以下是c5402cfg.h部分 extern void c_int00(void); extern interrupt void DefaultIsr(void);
enum DspCodeEnum_Enum { DSPCODE_BD = (TI_IREG)0xf273, DSPCODE_RETE = (TI_IREG)0xf4fb, DSPCODE_NOP = (TI_IREG)0xf495,//, DSPCODE_SP_200L = (TI_IREG)0x7718,//STM #200,SP DSPCODE_SP_200H = (TI_IREG)0x00c8//STM #200,SP };
#define ISR_Reset() {DSPCODE_BD, (pfnVectorEntry)c_int00, DSPCODE_SP_200L, DSPCODE_SP_200H} #define ISR_Return() {DSPCODE_RETE, (pfnVectorEntry)DSPCODE_NOP, DSPCODE_NOP, DSPCODE_NOP} #define ISR_Default() {DSPCODE_BD, (pfnVectorEntry)DefaultIsr, DSPCODE_NOP, DSPCODE_NOP} #define ISR(addr) {DSPCODE_BD, (pfnVectorEntry)addr, DSPCODE_NOP, DSPCODE_NOP}
typedef interrupt void (*pfnVectorEntry)(void); typedef struct { TI_IREG Code; pfnVectorEntry Isr;//中断入口地址 TI_IREG DataLow; TI_IREG DataHi; }uVectorEntry;
#define nISR_REST 0 //0x0080 #define nISR_NMI 1 //0x0084 #define nISR_SINT17 2 //0x0088 #define nISR_SINT18 3 //0x008c #define nISR_SINT19 4 //0x0090 #define nISR_SINT20 5 //0x0094 #define nISR_SINT21 6 //0x0098 #define nISR_SINT22 7 //0x009c #define nISR_SINT23 8 //0x00a0 #define nISR_SINT24 9 //0x00a4 #define nISR_SINT25 10 //0x00a8 #define nISR_SINT26 11 //0x00ac #define nISR_SINT27 12 //0x00b0 #define nISR_SINT28 13 //0x00b4 #define nISR_SINT29 14 //0x00b8 #define nISR_SINT30 15 //0x00bc #define nISR_INT0 16 //0x00c0 #define nISR_INT1 17 //0x00c4 #define nISR_INT2 18 //0x00c8 #define nISR_TINT0 19 //0x00cc #define nISR_TIMER0 19 //0x00cc #define nISR_RINT0 20 //0x00d0 #define nISR_XINT0 21 //0x00d4 #define nISR_RINT1 22 //0x00d8 #define nISR_XINT1 23 //0x00dc #define nISR_TIMER1 23 //0x00dc #define nISR_INT3 24 //0x00e0 #define nISR_HPINT 25 //0x00e4 #define nISR_RESINT0 26 //0x00e8 #define nISR_RESINT1 27 //0x00ec #define nISR_RESINT2 28 //0x00f0 #define nISR_RESINT3 29 //0x00f4 #define nISR_RESINT4 30 //0x00f8 #define nISR_RESINT5 31 //0x00fc
以下是interrupt.c部分 #pragma DATA_SECTION("vectors") const uVectorEntry g_pfnVectors[] = { ISR_Reset(), //reset 0x0080 #0 ISR_Default(), //nmi 0x0084 #1 ISR_Default(), //sint17 0x0088 #2 ISR_Default(), //sint18 0x008c #3 ISR_Default(), //sint19 0x0090 #4 ISR_Default(), //sint20 0x0094 #5 ISR_Default(), //sint21 0x0098 #6 ISR_Default(), //sint22 0x009c #7 ISR_Default(), //sint23 0x00a0 #8 ISR_Default(), //sint24 0x00a4 #9 ISR_Default(), //sint25 0x00a8 #10 ISR_Default(), //sint26 0x00ac #11 ISR_Default(), //sint27 0x00b0 #12 ISR_Default(), //sint28 0x00b4 #13 ISR_Default(), //sint29 0x00b8 #14 ISR_Default(), //sint30 0x00bc #15 ISR(Eint0Isr), //int0 0x00c0 #16 ISR(Eint1Isr), //int1 0x00c4 #17 ISR(Eint2Isr), //int2 0x00c8 #18 ISR(Timer0Isr),//tint 0x00cc #19 ISR(McBSPIsr), //rint0 0x00d0 #20 ISR_Default(), //xint0 0x00d4 #21 ISR_Default(), //rint1 0x00d8 #22 ISR_Default(), //xint1 0x00dc #23 ISR(Eint3Isr), //int3 0x00e0 #24 ISR_Default(), //hpint 0x00e4 #25 ISR_Default(), // 0x00e8 #26 ISR_Default(), // 0x00ec #27 ISR_Default(), // 0x00f0 #28 ISR_Default(), // 0x00f4 #29 ISR_Default(), // 0x00f8 #30 ISR_Default(), // 0x00fc #31 };
extern "C" interrupt void DefaultIsr(void) { }
extern "C" interrupt void Eint0Isr(void) { } ......................
以下是cmd文件部分
MEMORY { //(R读 W写 X运行 I初始化) PAGE 0: /* Program Space */ MMRS (RW ) : o=000000h l=000060h /* Memory-mapped registers */ SCRATCH (RW ) : o=000060h l=000020h /* scratch-pad DARAM */ VECT (RW ): o=000080h l=000080h /* Interrupt Vector Table */ IPROG (RWX ) : o=000100h l=001f00h /* On-Chip DARAM */ PAGE 1: /* Data Space */ /* declaration for DARAM already made in PAGE 0 */ IDATA (RWX ) : o=002000h l=002000h /* On-Chip DARAM */ EDATA (RW ) : o=008000h l=008000h }
SECTIONS { .vectors : > VECT PAGE 0 /* interrupt vector table */
|