使用例程中周期定时中断的程序,周期改变不了,进入中断后不是按照设定周期而是一直在进中断。

void generate_clocks_by_timer()
{
Timer64_Config tmrCfg;

puts("clocks will be generated on TIMO0...");

uiTick = 0;

//select output on TIMO0 from local timer.
gpBootCfgRegs->TOUTSEL = (DNUM*2)<<CSL_BOOTCFG_TOUTSEL_TOUTSEL0_SHIFT;

/*configure the timer to generate clocks and interrupts*/
tmrCfg.timer_num= DNUM;
tmrCfg.timerMode= TIMER_PERIODIC_CLOCK;
tmrCfg.period= (unsigned long long)CLOCK_PERIOD_MS*gDSP_Core_Speed_Hz/6000;
Timer64_Init(&tmrCfg);

//wait until a number of interupts happen
while(uiTick<1025)
asm(" nop 5");
//printf("%d",uiTick);
Reset_Timer(DNUM); //stop the timer

puts("clocks were generated on TIMO0\n");
}

void interrupt Timer_ISR(void)
{
uiTick++;
//time_all_1 = _itoll(TSCH,TSCL)-time_all;
time_all = _itoll(TSCH,TSCL)-time_all;
printf("%ld\n",time_all);

time_all=_itoll(TSCH,TSCL);
}

void Timer_Interrupts_Init(void)
{
gpCGEM_regs->INTMUX1 = 0;
gpCGEM_regs->INTMUX2 = 0;
//map local timer interrupt to INT14
gpCGEM_regs->INTMUX3 = CSL_GEM_TINTLN<<CSL_CGEM_INTMUX3_INTSEL14_SHIFT;

/*Clear all DSP core events*/
gpCGEM_regs->EVTCLR[0]= 0xFFFFFFFF;
gpCGEM_regs->EVTCLR[1]= 0xFFFFFFFF;
gpCGEM_regs->EVTCLR[2]= 0xFFFFFFFF;
gpCGEM_regs->EVTCLR[3]= 0xFFFFFFFF;

//clear DSP core interrupt flag
ICR= IFR;

//enable INT14
IER = IER|(1<<14);

/*Interrupt Service Table Pointer to begining of LL2 memory*/
ISTP= 0x800000;

//enable GIE
TSR = TSR|1;
}

相关代码如上,不是按照程序定义的周期,感觉是只要从中断中出来就立马再进入中断。是不是中断执行程序中没有清除中断位的原因,看了下文档,不知道应该用哪个寄存器。