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

📄 myusb_descr.asm

📁 实现2个ps/2接口转到1个USB接口功能
💻 ASM
📖 第 1 页 / 共 3 页
字号:
  DB    1                                        ; bInterfaceNumber (zero based)
  DB    0                                        ; bAlternateSetting
  DB    1                                        ; bNumEndpoints
  DB    3                                        ; bInterfaceClass
  DB    1                                        ; bInterfaceSubClass
  DB    1                                        ; bInterfaceProtocol
  DB    STR_HASH_3                               ; iInterface
;----------------------------------------------------------------------
; HID Class Descriptor (myUSB_D0_C1_I1)
;----------------------------------------------------------------------
myUSB_D0_C1_I1_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_I1_E0)
;----------------------------------------------------------------------
  DB    7                                        ; Endpoint Descriptor Length (7)
  DB    5                                        ; bDescriptorType: ENDPOINT
  DB    (EP2 | USB_DIR_IN)                       ; bEndpointAddress
  DB    3                                        ; bmAttributes
  DWL   8                                        ; wMaxPacketSize
  DB    10                                       ; bInterval
;----------------------------------------------------------------------
myUSB_D0_C1_DESCR_END:
myUSB_D0_C1_DESCR_SIZE:	EQU	(myUSB_D0_C1_DESCR_END - myUSB_D0_C1_DESCR_START)
.ENDLITERAL
;----------------------------------------------------------------------
; HID Class Report Descriptors
;
; This section contains the HID Class Report Descriptors generated
; by the USB User Module Descriptor Generator
;
;----------------------------------------------------------------------
; HID Report Descriptor (HID_RPT_1}
;----------------------------------------------------------------------
AREA  UserModules     (ROM,REL,CON)
.LITERAL
myUSB_HID_REPORT_1_DESCR_START:                  ;
    DB     05H, 01H                              ; Usage Page
    DB     09H, 02H                              ; Usage
    DB     A1H, 01H                              ; Collection
    DB     09H, 01H                              ; Usage
    DB     A1H, 00H                              ; Collection
    DB     05H, 09H                              ; Usage Page
    DB     19H, 01H                              ; Usage Minimum
    DB     29H, 03H                              ; Usage Maximum
    DB     15H, 00H                              ; Logical Minimum
    DB     25H, 01H                              ; Logical Maximum
    DB     95H, 03H                              ; Report Count
    DB     75H, 01H                              ; Report Size
    DB     81H, 02H                              ; Input
    DB     95H, 01H                              ; Report Count
    DB     75H, 05H                              ; Report Size
    DB     81H, 01H                              ; Input
    DB     05H, 01H                              ; Usage Page
    DB     09H, 30H                              ; Usage
    DB     09H, 31H                              ; Usage
    DB     15H, 80H                              ; Logical Minimum
    DB     25H, 7FH                              ; Logical Maximum
    DB     75H, 08H                              ; Report Size
    DB     95H, 03H                              ; Report Count
    DB     81H, 06H                              ; Input
    DB     C0H                                   ; End Collection
    DB     C0H                                   ; End Collection
myUSB_HID_REPORT_1_DESCR_END:                    ;
myUSB_HID_REPORT_1_DESCR_SIZE:  EQU    (myUSB_HID_REPORT_1_DESCR_END - myUSB_HID_REPORT_1_DESCR_START)
.ENDLITERAL
;----------------------------------------------------------------------
; End HID Report Descriptor (HID_RPT_1}
;----------------------------------------------------------------------
; HID Report Descriptor (HID_RPT_2}
;----------------------------------------------------------------------
AREA  UserModules     (ROM,REL,CON)
.LITERAL
myUSB_HID_REPORT_2_DESCR_START:                  ;
    DB     05H, 01H                              ; Usage Page
    DB     09H, 06H                              ; Usage
    DB     A1H, 01H                              ; Collection
    DB     05H, 07H                              ; Usage Page
    DB     19H, E0H                              ; Usage Minimum
    DB     29H, E7H                              ; Usage Maximum
    DB     15H, 00H                              ; Logical Minimum
    DB     25H, 01H                              ; Logical Maximum
    DB     75H, 01H                              ; Report Size
    DB     95H, 08H                              ; Report Count
    DB     81H, 02H                              ; Input
    DB     95H, 01H                              ; Report Count
    DB     75H, 08H                              ; Report Size
    DB     81H, 01H                              ; Input
    DB     95H, 05H                              ; Report Count
    DB     75H, 01H                              ; Report Size
    DB     05H, 08H                              ; Usage Page
    DB     19H, 01H                              ; Usage Minimum
    DB     29H, 05H                              ; Usage Maximum
    DB     91H, 02H                              ; Output
    DB     95H, 01H                              ; Report Count
    DB     75H, 03H                              ; Report Size
    DB     91H, 01H                              ; Output
    DB     95H, 06H                              ; Report Count
    DB     75H, 08H                              ; Report Size
    DB     15H, 00H                              ; Logical Minimum
    DB     25H, 65H                              ; Logical Maximum
    DB     05H, 07H                              ; Usage Page
    DB     19H, 00H                              ; Usage Minimum
    DB     29H, 65H                              ; Usage Maximum
    DB     81H, 00H                              ; Input
    DB     C0H                                   ; End Collection
