s3c2410 interrupt handler

The s3c2410 interrupt program should pay attention to the difference between the interrupt vector table and the exception vector table. After an interrupt occurs, it always enters from the IRQ or FIQ exception entry, and then jumps to the corresponding exception handler for execution. This exception handler generally performs the operation of finding the interrupt vector table and then calls the interrupt handler.
The following is the process of implementing interrupt processing in the application: It is not difficult to experience the process of interrupt processing.
Define the physical address of the interrupt vector table:
Code
.equ pISR_DABORT, (_ISR_STARTADDRESS + 0x10)
.equ pISR_RESERVED, (_ISR_STARTADDRESS + 0x14)
.equ pISR_IRQ, (_ISR_STARTADDRESS + 0x18)
.equ pISR_FIQ, (_ISR_STARTADDRESS + 0x1c) // Exception vector table ..............................................................................
.equ pISR_EINT0, (_ISR_STARTADDRESS + 0x20) // Interrupt vector table
.equ pISR_EINT1, (_ISR_STARTADDRESS + 0x24)
.equ pISR_EINT2, (_ISR_STARTADDRESS + 0x28)
.equ pISR_EINT3, (_ISR_STARTADDRESS + 0x2c)
Put the interrupt handler entry address into the interrupt vector table:
Code
pISR_EINT0 = (unsigned int) isrEINT0; // isrEINT0 interrupt handler
pISR_EINT1 = (unsigned int) isrEINT1;
Define the interrupt handler:
Code
.extern Interrupt_Rbutton
.global isrEINT0
isrEINT0:
IRQHandle Interrupt_Rbutton
Define the exception vector table:
Code
b HandlerUndef / * handler for Undefined mode * /
b HandlerSWI / * handler for SWI interrupt * /
b HandlerPabort / * handler for PAbort * /
b HandlerDabort / * handler for DAbort * /
.long FileIDTable / * id * /
b HandlerIRQ / * handler for IRQ interrupt * /
b HandlerFIQ
Define the exception handling function:
Code
HandlerFIQ: HANDLER HandleFIQ
HandlerIRQ: HANDLER HandleIRQ
HandlerUndef: HANDLER HandleUndef
HandlerSWI: HANDLER HandleSWI
HandlerDabort: HANDLER HandleDabort
HandlerPabort: HANDLER HandlePabort
Definition of exception handling macro HANDLER:
Code
.macro HANDLER HandleLabel
sub sp, sp, # 4 / * decrement sp (to store jump address) * /
stmfd sp!, {r0} / * PUSH the work register to stack (lr does't push bec
ause 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) * /
.endm
Define IRQ interrupt processing macro IRQHandle:
Code
.macro IRQHandle isrHandle:
stmdb sp !, {r0-r11, ip, lr} / * save r0-r11, ip, lr * /
ldr r0, = isrHandle
mov lr, pc
bx r0 / * jump to user_handle (void) * /
ldmia sp !, {r0-r11, ip, lr} / * restore r0, ip, lr * /
subs pc, r14, # 4 / * return from interrupt * /
.endm
The service program that declares an IRQ exception is: IsrIRQ, that is, when an IRQ exception occurs, executing "b HandlerIRQ" is to run IsrIRQ code:
Code
ldr r0, = HandleIRQ @ This rouTIne is needed
ldr r1, = IsrIRQ @ if there isn't 'subs pc, lr, # 4' at 0x18, 0x1c
str r1, [r0]
IRQ exception handler:
Code
IsrIRQ:
sub sp, sp, # 4 @ reserved for PC
stmfd sp!, {r8-r9}
ldr r9, = INTOFFSET
ldr r9, [r9]
ldr r8, = HandleEINT0
add r8, r8, r9, lsl # 2
ldr r8, [r8]
str r8, [sp, # 8]
ldmfd sp!, {r8-r9, pc}
In the embedded system, the exception vector table and the interrupt vector table are both stored in a space at the beginning of FLASH. The exception handling and interrupt handlers are all running in RAM.

It can be known from the above that when an IRQ interrupt occurs, the CPU will fetch and execute instructions from 0X18 (IRQ exception entry address). At this step, the PC jump is implemented by hardware. At the entry address 0x18 is a jump instruction. This instruction will jump to the IRQ exception handler. The IRQ exception handler mainly looks for the interrupt vector table according to the interrupt source. After obtaining the interrupt entry address, the CPU then jumps to the interrupt handler and runs.

SP300VAC600W is a switching mode single-channel output high-precision Ac Power Source, it`s cost effective and fully programmable for both basic frequency conversion and advanced AC power line or DC power disturbance test applications. This Ac Power Supply adopts high speed DSP+CPLD control, high frequency PWM power technology and active PFC design to realize AC/DC stable output.

APM Ac Output Power Supply is featured with high power density, high reliability and high precision, meanwhile it possesses operation interface of touch screen and keys manually. It is able to analog output normal or abnormal input for electrical device to meet test requirements. 

Some features as below:


  • 4.3"large touch color screen
  • AC+DC mixed or independent output mode
  • Capable of setting output slope/phase angle  
  • Built-in IEC standard test function
  • Built-in multiple protections
  • Built-in power meter
  • Support impedance function
  • Support for LIST/PULSE/STEP mode & Transient mode
  • Standard RS232/RS485/USB, Optional GPIB//LAN
  • Support harmonics/inter-harmonics simulation and measuring function
  • Support for USB data import/export and scree nap from front panel


600W AC Power Supply

600W Ac Power Supply,Variable Ac Power Supply,Portable Ac Power Source,Ac Voltage Source

APM Technologies (Dongguan) Co., Ltd , https://www.apmpowersupply.com