⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_viewa.s

📁 用于在ICC上使用的ATMEL 128处理器的ucos2.81版本的移植文件以及相关例子。还包含uCOSView 和 EvalBoards
💻 S
字号:
;********************************************************************************************************
;                                              uC/OS-View
;
;                               (c) Copyright 2006, Micrium, Inc., Weston, FL
;                                           All Rights Reserved
;
;                                               Atmel AVR
;                                               ATmega128
;
; File : OS_VIEWa.ASM
; By   : Jean J. Labrosse 
;********************************************************************************************************

                .include  "os_cpu_i.h"
                .area     text(rel)

;**********************************************************************************************
;*                                  uC/OS-View COM Rx ISR
;*                                 void OSView_RxISR(void)
;*
;* Description: This function is invoked when a character is received from the serial port
;*
;* Arguments  : none
;*
;* Note(s)    : 1) Pseudo code:
;*
;*                 Save all registers
;*                 OSIntNesting++
;*                 if (OSIntNesting == 1) {
;*                     OSTCBCur->OSTCBStkPtr = SP
;*                 }
;*                 OSView_RxHandler();
;*                 OSIntExit();
;*                 Restore all registers
;*                 Return from interrupt;
;**********************************************************************************************


                .area   text(rel)

_OSView_RxISR::

                PUSH_ALL                            ; Save all registers and status register
                IN      R16,SREG                    ; Save the SREG but with interrupts enabled
                SBR     R16,BIT07                    
                ST      -Y,R16
                PUSH_SP                             ; Save the task's hardware stack pointer onto task's stack

                LDS     R16,_OSIntNesting           ; Notify uC/OS-II of ISR
                INC     R16                         ;
                STS     _OSIntNesting,R16           ;

                CPI     R16,1                       ; if (OSIntNesting == 1) {
                BRNE    OSView_RxISR_1

                LDS     R30,_OSTCBCur               ;     OSTCBCur->OSTCBStkPtr = Y
                LDS     R31,_OSTCBCur+1
                ST      Z+,R28
                ST      Z+,R29                      ; }

OSView_RxISR_1:

                CALL    _OSView_RxISRHandler        ; Call uC/OS-View's Rx ISR Handler
                CALL    _OSIntExit                  ; Notify uC/OS-II about end of ISR

                POP_SP                              ; Restore the hardware stack pointer from task's stack
                POP_SREG_INT                        ; Restore the SREG register
                POP_ALL                             ; Restore all registers

                RETI


;**********************************************************************************************
;*                                  uC/OS-View COM Rx ISR
;*                                void OSView_RxTxISR(void)
;*
;* Description: This function is invoked when either a character is received or transmitted.
;*              However, the M16C issues a separate ISR is issued for Rx and Tx and thus, this
;*              ISR should not be invoked.
;*
;* Arguments  : none
;*
;* Note(s)    : 1) Pseudo code:
;*
;*                 Save all registers
;*                 OSIntNesting++
;*                 if (OSIntNesting == 1) {
;*                     OSTCBCur->OSTCBStkPtr = SP
;*                 }
;*                 OSView_RxHandler();
;*                 OSIntExit();
;*                 Restore all registers
;*                 Return from interrupt;
;*
;*              2) This function is not used by the M16C because a separate ISR is issued for
;*                 Rx and Tx.
;**********************************************************************************************

    .EVEN

_OSView_RxTxISR::

                PUSH_ALL                            ; Save all registers and status register
                IN      R16,SREG                    ; Save the SREG but with interrupts enabled
                SBR     R16,BIT07                    
                ST      -Y,R16
                PUSH_SP                             ; Save the task's hardware stack pointer onto task's stack

                LDS     R16,_OSIntNesting           ; Notify uC/OS-II of ISR
                INC     R16                         ;
                STS     _OSIntNesting,R16           ;

                CPI     R16,1                       ; if (OSIntNesting == 1) {
                BRNE    OSView_RxTxISR_1

                LDS     R30,_OSTCBCur               ;     OSTCBCur->OSTCBStkPtr = Y
                LDS     R31,_OSTCBCur+1
                ST      Z+,R28
                ST      Z+,R29                      ; }

OSView_RxTxISR_1:

                CALL    _OSView_RxTxISRHandler      ; Call uC/OS-View's Rx/Tx ISR Handler
                CALL    _OSIntExit                  ; Notify uC/OS-II about end of ISR

                POP_SP                              ; Restore the hardware stack pointer from task's stack
                POP_SREG_INT                        ; Restore the SREG register
                POP_ALL                             ; Restore all registers

                RETI


;**********************************************************************************************
;*                                  uC/OS-View COM Tx ISR
;*                                 void OSView_TxISR(void)
;*
;* Description: This function is invoked when a character has been transmitted to the serial port
;*
;* Arguments  : none
;*
;* Note(s)    : 1) Pseudo code:
;*
;*                 Save all registers
;*                 OSIntNesting++
;*                 if (OSIntNesting == 1) {
;*                     OSTCBCur->OSTCBStkPtr = SP
;*                 }
;*                 OSView_TxHandler();
;*                 OSIntExit();
;*                 Restore all registers
;*                 Return from interrupt;
;**********************************************************************************************

    .EVEN

_OSView_TxISR::

                PUSH_ALL                            ; Save all registers and status register
                IN      R16,SREG                    ; Save the SREG but with interrupts enabled
                SBR     R16,BIT07                    
                ST      -Y,R16
                PUSH_SP                             ; Save the task's hardware stack pointer onto task's stack

                LDS     R16,_OSIntNesting           ; Notify uC/OS-II of ISR
                INC     R16                         ;
                STS     _OSIntNesting,R16           ;

                CPI     R16,1                       ; if (OSIntNesting == 1) {
                BRNE    OSView_TxISR_1

                LDS     R30,_OSTCBCur               ;     OSTCBCur->OSTCBStkPtr = Y
                LDS     R31,_OSTCBCur+1
                ST      Z+,R28
                ST      Z+,R29                      ; }

OSView_TxISR_1:

                CALL    _OSView_TxISRHandler        ; Call uC/OS-View's Tx ISR Handler
                CALL    _OSIntExit                  ; Notify uC/OS-II about end of ISR

                POP_SP                              ; Restore the hardware stack pointer from task's stack
                POP_SREG_INT                        ; Restore the SREG register
                POP_ALL                             ; Restore all registers

                RETI


;**********************************************************************************************
;*                                  INTERRUPT VECTOR TABLE
;**********************************************************************************************

                .area   OSView_ISR_Vectors(abs)
                .org    18*4                        ; Rx ISR, Assume UART 0
                JMP     _OSView_RxISR

                .org    20*4                        ; Tx ISR, Assume UART 0
                JMP     _OSView_TxISR

                .org    30*4                        ; Rx ISR, Assume UART 1
                JMP     _OSView_RxISR

                .org    32*4                        ; Tx ISR, Assume UART 1
                JMP     _OSView_TxISR

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -