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.

4.5. EXTENDED SYNCHRONIZATION AND COMMUNICATION FUNCTIONS 121<br />

tk snd mbf<br />

Send Message to Message Buffer<br />

[C Language Interface]<br />

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

[Parameters]<br />

ID mbfid Message buffer ID<br />

INT msgsz Send message size (in bytes)<br />

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

TMO tmout Timeout designation<br />

[Return Parameters]<br />

ER ercd 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 (msgsz ≤ 0, msgsz > maxmsz,value that cannot be used in msg, or<br />

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

Sends the message at the address designated in msg to the message buffer designated in mbfid. The<br />

message size is indicated in msgsz. This system call copies msgsz bytes starting from msg to the message<br />

queue of message buffer mbfid. The message queue is implemented as a ring buffer.<br />

If msgsz is larger than the maxmsz designated with tk cre mbf, error code E PAR is returned.<br />

If there is not enough available buffer space to accommodate message msg in the message queue, the<br />

task issuing this system call goes to send wait state and is queued waiting for buffer space to become<br />

available (send queue). Waiting tasks are queued in either FIFO or priority order, depending on the<br />

designation made with tk cre mbf.<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 there is sufficient buffer space), the system call terminates, returning timeout<br />

error code E TMOUT.<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!