Cypress CyUsb3.sys Programmers Reference

更新时间:2024-04-09 17:17:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

Cypress CyUsb3.sys

Programmer's Reference

? 2012 Cypress Semiconductor

Contents3Table of Contents

Part IDriver Overview5Part IIModifying CyUSB3.INF7Part IIIMatching Devices to the Driver

13

1Windows XP................................................................................................................................... 142Windows Vista ,Win7 and Win8 Beta................................................................................................................................... 16

Part IVReinstalling the Driver19Part VThe IOCTL Interface

20

1Getting a Handle to the Driver................................................................................................................................... 212IOCTL_ADAPT_ABORT_PIPE................................................................................................................................... 233IOCTL_ADAPT_CYCLE................................................................................................................................... 24_PORT4IOCTL_ADAPT_GE................................................................................................................................... 25T_ADDRESS5IOCTL_ADAPT_GE................................................................................................................................... 26T_ALT_INTERFACE_SETTING6IOCTL_ADAPT_GE................................................................................................................................... 27T_CURRENT_FRAME7IOCTL_ADAPT_GE................................................................................................................................... 28T_DEVICE_NAME8IOCTL_ADAPT_GE................................................................................................................................... 29T_DEVICE_POWER_STATE9IOCTL_ADAPT_GE................................................................................................................................... 30T_DEVICE_SPEED10IOCTL_ADAPT_GE................................................................................................................................... 31T_DRIVER_VERSION11IOCTL_ADAPT_GE................................................................................................................................... 32T_FRIENDLY_NAME12IOCTL_ADAPT_GE................................................................................................................................... 33T_NUMBER_ENDPOINTS13IOCTL_ADAPT_GE................................................................................................................................... 34T_TRANSFER_SIZE14IOCTL_ADAPT_GE................................................................................................................................... 35T_USBDI_VERSION15IOCTL_ADAPT_RE................................................................................................................................... 36SET_PARENT_PORT16IOCTL_ADAPT_RE................................................................................................................................... 37SET_PIPE17IOCTL_ADAPT_SE................................................................................................................................... 38LECT_INTERFACE18IOCTL_ADAPT_SE................................................................................................................................... 39ND_EP0_CONTROL_TRANSFER19IOCTL_ADAPT_SE................................................................................................................................... 41ND_NON_EP0_TRANSFER20IOCTL_ADAPT_SE................................................................................................................................... 43ND_NON_EP0_DIRECT21IOCTL_ADAPT_SE................................................................................................................................... 46T_DEVICE_POWER_STATE22IOCTL_ADAPT_SE................................................................................................................................... 47T_TRANSFER_SIZE

Part VICYIOCTL.H

48

1ISO_ADV_PARAMS................................................................................................................................... 50

? 2012 Cypress Semiconductor

3

4Cypress CyUsb3.sys Programmer's Reference2SINGLE................................................................................................................................... 52_TRANSFER3SETUP_PACKE................................................................................................................................... 53T4SET_TRANSFE................................................................................................................................... 54R_SIZE_INFO

Part VIIFeatures Not Supported

Part VIIIEZ-USB.sys to CyUSB3.sys Migration Guide

Index

555659

? 2012 Cypress Semiconductor

Driver Overview51Driver Overview

The CYUSB3.SYS driver is licensed for distribution ONLY with Cypress USB products andproducts that employ Cypress USB chips. CyUSB3.sys is a kernel mode USB function driver,it is capable of communicating with any USB 2.0 andUSB3.0 compliant devices. The driver is general-purpose, understanding primitive USB commands, butnot implementing higher-level, USB device-class specific commands. For this reason, the driver is notcapable, for instance, of interfacing a USB mass storage class device to the Windows file system.Please note that this release does not include the USB3.0 bulk streaming interface. The driver would be ideal for communicating with a vendor-specific device from a custom USB applicationor to send low-level USB requests to any USB device for experimental or diagnostic applications. In order to use the driver to communicate with a device, Windows must match the device to the driver. The class library, CyAPI.lib and Cyusb.dll, provides a high-level programming interface to the driver. Thishelp file documents the low-level, more cumbersome and explicit programming interface.The driver supports following operating systems and platform.1. Windows XP 32 bit2. Windows Vista 32/64bit3. Windows 7 and 32/64 bit 4. Windows 8 Beta 32/64 bitCypress signed CyUSB3.sys driver for following Cypress VID/PID pairs.1. VID_04B4&PID_00F02. VID_04B4&PID_00F13. VID_04B4&PID_00F34. VID_04B4&PID_4720

Please note, the driver is signed for above mentioned pairs of Cypress VID/PID. If you modify CyUSB3.inf to add your own VID/PID, the driver will become unsigned. However, Windows OS will allow to installthe unsigned driver with warning messages on 32-bit and 64-bit platform. You can go for WHQL drivercertification with your own VID/PID once your product is ready.

Features

?Windows Driver Foundation (WDF) compliant ?Compatible with any USB 2.0 compliant device

?Compatible with Cypress USB 3.0 compliant device?Supports basic USB3.0 features.

?Supports Windows Plug and play and power management ?Supports USB Remote Wake-up

?Supports Control, Bulk, Interrupt and Isochronous transfers?Supports multiple USB devices connected at once

?Supports customizable driver GUID without re-building the driver

?Supports high bandwidth data transfers passing multiple packets per micro-frame

? 2012 Cypress Semiconductor

6Cypress CyUsb3.sys Programmer's Reference

? 2012 Cypress Semiconductor

Modifying CyUSB3.INF72Modifying CyUSB3.INF

