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