All rights reserved. No parts of this work may be reproduced in any form or by any means - graphic, electronic, or
mechanical, including photocopying, recording, taping, or information storage and retrieval systems - without the
written permission of the publisher.
Products that are referred to in this document may be either trademarks and/or registered trademarks of the
respective owners. The publisher and the author make no claim to these trademarks.
While every precaution has been taken in the preparation of this document, the publisher and the author assume no
responsibility for errors or omissions, or for damages resulting from the use of information contained in this document
or from the use of programs and source code that may accompany it. In no event shall the publisher and the author be
liable for any loss of profit or any other commercial damage caused or alleged to have been caused directly or
indirectly by this document.
Cypress CyUsb.sys Programmer's Reference
© 2003 Cypress Semiconductor
Table of Contents
Part I Driver Overview
3
Part II Modifying CyUSB.INF
3
Part III Matching Devices to the Driver
7
................................................................................................................................... 71 Windows 2000
................................................................................................................................... 92 Windows XP
Part IV
The IOCTL Interface
12
................................................................................................................................... 131 Getting a Handle to the Driver
................................................................................................................................... 142 IOCTL_ADAPT_ABORT_PIPE
................................................................................................................................... 153 IOCTL_ADAPT_CYCLE_PORT
................................................................................................................................... 154 IOCTL_ADAPT_GET_ADDRESS
................................................................................................................................... 155 IOCTL_ADAPT_GET_ALT_INTERFACE_SETTING
................................................................................................................................... 166 IOCTL_ADAPT_GET_CURRENT_FRAME
................................................................................................................................... 167 IOCTL_ADAPT_GET_DEVICE_NAME
................................................................................................................................... 178 IOCTL_ADAPT_GET_DEVICE_POWER_STATE
................................................................................................................................... 179 IOCTL_ADAPT_GET_DEVICE_SPEED
................................................................................................................................... 1810 IOCTL_ADAPT_GET_DRIVER_VERSION
................................................................................................................................... 1811 IOCTL_ADAPT_GET_FRIENDLY_NAME
................................................................................................................................... 1912 IOCTL_ADAPT_GET_NUMBER_ENDPOINTS
................................................................................................................................... 1913 IOCTL_ADAPT_GET_TRANSFER_SIZE
................................................................................................................................... 1914 IOCTL_ADAPT_GET_USBDI_VERSION
................................................................................................................................... 2015 IOCTL_ADAPT_RESET_PARENT_PORT
................................................................................................................................... 2016 IOCTL_ADAPT_RESET_PIPE
................................................................................................................................... 2117 IOCTL_ADAPT_SELECT_INTERFACE
................................................................................................................................... 2118 IOCTL_ADAPT_SEND_EP0_CONTROL_TRANSFER
................................................................................................................................... 2219 IOCTL_ADAPT_SEND_NON_EP0_TRANSFER
................................................................................................................................... 2320 IOCTL_ADAPT_SEND_NON_EP0_DIRECT
................................................................................................................................... 2521 IOCTL_ADAPT_SET_DEVICE_POWER_STATE
................................................................................................................................... 2622 IOCTL_ADAPT_SET_TRANSFER_SIZE
Part V CYIOCTL.H
27
................................................................................................................................... 281 ISO_ADV_PARAMS
................................................................................................................................... 292 SINGLE_TRANSFER
................................................................................................................................... 303 SETUP_PACKET
Cypress CyUsb.sys Programmer's ReferenceI
© 2003 Cypress Semiconductor
................................................................................................................................... 314 SET_TRANSFER_SIZE_INFO
IIContents
II
© 2003 Cypress Semiconductor
Cypress CyUsb.sys Programmer's Reference3
© 2003 Cypress Semiconductor
1 Driver Overview
The CYUSB.SYS driver is licensed for distribution ONLY with Cypress USB products and
products that employ Cypress USB chips.
CYUSB.SYS is a USB device driver for Windows 2000 and Windows XP that is capable of
communicating with any USB 2.0 compliant device. The driver is general-purpose, understanding
primitive USB commands, but not implementing higher-level, USB device-class specific commands.
For this reason, the driver is not capable, for instance, of interfacing a USB mass storage class device
to the Windows file system.
However, the driver would be ideal for communicating with a vendor-specific device from a custom
USB application. Or, it might be used 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, provides a high-level programming interface to the driver. This help file
documents the low-level, more cumbersome and explicit, programming interface.
Features
·
Windows Driver Model (WDM) compliant
·
WHQL Certified (not signed)
·
Compatible with any USB 2.0 compliant device
·
Supports Windows PnP and Power Management level S4
·
Supports USB Remote Wake-up
·
Supports Control, Bulk, Interrupt and Isochronous endpoints
·
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 uframe
·
Supports automatic
play-back of control transfer scripts
at device startup
2 Modifying CyUSB.INF
The CYUSB.INF file can be modified to accomplish several different objectives. These are:
1.
Add a device's identifiers to the driver
2.
Replace Cypress strings
that are displayed during driver installation
3.
Implement a custom GUID for the driver
4.
Execute a saved script
of commands at driver load time
Add a device's identifiers to the driver
To make the driver match to a specific device, the device's vendor ID and product ID need to be added
to the .inf file.
Locate the
[Cypress]
section and duplicate the line
;%VID_VVVV&PID_PPPP.DeviceDesc%=CyUSB, USB\VID_VVVV&PID_PPPP
Remove the semicolon from the duplicate line
Modifying CyUSB.INF 4
© 2003 Cypress Semiconductor
Change the
VVVV
to contain the hexadecimal value of the
VendorID
for the device
Change the
PPPP
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
[Cypress] section like the
following
%VID_04B4&PID_DE01.DeviceDesc%=CyUSB, USB\VID_04B4&PID_DE01
Now, move to the bottom of the CYUSB.INF file and locate the [Strings] section and duplicate the
line.
;VID_VVVV&PID_PPPP.DeviceDesc="My Device Description"
Remove the semicolon from the duplicate line
Change the
VVVV
to contain the hexadecimal value of the
VendorID
for the device
Change the
PPPP
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="Cypress OTG DE1 DevBoard"
Replace Cypress strings
If you plan to do more than just add your device's VID/PID to the CYUSB.INF file, it is strongly
recommended that you create your own .INF file and a copy of CYUSB.SYS that you have re-named.
The remaining instructions assume that you have created your own .INF file to match your newly
named copy of CYUSB.SYS.
The driver can be customized to report a company other than Cypress as its manufacturer and
provider.
Locate the
[Strings]
section at the bottom of the CYUSB.INF file.
Change the quoted
PROVIDER
string.
Change the quoted
MFGNAME
string.
Change the quoted
CyUSB.SvcDesc
string.
There is also an identifier named Cypress that is used in the file. This can be modified if you want
no mention of Cypress in the .inf file.
Locate the
[Manufacturer]
section near the top of the file.
Change the symbolic name,
Cypress
, in the line
%MFGNAME%=
Cypress
Change the section name,
[Cypress]
in the next line to match the
symbolic name
used in the
%MFGNAME%=
assignment.
评论0