Versions Compared

Key

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

...

Anchor10799021079902 Message Mailboxes Anchor10799031079903Table C-9 shows the API for message mailbox management. Note that µC/OS-III does not directly provide services for managing message mailboxes. Given that a message mailbox is a message queue of size one, µC/OS-III can easily emulate message mailboxes. Anchor11815671181567  

...

µC/OS-II (os_mbox.c)

...

µC/OS-III (os_q.c)

...

Note

...

rowspan3

...

void *

...

...

OSMboxAccept(

...

OS_EVENT *pevent);

...

rowspan3

...

rowspan3

...

...

(1)

...

rowspan4

...

OS_EVENT *

...

OSMboxCreate(

...

void *pmsg);

...

...

rowspan4

void

...

OSQCreate(

...

...

OS_Q *p_q,

...

CPU_CHAR *p_name,

...

OS_MSG_QTY max_qty,

...

OS_ERR *p_err);

...

...

rowspan4

...

(2)

...

rowspan5

...

void *

...

...

OSMboxDel(

...

...

OS_EVENT *pevent,

...

INT8U opt,

...

INT8U *perr);

...

rowspan5

OS_OBJ_QTY,

...

...

OSQDel(

...

OS_Q *p_q,

...

OS_OPT opt,

...

...

OS_ERR *p_err);

...

rowspan5

...

...

rowspan5

...

void *

...

OSMboxPend(

...

OS_EVENT *pevent,

...

INT32U timeout,

...

INT8U *perr);

...

rowspan5

...

void *

...

...

OSQPend(

...

OS_Q *p_q,

...

...

OS_TICK timeout,

...

OS_OPT opt,

...

OS_MSG_SIZE *p_msg_size,

...

...

CPU_TS *p_ts,

...

OS_ERR *p_err);

...

rowspan5

...

(3)

...

...

rowspan5

...

INT8U

...

...

OSMBoxPendAbort(

...

OS_EVENT *pevent,

...

...

INT8U opt,

...

...

INT8U *perr);

...

rowspan5

...

OS_OBJ_QTY

...

OSQPendAbort(

...

OS_Q *p_q,

...

...

OS_OPT opt

...

OS_ERR *p_err);

...

rowspan5

...

rowspan4

...

...

INT8U

...

OSMboxPost(

...

...

OS_EVENT *pevent,

...

void *pmsg);

...

rowspan4

...

void

...

OSQPost(

...

OS_Q *p_q,

...

Void *p_void,

...

...

OS_MSG_SIZE msg_size,

...

OS_OPT opt,

...

...

OS_ERR *p_err);

...

rowspan4

(4)

...

...

rowspan6

...

INT8U

...

OSMboxPostOpt(

...

...

OS_EVENT *pevent,

...

void *pmsg,

...

...

INT8U opt);

...

rowspan6

...

rowspan6

...

...

(4)

...

...

rowspan4

INT8U

...

...

OSMboxQuery(

...

OS_EVENT *pevent,

...

OS_MBOX_DATA *p_mbox_data);

...

rowspan4

...

rowspan4

...

(5)

...

Table C-9 Message Mailbox API

...

TC-9(1) In µC/OS-III, there is no “accept” API since this feature is built into the OSQPend() by specifying the OS_OPT_PEND_NON_BLOCKING option.

...

TC-9(2) In µC/OS-II, OSMboxCreate() returns the address of an OS_EVENT, which is used as the “handle” to the message mailbox. In µC/OS-III, the application must allocate storage for an OS_Q, which serves the same purpose as the OS_EVENT. The benefit in µC/OS-III is that it is not necessary to predetermine the number of message queues at compile time. Also, to create the equivalent of a message mailbox, you would specify 1 for the max_qty argument.

...

TC-9(3) µC/OS-III returns additional information about the message received. Specifically, the sender specifies the size of the message as a snapshot of the current timestamp is taken and stored as part of the message. The receiver of the message therefore knows when the message was sent.

...

TC-9(4) In µC/OS-III, OSQPost() offers a number of options that replaces the two post functions provided in µC/OS-II.

...

TC-9(5) µC/OS-III does not provide query services, as they were rarely used in µC/OS-II.