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.

EDMA数据为什么没有传输?



各位专家好!

下面是我的EDMA数据传输的代码,程序运行完以后在expressions里查看dstBuff1[ ]dstBuff2[ ],发现里面仍然是初始化时候的值,即全是0,也就是说srcBuff[ ]数组中的数据并没有传输过去。请问是什么原因?谢谢!

#include <stdio.h>
#include <string.h>
#include <ti/csl/csl_edma3.h>
#include <ti/csl/csl_edma3Aux.h>

/* Global Buffers (Source and Destination) for PING-PONG */
// ping/pong的源缓冲区和目的缓冲区
Uint32 srcBuff[512];
Uint32 dstBuff1[256];
Uint32 dstBuff2[256];

static Int32 edma_ping_pong_xfer_gbl_region (Int32 instNum, Uint8 channelNum)
{
    CSL_Edma3Handle                 hModule;
    CSL_Edma3Obj                    edmaObj;
    CSL_Edma3ParamHandle            hParamPing;
    CSL_Edma3ParamHandle            hParamPong;
    CSL_Edma3ChannelObj             chObj;
    CSL_Edma3CmdIntr                regionIntr;
    CSL_Edma3ChannelHandle          hChannel;
    CSL_Edma3ParamSetup             myParamSetup;
    CSL_Edma3Context                context;
    CSL_Edma3ChannelAttr            chAttr;
    CSL_Status                      status;
    Uint32                          loopIndex;
    Uint32                          loopIndex1;

    printf ("Debug: Testing EDMA(%d) Ping-Pong Test (Global) Region for Channel %d...\n", instNum, channelNum);

    /* Initialize data数据初始化  */
    for (loopIndex = 0; loopIndex < 512; loopIndex++)
    {
        srcBuff[loopIndex] = loopIndex;


    }
    for(loopIndex1=0;loopIndex1<256;loopIndex1++)
    {
      dstBuff1[loopIndex1] = 0;
      dstBuff2[loopIndex1] = 0;

    }


    /* 模块初始化*/
    if (CSL_edma3Init(&context) != CSL_SOK)
    {
        printf ("Error: EDMA module initialization failed\n");
        return -1;
    }

    /* Open the EDMA Module using the provided instance number*/
    hModule=CSL_edma3Open(&edmaObj, instNum, NULL, &status);
    /* Channel open*/
    chAttr.regionNum = CSL_EDMA3_REGION_GLOBAL;
    chAttr.chaNum    = channelNum;
 hChannel = CSL_edma3ChannelOpen(&chObj, instNum, &chAttr, &status);

    /* Change Channel Default queue setup from 0 to 3  */
   CSL_edma3HwChannelSetupQue(hChannel,CSL_EDMA3_QUE_3);

    /* Map the DMA Channel to PARAM Block 2.*/
    CSL_edma3MapDMAChannelToParamBlock(hModule, channelNum, 2);

    /* Obtain a handle to parameter set 2*/
    hParamPing = CSL_edma3GetParamHandle(hChannel, 2, &status);


    /* Obtain a handle to parameter set 1 */
    hParamPong = CSL_edma3GetParamHandle(hChannel, 1, &status);


    /* Setup the parameter entry parameters (Ping buffer) */
    myParamSetup.option = CSL_EDMA3_OPT_MAKE(CSL_EDMA3_ITCCH_DIS, \
                                             CSL_EDMA3_TCCH_DIS, \
                                             CSL_EDMA3_ITCINT_DIS, \
                                             CSL_EDMA3_TCINT_EN, \
                                             0, CSL_EDMA3_TCC_NORMAL,\
                                             CSL_EDMA3_FIFOWIDTH_NONE, \
                                             CSL_EDMA3_STATIC_DIS, \
                                             CSL_EDMA3_SYNC_A, \
                                             CSL_EDMA3_ADDRMODE_INCR, \
                                             CSL_EDMA3_ADDRMODE_INCR );
    myParamSetup.srcAddr    = (Uint32)srcBuff;
    myParamSetup.aCntbCnt   = CSL_EDMA3_CNT_MAKE(512,1);
    myParamSetup.dstAddr    = (Uint32)dstBuff1;
    myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(1,1);
    myParamSetup.linkBcntrld= CSL_EDMA3_LINKBCNTRLD_MAKE(hParamPong,0);
    myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0,1);
    myParamSetup.cCnt = 1;

    /* Ping setup  */
    CSL_edma3ParamSetup(hParamPing,&myParamSetup);

    /* Pong setup */
     myParamSetup.option = CSL_EDMA3_OPT_MAKE(CSL_EDMA3_ITCCH_DIS, \
                                             CSL_EDMA3_TCCH_DIS, \
                                             CSL_EDMA3_ITCINT_DIS, \
                                             CSL_EDMA3_TCINT_EN,\
                                             1, CSL_EDMA3_TCC_NORMAL,\
                                             CSL_EDMA3_FIFOWIDTH_NONE, \
                                             CSL_EDMA3_STATIC_EN, \
                                             CSL_EDMA3_SYNC_A, \
                                             CSL_EDMA3_ADDRMODE_INCR, \
                                             CSL_EDMA3_ADDRMODE_INCR );
     myParamSetup.aCntbCnt   = CSL_EDMA3_CNT_MAKE(512,1);
        myParamSetup.srcAddr = (Uint32)srcBuff;
        myParamSetup.dstAddr = (Uint32)dstBuff2;
        myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(1,1);
        myParamSetup.linkBcntrld= CSL_EDMA3_LINKBCNTRLD_MAKE(hParamPing,0);
        myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0,1);
        myParamSetup.cCnt = 1;

    /* Pong setup  */
    CSL_edma3ParamSetup(hParamPong,&myParamSetup);

    /* Interrupt enable (Bits 0-1)  for the global region interrupts*/
    regionIntr.region = CSL_EDMA3_REGION_GLOBAL;
    regionIntr.intr   = 0x3;
    regionIntr.intrh  = 0x0000;
    CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTR_ENABLE,&regionIntr);

    /* Trigger channel */
    CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL);
    regionIntr.region = CSL_EDMA3_REGION_GLOBAL;
    regionIntr.intr   = 0;
    regionIntr.intrh  = 0;

    /* Poll on IPR bit 0 */
    do {
        CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,&regionIntr);
    } while (!(regionIntr.intr & 0x1));

    /* Clear the pending bit   */
    CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTRPEND_CLEAR,&regionIntr);

    /* Trigger Channel  */
    CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL);

    /* Poll on IPR bit 2 */
    do {
        CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,&regionIntr);
    } while (!(regionIntr.intr & 0x2));

    /* Close channel */
 CSL_edma3ChannelClose(hChannel);

    /* Close EDMA module 关闭EDMA模块*/
    CSL_edma3Close(hModule);
    /* The test passed. */
    return 0;
}

