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

📄 kbm_desc.asm

📁 Cypress 的(鼠标+键盘)复合设备汇编源程序
💻 ASM
字号:
;========================================================================
;  This is the LOGITECH dual-interface keyboard   descriptor table file
;========================================================================
;6/16/99 alpha bug repairs
;========================================================================




		XPAGEOFF




ROM_PAGE0:
   device_desc0_table:
	db	12h		; size of descriptor (18 bytes)
	db	01h		; descriptor type (device descriptor)
	db	10h, 01h	; USB spec release (ver 1.1)
	db	00h		; class code (each interface specifies class information)
	db	00h		; device sub-class (must be set to 0 because class code is 0)
	db	00h		; device protocol (no class specific protocol)
	db	08h		; maximum packet size (8 bytes)
	db	B4h, 04h	; vendor ID (note Cypress vendor ID)
	db	01h, 01h	; product ID (Cypress USB keyboard/PS2 mouse product ID)
	db	01h, 00h	; device release number
	db	01h		; index of manufacturer string 
	db	02h		; index of product string 
	db	00h		; index of serial number string (0=none)
	db	01h		; number of configurations (1)
 end_device_desc0_table:
device_desc0_len:		EQU (end_device_desc0_table - device_desc0_table)
device_desc0_offset:   EQU (device_desc0_table - ROM_PAGE0) 





   config_desc_table:
	db	09h		; length of descriptor (9 bytes)
	db	02h		; descriptor type (CONFIGURATION)
	db	(end_config_desc_table - config_desc_table) ; total length of descriptor
	db	00h
        db      02h             ; number of interfaces to configure (2)
	db	01h		; configuration value (1)
	db	04h		; configuration string index
	db	A0h		; configuration attributes (bus powered, remote wakeup)
	db	32h		; maximum power (100mA)
   Interface1_Descriptor:  ; descriptor for interface 0 (HID keyboard)
	db	09h		; length of descriptor (9 bytes)
	db	04h		; descriptor type (INTERFACE)
	db	00h		; interface number (0)
	db	00h		; alternate setting (0)
	db	01h		; number of endpoints (1)
	db	03h		; interface class (3..defined by HID spec for HID)
	db	01h		; interface sub-class (1..defined by HID spec for Boot subclass)
	db	01h		; interface protocol (1..defined by HID spec for keyboard)
	db	05h		; interface string index 


   Class1_Descriptor:
	db	09h		; descriptor size (9 bytes)
      db    21h         ; descriptor type (HID)
	db	00h, 01h	; class specification (1.00)
	db	00h		; hardware target country
	db	01h		; number of hid class desriptors to follow (1)
	db	22h		; report descriptor type (2)
	db	(end_hid_report_desc1_table - hid_report_desc1_table)
	db    00h
   end_Class1_Descriptor:
Class1_Descriptor_len: EQU (end_Class1_Descriptor - Class1_Descriptor)
Class1_Descriptor_offset: EQU (Class1_Descriptor - ROM_PAGE0)

   Endpoint1_Descriptor:
	db	07h		; descriptor length (7 bytes)
	db	05h		; descriptor type (ENDPOINT)
	db	81h		; endpoint address (IN endpoint, endpoint 1)
	db	03h		; endpoint attributes (interrupt)
	db	08h, 00h	; maximum packet size (8 bytes)
	db	0Ah		; polling interval (10ms)

   Interface2_Descriptor:  ; descriptor for interface 1 (HID mouse)
 	db	09h		; length of descriptor (9 bytes)
	db	04h		; descriptor type (INTERFACE)
	db	01h		; interface number (1)
	db	00h		; alternate setting (0)
	db	01h		; number of endpoints (1)
	db	03h		; interface class (3..defined by HID spec for HID)
	db	01h		; interface sub-class (1..defined by HID spec for Boot subclass)
	db	02h		; interface protocol (1..defined by HID spec for mouse)
	db	06h		; interface string index 

   Class2_Descriptor:
	db	09h		; descriptor size (9 bytes)
      db    21h         ; descriptor type (HID)
	db	00h, 01h	; class specification (1.00)
	db	00h		; hardware target country
	db	01h		; number of hid class desriptors to follow (1)
	db	22h		; report descriptor type (2)
	db	(end_hid_report_desc2_table - hid_report_desc2_table)
	db    00h

   end_Class2_Descriptor:
   Class2_Descriptor_len: EQU (end_Class2_Descriptor - Class2_Descriptor)
   Class2_Descriptor_offset: EQU (Class2_Descriptor - ROM_PAGE0)

   Endpoint2_Descriptor:
	db	07h		; descriptor length (7 bytes)
	db	05h		; descriptor type (ENDPOINT)
	db	82h		; endpoint address (IN endpoint, endpoint 2)
	db	03h		; endpoint attributes (interrupt)
	db	05h, 00h	; maximum packet size (4 bytes)
	db	0Ah		; polling interval (10ms)

   end_config_desc_table:
