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

📄 ex.lst

📁 这是使用CYPRESS的7C637xx芯片完成USB鼠标的例子。
💻 LST
📖 第 1 页 / 共 5 页
字号:
0000            ;
0000            ; EP0 In-Transaction State Machine
0000            ;
0000            EP0_IN_IDLE:                    equ    00h
0000            CONTROL_READ_DATA:              equ    02h
0000            NO_DATA_STATUS:                 equ    04h
0000            EP0_IN_STALL:                   equ    06h
0000            
0000            ;
0000            ; EP0 No-Data Control Flags
0000            ;
0000            ADDRESS_CHANGE_PENDING:         equ    00h
0000            NO_CHANGE_PENDING:              equ    02h
0000            
0000            ;
0000            ; Response Sizes
0000            ;
0000            DEVICE_STATUS_LENGTH:           equ    2
0000            DEVICE_CONFIG_LENGTH:           equ    1
0000            ENDPOINT_STALL_LENGTH:          equ    2
0000            INTERFACE_STATUS_LENGTH:        equ    2
0000            INTERFACE_ALTERNATE_LENGTH:     equ    1
0000            INTERFACE_PROTOCOL_LENGTH:      equ    1
0000            
0000            ;
0000            ; General Constants
0000            ;
0000            BIT0:                           equ    01h
0000            BIT1:                           equ    02h
0000            BIT2:                           equ    04h
0000            BIT3:                           equ    08h
0000            BIT4:                           equ    10h
0000            BIT5:                           equ    20h
0000            BIT6:                           equ    40h
0000            BIT7:                           equ    80h
0000            
0000            ;
0000            ; Interface Constants - they need to be redefined for a new hardware platform
0000            ;
0000            DUAL_DSP_DATA:                  equ    20h      ; top of data stack 
0000                                                            ; (for PUSH/POP instructions)
0000            LEFT_BUTTON_PORT:               equ    PORT0
0000            LEFT_BUTTON_MASK:               equ    BIT7
0000            
0000            RIGHT_BUTTON_PORT:              equ    PORT1
0000            RIGHT_BUTTON_MASK:              equ    BIT0
0000            
0000            MIDDLE_BUTTON_PORT:             equ    PORT1
0000            MIDDLE_BUTTON_MASK:             equ    BIT1
0000            
0000            OPTICS_PORT:                    equ    PORT0
0000            
0000            X_LEFT_OPTICS_PORT:             equ    PORT0
0000            X_LEFT_OPTICS_MASK:             equ    BIT0
0000            X_RIGHT_OPTICS_PORT:            equ    PORT0
0000            X_RIGHT_OPTICS_MASK:            equ    BIT1
0000            
0000            Y_LEFT_OPTICS_PORT:             equ    PORT0
0000            Y_LEFT_OPTICS_MASK:             equ    BIT2
0000            Y_RIGHT_OPTICS_PORT:            equ    PORT0
0000            Y_RIGHT_OPTICS_MASK:            equ    BIT3
0000            
0000            Z_UP_OPTICS_PORT:               equ    PORT0
0000            Z_UP_OPTICS_MASK:               equ    BIT4
0000            Z_DOWN_OPTICS_PORT:             equ    PORT0
0000            Z_DOWN_OPTICS_MASK:             equ    BIT5
0000            
0000            LED_PORT:                       equ    PORT0
0000            LED_MASK:                       equ    BIT6
0000                ;
0000                ; Normal operating mode - configure buttons as resistive/CMOS
0000                ; LED as medium sink/CMOS and optics (x,y,z) as HI-Z/CMOS
0000                ;
0000            PORT0_NORMAL:                   equ    80h
0000            PORT0_MODE1_NORMAL:             equ    80h
0000            PORT0_MODE0_NORMAL:             equ    40h
0000            
0000            PORT1_NORMAL:                   equ    03h
0000            PORT1_MODE1_NORMAL:             equ    03h
0000            PORT1_MODE0_NORMAL:             equ    00h
0000            
0000                ;
0000                ; Suspend operating mode (no wake up) - configure buttons as 
0000                ; medium sink/CMOS, LED as resistive/CMOS and 
0000                ; optics (x,y,z) as HI-Z/CMOS
0000                ;
0000            PORT0_SUSPEND:                  equ    40h
0000            PORT0_MODE1_SUSPEND:            equ    40h
0000            PORT0_MODE0_SUSPEND:            equ    80h
0000            
0000            PORT1_SUSPEND:                  equ    00h
0000            PORT1_MODE1_SUSPEND:            equ    00h
0000            PORT1_MODE0_SUSPEND:            equ    03h
0000            
0000                ;
0000                ; Suspend with remote wake-up - configure buttons as resistive/CMOS
0000                ; LED as resistive/CMOS and optics (x,y,z) as HI-Z/CMOS
0000                ;
0000            PORT0_SUSRW:                    equ    0C0h
0000            PORT0_MODE1_SUSRW:              equ    0C0h
0000            PORT0_MODE0_SUSRW:              equ    00h
0000            
0000            PORT1_SUSRW:                    equ    03h
0000            PORT1_MODE1_SUSRW:              equ    03h
0000            PORT1_MODE0_SUSRW:              equ    00h
0000            
0000            BUTTON_DEBOUNCE:                equ    15       ; 15ms debouce time
0000            MOUSE_PACKET_4:                 equ    4        ; 4-byte mouse packet
0000            MOUSE_PACKET_3:                 equ    3        ; 3-byte mouse packet
0000            
0000            ;
0000            ; Button State Machine
0000            ;
0000            NO_BUTTON_DATA_PENDING:         equ    00h
0000            BUTTON_DATA_PENDING:            equ    02h       ; state defined any time
0000                                                             ; we read a button
0000            ;
0000            ; Optics State Machine
0000            ;
0000            NO_OPTIC_DATA_PENDING:          equ    00h
0000            OPTIC_DATA_PENDING:             equ    02h       ; state defined any time
0000                                                             ; we read the optics
0000            ;
0000            ; Event State Machine
0000            ;
0000            NO_EVENT_PENDING:               equ    00h
0000            EVENT_PENDING:                  equ    02h       ; state defined any time 
0000                                                             ; we have mouse packet to
0000                                                             ; be sent back to host
0000            ;
0000            ; Transaction Types
0000            ;
0000            TRANS_NONE:                     equ    00h
0000            TRANS_CONTROL_READ:             equ    02h
0000            TRANS_CONTROL_WRITE:            equ    04h
0000            TRANS_NO_DATA_CONTROL:          equ    06h
0000            
0000            ;
0000            ; Optics & Button Variables
0000            ;
0000            debounceCount:                  equ    20h      ; debounce counters for buttons
0000            currentButtonState:             equ    21h      ; current button status 
0000            lastButtonState:                equ    22h      ; last read value of buttons
0000            
0000            opticStatus:                    equ    23h      ; current optic status
0000            xCount:                         equ    24h      ; current optics x state
0000            yCount:                         equ    25h      ; current optics y state
0000            zCount:                         equ    26h      ; current wheel button state
0000                                        
0000            buttonMachine:                  equ    27h      ; buttons/optics state machine
0000            eventMachine:                   equ    28h      ; state machine for sending data back to host
0000            vertMachine:                    equ    29h      ; y-axis state machine
0000            horzMachine:                    equ    2Ah      ; x-axis state machine
0000            zMachine:                       equ    2Bh      ; z-axis (wheel) state machine
0000            
0000            lastVertState:                  equ    2Ch      ; last read y-axis optics
0000            lastHorzState:                  equ    2Dh      ; last read x-axis optics
0000            lastZstate:                     equ    2Eh      ; last read z-axis optics
0000                                                            ; (wheel)
0000            
0000            temp:                           equ    2Fh      ; temporary register
0000            buttonValue:                    equ    30h
0000            buttonTemp:                     equ    31h
0000            
0000            ;
0000            ; Dual Interface Variables
0000            ;
0000                                                      
0000            dualInterfaceMouse:             equ    32h      ; mouse type
0000            delayCounter:                   equ    33h      ; delay counter
0000            dualInterface1ms:               equ    34h      ; 1ms counter
0000            
0000            ;
0000            ; USB Variables
0000            ;
0000            suspendCount:                   equ    35h      ; usb suspend counter
0000            ep1DataToggle:                  equ    36h      ; endpoint 1 data toggle
0000            ep0DataToggle:                  equ    37h      ; endpoint 0 data toggle
0000            dataStart:                      equ    38h      ; ROM table address, start of data
0000            dataCount:                      equ    39h      ; data count to return to host
0000            maximumDataCount:               equ    3Ah      ; maximum size of data to return to host
0000            ep0InMachine:                   equ    3Bh      ; endpoint 0 IN state machine
0000            ep0InFlag:                      equ    3Ch      ; endpoint 0 flag for no-data control
0000            configuration:                  equ    3Dh      ; configured/not configured state
0000            remoteWakeup:                   equ    3Eh      ; remote wakeup on/off
0000            ep1Stall:                       equ    3Fh      ; endpoint 1 stall on/off
0000            idle:                           equ    40h      ; HID idle timer
0000            intTemp:                        equ    41h      ; interrupt routine temp variable
0000            idleTimer:                      equ    42h      ; HID idle timer
0000            idlePrescaler:                  equ    43h      ; HID idle prescale (4ms)
0000            ep0Transtype:                   equ    44h      ; Endpoint 0 transaction type
0000            pendingData:                    equ    45h      ; data pending during no-data control
0000            protocol:                       equ    46h      ; mouse protocol boot/report
0000            
0000            ;
0000            ; PS2 Variables - written on top of USB variables
0000            ;
0000            ps2Temp0:                       equ    35h
0000            
0000            ps2LastValidCmd:                equ    36h
0000            ps2InvalidCmdCount:             equ    37h
0000            ps2ReportRate:                  equ    38h
0000            ps2ReportInterval:              equ    39h
0000            ps2Scale:                       equ    3Ah
0000            ps2StreamMode:                  equ    3Bh
0000            ps2Resolution:                  equ    3Ch
0000            ps2MouseEnabled:                equ    3Dh
0000            ps2Wheel:                       equ    3Eh
0000            ps2WrapMode:                    equ    3Fh
0000            
0000            ps2IntervalCount:               equ    40h       ; send back a mouse packet
0000                                                             ; when this interval expires
0000            sequence:                       equ    41h
0000            saveCmd:                        equ    42h
0000            ps2XmitBuffer:                  equ    43h
0000            ps2XmitBuffer0:                 equ    ps2XmitBuffer+0
0000            ps2XmitBuffer1:                 equ    ps2XmitBuffer+1
0000            ps2XmitBuffer2:                 equ    ps2XmitBuffer+2
0000            ps2XmitBuffer3:                 equ    ps2XmitBuffer+3
0000            
0000            ps2XmitBufferLen:               equ    ps2XmitBuffer+4    ; total bytes to send
0000            ps2XmitLen:                     equ    ps2XmitBuffer+5    ; remaining bytes to send
0000            
0000            
0000            ;********************************************************************
0000            ;
0000            ; Interrupt Vector Table
0000            ;
0000            ;********************************************************************
0000                ORG 00h            
0000            
0000 80 1E [05] jmp    dualMain                         ; power up        
0002 85 99 [05] jmp    dualUsbBusReset_ps2Error         ; USB reset / error
0004 80 1A [05] jmp    errorHandler                     ; 128us interrupt
0006 85 B2 [05] jmp    dual1msTimer                     ; 1.024ms interrupt
0008 87 32 [05] jmp    dualUsbEndpoint0_ps2Error        ; Endpoint 0 interrupt / error
000A 8A 70 [05] jmp    dualUsbEndpoint1_ps2Error        ; Endpoint 1 interrupt / error
000C 80 1A [05] jmp    errorHandler                     ; Endpoint 2 interrupt
000E 80 1A [05] jmp    errorHandler                     ; Reserved
0010 80 1A [05] jmp    errorHandler                     ; Capture timer A interrupt Vector
0012 80 1A [05] jmp    errorHandler                     ; Capture timer B interrupt Vector
0014 80 1A [05] jmp    errorHandler                     ; GPIO interrupt vector
0016 8A AB [05] jmp    dualUsbWakeup_ps2Error           ; Wake-up interrupt / error
0018            
0018            
0018            ;********************************************************************
0018            ; Error Handler
0018            ;

⌨️ 快捷键说明

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