55 LOG_ERR(
"failed to set PS/2 keyboard scan code set\n");
62 LOG_ERR(
"failed to allocate memory for PS/2 keyboard data\n");
70 LOG_ERR(
"failed to create PS/2 keyboard\n");
83 LOG_ERR(
"PS/2 keyboard data is NULL during IRQ registration\n");
90 LOG_ERR(
"failed to register PS/2 keyboard IRQ handler\n");
void irq_handler_unregister(irq_func_t func, irq_virt_t virt)
Unregister an IRQ handler.
uint64_t irq_handler_register(irq_virt_t virt, irq_func_t func, void *private)
Register an IRQ handler for a virtual IRQ.
void kbd_release(kbd_t *kbd, keycode_t code)
Push a keyboard release event to the keyboard event queue.
void kbd_press(kbd_t *kbd, keycode_t code)
Push a keyboard press event to the keyboard event queue.
void kbd_free(kbd_t *kbd)
Frees a keyboard.
kbd_t * kbd_new(const char *name)
Allocate and initialize a new keyboard.
#define LOG_ERR(format,...)
#define EINVAL
Invalid argument.
#define errno
Error number variable.
keycode_t
Keyboard keycode type.
#define NULL
Pointer error value.
#define ERR
Integer error value.
uint64_t ps2_kbd_init(ps2_device_info_t *info)
Initialize a PS/2 keyboard device.
void ps2_kbd_deinit(ps2_device_info_t *info)
Deinitialize a PS/2 keyboard device.
uint64_t ps2_kbd_irq_register(ps2_device_info_t *info)
Register the IRQ handler for a PS/2 keyboard device.
#define PS2_SCAN_CODE_SET
PS/2 scan code set to use.
keycode_t ps2_scancode_to_keycode(ps2_scancode_t scancode, bool isExtended)
Convert a PS/2 scancode to a generic keycode.
uint8_t ps2_scancode_t
PS/2 scancode.
uint64_t ps2_read_no_wait(void)
Read from the PS/2 controllers data port without waiting.
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_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.
static void ps2_kbd_irq(irq_func_data_t *data)
_PUBLIC void * malloc(size_t size)
_PUBLIC void free(void *ptr)
Data passed to IRQ functions.
PS/2 device information structure.
irq_virt_t irq
IRQ assigned to the device by ACPI.
ps2_device_t device
Device port.
const char * name
Human-readable name of the device.
void * private
Driver-specific private data.
PS/2 keyboard private data.