📄 mass.s
字号:
;
;********************************************************************************************************
; uC/OS-II
; The Real-Time Kernel
;
; PIC24HJ MPLab uC/OS-View Port
;
;
; File : Mass.S
; By : tbh
;********************************************************************************************************
;
;
;********************************************************************************************************
; CONSTANTS
;********************************************************************************************************
;
.equ __24HJ64GP210, 1 ; Inform the p24FJ128GA010 header file that we are using a p24FJ128GA010
;
;********************************************************************************************************
; INCLUDES
;********************************************************************************************************
;
.include "p24HJ64GP210.inc" ;//tbh080510 Include assembly equates for various CPU registers and bit masks
.include "os_cpu_util_a.s" ; Include an assembly utility files with macros for saving and restoring the CPU registers
;
;********************************************************************************************************
; LINKER SPECIFICS
;********************************************************************************************************
;
.text ; Locate this file in the text region of the build
;
;********************************************************************************************************
; GLOBALS AND EXTERNALS
;********************************************************************************************************
;
.global __T1Interrupt
.global __T2Interrupt
.global __T3Interrupt
.global __T7Interrupt
.global __U1RXInterrupt
.global __U1TXInterrupt
.global __ADC1Interrupt
.global __DMA0Interrupt
.global __IC1Interrupt
.global __IC2Interrupt
.global __IC3Interrupt
.global __IC4Interrupt
.global __IC5Interrupt
.global __IC6Interrupt
.global __IC7Interrupt
.global __IC8Interrupt
.global __CNInterrupt
;********************************************************************************************************
; Timer1 ISR Handler
;
;
; Notes : All user interrupts should be defined as follows.
;********************************************************************************************************
;
__T1Interrupt:
OS_REGS_SAVE ; 1) Save processor registers
inc.b _OSIntNesting ; 2) Call OSIntEnter() or increment OSIntNesting
dec.b _OSIntNesting, wreg ; 3) Check OSIntNesting. if OSIntNesting == 1, then save the stack pointer, otherwise jump to T2_Cont
bra nz, T1_Cont
mov _OSTCBCur, w0
mov w15, [w0]
T1_Cont:
BCLR IFS0, #T1IF ; 4) Clear the interrupt source
call _Timer1_ISR_Handler ; 5) Call YOUR ISR Handler (May be a C function). In this case, the OS Tick ISR Handler
call _OSIntExit ; 6) Call OSIntExit() or decrement 1 from OSIntNesting
OS_REGS_RESTORE ; 7) Restore registers
retfie
; 8) Return from interrupt
;
;********************************************************************************************************
; OS Time Tick ISR Handler
;
; Description : This function services the OS Time Tick Interrupt when configured using Timer #2
;
; Notes : All user interrupts should be defined as follows.
;********************************************************************************************************
;
__T2Interrupt:
OS_REGS_SAVE ; 1) Save processor registers
inc.b _OSIntNesting ; 2) Call OSIntEnter() or increment OSIntNesting
dec.b _OSIntNesting, wreg ; 3) Check OSIntNesting. if OSIntNesting == 1, then save the stack pointer, otherwise jump to T2_Cont
bra nz, T2_Cont
mov _OSTCBCur, w0
mov w15, [w0]
T2_Cont:
BCLR IFS0, #T2IF ; 4) Clear the interrupt source
call _Timer2_ISR_Handler ; 5) Call YOUR ISR Handler (May be a C function). In this case, the OS Tick ISR Handler
call _OSIntExit ; 6) Call OSIntExit() or decrement 1 from OSIntNesting
OS_REGS_RESTORE ; 7) Restore registers
retfie ; 8) Return from interrupt
;********************************************************************************************************
; Timer3 ISR Handler
;
;
; Notes : All user interrupts should be defined as follows.
;********************************************************************************************************
;
__T3Interrupt:
OS_REGS_SAVE ; 1) Save processor registers
inc.b _OSIntNesting ; 2) Call OSIntEnter() or increment OSIntNesting
dec.b _OSIntNesting, wreg ; 3) Check OSIntNesting. if OSIntNesting == 1, then save the stack pointer, otherwise jump to T2_Cont
bra nz, T3_Cont
mov _OSTCBCur, w0
mov w15, [w0]
T3_Cont:
BCLR IFS0, #T3IF ; 4) Clear the interrupt source
call _Timer3_ISR_Handler ; 5) Call YOUR ISR Handler (May be a C function). In this case, the OS Tick ISR Handler
call _OSIntExit ; 6) Call OSIntExit() or decrement 1 from OSIntNesting
OS_REGS_RESTORE ; 7) Restore registers
retfie ; 8) Return from interrupt
;********************************************************************************************************
; Timer7 ISR Handler
;
;
; Notes : All user interrupts should be defined as follows.
;********************************************************************************************************
;
__T7Interrupt:
OS_REGS_SAVE ; 1) Save processor registers
inc.b _OSIntNesting ; 2) Call OSIntEnter() or increment OSIntNesting
dec.b _OSIntNesting, wreg ; 3) Check OSIntNesting. if OSIntNesting == 1, then save the stack pointer, otherwise jump to T2_Cont
bra nz, T7_Cont
mov _OSTCBCur, w0
mov w15, [w0]
T7_Cont:
BCLR IFS3, #T7IF ; 4) Clear the interrupt source
call _Timer7_ISR_Handler ; 5) Call YOUR ISR Handler (May be a C function). In this case, the OS Tick ISR Handler
call _OSIntExit ; 6) Call OSIntExit() or decrement 1 from OSIntNesting
OS_REGS_RESTORE ; 7) Restore registers
retfie ; 8) Return from interrupt
;
;********************************************************************************************************
; U1RXInterrupt
;
; Description : This function is the UART1 Rx Interrupt Service Routine
;
; Notes : All user interrupts should be defined as shown below.
;********************************************************************************************************
;
__U1RXInterrupt:
OS_REGS_SAVE ; 1) Save processor registers
inc.b _OSIntNesting ; 2) Call OSIntEnter() or increment OSIntNesting
dec.b _OSIntNesting, wreg ; 3) Check OSIntNesting. if OSIntNesting == 1, then save the stack pointer, otherwise jump to T2_Cont
bra nz, U1RXCont
mov _OSTCBCur, w0
mov w15, [w0]
U1RXCont:
BCLR IFS0, #U1RXIF ; 4) Clear the interrupt source
call _Mass_RxISRHandler ; 5) Call YOUR ISR Handler (May be a C function). In this case, the OSView Rx ISR Handler
call _OSIntExit ; 6) Call OSIntExit() or decrement 1 from OSIntNesting
OS_REGS_RESTORE ; 7) Restore registers
retfie ; 8) Return from interrupt
;
;********************************************************************************************************
; U1TXInterrupt
;
; Description : This function is the UART1 Tx Interrupt Service Routine
;
; Notes : All user interrupts should be defined as shown below.
;********************************************************************************************************
;
__U1TXInterrupt:
OS_REGS_SAVE ; 1) Save processor registers
inc.b _OSIntNesting ; 2) Call OSIntEnter() or increment OSIntNesting
dec.b _OSIntNesting, wreg ; 3) Check OSIntNesting. if OSIntNesting == 1, then save the stack pointer, otherwise jump to T2_Cont
bra nz, U1TXCont
mov _OSTCBCur, w0
mov w15, [w0]
U1TXCont:
BCLR IFS0, #U1TXIF ; 4) Clear the interrupt source
call _Mass_TxISRHandler ; 5) Call YOUR ISR Handler (May be a C function). In this case, the OSView Tx ISR Handler
call _OSIntExit ; 6) Call OSIntExit() or decrement 1 from OSIntNesting
OS_REGS_RESTORE ; 7) Restore registers
retfie ; 8) Return from interrupt
;
;********************************************************************************************************
; ADC1Interrupt
;
; Description : This function is the ADC1 Interrupt Service Routine
;
; Notes : All user interrupts should be defined as shown below.
;********************************************************************************************************
;
__ADC1Interrupt:
OS_REGS_SAVE ; 1) Save processor registers
inc.b _OSIntNesting ; 2) Call OSIntEnter() or increment OSIntNesting
dec.b _OSIntNesting, wreg ; 3) Check OSIntNesting. if OSIntNesting == 1, then save the stack pointer, otherwise jump to T2_Cont
bra nz, ADC1Cont
mov _OSTCBCur, w0
mov w15, [w0]
ADC1Cont:
BCLR IFS0, #AD1IF ; 4) Clear the interrupt source
call _Mass_ADC1ISRHandler ; 5) Call YOUR ISR Handler (May be a C function). In this case, the OSView Tx ISR Handler
call _OSIntExit ; 6) Call OSIntExit() or decrement 1 from OSIntNesting
OS_REGS_RESTORE ; 7) Restore registers
retfie ; 8) Return from interrupt
;
;********************************************************************************************************
; DMA0Interrupt
;
; Description : This function is the DMA0 Interrupt Service Routine
;
; Notes : All user interrupts should be defined as shown below.
;********************************************************************************************************
;
__DMA0Interrupt:
OS_REGS_SAVE ; 1) Save processor registers
inc.b _OSIntNesting ; 2) Call OSIntEnter() or increment OSIntNesting
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -