22#define PS2_WAIT_TIMEOUT (CLOCKS_PER_SEC / 2)
27#define PS2_SMALL_DELAY (CLOCKS_PER_SEC / 100)
32#define PS2_LARGE_DELAY (CLOCKS_PER_SEC / 5)
37#define PS2_COMMAND_RETRIES 10
44#define PS2_KEYBOARD_PNP_IDS \
45 "PNP0300;PNP0301;PNP0302;PNP0303;PNP0304;PNP0305;PNP0306;PNP0307;PNP0308;PNP0309;PNP030A;PNP030B;PNP0320;PNP0321;" \
46 "PNP0322;PNP0323;PNP0324;PNP0325;PNP0326;PNP0327;PNP0340;PNP0341;PNP0342;PNP0343;PNP0344"
53#define PS2_MOUSE_PNP_IDS \
54 "PNP0F00;PNP0F01;PNP0F02;PNP0F03;PNP0F04;PNP0F05;PNP0F06;PNP0F07;PNP0F08;PNP0F09;PNP0F0A;PNP0F0B;PNP0F0C;PNP0F0D;" \
55 "PNP0F0E;PNP0F0F;PNP0F10;PNP0F11;PNP0F12;PNP0F13;PNP0F14;PNP0F15;PNP0F16;PNP0F17;PNP0F18;PNP0F19;PNP0F1A;PNP0F1B;" \
56 "PNP0F1C;PNP0F1D;PNP0F1E;PNP0F1F;PNP0F20;PNP0F21;PNP0F22;PNP0F23;PNP0FFC;PNP0FFF"
uint8_t irq_virt_t
Virtual IRQ numbers.
uint64_t ps2_cmd(ps2_cmd_t command)
Send a command to the PS/2 controller without reading response.
ps2_device_t
PS/2 device identifiers.
uint64_t ps2_read(void)
Read from the PS/2 controllers data port.
ps2_status_bits_t
PS/2 controller status register bits.
ps2_device_test_response_t
PS/2 device test responses.
ps2_cmd_t
PS/2 controller commands.
ps2_config_bits_t
PS/2 controller configuration bits.
uint64_t ps2_wait_until_set(ps2_status_bits_t status)
Wait until status bit(s) are set.
uint64_t ps2_write(uint8_t data)
Write to the PS/2 controllers data port.
uint64_t ps2_device_cmd_and_read(ps2_device_t device, ps2_device_cmd_t command)
Send a command to a PS/2 device and read response.
ps2_self_test_response_t
PS/2 controller self-test responses.
ps2_device_type_t
PS/2 device types.
uint64_t ps2_cmd_and_read(ps2_cmd_t command)
Send a command to the PS/2 controller and read response.
void ps2_drain(void)
Drain the PS/2 output buffer.
uint64_t ps2_read_no_wait(void)
Read from the PS/2 controllers data port without waiting.
uint64_t ps2_wait_until_clear(ps2_status_bits_t status)
Wait until status bit(s) are clear.
ps2_device_cmd_t
PS/2 device commands.
ps2_device_response_t
PS/2 device command responses.
uint64_t ps2_device_cmd(ps2_device_t device, ps2_device_cmd_t command)
Send a command to a PS/2 device without reading response.
uint64_t ps2_cmd_and_write(ps2_cmd_t command, uint8_t data)
Send a command to the PS/2 controller and write data.
uint64_t ps2_device_sub_cmd(ps2_device_t device, ps2_device_cmd_t command, uint8_t subCommand)
Send a command and a subcommand to a PS/2 device.
@ PS2_STATUS_TIMEOUT_ERROR
@ PS2_STATUS_PARITY_ERROR
@ PS2_STATUS_IN_FULL
Input buffer status (0 = empty, 1 = full)
@ PS2_STATUS_OUT_FULL
Output buffer status (0 = empty, 1 = full)
@ PS2_STATUS_CMD_DATA
Command(1) or Data(0)
@ PS2_DEV_TEST_DATA_STUCK_LOW
@ PS2_DEV_TEST_DATA_STUCK_HIGH
@ PS2_DEV_TEST_CLOCK_STUCK_HIGH
@ PS2_DEV_TEST_CLOCK_STUCK_LOW
@ PS2_CFG_SECOND_IRQ
Second PS/2 port interrupt enable.
@ PS2_CFG_FIRST_IRQ
First PS/2 port interrupt enable.
@ PS2_CFG_RESERVED_7
Should be zero.
@ PS2_CFG_SYSTEM_FLAG
System flag (POST passed)
@ PS2_CFG_RESERVED_3
Should be zero.
@ PS2_CFG_SECOND_CLOCK_DISABLE
Second PS/2 port clock disable.
@ PS2_CFG_FIRST_CLOCK_DISABLE
First PS/2 port clock disable.
@ PS2_CFG_FIRST_TRANSLATION
First PS/2 port translation enable.
@ PS2_DEV_TYPE_MOUSE_5BUTTON
@ PS2_DEV_TYPE_MOUSE_STANDARD
@ PS2_DEV_TYPE_MOUSE_SCROLL
@ PS2_DEV_CMD_SET_DEFAULTS
@ PS2_DEV_CMD_DISABLE_SCANNING
@ PS2_DEV_CMD_SET_TYPEMATIC
@ PS2_DEV_CMD_ENABLE_SCANNING
@ PS2_DEV_CMD_SET_SCANCODE_SET
@ PS2_DEV_RESPONSE_RESEND
@ PS2_DEV_RESPONSE_BAT_OK
@ PS2_DEV_RESPONSE_KBD_EXTENDED
Indicates that the following byte is an extended scancode.
@ PS2_DEV_RESPONSE_KBD_RELEASE
Indicates that the following byte is a key release code.
PS/2 device information structure.
bool attached
The device has been attached from ACPI.
irq_virt_t irq
IRQ assigned to the device by ACPI.
ps2_device_t device
Device port.
bool initialized
The device has been initialized.
const char * name
Human-readable name of the device.
const char * pnpId
PNP ID of the device.
Known PS/2 device structure.