cocoOS  5.0.1
os_msgqueue.h File Reference
#include "os_defines.h"

Go to the source code of this file.

Data Structures

struct  Msg_t
 

Macros

#define OS_MSG_Q_POST(task_id, msg, delay, period, async)
 
#define OS_MSG_Q_RECEIVE(task_id, pMsg, async)
 

Typedefs

typedef uint8_t MsgQ_t
 

Enumerations

enum  {
  MSG_QUEUE_UNDEF, MSG_QUEUE_DEF, MSG_QUEUE_EMPTY, MSG_QUEUE_FULL,
  MSG_QUEUE_RECEIVED, MSG_QUEUE_POSTED
}
 

Functions

void os_msgQ_init ()
 
MsgQ_t os_msgQ_create (Msg_t *buffer, uint8_t nMessages, uint16_t msgSize, uint8_t task_id)
 
MsgQ_t os_msgQ_find (uint8_t task_id)
 
Evt_t os_msgQ_event_get (MsgQ_t queue)
 
void os_msgQ_tick (MsgQ_t queue)
 
uint8_t os_msg_post (Msg_t *msg, MsgQ_t queue, uint16_t delay, uint16_t period)
 
uint8_t os_msg_receive (Msg_t *msg, MsgQ_t queue)
 

Detailed Description

Message queue header file

Macro Definition Documentation

#define OS_MSG_Q_POST (   task_id,
  msg,
  delay,
  period,
  async 
)
Value:
do {\
uint8_t os_posted;\
MsgQ_t queue = os_msgQ_find(task_id);\
os_task_set_wait_queue(running_tid, queue);\
Evt_t event = os_msgQ_event_get( queue );\
os_task_set_change_event(running_tid, event);\
do {\
os_posted = os_msg_post( (Msg_t*)&msg, os_msgQ_find(task_id), delay, period );\
if ( os_posted == MSG_QUEUE_FULL ){\
if ( async == 0 ) {\
os_task_set_msg_result(running_tid, os_posted);\
event_wait(event);\
os_posted = os_task_get_msg_result(running_tid);\
event = os_task_get_change_event(running_tid);\
}\
else {\
os_posted = MSG_QUEUE_UNDEF;\
}\
}\
} while ( os_posted == MSG_QUEUE_FULL );\
if ( MSG_QUEUE_POSTED == os_posted ) {\
os_signal_event(event);\
os_event_set_signaling_tid( event, running_tid );\
}\
} while(0)
#define event_wait(event)
Definition: os_applAPI.h:263
Definition: os_msgqueue.h:50
#define OS_MSG_Q_RECEIVE (   task_id,
  pMsg,
  async 
)
Value:
do {\
uint8_t os_received;\
MsgQ_t queue = os_msgQ_find(task_id);\
os_task_set_wait_queue(running_tid, queue);\
Evt_t event = os_msgQ_event_get(queue);\
os_task_set_change_event(running_tid, event);\
do {\
os_received = os_msg_receive((Msg_t*)pMsg, os_msgQ_find(task_id));\
if ( os_received == MSG_QUEUE_EMPTY ){\
if ( async == 0 ) {\
os_task_set_msg_result(running_tid, os_received);\
event_wait(event);\
os_received = os_task_get_msg_result(running_tid);\
event = os_task_get_change_event(running_tid);\
}\
else {\
((Msg_t*)pMsg)->signal = NO_MSG_ID;\
os_received = MSG_QUEUE_UNDEF;\
}\
}\
} while ( os_received == MSG_QUEUE_EMPTY );\
if ( MSG_QUEUE_RECEIVED == os_received) {\
os_signal_event(event);\
os_event_set_signaling_tid(event, running_tid );\
}\
} while(0)
#define event_wait(event)
Definition: os_applAPI.h:263
Definition: os_msgqueue.h:50