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

📄 ex.lst

📁 这是使用CYPRESS的7C637xx芯片完成USB鼠标的例子。
💻 LST
📖 第 1 页 / 共 5 页
字号:
CYASM Version 1.91
(C) 1998,1999,2000 Cypress Semiconductor Corp.

0000            ;***************************************************************************
0000            ;
0000            ; File: 637mouse.asm
0000            ; Version: 1.02
0000            ; Description: This code provides both PS/2 and USB support for a combi
0000            ;              mouse
0000            ; Target: Cypress CY7C63743
0000            ;
0000            ; Overview
0000            ;        On power up, the firmware starts executing code at address 0h. 
0000            ; After some housekeeping tasks it will determine whether it is attached to
0000            ; a USB or a PS2 interface. From that, it will branch either to USB_Main or
0000            ; PS2_Main.
0000            ;
0000            ; PS2 Overview
0000            ;        There are four main tasks:
0000            ;        * PS2_Main
0000            ;        * buttons (common to USB and PS2)
0000            ;        * optics (common to USB and PS2)
0000            ;        * PS2_DoCommand - processing of PS2 commands from host
0000            ;
0000            ; PS2_Main
0000            ;        This routine initializes the PS2 variables, the IO ports, computes
0000            ; the (X,Y) coordinates of mouse movement, the Z-coordinate of wheel motion,
0000            ; if needed, determines which button has been pressed and sends out a mouse 
0000            ; packet to a host.
0000            ;
0000            ; PS2_DoCommand
0000            ;        When a host wants to send data to the mouse it will drive the
0000            ; SDATA line low. The PS2_Main task will continuously poll it and will clock 
0000            ; in the data. The latter will be parsed and processed.
0000            ;
0000            ; USB Overview
0000            ;        There are also four main tasks: 
0000            ;        * USB_Main
0000            ;        * buttons (common to USB and PS2)
0000            ;        * optics (common to USB and PS2)
0000            ;        * suspend/resume 
0000            ;
0000            ; USB_Main
0000            ;        This routine initializes the USB variables, the IO ports, the mouse
0000            ; logic, and the data space. All USB communication occurs on an interrupt 
0000            ; basis.
0000            ; 
0000            ;        Endpoint 0 is used to support Control Transfers and vendor specific
0000            ; requests.  During enumeration setup commands are sent to endpoint1 to 
0000            ; initialize the USB device and to extract configuration information from the
0000            ; device
0000            ;
0000            ;        Endpoint 1 is used to transfer interrupt data back to the host.  
0000            ; In this case we transfer data from the button and optics back to the host. 
0000            ;
0000            ; Buttons
0000            ;        The buttons are polled every millisecond inside the 1ms handler and
0000            ; processed in the main task loop.
0000            ;
0000            ; Optics
0000            ;        The optics for mouse mouvement (X,Y,Z) are continuously polled
0000            ; and processed in the main task loop.  The quadrature state of the optics
0000            ; tells us which direction the mouse is moving in. This data is sent back to
0000            ; the host as an offset from the last time the mouse was polled for data by
0000            ; the host. Further, for PS/2, the optics will be polled and processed every
0000            ; time a bit is sent out or received. This prevents missing any optics count
0000            ; during PS2 data transfer.
0000            ;
0000            ; Suspend/Resume
0000            ;        Every millisecond, the USB is polled for activity. If no activity
0000            ; occurs for three milliseconds, then it is assumed that the USB is in 
0000            ; suspend.  Because this device supports remote wakeup, pressing the buttons
0000            ; or moving the mouse causes the firmware to send resume signalling back 
0000            ; to the host to wakeup and resume operation.
0000            ;
0000            ; Endpoint1 packet definition
0000            ;     Byte      Usage
0000            ;      0    Button Data 7-3 Not used, 2=middle, 1=right, 0=left
0000            ;      1    horizontal displacement measured via the optics
0000            ;      2    vertical displacement measured via the optics
0000            ;      3    z-displacement (wheel) measured via the optics
0000            ;
0000            ; Revisions:
0000            ;    10/09/00: Original Version. Taken from u5combi.asm, v.1.03
0000            ;
0000            ;    1.00    
0000            ;       Fixed the Chapter 9 Test - device remote wakeup
0000            ;
0000            ;    1.01    
0000            ;       Fixed the suspend current requirements by explicitly writing SUSPEND
0000            ; and RUN bits of the processor status control register when going into 
0000            ; suspend
0000            ;
0000            ;    1.02
0000            ;       Convert TABS into spaces. No code change.
0000            ;    
0000            ;***************************************************************************
0000            ;
0000            ;        Copyright 2000 Cypress Semiconductor
0000            ;    This code is provided by Cypress as a reference.  Cypress makes no
0000            ;    claims or warranties to this firmware's suitability for any 
0000            ;    application. 
0000            ;
0000            ;*************************************************************************** 
0000            
0000                CPU    63743
0000            
0000                XPAGEON
0000            
0000            ;**************************************
0000            ; Processor specific definitions
0000            
0000            ep2DmaBuff:                     equ     E8h
0000            ep2DmaBuff0:                    equ     ep2DmaBuff+0
0000            ep2DmaBuff1:                    equ     ep2DmaBuff+1
0000            ep2DmaBuff2:                    equ     ep2DmaBuff+2
0000            ep2DmaBuff3:                    equ     ep2DmaBuff+3
0000            ep2DmaBuff4:                    equ     ep2DmaBuff+4
0000            ep2DmaBuff5:                    equ     ep2DmaBuff+5
0000            ep2DmaBuff6:                    equ     ep2DmaBuff+6
0000            ep2DmaBuff7:                    equ     ep2DmaBuff+7
0000            
0000            ep1DmaBuff:                     equ     F0h
0000            ep1DmaBuff0:                    equ     ep1DmaBuff+0
0000            ep1DmaBuff1:                    equ     ep1DmaBuff+1
0000            ep1DmaBuff2:                    equ     ep1DmaBuff+2
0000            ep1DmaBuff3:                    equ     ep1DmaBuff+3
0000            ep1DmaBuff4:                    equ     ep1DmaBuff+4
0000            ep1DmaBuff5:                    equ     ep1DmaBuff+5
0000            ep1DmaBuff6:                    equ     ep1DmaBuff+6
0000            ep1DmaBuff7:                    equ     ep1DmaBuff+7
0000            
0000            ep0DmaBuff:                     equ     F8h
0000            ep0DmaBuff0:                    equ     ep0DmaBuff+0
0000            ep0DmaBuff1:                    equ     ep0DmaBuff+1
0000            ep0DmaBuff2:                    equ     ep0DmaBuff+2
0000            ep0DmaBuff3:                    equ     ep0DmaBuff+3
0000            ep0DmaBuff4:                    equ     ep0DmaBuff+4
0000            ep0DmaBuff5:                    equ     ep0DmaBuff+5
0000            ep0DmaBuff6:                    equ     ep0DmaBuff+6
0000            ep0DmaBuff7:                    equ     ep0DmaBuff+7
0000            
0000            
0000            
0000            ;**************************************
0000            ; register definitions
0000            
0000            PORT0:                          equ     00h ; GPIO data port 0
0000            PORT1:                          equ     01h ; GPIO data port 1
0000            PORT2:                          equ     02h ; GPIO data port 2
0000                    SCLK:                   equ     20h
0000                    DPLUS:                  equ     20h
0000                    SDATA:                  equ     10h
0000                    DMINUS:                 equ     10h
0000                    XTALIN:                 equ     02h
0000                    VREG:                   equ     01h
0000            
0000            PORT0_INT:                      equ     04h ; Interrupt enable for Port 0
0000            PORT1_INT:                      equ     05h ; Interrupt enable for Port 1
0000            PORT0_INT_POLARITY:             equ     06h ; Interrupt polarity for Port 0
0000            PORT1_INT_POLARITY:             equ     07h ; Interrupt polarity for Port 1
0000            
0000            PORT0_MODE0:                    equ     0Ah ; Mode Configuration 0 for Port 0
0000            PORT0_MODE1:                    equ     0Bh ; Mode Configuration 1 for Port 0
0000            PORT1_MODE0:                    equ     0Ch ; Mode Configuration 0 for Port 1
0000            PORT1_MODE1:                    equ     0Dh ; Mode Configuration 1 for Port 1
0000            
0000            USB_ADDRESS:                    equ     10h ; USB device address
0000                    ADDRESS_ENABLE:         equ     80h
0000                    ADDRESS_MASK:           equ     7Fh
0000            
0000            EP0_COUNT:                      equ     11h     ; Endpoint 0 counter
0000                    DATA_TOGGLE:            equ     80h
0000                    DATA_VALID:             equ     40h
0000                    BYTE_COUNT:             equ     0Fh
0000            
0000            EP0_MODE:                       equ     12h ; Endpoint 0 configuration
0000                    EP0_SETUP:              equ     80h
0000                    EP0_IN:                 equ     40h
0000                    EP0_OUT:                equ     20h
0000                    EP0_ACK:                equ     10h
0000                    MODE_MASK:              equ     0Fh
0000            
0000            EP1_COUNT:                      equ     13h ; Endpoint 1 counter
0000            EP1_MODE:                       equ     14h ; Endpoint 1 configuration
0000            EP2_COUNT:                      equ     15h ; Endpoint 2 counter
0000            
0000            EP2_MODE:                       equ     16h ; Endpoint 2 configuration
0000                    EP_STALL:               equ     80h
0000                    EP_ACK:                 equ     10h
0000            
0000            USB_STATUS_CONTROL_REG:         equ     1Fh ; USB upstream status and control
0000                    PS2_PULLUP:             equ     80h
0000                    VREG_ENABLE:            equ     40h
0000                    USB_PS2_MODE:           equ     20h
0000                    BUS_ACTIVITY:           equ     08h
0000                    CONTROL2:               equ     04h
0000                    CONTROL1:               equ     02h
0000                    CONTROL0:               equ     01h
0000            
0000                    NOT_FORCING:            equ     00h
0000                    FORCE_K:                equ     01h
0000                    FORCE_J:                equ     02h
0000                    FORCE_SE0:              equ     03h
0000                    FORCEBOTH_LOW:          equ     04h
0000                    FORCESDATA_LOW:         equ     05h
0000                    FORCESCLK_LOW:          equ     06h
0000                    FORCE_HIZ:              equ     07h
0000            
0000            GLOBAL_INTERRUPT_REG:                   equ     20h ; Global interrupt enable
0000                    WAKEUP_INT:             equ     80h
0000                    GPIO_INT:               equ     40h
0000                    CAPTUREB_INT:           equ     20h
0000                    CAPTUREA_INT:           equ     10h
0000                    SPI_INT:                equ     08h
0000                    1MS_INT:                equ     04h
0000                    128US_INT:              equ     02h
0000                    USB_RESET_INT:          equ     01h
0000            
0000            ENDPOINT_INT:                   equ     21h ; USB endpoint interrupt enable
0000                    EP2_INT:                equ     04h
0000                    EP1_INT:                equ     02h
0000                    EP0_INT:                equ     01h
0000            
0000            TIMER_LSB:                      equ     24h ; Lower eight bits of timer
0000            TIMER_MSB:                      equ     25h ; Upper six bits of timer
0000            WATCHDOG_REG:                   equ     26h ; Clear watchdog Timer
0000            
0000            CAPTUREA_RISING:                equ     40h ; Capture timer A rising register
0000            CAPTUREA_FALLING:               equ     41h ; Capture timer A falling register
0000            CAPTUREB_RISING:                equ     42h ; Capture timer B rising register
0000            CAPTUREB_FALLING:               equ     43h ; Capture timer B falling register
0000            
0000            CAPTURE_CONFIG:                 equ     44h ; Capture timer configuration register
0000                    FIRST_EDGE_HOLD:        equ     80h
0000                    PRESCALE:               equ     70h
0000                    PRESCALE2:              equ     40h
0000                    PRESCALE1:              equ     20h
0000                    PRESCALE0:              equ     10h
0000                    CAPTUREB_FALL_INT:      equ     08h
0000                    CAPTUREB_RISE_INT:      equ     04h
0000                    CAPTUREA_FALL_INT:      equ     02h
0000                    CAPTUREA_RISE_INT:      equ     01h
0000            
0000            CAPTURE_STATUS:                 equ     45h ; Capture timer status register
0000                    CAPTUREB_FALL_EVENT:    equ     08h
0000                    CAPTUREB_RISE_EVENT:    equ     04h
0000                    CAPTUREA_FALL_EVENT:    equ     02h

⌨️ 快捷键说明

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