void OSQPost (OS_Q *p_q,
void *p_void,
OS_MSG_SIZE msg_size,
OS_OPT opt,
OS_ERR *p_err)
File | Called from | Code enabled by |
---|---|---|
| Task or ISR |
|
...
Description
Sends a message to a task through a message queue. A message is a pointer-sized variable, and its use is application specific. If the message queue is full, an error code is returned to the caller. In this case, OSQPost()
immediately returns to its caller, and the message is not placed in the message queue.
...
If any task is waiting for a message at the message queue, OSQPost()
allows the user to either post the message to the highest-priority task waiting at the queue (opt
set to OS_OPT_POST_FIFO
or OS_OPT_POST_LIFO
), or to all tasks waiting at the message queue (opt
is set to OS_OPT_POST_ALL
). In either case, scheduling occurs unless opt
is also set to OS_OPT_POST_NO_SCHED
.
Files
os.h/os_q.c
Prototype
Arguments
p_q
is a pointer to the message queue being posted to.
...
If the queue is full and therefore cannot accept more messages.
Returned Value
None
Required Configuration
OS_CFG_Q_EN
must be enabled in os_cfg.h. Refer to uC-OS-III Configuration Manual
Callers
Application and ISRs.
Notes/Warnings
- Queues must be created before they are used.
- Possible combinations of options are:
OS_OPT_POST_FIFO
OS_OPT_POST_LIFO
OS_OPT_POST_FIFO + OS_OPT_POST_ALL
OS_OPT_POST_LIFO + OS_OPT_POST_ALL
OS_OPT_POST_FIFO + OS_OPT_POST_NO_SCHED
OS_OPT_POST_LIFO + OS_OPT_POST_NO_SCHED
OS_OPT_POST_FIFO + OS_OPT_POST_ALL + OS_OPT_POST_NO_SCHED
OS_OPT_POST_LIFO + OS_OPT_POST_ALL + OS_OPT_POST_NO_SCHED
...
- Although the example below shows calling
OSQPost()
from a task, it can also be called from an ISR.