diff options
| author | Tianhao Wang <wth@riseup.net> | 2024-02-05 04:18:51 +0100 |
|---|---|---|
| committer | Tianhao Wang <shrik3@mailbox.org> | 2024-06-11 15:13:38 +0200 |
| commit | 959d50d9117a0ed3f280bf7d5bfbffd1fa1a5740 (patch) | |
| tree | cfa2d2cf408ce9597fed3076b76251b8e3e7537d /src/lib.rs | |
| parent | a6b91c56f29257c3e54f0bfb2d99bf07262cb184 (diff) | |
PS/2 Keyboard controller: read and decode key
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -5,11 +5,11 @@ mod arch; mod io; mod machine; +use arch::x86_64::interrupt::pic_8259; +use arch::x86_64::interrupt::pic_8259::PicDeviceInt; use core::panic::PanicInfo; use machine::cgascr::CGAScreen; use machine::interrupt; -use arch::x86_64::interrupt::pic_8259; -use arch::x86_64::interrupt::pic_8259::PicDeviceInt; #[cfg(not(test))] #[panic_handler] @@ -28,9 +28,17 @@ pub extern "C" fn _entry() -> ! { println!(" `-.-' \\ )-`( , o o)"); println!(" `- \\`_`\"'-"); println!("it works!"); - + // testing interrupt/PIC - pic_8259::allow(PicDeviceInt::KEYBOARD); - interrupt::interrupt_enable(); - loop {} + // pic_8259::allow(PicDeviceInt::KEYBOARD); + // interrupt::interrupt_enable(); + // + // busy loop query keyboard + loop { + // let code = io::KBCTL_GLOBAL.lock().simple_read(); + io::KBCTL_GLOBAL.lock().fetch_key(); + if let Some(k) = io::KBCTL_GLOBAL.lock().consume_key() { + println! {"caught key: {:?}", k} + } + } } |
