⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 et_easy_usb_bulk_c_setting.h

📁 ET44 Bulk transfer is a simple USB(bulk mode)device tester package. There are firmware, software and
💻 H
📖 第 1 页 / 共 2 页
字号:
/************************************************************************************************************************/
/*                                                                                                                      */
/*          USb Library setting file create by ETOMS usb library generator V2.00                                        */
/*          Output file E:\Bulk_testr_simple\firmware_bulk_byc\usb_bulk_c_setting.h                                     */
/*          Binary file E:\Bulk_testr_simple\firmware_bulk_byc\usb_bulk_c_setting_lib.bin                               */
/*                                                                                                                      */
/************************************************************************************************************************/
#define  LIBRARY_VERSION   200                // 

//MACRO SETTING


#define  _ENABLE          1                   // 
#define  _DISABLE         0                   // 


#define  _IN_DIR          1                   // 
#define  _OUT_DIR         0                   // 


#define  _UN_USE_MODE     0                   // 
#define  _ISO_MODE        1                   // 
#define  _BULK_MODE       2                   // 
#define  _INT_MODE        3                   // 


//---Program Setting---//
//---USB INT STACK---//
#define  _USB_DIS_ANO_INT                     _DISABLE                //// DISABLE another INT during USB INT happened
#define  _USB_AUTO_SET_PAGE                   _DISABLE                //// USB INT in PAGE0
#define  _USB_AUTO_SET_BANK                   _DISABLE                //// USB all register in BANK1
#define  _USB_AUTO_STORE_IAP0                 _DISABLE                //// Store Main program IAP0
#define  USB_BANK                             0x01                    //

//---USB FUNCTION SETTING---//
//USB FUNCTION: HUB(+Embedded) or DEVICE
#define  _USB_HUB                             _DISABLE                //// Keyboard/Mouse need
#define  _USB_DEVICE                          _ENABLE                 ////EMBEDDED FUNCTION
#define  _USB_DOWNSTREAM_NO                   0x03                    //// M210/R110/R310 have 3/2/0 Downstream Port

//USB Speed
#define  _USB_FULL_SPEED                      _ENABLE                 //// usb speed
#define  _USB_LOW_SPEED                       _DISABLE                //// usb speed

//USB HID function
#define  _USB_HID                             _DISABLE                //// Keyboard/Mouse need

//USB EndPoint
#define  _USB_HEP0RX_SIZE                     0x08                    // 
#define  _USB_HEP0TX_SIZE                     0x08                    // 
#define  _USB_HEP1                            _ENABLE*_USB_HUB        // 
#define  _USB_HEP1_DIR                        _IN_DIR                 // 
#define  _USB_HEP1_MODE                       _INT_MODE               // 
#define  _USB_HEP1_SIZE                       0x01                    // 

// Endpoint Enable
#define  _USB_EP0                             _ENABLE                 // 
#define  _USB_EP1                             _ENABLE                 // 
#define  _USB_EP2                             _ENABLE                 // 
#define  _USB_EP3                             _DISABLE                // 

// Endpoint Direction
#define  _USB_EP1_DIR                         _IN_DIR                 // 
#define  _USB_EP2_DIR                         _OUT_DIR                // 
#define  _USB_EP3_DIR                         _IN_DIR                 // 
// Endpoint Transfer Mode
#define  _USB_EP1_MODE                        _BULK_MODE              // 
#define  _USB_EP2_MODE                        _BULK_MODE              // 
#define  _USB_EP3_MODE                        _UN_USE_MODE            // 

// Endpoint Max Size
#define  _USB_EP0RX_SIZE                      0x40                    // 
#define  _USB_EP0TX_SIZE                      0x40                    // 

#define  _USB_EP1_CON                         32*_USB_EP1+4*_USB_EP1_DIR+_USB_EP1_MODE  // 
#define  _USB_EP2_CON                         32*_USB_EP2+4*_USB_EP2_DIR+_USB_EP2_MODE  // 
#define  _USB_EP3_CON                         32*_USB_EP3+4*_USB_EP3_DIR+_USB_EP3_MODE  // 

