📄 usb_descr.lis
字号:
0000 USB_VSR_SUPPORT: EQU 0
IF USB_CB_h2d_vnd_dev
USB_VSR_SUPPORT: EQU 1
ENDIF
IF USB_CB_h2d_vnd_ifc
USB_VSR_SUPPORT: EQU 1
ENDIF
IF USB_CB_h2d_vnd_ep
USB_VSR_SUPPORT: EQU 1
ENDIF
IF USB_CB_h2d_vnd_oth
USB_VSR_SUPPORT: EQU 1
ENDIF
IF USB_CB_d2h_vnd_dev
USB_VSR_SUPPORT: EQU 1
ENDIF
IF USB_CB_d2h_vnd_ifc
USB_VSR_SUPPORT: EQU 1
ENDIF
IF USB_CB_d2h_vnd_ep
USB_VSR_SUPPORT: EQU 1
ENDIF
IF USB_CB_d2h_vnd_oth
USB_VSR_SUPPORT: EQU 1
ENDIF
; end of file USB.inc
0000 MACRO GET_WORD
0000 PUSH A ; Quickly get a RAM temp
0000 PUSH A ; Save the source MSB
0000 ROMX ; Get the first byte
0000 PUSH X ; Save X
0000 MOV X,SP ; Get SP, to index to the temp
0000 MOV [X - 3],A ; Save the first byte
0000 POP X ; Get back the source LSB
0000 POP A ; And the MSB
0000 INC X ; Point to the second byte
0000 ADC A, 0 ;
0000 ROMX ; Get the second byte
0000 MOV X,A ; Save it in X
0000 POP A ; And the first byte in A
0000 MACRO NULL_PTR_CHECK
0000 SWAP A, X ; LSB non-zero?
0000 JNZ .ok ; Exit on non-zero
0000 SWAP A, X ; MSB zero
0000 JZ @0 ; Jump to the null pointer handler
0000 JMP .exit
0000 .ok:
0000 SWAP A, X ; Put them back
0000 .exit:
0000 NULL_PTR: EQU 0 ; Null pointer value
0000
0000 ;--------------------------------------------------
0000 ; Transfer Descriptor--Data Source
0000 ;--------------------------------------------------
0000 USB_DS_ROM: EQU 0x00
0001 USB_DS_RAM: EQU 0x01
0002 USB_DS_RAM_CB: EQU 0x02
0003 USB_DS_RAM_MASK: EQU 0x03
0000
0000 ;--------------------------------------------------
0000 ; TRANSFER DESCRIPTOR MACROS
0000 ;--------------------------------------------------
0000
0000 ;-----------------------------------------------
0000 ; TD_START_TABLE MACRO
0000 ;-----------------------------------------------
0000 ; Parameters:
0000 ; @0 = Number of table entries
0000 ; Register setup
0000 ; N/A (builds ROM data at assembly time)
0000 ;-----------------------------------------------
0000 MACRO TD_START_TABLE
0000 DB ((@0) - 1) ; Number of table entries - 1
0000 MACRO TD_ENTRY
0000 DB @0 ; Data source (USB_DS_*)
0000 DW @1 ; Transfer size
0000 DW @2 ; Data source address
0000 DW @3 ; Transfer Completion Status Block Address
0000 DB 0xde ; Reserved
0008 TD_ENTRY_SIZE: EQU 8
0001 TD_START_SIZE: EQU 1
0000 ;-----------------------------------------------
0000 ; TD_INDEX_TO_OFFSET MACRO
0000 ;-----------------------------------------------
0000 ; Parameters:
0000 ; @0 = RAM address of Index
0000 ; Register setup
0000 ; A = DC (restored)
0000 ; X = DC (not used)
0000 ;--------------------------------------------------
0000 MACRO TD_INDEX_TO_OFFSET
0000 PUSH A ; Save a work register
0000 ASL [@0] ; Index * 2
0000 ASL [@0] ; Index * 4
0000 ASL [@0] ; Index * 4
0000 POP A ; Restore the work register
0000 MACRO LT_START
0000 DB (@0) ; Table size
0000 MACRO LT_ENTRY
0000 DW (@0) ; Table entry
0000 DW (@1) ; Table entry
0002 LT_ENTRY_SIZE: EQU 2
0001 LT_START_SIZE: EQU 1
0000
0000 ;-----------------------------------------------
0000 ; LT_INDEX_TO_OFFSET MACRO
0000 ;-----------------------------------------------
0000 ; Parameters:
0000 ; @0 = RAM address of Index
0000 ; Register setup
0000 ; A = DC (not used)
0000 ; X = DC (not used)
0000 ;--------------------------------------------------
0000 MACRO LT_INDEX_TO_OFFSET
0000 ASL [@0] ; Simply shift (mult by 2)
0000 ASL [@0] ; (mult by 4)
0000 MACRO DISPATCHER
0000 CMP A,@1
0000 JNC .dispatch_not_supported
0000 ASL A
0000 JACC @0
0000 .dispatch_not_supported:
0000 JMP @2
0001 USB_NOT_SUPPORTED: EQU 0x01
0002 USB_UM_SUPPLIED: EQU 0x02
0004 USB_APP_SUPPLIED: EQU 0x04
0000 ; end of file USB_macro.inc
0000
0001 WIZARD: equ 1
0001 WIZARD_DEFINED_REPORT_STORAGE: EQU 1
0000 ;---------------------------------------------------
0000 ;@PSoC_UserCode_BODY_1@ (Do not change this line.)
0000 ;---------------------------------------------------
0000 ; Insert your custom code below this banner
0000 ;---------------------------------------------------
0000 ; Redefine the WIZARD equate to 0 below by
0000 ; uncommenting the WIZARD: equ 0 line
0000 ; to allow your custom descriptor to take effect
0000 ;---------------------------------------------------
0000
0000 ; WIZARD: equ 0
0000 ; WIZARD_DEFINED_REPORT_STORAGE: EQU 0
0000
0000 ;---------------------------------------------------
0000 ; Insert your custom code above this banner
0000 ;---------------------------------------------------
0000 ;@PSoC_UserCode_END@ (Do not change this line.)
0000
IF WIZARD
;-----------------------------------------------
; 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
0000 .LITERAL
0000 USB_DEVICE_LOOKUP: ;
0000 01 DB (1) ; Table size
0001 0005 DW (USB_D0_CONFIG_LOOKUP) ; Table entry
0003 004E DW (USB_D0_CONFIG_DESCR_TABLE) ; Table entry
0005 .ENDLITERAL
0005
0005 ;----------------------------------------------------------------------
0005 ; Configuration Dispatch Table
0005 ; for Device: (USB_D0)
0005 ;----------------------------------------------------------------------
AREA func_lit (ROM,REL,CON)
EXPORT USB_D0_CONFIG_LOOKUP
0005 .LITERAL
0005 USB_D0_CONFIG_LOOKUP: ;
0005 01 DB (1) ; Table size
0006 0010 DW (USB_D0_C1_EP_SETUP) ; Table entry
0008 000A DW (USB_D0_C1_INTERFACE_LOOKUP) ; Table entry
000A .ENDLITERAL
000A
000A ;----------------------------------------------------------------------
000A ; Interface Look Up Table
000A ;
000A ; This look up table points to three tables. Each of those tables is
000A ; indexed by the selected interface number provided by the request.
000A ;
000A ; Item 0: HID Report GET_REPORT/SET_REPORT Lookup Table
000A ; Item 1: HID Report Descriptor Transfer Descriptor Table
000A ; Item 2: HID Class Descriptor Transfer Descriptor Table
000A ;----------------------------------------------------------------------
AREA func_lit (ROM,REL,CON)
EXPORT USB_D0_C1_INTERFACE_LOOKUP
000A .LITERAL
000A USB_D0_C1_INTERFACE_LOOKUP: ;
000A 0012 DW USB_D0_C1_INTERFACE_RPT_LOOKUP ; Interface GET_REPORT/SET_REPORT Lookup Table
000C 001D DW USB_D0_C1_HID_RPT_DESCR_TABLE ; HID Report Descriptor Transfer Descriptor Table
000E 0014 DW USB_D0_C1_HID_CLASS_DESCR_TABLE ; HID Class Descriptor Transfer Descriptor Table
0010 .ENDLITERAL
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -