Functions | |
void | flags_init (flags_t *flags, flags_value_t value) |
void | flags_deinit (flags_t *flags) |
void | flags_clr (flags_t *flags, flags_mask_t mask) |
flags_t * | flags_create (flags_value_t value) |
void | flags_destroy (flags_t *flags) |
flags_value_t | flags_get (flags_t *flags) |
void | flags_set (flags_t *flags, flags_mask_t mask) |
void | flags_wait_all (flags_t *flags, flags_mask_t mask, flags_value_t *value) |
int | flags_wait_all_tmo (flags_t *flags, flags_mask_t mask, tick_t time, flags_mask_t *value) |
void | flags_wait_any (flags_t *flags, flags_mask_t mask, flags_value_t *value) |
int | flags_wait_any_tmo (flags_t *flags, flags_mask_t mask, tick_t time, flags_value_t *value) |
void | flags_set_name (flags_t *flags, const char *name) |
void | flags_show (void) |
void | flags_show_with_fmt_fn (fmt_fn_t fn) |
void flags_clr | ( | flags_t * | flags, |
flags_mask_t | mask | ||
) |
Clears the flag. Bits that are set to one in the mask are cleared in the flag register. Bits that are set to zero in the mask are left unmodified.
flags | Flags handle |
mask | Mask value |
flags_t* flags_create | ( | flags_value_t | value | ) |
Allocates and initialises a flags handle. See flags_init() for further details.
value | Initial value of flags |
void flags_deinit | ( | flags_t * | flags | ) |
Deinitialises the flags handle. The flags must not be in use when this function is called (no task can be waiting on the flag, nor can they do so at any time after calling this function).
This function must not be called with a handle that was returned by flags_create(). See flags_destroy().
flags | Flags handle |
void flags_destroy | ( | flags_t * | flags | ) |
Frees the resources allocated by the flags. The flags must not be in use when this function is called (no task can be waiting on the flag, nor can they do so at any time after calling this function).
This function must only be called with a handle that was returned by flags_create().
flags | Flags handle |
flags_value_t flags_get | ( | flags_t * | flags | ) |
Gets the value in the flag register.
flags | Flags handle |
void flags_init | ( | flags_t * | flags, |
flags_value_t | value | ||
) |
Initialises a flags handle. The flag register is initialised to value.
This function must not be called with a handle that was returned by flags_create().
flags | Flags handle |
value | Initial value of flags |
void flags_set | ( | flags_t * | flags, |
flags_mask_t | mask | ||
) |
Sets the flag. Bits that are set to one in the mask are set in the flag register. Bits that are set to zero in the mask are left unmodified.
If any tasks were waiting on any of the bits that were modified, they will be put in the READY state.
flags | Flags handle |
mask | Mask value |
void flags_set_name | ( | flags_t * | flags, |
const char * | name | ||
) |
Sets the name of the flag.
This function is only used for debugging purposes, where a kernel-aware debugger may present this name to the user.
The name will be stored in a separate table for kernel objects. If the name could not be set, the error is silently ignored.
flags | Flags handle |
name | String describing flag |
void flags_show | ( | void | ) |
Prints all registered flags to stdout using rprintp(). This may prove useful for debugging purposes. This function should not be called from application code, but may be called from e.g. uerror() or an exception handler.
void flags_show_with_fmt_fn | ( | fmt_fn_t | fn | ) |
Same as flags_show(), but using supplied function for formatted output.
fn | Function for formatted output |
void flags_wait_all | ( | flags_t * | flags, |
flags_mask_t | mask, | ||
flags_value_t * | value | ||
) |
Waits for all of the requested bits in the flag register to be set.
If all of the bits that are set to one in the mask are also set to one in the flag, then the function will return immediately. If any of the bits that are set to one in the mask are not set in the flag, then the calling task is put in the WAITING state.
flags | Flags handle |
mask | Mask value |
value | Updated with value of flags after waiting |
int flags_wait_all_tmo | ( | flags_t * | flags, |
flags_mask_t | mask, | ||
tick_t | time, | ||
flags_mask_t * | value | ||
) |
Analogous to flags_wait_all(), but a maximum time to wait can be specified. If any of the requested bits are not set, the calling task will wait until all of the requested bits become set, or the number of ticks given by time expires.
flags | Flags handle |
mask | Mask value |
time | Number of ticks to wait |
value | Updated with value of flags after waiting |
void flags_wait_any | ( | flags_t * | flags, |
flags_mask_t | mask, | ||
flags_value_t * | value | ||
) |
Waits for any of the requested bits in the flag register to be set.
If any of the bits that are set to one in the mask are also set to one in the flag, then the function will return immediately. If none of the bits that are set to one in the mask are set in the flag, then the calling task is put in the WAITING state.
flags | Flags handle |
mask | Mask value |
value | Updated with value of flag register after waiting |
int flags_wait_any_tmo | ( | flags_t * | flags, |
flags_mask_t | mask, | ||
tick_t | time, | ||
flags_value_t * | value | ||
) |
Analogous to flags_wait_any(), but a maximum time to wait can be specified. If none of the requested bits are set, the calling task will wait until any of the requested bits become set, or the number of ticks given by time expires.
flags | Flags handle |
mask | Mask value |
time | Number of ticks to wait |
value | Updated with value of flag register after waiting |