//---USB HUB DESCRIPTOR---//
//USB STANDARD HUB DESCRIPTOR
#define  ET_USB_HD_bLength                    0x12          //1 BYTE
#define  ET_USB_HD_bDescriptorType            0x01          //1 BYTE
#define  ET_USB_HD_bcdUSB                     0x0110        //2 BYTES USB1.1
#define  ET_USB_HD_bDeviceClass               0x09          //1 BYTE Class code
#define  ET_USB_HD_bDeviceSubClass            0x00          // BYTE Subclass code
#define  ET_USB_HD_bDeviceProtocol            0x00          //1 BYTE Protocol code
#define  ET_USB_HD_bMaxPacketSize0            0x08          //1 BYTE Max. packet size for HEP0 = 8 bytes
#define  ET_USB_HD_idVender                   0x102C        //// Hub Vid
#define  ET_USB_HD_idProduct                  0xFFFF        //// Hub Pid
#define  ET_USB_HD_bcdDevice                  0x0001        //2 BYTE Device release number
#define  ET_USB_HD_iManufacture               0x00*_USB_HUB //1 BYTE Mfr string descriptor index
#define  ET_USB_HD_iProduct                   0x00*_USB_HUB //BYTE Product string descriptor index
#define  ET_USB_HD_iSerialNumber              0x00*_USB_HUB //1 BYTE Serial Number string descriptor index
#define  ET_USB_HD_bNumConfiguration          0x01          //1 BYTE Number of possible configurations

//USB STANDARD HUB CONFIGURATION DESCRIPTOR
#define  ET_USB_HC_bLength                    0x09          //1 BYTE Descriptor length
#define  ET_USB_HC_bDescriptorType            0x02          //1 BYTE Descriptor type
#define  ET_USB_HC_wTotalLength               0x0019        //2 BYTES Total data length
#define  ET_USB_HC_bNumInterface              0x01          //1 BYTE Interface supported
#define  ET_USB_HC_bConfigurationValue        0x01          //1 BYTE Configuration value
#define  ET_USB_HC_iConfiguration             0x00*_USB_HUB //1 BYTE Index of string descriptor
#define  ET_USB_HC_bmAttributes               0x80          //1 BYTE Configuration (bus powered)
#define  ET_USB_HC_MaxPower                   0x20          //1 BYTE Maximum power consumption (mA)

////USB STANDARD HUB INTERFACE DESCRIPTOR
#define  ET_USB_HI_bLength                    0x09          //1 BYTE Descriptor length
#define  ET_USB_HI_bDescriptorType            0x04          //1 BYTE Descriptor type
#define  ET_USB_HI_bInterfaceNumber           0x00          //1 BYTE Number of interface
#define  ET_USB_HI_bAlternateSetting          0x00          //1 BYTE Alternate setting
#define  ET_USB_HI_bNumEndpoints              0x01          //1 BYTE Number of interface endpoint
#define  ET_USB_HI_bInterfaceClass            0x09          //1 BYTE Class code
#define  ET_USB_HI_bInterfaceSubClass         0x00          //1 BYTE Subclass code
#define  ET_USB_HI_bInterfaceProtocol         0x00          // BYTE Protocol code
#define  ET_USB_HI_iInterface                 0x00*_USB_HUB //1 BYTE Index of string

//USB STANDARD HUB ENDPOINT DESCRIPTOR
#define  ET_USB_HE_bLength1                   0x07          //1 BYTE Descriptor length
#define  ET_USB_HE_bDescriptorType1           0x05          //1 BYTE Descriptor type
#define  ET_USB_HE_bEndpointAddress1          _USB_HEP1_DIR*128+_USB_HEP1*1  //1 BYTE Encoded address
#define  ET_USB_HE_bmAttributes1              _USB_HEP1_MODE  //1 BYTE Endpoint attribute
#define  ET_USB_HE_wMaxPacketSize1            _USB_HEP1_SIZE  //2 BYTE Maximum packet size
#define  ET_USB_HE_bInterval1                 0xFF          //1 BYTE Polling interval

