Expand description
PS/2 Keyboard driver
Handles IRQ1 keyboard interrupts, reads scancodes from port 0x60, and converts them to characters for the VGA console.
Modifier state and scancode processing are shared via keyboard_layout.rs. This module owns the ring buffer, PS/2 port init, and lost-key diagnostics.
Re-exportsยง
pub use super::keyboard_layout::KEY_DOWN;pub use super::keyboard_layout::KEY_END;pub use super::keyboard_layout::KEY_HOME;pub use super::keyboard_layout::KEY_LEFT;pub use super::keyboard_layout::KEY_RIGHT;pub use super::keyboard_layout::KEY_UP;
Structsยง
- Keyboard
Buffer ๐ - Keyboard
Buffer ๐Inner
Constantsยง
- CMD_
ENABLE_ ๐KBD - CMD_
READ_ ๐CFG - CMD_
WRITE_ ๐CFG - KEYBOARD_
BUFFER_ ๐SIZE - Keyboard input buffer size
- KEYBOARD_
DATA_ ๐PORT - PS/2 keyboard data port
- PS2_
CMD_ ๐PORT - STATUS_
INPUT_ ๐FULL - STATUS_
OUTPUT_ ๐FULL
Staticsยง
- KEYBOARD_
BUFFER ๐ - LOST_
KEY_ ๐COUNT - Number of characters dropped due to buffer overflow. Incremented atomically in IRQ context, safe to read from any context.
Functionsยง
- add_
to_ buffer - Add a character to the keyboard buffer (called from IRQ context).
- flush_
output ๐ - has_
input - Check if keyboard buffer has data (task context only).
- init
- Initialize the PS/2 keyboard controller
- inject_
hid_ scancode - Inject a PS/2 scancode from USB HID or other non-PS/2 source.
- lost_
key_ count - Return the total number of characters lost due to buffer overflow since boot.
- ps2_
read ๐ - ps2_
write_ ๐cmd - ps2_
write_ ๐data - read_
char - Get a character from the keyboard buffer (non-blocking, task context only).
- reset_
lost_ key_ count - Reset the lost-key counter to zero.
- wait_
read ๐ - wait_
write ๐