?? os_viewa.s90
字號:
;********************************************************************************************************
; uC/OS-View
;
; (c) Copyright 2005, Micrium, Inc., Weston, FL
; All Rights Reserved
;
; Atmel AVR
; ATmega128
;
; File : OS_VIEWa.S90
; By : Jean J. Labrosse
;********************************************************************************************************
#include <os_cpu_i.s90>
#include <app_cfg.h>
#include <os_cfg.h>
#if OS_VIEW_MODULE > 0
MODULE OS_VIEW_A
PUBLIC OSView_RxISR
PUBLIC OSView_RxTxISR
PUBLIC OSView_TxISR
;********************************************************************************************************
; EXTERNAL DECLARATIONS
;********************************************************************************************************
EXTERN OSIntExit
EXTERN OSIntNesting
EXTERN OSTCBCur
EXTERN OSView_RxISRHandler
EXTERN OSView_RxTxISRHandler
EXTERN OSView_TxISRHandler
;**********************************************************************************************
;* 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;
;**********************************************************************************************
RSEG CODE:CODE:NOROOT(1)
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 tick Handler written in C
CALL OSIntExit ; Notify uC/OS-II about end of ISR
POP_SP ; Restore the hardware stack pointer from task's stack
POP_SREG_INT
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 AVR 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.
;**********************************************************************************************
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 tick Handler written in C
CALL OSIntExit ; Notify uC/OS-II about end of ISR
POP_SP ; Restore the hardware stack pointer from task's stack
POP_SREG_INT
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;
;**********************************************************************************************
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 tick Handler written in C
CALL OSIntExit ; Notify uC/OS-II about end of ISR
POP_SP ; Restore the hardware stack pointer from task's stack
POP_SREG_INT
POP_ALL ; Restore all registers
RETI
#endif
END
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -