PatchworkOS  3984a1d
A non-POSIX operating system.
Loading...
Searching...
No Matches
PS/2 Mouse Driver

PS/2 Mouse Driver. More...

Collaboration diagram for PS/2 Mouse Driver:

Detailed Description

PS/2 Mouse Driver.

Todo:
Implement scrolling and buttons 4 and 5.

Data Structures

struct  ps2_mouse_packet_t
 PS/2 mouse packet structure. More...
 
struct  ps2_mouse_t
 PS/2 mouse private data. More...
 

Enumerations

enum  ps2_mouse_packet_flags_t {
  PS2_PACKET_BUTTON_LEFT = (1 << 0) , PS2_PACKET_BUTTON_RIGHT = (1 << 1) , PS2_PACKET_BUTTON_MIDDLE = (1 << 2) , PS2_PACKET_ALWAYS_ONE = (1 << 3) ,
  PS2_PACKET_X_SIGN = (1 << 4) , PS2_PACKET_Y_SIGN = (1 << 5) , PS2_PACKET_X_OVERFLOW = (1 << 6) , PS2_PACKET_Y_OVERFLOW = (1 << 7)
}
 PS/2 mouse packet flags. More...
 
enum  ps2_mouse_packet_index_t { PS2_PACKET_FLAGS = 0 , PS2_PACKET_DELTA_X = 1 , PS2_PACKET_DELTA_Y = 2 }
 PS/2 mouse packet index. More...
 

Functions

uint64_t ps2_mouse_init (ps2_device_info_t *info)
 Initialize 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.
 
void ps2_mouse_deinit (ps2_device_info_t *info)
 Deinitialize a PS/2 mouse device.
 

Enumeration Type Documentation

◆ ps2_mouse_packet_flags_t

PS/2 mouse packet flags.

Enumerator
PS2_PACKET_BUTTON_LEFT 
PS2_PACKET_BUTTON_RIGHT 
PS2_PACKET_BUTTON_MIDDLE 
PS2_PACKET_ALWAYS_ONE 
PS2_PACKET_X_SIGN 
PS2_PACKET_Y_SIGN 
PS2_PACKET_X_OVERFLOW 
PS2_PACKET_Y_OVERFLOW 

Definition at line 20 of file ps2_mouse.h.

◆ ps2_mouse_packet_index_t

PS/2 mouse packet index.

Since the packet is received one byte at a time, this enum specifies which member is the next byte to be received.

Enumerator
PS2_PACKET_FLAGS 
PS2_PACKET_DELTA_X 
PS2_PACKET_DELTA_Y 

Definition at line 49 of file ps2_mouse.h.

Function Documentation

◆ ps2_mouse_init()

uint64_t ps2_mouse_init ( ps2_device_info_t info)

Initialize a PS/2 mouse device.

Parameters
infoDevice information structure
Returns
On success, 0. On failure, ERR.

Definition at line 110 of file ps2_mouse.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ps2_mouse_irq_register()

uint64_t ps2_mouse_irq_register ( ps2_device_info_t info)

Register the IRQ handler for a PS/2 mouse device.

Parameters
infoDevice information structure.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 141 of file ps2_mouse.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ps2_mouse_deinit()

void ps2_mouse_deinit ( ps2_device_info_t info)

Deinitialize a PS/2 mouse device.

Parameters
infoDevice information structure.

Definition at line 160 of file ps2_mouse.c.

Here is the call graph for this function:
Here is the caller graph for this function: