?? irq.s
字號:
;********************************************************************************************************/
NoInt EQU 0x80
USR32Mode EQU 0x10
SVC32Mode EQU 0x13
SYS32Mode EQU 0x1f
IRQ32Mode EQU 0x12
FIQ32Mode EQU 0x11
CODE32
PRESERVE8
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.保存SPSR和用戶狀態的SP,注意不能回寫
; If the SP is written back, it should be adjusted to its appropriate value later.如果回寫的是用戶的SP,所以后面要調整SP
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 調用c語言的中斷處理程序
MSR CPSR_c, #(NoInt | IRQ32Mode) ; Switch bak to IRQ mode 切換回irq模式
LDMFD SP, {R3,LR}^ ; Recover SPSR and SP in user status, Notic: DO NOT write back. 恢復SPSR和用戶狀態的SP,注意不能回寫
; If the SP is written back, it should be adjusted to its appropriate value later.如果回寫的是用戶的SP,所以后面要調整SP
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
;/*********************************************************************************************************
;** End Of File
;********************************************************************************************************/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -