usb_protocol.h
Go to the documentation of this file.
1 
36 /*
37  * Support and FAQ: visit <a href="https://www.microchip.com/support/">Microchip Support</a>
38  */
39 
40 #ifndef _USB_PROTOCOL_H_
41 #define _USB_PROTOCOL_H_
42 
43 #include "usb_atmel.h"
44 
55 #define USB_V2_0 0x0200
57 #define USB_V2_1 0x0201
58 
59 
61 #define NO_CLASS 0x00
63 #define CLASS_VENDOR_SPECIFIC 0xFF
64 #define NO_SUBCLASS 0x00
65 #define NO_PROTOCOL 0x00
66 
70 #define CLASS_IAD 0xEF
71 #define SUB_CLASS_IAD 0x02
72 #define PROTOCOL_IAD 0x01
73 
78 #define USB_REQ_DIR_OUT (0<<7)
79 #define USB_REQ_DIR_IN (1<<7)
80 #define USB_REQ_DIR_MASK (1<<7)
81 
82 
85 #define USB_REQ_TYPE_STANDARD (0<<5)
86 #define USB_REQ_TYPE_CLASS (1<<5)
87 #define USB_REQ_TYPE_VENDOR (2<<5)
88 #define USB_REQ_TYPE_MASK (3<<5)
89 
90 
93 #define USB_REQ_RECIP_DEVICE (0<<0)
94 #define USB_REQ_RECIP_INTERFACE (1<<0)
95 #define USB_REQ_RECIP_ENDPOINT (2<<0)
96 #define USB_REQ_RECIP_OTHER (3<<0)
97 #define USB_REQ_RECIP_MASK (0x1F)
98 
99 
102 enum usb_reqid {
114 };
115 
124 };
125 
132 };
133 
140 };
141 
153 };
154 
166 };
167 
173 };
174 
179  USB_TEST_J = 0x01,
180  USB_TEST_K = 0x02,
184 };
185 
199  USB_DT_IAD = 0x0B,
200  USB_DT_BOS = 0x0F,
202 };
203 
209 };
210 
216  USB_DC_EXT_LPM = 0x00000002,
217 };
218 
219 #define HIRD_50_US 0
220 #define HIRD_125_US 1
221 #define HIRD_200_US 2
222 #define HIRD_275_US 3
223 #define HIRD_350_US 4
224 #define HIRD_425_US 5
225 #define HIRD_500_US 6
226 #define HIRD_575_US 7
227 #define HIRD_650_US 8
228 #define HIRD_725_US 9
229 #define HIRD_800_US 10
230 #define HIRD_875_US 11
231 #define HIRD_950_US 12
232 #define HIRD_1025_US 13
233 #define HIRD_1100_US 14
234 #define HIRD_1175_US 15
235 
237 #define USB_LPM_ATTRIBUT_BLINKSTATE_MASK (0xF << 0)
238 #define USB_LPM_ATTRIBUT_FIRD_MASK (0xF << 4)
239 #define USB_LPM_ATTRIBUT_REMOTEWAKE_MASK (1 << 8)
240 #define USB_LPM_ATTRIBUT_BLINKSTATE(value) ((value & 0xF) << 0)
241 #define USB_LPM_ATTRIBUT_FIRD(value) ((value & 0xF) << 4)
242 #define USB_LPM_ATTRIBUT_REMOTEWAKE(value) ((value & 1) << 8)
243 #define USB_LPM_ATTRIBUT_BLINKSTATE_L1 USB_LPM_ATTRIBUT_BLINKSTATE(1)
244 
254 };
255 
260  USB_LANGID_EN_US = 0x0409,
261 };
262 
266 #define USB_EP_ADDR_MASK 0x0f
267 
269 typedef uint8_t usb_add_t;
270 
274 #define USB_EP_DIR_IN 0x80
275 
279 #define USB_EP_DIR_OUT 0x00
280 
282 typedef uint8_t usb_ep_t;
283 
290 #define USB_MAX_DESC_LEN 255
291 
292 /*
293  * 2-byte alignment requested for all USB structures.
294  */
296 
297 
302 typedef struct {
303  uint8_t bmRequestType;
304  uint8_t bRequest;
309 
313 typedef struct {
314  uint8_t bLength;
317  uint8_t bDeviceClass;
324  uint8_t iManufacturer;
325  uint8_t iProduct;
326  uint8_t iSerialNumber;
329 
338 typedef struct {
339  uint8_t bLength;
342  uint8_t bDeviceClass;
347  uint8_t bReserved;
349 
362 typedef struct {
363  uint8_t bLength;
366  uint8_t bNumDeviceCaps;
368 
369 
375 typedef struct {
376  uint8_t bLength;
381 
387 typedef struct {
391 
395 typedef struct {
396  uint8_t bLength;
397  uint8_t bDescriptorType;
398  uint8_t bFirstInterface;
399  uint8_t bInterfaceCount;
400  uint8_t bFunctionClass;
403  uint8_t iFunction;
405 
406 
410 typedef struct {
411  uint8_t bLength;
414  uint8_t bNumInterfaces;
416  uint8_t iConfiguration;
417  uint8_t bmAttributes;
418  uint8_t bMaxPower;
420 
421 
422 #define USB_CONFIG_ATTR_MUST_SET (1 << 7)
423 #define USB_CONFIG_ATTR_BUS_POWERED (0 << 6)
424 #define USB_CONFIG_ATTR_SELF_POWERED (1 << 6)
425 #define USB_CONFIG_ATTR_REMOTE_WAKEUP (1 << 5)
426 
427 #define USB_CONFIG_MAX_POWER(ma) (((ma) + 1) / 2)
428 
429 
432 typedef struct {
433  uint8_t bLength;
434  uint8_t bDescriptorType;
435  uint8_t bFirstInterface;
436  uint8_t bInterfaceCount;
437  uint8_t bFunctionClass;
440  uint8_t iFunction;
442 
446 typedef struct {
447  uint8_t bLength;
451  uint8_t bNumEndpoints;
455  uint8_t iInterface;
457 
461 typedef struct {
462  uint8_t bLength;
465  uint8_t bmAttributes;
467  uint8_t bInterval;
468 } usb_ep_desc_t;
469 
470 
474 typedef struct {
475  uint8_t bLength;
478 
479 typedef struct {
481  le16_t string[1];
483 
485 
486 
488 #endif /* _USB_PROTOCOL_H_ */
usb_interface_status
Standard USB Interface status flags.
Definition: usb_protocol.h:130
uint8_t iFunction
Index of string descriptor.
Definition: usb_protocol.h:403
usb_endpoint_feature
Standard USB endpoint feature/status flags.
Definition: usb_protocol.h:171
uint8_t bDescriptorType
Definition: usb_protocol.h:463
A standard USB string descriptor structure.
Definition: usb_protocol.h:474
le16_t wMaxPacketSize
Definition: usb_protocol.h:466
uint8_t bMaxPacketSize0
Definition: usb_protocol.h:320
English (United States)
Definition: usb_protocol.h:260
uint8_t bNumConfigurations
Definition: usb_protocol.h:346
usb_str_desc_t desc
Definition: usb_protocol.h:480
uint8_t bDescriptorType
INTERFACE descriptor type.
Definition: usb_protocol.h:397
#define COMPILER_PACK_RESET()
Set default alignment for subsequent struct and union definitions.
Definition: compiler.h:120
uint8_t bInterval
Definition: usb_protocol.h:467
uint8_t bmRequestType
Definition: usb_protocol.h:303
uint8_t bLength
Definition: usb_protocol.h:462
Standard USB device descriptor structure.
Definition: usb_protocol.h:313
usb_descriptor_type
Standard USB descriptor types.
Definition: usb_protocol.h:189
Standard USB configuration descriptor structure.
Definition: usb_protocol.h:410
A USB Device SETUP request.
Definition: usb_protocol.h:302
uint8_t bInterfaceProtocol
Definition: usb_protocol.h:454
uint8_t iManufacturer
Definition: usb_protocol.h:324
usb_dev_capa_ext_desc_t capa_ext
Definition: usb_protocol.h:389
uint8_t bInterfaceCount
value to select alternate setting
Definition: usb_protocol.h:399
usb_device_feature
Standard USB device feature flags.
Definition: usb_protocol.h:147
uint32_t le32_t
Definition: compiler.h:254
#define COMPILER_PACK_SET(alignment)
Set maximum alignment for subsequent struct and union definitions to alignment.
Definition: compiler.h:113
uint8_t bDescriptorType
Definition: usb_protocol.h:476
uint8_t bFunctionSubClass
Sub-class code assigned by the USB.
Definition: usb_protocol.h:438
usb_capability_extension_attr
USB Device Capability - USB 2.0 Extension To fill bmAttributes field of usb_capa_ext_desc_t structure...
Definition: usb_protocol.h:215
USB Device Capabilities - USB 2.0 Extension Descriptor structure.
Definition: usb_protocol.h:375
uint8_t bNumInterfaces
Definition: usb_protocol.h:414
All USB VIDs and PIDs from Atmel USB applications.
uint8_t bDescriptorType
Definition: usb_protocol.h:448
uint8_t iProduct
Definition: usb_protocol.h:325
usb_reqid
Standard USB requests (bRequest)
Definition: usb_protocol.h:102
Standard USB device qualifier descriptor structure.
Definition: usb_protocol.h:338
usb_device_status
Standard USB device status flags.
Definition: usb_protocol.h:120
uint8_t bConfigurationValue
Definition: usb_protocol.h:415
uint8_t bDeviceProtocol
Definition: usb_protocol.h:319
uint8_t usb_ep_t
Endpoint identifier.
Definition: usb_protocol.h:282
uint8_t bInterfaceCount
value to select alternate setting
Definition: usb_protocol.h:436
uint8_t bEndpointAddress
Definition: usb_protocol.h:464
uint8_t iFunction
Index of string descriptor.
Definition: usb_protocol.h:440
usb_ep_type
Standard USB endpoint transfer types.
Definition: usb_protocol.h:248
Standard USB interface descriptor structure.
Definition: usb_protocol.h:446
uint8_t bDescriptorType
Definition: usb_protocol.h:412
uint8_t bDescriptorType
Definition: usb_protocol.h:315
uint8_t bFunctionSubClass
Sub-class code assigned by the USB.
Definition: usb_protocol.h:401
Standard USB association descriptor structure.
Definition: usb_protocol.h:432
uint8_t bFirstInterface
Number of interface.
Definition: usb_protocol.h:398
uint8_t bDeviceSubClass
Definition: usb_protocol.h:318
uint8_t bFunctionProtocol
Protocol code assigned by the USB.
Definition: usb_protocol.h:439
uint8_t iSerialNumber
Definition: usb_protocol.h:326
uint8_t iConfiguration
Definition: usb_protocol.h:416
uint16_t le16_t
Definition: compiler.h:250
uint8_t bAlternateSetting
Definition: usb_protocol.h:450
uint8_t bDeviceClass
Definition: usb_protocol.h:317
uint8_t bFirstInterface
Number of interface.
Definition: usb_protocol.h:435
uint8_t usb_add_t
USB address identifier.
Definition: usb_protocol.h:269
uint8_t bLength
Size of this descriptor in bytes.
Definition: usb_protocol.h:433
usb_endpoint_status
Standard USB endpoint status flags.
Definition: usb_protocol.h:138
uint8_t bFunctionClass
Class code assigned by the USB.
Definition: usb_protocol.h:400
Remote wakeup enabled.
Definition: usb_protocol.h:148
Standard USB endpoint descriptor structure.
Definition: usb_protocol.h:461
Standard USB Interface Association Descriptor structure.
Definition: usb_protocol.h:395
usb_device_hs_test_mode
Test Mode possible on HS USB device.
Definition: usb_protocol.h:160
uint8_t bNumConfigurations
Definition: usb_protocol.h:327
uint8_t bNumEndpoints
Definition: usb_protocol.h:451
USB Device LPM Descriptor structure.
Definition: usb_protocol.h:387
uint8_t bFunctionClass
Class code assigned by the USB.
Definition: usb_protocol.h:437
uint8_t bInterfaceSubClass
Definition: usb_protocol.h:453
usb_test_mode_selector
Standard USB Test Mode Selectors.
Definition: usb_protocol.h:178
uint8_t bFunctionProtocol
Protocol code assigned by the USB.
Definition: usb_protocol.h:402
usb_capability_type
USB Device Capability types.
Definition: usb_protocol.h:207
uint8_t bmAttributes
Definition: usb_protocol.h:465
uint8_t bLength
size of this descriptor in bytes
Definition: usb_protocol.h:396
uint8_t bInterfaceClass
Definition: usb_protocol.h:452
usb_dev_bos_desc_t bos
Definition: usb_protocol.h:388
usb_langid
Standard USB language IDs for string descriptors.
Definition: usb_protocol.h:259
uint8_t bmAttributes
Definition: usb_protocol.h:417
uint8_t bDescriptorType
Interface descriptor type.
Definition: usb_protocol.h:434
USB Device BOS descriptor structure.
Definition: usb_protocol.h:362
uint8_t bInterfaceNumber
Definition: usb_protocol.h:449


inertial_sense_ros
Author(s):
autogenerated on Sat Sep 19 2020 03:19:05