...
Files
os.h/os_q.c
Prototype
Code Block |
---|
void OSQCreate (OS_Q *p_q,
CPU_CHAR *p_name,
OS_MSG_QTY max_qty,
OS_ERR *p_err) |
Arguments
p_q
is a pointer to the message queue control block. It is assumed that storage for the message queue will be allocated in the application. The user will need to declare a “global” variable as follows, and pass a pointer to this variable to OSQCreate()
:
OS_Q MyMsgQ MyMsgQ;
p_name
is a pointer to an ASCII string used to name the message queue. The name can be displayed by debuggers or µC/Probe.
...
If OS_CFG_CALLED_FROM_ISR_CHK_EN
set to 1
in DEF_ENABLED
in os_cfg.h
: if attempting to create the message queue from an ISR.
OS_ERR_ILLEGAL_CREATE_RUN_TIME
If OS_SAFETY_CRITICAL_IEC61508
is defined: you called this after calling OSStart()
and thus you are no longer allowed to create additional kernel objects.
OS_ERR_OBJ_PTR_NULL
If OS_CFG_ARG_CHK_EN
is set to 1
in DEF_ENABLED
in os_cfg.h
: if p_q
is a NULL
pointer.
...
If OS_CFG_ARG_CHK_EN
is set to 1
in DEF_ENABLED
in os_cfg.h
: if the size specified is 0.
OS_ERR_ILLEGAL_CREATE_RUN_TIME
If OS_SAFETY_CRITICAL_IEC61508
is defined: you called this after calling OSSafetyCriticalStart()
and thus you are no longer allowed to create additional kernel objects.
Returned Value
None
Required Configuration
OS_CFG_Q_EN
must be enabled in os_cfg.h
. Refer to uCµC-OS-III Configuration Manual.
Callers
Application.
Notes/Warnings
- Queues must be created before they are used.
Example Usage
Code Block | ||
---|---|---|
| ||
OS_Q CommQ;
void main (void)
{
OS_ERR err;
OSInit(&err); /* Initialize µC/OS-III */
:
:
OSQCreate(&CommQ,
"Comm Queue",
10,
&err); /* Create COMM Q */
/* Check "err" */
:
:
OSStart(); /* Start Multitasking */
} |