[Tinyos Core WG] SchedulerBasic
Kevin Klues
klueska at gmail.com
Mon Feb 5 16:54:27 PST 2007
Sorry, that qhote is from TEP112
Kevin
On 2/5/07, Kevin Klues <klueska at gmail.com> wrote:
>
> You need to take a look at the implementations of the McuSleep.sleep()
> functions for the msp430 and atm128 platforms. The very last thing they do
> just before putting the microcontroller to sleep is renable interrrupts. If
> you are using a new platform that has a different microcontroller, you need
> to be sure that it has implemented its McuSleep.sleep() function this
> way.
>
> Quoted from TEP115:
> "McuSleep.sleep() puts the microcontroller into a low power sleep state,
> to be woken by an interrupt. This command deprecates the
> __nesc_atomic_sleep() call of TinyOS 1.x. Note that, as the 1.x call
> suggests, putting the microcontroller to sleep MUST have certain atomicity
> properties. The command is called from within an atomic section, and MUST
> atomically re-enable interrupts and go to sleep. An issue arises if the
> system handles an interrupt after it re-enables interrupts but before it
> sleeps: the interrupt may post a task, but the task will not be run until
> the microcontroller wakes up from sleep."
>
> Kevin
>
> On 2/5/07, Martin Leopold < leopold at diku.dk> wrote:
> >
> > Hi All.
> > I seem to be having a problem with a simple test program (for my cc2430
> > platform). I don't have any tasks and I echo a char back over the UART
> > in interrupt context. If I loop forever in say in Boot.booted all is
> > dandy, but if I let the system boot all the way, I don't seem to get to
> > my interrupt handler.
> >
> > If I'm not mistaken, what happens after the system boots is, that it
> > ends up in the taskLoop (below). If I'm reading this correctly then my
> > system will loop here forever with no help of recovery since interrupts
> > are off.
> >
> > Am I missing something obvious here or what? To me this doesn't seem
> > right - sleep is called with interrupts off and there is no way to post
> > a new task from an interrupt.
> >
> >
> > command void Scheduler.taskLoop() {
> > ...
> > atomic {
> > while ((nextTask = popTask()) == NO_TASK) {
> > call McuSleep.sleep();
> > }
> > }
> >
> > If I look at the old "TOSH_run_next_task" from 1.x interrupts would be
> > turned on in between calls to __nesc_atomic_sleep():
> >
> > void TOSH_run_task() {
> > for (;;) TOSH_run_next_task();
> > }
> >
> > bool TOSH_run_next_task () {
> > ...
> > fInterruptFlags = __nesc_atomic_start();
> > ...
> > __nesc_atomic_end(fInterruptFlags);
> > ...
> > func();
> > return 1;
> > }
> >
> > --
> > Regards Martin Leopold.
> > Dept. of Computer Science, University of Copenhagen
> > http://www.diku.dk/~leopold <http://www.diku.dk/%7Eleopold>
> >
> >
> >
> > _______________________________________________
> > Tinyos-2.0wg mailing list
> > Tinyos-2.0wg at Mail.Millennium.Berkeley.EDU
> >
> > https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-2.0wg
> >
>
>
>
> --
> ~Kevin
--
~Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.millennium.berkeley.edu/pipermail/tinyos-2.0wg/attachments/20070205/57388160/attachment.htm
More information about the Tinyos-2.0wg
mailing list