10 if (
ps2->current.deltaX != 0)
15 if (
ps2->current.deltaY != 0)
76 LOG_WARN(
"mouse packet out of sync flags=0x%02X\n",
mouse->current.flags);
83 LOG_WARN(
"mouse packet x overflow flags=0x%02X\n",
mouse->current.flags);
88 LOG_WARN(
"mouse packet y overflow flags=0x%02X\n",
mouse->current.flags);
115 LOG_ERR(
"failed to allocate memory for PS/2 mouse data\n");
123 LOG_ERR(
"failed to create PS/2 mouse\n");
133 LOG_ERR(
"failed to set default PS/2 mouse settings\n");
146 LOG_ERR(
"PS/2 mouse data is NULL during IRQ registration\n");
153 LOG_ERR(
"failed to register PS/2 mouse 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.
mouse_t * mouse_new(const char *name)
Allocate and initialize a mouse structure.
void mouse_free(mouse_t *mouse)
Free and deinitialize a mouse structure.
void mouse_press(mouse_t *mouse, uint32_t button)
Push a mouse button press event to the mouse event queue.
void mouse_release(mouse_t *mouse, uint32_t button)
Push a mouse button release event to the mouse event queue.
void mouse_move_x(mouse_t *mouse, int64_t delta)
Push a mouse movement in the X direction to the mouse event queue.
void mouse_move_y(mouse_t *mouse, int64_t delta)
Push a mouse movement in the Y direction to the mouse event queue.
#define LOG_ERR(format,...)
#define LOG_WARN(format,...)
#define EINVAL
Invalid argument.
#define errno
Error number variable.
#define NULL
Pointer error value.
#define ERR
Integer error value.
void ps2_mouse_deinit(ps2_device_info_t *info)
Deinitialize a PS/2 mouse device.
uint64_t ps2_mouse_irq_register(ps2_device_info_t *info)
Register the IRQ handler for a PS/2 mouse device.
uint64_t ps2_mouse_init(ps2_device_info_t *info)
Initialize a PS/2 mouse device.
@ PS2_PACKET_BUTTON_RIGHT
@ PS2_PACKET_BUTTON_MIDDLE
uint64_t ps2_read_no_wait(void)
Read from the PS/2 controllers data port without waiting.
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.
@ PS2_DEV_CMD_SET_DEFAULTS
static void ps2_mouse_irq(irq_func_data_t *data)
static void ps2_mouse_handle_packet(mouse_t *mouse, ps2_mouse_t *ps2)
_PUBLIC void * calloc(size_t nmemb, 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.