isrshell.s79

来自「IAR 开发环境的Cirrus Logic的例程」· S79 代码 · 共 92 行

S79
92
字号
;*****************************************************************************
;
; ISRSHELL.S - Assembly shell around the C IRQ and FIQ handlers
;
; Copyright (c) 1998-1999 Cirrus Logic, Inc.
;
;*****************************************************************************

        IMPORT IRQHandler
        IMPORT pfnOldIRQ
        IMPORT FIQHandler
        IMPORT pfnOldFIQ

#ifdef __IAR_SYSTEMS_ASM__
	RSEG	ICODE:CODE:NOROOT(2)
	CODE32
#else
        AREA |C$$code|, CODE
#endif

;*****************************************************************************
;
; IRQShell is a wrapper around the IRQ handler.  It saves registers to the
; stack, calls the C IRQ handler, and chains to the original IRQ handler.
;
;*****************************************************************************
        EXPORT IRQShell
IRQShell

        ;
        ; Save any registers which are not saved by APCS.
        ;
        stmdb   r13!, {r0}
        stmdb   r13!, {r1-r3, r9-r12, r14}

        ;
        ; Call the C IRQ handler.
        ;
        bl      IRQHandler

        ;
        ; Restore the saved registers (except for r0).
        ;
        ldmia   r13!, {r1-r3, r9-r12, r14}

        ;
        ; Branch to the original IRQ handler, being careful to make sure that
        ; registers r0-r14 all have the same values as when this routine was
        ; called.
        ;
        ldr     r0, =pfnOldIRQ
        ldr     r0, [r0, #0]
        swp     r0, r0, [r13]
        ldmia   r13!, {pc}

;*****************************************************************************
;
; FIQShell is a wrapper around the FIQ handler.  It saves registers to the
; stack, calls the C FIQ handler, and chains to the original FIQ handler.
;
;*****************************************************************************
        EXPORT FIQShell
FIQShell

        ;
        ; Save any registers which are not saved by APCS.
        ;
        stmdb   r13!, {r0}
        stmdb   r13!, {r1-r3, r9-r12, r14}

        ;
        ; Call the C FIQ handler.
        ;
        bl      FIQHandler

        ;
        ; Restore the saved registers (except for r0).
        ;
        ldmia   r13!, {r1-r3, r9-r12, r14}

        ;
        ; Branch to the original FIQ handler, being careful to make sure that
        ; registers r0-r14 all have the same values as when this routine was
        ; called.
        ;
        ldr     r0, =pfnOldFIQ
        ldr     r0, [r0, #0]
        swp     r0, r0, [r13]
        ldmia   r13!, {pc}

        END

⌨️ 快捷键说明

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