The following code is picked up from the sample program in PSP package. I used them in my project. but I found that the third parameter sedId is zero when the function test_raw_capture() is called, however at the same time I can see that the EXTERNALHEAP is 0xE4046BEC in the watch window. Generally speaking, I can assign a pointer address to an integer variable like this:
Int32 sedId = (Int32) EXTERNALHEAP;
While I find that I could not do this in CCS, at the entry of function test_raw_capture(), the sedId is zero in the watch window, which will cause a failure in FVID_allocBuffer() later.
Then I changed the assignment to direct hard-code like this:
vCapParamsChanRaw.segId = 0xE4046BEC;
vDisParamsChan.segId = 0xE4046BEC;
The external heap address is looked up in the *.map file. There is another question : In DSP/BIOS I have configured the DDR2 to have a heap with the size of 0x02000000, and labeled as EXTERNALHEAP. So why is the EXTERNALHEAP at the address of 0xE4046BEC not at 0xE0000000?
Even after this modification, the function FVID_allocBuffer still failed with a returned value of -5. Now I have no idea at all. Did I miss something important here?
The software is CCS3.3 with SR11 and PSP 1.10.01. It seems that I still could not dynamically allocate memory. Can anyone help me out of this?
void tskRawCapture(void)
{
/* Run VP4 raw capture -> VP1 display */
test_raw_capture(hEdma, CFG_NUM_FRAME_COUNT, EXTERNALHEAP);
}
static Int32 test_raw_capture(EDMA3_DRV_Handle hEdma,
Uint32 totalFrameCnt,
Int32 sedId)
{
Int status = IOM_COMPLETED;
Int frames, bufCount;
/* Display and capture channel information */
ChannelInfo capChInfoRaw;
ChannelInfo disChInfo;
/* Display and capture driver name strings
Use this strings as they are for proper driver creation */
Int8 *vPortCapStringsRaw = "/VP4CAPTURE/A";
Int8 *vPortDisStrings = "/VP1DISPLAY/SAA7105";
if (!totalFrameCnt)
{
LOG_printf(&trace, "Give non-zero frame count\n");
return -1;
}
/* Allocate both capture and display frame buffers
in external heap memory */
vCapParamsChanRaw.segId = sedId;
vDisParamsChan.segId = sedId;
……………
/* Allocate and Queue buffers for display and capture drivers */
if (IOM_COMPLETED == status)
{
for (bufCount = 0; bufCount < NUM_FRAME_BUFFERS; bufCount++)
{
/* Allocate Frame buffer for capture driver */
status = FVID_allocBuffer(capChInfo.chanHandle, &(capChInfo.frame));
if (IOM_COMPLETED != status)
{
LOG_printf(&trace, "Failed to allocate buffer\n");
break;
}
/* Queue the buffers */
status = FVID_queue(capChInfo.chanHandle, &(capChInfo.frame));
if (IOM_COMPLETED != status)
{
LOG_printf(&trace, "Failed to Queue buffer\n");
break;
}
/* Allocate Frame buffer for display driver - VP3 */
status = FVID_allocBuffer(disChInfoRaw.chanHandle,
&(disChInfoRaw.frame));
if (IOM_COMPLETED != status)
{
LOG_printf(&trace, "Failed to allocate buffer\n");
break;
}
/* Queue the buffers */
status = FVID_queue(disChInfoRaw.chanHandle, &(disChInfoRaw.frame));
if (IOM_COMPLETED != status)
{
LOG_printf(&trace, "Failed to Queue buffer\n");
break;
}
}
}
else
{
LOG_printf(&trace, "Failed to create - Display channel\n");
}
}