Installation of the interrupt vector table from CThis example shows one way to initialize the interrupt vector table. You can do it also with plain assembly. 1. Reserve space for the interrupt vector table using the .usect command in a assembly language file: assembly file: [this could be added to your boot.asm routine (rts.src)> ]
.global _vecta
.text
_vecta .word vect
vect .usect ".vectors",2ch
2. C file:
extern int *vecta;
int *ivtpa;
int iieval= 0x01;
main() {
ivtpa = vecta;
asm(" ldi @_ivtpa,r0")
asm(" ldpe r0,ivtp") /* ivtp register initialization */
*(ivtpa+0x02) = (int)c_int90; /* install vector for timer 0 interrupt */
asm(" ldi @_iieval,iie"); /* enable timer interrupt */
asm(" or 3800h,st"); /* enable interrupts globally */
}
void c_int90() {
/* isr code */
}
3. Remember: allocate the interrupt vector table in a 512-word boundary. The C4x will not give you any kind of warning if you don't do it The C4x will automatically clear the 9 LSbits of the IVTP/TVTP
|