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.5. EXTENDED SYNCHRONIZATION AND COMMUNICATION FUNCTIONS 123<br />

tk rcv mbf<br />

Receive Message from Message Buffer<br />

[C Language Interface]<br />

INT msgsz = tk_rcv_mbf ( ID mbfid, VP msg, TMO tmout ) ;<br />

[Parameters]<br />

ID mbfid Message buffer ID<br />

VP msg Start address of receive message packet<br />

TMO tmout Timeout designation<br />

[Return Parameters]<br />

INT msgsz Received message size<br />

or Error Code<br />

[Error Codes]<br />

E OK<br />

E ID<br />

E NOEXS<br />

E PAR<br />

E DLT<br />

E RLWAI<br />

E DISWAI<br />

E TMOUT<br />

E CTX<br />

Normal completion<br />

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

Object does not exist (the message buffer designated in mbfid does not exist)<br />

Parameter error (value that cannot be used in msg, or tmout ≤ (−2))<br />

The object being waited for was deleted (message buffer was deleted while waiting)<br />

Wait state released (tk rel wai received in wait state)<br />

Wait released by wait disabled state<br />

Polling failed or timeout<br />

Context error (issued from task-independent portion or in dispatch disabled state)<br />

[Description]<br />

Receives a message from the message buffer designated in mbfid, putting it in the location designated<br />

in msg.<br />

This system call copies the contents of the first queued message in the message buffer designated in<br />

mbfid, and copies it to an area of msgsz bytes starting at address msg.<br />

If no message has been sent to the message buffer designated in mbfid (the message queue is empty),<br />

the task issuing this system call goes to WAIT state and is put in the receive queue of the message<br />

buffer to wait for message arrival. Tasks in the receive queue are ordered by FIFO only.<br />

A maximum wait time (timeout) can be set in tmout. If the tmout time elapses before the wait release<br />

condition is met (before a message arrives), the system call terminates, returning timeout error code<br />

E TMOUT.<br />

Only positive values can be set in tmout. The time base for tmout (time unit) is the same as that for<br />

system time (= 1 ms).<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!