void main (void)
{
    Uint8  channelNum=0;
    Uint8  instNum = 1;

    printf("EDMA testing...\n");

    edma_ping_pong_xfer_gbl_region(instNum, channelNum);

    printf("Debug: Testing EDMA(%d) Ping-Pong Test (Global) Region for Channel %d passed\n", instNum, channelNum);


    printf("EDMA test successful\n");

       return;

}

  • 您好,

    注意当buffer在L2 memory时,需要转换成全局地址赋给EDMA,如下语句的方式获得的只是局部地址。所以确认一下你的buffer是否在L2,如果是,请按照如下方式修改。

     myParamSetup.srcAddr    = (Uint32)srcBuff;

       myParamSetup.dstAddr    = (Uint32)dstBuff1;

    修改为:

      myParamSetup.srcAddr    = (Uint32)srcBuff + 0x10000000 + DNUM << 24;

       myParamSetup.dstAddr    = (Uint32)dstBuff1+ 0x10000000 + DNUM << 24;

  • Andy Yin

    您好!

    1.按照您所说的,请问如何确认Buff是否在L2呢?另外,buff是否必须在L2?如果不在L2的话是否就无法正确传输数据?

    2.我修改以后为什么会出现下面这样的警告?

    pointer points outside of underlying object

    谢谢!

  • Andy Yin

    如果buff不在L2,那么该如何修改以保证buff存放到L2呢?谢谢!