?? os_cpu_a._s
字號:
;********************************************************************************************************
; uC/OS-Bms
;
; (c) Copyright 2006, Micrium, Inc., Weston, FL
; All Rights Reserved
;
; Atmel AVR
; ATmega128
;
; File : OS_Bms_a.ASM
; By : Jean J. Labrosse
; Version : GX_EVBMS_S_V1.0
;********************************************************************************************************
.include "..\source\CPU_source\os_cpu_a.h"
.area text(rel)
;******************************************************************************
; SYSTEM TICK ISR
;
; Description: This function is the ISR used to notify uC/OS-II that a system
; tick has occurred.
;
;
;*******************************************************************************
;
_OSTickISR::
PUSHRS ; save all registers
IN R16, SREG
SBR R16, 0x80 ; bei Aufruf dieser ISR geloeschtes I-Flag setzen
ST -Y, R16
PUSHSP
LDI R16,0x05 ; Reload TC0, 0.5ms/4MHz/8
OUT TCNT0,R16
LDS R16,_OSIntNesting ; Notify uC/OS-II of ISR
INC R16 ;
STS _OSIntNesting,R16 ;
CPI R16,1 ;if(OSIntNesting==1){
BRNE OSTickISR_1
LDS R30,_OSTCBCur
LDS R31,_OSTCBCur+1 ;OSTCBCur->OSTCBStkPtr=Y;
ST Z+,R28
ST Z+,R29 ;}
OSTickISR_1:
CALL _OSTickISR_Handler ; Call uC/OS-II's tick updating function
CALL _OSIntExit ; Notify uC/OS-II about end of ISR
POPSP
POPSREG ; restore SREG
POPRS ; restore all registers
RETI ; Note: RET instead of RETI
;*******************************************************************************
;
;*******************************************************************************
;**********************************************************************************************
;* uC/OS-Bms ADC ISR
;* void OSBms_AdcISR(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_AdcHandler();
;* OSIntExit();
;* Restore all registers
;* Return from interrupt;
;**********************************************************************************************
.area text(rel)
_OSBms_AdcISR::
PUSHRS ; Save all registers and status register
IN R16,SREG ; Save the SREG but with interrupts enabled
SBR R16,BIT07
ST -Y,R16
PUSHSP ; 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 OSBms_AdcISR_1
LDS R30,_OSTCBCur ; OSTCBCur->OSTCBStkPtr = Y
LDS R31,_OSTCBCur+1
ST Z+,R28
ST Z+,R29 ; }
OSBms_AdcISR_1:
CALL _OSBms_AdcISRHandler ; Call uC/OS-Bms's Adc ISR Handler
CALL _OSIntExit ; Notify uC/OS-II about end of ISR
POPSP ; Restore the hardware stack pointer from task's stack
POPSREG ; Restore the SREG register
POPRS ; Restore all registers
RETI
;**********************************************************************************************
;* uC/OS-Bms COM Rx ISR
;* void OSBms_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)
_OSBms_RxISR::
PUSHRS ; Save all registers and status register
IN R16,SREG ; Save the SREG but with interrupts enabled
SBR R16,BIT07
ST -Y,R16
PUSHSP ; 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 OSBms_RxISR_1
LDS R30,_OSTCBCur ; OSTCBCur->OSTCBStkPtr = Y
LDS R31,_OSTCBCur+1
ST Z+,R28
ST Z+,R29 ; }
OSBms_RxISR_1:
CALL _OSBms_RxISRHandler ; Call uC/OS-Bms's Rx ISR Handler
CALL _OSIntExit ; Notify uC/OS-II about end of ISR
POPSP ; Restore the hardware stack pointer from task's stack
POPSREG ; Restore the SREG register
POPRS ; Restore all registers
RETI
;**********************************************************************************************
;* uC/OS-Bms COM Tx ISR
;* void OSBms_UDREISR(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;
;**********************************************************************************************
_OSBms_UDREISR::
PUSHRS ; Save all registers and status register
IN R16,SREG ; Save the SREG but with interrupts enabled
SBR R16,BIT07
ST -Y,R16
PUSHSP ; 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 OSBms_UDREISR_1
LDS R30,_OSTCBCur ; OSTCBCur->OSTCBStkPtr = Y
LDS R31,_OSTCBCur+1
ST Z+,R28
ST Z+,R29 ; }
OSBms_UDREISR_1:
CALL _OSBms_UDREISRHandler ; Call uC/OS-Bms's UDR empty ISR Handler
CALL _OSIntExit ; Notify uC/OS-II about end of ISR
POPSP ; Restore the hardware stack pointer from task's stack
POPSREG ; Restore the SREG register
POPRS ; Restore all registers
RETI
;**********************************************************************************************
;* INTERRUPT VECTOR TABLE
;**********************************************************************************************
.area OSBms_ISR_Vectors(abs)
.org 9*4 ;Timer0 ISR
JMP _OSTickISR
.org 14*4 ;ADC ISR
JMP _OSBms_AdcISR
.org 11*4 ; Rx ISR, Assume UART
JMP _OSBms_RxISR
.org 13*4
JMP _OSBms_UDREISR ;UDR empty ,assume uart
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -