Punch list §25 item 4.3.5c complete. Amended from a nonexistent MMIO transport to PCI (matching the board's actual virtio-blk-pci precedent). New virtio-input driver: eventq with pre-posted buffers, PLIC source computed at runtime from PCI slot/pin (derived live from this host's QEMU riscv64 DTB), mandatory ISR-status read, PCI interrupt-disable-bit check. New VKBD-EVENT/VKBD-DEBUG FORTH words. Verified with a real QEMU sendkey keypress: exact KEY_A/press match, two real interrupts serviced, zero exceptions. Three-arch acceptance boot clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
49 lines
1.5 KiB
C
49 lines
1.5 KiB
C
/*
|
||
StarForth — Steady-State Virtual Machine Runtime
|
||
|
||
Copyright (c) 2023–2025 Robert A. James
|
||
All rights reserved.
|
||
|
||
Licensed under the StarForth License, Version 1.0
|
||
*/
|
||
|
||
#ifndef KEYBOARD_WORDS_H
|
||
#define KEYBOARD_WORDS_H
|
||
|
||
#include "vm.h"
|
||
|
||
/**
|
||
* @defgroup keyboard_words Keyboard Words
|
||
* @{
|
||
*
|
||
* @brief Raw hardware-boundary FORTH word for verifying the interrupt-driven
|
||
* keyboard path (FABRIC.md item 4.3.5). Deliberately a diagnostic peek at
|
||
* the raw scancode ring buffer -- no set-2 translation, no REPL wiring.
|
||
* Those belong to the later REPL keyboard-input work noted in FABRIC.md.
|
||
*
|
||
* Kernel-only, amd64-only today (i8042 is amd64 hardware); no-op elsewhere
|
||
* so dictionary parity across all three architectures is unaffected.
|
||
*
|
||
* @par KBD-SCAN ( -- c -1 | 0 )
|
||
* Pop one raw scancode off the interrupt-fed ring buffer. Pushes the
|
||
* scancode and -1 (true) if one was available, or just 0 (false) if the
|
||
* buffer was empty.
|
||
*
|
||
* @par KBD-DEBUG ( -- isr_count spurious_count )
|
||
* Standing diagnostic: count of real keyboard IRQs serviced and count of
|
||
* LAPIC spurious-vector interrupts, both since boot.
|
||
*
|
||
* @par VKBD-EVENT ( -- code value -1 | 0 )
|
||
* Item 4.3.5c. Pop one decoded EV_KEY event (Linux input-event code/value
|
||
* pair) off the virtio-input interrupt-fed ring buffer. Kernel-only,
|
||
* riscv64-only today (virtio-keyboard-pci); no-op elsewhere.
|
||
*
|
||
* @par VKBD-DEBUG ( -- isr_count )
|
||
* Standing diagnostic: count of virtio-input ISR invocations since boot.
|
||
* @}
|
||
*/
|
||
|
||
void register_keyboard_words(VM *vm);
|
||
|
||
#endif /* KEYBOARD_WORDS_H */
|