2 Replies Latest reply on Sep 13, 2013 10:02 AM by yu.jj
      • 1. Re: How to make the  DVK to be enumed as two uvc videos ?
        yu.jj
                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, /* D2 : Compression quality supported */ and the interface 3 decriptors is : /* 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; } } #ifdef stream2 apiRetStatus = CyU3PDmaChannelCreate (&glChHandleUVCStream2, CY_U3P_DMA_TYPE_MANUAL_OUT, &dmaCfg); if (apiRetStatus != CY_U3P_SUCCESS) { CyU3PDebugPrint (4, "CyU3PDmaChannelCreate failed, error code = %d\n",apiRetStatus); return apiRetStatus; } #endif /* 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; } } #ifdef stream2 apiRetStatus = CyU3PDmaChannelSetXfer (&glChHandleUVCStream2, 0); if (apiRetStatus != CY_U3P_SUCCESS) { CyU3PDebugPrint (4, "CyU3PDmaChannelSetXfer failed, error code = %d\n", apiRetStatus); return apiRetStatus; } #endif /* 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; } /* This function stops the video streaming. It is called from the USB event * handler, when there is a reset / disconnect or SET_INTERFACE for alternate * interface 0. */ 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); #ifdef stream2 CyU3PDmaChannelDestroy (&glChHandleUVCStream2); #endif } /* Flush the endpoint memory */ CyU3PUsbFlushEp(epAddr); /* Disable the video streaming endpoint. */ CyU3PMemSet ((uint8_t *)&epCfg, 0, sizeof (epCfg)); epCfg.enable = CyFalse; CyU3PSetEpConfig(epAddr, &epCfg); } 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); #ifdef stream2 CyU3PDmaChannelDestroy (&glChHandleUVCStream2); #endif } /* Flush the endpoint memory */ CyU3PUsbFlushEp(epAddr); /* Disable the video streaming endpoint. */ CyU3PMemSet ((uint8_t *)&epCfg, 0, sizeof (epCfg)); epCfg.enable = CyFalse; CyU3PSetEpConfig(epAddr, &epCfg); } 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!!   
        • 2. Re: How to make the  DVK to be enumed as two uvc videos ?
          rama.sai.krishna.vakkantula

          Hi,

             

          I think if you use Mozilla Firefox to paste your code then it will avoid these formatting issues. I am also facing some formating issues when I use chrome.

             

          Thanks,

             

          Sai Krishna.