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

📄 dscr.a51

📁 Cy68013的应用——USB2.0接口转IDE、CF卡接口
💻 A51
字号:
;;-----------------------------------------------------------------------------
;;   File:      dscr.a51
;;   Contents:   This file contains descriptor data tables.  
;;
;;   Copyright (c) 1997 AnchorChips, Inc. All rights reserved
;;
;; $Archive:$
;; $Date:$
;; $Revision:$
;;-----------------------------------------------------------------------------
   
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

MASS_STORAGE_CLASS     EQU   8
MASS_STORAGE_SCSICMD   EQU   6
MASS_STORAGE_BOT       EQU   50h

public      DeviceDscr, DeviceQualDscr, HighSpeedConfigDscr, FullSpeedConfigDscr, StringDscr
public      IntrfcSubClassHighSpeed, IntrfcSubClassFullSpeed, DscrEnd
public      DeviceDscrOffset, DeviceQualDscrOffset, HighSpeedConfigDscrOffset, FullSpeedConfigDscrOffset, StringDscrOffset
public      IntrfcSubClassHighSpeedOffset, IntrfcSubClassFullSpeedOffset, DscrEndOffset
public	   StringDscr0, StringDscr1, StringDscr3
public      SerialNumberIndexOffset, SerialNumberStringDscrOffset
DSCR   SEGMENT   CODE PAGE

;;-----------------------------------------------------------------------------
;; Global Variables
;;-----------------------------------------------------------------------------
      rseg DSCR      ;; 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
      dw   0B404H      ;; Vendor ID (4b4)
DscrPID:
      dw   1146H      ;; Product ID - set to new id = CY4611
;     dw   0210h	;; Sample device
      dw   0230H      ;; Product version ID [RevH RevL Major Minor]
      db   (StringDscr1 - DeviceDscr + 16) / 2       ;; Manufacturer string index
      db   (StringDscr3 - DeviceDscr + 16) / 2       ;; Product string index
SerialNumberStringIndex:
      db   (StringDscr2 - DeviceDscr + 16) / 2       ;; Serial number string index
      db   1         ;; Number of configurations

FullSpeedConfigDscr:   
      db   DSCR_CONFIG_LEN               ;; Descriptor length
      db   DSCR_CONFIG                  ;; Descriptor type
      db   (FullSpeedConfigDscrEnd-FullSpeedConfigDscr) mod 256 ;; Total Length (LSB)
      db   (FullSpeedConfigDscrEnd-FullSpeedConfigDscr)  /  256 ;; Total Length (MSB)
      db   1      ;; Number of interfaces
      db   1      ;; Configuration number
      db   0      ;; Configuration string
$if (BUS_POWERED)
      db   10000000b   ;; Attributes (b7 - buspwr, b6 - selfpwr, b5 - rwu)
      db   250      ;; Power requirement (div 2 ma)
$else
      db   11000000b   ;; Attributes (b7 - buspwr, b6 - selfpwr, b5 - rwu)
      db   0      ;; Power requirement (div 2 ma)
$endif

;; 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 
IntrfcClassFullSpeed:
      db   08H             ;; Interface class - vendor specific for mfgMode
IntrfcSubClassFullSpeed:
      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   40H               ;; Maximun packet size (LSB)
      db   00H               ;; Max packect size (MSB)
      db   00H               ;; Polling interval

;; Endpoint Descriptor
      db   DSCR_ENDPNT_LEN      ;; Descriptor length
      db   DSCR_ENDPNT         ;; Descriptor type
      db   88H               ;; Endpoint number, and direction
      db   ET_BULK            ;; Endpoint type
      db   40H               ;; Maximun packet size (LSB)
      db   00H               ;; Max packect size (MSB)
      db   00H               ;; Polling interval

FullSpeedConfigDscrEnd:   

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)
      db   1      ;; Number of interfaces
      db   1      ;; Configuration number
      db   0      ;; Configuration string
$if (BUS_POWERED)
      db   10000000b   ;; Attributes (b7 - buspwr, b6 - selfpwr, b5 - rwu)
      db   250      ;; Power requirement (div 2 ma)
$else
      db   11000000b   ;; Attributes (b7 - buspwr, b6 - selfpwr, b5 - rwu)
      db   0      ;; Power requirement (div 2 ma)
$endif

;; 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 
IntrfcClassHighSpeed:
      db   08H             ;; Interface class - vendor specific for mfgMode
IntrfcSubClassHighSpeed:
      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   88H               ;; 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

HighSpeedConfigDscrEnd:   

StringDscr:
StringDscr0:
		db	StringDscr0End-StringDscr0		;; String descriptor length
		db	DSCR_STRING
		db	09H,04H
