📄 usbps2.lst
字号:
0000 AT101KB_SCROLL_LOCK: EQU 125
0000 AT101KB_PAUSE: EQU 126
0000
0000 AT101KB_LEFTGUI: EQU 127
0000 AT101KB_RIGHTGUI: EQU 128
0000 AT101KB_APPLICATION: EQU 129
0000
0000 AT101KB_POWER: EQU 130
0000 AT101KB_SLEEP: EQU 131
0000 AT101KB_WAKE: EQU 132
0000
0000
0000
0000
0000 ;internal use! use this key code for the alt-key-124 special key code.
0000
0000
0000 AT101KB_ALT_124: EQU 135
0000
0000 ;consumer page HID audio controls
0000 AT101KB_MUTE: EQU 143 ;MUTE
0000 AT101KB_VOL_DEC: EQU 146 ;VOL-
0000 AT101KB_VOL_INC: EQU 147 ;VOL+
0000
0000
0000
0000 ;========================================================================
0000 ; This is the Cypress Dual Interface Keyboard hardware port defines
0000 ;
0000 ;========================================================================
0000 DEBOUNCE_PRESS_TIME: equ 03h ; Set debounce time for
0000 ; key press equal to 12 ms
0000 ; (3 * 4 ms)
0000 DEBOUNCE_RELEASE_TIME: equ 01h ; Set debounce time for
0000 ; key release equal to 4 ms
0000 ; (1 * 4 ms)
0000
0000 ; LED and KEY bit masks in port 3
0000 P3_KEY_MASK: equ c0h ; bits[7:4]
0000 P3_LED_MASK: equ 07h ; bits[3:0]
0000 P3_KEY_LSBIT_MASK: equ 040h ; first bit of key drive lines in p3
0000 P3_USB_CONN_MASK: equ 08h; usb connection bit
0000
0000 ; LED positions in port 3
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 ;we need to use the endpoint 2 normally used for the mouse, to report
0000 ;power key usages. So, the following equate will enable endpoint 2 interrupts
0000 ;even though we are not using mouse code.
0000 EP_INTERRUPTS: equ KEYBOARD_PLUS_MOUSE
0000 ;========================================================================
0000 ; interrupt vector table -- must be located here
0000 ;========================================================================
0000
0000 ORG 00h
0000
0000 80 26 [05] jmp sys_reset ; reset vector
0002
0002 81 97 [05] jmp USB_Bus_Reset_ISR ; USB bus reset
0004
0004 80 26 [05] jmp illegal_int ; 128us interrupt
0006
0006 80 1A [05] jmp dual_ifc_1ms_ISR ; 1.024ms interrupt
0008
0008 82 D6 [05] jmp USB_EP0_ISR ; endpoint 0 interrupt
000A
000A 81 0A [05] jmp USB_EP1_ISR ; endpoint 1 interrupt
000C
000C 81 1D [05] jmp USB_EP2_ISR ; endpoint 2 interrupt
000E
000E 80 26 [05] jmp illegal_int ; reserved interrupt
0010
0010 80 26 [05] jmp illegal_int ; reserved interrupt
0012
0012 80 26 [05] jmp illegal_int ; reserved interrupt
0014
0014 81 30 [05] jmp DAC_ISR ; DAC interrupt
0016
0016 81 31 [05] jmp GPIO_ISR ; GPIO interrupt
0018
0018 80 26 [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 if a usb keyboard
001A ; is connected. Otherwise, it performs the necessary ps2-specific
001A ; functions and returns.
001A ;
001A ;
001A ;========================================================================
001A dual_ifc_1ms_ISR:
001A 72 [08] ei ;allow nesting
001B 2D [05] push A ;save A
001C 1A 20 [06] mov A,[dual_ifc_keyboard] ;check keyboard type
001E 16 00 [04] cmp A,PS2_KEYBOARD ;if USB
0020 B0 D5 [05] jnz One_mSec_ISR ;go direct to USB ISR
0022 23 21 [07] inc [dual_ifc_1ms] ;otherwise increment 1msec counter
0024 2B [04] pop a ;restore A reg
0025 73 [08] reti ;return from interrupt
0026
0026 ;========================================================================
0026 ;
0026 ; FUNCTION: sys_reset
0026 ;
0026 ; purpose:
0026 ; reset entry point for code
0026 ;
0026 ;
0026 ;========================================================================
0026
0026
0026 illegal_int:
0026 sys_reset:
0026 70 [08] di ;disable interrupts
0027 19 FF [04] mov A,0ffh
0029 2A 03 [05] iowr PORT3_DATA_REG
002B 19 F5 [04] mov A,NORMAL ;configure GPIO reg
002D 2A 08 [05] iowr GPIO_CONFIG_REG
002F
002F
002F
002F 19 00 [04] mov a,0 ;set psp stack to 0
0031 60 [04] mov psp,a ;
0032 19 FF [04] mov a,0ffh ;set dsp stack to 0xff
0034 30 [05] swap a,dsp ;now we can call functions
0035
0035 19 00 [04] mov A,0 ;zero endpoint interrupt reg
0037 2A 21 [05] iowr ENDPOINT_INTERRUPT_REG
0039 31 20 [05] mov [dual_ifc_keyboard],A ;set type to ps2 initially
003B
003B 5A 62 [10] call get_keyboard_type ;get the keyboard type
003D 31 20 [05] mov [dual_ifc_keyboard],A ;save it
003F 1A 20 [06] mov A,[dual_ifc_keyboard] ;get it again
0041 16 00 [04] cmp A,PS2_KEYBOARD ;if USB
0043 B1 8D [05] jnz Reset ;go to code usb
0045 89 FB [05] jmp ps2main ;else straight to ps2
0047
0047 .bummer:
0047 80 47 [05] jmp .bummer ;loop if we ever get here
0049
0049
0049 ; the dsp will remain at 0 for both ps2 and usb. Allow 30h bytes for it.
0049
0049 dsp_stack_size: equ 30h
0049
0049 ; the psp will start at 0xff for ps2 and 0xe0 for usb (to avoid the
0049 ; USB queues)
0049
0049 psp_stack_size: equ 20h
0049
0049 ram_base: equ psp_stack_size ;application ram start
0049 dual_ifc_keyboard: equ ram_base ;keyboard type
0049 dual_ifc_1ms: equ ram_base+1 ;1msec counter
0049 usbmain_ram_base: equ ram_base+2 ;start of usb main ram
0049 ps2main_ram_base: equ ram_base+2 ;and ps2 ram also
0049
0049 ;include all code which resides in lower 4k now.
0049
0049 ;========================================================================
0049 ; This is the Cypress USB Keyboard + PS2 Mouse demonstration firmware.
0049 ; It supports the following features:
0049 ; - Ch. 9 and HIDView compliance
0049 ; - String Descriptors
0049 ; - Suspend / Resume / Remote Wakeup
0049 ; - Send keys on change
0049 ; - N-Key rollover
0049 ; - Debounce
0049 ; - Phantom keys
0049 ; - Boot protocol
0049 ; - Plug and Play PS/2 Mouse Port
0049 ;
0049 ;REVISIONS:
0049 ;08/17/99 bth rewrote endpoint 0 ISR
0049 ;02/02/99
0049 ; bth added set idle, get idle for mouse/power keys
0049 ; added boot protocol switching on 2nd endpoint (mouse/power)
0049 ; added get_report for mouse and power key packets
0049 ; altered mechanism for maintaining idle period
0049 ; by removing it from ISR and placing it in SendKeyboardReport
0049 ;11/09/98 bth added power management support
0049 CPU 63413
0049 ;label: XPAGEON
0049
0049
0049 ;========================================================================
0049 ; data variable assignments
0049 ;========================================================================
0049
0049 ; control endpoint 0 fifo
0049 endpoint_0: equ F8h ; control endpoint
0049
0049 ; definitions for SETUP packets
0049 bmRequestType: equ F8h
0049 bRequest: equ F9h
0049 wValue: equ FAh ; default wValue (8-bits)
0049 wValueHi: equ FBh
0049 wIndex: equ FCh ; default wIndex (8-bits)
0049 wIndexHi: equ FDh
0049 wLength: equ FEh ; default wLength (8-bits)
0049 wLengthHi: equ FFh
0049
0049 ; definition for OUT packets
0049 outbyte: equ F8h
0049
0049 ; interrupt endpoint 1 fifo
0049 endpoint_1: equ F0h ; keyboard endpoint
0049 modifiers: equ F0h
0049
0049 ; interrupt endpoint 2 fifo
0049 endpoint_2: equ E8h ; power/media keys endpoint
0049
0049 datastack_start: equ E0h ; start of data stack
0049
0049 ; data memory variables
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -