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.

c64+ edma transfer question!!!

I use C64+ dsp. I want to use  “code II”  to instead of  “code I”.

//-------------------------------------------------------------------------------------------------

codeI

for (y=0; y<144; y++)

                  for (x=0; x<176; x++)

                  imgY_org_frm [y][x] = imgY_org_buffer[y*176+x]; 

codeII

status = CSL_edmaInit(&context);

    hModule = CSL_edmaOpen(NULL,CSL_EDMA_1,NULL,&status);

    regionAccess.region = CSL_EDMA_REGION_1 ;

    regionAccess.drae =   0xFFFF ;  

    regionAccess.draeh =  0x0 ;      

    status = CSL_edmaHwControl(hModule,CSL_EDMA_CMD_DMAREGION_ENABLE,&regionAccess);

    

       regParam.regionNum = CSL_EDMA_REGION_1;

    CSL_edmaRegionOpen(&RegionObj,CSL_EDMA_1,&regParam,&status);

 

    chAttr.regionNum = CSL_EDMA_REGION_1;

    chAttr.chaNum = CSL_EDMA_CHA0;

    hChannel = CSL_edmaChannelOpen(&chObj, CSL_EDMA_1, &chAttr, &status);  

 

    hParamBasic = CSL_edmaGetParamHandle(hChannel,CSL_EDMA_CHA0, &status);

 

    myParamSetup.option = CSL_EDMA_OPT_MAKE(  FALSE, \

                                              FALSE, \

                                              FALSE, \

                                              TRUE,\

                                              8,

                                              CSL_EDMA_TCC_NORMAL,\

                                              CSL_EDMA_FIFOWIDTH_NONE, \

                                              TRUE, \

                                              CSL_EDMA_SYNC_AB, \

                                              CSL_EDMA_ADDRMODE_INCR, \

                                              CSL_EDMA_ADDRMODE_INCR

                                             );          

    myParamSetup.srcAddr = (Uint32)(0x80270588);   //the address of imgY_org_buffer    

    myParamSetup.aCntbCnt = CSL_EDMA_CNT_MAKE(176,144);     

    myParamSetup.dstAddr = (Uint32)(0x80279C58);   // the address of imgY_org_frm

    myParamSetup.srcDstBidx = CSL_EDMA_BIDX_MAKE(176,176);   

    myParamSetup.linkBcntrld = CSL_EDMA_LINKBCNTRLD_MAKE(CSL_EDMA_LINK_NULL,0);    

    myParamSetup.srcDstCidx = CSL_EDMA_CIDX_MAKE(0,0);   

    myParamSetup.cCnt = 1;

    myParamSetup.triggerWord = CSL_EDMA_TRIGWORD_NONE;

 

    status = CSL_edmaParamSetup(hParamBasic, &myParamSetup,CSL_EDMA_PARAM_BASIC);//??????

 

    status = CSL_edmaHwChannelControl(hChannel,CSL_EDMA_CMD_CHANNEL_ENABLE, NULL);

  

    CSL_edmaHwChannelControl(hChannel,CSL_EDMA_CMD_CHANNEL_SET,NULL);

 

    do {

      

       CSL_edmaGetHwStatus(hModule,CSL_EDMA_QUERY_INTERRUPT_PENDSTATUS,&regionIntr);

      

    } while (!(regionIntr[0] & 0x100));

   

    status = CSL_edmaHwControl(hModule,CSL_EDMA_CMD_INTERRUPT_CLEAR,&regionIntr);

 

    regionAccess.region = CSL_EDMA_REGION_1 ;

    regionAccess.drae =   0xFFFF ;  

    regionAccess.draeh =  0x0 ;

    CSL_edmaHwControl(hModule,CSL_EDMA_CMD_DMAREGION_DISABLE, &regionAccess);

 

    CSL_edmaHwChannelControl (hChannel, CSL_EDMA_CMD_CHANNEL_DISABLE, NULL);

    CSL_edmaHwChannelControl (hChannel, CSL_EDMA_CMD_CHANNEL_CLEAR, NULL);

    CSL_edmaChannelClose(hChannel);

CSL_edmaClose(hModule);

//---------------------------------------------------------------------------------------------------------------------

now my question is

 

when the first time process run herethe first time source data ==the first time destination datathe transfer is right

when the second time process run herethe second time source data =the second time destination dataand the second time destination data == the first time source datathe transfer is wrong!!

when the third time process run herethe third time source data =the third time destination dataand the third time destination data == the second time source datathe transfer is wrong!!

 

when the forth time process run herethe forth time source data =the forth time destination dataand the forth time destination data == the third time source datathe transfer is wrong!!

 

……

you can see that except the first time , the other time “current  source data = current  destination data” and “current destination data == the old source data ”, BUT my aim is make “current  source data == current  destination data”,I think codeII may have same problem,and same parameter may have problem ,so the channel or other things can’t updata the data.could you help me find out the problem?

  • Sounds like a cache coherence issue.  Do something like this:

    1. Block writeback of "source" buffer (source as defined by the EDMA transfer src).  This will make sure the data that has been written by the CPU actually resides in that buffer.
    2. Kick off the EDMA transfer.
    3. Block invalidate of "destination" buffer.  This will cause CPU to throw away any old data in the cache before accessing the new data that was just written by the EDMA.

    This all assumes that only the CPU reads/writes to these buffers aside from this EDMA-accelerated memcpy.

    Brad