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.

AWR1642: How to understand MMWave_spawn in Mmwave link

Part Number: AWR1642

Hi champion,
   My customer is looking at the mmwave demo in mmwave_sdk_01_00_00_05. I got a question about the MMWave_spawn funciton in the code. This function is registered to rlDevicePowerOn in below code.

  /* Initialize OSI Queue Interface */
    RlApp_ClientCtx.osiCb.queue.rlOsiSpawn      = &MMWave_spawn;
  1. Inside this function it saved input function point and parameter in gMMWave_MCB.ptrSpawnFxnFreeList, and then post a semaphore to other task. My questiton is when
MMWave_spawn is called and what is the funciton point and parameter it used.

static rlInt32_t MMWave_spawn
(
    RL_P_OSI_SPAWN_ENTRY    fxn,
    const void*             pValue,
    uint32_t                flags
)
{
    MMWave_SpawnFxnNode*    ptrSpawnFxnNode;
    uintptr_t               key;
    int32_t                 retVal = 0;

    /* Critical Section: The spawn free list is a critical resource which is accessed
     * from multiple contexts */
    key = HwiP_disable();
    ptrSpawnFxnNode = (MMWave_SpawnFxnNode*)MMWave_listRemove ((MMWave_ListNode**)&gMMWave_MCB.ptrSpawnFxnFreeList);
    HwiP_restore (key);

    /* Did we get an entry? */
    if (ptrSpawnFxnNode != NULL)
    {
        /* YES: Populate the entry */
        ptrSpawnFxnNode->spawnEntry = fxn;
        ptrSpawnFxnNode->arg        = pValue;

        /* Critical Section: The spawn active list is a critical resource which is accessed
         * from multiple contexts */
        key = HwiP_disable();
        MMWave_listAdd ((MMWave_ListNode**)&gMMWave_MCB.ptrSpawnFxnActiveList, (MMWave_ListNode*)ptrSpawnFxnNode);
        HwiP_restore (key);

        /* Keep track of the number of spawn messages which have been received */
        gMMWave_MCB.spawnCounter++;

        /* Wake up the mmWave execution thread  */
        SemaphoreP_post (gMMWave_MCB.linkSemHandle);
    }
    else
    {
        /* Error: No span free node was present. This can happen if all the spawn functions
         * have been taken up and the execute mmWave control API has not been invoked. Increment
         * statistics to report this condition */
        gMMWave_MCB.spawnOverflow++;

        /* Setup the return value to indicate an error. */
        retVal = -1;
    }
    return retVal;
}



2. why we define the spwan list size to 4 (MMWAVE_MAX_NUM_SPAWN_LIST)? In which case we need to use this list to save more than one funciton call.


  • Hi Adam,

    Can you please check the following html file that touches upon this function.

    Under SDK directory, typically at:

    file:///C:/ti/mmwave_sdk_01_00_00_05/packages/ti/control/mmwave/docs/doxygen/html/group___m_m_w_a_v_e___i_n_t_e_r_n_a_l___f_u_n_c_t_i_o_n.html#ga35cb2c4165072f9dd72960c67b919e23

    static rlInt32_t MMWave_spawn ( RL_P_OSI_SPAWN_ENTRY  fxn,
    const void *  pValue,
    uint32_t  flags 
    )
    static

    Description
    This is the mmWave link registered callback function which is invoked to ensure that the spawn function is invoked in a different execution context

    Parameters
    [in] fxn Pointer to the function to be executed in a different context
    [in] pValue Pointer of data to be passed to the function
    [in] flags Flag to indicate preference
    Return values

    Success - 0
    Error - <0

    Thank you,

    Vaibhav

  • Hi Vaibhav,
       I already found these explanation. I think it is from the comments of the code. Could you help to give more information?

    Thanks,
    Adam

  • Hello Adam,

    mmWaveLink is used to send command and receive response/Async Event to/from radarSS over the mailbox. Response to any command is received in the same flow of CMD send call, but to receive any async event message mmWaveLink spawns a function to read this message in different context. Usually, MSS application doesn't need spawn list more than one when mmWaveLink is responsible to send/receive a message from only one core (here radarSS).

    RadarSS mailbox will not be refilled with new data till it gets unmasked by MSS. mmWaveLink will unMask radarSS mailbox only when it read the full async event message from spawn context. 

    Please go through these functions to understand the flow-

    /* at Async Event message arrival */

    rlDriverHostIrqHandler -> MMWave_spawn

    /* Spawn function, read data and unmask Mailbox (flush) */

    MMWave_executeLink  -> rlDriverMsgReadSpawnCtx -> rlDriverMsgRead -> rlDeviceUnMaskHostIrq -> Mailbox_readFlush

    Regards,

    Jitendra Gupta

  • Hello Gupta,
        Thanks a lot for your explanation. I am clear about it now.
        I have a furthur question about the difference between mmwavelink and mmwave folder under C:\TI\mmwave_sdk_01_00_00_05\packages\ti\control. Why we have two control layer and which layer does custoemr need to call directly?

    Thanks,
    Adam