Detailed explanation of S3C2410 interrupt

Publisher:SereneVoyageLatest update time:2016-08-01 Source: eefocusKeywords:S3C2410 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
The initial code is familiar to everyone, the most basic interrupt jump

b ResetHandler

b HandlerUndef ;handler for Undefined mode
 b HandlerSWI ;handler for SWI interrupt
 b HandlerPabort ;handler for PAbort
 b HandlerDabort ;handler for DAbort
 b . ;reserved
 b HandlerIRQ ;handler for IRQ interrupt 
 b HandlerFIQ ;handler for FIQ interrupt

The jump label is a series of macros

LTORG   
HandlerFIQ HANDLER HandleFIQ
HandlerIRQ HANDLER HandleIRQ
HandlerUndef HANDLER HandleUndef
HandlerSWI HANDLER HandleSWI
HandlerDabort HANDLER HandleDabort
HandlerPabort HANDLER HandlePabort

This macro is implemented at the beginning of the file and does some pre-jump processing. As follows:

MACRO
$HandlerLabel HANDLER $HandleLabel

$HandlerLabel
 sub sp,sp,#4 ;decrement sp(to store jump address)
 stmfd sp!,{r0} ;PUSH the work register to stack(lr does't 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

Take HandleIRQ jump as an example to illustrate the secondary jump process of interrupt. The above macro code shows that IRQ jumps to the label HandleIRQ, which is defined as follows: (a series of interrupts and secondary interrupt entry addresses)

AREA RamData, DA TA, READWRITE

        ^ _ISR_STARTADDRESS; (This value is defined by yourself, it is the address of the interrupt vector table)
HandleReset # 4
HandleUndef # 4
HandleSWI # 4 HandlePabort #
4 HandleDabort
# 4
HandleReserved # 4
HandleIRQ # 4
HandleFIQ # 4

;Don't use the label 'IntVectorTable',
;The value of IntVectorTable is different with the address you think it may be.
;IntVectorTable (secondary IRQ interrupt vector table)
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 HandleDMA 3 # 4 HandleMMC # 4 HandleSPI0 # 4 HandleUART1 # 4 HandleRSV24 # 4 HandleUSBD # 4 HandleUSBH # 4 HandleIIC # 4 HandleUART0 # 4 HandleSPI1 # 4 HandleRTC # 4 HandleADC # 4




















And HandleIRQ is assigned by the following code, and it can be seen that it jumps to IsrIRQ:

dr r0,=HandleIRQ ;This routine is needed
 ldr r1,=IsrIRQ ;if there isn't 'subs pc,lr,#4' at 0x18, 0x1c place interrupt jump
 str r1,[r0]

IsrIRQ ;The real IRQ interrupt entry
 sub sp,sp,#4 ;reserved for PC to set aside a location to save the interrupt entry address
 stmfd sp!,{r8-r9}   
 
 ldr r9,=INTOFFSET
 ldr r9,[r9] ;Read the interrupt offset code
 ldr r8,=HandleEINT0 ;The first address of the secondary jump table
 add r8,r8,r9,lsl #2 ;R8=R8+R9X4 to get the corresponding interrupt entry address
 ldr r8,[r8]
 str r8,[sp,#8] ;The interrupt entry address is sent to SP (the 4-byte space reserved by the first code)
 ldmfd sp!,{r8-r9,pc}

So far, the interrupt has been successfully entered into the interrupt vector table, and it has become very simple to write a service program in C language. For example, the ISR of the EINT0 interrupt

void Eint0(void)

{ }

pISR_EINT0=(U32)Eint0; //Use the interrupt entry to point to the function pointer.

Keywords:S3C2410 Reference address:Detailed explanation of S3C2410 interrupt

Previous article:ARM926EJ-S/ARM920T coprocessor CP14, CP15 detailed explanation
Next article:STM32 interrupt priority and switch total interrupt

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号