i'm tring to confgure timer0 in int mode, from the registers i can see the
PCGCR1->TMROCG = active,
IER0->TINT = enable ,
timer0->TCR = 0x8003,
ST1_55->INTM = off,
however, IER0->TINT is always disable
what do i miss in configuring ?
and by the way, i feel CCS software may have a little bug in register address, the IER1 in the rigister may not be in right adress,
thanks
void main(void)
{
#if DEBUG||(SOURCE != FROM_CODEC)
Int16 i;
#endif
#if (SOURCE != FROM_CODEC)
Int16 Sim_Index_L = 0;
Int16 Sim_Index_R = 0;
#endif
Int32 *FilterIn; // Pointer to filter input buffer
InitSystem();
Zero_Pad_Inputs(); // Zero-pad the input buffers in advance (zeros will not be overwritten)
Clear_COLA_Overlaps(); // Zero overlap buffers that hold Constant-Overlap-and-Add samples
FFT_Coeffs(); // Zero-pad and FFT coefficients outside of loop
init_gpt_0(700,0);
ConfigPort();
//SYS_GlobalIntEnable();
reset_RTC();
IER0 = 0x0110; // enable dma, timer int
IER1 = 0x0004; // enable RTC int
SYS_GlobalIntEnable();
setDMA_address();
//set_i2s0_master(); // I2S0_CLK and I2S0_FS pins of DSP configured as outputs
set_i2s0_slave(); // I2S0_CLK and I2S0_FS pins of DSP configured as inputs
AIC3204_init();
PLL_98MHz();
start_gpt_0();
while(1) //waiting for timer0 interrupt
{
;
}
}
/*****************************************************************
* gpt_routine.c
****************************************************************/
#include <stdio.h>
#include "data_types.h"
#include "register_cpu.h"
#include "register_gpt.h"
#include "register_gpio.h"
#include "gpt_routine.h"
Uint16 flag = 1;
void start_gpt_0(void)
{
Uint16 prescale_divider;
/* 2:100M/2 = 50M */
prescale_divider = 0x0000;
//0x8003: Timer enable,autoload,start
TIMER_TIMER0_TCR |= prescale_divider<<2;
TIMER_TIMER0_TCR |= 0x0001;
}
void init_gpt_0(Uint16 timer_low_16bits,Uint16 timer_high_16bits)
{
TIMER_TIMER0_TCR =0x0000;
//80/2=40KHz
TIMER_TIMER0_TIMPRD1 = timer_low_16bits; //LSW
TIMER_TIMER0_TIMPRD2 = timer_high_16bits; //MSW
TIMER_TIMER0_TIMCNT1 = 0xFFFF;
TIMER_TIMER0_TIMCNT2 = 0xFFFF;
TIMER_TIMER0_TCR = 0x8002;
//clear flag
//TIMER_TIAFR = 0x0007;
}
interrupt void gpt_0_Isr(void)
{
Uint16 temp;
temp = IFR0;
//clear timer int flag
//IFR1 = temp|0x0010;
IFR0 = temp|0x0010;
//GPIO13 = ~GPIO13;
if(flag)
{
GPIO_IODATAOUT1 = GPIO_IODATAOUT1&0xDFFF;
flag = 0;
}else
{
GPIO_IODATAOUT1 = GPIO_IODATAOUT1|0x2000;
flag = 1;
}
//clear the flag
temp = TIMER_TIAFR;
TIMER_TIAFR = temp;
}