📄 irq_handler.asm
字号:
/*----------------------------------------------------------------------
; $Workfile: irq_handler.s $
; $Revision: 1.0 $
; $Author: AnvikE $
; $Date: Jul 03 2003 17:32:14 $
;
; Project:
;
; Description:
;
;-----------------------------------------------------------------------
;
; Copyright (c) 2002,2003 Sharp Microelectronics of the Americas
;
; All rights reserved
;
; SHARP MICROELECTRONICS OF THE AMERICAS MAKES NO REPRESENTATION
; OR WARRANTIES WITH RESPECT TO THE PERFORMANCE OF THIS SOFTWARE,
; AND SPECIFICALLY DISCLAIMS ANY RESPONSIBILITY FOR ANY DAMAGES,
; SPECIAL OR CONSEQUENTIAL, CONNECTED WITH THE USE OF THIS SOFTWARE.
;
; SHARP MICROELECTRONICS OF THE AMERICAS PROVIDES THIS SOFTWARE SOLELY
; FOR THE PURPOSE OF SOFTWARE DEVELOPMENT INCORPORATING THE USE OF A
; SHARP MICROCONTROLLER OR SYSTEM-ON-CHIP PRODUCT. USE OF THIS SOURCE
; FILE IMPLIES ACCEPTANCE OF THESE CONDITIONS.
;
;---------------------------------------------------------------------*/
.GLOBAL __user_irq_handler
.EQU VIC_VECT_ADDR, 0xFFFFF030
.TEXT
.CODE 32
/*----------------------------------------------------------------------
; Function: __user_irq_handler
;
; Purpose: Handle IRQ exceptions
;
; Processing:
; 1. Save the current machine state
; 2. Load the VIC vector address into PC
; 3. Write to the VIC vector address register to signal end
; of interrupt
; 4. Restore the save machine state
;
; Parameters: None
;
; Outputs: None
;
; Returns: Nothing
;
; Notes:
;---------------------------------------------------------------------*/
__user_irq_handler:
/* Modify and save the lr so we return from where we were
interrupted. */
SUB lr, lr, #4
/* Push the required registers onto the stack */
STMFD sp!, {r0-r3,r10,r12,lr}
MRS r0, spsr
STMFD sp!, {r0}
__vic_jump:
LDR r0, =VIC_VECT_ADDR
MOV lr, pc
LDR pc, [r0]
/* control returns here after the ISR has executed
write to the VIC Vector Address register to signal
end-of-interrupt to the VIC */
LDR r0,=VIC_VECT_ADDR
MOV r1,#0
STR r1,[r0]
/* Pop the spsr off the stack */
LDMFD sp!, {r0}
MSR spsr_cf, r0
/* Pop the rest of the stack and return */
LDMFD sp!, {r0-r3,r10,r12,pc}^
.END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -