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

📄 usb.lis

📁 Cypress cy7c63318 鼠标开发板的源代码
💻 LIS
📖 第 1 页 / 共 5 页
字号:
 0000           USB_CB_h2d_cls_oth: equ 0
 0000           USB_CB_d2h_cls_dev: equ 0
 0001           USB_CB_d2h_cls_ifc: equ 1
 0000           USB_CB_d2h_cls_ep:  equ 0
 0000           USB_CB_d2h_cls_oth: equ 0
 0000           
 0000           ;-----------------------------------------------
 0000           ; 1st Tier Dispatch--Vendor Specific Requests
 0000           ;-----------------------------------------------
 0000           USB_CB_h2d_vnd_dev: equ 0
 0000           USB_CB_h2d_vnd_ifc: equ 0
 0000           USB_CB_h2d_vnd_ep:  equ 0
 0000           USB_CB_h2d_vnd_oth: equ 0
 0000           USB_CB_d2h_vnd_dev: equ 0
 0000           USB_CB_d2h_vnd_ifc: equ 0
 0000           USB_CB_d2h_vnd_ep:  equ 0
 0000           USB_CB_d2h_vnd_oth: equ 0
 0000           
 0000           ;-----------------------------------------------
 0000           ; 1st Tier Dispatch--Reserved Requests
 0000           ;-----------------------------------------------
 0000           USB_CB_h2d_rsv_dev: equ 0
 0000           USB_CB_h2d_rsv_ifc: equ 0
 0000           USB_CB_h2d_rsv_ep:  equ 0
 0000           USB_CB_h2d_rsv_oth: equ 0
 0000           USB_CB_d2h_rsv_dev: equ 0
 0000           USB_CB_d2h_rsv_ifc: equ 0
 0000           USB_CB_d2h_rsv_ep:  equ 0
 0000           USB_CB_d2h_rsv_oth: equ 0
 0000           
 0000           ;-----------------------------------------------
 0000           ; Endpoint event flags
 0000           ;-----------------------------------------------
 0002           NO_EVENT_ALLOWED:   equ               2
 0001           EVENT_PENDING:      equ               1
 0000           NO_EVENT_PENDING:   equ               0
 0000           
 0000           IN_BUFFER_FULL:     equ               NO_EVENT_PENDING
 0001           IN_BUFFER_EMPTY:    equ               EVENT_PENDING
 0001           OUT_BUFFER_FULL:    equ               EVENT_PENDING
 0000           OUT_BUFFER_EMPTY:   equ               NO_EVENT_PENDING
 0000           
 0000           ;-----------------------------------------------
 0000           ; HID Descriptor Types
 0000           ;-----------------------------------------------
 0021           DESCR_TYPE_HID_CLASS:        equ      0x21
 0009           DESCR_SIZE_HID_CLASS:        equ      9
 0022           DESCR_TYPE_HID_REPORT:       equ      0x22
 0023           DESCR_TYPE_HID_PHYSICAL:     equ      0x23
 0000           
 0000           ;-----------------------------------------------
 0000           ; Transfer Completion Notification
 0000           ;-----------------------------------------------
 0000           USB_XFER_IDLE:         equ      0x00
 0001           USB_XFER_STATUS_ACK:   equ      0x01
 0002           USB_XFER_PREMATURE:    equ      0x02
 0003           USB_XFER_ERROR:        equ      0x03
 0000           
 0000           ; This macro is used to allocate a completion status block
 0000           ; for all Requests.  The macro parameter is used
 0000           ; to prefix the two data elements.
 0000           USB_XFER_STATUS:       equ      0
 0001           USB_XFER_LENGTH:       equ      1
 0000           MACRO    USB_XFER_STATUS_BLOCK
 0000               BLK    1    ; Completion Status
 0000               BLK    2    ; Transfer Length
 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
                IF 0x2 & 0x10000000
                PSOC_ERROR Please run the USB Setup Wizard.  Device Editor, Right Click the USB User Module
                ; This message will only appear if the USB Setup Wizard has not be run and the descriptors
                ; and associated data structures have been created.
                ; After running the USB Setup Wizard, you must also select the Config/Generate Application
                ; menu item from PSoC Designer in order to generate USB User Module data structures and
                ; descriptors.
                ENDIF
                ;-----------------------------------------------
                ;  Global Symbols
                ;-----------------------------------------------
                EXPORT USB_Start
                EXPORT _USB_Start
                EXPORT USB_Stop
                EXPORT _USB_Stop
                EXPORT USB_bCheckActivity
                EXPORT _USB_bCheckActivity
                EXPORT USB_bGetConfiguration
                EXPORT _USB_bGetConfiguration
                EXPORT USB_bGetEPState
                EXPORT _USB_bGetEPState
                EXPORT USB_bGetEPCount
                EXPORT _USB_bGetEPCount
                EXPORT USB_XLoadEP
                EXPORT _USB_XLoadEP
                EXPORT USB_EnableOutEP
                EXPORT _USB_EnableOutEP
                EXPORT USB_DisableOutEP
                EXPORT _USB_DisableOutEP
                EXPORT USB_EnableEP
                EXPORT _USB_EnableEP
                EXPORT USB_DisableEP
                EXPORT _USB_DisableEP
                EXPORT USB_Force
                EXPORT _USB_Force
                EXPORT USB_Suspend
                EXPORT _USB_Suspend
                EXPORT USB_Resume
                EXPORT _USB_Resume
                EXPORT USB_bRWUEnabled
                EXPORT _USB_bRWUEnabled
                
                AREA bss (RAM,REL)
                ;-----------------------------------------------
                ;  Variable Allocation
                ;-----------------------------------------------
                ;----------------------------------------------------------------------------
                EXPORT USB_APITemp
 0000            USB_APITemp:                          BLK   2 ; Two bytes of temporary
 0002                                                           ; storage shared by the API
 0002                                                           ; functions
                EXPORT USB_APIEPNumber, _USB_APIEPNumber
 0002           _USB_APIEPNumber:
 0002            USB_APIEPNumber:                      BLK   1 ; API storage for speed
                EXPORT USB_APICount, _USB_APICount
 0003           _USB_APICount:
 0003            USB_APICount:                         BLK   1 ; API storage for speed
 0004           
                EXPORT USB_bActivity
 0004            USB_bActivity:                        BLK   1 ; Activity flag (Shared between the ISR and API)
 0005           ;-----------------------------------------------
 0005           ;  Constant Data Allocation
 0005           ;-----------------------------------------------
                AREA UserModules (ROM, REL)
                EXPORT USB_USB_EP_BIT_LOOKUP
 0000           .LITERAL
 0000           USB_USB_EP_BIT_LOOKUP:  ;
 0000 01            DB     01H                       ; EP0
 0001 02            DB     02H                       ; EP1
 0002 04            DB     04H                       ; EP2
 0003           .ENDLITERAL
 0003           
                AREA UserModules (ROM, REL)
                
                ;-----------------------------------------------------------------------------
                ;  FUNCTION NAME: USB_Start
                ;
                ;  DESCRIPTION:    Starts the USB User Module
                ;                    Sets the device selection
                ;                    Set the configuration to unconfigured
                ;                    Enables the SIE for Address 0
                ;                    Enables the USB pullup (D- for low speed, D+ for full speed)
                ;
                ;-----------------------------------------------------------------------------
                ;
                ;  ARGUMENTS:    A is the desired device setting
                ;
                ;  RETURNS:
                ;
                ;  SIDE EFFECTS: REGISTERS ARE VOLATILE: THE A AND X REGISTERS MAY BE MODIFIED!
                ;
                ;  THEORY of OPERATION or PROCEDURE:
                ;
                ;-----------------------------------------------------------------------------
 0003           .SECTION
 0003            USB_Start:
 0003           _USB_Start:
 0003 620D00        MOV    REG[P10CR], 0x00            ; Disable the states
 0006 620E00        MOV    REG[P11CR], 0x00            ; 
 0009           
 0009 5300          MOV     [USB_bCurrentDevice], A    ; The app selects the desired device
 000B           
 000B 550000        MOV     [USB_TransferType], USB_TRANS_STATE_IDLE ; Transaction Idle State
 000E 550000        MOV     [USB_Configuration], 0     ; Unconfigured
 0011 550000        MOV     [USB_DeviceStatus], 0      ; Clears device status
 0014           
 0014 550000        MOV     [USB_EPDataToggle], 0      ; Clear all EP data toggles
 0017           
 0017           ; Flow here to enable the SIE
 0017 624080        MOV     REG[USB_ADDR], USB_ADDR_ENABLE ; Enable Address 0
 001A 437480        OR      REG[USB_USBXCR], USB_PULLUP_ENABLE ; Pullup D-
 001D 624403        MOV     REG[USB_EP0MODE], USB_MODE_STALL_IN_OUT ; ACK Setup/Stall IN/OUT
 0020 40            NOP
 0021 5D44          MOV     A, REG[USB_EP0MODE]        ; Read the mode register as a debug marker
 0023           
 0023 43E119        or    reg[INT_MSK1], (INT_MSK1_USB_ACTIVITY | INT_MSK1_USB_BUS_RESET | INT_MSK1_USB_EP0)               ; enable specified interrupt enable bit
 0026 7F            RET
 0027           .ENDSECTION
 0027           ;-----------------------------------------------------------------------------
 0027           ;  FUNCTION NAME: USB_Stop
 0027           ;
 0027           ;  DESCRIPTION:
 0027           ;
 0027           ;-----------------------------------------------------------------------------

⌨️ 快捷键说明

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