The CYUSB3.INF file can be modified to accomplish several different objectives. These are: 1. Add a device's identifiers to the driver2. Replace Cypress strings that are displayed during driver installation3. Implement a custom GUID for the driver NOTE: x86 refers to the 32bit OS and amd64 refers to 64 bit OS. Add a device's identifiers to the driver The following steps describe the process of adding a device's vendor ID and product ID to the CYSUB3.INF file. 1. Locate the following sections [Device],[Device.NT],[Device.Ntx86] and [Device.Ntamd64] andremove the semicolon of each item under the each section ;%VID_XXXX&PID_XXXX.DeviceDesc%=CyUSB3, USB\\VID_XXXX&PID_XXXX 2. Change the VID_XXXX to contain the hexadecimal value of the VendorID for the device and change the PID_XXXX to contain the hexadecimal value of the ProductID for the device For example, a device with vendorID 0x04B4 and productID 0xDE01 would have a new entry in theabove listed sections like following %VID_04B4&PID_DE01.DeviceDesc%=CyUSB3, USB\\VID_04B4&PID_DE01 3. Change [String] section for Device Description according to the Vendor ID and Product ID. VID_XXXX&PID_XXXX.DeviceDesc=\ 4. Change the VID_XXXX to contain the hexadecimal value of the VendorID for the device Change the PID_XXXX to contain the hexadecimal value of the ProductID for the device For example, a device with vendorID 0x04B4 and productID 0xDE01 would have a new entry in the[Strings] section like the following VID_04B4&PID_DE01.DeviceDesc=\ Replace Cypress strings If you plan to do more than just add your device's VID/PID to the CYUSB3.INF file, it is stronglyrecommended that you create your own .INF file and a copy of CYUSB3.SYS that you have re-named.The remaining instructions assume that you have created your own .INF file to match your newly namedcopy of CYUSB3.SYS. The driver can be customized to report a company other than Cypress as its manufacturer and provider. 1. Locate the [Strings] section at the bottom of the CYUSB3.INF file.? 2012 Cypress Semiconductor

8Cypress CyUsb3.sys Programmer's Reference 2. Change the quoted CYUSB3_Provider string. 3. Change the quoted CYUSB3_DisplayName string. 4. Change the quoted CYUSB3_Company string. 5. Change the quoted CYUSB3_Description string. Implement a custom GUID Applications software usually accesses the driver using the driver's Global Unique IDentifier (GUID).Each driver in the Windows system should have a unique GUID. By employing distinct GUIDs, multipleinstances of CYUSB3.SYS from different hardware vendors can exist on a given system withoutcolliding. 1. To change the driver's GUID, 2. Use the GUIDGEN.EXE utility (distributed with Microsoft Visual Studio) to get a new GUID. 3. Locate the [Strings] section in the CyUSB3.inf file 4. Locate the line CYUSB3.GUID=\18AA60-7F6A-11d4-97DD-00010229B959}\ and replace the quoted GUID string with the new one you created. (Retain the curly braces.) Execute a script at start-upThe CYUSB3.SYS driver can be used to perform transfers to the default control endpoint (endpointaddress 0) when the device is started.

To configure the driver to perform a control transfer at startup

1. Use the CyControl.exe application to create a script file containing the control transfer commands.2. Save the script as a file named MyDevice.SPT

3. Place that script file in the same directory as the the driver's .INF file

A common use of this feature is to have the driver play a script which downloads a firmware image to theUSB device, thereby modifying its \f thisre-enumeration occurs with the same VID/PID as the original \again and again in an un-ending loop.

To avoid this endless loop scenario, the second personality should enumerate with a different VID/PIDthan the one which caused the script to play.

The .inf file can be modified to play a script when one VID/PID is enumerated and to simply load thedriver when a different VID/PID is detected.How to disable the CyScript feature To disable this feature the user needs to delete the key 'DriverEXECSCRIPT' from the registry.The following steps should be followed to delete the key.

? 2012 Cypress Semiconductor

Modifying CyUSB3.INF91. Execute the 'regedit.exe' application.2. Search for the 'DriverEXECSCRIPT'.3. Delete the key 'DriverEXECSCRIPT'.4. Close 'regedit.exe'.

The following is an excerpt from a .inf file that plays a script called MyDevice.spt when VID/PID of04B4/00F3 is enumerated. If VID/PID 0547/00F0 enumerates, the script is not played.

NOTE: For FX3 devices, the MyDevice.spt script will play only when the connected device supports FX3boot commands.Sample CYUSB3.INF file using the CyScript feature with VID-0x04B4 and PID-0x00F3 and0x00F0 ; Installation INF for the Cypress Generic USB Driver for OS unknown; Processor support for x86 based platforms.;

; (c) Copyright 2012 Cypress Semiconductor Corporation;

[Version]

Signature=\NDOWS NT$\Class=USB

ClassGUID={36FC9E60-C465-11CF-8056-444553540000}provider=%CYUSB3_ProviderêtalogFile=CYUSB3.cat

DriverVer=01/23/2012,1.0.0.01[SourceDisksNames]1=%CYUSB3_Install%,,,[SourceDisksFiles]CYUSB3.sys = 1

[DestinationDirs]CYUSB3.Files.Ext = 10,System32\\DriversMyDevice.Files.Ext = 10,System32\\MyDevice[ControlFlags]ExcludeFromSelect = *

[Manufacturer]

%CYUSB3_Provider%=Device,NT,NTx86,NTamd64

;for all platforms[Device.NT]

%VID_04B4&PID_00F3.DeviceDesc%=MyDevice, USB\\VID_04B4&PID_00F3%VID_04B4&PID_00F0.DeviceDesc%=CYUSB3, USB\\VID_04B4&PID_00F0;for x86 platforms[Device.NTx86]

%VID_04B4&PID_00F3.DeviceDesc%=MyDevice, USB\\VID_04B4&PID_00F3%VID_04B4&PID_00F0.DeviceDesc%=CYUSB3, USB\\VID_04B4&PID_00F0

? 2012 Cypress Semiconductor

10Cypress CyUsb3.sys Programmer's Reference;for x64 platforms[Device.NTamd64]

%VID_04B4&PID_00F3.DeviceDesc%=MyDevice, USB\\VID_04B4&PID_00F3%VID_04B4&PID_00F0.DeviceDesc%=CYUSB3, USB\\VID_04B4&PID_00F0[MyDevice]

