Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
usb100.h
00001 /* 00002 * usb100.h 00003 * 00004 * USB 1.0 support 00005 * 00006 * This file is part of the w32api package. 00007 * 00008 * Contributors: 00009 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net> 00010 * 00011 * THIS SOFTWARE IS NOT COPYRIGHTED 00012 * 00013 * This source code is offered for use in the public domain. You may 00014 * use, modify or distribute it freely. 00015 * 00016 * This code is distributed in the hope that it will be useful but 00017 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 00018 * DISCLAIMED. This includes but is not limited to warranties of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00020 * 00021 */ 00022 00023 #ifndef __USB100_H 00024 #define __USB100_H 00025 00026 #if __GNUC__ >=3 00027 #pragma GCC system_header 00028 #endif 00029 00030 #ifdef __cplusplus 00031 extern "C" { 00032 #endif 00033 00034 #include "ntddk.h" 00035 00036 #define MAXIMUM_USB_STRING_LENGTH 255 00037 00038 #define USB_DEVICE_CLASS_RESERVED 0x00 00039 #define USB_DEVICE_CLASS_AUDIO 0x01 00040 #define USB_DEVICE_CLASS_COMMUNICATIONS 0x02 00041 #define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03 00042 #define USB_DEVICE_CLASS_MONITOR 0x04 00043 #define USB_DEVICE_CLASS_PHYSICAL_INTERFACE 0x05 00044 #define USB_DEVICE_CLASS_POWER 0x06 00045 #define USB_DEVICE_CLASS_PRINTER 0x07 00046 #define USB_DEVICE_CLASS_STORAGE 0x08 00047 #define USB_DEVICE_CLASS_HUB 0x09 00048 #define USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xFF 00049 00050 #define USB_RESERVED_DESCRIPTOR_TYPE 0x06 00051 #define USB_CONFIG_POWER_DESCRIPTOR_TYPE 0x07 00052 #define USB_INTERFACE_POWER_DESCRIPTOR_TYPE 0x08 00053 00054 #define USB_REQUEST_GET_STATUS 0x00 00055 #define USB_REQUEST_CLEAR_FEATURE 0x01 00056 #define USB_REQUEST_SET_FEATURE 0x03 00057 #define USB_REQUEST_SET_ADDRESS 0x05 00058 #define USB_REQUEST_GET_DESCRIPTOR 0x06 00059 #define USB_REQUEST_SET_DESCRIPTOR 0x07 00060 #define USB_REQUEST_GET_CONFIGURATION 0x08 00061 #define USB_REQUEST_SET_CONFIGURATION 0x09 00062 #define USB_REQUEST_GET_INTERFACE 0x0A 00063 #define USB_REQUEST_SET_INTERFACE 0x0B 00064 #define USB_REQUEST_SYNC_FRAME 0x0C 00065 00066 #define USB_GETSTATUS_SELF_POWERED 0x01 00067 #define USB_GETSTATUS_REMOTE_WAKEUP_ENABLED 0x02 00068 00069 #define BMREQUEST_HOST_TO_DEVICE 0 00070 #define BMREQUEST_DEVICE_TO_HOST 1 00071 00072 #define BMREQUEST_STANDARD 0 00073 #define BMREQUEST_CLASS 1 00074 #define BMREQUEST_VENDOR 2 00075 00076 #define BMREQUEST_TO_DEVICE 0 00077 #define BMREQUEST_TO_INTERFACE 1 00078 #define BMREQUEST_TO_ENDPOINT 2 00079 #define BMREQUEST_TO_OTHER 3 00080 00081 /* USB_COMMON_DESCRIPTOR.bDescriptorType constants */ 00082 #define USB_DEVICE_DESCRIPTOR_TYPE 0x01 00083 #define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02 00084 #define USB_STRING_DESCRIPTOR_TYPE 0x03 00085 #define USB_INTERFACE_DESCRIPTOR_TYPE 0x04 00086 #define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05 00087 00088 typedef struct _USB_COMMON_DESCRIPTOR { 00089 UCHAR bLength; 00090 UCHAR bDescriptorType; 00091 } USB_COMMON_DESCRIPTOR, *PUSB_COMMON_DESCRIPTOR; 00092 00093 #define USB_DESCRIPTOR_MAKE_TYPE_AND_INDEX(d, i) ((USHORT)((USHORT)d << 8 | i)) 00094 00095 /* USB_CONFIGURATION_DESCRIPTOR.bmAttributes constants */ 00096 #define USB_CONFIG_POWERED_MASK 0xc0 00097 #define USB_CONFIG_BUS_POWERED 0x80 00098 #define USB_CONFIG_SELF_POWERED 0x40 00099 #define USB_CONFIG_REMOTE_WAKEUP 0x20 00100 00101 #include <pshpack1.h> 00102 typedef struct _USB_CONFIGURATION_DESCRIPTOR { 00103 UCHAR bLength; 00104 UCHAR bDescriptorType; 00105 USHORT wTotalLength; 00106 UCHAR bNumInterfaces; 00107 UCHAR bConfigurationValue; 00108 UCHAR iConfiguration; 00109 UCHAR bmAttributes; 00110 UCHAR MaxPower; 00111 } USB_CONFIGURATION_DESCRIPTOR, *PUSB_CONFIGURATION_DESCRIPTOR; 00112 #include <poppack.h> 00113 00114 typedef struct _USB_DEVICE_DESCRIPTOR { 00115 UCHAR bLength; 00116 UCHAR bDescriptorType; 00117 USHORT bcdUSB; 00118 UCHAR bDeviceClass; 00119 UCHAR bDeviceSubClass; 00120 UCHAR bDeviceProtocol; 00121 UCHAR bMaxPacketSize0; 00122 USHORT idVendor; 00123 USHORT idProduct; 00124 USHORT bcdDevice; 00125 UCHAR iManufacturer; 00126 UCHAR iProduct; 00127 UCHAR iSerialNumber; 00128 UCHAR bNumConfigurations; 00129 } USB_DEVICE_DESCRIPTOR, *PUSB_DEVICE_DESCRIPTOR; 00130 00131 #define USB_ENDPOINT_DIRECTION_MASK 0x80 00132 00133 #define USB_ENDPOINT_DIRECTION_OUT(x) (!((x) & USB_ENDPOINT_DIRECTION_MASK)) 00134 #define USB_ENDPOINT_DIRECTION_IN(x) ((x) & USB_ENDPOINT_DIRECTION_MASK) 00135 00136 /* USB_ENDPOINT_DESCRIPTOR.bmAttributes constants */ 00137 #define USB_ENDPOINT_TYPE_MASK 0x03 00138 #define USB_ENDPOINT_TYPE_CONTROL 0x00 00139 #define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01 00140 #define USB_ENDPOINT_TYPE_BULK 0x02 00141 #define USB_ENDPOINT_TYPE_INTERRUPT 0x03 00142 00143 #include <pshpack1.h> 00144 typedef struct _USB_ENDPOINT_DESCRIPTOR { 00145 UCHAR bLength; 00146 UCHAR bDescriptorType; 00147 UCHAR bEndpointAddress; 00148 UCHAR bmAttributes; 00149 USHORT wMaxPacketSize; 00150 UCHAR bInterval; 00151 } USB_ENDPOINT_DESCRIPTOR, *PUSB_ENDPOINT_DESCRIPTOR; 00152 #include <poppack.h> 00153 00154 #define USB_FEATURE_ENDPOINT_STALL 0x0000 00155 #define USB_FEATURE_REMOTE_WAKEUP 0x0001 00156 00157 typedef struct _USB_INTERFACE_DESCRIPTOR { 00158 UCHAR bLength; 00159 UCHAR bDescriptorType; 00160 UCHAR bInterfaceNumber; 00161 UCHAR bAlternateSetting; 00162 UCHAR bNumEndpoints; 00163 UCHAR bInterfaceClass; 00164 UCHAR bInterfaceSubClass; 00165 UCHAR bInterfaceProtocol; 00166 UCHAR iInterface; 00167 } USB_INTERFACE_DESCRIPTOR, *PUSB_INTERFACE_DESCRIPTOR; 00168 00169 typedef struct _USB_STRING_DESCRIPTOR { 00170 UCHAR bLength; 00171 UCHAR bDescriptorType; 00172 WCHAR bString[1]; 00173 } USB_STRING_DESCRIPTOR, *PUSB_STRING_DESCRIPTOR; 00174 00175 #include <pshpack1.h> 00176 typedef struct _USB_HUB_DESCRIPTOR { 00177 UCHAR bDescriptorLength; 00178 UCHAR bDescriptorType; 00179 UCHAR bNumberOfPorts; 00180 USHORT wHubCharacteristics; 00181 UCHAR bPowerOnToPowerGood; 00182 UCHAR bHubControlCurrent; 00183 UCHAR bRemoveAndPowerMask[64]; 00184 } USB_HUB_DESCRIPTOR, *PUSB_HUB_DESCRIPTOR; 00185 #include <poppack.h> 00186 00187 #define USB_SUPPORT_D0_COMMAND 0x01 00188 #define USB_SUPPORT_D1_COMMAND 0x02 00189 #define USB_SUPPORT_D2_COMMAND 0x04 00190 #define USB_SUPPORT_D3_COMMAND 0x08 00191 00192 #define USB_SUPPORT_D1_WAKEUP 0x10 00193 #define USB_SUPPORT_D2_WAKEUP 0x20 00194 00195 typedef struct _USB_CONFIGURATION_POWER_DESCRIPTOR { 00196 UCHAR bLength; 00197 UCHAR bDescriptorType; 00198 UCHAR SelfPowerConsumedD0[3]; 00199 UCHAR bPowerSummaryId; 00200 UCHAR bBusPowerSavingD1; 00201 UCHAR bSelfPowerSavingD1; 00202 UCHAR bBusPowerSavingD2; 00203 UCHAR bSelfPowerSavingD2; 00204 UCHAR bBusPowerSavingD3; 00205 UCHAR bSelfPowerSavingD3; 00206 USHORT TransitionTimeFromD1; 00207 USHORT TransitionTimeFromD2; 00208 USHORT TransitionTimeFromD3; 00209 } USB_CONFIGURATION_POWER_DESCRIPTOR, *PUSB_CONFIGURATION_POWER_DESCRIPTOR; 00210 00211 #define USB_FEATURE_INTERFACE_POWER_D0 0x0002 00212 #define USB_FEATURE_INTERFACE_POWER_D1 0x0003 00213 #define USB_FEATURE_INTERFACE_POWER_D2 0x0004 00214 #define USB_FEATURE_INTERFACE_POWER_D3 0x0005 00215 00216 #include <pshpack1.h> 00217 typedef struct _USB_INTERFACE_POWER_DESCRIPTOR { 00218 UCHAR bLength; 00219 UCHAR bDescriptorType; 00220 UCHAR bmCapabilitiesFlags; 00221 UCHAR bBusPowerSavingD1; 00222 UCHAR bSelfPowerSavingD1; 00223 UCHAR bBusPowerSavingD2; 00224 UCHAR bSelfPowerSavingD2; 00225 UCHAR bBusPowerSavingD3; 00226 UCHAR bSelfPowerSavingD3; 00227 USHORT TransitionTimeFromD1; 00228 USHORT TransitionTimeFromD2; 00229 USHORT TransitionTimeFromD3; 00230 } USB_INTERFACE_POWER_DESCRIPTOR, *PUSB_INTERFACE_POWER_DESCRIPTOR; 00231 #include <poppack.h> 00232 00233 #ifdef __cplusplus 00234 } 00235 #endif 00236 00237 #endif /* __USB100_H */
Generated on Tue Jul 12 2022 19:59:55 by
1.7.2