diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-29 22:38:43 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-29 22:38:43 +0100 |
| commit | a8c17ccd6d97cc78830917dc6282b040b21ba16c (patch) | |
| tree | 2181e96ccf9c89c677d2208661bce5584a667470 /Private/HALKit | |
| parent | 78861f1b16f18a85e9f6890e16eb320412b6ab80 (diff) | |
Kernel: Update SPECS and TODO list.
Cleaned up the SPECS to get into the point.
Current Task: Load kernel into memory.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/HALKit')
| -rw-r--r-- | Private/HALKit/AMD64/ACPI/ACPIManager.hpp | 3 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/DebugOutput.cxx | 23 |
2 files changed, 19 insertions, 7 deletions
diff --git a/Private/HALKit/AMD64/ACPI/ACPIManager.hpp b/Private/HALKit/AMD64/ACPI/ACPIManager.hpp index 385ea854..da01f1c7 100644 --- a/Private/HALKit/AMD64/ACPI/ACPIManager.hpp +++ b/Private/HALKit/AMD64/ACPI/ACPIManager.hpp @@ -18,13 +18,12 @@ namespace hCore { class ACPIManager { public: - ACPIManager(voidPtr rsdptr); + explicit ACPIManager(voidPtr rsdptr); public: ~ACPIManager() = default; ACPIManager &operator=(const ACPIManager &) = default; - ACPIManager(const ACPIManager &) = default; public: diff --git a/Private/HALKit/AMD64/DebugOutput.cxx b/Private/HALKit/AMD64/DebugOutput.cxx index 43ab2538..123ad4c6 100644 --- a/Private/HALKit/AMD64/DebugOutput.cxx +++ b/Private/HALKit/AMD64/DebugOutput.cxx @@ -12,10 +12,20 @@ #include <NewKit/Utils.hpp> namespace hCore { +enum CommStatus { + kStateReady = 0xCF, + kStateTransmit = 0xFC, + kStateLimbo, + kStateCnt = 3 +}; + namespace Detail { constexpr short PORT = 0x3F8; +static int kState = kStateLimbo; + bool serial_init() { +#ifdef __DEBUG__ HAL::out8(PORT + 1, 0x00); // Disable all interrupts HAL::out8(PORT + 3, 0x80); // Enable DLAB (set baud rate divisor) HAL::out8(PORT + 0, 0x03); // Set divisor to 3 (lo byte) 38400 baud @@ -29,23 +39,24 @@ bool serial_init() { // Check if serial is faulty (i.e: not same byte as sent) if (HAL::in8(PORT) != 0xAE) { -#ifdef __DEBUG__ panic(RUNTIME_CHECK_HANDSHAKE); -#else - return false; -#endif } + kReady = kStateReady; + // If serial is not faulty set it in normal operation mode // (not-loopback with IRQs enabled and OUT#1 and OUT#2 bits enabled) HAL::out8(Detail::PORT + 4, 0x0F); +#endif return true; } } // namespace Detail void system_io_print(const char *bytes) { - if (!bytes) return; + if (!bytes || Detail::kState != kStateReady) return; + + Detail::kState = kStateTransmit; SizeT index = 0; SizeT len = string_length(bytes, 256); @@ -54,6 +65,8 @@ void system_io_print(const char *bytes) { HAL::out8(Detail::PORT, bytes[index]); ++index; } + + Detail::kState = kStateReady; } TerminalDevice kcout(hCore::system_io_print, nullptr); |
