kernel: events: add function to clear events
Shortcut making it easier to clear events than with k_event_set_masked. Signed-off-by: Martin Jäger <martin@libre.solar>
This commit is contained in:
parent
58ece9d503
commit
caba2ad616
|
@ -2142,6 +2142,16 @@ __syscall void k_event_set(struct k_event *event, uint32_t events);
|
||||||
__syscall void k_event_set_masked(struct k_event *event, uint32_t events,
|
__syscall void k_event_set_masked(struct k_event *event, uint32_t events,
|
||||||
uint32_t events_mask);
|
uint32_t events_mask);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Clear the events in an event object
|
||||||
|
*
|
||||||
|
* This routine clears (resets) the specified events stored in an event object.
|
||||||
|
*
|
||||||
|
* @param event Address of the event object
|
||||||
|
* @param events Set of events to clear in @a event
|
||||||
|
*/
|
||||||
|
__syscall void k_event_clear(struct k_event *event, uint32_t events);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Wait for any of the specified events
|
* @brief Wait for any of the specified events
|
||||||
*
|
*
|
||||||
|
|
|
@ -188,6 +188,20 @@ void z_vrfy_k_event_set_masked(struct k_event *event, uint32_t events,
|
||||||
#include <syscalls/k_event_set_masked_mrsh.c>
|
#include <syscalls/k_event_set_masked_mrsh.c>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void z_impl_k_event_clear(struct k_event *event, uint32_t events)
|
||||||
|
{
|
||||||
|
k_event_post_internal(event, 0, events);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_USERSPACE
|
||||||
|
void z_vrfy_k_event_clear(struct k_event *event, uint32_t events)
|
||||||
|
{
|
||||||
|
Z_OOPS(Z_SYSCALL_OBJ(event, K_OBJ_EVENT));
|
||||||
|
z_impl_k_event_clear(event, events);
|
||||||
|
}
|
||||||
|
#include <syscalls/k_event_clear_mrsh.c>
|
||||||
|
#endif
|
||||||
|
|
||||||
static uint32_t k_event_wait_internal(struct k_event *event, uint32_t events,
|
static uint32_t k_event_wait_internal(struct k_event *event, uint32_t events,
|
||||||
unsigned int options, k_timeout_t timeout)
|
unsigned int options, k_timeout_t timeout)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue