void main() { CSL_init();//CSL function initialization Htimer = TIMER_open(TIMER_DEV0,TIMER_OPEN_RESET);//Open timer 0 and return the timer handle TimerEventId = TIMER_getEventId(Htimer);//Get the timer event ID TIMER_config(Htimer,&Mtimer_configA);//Configure timer Hgpio = GPIO_open(GPIO_DEV0,GPIO_OPEN_RESET);//Open IO GPIO_config(Hgpio,&Mgpio_config);//Configure IO IRQ_setVecs(vectors);//Reset interrupt vector IRQ_globalEnable();//Global interrupt enable IRQ_nmiEnable(); IRQ_map(TimerEventId,14);//Remap the timer interrupt to 14 IRQ_reset(TimerEventId); IRQ_enable(TimerEventId);// TIMER_start(Htimer);//Timer startwhile(1);//Infinite loopTIMER_close(Htimer); GPIO_close(Hgpio); } /********************************************************************** * Interrupt service routine******************************************************************/ interrupt void c_int14(void)//Interrupt service routine{ if(flag==0) { GPIO_pinWrite(Hgpio,GPIO_PIN3,flag); flag=1; } else { GPIO_pinWrite(Hgpio,GPIO_PIN3,1); //Light up flag=0; } } *------------------------------------------------------------------------------ * Global symbols defined here and exported out of this file *------------------------------------------------------------------------------ .global _vectors//Global labels, can be used elsewhere. .global _c_int00 .global _vector1 .global _vector2 .global _vector3 .global _vector4 .global _vector5 .global _vector6 .global _vector7 .global _vector8 .global _vector9 .global _vector10 .global _vector11 .global _vector12 .global _vector13 .global _c_int14 ; Hookup the c_int14 ISR in main() .global _vector15 *--------------------------------------------------------------------------------- * Global symbols referenced in this file but defined somewhere else. * Remember that your interrupt service routines need to be referenced here. the interrupt service table. *------------------------------------------------------------------------------ VEC_ENTRY .macro addr //define interrupt vector entry address STW B0,*--B15; save B0 content, the first instruction executed after interruption MVKL addr,B0; MVKH addr,B0; //load address into B0 B B0; jump to address stored in B0 LDW *B15++,B0; restore B0 content; due to C6000 pipeline, multiple instructions can still be executed after jump NOP 2 NOP NOP .endm *------------------------------------------------------------------------------ * This is a dummy interrupt service routine used to initialize the IST.;NMI _vector2: VEC_ENTRY _vec_dummy ;RSVD _vector3: VEC_ENTRY _vec_dummy ; All undefined interrupts jump to the same address _vector4: VEC_ENTRY _vec_dummy _vector5: VEC_ENTRY _vec_dummy _vector6: VEC_ENTRY _vec_dummy _vector7: VEC_ENTRY _vec_dummy _ vector8: VEC_ENTRY _vec_dummy _vector9: VEC_ENTRY _vec_dummy _vector10: VEC_ENTRY _vec_dummy _vector11: VEC_ENTRY _vec_dummy _vector13: VEC_ENTRY _vec_dummy _vector14: V EC_ENTRY _c_int14 ; Hookup the c_int14 ISR in main() Timer interrupt interrupt vector _vector15: VEC_ENTRY _vec_dummy *------------------------------------------------------------------------------------------------------