- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi guys, I have errors when I implement two usb videos use the FX3 DVK .
My project is changed from UVC sample in SDK Samples . I have added the descriptors in the USB 3 descriptors, there are 4 interfaces , 2 control interfaces and 2 VS stream interfaces. And now the graphEdit(Win7) can recognize the capture source , and the source filter has two source and two output pin . If the address of the VS Stream EP in interface 1 and 3 is the same, the capture source can be rendered but it can not be closed and reopen !!!
The descriptor is :
/* Standard video streaming interface descriptor (Alternate setting 0) */
0x09, /* Descriptor size */
CY_U3P_USB_INTRFC_DESCR, /* Interface descriptor type */
0x01, /* Interface number */
0x00, /* Alternate setting number */
0x00, /* Number of end points : zero bandwidth */
0x0E, /* Interface class : CC_VIDEO */
0x02, /* Interface sub class : CC_VIDEOSTREAMING */
0x00, /* Interface protocol code : Undefined */
0x00, /* Interface descriptor string index */
/* Class-specific video streaming input header descriptor */
0x0F, /* Descriptor size */
0x24, /* Class-specific VS i/f Type */
0x01, /* Descriptotor subtype : input header */
0x02, /* 1 format desciptor follows */ /////////////////format
// 0x19,0x00, /* Total size of class specific VS descr */
0x38,0x00, /* Total size of class specific VS descr */
CY_FX_EP_ISO_VIDEO, /* EP address for ISO video data */
0x00, /* No dynamic format change supported */
0x04, /* Output terminal ID : 4 */
0x01, /* Still image capture method 1 supported */
0x01, /* Hardware trigger supported for still image */
0x00, /* Hardware to initiate still image capture */
0x01, /* Size of controls field : 1 byte */
0x00, /* D2 : Compression quality supported */
0x00,
/* Standard video streaming interface descriptor (Alternate setting 0) */
0x09, /* Descriptor size */
CY_U3P_USB_INTRFC_DESCR, /* Interface descriptor type */
0x03, /* Interface number */
0x00, /* Alternate setting number */
0x00, /* Number of end points : zero bandwidth */
0x0E, /* Interface class : CC_VIDEO */
0x02, /* Interface sub class : CC_VIDEOSTREAMING */
0x00, /* Interface protocol code : Undefined */
0x00, /* Interface descriptor string index */
/* Class-specific video streaming input header descriptor */
0x0F, /* Descriptor size */
0x24, /* Class-specific VS i/f Type */
0x01, /* Descriptotor subtype : input header */
0x02, /* 1 format desciptor follows */ /////////////////format
// 0x19,0x00, /* Total size of class specific VS descr */
0x38,0x00, /* Total size of class specific VS descr */
CY_FX_EP_ISO_VIDEO, /* EP address for ISO video data */
0x00, /* No dynamic format change supported */
// 0x04, /* Output terminal ID : 4 */
//change 0912
0x08,
0x01, /* Still image capture method 1 supported */
0x01, /* Hardware trigger supported for still image */
0x00, /* Hardware to initiate still image capture */
0x01, /* Size of controls field : 1 byte */
0x00, /* D2 : Compression quality supported */
0x00, /* D2 : Compression quality supported */
From those two VS stream interfaces descriptors , you can see the EP address is the same : CY_FX_EP_ISO_VIDEO . But I can not close and reopen the videos ???
Then I changed the EP address , I changed the EP address from CY_FX_EP_ISO_VIDEO to CY_FX_EP_ISO_VIDEO_2 (I define the value is 0x83). Then in the project I think I used the same DMA Channels and same DMA buffers for the 2 EPs, but use 2 values to define whether the EP is active or not (glIsApplnActive and glIsApplnActive2) ,
If the EhP0 is closed , I flush the EP0, and if the EP1 is active, the DMA channel does not destroy. The DMA channel is create when there is a EP open , But the DMA destroy only when the EP0 abd EP1 all close! see the below code:
CyU3PReturnStatus_t
CyFxUVCApplnStart (uint8_t interface)
{
CyU3PEpConfig_t epCfg;
CyU3PDmaChannelConfig_t dmaCfg;
CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;
CyU3PDebugPrint(4, "+++++CyFxUVCApplnStart++++\n");
/*changed by jijun.yu 0913*/
uint8_t epAddr = -1;
if (!glIsApplnActive && (interface == 1))
epAddr = CY_FX_EP_ISO_VIDEO;
else if (!glIsApplnActive2 && (interface == 3))
epAddr = CY_FX_EP_ISO_VIDEO_2;
else
return CY_U3P_SUCCESS;
CyU3PDebugPrint(4, "+++++CyFxUVCApplnStart epAddr = %d++++\n",epAddr);
/* Video streaming endpoint configuration */
epCfg.enable = CyTrue;
epCfg.epType = CY_U3P_USB_EP_ISO;
epCfg.pcktSize = CY_FX_EP_ISO_VIDEO_PKT_SIZE;
epCfg.isoPkts = 1;
epCfg.burstLen = 1;
epCfg.streams = 0;
//changed by jijun.yu 0913
apiRetStatus = CyU3PSetEpConfig(epAddr, &epCfg); //CY_FX_EP_ISO_VIDEO
if (apiRetStatus != CY_U3P_SUCCESS)
{
CyU3PDebugPrint (4, "CyU3PSetEpConfig failed, Error Code = %d\n", apiRetStatus);
return apiRetStatus;
}
/* Create a DMA Manual OUT channel for streaming data */
/* Video streaming Channel is not active till a stream request is received */
dmaCfg.size = CY_FX_UVC_STREAM_BUF_SIZE;
dmaCfg.count = CY_FX_UVC_STREAM_BUF_COUNT;
dmaCfg.prodSckId = CY_U3P_CPU_SOCKET_PROD;
dmaCfg.consSckId = CY_FX_EP_VIDEO_CONS_SOCKET;
dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;
dmaCfg.cb = NULL;
dmaCfg.prodHeader = 0;
dmaCfg.prodFooter = 0;
dmaCfg.consHeader = 0;
dmaCfg.prodAvailCount = 0;
/*changed jijun 0913*/
if ((!glIsApplnActive) && (!glIsApplnActive2)) {
apiRetStatus = CyU3PDmaChannelCreate (&glChHandleUVCStream, CY_U3P_DMA_TYPE_MANUAL_OUT, &dmaCfg);
if (apiRetStatus != CY_U3P_SUCCESS)
{
CyU3PDebugPrint (4, "CyU3PDmaChannelCreate failed, error code = %d\n",apiRetStatus);
return apiRetStatus;
}
}
/* Flush the endpoint memory */
CyU3PUsbFlushEp(epAddr);
/////////////??????
if (!glIsApplnActive && !glIsApplnActive2) {
apiRetStatus = CyU3PDmaChannelSetXfer (&glChHandleUVCStream, 0);
if (apiRetStatus != CY_U3P_SUCCESS)
{
CyU3PDebugPrint (4, "CyU3PDmaChannelSetXfer failed, error code = %d\n", apiRetStatus);
return apiRetStatus;
}
}
/* Update the flag so that the application thread is notified of this. */
if (interface == 1)
glIsApplnActive = CyTrue;
if (interface == 3)
glIsApplnActive2 = CyTrue;
return CY_U3P_SUCCESS;
}
void
CyFxUVCApplnStop (uint8_t interface)
{
CyU3PEpConfig_t epCfg;
uint8_t epAddr = -1;
CyU3PDebugPrint(4, "CyFxUVCApplnStop interface = %d \n",interface);
/* Update the flag so that the application thread is notified of this. */
if (interface ==1) {
epAddr = CY_FX_EP_ISO_VIDEO;
glIsApplnActive = CyFalse;
}
if (interface == 3) {
epAddr = CY_FX_EP_ISO_VIDEO_2;
glIsApplnActive2 = CyFalse;
}
/* Abort and destroy the video streaming channel */
if ((!glIsApplnActive) && (!glIsApplnActive2)) {
CyU3PDebugPrint(4,"Destroy the dma channel \n");
CyU3PDmaChannelDestroy (&glChHandleUVCStream);
}
/* Flush the endpoint memory */
CyU3PUsbFlushEp(epAddr);
/* Disable the video streaming endpoint. */
CyU3PMemSet ((uint8_t *)&epCfg, 0, sizeof (epCfg));
epCfg.enable = CyFalse;
CyU3PSetEpConfig(epAddr, &epCfg);
}
static void
CyFxUVCApplnUSBEventCB (
CyU3PUsbEventType_t evtype, /* Event type */
uint16_t evdata /* Event data */
)
{
uint8_t interface = 0, altSetting = 0;
if (evtype == CY_U3P_USB_EVENT_SETINTF )
CyU3PDebugPrint(4,"CyFxUVCApplnUSBEventCB evtype = %d \n ",evtype);
switch (evtype)
{
case CY_U3P_USB_EVENT_SETINTF:
/* Start the video streamer application if the
* interface requested was 1. If not, stop the
* streamer. */
interface = CY_U3P_GET_MSB(evdata);
altSetting = CY_U3P_GET_LSB(evdata);
if ((altSetting == CY_FX_UVC_STREAM_INTERFACE) &&
((interface == 1)||(interface == 3)))
{
/* Stop the application before re-starting. */
if (glIsApplnActive||glIsApplnActive2)
{
CyFxUVCApplnStop (interface);
} //else //added 0913
CyFxUVCApplnStart (interface);
break;
}
/* Fall-through. */
case CY_U3P_USB_EVENT_SETCONF:
case CY_U3P_USB_EVENT_RESET:
case CY_U3P_USB_EVENT_DISCONNECT:
/* Stop the video streamer application. */
if (glIsApplnActive||glIsApplnActive2)
{
CyFxUVCApplnStop (interface);
}
break;
default:
break;
}
// CyU3PDebugPrint(4,"CyFxUVCApplnUSBEventCB is ok \n");
}
void
UVCAppThread_Entry (
uint32_t input) {
while (glIsApplnActive||glIsApplnActive2){
.............
}
}
however, after I changed the process, the Ep1 can not be rendered!!! and also can not be reopened ! Can you tell me how two handle the DMA channel and two video devices?? Thanks!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I would recommend you to create a tech support case to get help on this.
Thanks,
Sai Krishna.