CopyFiles=CYUSB3.Files.Ext,MyDevice.Files.ExtAddReg=CYUSB3.AddReg [MyDevice.HW]

AddReg=MyDevice.AddReg.Guid

[MyDevice.Services]

Addservice = CYUSB3,2,CYUSB3.AddService [MyDevice.NT]

CopyFiles=CYUSB3.Files.Ext, MyDevice.Files.ExtAddReg=CYUSB3.AddReg [MyDevice.NT.HW]

AddReg=MyDevice.AddReg.Guid

[MyDevice.NT.Services]

Addservice = CYUSB3,2,CYUSB3.AddService[MyDevice.NTx86]

CopyFiles=CYUSB3.Files.Ext, MyDevice.Files.ExtAddReg=CYUSB3.AddReg [MyDevice.NTx86.HW]

AddReg=MyDevice.AddReg.Guid

[MyDevice.NTx86.Services]

Addservice = CYUSB3,2,CYUSB3.AddService [MyDevice.NTamd64]

CopyFiles=CYUSB3.Files.Ext, MyDevice.Files.ExtAddReg=CYUSB3.AddReg [MyDevice.NTamd64.HW]

AddReg=MyDevice.AddReg.Guid

[MyDevice.NTamd64.Services]

Addservice = CYUSB3,2,CYUSB3.AddService [MyDevice.AddReg.Guid]

HKR,,DriverGUID,,%CYUSB3.GUID%HKR,,DriverEXECSCRIPT,,%MyDevice.EXECSCRIPT%[MyDevice.Files.Ext]MyDevice.spt

[CYUSB3.NT]

CopyFiles=CYUSB3.Files.ExtAddReg=CYUSB3.AddReg[CYUSB3.NT.HW]

? 2012 Cypress Semiconductor

Modifying CyUSB3.INF11AddReg=CYUSB3.AddReg.Guid

[CYUSB3.NT.Services]

Addservice = CYUSB3,2,CYUSB3.AddService

[CYUSB3.NTx86]

CopyFiles=CYUSB3.Files.ExtAddReg=CYUSB3.AddReg[CYUSB3.NTx86.HW]

AddReg=CYUSB3.AddReg.Guid

[CYUSB3.NTx86.Services]

Addservice = CYUSB3,2,CYUSB3.AddService[CYUSB3.NTamd64]

CopyFiles=CYUSB3.Files.ExtAddReg=CYUSB3.AddReg[CYUSB3.NTamd64.HW]

AddReg=CYUSB3.AddReg.Guid

[CYUSB3.NTamd64.Services]

Addservice = CYUSB3,2,CYUSB3.AddService

[CYUSB3.AddReg]

; Deprecating - do not use in new apps to identify a CYUSB3 driverHKR,,DevLoader,,*ntkern

HKR,,NTMPDriver,,CYUSB3.sys

; You may optionally include a check for DriverBase in your application to check for a CYUSB3 driverHKR,,DriverBase,,CYUSB3.sys

HKR,\arameters\aximumTransferSize\HKR,\arameters\ebugLevel\HKR,,FriendlyName,,%CYUSB3_Description%

[CYUSB3.AddService]

DisplayName = %CYUSB3_Description%ServiceType = 1 ; SERVICE_KERNEL_DRIVERStartType = 3 ; SERVICE_DEMAND_STARTErrorControl = 1 ; SERVICE_ERROR_NORMALServiceBinary = %\\System32\\Drivers\\CYUSB3.sysAddReg = CYUSB3.AddRegLoadOrderGroup = Base[CYUSB3.Files.Ext]CYUSB3.sys

[CYUSB3.AddReg.Guid]

HKR,,DriverGUID,,%CYUSB3.GUID%

;-------------- WDF Coinstaller installation[SourceDisksFiles]

WdfCoInstaller01009.dll=1 ; make sure the number matches with SourceDisksNames[DestinationDirs]

CoInstaller_CopyFiles = 11

? 2012 Cypress Semiconductor

12Cypress CyUsb3.sys Programmer's Reference[CYUSB3.NTamd64.CoInstallers]AddReg=CoInstaller_AddRegCopyFiles=CoInstaller_CopyFiles[CYUSB3.NTx86.CoInstallers]AddReg=CoInstaller_AddRegCopyFiles=CoInstaller_CopyFiles[CoInstaller_CopyFiles]WdfCoInstaller01009.dll

[CoInstaller_AddReg]

HKR,,CoInstallers32,0x00010000, \oInstaller01009.dll,WdfCoInstaller\[CYUSB3.NTamd64.Wdf]

KmdfService = CYUSB3, CYUSB3_wdfsect[CYUSB3.NTx86.Wdf]

KmdfService = CYUSB3, CYUSB3_wdfsect[CYUSB3_wdfsect]

KmdfLibraryVersion = 1.9

[Strings]

CYUSB3_Provider = \ypress\

CYUSB3_Company = \ypress Semiconductor Corporation\CYUSB3_Description = \ypress Generic USB3.0 Driver\CYUSB3_DisplayName = \ypress USB3.0 Generic\

CYUSB3_Install = \ypress CYUSB3.0 Driver Installation Disk\VID_04B4&PID_00F3.DeviceDesc=\ypress USB BootLoader\VID_04B4&PID_00F0.DeviceDesc=\ypress BULK LOOP\CYUSB3.GUID=\18AA60-7F6A-11d4-97DD-00010229B959}\CYUSB3_Unused = \MyDevice.EXECSCRIPT=\root\\system32\\MyDevice\\MyDevice.spt\

? 2012 Cypress Semiconductor

Matching Devices to the Driver133Matching Devices to the Driver

Usually matching of a USB device to the CYUSB3.SYS driver will need to be manually configured. Following are the steps user has to follow to install driver on Windows OS. Step A : Add the device's VendorID and ProductID to the CYUSB3.INF file.Step B : Force Windows to use the CYUSB3.SYS driver with the device. Though similar, these steps are slightly different for WinXP and Windows Vista and 7