//USB STANDARD HUB DESCRIPTOR
#define  ET_USB_HU_bDescLength                0x09          //1 BYTE Descriptor length
#define  ET_USB_HU_bDescriptorType            0x29          //1 BYTE Descriptor type
#define  ET_USB_HU_bNbrPorts                  _USB_DEVICE+_USB_DOWNSTREAM_NO  //1 BYTE Downstram ports
#define  ET_USB_HU_bHubCharacteristics        0x000D        //2 BYTE individual power switch & current protect
#define  ET_USB_HU_bPwrOn2PwrGood             0x32          //1 BYTE Power-on time (50*2ms=100ms)
#define  ET_USB_HU_bHubContrCurrent           0x40          //1 BYTE Max current for HUB (100mA)
#define  ET_USB_HU_DeviceRemovable            0x02          //1 BYTE DeviceRemovable (removable)
#define  ET_USB_HU_PortPwrCtrlMask            0x0E          //1 BYTE PortPwrCtrlMask

//---USB DEVICE DESCRIPTOR---//
//USB STANDARD DEVICE DESCRIPTOR
#define  ET_USB_DD_bLength                    0x12          //1 BYTE
#define  ET_USB_DD_bDescriptorType            0x01          //1 BYTE
#define  ET_USB_DD_bcdUSB                     0x0110        //// 2Bytes bcdUSB
#define  ET_USB_DD_bDeviceClass               0x00          //// 1 BYTE	Class code
#define  ET_USB_DD_bDeviceSubClass            0x00          //// 1Bytes Subclass code
#define  ET_USB_DD_bDeviceProtocol            0x00          //// 1Bytes Protocol code
#define  ET_USB_DD_bMaxPacketSize0            0x40          //// 1Byte Max. packet size for EP0 = 64 bytes
#define  ET_USB_DD_idVender                   0x102C        //// 2Bytes Vender ID
#define  ET_USB_DD_idProduct                  0xFF07        //// 2Bytes Product ID
#define  ET_USB_DD_bcdDevice                  0x100         //// 2Bytes Device release number
#define  ET_USB_DD_iManufacture               0x01          //// 1Byte Mfr string descriptor index
#define  ET_USB_DD_iProduct                   0x02          //// 1Byte Product string descriptor index
#define  ET_USB_DD_iSerialNumber              0x00          //// 1Byte Serial Number string descriptor index
#define  ET_USB_DD_bNumConfiguration          0x01          //1 BYTE Number of configurations

//USB STANDARD CONFIGURATION DESCRIPTOR
#define  ET_USB_CD_bLength                    0x09          //1 BYTE Descriptor length
#define  ET_USB_CD_bDescriptorType            0x02          //1 BYTE Descriptor type
#define  ET_USB_CD_wTotalLength               0x0020        //// Configuration Descriptor total length
#define  ET_USB_CD_bNumInterface              0x01          //// 1 BYTE Interface supported
#define  ET_USB_CD_bConfigurationValue        0x01          //// 1 BYTE Configuration value
#define  ET_USB_CD_iConfiguration             0x00          //// 1 BYTE Index of string descriptor
#define  ET_USB_CD_bmAttributes               0xA0          //// 1 BYTE Configuration (bus powered)
#define  ET_USB_CD_MaxPower                   0x32          //// 1 BYTE Maximum power consumption (mA)

