//
// Enable the peripherals used by this example.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);
// 使能宽64位定时器0外设
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_WTIMER0);
//
// Enable processor interrupts.
//
ROM_IntMasterEnable();
//
// Configure the two 32-bit periodic timers.
//
ROM_TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC);
ROM_TimerConfigure(TIMER1_BASE, TIMER_CFG_PERIODIC);
ROM_TimerLoadSet(TIMER0_BASE, TIMER_A, ROM_SysCtlClockGet());
ROM_TimerLoadSet(TIMER1_BASE, TIMER_A, ROM_SysCtlClockGet() / 2);
//配置64位宽的定时器0
ROM_TimerConfigure(WTIMER0_BASE,TIMER_CFG_PERIODIC);
ROM_TimerLoadSet64(WTIMER0_BASE,ROM_SysCtlClockGet()*10);
//
// Setup the interrupts for the timer timeouts.
//
ROM_IntEnable(INT_TIMER0A);
ROM_IntEnable(INT_TIMER1A);
//使能64位宽的定时器0中断
ROM_IntEnable(INT_WTIMER0A);
ROM_TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
ROM_TimerIntEnable(TIMER1_BASE, TIMER_TIMA_TIMEOUT);
ROM_TimerIntEnable(WTIMER0_BASE,TIMER_TIMA_TIMEOUT);
//
// Enable the timers.
//
//ROM_TimerEnable(TIMER0_BASE, TIMER_A);
ROM_TimerEnable(TIMER1_BASE, TIMER_A);
//使能64位宽的定时器0
ROM_TimerEnable(WTIMER0_BASE,TIMER_A);
中断函数
void
WTimer0IntHandler(void)
{
//
// Clear the timer interrupt.
//
ROM_TimerIntClear(WTIMER0_BASE,TIMER_TIMA_TIMEOUT);
//
// Toggle the flag for the first timer.
//
HWREGBITW(&g_ulFlags, 0) ^= 1;
//
// Update the interrupt status on the display.
//
ROM_IntMasterDisable();
GrStringDraw(&g_sContext, (HWREGBITW(&g_ulFlags, 0) ? "1" : "0"), -1, 68,
26, 1);
ROM_IntMasterEnable();
}
然后修改startup_rvmdk.s里增加
EXTERN WTimer0IntHandler
还有
DCD WTimer0IntHandler ; Wide Timer 0 subtimer A