//本例中只是开启定时器,然后定时器自动计数,计到0xFFFFFFFFFF后,为0,继续计数,没有使用中断等其他功能
//AM335X Timer7
#define TIMER7_BASE 0x4804A000
#define TIMER7_CLKSEL_BASE 0x44E00500
void Timer7_config(void)
{
out32(0x44E00000 + 0x7C, 0x02);//CM_PER->M_PER_TIMER7_CLKCTRL,开启定时器
out32(TIMER7_BASE + 0x10, 0x00000002);//DMTIMER7->Timer OCP Configuration Register,定时器自由运行
out32(TIMER7_BASE + 0x40, 0x00000000);//DMTIMER7->Timer Load Register, timer counter register start value after overflow
out32(TIMER7_BASE + 0x38, 0x00000003);//DMTIMER7->Timer Control Register,Auto-Reload,& Start Timer
//时钟选择,默认为高速晶振
// out32(TIMER7_CLKSEL_BASE + 0x04, 0x00000001);//CM_DPLL->CLKSEL_TIMER7_CLK,时钟源选择,默认复位即为选贼高速晶振
}
u32 GetTimer7Count(void)
{
return(in32(TIMER7_BASE + 0x3C));
}