|
The Pedigree Project 0.1
|
#include <Keyboard.h>
Inheritance diagram for X86Keyboard:
Collaboration diagram for X86Keyboard:Public Member Functions | |
| X86Keyboard (Ps2Controller *controller) | |
| virtual void | initialise () |
| Initialises the device. | |
| virtual void | setDebugState (bool enableDebugState) |
| virtual bool | getDebugState () |
| virtual char | getChar () |
| virtual char | getCharNonBlock () |
| virtual char | getLedState () |
| virtual void | setLedState (char state) |
| void | startReaderThread () |
| void | stopReaderThread () |
Private Types | |
| enum | LedCommandState { LedIdle , LedCommandAck , LedDataAck } |
Private Member Functions | |
| void | readerThread () |
| void | updateLedState (char state, bool toggle) |
| void | handleLedResponse (uint8_t response) |
| char | scancodeToAscii (uint8_t scancode) |
| Converts a scancode into an ASCII character (for use in debug state) | |
Static Private Member Functions | |
| static int | readerThreadTrampoline (void *) |
Private Attributes | |
| Ps2Controller * | m_pPs2Controller |
| Parent PS/2 controller. | |
| KeymapManager::EscapeState | m_Escape |
| The current escape state. | |
| irq_id_t | m_IrqId |
| IRQ id. | |
| char | m_LedState |
| Current LED state. | |
| LedCommandState | m_LedCommandState |
| uint8_t | m_LedSent |
| size_t | m_LedRetries |
| Mutex | m_LedLock |
| OwnedThread | m_ReaderThread |
| The controller buffer may block this worker until teardown wakes it. | |
Additional Inherited Members | |
Public Types inherited from Keyboard | |
| enum | KeyFlags { Special = 1ULL << 63 , Ctrl = 1ULL << 62 , Shift = 1ULL << 61 , Alt = 1ULL << 60 , AltGr = 1ULL << 59 , Special = 1ULL << 63 , Ctrl = 1ULL << 62 , Shift = 1ULL << 61 , Alt = 1ULL << 60 , AltGr = 1ULL << 59 } |
| enum | KeyboardLeds { ScrollLock = 1 << 0 , NumLock = 1 << 1 , CapsLock = 1 << 2 , Led1 = 1 << 3 , Led2 = 1 << 4 , Led3 = 1 << 5 , Led4 = 1 << 6 , Led5 = 1 << 7 } |
| Bit numbers follow the same format as the PS/2 keyboard LED byte. More... | |
| enum | KeyFlags { Special = 1ULL << 63 , Ctrl = 1ULL << 62 , Shift = 1ULL << 61 , Alt = 1ULL << 60 , AltGr = 1ULL << 59 , Special = 1ULL << 63 , Ctrl = 1ULL << 62 , Shift = 1ULL << 61 , Alt = 1ULL << 60 , AltGr = 1ULL << 59 } |
Keyboard device implementation
Definition at line 39 of file kernel/machine/mach_pc/Keyboard.h.
|
private |
Definition at line 81 of file kernel/machine/mach_pc/Keyboard.h.
| X86Keyboard::X86Keyboard | ( | Ps2Controller * | controller | ) |
Definition at line 48 of file mach_pc/Keyboard.cc.
|
virtual |
Definition at line 59 of file mach_pc/Keyboard.cc.
|
virtual |
Retrieves a character from the keyboard. Blocking I/O. If DebugState is false this returns zero. If DebugState is true this returns the next character received, or zero if the character is non-ASCII.
Implements Keyboard.
Definition at line 73 of file mach_pc/Keyboard.cc.
References Ps2Controller::getDebugState(), m_pPs2Controller, Ps2Controller::readByte(), and scancodeToAscii().
|
virtual |
Retrieves a character from the keyboard. Non blocking I/O. If DebugState is false this returns zero. If DebugState is true this returns the next character received, or zero if the character is non-ASCII.
Implements Keyboard.
Definition at line 84 of file mach_pc/Keyboard.cc.
References Ps2Controller::getDebugState(), m_pPs2Controller, and scancodeToAscii().
|
virtual |
Implements Keyboard.
Definition at line 105 of file mach_pc/Keyboard.cc.
|
virtual |
Gets the current state of the LEDs on the keyboard. A single byte bitmap is returned with flags from KeyboardLeds identifying which LEDs are on or off.
Reimplemented from Keyboard.
Definition at line 143 of file mach_pc/Keyboard.cc.
References m_LedState.
|
private |
Definition at line 162 of file mach_pc/Keyboard.cc.
|
virtual |
Initialises the device.
Implements Keyboard.
Definition at line 63 of file mach_pc/Keyboard.cc.
References Hex, m_pPs2Controller, Ps2Controller::readFirstPort(), and Ps2Controller::writeFirstPort().
Referenced by Pc::initialise().
Here is the caller graph for this function:
|
private |
Definition at line 217 of file mach_pc/Keyboard.cc.
|
staticprivate |
Definition at line 211 of file mach_pc/Keyboard.cc.
|
private |
Converts a scancode into an ASCII character (for use in debug state)
Definition at line 109 of file mach_pc/Keyboard.cc.
References KeymapManager::convertPc102ScancodeToHidKeycode(), KeymapManager::instance(), m_Escape, and KeymapManager::resolveHidKeycode().
Referenced by getChar(), and getCharNonBlock().
Here is the caller graph for this function:
|
virtual |
Selects polling input while the kernel debugger owns the processor.
A debugger trap can interrupt code which owns arbitrary device or IRQ controller locks. Both this setter and getDebugState() must therefore access this mode without taking locks, waiting, allocating, logging, changing interrupt masks, or starting a device protocol. The debugger trap itself prevents ordinary interrupt delivery while this mode is active.
Implements Keyboard.
Definition at line 101 of file mach_pc/Keyboard.cc.
References m_pPs2Controller, and Ps2Controller::setDebugState().
|
virtual |
Sets the current state of LEDs on the keyboard. If a keyboard does not have any LEDs this is essentially a no-op.
Reimplemented from Keyboard.
Definition at line 148 of file mach_pc/Keyboard.cc.
| void X86Keyboard::startReaderThread | ( | ) |
Definition at line 193 of file mach_pc/Keyboard.cc.
| void X86Keyboard::stopReaderThread | ( | ) |
Definition at line 207 of file mach_pc/Keyboard.cc.
|
private |
Definition at line 152 of file mach_pc/Keyboard.cc.
|
private |
The current escape state.
Definition at line 73 of file kernel/machine/mach_pc/Keyboard.h.
Referenced by scancodeToAscii().
|
private |
IRQ id.
Definition at line 76 of file kernel/machine/mach_pc/Keyboard.h.
|
private |
Definition at line 82 of file kernel/machine/mach_pc/Keyboard.h.
|
private |
Definition at line 85 of file kernel/machine/mach_pc/Keyboard.h.
|
private |
Definition at line 84 of file kernel/machine/mach_pc/Keyboard.h.
|
private |
Definition at line 83 of file kernel/machine/mach_pc/Keyboard.h.
|
private |
Current LED state.
Definition at line 79 of file kernel/machine/mach_pc/Keyboard.h.
Referenced by getLedState().
|
private |
Parent PS/2 controller.
Definition at line 70 of file kernel/machine/mach_pc/Keyboard.h.
Referenced by getChar(), getCharNonBlock(), initialise(), and setDebugState().
|
private |
The controller buffer may block this worker until teardown wakes it.
Definition at line 88 of file kernel/machine/mach_pc/Keyboard.h.