TI的工程师你们好!
目前使用6678 在BIOS下进行QDMA的调试 目前发现的问题是 想要配置成Region0 下的QDMA发送 但是Region0的IPR一直是0 但是Global内的IPR正常置位
并且QDMA传数正常 在DDR内(EMIF-》DDR)可以看到正确的图像数据,所以想问下我的程序究竟是哪里出了问题,程序依照CSL EDMA3的测试合集程序修改
QDMA初始化源程序:
int QdmaInit (
int instNum,
unsigned char channelNum,
int regionNum,
int CoreId,
CSL_Edma3CmdIntr* regionIntr,
CSL_Edma3Handle* hModule,
CSL_Edma3Obj* edmaObj,
CSL_Edma3ParamHandle* hParamPing,
CSL_Edma3ChannelObj* chObj,
CSL_Edma3ChannelHandle* hChannel,
CSL_Edma3ParamSetup* myParamSetup
)
{
CSL_Edma3CmdDrae regionAccess;
CSL_Edma3Context context;
CSL_Edma3ChannelAttr chAttr;
CSL_Edma3CmdQrae qraeSetup;
CSL_Status status;
/* Module initialization */
if (CSL_edma3Init(&context) != CSL_SOK)
{
printf ("Error: EDMA module initialization failed\n");
return -1;
}
/* Module level open */
*hModule = CSL_edma3Open(edmaObj,instNum,NULL,&status);
if ((*hModule == NULL) || (status != CSL_SOK))
{
printf ("Error: EDMA module open failed\n");
return -2;
}
/* Shadow Region: Enable DRAE enable(Bits 0-15) it. */
regionAccess.region = regionNum;
regionAccess.drae = 0x0000;
regionAccess.draeh = 0x0000;
if (CSL_edma3HwControl(*hModule,CSL_EDMA3_CMD_DMAREGION_ENABLE, ®ionAccess) != CSL_SOK)
{
printf ("Error: EDMA region enable command failed\n");
return -3;
}
/* Enable access for all QDMA channels in the SHADOW Region. */
qraeSetup.region = regionNum;
qraeSetup.qrae = 0xFF;
if (CSL_edma3HwControl(*hModule,CSL_EDMA3_CMD_QDMAREGION_ENABLE, &qraeSetup) != CSL_SOK)
{
printf ("Error: EDMA QDMA region enable command failed\n");
return -4;
}
/* QDMA Channel Open */
chAttr.regionNum = regionNum;
chAttr.chaNum = channelNum;
*hChannel = CSL_edma3ChannelOpen(chObj, instNum, &chAttr, &status);
if ((*hChannel == NULL) || (status != CSL_SOK))
{
printf ("Error: EDMA channel open failed\n");
return -5;
}
/* Map QDMA Channel to the PING Param Block i.e. 1 */
CSL_edma3HwChannelSetupParam (*hChannel, 3);
/* Setup the trigger word for the QDMA Channel. */
CSL_edma3HwChannelSetupTriggerWord(*hChannel, 7);
/* PING Parameter Entry Handle */
*hParamPing = CSL_edma3GetParamHandle(*hChannel, 3, &status);
if (*hParamPing == NULL)
{
printf ("Error: EDMA get handle for param entry 1 failed\n");
return -6;
}
/* Setup param entry */
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_EN, \
CSL_EDMA3_SYNC_AB, \
CSL_EDMA3_ADDRMODE_INCR, \
CSL_EDMA3_ADDRMODE_INCR);
//myParamSetup->option = 0x0010000C;
myParamSetup->srcAddr = 0x70000000;
myParamSetup->aCntbCnt = 0x024402D0;
myParamSetup->dstAddr = 0x81000000;
myParamSetup->srcDstBidx = 0x02D002D0;//high 16bit is for dest
myParamSetup->linkBcntrld = 0x0000ffff;
myParamSetup->srcDstCidx = 0x0;
myParamSetup->cCnt = 0x00000001;
/* Setup PING to operate with this PARAM Entry. */
if (CSL_edma3ParamSetup(*hParamPing, myParamSetup) != CSL_SOK)
{
printf ("Error: EDMA param setup failed\n");
return -7;
}
/* Enable Channel */
if (CSL_edma3HwChannelControl(*hChannel,CSL_EDMA3_CMD_CHANNEL_ENABLE, NULL) != CSL_SOK)
{
printf ("Error: EDMA channel enable command failed\n");
return -8;
}
return 0;
}
Main 函数调用:
i=QdmaInit (
1, //使用EDMA CC 1
64, //使用QDMA channel0
CSL_EDMA3_REGION_0,
CoreId,
®ionIntr,
&hModule,
&edmaObj,
&hParamPing,
&chObj,
&hChannel,
&myParamSetup
);
Hwi内调用:
if (CSL_edma3ParamWriteWord(hParamPing,3,0×81000000+0x65F40*CountIn) != CSL_SOK) {
printf ("Error: EDMA param write word failed\n");
}
if (CSL_edma3ParamWriteWord(hParamPing,7,2) != CSL_SOK) {
printf ("Error: EDMA param write word failed\n");
}
/* Poll IPR bit */
regionIntr.region = CSL_EDMA3_REGION_0;
do {
CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,®ionIntr);
} while (!(regionIntr.intr & 0x1));
/* Clear pending interrupt */
if (CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTRPEND_CLEAR, ®ionIntr) != CSL_SOK)
{
printf ("Error: EDMA clear interrupt pend command failed\n");
}
程序最后一直卡在那个do while循环里了 通过观察0x02722000发现IPR都是0 但是观察0x02721068发现IPR正确置位了,我试过在调用的时候
将CSL_EDMA3_REGION_0 改为 CSL_EDMA3_REGION_GLOBAL 发现程序就正常运行了 同时观察Region0 的 QDMA event enable寄存器 发现是
0x00000001 说明region0的 QDMA channel0 也正确打开了 但是为什么IPR就是不能置位 是还有什么地方没有配置吗?
shiyan sun:
回复 Andy Yin1:
/* Enable access for all QDMA channels in the SHADOW Region. */ qraeSetup.region = regionNum; qraeSetup.qrae = 0xFF; if (CSL_edma3HwControl(*hModule,CSL_EDMA3_CMD_QDMAREGION_ENABLE, &qraeSetup) != CSL_SOK) { printf ("Error: EDMA QDMA region enable command failed\n"); return -4; }
程序里这句就是置位QREA了吧?
我也确认了0x0380 也确实就是0xFF 不过没有置高
不过现在我使用DMA 并且使用手动置位的方式实现了同样的功能 现在程序运转正常了!