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

📄 revlog.txt

📁 CY7C63743 usb键盘的源码
💻 TXT
📖 第 1 页 / 共 2 页
字号:
; This firmware file is for demonstration purposes only.  
; Cypress Semiconductor will not assume any liability for its use.
;=======================================================================
; 3/23/00	dgw
;
;  fixed the descriptors to report usb 1.10 not 1.01
;
; ??/??/00	lxa
;
;  implemented new usb/ps2 detection algorithm.
;
; 10/05/99      bth
; 
;  fixed phantom key release bug in ps/2
;  fixed short-inhibit problem with ps/2 command clocking
;
;
; 
;
; 8/16/99      bth
; 
; rewrote endpoint 0 ISR, delegating much of the endpoint 0 traffic processing
; to the main loop. This removes much of the finite looping within the ISR
; and improves throughput.  Some of the non-compliant bugs were fixed as part of
; this rewrite.
;
; rewrote setup command parsing to be table driven
;
; rewrote descriptor parsing so that descriptors can be of arbitrary length
; and position (greater than 256 bytes and spanning page boundaries).
;
; rewrote endpoint 2 sharing to be table driven (set idle, get idle, get report)
;
; added more robust parameter checking on all setup commands
;
; fixed mouse polling rate at 24 msec, repaired mouse idle rate bug
;
;
;
; 
;
;=======================================================================
; 2/13/99      bth
; added 3-d mouse support
; 
; 2/2/99      bth
; 
; added boot-protocol switching on endpoint 2 (mouse/power reports)
; now, in boot protocol, the 2nd endpoint only reports mouse packets
; and omits the report ID, in accordance with the boot protocol format.
;
; enhanced  get_report for endpoint 2's packets 
;
; added idle counts for power and mouse packets, and enhanced get_idle
; and set_idle to handle these.
;
;=======================================================================
; 10/16/98      bth 
;
; renamed file from kbps2_07.asm to usbmain.asm, and made several changes
; to the code so that it could be combined with existing ps2 keyboard code into a
; single executable that fully supports two types of keyboards: usb with ps2 slave mouse,
; and a ps2 keyboard.  The changes are:
;
; 1: the key scanning code and its associated RAM variables were removed from
; this file and replaced by calls to the shared key scanning code which resides 
; in the separate file keyscan.asm.
;
; 2: Ram variables in this file were declared as an offset from a base value rather than
; as absolute values. This allows the variables to be arbitrarily located in RAM.
;
; 3: All writes and reads to the leds were modified to use the generic ksc_writeLED
; routine found in keyscan.asm
;
; 4: Some redundant constant declarations that were also in regs.inc were removed.
;
; 5. The 1 msec and GPIO ISRs were completely rewritten to simplify their operation.
; The suspend/resume code was gutted from these routines and moved to a background
; routine ("Suspend") which is invoked from the main loop.  This obviates the need for the
; 1msec and GPIO ISRs to interact so intensively as was the case in the previous code.
; As a result, the GPIO ISR shrank from 100 lines of code to 2 (!), while the 1 msec
; ISR shrank from 200 lines of code to about 30. 4 state variables that controlled
; the suspend/resume process were eliminated. Subroutine "Suspend" was added; this
; routine is now called from the main loop when the 1msec ISR detects no bus activity
; for 3msec or more. This routine consists mostly of old code removed from the 1msec
; and GPIO ISR routines.
;
; 6. Fixed remote wakeup so that mouse activity can now wake up the keyboard after
; a suspend.  Now the GPIO ISR ALWAYS calls mouse_int.
; See the comments for the GPIO ISR for details.
;
; 7. Added MouseConnectTask, and removed Ch11_Supp, and removed PS2_Init_Reset.
; Now, plugging/unplugging the mouse is handled entirely within MouseConnectTask
; which is repeatedly invoked from the main loop to keep track of the mouse's connect state.
; See the comments in MouseConnectTask.  This change obsoletes many of the modifications
; previously made to get the mouse to plug and play: they did not work reliably.
;
; 8. Modifications were made to kb_mouse code to improve its operation when the
; mouse is plugged and unplugged. Specifically, the mouse_machine state machine
; could get "stuck" in a non-idle state if the mouse was unplugged during a data transfer.
; This in turn would cause calls to mouse_poll to hang indefinitely.  The
; kb_mouse 1msec ISR was supposed to "free" mouse_machine in this case, but
; it was not working properly. To fix this,
; the functionality of the kb_mouse subroutine "mouse_status" was changed.
; Now, mouse_status returns the state of mouse_machine.  If mouse_status returns
; nonzero, it means that mouse_machine is in the middle of transacting with the
; mouse. The mouse 1msec ISR was in turn changed to use the result of "mouse_status"
; to time mouse transactions and to "unstick" mouse_machine in the event of a timeout.
; Due to this enhancement, the "plugin" flag and the 256msec_counter were removed
; as they were no longer necessary.
;
; 9. Writing the leds was removed from the EP0 and Bus_Reset ISR. Port 3 is shared by keyboard
; column scanning, slave-mouse control lines, and the leds.  The firmware that 
; modifies these bits executes in the background (key scan code and mouse communications)
; as well as in the ISRs (GPIO, Reset, and EP0).  There exists the possibility
; that a background task and an ISR could simultaneously access port3 and 
; corrupt certain bits.  In actuality the possibility is remote, but to reduce it
; even further, the writing of port 3 was removed from EP0 and Reset ISRs and
; put in the main processing loop.  Now, the only possibility that port3 is accessed
; by an ISR and the background simultaneously, is when a mouse is initially plugged in
; and asynchronously sends its power-on string (causing a GPIO ISR which accesses port 3),
; which could occur during key scanning which also accesses port 3.
; This likelihood is small and the only consequence is that the mouse communication
; would be corrupted for 1 pass; it will recover during the next sequence of calls to 
; MouseConnectTask from the main loop.
;
; 10. Modified operation of Bus Reset ISR. the main loop was moved to within the bus reset
; ISR to simplify the startup operation. Now, after a power-up reset, the code
; enters an infinite loop waiting for a bus reset.  The occurrence of a bus reset
; causes the Bus Reset ISR to fire, which initializes the system and runs the main
; loop.  In this way, the Bus Reset is now truly a "vulcan nerve pinch", in that
; it interrupts whatever is currently executing and restarts the code.  Previously,
; the Bus Reset would interrupt currently executing code, reinitialize global variables,
; and then would RETURN to currently executing code, which was expected to recover
; and find its way back to the main loop. This technique has shortcomings.  This new way,
; a Bus Reset truly restarts the code from scratch.  
;
; 11. added SetInterface and GetInterface support.  These were only partially implemented.
; Code was added to get SetInterface to work properly.
;=======================================================================
; 08/07/98      jk Fixed Hot and Could Reboot with PS/2 mouse connected.
; Removed the call of the "ps2_init" routine from after the call of the 
; "mouse_reset" routine.
; This modification was done in the Reset subroutine. 						
;;=======================================================================
; 07/30/98      lxa Fixed suspend operation on Chapter 9 test.
; Previous version of the code (v.06) didn't go into suspend mode during 
; Chapter 9 test. 
; Every time the variable "task" is set to 1 (SCAN_TASK) the suspend in the
; One_mSec_ISR is skipped.
; Modification in the One_mSec_ISR:
; now before checking if it is time to scan the matrix (every 4 ms) we check
; if the device is already configured, if not (this the case of Chapter9)
; we skipped the test and the "task" variable is set to 0 (NO_TASK).
;=======================================================================
; 07/24/98      jk Bugfixes
; (1) "Reset" entry point routine (POR or Watchdog). This routine always
; assumed mouse was present. This could sometimes cause problems if
; keyboard was plugged into host without a mouse connected. The former
; section of code labelled "Initialize_PS2" has been removed from the Reset
; processing routine and "Init_PS2_Reset" has been converted to a subroutine
; as it is still used by the main loop when it tries to re-connect a new
; mouse.
; (2) "Ch11_Supp" was modified to check for mouse connection before
; attempting to re-initialize it (in case it has been un-plugged).
;=======================================================================
; 10/07/98      jk Added support for true plug and play mouse.
; Version 6 did not allow random plug/un-plug of the PS/2 mouse. The 
; routines that have been modified to add this support are:
; (1) One_mSec_ISR. In the "Mouse_timer" routine, a 256msec timer has been
; added as a PS/2 watchdog. If there is no PS/2 activity for 256msec, then
; the PS/2 bus will be reset and the mouse connected flag (mouse_conx_flagC)
; will be cleared. This makes sure that the mouse command state machines are
; all reset back to idle. This disconnect event will be later recognized by 
; the main loop which will then look for new PS/2 activity indicating that the
; mous hase been re-plugged. The 256ms timer is reset back to 256ms every
; time there is any PS/2 activity (handled in "mouse_int" interrupt code)
; (2) Main Loop. Code added that will detect whether a mouse is connected
; or not. If it is, then the sequence flow is the same as version 6. If it
; does not detect a mouse, then the main loop will look at the "plugin" flag.
; This flag will be set if there is any PS/2 activity. In that case, there
; has been a mouse re-connect event and it will make the necessary calls to
; configure the PS/2 port and reset the mouse. If valid data has been received
; then we know the mouse has been successfully reset and it has sent its self
; test result. At that point, the mouse is working fine, so it is placed
; into polling mode for normal operation, and flagged as connected.
; (3) BugFix. The keyboard scan task was accidentally corrupting the PS/2
; bus. This has been fixed in the "WriteP3" routine by using the
; P3_PS2_LED_MASK which saves the state of PS/2 and LEDs before initiating
; a new scan pattern.
;=======================================================================
; 06/17/98      nxk/lxa Fixed suspend/resume problem
; Now keyboard and mouse work coming out of suspend.  Remote wakeup
; works on a real system (both mouse and keyboard), but for some
; reason, it fails to work with Ch. 11 test (the device does not
; go to suspend during the Selective Suspend and Remote Wakeup test
; under Ch. 11, and so remote wakeup cannot work).  More investigation
; is required.
; Changes:
; 1. Added the GPIO_TIMER_RESET_MASK constant to be used with register 20h
; (i.e. Global Interrupt register).  This constant is used wherever
; GPIO, 1ms, and USB Bus Reset interrupts are required (replaced the
; old constant GPIO_TIMER_MASK).
; 2. Changed the GPIO_TIMER_MASK constant to be used when just the GPIO
; and 1ms interrupts are required.
; 3. Added the MOUSE_TASK constant. This is put in the 'task' variable
; during the execution of MouseTask. The 1ms ISR will not go to suspend
; while a task is running, so that PS/2 transactions will not be
; interrupted.  
; 4. The 'suspend_in_progress' variable was added so that the 1ms ISR
; can be nested safely during the suspend procedure to allow 
; timeout capability to the mouse transactions.
;=======================================================================
; 06/17/98      nxk/lxa Upgraded to be consistent with key38.asm
;=======================================================================
; 06/12/98      nxk/lxa Removed wait loops
; Removed wait loops from SendMouseData and SendKeys routines.
;=======================================================================
; 06/12/98      nxk/lxa Fixed bug in Init routine
; Port 2 interrupts were being enabled.  Now they're disabled.
;=======================================================================
; 06/12/98      nxk/lxa Changed design for boot protocol compliance
; Keyboard uses EP1 and mouse uses EP2.  The routines that were
; affected are:
; - USB Bus Reset ISR
; - Endpoint 0 ISR
; - Endpoint 2 ISR (added)
; - SendMouseData
; - SendKeys
; Constants were defined for EP2 mode/counter registers and EP2 interrupts.
;=======================================================================
; 04/18/98      nxk/lxa/hth Integrated v36 of USB keyboard firmware
;=======================================================================
; 04/18/98      nxk/lxa Implemented new key debounce algorithm
; A new debounce algorithm was implemented which replaced the debounce
; FIFO with two arrays:  debounce_key_array and debounce_counters_array.

⌨️ 快捷键说明

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