myUSB_HID_REPORT_2_DESCR_END:                    ;
myUSB_HID_REPORT_2_DESCR_SIZE:  EQU    (myUSB_HID_REPORT_2_DESCR_END - myUSB_HID_REPORT_2_DESCR_START)
.ENDLITERAL
;----------------------------------------------------------------------
; End HID Report Descriptor (HID_RPT_2}
;----------------------------------------------------------------------
; HID Report Sizes (HID_RPT_1}
;----------------------------------------------------------------------
myUSB_HID_RPT_1_IN_RPT_SIZE:  EQU    8           ; TODO: Optimize report size
;----------------------------------------------------------------------
myUSB_HID_RPT_1_OUT_RPT_SIZE:  EQU    8          ; TODO: Optimize report size
;----------------------------------------------------------------------
myUSB_HID_RPT_1_FEATURE_RPT_SIZE:  EQU    0      ; No FEATURE Reports are defined.  Size set to 0.
;----------------------------------------------------------------------
; HID Report Sizes (HID_RPT_2}
;----------------------------------------------------------------------
myUSB_HID_RPT_2_IN_RPT_SIZE:  EQU    8           ; TODO: Optimize report size
;----------------------------------------------------------------------
myUSB_HID_RPT_2_OUT_RPT_SIZE:  EQU    8          ; TODO: Optimize report size
;----------------------------------------------------------------------
myUSB_HID_RPT_2_FEATURE_RPT_SIZE:  EQU    0      ; No FEATURE Reports are defined.  Size set to 0.
;----------------------------------------------------------------------
;----------------------------------------------------------------------
; USB String Descriptors
;
; This section contains the USB String Descriptors generated
; by the USB User Module Descriptor Generator
;
; Note:  The string labels are internally generated by the
; descriptor generator
;
; Descriptors that reference string descriptors, use a hashed
; symbol that is set in an EQU directive with each string
; descriptor.
;----------------------------------------------------------------------
STR_HASH_0:  EQU    0                            ; String Hash for the null string
AREA  UserModules     (ROM,REL,CON)
EXPORT myUSB_StringTable
.LITERAL
myUSB_StringTable:                               
  TD_START_TABLE 3                               ; Number of USB Strings
  TD_ENTRY       USB_DS_ROM, LANGID_DESCR_SIZE, LANGID_DESCR_START, NULL_PTR
  TD_ENTRY       USB_DS_ROM, STRING_2_DESCR_SIZE, STRING_2_DESCR_START, NULL_PTR
  TD_ENTRY       USB_DS_ROM, STRING_3_DESCR_SIZE, STRING_3_DESCR_START, NULL_PTR
;----------------------------------------------------------------------
; LANGID Descriptor
;----------------------------------------------------------------------
LANGID_DESCR_START:                              
  DB    ((1 * 2) + 2)                            ; bLength (N+2)
  DB    3                                        ; bDescriptorType (STRING)
  DWL   1033                                     ;
LANGID_DESCR_END:                                
LANGID_DESCR_SIZE:  EQU    (LANGID_DESCR_END - LANGID_DESCR_START)
;----------------------------------------------------------------------
; String Desciptor
;----------------------------------------------------------------------
STR_HASH_2:  EQU    1                            ; String Hash
STRING_2_DESCR_START:                            
  DB    STRING_2_DESCR_SIZE                      ; bLength
  DB    3                                        ; bDescriptorType (STRING)
  DSU   "shengxiangzuo"                          ;
STRING_2_DESCR_END:                              
STRING_2_DESCR_SIZE:  EQU    (STRING_2_DESCR_END - STRING_2_DESCR_START)
;----------------------------------------------------------------------
; String Desciptor
;----------------------------------------------------------------------
STR_HASH_3:  EQU    2                            ; String Hash
STRING_3_DESCR_START:                            
  DB    STRING_3_DESCR_SIZE                      ; bLength
  DB    3                                        ; bDescriptorType (STRING)
  DSU   "she_xz"                                 ;
STRING_3_DESCR_END:                              
STRING_3_DESCR_SIZE:  EQU    (STRING_3_DESCR_END - STRING_3_DESCR_START)
.ENDLITERAL

;-----------------------------------------------
; End of Descriptors
;-----------------------------------------------

ENDIF
   ;---------------------------------------------------
   ;@PSoC_UserCode_BODY_2@ (Do not change this line.)
   ;---------------------------------------------------
   ; Redefine your descriptor table below. You might
   ; cut and paste code from the WIZARD descriptor
   ; above and then make your changes.
   ;---------------------------------------------------

   
   ;---------------------------------------------------
   ; Insert your custom code above this banner
   ;---------------------------------------------------
   ;@PSoC_UserCode_END@ (Do not change this line.)

; End of File myUSB_descr.asm

⌨️ 快捷键说明

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