提交 ec1c89d5 编写于 作者: wuyangyong's avatar wuyangyong

add idle hook, in idle thread, cpu hlt.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1964 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 017e673c
...@@ -93,11 +93,6 @@ void rtthread_startup() ...@@ -93,11 +93,6 @@ void rtthread_startup()
finsh_set_device("console"); finsh_set_device("console");
#endif #endif
#ifdef RT_USING_HOOK
/* set idle thread hook */
rt_thread_idle_sethook(RT_NULL);
#endif
/* init idle thread */ /* init idle thread */
rt_thread_idle_init(); rt_thread_idle_init();
......
...@@ -26,7 +26,14 @@ ...@@ -26,7 +26,14 @@
static void rt_timer_handler(int vector) static void rt_timer_handler(int vector)
{ {
rt_tick_increase(); rt_tick_increase();
}
#ifdef RT_USING_HOOK
static void idle_hook(void)
{
asm volatile("sti; hlt": : :"memory");
} }
#endif
/** /**
* This function will init QEMU * This function will init QEMU
...@@ -41,7 +48,11 @@ void rt_hw_board_init(void) ...@@ -41,7 +48,11 @@ void rt_hw_board_init(void)
/* install interrupt handler */ /* install interrupt handler */
rt_hw_interrupt_install(INTTIMER0, rt_timer_handler, RT_NULL); rt_hw_interrupt_install(INTTIMER0, rt_timer_handler, RT_NULL);
rt_hw_interrupt_umask(INTTIMER0); rt_hw_interrupt_umask(INTTIMER0);
#ifdef RT_USING_HOOK
rt_thread_idle_sethook(idle_hook);
#endif
} }
void restart(void) void restart(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册