37 #include "usbh_conf.h" 65 #define ValBit(VAR,POS) (VAR & (1 << POS)) 66 #define SetBit(VAR,POS) (VAR |= (1 << POS)) 67 #define ClrBit(VAR,POS) (VAR &= ((1 << POS)^255)) 69 #define LE16(addr) (((uint16_t)(*((uint8_t *)(addr))))\ 70 + (((uint16_t)(*(((uint8_t *)(addr)) + 1))) << 8)) 72 #define LE16S(addr) (uint16_t)(LE16((addr))) 74 #define LE32(addr) ((((uint32_t)(*(((uint8_t *)(addr)) + 0))) + \ 75 (((uint32_t)(*(((uint8_t *)(addr)) + 1))) << 8) + \ 76 (((uint32_t)(*(((uint8_t *)(addr)) + 2))) << 16) + \ 77 (((uint32_t)(*(((uint8_t *)(addr)) + 3))) << 24))) 79 #define LE64(addr) ((((uint64_t)(*(((uint8_t *)(addr)) + 0))) + \ 80 (((uint64_t)(*(((uint8_t *)(addr)) + 1))) << 8) +\ 81 (((uint64_t)(*(((uint8_t *)(addr)) + 2))) << 16) +\ 82 (((uint64_t)(*(((uint8_t *)(addr)) + 3))) << 24) +\ 83 (((uint64_t)(*(((uint8_t *)(addr)) + 4))) << 32) +\ 84 (((uint64_t)(*(((uint8_t *)(addr)) + 5))) << 40) +\ 85 (((uint64_t)(*(((uint8_t *)(addr)) + 6))) << 48) +\ 86 (((uint64_t)(*(((uint8_t *)(addr)) + 7))) << 56))) 89 #define LE24(addr) ((((uint32_t)(*(((uint8_t *)(addr)) + 0))) + \ 90 (((uint32_t)(*(((uint8_t *)(addr)) + 1))) << 8) + \ 91 (((uint32_t)(*(((uint8_t *)(addr)) + 2))) << 16))) 94 #define LE32S(addr) (int32_t)(LE32((addr))) 98 #define USB_LEN_DESC_HDR 0x02 99 #define USB_LEN_DEV_DESC 0x12 100 #define USB_LEN_CFG_DESC 0x09 101 #define USB_LEN_IF_DESC 0x09 102 #define USB_LEN_EP_DESC 0x07 103 #define USB_LEN_OTG_DESC 0x03 104 #define USB_LEN_SETUP_PKT 0x08 107 #define USB_REQ_DIR_MASK 0x80 112 #define USB_REQ_TYPE_STANDARD 0x00 113 #define USB_REQ_TYPE_CLASS 0x20 114 #define USB_REQ_TYPE_VENDOR 0x40 115 #define USB_REQ_TYPE_RESERVED 0x60 118 #define USB_REQ_RECIPIENT_DEVICE 0x00 119 #define USB_REQ_RECIPIENT_INTERFACE 0x01 120 #define USB_REQ_RECIPIENT_ENDPOINT 0x02 121 #define USB_REQ_RECIPIENT_OTHER 0x03 125 #define USB_REQ_GET_STATUS 0x00 126 #define USB_REQ_CLEAR_FEATURE 0x01 127 #define USB_REQ_SET_FEATURE 0x03 128 #define USB_REQ_SET_ADDRESS 0x05 129 #define USB_REQ_GET_DESCRIPTOR 0x06 130 #define USB_REQ_SET_DESCRIPTOR 0x07 131 #define USB_REQ_GET_CONFIGURATION 0x08 132 #define USB_REQ_SET_CONFIGURATION 0x09 133 #define USB_REQ_GET_INTERFACE 0x0A 134 #define USB_REQ_SET_INTERFACE 0x0B 135 #define USB_REQ_SYNCH_FRAME 0x0C 138 #define USB_DESC_TYPE_DEVICE 1 139 #define USB_DESC_TYPE_CONFIGURATION 2 140 #define USB_DESC_TYPE_STRING 3 141 #define USB_DESC_TYPE_INTERFACE 4 142 #define USB_DESC_TYPE_ENDPOINT 5 143 #define USB_DESC_TYPE_DEVICE_QUALIFIER 6 144 #define USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION 7 145 #define USB_DESC_TYPE_INTERFACE_POWER 8 146 #define USB_DESC_TYPE_HID 0x21 147 #define USB_DESC_TYPE_HID_REPORT 0x22 150 #define USB_DEVICE_DESC_SIZE 18 151 #define USB_CONFIGURATION_DESC_SIZE 9 152 #define USB_HID_DESC_SIZE 9 153 #define USB_INTERFACE_DESC_SIZE 9 154 #define USB_ENDPOINT_DESC_SIZE 7 158 #define USB_DESC_DEVICE ((USB_DESC_TYPE_DEVICE << 8) & 0xFF00) 159 #define USB_DESC_CONFIGURATION ((USB_DESC_TYPE_CONFIGURATION << 8) & 0xFF00) 160 #define USB_DESC_STRING ((USB_DESC_TYPE_STRING << 8) & 0xFF00) 161 #define USB_DESC_INTERFACE ((USB_DESC_TYPE_INTERFACE << 8) & 0xFF00) 162 #define USB_DESC_ENDPOINT ((USB_DESC_TYPE_INTERFACE << 8) & 0xFF00) 163 #define USB_DESC_DEVICE_QUALIFIER ((USB_DESC_TYPE_DEVICE_QUALIFIER << 8) & 0xFF00) 164 #define USB_DESC_OTHER_SPEED_CONFIGURATION ((USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION << 8) & 0xFF00) 165 #define USB_DESC_INTERFACE_POWER ((USB_DESC_TYPE_INTERFACE_POWER << 8) & 0xFF00) 166 #define USB_DESC_HID_REPORT ((USB_DESC_TYPE_HID_REPORT << 8) & 0xFF00) 167 #define USB_DESC_HID ((USB_DESC_TYPE_HID << 8) & 0xFF00) 170 #define USB_EP_TYPE_CTRL 0x00 171 #define USB_EP_TYPE_ISOC 0x01 172 #define USB_EP_TYPE_BULK 0x02 173 #define USB_EP_TYPE_INTR 0x03 175 #define USB_EP_DIR_OUT 0x00 176 #define USB_EP_DIR_IN 0x80 177 #define USB_EP_DIR_MSK 0x80 179 #ifndef USBH_MAX_PIPES_NBR 180 #define USBH_MAX_PIPES_NBR 15 183 #define USBH_DEVICE_ADDRESS_DEFAULT 0 184 #define USBH_MAX_ERROR_COUNT 2 185 #define USBH_DEVICE_ADDRESS 1 193 #define USBH_CONFIGURATION_DESCRIPTOR_SIZE (USB_CONFIGURATION_DESC_SIZE \ 194 + USB_INTERFACE_DESC_SIZE\ 195 + (USBH_MAX_NUM_ENDPOINTS * USB_ENDPOINT_DESC_SIZE)) 198 #define CONFIG_DESC_wTOTAL_LENGTH (ConfigurationDescriptorData.ConfigDescfield.\ 199 ConfigurationDescriptor.wTotalLength) 421 #if (USBH_KEEP_CFG_DESCRIPTOR == 1) 466 #if (USBH_USE_OS == 1) 474 #if defined ( __GNUC__ ) 476 #define __weak __attribute__((weak)) 479 #define __packed __attribute__((__packed__)) CMD_StateTypeDef RequestState
#define USBH_MAX_NUM_SUPPORTED_CLASS
USBH_DeviceTypeDef device
#define USBH_MAX_SIZE_CONFIGURATION
uint8_t bNumConfigurations
#define USBH_MAX_NUM_ENDPOINTS
ENUM_StateTypeDef EnumState
USBH_CfgDescTypeDef CfgDesc
uint8_t bConfigurationValue
struct _InterfaceDescriptor USBH_InterfaceDescTypeDef
#define USBH_MAX_NUM_INTERFACES
struct _EndpointDescriptor USBH_EpDescTypeDef
struct _DeviceDescriptor USBH_DevDescTypeDef
uint8_t bInterfaceSubClass
uint8_t bAlternateSetting
QueueHandle_t osMessageQId
#define USBH_MAX_DATA_BUFFER
struct _ConfigurationDescriptor USBH_CfgDescTypeDef
__IO HOST_StateTypeDef gState
union _USB_Setup USB_Setup_TypeDef
uint8_t current_interface
uint8_t bInterfaceProtocol
USBH_DevDescTypeDef DevDesc
USBH_ClassTypeDef * pActiveClass
struct _USBH_HandleTypeDef USBH_HandleTypeDef
__IO uint8_t is_connected
struct _DescHeader USBH_DescHeader_t