Hello,
I am working on dm8168evm with ezsdk5.05.
I want to capture 720p60 video frames and do some process on the dsp side,then transmit it back to display.I have modified the saLoopBack(linux example) and video copy(codec engine example) examples to do this. But I cannot allocate memory in L2 cache on the dsp side.
Except wiki pages and xdocs, I referred the links
http://e2e.ti.com/support/embedded/bios/f/355/p/122205/436485.aspx#436485
http://e2e.ti.com/support/embedded/linux/f/354/p/7283/28490.aspx#28490
But I still cannot get memory from L2.
Here is the related codes.
/////////////////*-------------codec part------------------*/
/*-------videnc_copy_ti_priv.h---------*/
typedef struct VIDENCCOPY_TI_Obj {
IALG_Obj alg; /* MUST be first field of all XDAS algs */
IDMA3_Handle dmaHandle1D1D8B; /* DMA logical channel for 1D to 1D xfers */
XDAS_Int8 *workBuf;
XDAS_UInt32 workBufLen;
} VIDENCCOPY_TI_Obj;
/*----------------videnc_copy.c------------------*/
/*
* ======== VIDENCCOPY_TI_activate ========
*/
Void VIDENCCOPY_TI_activate(IALG_Handle handle)
{
Log_print1(Diags_ENTRY, "[+E] VIDENCCOPY_TI_activate(0x%x)", (IArg)handle);
}
/*
* ======== VIDENCCOPY_TI_deactivate ========
*/
Void VIDENCCOPY_TI_deactivate(IALG_Handle handle)
{
Log_print1(Diags_ENTRY, "[+E] VIDENCCOPY_TI_deactivate(0x%x)",
(IArg)handle);
}
/*
* ======== VIDENCCOPY_TI_alloc ========
*/
Int VIDENCCOPY_TI_alloc(const IALG_Params *algParams,
IALG_Fxns **pf, IALG_MemRec memTab[])
{
Registry_Result result;
/*
* No need to reference count for Registry_addModule(), since there
* is no way to remove the module.
*/
if (regInit == 0) {
/* Register this module for logging */
result = Registry_addModule(&ti_sdo_ce_examples_codecs_videnc_copy_desc,
MODNAME);
Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);
if (result == Registry_SUCCESS) {
/* Set the diags mask to the CE default */
CESettings_init();
CESettings_setDiags(MODNAME);
}
regInit = 1;
}
Log_print3(Diags_ENTRY, "[+E] VIDENCCOPY_TI_alloc(0x%x, 0x%x, 0x%x)",
(IArg)algParams, (IArg)pf, (IArg)memTab);
/* Request memory for my object */
memTab[0].size = sizeof(VIDENCCOPY_TI_Obj);
memTab[0].alignment = 0;
memTab[0].space = IALG_EXTERNAL;
memTab[0].attrs = IALG_PERSIST;
memTab[1].size = 0x20000*sizeof(XDAS_Int8);//128KB
memTab[1].alignment = 0;
memTab[1].attrs = IALG_SCRATCH;
memTab[1].space = IALG_DARAM0;
return (1);
}
/*
* ======== VIDENCCOPY_TI_free ========
*/
Int VIDENCCOPY_TI_free(IALG_Handle handle, IALG_MemRec memTab[])
{
VIDENCCOPY_TI_Obj *inst = (VIDENCCOPY_TI_Obj *)handle;
Log_print2(Diags_ENTRY, "[+E] VIDENCCOPY_TI_free(0x%lx, 0x%lx)",
(IArg)handle, (IArg)memTab);
VIDENCCOPY_TI_alloc(NULL, NULL, memTab);
memTab[0].size = sizeof(VIDENCCOPY_TI_Obj);
memTab[0].base = inst;
memTab[1].size = 0x20000*sizeof(XDAS_Int8);
memTab[1].base = inst->workBuf;
return (2);
}
/*
* ======== VIDENCCOPY_TI_initObj ========
*/
Int VIDENCCOPY_TI_initObj(IALG_Handle handle,
const IALG_MemRec memTab[], IALG_Handle p,
const IALG_Params *algParams)
{
VIDENCCOPY_TI_Obj *inst = (VIDENCCOPY_TI_Obj *)handle;
inst->workBuf = memTab[1].base;
inst->workBufLen = 0x20000*sizeof(XDAS_Int8);
Log_print4(Diags_ENTRY,
"[+E] VIDENCCOPY_TI_initObj(0x%x, 0x%x, 0x%x, 0x%x)",
(IArg)handle, (IArg)memTab, (IArg)p, (IArg)algParams);
return (IALG_EOK);
}
And in the VIDENCCOPY_TI_process function, memtab[1] is used as below:
XDAS_Int8 *tmpbuf;
ACPY3_Params params;
VIDENCCOPY_TI_Obj *videncObj = (VIDENCCOPY_TI_Obj *)h;
tmpbuf = videncObj->workBuf;
Log_print1(Diags_USER2, "[+2] tmpbuf address > "
" %x ", (IArg)tmpbuf);
When using dma to copy buffer to tmpbuf or invert,"(Uint32)tmpbuf+0x30000000" is used.
////////////////*------------server part-----------------*/
/*--------------heaps.cfg-----------------*/
I modified the size of ".INT_HEAP" to 0x28000; //160kB
var internalHeapSize = 0x28000; //160kB
/*---------------all_syslink.cfg---------------------*/
var DSKT2 = xdc.useModule('ti.sdo.fc.dskt2.DSKT2');
DSKT2.DARAM0 = "INT_HEAP";
DSKT2.DARAM1 = "INT_HEAP";
DSKT2.DARAM2 = "INT_HEAP";
DSKT2.SARAM0 = "INT_HEAP";
DSKT2.SARAM1 = "INT_HEAP";
DSKT2.SARAM2 = "INT_HEAP";
DSKT2.ESDATA = "EXTALG_HEAP";
DSKT2.EPROG = "EXTALG_HEAP";
DSKT2.IPROG = "INT_HEAP";
DSKT2.DSKT2_HEAP = "EXT_HEAP";
DSKT2.ALLOW_EXTERNAL_SCRATCH = false;//true;//false;
DSKT2.SARAM_SCRATCH_SIZES[0] = 4 * 8192; // 32k scratch for groupId 0
"DMAN3.queuePri = [2,2];" is added just as the link above said.
//////////////////*---------app part----------*/
The codec is used as below
Engine_initAttrs(&attrs);
ce = Engine_open(engineName, &attrs, NULL);
enc = VIDENC_create(ce, encoderName, NULL);
encDynParams.size = sizeof(encDynParams);
encStatus.size = sizeof(encStatus);
status = VIDENC_control(enc, XDM_GETSTATUS, &encDynParams, &encStatus);
status = VIDENC_process(enc, &inBufDesc, &encodedBufDesc, &encInArgs,&encOutArgs);
When running the application with CE_DEBUG=2, I got the message
"[DSP] [t=+000,066 us] [tid=0x9955f170] ti.sdo.ce.examples.codecs.videnc_copy: [+2] tmpbuf address > 0".
It seems that I still cannot get L2 cache used to do video process.
I cannot find where the problem lies.
Hope for help.
Regards,
Yang