Tuesday, August 01, 2006

kernel idle on BFIN

/*
* The idle loop on BFIN
*/
inline static void default_idle(void)
{
while (!need_resched()) {
leds_switch(LED_OFF);
ipipe_suspend_domain();
__asm__("nop;\n\t nop;\n\t nop;\n\t idle;\n\t": : :"cc");
leds_switch(LED_ON);
}
}

void (*idle)(void) = default_idle;

/*
* The idle thread. There's no useful work to be
* done, so just try to conserve power and have a
* low exit latency (ie sit in a loop waiting for
* somebody to say that they'd like to reschedule)
*/
void cpu_idle(void)
{
/* endless idle loop with no priority at all */
while (1) {
idle();
preempt_enable_no_resched();
schedule();
preempt_disable();
}
}

Blog Archive