config_descriptor_len: EQU (end_config_desc_table - config_desc_table)
config_descriptor_offset: EQU (config_desc_table - ROM_PAGE0)


   report_desc_table:
   hid_report_desc1_table:
	db	05h, 01h	; usage page (generic desktop)
	db	09h, 06h	; usage (keyboard)
	db	A1h, 01h	; collection (application)
	db	05h, 07h	; usage page( key codes)
	db	19h, E0h	; usage minimum (234)
	db	29h, E7h	; usage maximum (231)
	db	15h, 00h	; logical minimum (0)
	db	25h, 01h	; logical maximum (1)
	db	75h, 01h	; report size (1 bit)
	db	95h, 08h	; report count (8 bytes)
	db	81h, 02h	; input (data, variable, absolute)
	db	95h, 01h	; report count (1 byte)
	db	75h, 08h	; report size (8 bits)
	db	81h, 01h	; input (constant)
	db	95h, 05h	; report count (5)
	db	75h, 01h	; report size (1)
	db	05h, 08h	; usage page (LEDs)
	db	19h, 01h	; usage minimum (1)
	db	29h, 05h	; usage maximum (5)
	db	91h, 02h	; output (data, variable, absolute)
	db	95h, 01h	; report count (1)
	db	75h, 03h	; report size (3)
	db	91h, 01h	; output (constant)
	db	95h, 06h	; report count (6)
	db	75h, 08h	; report size (8)
	db	15h, 00h	; logical minimum (0)
	db	25h, 68h	; logical maximum (101)
	db	05h, 07h	; usage page (key codes)
	db	19h, 00h	; usage minimum (0)
	db	29h, 68h	; usage maximum (101)
	db	81h, 00h	; input (data, array)
	db	C0h		; end collection
   end_hid_report_desc1_table:
hid_report_desc1_table_len: EQU (end_hid_report_desc1_table - hid_report_desc1_table)
hid_report_desc1_table_offset: EQU (hid_report_desc1_table - ROM_PAGE0)
   hid_report_desc2_table:
 	db	05h, 01h	; usage page (generic desktop)
	db	09h, 02h	; usage (mouse)
	db	A1h, 01h	; collection (application)
	db	85h, 01h    ; report id (1)
	db	09h, 01h	; usage (pointer)
	db	A1h, 00h	; collection (linked)
	db	05h, 09h	; usage page (buttons)
	db	19h, 01h	; usage minimum (1)
	db	29h, 03h	; usage maximum (3)
	db	15h, 00h	; logical minimum (0)
	db	25h, 01h	; logical maximum (1)
	db	95h, 03h	; report count (3 bytes)
	db	75h, 01h	; report size (1)
	db	81h, 02h	; input (3 button bits)
	db	95h, 01h	; report count (1)
	db	75h, 05h	; report size (5)
	db	81h, 01h	; input (constant 5 bit padding)
	db	05h, 01h	; usage page (generic desktop)
	db	09h, 30h	; usage (X)
	db	09h, 31h	; usage (Y)
    db    09h, 38h    ; usage (wheel)                  
	db	15h, 81h	; logical minimum (-127)
	db	25h, 7Fh	; logical maximum (127)
	db	75h, 08h	; report size (8)
	db	95h, 03h	; report count (3)
	db	81h, 06h	; input (3 position bytes X & Y & wheel)
	db	C0h, C0h	; end collection, end collection
    
      db    5h,  1h     ; USAGE_PAGE (Generic Desktop)
      db    9h, 80h     ; USAGE (System Control)
      db    a1h,  1h    ; COLLECTION (Application)
      db	85h, 02h    ; report id (2)
      db    5h,  1h     ;   USAGE_PAGE (Generic Desktop)
      db    19h, 81h    ;   USAGE_MINIMUM (System Power Down)
      db    29h, 83h    ;   USAGE_MAXIMUM (System Wake Up)
      db    15h,  0h    ;   LOGICAL_MINIMUM (0)
      db    25h,  1h    ;   LOGICAL_MAXIMUM (1)
      db    95h,  3h    ;   REPORT_COUNT (3)
      db    75h,  1h    ;   REPORT_SIZE (1)
      db    81h,  6h    ;   INPUT (Data,Var,rel)
	db    95h, 01h	;   report count (1 byte)
	db	75h, 05h	;   report size (5 bits)
	db	81h, 01h	;   input (constant)
      db 	c0h         ; END_COLLECTION

	db	05h, 0Ch	; USAGE_PAGE (consumer)
	db	09h, 01h	; USAGE (consumer control)
	db	A1h, 01h	; COLLECTION (application)
      db	85h, 03h    ; report id (3)
	db	15h, 00h	;	LOGICAL_MINIMUM (0)
      db    25h, 01h    ; 	LOGICAL_MAXIMUM (1)
	db	09h, E9h	;	USAGE (Volume Increment)
	db	09h, EAh	;	USAGE (Volume Decrement)
      db    75h, 01h    ; 	REPORT_SIZE (1)
      db    95h, 02h    ; 	REPORT_COUNT (2)
	db	81h, 02h	;	INPUT (Data, Var, Abs, Preferred)
	db	09h, E2h	;	USAGE (Mute)
      db    95h, 01h    ; 	REPORT_COUNT (1)
	db	81h, 06h	;	INPUT (Data, Var, Rel, Preferred)
	db	95h, 05h	;	REPORT_COUNT (5)
	db	81h, 01h	;	INPUT (constant - padding)
	db	C0h		; END_COLLECTION	
 end_hid_report_desc2_table:

