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

📄 irq.s

📁 LPC21XX系列开发板测试原代码,包括IIC RTC BEEZ UART等基础实验
💻 S
字号:
;/*******************************************************************************************************
;**                                     西安傅立叶电子科技
;**                                Xian FFT Electornic Technology
;**                                   http://www.fftchina.com
;********************************************************************************************************/

;// The irq handle that what allow the interrupt nesting. 

NoInt       EQU 0x80

USR32Mode   EQU 0x10
SVC32Mode   EQU 0x13
SYS32Mode   EQU 0x1f
IRQ32Mode   EQU 0x12
FIQ32Mode   EQU 0x11

    CODE32

    AREA    IRQ,CODE,READONLY

    MACRO
$IRQ_Label HANDLER $IRQ_Exception_Function

        EXPORT  $IRQ_Label                      ; The label for exports
        IMPORT  $IRQ_Exception_Function         ; The imported labels

$IRQ_Label
        SUB     LR, LR, #4                      ; Calculate the returning address
        STMFD   SP!, {R0-R3, R12, LR}           ; Protects the task environments
        MRS     R3, SPSR                        ; Protects the status variable
        STMFD   SP, {R3,LR}^                    ; Protects SPSR and SP in user status, Notice: DO NOT write back.
                                                ; If the SP is written back, it should be adjusted to its appropriate value later.
        NOP
        SUB     SP, SP, #4*2

        MSR     CPSR_c, #(NoInt | SYS32Mode)    ; Switch to the System Mode
       
        BL      $IRQ_Exception_Function         ; call the C interrupt handler funtion

        MSR     CPSR_c, #(NoInt | IRQ32Mode)    ; Switch bak to IRQ mode
        LDMFD   SP, {R3,LR}^                    ; Recover SPSR and SP in user status, Notic: DO NOT write back.
                                                ; If the SP is written back, it should be adjusted to its appropriate value later.
        MSR     SPSR_cxsf, R3
        ADD     SP, SP, #4*2                    ; 

        LDMFD   SP!, {R0-R3, R12, PC}^          ;
    MEND

;/* Add interrupt handler here,user could change it as needed */

;Timer0_Handler  HANDLER Timer0

    END

⌨️ 快捷键说明

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