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

📄 usb_descr.asm

📁 Cypress 的VOIP DEMO 研究VOIP终端的朋友可以研究研究
💻 ASM
📖 第 1 页 / 共 3 页
字号:
   ;---------------------------------------------------
   ; Redefine your descriptor table below. You might
   ; cut and paste code from the WIZARD descriptor
   ; above and then make your changes.
   ;---------------------------------------------------


;-----------------------------------------------
; USB Descriptors--Generated by the USB Setup Wizard
;-----------------------------------------------
AREA  UserModules     (ROM,REL,CON)
;----------------------------------------------------------------------
; Descriptor Dispatch Tables
;   The following tables provide the dispatching pointers and
;   descriptor lengths necessary for the request handler to
;   respond to USB requests.
;----------------------------------------------------------------------

;----------------------------------------------------------------------
; Device Dispatch Table
;   for User Module: (USB)
;----------------------------------------------------------------------
AREA  func_lit     (ROM,REL,CON)
EXPORT USB_DEVICE_LOOKUP
.LITERAL
USB_DEVICE_LOOKUP:                               ;
  LT_START    1                                  ; Number of devices defined for USB
  LT_ENTRY    USB_D0_CONFIG_LOOKUP, USB_D0_CONFIG_DESCR_TABLE
.ENDLITERAL

;----------------------------------------------------------------------
; Configuration Dispatch Table
;   for Device: (USB_D0)
;----------------------------------------------------------------------
AREA  func_lit     (ROM,REL,CON)
EXPORT USB_D0_CONFIG_LOOKUP
.LITERAL
USB_D0_CONFIG_LOOKUP:                            ;
  LT_START    1                                  ; Number of configurations
  LT_ENTRY    NULL_PTR, NULL_PTR                 ; No HID Class Descriptors
.ENDLITERAL

;----------------------------------------------------------------------
; Endpoint Setup Table
; 
; This table provides the data to configure the endpoint mode registers
; for IN/OUT direction.
;----------------------------------------------------------------------
AREA  func_lit     (ROM,REL,CON)
.LITERAL
USB_D0_C1_EP_SETUP:                              ;
  DB    0                                        ; INVALID Number of Endpoint Descriptors  
  DB    USB_DIR_UNUSED                           ; Endpoint EP2 not used for this configuration
  DB    USB_DIR_UNUSED                           ; Endpoint EP3 not used for this configuration
  DB    USB_DIR_UNUSED                           ; Endpoint EP4 not used for this configuration
.ENDLITERAL

;----------------------------------------------------------------------
; Interface Lookup Table
; 
; This table is indexed by interface number.
;
;----------------------------------------------------------------------
EXPORT USB_D0_C1_INTERFACE_RPT_LOOKUP
.LITERAL
USB_D0_C1_INTERFACE_RPT_LOOKUP:                  ;
  DW    0                                        ; HID Class Reports not defined for this interface
  DW    0                                        ; HID Class Reports not defined for this interface
.ENDLITERAL

;----------------------------------------------------------------------
; HID Class Descriptor transfer descriptor table
;----------------------------------------------------------------------
AREA  func_lit     (ROM,REL,CON)
EXPORT USB_D0_C1_HID_CLASS_DESCR_TABLE
.LITERAL
USB_D0_C1_HID_CLASS_DESCR_TABLE:                 ;
  TD_START_TABLE 2                               ; Number of interfaces/HID Class Descriptors
  TD_ENTRY       USB_DS_ROM, 0, NULL_PTR, NULL_PTR
  TD_ENTRY       USB_DS_ROM, 0, NULL_PTR, NULL_PTR
.ENDLITERAL

;----------------------------------------------------------------------
; Configuration Descriptor Table
;  for (USB_D0)
;
;	This table provides transfer descriptors for each USB Configuration
; Descriptor
;----------------------------------------------------------------------
AREA  func_lit     (ROM,REL,CON)
.LITERAL
USB_D0_CONFIG_DESCR_TABLE:                       ;
  TD_START_TABLE 1                               ; Number of configurations
  TD_ENTRY       USB_DS_ROM, USB_D0_C1_DESCR_SIZE, USB_D0_C1_DESCR_START, NULL_PTR
.ENDLITERAL

;----------------------------------------------------------------------
; Device Descriptor Table
;
;	This table provides transfer descriptors for each USB Device Descriptor
;----------------------------------------------------------------------
AREA  func_lit     (ROM,REL,CON)
EXPORT USB_DEVICE_DESCR_TABLE
.LITERAL
USB_DEVICE_DESCR_TABLE:                          
  TD_START_TABLE 1                               ; Number of devices
  TD_ENTRY       USB_DS_ROM, USB_D0_DESCR_SIZE, USB_D0_DESCR_START, NULL_PTR