hid_report_desc2_table_len: EQU (end_hid_report_desc2_table - hid_report_desc2_table)
hid_report_desc2_table_offset: EQU (hid_report_desc2_table - ROM_PAGE0)

;
;*********************************************************
;         rom lookup tables for string descriptor
;*********************************************************


;string 0
USBStringDescription0:
    db 04h          ; Length
    db 03h          ; Type (3=string)
    db 09h          ; Language:  English
    db 04h          ; Sub-language: Default
end_USBStringDescription0:
USBStringDescription0_len: EQU (end_USBStringDescription0 - USBStringDescription0)
USBStringDescription0_offset: EQU (USBStringDescription0 - ROM_PAGE0)

; string 1
USBStringDescription1:	; IManufacturerName
    db 10h          ; Length
    db 03h          ; Type (3=string)
    dsu "Cypress" ;


end_USBStringDescription1:	; IManufacturerName
USBStringDescription1_len: EQU (end_USBStringDescription1 -	USBStringDescription1)
USBStringDescription1_offset: EQU (USBStringDescription1 - ROM_PAGE0)

; string 2
USBStringDescription2:	; IProduct
    db 42h          ; Length
    db 03h          ; Type (3=string)
    dsu "Cypress USB Keyboard / PS2 Mouse"  ;

end_USBStringDescription2:	; IProduct
USBStringDescription2_len: EQU (end_USBStringDescription2 -	USBStringDescription2)
USBStringDescription2_offset: EQU (USBStringDescription2 - ROM_PAGE0)

;string 3
USBStringDescription3:	; serial number
                        ; If a SN is used, this must be unique
                        ; for every device or the device may
                        ; not enumerate properly
end_USBStringDescription3:	; serial number
USBStringDescription3_len: EQU (end_USBStringDescription3 -	USBStringDescription3)
USBStringDescription3_offset: EQU (USBStringDescription3 - ROM_PAGE0)
; string 4                 
USBStringDescription4:	; configuration string descriptor
    db 2Ah          ; Length
    db 03h          ; Type (3=string)
    dsu "HID Keyboard / Mouse"  ;

end_USBStringDescription4:	; configuration string descriptor
USBStringDescription4_len: EQU (end_USBStringDescription4 -	USBStringDescription4)
USBStringDescription4_offset: EQU (USBStringDescription4 - ROM_PAGE0)

;string 5
USBStringDescription5:	; interface 0 string descriptor
    db 28h          ; Length
    db 03h          ; Type (3=string)
    dsu "EndPoint1 Interrupt"  ;
end_USBStringDescription5:	; interface 0 string descriptor
USBStringDescription5_len: EQU (end_USBStringDescription5 -	USBStringDescription5)
USBStringDescription5_offset: EQU (USBStringDescription5 - ROM_PAGE0)

;string 6
USBStringDescription6:	; interface 1 string descriptor
    db 1Ch          ; Length
    db 03h          ; Type (3=string)
    dsu "EP2 Interrupt"  ;

end_USBStringDescription6:	; interface 1 string descriptor
USBStringDescription6_len: EQU (end_USBStringDescription6 -	USBStringDescription6)
USBStringDescription6_offset: EQU (USBStringDescription6 - ROM_PAGE0)




lookup_table:
dw device_desc0_offset
db device_desc0_len,0

dw config_descriptor_offset
db config_descriptor_len,0

dw USBStringDescription0_offset
db USBStringDescription0_len,0

dw USBStringDescription1_offset
db USBStringDescription1_len,0

dw USBStringDescription2_offset
db USBStringDescription2_len,0

dw USBStringDescription3_offset
db USBStringDescription3_len,0

dw USBStringDescription4_offset
db USBStringDescription4_len,0

dw USBStringDescription5_offset
db USBStringDescription5_len,0

dw USBStringDescription6_offset
db USBStringDescription6_len,0

dw Class1_Descriptor_offset
db Class1_Descriptor_len,0

dw Class2_Descriptor_offset
db Class2_Descriptor_len,0

dw hid_report_desc1_table_offset
db hid_report_desc1_table_len,0

dw hid_report_desc2_table_offset
db hid_report_desc2_table_len,0



key_error_buffer:
db 01,01,01,01,01,01,01,01
key_error_offset:
dw (key_error_buffer - ROM_PAGE0)


    XPAGEON

⌨️ 快捷键说明

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