hi all,
I want to add my DSP algorithm in alg_link using IPNC_RDK3.0,I want to move a few lines of frame from DDR3 to L2_ram to process.then return the data back to ddr3, I tried memcpy() API,but it costs so much time.
Fortunately I find 8127 EDMA API in the dir...\ipnc_rdk\ipnc_mcfw\mcfw\src_bios6 \links_c6xdsp\va\valink_alg.c. In Func VaLink_algCopyFrames() it called the EDMA api, The code has showed below:
/* copy the frame */
edmaWidth = pObj->inQueInfo.chInfo[0].width;
edmaHeight = pObj->inQueInfo.chInfo[0].height;
/* copy Y plane */
DM81XX_EDMA3_setParams(VA_LINK_EDMA3_CH_ID, // chId
VA_LINK_EDMA3_QUEUE_ID, // dmaQueue
(UInt32)pFullFrame->addr[0][0], // srcAddr
(UInt32)pEmptyFrame->addr[0][0], // dstAddr
edmaWidth, // edmaWidth
edmaHeight, // edmaHeight
edmaWidth, // srcLineOffset
edmaWidth); // dstLineOffset
/* Trigger the edma transfer */
DM81XX_EDMA3_triggerTransfer(VA_LINK_EDMA3_CH_ID);
pEmptyFrame->timeStamp = pFullFrame->timeStamp;
Then I add the code to the the Alglink_priv.c:
Int32 AlgLink_algProcessData(AlgLink_Obj * pObj)
{
extern unsigned char *frame_buffer; //frame_buffer大小为2048*1280;开辟在在DDR 的SR2上
unsigned char * current_frame;
unsigned char * temp;
int edmaWidth = 2048;
int edmaHeight = 1280;
UInt32 frameId, status;
System_LinkInQueParams *pInQueParams;
FVID2_Frame *pFrame;
FVID2_FrameList frameList;
pInQueParams = &pObj->createArgs.inQueParams;
System_getLinksFullFrames(pInQueParams->prevLinkId,
pInQueParams->prevLinkQueId, &frameList);
if (frameList.numFrames)
{
/* SCD should be done first as it requires to operate on raw YUV */
if (pObj->createArgs.enableSCDAlg) {
status = AlgLink_ScdalgProcessData(&pObj->scdAlg, &frameList, &pObj->outObj[0].bufOutQue);
if (status == FVID2_SOK) {
/* Send-out the output bitbuffer */
System_sendLinkCmd(pObj->createArgs.outQueParams.nextLink,
SYSTEM_CMD_NEW_DATA);
}
}
for(frameId=0; frameId<frameList.numFrames; frameId++) {
pFrame = frameList.frames[frameId];
if(pFrame->channelNum >= pObj->inQueInfo.numCh)
continue;
//*************************************add my alg ****************************//
/* copy the frame */
edmaWidth = pObj->inQueInfo.chInfo[0].width;
edmaHeight = pObj->inQueInfo.chInfo[0].height;
/* copy Y plane */
DM81XX_EDMA3_setParams(VA_LINK_EDMA3_CH_ID, // chId
VA_LINK_EDMA3_QUEUE_ID, // dmaQueue
(UInt32)pFrame->addr[0][0], // srcAddr
(UInt32)(frame_buffer), // dstAddr
edmaWidth, // edmaWidth
edmaHeight, // edmaHeight
edmaWidth, // srcLineOffset
edmaWidth); // dstLineOffset
/* Trigger the edma transfer */
DM81XX_EDMA3_triggerTransfer(VA_LINK_EDMA3_CH_ID);
pEmptyFrame->timeStamp = pFullFrame->timeStamp;
//Determine data movement error or not
current_frame = (unsigned char *)pFrame->addr[0][0];
temp = frame_buffer;
for(i=0;i<2048*1280;i++){
if(*temp !=*current_frame)
Vps_printf("wrong!!!!!!!");
current_frame++;
temp++;
}
//********************************************************************************//
// do SW OSD
if (pObj->createArgs.enableOSDAlg) {
AlgLink_OsdalgProcessFrame(&pObj->osdAlg, pFrame);
}
}
System_putLinksEmptyFrames(pInQueParams->prevLinkId,
pInQueParams->prevLinkQueId, &frameList);
}
return FVID2_SOK;
}
After compile and run I found the mistake about DMA transfer. The data in src addr and dest addr is different.
I am sure the frame size is 2048*1280,and I run the fullfeature mode ,valink is not running;this DMA channel would
be unused.So what's wrong with it?Is sth wrong about my EDMA configuration?Have you used EDMA transfer in
8127before? If you have,please tell me how to do it.Thank you very much!!
regards
Chase Yan