📄 app_isr.s
字号:
;********************************************************************************************************
; uC/OS-II
; The Real-Time Kernel
;
; ATmega128 Specific code
;
;
; File : APP_ISR.S
; By : Jean J. Labrosse
;********************************************************************************************************
.include "os_cpu_i.h"
;/*$PAGE*/.
;********************************************************************************************************
; SYSTEM TICK ISR
;
; Description : This function is the Tick ISR.
;
; The following C-like pseudo-code describe the operation being performed in the code below.
;
; Save all registers on the current task's stack:
; Use the PUSH_ALL macro
; Get the SREG, set Bit #7 and save onto the task's stack using -Y addressing
; Use the PUSH_SP macro to save the task's hardware stack pointer onto the current task's stack
; OSIntNesting++;
; if (OSIntNesting == 1) {
; OSTCBCur->OSTCBStkPtr = SP
; }
; Clear the interrupt; Not needed for the timer we used.
; OSTimeTick(); Notify uC/OS-II that a tick has occured
; OSIntExit(); Notify uC/OS-II about end of ISR
; Restore all registers that were save on the current task's stack:
; Use the POP_SP macro to restore the task's hardware stack pointer
; Use the POP_SREG macro to restore the SREG register
; Use the POP_ALL macro to restore the remaining registers
; Return from interrupt
;********************************************************************************************************
.area text(rel)
_BSP_TickISR::
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 BSP_TickISR_1
LDS R30,_OSTCBCur ; OSTCBCur->OSTCBStkPtr = Y
LDS R31,_OSTCBCur+1
ST Z+,R28
ST Z+,R29 ; }
BSP_TickISR_1:
CALL _BSP_TickISR_Handler ; Handle the tick ISR
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -