From da70596895d8135e08f8caac6978117697b4c021 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 18 Aug 2024 21:39:29 +0200 Subject: [REFACTOR] Improved project structure. Signed-off-by: Amlal El Mahrouss --- dev/Kernel/Modules/PS2/PS2MouseInterface.hxx | 112 --------------------------- 1 file changed, 112 deletions(-) delete mode 100644 dev/Kernel/Modules/PS2/PS2MouseInterface.hxx (limited to 'dev/Kernel/Modules/PS2') diff --git a/dev/Kernel/Modules/PS2/PS2MouseInterface.hxx b/dev/Kernel/Modules/PS2/PS2MouseInterface.hxx deleted file mode 100644 index 0a0f4aa8..00000000 --- a/dev/Kernel/Modules/PS2/PS2MouseInterface.hxx +++ /dev/null @@ -1,112 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - - File: PS2MouseInterface.hxx - Purpose: PS/2 mouse. - - Revision History: - - 03/02/24: Added file (amlel) - -------------------------------------------- */ - -#pragma once - -#include -#include -#include - -namespace Kernel -{ - /// @brief PS/2 Mouse driver interface - class PS2MouseInterface final - { - public: - explicit PS2MouseInterface() = default; - ~PS2MouseInterface() = default; - - NEWOS_COPY_DEFAULT(PS2MouseInterface); - - public: - /// @brief Enables PS2 mouse for kernel. - /// @return - Void Init() noexcept - { - HAL::rt_cli(); - - HAL::Out8(0x64, 0xA8); // enabling the auxiliary device - mouse - - this->Wait(); - HAL::Out8(0x64, 0x20); // tells the keyboard controller that we want to send a command to the mouse - this->WaitInput(); - - UInt8 status = HAL::In8(0x60); - status |= 0b10; - - this->Wait(); - HAL::Out8(0x64, 0x60); - this->Wait(); - HAL::Out8(0x60, status); // setting the correct bit is the "compaq" status byte - - this->Write(0xF6); - this->Read(); - - this->Write(0xF4); - this->Read(); - - HAL::rt_sti(); - } - - public: - Bool WaitInput() noexcept - { - UInt64 timeout = 100000; - - while (timeout) - { - if ((HAL::In8(0x64) & 0x1)) - { - return true; - } - - --timeout; - } // wait until we can read - - // return the ack bit. - return false; - } - - Bool Wait() noexcept - { - UInt64 timeout = 100000; - - while (timeout) - { - if ((HAL::In8(0x64) & 0b10) == 0) - { - return true; - } - - --timeout; - } // wait until we can read - - // return the ack bit. - return false; - } - - Void Write(UInt8 val) - { - HAL::Out8(0x64, 0xD4); - this->Wait(); - HAL::Out8(0x60, val); - this->Wait(); - } - - UInt8 Read() - { - this->WaitInput(); - return HAL::In8(0x60); - } - }; -} // namespace Kernel -- cgit v1.2.3