Interrupt Handling
6-27
Run-Time Environment
6.5.3 Using Assembly Language Interrupt Routines
You can handle Interrupts with assembly language code as long as you follow
the same register conventions the compiler. Keep the following points in mind:
-
The word pointed to by the SP (AR1) may be in use by the compiler. It must
be saved.
-
The interrupt routine must preserve the registers from Table 6
2 on page 6-11 that it modifies.
-
If the interrupt routine calls a C function, it must preserve
all
registers listed
1 on page 6-10 that are not preserved by a call. Any other
register can be modified by the C routine.
-
Remember to precede the symbol name with an underscore. For
example, refer to c_int0 as _c_int0.
6.5.4 TMS320C5x Shadow Register Capability
The TMS320C5x device automatically saves certain registers upon an inter-
rupt trap in a set of internal shadow registers. See the
TMS320C5x User’s
Guide
for more information. If an interrupt is not nested (that is, does not reen-
able interrupts so that this interrupt routine is itself interruptible), then using the
shadow register capability is the best way to preserve those registers.
If none of the interrupts you have written in C are nested, then you can take
advantage of the shadow register capability by modifying an assembly time
flag in the source of the I$$SAVE/I$$RESTORE routines that the compiler
uses to preserve registers, as follows:
1) Unarchive the source from source library
dspar −x rts.src saverest.asm
2) Change the NEST flag in the source to 0
NEST
.set
0
3) Reassemble
dspa −v50 saverest.asm
4) Archive the new object file into the object library
dspar −r rts50.lib saverest.obj
Summary of Contents for TMS320C2x
Page 8: ...viii...
Page 69: ...2 47 C Compiler Description...
Page 159: ...6 36...
Page 226: ...8 6...