tk_rcv_mbf
Receive Message from Message Buffer
INT msgsz = tk_rcv_mbf ( ID mbfid, VP msg, TMO tmout ) ;
ID mbfid Message buffer ID
VP msg Start address of receive message packet
TMO tmout timeout
INT msgsz Received message size
or Error Code
E_OK Normal completion
E_ID Invalid ID number (mbfid is invalid or cannot be used)
E_NOEXS Object does not exist (the message buffer specified in mbfid does not exist)
E_PAR Parameter error (value in msg cannot be used, or tmout <= (-2))
E_DLT The object being waited for was deleted (message buffer was deleted while waiting)
E_RLWAI Wait state released (tk_rel_wai received in wait state)
E_TMOUT Polling failed or timeout
E_CTX Context error (issued from task-independent portion or in dispatch disabled state)
Receives a message from the message buffer specified in mbfid, putting it in the location specified in msg.
This system call copies the contents of the first queued message in the message buffer specified in mbfid, and copies it to an area of @@msg@sz@ bytes starting at address msg.
If no message has been sent to the message buffer specified in mbfid (the message queue is empty), the task issuing this system call goes to WAIT state and is put in the receive queue of the message buffer to wait for message arrival. Tasks in the receive queue are ordered by FIFO only.
A maximum wait time (timeout) can be set in tmout. If the tmout time elapses before the wait release condition is met (before a message arrives), the system call terminates, returning timeout error code E_TMOUT.
Only positive values can be set in tmout. The time base for tmout (time unit) is the same as that for system time (= 1 ms).
When TMO_POL = 0 is set in tmout, this means 0 was specified as the timeout value, and E_TMOUT is returned without entering WAIT state even if there is no message.
When TMO_FEVR =(-1) is set in tmout, this means infinity was specified as the timeout value, and the task continues to wait for message arrival without timing out.
E_DISWAI does not exist in error codes. This is because in µT-Kernel, there is no wait disabled function.

Comments
Click here to Post a Comment