![]() |
EVE 1.0
|
![]() |
Data Structures | |
struct | uwork_t |
Macros | |
#define | UWORK_USEC(us) (us) |
#define | UWORK_INIT(x, callback) |
#define | UWORK_INIT_TYPED(x, callback) (struct uwork_t) UWORK_INIT(x, callback) |
#define | DECLARE_UWORK(x, callback) struct uwork_t x = UWORK_INIT(x, callback) |
Typedefs | |
typedef int32_t | uwork_time_t |
typedef void(* | uwork_cb_t) (struct uwork_t *work) |
Functions | |
uwork_time_t | uwork_now (void) |
void | uwork_schedule (struct uwork_t *work) |
void | uwork_cancel (struct uwork_t *work) |
static bool | uwork_pending (struct uwork_t *work) |
void | uwork_init (void) |
#define UWORK_USEC | ( | us | ) | (us) |
Converts a time interval, given in number of microseconds, to the number of microticks.
us | duration of the time interval, microseconds |
Definition at line 58 of file uwork.h.
Referenced by clock_delay_usec().
#define UWORK_INIT | ( | x, | |
callback | |||
) |
Initializes a microwork structure.
The macro is used to initialize a microsecond-scale work (microwork) structure instance.
x | microwork structure |
callback | microwork callback |
Usage:
#define UWORK_INIT_TYPED | ( | x, | |
callback | |||
) | (struct uwork_t) UWORK_INIT(x, callback) |
Initializes a microwork structure. Typed version of UWORK_INIT
#define DECLARE_UWORK | ( | x, | |
callback | |||
) | struct uwork_t x = UWORK_INIT(x, callback) |
Instantiates a microwork structure.
The macro is used to instantiate a work structure.
x | name of the microwork structure |
callback | the microwork callback |
Usage:
typedef int32_t uwork_time_t |
typedef void(* uwork_cb_t) (struct uwork_t *work) |
uwork_time_t uwork_now | ( | void | ) |
Returns the current timestamp, which can be used as a time reference in struct uwork_t::at
Usage:
microticks
Referenced by clock_delay_usec().
void uwork_schedule | ( | struct uwork_t * | work | ) |
Schedules a microwork.
The function schedules a microwork for execution at the specified point in time. The microwork will be executed at the hardware interrupt level. It is allowed to schedule a microwork in the past. In this case it is triggered for execution immediately.
If two or more microworks are scheduled for the same tick, they will be executed in the same order as thay were scheduled. As hardware interrupt routines, microworks preempt software interrupts (that implies also works and milliworks) and OS processes. A microwork selv can be preempted by high-priority low-level BLE radio interrupts.
If the microwork structure, pointed by the work
parameter is already scheduled for execution, then it is re-scheduled at the new time.
A scheduled microwork holds system at PM_LEVEL_CONSTLAT power level.
work | pointer to the microwork structure |
Referenced by clock_delay_usec().
void uwork_cancel | ( | struct uwork_t * | work | ) |
Cancels a scheduled microwork.
The function cancels a previously scheduled work.
work | pointer to the microwork structure |
|
inlinestatic |
Checks if the microwork is scheduled and pending execution.
The function checks if the microwork is scheduled for execution.
work | pointer to the microwork structure |
Definition at line 207 of file uwork.h.
References dlist_is_empty(), work_t::link, uwork_init(), and uwork_t::work.
Referenced by clock_delay_usec().
void uwork_init | ( | void | ) |
Initializes the microwork framework
Referenced by uwork_pending().