//Usb Standard Interface Descriptor for Interface:0 Alternate:0
//Syntax  : Descriptor_Type_nInterface_nAlternate
//example : _USB_DD_bLength_0_0   ; usb device length for interface 0 alternate 0
#define  ET_USB_ID_bLength_0_0                0x09          // 
#define  ET_USB_ID_bDescriptorType_0_0        0x04          // 
#define  ET_USB_ID_bInterfaceNumber_0_0       0x00          ////
#define  ET_USB_ID_bAlternateSetting_0_0      0x00          //// 1 BYTE	Alternate setting
#define  ET_USB_ID_bNumEndpoints_0_0          0x02          ////
#define  ET_USB_ID_bNumEndpoints_0_0          0x02          ////
#define  ET_USB_ID_bInterfaceClass_0_0        0x00          //// 1 BYTE	Class code (HID)
#define  ET_USB_ID_bInterfaceSubClass_0_0     0x00          //// 1 BYTE	Subclass code (Boot Interface)
#define  ET_USB_ID_bInterfaceProtocol_0_0     0x00          //// 1 BYTE	Protocol code (Keyboard)
#define  ET_USB_ID_iInterface_0_0             0x00          //// 1 BYTE	Index of string

//Usb Standard Endpoint Descriptor 
//Syntax  : Descriptor_Type_nEndpoint_nInterface_nAlternate
//example : _USB_ED_bLength_1_0_0   ; usb endpoint length for endpoint 1 interface 0 alternate 0

//Usb Standard Endpoint Descriptor for Interface:0 Alternate:0 Endpoint:1
#define  ET_USB_ED_bLength_1_0_0              0x07          //1 BYTE Descriptor length
#define  ET_USB_ED_bDescriptorType_1_0_0      0x05          //1 BYTE Descriptor type
#define  ET_USB_ED_bEndpointAddress_1_0_0     _USB_EP1_DIR*128+_USB_EP1*1  //1 BYTE Encoded address
#define  ET_USB_ED_bmAttributes_1_0_0         _USB_EP1_MODE //1 BYTE Endpoint attribute
#define  ET_USB_ED_wMaxPacketSize_1_0_0       0x0040        //// 2 BYTES	Maximum packet size
#define  ET_USB_ED_bInterval_1_0_0            0x0A          //// 1 BYTE	Polling interval

//Usb Standard Endpoint Descriptor for Interface:0 Alternate:0 Endpoint:2
#define  ET_USB_ED_bLength_2_0_0              0x07          //1 BYTE Descriptor length
#define  ET_USB_ED_bDescriptorType_2_0_0      0x05          //1 BYTE Descriptor type
#define  ET_USB_ED_bEndpointAddress_2_0_0     _USB_EP2_DIR*128+_USB_EP2*2  //1 BYTE Encoded address
#define  ET_USB_ED_bmAttributes_2_0_0         _USB_EP2_MODE //1 BYTE Endpoint attribute
#define  ET_USB_ED_wMaxPacketSize_2_0_0       0x0040        //// 2 BYTES	Maximum packet size
#define  ET_USB_ED_bInterval_2_0_0            0x0A          //// 1 BYTE	Polling interval

//---USB STRING DESCRIPTOR---//
#if (ET_USB_HD_iManufacture || ET_USB_HD_iProduct || ET_USB_HD_iSerialNumber || ET_USB_HC_iConfiguration || ET_USB_HI_iInterface || ET_USB_DD_iManufacture || ET_USB_DD_iProduct || ET_USB_DD_iSerialNumber || ET_USB_CD_iConfiguration)
#define  ET_USB_STRING_INDEX                  _DISABLE      // 
#else
#define  ET_USB_STRING_INDEX                  _ENABLE       // 
#endif

#define  ET_USB_String_LANGUAGE_ID            0x0409        //
#define  ET_USB_Manufacture_String            "ETOMS"       // 
#define  ET_USB_Manufacture_Length            5*2+2         //_USB_Manufacture_String length*2+2
#define  ET_USB_Product_String                "Usb Bulk Tester"  // 
#define  ET_USB_Product_Length                15*2+2        //_USB_Product_String length*2+2
#define  ET_USB_SerialNumber_String           ""            // 
#define  ET_USB_SerialNumber_Length           0             //_USB_SerialNumber_String length*2+2

