30.12.2013 Views

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4.4. SYNCHRONIZATION AND COMMUNICATION FUNCTIONS 101<br />

tk snd mbx<br />

Send Message to Mailbox<br />

[C Language Interface]<br />

ER ercd = tk_snd_mbx ( ID mbxid, T_MSG *pk_msg ) ;<br />

[Parameters]<br />

ID mbxid Mailbox ID<br />

T MSG* pk msg Message packet address<br />

[Return Parameters]<br />

ER ercd Error code<br />

[Error Codes]<br />

E OK<br />

E ID<br />

E NOEXS<br />

E PAR<br />

Normal completion<br />

Invalid ID number (mbxid is invalid or cannot be used)<br />

Object does not exist (the mailbox designated in mbxid does not exist)<br />

Parameter error (pk msg is a value that cannot be used)<br />

[Description]<br />

Sends the message packet having pk msg as its start address to the mailbox designated in mbxid. The<br />

message packet contents are not copied; only the start address (pk msg) is passed at the time of message<br />

receipt.<br />

If tasks are already waiting for messages in the same mailbox, the WAIT state of the task at the head of<br />

the queue is released, and the pk msg passed to tk snd mbx is sent to that task, becoming a parameter<br />

returned by tk rcv mbx. If there are no tasks waiting for messages in the designated mailbox, the sent<br />

message goes in the message queue of that mailbox. In neither case does the task issuing tk snd mbx<br />

enter WAIT state.<br />

pk msg is the start address of the packet containing the message, including header. The message header<br />

has the following format.<br />

typedef struct t_msg {<br />

? ? /* Implementation-dependent contents (fixed size) */<br />

} T_MSG;<br />

typedef struct t_msg_pri {<br />

T_MSG msgque; /* message queue area */<br />

PRI msgpri; /* message priority */<br />

} T_MSG_PRI;<br />

Copyright c○ 2002, 2003 by T-Engine Forum<br />

T-<strong>Kernel</strong> <strong>1.B0.02</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!