?? dscr.a51
字號:
;-----------------------------------------------------------------------------
; File: dscr.a51
; Contents: This file contains descriptor data tables.
;
;--------------------------------------------------------------------------
$include (fx2_intvec.inc)
DSCR_DEVICE equ 1 ; Descriptor type: Device
DSCR_CONFIG equ 2 ; Descriptor type: Configuration
DSCR_STRING equ 3 ; Descriptor type: String
DSCR_INTRFC equ 4 ; Descriptor type: Interface
DSCR_ENDPNT equ 5 ; Descriptor type: Endpoint
DSCR_DEVQUAL equ 6 ; Descriptor type: Device Qualifier
DSCR_DEVICE_LEN equ 18
DSCR_CONFIG_LEN equ 9
DSCR_INTRFC_LEN equ 9
DSCR_ENDPNT_LEN equ 7
DSCR_DEVQUAL_LEN equ 10
ET_CONTROL equ 0 ; Endpoint type: Control
ET_ISO equ 1 ; Endpoint type: Isochronous
ET_BULK equ 2 ; Endpoint type: Bulk
ET_INT equ 3 ; Endpoint type: Interrupt
public DeviceDscr, DeviceQualDscr, HighSpeedConfigDscr
public DscrEnd, VendorOffset, Str3Offset, HighSpeedConfigLen
public DeviceDscrOffset, DeviceQualDscrOffset, HighSpeedConfigDscrOffset
public DscrEndOffset, DscrVIDOffset
$if (HID)
public HIDDscrOffset, HIDReportDscrOffset, HIDReportDscrLen, HIDIntrfcDscr, HIDIntrfcDscrOffset
public HIDDscr
$endif
;-----------------------------------------------------------------------------
; Global Variables
;-----------------------------------------------------------------------------
CSEG at DESC_VEC ; locate the descriptor table in on-part memory.
DeviceDscr:
db DSCR_DEVICE_LEN ; Descriptor length
db DSCR_DEVICE ; Decriptor type
dw 0002H ; Specification Version (BCD)
db 00H ; Device class
db 00H ; Device sub-class
db 00H ; Device sub-sub-class
db 64 ; Maximum packet size
DscrVID:
dw 0B604H ; Vendor ID (4b4)
dw 1746H ; Product ID - set to new id = NX2LP
dw 0200H ; Product version ID [RevH RevL Major Minor]
Str3:
db 1 ; Manufacturer string index
db 2 ; Product string index
db 3 ; Serial number string index
db 1 ; Number of configurations
HighSpeedConfigDscr:
db DSCR_CONFIG_LEN ; Descriptor length
db DSCR_CONFIG ; Descriptor type
db (HighSpeedConfigDscrEnd-HighSpeedConfigDscr) mod 256 ; Total Length (LSB)
db (HighSpeedConfigDscrEnd-HighSpeedConfigDscr) / 256 ; Total Length (MSB)
$if (HID)
db 2 ; Number of interfaces
$else
db 1 ; Number of interfaces
$endif
db 1 ; Configuration number
db 0 ; Configuration string
db 10000000b ; Attributes (b7 - buspwr, b6 - selfpwr, b5 - rwu)
db 50 ; Power requirement (div 2 ma)
; Interface Descriptor
db DSCR_INTRFC_LEN ; Descriptor length
db DSCR_INTRFC ; Descriptor type
db 0 ; Zero-based index of this interface
db 0 ; Alternate setting
db 2 ; Number of end points
Vendor:
db 08H ; Interface class - vendor specific for mfgMode
db 06H ; Interface sub class
db 50H ; Interface sub sub class
db 0 ; Interface descriptor string index
; Endpoint Descriptor
db DSCR_ENDPNT_LEN ; Descriptor length
db DSCR_ENDPNT ; Descriptor type
db 02H ; Endpoint number, and direction
db ET_BULK ; Endpoint type
db 00H ; Maximun packet size (LSB)
db 02H ; Max packect size (MSB)
db 00H ; Polling interval
;; Endpoint Descriptor
db DSCR_ENDPNT_LEN ; Descriptor length
db DSCR_ENDPNT ; Descriptor type
db 84H ; Endpoint number, and direction
db ET_BULK ; Endpoint type
db 00H ; Maximun packet size (LSB)
db 02H ; Max packect size (MSB)
db 00H ; Polling interval
$if (HID)
HIDIntrfcDscr: ; HID Interface Descriptor
db DSCR_CONFIG_LEN ; Descriptor length
db DSCR_INTRFC ; Descriptor type
db 1 ; Zero-based index of this interface
db 0 ; Alternate setting
db 1 ; Number of end points
db 03H ; Interface class (HID)
db 00H ; Interface sub class
db 00H ; Interface sub sub class
db 0 ; Interface descriptor string index
HIDDscr:
db 09h ; length
db 21h ; type: HID
db 010h,01h ; release: HID class rev 1.1
db 00h ; country code (none)
db 01h ; number of HID class descriptors to follow
db 22h ; report descriptor type (HID)
db (HIDReportDscrEnd - HIDReportDscr)mod 256 ; length of HID descriptor
db (HIDReportDscrEnd - HIDReportDscr)/256 ; length of HID descriptor
HIDDscrEnd:
InterruptEPDscr:
db DSCR_ENDPNT_LEN ; Descriptor length
db DSCR_ENDPNT ; Descriptor type
db 81H ; Endpoint number, and direction
db ET_INT ; Endpoint type
db 04H ; Maximun packet size (LSB)
db 00H ; Max packect size (MSB)
db 0AH ; Polling interval
$endif
HighSpeedConfigDscrEnd:
$if (HID)
db 0 ; need a byte aligment here
HIDReportDscr:
db 05h, 01h ; Usage Page (Generic Desktop),
db 09h, 02h ; Usage (Mouse),
db 0A1h, 01h ; Collection (Application),
db 09h, 01h ; Usage (Pointer),
db 0A1h, 00h ; Collection (Physical),
db 95h, 03h ; Report Count (3),
db 75h, 01h ; Report Size (1),
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 81h, 02h ; Input (Data, Variable, Absolute), (3 button bits)
db 95h, 01h ; Report Count (1),
db 75h, 05h ; Report Size (5),
db 81h, 01h ; Input (Constant)
db 75h, 08h ; Report Size (8)
db 95h, 02h ; Report Count (2)
db 05h, 01h ; Usage Page (Generic Desktop),
db 09h, 30h ; Usage (X),
db 09h, 31h ; Usage (Y),
db 15h, 81h ; Logical Minimum (-127),
db 25h, 7Fh ; Logical Maximum (+127),
db 81h, 06h ; Input (Data, Variable, Relative), (2 position bytes - X & Y)
db 0C0h ; End Collection
db 0C0h ; End Collection
HIDReportDscrEnd:
$endif
DeviceQualDscr:
db DSCR_DEVQUAL_LEN ; Descriptor length
db DSCR_DEVQUAL ; Decriptor type
dw 0002H ; Specification Version (BCD)
db 00H ; Device class
db 00H ; Device sub-class
db 00H ; Device sub-sub-class
db 64 ; Maximum packet size
db 1 ; Number of configurations
db 0 ; Reserved
DscrEnd:
DeviceDscrOffset EQU DeviceDscr - DeviceDscr
DeviceQualDscrOffset EQU DeviceQualDscr - DeviceDscr
HighSpeedConfigDscrOffset EQU HighSpeedConfigDscr - DeviceDscr
DscrEndOffset EQU DscrEnd - DeviceDscr
DscrVIDOffset EQU DscrVID - DeviceDscr
Str3Offset EQU Str3 - DeviceDscr
VendorOffset EQU Vendor - DeviceDscr
HighSpeedConfigLen EQU HighSpeedConfigDscrEnd-HighSpeedConfigDscr
$if HID
HIDDscrOffset EQU HIDDscr - DeviceDscr
HIDReportDscrLen EQU HIDReportDscrEnd - HIDReportDscr
HIDIntrfcDscrOffset EQU HIDDscr - DeviceDscr
HIDReportDscrOffset EQU HIDReportDscr - DeviceDscr
$endif
end
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -