StuBS
ps2controller.cc File Reference
Include dependency graph for ps2controller.cc:

Namespaces

namespace  PS2Controller
 PS/2 Controller.
 

Enumerations

enum  PS2Controller::Status {
  PS2Controller::HAS_OUTPUT = 1 << 0 ,
  PS2Controller::INPUT_PENDING = 1 << 1 ,
  PS2Controller::SYSTEM_FLAG = 1 << 2 ,
  PS2Controller::IS_COMMAND = 1 << 3 ,
  PS2Controller::IS_MOUSE = 1 << 5 ,
  PS2Controller::TIMEOUT_ERROR = 1 << 6 ,
  PS2Controller::PARITY_ERROR = 1 << 7
}
 Flags in the PS/2 controller status register. More...
 
enum  PS2Controller::KeyboardCommand : uint8_t {
  PS2Controller::KEYBOARD_SET_LED = 0xed ,
  PS2Controller::KEYBOARD_SEND_ECHO = 0xee ,
  PS2Controller::KEYBOARD_SET_SPEED = 0xf3 ,
  PS2Controller::KEYBOARD_ENABLE = 0xf4 ,
  PS2Controller::KEYBOARD_DISABLE = 0xf5 ,
  PS2Controller::KEYBOARD_SET_DEFAULT = 0xf6
}
 Commands to be send to the Keyboard. More...
 
enum  PS2Controller::Reply {
  PS2Controller::ACK = 0xfa ,
  PS2Controller::RESEND = 0xfe ,
  PS2Controller::ECHO = 0xee
}
 Replies. More...
 
enum  PS2Controller::ControllerCommand {
  PS2Controller::CONTROLLER_GET_COMMAND_BYTE = 0x20 ,
  PS2Controller::CONTROLLER_SET_COMMAND_BYTE = 0x60 ,
  PS2Controller::CONTROLLER_MOUSE_DISABLE = 0xa7 ,
  PS2Controller::CONTROLLER_MOUSE_ENABLE = 0xa8 ,
  PS2Controller::CONTROLLER_KEYBOARD_DISABLE = 0xad ,
  PS2Controller::CONTROLLER_KEYBOARD_ENABLE = 0xae ,
  PS2Controller::CONTROLLER_SEND_TO_MOUSE = 0xd4
}
 Commands for the PS/2 Controller. More...
 
enum  PS2Controller::MouseCommand {
  PS2Controller::MOUSE_RESET = 0xff ,
  PS2Controller::MOUSE_DEFAULTS = 0xf6 ,
  PS2Controller::MOUSE_STREAMING_DISABLE = 0xf5 ,
  PS2Controller::MOUSE_STREAMING_ENABLE = 0xf4 ,
  PS2Controller::MOUSE_SAMPLE_RATE = 0xf3 ,
  PS2Controller::MOUSE_ID = 0xf2 ,
  PS2Controller::MOUSE_REQUEST_PACKET = 0xeb ,
  PS2Controller::MOUSE_REQUEST_STATUS = 0xe9 ,
  PS2Controller::MOUSE_RESOLUTION = 0xe8 ,
  PS2Controller::MOUSE_SCALING_2_1 = 0xe7 ,
  PS2Controller::MOUSE_SCALING_1_1 = 0xe6
}
 Commands to be send to the mouse. More...
 

Functions

static uint8_t PS2Controller::receiveData ()
 Receive requested data / answer from the controller (or the PS/2 device)
 
static void PS2Controller::sendCommand (ControllerCommand cmd)
 Send command to the controller by writing it into the command register.
 
static void MAYBE_UNUSED PS2Controller::sendData (uint8_t value)
 Send a command or data to a connected PS/2 device.
 
void PS2Controller::init ()
 Initialization of connected devices.
 
bool PS2Controller::fetch (Key &pressed)
 Retrieve the keyboard event.
 
bool PS2Controller::fetch (Pointer &state)
 Retrieve the mouse event.
 
void PS2Controller::setRepeatRate (Speed speed, Delay delay)
 Configure the repeat rate of the keyboard.
 
void PS2Controller::setLed (enum LED led, bool on)
 Enable or disable a keyboard LED.
 
void PS2Controller::drainBuffer ()
 Empties the keyboard buffer.
 

Constants

static const IOPort PS2Controller::ctrl_port (0x64)
 Access status- (read) and command (write) register.
 
static const IOPort PS2Controller::data_port (0x60)
 Access PS/2 device [keyboard] output- (read) and input (write) buffer.
 
static KeyDecoder PS2Controller::key_decoder
 
static MouseDecoder PS2Controller::mouse_decoder
 
static uint8_t MAYBE_UNUSED PS2Controller::leds = 0