?? revlog.txt
字號:
; The arrays can debounce up to 6 key presses or releases.
; Three routines support this algorithm:
; - Debounce_Task
; - Debounce_Key
; - Debounce_Test
; During the execution of the FoundKey routine, Debounce_Test is called
; to see if the found key's index is in the debounce_key_array. If it
; is found, then the key event (press or release) is ignored. Otherwise,
; FoundKey calls the Debounce_Key routine to load the key index into the
; debounce_key_array. The corresponding position in the
; debounce_counters_array is loaded with either DEBOUNCE_PRESS_TIME or
; DEBOUNCE_RELEASE_TIME (defined in the scan_matrix_file) depending on
; the event.
; The Debounce_Task is called by Main every time the ScanTask is
; scheduled by the One_mSec_ISR (i.e. every 4ms). This
; routine decrements all the counters in the debounce_counters_array. Once
; a counter reaches 0, the corresponding key index is removed from the
; debounce_key_array so that new events on that key will be processed.
;=======================================================================
; 04/03/98 nxk/lxa Modified 1ms_ISR, GPIO_ISR and Init routines
; 1. We suspect that changing the GPIO Configuration register can
; cause a glitch on GPIO ports. For this reason, we change this register
; prior to enabling GPIO interrupts in the 1ms_ISR (for remote wakeup)
; so that the glitches do not cause undesirable interrupts.
; 2. We modified GPIO_ISR to check if the interrupt is really
; caused by a key press. If it is not (i.e. some unknown cause) we
; exit without sending the remote wakeup signal to the host.
; 3. We initialize protocol_status to REPORT_PROTOCOL in the Init
; routine.
;=======================================================================
; 03/23/98 nxk/lxa Modified SetConfiguration and SetProtocol
; As per customer request, the SetConfiguration routine will send a
; a STALL to the host if the configuration value is not 0 or 1. As well,
; the SetProtocol routine will send a STALL to the host if the protocol
; value is not 0 (Boot Protocol) or 1 (Report Protocol).
;=======================================================================
; 03/18/98 nxk/lxa Modified Reset routine and EP0 ISR
; 1. We found that in certain cases, we begin with a WatchDog Reset
; after POR eventhough Suspend-on-Reset mode is selected
; (i.e. port 3 bit 7 is tied to Vcc through an external 470 KOhm
; resistor). When the WDR bit (bit 6) of the Status & Control register
; (0xFF) is set, the USB transmitter is disabled and the device cannot
; respond to traffic from the host. So now, both the POR bit and the
; WDR bit are cleared in the Reset routine (if they are set to 1).
;
; 2. As per customer request, the GetProtocol and GetConfiguration
; routines were modified to send the value from RAM (instead of ROM).
; The values in RAM are set by the host during SetProtocol and
; SetConfiguration.
; 03/10/98 lxa Modified control_read routines
; control_read did not properly handle the case where
; the total number of data bytes to send was a multiple of 8. In this
; case, the transmission has to send a zero-length data packet to
; terminate the data stage. SendBuffer were modified to handle this.
;=======================================================================
; 03/23/98 lxa Change in USB_EP0_ISR
; GetStringdescriptor sends string report descriptor.
; Create string descriptors in a new ROM lookup table .
;========================================================================
; 01/14/98 kbps2 v0.1 hth
; This is the Cypress USB keyboard with PS/2 mouse demo firmware.
; Basic USB keyboard code from ref27.asm
; PS/2 code contributed by: Rich Moran, RPM Systems, Kirkland, WA.
; Code Integration by hth.
;========================================================================
;12/12/97 hth/nxk Initial keyboard and PS/2 mouse code
; integration
; GPIO port 3, bit 6 and 7 are used to toggle PS/2 clock and data lines,
; respectively. Make sure that these bits are not affected by the
; keyboard scan code.
;========================================================================
; 12/09/97 nxk EP0 ISR changes to work with OHCI hosts
; Made sure all interrupts are disabled prior to reenabling EP0 interrupts
; before returning from EP0 ISR. This prevents ISRs from nesting.
; Modified Control_read routine to verify that the ACK token is received
; when the IN pid bit is set.
;========================================================================
; 12/08/97 nxk Chip bug workaround
; Some data RAM addresses cannot be written to while the SETUP pid bit
; is set in the EP0 mode register. These are:
; 70h - 7Fh, F0h - F7h in the CY3651
; E0h - E7h in the CY7C634/635xx
; Only F8h - FFh (end point 0 FIFO) is supposed to be locked out.
; This problem caused the Ch. 9 tests to fail after a large number
; of iterations in continuous loop mode.
; The firmware has been changed to avoid use of these locations.
; - data stack begins at address E0h rather than E8h
; - data memory variables no longer use addresses from 70h - 7Fh so that
; the code will run on both the development board and chip.
;========================================================================
; 11/12/97 nxk Changed GPIO port configuration
; Some keyboard vendors were concerned about input thresholds when all
; rows and columns are pulled up in resistive mode. Changed port
; configuration to be rows resisitive, columns open-drain (negative).
; However, when we go into suspend mode, all ports will be configured
; as resistive.
;========================================================================
; 11/12/97 nxk Bug fix
; 'image' is now updated only when there is a change in a key switch
; state and the key is not being debounced.
;========================================================================
; 11/05/97 nxk Added support for bmRequestType = 22h
; Need this for AWARD-based ASUSTEK motherboards.
;========================================================================
; 11/05/97 nxk Bug fix
; Altered FoundKey routine so that when a modifier key goes up,
; the firmware resends the last key (so that Shift-J looks like
; "JJJJJJJJJJJJJjjjjjjjjjjjj" once the Shift key is released.
; When modifier key goes down, key positions in EP1 FIFO are set to 0's.
;========================================================================
; 11/03/97 nxk Changes to USB_EP0_ISR made for robustness
; 1. Verifies that the PID for the token packet causing
; the interrupt is SETUP.
; 2. Verifies that 'Data Valid' is true, count == 8, and data toggle is 0
; when we receive a SETUP token.
; 3. Handles reception of premature SETUP while still processing the
; last SETUP packet.
;========================================================================
; 11/03/97 nxk Changed Control_read routine
; Now sets EP_A0_Mode to STATUSOUTONLY instead of SETUP to stall further
; IN packets after all data has been sent to host.
;========================================================================
; 10/28/97 nxk Added Control_write routine
; Control_write routine is called by SetReport to get the OUT byte
; containing LED report from the host.
; This routine waits for the Status IN to be sent by host, but lets
; the no_data_control routine acknowledge it (this routine NAKs the
; Status IN so that we have time to process the OUT byte).
;========================================================================
; 10/27/97 nxk Changed GPIO port configuration
; The Reset subroutine now initializes all GPIO ports to resistive mode
; (previously, ports 0,1, and 3 were initialized as open-drain).
; This was done so that when the microcontroller is in suspend mode,
; the leakage current through the GPIO pins won't exceed the 500 uA
; budget (in open-drain mode the pins are floating, and we can't
; guarantee this). The Scan Task is still functional in this mode,
; with both columns and rows internally pulled up to Vcc.
;========================================================================
; 10/27/97 nxk Bug fix
; The routine GetHIDDescriptor was using the wrong length calculation for
; the HID Class descriptor (i.e. end_config_desc_table - Class_Descriptor).
; It now uses (Endpoint_Descriptor - Class_Descriptor).
;========================================================================
; 10/03/97 nxk Added remote wakeup feature
; 1ms ISR enables GPIO interrupts before suspending.
; GPIO ISR sends remote wakeup signal (on key press).
;========================================================================
; 10/01/97 nxk Changed Debounce FIFO length
; Changed the Debounce FIFO from 6 elements to 4 to give 48ms debounce time.
; Modified data variable organization so that dbfifo is at the end.
; - This allows for easier changes to its length
;========================================================================
; 9/25/97 nxk Enhancements made
; The firmware now supports the following features:
; - Send keys on change
; - N-key rollover
; - debounce
; - phantom keys
; Features that are not complete:
; - remote wakeup
;========================================================================
; 9/22/97 nxk Boot protocol implemented
; Keyboard is initialized with boot protocol.
; Modified descriptor order to match boot protocol requirements.
;========================================================================
; 9/22/97 nxk Changes made
; Set configuration now enables/disables ep1.
; GetReport request is stalled.
; GetReportDescriptor is routine that sends HID report desc. to host.
;========================================================================
; 8/11/97 nxk USB_EP1_ISR and SendKeys routines changed
; USB_EP1_ISR does nothing unless the ACK bit is set in the EP1 mode reg.
; SendKeys no longer waits for the ACK bit to be set after enabling a
; transmission.
;========================================================================
; 7/23/97 nxk control_read routine changed
; Now waits for the Status OUT packet when all data has been sent.
;========================================================================
; 7/22/97 wmh SendKeys Routine changed
; Fixing a noted abnormal behavior in that routine
;========================================================================
; 7/10/97 wmh Suspend/Resume
; Suspend/Resume code was added in the One_msec_ISR
;========================================================================
; 6/24/97 nxk bug fixes
; 1. Modified 'get_descriptor_length' to check both bytes of wValue
; to ensure that 0 length data packets and packets > 255 use the
; actual length of the descriptor.
; 2. GetHIDDescriptor now returns the Class Descriptor instead of
; the HID report descriptor (GetReport now does this as well as enabling
; endpoint 1 after enumeration.)
;
;========================================================================
; 6/17/97 gwg new features
; Reworked the USB endpoint zero interrupt service routine to correct the
; chapter nine failures. A secondary result was to review and rework the
; enumeration code. The following updates still need to be implemented
; for this code to be usable as a reference design candidate:
;
; 1. debounce
; 2. send packet on state change
; 3. N-key rollover
; 4. phantom keys
;
;========================================================================
; 6/10/97 gwg bug fixes
; 1. The main problem was a crash whenever we pressed a key that would
; change an LED (num lock, caps lock, or scroll lock). This appears
; to be because the endpoint zero ISR turned off the endpoint one
; interrupt and never turned it back on.
; 2. Modified the code to turn on all of the LEDs during enumeration.
; 3. Fixed a buffer overrun problem in the "FoundKey" routine so that
; it never tries to store more than six non-modifier keys in the
; buffer.
; 4. Added a comparison routine to FoundKey to prevent saving duplicate
; key presses.
;
;========================================================================
; 5/16/97 gwg retarget code
; Many thanks to Jeff Wick for last minute help with this code.
; 1. The run bit must be set when enetering suspend mode or the part will
; never come out of suspend.
; 2. The Device Address must be enabled for address zero or the part will
; not respond to any endpoint zero traffic.
; 3. We MUST clear the ACK bit in the endpoint zero ISR to allow data to
; be written by the firmware.
; 4. The first data packet from control_read should be data1 instead
; of data0. If the first packet is data0, the host does not set the
; device address correclty and the enumeration fails.
; 5. The endpoint ISR routines MUST check for PID and ACK bits in the
; mode register. If the bits are clear, do nothing.
; 6. The keyboard software sends packets while a key is pressed. The
; host expects a packet on change. This will require a code rewrite.
;
;**************** assembler directives *****************
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -