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

📄 usb_descr.asm

📁 利用psoc进行usb及capsense的程序编写
💻 ASM
📖 第 1 页 / 共 2 页
字号:
; RAM allocation for FEATURE Reports.
;----------------------------------------------------------------------
EXPORT _USB_INTERFACE_0_FEATURE_RPT_DATA
EXPORT USB_INTERFACE_0_FEATURE_RPT_DATA
_USB_INTERFACE_0_FEATURE_RPT_DATA:               
USB_INTERFACE_0_FEATURE_RPT_DATA:                
  BLK  8                                         ;
;----------------------------------------------------------------------
;----------------------------------------------------------------------
; 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   4242H                                    ; idVendor
  DWL   EE01H                                    ; idProduct
  DWL   0100H                                    ; bcdDevice
  DB    STR_HASH_2                               ; iManufacturer
  DB    STR_HASH_3                               ; iProduct
  DB    STR_HASH_4                               ; iSerialNumber
  DB    1                                        ; bNumConfigurations
USB_D0_DESCR_END:                                ;
USB_D0_DESCR_SIZE:  EQU    USB_D0_DESCR_END - USB_D0_DESCR_START

;----------------------------------------------------------------------
; 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
  DB    1                                        ; bNumInterfaces
  DB    1                                        ; bConfigurationValue
  DB    STR_HASH_0                               ; iConfiguration
  DB    80H | (0 << 6) | (0 << 5)                ; bmAttributes >
  DB    50                                       ; bMaxPower
;----------------------------------------------------------------------
; Interface Descriptor (USB_D0_C1_I0)
;----------------------------------------------------------------------
  DB    9                                        ; Interface Descriptor Length (9)
  DB    4                                        ; bDescriptorType: INTERFACE
  DB    0                                        ; bInterfaceNumber (zero based)
  DB    0                                        ; bAlternateSetting
  DB    1                                        ; bNumEndpoints
  DB    3                                        ; bInterfaceClass
  DB    0                                        ; bInterfaceSubClass
  DB    0                                        ; bInterfaceProtocol
  DB    STR_HASH_0                               ; iInterface
;----------------------------------------------------------------------
; HID Class Descriptor (USB_D0_C1_I0)
;----------------------------------------------------------------------
USB_D0_C1_I0_HID_DESCR_START:                    
  DB    9                                        ; bLength--HID Class Descriptor Length (9)
  DB    0x21                                     ; bDescriptorType: HID Class
  DWL   0x0111                                   ; bcdHID
  DB    0                                        ; bCountryCode
  DB    1                                        ; bNumDescriptors
  DB    34                                       ; bDescriptorType
  DWL   USB_HID_REPORT_1_DESCR_SIZE              ; wDescriptorLength
;----------------------------------------------------------------------
; Endpoint Descriptor (USB_D0_C1_I0_E0)
;----------------------------------------------------------------------
  DB    7                                        ; Endpoint Descriptor Length (7)
  DB    5                                        ; bDescriptorType: ENDPOINT
  DB    (EP2 | USB_DIR_IN)                       ; bEndpointAddress
  DB    3                                        ; bmAttributes
  DWL   1                                        ; wMaxPacketSize
  DB    50                                       ; bInterval
;----------------------------------------------------------------------
USB_D0_C1_DESCR_END:
USB_D0_C1_DESCR_SIZE:	EQU	(USB_D0_C1_DESCR_END - USB_D0_C1_DESCR_START)
.ENDLITERAL
;----------------------------------------------------------------------
; HID Class Report Descriptors
;
; This section contains the HID Class Report Descriptors generated
; by the USB User Module Descriptor Generator
;
;----------------------------------------------------------------------
; HID Report Descriptor (HID_RPT_1}
;----------------------------------------------------------------------
AREA  UserModules     (ROM,REL,CON)
.LITERAL
USB_HID_REPORT_1_DESCR_START:                    ;
    DB     06H, 00H, FFH                         ; Usage Page
    DB     09H, 01H                              ; Usage
    DB     A1H, 01H                              ; Collection
    DB     19H, 01H                              ; Usage Minimum
    DB     29H, 02H                              ; Usage Maximum
    DB     15H, 80H                              ; Logical Minimum
    DB     25H, 7FH                              ; Logical Maximum
    DB     75H, 08H                              ; Report Size
    DB     95H, 01H                              ; Report Count
    DB     81H, 02H                              ; Input
    DB     19H, 01H                              ; Usage Minimum
    DB     29H, 02H                              ; Usage Maximum
    DB     91H, 02H                              ; Output
    DB     C0H                                   ; End Collection
