usb11spec.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _USB11PSEC_H
00019 #define _USB11SPEC_H
00020
00021
00022
00023
00024 struct usb_device_descriptor
00025 {
00026 unsigned char bLength;
00027 unsigned char bDescriptorType;
00028 unsigned short bcdUSB;
00029 unsigned char bDeviceClass;
00030 unsigned char bDeviceSubClass;
00031 unsigned char bDeviceProtocol;
00032 unsigned char bMaxPacketSize0;
00033 unsigned short idVendor;
00034 unsigned short idProduct;
00035 unsigned short bcdDevice;
00036 unsigned char iManufacturer;
00037 unsigned char iProduct;
00038 unsigned char iSerialNumber;
00039 unsigned char bNumConfigurations;
00040 };
00041
00042
00043
00044
00045
00046 struct usb_configuration_descriptor
00047 {
00048 unsigned char bLength;
00049 unsigned char bDescriptorType;
00050 unsigned short wTotalLength;
00051 unsigned char bNumInterfaces;
00052 unsigned char bConfigurationValue;
00053 unsigned char iConfiguration;
00054 unsigned char bmAttributes;
00055 unsigned char MaxPower;
00056 };
00057
00058
00059
00060
00061
00062 struct usb_interface_descriptor
00063 {
00064 unsigned char bLength;
00065 unsigned char bDescriptorType;
00066 unsigned char bInterfaceNumber;
00067 unsigned char bAlternateSetting;
00068 unsigned char bNumEndpoints;
00069 unsigned char bInterfaceClass;
00070 unsigned char bInterfaceSubClass;
00071 unsigned char bInterfaceProtocol;
00072 unsigned char iInterface;
00073 };
00074
00075
00076
00077
00078
00079 struct usb_endpoint_descriptor
00080 {
00081 unsigned char bLength;
00082 unsigned char bDescriptorType;
00083 unsigned char bEndpointAddress;
00084 unsigned char bmAttributes;
00085 unsigned short wMaxPacketSize;
00086 unsigned char bIntervall;
00087 };
00088
00089
00090
00091
00092
00093
00094 struct usb_string_descriptor
00095 {
00096 unsigned char bLength;
00097 unsigned char bDescriptorType;
00098 unsigned char* String;
00099 };
00100
00101
00102
00103
00104
00105
00106
00107 typedef struct usb_device_request_t usb_device_request;
00108 struct usb_device_request_t
00109 {
00110 unsigned char bmRequestType;
00111 unsigned char bRequest;
00112 unsigned short wValue;
00113 unsigned short wIndex;
00114 unsigned short wLength;
00115 };
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130 #define USB_CTRL 0x00
00131 #define USB_ISOC 0x01
00132 #define USB_BULK 0x02
00133 #define USB_INTR 0x03
00134
00135
00136
00137
00138 #define DO_STANDARD 0x00
00139 #define DO_CLASS 0x20
00140 #define DO_VENDOR 0x40
00141
00142
00143
00144
00145
00146 #define GET_STATUS 0x00
00147 #define CLR_FEATURE 0x01
00148 #define SET_FEATURE 0x03
00149 #define SET_ADDRESS 0x05
00150 #define GET_DESCRIPTOR 0x06
00151 #define SET_DESCRIPTOR 0x07
00152 #define GET_CONFIGURATION 0x08
00153 #define SET_CONFIGURATION 0x09
00154 #define GET_INTERFACE 0x0A
00155 #define SET_INTERFACE 0x0B
00156
00157
00158
00159
00160
00161 #define DEVICE 0x01
00162 #define CONFIGURATION 0x02
00163 #define STRING 0x03
00164 #define INTERFACE 0x04
00165 #define ENDPOINT 0x05
00166 #define DEVICEQUALIFIER 0x06 // only usb2.0
00167 #define OTHERSPEEDCONFIGURATION 0x07 // only usb2.0
00168
00169
00170
00171
00172
00173
00174 #define USB_PID_SOF 0x05
00175 #define USB_PID_SETUP 0x0D
00176 #define USB_PID_IN 0x09
00177 #define USB_PID_OUT 0x01
00178 #define USB_PID_DATA0 0x03
00179 #define USB_PID_DATA1 0x0B
00180 #define USB_PID_ACK 0x02
00181 #define USB_PID_NACK 0x0A
00182 #define USB_PID_STALL 0x0E
00183 #define USB_PID_PRE 0x0C
00184
00185
00186 #define HID_CLASSCODE 0x03
00187 #define MASS_STORAGE_CLASSCODE 0x08
00188 #define HUB_CLASSCODE 0x09
00189
00190
00191
00192 #endif