| ||||||||
Technical Support On-Line Manuals CARM User's Guide | __fiq: Fast InterruptThe CARM Compiler supports C fast interrupt functions and eliminates the need to write them in assembly language. Fast interrupt functions are defined using the __fiq function attribute. void funcname (void) __fiq Where:
The __fiq attribute affects the generated code of the function as follows:
When a fast interrupt is triggered, the ARM device jumps to the __fiq vector location (some ARM devices provide a Vectored Interrupt Controller (VIC) that supports fiq interrupts). By default, the CPU startup code (STARTUP.S) jumps to the function named FIQ_Handler. So, if you name your __irq function FIQ_Handler, no changes to the STARTUP.S file are required. The following example shows how to use the __fiq attribute with a VIC on a Philips LPC2000 device. The code sequences generated are shown in the Assembler Listing.
stmt level source
1 /*
2 * IRQ Handler for ADuC7000 Timer0 Interrupt
3 */
4
5 #include <ADuC7024.H>
6
7 volatile int T0_ticks;
8
9 void IRQ_Handler (void) __fiq {
10 1 if (IRQSIG & 0x00000004) { // Timer0 Interrupt
11 2 T0CLRI = 1;
12 2 T0_ticks++;
13 2 }
14 1 }
ASSEMBLY LISTING OF GENERATED OBJECT CODE
*** PUBLICS:
PUBLIC IRQ_Handler?A
PUBLIC T0_ticks
*** DATA SEGMENT '?DT0?irq':
00000000 T0_ticks:
00000000 DS 4
*** CODE SEGMENT '?PR?IRQ_Handler?A?irq':
9: void IRQ_Handler (void) __irq {
00000000 E92D0003 STMDB R13!,{R0-R1}
10: if (IRQSIG & 0x00000004) { // Timer0 Interrupt
00000004 E5100000 LDR R0,=0xFFFF0004
00000008 E5900000 LDR R0,[R0,#0x0]
0000000C E3A01004 MOV R1,#0x4
00000010 E1100001 TST R0,R1
00000014 0A000006 BEQ L_1 ; Targ=0x34
11: T0CLRI = 1;
00000018 E3A01001 MOV R1,#0x1
0000001C E5100000 LDR R0,=0xFFFF030C
00000020 E5801000 STR R1,[R0,#0x0]
12: T0_ticks++;
00000024 E5100000 LDR R0,=T0_ticks ; T0_ticks
00000028 E5901000 LDR R1,[R0,#0x0] ; T0_ticks
0000002C E2811001 ADD R1,R1,#0x0001
00000030 E5801000 STR R1,[R0,#0x0] ; T0_ticks
13: }
00000034 L_1:
00000034 E8BD0003 LDMIA R13!,{R0-R1}
00000038 E25EF004 SUBS R15,R14,#0x0004
0000003C ENDP ; 'IRQ_Handler?A'
Note
| |||||||
| ||||||||