NOVA User-Level Environment  Version testbox/changed-memory-timing-317-g320d8b5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HostKeyboard Class Reference

A PS/2 host keyboard and mouse driver. More...

Inheritance diagram for HostKeyboard:
StaticReceiver< HostKeyboard > Device

Public Member Functions

bool receive (MessageIrq &msg)
bool receive (MessageLegacy &msg)
 HostKeyboard (DBus< MessageHwIOIn > &bus_hwioin, DBus< MessageHwIOOut > &bus_hwioout, DBus< MessageInput > &bus_input, Clock *clock, unsigned hostdev, unsigned short base, unsigned irq, unsigned irqaux, unsigned char scset, bool verbose)
- Public Member Functions inherited from StaticReceiver< HostKeyboard >
 StaticReceiver ()
- Public Member Functions inherited from Device
void debug_dump ()
 Device (const char *debug_name)

Private Member Functions

bool wait_status (unsigned char mask, unsigned char value)
bool wait_output_full ()
bool wait_input_empty ()
bool disable_devices ()
bool enable_devices ()
bool read_cmd (unsigned char cmd, unsigned char &value)
bool write_cmd (unsigned char cmd, unsigned char value)
bool wait_ack ()
bool write_keyboard_ack (unsigned char value)
bool write_mouse_ack (unsigned char value)
void handle_aux (unsigned char data)
void handle_scancode (unsigned char key)
 Handle a scancode send from the keyboard.

Private Attributes

DBus< MessageInput > & _bus_input
Clock_clock
unsigned _hostdev
unsigned short _base
unsigned _irq
unsigned _irqaux
unsigned _flags
unsigned _mousestate
bool _scset1
bool _verbose

Static Private Attributes

static unsigned const FREQ = 1000
static unsigned const TIMEOUT = 50

Additional Inherited Members

- Static Public Member Functions inherited from StaticReceiver< HostKeyboard >
static bool receive_static (Device *o, M &msg)

Detailed Description

A PS/2 host keyboard and mouse driver.

Translates SCS2 keycodes to single extended keycode and mouse movements to mouse packets. Both are forwarded on the keycode bus.

State: stable Features: scancode set1+2, simple PS2 mouse Missing: z-axis Documentation: PS2 hitrc chapter 7+11, scancodes-13.html

Constructor & Destructor Documentation

HostKeyboard::HostKeyboard ( DBus< MessageHwIOIn > &  bus_hwioin,
DBus< MessageHwIOOut > &  bus_hwioout,
DBus< MessageInput > &  bus_input,
Clock clock,
unsigned  hostdev,
unsigned short  base,
unsigned  irq,
unsigned  irqaux,
unsigned char  scset,
bool  verbose 
)
inline

Member Function Documentation

bool HostKeyboard::disable_devices ( )
inlineprivate
bool HostKeyboard::enable_devices ( )
inlineprivate
void HostKeyboard::handle_aux ( unsigned char  data)
inlineprivate
void HostKeyboard::handle_scancode ( unsigned char  key)
inlineprivate

Handle a scancode send from the keyboard.

There are some bad BIOSes around which do not emulate SC2. We have to convert from SC1.

We have a small state machine here, as the keyboard runs with scancode set 2. SCS3 would be much nicer but is not available everywhere.

bool HostKeyboard::read_cmd ( unsigned char  cmd,
unsigned char &  value 
)
inlineprivate
bool HostKeyboard::receive ( MessageIrq msg)
inline
bool HostKeyboard::receive ( MessageLegacy msg)
inline
bool HostKeyboard::wait_ack ( )
inlineprivate
bool HostKeyboard::wait_input_empty ( )
inlineprivate
bool HostKeyboard::wait_output_full ( )
inlineprivate
bool HostKeyboard::wait_status ( unsigned char  mask,
unsigned char  value 
)
inlineprivate
bool HostKeyboard::write_cmd ( unsigned char  cmd,
unsigned char  value 
)
inlineprivate
bool HostKeyboard::write_keyboard_ack ( unsigned char  value)
inlineprivate
bool HostKeyboard::write_mouse_ack ( unsigned char  value)
inlineprivate

Member Data Documentation

unsigned short HostKeyboard::_base
private
DBus<MessageInput>& HostKeyboard::_bus_input
private
Clock* HostKeyboard::_clock
private
unsigned HostKeyboard::_flags
private
unsigned HostKeyboard::_hostdev
private
unsigned HostKeyboard::_irq
private
unsigned HostKeyboard::_irqaux
private
unsigned HostKeyboard::_mousestate
private
bool HostKeyboard::_scset1
private
bool HostKeyboard::_verbose
private
unsigned const HostKeyboard::FREQ = 1000
staticprivate
unsigned const HostKeyboard::TIMEOUT = 50
staticprivate

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