标题: CYUSBcycx3_uvc_ov5640工程 BLUK传输改ISO传输问题 [打印本页] 作者: hceng 时间: 2020-7-5 18:25 标题: CYUSBcycx3_uvc_ov5640工程 BLUK传输改ISO传输问题 修改原来端点描述符
/* Standard video streaming interface descriptor (Alternate setting 1) */
0x09, /* Descriptor size */
CY_U3P_USB_INTRFC_DESCR, /* Interface Descriptor type */
0x01, /* Interface number: 1 */
0x01, /* Alternate setting number: 0 */
0x01, /* Number of end points: 1 Bulk Endpoint */
0x0E, /* Interface class : CC_VIDEO */
0x02, /* Interface sub class : SC_VIDEOSTREAMING */
0x00, /* Interface protocol code : PC_PROTOCOL_UNDEFINED */
0x00, /* Interface descriptor string index */
/* 视频传输端点描述符 Endpoint Descriptor for BULK Streaming Video Data */
0x07, /* Descriptor size */
CY_U3P_USB_ENDPNT_DESCR, /* Endpoint Descriptor Type */
CX3_EP_BULK_VIDEO, /* Endpoint address and description: EP 3 IN */
0x05, /* ISO endpoint type */
0x00, /* LS Byte of maximum packet size. */
0x04, /* MS Byte of maximum packet size. */
0x01, /* Servicing interval for data transfers */
/* Super Speed Endpoint Companion Descriptor */
0x06, /* Descriptor size */
CY_U3P_SS_EP_COMPN_DESCR, /* SS Endpoint Companion Descriptor Type */
CY_FX_PKTS_PER_BURST-1, /* Max no. of packets in a burst 0-15,从0开始计数 */
CY_FX_BURST_PER_SOF-1, /* Mult setting: Number of bursts per service interval. */
CY_U3P_GET_LSB(CY_FX_PKTS_MAX_SIZE),/* LS Byte of data per interval. */
CY_U3P_GET_MSB(CY_FX_PKTS_MAX_SIZE) /* MS Byte of data per interval. */
打开cycx3_uvc.h文件中调试CX3_DEBUG_ENABLED
打印信息如下
bType=0x0,bTarget=0x1,bRequest=0xB,wValue=0x0,wIndex=0x1,wLength=0x0 //设置接口请求
UsbCB: IF = 1, ALT = 0
bType=0x0,bTarget=0x1,bRequest=0x0,wValue=0x0,wIndex=0x0,wLength=0x2 //获取接口状态, 程序中返回[0,0]
bType=0x0,bTarget=0x1,bRequest=0xB,wValue=0x0,wIndex=0x1,wLength=0x0//设置接口请求
UsbCB: IF = 1, ALT = 0
...中间是ucv类请求
bType=0x0,bTarget=0x1,bRequest=0x3,wValue=0x0,wIndex=0x100,wLength=0x0 //设置特性请求, 接口号=0x100不知道是什么
StpCB:In SET_FTR 0::1 //设置接口事件
bType=0x0,bTarget=0x1,bRequest=0x3,wValue=0x0,wIndex=0x0,wLength=0x0
StpCB:In SET_FTR 0::1
bType=0x0,bTarget=0x1,bRequest=0x3,wValue=0x0,wIndex=0x100,wLength=0x0
StpCB:In SET_FTR 0::1
bType=0x0,bTarget=0x1,bRequest=0x3,wValue=0x0,wIndex=0x0,wLength=0x0
StpCB:In SET_FTR 0::1
bType=0x0,bTarget=0x1,bRequest=0x3,wValue=0x0,wIndex=0x100,wLength=0x0
StpCB:In SET_FTR 0::1
//获取设备状态bRType=0x80
if(bRType == CY_U3P_USB_GS_DEVICE)
{
/* Make sure that we bring the link back to U0, so that the ERDY can be sent. */
if (CyU3PUsbGetSpeed () == CY_U3P_SUPER_SPEED)
CyU3PUsbSetLinkPowerState (CyU3PUsbLPM_U0);
}
switch (evtype)
{
case CY_U3P_USB_EVENT_SUSPEND:
/* Suspend the device with Wake On Bus Activity set */
glIsStreamingStarted = CyFalse;
CyU3PEventSet (&glCx3Event, CX3_USB_SUSP_EVENT_FLAG, CYU3P_EVENT_OR);
break;
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);
/* Make sure that the endpoint toggles/sequence numbers are cleared. */
glIsClearFeature = CyTrue;
#if CX3_DEBUG_ENABLED
CyU3PDebugPrint(4,"UsbCB: IF = %d, ALT = %d\r\n", interface, altSetting);
#endif
glIsStreamingStarted = CyFalse;
/* Stop the application before re-starting. */
if (glIsApplnActive)
{
CyCx3AppStop ();
}
//if ((altSetting == CX3_APP_STREAM_INTERFACE) && (interface == 1))
if ( (altSetting != 0) && (interface == 1) )
{
// /* Stop the application before re-starting. */
// if (glIsApplnActive)
// {
// CyCx3AppStop ();
// }
CyCx3AppStart ();
}
break;
/* Intentional Fall-through all cases */
case CY_U3P_USB_EVENT_SETCONF:
{
glIsStreamingStarted = CyFalse;
if(glIsApplnActive)
CyCx3AppStop ();
if(evdata!=0)
glIsConfigured = CyTrue;
break;
}
case CY_U3P_USB_EVENT_RESET:
case CY_U3P_USB_EVENT_DISCONNECT:
case CY_U3P_USB_EVENT_CONNECT:
glIsStreamingStarted = CyFalse;
// if ( evtype == CY_U3P_USB_EVENT_SETCONF )//设置配置
// glIsConfigured = CyTrue;
// else
// glIsConfigured = CyFalse;
/* Stop the video streamer application and enable LPM. */
CyU3PUsbLPMEnable ();
if (glIsApplnActive)
{
#if CX3_DEBUG_ENABLED
CyU3PDebugPrint (4, "\n\rUsbCB:Call AppStop");
#endif
CyCx3AppStop ();
}
break;
case CY_U3P_USB_EVENT_SOF_ITP://SOF事件,在3.0和2.0中125us一次,同步传输在这里提交缓冲区
break;
default:
break;
}
}