USB_HID_REPORT_1_DESCR_END:                      ;
USB_HID_REPORT_1_DESCR_SIZE:  EQU    (USB_HID_REPORT_1_DESCR_END - USB_HID_REPORT_1_DESCR_START)
.ENDLITERAL
;----------------------------------------------------------------------
; End HID Report Descriptor (HID_RPT_1}
;----------------------------------------------------------------------
; HID Report Sizes (HID_RPT_1}
;----------------------------------------------------------------------
USB_HID_RPT_1_IN_RPT_SIZE:  EQU    8             ; TODO: Optimize report size
;----------------------------------------------------------------------
USB_HID_RPT_1_OUT_RPT_SIZE:  EQU    8            ; TODO: Optimize report size
;----------------------------------------------------------------------
USB_HID_RPT_1_FEATURE_RPT_SIZE:  EQU    0        ; No FEATURE Reports are defined.  Size set to 0.
;----------------------------------------------------------------------
;----------------------------------------------------------------------
; USB String Descriptors
;
; This section contains the USB String Descriptors generated
; by the USB User Module Descriptor Generator
;
; Note:  The string labels are internally generated by the
; descriptor generator
;
; Descriptors that reference string descriptors, use a hashed
; symbol that is set in an EQU directive with each string
; descriptor.
;----------------------------------------------------------------------
STR_HASH_0:  EQU    0                            ; String Hash for the null string
AREA  UserModules     (ROM,REL,CON)
EXPORT USB_StringTable
.LITERAL
USB_StringTable:                                 
  TD_START_TABLE 4                               ; Number of USB Strings
  TD_ENTRY       USB_DS_ROM, LANGID_DESCR_SIZE, LANGID_DESCR_START, NULL_PTR
  TD_ENTRY       USB_DS_ROM, STRING_2_DESCR_SIZE, STRING_2_DESCR_START, NULL_PTR
  TD_ENTRY       USB_DS_ROM, STRING_3_DESCR_SIZE, STRING_3_DESCR_START, NULL_PTR
  TD_ENTRY       USB_DS_ROM, STRING_4_DESCR_SIZE, STRING_4_DESCR_START, NULL_PTR
;----------------------------------------------------------------------
; LANGID Descriptor
;----------------------------------------------------------------------
LANGID_DESCR_START:                              
  DB    ((1 * 2) + 2)                            ; bLength (N+2)
  DB    3                                        ; bDescriptorType (STRING)
  DWL   1033                                     ;
LANGID_DESCR_END:                                
LANGID_DESCR_SIZE:  EQU    (LANGID_DESCR_END - LANGID_DESCR_START)
;----------------------------------------------------------------------
; String Desciptor
;----------------------------------------------------------------------
STR_HASH_2:  EQU    1                            ; String Hash
STRING_2_DESCR_START:                            
  DB    STRING_2_DESCR_SIZE                      ; bLength
  DB    3                                        ; bDescriptorType (STRING)
  DSU   "USB Design By Example"                  ;
STRING_2_DESCR_END:                              
STRING_2_DESCR_SIZE:  EQU    (STRING_2_DESCR_END - STRING_2_DESCR_START)
;----------------------------------------------------------------------
; String Desciptor
;----------------------------------------------------------------------
STR_HASH_3:  EQU    2                            ; String Hash
STRING_3_DESCR_START:                            
  DB    STRING_3_DESCR_SIZE                      ; bLength
  DB    3                                        ; bDescriptorType (STRING)
  DSU   "Example 1: Buttons and Lights"          ;
STRING_3_DESCR_END:                              
STRING_3_DESCR_SIZE:  EQU    (STRING_3_DESCR_END - STRING_3_DESCR_START)
;----------------------------------------------------------------------
; String Desciptor
;----------------------------------------------------------------------
STR_HASH_4:  EQU    3                            ; String Hash
STRING_4_DESCR_START:                            
  DB    STRING_4_DESCR_SIZE                      ; bLength
  DB    3                                        ; bDescriptorType (STRING)
  DSU   "SN:000001"                              ;
STRING_4_DESCR_END:                              
STRING_4_DESCR_SIZE:  EQU    (STRING_4_DESCR_END - STRING_4_DESCR_START)
.ENDLITERAL

;-----------------------------------------------
; End of Descriptors
;-----------------------------------------------

ELSE
   ;---------------------------------------------------
   ;@PSoC_UserCode_BODY_2@ (Do not change this line.)
   ;---------------------------------------------------
   ; Redefine your descriptor table below. You might
   ; cut and paste code from the WIZARD descriptor
   ; above and then make your changes.
   ;---------------------------------------------------

   
   ;---------------------------------------------------
   ; Insert your custom code above this banner
   ;---------------------------------------------------
   ;@PSoC_UserCode_END@ (Do not change this line.)
ENDIF
; End of File USB_descr.asm

⌨️ 快捷键说明

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