S3C2410中断详解
bResetHandler
bHandlerUndef;handler for Undefined mode
bHandlerSWI;handler for SWI interrupt
bHandlerPabort;handler for PAbort
bHandlerDabort;handler for DAbort
b.;reserved
bHandlerIRQ;handler for IRQ interrupt
bHandlerFIQ;handler for FIQ interrupt
跳转的标号是一系列的宏
LTORG
HandlerFIQ HANDLER HandleFIQ
HandlerIRQ HANDLER HandleIRQ
HandlerUndef HANDLER HandleUndef
HandlerSWI HANDLER HandleSWI
HandlerDabort HANDLER HandleDabort
HandlerPabort HANDLER HandlePabort
该宏在文件的最前面实现,做了一些跳转前的处理。如下:
MACRO
$HandlerLabel HANDLER $HandleLabel
$HandlerLabel
subsp,sp,#4 ;decrement sp(to store jump address)
stmfdsp!,{r0} ;PUSH the work register to stack(lr doest push because it return to original address)
ldr r0,=$HandleLabel;load the address of HandleXXX to r0
ldr r0,[r0] ;load the contents(service routine start address) of HandleXXX
str r0,[sp,#4] ;store the contents(ISR) of HandleXXX to stack
ldmfd sp!,{r0,pc} ;POP the work register and pc(jump to ISR)
MEND
以HandleIRQ跳转为例说明中断的二级跳转流程,以上的宏代码说明IRQ跳转到了标号HandleIRQ处,该标号如下定义:(是一系列的中断以及二级中断入口地址)
AREA RamData, DA
^ _ISR_STARTADDRESS ;(该值自己定义,是存放中断向量表的地址)
HandleReset # 4
HandleUndef # 4
HandleSWI # 4
HandlePabort # 4
HandleDabort # 4
HandleReserved # 4
HandleIRQ # 4
HandleFIQ # 4
;Dont use the label IntVectorTable,
;The value of IntVectorTable is different with the address you think it may be.
;IntVectorTable(二级IRQ中断向量表)
HandleEINT0 # 4
HandleEINT1 # 4
HandleEINT2 # 4
HandleEINT3 # 4
HandleEINT4_7# 4
HandleEINT8_23# 4
HandleRSV6# 4
HandleBATFLT # 4
HandleTICK # 4
HandleWDT# 4
HandleTIMER0 # 4
HandleTIMER1 # 4
HandleTIMER2 # 4
HandleTIMER3 # 4
HandleTIMER4 # 4
HandleUART2 # 4
HandleLCD # 4
HandleDMA0# 4
HandleDMA1# 4
HandleDMA2# 4
HandleDMA3# 4
HandleMMC# 4
HandleSPI0# 4
HandleUART1# 4
HandleRSV24# 4
HandleUSBD# 4
HandleUSBH# 4
HandleIIC # 4
HandleUART0 # 4
HandleSPI1 # 4
HandleRTC # 4
HandleADC # 4
而HandleIRQ由以下代码赋值,可以看出跳转到了IsrIRQ:
drr0,=HandleIRQ ;This routine is needed
ldrr1,=IsrIRQ ;if there isnt subs pc,lr,#4 at 0x18, 0x1c放置中断跳转
strr1,[r0]
IsrIRQ ;真正的IRQ中断的入口
subsp,sp,#4 ;reserved for PC留出一个位置保存中断入口地址
stmfdsp!,{r8-r9}
ldrr9,=INTOFFSET
ldrr9,[r9] ;读入中断偏移码
ldrr8,=HandleEINT0 ;二级跳转表的首地址
addr8,r8,r9,lsl #2 ;R8=R8+R9X4得到相应的中断入口地址
ldrr8,[r8]
strr8,[sp,#8] ;中断入口地址送进SP(第一个代码留出的4字节空间)
ldmfdsp!,{r8-r9,pc}
到此为止,中断已经顺利的进入了中断向量表,用C语言编写服务程序已变的非常简单。如EINT0中断的ISR
void Eint0(void)
{ }
pISR_EINT0=(U32)Eint0; //用中断入口指向函数指针即可。
S3C2410中断详 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)