Cypress CyUsb3.sys Programmer\\'s Reference(8)

2019-04-17 14:49

36Cypress CyUsb3.sys Programmer's Reference5.15IOCTL_ADAPT_RESET_PARENT_PORT

Description

This command resets the upstream port of the device it manages. After a successful reset, the busdriver reselects the configuration and any alternative interface settings that the device had before thereset occurred. All pipe handles, configuration handles and interface handles remain valid.

A null pointer is passed as both the lpInBuffer and lpOutBuffer parameters to the DeviceIoControl( )function.

Example

DWORD dwBytes;

DeviceIoControl(hDevice, IOCTL_ADAPT_RESET_PARENT_PORT, NULL, 0, NULL, 0,

&dwBytes, NULL);

? 2012 Cypress Semiconductor

The IOCTL Interface375.16IOCTL_ADAPT_RESET_PIPE

Description

This command resets an endpoint of the device, clearing any error or stall conditions on that endpoint.Pending data transfers are not cancelled by this command.

The address of a single byte is passed as the lpInBuffer parameter to the DeviceIoControl( ) function.

A null pointer is passed as the lpOutBuffer parameter.

Example

DWORD dwBytes;

UCHAR Address = 0x82;

DeviceIoControl(hDevice, IOCTL_ADAPT_RESET_PIPE, &Address, sizeof (Address) NULL, 0,

&dwBytes, NULL);

? 2012 Cypress Semiconductor

38Cypress CyUsb3.sys Programmer's Reference5.17IOCTL_ADAPT_SELECT_INTERFACE

Description

This command sets the alternate interface setting for the primary interface of the attached device.

A pointer to a byte indicating the alternate interface setting is passed as both the lpInBuffer andlpOutBuffer parameters to the DeviceIoControl( ) function.

The length of the variable (1) is passed in the nInBufferSize and nOutBufferSize parameters.

Example

DWORD dwBytes = 0;UCHAR alt = 2;

DeviceIoControl (hDevice, IOCTL_ADAPT_SELECT_INTERFACE, &alt, sizeof (alt), &alt, sizeof (alt), &dwBytes, NULL);

? 2012 Cypress Semiconductor

The IOCTL Interface395.18IOCTL_ADAPT_SEND_EP0_CONTROL_TRANSFER

IOCTL_ADAPT_SEND_EP0_CONTROL_TRANSFERPrevious Top Next Description This command sends a control request to the default Control endpoint, endpoint zero. DeviceIoControl( ) is passed a pointer to a two-part structure as both the lpInBuffer and lpOutBufferparameters. This two-part structure contains a SINGLE_TRANSFER structure followed by a data buffer. The SINGLE_TRANSFER structure contains all the parameters for the control request. The buffer contains the transfer data. NOTE : Please note that this IOCTL return device configuration inclusive of both interface for USB3.0composite device. This is the limitation due to the USBDI bus interface. The USBDI doesn't supportUSB3.0 specific device configuration. Example union {struct {UCHAR Recipient:5;UCHAR Type:2;UCHAR Direction:1;} bmRequest; UCHAR bmReq;}; bmRequest.Recipient = 0; // DevicebmRequest.Type = 2; // VendorbmRequest.Direction = 1; // IN command (from Device to Host) int iXmitBufSize = sizeof(SINGLE_TRANSFER) + bufLen; // The size of the two-partstructureUCHAR *pXmitBuf = new UCHAR[iXmitBufSize]; // Allocate the memoryZeroMemory(pXmitBuf, iXmitBufSize); PSINGLE_TRANSFER pTransfer = (PSINGLE_TRANSFER)pXmitBuf; // The SINGLE_TRANSFER comesfirstpTransfer->SetupPacket.bmRequest = bmReq;pTransfer->SetupPacket.bRequest = ReqCode;pTransfer->SetupPacket.wValue = Value;pTransfer->SetupPacket.wIndex = Index;pTransfer->SetupPacket.wLength = bufLen;pTransfer->SetupPacket.ulTimeOut = TimeOut / 1000;pTransfer->Reserved = 0;pTransfer->ucEndpointAddress = 0x00; // Control pipepTransfer->IsoPacketLength = 0;pTransfer->BufferOffset = sizeof (SINGLE_TRANSFER);pTransfer->BufferLength = bufLen;? 2012 Cypress Semiconductor

40Cypress CyUsb3.sys Programmer's ReferenceDWORD dwReturnBytes;

DeviceIoControl (hDevice, IOCTL_ADAPT_SEND_EP0_CONTROL_TRANSFER, pXmitBuf, iXmitBufSize, pXmitBuf, iXmitBufSize, &dwReturnBytes, NULL);

// Copy data into buf

UCHAR *ptr = pXmitBuf + sizeof (SINGLE_TRANSFER);memcpy(buf, ptr, dwReturnBytes);

? 2012 Cypress Semiconductor


Cypress CyUsb3.sys Programmer\\'s Reference(8).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:客户满意度调查方案

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: