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

📄 myusb_descr.asm

📁 实现2个ps/2接口转到1个USB接口功能
💻 ASM
📖 第 1 页 / 共 3 页
字号:
  TD_START_TABLE 1                               ; Only 1 Transfer Descriptor
  TD_ENTRY       USB_DS_RAM, myUSB_HID_RPT_2_IN_RPT_SIZE, myUSB_INTERFACE_1_IN_RPT_DATA, NULL_PTR
.ENDLITERAL
ENDIF ; WIZARD_DEFINED_REPORT_STORAGE
;----------------------------------------------------------------------
; HID OUT Report Transfer Descriptor Table for ()
;----------------------------------------------------------------------
IF WIZARD_DEFINED_REPORT_STORAGE
AREA  func_lit     (ROM,REL,CON)
.LITERAL
myUSB_D0_C1_I1_OUT_RPTS:                         
  TD_START_TABLE 1                               ; Only 1 Transfer Descriptor
  TD_ENTRY       USB_DS_RAM, myUSB_HID_RPT_2_OUT_RPT_SIZE, myUSB_INTERFACE_1_OUT_RPT_DATA, NULL_PTR
.ENDLITERAL
ENDIF ; WIZARD_DEFINED_REPORT_STORAGE
;----------------------------------------------------------------------
; HID FEATURE Report Transfer Descriptor Table for ()
;----------------------------------------------------------------------
IF WIZARD_DEFINED_REPORT_STORAGE
AREA  func_lit     (ROM,REL,CON)
.LITERAL
myUSB_D0_C1_I1_FEATURE_RPTS:                     
  TD_START_TABLE 1                               ; Only 1 Transfer Descriptor
  TD_ENTRY       USB_DS_RAM, myUSB_HID_RPT_2_FEATURE_RPT_SIZE, myUSB_INTERFACE_1_FEATURE_RPT_DATA, NULL_PTR
.ENDLITERAL
ENDIF ; WIZARD_DEFINED_REPORT_STORAGE
;----------------------------------------------------------------------

;----------------------------------------------------------------------
; Configuration Descriptor Table
;  for (myUSB_D0)
;
;	This table provides transfer descriptors for each USB Configuration
; Descriptor
;----------------------------------------------------------------------
AREA  func_lit     (ROM,REL,CON)
.LITERAL
myUSB_D0_CONFIG_DESCR_TABLE:                     ;
  TD_START_TABLE 1                               ; Number of configurations
  TD_ENTRY       USB_DS_ROM, myUSB_D0_C1_DESCR_SIZE, myUSB_D0_C1_DESCR_START, NULL_PTR
.ENDLITERAL

;----------------------------------------------------------------------
; Device Descriptor Table
;
;	This table provides transfer descriptors for each USB Device Descriptor
;----------------------------------------------------------------------
AREA  func_lit     (ROM,REL,CON)
EXPORT myUSB_DEVICE_DESCR_TABLE
.LITERAL
myUSB_DEVICE_DESCR_TABLE:                        
  TD_START_TABLE 1                               ; Number of devices
  TD_ENTRY       USB_DS_ROM, myUSB_D0_DESCR_SIZE, myUSB_D0_DESCR_START, NULL_PTR
.ENDLITERAL
;----------------------------------------------------------------------
;----------------------------------------------------------------------
; Interface 0 RAM Allocation (Reused across configurations)
;----------------------------------------------------------------------
IF WIZARD_DEFINED_REPORT_STORAGE
AREA  bss     (RAM,REL,CON)
;----------------------------------------------------------------------
; RAM allocation for IN Reports.
;----------------------------------------------------------------------
EXPORT _myUSB_INTERFACE_0_IN_RPT_DATA
EXPORT myUSB_INTERFACE_0_IN_RPT_DATA
_myUSB_INTERFACE_0_IN_RPT_DATA:                  
myUSB_INTERFACE_0_IN_RPT_DATA:                   
  BLK  8                                         ;
;----------------------------------------------------------------------
; RAM allocation for OUT Reports.
;----------------------------------------------------------------------
EXPORT _myUSB_INTERFACE_0_OUT_RPT_DATA
EXPORT myUSB_INTERFACE_0_OUT_RPT_DATA
_myUSB_INTERFACE_0_OUT_RPT_DATA:                 
myUSB_INTERFACE_0_OUT_RPT_DATA:                  
  BLK  8                                         ;
;----------------------------------------------------------------------
; RAM allocation for FEATURE Reports.
;----------------------------------------------------------------------
EXPORT _myUSB_INTERFACE_0_FEATURE_RPT_DATA
EXPORT myUSB_INTERFACE_0_FEATURE_RPT_DATA
_myUSB_INTERFACE_0_FEATURE_RPT_DATA:             
myUSB_INTERFACE_0_FEATURE_RPT_DATA:              
  BLK  8                                         ;
;----------------------------------------------------------------------
ENDIF  ; WIZARD_DEFINED_REPORT_STORAGE
;----------------------------------------------------------------------
; Interface 1 RAM Allocation (Reused across configurations)
;----------------------------------------------------------------------
IF WIZARD_DEFINED_REPORT_STORAGE
AREA  bss     (RAM,REL,CON)
;----------------------------------------------------------------------
; RAM allocation for IN Reports.
;----------------------------------------------------------------------
EXPORT _myUSB_INTERFACE_1_IN_RPT_DATA
EXPORT myUSB_INTERFACE_1_IN_RPT_DATA
_myUSB_INTERFACE_1_IN_RPT_DATA:                  
myUSB_INTERFACE_1_IN_RPT_DATA:                   
  BLK  8                                         ;
