usb.h (1554B)
1 #ifndef _PROTOCOL_USB_H_ 2 #define _PROTOCOL_USB_H_ 3 4 #define DSC_DEVICE 0x01 5 #define DSC_CONFIG 0x02 6 #define DSC_STRING 0x03 7 #define DSC_INTERFACE 0x04 8 #define DSC_ENDPOINT 0x05 9 10 #define GET_STATUS 0x0080 11 #define SET_ADDRESS 0x0500 12 #define GET_DESCRIPTOR 0x0680 13 #define SET_DESCRIPTOR 0x0700 14 #define GET_CONFIGURATION 0x0880 15 #define SET_CONFIGURATION 0x0900 16 #define GET_INTERFACE 0x0A81 17 #define SET_INTERFACE 0x0B01 18 19 struct usb_setup_req{ 20 union { 21 u8 bmRequestType; 22 struct { 23 unsigned rcpt:4; 24 unsigned type:3; 25 unsigned dir:1; 26 } __attribute__((packed)) t ; 27 }; 28 u8 bRequest; 29 u16 wValue; 30 u16 wIndex; 31 u16 wLength; 32 } __attribute__((packed)); 33 34 #define USB_REQ_GET_STATUS 0 35 #define USB_REQ_CLEAR_FEATURE 1 36 #define USB_REQ_SET_FEATURE 3 37 #define USB_REQ_SET_ADDRESS 5 38 #define USB_REQ_GET_DESCRIPTOR 6 39 #define USB_REQ_SET_DESCRIPTOR 7 40 #define USB_REQ_GET_CONFIGURATION 8 41 #define USB_REQ_SET_CONFIGURATION 9 42 #define USB_REQ_GET_INTERFACE 10 43 #define USB_REQ_SET_INTERFACE 11 44 #define USB_REQ_SYNCH_FRAME 12 45 #define USB_REQ_SET_SEL 48 46 #define USB_REQ_SET_ISOCH_DELAY 49 47 48 #define USB_DESC_DEVICE 1 49 #define USB_DESC_CONFIG 2 50 #define USB_DESC_STRING 3 51 #define USB_DESC_INTERFACE 4 52 #define USB_DESC_ENDPOINT 5 53 #define USB_DESC_INTERFACE_POWER 8 54 #define USB_DESC_OTG 9 55 #define USB_DESC_DEBUG 10 56 #define USB_DESC_INTERFACE_ASSOCIATION 11 57 #define USB_DESC_BOS 15 58 #define USB_DESC_DEVICE_CAPABILITY 16 59 #define USB_DESC_SUPERSPEED_ENDPOINT 48 60 61 #define USB_DESC_VALUE(type, index) (((type) << 8) | ((index) & 0xff)) 62 63 #endif 64