? 2012 Cypress Semiconductor

14Cypress CyUsb3.sys Programmer's Reference3.1Windows XP

Usually, matching of a USB device to the CYUSB3.SYS driver will need to be manually configured.

Please follow below steps to update the INF file and driver installation on Windows XP.

Note: Please skip step B to install driver on 32-bit OS.

Step A : Please follow the below steps to add the device's VendorID and ProductID to the CYUSB3.INFfile.

1.After installation of the Cypress Suite USB installer, the driver file is located in a Driver

subdirectory of the install directory. (Default is C:\\Program Files\\Cypress\\FX3 HostSoftware\\Driver\\bin.).

2.Open the file CYUSB3.INF with a text editor (notepad.exe, for instance)

3.Locate the following sections [Device],[Device.NT],[Device.Ntx86] and [Device.Ntamd64] and

remove the semicolon of each item under the each section

;%VID_XXXX&PID_XXXX.DeviceDesc%=CyUsb3, USB\\VID_XXXX&PID_XXXX.

4.Change the VID_XXXX to contain the hexadecimal value of the VendorID for the device and change the PID_XXXX to contain the hexadecimal value of the ProductID for the device.

For example, a device with vendorID 0x04B4 and productID 0xDE01 would have a new entry inthe above listed sections like following:

%VID_04B4&PID_DE01.DeviceDesc%=CyUSB3, USB\\VID_04B4&PID_DE01

5.Change [String] section for Device Description according to the Vendor ID and Product ID. VID_XXXX&PID_XXXX.DeviceDesc=\er\

6.Change the VID_XXXX to contain the hexadecimal value of the VendorID for the device and change the PID_XXXX to contain the hexadecimal value of the ProductID for the device.

For example, a device with vendorID 0x04B4 and productID 0xDE01 would have a new entryin the [Strings] section like the following:

VID_04B4&PID_DE01.DeviceDesc=\3 Bulk loopback\

7.Save the file.

Step B : Please follow the below steps to force WindowsXP to use the cyusb3.sys driver with thedevice.

1.Connect the device to the PC

2.If Windows prompts for a driver or indicates that it needs a driver, direct the PC to use the

CYUSB3.SYS driver by steering it to the CYUSB3.INF file in the [InstallDir]\\Driver directory.

3.If Windows does not prompt for a driver, it has already matched the device to a driver itself. In

this case, you will need to see if the CYUSB3.SYS driver was selected and, if not, manuallyinstruct Windows to use that driver.

4.Right-click My Computer and select the Manage menu item.

? 2012 Cypress Semiconductor

Matching Devices to the Driver15

5.In the Computer Management window, select Device Manager

6.In the right window pane, click the + icon next to Universal Serial Bus controllers

7.Locate your device in the list and double click on it

8.Select the Driver tab in the Properties dialog that comes up

9.Click on the Driver Details button.

10.If the displayed driver file is CYUSB3.SYS, Windows has already matched the device to this

driver and you should click OK and Cancel . If not, proceed with the remaining steps.

11.Click OK

12.Click Update Driver

13.Select Install from a list or specific location (Advanced)

14.Click Next

15.Select Don't search. I will choose the driver to install.

16.Click Next

17.Click Have Disk

18.Click Browse

19.Navigate to the directory containing CYUSB3.SYS (wxp(Windows XP) and select x86(32-bit

OS) or x64(64-bit OS)) based on the platform you want to install driver on.

20.CYUSB3.INF should be automatically placed in the File name field

21.Click Open

22.Click OK

23.Click Next

24.It will popup message saying Unsigned driver, Please select 'Install driver software anyway'

and click ok.

25.Click Finish

26.Click Close

27.Don't re-boot your system if Windows suggests that you must. You may need to unplug and

re-plug your device, however.

? 2012 Cypress Semiconductor

The IOCTL Interface215.1Getting a Handle to the Driver

In order to use the IOCTL codes supported by the driver, you will need to obtain a Windows handle to thedriver.

A very simple way to accomplish this is to utilize the CyAPI class library. After creating a

CCyUSBDevice object, a handle to the driver will have been setup automatically. Closing or deleting theCCyUSBDevice object frees the handle.

Example 1:

CCyUSBDevice *USBDevice = new CCyUSBDevice();HANDLE hDevice = USBDevice->DeviceHandle();....

delete USBDevice;

The more typical (and complex) way to obtain a handle is to make a sequence of SetupDi calls, passingthe driver GUID declared in CyAPI.h. The default driver guid is defined as:

// {AE18AA60-7F6A-11d4-97DD-00010229B959}

static GUID CYUSBDRV_GUID = {0xae18aa60, 0x7f6a, 0x11d4, 0x97, 0xdd, 0x0, 0x1, 0x2,0x29, 0xb9, 0x59};

The CyAPI library uses the following code to obtain a handle, using the GUID.

Example 2:

SP_DEVINFO_DATA devInfoData;

SP_DEVICE_INTERFACE_DATA devInterfaceData;

PSP_INTERFACE_DEVICE_DETAIL_DATA functionClassDeviceData;

ULONG requiredLength = 0;

int deviceNumber = 0; // Can be other values if more than 1 device connected to driver

HDEVINFO hwDeviceInfo = SetupDiGetClassDevs ( (LPGUID) &CYUSBDRV_GUID, NULL, NULL,

DIGCF_PRESENT|DIGCF_INTERFACEDEVICE);

