This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS: Mailbox Pend() - No of bytes read

Tool/software: TI-RTOS

Hi,

Is there any way to get the number of bytes copied to msg(buffer) when Mailbox_pend(Mailbox_Handle handle, Ptr msg, UInt timeout) is called?

Regards,

Sandhya

  • Hi Sandhya,

    When a Mailbox_pend or Mailbox_post is done, the size of the msg is copied (where is the size is set at Mailbox creation time via the bufSize parameter).

    Todd
  • Thanks for your reply.

    This is my understanding - since multiple messages can be posted in a mailbox, normally when a mailbox is created, the size provided will be the maximum size of a single message and when Mailbox_getMsgSize()  is called it will return that size which is provided during mailbox creation and TI is not providing an option to get the exact number of bytes read when Mailbox_pend() is called (like msgQReceive() in VxWorks). Please confirm

  • The Mailbox module is essentially fixed size. Let's say you created the mailbox with bufSize of 128 and you have 3 messages. When you call Mailbox_post, the API grabs a free internal message and copies 128 bytes from your supplied buffer into the internal message. If you called Mailbox_pend then, the API would see the "full" msg and copy 128 bytes from that "full" msg into the buffer you supplied to the API.

    Mailbox does not know how many "application significant" bytes are in the message. It just knows the bufSize.

    Todd