📄 usb_descriptors.h
字号:
#define USB_PRODUCT_NAME \{ Usb_unicode('R') \ ,Usb_unicode('Z') \ ,Usb_unicode('R') \ ,Usb_unicode('A') \ ,Usb_unicode('V') \ ,Usb_unicode('E') \ ,Usb_unicode('N') \ ,Usb_unicode(' ') \ ,Usb_unicode('U') \ ,Usb_unicode('S') \ ,Usb_unicode('B') \ ,Usb_unicode(' ') \ ,Usb_unicode('D') \ ,Usb_unicode('E') \ ,Usb_unicode('M') \ ,Usb_unicode('O') \}#define USB_SN_LENGTH 0x05#define USB_SERIAL_NUMBER \{Usb_unicode('1') \ ,Usb_unicode('.') \ ,Usb_unicode('0') \ ,Usb_unicode('.') \ ,Usb_unicode('0') \}#define LANGUAGE_ID 0x0409 //! Usb Requesttypedef struct{ U8 bmRequestType; //!< Characteristics of the request U8 bRequest; //!< Specific request U16 wValue; //!< field that varies according to request U16 wIndex; //!< field that varies according to request U16 wLength; //!< Number of bytes to transfer if Data} S_UsbRequest; //! Usb Device Descriptortypedef struct { U8 bLength; //!< Size of this descriptor in bytes U8 bDescriptorType; //!< DEVICE descriptor type U16 bscUSB; //!< Binay Coded Decimal Spec. release U8 bDeviceClass; //!< Class code assigned by the USB U8 bDeviceSubClass; //!< Sub-class code assigned by the USB U8 bDeviceProtocol; //!< Protocol code assigned by the USB U8 bMaxPacketSize0; //!< Max packet size for EP0 U16 idVendor; //!< Vendor ID. ATMEL = 0x03EB U16 idProduct; //!< Product ID assigned by the manufacturer U16 bcdDevice; //!< Device release number U8 iManufacturer; //!< Index of manu. string descriptor U8 iProduct; //!< Index of prod. string descriptor U8 iSerialNumber; //!< Index of S.N. string descriptor U8 bNumConfigurations; //!< Number of possible configurations} S_usb_device_descriptor; //! Usb Configuration Descriptortypedef struct { U8 bLength; //!< size of this descriptor in bytes U8 bDescriptorType; //!< CONFIGURATION descriptor type U16 wTotalLength; //!< total length of data returned U8 bNumInterfaces; //!< number of interfaces for this conf. U8 bConfigurationValue; //!< value for SetConfiguration resquest U8 iConfiguration; //!< index of string descriptor U8 bmAttibutes; //!< Configuration characteristics U8 MaxPower; //!< maximum power consumption} S_usb_configuration_descriptor; //! Usb Interface Descriptortypedef struct { U8 bLength; //!< size of this descriptor in bytes U8 bDescriptorType; //!< INTERFACE descriptor type U8 bInterfaceNumber; //!< Number of interface U8 bAlternateSetting; //!< value to select alternate setting U8 bNumEndpoints; //!< Number of EP except EP 0 U8 bInterfaceClass; //!< Class code assigned by the USB U8 bInterfaceSubClass; //!< Sub-class code assigned by the USB U8 bInterfaceProtocol; //!< Protocol code assigned by the USB U8 iInterface; //!< Index of string descriptor} S_usb_interface_descriptor; //! Usb Endpoint Descriptortypedef struct { U8 bLength; //!< Size of this descriptor in bytes U8 bDescriptorType; //!< ENDPOINT descriptor type U8 bEndpointAddress; //!< Address of the endpoint U8 bmAttributes; //!< Endpoint's attributes U16 wMaxPacketSize; //!< Maximum packet size for this EP U8 bInterval; //!< Interval for polling EP in ms} S_usb_endpoint_descriptor; //! Usb Device Qualifier Descriptortypedef struct { U8 bLength; //!< Size of this descriptor in bytes U8 bDescriptorType; //!< Device Qualifier descriptor type U16 bscUSB; //!< Binay Coded Decimal Spec. release U8 bDeviceClass; //!< Class code assigned by the USB U8 bDeviceSubClass; //!< Sub-class code assigned by the USB U8 bDeviceProtocol; //!< Protocol code assigned by the USB U8 bMaxPacketSize0; //!< Max packet size for EP0 U8 bNumConfigurations; //!< Number of possible configurations U8 bReserved; //!< Reserved for future use, must be zero} S_usb_device_qualifier_descriptor; //! Usb Language Descriptortypedef struct { U8 bLength; //!< size of this descriptor in bytes U8 bDescriptorType; //!< STRING descriptor type U16 wlangid; //!< language id} S_usb_language_id;//_____ U S B M A N U F A C T U R E R D E S C R I P T O R _______________//struct usb_st_manufacturertypedef struct { U8 bLength; // size of this descriptor in bytes U8 bDescriptorType; // STRING descriptor type U16 wstring[USB_MN_LENGTH];// unicode characters} S_usb_manufacturer_string_descriptor;//_____ U S B P R O D U C T D E S C R I P T O R _________________________//struct usb_st_producttypedef struct { U8 bLength; // size of this descriptor in bytes U8 bDescriptorType; // STRING descriptor type U16 wstring[USB_PN_LENGTH];// unicode characters} S_usb_product_string_descriptor;//_____ U S B S E R I A L N U M B E R D E S C R I P T O R _____________//struct usb_st_serial_numbertypedef struct { U8 bLength; // size of this descriptor in bytes U8 bDescriptorType; // STRING descriptor type U16 wstring[USB_SN_LENGTH];// unicode characters} S_usb_serial_number;/*_____ U S B I A D _______________________________________________________*/#define DSC_TYPE_IAD 11typedef struct{ U8 bLength; U8 bDescriptorType; U8 bFirstInterface; U8 bInterfaceCount; U8 bFunctionClass; U8 bFunctionSubClass; U8 bFunctionProtocol; U8 iInterface;} S_usb_interface_association_descriptor;/*_____ U S B D E S C R I P T O R __________________________________*//* RNDIS + Serial Port */typedef struct{ S_usb_configuration_descriptor cfg; S_usb_interface_association_descriptor iad0; S_usb_interface_descriptor ifc0; U8 CS1_INTERFACE[19]; S_usb_endpoint_descriptor ep1; S_usb_interface_descriptor ifc1; S_usb_endpoint_descriptor ep2; S_usb_endpoint_descriptor ep3; S_usb_interface_association_descriptor iad1; S_usb_interface_descriptor ifc2; U8 CS2_INTERFACE[19]; S_usb_endpoint_descriptor ep4; S_usb_interface_descriptor ifc3; S_usb_endpoint_descriptor ep5; S_usb_endpoint_descriptor ep6;} S_usb_user_configuration_descriptor_composite;/* Just RNDIS */typedef struct{ S_usb_configuration_descriptor cfg; S_usb_interface_descriptor ifc0; U8 CS1_INTERFACE[19]; S_usb_endpoint_descriptor ep1; S_usb_interface_descriptor ifc1; S_usb_endpoint_descriptor ep2; S_usb_endpoint_descriptor ep3;} S_usb_user_configuration_descriptor_network;/* Mass Storage */typedef struct{ S_usb_configuration_descriptor cfg; S_usb_interface_descriptor ifc0; S_usb_endpoint_descriptor ep1; S_usb_endpoint_descriptor ep2;} S_usb_user_configuration_descriptor_mass;PGM_VOID_P Usb_get_dev_desc_pointer(void); U8 Usb_get_dev_desc_length(void);PGM_VOID_P Usb_get_conf_desc_pointer(void) ;U8 Usb_get_conf_desc_length(void);#endif // _USB_USERCONFIG_H_/** @} */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -