StuBS
ps2controller.cc File Reference
#include "machine/ps2controller.h"
#include "machine/keydecoder.h"
#include "machine/ioport.h"
#include "debug/output.h"
#include "compiler/fix.h"
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...
 

Functions

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

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 uint8_t MAYBE_UNUSED PS2Controller::leds = 0