Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

void  OSQCreate (OS_Q        *p_q,

...

                 CPU_CHAR    *p_name,

...

                 OS_MSG_QTY   max_qty,

...

                 OS_ERR      *p_err)

...

...

File

...

Called from

...

Code enabled by

...

os_q.c

...

Task or startup code

...

OS_CFG_Q_EN and OS_CFG_MSG_EN

...

OSQCreate() creates a message queue. A message queue allows tasks or ISRs to send pointer-sized variables (messages) to one or more tasks. The meaning of the messages sent are application specific.anchor10018311001831

Arguments

...

p_q Anchor10018331001833

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;

...

10018351001835p_name Anchor10018361001836

is a pointer to an ASCII string used to name the message queue. The name can be displayed by debuggers or µC/Probe.

...

10018381001838msg_qtyanchor10018391001839

indicates the maximum size of the message queue (must be non-zero). If the user intends to not limit the size of the queue, simply pass a very large number. Of course, if there are not enough OS_MSGs in the pool of OS_MSGs, the post call (i.e., OSQPost()) will simply fail and an error code will indicate that there are no more OS_MSGs to use.

...

p_err Anchor10018411001841

is a pointer to a variable that is used to hold an error code:

...

classWebWorks_Indent_1

...

OS_ERR_NONE

...

classWebWorks_Indent_2

...

if the call is successful and the mutex has been created.

...

...

OS_ERR_CREATE_ISR

...

classWebWorks_Indent_2

...

...

if OS_CFG_CALLED_FROM_ISR_CHK_EN set to 1 in os_cfg.h: if attempting to create the message queue from an ISR.

...

...

OS_ERR_OBJ_PTR_NULL

...

classWebWorks_Indent_2

...

if OS_CFG_ARG_CHK_EN is set to 1 in os_cfg.h: if p_q is a NULL pointer.

...

classWebWorks_Indent_1

...

OS_ERR_Q_SIZE

...

classWebWorks_Indent_2

...

if OS_CFG_ARG_CHK_EN is set to 1 in os_cfg.h: if the size specified is 0.

...

...

OS_ERR_ILLEGAL_CREATE_RUN_TIME

...

classWebWorks_Indent_2

...

...

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

...

10018551001855Noneanchor10505931050593

Notes/Warnings

...

Queues must be created before they are used. Anchor10506471050647

Example

...

rowspan16

...