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

📄 usbsm.lst

📁 Cypress 的(鼠标+键盘)复合设备汇编源程序
💻 LST
📖 第 1 页 / 共 5 页
字号:
0000            
0000            ;========================================================================
0000            ; Endpoint Interrupt Enable bits
0000            
0000            ENDPOINT_ZERO:              equ     1h      ; USB EP A0 interrupt bit
0000            ENDPOINT_ONE:               equ     2h      ; USB EP A1 interrupt bit
0000            ENDPOINT_TWO:           equ      4h     ; USB EP A2 interrupt bit
0000            
0000            ;========================================================================
0000            ; timer constants
0000            TIMER_MSB_MASK:             equ     3Fh     ; six bits
0000            
0000            ;========================================================================
0000            ; Processor Status and Control
0000            
0000            ENTER_SUSPEND:              equ      9h
0000            
0000            RUNBIT:                     equ      1h     ; CPU Run bit
0000            SINGLESTEP:                 equ      2h     ; Single Step
0000            INTERRUPTENABLE:            equ      4h     ; interrupt enable
0000            SUSPENDWAIT:                equ      8h     ; Suspend, wait for interrupt
0000            POWERONRESET:               equ      10h    ; power-on reset
0000            USBRESET:                   equ      20h    ; USB Bus Reset bit
0000            WATCHDOG_RESET:             equ      40h    ; Watchdog Reset bit
0000            IRQPENDING:                 equ      80h    ; IRQ pending
0000            
0000            ;========================================================================
0000            ; USB Status and Control
0000            NOT_FORCING:                equ     00h       ; SIE controls D+/D-
0000            FORCE_K:                    equ     01h       ; D+ high, D- low (resume signal)
0000            FORCE_J:                    equ     02h   ; D+ low, D- high (idle state)
0000            
0000            
0000            
0000            ;========================================================================
0000            ;   FILE: usb.inc
0000            ;
0000            ;   This file contains usb-specific delarations
0000            ;
0000            ;
0000            ;
0000            ;========================================================================
0000            ;========================================================================
0000            ; constant declarations
0000            ;========================================================================
0000            ; from USB Spec v1.0 from page 175
0000            ;------------------------------------------------------------------------
0000            ; standard request codes
0000            ;========================================================================
0000            ; constant declarations
0000            ;========================================================================
0000            ; from USB Spec v1.0 from page 175
0000            ;------------------------------------------------------------------------
0000            ; standard request codes
0000            get_status:             equ   0
0000            clear_feature:          equ   1
0000            set_feature:            equ   3
0000            set_address:            equ   5
0000            get_descriptor:         equ   6
0000            set_descriptor:         equ   7
0000            get_configuration:      equ   8
0000            set_configuration:      equ   9
0000            get_interface:          equ  10 
0000            set_interface:          equ  11 
0000            synch_frame:            equ  12
0000            
0000            ; standard descriptor types
0000            device:                       equ   1
0000            configuration:                equ   2
0000            string:                       equ   3
0000            interface:                    equ   4
0000            endpoint:                     equ   5
0000            
0000            ; standard feature selectors
0000            endpoint_stall:         equ   0    ;recipient endpoint
0000            device_remote_wakeup:   equ   1    ; recipient device
0000             
0000            ;========================================================================
0000            ; from HID Class v1.0 Draft #4
0000            ;------------------------------------------------------------------------
0000            ; class specific descriptor types from section 7.1 Standard Requests
0000            HID:                    equ  21h
0000            report:                 equ  22h
0000            physical:               equ  23h
0000              
0000            ; class specific request codes from section 7.2 Class Specific Requests
0000            get_report:             equ   1
0000            get_idle:               equ   2
0000            get_protocol:           equ   3
0000            set_report:             equ   9
0000            set_idle:               equ  10
0000            set_protocol:           equ  11
0000            
0000            ;========================================================================
0000            ; USB packet constants (debug purposes)
0000            ;------------------------------------------------------------------------
0000            ;setup:                       equ  B4h
0000            ;in:                          equ  96h
0000            ;out:                         equ  87h
0000            ;data0:                       equ  C3h
0000            ;data1:                       equ  D2h
0000            ;ack:                         equ  4Bh
0000            ;nak:                         equ  5Ah
0000            
0000            CONFIGURED:             equ   1 ; configuration status values
0000            UNCONFIGURED:           equ   0
0000            
0000            BOOT_PROTOCOL:          equ   0 ; protocol status values
0000            REPORT_PROTOCOL:        equ   1
0000            
0000            DISABLE_REMOTE_WAKEUP:  equ   0         ; bit[1] = 0
0000            ENABLE_REMOTE_WAKEUP:   equ   2         ; bit[1] = 1
0000            
0000            MOUSE_REPORT_ID:        equ   1
0000            MOUSE_REPORT_LEN:       equ   5
0000            POWER_REPORT_ID:        equ   2
0000            POWER_REPORT_LEN:       equ   2
0000            CONSUMER_REPORT_ID:     equ     3
0000            CONSUMER_REPORT_LEN:    equ   2
0000            LAST_REPORT_ID:     equ CONSUMER_REPORT_ID
0000            
0000            MOUSE_3D_PACKET_LEN:    equ     4  ;3d mouse use 4-byte packets
0000            MOUSE_3D_ID:            equ     3  ;3d mouse reports an id of 3
0000            
0000            ;========================================================================
0000            ;   FILE: macros.inc 
0000            ;
0000            ;   contains useful macro definitions
0000            ;
0000            ;========================================================================
0000                ;clear bit(s) in a RAM location
0000                MACRO CLRBIT BIT REG
0000                mov A,~BIT
0000                and [REG],A
0000                ENDM
0000            
0000                ;set bit(s) in a RAM location
0000                MACRO SETBIT BIT REG
0000                mov A,BIT
0000                or  [REG],A
0000                ENDM
0000              
0000                ;test bit(s) in a RAM location
0000                MACRO TSTBIT BIT REG
0000                mov A,BIT
0000                and A,[REG]
0000                ENDM
0000            
0000                ;clear carry
0000                MACRO CLEARC
0000                or    A,0
0000                ENDM
0000            
0000                ;set carry
0000                MACRO SETC
0000                cpl   A
0000                cpl   A
0000                ENDM
0000            
0000            
0000                ;macro for clearing blocks of RAM
0000                ;destroys X and A
0000                MACRO   CLEARRAM base,length
0000                mov     X,length - 1
0000                mov     A,0
0000            lp:
0000                mov     [X + base],A
0000                dec     X
0000                jnc     lp
0000                ENDM
0000            
0000            
0000                ;macro for packing 4 2-bit fields into a byte
0000            
0000                MACRO TYPE a,b,c,d
0000                    db  (a + b*4 + c*16 + d*64)
0000                ENDM
0000            
0000            
0000                ;delay macro is the front-end for a call to the delay subroutine
0000                ;The fixed overhead of the macro plus the subroutine is 3 us,
0000                ;so this technique is good for delays of 4us or greater.
0000                ;
0000            
0000                MACRO DELAY US
0000                push    A
0000                mov     A,(US-3)
0000                call    delay
0000                ENDM
0000            ;*****
0000            ; CLRC
0000            ;       Clears C bit
0000            ;*****
0000            MACRO CLRC
0000                    add     A,0     ;Clear C-bit
0000                                    ;*** END MACRO CLRC
0000            ENDM
0000            
0000            
0000            ;*****
0000            ; SETFLAG       F
0000            ;       Sets flag F in mouse_flagsV
0000            ;*****
0000            MACRO SETFLAG F
0000                    mov     a,F                     ;a <- F bit
0000                    or      [mouse_flagsV],a        ;set flag
0000                                                    ;*** END MACRO SETFLAG
0000            ENDM
0000            
0000            
0000            ;*****
0000            ; CLRFLAG F
0000            ;       Clear flag F in mouse_flagsV
0000            ;*****
0000            MACRO CLRFLAG F
0000                    mov     a,~F                    ;a <- F mask
0000                    and     [mouse_flagsV],a        ;clear flag
0000                                                    ;*** END MACRO CLRFLAG
0000            ENDM
0000            
0000            
0000            ;*****
0000            ; CHKFLAG F
0000            ;       Check flag F in mouse_flagsV
0000            ;*****
0000            MACRO CHKFLAG F
0000                    mov     a,F                     ;a <- F flag
0000                    and     a,[mouse_flagsV]        ;isolate flag
0000                                                    ;*** END MACRO CHKFLAG
0000            ENDM
0000            
0000            
0000            ;*****
0000            ; CPLFLAG F

⌨️ 快捷键说明

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