38 #ifndef OS_MSGQUEUE_H__
39 #define OS_MSGQUEUE_H__
60 typedef uint8_t MsgQ_t;
75 #define OS_MSG_Q_POST(task_id, msg, delay, period, async ) do {\
77 MsgQ_t queue = os_msgQ_find(task_id);\
78 os_task_set_wait_queue(running_tid, queue);\
79 Evt_t event = os_msgQ_event_get( queue );\
80 os_task_set_change_event(running_tid, event);\
82 os_posted = os_msg_post( (Msg_t*)&msg, os_msgQ_find(task_id), delay, period );\
83 if ( os_posted == MSG_QUEUE_FULL ){\
85 os_task_set_msg_result(running_tid, os_posted);\
87 os_posted = os_task_get_msg_result(running_tid);\
88 event = os_task_get_change_event(running_tid);\
91 os_posted = MSG_QUEUE_UNDEF;\
94 } while ( os_posted == MSG_QUEUE_FULL );\
95 if ( MSG_QUEUE_POSTED == os_posted ) {\
96 os_signal_event(event);\
97 os_event_set_signaling_tid( event, running_tid );\
103 #define OS_MSG_Q_RECEIVE(task_id, pMsg, async) do {\
104 uint8_t os_received;\
105 MsgQ_t queue = os_msgQ_find(task_id);\
106 os_task_set_wait_queue(running_tid, queue);\
107 Evt_t event = os_msgQ_event_get(queue);\
108 os_task_set_change_event(running_tid, event);\
110 os_received = os_msg_receive((Msg_t*)pMsg, os_msgQ_find(task_id));\
111 if ( os_received == MSG_QUEUE_EMPTY ){\
113 os_task_set_msg_result(running_tid, os_received);\
115 os_received = os_task_get_msg_result(running_tid);\
116 event = os_task_get_change_event(running_tid);\
119 ((Msg_t*)pMsg)->signal = NO_MSG_ID;\
120 os_received = MSG_QUEUE_UNDEF;\
123 } while ( os_received == MSG_QUEUE_EMPTY );\
124 if ( MSG_QUEUE_RECEIVED == os_received) {\
125 os_signal_event(event);\
126 os_event_set_signaling_tid(event, running_tid );\
134 MsgQ_t os_msgQ_create(
Msg_t *buffer, uint8_t nMessages, uint16_t msgSize, uint8_t task_id );
135 MsgQ_t os_msgQ_find( uint8_t task_id );
137 Evt_t os_msgQ_event_get( MsgQ_t queue );
138 void os_msgQ_tick( MsgQ_t queue );
140 uint8_t os_msg_post(
Msg_t *msg, MsgQ_t queue, uint16_t delay, uint16_t period );
141 uint8_t os_msg_receive(
Msg_t *msg, MsgQ_t queue );
Definition: os_msgqueue.h:50