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.

CC3220MOD: mq_send() message pointer

Part Number: CC3220MOD
Other Parts Discussed in Thread: SYSBIOS

When using mq_send(), should the msg_ptr argument be static or can it be provided by a local variable?

Where is the source and/or documentation for the mq functions?

Thank you,

Mark

  • Hi Mark,

    mq_send is part of POSIX, and we link to the standard documentation in the TI-POSIX user's guide in the SDK: https://pubs.opengroup.org/onlinepubs/009604599/functions/mq_send.html

    If you're looking for a reference, we use the mq functions for the message queue in the mqt_client and local_ota examples. The msg_ptr in mqtt_client_app.c is a variable queueElement.

    Best regards,

    Sarah

  • "The mq_send() function shall add the message pointed to by the argument msg_ptr to the message queue specified by mqdes. The msg_len argument specifies the length of the message, in bytes, pointed to by msg_ptr. The value of msg_len shall be less than or equal to the mq_msgsize attribute of the message queue, or mq_send() shall fail."

    That still seems vague, "add the message" may copy the message pointer to the queue or copy the message data to the queue.

    Google returned this.  Hopefully it is true for the CC32xx.

    "To send a message to a queue, call mq_send() specifying the queue, the address and length of the message data, and an integer specifying the priority class of the message. ... The message is copied out of the caller's buffer, so the buffer can be reused immediately after a successful send."

     

  • Hi Mark,

    Yes, there is a memcpy from the msg_ptr to a mailbox element. Assuming you are using TI-RTOS, you can trace the implementation of mq_send() from source/ti/posix/tirtos/mqueue.c to Mailbox_post in kernel/tirtos/packages/ti/sysbios/knl/Mailbox.c.

    Best regards,

    Sarah

  • Perfect!  Thank you.