cocoOS  5.0.1
os_event.h File Reference
#include "cocoos.h"
#include "stdarg.h"

Go to the source code of this file.

Data Structures

struct  EventQueue_t
 

Macros

#define EVENT_OFS1   10000
 
#define EVENT_OFS2   11000
 
#define EVENT_OFS3   12000
 
#define OS_WAIT_SINGLE_EVENT(x, timeout)
 
#define OS_WAIT_MULTIPLE_EVENTS(waitAll, args...)
 
#define OS_SIGNAL_EVENT(event)
 
#define OS_INT_SIGNAL_EVENT(event)
 
#define OS_GET_TASK_TIMEOUT_VALUE()   os_task_timeout_get(running_tid)
 
#define EVENT_QUEUE_SIZE   ((N_TOTAL_EVENTS/9)+1)
 

Typedefs

typedef uint8_t Evt_t
 

Functions

void os_event_init ()
 
void os_wait_event (uint8_t tid, Evt_t ev, uint8_t waitSingleEvent, uint16_t timeout)
 
void os_wait_multiple (uint8_t waitAll,...)
 
void os_signal_event (Evt_t ev)
 
void os_event_set_signaling_tid (Evt_t ev, uint8_t tid)
 
Evt_t event_last_signaled_get (void)
 

Detailed Description

Event header file

Macro Definition Documentation

#define OS_INT_SIGNAL_EVENT (   event)
Value:
do {\
os_signal_event(event);\
os_event_set_signaling_tid( event, ISR_TID );\
} while (0)
#define OS_SIGNAL_EVENT (   event)
Value:
do {\
os_signal_event(event);\
os_event_set_signaling_tid( event, running_tid );\
OS_SCHEDULE(EVENT_OFS3);\
} while (0)
#define OS_WAIT_MULTIPLE_EVENTS (   waitAll,
  args... 
)
Value:
do {\
os_wait_multiple(waitAll, args, NO_EVENT);\
OS_SCHEDULE(EVENT_OFS2);\
} while (0)
#define OS_WAIT_SINGLE_EVENT (   x,
  timeout 
)
Value:
do {\
os_wait_event(running_tid,x,1,timeout);\
OS_SCHEDULE(EVENT_OFS1);\
} while (0)

Function Documentation

Evt_t event_last_signaled_get ( void  )

Gets the last signaled event

Returns
Last signaled event
Remarks
Usage:
Used when waiting for multiple events, to find out which event was signaled.
1 event_wait_multiple(0, event1, event2);
2 Evt_t lastEvt = event_last_signaled_get();
3 if ( lastEvt == event1 ) {
4  ...
5 }