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.

Regarding Pa_close function

Hi Ti Folks,

                  Thanks for quick answers for my previous questions on PA. I was searching for a way to close/delete/flush the PA configurations/setup. I found this API

paReturn_t Pa_close (Pa_Handle handle, void* bases[])

few questions on above

1. i will pass the PA handle to the function as its first argument

2. what is expectation from Application in terms of bases. it would be really great if you have any example for it.

3. i see the comments for  Pa_close as below.

/**
* @ingroup palld_api_functions
* @brief Pa_close decativates the PA driver instance
*
* @details This function deactivates the PA driver instance, all the associated
* memory buffers can be freed after this call.
*
* @param[in] handle The PA LLD instance identifier
* @param[out] bases Array of the memory buffer base addresses
* @retval Value (@ref ReturnValues)

paReturn_t Pa_close (Pa_Handle handle, void* bases[])
{
paInst_t *paInst = (paInst_t *)handle;
int i;
uint32_t mtCsKey;

/* Refresh PA Instance for read only */
Pa_osalMtCsEnter(&mtCsKey);
Pa_osalBeginMemAccess (paInst, sizeof(paInst_t));

for ( i = 0; i < pa_N_BUFS; i++)
{
bases[i] = paInst->paBufs[i].base;
}

Pa_osalEndMemAccess (paInst, sizeof(paInst_t));
Pa_osalMtCsExit(mtCsKey);

return (pa_OK);

} /* Pa_close */

Taking the comments one by one

1. There is nothing de-activation happening inside the Pa_close function. please clarify on this.?

2. If i understand associated buffers needs to be freed..means

    bases[0]    =   (Void *)paInst;

    bases[1]    =   (Void *)memL2Ram;

    bases[2]    =   (Void *)memL3Ram;

if i set the bases to NULL, will that do the clean-up activity.

or should i reset the paInst, memL2Ram, memL3Ram to zeros..

in anyway, i want to make sure that i shuld be able to call Pa_create again [after Pa_close and extra code] without being returned error. Kindly help me.

Thanks

RC Reddy

  • Hi, RC:

    1. There is nothing de-activation happening inside the Pa_close function. please clarify on this.?

    No, Pa_close() does not remove the LUT1/LUT2 entries. You need to call APIs such as Pa_delHandle() and Pa_delL4Handle() to remove LUT1/LUT2 entries.
    However, all LUT1/LUT2 entries will be removed and all the configuration parameters will be reset if you download the PDSP images again. Therefore, you can call Pa_resetControl(pa_STATE_RESET) to disable all PDSPs and then call Pa_close() to shutdown PA LLD. Please note that you do need to clean up all receive queues, descriptors and buffers.

    2. If i understand associated buffers needs to be freed..means

        bases[0]    =   (Void *)paInst;

        bases[1]    =   (Void *)memL2Ram;

        bases[2]    =   (Void *)memL3Ram;

    if i set the bases to NULL, will that do the clean-up activity.

    [Eric] Of course, no. How could it be possible? You need to free the system buffers if they were allocated by malloc or other similar functions.

    or should i reset the paInst, memL2Ram, memL3Ram to zeros.

    [Eric] It is not required. Those memory ranges will be re-initialized if you re-use them at Pa_create().

    in anyway, i want to make sure that i shuld be able to call Pa_create again [after Pa_close and extra code] without being returned error. Kindly help me.

    Best regards,

    Eric