duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit c48f263a4adba663308ab35afa23ad270c30272c
parent fc760b94218ec72d9981a8cbaef193595545dd54
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Sun, 30 Oct 2022 12:54:27 -0400

drv/pc/ps28042: make keyboard driver interrupt driven

Diffstat:
Mfs/drv/pc/pic.fs | 2++
Mfs/drv/pc/ps28042.fs | 25++++++++++++++++++++++++-
Mfs/xcomp/i386/pc/init.fs | 2+-
3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/fs/drv/pc/pic.fs b/fs/drv/pc/pic.fs @@ -7,6 +7,8 @@ $a0 const PIC2CMD $a1 const PIC2DATA \ piceoi and piceoi2 are already defined in the kernel +: piceoi, al $20 i) mov, PIC1CMD i) al out, ; +: piceoi2, piceoi, PIC2CMD i) al out, ; : pic$ \ Set $20-$2f ISRs to IRQ handlers that send back EOI to PICs diff --git a/fs/drv/pc/ps28042.fs b/fs/drv/pc/ps28042.fs @@ -1,6 +1,29 @@ \ 8042 PS/2 Controller driver +?f<< /asm/i386.fs + $60 const PS2DATA $64 const PS2CMD +$20 const BUFSZ + +create _buf( BUFSZ allot +here const _)buf +create _ridx 0 , +create _widx 0 , + +code isrIRQ1 + ax push, si push, + al PS2DATA i) in, + si _buf( i) mov, + si _widx m) add, + _widx m) inc, + _widx m) BUFSZ 1- i) and, + si 0 d) al mov, + piceoi, si pop, ax pop, iret, : 8042ps2@? ( -- keycode? f ) - PS2CMD pc@ 1 and dup if PS2DATA pc@ swap then ; + _ridx @ _widx @ <> if + _ridx @ dup 1+ BUFSZ 1- and _ridx ! ( idx ) _buf( + c@ 1 + else 0 then ; + +\ You need to remap the PIC before calling this +: 8042ps2$ ['] isrIRQ1 $21 setISR ; diff --git a/fs/xcomp/i386/pc/init.fs b/fs/xcomp/i386/pc/init.fs @@ -39,9 +39,9 @@ f<< /fs/fat.fs f<< /drv/pc/ps28042.fs f<< /sys/ps2.fs +8042ps2$ ' 8042ps2@? to ps2@? ' ps2keyset1 to key - f<< /drv/pc/a20.fs a20$