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.

ARM - DSP Message Queueing, message allocation on both sides

Hi, 

I have an ARM - DSP application that uses IPC MessageQ API for message exchanging. 

What I have been doing is using MessageQ_alloc on ARM side and pass that message pointer to DSP through a heap on shared region (that is registered with MessageQ API also from ARM side).

I have tried to do MessageQ_alloc on DSP side, that attempt failed, saying to me that the heapId is invalid, for that I have used the same HeapId definition for ARM, my code is based on syslink-ex02 from ezsdk-5_05_01_04 (dm8168). Also tried other heap id numbers with the same result.

My questions are the following,

1. If I want to allocate a new Message from DSP can I use the same heap registered by ARM? If yes, under which circumstances?

2. Can I register 2 heaps from each side that are hold on the same shared region? And use:

ArmQ-->Heap1-->DspQ

DspQ-->Heap2-->ArmQ

If that is possible, should one Queue Handle on each side should be more than enough?

Any other info that help me to allocate queue messages on each side would be great.

Thanks

-Jose L.

  • Jose Lopez1 said:
    1. If I want to allocate a new Message from DSP can I use the same heap registered by ARM? If yes, under which circumstances?

    The DSP-side needs to open the same heap and registered with MessageQ on the DSP-side.  You'll also need to ensure that both sides register the same heapID with MessageQ.

    Jose Lopez1 said:

    2. Can I register 2 heaps from each side that are hold on the same shared region? And use:

    ArmQ-->Heap1-->DspQ

    DspQ-->Heap2-->ArmQ

    Yes and depending on what type of heap it is, it may be advisable to have two separate heaps for each of the communication paths.  Take a look at the following post:

    http://e2e.ti.com/support/embedded/tirtos/f/355/p/250517/876767.aspx#876767

    In general, both sides need to register a heap with MessageQ if you plan to allocate messages.  When registering, you must ensure that each unique heap registers a unique heapId with MessageQ.

  • Arnie,

    If I understood you correctly, for example

    1 Heap use case:

    ARM:

    Creates heap with HeapBufMP_create and registers the Heap with MessageQ_registerHeap.

    DSP:

    Opens the heap with HeapBufMP_open, now I should have a valid HeapBufMP_Handle *handlePtr.

    Then use that handle to register the heap with MessageQ_registerHeap(Ptr heap, UInt16 heapId);

    I suppose that this registration gives the MessageQ API access to the Heap. That way i should be able to allocate new messages in the shared heap from each sides.

    2 heaps use case:

    Just do on DSP-side HeapBufMP_create instead of HeapBufMP_open, also make sure that the Queue reader logic on each side is accessing correctly the Queue writer heap (Wondering if one MessageQ_Handle for each side is enough or could cause trouble) .

    From the post you pasted, I think the 2 heaps use case may be considered if speed is a concern, talking about contention on the heap:

    "This puts heavy contention on the heap instance because both sides are doing alloc and free"

    I may consider using 2 heaps in that case, never used this GateMP API though ..

    Thanks

  • Arnie, 

    I tried the existing heap registration on DSP-side. Seems that allocations can be made and queue messages can get sent through IPC.

    Thank you for the explanation.