event.h File Reference

Event API. More...

Detailed Description

#include <stdint.h>
#include <string.h>
#include "assert.h"
#include "clist.h"
#include "irq.h"
#include "thread.h"
#include "thread_flags.h"
+ Include dependency graph for event.h:

Go to the source code of this file.

Data Structures

struct  event
 event structure More...
 
struct  event_queue_t
 event queue structure More...
 

Macros

#define THREAD_FLAG_EVENT   (0x1)
 Thread flag use to notify available events in an event queue.
 
#define EVENT_QUEUE_INIT   { .waiter = thread_get_active() }
 event_queue_t static initializer
 
#define EVENT_QUEUE_INIT_DETACHED   { .waiter = NULL }
 static initializer for detached event queues
 

Typedefs

typedef struct event event_t
 event structure forward declaration
 
typedef void(* event_handler_t) (event_t *)
 event handler type definition
 

Functions

static void event_queues_init (event_queue_t *queues, size_t n_queues)
 Initialize an array of event queues. More...
 
static void event_queue_init (event_queue_t *queue)
 Initialize an event queue. More...
 
static void event_queues_init_detached (event_queue_t *queues, size_t n_queues)
 Initialize an array of event queues not binding it to a thread. More...
 
static void event_queue_init_detached (event_queue_t *queue)
 Initialize an event queue not binding it to a thread. More...
 
static void event_queues_claim (event_queue_t *queues, size_t n_queues)
 Bind an array of event queues to the calling thread. More...
 
static void event_queue_claim (event_queue_t *queue)
 Bind an event queue to the calling thread. More...
 
void event_post (event_queue_t *queue, event_t *event)
 Queue an event. More...
 
void event_cancel (event_queue_t *queue, event_t *event)
 Cancel a queued event. More...
 
event_tevent_get (event_queue_t *queue)
 Get next event from event queue, non-blocking. More...
 
event_tevent_wait_multi (event_queue_t *queues, size_t n_queues)
 Get next event from the given event queues, blocking. More...
 
static event_tevent_wait (event_queue_t *queue)
 Get next event from event queue, blocking. More...
 
event_tevent_wait_timeout (event_queue_t *queue, uint32_t timeout)
 Get next event from event queue, blocking until timeout expires. More...
 
event_tevent_wait_timeout64 (event_queue_t *queue, uint64_t timeout)
 Get next event from event queue, blocking until timeout expires. More...
 
static void event_loop_multi (event_queue_t *queues, size_t n_queues)
 Simple event loop with multiple queues. More...
 
static void event_loop (event_queue_t *queue)
 Simple event loop. More...