commit 70c6ef1a7069c4758f8ff6018ef982ab23e6b020
parent b88a4c65b5b1d2853bcfdf55c8293d1f0dc0d89c
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Thu, 5 Jan 2023 16:43:47 -0500
drv/pc/ps28042: make initialization routine more solid
On the Zenith Data Systems Pentium 75Mhz laptop, the keyboard sends an ACK
before sending $aa on initialization.
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/fs/drv/pc/ps28042.fs b/fs/drv/pc/ps28042.fs
@@ -7,6 +7,7 @@ require /sys/mouse.fs
$60 const PS2DATA
$64 const PS2CMD
$20 const BUFSZ
+$fa const ACK
\ Keyboard buffer. we want to keep a history of pressed keys
create _buf( BUFSZ allot
@@ -87,6 +88,7 @@ code isrIRQc
: _writecmd _waitwrite PS2CMD pc! ;
: _writedata _waitwrite PS2DATA pc! ;
: _readdata _waitread PS2DATA pc@ ;
+: _readdatamaybeack _readdata dup ACK = if drop _readdata then ;
: _writeport2 $d4 _writecmd _writedata ;
\ You need to remap the PIC before calling this
@@ -103,9 +105,9 @@ code isrIRQc
0 _ridx ! 0 _widx ! ['] isrIRQ1 $21 setISR 1 pic1unmask
$60 _writecmd $07 _writedata \ interrupt on both ports, both ports enabled
$ff _writedata \ send reset cmd to keyboard
- _readdata $aa <> if abort" Keyboard self-test failed" then
+ _readdatamaybeack $aa <> if abort" Keyboard self-test failed" then
$f0 _writedata $01 _writedata \ use scan code set 1
- _readdata $fa <> if abort" Can't set keyboard to scan code set 1" then ;
+ _readdata ACK <> if abort" Can't set keyboard to scan code set 1" then ;
: 8042mouse$
\ Try to initialize the mouse. it might not be there.
@@ -114,7 +116,7 @@ code isrIRQc
begin _readdata drop _waitread _canread? not until
0 _dx ! 0 _dy ! 0 _btnflags ! 0 _pkt ! ['] isrIRQc $2c setISR 4 pic2unmask
\ Enable straming
- $f4 _writeport2 _readdata $fa <> if abort" mouse init failed" then
+ $f4 _writeport2 _readdata ACK <> if abort" mouse init failed" then
then ;
extends Mouse struct[ PS2Mouse