if (hwDeviceInfo != INVALID_HANDLE_VALUE) {

devInterfaceData.cbSize = sizeof(devInterfaceData);

if (SetupDiEnumDeviceInterfaces ( hwDeviceInfo, 0, (LPGUID) &CYUSBDRV_GUID, deviceNumber, &devInterfaceData)) {

SetupDiGetInterfaceDeviceDetail ( hwDeviceInfo, &devInterfaceData, NULL, 0,

? 2012 Cypress Semiconductor

22Cypress CyUsb3.sys Programmer's Reference &requiredLength, NULL);

ULONG predictedLength = requiredLength;

functionClassDeviceData = (PSP_INTERFACE_DEVICE_DETAIL_DATA) malloc(predictedLength);

functionClassDeviceData->cbSize = sizeof (SP_INTERFACE_DEVICE_DETAIL_DATA);

devInfoData.cbSize = sizeof(devInfoData);

if (SetupDiGetInterfaceDeviceDetail (hwDeviceInfo,

&devInterfaceData,

functionClassDeviceData, predictedLength, &requiredLength, &devInfoData)) {

hDevice = CreateFile (functionClassDeviceData->DevicePath, GENERIC_WRITE | GENERIC_READ,

FILE_SHARE_WRITE | FILE_SHARE_READ, NULL,

OPEN_EXISTING,

FILE_FLAG_OVERLAPPED, NULL);

free(functionClassDeviceData);

SetupDiDestroyDeviceInfoList(hwDeviceInfo); }

? 2012 Cypress Semiconductor

The IOCTL Interface235.2IOCTL_ADAPT_ABORT_PIPE

Description

This command is used to cancel pending IO requests on an endpoint.

A pointer to a variable containing the endpoint address is passed as the lpInBuffer parameter to theDeviceIoControl( ) function. A null pointer is passed as the lpOutBuffer parameter.

Example

DWORD dwBytes = 0;UCHAR Address = 0x82;

DeviceIoControl(hDevice, IOCTL_ADAPT_ABORT_PIPE, &Address, sizeof (UCHAR), NULL, 0,

&dwBytes, NULL);

? 2012 Cypress Semiconductor

24Cypress CyUsb3.sys Programmer's Reference5.3IOCTL_ADAPT_CYCLE_PORT

Description

This command power-cycles the USB port to which a specified device is attached., Power-cycling a portcauses the device to be surprise-removed and re-enumerated.

NULL pointers are passed to DeviceIoControl in the pInBuffer and pOutBuffer parameters.

Example

DWORD dwBytes = 0;

DeviceIoControl(hDevice, IOCTL_ADAPT_CYCLE_PORT, NULL, 0, NULL, 0,

&dwBytes, NULL);

? 2012 Cypress Semiconductor

The IOCTL Interface255.4IOCTL_ADAPT_GET_ADDRESS

Description

This command retrieves the USB address of the device from the Windows host controller driver.

A pointer to a 1-byte variable is passed as both the lpInBuffer and lpOutBuffer parameters to theDeviceIoControl( ) function.

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

Example

DWORD dwBytes = 0;UCHAR DevAddr;

DeviceIoControl(hDevice, IOCTL_ADAPT_GET_ADDRESS, &DevAddr, sizeof (UCHAR), &DevAddr, sizeof (UCHAR), &dwBytes, NULL);

? 2012 Cypress Semiconductor

26Cypress CyUsb3.sys Programmer's Reference5.5IOCTL_ADAPT_GET_ALT_INTERFACE_SETTING

Description

This command retrieves the alternate interface setting for a particular interface of the attached device.

A pointer to a byte indicating the interface number is passed as the lpInBuffer parameter to theDeviceIoControl( ) function.

A pointer to a byte into which the alternate interface setting will be reported is passed as the lpOutBufferparameter to the DeviceIoControl( ) function.

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

Example

DWORD dwBytes = 0;UCHAR intfc = 0;UCHAR alt;

DeviceIoControl(hDevice, IOCTL_ADAPT_GET_ALT_INTERFACE_SETTING, &intfc, sizeof (alt), &alt, sizeof (alt), &dwBytes, NULL);

? 2012 Cypress Semiconductor

The IOCTL Interface275.6IOCTL_ADAPT_GET_CURRENT_FRAME

Description

This command returns the current frame number from the host controller driver.

A pointer to a 4-byte variable is passed as both the lpInBuffer and lpOutBuffer parameters to theDeviceIoControl( ) function.

The size of the variable (4) is passed in the nInBufferSize and nOutBufferSize parameters.

Example

DWORD dwBytes = 0;ULONG CurrentFrame;

DeviceIoControl(hDevice, IOCTL_ADAPT_GET_CURRENT_FRAME,

DeviceIoControl(hDevice, IOCTL_ADAPT_GET_CURRENT_FRAME, &CurrentFrame, sizeof (ULONG), &CurrentFrame, sizeof (ULONG), &dwBytes, NULL);

? 2012 Cypress Semiconductor

28Cypress CyUsb3.sys Programmer's Reference5.7IOCTL_ADAPT_GET_DEVICE_NAME

Description

This command retrieves the Product string descriptor value for the attached device.

A pointer to a character buffer is passed as both the lpInBuffer and lpOutBuffer parameters to theDeviceIoControl( ) function.

The length of the buffer is passed in the nInBufferSize and nOutBufferSize parameters.

Example

DWORD dwBytes = 0;ULONG len = 256;

UCHAR *buf = new UCHAR[len];

DeviceIoControl(hDevice, IOCTL_ADAPT_GET_DEVICE_NAME, buf, len, buf, len,

&dwBytes, NULL);

delete[] buf;

? 2012 Cypress Semiconductor

The IOCTL Interface295.8IOCTL_ADAPT_GET_DEVICE_POWER_STATE

Description

This IOCTL is no longer supported. It is available to keep backward compatibility with older interfacelibrary and application.

Microsoft WDF driver framework manages device power state internally.

? 2012 Cypress Semiconductor

30Cypress CyUsb3.sys Programmer's Reference5.9IOCTL_ADAPT_GET_DEVICE_SPEED

Description

This command attempts to report the current operating speed of the USB device. It uses the

IsDeviceHighSpeed routine, but this routine is only supported in Version 1 of the USBD interface.Windows 2K SP4, Windows XP and later all support Version 1 of the USBD interface. If the

IsDeviceHighSpeed routine is not available, DEVICE_SPEED_UNKNOWN is returned. The possiblereturn value of this IOCTL is defined in the cyioctl.h header file.

A pointer to a 4-byte variable is passed as both the lpInBuffer and lpOutBuffer parameters to theDeviceIoControl( ) function.

The size of the variable (4) is passed in the nInBufferSize and nOutBufferSize parameters.

Defines (cyioctl.h)

#define DEVICE_SPEED_UNKNOWN 0x00000000#define DEVICE_SPEED_LOW_FULL 0x00000001#define DEVICE_SPEED_HIGH 0x00000002

#define DEVICE_SPEED_SUPER 0x00000004

Example

DWORD dwBytes = 0;ULONG DevSpeed;

DeviceIoControl(hDevice, IOCTL_ADAPT_GET_DEVICE_SPEED, &DevSpeed, sizeof (ULONG), &DevSpeed, sizeof (ULONG), &dwBytes, NULL);

? 2012 Cypress Semiconductor

The IOCTL Interface315.10IOCTL_ADAPT_GET_DRIVER_VERSION

Description

This command retrieves the version of the driver.

A pointer to a 4-byte variable is passed as both the lpInBuffer and lpOutBuffer parameters to theDeviceIoControl( ) function.

The size of the variable (4) is passed in the nInBufferSize and nOutBufferSize parameters.

Example

DWORD dwBytes = 0;ULONG ver;

DeviceIoControl(hDevice, IOCTL_ADAPT_GET_DRIVER_VERSION, &ver, sizeof (ver), &ver, sizeof (ver), &dwBytes, NULL);

? 2012 Cypress Semiconductor

32Cypress CyUsb3.sys Programmer's Reference5.11IOCTL_ADAPT_GET_FRIENDLY_NAME

Description

This command retrieves the string associated with the device in the [Strings] section of the CyUSB3.inffile.

A pointer to an array of unsigned characters is passed as both the lpInBuffer and lpOutBuffer parametersto the DeviceIoControl( ) function.

The size of the array is passed in the nInBufferSize and nOutBufferSize parameters.

Example

DWORD dwBytes = 0;

PUCHAR FriendlyName = new UCHAR[256];

DeviceIoControl(hDevice, IOCTL_ADAPT_GET_FRIENDLY_NAME, FriendlyName, 256, FriendlyName, 256, &dwBytes, NULL);

delete[] FriendlyName;

? 2012 Cypress Semiconductor

The IOCTL Interface335.12IOCTL_ADAPT_GET_NUMBER_ENDPOINTS

Description

This command retrieves the number of endpoints enumerated by the current interface / alternateinterface setting.

A null pointer is passed as the lpInBuffer parameter to the DeviceIoControl( ) function. Zero is passed asthe nInBufferSize parameter.

The address of an unsigned character is passed as the lpOutBuffer parameter to the DeviceIoControl( )function. The size of the variable (1) is passed in the nOutBufferSize parameter.

Example

DWORD dwBytes = 0;UCHAR endPts;

DeviceIoControl(hDevice, IOCTL_ADAPT_GET_NUMBER_ENDPOINTS, NULL, 0,

&endPts, sizeof (endPts), &dwBytes, NULL);

? 2012 Cypress Semiconductor

34Cypress CyUsb3.sys Programmer's Reference5.13IOCTL_ADAPT_GET_TRANSFER_SIZE

Description This IOCTL is no longer supported. It is available to keep backward compatibility with older interfacelibrary and application. For more information on USB transfer size please refer link from Microsoft : http://msdn.microsoft.com/en-us/library/ff538112.aspxFollowing are the maximum transfer size limits set into the CyUSB3.sys driver for various transfers.1. Bulk and Interrupt Transfer 4MBytes2. Full Speed Isochronous Transfer 256 Frames3. High Speed and Super Speed Isochronous Transfer 1024 Frames? 2012 Cypress Semiconductor

The IOCTL Interface355.14IOCTL_ADAPT_GET_USBDI_VERSION

Description

This command retrieves the version of the USB Host Controller Driver in BCD format.

A pointer to a 4-byte variable is passed as both the lpInBuffer and lpOutBuffer parameters to theDeviceIoControl( ) function.

The size of the variable (4) is passed in the nInBufferSize and nOutBufferSize parameters.

Example

DWORD dwBytes = 0;ULONG ver;

DeviceIoControl(hDevice, IOCTL_ADAPT_GET_USBDI_VERSION, &ver, sizeof (ver), &ver, sizeof (ver), &dwBytes, NULL);

? 2012 Cypress Semiconductor

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

The IOCTL Interface415.19IOCTL_ADAPT_SEND_NON_EP0_TRANSFER

Description

This IOCTL command is used to request Bulk, Interrupt or Isochronous data transfers acrosscorresponding USB device endpoints.

Regardless of whether the endpoint is an IN or an OUT endpoint, a pointer to a single data structure ispassed to DeviceIoControl( ) as both the lpInBuffer and lpOutBuffer parameters. The driver expects thatthe pointer references a SINGLE_TRANSFER structure, followed by a data buffer. In the case of OUTendpoints, the buffer is expected to contain the data bytes to be transmitted. In the case of an INendpoint, the buffer is expected to be the writeable memory for received data bytes.

Special ISOC Constraints

The endpoint maximum transfer size and buffer length parameter must both be a multiple of theendpoint's MaxPacketSize.

For ISOC transfers on a device operating at High speed or Super Speed, the following constraints applyto this command:

1) The buffer length parameter (bufLen in the below examples) must also be a multiple of the endpoint'sMaxPacketSize * 8. Please also note that last packet is allow to send with partial size(less than Maxpacket) for both super and high speed Isochronous transfer.

2) For Super speed Isochronous endpoint only , if device define the MaxBurst in the super speedendpoint companion descriptor then Maxburst should be used to calculate the packet size=

(MaxpacketSize * (MaxBurst+1). This packet length data will be sent over one micro frame interval.Example

PUCHAR CCyBulkEndPoint::BeginDataXfer(PCHAR buf, LONG bufLen, OVERLAPPED *ov) {

if (hDevice == INVALID_HANDLE_VALUE) return NULL;

int iXmitBufSize = sizeof (SINGLE_TRANSFER) + bufLen; PUCHAR pXmitBuf = new UCHAR[iXmitBufSize]; ZeroMemory(pXmitBuf, iXmitBufSize);

PSINGLE_TRANSFER pTransfer = (PSINGLE_TRANSFER)pXmitBuf; pTransfer->Reserved = 0;

pTransfer->ucEndpointAddress = Address; pTransfer->IsoPacketLength = 0;

pTransfer->BufferOffset = sizeof (SINGLE_TRANSFER); pTransfer->BufferLength = bufLen; // Copy buf into pXmitBuf

UCHAR *ptr = (PUCHAR) pTransfer + pTransfer->BufferOffset; memcpy(ptr, buf, bufLen);DWORD dwReturnBytes;

DeviceIoControl(hDevice, IOCTL_ADAPT_SEND_NON_EP0_TRANSFER, pXmitBuf, iXmitBufSize, pXmitBuf, iXmitBufSize, &dwReturnBytes, ov);return pXmitBuf;

? 2012 Cypress Semiconductor

42Cypress CyUsb3.sys Programmer's Reference}

? 2012 Cypress Semiconductor

The IOCTL Interface435.20IOCTL_ADAPT_SEND_NON_EP0_DIRECT

Description

This IOCTL is used to request Bulk, Interrupt or Isochronous data transfers across corresponding USBdevice endpoints.

The DeviceIoControl call requires two buffer parameters. For this command, the first buffer must containa properly initialized SINGLE_TRANSFER structure.

The SINGLE_TRANSFER fields of BufferOffset and BufferLength should be set to 0 for this command.

The second buffer is for the actual transfer data. For an OUT endpoint, this will contain the data headedto the USB device. For an IN endpoint, this buffer will hold the data that is received from the device.

Special ISOC Constraints

The endpoint maximum transfer size and buffer length parameter must both be a multiple of theendpoint's MaxPacketSize.

For ISOC transfers on a device operating at High speed or Super Speed, the following constraints applyto this command:

1) The buffer length parameter (bufLen in the below examples) must also be a multiple of the endpoint'sMaxPacketSize * 8. Please also note that last packet is allow to send with partial size(less than Maxpacket) for both super and high speed Isochronous transfer.

2) For Super speed Isochronous endpoint only , if device define the MaxBurst in the super speedendpoint companion descriptor then Maxburst should be used to calculate the packet size=

(MaxpacketSize * (MaxBurst+1)). This packet length data will be sent over one micro frame interval.

The SINGLE_TRANSFER structure must be followed by additional space sufficient to hold thePACKET_INFO structures for the transfer (see examples #2 and #3, below).

Example #1 (Bulk and Interrupt endpoints)

PUCHAR CCyUSBEndPoint::BeginDirectXfer(PUCHAR buf, LONG bufLen, OVERLAPPED *ov) {

if ( hDevice == INVALID_HANDLE_VALUE ) return NULL; int iXmitBufSize = sizeof (SINGLE_TRANSFER); PUCHAR pXmitBuf = new UCHAR[iXmitBufSize]; ZeroMemory (pXmitBuf, iXmitBufSize);

PSINGLE_TRANSFER pTransfer = (PSINGLE_TRANSFER) pXmitBuf; pTransfer->ucEndpointAddress = Address; pTransfer->IsoPacketLength = 0; pTransfer->BufferOffset = 0; pTransfer->BufferLength = 0; DWORD dwReturnBytes;

DeviceIoControl (hDevice,

? 2012 Cypress Semiconductor

44Cypress CyUsb3.sys Programmer's Reference IOCTL_ADAPT_SEND_NON_EP0_DIRECT, pXmitBuf, iXmitBufSize, buf, bufLen,

&dwReturnBytes, ov);

// Note that this method leaves pXmitBuf allocated. It will get deleted in// FinishDataXfer.

LastError = GetLastError();return pXmitBuf;}

Example #2 (ISOC endpoints)

PUCHAR CCyIsocEndPoint::BeginDirectXfer(PUCHAR buf, LONG bufLen, OVERLAPPED *ov) {

if ( hDevice == INVALID_HANDLE_VALUE ) return NULL;

int pkts = bufLen / MaxPktSize; // Number of packets implied by bufLen & pktSize if (bufLen % MaxPktSize) pkts++; if (pkts == 0) return NULL;

int iXmitBufSize = sizeof (SINGLE_TRANSFER) + (pkts * sizeof(ISO_PACKET_INFO)); UCHAR *pXmitBuf = new UCHAR[iXmitBufSize]; ZeroMemory (pXmitBuf, iXmitBufSize);

PSINGLE_TRANSFER pTransfer = (PSINGLE_TRANSFER) pXmitBuf; pTransfer->ucEndpointAddress = Address;

pTransfer->IsoPacketOffset = sizeof (SINGLE_TRANSFER);

pTransfer->IsoPacketLength = pkts * sizeof(ISO_PACKET_INFO); pTransfer->BufferOffset = 0; pTransfer->BufferLength = 0;DWORD dwReturnBytes = 0; DeviceIoControl (hDevice,

IOCTL_ADAPT_SEND_NON_EP0_DIRECT, pXmitBuf, iXmitBufSize, buf, bufLen,

&dwReturnBytes, ov);

// Note that this method leaves pXmitBuf allocated. It will get deleted in // FinishDataXfer.

LastError = GetLastError(); return pXmitBuf; }

Example #3 (ISOC endpoints)

PUCHAR CCyIsocEndPoint::BeginDirectXfer(PUCHAR buf, LONG bufLen, OVERLAPPED *ov) {

if ( hDevice == INVALID_HANDLE_VALUE ) return NULL;

int pkts = bufLen / MaxPktSize; // Number of packets implied by bufLen & pktSize if (bufLen % MaxPktSize) pkts++; if (pkts == 0) return NULL;

int iXmitBufSize = sizeof (SINGLE_TRANSFER) + (pkts * sizeof(ISO_PACKET_INFO)); UCHAR *pXmitBuf = new UCHAR[iXmitBufSize]; ZeroMemory (pXmitBuf, iXmitBufSize);

PSINGLE_TRANSFER pTransfer = (PSINGLE_TRANSFER) pXmitBuf; pTransfer->ucEndpointAddress = Address;

pTransfer->IsoPacketOffset = sizeof (SINGLE_TRANSFER);

pTransfer->IsoPacketLength = pkts * sizeof(ISO_PACKET_INFO);

? 2012 Cypress Semiconductor

The IOCTL Interface45pTransfer->IsoParams.isoId = USB_ISO_ID;

pTransfer->IsoParams.isoCmd = USB_ISO_CMD_ASAP;pTransfer->IsoParams.ulParam1 = 0;DWORD dwReturnBytes = 0; DeviceIoControl (hDevice,

IOCTL_ADAPT_SEND_NON_EP0_DIRECT, pXmitBuf, iXmitBufSize, buf, bufLen,

&dwReturnBytes, ov);

// Note that this method leaves pXmitBuf allocated. It will get deleted in // FinishDataXfer.

LastError = GetLastError();return pXmitBuf; }

? 2012 Cypress Semiconductor

46Cypress CyUsb3.sys Programmer's Reference5.21IOCTL_ADAPT_SET_DEVICE_POWER_STATE

Description

This IOCTL is no longer supported. It is available to keep backward compatibility with older interfacelibrary and application.

Microsoft WDF driver framework manage device power state internally.

? 2012 Cypress Semiconductor

The IOCTL Interface475.22IOCTL_ADAPT_SET_TRANSFER_SIZE

Description This IOCTL is no longer supported. It is available to keep backward compatibility with older interfacelibrary and application. For more information on USB transfer size please refer link from Microsoft : http://msdn.microsoft.com/en-us/library/ff538112.aspxFollowing is the maximum transfer size limit set into the CyUSB3.sys driver for various transfers.1. Bulk and Interrupt Transfer 4MBytes2. Full Speed Isochronous Transfer 256 Frames3. High Speed and Super Speed Isochronous Transfer 1024 Frames? 2012 Cypress Semiconductor

48Cypress CyUsb3.sys Programmer's Reference6CYIOCTL.H

Headercyioctl.h Description A pointer to a SINGLE_TRANSFER structure is passed to the driver for the IOCTL_ADAPT_SEND_NON_EP0_TRANSFER andIOCTL_ADAPT_SEND_EP0_CONTROL_TRANSFER commands. The structure is defined as:typedef struct _SINGLE_TRANSFER {union { SETUP_PACKET SetupPacket; ISO_ADV_PARAMS IsoParams; };UCHAR Reserved; UCHAR ucEndpointAddress; ULONG NtStatus; ULONG UsbdStatus; ULONG IsoPacketOffset; ULONG IsoPacketLength; ULONG BufferOffset; ULONG BufferLength; } SINGLE_TRANSFER, *PSINGLE_TRANSFER; Members SetupPacket Contains required parameters for Control Endpoint transfers, IsoParams

Contains optional parameters for Isochronous Endpoint transfers.

reserved

Reserved. Should be set to 0.

ucEndpointAddress

Specified the address of the device endpoint in which the transfer will occur.

NtStatus

NTSTATUS values that are returned by the driver.

UsbdStatus

USB_STATUS_XXX codes returned from the host controller driver.

IsoPacketOffset

Specifies the byte offset from the beginning of the structure to an IsoPacket list.

IsoPacketLength

The length, in bytes, of the IsoPacket list specified at offset IsoPacketOffset.

BufferOffset

Specifies the byte offset from the beginning of the structure to a transfer buffer.

BufferLength

The length, in bytes, of the transfer buffer at offset BufferOffset.

? 2012 Cypress Semiconductor

CYIOCTL.H49

? 2012 Cypress Semiconductor

50Cypress CyUsb3.sys Programmer's Reference6.1ISO_ADV_PARAMS

Headercyioctl.h Description ISO_ADV_PARAMS is part of the a SINGLE_TRANSFER structure. It contains advanced parameters forIsochronous endpoint transfers when sending the IOCTL_ADAPT_SEND_NON_EP0_TRANSFER andIOCTL_ADAPT_SEND_NON_EP0_DIRECT commands. The structure is defined as:typedef struct _ISO_ADV_PARAMS{USHORT isoId;USHORT isoCmd;ULONG ulParam1;ULONG ulParam2; } ISO_ADV_PARAMS, *PISO_ADV_PARAMS; Defines #define USB_ISO_ID 0x4945#define USB_ISO_CMD_ASAP 0x8000#define USB_ISO_CMD_CURRENT_FRAME 0x8001#define USB_ISO_CMD_SET_FRAME 0x8002

Members isoId

ISO_ADV_PARAMS structure identifier must be set to USB_ISO_ID.

isoCmd

Specifies one of the following types of Isoch transfers:

USB_ISO_CMD_ASAP

If no transfers have been submitted to the pipe since the pipe was opened or last reset, thetransfer to begin on the next frame. Otherwise, the transfer will begin on the first frame followingall currently queued requests for the pipe.

USB_ISO_CMD_CURRENT_FRAME

Causes the transfer to begin on the current frame number obtained from the host controllerdriver, plus an optional offset specified in the ulParam1 field.

USB_ISO_CMD_SET_FRAME

Causes the transfer to begin on the frame number specified in the ulParam1 field.

ulParam1

If isoCMD is set to USB_ISO_CMD_ASAP, when the request is returned by the driver this fieldwill contain the frame number that the transfer began on.

If isoCMD is set to USB_ISO_CMD_CURRENT_FRAME, this field contains the offset from the

? 2012 Cypress Semiconductor

本文来源:https://www.bwwdw.com/article/f06r.html

Top