.ENDLITERAL
;----------------------------------------------------------------------
;----------------------------------------------------------------------
; Device Descriptor (USB_D0)
; This marks the beginning of the Device Descriptor.  This descriptor
; concatenates all of the descriptors in the following format:
;	Device Descriptor
;		Configuration Descriptor (1)
;	  	Interface 1 Descriptor
;				HID Descriptor 1
;			  	Endpoint Descriptor(s)
;			Interface 2 Descriptor
;				HID Descriptor 2
;					Endpoint Descriptor(s)
;		Configuration Descriptor (2)
;			Interface/HID/Endpoint...
;----------------------------------------------------------------------
AREA  UserModules     (ROM,REL,CON)
.LITERAL
USB_D0_DESCR_START:                              ;
  DB    18                                       ; Device Descriptor Length (18)
  DB    1                                        ; bDescriptorType: DEVICE
  DWL   0200H                                    ; bcdUSB (ver 2.0)
  DB    0                                        ; bDeviceClass
  DB    0                                        ; bDeviceSubClass 
  DB    0                                        ; bDeviceProtocol 
  DB    8                                        ; bMaxPacketSize0
  DWL   04B4H                                    ; idVendor
  DWL   4C55H                                    ; idProduct
  DWL   0000H                                    ; bcdDevice
  DB    STR_HASH_2                               ; iManufacturer
  DB    STR_HASH_3                               ; iProduct
  DB    STR_HASH_0                               ; iSerialNumber
  DB    1                                        ; bNumConfigurations
USB_D0_DESCR_END:                                ;
USB_D0_DESCR_SIZE:  EQU    USB_D0_DESCR_END - USB_D0_DESCR_START
HID_INT: equ 0
;----------------------------------------------------------------------
; Configuration Descriptor (USB_D0_C1)
; This marks the beginning of the Configuration Descriptor.  This descriptor
; concatenates all of the descriptors in the following format:
; Configuration Descriptor
;	Interface 1 Descriptor
;		HID Descriptor 1
;			Endpoint Descriptor(s)
;	Interface 2 Descriptor
;		HID Descriptor 2
;			Endpoint Descriptor(s)
;----------------------------------------------------------------------
USB_D0_C1_DESCR_START:                           ;
  DB    9                                        ; Configuration Descriptor Length (9)
  DB    2                                        ; bDescriptorType: CONFIGURATION
  DWL   USB_D0_C1_DESCR_SIZE                     ; wTotalLength
IF HID_INT
  DB    4                                        ; bNumInterfaces
ELSE
  DB    3                                        ; bNumInterfaces
ENDIF
  DB    1                                        ; bConfigurationValue
  DB    0		                               ; iConfiguration
  DB    80H | (0 << 6) | (0 << 5)                ; bmAttributes >
  DB    50                                       ; bMaxPower
;----------------------------------------------------------------------
; Interface Descriptor (USB_D0_C1_I0) (AudioControl)
;----------------------------------------------------------------------
  DB    9                                        ; Interface Descriptor Length (9)
  DB    4                                        ; bDescriptorType: INTERFACE
  DB    0                                        ; bInterfaceNumber (zero based)
  DB    0                                        ; bAlternateSetting
  DB    0                                        ; bNumEndpoints
  DB    1 ; Audio                                   ; bInterfaceClass
  DB    1 ; Audio control                                        ; bInterfaceSubClass
  DB    0                                        ; bInterfaceProtocol
  DB    0		                               ; iInterface
  
AUDIO_CONTROL_CS_START:
;---------------------------------------------------------------------
; Class-specific interface descr
  DB    10                                        ; Interface Descriptor Length 
  DB    24h                                      ; bDescriptorType: INTERFACE
  DB    1 			; Subtype - header
  DWL   0100h		; Class version 
  DWL	AUDIO_CONTROL_CS_SIZE		; Total size of class descrs
  DB	2			; Number of streaming interfaces
  DB    1			; AudStream ifc belongs to this AC
  DB    2			; AudStream ifc belongs to this AC

;--------------------------------------------------
; Microphone input terminal
  DB 	0ch
  DB    24h
  DB	02h
  DB	01h		; ID
  DWL	0203h	; Head mounted microphone
  DB	00h
  DB	01h
  DWL	0000h
  DB	00h
  DB	3h

; Microphone output terminal (USB)
  DB 	9
  DB  	24h
  DB	3 ; OUTPUT
  DB	2 ; ID 
  DWL	0101h ; USB 
  DB	0
  DB	1 		; Source - from input terminal
  DB	0


 
 ;-------------------------------------------------
 
; Earphone input terminal
  DB 	0ch
  DB    24h
  DB	02h		; INPUT
  DB	03h		; ID
  DWL	0101h	; USB Streaming
  DB	00h		; Assoc ID
  DB	01h		; nChannels
  DWL	0000h
  DB	00h
  DB	4h
    
  ;--------------------------------------------------
  
 ; Earphone output terminal 
  DB 	9
  DB  	24h
  DB	3		; OUTPUT
  DB	4		; ID
  DWL	0302h	; Headphones
  DB	0
  DB	3 		; Source - from input terminal
  DB	0

AUDIO_CONTROL_CS_END:
AUDIO_CONTROL_CS_SIZE:  EQU    (AUDIO_CONTROL_CS_END - AUDIO_CONTROL_CS_START)



;----------------------------------------------------------------------
; Microphone Interface Descriptor (USB_D0_C1_I1) (AudioStreaming - Idle)
;----------------------------------------------------------------------
  DB    9                                        ; Interface Descriptor Length (9)
  DB    4                                        ; bDescriptorType: INTERFACE
  DB    1                                        ; bInterfaceNumber (zero based)
  DB    0                                        ; bAlternateSetting
  DB    0                                        ; bNumEndpoints

⌨️ 快捷键说明

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