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

📄 os_viewa.s

📁 uCOS在PIC芯片中的移植:以PIC24HJ64GP210为例进行uCOS在Microchip芯片中的移植
💻 S
字号:
;
;********************************************************************************************************
;                                               uC/OS-II
;                                         The Real-Time Kernel
;
;                         (c) Copyright 2002, Jean J. Labrosse, Weston, FL
;                                          All Rights Reserved
;
;
;                                  PIC24FJ MPLab uC/OS-View Port
;                                                 
;
; File         : OS_VIEWa.S
; By           : Eric Shufro
;********************************************************************************************************
;

;
;********************************************************************************************************
;                                                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 __U2RXInterrupt
    .global __U2TXInterrupt

;
;********************************************************************************************************
;                                            U2RXInterrupt
;
; Description : This function is the UART2 Rx Interrupt Service Routine
;
; Notes       : All user interrupts should be defined as shown below.
;********************************************************************************************************
;

__U2RXInterrupt:
    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, U2RXCont    
    mov _OSTCBCur, w0
    mov w15, [w0]    

U2RXCont:  
    BCLR  IFS1, #U2RXIF                                                 ; 4) Clear the interrupt source
    
    call _OSView_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

;
;********************************************************************************************************
;                                            U2TXInterrupt
;
; Description : This function is the UART2 Tx Interrupt Service Routine
;
; Notes       : All user interrupts should be defined as shown below.
;********************************************************************************************************
;

__U2TXInterrupt:
    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, U2TXCont    
    mov _OSTCBCur, w0
    mov w15, [w0]    

U2TXCont:  
    BCLR  IFS1, #U2TXIF                                                 ; 4) Clear the interrupt source
    
    call _OSView_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

⌨️ 快捷键说明

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