20 #ifndef MACHINE_X86_PS2CONTROLLER_H 21 #define MACHINE_X86_PS2CONTROLLER_H 23 #include "pedigree/kernel/compiler.h" 24 #include "pedigree/kernel/machine/Controller.h" 25 #include "pedigree/kernel/machine/IrqHandler.h" 26 #include "pedigree/kernel/machine/types.h" 27 #include "pedigree/kernel/processor/state_forward.h" 28 #include "pedigree/kernel/processor/types.h" 29 #include "pedigree/kernel/utilities/Buffer.h" 30 #include "pedigree/kernel/utilities/String.h" 46 str =
"PS/2 Controller";
51 str =
"PS/2 Controller";
76 uint8_t readByteNonBlock();
93 virtual bool irq(irq_id_t number, InterruptState &state);
95 void waitForReading();
96 void waitForWriting();
99 bool m_bHasSecondPort;
104 bool m_bFirstIrqEnabled;
105 bool m_bSecondIrqEnabled;
107 irq_id_t m_FirstIrqId;
108 irq_id_t m_SecondIrqId;
112 uint8_t m_ConfigByte;
115 bool m_bDebugStateFirstIrqEnabled;
116 bool m_bDebugStateSecondIrqEnabled;
virtual bool irq(irq_id_t number, InterruptState &state)
bool hasSecondPort() const
Reports whether this PS/2 controller has two ports.
bool getDebugState() const
Gets the debug state.
uint8_t readByte()
Reads a single byte from the PS/2 controller by polling.
uint8_t sendCommandWithResponse(uint8_t command)
Send a command to the PS/2 controller and report its response.
void writeFirstPort(uint8_t byte)
Send a byte to the first port of the PS/2 controller.
EXPORTED_PUBLIC void setIrqEnable(bool firstEnabled, bool secondEnabled)
Enables/disables IRQs for the first or second ports.
void setDebugState(bool debugState)
Sets the debug state (blocks IRQs to allow polling).
EXPORTED_PUBLIC bool readSecondPort(uint8_t &byte, bool block=true)
Reads a single byte from the second port.
Abstrace base class for hardware I/O capabilities.
bool readFirstPort(uint8_t &byte, bool block=true)
Reads a single byte from the first port.
virtual void getName(String &str)
EXPORTED_PUBLIC void writeSecondPort(uint8_t byte)
Send a byte to the second port of the PS/2 controller.
virtual void dump(String &str)
void sendCommand(uint8_t command)
Send a command to the PS/2 controller that has no response or data.