Hello,
I am trying to get the sd_loopback demo supplied with the pspdiververs in dvsdk compiled under CCS4. Unfortunately, it i rather laborious to get all the pieces together as the CCS3 project cannot be directly loaded.
I managed to get everything compiled and run the demo, however when I get tho the first Vport call, FVID_create, it never returns. I copied the code below. It is the original example. Though it is rather long it fails very early in at the highlighted line.
I also set up the Vport drivers in the bios config file as per the original example. the init functions of the drivers get called for each instance as specified in the BIOS config file.
The example assumes that the Pin mux is set properly which is a function of the supplied gel file. Though I am not sure how the EDCs are reset...
Any hint would be welcome.
Regards,
Peter
static Int32 test_sd_loopback(EDMA3_DRV_Handle hEdma,
Uint32 numCapChannel,
Uint32 totalFrameCnt,
Uint32 numFrameLoop,
Int32 sedId)
{
Int status = IOM_COMPLETED;
Int inputChan;
Int frames;
Int count;
/* Array containing display and capture channel information */
ChannelInfo disChInfo;
ChannelInfo capChInfo[MAX_CAP_CHAN];
/* Array containing display and capture driver name strings
Use this strings as they are for proper driver creation */
Int8 *vPortCapStrings[MAX_CAP_CHAN] =
{
"/VP0CAPTURE/A/0",
"/VP0CAPTURE/B/1",
"/VP2CAPTURE/A/2",
"/VP2CAPTURE/B/3",
"/VP3CAPTURE/A/4",
"/VP3CAPTURE/B/5",
"/VP4CAPTURE/A/6",
"/VP4CAPTURE/B/7"
};
Int8 *vPortDisStrings = "/VP1DISPLAY/SAA7105";
if ((!numCapChannel) || (numCapChannel > MAX_CAP_CHAN))
{
LOG_printf(&trace,
"Give number of capture channel between 1 and %d\n",
MAX_CAP_CHAN);
return -1;
}
if ((!totalFrameCnt) || (!numFrameLoop))
{
LOG_printf(&trace, "Give non-zero frame count/loop count\n");
return -1;
}
/* Allocate both capture and display frame buffers
in external heap memory */
vCapParamsChan.segId = sedId;
vDisParamsChan.segId = sedId;
/* Assign EDMA3 driver handle to channel params */
vCapParamsChan.hEdma = hEdma;
vDisParamsChan.hEdma = hEdma;
/* Enable or disable horizontal scaling */
#if (CFG_ENABLE_SCALING == 1)
vCapParamsChan.scale = VPORT_SCALING_ENABLE;
vCapParamsChan.thrld = NUMPIXELS >> 4;
vDisParamsChan.scale = VPORT_SCALING_ENABLE;
vDisParamsChan.thrld = NUMPIXELS >> 4;
#else
vCapParamsChan.scale = VPORT_SCALING_DISABLE;
vCapParamsChan.thrld = NUMPIXELS >> 3;
vDisParamsChan.scale = VPORT_SCALING_DISABLE;
vDisParamsChan.thrld = NUMPIXELS >> 3;
#endif /* #if (CFG_ENABLE_SCALING == 1) */
/* Create and configure capture drivers */
for (count = 0; count < numCapChannel; count++)
{
capChInfo[count].chanHandle = FVID_create(vPortCapStrings[count],
IOM_INPUT,
&status,
(Ptr)&vCapParamsChan,
NULL);
if (IOM_COMPLETED != status)
{
LOG_printf(&trace, "Failed to create capture channel %d\n", count);
break;
}
}
/* Create and configure display driver */
if (IOM_COMPLETED == status)
{
disChInfo.chanHandle = FVID_create(vPortDisStrings,
IOM_OUTPUT,
&status,
(Ptr)&vDisParamsChan,
NULL);
if (IOM_COMPLETED != status)
{
LOG_printf(&trace, "Failed to create display channels\n");
}
}
/* Configure external video encoders (SAA7105) & decoders (TVP5154) */
if (IOM_COMPLETED == status)
{
/* Only need to configure if the mode is PAL. Since NTSC is the default
mode of operation for EDC driver */
#if !(CFG_VIDEO_MODE == MODE_NTSC)
/* Configure SAA7105 */
status |= FVID_control(disChInfo.chanHandle,
VPORT_CMD_EDC_BASE + EDC_CONFIG,
(Ptr)&vDisParamsEncoder);
for (count = 0; count < numCapChannel; count++)
{
/* Configure TVP5154 */
status |= FVID_control(capChInfo[count].chanHandle,
VPORT_CMD_EDC_BASE + EDC_CONFIG,
(Ptr)&vCapParamsDecoder);
}
#endif /* #if !(CFG_VIDEO_MODE == MODE_NTSC) */
}
else
{
LOG_printf(&trace, "Failed to open - Display channel\n");
}
/* Start display and capture operations */
if (IOM_COMPLETED == status)
{
status |= FVID_control(disChInfo.chanHandle,
VPORT_CMD_START,
NULL);
for (count = 0; count < numCapChannel; count++)
{
status |= FVID_control(capChInfo[count].chanHandle,
VPORT_CMD_START,
NULL);
}
}
else
{
LOG_printf(&trace, "Failed to configure cap/disp channel device\n");
}
/* Request a frame buffer from display & capture driver */
if (IOM_COMPLETED == status)
{
/* Display buffer will return a free buffer */
status |= FVID_alloc(disChInfo.chanHandle, &(disChInfo.frame));
for (count = 0; count < numCapChannel; count++)
{
/* Capture buffer will return the latest captured buffer */
status |= FVID_alloc(capChInfo[count].chanHandle,
&(capChInfo[count].frame));
}
}
else
{
LOG_printf(&trace, "Failed to start display/capture driver\n");
}
if (IOM_COMPLETED == status)
{
frames = 0;
inputChan = 0; /* Default to VP0 Capture Channel A */
while (frames < totalFrameCnt)
{
/* Invalidate the buffer before giving to capture driver */
BCACHE_inv((Uint8 *)capChInfo[inputChan].frame->frame.iFrm.y1,
(FRAME_SIZE),
TRUE);
/* Give the old capture frame buffer back to driver and get the
recently captured frame buffer */
status = FVID_exchange(capChInfo[inputChan].chanHandle,
&(capChInfo[inputChan].frame));
#if (CFG_ENABLE_DOUBLEWORD_BYTE_SWAP == 1)
/* Fix for Video Port bigendian mode - This is for capture port */
double_word_byte_swap(
(Uint8 *)capChInfo[inputChan].frame->frame.iFrm.y1,
FRAME_SIZE);
/* Fix for Video Port bigendian mode - This is for display port */
double_word_byte_swap(
(Uint8 *)capChInfo[inputChan].frame->frame.iFrm.y1,
FRAME_SIZE);
#endif /* #if (CFG_ENABLE_DOUBLEWORD_BYTE_SWAP == 1) */
/* Flush and invalidate the processed buffer so that the EDMA reads
the processed data */
BCACHE_wbInv((Uint8 *)capChInfo[inputChan].frame->frame.iFrm.y1,
(FRAME_SIZE),
TRUE);
/* Note: For DM648 we are directly exchanging the capture
* buffer to display channel instead of copying to display buffer.
* Care has to be taken that the buffers are with their
* respective driver (where they were allocated) while deleting
* (GIO delete) the drivers, because these driver will free their
* buffers at this point.
* But in real scenario, need for GIO delete will not occur.
*/
/* Give the captured frame buffer to display driver and get a
free frame buffer for next capture */
status |= FVID_exchange(disChInfo.chanHandle,
&(capChInfo[inputChan].frame));
/* LOG_printf(&trace, "%d\n", frames); */
if (IOM_COMPLETED != status)
{
LOG_printf(&trace, "IOM_COMPLETED != status\n");
break;
}
frames++;
/* Check if we need to change capture channel */
if (0 == (frames % numFrameLoop))
{
if (inputChan < (numCapChannel - 1))
{
inputChan++;
}
else if ((numCapChannel - 1) == inputChan)
{
inputChan = 0; /* Go back to channel 0 */
}
}
/* Update global frame count for check purpose */
AppSdFrameCnt = frames;
}/* while (frame count) */
/* Stop capture and display operation */
if (IOM_COMPLETED == status)
{
status |= FVID_control(disChInfo.chanHandle,
VPORT_CMD_STOP,
NULL);
for (count = 0; count < numCapChannel; count++)
{
status |= FVID_control(capChInfo[count].chanHandle,
VPORT_CMD_STOP,
NULL);
}
}
else
{
LOG_printf(&trace, "Failed to alloc or exchange buffers\n");
}
/* Delete capture and display drivers */
if (IOM_COMPLETED == status)
{
status |= FVID_delete(disChInfo.chanHandle);
for (count = 0; count < numCapChannel; count++)
{
status |= FVID_delete(capChInfo[count].chanHandle);
if (IOM_COMPLETED != status)
{
LOG_printf(&trace,
"Failed to delete capture channel %d\n",
count);
}
}
if (IOM_COMPLETED == status)
{
LOG_printf(&trace, "Application closed successfully!!\n");
}
}
else
{
LOG_printf(&trace, "Failed to stop display/capture channel\n");
}
}
else if (IOM_COMPLETED != status)
{
LOG_printf(&trace, "Failed to alloc or exchange buffers\n");
}
return status;
}