Re: [riot-devel] I have question about scheduler when all thread in sleep

2016-07-13 Thread Joakim Nohlgård
Dear Teemu,
What you are describing sounds like the xtimer subsystem in RIOT. It uses a
hardware timer to schedule tasks in the future.
See examples/xtimer_periodic_wakeup in the RIOT sources for an example on
how to achieve periodic scheduling for your task.

Also note that the function xtimer_usleep_until used in the example may be
renamed xtimer_periodic_wakeup in a near future, see [1].
The functionality will remain the same and the example will be updated at
the same time the rename happens.

[1]: https://github.com/RIOT-OS/RIOT/pull/5612

Best regards,
Joakim

On Wed, Jul 13, 2016 at 10:53 AM, Teemu Hakala  wrote:

>
>
> > On 12 Jul 2016, at 22:02, Kaspar Schleiser  wrote:
> >
> > The system gets woken up by external interrupts, e.g., a timer,
> > gpio-pin. That powers up the MCU
>
> > thread_flag), that triggers the scheduler and
>
> > The scheduler never wakes up itself
>
> In this thinking concept of achieving some repetitive task, you should
> perhaps configure a hw timer to create a stream of interrupts.
>
> Said interrupts then individually wake up mcu, go via irq handler and
> start processing that then yields, allowing the scheduler to put mcu into
> sleep mode. This is then repeated.
>
> Most normal modern mcus support configuring a timer for this purpose, the
> interrupts can come from an external source or mcu internal peripherals
> such as adc can act as interrupt stream generator.
>
>  - t
> ___
> devel mailing list
> devel@riot-os.org
> https://lists.riot-os.org/mailman/listinfo/devel
>
___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel


Re: [riot-devel] I have question about scheduler when all thread in sleep

2016-07-13 Thread Teemu Hakala


> On 12 Jul 2016, at 22:02, Kaspar Schleiser  wrote:
> 
> The system gets woken up by external interrupts, e.g., a timer,
> gpio-pin. That powers up the MCU 

> thread_flag), that triggers the scheduler and 

> The scheduler never wakes up itself

In this thinking concept of achieving some repetitive task, you should perhaps 
configure a hw timer to create a stream of interrupts.

Said interrupts then individually wake up mcu, go via irq handler and start 
processing that then yields, allowing the scheduler to put mcu into sleep mode. 
This is then repeated.

Most normal modern mcus support configuring a timer for this purpose, the 
interrupts can come from an external source or mcu internal peripherals such as 
adc can act as interrupt stream generator.

 - t
___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel


Re: [riot-devel] I have question about scheduler when all thread in sleep

2016-07-12 Thread Kaspar Schleiser
Hey,

On 07/12/2016 07:08 PM, 신익희 wrote:
> in this condition, when scheduler wake up from low power mode and
> restart schedule?
> 
> and how to know scheduler when wake up itself?

The system gets woken up by external interrupts, e.g., a timer,
gpio-pin. That powers up the MCU and executes the corresponding
interrupt handler. Should that handler do something that wakes a thread
(calling thread_wakeup(), release a mutex, send a message or set a
thread_flag), that triggers the scheduler and then leads to a context
switch into the thread(s).

The scheduler never wakes up itself.

Kaspar
___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel


[riot-devel] I have question about scheduler when all thread in sleep

2016-07-12 Thread 신익희
when all thread in sleep except idle thread

then idle task call lpm_set and OS go to low power mode

in this condition, when scheduler wake up from low power mode and restart
schedule?

and how to know scheduler when wake up itself?
___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel