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 125<br />

tk ref mbf<br />

Get Message Buffer Status<br />

[C Language Interface]<br />

ER ercd = tk_ref_mbf ( ID mbfid, T_RMBF *pk_rmbf ) ;<br />

[Parameters]<br />

ID mbfid Message buffer ID<br />

T RMBF* pk rmbf Address of packet for returning status information<br />

[Return Parameters]<br />

ER ercd Error code<br />

pk rmbf detail:<br />

VP exinf Extended information<br />

ID wtsk Waiting task information<br />

ID stsk Send task information<br />

INT msgsz Size of the next message to be received (in bytes)<br />

INT frbufsz Free buffer size (in bytes)<br />

INT maxmsz Maximum message size (in bytes)<br />

(Other implementation-dependent parameters may be added beyond this point.)<br />

[Error Codes]<br />

E OK<br />

E ID<br />

E NOEXS<br />

E PAR<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 (the return parameter packet address cannot be used)<br />

[Description]<br />

References the status of the message buffer designated in mbfid, passing in the return parameters sending<br />

task information (stsk), the size of the next message to be received (msgsz), free buffer size (frbufsz),<br />

tmaximum message size (maxmsz), waiting task information (wtsk), and extended information (exinf).<br />

wtsk indicates the ID of a task waiting for receipt from the message buffer. The ID of a task waiting<br />

to send to the message buffer is indicated in stsk. If multiple tasks are waiting in the message buffer<br />

queues, the ID of the task at the head of the queue is returned. If no tasks are waiting, 0 is returned.<br />

If the designated message buffer does not exist, error code E NOEXS is returned.<br />

The size of the message at the head of the queue (the next message to be received) is returned in msgsz.<br />

If there are no queued messages, msgsz = 0 is returned. A message of size 0 cannot be sent. At least one<br />

of msgsz = 0 and wtsk = 0 is always true for this system call. frbufsz indicates the free space in the<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!