Message Queue Support. More...
|
Functions | |
| NUTMSGQ * | NutMsgQCreate (uint8_t bits) |
| Allocate a new message que. | |
| int | NutMsgQBroadcast (uint8_t id, int param, void *data) |
| Send a message to all message ques. | |
| int | NutMsgQPost (NUTMSGQ *que, uint8_t id, int param, void *data) |
| Send a message to a que and return immediately. | |
| int | NutMsgQSend (NUTMSGQ *que, uint8_t id, int param, void *data) |
| Send a message to a que and yields so that a waiting thread can act on the message. | |
| int | NutMsgQFull (NUTMSGQ *que) |
| Checks the state of a que. | |
| HANDLE | NutMsgQStartTimer (NUTMSGQ *que, uint32_t ms, int param, void *data, uint8_t flags) |
| Starts a periodic or one-shot timer on the given que. | |
| void | NutMsgQStopTimer (HANDLE timer) |
| Stops a timer. | |
| int | NutMsgQGetMessage (NUTMSGQ *que, NUTMSG *msg, uint32_t timeout) |
| Gets the next message from the que. | |
| void | NutMsgQFlush (NUTMSGQ *que) |
| Removes all entries from a que. | |
Variables | |
| NUTMSGQ * | nutMsgQue |
| global list of ques | |
| NUTMSGTMR * | nutMsgFreeTimers |
Message Queue Support.
Allocate a new message que.
| bits | size of the que in bits |
Definition at line 99 of file msg.c.
References ASSERT, _NUTMSGQ::mq_mask, _NUTMSGQ::mq_next, NutHeapAllocClear, and nutMsgQue.
| int NutMsgQBroadcast | ( | uint8_t | id, |
| int | param, | ||
| void * | data | ||
| ) |
Send a message to all message ques.
| id | the id of the sent message |
| param | the param of the sent message |
| data | the data of the sent message |
Definition at line 132 of file msg.c.
References _NUTMSGQ::mq_next, NutMsgQPost(), and nutMsgQue.

Send a message to a que and return immediately.
| que | the que to send to |
| id | the id of the sent message |
| param | the param of the sent message |
| data | the data of the sent message |
Definition at line 157 of file msg.c.
References _NUTMSG::data, _NUTMSG::id, _NUTMSGQ::mq_mask, _NUTMSGQ::mq_que, _NUTMSGQ::mq_wait, _NUTMSGQ::mq_write, NutEnterCritical, NutEventPostAsync(), NutExitCritical, NutJumpOutCritical, NutMsgQFull(), and _NUTMSG::param.
Referenced by NutMsgQBroadcast(), and NutMsgQSend().

Send a message to a que and yields so that a waiting thread can act on the message.
The sending thread should have a lower priority than the receiver thread
| que | the que to send to |
| id | the id of the sent message |
| param | the param of the sent message |
| data | the data of the sent message |
Definition at line 197 of file msg.c.
References NutMsgQPost(), and NutThreadYield().

| int NutMsgQFull | ( | NUTMSGQ * | que | ) |
Checks the state of a que.
Definition at line 211 of file msg.c.
References _NUTMSGQ::mq_mask, _NUTMSGQ::mq_read, and _NUTMSGQ::mq_write.
Referenced by NutMsgQPost().
Starts a periodic or one-shot timer on the given que.
| que | the que to send to |
| ms | timeout length of the timer |
| param | the param of the sent message |
| data | the data of the sent message |
| flags | 0 or TM_ONESHOT |
Definition at line 253 of file msg.c.
References ASSERT, _NUTMSGQ::mq_timers, _NUTMSGTMR::mt_data, _NUTMSGTMR::mt_flags, _NUTMSGTMR::mt_handle, _NUTMSGTMR::mt_next, _NUTMSGTMR::mt_param, _NUTMSGTMR::mt_que, NutHeapAlloc, nutMsgFreeTimers, NutTimerStart(), and TM_ONESHOT.

| void NutMsgQStopTimer | ( | HANDLE | timer | ) |
Stops a timer.
| timer | HANDLE of the timer to stop |
Definition at line 305 of file msg.c.
References _NUTMSG::data, _NUTMSG::id, _NUTMSGQ::mq_mask, _NUTMSGQ::mq_que, _NUTMSGQ::mq_read, _NUTMSGQ::mq_write, MSG_NULL, MSG_TIMER, _NUTMSGTMR::mt_handle, _NUTMSGTMR::mt_que, NutEnterCritical, NutExitCritical, and NutTimerStop().

Gets the next message from the que.
| que | the que to wait on |
| msg | pointer to memory to return data to |
| timeout | how long to wait for a message |
Definition at line 345 of file msg.c.
References ASSERT, _NUTMSG::data, _NUTMSG::id, _NUTMSGQ::mq_mask, _NUTMSGQ::mq_que, _NUTMSGQ::mq_read, _NUTMSGQ::mq_wait, _NUTMSGQ::mq_write, MSG_TIMER, _NUTMSGTMR::mt_data, _NUTMSGTMR::mt_flags, _NUTMSGTMR::mt_param, NutEnterCritical, NutEventPostAsync(), NutEventWait(), NutExitCritical, NutJumpOutCritical, _NUTMSG::param, and TM_ONESHOT.

| void NutMsgQFlush | ( | NUTMSGQ * | que | ) |
Removes all entries from a que.
Definition at line 383 of file msg.c.
References _NUTMSGQ::mq_read, _NUTMSGQ::mq_wait, _NUTMSGQ::mq_write, NutEnterCritical, and NutExitCritical.
global list of ques
Definition at line 86 of file msg.c.
Referenced by NutMsgQBroadcast(), and NutMsgQCreate().
Definition at line 88 of file msg.c.
Referenced by NutMsgQStartTimer().