Post Go back to editing

Getting processed DMA buffer in SPORT group callback

Thread Summary

The user is experiencing issues with the SPORT DMA group configuration on the ADSP-SC59x processor, where the SPORT_DMA_DSCPTR_PRV register sometimes points to the wrong buffer during the first interrupt. The final answer suggests checking the 'Register Polling Based Synchronization' section in the Hardware Reference Manual for detailed information on DMA synchronization. The user seeks further clarification on why the DMA registers do not reflect the current operation status and asks for documentation on this behavior.
AI Generated Content
Category: Software

Hi Team,

This about how to get the processed SPORT DMA data buffer in group configuration.

The API adi_sport_GlobalRegisterCallback(), takes the callback function of type void (*ADI_CALLBACK)(void *pCBParam, uint32_t Event, void *pArg), where pArg points to the group handle.

In case of single SPORT config the call back function registered adi_sport_RegisterCallback() returns the processed buffer in pArg which is convinient. I understand it is not possible to pass the processed buffer in the group case as mutiple SPORTs are involved.

In our case, we have configured the multiple SPORT DMA with two DMA descriptors

ping ---> 0th index

pong ----> 1st index

in a circular configuration and grouped them together.

In the group callback, currently we are getting the completed buffer address from the SPORT_DMA_DSCPTR_PRV register of the specific SPORT, with the understanding that it points to the previous descriptor which is already processed by DMA

But the issue is sometimes during the very first interrupt, SPORT_DMA_DSCPTR_PRV points to pong buffer instead of ping.

1. Could you please explain the reason for such behaviour? 

2. What is the recommeded way to get the processed buffer in the group callback case? Should we use a ping / pong flag to determine the buffer?

3. The internal struct in SPORT driver ADI_SPORT_GBL_GROUP has a member 'nBufferIndex' which could be helpful to determine the buffer. Is this exposed to user in any of the interface?

typedef volatile struct
{
  ADI_SPORT_HANDLE         *pDeviceArray;
  uint8_t             NoofDevices;
  bool                      bUsed;
  bool            bGblTrigEnable;
    ADI_CALLBACK              pfCallback;
    void                     *pCBParam;
    bool            bGroupInProgress;
    uint8_t           nBufferIndex;
    bool            bCircularBuff;
} ADI_SPORT_GBL_GROUP;

Thanks in advace.

Regards,

Vetrivel.

Parents Reply Children
No Data