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.

dma transfer inconsistency.

Other Parts Discussed in Thread: ALP

I used below codes to test the SWOSD_TI_DMA_Fast2D2D() function. the Idea is to regroup 1000,000 shorts into blocks of 1024 shorts. In every 10 shorts, I'll take out 1 short to form a new block. I used 4 DMA channels to transfer data from testData to the 4 buffers in pOn_chip_data[i]; after each transfer, I check the data validity by comparing each short between source and dest.  Then I found only the first 4 transfers are valid,  then the following transfers will not succeed(none of the1024 shorts in dest are updated ).

----------------------codes in below----------------------------------------

testData = (unsigned short*) malloc(100000*10*sizeof(unsigned short));
  assert(testData!=NULL);
  for(int i = 0; i < 100000*10; i++){
    testData[i] = (i/10)%65536;
  }
 
  ... ...
  #define BLK_SIZE 1024
  int tranxCount = 1000000/BLK_SIZE;
  unsigned short* restrict pOn_chip_data[4];
    //ping-pong buffer;
    pOn_chip_data [0]= (unsigned short*)pIdxConst;
    pOn_chip_data [1] =(unsigned short*) (pIdxConst+ BLK_SIZE*sizeof(unsigned short));
    pOn_chip_data [2] =(unsigned short*) (pIdxConst + 2*BLK_SIZE*sizeof(unsigned short));
    pOn_chip_data [3] =(unsigned short*) (pIdxConst  + 3*BLK_SIZE*sizeof(unsigned short));
    
    int DmaId[4];
    DmaId[0] = TLD_DMA_CH_IN_A;
    DmaId[1] = TLD_DMA_CH_IN_B;
    DmaId[2] = TLD_DMA_CH_ALP;
    DmaId[3] = TLD_DMA_CH_OUT;    
   for(int dmaId = TLD_DMA_CH_IN_A; dmaId <TLD_DMA_CH_AUX; dmaId++)
   {
      ECPY_activate(g_HW_obj->ecpyHandle[dmaId]);
  }

    //1. just loop for the 10 structs
    for(t=0; t < 10; t++){

        //1.1 take 2 bytes from every 20 bytes in testData,and form an array of BLK_SIZE
        for(count = 0; count < tranxCount; count ++){            
            blkIdx = count*BLK_SIZE;
            int dma_Id = DmaId[count%4];
            SWOSD_TI_DMA_Fast2D2D(  &g_HW_obj->dmaHandle,
                dma_Id,
                &testData[blkIdx*10+t],
                TLDDIRADD(pOn_chip_data[count%4]),
                sizeof(unsigned short),
                BLK_SIZE,
                10*sizeof(unsigned short),
                sizeof(unsigned short));
            Vps_printf("%s, %d, dma2dcpy, enter,",__FUNCTION__,__LINE__);
            SWOSD_TI_DMA_FastWait(&g_HW_obj->dmaHandle);
                // check data validity
                 if(CompareConfidence){
                     for(int n=0; n < BLK_SIZE; n ++){
                        if((pOn_chip_data[count%4][n]) != testData[(blkIdx+n)*10+t ]){
                                if(last_t != t || lastIdx!= blkIdx){
                                    if(last_t >= 0){
                                       Vps_printf("%s, %d, round(%d) on-chip has %d mismatchs in testData idx(%d), t(%d)",
                                        __FUNCTION__,__LINE__, printtRound, errCount, lastIdx, last_t);
                                    }
                                    last_t = t;
                                    lastIdx = blkIdx;
                                    errCount = 0;
                                }
                                errCount ++;
                            if(errCount < 10){
                                Vps_printf("%s, %d, err in-chip %x != %x, [count%4=%d, n=%d, blkIdx=%d, t=%d, dmaId=%d]",
                                __FUNCTION__,__LINE__, *((unsigned short*)TLDDIRADD(&pOn_chip_data[count%4][n])), testData[(blkIdx+n)*10+t] ,
                                count%4,n,blkIdx, t ,DmaId[count%4]);
                            }
                        }
                     }
                                         
             }

        }

    for(int dmaId = TLD_DMA_CH_IN_A; dmaId <TLD_DMA_CH_AUX; dmaId++)
   {
       ECPY_deactivate(g_pTLD_HW_obj->ecpyHandle[dmaId]);
   }