The Pedigree Project 0.1
Public Types | Public Member Functions | List of all members
Keyboard Class Referenceabstract

#include <Keyboard.h>

+ Inheritance diagram for Keyboard:
+ Collaboration diagram for Keyboard:

Public Types

enum  KeyFlags {
  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...
 

Public Member Functions

virtual void initialise ()=0
 
virtual void setDebugState (bool enableDebugState)=0
 
virtual bool getDebugState ()=0
 
virtual char getChar ()=0
 
virtual char getCharNonBlock ()=0
 
virtual char getLedState ()
 
virtual void setLedState (char state)
 

Detailed Description

Keyboard device abstraction.

Definition at line 26 of file include/pedigree/kernel/machine/Keyboard.h.

Member Enumeration Documentation

◆ KeyboardLeds

Bit numbers follow the same format as the PS/2 keyboard LED byte.

Enumerator
ScrollLock 

Scroll Lock LED.

NumLock 

Number Lock LED.

CapsLock 

Caps Lock LED.

Led1 

LEDs 1-5 cover non-standard LEDs that might be present on some keyboards - very vendor-specific.

Definition at line 37 of file include/pedigree/kernel/machine/Keyboard.h.

◆ KeyFlags

enum Keyboard::KeyFlags

Definition at line 28 of file include/pedigree/kernel/machine/Keyboard.h.

Member Function Documentation

◆ getChar()

virtual char Keyboard::getChar ( )
pure 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.

Implemented in HostedKeyboard, X86Keyboard, and VirtKeyboard.

Referenced by LocalIO::getChar().

+ Here is the caller graph for this function:

◆ getCharNonBlock()

virtual char Keyboard::getCharNonBlock ( )
pure 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.

Implemented in HostedKeyboard, X86Keyboard, and VirtKeyboard.

◆ getLedState()

char Keyboard::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 in HostedKeyboard, and X86Keyboard.

Definition at line 25 of file Keyboard.cc.

◆ initialise()

virtual void Keyboard::initialise ( )
pure virtual

Initialises the device.

Implemented in HostedKeyboard, X86Keyboard, and VirtKeyboard.

Referenced by HostedMachine::initialise().

+ Here is the caller graph for this function:

◆ setDebugState()

virtual void Keyboard::setDebugState ( bool  enableDebugState)
pure 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.

Implemented in VirtKeyboard, HostedKeyboard, and X86Keyboard.

Referenced by Debugger::start().

+ Here is the caller graph for this function:

◆ setLedState()

void Keyboard::setLedState ( char  state)
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 in HostedKeyboard, and X86Keyboard.

Definition at line 29 of file Keyboard.cc.


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