Post Go back to editing

Dma copy between SPORTs

Category: Hardware
Product Number: ADSP-21593

Hello guys,

I'm now having a setup with ADSP 21593 and A2B device, the SPORT 1A is set as TDM TX and SPORT 1B is set as TDM RX, and they all have a DMA list, when we are trying to apply a loopback feature, we want the data from SPORT1B directly going to the SPORT1A, the way we are using now is use a while(1) loopback and copy the data from buffer RX to buffer TX, but this will block the main function. Is there an non-blocking method to copy the data from one DMA to the other one? the TDM config are all the same one. by the way ,we try to let the adi_sport_DMATransfer of TX using the RX's DMA, but it seems not work.

//SPORT CONFIG

    /* SPORT return code */
    ADI_SPORT_RESULT    eResult;

    /* Open the SPORT Device 1A */
    eResult = adi_sport_Open(SPORT_DEVICE_1A,ADI_HALF_SPORT_A,ADI_SPORT_DIR_TX, ADI_SPORT_MC_MODE, SPORTMemory1A,ADI_SPORT_MEMORY_SIZE,&hSPORTDev1ATx);
    CHECK_RESULT(eResult);
    /* Open the SPORT Device 1B*/
    eResult = adi_sport_Open(SPORT_DEVICE_1B,ADI_HALF_SPORT_B,ADI_SPORT_DIR_RX, ADI_SPORT_MC_MODE, SPORTMemory1B,ADI_SPORT_MEMORY_SIZE,&hSPORTDev1BRx);
    CHECK_RESULT(eResult);

    /* Configure the data,clock,frame sync and MCTL of SPORT Device 1A*/
    eResult = adi_sport_ConfigData(hSPORTDev1ATx,ADI_SPORT_DTYPE_SIGN_FILL,15,false,true,false);
    CHECK_RESULT(eResult);
    eResult = adi_sport_ConfigClock(hSPORTDev1ATx,0,false,true,false);
    CHECK_RESULT(eResult);
    eResult = adi_sport_ConfigFrameSync(hSPORTDev1ATx,512,true,false,false,false,false,false);
    CHECK_RESULT(eResult);
    eResult = adi_sport_ConfigMC(hSPORTDev1ATx,0u,15u,0u,true);
    CHECK_RESULT(eResult);
    eResult = adi_sport_SelectChannel(hSPORTDev1ATx,0u,15u);
    CHECK_RESULT(eResult);

    /* Configure the data,clock,frame sync and MCTL of SPORT Device 1B*/
    eResult = adi_sport_ConfigData(hSPORTDev1BRx,ADI_SPORT_DTYPE_SIGN_FILL,15,false,true,false);
    CHECK_RESULT(eResult);
    eResult = adi_sport_ConfigClock(hSPORTDev1BRx,0,false,true,false);
    CHECK_RESULT(eResult);
    eResult = adi_sport_ConfigFrameSync(hSPORTDev1BRx,512,true,false,false,false,false,false);
    CHECK_RESULT(eResult);
    eResult = adi_sport_ConfigMC(hSPORTDev1BRx,0u,15u,0u,true);
    CHECK_RESULT(eResult);
    eResult = adi_sport_SelectChannel(hSPORTDev1BRx,0u,15u);
    CHECK_RESULT(eResult);


    /* Register SPORT Callback function */
    eResult = adi_sport_RegisterCallback(hSPORTDev1ATx,SPORTCallback,NULL);
    CHECK_RESULT(eResult);
    /* Register SPORT Callback function */
    eResult = adi_sport_RegisterCallback(hSPORTDev1BRx,SPORTCallback,NULL);
    CHECK_RESULT(eResult);

    /* Submit the first buffer for Rx.  */
    eResult = adi_sport_DMATransfer(hSPORTDev1BRx,&iRX_LIST_1_SP1B,(DMA_NUM_DESC),ADI_PDMA_DESCRIPTOR_LIST, ADI_SPORT_CHANNEL_PRIM_SEC);
    CHECK_RESULT(eResult);
    eResult = adi_sport_DMATransfer(hSPORTDev1ATx,&iTX_LIST_1_SP1A,(DMA_NUM_DESC),ADI_PDMA_DESCRIPTOR_LIST, ADI_SPORT_CHANNEL_PRIM_SEC);
    CHECK_RESULT(eResult);
//DMA COPY
void SPT1_DMA_copy()
{
    memcpy(int_SP1ABuffer1,int_SP1BBuffer1,sizeof(int_SP1ABuffer1));
    memcpy(int_SP1ABuffer2,int_SP1BBuffer2,sizeof(int_SP1ABuffer2));
}
//CALL DMA COPY
while(1)
{
    SPT1_DMA_copy();
}