Loading...
Searching...
No Matches
os_eventq.h File Reference

mynewt-core event and event queue abstraction More...

Detailed Description

mynewt-core event and event queue abstraction

Author
Francisco Molina franc.nosp@m.ois-.nosp@m.xavie.nosp@m.r.mo.nosp@m.lina@.nosp@m.inri.nosp@m.a.fr

Definition in file os_eventq.h.

#include <os/os_types.h>
#include "event/callback.h"
+ Include dependency graph for os_eventq.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  os_event
 Event wrapper. More...
 
struct  os_eventq
 Event queue wrapper. More...
 

Typedefs

typedef void os_event_fn(struct os_event *ev)
 Event callback function.
 

Functions

static void os_event_init (struct os_event *ev, os_event_fn *fn, void *arg)
 Init a event.
 
static bool os_event_is_queued (struct os_event *ev)
 Check if event is in queue.
 
static void * os_event_get_arg (struct os_event *ev)
 Returns event argument.
 
static void os_event_set_arg (struct os_event *ev, void *arg)
 Set the event argument.
 
static void os_event_run (struct os_event *ev)
 Runs an event.
 
static void os_eventq_init (struct os_eventq *evq)
 Initialize the event queue.
 
static int os_eventq_inited (struct os_eventq *evq)
 Check whether the event queue is initialized.
 
static void os_eventq_deinit (struct os_eventq *evq)
 Deinitialize an event queue.
 
static struct os_eventos_eventq_get (struct os_eventq *evq, os_time_t tmo)
 Get next event from event queue.
 
static struct os_eventos_eventq_get_no_wait (struct os_eventq *evq)
 Get next event from event queue, non-blocking.
 
static void os_eventq_put (struct os_eventq *evq, struct os_event *ev)
 Put an event on the event queue.
 
static void os_eventq_remove (struct os_eventq *evq, struct os_event *ev)
 Remove an event from the queue.
 
static void os_eventq_run (struct os_eventq *evq)
 Gets and runs an event from the queue callback.
 
static bool os_eventq_is_empty (struct os_eventq *evq)
 Check if queue is empty.
 

Typedef Documentation

◆ os_event_fn

typedef void os_event_fn(struct os_event *ev)

Event callback function.

Definition at line 51 of file os_eventq.h.

Function Documentation

◆ os_event_get_arg()

static void * os_event_get_arg ( struct os_event ev)
inlinestatic

Returns event argument.

Parameters
[in]evevent

Definition at line 89 of file os_eventq.h.

◆ os_event_init()

static void os_event_init ( struct os_event ev,
os_event_fn fn,
void *  arg 
)
inlinestatic

Init a event.

Parameters
[in]evpointer to event to set
[in]fnevent callback function
[in]argevent argument

Definition at line 60 of file os_eventq.h.

◆ os_event_is_queued()

static bool os_event_is_queued ( struct os_event ev)
inlinestatic

Check if event is in queue.

Parameters
[in]evevent to check
Returns
true if event is queues, false otherwise

Definition at line 79 of file os_eventq.h.

◆ os_event_run()

static void os_event_run ( struct os_event ev)
inlinestatic

Runs an event.

Parameters
[in]evevent to run

Definition at line 110 of file os_eventq.h.

◆ os_event_set_arg()

static void os_event_set_arg ( struct os_event ev,
void *  arg 
)
inlinestatic

Set the event argument.

Parameters
[in]evevent
[in]argarg to set event

Definition at line 100 of file os_eventq.h.

◆ os_eventq_deinit()

static void os_eventq_deinit ( struct os_eventq evq)
inlinestatic

Deinitialize an event queue.

Note
Not supported in RIOT
Parameters
[in]evqthe event queue to deinit

Definition at line 142 of file os_eventq.h.

◆ os_eventq_get()

static struct os_event * os_eventq_get ( struct os_eventq evq,
os_time_t  tmo 
)
inlinestatic

Get next event from event queue.

Parameters
[in]evqthe event queue to pull an event from
[in]tmotimeout, OS_WAIT_FOREVER to block, 0 to return immediately
Returns
the event from the queue

Definition at line 156 of file os_eventq.h.

◆ os_eventq_get_no_wait()

static struct os_event * os_eventq_get_no_wait ( struct os_eventq evq)
inlinestatic

Get next event from event queue, non-blocking.

Returns
event from the queue, or NULL if none available.

Definition at line 178 of file os_eventq.h.

◆ os_eventq_init()

static void os_eventq_init ( struct os_eventq evq)
inlinestatic

Initialize the event queue.

Parameters
[in]evqThe event queue to initialize

Definition at line 120 of file os_eventq.h.

◆ os_eventq_inited()

static int os_eventq_inited ( struct os_eventq evq)
inlinestatic

Check whether the event queue is initialized.

Parameters
[in]evqthe event queue to check

Definition at line 130 of file os_eventq.h.

◆ os_eventq_is_empty()

static bool os_eventq_is_empty ( struct os_eventq evq)
inlinestatic

Check if queue is empty.

Parameters
[in]evqthe event queue to check
Returns
true if empty, false otherwise

Definition at line 227 of file os_eventq.h.

◆ os_eventq_put()

static void os_eventq_put ( struct os_eventq evq,
struct os_event ev 
)
inlinestatic

Put an event on the event queue.

Parameters
[in]evqevent queue
[in]evevent to put in queue

Definition at line 193 of file os_eventq.h.

◆ os_eventq_remove()

static void os_eventq_remove ( struct os_eventq evq,
struct os_event ev 
)
inlinestatic

Remove an event from the queue.

Parameters
[in]evqevent queue to remove the event from
[in]evevent to remove from the queue

Definition at line 204 of file os_eventq.h.

◆ os_eventq_run()

static void os_eventq_run ( struct os_eventq evq)
inlinestatic

Gets and runs an event from the queue callback.

Parameters
[in]evqThe event queue to pull the item off.

Definition at line 214 of file os_eventq.h.