StuBS
|
Handles keystrokes. More...
#include <device/keyboard.h>
Public Member Functions | |
Keyboard () | |
Constructor. | |
void | plugin () |
Initialization of the keyboard. | |
bool | prologue () override |
Prologue of keyboard interrupts. | |
void | epilogue () override |
Epilogue of keyboard interrupts. | |
Key | getKey () |
Application interface to retrieve a Key. | |
Public Member Functions inherited from Gate | |
Gate () | |
Constructor. | |
virtual | ~Gate () |
Destructor. | |
bool | is_queued () const |
Status about the epilogue. | |
void | set_queued (bool val) |
Set epilogue status. | |
Private Member Functions | |
Keyboard (const Keyboard &)=delete | |
Keyboard & | operator= (const Keyboard &)=delete |
Private Attributes | |
BBuffer< Key, 16 > | prologue_keys |
Buffer for pressed keys in prologue. | |
BBuffer< Key, 64 > | epilogue_keys |
Buffer for pressed keys already processed in epilogue. | |
Semaphore | key_available |
Semaphore to signal an available key. | |
Additional Inherited Members | |
Protected Member Functions inherited from Queue< T, ContainerType >::Node | |
Node () | |
Handles keystrokes.
This class ensures correct initialization of the keyboard and, above all, its interrupt handling. It also allows an application to query it for key strokes.
|
inline |
void Keyboard::plugin | ( | ) |
Initialization of the keyboard.
Initialization of the keyboard and activation of the specific interrupt handling: The object will register itself at the Plugbox and configure the IOAPIC to receive the corresponding interrupts.
|
overridevirtual |
Prologue of keyboard interrupts.
This method directly handles interrupts caused by the keyboard. Since multiple interrupts are triggered on a keystroke (press & release) it produces not always a printable ASCII character – therefore only valid keys are handled in the Keyboard::epilogue.
Since the buffer is limited, it also ensures that a valid key is not overwritten by a subsequent prologue before it was handled in the Keyboard::epilogue.
true
if a new Key was stored in the buffer and has to be processed in the Keyboard::epilogue. Implements Gate.
|
overridevirtual |
Key Keyboard::getKey | ( | ) |
Buffer for pressed keys already processed in epilogue.
|
private |
Semaphore to signal an available key.