| |||||||||||
Technical Support On-Line Manuals CARM User's Guide | __swi: Software InterruptSoftware interrupt functions (SWI) are defined using the __swi function attribute: « type » funcname (« args ») __swi (« num ») Where:
The __swi attribute affects the generated code of the function as follows:
The following example program shows how to use the __swi attribute along with the SWI_VEC.S file. A complete interrupt example project is provided in the \KEIL\ARM\EXAMPLES\INTERRUPT\ folder. stmt level source
1 volatile long x;
2
3 void func (void) __swi(3)
4 {
5 1 x++;
6 1 }
7
8 void main (void)
9 {
10 1 while (1)
11 1 func ();
12 1 }
.
.
.
*** CODE SEGMENT '?PR?func?T?main':
5: x++;
00000000 4800 LDR R0,=x ; x
00000002 6801 LDR R1,[R0,#0x0] ; x
00000004 3101 ADD R1,#0x1
00000006 6001 STR R1,[R0,#0x0] ; x
6: }
00000008 4770 BX R14
0000000A ENDP ; 'func?T'
*** CODE SEGMENT '?PR?main?main':
8: void main (void)
00000000 B500 PUSH {LR}
10: while (1)
00000002 L_3:
00000002 DF03 SWI 0x3 ; func?T
00000004 E7FD B L_3 ; T=0x00000002
00000006 BC08 POP {R3}
00000008 4718 BX R3
0000000A ENDP ; 'main'
Note
| ||||||||||
| |||||||||||