PicoWAN SDK Documentation
|
Implementation of a Low-Power scheduler. More...
Go to the source code of this file.
Data Structures | |
struct | os_job_t |
Typedefs | |
typedef int64_t | os_time_t |
Functions | |
void | os_init (void) |
Initializes the Operating System. More... | |
os_time_t | os_get_time (void) |
Gets the current time. More... | |
void | os_wait_until (os_time_t time) |
Waits until a given time. More... | |
void | os_delay (os_time_t time) |
Waits for a given time. More... | |
os_time_t | os_get_elapsed_time (os_time_t time) |
Returns how much time passed since a given timestamp. More... | |
uint8_t | os_cancel_job (os_job_t *job) |
Cancels a scheduled job. More... | |
void | os_post_job (os_job_t *job, void(*cb)(os_job_t *)) |
Posts a job to be executed as soon as possible. More... | |
void | os_post_delayed_job (os_job_t *job, os_time_t time, void(*cb)(os_job_t *)) |
Posts a job to be executed at a given time. More... | |
void | os_unblock_powersave (void) |
Allows the system to go to sleep mode. More... | |
void | os_block_powersave (void) |
Prevents the system from going to sleep mode. More... | |
void | os_mainloop (void) |
The Operating System mainloop. More... | |
Implementation of a Low-Power scheduler.
Copyright (c) 2018, Archos S.A. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND AND EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARCHOS S.A. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
void os_block_powersave | ( | void | ) |
Prevents the system from going to sleep mode.
This function prevents the system from going to sleep, thus allowing to get the lowest possible latency. It uses a reference counter, so as many calls to os_unblock_powersave() as calls to os_block_powersave() will be needed to re-enable the sleep mode.
uint8_t os_cancel_job | ( | os_job_t * | job | ) |
Cancels a scheduled job.
This function cancels a job that has been previously scheduled (delayed or not).
job | The job to cancel. |
uint8_t | 1 if the job has been canceled, 0 otherwise. |
void os_delay | ( | os_time_t | time | ) |
Waits for a given time.
This function waits for a given time.
time | How much time to wait. |
os_time_t os_get_elapsed_time | ( | os_time_t | time | ) |
Returns how much time passed since a given timestamp.
This function returns how much time passed since a given timestamp.
time | The timestamp used as origin. |
os_time_t |
os_time_t os_get_time | ( | void | ) |
Gets the current time.
This function returns the current time in ticks.
os_time_t |
void os_init | ( | void | ) |
Initializes the Operating System.
This function initializes the Low-Level system dependencies.
void os_mainloop | ( | void | ) |
The Operating System mainloop.
This is the Operating System mainloop. It must be called only once, as soon as basic system initialization has been performed.
void os_post_delayed_job | ( | os_job_t * | job, |
os_time_t | time, | ||
void(*)(os_job_t *) | cb | ||
) |
Posts a job to be executed at a given time.
This function posts a job that will be executed at a given time. If the job is already scheduled, it will be canceled first.
job | The job handle. |
time | The timestamp at which the job needs to be executed. |
cb | The callback that will be executed. |
void os_post_job | ( | os_job_t * | job, |
void(*)(os_job_t *) | cb | ||
) |
Posts a job to be executed as soon as possible.
This function posts a job that will be executed as soon as possible. If the job is already scheduled, it will be canceled first.
job | The job handle. |
cb | The callback that will be executed. |
void os_unblock_powersave | ( | void | ) |
Allows the system to go to sleep mode.
This function allows the system to go to sleep mode. Any calls to os_block_powersave() must be released at a point by a call to os_unblock_powersave().
void os_wait_until | ( | os_time_t | time | ) |
Waits until a given time.
This function blocks until the given time is reached.
time | The timestamp to reach. |