//Include USB Command Setting. Source File:E:\Usb_lib\c_command_setting.h
//---USB COMMAND (RequestType)---//
//USB Command
//USB Command bmRequestType: STANDARD
#define _RequestType_0X00  _ENABLE
#define _RequestType_0X01  _ENABLE
#define _RequestType_0X02  _ENABLE
#define _RequestType_0X80  _ENABLE
#define _RequestType_0X81  _ENABLE
#define _RequestType_0X82  _ENABLE
#define _RequestType_0X20  _ENABLE
#define _RequestType_0X21  _ENABLE
#define _RequestType_0X23  _ENABLE
#define _RequestType_0XA0  _ENABLE
#define _RequestType_0XA3  _ENABLE
#define _RequestType_0XA1  _ENABLE

//_RequestType_0X00
#define _RT0X00_Request_0X01  _RequestType_0X00        //;clear_feature
#define _RT0X00_Request_0X03  _ENABLE*_RequestType_0X00    	//;set_feature
#define _RT0X00_Request_0X05  _ENABLE*_RequestType_0X00    	//;set_address
#define _RT0X00_Request_0X07  _DISABLE*_RequestType_0X00    	//;set_descriptor
#define _RT0X00_Request_0X09  _ENABLE*_RequestType_0X00    	//;set_configuration

//_RequestType_0X01
#define _RT0X01_Request_0X0B	_ENABLE*_RequestType_0X01        //;set_interface

//_RequestType_0X02
#define _RT0X02_Request_0X01	_ENABLE*_RequestType_0X02    	//;clear_feature
#define _RT0X02_Request_0X03	_ENABLE*_RequestType_0X02    	//;set_feature

//_RequestType_0X80
#define _RT0X80_Request_0X00	_ENABLE*_RequestType_0X80    	//;get_status
#define _RT0X80_Request_0X06	_ENABLE*_RequestType_0X80    	//;get_descriptor
#define _RT0X80_Request_0X08	_ENABLE*_RequestType_0X80    	//;get_configuration

//_RequestType_0X81
#define _RT0X81_Request_0X00	_ENABLE*_RequestType_0X81    	//;get_status
#define _RT0X81_Request_0X06	_RequestType_0X81*_USB_HID    	//;get_descriptor
#define _RT0X81_Request_0X0A	_ENABLE*_RequestType_0X81    	//;get_interface

//_RequestType_0X82
#define _RT0X82_Request_0X00	_ENABLE*_RequestType_0X82    	//;get_status

//_RequestType_0X20
#define _RT0X20_Request_0X01	_ENABLE*_RequestType_0X20    	//;clear_feature
#define _RT0X20_Request_0X03	_ENABLE*_RequestType_0X20    	//;set_feature
#define _RT0X20_Request_0X06	_DISABLE*_RequestType_0X20   	//;set_descriptor

//_RequestType_0X21
#define _RT0X21_Request_0X09	_ENABLE*_RequestType_0X21    	//;set_report
#define _RT0X21_Request_0X0A	_ENABLE*_RequestType_0X21    	//;set_idle
#define _RT0X21_Request_0X0B	_ENABLE*_RequestType_0X21    	//;set_protocol
 
//_RequestType_0X23
#define _RT0X23_Request_0X01	_ENABLE*_RequestType_0X23    	//;clear_feature
#define _RT0X23_Request_0X03	_ENABLE*_RequestType_0X23    	//;set_feature

//_RequestType_0XA0
#define _RT0XA0_Request_0X00	_ENABLE*_RequestType_0XA0    	//;get_status
#define _RT0XA0_Request_0X06	_ENABLE*_RequestType_0XA0    	//;get_descriptor

//_RequestType_0XA1
#define _RT0XA1_Request_0X01	_ENABLE*_RequestType_0XA1    	//;get_report
#define _RT0XA1_Request_0X02	_ENABLE*_RequestType_0XA1    	//;get_idle
#define _RT0XA1_Request_0X03	_ENABLE*_RequestType_0XA1    	//;get_protocol

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -