提交 21ef7332 编写于 作者: G Grissiom

lpc43xx: use the RIT timer as SysTick in M0 core

上级 773a884a
...@@ -26,17 +26,34 @@ void RIT_OR_WWDT_IRQHandler(void) ...@@ -26,17 +26,34 @@ void RIT_OR_WWDT_IRQHandler(void)
/* enter interrupt */ /* enter interrupt */
rt_interrupt_enter(); rt_interrupt_enter();
rt_tick_increase(); if (LPC_RITIMER->CTRL & 0x01)
{
rt_tick_increase();
LPC_RITIMER->CTRL |= 0x01;
}
/* leave interrupt */ /* leave interrupt */
rt_interrupt_leave(); rt_interrupt_leave();
} }
extern void SystemCoreClockUpdate(void);
/** /**
* This function will initial LPC43xx board. * This function will initial LPC43xx board.
*/ */
void rt_hw_board_init() void rt_hw_board_init()
{ {
SystemCoreClockUpdate();
/* Setup RIT timer. */
LPC_RITIMER->COMPVAL = SystemCoreClock / RT_TICK_PER_SECOND - 1;
/* Enable auto-clear. */
LPC_RITIMER->CTRL |= 1 << 1;
/* Reset the counter as the counter is enabled after reset. */
LPC_RITIMER->COUNTER = 0;
NVIC_SetPriority(M0_RITIMER_OR_WWDT_IRQn, (1 << __NVIC_PRIO_BITS) - 1);
NVIC_EnableIRQ(M0_RITIMER_OR_WWDT_IRQn);
/* set pend exception priority */ /* set pend exception priority */
NVIC_SetPriority(PendSV_IRQn, (1 << __NVIC_PRIO_BITS) - 1); NVIC_SetPriority(PendSV_IRQn, (1 << __NVIC_PRIO_BITS) - 1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册