38 #define USBH_NULL ((void *)0)
50 #define ValBit(VAR,POS) (VAR & (1 << POS))
51 #define SetBit(VAR,POS) (VAR |= (1 << POS))
52 #define ClrBit(VAR,POS) (VAR &= ((1 << POS)^255))
54 #define LE16(addr) (((u16)(*((u8 *)(addr))))\
55 + (((u16)(*(((u8 *)(addr)) + 1))) << 8))
57 #define USB_LEN_DESC_HDR 0x02
58 #define USB_LEN_DEV_DESC 0x12
59 #define USB_LEN_CFG_DESC 0x09
60 #define USB_LEN_IF_DESC 0x09
61 #define USB_LEN_EP_DESC 0x07
62 #define USB_LEN_OTG_DESC 0x03
63 #define USB_LEN_SETUP_PKT 0x08
66 #define USB_REQ_DIR_MASK 0x80
71 #define USB_REQ_TYPE_STANDARD 0x00
72 #define USB_REQ_TYPE_CLASS 0x20
73 #define USB_REQ_TYPE_VENDOR 0x40
74 #define USB_REQ_TYPE_RESERVED 0x60
77 #define USB_REQ_RECIPIENT_DEVICE 0x00
78 #define USB_REQ_RECIPIENT_INTERFACE 0x01
79 #define USB_REQ_RECIPIENT_ENDPOINT 0x02
80 #define USB_REQ_RECIPIENT_OTHER 0x03
84 #define USB_REQ_GET_STATUS 0x00
85 #define USB_REQ_CLEAR_FEATURE 0x01
86 #define USB_REQ_SET_FEATURE 0x03
87 #define USB_REQ_SET_ADDRESS 0x05
88 #define USB_REQ_GET_DESCRIPTOR 0x06
89 #define USB_REQ_SET_DESCRIPTOR 0x07
90 #define USB_REQ_GET_CONFIGURATION 0x08
91 #define USB_REQ_SET_CONFIGURATION 0x09
92 #define USB_REQ_GET_INTERFACE 0x0A
93 #define USB_REQ_SET_INTERFACE 0x0B
94 #define USB_REQ_SYNCH_FRAME 0x0C
97 #define USB_DESC_TYPE_DEVICE 1
98 #define USB_DESC_TYPE_CONFIGURATION 2
99 #define USB_DESC_TYPE_STRING 3
100 #define USB_DESC_TYPE_INTERFACE 4
101 #define USB_DESC_TYPE_ENDPOINT 5
102 #define USB_DESC_TYPE_DEVICE_QUALIFIER 6
103 #define USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION 7
104 #define USB_DESC_TYPE_INTERFACE_POWER 8
105 #define USB_DESC_TYPE_HID 0x21
106 #define USB_DESC_TYPE_HID_REPORT 0x22
109 #define USB_DEVICE_DESC_SIZE 18
110 #define USB_CONFIGURATION_DESC_SIZE 9
111 #define USB_HID_DESC_SIZE 9
112 #define USB_INTERFACE_DESC_SIZE 9
113 #define USB_ENDPOINT_DESC_SIZE 7
117 #define USB_DESC_DEVICE ((USB_DESC_TYPE_DEVICE << 8) & 0xFF00)
118 #define USB_DESC_CONFIGURATION ((USB_DESC_TYPE_CONFIGURATION << 8) & 0xFF00)
119 #define USB_DESC_STRING ((USB_DESC_TYPE_STRING << 8) & 0xFF00)
120 #define USB_DESC_INTERFACE ((USB_DESC_TYPE_INTERFACE << 8) & 0xFF00)
121 #define USB_DESC_ENDPOINT ((USB_DESC_TYPE_INTERFACE << 8) & 0xFF00)
122 #define USB_DESC_DEVICE_QUALIFIER ((USB_DESC_TYPE_DEVICE_QUALIFIER << 8) & 0xFF00)
123 #define USB_DESC_OTHER_SPEED_CONFIGURATION ((USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION << 8) & 0xFF00)
124 #define USB_DESC_INTERFACE_POWER ((USB_DESC_TYPE_INTERFACE_POWER << 8) & 0xFF00)
125 #define USB_DESC_HID_REPORT ((USB_DESC_TYPE_HID_REPORT << 8) & 0xFF00)
126 #define USB_DESC_HID ((USB_DESC_TYPE_HID << 8) & 0xFF00)
129 #define USB_EP_TYPE_CTRL 0x00
130 #define USB_EP_TYPE_ISOC 0x01
131 #define USB_EP_TYPE_BULK 0x02
132 #define USB_EP_TYPE_INTR 0x03
134 #define USB_EP_DIR_OUT 0x00
135 #define USB_EP_DIR_IN 0x80
136 #define USB_EP_DIR_MSK 0x80
139 #define USB_MSC_CLASS 0x08
140 #define USB_HID_CLASS 0x03
143 #define HID_BOOT_CODE 0x01
144 #define HID_KEYBRD_BOOT_CODE 0x01
145 #define HID_MOUSE_BOOT_CODE 0x02
149 #define DATA_STAGE_TIMEOUT 5000
150 #define NODATA_STAGE_TIMEOUT 50
157 #define USBH_CONFIGURATION_DESCRIPTOR_SIZE (USB_CONFIGURATION_DESC_SIZE \
158 + USB_INTERFACE_DESC_SIZE\
159 + (USBH_MAX_NUM_ENDPOINTS * USB_ENDPOINT_DESC_SIZE))
162 #define CONFIG_DESC_wTOTAL_LENGTH (ConfigurationDescriptorData.ConfigDescfield.\
163 ConfigurationDescriptor.wTotalLength)
186 uint8_t bmRequestType;
198 uint8_t bDescriptorType;
205 uint8_t bDescriptorType;
207 uint8_t bDeviceClass;
208 uint8_t bDeviceSubClass;
209 uint8_t bDeviceProtocol;
213 uint8_t bMaxPacketSize;
217 uint8_t iManufacturer;
219 uint8_t iSerialNumber;
220 uint8_t bNumConfigurations;
228 uint8_t bDescriptorType;
229 uint16_t wTotalLength;
230 uint8_t bNumInterfaces;
231 uint8_t bConfigurationValue;
232 uint8_t iConfiguration;
233 uint8_t bmAttributes;
242 uint8_t bDescriptorType;
244 uint8_t bCountryCode;
245 uint8_t bNumDescriptors;
246 uint8_t bReportDescriptorType;
247 uint16_t wItemLength;
255 uint8_t bDescriptorType;
256 uint8_t bInterfaceNumber;
257 uint8_t bAlternateSetting;
258 uint8_t bNumEndpoints;
259 uint8_t bInterfaceClass;
260 uint8_t bInterfaceSubClass;
261 uint8_t bInterfaceProtocol;
271 uint8_t bDescriptorType;
272 uint8_t bEndpointAddress;
273 uint8_t bmAttributes;
274 uint16_t wMaxPacketSize;
Definition: usbh_def.h:268
Definition: usbh_def.h:202
Definition: usbh_def.h:184
Definition: usbh_def.h:170
Definition: usbh_def.h:225
Definition: usbh_def.h:167
Definition: usbh_def.h:180
Definition: usbh_def.h:239
Definition: usbh_def.h:252