📄 et_easy_usb_bulk_c_setting.h
字号:
//_RequestType_0XA3
#define _RT0XA3_Request_0X00 _ENABLE*_RequestType_0XA3 //;get_status
#define _RT0XA3_Request_0X02 _ENABLE*_RequestType_0XA3 //;get_state
//---USB COMMAND (VALUE)---//
//_RT0X00_Request_0X01 clear_feature
#define _RT0X00_R0X01_Value0001 _ENABLE*_RT0X00_Request_0X01 //;device_remote_wakeup
//_RT0X00_Request_0X03 set_feature
#define _RT0X00_R0X03_Value0001 _ENABLE*_RT0X00_Request_0X03 //;device_remote_wakeup
//_RT0X02_Request_0X01 clear_feature
#define _RT0X02_R0X01_Value0000 _ENABLE*_RT0X02_Request_0X01 //;endpoint_stalled
//_RT0X02_Request_0X03 set_feature
#define _RT0X02_R0X03_Value0000 _ENABLE*_RT0X02_Request_0X03 //;endpoint_stalled
//_RT0X80_Request_0X06 get_descriptor
#define _RT0X80_R0X06_Value0100 _ENABLE*_RT0X80_Request_0X06 //;device
#define _RT0X80_R0X06_Value0200 _ENABLE*_RT0X80_Request_0X06 //;configuration
#define _RT0X80_R0X06_Value0300 ET_USB_STRING_INDEX*_RT0X80_Request_0X06 //;string
//_RT0X81_Request_0X06 get_descriptor
#define _RT0X81_R0X06_Value2100 _ENABLE*_RT0X81_Request_0X06 //;HID
#define _RT0X81_R0X06_Value2200 _ENABLE*_RT0X81_Request_0X06 //;Report
#define _RT0X81_R0X06_Value2300 _DISABLE*_RT0X81_Request_0X06 //;Physical
//_RT0X20_Request_0X01 clear_feature
#define _RT0X20_R0X01_Value0000 _ENABLE*_RT0X20_Request_0X01 //;c_hub_local_power
#define _RT0X20_R0X01_Value0100 _ENABLE*_RT0X20_Request_0X01 //;c_hub_over_current
//--- USB CONSTANT ---//
//USB Constant
//standard request codes
#define request_get_status 0
#define request_clear_feature 1
#define request_get_state 2
#define request_set_feature 3
#define request_set_address 5
#define request_get_descriptor 6
#define request_set_descriptor 7
#define request_get_configuration 8
#define request_set_configuration 9
#define request_get_interface 10
#define request_set_interface 11
#define request_synch_frame 12
//extra request codes
#define request_get_capability 1
#define request_get_report 1
#define request_get_idle 2
#define request_get_protocol 3
#define request_set_report 9
#define request_set_idle 0x0A
#define request_set_protocol 0x0B
//standard descriptor types
#define descriptor_types_device 1
#define descriptor_types_configuration 2
#define descriptor_types_string 3
#define descriptor_types_interface 4
#define descriptor_types_endpoint 5
#define descriptor_types_HID 0x21
#define descriptor_types_Report 0x22
#define descriptor_types_Physical 0x23
//Standard feature selectors
#define endpoint_stalled 0
#define device_remote_wakeup 1
//Hub feature selectors
#define c_hub_local_power 0
#define c_hub_over_current 1
//Port feature selectors
#define port_connection 0
#define port_enable 1
#define port_suspend 2
#define port_over_current 3
#define port_reset 4
#define port_power 8
#define port_low_speed 9
#define c_port_connection 16
#define c_port_enable 17
#define c_port_suspend 18
#define c_port_over_current 19
#define c_port_reset 20
//endpoint number
#define hub_endpoint00 0x00
#define hub_endpoint01 0x01
#define hub_endpoint80 0x80
#define hub_endpoint81 0x81
#include <usb_descriptor.h>
#pragma Use_usb_lib
// Declaration for Device configure descriptor //
struct DeviceConfigureDescriptor {
unsigned char _USB_CD_bLength;
unsigned char _USB_CD_bDescriptorType;
unsigned int _USB_CD_wTotalLength;
unsigned char _USB_CD_bNumInterface;
unsigned char _USB_CD_bConfigurationValue;
unsigned char _USB_CD_iConfiguration;
unsigned char _USB_CD_bmAttributes;
unsigned char _USB_CD_MaxPower;
// InterfaceDescriptor for interface 0 alternate setting 0//
unsigned char _USB_ID_bLength_0_0;
unsigned char _USB_ID_bDescriptorType_0_0;
unsigned char _USB_ID_bInterfaceNumber_0_0;
unsigned char _USB_ID_bAlternateSetting_0_0;
unsigned char _USB_ID_bNumEndpoints_0_0;
unsigned char _USB_ID_bInterfaceClass_0_0;
unsigned char _USB_ID_bInterfaceSubClass_0_0;
unsigned char _USB_ID_bInterfaceProtocol_0_0;
unsigned char _USB_ID_iInterface_0_0;
// Endpoint 1 Descriptor for interface 0 alternate setting 0 //
unsigned char _USB_ED_bLength_1_0_0;
unsigned char _USB_ED_bDescriptorType_1_0_0;
unsigned char _USB_ED_bEndpointAddress_1_0_0;
unsigned char _USB_ED_bmAttributes_1_0_0;
unsigned int _USB_ED_wMaxPacketSize_1_0_0;
unsigned char _USB_ED_bInterval_1_0_0;
// Endpoint 2 Descriptor for interface 0 alternate setting 0 //
unsigned char _USB_ED_bLength_2_0_0;
unsigned char _USB_ED_bDescriptorType_2_0_0;
unsigned char _USB_ED_bEndpointAddress_2_0_0;
unsigned char _USB_ED_bmAttributes_2_0_0;
unsigned int _USB_ED_wMaxPacketSize_2_0_0;
unsigned char _USB_ED_bInterval_2_0_0;
};
// struct for descriptor
// Hub device descriptor table
#if _USB_HUB
const struct HubDeviceDescriptor Hub_device_desc_table =
{
ET_USB_HD_bLength,
ET_USB_HD_bDescriptorType,
ET_USB_HD_bcdUSB,
ET_USB_HD_bDeviceClass,
ET_USB_HD_bDeviceSubClass,
ET_USB_HD_bDeviceProtocol,
ET_USB_HD_bMaxPacketSize0,
ET_USB_HD_idVender,
ET_USB_HD_idProduct,
ET_USB_HD_bcdDevice,
ET_USB_HD_iManufacture,
ET_USB_HD_iProduct,
ET_USB_HD_iSerialNumber,
ET_USB_HD_bNumConfiguration
};
// Hub configure descriptor table //
const struct HubConfigureDescriptor Hub_config_desc_table=
{
ET_USB_HC_bLength,
ET_USB_HC_bDescriptorType,
ET_USB_HC_wTotalLength,
ET_USB_HC_bNumInterface,
ET_USB_HC_bConfigurationValue,
ET_USB_HC_iConfiguration,
ET_USB_HC_bmAttributes,
ET_USB_HC_MaxPower,
ET_USB_HI_bLength,
ET_USB_HI_bDescriptorType,
ET_USB_HI_bInterfaceNumber,
ET_USB_HI_bAlternateSetting,
ET_USB_HI_bNumEndpoints,
ET_USB_HI_bInterfaceClass,
ET_USB_HI_bInterfaceSubClass,
ET_USB_HI_bInterfaceProtocol,
ET_USB_HI_iInterface,
ET_USB_HE_bLength1,
ET_USB_HE_bDescriptorType1,
ET_USB_HE_bEndpointAddress1,
ET_USB_HE_bmAttributes1,
ET_USB_HE_wMaxPacketSize1,
ET_USB_HE_bInterval1
};
// definition for Hub class descriptor table //
const struct HubClassDescriptor Hub_class_desc_table =
{
ET_USB_HU_bDescLength,
ET_USB_HU_bDescriptorType,
ET_USB_HU_bNbrPorts,
ET_USB_HU_bHubCharacteristics,
ET_USB_HU_bPwrOn2PwrGood,
ET_USB_HU_bHubContrCurrent,
ET_USB_HU_DeviceRemovable,
ET_USB_HU_PortPwrCtrlMask
};
#endif
const struct DeviceDescriptor Fc_device_desc_table =
{
ET_USB_DD_bLength,
ET_USB_DD_bDescriptorType,
ET_USB_DD_bcdUSB,
ET_USB_DD_bDeviceClass,
ET_USB_DD_bDeviceSubClass,
ET_USB_DD_bDeviceProtocol,
ET_USB_DD_bMaxPacketSize0,
ET_USB_DD_idVender,
ET_USB_DD_idProduct,
ET_USB_DD_bcdDevice,
ET_USB_DD_iManufacture,
ET_USB_DD_iProduct,
ET_USB_DD_iSerialNumber,
ET_USB_DD_bNumConfiguration
};
// definition for Device configure descriptor //
const struct DeviceConfigureDescriptor Fc_config_desc_table =
{
ET_USB_CD_bLength,
ET_USB_CD_bDescriptorType,
ET_USB_CD_wTotalLength,
ET_USB_CD_bNumInterface,
ET_USB_CD_bConfigurationValue,
ET_USB_CD_iConfiguration,
ET_USB_CD_bmAttributes,
ET_USB_CD_MaxPower,
ET_USB_ID_bLength_0_0,
ET_USB_ID_bDescriptorType_0_0,
ET_USB_ID_bInterfaceNumber_0_0,
ET_USB_ID_bAlternateSetting_0_0,
ET_USB_ID_bNumEndpoints_0_0,
ET_USB_ID_bInterfaceClass_0_0,
ET_USB_ID_bInterfaceSubClass_0_0,
ET_USB_ID_bInterfaceProtocol_0_0,
ET_USB_ID_iInterface_0_0,
ET_USB_ED_bLength_1_0_0,
ET_USB_ED_bDescriptorType_1_0_0,
ET_USB_ED_bEndpointAddress_1_0_0,
ET_USB_ED_bmAttributes_1_0_0,
ET_USB_ED_wMaxPacketSize_1_0_0,
ET_USB_ED_bInterval_1_0_0,
ET_USB_ED_bLength_2_0_0,
ET_USB_ED_bDescriptorType_2_0_0,
ET_USB_ED_bEndpointAddress_2_0_0,
ET_USB_ED_bmAttributes_2_0_0,
ET_USB_ED_wMaxPacketSize_2_0_0,
ET_USB_ED_bInterval_2_0_0
};
// definition for Language ID table //
const struct StringLanguageId String_langid_table =
{
4,
descriptor_types_string,
ET_USB_String_LANGUAGE_ID
};
// definition for manufacture string table //
const struct StringIndexTable String_index_DManufacture_table =
{
ET_USB_Manufacture_Length,
descriptor_types_string,
ET_USB_Manufacture_String
};
// definition for Product string table //
const struct StringIndexTable String_index_DProduct_table =
{
ET_USB_Product_Length,
descriptor_types_string,
ET_USB_Product_String
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -