The Pedigree Project  0.1
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
X86Keyboard Class Reference

#include <Keyboard.h>

+ Inheritance diagram for X86Keyboard:
+ Collaboration diagram for X86Keyboard:

Public Member Functions

 X86Keyboard (Ps2Controller *controller)
 
virtual void initialise ()
 Initialises the device. More...
 
virtual void setDebugState (bool enableDebugState)
 
virtual bool getDebugState ()
 
virtual char getChar ()
 
virtual char getCharNonBlock ()
 
virtual char getLedState ()
 
virtual void setLedState (char state)
 
void startReaderThread ()
 

Private Member Functions

void readerThread () NORETURN
 
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 *) NORETURN
 

Private Attributes

Ps2Controllerm_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.
 

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
}
 

Detailed Description

Keyboard device implementation

Definition at line 36 of file kernel/machine/mach_pc/Keyboard.h.

Member Function Documentation

char X86Keyboard::getChar ( )
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 67 of file mach_pc/Keyboard.cc.

References ERROR.

Referenced by PPCKeyboard::getCharacter().

+ Here is the caller graph for this function:

char X86Keyboard::getCharNonBlock ( )
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 82 of file mach_pc/Keyboard.cc.

References ERROR.

Referenced by PPCKeyboard::getCharacterNonBlock().

+ Here is the caller graph for this function:

char X86Keyboard::getLedState ( )
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 154 of file mach_pc/Keyboard.cc.

void X86Keyboard::initialise ( )
virtual

Initialises the device.

Todo:
do we need to switch into a specific scancode set?

Implements Keyboard.

Definition at line 56 of file mach_pc/Keyboard.cc.

References Hex, and NOTICE.

Referenced by Pc::initialise().

+ Here is the caller graph for this function:

void X86Keyboard::setDebugState ( bool  enableDebugState)
virtual

Sets the state of the device. When debugging, it is unwise to rely on interrupt- driven I/O, however in normal use polling is extremely slow and CPU-intensive.

The debugger therefore will set the device to "debug state" by calling this function with the argument "true". In "debug state", any buffered input will be discarded, the device's interrupt masked, and the device will rely on polling only. This will be the default state.

When the device is set to "normal state" by calling this function with the argument "false", interrupts may be used, along with buffered input, and it is recommended that during blocking I/O a Semaphore is used to signal incoming interrupts, so that the blocked thread may go to sleep.

Implements Keyboard.

Definition at line 103 of file mach_pc/Keyboard.cc.

void X86Keyboard::setLedState ( char  state)
virtual

The documentation for this class was generated from the following files: