1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:57:45 +00:00

Kernel: Enumify all magic constants for I8042 devices

This makes the code much easier to read.
This commit is contained in:
Jelle Raaijmakers 2021-10-24 19:51:00 +02:00 committed by Andreas Kling
parent 0a748de1a0
commit 26c84967fa
4 changed files with 115 additions and 82 deletions

View file

@ -13,16 +13,55 @@
namespace Kernel {
#define I8042_BUFFER 0x60
#define I8042_STATUS 0x64
#define I8042_ACK 0xFA
#define I8042_RESEND 0xFE
#define I8042_BUFFER_FULL 0x01
enum I8042Port : u8 {
Buffer = 0x60,
Command = 0x64,
Status = 0x64,
};
#define I8042_WHICH_BUFFER 0x20
enum I8042Command : u8 {
ReadConfiguration = 0x20,
WriteConfiguration = 0x60,
DisableSecondPS2Port = 0xA7,
EnableSecondPS2Port = 0xA8,
TestSecondPS2Port = 0xA9,
TestPS2Controller = 0xAA,
TestFirstPS2Port = 0xAB,
DisableFirstPS2Port = 0xAD,
EnableFirstPS2Port = 0xAE,
WriteSecondPS2PortInputBuffer = 0xD4,
GetDeviceID = 0xF2,
SetSampleRate = 0xF3,
EnablePacketStreaming = 0xF4,
SetDefaults = 0xF6,
Reset = 0xFF,
};
#define I8042_KEYBOARD_BUFFER 0x00
#define I8042_MOUSE_BUFFER 0x20
enum I8042ConfigurationFlag : u8 {
FirstPS2PortInterrupt = 1 << 0,
SecondPS2PortInterrupt = 1 << 1,
SystemFlag = 1 << 2,
FirstPS2PortClock = 1 << 4,
SecondPS2PortClock = 1 << 5,
FirstPS2PortTranslation = 1 << 6,
};
enum I8042StatusFlag : u8 {
OutputBuffer = 1 << 0,
InputBuffer = 1 << 1,
System = 1 << 2,
InputType = 1 << 3,
SecondPS2PortOutputBuffer = 1 << 5,
TimeoutError = 1 << 6,
ParityError = 1 << 7,
};
enum I8042Response : u8 {
ControllerTestPassed = 0x55,
Success = 0xAA,
Acknowledge = 0xFA,
Resend = 0xFE,
};
class I8042Controller;
class I8042Device {