add idle hook, in idle thread, cpu hlt.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1964 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
wuyangyong 2012-02-18 14:49:46 +00:00
parent 017e673c17
commit ec1c89d5ec
2 changed files with 12 additions and 6 deletions

View File

@ -93,11 +93,6 @@ void rtthread_startup()
finsh_set_device("console");
#endif
#ifdef RT_USING_HOOK
/* set idle thread hook */
rt_thread_idle_sethook(RT_NULL);
#endif
/* init idle thread */
rt_thread_idle_init();

View File

@ -26,7 +26,14 @@
static void rt_timer_handler(int vector)
{
rt_tick_increase();
}
#ifdef RT_USING_HOOK
static void idle_hook(void)
{
asm volatile("sti; hlt": : :"memory");
}
#endif
/**
* This function will init QEMU
@ -41,7 +48,11 @@ void rt_hw_board_init(void)
/* install interrupt handler */
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)