?? u_u_setting.inc
字號:
LIBRARY_VERSION == 200 ;
//MACRO SETTING
_ENABLE == 1 ;
_DISABLE == 0 ;
_IN_DIR == 1 ;
_OUT_DIR == 0 ;
_UN_USE_MODE == 0 ;
_ISO_MODE == 1 ;
_BULK_MODE == 2 ;
_INT_MODE == 3 ;
//---Program Setting---//
//---USB INT STACK---//
_USB_DIS_ANO_INT == _ENABLE ;// DISABLE another INT during USB INT happened
_USB_AUTO_SET_PAGE == _ENABLE ;// USB INT in PAGE0
_USB_AUTO_SET_BANK == _ENABLE ;// USB all register in BANK1
_USB_AUTO_STORE_IAP0 == _ENABLE ;// Store Main program IAP0
USB_BANK == 0x01 ;
//---USB FUNCTION SETTING---//
//USB FUNCTION: HUB(+Embedded) or DEVICE
_USB_HUB == _DISABLE ;// Keyboard/Mouse need
_USB_DEVICE == _ENABLE ;//EMBEDDED FUNCTION
_USB_DOWNSTREAM_NO == 0x03 ;// M210/R110/R310 have 3/2/0 Downstream Port
//USB Speed
_USB_FULL_SPEED == _ENABLE ;// usb speed
_USB_LOW_SPEED == _DISABLE ;// usb speed
//USB HID function
_USB_HID == _DISABLE ;// Keyboard/Mouse need
//USB EndPoint
_USB_HEP0RX_SIZE == 0x08 ;
_USB_HEP0TX_SIZE == 0x08 ;
_USB_HEP1 == _ENABLE*_USB_HUB ;
_USB_HEP1_DIR == _IN_DIR ;
_USB_HEP1_MODE == _INT_MODE ;
_USB_HEP1_SIZE == 0x01 ;
// Endpoint Enable
_USB_EP0 == _ENABLE ;
_USB_EP1 == _ENABLE ;
_USB_EP2 == _ENABLE ;
_USB_EP3 == _DISABLE ;
// Endpoint Direction
_USB_EP1_DIR == _IN_DIR ;
_USB_EP2_DIR == _OUT_DIR ;
_USB_EP3_DIR == _IN_DIR ;
// Endpoint Transfer Mode
_USB_EP1_MODE == _BULK_MODE ;
_USB_EP2_MODE == _BULK_MODE ;
_USB_EP3_MODE == _UN_USE_MODE ;
// Endpoint Max Size
_USB_EP0RX_SIZE == 0x40 ;
_USB_EP0TX_SIZE == 0x40 ;
_USB_EP1_CON == 32*_USB_EP1+4*_USB_EP1_DIR+_USB_EP1_MODE ;
_USB_EP2_CON == 32*_USB_EP2+4*_USB_EP2_DIR+_USB_EP2_MODE ;
_USB_EP3_CON == 32*_USB_EP3+4*_USB_EP3_DIR+_USB_EP3_MODE ;
//---USB HUB DESCRIPTOR---//
//USB STANDARD HUB DESCRIPTOR
_USB_HD_bLength == 0x12 ;1 BYTE
_USB_HD_bDescriptorType == 0x01 ;1 BYTE
_USB_HD_bcdUSB == 0x0110 ;2 BYTES USB1.1
_USB_HD_bDeviceClass == 0x09 ;1 BYTE Class code
_USB_HD_bDeviceSubClass == 0x00 ; BYTE Subclass code
_USB_HD_bDeviceProtocol == 0x00 ;1 BYTE Protocol code
_USB_HD_bMaxPacketSize0 == 0x08 ;1 BYTE Max. packet size for HEP0 = 8 bytes
_USB_HD_idVender == 0x102C ;// Hub Vid
_USB_HD_idProduct == 0xFFFF ;// Hub Pid
_USB_HD_bcdDevice == 0x0001 ;2 BYTE Device release number
_USB_HD_iManufacture == 0x00*_USB_HUB ;1 BYTE Mfr string descriptor index
_USB_HD_iProduct == 0x00*_USB_HUB ;BYTE Product string descriptor index
_USB_HD_iSerialNumber == 0x00*_USB_HUB ;1 BYTE Serial Number string descriptor index
_USB_HD_bNumConfiguration == 0x01 ;1 BYTE Number of possible configurations
//USB STANDARD HUB CONFIGURATION DESCRIPTOR
_USB_HC_bLength == 0x09 ;1 BYTE Descriptor length
_USB_HC_bDescriptorType == 0x02 ;1 BYTE Descriptor type
_USB_HC_wTotalLength == 0x0019 ;2 BYTES Total data length
_USB_HC_bNumInterface == 0x01 ;1 BYTE Interface supported
_USB_HC_bConfigurationValue == 0x01 ;1 BYTE Configuration value
_USB_HC_iConfiguration == 0x00*_USB_HUB ;1 BYTE Index of string descriptor
_USB_HC_bmAttributes == 0x80 ;1 BYTE Configuration (bus powered)
_USB_HC_MaxPower == 0x20 ;1 BYTE Maximum power consumption (mA)
////USB STANDARD HUB INTERFACE DESCRIPTOR
_USB_HI_bLength == 0x09 ;1 BYTE Descriptor length
_USB_HI_bDescriptorType == 0x04 ;1 BYTE Descriptor type
_USB_HI_bInterfaceNumber == 0x00 ;1 BYTE Number of interface
_USB_HI_bAlternateSetting == 0x00 ;1 BYTE Alternate setting
_USB_HI_bNumEndpoints == 0x01 ;1 BYTE Number of interface endpoint
_USB_HI_bInterfaceClass == 0x09 ;1 BYTE Class code
_USB_HI_bInterfaceSubClass == 0x00 ;1 BYTE Subclass code
_USB_HI_bInterfaceProtocol == 0x00 ; BYTE Protocol code
_USB_HI_iInterface == 0x00*_USB_HUB ;1 BYTE Index of string
//USB STANDARD HUB ENDPOINT DESCRIPTOR
_USB_HE_bLength1 == 0x07 ;1 BYTE Descriptor length
_USB_HE_bDescriptorType1 == 0x05 ;1 BYTE Descriptor type
_USB_HE_bEndpointAddress1 == _USB_HEP1_DIR*128+_USB_HEP1*1 ;1 BYTE Encoded address
_USB_HE_bmAttributes1 == _USB_HEP1_MODE ;1 BYTE Endpoint attribute
_USB_HE_wMaxPacketSize1 == _USB_HEP1_SIZE ;2 BYTE Maximum packet size
_USB_HE_bInterval1 == 0xFF ;1 BYTE Polling interval
//USB STANDARD HUB DESCRIPTOR
_USB_HU_bDescLength == 0x09 ;1 BYTE Descriptor length
_USB_HU_bDescriptorType == 0x29 ;1 BYTE Descriptor type
_USB_HU_bNbrPorts == _USB_DEVICE+_USB_DOWNSTREAM_NO ;1 BYTE Downstram ports
_USB_HU_bHubCharacteristics == 0x000D ;2 BYTE individual power switch & current protect
_USB_HU_bPwrOn2PwrGood == 0x32 ;1 BYTE Power-on time (50*2ms=100ms)
_USB_HU_bHubContrCurrent == 0x40 ;1 BYTE Max current for HUB (100mA)
_USB_HU_DeviceRemovable == 0x02 ;1 BYTE DeviceRemovable (removable)
_USB_HU_PortPwrCtrlMask == 0x0E ;1 BYTE PortPwrCtrlMask
//---USB DEVICE DESCRIPTOR---//
//USB STANDARD DEVICE DESCRIPTOR
_USB_DD_bLength == 0x12 ;1 BYTE
_USB_DD_bDescriptorType == 0x01 ;1 BYTE
_USB_DD_bcdUSB == 0x0110 ;// 2Bytes bcdUSB
_USB_DD_bDeviceClass == 0x00 ;// 1 BYTE Class code
_USB_DD_bDeviceSubClass == 0x00 ;// 1Bytes Subclass code
_USB_DD_bDeviceProtocol == 0x00 ;// 1Bytes Protocol code
_USB_DD_bMaxPacketSize0 == 0x40 ;// 1Byte Max. packet size for EP0 = 64 bytes
_USB_DD_idVender == 0x102C ;// 2Bytes Vender ID
_USB_DD_idProduct == 0xFF00 ;// 2Bytes Product ID
_USB_DD_bcdDevice == 0x100 ;// 2Bytes Device release number
_USB_DD_iManufacture == 0x01 ;// 1Byte Mfr string descriptor index
_USB_DD_iProduct == 0x02 ;// 1Byte Product string descriptor index
_USB_DD_iSerialNumber == 0x00 ;// 1Byte Serial Number string descriptor index
_USB_DD_bNumConfiguration == 0x01 ;1 BYTE Number of configurations
//USB STANDARD CONFIGURATION DESCRIPTOR
_USB_CD_bLength == 0x09 ;1 BYTE Descriptor length
_USB_CD_bDescriptorType == 0x02 ;1 BYTE Descriptor type
_USB_CD_wTotalLength == 0x0020 ;// Configuration Descriptor total length
_USB_CD_bNumInterface == 0x01 ;// 1 BYTE Interface supported
_USB_CD_bConfigurationValue == 0x01 ;// 1 BYTE Configuration value
_USB_CD_iConfiguration == 0x00 ;// 1 BYTE Index of string descriptor
_USB_CD_bmAttributes == 0xA0 ;// 1 BYTE Configuration (bus powered)
_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
_USB_ID_bLength_0_0 == 0x09 ;
_USB_ID_bDescriptorType_0_0 == 0x04 ;
_USB_ID_bInterfaceNumber_0_0 == 0x00 ;//
_USB_ID_bAlternateSetting_0_0 == 0x00 ;// 1 BYTE Alternate setting
_USB_ID_bNumEndpoints_0_0 == 0x02 ;//
_USB_ID_bNumEndpoints_0_0 == 0x02 ;//
_USB_ID_bInterfaceClass_0_0 == 0x08 ;// 1 BYTE Class code (HID)
_USB_ID_bInterfaceSubClass_0_0 == 0x06 ;// 1 BYTE Subclass code (Boot Interface)
_USB_ID_bInterfaceProtocol_0_0 == 0x50 ;// 1 BYTE Protocol code (Keyboard)
_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
_USB_ED_bLength_1_0_0 == 0x07 ;1 BYTE Descriptor length
_USB_ED_bDescriptorType_1_0_0 == 0x05 ;1 BYTE Descriptor type
_USB_ED_bEndpointAddress_1_0_0 == _USB_EP1_DIR*128+_USB_EP1*1 ;1 BYTE Encoded address
_USB_ED_bmAttributes_1_0_0 == _USB_EP1_MODE ;1 BYTE Endpoint attribute
_USB_ED_wMaxPacketSize_1_0_0 == 0x0040 ;// 2 BYTES Maximum packet size
_USB_ED_bInterval_1_0_0 == 0x00 ;// 1 BYTE Polling interval
//Usb Standard Endpoint Descriptor for Interface:0 Alternate:0 Endpoint:2
_USB_ED_bLength_2_0_0 == 0x07 ;1 BYTE Descriptor length
_USB_ED_bDescriptorType_2_0_0 == 0x05 ;1 BYTE Descriptor type
_USB_ED_bEndpointAddress_2_0_0 == _USB_EP2_DIR*128+_USB_EP2*2 ;1 BYTE Encoded address
_USB_ED_bmAttributes_2_0_0 == _USB_EP2_MODE ;1 BYTE Endpoint attribute
_USB_ED_wMaxPacketSize_2_0_0 == 0x0040 ;// 2 BYTES Maximum packet size
_USB_ED_bInterval_2_0_0 == 0x00 ;// 1 BYTE Polling interval
//---USB STRING DESCRIPTOR---//
if _USB_HD_iManufacture+_USB_HD_iProduct+_USB_HD_iSerialNumber+_USB_HC_iConfiguration+_USB_HI_iInterface+_USB_DD_iManufacture+_USB_DD_iProduct+_USB_DD_iSerialNumber+_USB_CD_iConfiguration == _DISABLE
_USB_STRING_INDEX == _DISABLE ;
else
_USB_STRING_INDEX == _ENABLE ;
endif
_USB_String_LANGUAGE_ID == 0x0409 ;
_USB_Manufacture_String == "ETOMS" ;
_USB_Manufacture_Length == 5*2+2 ;_USB_Manufacture_String length*2+2
_USB_Product_String == "Usb Device" ;
_USB_Product_Length == 10*2+2 ;_USB_Product_String length*2+2
_USB_SerialNumber_String == "" ;
_USB_SerialNumber_Length == 0 ;_USB_SerialNumber_String length*2+2
//Include USB Command Setting. Source File:C:\Program Files\ETOMS\USB Library Generator\command_setting.h
//---USB COMMAND (RequestType)---//
//USB Command
//USB Command bmRequestType: STANDARD
_RequestType_0X00 == _ENABLE
_RequestType_0X01 == _ENABLE
_RequestType_0X02 == _ENABLE
_RequestType_0X80 == _ENABLE
_RequestType_0X81 == _ENABLE
_RequestType_0X82 == _ENABLE
_RequestType_0X20 == _ENABLE
_RequestType_0X21 == _ENABLE
_RequestType_0X23 == _ENABLE
_RequestType_0XA0 == _ENABLE
_RequestType_0XA3 == _ENABLE
_RequestType_0XA1 == _ENABLE
//---USB COMMAND (Request)---//
//_RequestType_0X00
_RT0X00_Request_0X01 == _ENABLE*_RequestType_0X00 ;clear_feature
_RT0X00_Request_0X03 == _ENABLE*_RequestType_0X00 ;set_feature
_RT0X00_Request_0X05 == _ENABLE*_RequestType_0X00 ;set_address
_RT0X00_Request_0X07 == _DISABLE*_RequestType_0X00 ;set_descriptor
_RT0X00_Request_0X09 == _ENABLE*_RequestType_0X00 ;set_configuration
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -