?? gphid_descriptors.a51
字號:
; HID_descriptors.a51
; Contains the Device Descriptor, Configuration(/Interface/HID/Endpoint) Descriptor,
; and String descriptors.
;
; There are two advantages to putting these into an assembly file rather than in-likne
; in the C module:
; 1. Descriptor lengths can be computed using the 'db' directive.
; 2. Labels may be assigned in the middle of a discriptor (HID)
;
public DeviceDescr,ConfigDescr,String0,String1,String2,HIDDescr,ReportDescr,ReportDescr_end
;
VID equ 0547h
PID equ 7450h
DID equ 0001h
;
DSCR segment CODE
;
rseg DSCR
DeviceDescr:
db 18d ; Descriptor length
db 01h ; Descriptor type = DEVICE
db 10h,01h ; spec version (BCD) is 1.10
db 0,0,0 ; HID class is defined in the interface descriptor
db 64 ; maxPacketSize
db LOW(VID),HIGH(VID)
db LOW(PID),HIGH(PID)
db LOW(DID),HIGH(DID)
db 01h,02h,03h ; manuf, product, s/n string index (no s/n)
db 01h ; number of configurations
ConfigDescr:
db 09h ; descriptor length
db 02h ; Descriptor type = CONFIG
db LOW(EPend-ConfigDescr) ; total length (conf+interface+HID+EP's)
db HIGH(EPend-ConfigDescr)
db 01h ; number of interfaces
db 01h ; value to select this interface
db 04h ; string index to describe this config
db 10100000b ; b7=1; b6=self-powered; b5=Remote WU
db 50d ; bus power = 100 ma
; Interface Descriptor
db 09h ; Descriptor length
db 04h ; Descriptor type = INTERFACE
db 0,0 ; Interface 0, Alternate setting 0
db 02h ; number of endpoints
db 03h,0,0 ; class(03)=HID, no subclass or protocol
db 05h ; string index for this interface
HIDDescr:
db 09h ; Descriptor length
db 21h ; Descriptor type - HID
db 10h,01h ; HID Spec version 1.10
db 0 ; country code(none)
db 01h ; number of HID class descriptors
db 22h ; class descriptor type: REPORT
db LOW(ReportDescr_end - ReportDescr)
db HIGH(ReportDescr_end - ReportDescr)
; I-0, AS-0, first endpoint descriptor (EP1IN)
db 07h ; Descriptor length
db 05h ; Descriptor type = ENDPOINT
db 81h ; IN-1
db 03h ; type - INTERRUPT
db 64d,0 ; maxPacketSize = 64
db 10d ; polling interval is 10 msec
; I-0, AS-0, second endpoint descriptor (EP1OUT)
db 07h ; Descriptor length
db 05h ; Descriptor type = ENDPOINT
db 01h ; OUT-1
db 03h ; type - INTERRUPT
db 64d,0 ; maxPacketSize = 64
db 10d ; polling interval is 10 msec
EPend:
;
ReportDescr: db 06h,0A0h,0FFh ; Usage page (vendor-defined:FF00-FFFF)
db 09h,0A5h ; Usage (vendor defines 'A5')
db 0A1h,01h ; Collection(application)
db 09h,0A6h ; Usage (vendor)
; The input report
db 09h,0A7h ; Usage(vendor defines 'A7')
db 15h,80h ; Logical minimum(-128)
db 25h,7Fh ; Logical maximum(127)
db 75h,08h ; Report size(8)
db 95h,02h ; Report count(2)
db 81h,02h ; Input(Data,Variable,Absolute)
; The output report
db 09h,0A9h ; Usage (vendor defines 'A9')
db 15h,80h ; Logical minimum(-128)
db 25h,7Fh ; Logical maximum(127)
db 75h,08h ; Report size(8)
db 95h,02h ; Report count(2)
db 91h,02h ; Output (Data, Variable, Absolute)
db 0C0h ; End Collection
ReportDescr_end:
String0:
db 4,3,9,4 ; string0 is language ID: len, type, lang, sub-lang
String1: ; manufacturer
db endStr1-String1 ; length is one byte for strings
db 3 ; Descriptor type = STRING
db 'C',0,'y',0,'p',0,'r',0,'e',0,'s',0,'s',0
endStr1:
String2: ; product
db endStr2-String2
db 3
db 'L',0,'a',0,'n',0,'e',0,'s',0,' ',0,'H',0,'I',0,'D',0
endStr2:
String3: ; Serial Number
db endStr3-String3
db 3
db 'S',0,'/',0,'N',0,' ',0,'0',0,'0',0,'0',0,'1',0
endStr3:
String4: ; configuration
db endStr4-String4
db 3
db 'C',0,'f',0,'g',0,'.',0,'s',0,'t',0,'r',0,'i',0,'n',0,'g',0
endStr4:
String5: ; interface
db endStr5-String5
db 3
db 'I',0,'n',0,'t',0,'e',0,'r',0,'f',0,'a',0,'c',0,'e',0,'X',0
endStr5:
END
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -