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.

TMS320C6657: 【求教!紧急!】EDMA是否支持对一个instance同时配置多个channel?即支持同步读写?

Part Number: TMS320C6657

各位专家好:

我提出的问题不是像例程一样,在for循环里跑多个channel:

/* Run the test for EDMA Instance 1 and 2; both have the same limits. */
for (instNum = 1; instNum < 3; instNum++)
{
/* EDMA Instance 1 and 2: Supports 64 DMA Channels. */
for (channelNum = 0; channelNum < 64; channelNum++)
{
if (edma_ping_pong_xfer_gbl_region(instNum, channelNum) < 0)
{
printf("Error: Testing EDMA(%d) Ping-Pong Test (Global) Region for Channel %d FAILED\n",
instNum, channelNum);
return;
}
printf("Debug: Testing EDMA(%d) Ping-Pong Test (Global) Region for Channel %d Passed\n",
instNum, channelNum);
}
}

我的意思是在打开一个EDMA的model之后,同时打开两个通道,即:

//打开edma实例
hEdmaModule = CSL_edma3Open(&edmaObj, instNum, NULL, &status);
if ( (hEdmaModule == NULL) || (status != CSL_SOK))
{
printf ("Error: EDMA module open failed\n");
}
//打开读通道
chAttr.regionNum = CSL_EDMA3_REGION_GLOBAL;
chAttr.chaNum = channelNum_Read;
hEdmaReadChannel = CSL_edma3ChannelOpen(&chObj, instNum, &chAttr, &status);
if ((hEdmaReadChannel == NULL) || (status != CSL_SOK))
{
printf ("Error: Unable to open EDMA Channel:%d\n", channelNum_Read);
}
//打开写通道
chAttr.regionNum = CSL_EDMA3_REGION_GLOBAL;
chAttr.chaNum = channelNum_write;
hEdmaWriteChannel = CSL_edma3ChannelOpen(&chObj, instNum, &chAttr, &status);
if ((hEdmaWriteChannel == NULL) || (status != CSL_SOK))
{
printf ("Error: Unable to open EDMA Channel:%d\n", channelNum_write);
}

跑我上面的代码,我做实验验证了:打开的channel等于EDMA实例对象的句柄,多次调用函数CSL_edma3ChannelOpen()函数,写入相同的instNum和不同的chAttr.chaNum,后写入的chaNum会覆盖在原有的chAttr.chaNum上。且打开的通道指向一个model的同一块地址。所以我才想问,是不是对于一个edma只能同时跑一个通道?如果需要同时读写两个通道,是不是得用两个edma instance?

 (另:附上目前的EDMA信道控制器的框图)

  • 我认为您尝试一下确保在为每个通道配置属性时,使用不同的`chAttr`对象,而不是重用相同的对象。这样可以确保每个通道都有独立的配置属性

    // 打开读通道
    chAttr.regionNum = CSL_EDMA3_REGION_GLOBAL;
    chAttr.chaNum = channelNum_Read;
    hEdmaReadChannel = CSL_edma3ChannelOpen(&chObjRead, instNum, &chAttr, &status);
    if ((hEdmaReadChannel == NULL) || (status != CSL_SOK))
    {
    printf ("Error: Unable to open EDMA Read Channel:%d\n", channelNum_Read);
    }
    
    // 打开写通道
    chAttr.regionNum = CSL_EDMA3_REGION_GLOBAL;
    chAttr.chaNum = channelNum_write;
    hEdmaWriteChannel = CSL_edma3ChannelOpen(&chObjWrite, instNum, &chAttr, &status);
    if ((hEdmaWriteChannel == NULL) || (status != CSL_SOK))
    {
    printf ("Error: Unable to open EDMA Write Channel:%d\n", channelNum_write);
    }

    上述示例代码假设声明两个不同的`chObjRead`和`chObjWrite`对象来配置读写通道的属性

  • 所以我有一个最直观的问题是:EDMA3支持双通道同步读写吗?

  • 我认为是支持的

  • 这个同步读写的触发条件是只调用一次指令可以完成的吗?类似这种:

    //触发通道
    //触发EDMA通道
    CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL);
    //轮询EDMA的传输完成标志位
    do {
    CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,&regionIntr);
    } while (!(regionIntr.intr & (0x1 << TccCode)));
    //清空IPR/IPRH等待标志位
    CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTRPEND_CLEAR,&regionIntr);

  • 请移步英文论坛发帖