You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 12
Next »
Table C-12 shows the difference in API for message-queue management.
µC/OS-II (os_q.c ) | µC/OS-III (os_q.c ) | Note |
void *
OSQAccept(
OS_EVENT *pevent,
INT8U *perr);
| | (1) |
OS_EVENT *
OSQCreate(
void **start,
INT16U size);
| void
OSQCreate(
OS_Q *p_q,
CPU_CHAR *p_name,
OS_MSG_QTY max_qty,
OS_ERR *p_err);
| (2) |
OS_EVENT *
OSQDel(
OS_EVENT *pevent,
INT8U opt,
INT8U *perr);
| OS_OBJ_QTY,
OSQDel(
OS_Q *p_q,
OS_OPT opt,
OS_ERR *p_err);
| |
INT8U
OSQFlush(
OS_EVENT *pevent);
| OS_MSG_QTY
OSQFlush(
OS_Q *p_q,
OS_ERR *p_err);
| |
void *
OSQPend(
OS_EVENT *pevent,
INT32U timeout,
INT8U *perr);
| void *
OSQPend(
OS_Q *p_q,
OS_MSG_SIZE *p_msg_size,
OS_TICK timeout,
OS_OPT opt,
CPU_TS *p_ts,
OS_ERR *p_err);
| (3) |
INT8U
OSQPendAbort(
OS_EVENT *pevent,
INT8U opt,
INT8U *perr);
| OS_OBJ_QTY
OSQPendAbort(
OS_Q *p_q,
OS_OPT opt,
OS_ERR *p_err);
| |
INT8U
OSQPost(
OS_EVENT *pevent,
void *pmsg);
| void
OSQPost(
OS_Q *p_q,
void *p_void,
OS_MSG_SIZE msg_size,
OS_OPT opt,
OS_ERR *p_err);
| (4) |
INT8U
OSQPostFront(
OS_EVENT *pevent,
void *pmsg);
| | |
INT8U
OSQPostOpt(
OS_EVENT *pevent,
void *pmsg,
INT8U opt);
| | (4) |
INT8U
OSQQuery(
OS_EVENT *pevent,
OS_Q_DATA *p_q_data);
| | (5) |
Table C-12 Message Queue Management API
TC-12(1) In µC/OS-III, there is no “accept” API as this feature is built into the OSQPend()
by specifying the OS_OPT_PEND_NON_BLOCKING
option.
TC-12(2) In µC/OS-II, OSQCreate()
returns the address of an OS_EVENT
, which is used as the “handle” to the message queue. In µC/OS-III, the application must allocate storage for an OS_Q
object, which serves the same purpose as the OS_EVENT
. The benefit in µC/OS-III is that it is not necessary to predetermine at compile time, the number of message queues.
TC-12(3) µC/OS-III returns additional information when a message queue is posted. Specifically, the sender includes the size of the message and takes a snapshot of the current timestamp and stores it in the message. The receiver of the message therefore knows when the message was posted.
TC-12(4) In µC/OS-III, OSQPost()
offers a number of options that replaces the three post functions provided in µC/OS-II.
TC-12(5) µC/OS-III does not provide query services as they were rarely used.
µC/OS-II (os_q.c ) | µC/OS-III (os_q.c ) | Note |
void *
OSQAccept(
OS_EVENT *pevent,
INT8U *perr);
| | (1) |
OS_EVENT *
OSQCreate(
void **start,
INT16U size);
| void
OSQCreate(
OS_Q *p_q,
CPU_CHAR *p_name,
OS_MSG_QTY max_qty,
OS_ERR *p_err);
| (2) |
OS_EVENT *
OSQDel(
OS_EVENT *pevent,
INT8U opt,
INT8U *perr);
| OS_OBJ_QTY,
OSQDel(
OS_Q *p_q,
OS_OPT opt,
OS_ERR *p_err);
| |
INT8U
OSQFlush(
OS_EVENT *pevent);
| OS_MSG_QTY
OSQFlush(
OS_Q *p_q,
OS_ERR *p_err);
| |
void *
OSQPend(
OS_EVENT *pevent,
INT32U timeout,
INT8U *perr);
| void *
OSQPend(
OS_Q *p_q,
OS_MSG_SIZE *p_msg_size,
OS_TICK timeout,
OS_OPT opt,
CPU_TS *p_ts,
OS_ERR *p_err);
| (3) |