Rockbox mail archiveSubject: time to sleep?
From: Daniel Stenberg (daniel_at_haxx.se)
The SH-1 CPU has a SLEEP mode that makes the CPU halt and consume 20mA less
It takes 3 cycles to reach the state (it is a CPU instruction).
Here's how I figure we can make use of this:
o We add a new thread with only one purpose: go to sleep when all tasks have
o We wake up automaticly on the timer tick, every 50 ms. We then continue
o Threads should mark themselves as "busy" even when they use yield() or
This allows us to run as long as we have to without sleeping as long as we
I haven't thought out exactly how to mark the thread "busy" or how to make
o The sleep thread basicly perform this little loop:
If done correctly, this will basicly allow all threads to do what they need
Pretty much like going to work each day. ;-)
 = Details are found in section 19 and 20 in the SH-1 HW manual:
-- Daniel "Bagder" Stenberg -- http://rockbox.haxx.se/
Page was last modified "Jan 10 2012" The Rockbox Crew