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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

118 CHAPTER 4. T-KERNEL/OS FUNCTIONS<br />

tk cre mbf<br />

Create Message Buffer<br />

[C Language Interface]<br />

ID mbfid = tk_cre_mbf ( T_CMBF *pk_cmbf ) ;<br />

[Parameters]<br />

T CMBF* pk cmbf Information about the message buffer to be created<br />

pk cmbf detail:<br />

VP exinf Extended information<br />

ATR mbfatr Message buffer attributes<br />

INT bufsz Message buffer size (in bytes)<br />

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

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

[Return Parameters]<br />

ID mbfid Message buffer ID<br />

or Error Code<br />

[Error Codes]<br />

E OK<br />

E NOMEM<br />

E LIMIT<br />

E RSATR<br />

E PAR<br />

Normal completion<br />

Insufficient memory (memory for control block or ring buffer area cannot be allocated)<br />

Number of message buffers exceeds the system limit<br />

Reserved attribute (mbfatr is invalid or cannot be used)<br />

Parameter error (pk cmbf is invalid, or bufsz or maxmsz is negative or invalid)<br />

[Description]<br />

Creates a message buffer, assigning to it a message buffer ID.<br />

This system call allocates a control block to the created message buffer. Based on the information<br />

designated in bufsz, it allocates a ring buffer area for message queue use (for messages waiting to be<br />

received).<br />

A message buffer is an object for managing the sending and receiving of variable-size messages. If differs<br />

from a mailbox (mbx) in that the contents of the variable-size messages are copied when the message is<br />

sent and received. It also has a function for putting the sending task in WAIT state when the buffer is<br />

full.<br />

exinf can be used freely by the user to set miscellaneous information about the created message buffer.<br />

The information set in this parameter can be referenced by tk ref mbf. If a larger area is needed for<br />

indicating user information, or if the information may need to be changed after the message buffer is<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!