📄 usb200.h
字号:
#define USB_FSEL_INTERFACE_POWER_D1 0x0003
#define USB_FSEL_INTERFACE_POWER_D2 0x0004
#define USB_FSEL_INTERFACE_POWER_D3 0x0005
/* USB Descriptor Types */
#define USB_DESCR_DEVICE 0x01
#define USB_DESCR_CONFIGURATION 0x02
#define USB_DESCR_STRING 0x03
#define USB_DESCR_INTERFACE 0x04
#define USB_DESCR_ENDPOINT 0x05
#define USB_DESCR_DEVICE_QUALIFIER 0x06
#define USB_DESCR_OTHER_SPEED_CONFIG 0x07
#define USB_DESCR_INTERFACE_POWER 0x08
#define USB_DESCR_OTG 0x09
#define USB_DESCR_DEBUG 0x0A
#define USB_DESCR_INTERFACE_ASSOCIATION 0x0B
/* USB DWG defined Descriptor Types */
#define USB_DESCR_RESERVED 0x06
#define USB_DESCR_CONFIG_POWER 0x07
#define USB_DESCR_INTERFACE_POWER 0x08
#define USB_DESCR_OTG 0x09
#define USB_DESCR_HID 0x21
#define USB_DESCR_REPORT 0x22
#define USB_DESCR_PHYSICAL 0x23
#define USB_DESCR_HUB 0x29
#define USB_DESCR_MAKE_TYPE_AND_INDEX(d, i) ((((USHORT)d) << 8 | i))
/* Definitions for bits in the bmAttributes field of a Configuration Descriptor */
#define USB_CONFIG_POWERED_MASK 0xC0
#define USB_CONFIG_BUS_POWERED 0x80
#define USB_CONFIG_SELF_POWERED 0x40
#define USB_CONFIG_REMOTE_WAKEUP 0x20
/* Endpoint direction bits in the bEndpointAddress field of a Endpoint Descriptor */
#define USB_ENDPOINT_DIRECTION_MASK 0x80
#define USB_ENDPOINT_DIRECTION_OUT 0x00
#define USB_ENDPOINT_DIRECTION_IN 0x80
#define USB_ENDPOINT_ADDRESS_MASK 0x0F
/* Endpoint type bits in the bmAttributes field of an Endpoint Descriptor */
#define USB_ENDPOINT_TYPE_MASK 0x03
#define USB_ENDPOINT_TYPE_CONTROL 0x00
#define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01
#define USB_ENDPOINT_TYPE_BULK 0x02
#define USB_ENDPOINT_TYPE_INTERRUPT 0x03
/* Additional Transaction bits in the wMaxPacketSize field of an Endpoint Descriptor */
#define USB_ENDPOINT_MPS_MASK 0x07FF
#define USB_ENDPOINT_TRANSACTION_MASK 0x1800
#define USB_ENDPOINT_TRANSACTION_1 0x0000
#define USB_ENDPOINT_TRANSACTION_2 0x0800
#define USB_ENDPOINT_TRANSACTION_3 0x1000
#define USB_ENDPOINT_TRANSACTION_4 0x1800
/* Definitions for bits in the bmAttributes field of an OTG Descriptor */
#define USB_OTG_HNP 0x02
#define USB_OTG_SRP 0x01
/* Hub Characteristic bits in the bHubCharacteristics field of an Hub Descriptor */
#define USB_HUB_PSM 0x01 /* Power Switching Mode, 0:Ganged, 1:Indivisual */
#define USB_HUB_NPS 0x02 /* No Power Switching */
#define USB_HUB_COMP 0x04 /* Compound Device */
#define USB_HUB_OCPM 0x08 /* Over Current Protection Mode, 0:Global, 1:Indivisual */
#define USB_HUB_NOCP 0x10 /* No Over Current Protection */
/* USB Setup Data */
typedef struct _USB_SETUP {
UCHAR bmRequestType;
UCHAR bRequest;
USHORT wValue;
USHORT wIndex;
USHORT wLength;
} USB_SETUP, *PUSB_SETUP;
#define USB_SETUP_LEN 8
/* USB Common Descriptor */
typedef struct _USB_COMMON_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
} USB_COMMON_DESCRIPTOR, *PUSB_COMMON_DESCRIPTOR;
/* USB Device Descriptor */
typedef struct _USB_DEVICE_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
USHORT bcdUSB;
UCHAR bDeviceClass;
UCHAR bDeviceSubClass;
UCHAR bDeviceProtocol;
UCHAR bMaxPacketSize0;
USHORT idVendor;
USHORT idProduct;
USHORT bcdDevice;
UCHAR iManufacturer;
UCHAR iProduct;
UCHAR iSerialNumber;
UCHAR bNumConfigurations;
} USB_DEVICE_DESCRIPTOR, *PUSB_DEVICE_DESCRIPTOR;
#define USB_DEVICE_DESCR_LEN 18
/* USB Configuration Descriptor */
typedef struct _USB_CONFIGURATION_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
USHORT wTotalLength;
UCHAR bNumInterfaces;
UCHAR bConfigurationValue;
UCHAR iConfiguration;
UCHAR bmAttributes;
UCHAR MaxPower;
} USB_CONFIGURATION_DESCRIPTOR, *PUSB_CONFIGURATION_DESCRIPTOR;
#define USB_CONFIG_DESCR_LEN 9
/* USB Interface Descriptor */
typedef struct _USB_INTERFACE_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bInterfaceNumber;
UCHAR bAlternateSetting;
UCHAR bNumEndpoints;
UCHAR bInterfaceClass;
UCHAR bInterfaceSubClass;
UCHAR bInterfaceProtocol;
UCHAR iInterface;
} USB_INTERFACE_DESCRIPTOR, *PUSB_INTERFACE_DESCRIPTOR;
#define USB_INTERFACE_DESCR_LEN 9
/* USB Endpoint Descriptor */
typedef struct _USB_ENDPOINT_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bEndpointAddress;
UCHAR bmAttributes;
USHORT wMaxPacketSize;
UCHAR bInterval;
} USB_ENDPOINT_DESCRIPTOR, *PUSB_ENDPOINT_DESCRIPTOR;
#define USB_ENDPOINT_DESCR_LEN 7
/* USB Device Qualifier Descriptor */
typedef struct _USB_DEVICE_QUALIFIER_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
USHORT bcdUSB;
UCHAR bDeviceClass;
UCHAR bDeviceSubClass;
UCHAR bDeviceProtocol;
UCHAR bMaxPacketSize0;
UCHAR bNumConfigurations;
UCHAR bReserved;
} USB_DEVICE_QUALIFIER_DESCRIPTOR, *PUSB_DEVICE_QUALIFIER_DESCRIPTOR;
#define USB_DEVICE_QUALIFIER_DESCR_LEN 10
/* USB Language Descriptor */
typedef struct _USB_LANGUAGE_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
USHORT wLANGID[1];
} USB_LANGUAGE_DESCRIPTOR, *PUSB_LANGUAGE_DESCRIPTOR;
#define USB_LANGUAGE_DESCR_LEN 4
/* USB String Descriptor */
typedef struct _USB_STRING_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
USHORT bString[1];
} USB_STRING_DESCRIPTOR, *PUSB_STRING_DESCRIPTOR;
/* USB HUB Descriptor */
typedef struct _USB_HUB_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bNbrPorts;
UCHAR bHubCharacteristics;
UCHAR bReserved;
UCHAR bPwrOn2PwrGood;
UCHAR bHubContrCurrent;
UCHAR bPortInfo[2];
} USB_HUB_DESCRIPTOR, *PUSB_HUB_DESCRIPTOR;
#define USB_HUB_DESCR_LEN 9
/* USB OTG Descriptor */
typedef struct _USB_OTG_DESCRIPTOR {
UCHAR bLength;
UCHAR bDescriptorType;
UCHAR bmAttributes;
} USB_OTG_DESCRIPTOR, *PUSB_OTG_DESCRIPTOR;
#define USB_OTG_DESCR_LEN 3
#ifdef __cplusplus
}
#endif
#endif /* __INCusb200h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -