summaryrefslogtreecommitdiffhomepage
path: root/Private/Builtins/PS2
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-23 21:40:37 +0100
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-23 21:40:37 +0100
commit09383c793fe953da6441902b4f66b1382df46738 (patch)
tree9c4e4040ad28818c6f13c96375221609cfc773a5 /Private/Builtins/PS2
parentd9477b8a80ee0dc9a6d05c0353aa989ceaedae8a (diff)
Kernel: See below.
Fix BUG inside ATA driver: Due to bad cast on lba select. Add ToolBox APIs for kernel GUI. Userland: See below. Worked a bit on System.Core, just wrapped Thread.hxx into the System namespace. Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/Builtins/PS2')
-rw-r--r--Private/Builtins/PS2/PS2MouseInterface.hxx35
1 files changed, 13 insertions, 22 deletions
diff --git a/Private/Builtins/PS2/PS2MouseInterface.hxx b/Private/Builtins/PS2/PS2MouseInterface.hxx
index beb98665..5e964962 100644
--- a/Private/Builtins/PS2/PS2MouseInterface.hxx
+++ b/Private/Builtins/PS2/PS2MouseInterface.hxx
@@ -27,39 +27,30 @@ class PS2MouseInterface final {
HCORE_COPY_DEFAULT(PS2MouseInterface);
public:
+ /// @brief Enables PS2 mouse for kernel.
+ /// @return
Void Init() noexcept {
HAL::rt_cli();
- HCore::kcout << "HCoreKrnl.exe: Enabling PS/2 mouse...\r\n";
-
- this->Write(0xFF);
-
- HAL::Out8(0x64, 0xA8);
+ HAL::Out8(0x64, 0xA8); // enabling the auxiliary device - mouse
this->Wait();
-
- HAL::Out8(0x64, 0x20);
-
+ HAL::Out8(0x64, 0x20); // tells the keyboard controller that we want to send a command to the mouse
this->WaitInput();
-
- UInt8 dataStatus = HAL::In8(0x60);
-
- dataStatus |= 0b10;
+
+ UInt8 status = HAL::In8(0x60);
+ status |= 0b10;
this->Wait();
-
- HAL::Out8(0x60, dataStatus);
+ HAL::Out8(0x64, 0x60);
+ this->Wait();
+ HAL::Out8(0x60, status); // setting the correct bit is the "compaq" status byte
this->Write(0xF6);
- auto f6Dat = this->Read();
+ this->Read();
this->Write(0xF4);
- auto f4Dat = this->Read();
-
- HCore::kcout << "HCoreKrnl.exe: PS/2 mouse is OK: " << hex_number(f6Dat);
- HCore::kcout << ", " << hex_number(f4Dat) << end_line();
-
- HAL::Out8(0x64, 0xAD);
+ this->Read();
HAL::rt_sti();
}
@@ -69,7 +60,7 @@ class PS2MouseInterface final {
UInt64 timeout = 100000;
while (timeout) {
- if ((HAL::In8(0x64) & 0x1) == 0x0) {
+ if ((HAL::In8(0x64) & 0x1)) {
HCore::kcout << "NewKernel.exe: Wait: OK\r\n";
return true;
}