下面是我写的IRQ_Handler程序。
EXPORT IRQ_Handler
IMPORT Fake_Interrupt ,WEAK
IMPORT Int1_Interrupt ,WEAK
IMPORT Int2_Interrupt ,WEAK
IMPORT Int3_Interrupt ,WEAK
IMPORT Int4_Interrupt ,WEAK
IMPORT Int5_Interrupt ,WEAK
IMPORT Int6_Interrupt ,WEAK
IMPORT Int7_Interrupt ,WEAK
IMPORT Int8_Interrupt ,WEAK
IMPORT Int9_Interrupt ,WEAK
IMPORT Int10_Interrupt ,WEAK
IMPORT Int11_Interrupt ,WEAK
IMPORT Int12_Interrupt ,WEAK
IMPORT Int13_Interrupt ,WEAK
IMPORT Int14_Interrupt ,WEAK
IMPORT Int15_Interrupt ,WEAK
IMPORT Int16_Interrupt ,WEAK
IMPORT Int17_Interrupt ,WEAK
IMPORT Int18_Interrupt ,WEAK
IMPORT Int19_Interrupt ,WEAK
IMPORT Int20_Interrupt ,WEAK
IMPORT Int21_Interrupt ,WEAK
IMPORT Int22_Interrupt ,WEAK
IMPORT Int23_Interrupt ,WEAK
IMPORT Int24_Interrupt ,WEAK
IMPORT Int25_Interrupt ,WEAK
IMPORT Int26_Interrupt ,WEAK
IMPORT Int27_Interrupt ,WEAK
IMPORT Int28_Interrupt ,WEAK
IMPORT Int29_Interrupt ,WEAK
IMPORT Int30_Interrupt ,WEAK
IMPORT Int31_Interrupt ,WEAK
AIC_IPER EQU 0xFFF8210C
AREA IRQ , CODE ,READONLY
IRQ_Handler
SUB LR, LR, #4
STMFD SP!, {R0-R12, LR}
MSR CPSR_c, #0X9F ;// Switch to User module
LDR R2, =AICBase
LDR R3, =AIC_IPER
LDR R3,[R3]
LDR R1, [R2,R3] ; gets the highest pendingvector
LDR PC, [PC, R1] ; jump to correct handler
NOP
;table of handler start address
AICBase
DCD Fake_Interrupt
DCD Int1_Interrupt
DCD Int2_Interrupt
DCD Int3_Interrupt
DCD Int4_Interrupt
DCD Int5_Interrupt
DCD Int6_Interrupt
DCD Int7_Interrupt
DCD Int8_Interrupt
DCD Int9_Interrupt
DCD Int10_Interrupt
DCD Int11_Interrupt
DCD Int12_Interrupt
DCD Int13_Interrupt
DCD Int14_Interrupt
DCD Int15_Interrupt
DCD Int16_Interrupt
DCD Int17_Interrupt
DCD Int18_Interrupt
DCD Int19_Interrupt
DCD Int20_Interrupt
DCD Int21_Interrupt
DCD Int22_Interrupt
DCD Int23_Interrupt
DCD Int24_Interrupt
DCD Int25_Interrupt
DCD Int26_Interrupt
DCD Int27_Interrupt
DCD Int28_Interrupt
DCD Int29_Interrupt
DCD Int30_Interrupt
DCD Int31_Interrupt
rAIC_EOSCR = 0;
MSR CPSR_c, #0X92 ;// Switch to IRQ module
LDMFD SP!, {R0-R12, PC}^
END
这些是在IQR_Handler里面的,而Int1_Interrupt ~Int31_Interrupt是准备用C语言实现的中断函数。比如
void Int1_Interrupt(void)
{
}
请大家找出错误与不合理之处。万分感激 |