25 #if !defined(_usb_h_) || defined(_ch9_h_) 26 #error "Never include usb_ch9.h directly; include Usb.h instead" 33 #define DEV_DESCR_LEN 18 //device descriptor length 34 #define CONF_DESCR_LEN 9 //configuration descriptor length 35 #define INTR_DESCR_LEN 9 //interface descriptor length 36 #define EP_DESCR_LEN 7 //endpoint descriptor length 40 #define USB_REQUEST_GET_STATUS 0 // Standard Device Request - GET STATUS 41 #define USB_REQUEST_CLEAR_FEATURE 1 // Standard Device Request - CLEAR FEATURE 42 #define USB_REQUEST_SET_FEATURE 3 // Standard Device Request - SET FEATURE 43 #define USB_REQUEST_SET_ADDRESS 5 // Standard Device Request - SET ADDRESS 44 #define USB_REQUEST_GET_DESCRIPTOR 6 // Standard Device Request - GET DESCRIPTOR 45 #define USB_REQUEST_SET_DESCRIPTOR 7 // Standard Device Request - SET DESCRIPTOR 46 #define USB_REQUEST_GET_CONFIGURATION 8 // Standard Device Request - GET CONFIGURATION 47 #define USB_REQUEST_SET_CONFIGURATION 9 // Standard Device Request - SET CONFIGURATION 48 #define USB_REQUEST_GET_INTERFACE 10 // Standard Device Request - GET INTERFACE 49 #define USB_REQUEST_SET_INTERFACE 11 // Standard Device Request - SET INTERFACE 50 #define USB_REQUEST_SYNCH_FRAME 12 // Standard Device Request - SYNCH FRAME 52 #define USB_FEATURE_ENDPOINT_HALT 0 // CLEAR/SET FEATURE - Endpoint Halt 53 #define USB_FEATURE_DEVICE_REMOTE_WAKEUP 1 // CLEAR/SET FEATURE - Device remote wake-up 54 #define USB_FEATURE_TEST_MODE 2 // CLEAR/SET FEATURE - Test mode 58 #define USB_SETUP_HOST_TO_DEVICE 0x00 // Device Request bmRequestType transfer direction - host to device transfer 59 #define USB_SETUP_DEVICE_TO_HOST 0x80 // Device Request bmRequestType transfer direction - device to host transfer 60 #define USB_SETUP_TYPE_STANDARD 0x00 // Device Request bmRequestType type - standard 61 #define USB_SETUP_TYPE_CLASS 0x20 // Device Request bmRequestType type - class 62 #define USB_SETUP_TYPE_VENDOR 0x40 // Device Request bmRequestType type - vendor 63 #define USB_SETUP_RECIPIENT_DEVICE 0x00 // Device Request bmRequestType recipient - device 64 #define USB_SETUP_RECIPIENT_INTERFACE 0x01 // Device Request bmRequestType recipient - interface 65 #define USB_SETUP_RECIPIENT_ENDPOINT 0x02 // Device Request bmRequestType recipient - endpoint 66 #define USB_SETUP_RECIPIENT_OTHER 0x03 // Device Request bmRequestType recipient - other 70 #define USB_DESCRIPTOR_DEVICE 0x01 // bDescriptorType for a Device Descriptor. 71 #define USB_DESCRIPTOR_CONFIGURATION 0x02 // bDescriptorType for a Configuration Descriptor. 72 #define USB_DESCRIPTOR_STRING 0x03 // bDescriptorType for a String Descriptor. 73 #define USB_DESCRIPTOR_INTERFACE 0x04 // bDescriptorType for an Interface Descriptor. 74 #define USB_DESCRIPTOR_ENDPOINT 0x05 // bDescriptorType for an Endpoint Descriptor. 75 #define USB_DESCRIPTOR_DEVICE_QUALIFIER 0x06 // bDescriptorType for a Device Qualifier. 76 #define USB_DESCRIPTOR_OTHER_SPEED 0x07 // bDescriptorType for a Other Speed Configuration. 77 #define USB_DESCRIPTOR_INTERFACE_POWER 0x08 // bDescriptorType for Interface Power. 78 #define USB_DESCRIPTOR_OTG 0x09 // bDescriptorType for an OTG Descriptor. 80 #define HID_DESCRIPTOR_HID 0x21 85 #define OTG_FEATURE_B_HNP_ENABLE 3 // SET FEATURE OTG - Enable B device to perform HNP 86 #define OTG_FEATURE_A_HNP_SUPPORT 4 // SET FEATURE OTG - A device supports HNP 87 #define OTG_FEATURE_A_ALT_HNP_SUPPORT 5 // SET FEATURE OTG - Another port on the A device supports HNP 90 #define USB_TRANSFER_TYPE_CONTROL 0x00 // Endpoint is a control endpoint. 91 #define USB_TRANSFER_TYPE_ISOCHRONOUS 0x01 // Endpoint is an isochronous endpoint. 92 #define USB_TRANSFER_TYPE_BULK 0x02 // Endpoint is a bulk endpoint. 93 #define USB_TRANSFER_TYPE_INTERRUPT 0x03 // Endpoint is an interrupt endpoint. 94 #define bmUSB_TRANSFER_TYPE 0x03 // bit mask to separate transfer type from ISO attributes 98 #define USB_FEATURE_ENDPOINT_STALL 0 // Endpoint recipient 99 #define USB_FEATURE_DEVICE_REMOTE_WAKEUP 1 // Device recipient 100 #define USB_FEATURE_TEST_MODE 2 // Device recipient
uint8_t bConfigurationValue
uint16_t wDescriptorLength
uint16_t wDescriptorLength
uint8_t bAlternateSetting
uint8_t bNumConfigurations
uint8_t bInterfaceSubClass
uint8_t bInterfaceProtocol