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

📄 usbsm.lst

📁 Cypress 的(鼠标+键盘)复合设备汇编源程序
💻 LST
📖 第 1 页 / 共 5 页
字号:
0000            NUM_LOCK_LED:               equ    1h  ; bit[0]
0000            CAPS_LOCK_LED:          equ    2h   ; bit[1]
0000            SCROLL_LOCK_LED:        equ    4h   ; bit[2]
0000            
0000            ; Normal GPIO port configuration
0000            NORMAL:                 equ     f5h         ; Port3 resistive neg
0000                                                        ; Port2 resistive neg
0000                                                            ; Port1 open drain neg
0000                                                            ; Port0 open drain neg
0000            
0000            
0000            
0000            
0000            
0000            
0000            
0000            
0000            PS2_KEYBOARD:   equ 0               
0000            USB_KEYBOARD:   equ 1
0000            
0000            EP_INTERRUPTS: equ KEYBOARD_PLUS_MOUSE
0000            
0000            ;========================================================================
0000            ;  interrupt vector table -- must be located here
0000            ;========================================================================
0000            
0000                ORG     00h
0000            
0000 80 1E [05]     jmp     sys_reset               ; reset vector
0002            
0002 81 84 [05]     jmp     USB_Bus_Reset_ISR       ; USB bus reset
0004            
0004 80 1E [05]     jmp     illegal_int             ; 128us interrupt
0006            
0006 80 1A [05]     jmp    dual_ifc_1ms_ISR           ; 1.024ms interrupt
0008            
0008 82 C4 [05]     jmp     USB_EP0_ISR             ; endpoint 0 interrupt
000A            
000A 80 F5 [05]     jmp     USB_EP1_ISR             ; endpoint 1 interrupt
000C            
000C 81 0A [05]         jmp     USB_EP2_ISR                     ; endpoint 2 interrupt
000E            
000E 80 1E [05]     jmp     illegal_int             ; reserved interrupt
0010            
0010 80 1E [05]     jmp     illegal_int             ; reserved interrupt
0012            
0012 80 1E [05]     jmp     illegal_int             ; reserved interrupt
0014            
0014 81 1D [05]     jmp     DAC_ISR                 ; DAC interrupt
0016            
0016 81 1E [05]     jmp     GPIO_ISR                ; GPIO interrupt
0018            
0018 80 1E [05]     jmp     illegal_int             ; reserved interrupt
001A            
001A            ;========================================================================
001A            ;
001A            ;   FUNCTION: dual_ifc_1ms_ISR
001A            ;
001A            ;   purpose:    
001A            ;   provides the entry point for the 1 millisecond tick.
001A            ;   This ISR entry point jumps to the USB 1msec ISR.
001A            ;
001A            ;
001A            ;========================================================================
001A            dual_ifc_1ms_ISR:
001A 72    [08]     ei                              ;allow nesting
001B 2D    [05]     push    A                       ;save A
001C 80 C1 [05]     jmp     One_mSec_ISR            ;go direct to USB ISR
001E            
001E            
001E            ;========================================================================
001E            ;
001E            ;   FUNCTION: sys_reset
001E            ;
001E            ;   purpose:    
001E            ;   reset entry point for code
001E            ;
001E            ;
001E            ;========================================================================
001E            
001E            
001E            illegal_int:
001E            sys_reset:
001E 70    [08]     di                                        ;disable interrupts   
001F 19 FF [04]     mov       A,0ffh 
0021 2A 03 [05]     iowr      PORT3_DATA_REG
0023 19 F5 [04]     mov        A,NORMAL                        ;configure GPIO reg
0025 2A 08 [05]     iowr     GPIO_CONFIG_REG
0027            
0027            
0027            
0027 19 00 [04]     mov     a,0                             ;set psp stack to 0
0029 60    [04]     mov     psp,a                           ; 
002A 19 FF [04]     mov     a,0ffh                          ;set dsp stack to 0xff
002C 30    [05]     swap    a,dsp                           ;now we can call functions
002D            
002D 19 01 [04]     mov     A,USB_KEYBOARD
002F 31 20 [05]     mov     [dual_ifc_keyboard],A           
0031            
0031 81 7A [05]    jmp      Reset                          ;go straight usb
0033            .bummer:
0033 80 33 [05]     jmp     .bummer                         ;loop if we ever get here
0035            
0035            
0035            
0035            ; the dsp will remain at 0 for both ps2 and usb. Allow 30h bytes for it.
0035            
0035            dsp_stack_size:                 equ     30h
0035            
0035            ; the psp will start at 0xff for ps2 and 0xe0 for usb (to avoid the
0035            ; USB queues)
0035            
0035            psp_stack_size:                 equ     20h
0035            
0035            ram_base:                       equ     psp_stack_size  ;application ram start
0035            dual_ifc_keyboard:              equ     ram_base        ;keyboard type
0035            dual_ifc_1ms:                   equ     ram_base+1      ;1msec counter
0035            usbmain_ram_base:               equ     ram_base+2      ;start of usb main ram
0035            
0035            ;include all code which resides in lower 4k now.
0035            
0035            ;========================================================================
0035            ; This is the Cypress USB Keyboard + PS2 Mouse demonstration firmware.  
0035            ; It supports the following features:
0035            ;       - Ch. 9 and HIDView compliance
0035            ;       - String Descriptors
0035            ;       - Suspend / Resume / Remote Wakeup
0035            ;       - Send keys on change
0035            ;       - N-Key rollover
0035            ;       - Debounce
0035            ;       - Phantom keys
0035            ;       - Boot protocol
0035            ;       - Plug and Play PS/2 Mouse Port
0035            ;
0035            ;REVISIONS:
0035            ;08/17/99 bth rewrote endpoint 0 ISR
0035            ;02/02/99
0035            ;            bth added set idle, get idle for mouse/power keys
0035            ;            added boot protocol switching on 2nd endpoint (mouse/power)
0035            ;            added get_report for mouse and power key packets
0035            ;            altered mechanism for maintaining idle period
0035            ;            by removing it from ISR and placing it in SendKeyboardReport
0035            ;11/09/98  bth added power management support
0035                            CPU 63413
0035            ;label: XPAGEON
0035            
0035                                   
0035            ;========================================================================
0035            ; data variable assignments
0035            ;========================================================================
0035            
0035            ; control endpoint 0 fifo
0035            endpoint_0:             equ  F8h        ; control endpoint
0035            
0035            ; definitions for SETUP packets
0035            bmRequestType:          equ  F8h
0035            bRequest:               equ  F9h
0035            wValue:                 equ  FAh    ; default wValue (8-bits)
0035            wValueHi:               equ  FBh
0035            wIndex:                 equ  FCh    ; default wIndex (8-bits)
0035            wIndexHi:               equ  FDh
0035            wLength:                equ  FEh    ; default wLength (8-bits)
0035            wLengthHi:              equ  FFh
0035            
0035            ; definition for OUT packets
0035            outbyte:                                equ  F8h        
0035            
0035            ; interrupt endpoint 1 fifo
0035            endpoint_1:                             equ  F0h        ; keyboard endpoint
0035            modifiers:                              equ  F0h
0035            
0035            ; interrupt endpoint 2 fifo
0035            endpoint_2:                             equ  E8h        ; power/media keys endpoint
0035            
0035            datastack_start:                equ  E0h        ; start of data stack
0035            
0035            ; data memory variables
0035            ;------------------------------------------------------------------------
0035            ; To support the USB specification.
0035            remote_wakeup_status:   equ  usbmain_ram_base 
0035                                                                                                                                    ; remote wakeup request
0035                                                                                                                                    ; zero is disabled
0035                                                                                                                                    ; two is enabled
0035            configuration_status:   equ  (usbmain_ram_base+1)
0035                                                                                                                                    ; configuration status
0035                                                                                                                                    ; zero is unconfigured
0035                                                                                                                                    ; one is configured
0035            ep1_stall_status:               equ  (usbmain_ram_base+2)                           ; zero is not stalled
0035            ep2_stall_status:               equ  (usbmain_ram_base+3)                                                                                                                       ; one is stalled
0035            
0035            protocol_status:                equ  (usbmain_ram_base+4)                       ; zero is boot protocol
0035                                                                    ; one is report protocol
0035            ; support SetIdle and GetIdle
0035            kbd_idle_period:                equ  (usbmain_ram_base+5)                       ; keyboard idle period
0035            kbd_idle_period_ctr:    equ  (usbmain_ram_base+6)                       ; keyboard idle period
0035            mouse_idle_period:      equ  (usbmain_ram_base+7)                ; mouse idle period
0035            mouse_idle_period_ctr:  equ  (usbmain_ram_base+8)                ; mouse idle period
0035            consumer_idle_period:   equ  (usbmain_ram_base+9)                       ; consumer keys idle period
0035            consumer_idle_period_ctr:equ  (usbmain_ram_base+10)                     ; consumer keys idle period
0035            power_idle_period:              equ  (usbmain_ram_base+11)                      ; power idle period
0035            power_idle_period_ctr:  equ  (usbmain_ram_base+12)                      ; power idle period
0035            
0035            1ms_counter:            equ  (usbmain_ram_base+13)                      ; 4ms counter
0035            data_start:             equ  (usbmain_ram_base+14)                      ; points to start of descriptor
0035            data_count:             equ  (usbmain_ram_base+15)                      ; current length of descriptor
0035            byte_count:             equ  (usbmain_ram_base+16)                      ; current size of transmission
0035            temp:                   equ  (usbmain_ram_base+17)
0035            
0035            ;--------------------------------------------------------------------------
0035            suspend_counter:        equ  (usbmain_ram_base+18)                      ; contains number of idle bus msecs
0035            
0035            
0035            ;------------------------------------------------------------------------
0035            ; application support
0035            ;------------------------------------------------------------------------
0035            
0035            
0035            page:                                   equ  (usbmain_ram_base+19)                      ; page location of descriptor(RAM,
0035                                                                                                                                    ; ROM page 1, ROM page 2
0035            EP0_mode_shadow:        equ  (usbmain_ram_base+20)                      ; variable to store ep0 mode
0035                                                                                                                                    ; used by set_ep0_mode
0035            
0035            ps2_tmp:                                equ  (usbmain_ram_base+21)                      ; temporary variable for port 3 write by PS/2
0035            background_flags:               equ  (usbmain_ram_base+22)                      ; signal flags for background 
0035            usb_leds:                   equ  (usbmain_ram_base+23)                  ; overcurrent debounce counter
0035            last_key_report:        equ  (usbmain_ram_base+24)
0035            EP0_fifo_shadow:        equ  (usbmain_ram_base+25)
0035            EP_A0_counter_shadow:   equ  (usbmain_ram_base+26)
0035            EP0_Next_Mode:          equ  (usbmain_ram_base+27)
0035            EP0_FLAG:               equ  (usbmain_ram_base+28)
0035            USBMAIN_RAM_SIZE:               equ  29
0035             
0035            SUSPEND_FLAG:                           equ 1
0035            SCAN_FLAG:                                      equ 2

⌨️ 快捷键说明

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