diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-23 21:40:37 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-23 21:40:37 +0100 |
| commit | 09383c793fe953da6441902b4f66b1382df46738 (patch) | |
| tree | 9c4e4040ad28818c6f13c96375221609cfc773a5 /Private/Builtins | |
| parent | d9477b8a80ee0dc9a6d05c0353aa989ceaedae8a (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')
| -rw-r--r-- | Private/Builtins/ATA/Defines.hxx | 4 | ||||
| -rw-r--r-- | Private/Builtins/PS2/PS2MouseInterface.hxx | 35 | ||||
| -rw-r--r-- | Private/Builtins/Toolbox/Toolbox.hxx | 20 |
3 files changed, 35 insertions, 24 deletions
diff --git a/Private/Builtins/ATA/Defines.hxx b/Private/Builtins/ATA/Defines.hxx index f0f019e8..01b67c42 100644 --- a/Private/Builtins/ATA/Defines.hxx +++ b/Private/Builtins/ATA/Defines.hxx @@ -136,10 +136,10 @@ HCore::Void drv_ata_select(HCore::UInt16 Bus); HCore::Boolean drv_ata_wait_io(HCore::UInt16 IO); -HCore::Void drv_ata_read(HCore::UInt32 Lba, HCore::UInt16 IO, HCore::UInt8 Master, HCore::Char* Buf, +HCore::Void drv_ata_read(HCore::UInt64 Lba, HCore::UInt16 IO, HCore::UInt8 Master, HCore::Char* Buf, HCore::SizeT SectorSz, HCore::SizeT Size); -HCore::Void drv_ata_write(HCore::UInt32 Lba, HCore::UInt16 IO, HCore::UInt8 Master, HCore::Char* Buf, +HCore::Void drv_ata_write(HCore::UInt64 Lba, HCore::UInt16 IO, HCore::UInt8 Master, HCore::Char* Buf, HCore::SizeT SectorSz, HCore::SizeT Size); #endif // ifdef __KERNEL__
\ No newline at end of file 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; } diff --git a/Private/Builtins/Toolbox/Toolbox.hxx b/Private/Builtins/Toolbox/Toolbox.hxx new file mode 100644 index 00000000..f349375b --- /dev/null +++ b/Private/Builtins/Toolbox/Toolbox.hxx @@ -0,0 +1,20 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +#pragma once + +#include <NewKit/Defines.hpp> + +EXTERN_C HCore::Void _hal_init_mouse(); +EXTERN_C HCore::Boolean _hal_draw_mouse(); +EXTERN_C HCore::Void _hal_handle_mouse(); +EXTERN_C HCore::Boolean _hal_left_button_pressed(); +EXTERN_C HCore::Boolean _hal_middle_button_pressed(); +EXTERN_C HCore::Boolean _hal_right_button_pressed(); + +#define TOOLBOX_LOOP() while (true) + +#include <KernelKit/Rsrc/Util.hxx> |
