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.

IPC and Message Queue

Dear support,

I am having a problem using CCS help to find more information about these functions. I do not know where to go, search does not return anything and under

IPC (Multicore and I/O) 1.24.03.32 > API reference > ti > sdo > ipc or other places, these functions are not listed.

MessageQ_registerHeap

MessageQ_create

MessageQ_alloc/ MessageQ_free

I have a very simple query, I believe it has been designed for the following purpose:

Can I register 2 heaps (one in shared memory one in local memory) to message queue.

Then, Can I use MessageQ_alloc/free using one heap for comm between cores and one heap for comm between threads

How is MessageQ create working because I do not provide any heap id, therefore I am not sure where it will be placed.

Finally a more complex question

How do I use message queues to communicate between DSP (via PCIe or Hyperlink). DO you have available example?

Thanks for the help

Aymeric

  • Hi,

    I don't the answers for your questions, but here is the MessageQ doc, it may help as a starting point

    http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/syslink/2_10_05_26/exports/syslink_2_10_05_26/docs/html/_message_q_8h.html

    Regards

  • Aymeric,

    You can use the link provided by the previous post or in your IPC installation you should find a docs directory that contains documentation on all IPC modules.

    -Yes you can register multiple heaps with MessageQ

    -MessageQ_create() always creates the local object on the default local heap instance.

    My understanding is that you can only communicate between DSPs using shared memory, hardware queues or rapid IO.  I do not believe there is support for PCIe or Hyperlink.  You can search around the forums but this is my understanding.

    Judah

  • Judah,

    Thanks for the prompt answer and thanks Johannes for the link to the correct doc. Things are a bit more clear now.

    Judah, here is an extract of the documentation, followed by some questions

    Messages must be allocated from the MessageQ module. Once a message is allocated, it can be sent to any message queue. Once a message is sent, the writer loses ownership of the message and should not attempt to modify the message. Once the reader receives the message, it owns the message. It may either free the message or re-use the message.

    Messages in a message queue can be of variable length. The only requirement is that the first field in the definition of a message must be a #MessageQ_MsgHeader structure. For example:

      typedef struct MyMsg {
          MessageQ_MsgHeader header;
          ... [I need to add my own data here]
      } MyMsg;

    And here is the header used:

    typedef struct {
        Bits32       reserved0;         /*!< reserved for List.elem->next       */
        Bits32       reserved1;         /*!< reserved for List.elem->prev       */
        Bits32       msgSize;           /*!< message size                       */
        Bits16       flags;             /*!< bitmask of different flags         */
        Bits16       msgId;             /*!< message id                         */
        Bits16       dstId;             /*!< destination queue id               */
        Bits16       dstProc;           /*!< destination processor id           */
        Bits16       replyId;           /*!< reply id                           */
        Bits16       replyProc;         /*!< reply processor                    */
        Bits16       srcProc;           /*!< source processor                   */
        Bits16       heapId;            /*!< heap id                            */
        Bits16       seqNum;            /*!< sequence number                    */
        Bits16       reserved;          /*!< reserved                           */
    } MessageQ_MsgHeader;


    Who is populating the fields in the message? Is this done internally (dstProc, srcProc and all the reply information)
    Should I assume that the writer set all these fields and the reader can use them?
    The documentation is stating: Your application should not modify or directly access the fields in the MessageQ_MsgHeader but
    I could not find an API to access all the fields (ex: the proc)
    Is there an API to set msgSize or is it fixed to the size I asked to allocate?
    What is the sequence number used for?

    Thanks in advance

    Aymeric

    PS: the reason for all the questions is that I have all my code using messages. (I have inter thread, inter core and I will have inter proc)

     
  • Aymeric,

    MessageQ will populate the fields in the header.  There are some fields which can be populated through an API if needed.

    Yes, you can assume the writer will populate the fields.

    I don't believe we provide an API to access all the fields but you shouldn't need to.

    Yes, the msgSize is set when you do a MessageQ_alloc().

    Sequence number can be used to track messages to make sure a message isn't drop.  IPC itself does not use the sequence number other than for logging if Trace is enabled.  Every MessageQ_alloc bumps up the sequence number by 1.

    Judah