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.

DSP/BIOS LINK User guide examples MSGQ_alloc being called multiple times in scale.c example?



Hello In the DSP/BIOS LINK
LNK 058 USR
Version 1.61.03
MAR 31, 2009 USER GUIDE
one of the installed examples is scale

I would like to inquire on the gpp side ... scale.c

why is

status = MSGQ_alloc (POOL_makePoolId(processorId, SAMPLE_POOL_ID),
                                APP_MSG_SIZE,
                               (MSGQ_Msg *) &to_dsp_msg) ;

being allocated every time in the

if ( ((i != SCALE_NumIterations) || (SCALE_NumIterations == 0)) &&  ((i % 10) == 0) )

if  / for loop ?

This seems unnecessary and only needs to be done once before the start of the if / for loop.  Correct? or am I missing something?

 

  • In the scale example, a MSGQ message is allocated on the gpp side and then freed on the slave side (look for the MSGQ_free() call in dsplink/dsp/src/samples/scale files).  It is demonstrating a model where one side can do the allocation while the other side does the freeing.

    Regards,

    - Rob

  • Thanks Robert 

    Let me see if I understand.  The message is allocated on the gpp side, the message is freed on the DSP side.  But the message is still allocated on the Q, but since it was freed it does not contain a message, i.e. calling  MSGQ_get will return a status of 9, is this correct?  The only way the message is not still on the Q is by MSGQ_release, correct?  If these are both correct, then why is the message allocated every time in the for loop on the gpp side?

    Side question, is the parameter order of MSGQ_get different for the GPP side VS the GPP side,

    as I see this on gpp side

    MGSQ_ge(SampleGPPMsqq, WAIT_FOREVER, &from_dspmsg)

    and this on the DSP side

    MSGQ_get(info->msgqQueue, &msg, WAIT_FOREVER)  ?

    If this is so where is the documentation for the BIOSLink API on the dsp side.

    I think I have found the documentation on the gpp side using the doxigen index and looking at the header files... unless there is a real API reference I haven't found yet.

    Thanks again.

  • Brian Flinn said:
    Let me see if I understand.  The message is allocated on the gpp side, the message is freed on the DSP side.  But the message is still allocated on the Q, but since it was freed it does not contain a message, i.e. calling  MSGQ_get will return a status of 9, is this correct? 

    I'm not sure why you're saying that the message is still allocated on the Q after being freed on the DSP side.  After being freed with MSGQ_free(), it goes back in the pool of messages available for that queue, ready to  be MSGQ_alloc()ed again.

    Brian Flinn said:
    The only way the message is not still on the Q is by MSGQ_release, correct?

    No, MSGQ_free() takes the message off the queue.  MSGQ_release() "lets go" of the message queue, and is the counterpart to MSGQ_locate().  Be sure not to mix up messages and message queues - the queue holds the messages.

    Brian Flinn said:
      If these are both correct, then why is the message allocated every time in the for loop on the gpp side?

    This question has become moot, and my previous answer remains - a message is allocated every time in the loop because it's also freed every during the loop (by the DSP).

    Brian Flinn said:

    Side question, is the parameter order of MSGQ_get different for the GPP side VS the GPP side,

    as I see this on gpp side

    MGSQ_ge(SampleGPPMsqq, WAIT_FOREVER, &from_dspmsg)

    and this on the DSP side

    MSGQ_get(info->msgqQueue, &msg, WAIT_FOREVER)  ?

    Yes, unfortunately that is the case.

    Brian Flinn said:

    If this is so where is the documentation for the BIOSLink API on the dsp side.

    I think I have found the documentation on the gpp side using the doxigen index and looking at the header files... unless there is a real API reference I haven't found yet.

    I'm not sure where the BIOS docs are, they should be somewhere in the BIOS package.

    I don't believe there is a real API reference for the gpp side, doxygen is it.

    Regards,

    - Rob