...
Files
os.h/os_q.c
Prototype
Code Block |
---|
void OSQPost (OS_Q *p_q,
void *p_void,
OS_MSG_SIZE msg_size,
OS_OPT opt,
OS_ERR *p_err) |
Arguments
p_q
is a pointer to the message queue being posted to.
...
If no tasks were waiting on the queue. In this case, the return value is also 0.
OS_ERR_INT_Q_FULL
If OS_CFG_ISR_POST_DEFERRED_EN
is to DEF_ENABLED
in os_cfg.h
: If the deferred interrupt post queue is full.
OS_ERR_MSG_POOL_EMPTY
If there are no more OS_MSG
structures to use to store the message.
...
- 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.
Example Usage
Code Block | ||
---|---|---|
| ||
OS_Q CommQ;
CPU_INT08U CommRxBuf[100];
void CommTaskRx (void *p_arg)
{
OS_ERR err;
(void)&p_arg;
while (DEF_ON) {
:
:
OSQPost(&CommQ,
&CommRxBuf[0],
sizeof(CommRxBuf),
OS_OPT_POST_FIFO + OS_OPT_POST_ALL + OS_OPT_POST_NO_SCHED,
&err);
/* Check "err" */
:
:
}
} |