i3c_wire i82077
Simics Reference Manual  /  5 Classes  / 

i8042

Description

The i8042 device models a legacy PC keyboard controller together with a 105-key standard keyboard, and a mouse with three buttons, three buttons and a wheel or five buttons and a wheel.

Interfaces Implemented

conf_object, log_object, io_memory, keyboard, mouse

Notifiers

cell-change
Notifier that is triggered after the object's cell was changed.
object-delete
Notifier that is triggered just before Simics object is deleted.
queue-change
Notifier that is triggered after the object's clock was changed. New clock can be obtained with the SIM_object_clock function.

Commands for this class

Attributes

reset_target
Optional attribute; read/write access; type: o|n
Object implementing the x86_reset_bus interface.
irq_dev
Optional attribute; read/write access; type: o|n
Interrupt device implementing the simple_interrupt interface.
console
Optional attribute; read/write access; type: o|n
Console device implementing the 'gfx_con' or 'gfx_console' or 'keyboard_console' interfaces.
kbd_irq_level
Required attribute; read/write access; type: i
Interrupt level of the keyboard. Use to send interrupts to irq_dev using the simple_interrupt.
mouse_irq_level
Required attribute; read/write access; type: i
Interrupt level of the mouse. Use to send interrupts to irq_dev using the simple_interrupt.
next_write
Optional attribute; read/write access; type: i
The next write expected on the command port. 0 = Undefined, 1 = Command, 2 = Output, 3 = Mouse, and 4 = MouseBuffer.
obuffer
Optional attribute; read/write access; type: i
The next data that will be read from the keyboard.
mfull
Optional attribute; read/write access; type: b
True if obuffer contains mouse data.
ofull
Optional attribute; read/write access; type: b
True if obuffer contains data.
ifull
Optional attribute; read/write access; type: b
True if input buffer full flag. Always false in the current implementation.
command_last
Optional attribute; read/write access; type: b
True if the last write to the keyboard was a command.
selftest_ok
Optional attribute; read/write access; type: b
True if the selftest flag signals OK.
scan_convert
Optional attribute; read/write access; type: b
Flag whether we do scan code conversion.
mouse_irq_en
Optional attribute; read/write access; type: i
Mouse interrupt enabled flag.
mouse_disabled
Optional attribute; read/write access; type: i
Mouse disabled flag.
mouse_connected
Optional attribute; read/write access; type: i
Mouse connected flag.
kbd_irq_en
Optional attribute; read/write access; type: i
Keyboard interrupt enabled flag.
kbd_disabled
Optional attribute; read/write access; type: i
Keyboard disabled flag.
sent_time
Optional attribute; read/write access; type: f
The last time we sent an interrupt.
cmd_buttons
Optional attribute; read/write access; type: i
The state of the mouse buttons as set by the button-event pseudo attribute. Bit 0 = left button pressed, bit 1 = right button pressed, and 2 = middle button pressed.
irq_sent
Optional attribute; read/write access; type: i
Set to 1 if the keyboard interrupt line is raised, 2 if the mouse interrupt is raised, or 0 otherwise.
key_enabled
Optional attribute; read/write access; type: i
Flag saying if the keyboard is enabled.
key_caps_lock
Optional attribute; read/write access; type: i
Caps lock led flag.
key_num_lock
Optional attribute; read/write access; type: i
Num lock led flag.
key_scroll_lock
Optional attribute; read/write access; type: i
Scroll lock led flag.
led_caps_lock
Optional attribute; read/write access; type: n|o|[os]
Caps lock led signal target.
led_num_lock
Optional attribute; read/write access; type: n|o|[os]
Num lock led signal target.
led_scroll_lock
Optional attribute; read/write access; type: n|o|[os]
Scroll lock led signal target.
key_scan_codes
Optional attribute; read/write access; type: i
Selected scan codes.
key_buffer
Optional attribute; read/write access; type: [i*]
(b0, b1, ..., b15) Controller keyboard output data.
key_first
Optional attribute; read/write access; type: i
Index of the next data that will be read from the key_buffer.
key_buf_num
Optional attribute; read/write access; type: i
Number of entries used after key_first in the key_buffer.
key_next_write
Optional attribute; read/write access; type: i
Command expected for the next write to the controller. 0 = Undefined, 1 = Led, 2 = Typematic, and 3 = Scan.
mou_enabled
Optional attribute; read/write access; type: i
Mouse enabled flag.
mou_two_to_one
Optional attribute; read/write access; type: i
Scaling is 2:1 flag.
mou_resolution
Optional attribute; read/write access; type: i
Mouse resolution. The resolution is 1 << value counts / mm.
mou_sample_rate
Optional attribute; read/write access; type: i
Sample rate in Hz.
mou_buffer
Optional attribute; read/write access; type: [i{48}]
(b0, b1, ..., b47) Controller output mouse data.
mou_first
Optional attribute; read/write access; type: i
Index of next data in mou_buffer.
mou_buf_num
Optional attribute; read/write access; type: i
Number of entries used from mou_first in mou_buffer.
mou_next_write
Optional attribute; read/write access; type: i
Command expected for the next write to the mouse controller. 0 = Undefined, 1 = Resolution, and 3 = SampleRate.
mouse_type
Optional attribute; read/write access; type: i
Modeled mouse type. 0 = 3-button mouse (default), 1 = 3-button wheel mouse, and 2 = 5-button wheel mouse.
mouse_mode
Optional attribute; read/write access; type: i
Mode operating mode. 0 = 3-button mode, 1 = 3-button wheel mode, and 2 = 5-button wheel mode.
mode_select_state
Optional attribute; read/write access; type: i
Mode selection state. 0 = knocking not in progress, 1 = having set sample rate to 200 Hz once, 2 = having set sample rate to 200 Hz twice, and 3 = having set sample rate to 100 Hz.
mouse_movement_x
Optional attribute; read/write access; type: i
Mouse movement since last packet.
mouse_movement_y
Optional attribute; read/write access; type: i
Mouse movement since last packet.
mouse_movement_z
Optional attribute; read/write access; type: i
Mouse movement since last packet.
mouse_report_button_state
Optional attribute; read/write access; type: i
Mouse button state in last packet.
mouse_current_button_state
Optional attribute; read/write access; type: i
Current mouse button state.
mouse_event
Pseudo attribute; write-only access; type: Unknown
Write-only. Forces mouse events. Writes to indices 0 through 5 result in movement in directions up, down, left, right, wheel up, or wheel down by value mm.
key_event
Pseudo attribute; write-only access; type: Unknown
Write-only. Forces keyboard events. Writing value (an integer) to index i forces key number i to be pressed if value is false, or released if value is true.
button_event
Pseudo attribute; write-only access; type: Unknown
Write-only. Forces mouse button events. Writing value to index 0 (1, 2, 3, or 4) causes the left (right, middle, fourth, or fifth) button to be pressed if value is false, or released if value is false.
shift_l_down
Optional attribute; read/write access; type: i
Status of the left shift key.
shift_r_down
Optional attribute; read/write access; type: i
Status of the right shift key.
ctrl_l_down
Optional attribute; read/write access; type: i
Status of the left ctrl key.
ctrl_r_down
Optional attribute; read/write access; type: i
Status of the right ctrl key.
alt_l_down
Optional attribute; read/write access; type: i
Status of the left alt key.
alt_r_down
Optional attribute; read/write access; type: i
Status of the right alt key.
fast_a20
Optional attribute; read/write access; type: i
The fast A20 bit (port 92h).
fast_init
Optional attribute; read/write access; type: i
The fast init bit (port 92h).
output_port
Optional attribute; read/write access; type: i
The 8042 controller's output port P2. Only bits 2 and 3 are in this attribute. Use other attributes for the remaining bits.
output_port_mask
Optional attribute; read/write access; type: i
One bit set for each locked bit in output port P2.
allow_keyboard_buffer_overflow
Optional attribute; read/write access; type: b
By default this attribute is false, which implies that the i8042 will not allow the keyboard buffer to overflow. Instead it will force the console to buffer the input until there is room for it in the keyboard buffer. This makes the console generally easier to work with, since you are guaranteed that it won't drop characters. If you for some reason want to allow keyboard buffer overflows, set this attribute to true.
irq_freq
Optional attribute; read/write access; type: i
The maximum frequency in Hz at which the i8042 will generate interrupts. The default is 2000 Hz, which simulates the timing of a real device. However, some operating systems and X servers may have problems keeping up with that interrupt frequency when run with low processor clock frequencies and may start to lose input. If that happens you can lower the interrupt frequency. 20 Hz seems to work well with X servers on Linux in the configurations distributed with Simics.

Class Attributes

keys
Pseudo attribute; read-only access; type: [s*]
List with the names of all keys on the keyboard. Their index in the list represents the Simics internal key code.

Provided By

8042
i3c_wire i82077