;----------------------------------------------------------------------
; RAM allocation for OUT Reports.
;----------------------------------------------------------------------
EXPORT _myUSB_INTERFACE_1_OUT_RPT_DATA
EXPORT myUSB_INTERFACE_1_OUT_RPT_DATA
_myUSB_INTERFACE_1_OUT_RPT_DATA:                 
myUSB_INTERFACE_1_OUT_RPT_DATA:                  
  BLK  8                                         ;
;----------------------------------------------------------------------
; RAM allocation for FEATURE Reports.
;----------------------------------------------------------------------
EXPORT _myUSB_INTERFACE_1_FEATURE_RPT_DATA
EXPORT myUSB_INTERFACE_1_FEATURE_RPT_DATA
_myUSB_INTERFACE_1_FEATURE_RPT_DATA:             
myUSB_INTERFACE_1_FEATURE_RPT_DATA:              
  BLK  8                                         ;
;----------------------------------------------------------------------
ENDIF  ; WIZARD_DEFINED_REPORT_STORAGE
;----------------------------------------------------------------------
; Device Descriptor (myUSB_D0)
; This marks the beginning of the Device Descriptor.  This descriptor
; concatenates all of the descriptors in the following format:
;	Device Descriptor
;		Configuration Descriptor (1)
;	  	Interface 1 Descriptor
;				HID Descriptor 1
;			  	Endpoint Descriptor(s)
;			Interface 2 Descriptor
;				HID Descriptor 2
;					Endpoint Descriptor(s)
;		Configuration Descriptor (2)
;			Interface/HID/Endpoint...
;----------------------------------------------------------------------
AREA  UserModules     (ROM,REL,CON)
.LITERAL
myUSB_D0_DESCR_START:                            ;
  DB    18                                       ; Device Descriptor Length (18)
  DB    1                                        ; bDescriptorType: DEVICE
  DWL   0200H                                    ; bcdUSB (ver 2.0)
  DB    0                                        ; bDeviceClass
  DB    0                                        ; bDeviceSubClass 
  DB    0                                        ; bDeviceProtocol 
  DB    8                                        ; bMaxPacketSize0
  DWL   04B4H                                    ; idVendor
  DWL   120FH                                    ; idProduct
  DWL   0100H                                    ; bcdDevice
  DB    STR_HASH_3                               ; iManufacturer
  DB    STR_HASH_3                               ; iProduct
  DB    STR_HASH_0                               ; iSerialNumber
  DB    1                                        ; bNumConfigurations
myUSB_D0_DESCR_END:                              ;
myUSB_D0_DESCR_SIZE:  EQU    myUSB_D0_DESCR_END - myUSB_D0_DESCR_START

;----------------------------------------------------------------------
; Configuration Descriptor (myUSB_D0_C1)
; This marks the beginning of the Configuration Descriptor.  This descriptor
; concatenates all of the descriptors in the following format:
; Configuration Descriptor
;	Interface 1 Descriptor
;		HID Descriptor 1
;			Endpoint Descriptor(s)
;	Interface 2 Descriptor
;		HID Descriptor 2
;			Endpoint Descriptor(s)
;----------------------------------------------------------------------
myUSB_D0_C1_DESCR_START:                         ;
  DB    9                                        ; Configuration Descriptor Length (9)
  DB    2                                        ; bDescriptorType: CONFIGURATION
  DWL   myUSB_D0_C1_DESCR_SIZE                   ; wTotalLength
  DB    2                                        ; bNumInterfaces
  DB    1                                        ; bConfigurationValue
  DB    STR_HASH_2                               ; iConfiguration
  DB    80H | (0 << 6) | (1 << 5)                ; bmAttributes >
  DB    25                                       ; bMaxPower
;----------------------------------------------------------------------
; Interface Descriptor (myUSB_D0_C1_I0)
;----------------------------------------------------------------------
  DB    9                                        ; Interface Descriptor Length (9)
  DB    4                                        ; bDescriptorType: INTERFACE
  DB    0                                        ; bInterfaceNumber (zero based)
  DB    0                                        ; bAlternateSetting
  DB    1                                        ; bNumEndpoints
  DB    3                                        ; bInterfaceClass
  DB    1                                        ; bInterfaceSubClass
  DB    2                                        ; bInterfaceProtocol
  DB    STR_HASH_2                               ; iInterface
;----------------------------------------------------------------------
; HID Class Descriptor (myUSB_D0_C1_I0)
;----------------------------------------------------------------------
myUSB_D0_C1_I0_HID_DESCR_START:                  
  DB    9                                        ; bLength--HID Class Descriptor Length (9)
  DB    0x21                                     ; bDescriptorType: HID Class
  DWL   0x0111                                   ; bcdHID
  DB    33                                       ; bCountryCode
  DB    1                                        ; bNumDescriptors
  DB    34                                       ; bDescriptorType
  DWL   myUSB_HID_REPORT_2_DESCR_SIZE            ; wDescriptorLength
;----------------------------------------------------------------------
; Endpoint Descriptor (myUSB_D0_C1_I0_E0)
;----------------------------------------------------------------------
  DB    7                                        ; Endpoint Descriptor Length (7)
  DB    5                                        ; bDescriptorType: ENDPOINT
  DB    (EP1 | USB_DIR_IN)                       ; bEndpointAddress
  DB    3                                        ; bmAttributes
  DWL   4                                        ; wMaxPacketSize
  DB    10                                       ; bInterval
;----------------------------------------------------------------------
; Interface Descriptor (myUSB_D0_C1_I1)
;----------------------------------------------------------------------
  DB    9                                        ; Interface Descriptor Length (9)
  DB    4                                        ; bDescriptorType: INTERFACE

⌨️ 快捷键说明

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