StringDscr0End:

StringDscr1:	
		db	StringDscr1End-StringDscr1		;; String descriptor length
		db	DSCR_STRING
		db	'C',00
		db	'y',00
		db	'p',00
		db	'r',00
		db	'e',00
		db	's',00
		db	's',00
StringDscr1End:

StringDscr2:	
		db	StringDscr2End-StringDscr2		;; String descriptor length
		db	DSCR_STRING
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
		db	'0',00
StringDscr2End:

StringDscr3:	
		db	StringDscr3End-StringDscr3		;; String descriptor length
		db	DSCR_STRING
		db	'C',00
		db	'y',00
		db	'p',00
		db	'r',00
		db	'e',00
		db	's',00
		db	's',00
		db	' ',00
		db	'M',00
		db	'a',00
		db	's',00
		db	's',00
		db	' ',00
		db	'S',00
		db	't',00
		db	'o',00
		db	'r',00
		db	'a',00
		db	'g',00
		db	'e',00
		db	' ',00
		db	'2',00
		db	'.',00
		db	'3',00
		db	'0',00
		db	'B',00
		db	'6',00
StringDscr3End:
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:

$if (BUS_POWERED)
VID	equ	04b4h
PID	equ	461fh
DID 	equ	0h
;
;
public HIDDeviceDscr, HIDDeviceDscrEnd, HIDDeviceDscrEndOffset, HIDReportDscrOffset, HIDReportDscrEndOffset
public HIDDscrOffset
HIDDeviceDscr:	
	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      00h                     ; mfg string
        db      00h                     ; product string
        db      00h		        ; s/n string
       	db	01h			; number of configurations
HIDConfigDscr:
	db	09h			; descriptor length
	db	02h			; Descriptor type = CONFIG
	db	LOW(EPend-HIDConfigDscr)	; total length (conf+interface+HID+EP's)
	db	HIGH(EPend-HIDConfigDscr)
	db	01h			; number of interfaces
	db	01h			; value to select this interface
	db	00h			; string index to describe this config
	db	10000000b		; b7=1; b6=self-powered; b5=Remote WU
	db	250d			; bus power = 500 ma
; Interface Descriptor
	db	09h			; Descriptor length
	db	04h			; Descriptor type = INTERFACE
	db	0,0			; Interface 0, Alternate setting 0
	db	00h			; number of endpoints
	db	03h,0,0			; class(03)=HID, no subclass or protocol
	db	0			; string index for this interface
HIDDscr:
	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(HIDReportDscrEnd - HIDReportDscr)
	db	HIGH(HIDReportDscrEnd - HIDReportDscr)
EPend:

HIDReportDscr:	db	05h,01h		; Usage page (generic desktop)
        db 06h,0A0h,0FFh                ; Usage Page (vendor defined)
        db 09h,0A5h                     ; Usage (Vendor Defined)
        
        db 0A1h,01h                     ; collection (application)
        db 09h,0A6h                     ; usage (vendor defined)

        db 09h,0A7h                     ; usage (vendor defined)
        db 15h,80h                      ; logical min (-127)        
        db 25h,7Fh                      ; logical max (128)
        db 75h,08h                      ; report size (8 bits)
        db 95h,01h                      ; report count (1 field)
        db 81h,02h                      ; input (data,variable,absolute)

        db 0C0h                         ; end collection
HIDReportDscrEnd:

HIDDeviceDscrEnd:

HIDDeviceDscrEndOffset EQU HIDDeviceDscrEnd-HIDDeviceDscr
HIDReportDscrOffset EQU HIDReportDscr-HIDDeviceDscr
HIDReportDscrEndOffset EQU HIDReportDscrEnd-HIDDeviceDscr
HIDDscrOffset EQU HIDDscr-HIDDeviceDscr
$endif

DeviceDscrOffset EQU DeviceDscr - DeviceDscr
DeviceQualDscrOffset EQU DeviceQualDscr - DeviceDscr
HighSpeedConfigDscrOffset EQU HighSpeedConfigDscr - DeviceDscr
FullSpeedConfigDscrOffset EQU FullSpeedConfigDscr - DeviceDscr
StringDscrOffset EQU StringDscr - DeviceDscr
SerialNumberStringDscrOffset EQU StringDscr2 - DeviceDscr
SerialNumberIndexOffset EQU SerialNumberStringIndex - DeviceDscr
IntrfcSubClassHighSpeedOffset EQU IntrfcSubClassHighSpeed - DeviceDscr
IntrfcSubClassFullSpeedOffset EQU IntrfcSubClassFullSpeed - DeviceDscr
DscrEndOffset EQU DscrEnd - DeviceDscr

		end
		

⌨️ 快捷键说明

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