PatchworkOS
Loading...
Searching...
No Matches
PS/2 Mouse Driver

PS/2 Mouse Driver. More...

Data Structures

struct  ps2_mouse_packet_t
 PS/2 mouse packet structure. More...
 
struct  ps2_mouse_irq_context_t
 PS/2 mouse IRQ context. 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...
 
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.
 

Detailed Description

PS/2 Mouse Driver.

TODO: Implement scrolling and buttons 4 and 5.

Enumeration Type Documentation

◆ ps2_mouse_packet_flags_t [1/2]

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 18 of file ps2_mouse.h.

◆ ps2_mouse_packet_flags_t [2/2]

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 18 of file ps2_mouse.h.

◆ ps2_mouse_packet_index_t [1/2]

PS/2 mouse packet index.

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 47 of file ps2_mouse.h.

◆ ps2_mouse_packet_index_t [2/2]

PS/2 mouse packet index.

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 47 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
0 on success, ERR on failure

Definition at line 86 of file ps2_mouse.c.

References ERR, free(), ps2_mouse_irq_context_t::index, info, irq_install(), IRQ_PS2_FIRST_DEVICE, IRQ_PS2_SECOND_DEVICE, LOG_ERR, malloc(), mouse, mouse_free(), mouse_new(), fb_info_t::name, NULL, PS2_DEV_CMD, PS2_DEV_CMD_SET_DEFAULTS, PS2_DEV_FIRST, and ps2_mouse_irq().

Referenced by ps2_device_init().