diff options
Diffstat (limited to 'Kernel/Modules')
37 files changed, 1302 insertions, 0 deletions
diff --git a/Kernel/Modules/.gitkeep b/Kernel/Modules/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Kernel/Modules/.gitkeep diff --git a/Kernel/Modules/ACPI/.gitkeep b/Kernel/Modules/ACPI/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Kernel/Modules/ACPI/.gitkeep diff --git a/Kernel/Modules/ACPI/ACPI.hxx b/Kernel/Modules/ACPI/ACPI.hxx new file mode 100644 index 00000000..019bcb11 --- /dev/null +++ b/Kernel/Modules/ACPI/ACPI.hxx @@ -0,0 +1,88 @@ +/* ------------------------------------------- + + Copyright Zeta Electronics Corporation + +------------------------------------------- */ + +#ifndef __ACPI__ +#define __ACPI__ + +/** + https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html +*/ + +#include <NewKit/Defines.hpp> + +namespace NewOS +{ + class PACKED SDT + { + public: + Char Signature[4]; + UInt32 Length; + UInt8 Revision; + Char Checksum; + Char OemId[6]; + Char OemTableId[8]; + UInt32 OemRev; + UInt32 CreatorID; + UInt32 CreatorRevision; + }; + + class PACKED RSDP : public SDT + { + public: + UInt32 RsdtAddress; + UIntPtr XsdtAddress; + UInt8 ExtendedChecksum; + UInt8 Reserved0[3]; + }; + + class PACKED ConfigHeader + { + public: + UInt64 BaseAddress; + UInt16 PciSegGroup; + UInt8 StartBus; + UInt8 EndBus; + UInt32 Reserved; + }; + + enum class AddressSpace : UInt8 + { + SystemMemory = 0, + SystemIO = 1, + Pci = 2, + Controller = 3, + SmBus = 4, + Count = 5, + Invalid = 0xFF, + }; + + class PACKED Address + { + public: + AddressSpace AddressSpaceId; + UInt8 RegisterBitWidth; + UInt8 RegisterBitOffset; + UInt8 Reserved; + UIntPtr Address; + }; + + class PACKED RSDT + { + public: + Char Signature[4]; + UInt32 Length; + UInt8 Revision; + Char Checksum; + Char OemId[6]; + Char OemTableId[8]; + UInt32 OemRev; + UInt32 CreatorID; + UInt32 CreatorRevision; + UInt32 AddressArr[]; + }; +} // namespace NewOS + +#endif // !__ACPI__ diff --git a/Kernel/Modules/ACPI/ACPIFactoryInterface.hxx b/Kernel/Modules/ACPI/ACPIFactoryInterface.hxx new file mode 100644 index 00000000..7fbe6192 --- /dev/null +++ b/Kernel/Modules/ACPI/ACPIFactoryInterface.hxx @@ -0,0 +1,55 @@ +/* ------------------------------------------- + + Copyright Zeta Electronics Corporation + +------------------------------------------- */ + +#ifndef __ACPI_MANAGER__ +#define __ACPI_MANAGER__ + +#include <Modules/ACPI/ACPI.hxx> +#include <KernelKit/DebugOutput.hpp> +#include <NewKit/Defines.hpp> +#include <NewKit/Ref.hpp> + +namespace NewOS +{ + class ACPIFactoryInterface final + { + public: + explicit ACPIFactoryInterface(voidPtr rsdPtr); + ~ACPIFactoryInterface() = default; + + ACPIFactoryInterface& operator=(const ACPIFactoryInterface&) = default; + ACPIFactoryInterface(const ACPIFactoryInterface&) = default; + + public: + void Shutdown(); // shutdown + void Reboot(); // soft-reboot + + public: + /// @brief Descriptor find factory. + /// @param signature The signature of the descriptor table (MADT, ACPI...) + /// @return the blob inside an ErrorOr object. + ErrorOr<voidPtr> Find(const char* signature); + + /// @brief Checksum factory. + /// @param checksum the data to checksum + /// @param len it's size + /// @return if it succeed + bool Checksum(const char* checksum, SSizeT len); // watch for collides! + + public: + ErrorOr<voidPtr> operator[](const char* signature) + { + return this->Find(signature); + } + + private: + VoidPtr fRsdp; // pointer to root descriptor. + SSizeT fEntries; // number of entries, -1 tells that no invalid entries were + // found. + }; +} // namespace NewOS + +#endif // !__ACPI_MANAGER__ diff --git a/Kernel/Modules/ACPI/compile_flags.txt b/Kernel/Modules/ACPI/compile_flags.txt new file mode 100644 index 00000000..1bc51142 --- /dev/null +++ b/Kernel/Modules/ACPI/compile_flags.txt @@ -0,0 +1,4 @@ +-I./ +-I../ +-I../../ +-std=c++20 diff --git a/Kernel/Modules/AHCI/.gitkeep b/Kernel/Modules/AHCI/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Kernel/Modules/AHCI/.gitkeep diff --git a/Kernel/Modules/AHCI/AHCI.hxx b/Kernel/Modules/AHCI/AHCI.hxx new file mode 100644 index 00000000..b090c229 --- /dev/null +++ b/Kernel/Modules/AHCI/AHCI.hxx @@ -0,0 +1,368 @@ +/* ------------------------------------------- + + Copyright Zeta Electronics Corporation + + File: Defines.hxx + Purpose: AHCI header. + + Revision History: + + 03/02/24: Added file (amlel) + +------------------------------------------- */ + +#pragma once + +#include <NewKit/Defines.hpp> +#include <Modules/ACPI/ACPI.hxx> + +// Forward declarations of structs. + +struct HbaPort; +struct FisData; +struct FisRegD2H; +struct FisRegH2D; + +/// @brief Frame information type. +enum +{ + kFISTypeRegH2D = 0x27, // Register FIS - host to device + kFISTypeRegD2H = 0x34, // Register FIS - device to host + kFISTypeDMAAct = 0x39, // DMA activate FIS - device to host + kFISTypeDMASetup = 0x41, // DMA setup FIS - bidirectional + kFISTypeData = 0x46, // Data FIS - bidirectional + kFISTypeBIST = 0x58, // BIST activate FIS - bidirectional + kFISTypePIOSetup = 0x5F, // PIO setup FIS - device to host + kFISTypeDevBits = 0xA1, // Set device bits FIS - device to host +}; + +enum +{ + kAHCICmdIdentify = 0xEC, + kAHCICmdReadDma = 0xC8, + kAHCICmdReadDmaEx = 0x25, + kAHCICmdWriteDma = 0xCA, + kAHCICmdWriteDmaEx = 0x35 +}; + +typedef struct FisRegH2D final +{ + // DWORD 0 + NewOS::UInt8 FisType; // FIS_TYPE_REG_H2D + + NewOS::UInt8 PortMul : 4; // Port multiplier + NewOS::UInt8 Reserved0 : 3; // Reserved + NewOS::UInt8 CmdOrCtrl : 1; // 1: Command, 0: Control + + NewOS::UInt8 Command; // Command register + NewOS::UInt8 Featurel; // Feature register, 7:0 + + // DWORD 1 + NewOS::UInt8 Lba0; // LBA low register, 7:0 + NewOS::UInt8 Lba1; // LBA mid register, 15:8 + NewOS::UInt8 Lba2; // LBA high register, 23:16 + NewOS::UInt8 Device; // Device register + + // DWORD 2 + NewOS::UInt8 Lba3; // LBA register, 31:24 + NewOS::UInt8 Lba4; // LBA register, 39:32 + NewOS::UInt8 Lba5; // LBA register, 47:40 + NewOS::UInt8 FeatureHigh; // Feature register, 15:8 + + // DWORD 3 + NewOS::UInt8 CountLow; // Count register, 7:0 + NewOS::UInt8 CountHigh; // Count register, 15:8 + NewOS::UInt8 Icc; // Isochronous command completion + NewOS::UInt8 Control; // Control register + + // DWORD 4 + NewOS::UInt8 Reserved1[4]; // Reserved +} FisRegH2D; + +typedef struct FisRegD2H final +{ + // DWORD 0 + NewOS::UInt8 FisType; // FIS_TYPE_REG_D2H + + NewOS::UInt8 PortMul : 4; // Port multiplier + NewOS::UInt8 Reserved0 : 2; // Reserved + NewOS::UInt8 InterruptBit : 1; // Interrupt bit + NewOS::UInt8 Reserved1 : 1; // Reserved + + NewOS::UInt8 Status; // Status register + NewOS::UInt8 Rrror; // Error register + + // DWORD 1 + NewOS::UInt8 Lba0; // LBA low register, 7:0 + NewOS::UInt8 Lba1; // LBA mid register, 15:8 + NewOS::UInt8 Lba2; // LBA high register, 23:16 + NewOS::UInt8 Device; // Device register + + // DWORD 2 + NewOS::UInt8 Lba3; // LBA register, 31:24 + NewOS::UInt8 Lba4; // LBA register, 39:32 + NewOS::UInt8 Lba5; // LBA register, 47:40 + NewOS::UInt8 Rsv2; // Reserved + + // DWORD 3 + NewOS::UInt8 CountLow; // Count register, 7:0 + NewOS::UInt8 CountHigh; // Count register, 15:8 + NewOS::UInt8 Rsv3[2]; // Reserved + + // DWORD 4 + NewOS::UInt8 Rsv4[4]; // Reserved +} FisRegD2H; + +typedef struct FisData final +{ + // DWORD 0 + NewOS::UInt8 FisType; // FIS_TYPE_DATA + + NewOS::UInt8 PortMul : 4; // Port multiplier + NewOS::UInt8 Reserved0 : 4; // Reserved + + NewOS::UInt8 Reserved1[2]; // Reserved + + // DWORD 1 ~ N + NewOS::UInt32 Data[1]; // Payload +} FisData; + +typedef struct FisPioSetup final +{ + // DWORD 0 + NewOS::UInt8 FisType; // FIS_TYPE_PIO_SETUP + + NewOS::UInt8 PortMul : 4; // Port multiplier + NewOS::UInt8 Reserved0 : 1; // Reserved + NewOS::UInt8 DTD : 1; // Data transfer direction, 1 - device to host + NewOS::UInt8 InterruptBit : 1; // Interrupt bit + NewOS::UInt8 Reserved1 : 1; + + NewOS::UInt8 Status; // Status register + NewOS::UInt8 Error; // Error register + + // DWORD 1 + NewOS::UInt8 Lba0; // LBA low register, 7:0 + NewOS::UInt8 Lba1; // LBA mid register, 15:8 + NewOS::UInt8 Lba2; // LBA high register, 23:16 + NewOS::UInt8 Device; // Device register + + // DWORD 2 + NewOS::UInt8 Lba3; // LBA register, 31:24 + NewOS::UInt8 Lba4; // LBA register, 39:32 + NewOS::UInt8 Lba5; // LBA register, 47:40 + NewOS::UInt8 Rsv2; // Reserved + + // DWORD 3 + NewOS::UInt8 CountLow; // Count register, 7:0 + NewOS::UInt8 CountHigh; // Count register, 15:8 + NewOS::UInt8 Rsv3; // Reserved + NewOS::UInt8 EStatus; // New value of status register + + // DWORD 4 + NewOS::UInt16 TranferCount; // Transfer count + NewOS::UInt8 Rsv4[2]; // Reserved +} FisPioSetup; + +typedef struct FisDmaSetup final +{ + // DWORD 0 + NewOS::UInt8 FisType; // FIS_TYPE_DMA_SETUP + + NewOS::UInt8 PortMul : 4; // Port multiplier + NewOS::UInt8 Reserved0 : 1; // Reserved + NewOS::UInt8 DTD : 1; // Data transfer direction, 1 - device to host + NewOS::UInt8 InterruptBit : 1; // Interrupt bit + NewOS::UInt8 AutoEnable : 1; // Auto-activate. Specifies if DMA Activate FIS is needed + + NewOS::UInt8 Reserved1[2]; // Reserved + + // DWORD 1&2 + NewOS::UInt64 DmaBufferId; // DMA Buffer Identifier. Used to Identify DMA buffer in + // host memory. SATA Spec says host specific and not in + // Spec. Trying AHCI spec might work. + + // DWORD 3 + NewOS::UInt32 Rsvd; // More reserved + + // DWORD 4 + NewOS::UInt32 DmabufOffset; // Byte offset into buffer. First 2 bits must be 0 + + // DWORD 5 + NewOS::UInt32 TransferCount; // Number of bytes to transfer. Bit 0 must be 0 + + // DWORD 6 + NewOS::UInt32 Reserved3; // Reserved +} FisDmaSetup; + +typedef struct FisDevBits final +{ + // DWORD 0 + NewOS::UInt8 FisType; // FIS_TYPE_DMA_SETUP (A1h) + + NewOS::UInt8 Reserved0 : 5; // Reserved + NewOS::UInt8 R0 : 1; + NewOS::UInt8 InterruptBit : 1; + NewOS::UInt8 N : 1; + + NewOS::UInt8 StatusLow : 3; + NewOS::UInt8 R1 : 1; + NewOS::UInt8 StatusHigh : 3; + + NewOS::UInt8 R2 : 1; + NewOS::UInt8 Error; + + // DWORD 1 + NewOS::UInt32 Act; +} FisDevBits; + +/// \brief Enable AHCI device bit in GHC register. +#ifndef kAhciGHC_AE +#define kAhciGHC_AE (31) +#endif //! ifndef kAhciGHC_AE + +typedef struct HbaPort final +{ + NewOS::UInt32 Clb; // 0x00, command list base address, 1K-byte aligned + NewOS::UInt32 Clbu; // 0x04, command list base address upper 32 bits + NewOS::UInt32 Fb; // 0x08, FIS base address, 256-byte aligned + NewOS::UInt32 Fbu; // 0x0C, FIS base address upper 32 bits + NewOS::UInt32 Is; // 0x10, interrupt status + NewOS::UInt32 Ie; // 0x14, interrupt enable + NewOS::UInt32 Cmd; // 0x18, command and status + NewOS::UInt32 Reserved0; // 0x1C, Reserved + NewOS::UInt32 Tfd; // 0x20, task file data + NewOS::UInt32 Sig; // 0x24, signature + NewOS::UInt32 Ssts; // 0x28, SATA status (SCR0:SStatus) + NewOS::UInt32 Sctl; // 0x2C, SATA control (SCR2:SControl) + NewOS::UInt32 Serr; // 0x30, SATA error (SCR1:SError) + NewOS::UInt32 Sact; // 0x34, SATA active (SCR3:SActive) + NewOS::UInt32 Ci; // 0x38, command issue + NewOS::UInt32 Sntf; // 0x20, SATA notification (SCR4:SNotification) + NewOS::UInt32 Fbs; // 0x40, FIS-based switch control + NewOS::UInt32 Reserved1[11]; // 0x44 ~ 0x6F, Reserved + NewOS::UInt32 Vendor[4]; // 0x70 ~ 0x7F, vendor specific +} HbaPort; + +typedef struct HbaMem final +{ + // 0x00 - 0x2B, Generic Host Control + NewOS::UInt32 Cap; // 0x00, Host capability + NewOS::UInt32 Ghc; // 0x04, Global host control + NewOS::UInt32 Is; // 0x08, Interrupt status + NewOS::UInt32 Pi; // 0x0C, Port implemented + NewOS::UInt32 Vs; // 0x10, Version + NewOS::UInt32 Ccc_ctl; // 0x14, Command completion coalescing control + NewOS::UInt32 Ccc_pts; // 0x18, Command completion coalescing ports + NewOS::UInt32 Em_loc; // 0x1C, Enclosure management location + NewOS::UInt32 Em_ctl; // 0x20, Enclosure management control + NewOS::UInt32 Cap2; // 0x24, Host capabilities extended + NewOS::UInt32 Bohc; // 0x28, BIOS/OS handoff control and status + + NewOS::UInt16 Resv0; + NewOS::UInt32 Resv2; + + HbaPort Ports[1]; // 1 ~ 32 +} HbaMem; + +typedef struct HbaCmdHeader final +{ + // DW0 + NewOS::UInt8 Cfl : 5; // Command FIS length in DWORDS, 2 ~ 16 + NewOS::UInt8 Atapi : 1; // ATAPI + NewOS::UInt8 Write : 1; // Write, 1: H2D, 0: D2H + NewOS::UInt8 Prefetchable : 1; // Prefetchable + + NewOS::UInt8 Reset : 1; // Reset + NewOS::UInt8 BIST : 1; // BIST + NewOS::UInt8 Clear : 1; // Clear busy upon R_OK + NewOS::UInt8 Reserved0 : 1; // Reserved + NewOS::UInt8 Pmp : 4; // Port multiplier port + + NewOS::UInt16 Prdtl; // Physical region descriptor table length in entries + volatile NewOS::UInt32 Prdbc; // Physical region descriptor byte count transferred + + NewOS::UInt32 Ctba; // Command table descriptor base address + NewOS::UInt32 Ctbau; // Command table descriptor base address upper 32 bits + + NewOS::UInt32 Reserved1[4]; // Reserved +} HbaCmdHeader; + +typedef struct HbaFis final +{ + // 0x00 + FisDmaSetup Dsfis; // DMA Setup FIS + NewOS::UInt8 Pad0[4]; + // 0x20 + FisPioSetup Psfis; // PIO Setup FIS + NewOS::UInt8 Pad1[12]; + // 0x40 + FisRegD2H Rfis; // Register – Device to Host FIS + NewOS::UInt8 Pad2[4]; + // 0x58 + FisDevBits Sdbfis; // Set Device Bit FIS + // 0x60 + NewOS::UInt8 Ufis[64]; + // 0xA0 + NewOS::UInt8 Rsv[0x100 - 0xA0]; +} HbaFis; + +typedef struct HbaPrdtEntry final +{ + NewOS::UInt32 Dba; // Data base address + NewOS::UInt32 Dbau; // Data base address upper 32 bits + NewOS::UInt32 Reserved0; // Reserved + // DW3 + NewOS::UInt32 Dbc : 22; // Byte count, 4M max + NewOS::UInt32 Reserved1 : 9; // Reserved + NewOS::UInt32 InterruptBit : 1; // Interrupt on completion +} HbaPrdtEntry; + +typedef struct HbaCmdTbl final +{ + NewOS::UInt8 Cfis[64]; // Command FIS + NewOS::UInt8 Acmd[16]; // ATAPI command, 12 or 16 bytes + NewOS::UInt8 Rsv[48]; // Reserved + struct HbaPrdtEntry prdtEntries[1]; // Physical region descriptor table entries, 0 ~ 65535 +} HbaCmdTbl; + +/* EOF */ + +#if defined(__AHCI__) + +/// @brief Initializes an AHCI disk. +/// @param PortsImplemented the amount of port that have been detected. +/// @return +NewOS::Boolean drv_std_init(NewOS::UInt16& PortsImplemented); + +NewOS::Boolean drv_std_detected(NewOS::Void); + +/// @brief Read from disk. +/// @param Lba +/// @param Buf +/// @param SectorSz +/// @param Size +/// @return +NewOS::Void drv_std_read(NewOS::UInt64 Lba, NewOS::Char* Buf, NewOS::SizeT SectorSz, NewOS::SizeT Size); + +/// @brief Write to disk. +/// @param Lba +/// @param Buf +/// @param SectorSz +/// @param Size +/// @return +NewOS::Void drv_std_write(NewOS::UInt64 Lba, NewOS::Char* Buf, NewOS::SizeT SectorSz, NewOS::SizeT Size); + +/// @brief get sector count. +NewOS::SizeT drv_std_get_sector_count(); + +/// @brief get device size. +NewOS::SizeT drv_std_get_drv_size(); + +/// @brief get sector count. +NewOS::SizeT drv_std_get_sector_count(); + +/// @brief get device size. +NewOS::SizeT drv_std_get_drv_size(); + +#endif // ifdef __KERNEL__ diff --git a/Kernel/Modules/AHCI/compile_flags.txt b/Kernel/Modules/AHCI/compile_flags.txt new file mode 100644 index 00000000..1bc51142 --- /dev/null +++ b/Kernel/Modules/AHCI/compile_flags.txt @@ -0,0 +1,4 @@ +-I./ +-I../ +-I../../ +-std=c++20 diff --git a/Kernel/Modules/APM/.gitkeep b/Kernel/Modules/APM/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Kernel/Modules/APM/.gitkeep diff --git a/Kernel/Modules/ATA/ATA.hxx b/Kernel/Modules/ATA/ATA.hxx new file mode 100644 index 00000000..98732c72 --- /dev/null +++ b/Kernel/Modules/ATA/ATA.hxx @@ -0,0 +1,156 @@ +/* ------------------------------------------- + + Copyright Zeta Electronics Corporation + + File: Defines.hxx + Purpose: ATA header. + + Revision History: + + 03/02/24: Added file (amlel) + +------------------------------------------- */ + +#pragma once + +#ifndef __AHCI__ + +#include <CompilerKit/CompilerKit.hxx> +#include <NewKit/Defines.hpp> + +///! Status register +#define ATA_SR_BSY 0x80 +#define ATA_SR_DRDY 0x40 +#define ATA_SR_DF 0x20 +#define ATA_SR_DSC 0x10 +#define ATA_SR_DRQ 0x08 +#define ATA_SR_CORR 0x04 +#define ATA_SR_IDX 0x02 +#define ATA_SR_ERR 0x01 + +///! Error register +#define ATA_ER_BBK 0x80 +#define ATA_ER_UNC 0x40 +#define ATA_ER_MC 0x20 +#define ATA_ER_IDNF 0x10 +#define ATA_ER_MCR 0x08 +#define ATA_ER_ABRT 0x04 +#define ATA_ER_TK0NF 0x02 +#define ATA_ER_AMNF 0x01 + +#define ATA_CMD_READ_PIO 0x20 +#define ATA_CMD_READ_PIO_EXT 0x24 +#define ATA_CMD_READ_DMA 0xC8 +#define ATA_CMD_READ_DMA_EXT 0x25 +#define ATA_CMD_WRITE_PIO 0x30 +#define ATA_CMD_WRITE_PIO_EXT 0x34 +#define ATA_CMD_WRITE_DMA 0xCA +#define ATA_CMD_WRITE_DMA_EXT 0x35 +#define ATA_CMD_CACHE_FLUSH 0xE7 +#define ATA_CMD_CACHE_FLUSH_EXT 0xEA +#define ATA_CMD_PACKET 0xA0 +#define ATA_CMD_IDENTIFY_PACKET 0xA1 +#define ATA_CMD_IDENTIFY 0xEC + +///! ident offsets, use with data that we got from ATA_CMD_IDENTIFY. +#define ATA_IDENT_DEVICE_TYPE 0 +#define ATA_IDENT_CYLINDERS 2 +#define ATA_IDENT_HEADS 6 +#define ATA_IDENT_SECTORS 12 +#define ATA_IDENT_SERIAL 20 +#define ATA_IDENT_MODEL 54 +#define ATA_IDENT_CAPABILITIES 98 +#define ATA_IDENT_FIELDVALID 106 +#define ATA_IDENT_MAX_LBA 120 +#define ATA_IDENT_COMMANDSETS 164 +#define ATA_IDENT_MAX_LBA_EXT 200 + +#define ATA_MASTER 0x00 +#define ATA_SLAVE 0x01 + +///! Register +#define ATA_REG_DATA 0x00 +#define ATA_REG_ERROR 0x01 +#define ATA_REG_FEATURES 0x01 +#define ATA_REG_SEC_COUNT0 0x02 +#define ATA_REG_LBA0 0x03 +#define ATA_REG_LBA1 0x04 +#define ATA_REG_LBA2 0x05 +#define ATA_REG_HDDEVSEL 0x06 +#define ATA_REG_COMMAND 0x07 +#define ATA_REG_STATUS 0x07 +#define ATA_REG_SEC_COUNT1 0x08 +#define ATA_REG_LBA3 0x09 +#define ATA_REG_LBA4 0x0A +#define ATA_REG_LBA5 0x0B +#define ATA_REG_CONTROL 0x0C +#define ATA_REG_ALT_STATUS 0x0C +#define ATA_REG_DEV_ADDRESS 0x0D + +#define ATA_REG_NEIN 0x01 + +#define ATA_PRIMARY_IO 0x1F0 +#define ATA_SECONDARY_IO 0x170 +#define ATA_PRIMARY_DCR_AS 0x3F6 +#define ATA_SECONDARY_DCR_AS 0x376 + +///! Irq +#define ATA_PRIMARY_IRQ 14 +#define ATA_SECONDARY_IRQ 15 + +///! Channels +#define ATA_PRIMARY 0x00 +#define ATA_SECONDARY 0x01 + +#define ATA_CYL_LOW 3 +#define ATA_CYL_MID 4 +#define ATA_CYL_HIGH 5 + +///! IO Direction +#define ATA_READ 0x00 +#define ATA_WRITE 0x013 + +#define ATA_PRIMARY_SEL 0xA0 +#define ATA_SECONDARY_SEL 0xB0 + +///! ATA address register. +#define ATA_ADDRESS1(x) (x + 3) +#define ATA_ADDRESS2(x) (x + 4) +#define ATA_ADDRESS3(x) (x + 5) + +///! ATA command register. +#define ATA_COMMAND(x) (x + 7) + +#define kATASectorSize (512U) + +enum +{ + kATADevicePATA, + kATADeviceSATA, + kATADevicePATA_PI, + kATADeviceSATA_PI, + kATADeviceCount, +}; + +#if defined(__ATA_PIO__) || defined(__ATA_DMA__) + +NewOS::Boolean drv_std_init(NewOS::UInt16 Bus, NewOS::UInt8 Drive, NewOS::UInt16& OutBus, NewOS::UInt8& OutMaster); + +NewOS::Boolean drv_std_detected(NewOS::Void); + +NewOS::Void drv_std_select(NewOS::UInt16 Bus); + +NewOS::Boolean drv_std_wait_io(NewOS::UInt16 IO); + +NewOS::Void drv_std_read(NewOS::UInt64 Lba, NewOS::UInt16 IO, NewOS::UInt8 Master, NewOS::Char* Buf, NewOS::SizeT SectorSz, NewOS::SizeT Size); + +NewOS::Void drv_std_write(NewOS::UInt64 Lba, NewOS::UInt16 IO, NewOS::UInt8 Master, NewOS::Char* Buf, NewOS::SizeT SectorSz, NewOS::SizeT Size); + +/// @brief get sector count. +NewOS::SizeT drv_std_get_sector_count(); + +/// @brief get device size. +NewOS::SizeT drv_std_get_drv_size(); + +#endif // ifdef __KERNEL__ +#endif // ifndef __ATA_PIO__ || __AHCI__ diff --git a/Kernel/Modules/ATA/compile_flags.txt b/Kernel/Modules/ATA/compile_flags.txt new file mode 100644 index 00000000..1bc51142 --- /dev/null +++ b/Kernel/Modules/ATA/compile_flags.txt @@ -0,0 +1,4 @@ +-I./ +-I../ +-I../../ +-std=c++20 diff --git a/Kernel/Modules/CoreCG/Accessibility.hxx b/Kernel/Modules/CoreCG/Accessibility.hxx new file mode 100644 index 00000000..7f310719 --- /dev/null +++ b/Kernel/Modules/CoreCG/Accessibility.hxx @@ -0,0 +1,59 @@ +/* ------------------------------------------- + + Copyright Zeta Electronics Corporation + +------------------------------------------- */ + +#pragma once + +#include "CompilerKit/Detail.hxx" +#include <NewKit/NewKit.hpp> +#include <KernelKit/HError.hpp> +#include <Modules/CoreCG/CoreCG.hxx> +#include <Modules/CoreCG/Lerp.hxx> +#include <ArchKit/ArchKit.hpp> + +namespace NewOS +{ + inline Bool cKTSyncCall = false; + + inline float cDeviceWidthAlert = 150; + inline float cDeviceHeightAlert = 141; + + class UIAccessibilty final + { + explicit UIAccessibilty() = default; + + public: + NEWOS_COPY_DELETE(UIAccessibilty); + + static UIAccessibilty& The() + { + static UIAccessibilty the; + return the; + } + + Int32 Show(const char* text, int x, int y) + { + if (!text || *text == 0) + return kErrorHeapNotPresent; + + // GXDrawText("Sleek", text, cDeviceWidthAlert, x, cDeviceHeightAlert, y); + + if (cKTSyncCall) + return kErrorAsync; + + return kErrorSuccess; + } + + Int64 Width() noexcept + { + return kHandoverHeader->f_GOP.f_Width; + } + + Int64 Height() noexcept + { + return kHandoverHeader->f_GOP.f_Height; + } + }; +} // namespace NewOS diff --git a/Kernel/Modules/CoreCG/CoreCG.hxx b/Kernel/Modules/CoreCG/CoreCG.hxx new file mode 100644 index 00000000..5720ef13 --- /dev/null +++ b/Kernel/Modules/CoreCG/CoreCG.hxx @@ -0,0 +1,93 @@ +/* ------------------------------------------- + + Copyright Zeta Electronics Corporation + +------------------------------------------- */ + +#pragma once + +#include <NewKit/Defines.hpp> + +#define GXInit() NewOS::SizeT __GXCursor = 0 + +#define GXRgba(R, G, B) (UInt32)(R | G | B) + +#define gxClearClr RGB(9d, 9d, 9d) + +#define GXFini() __GXCursor = 0 + +/// @brief Performs OR drawing on the framebuffer. +#define GXDrawAlphaImg(ImgPtr, _Height, _Width, BaseX, BaseY) \ + __GXCursor = 0; \ + \ + for (NewOS::SizeT i = BaseX; i < (_Height + BaseX); ++i) \ + { \ + for (NewOS::SizeT u = BaseY; u < (_Width + BaseY); ++u) \ + { \ + *(((volatile NewOS::UInt32*)(kHandoverHeader->f_GOP.f_The + \ + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ + i + \ + 4 * u))) |= ImgPtr[__GXCursor]; \ + \ + ++__GXCursor; \ + } \ + } + +/// @brief Draws a resource. +#define GXDrawImg(ImgPtr, _Height, _Width, BaseX, BaseY) \ + __GXCursor = 0; \ + \ + for (NewOS::SizeT i = BaseX; i < (_Height + BaseX); ++i) \ + { \ + for (NewOS::SizeT u = BaseY; u < (_Width + BaseY); ++u) \ + { \ + *(((volatile NewOS::UInt32*)(kHandoverHeader->f_GOP.f_The + \ + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ + i + \ + 4 * u))) = ImgPtr[__GXCursor]; \ + \ + ++__GXCursor; \ + } \ + } + +/// @brief Cleans a resource. +#define GXClear(_Height, _Width, BaseX, BaseY) \ + \ + for (NewOS::SizeT i = BaseX; i < _Height + BaseX; ++i) \ + { \ + for (NewOS::SizeT u = BaseY; u < _Width + BaseY; ++u) \ + { \ + *(((volatile NewOS::UInt32*)(kHandoverHeader->f_GOP.f_The + \ + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ + i + \ + 4 * u))) = gxClearClr; \ + } \ + } + +/// @brief Draws inside a zone. +#define GXDraw(_Clr, _Height, _Width, BaseX, BaseY) \ + \ + for (NewOS::SizeT i = BaseX; i < (_Width + BaseX); ++i) \ + { \ + for (NewOS::SizeT u = BaseY; u < (_Height + BaseY); ++u) \ + { \ + *(((volatile NewOS::UInt32*)(kHandoverHeader->f_GOP.f_The + \ + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \ + i + \ + 4 * u))) = _Clr; \ + } \ + } + +/// This is enabled if Cairo is compiled with CoreCG. +#ifdef __CG_USE_GX__ +/// @brief This function creates a new framebuffer for CoreCG. +/// @return +inline cairo_surface_t* GXCreateFramebufferCairo() +{ + cairo_format_t format = CAIRO_FORMAT_ARGB32; + + NewOS::Int32 stride = cairo_format_stride_for_width(format, kHandoverHeader->f_GOP.f_Width); + + return cairo_image_surface_create_for_data((unsigned char*)kHandoverHeader->f_GOP.f_The, format, kHandoverHeader->f_GOP.f_Width, kHandoverHeader->f_GOP.f_Height, stride); +} +#endif diff --git a/Kernel/Modules/CoreCG/Lerp.hxx b/Kernel/Modules/CoreCG/Lerp.hxx new file mode 100644 index 00000000..b62a8266 --- /dev/null +++ b/Kernel/Modules/CoreCG/Lerp.hxx @@ -0,0 +1,22 @@ +/* ------------------------------------------- + + Copyright Zeta Electronics Corporation + +------------------------------------------- */ + +#pragma once + +/// @file Lerp.hxx +/// @brief Linear interpolation implementation. + +typedef float GXReal; + +/// @brief Linear interpolation equation solver. +/// @param from where? +/// @param to to? +/// @param at which state we're at **to**. +inline GXReal GXLerp(GXReal to, GXReal from, GXReal stat) +{ + GXReal difference = to - from; + return from + (difference * stat); +} diff --git a/Kernel/Modules/CoreCG/Rsrc/Cursor.rsrc b/Kernel/Modules/CoreCG/Rsrc/Cursor.rsrc new file mode 100644 index 00000000..2283cb32 --- /dev/null +++ b/Kernel/Modules/CoreCG/Rsrc/Cursor.rsrc @@ -0,0 +1,64 @@ +#define cCurHeight (57) +#define cCurWidth (53) + +#define cCurLength (3021) + +static const unsigned int Cursor[cCurLength] = { + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x0e0e0e, 0x474747, 0x474747, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x0e0e0e, 0x969696, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xdedede, 0x363636, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x969696, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xececec, 0x0e0e0e, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x222222, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x878787, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x474747, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xc2c2c2, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x363636, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x0e0e0e, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xebebeb, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x474747, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xa5a5a5, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x979797, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x686868, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xdedede, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x222222, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x0e0e0e, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xdedede, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x686868, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x969696, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xa5a5a5, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x585858, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xececec, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x0e0e0e, 0x585858, 0x222222, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x0e0e0e, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x363636, 0x000000, 0x000000, 0x000000, 0x686868, 0xebebeb, 0xf9f9f9, 0x969696, 0x000000, 0x000000, 0x000000, 0x222222, 0xdedede, 0xf9f9f9, 0xdedede, 0x0e0e0e, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xc2c2c2, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x787878, 0x000000, 0x000000, 0x000000, 0xdedede, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x787878, 0x000000, 0x000000, 0x474747, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x575757, 0x000000, 0x000000, 0x000000, 0x000000, 0x222222, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x878787, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xc2c2c2, 0x000000, 0x000000, 0x222222, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xc2c2c2, 0x000000, 0x000000, 0x0e0e0e, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x979797, 0x000000, 0x000000, 0x000000, 0x969696, 0xf9f9f9, 0xdedede, 0x0e0e0e, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x474747, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xececec, 0x000000, 0x000000, 0x000000, 0xdedede, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xececec, 0x0e0e0e, 0x000000, 0x000000, 0xdedede, 0xf9f9f9, 0xf9f9f9, 0xdedede, 0x000000, 0x000000, 0x000000, 0xdedede, 0xf9f9f9, 0xf9f9f9, 0x575757, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xebebeb, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x474747, 0x000000, 0x000000, 0x969696, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x474747, 0x000000, 0x000000, 0x969696, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x222222, 0x000000, 0x000000, 0xc2c2c2, 0xf9f9f9, 0xf9f9f9, 0x979797, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xc2c2c2, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x878787, 0x000000, 0x000000, 0x585858, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x979797, 0x000000, 0x000000, 0x474747, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x686868, 0x000000, 0x000000, 0x777777, 0xf9f9f9, 0xf9f9f9, 0xdedede, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x0e0e0e, 0x474747, 0x474747, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x777777, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xc2c2c2, 0x000000, 0x000000, 0x0e0e0e, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xcfcfcf, 0x000000, 0x000000, 0x0e0e0e, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xa5a5a5, 0x000000, 0x000000, 0x363636, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x222222, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x0e0e0e, 0xb3b3b3, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xdedede, 0x686868, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x363636, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x0e0e0e, 0x000000, 0x000000, 0xc2c2c2, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x0e0e0e, 0x000000, 0x000000, 0xc2c2c2, 0xf9f9f9, 0xf9f9f9, 0xececec, 0x222222, 0x222222, 0x363636, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x787878, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xc2c2c2, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xdedede, 0x222222, 0x000000, 0x000000, 0x000000, 0x000000, 0xebebeb, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x979797, 0x686868, 0x686868, 0xcfcfcf, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xcfcfcf, 0xd0d0d0, 0xdedede, 0xebebeb, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xa5a5a5, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x474747, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xa5a5a5, 0x222222, 0x000000, 0x000000, 0xa5a5a5, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xececec, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x878787, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x787878, 0x000000, 0x000000, 0x686868, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x474747, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x878787, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xc2c2c2, 0x000000, 0x000000, 0x0e0e0e, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x787878, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x474747, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xececec, 0x0e0e0e, 0x000000, 0x000000, 0xdedede, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x222222, 0x222222, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x222222, 0x222222, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xc2c2c2, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xc2c2c2, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x474747, 0x000000, 0x000000, 0x969696, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x0e0e0e, 0x000000, 0xc2c2c2, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x0e0e0e, 0x000000, 0xc2c2c2, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xececec, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x222222, 0xdedede, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x979797, 0x000000, 0x000000, 0x474747, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x878787, 0x000000, 0x474747, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x787878, 0x000000, 0x878787, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x0e0e0e, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x878787, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xcfcfcf, 0x000000, 0x000000, 0x585858, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xececec, 0x000000, 0x000000, 0xebebeb, 0xf9f9f9, 0xf9f9f9, 0xc2c2c2, 0x000000, 0x363636, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x222222, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x222222, 0xdedede, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x0e0e0e, 0x686868, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x222222, 0x222222, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x474747, 0x000000, 0x878787, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x0e0e0e, 0x000000, 0xdedede, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x474747, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x969696, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xd0d0d0, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x0e0e0e, 0x000000, 0xc2c2c2, 0xf9f9f9, 0xf9f9f9, 0xc2c2c2, 0x000000, 0x0e0e0e, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x686868, 0x000000, 0x969696, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x474747, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x474747, 0xdedede, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x878787, 0x000000, 0x585858, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x0e0e0e, 0x000000, 0xc2c2c2, 0xf9f9f9, 0xf9f9f9, 0xb3b3b3, 0x000000, 0x474747, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x222222, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x222222, 0xa5a5a5, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xececec, 0x000000, 0x0e0e0e, 0xebebeb, 0xf9f9f9, 0xf9f9f9, 0x878787, 0x000000, 0x474747, 0xf9f9f9, 0xf9f9f9, 0xececec, 0x0e0e0e, 0x000000, 0xebebeb, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x686868, 0xdedede, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x474747, 0x000000, 0x969696, 0xf9f9f9, 0xf9f9f9, 0xececec, 0x000000, 0x000000, 0xebebeb, 0xf9f9f9, 0xf9f9f9, 0x474747, 0x000000, 0x969696, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xcfcfcf, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x222222, 0xc2c2c2, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xb3b3b3, 0x000000, 0x474747, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x474747, 0x000000, 0x878787, 0xf9f9f9, 0xf9f9f9, 0x979797, 0x000000, 0x474747, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xa5a5a5, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x878787, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xececec, 0x0e0e0e, 0x000000, 0xc2c2c2, 0xf9f9f9, 0xf9f9f9, 0xc2c2c2, 0x000000, 0x0e0e0e, 0xf9f9f9, 0xf9f9f9, 0xececec, 0x000000, 0x0e0e0e, 0xebebeb, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x686868, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x878787, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x787878, 0x000000, 0x777777, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x0e0e0e, 0x000000, 0xc2c2c2, 0xf9f9f9, 0xf9f9f9, 0x474747, 0x000000, 0xb4b4b4, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xececec, 0x0e0e0e, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x0e0e0e, 0xebebeb, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xc2c2c2, 0x000000, 0x0e0e0e, 0xebebeb, 0xf9f9f9, 0xf9f9f9, 0x878787, 0x000000, 0x474747, 0xf9f9f9, 0xf9f9f9, 0x979797, 0x000000, 0x686868, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xa5a5a5, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x878787, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x474747, 0x000000, 0xb4b4b4, 0xf9f9f9, 0xf9f9f9, 0xececec, 0x000000, 0x000000, 0xebebeb, 0xf9f9f9, 0xdedede, 0x000000, 0x0e0e0e, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x686868, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xcfcfcf, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x979797, 0x000000, 0x474747, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x474747, 0x000000, 0x878787, 0xf9f9f9, 0xf9f9f9, 0x363636, 0x000000, 0xc2c2c2, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x878787, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x222222, 0xdedede, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xececec, 0x0e0e0e, 0x000000, 0xebebeb, 0xf9f9f9, 0xf9f9f9, 0xc2c2c2, 0x000000, 0x0e0e0e, 0xf9f9f9, 0xf9f9f9, 0x878787, 0x000000, 0x777777, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xa5a5a5, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x343434, 0xebebeb, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x575757, 0x000000, 0x878787, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x222222, 0x222222, 0xf9f9f9, 0xf9f9f9, 0xc2c2c2, 0x000000, 0x0e0e0e, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xb3b3b3, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x343434, 0xdedede, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xc2c2c2, 0x000000, 0x0e0e0e, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x222222, 0x222222, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xc2c2c2, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x222222, 0xdedede, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x222222, 0x222222, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xc2c2c2, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x686868, 0xdedede, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x686868, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x777777, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xdedede, 0x222222, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xcfcfcf, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0x585858, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x222222, 0xc2c2c2, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xf9f9f9, 0xebebeb, 0x585858, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x474747, 0x878787, 0xa5a5a5, 0xa5a5a5, 0xa5a5a5, 0xa5a5a5, 0xa5a5a5, 0xa5a5a5, 0xa5a5a5, 0xa5a5a5, 0xa5a5a5, 0xa5a5a5, 0xa5a5a5, 0x979797, 0x686868, 0x0e0e0e, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 +}; diff --git a/Kernel/Modules/Flash/Flash.hxx b/Kernel/Modules/Flash/Flash.hxx new file mode 100644 index 00000000..d75539b6 --- /dev/null +++ b/Kernel/Modules/Flash/Flash.hxx @@ -0,0 +1,19 @@ +/* ------------------------------------------- + + Copyright Zeta Electronics Corporation + +------------------------------------------- */ + +#pragma once + +#ifdef __FLASH_MEM__ + +/// @brief get sector count. +/// @return drive sector count. +NewOS::SizeT drv_std_get_sector_count(); + +/// @brief get device size. +/// @return drive size +NewOS::SizeT drv_std_get_drv_size(); + +#endif // ifdef __FLASH_MEM__ diff --git a/Kernel/Modules/GPRS/.keepme b/Kernel/Modules/GPRS/.keepme new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Kernel/Modules/GPRS/.keepme diff --git a/Kernel/Modules/HPET/.gitkeep b/Kernel/Modules/HPET/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Kernel/Modules/HPET/.gitkeep diff --git a/Kernel/Modules/HPET/Defines.hxx b/Kernel/Modules/HPET/Defines.hxx new file mode 100644 index 00000000..b0366ad2 --- /dev/null +++ b/Kernel/Modules/HPET/Defines.hxx @@ -0,0 +1,42 @@ +/* ------------------------------------------- + + Copyright Zeta Electronics Corporation + + File: HPET.hxx + Purpose: HPET builtin. + + Revision History: + +------------------------------------------- */ + +#pragma once + +#include <NewKit/Defines.hpp> +#include <Modules/ACPI/ACPI.hxx> + +namespace NewOS +{ + struct PACKED HPETAddressStructure final + { + NewOS::UInt8 AddressSpaceId; // 0 - system memory, 1 - system I/O + NewOS::UInt8 RegisterBitWidth; + NewOS::UInt8 RegisterBitOffset; + NewOS::UInt8 Reserved; + NewOS::UInt64 Address; + }; + + struct PACKED HPETHeader final : public SDT + { + NewOS::UInt8 HardwareRevId; + NewOS::UInt8 ComparatorCount : 5; + NewOS::UInt8 CounterSize : 1; + NewOS::UInt8 Reserved : 1; + NewOS::UInt8 LegacyReplacement : 1; + NewOS::UInt16 PciVendorId; + HPETAddressStructure Address; + NewOS::UInt8 HpetNumber; + NewOS::UInt16 MinimumTick; + NewOS::UInt8 PageProtection; + }; + +} // namespace NewOS diff --git a/Kernel/Modules/IEEE802/.gitkeep b/Kernel/Modules/IEEE802/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Kernel/Modules/IEEE802/.gitkeep diff --git a/Kernel/Modules/IEEE802/compile_flags.txt b/Kernel/Modules/IEEE802/compile_flags.txt new file mode 100644 index 00000000..1fbcad21 --- /dev/null +++ b/Kernel/Modules/IEEE802/compile_flags.txt @@ -0,0 +1,4 @@ +-I./ +-I../ +-I../Kernel +-std=c++20 diff --git a/Kernel/Modules/LTE/.keepme b/Kernel/Modules/LTE/.keepme new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Kernel/Modules/LTE/.keepme diff --git a/Kernel/Modules/LTE/IO.hxx b/Kernel/Modules/LTE/IO.hxx new file mode 100644 index 00000000..7ae256e9 --- /dev/null +++ b/Kernel/Modules/LTE/IO.hxx @@ -0,0 +1,28 @@ +/* -------------------------------------------
+
+Copyright Zeta Electronics Corporation.
+
+File: LTE\IO.hxx.
+Purpose: LTE I/O.
+
+------------------------------------------- */
+
+#ifndef _INC_NETWORK_LTE_IO_HXX_
+#define _INC_NETWORK_LTE_IO_HXX_
+
+#include <NewKit/Defines.hpp>
+#include <NewKit/String.hpp>
+
+/// @brief LTE I/O routines.
+
+/// @brief Turn on SIM slot.
+NewOS::Boolean lte_turn_on_slot(NewOS::Int32 slot);
+
+/// @brief Turn off SIM slot.
+NewOS::Boolean lte_turn_off_slot(NewOS::Int32 slot);
+
+/// @brief Send AT command.
+NewOS::Boolean lte_send_at_command(NewOS::Char* buf,
+ NewOS::Size bufSz);
+
+#endif // ifndef _INC_NETWORK_LTE_IO_HXX_
diff --git a/Kernel/Modules/MBCI/Interface.hxx b/Kernel/Modules/MBCI/Interface.hxx new file mode 100644 index 00000000..fa6f479b --- /dev/null +++ b/Kernel/Modules/MBCI/Interface.hxx @@ -0,0 +1,10 @@ +/* ------------------------------------------- + + Copyright Zeta Electronics Corporation + +------------------------------------------- */ + +#pragma once + +#include <NewKit/Defines.hpp> +#include <Modules/MBCI/MBCI.hxx> diff --git a/Kernel/Modules/MBCI/MBCI.hxx b/Kernel/Modules/MBCI/MBCI.hxx new file mode 100644 index 00000000..473013a2 --- /dev/null +++ b/Kernel/Modules/MBCI/MBCI.hxx @@ -0,0 +1,55 @@ +/* ------------------------------------------- + + Copyright Zeta Electronics Corporation + +------------------------------------------- */ + +#pragma once + +#include <NewKit/Defines.hpp> +#include <Modules/ACPI/ACPI.hxx> + +namespace NewOS +{ + struct MBCIHostInterface; + + /// @brief MBCI Host Interface header. + struct PACKED MBCIHostInterface final + { + UInt32 HostId; + UInt16 VendorId; + UInt16 DeviceId; + UInt8 MemoryType; + UInt16 HostType; + UInt16 HostFlags; + UInt8 Error; + UInt8 Status; + UInt8 InterruptEnable; + UInt64 BaseAddressRegister; + UInt64 BaseAddressRegisterSize; + }; + + /// @brief MBCI host flags. + enum MBCIHostFlags + { + kMBCIHostFlagsSupportsPageProtection, /// Page protected. + kMBCIHostFlagsSupportsAPM, /// Advanced Power Management. + kMBCIHostFlagsSupportsDaisyChain, /// Is daisy chained. + kMBCIHostFlagsSupportsHWInterrupts, /// Has HW interrupts. + kMBCIHostFlagsSupportsDMA, /// Has DMA. + kMBCIHostFlagsExtended = __UINT16_MAX__, // Extended flags table. + }; + + enum MBCIHostKind + { + kMBCIHostKindHardDisk, + kMBCIHostKindOpticalDisk, + kMBCIHostKindKeyboardLow, + kMBCIHostKindMouseLow, + kMBCIHostKindMouseHigh, + kMBCIHostKindKeyboardHigh, + kMBCIHostKindNetworkInterface, + kMBCIHostKindDaisyChain, + kMBCIHostKindStartExtended = __UINT16_MAX__, /// Extended vendor table. + }; +} // namespace NewOS diff --git a/Kernel/Modules/NVME/.gitkeep b/Kernel/Modules/NVME/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Kernel/Modules/NVME/.gitkeep diff --git a/Kernel/Modules/NVME/compile_flags.txt b/Kernel/Modules/NVME/compile_flags.txt new file mode 100644 index 00000000..1bc51142 --- /dev/null +++ b/Kernel/Modules/NVME/compile_flags.txt @@ -0,0 +1,4 @@ +-I./ +-I../ +-I../../ +-std=c++20 diff --git a/Kernel/Modules/OHCI/.gitkeep b/Kernel/Modules/OHCI/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Kernel/Modules/OHCI/.gitkeep diff --git a/Kernel/Modules/PS2/PS2MouseInterface.hxx b/Kernel/Modules/PS2/PS2MouseInterface.hxx new file mode 100644 index 00000000..124d4380 --- /dev/null +++ b/Kernel/Modules/PS2/PS2MouseInterface.hxx @@ -0,0 +1,112 @@ +/* ------------------------------------------- + + Copyright Zeta Electronics Corporation + + File: PS2MouseInterface.hxx + Purpose: PS/2 mouse. + + Revision History: + + 03/02/24: Added file (amlel) + +------------------------------------------- */ + +#pragma once + +#include <ArchKit/ArchKit.hpp> +#include <CompilerKit/CompilerKit.hxx> +#include <NewKit/Defines.hpp> + +namespace NewOS +{ + /// @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 NewOS diff --git a/Kernel/Modules/ReadMe.txt b/Kernel/Modules/ReadMe.txt new file mode 100644 index 00000000..acbc3de7 --- /dev/null +++ b/Kernel/Modules/ReadMe.txt @@ -0,0 +1,19 @@ +============== +NewOS Modules +============== + +=============== +What are these? +=============== + +These are like modules for the kernel. + +=================== +Maintainers/Authors +=================== + +ACPI: Amlal EL Mahrouss. +AHCI: Amlal EL Mahrouss. +CoreCG: Amlal EL Mahrouss. +PS2: Amlal EL Mahrouss. +ATA: Amlal EL Mahrouss. diff --git a/Kernel/Modules/SCSI/.gitkeep b/Kernel/Modules/SCSI/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Kernel/Modules/SCSI/.gitkeep diff --git a/Kernel/Modules/SCSI/SCSI.hxx b/Kernel/Modules/SCSI/SCSI.hxx new file mode 100644 index 00000000..a0feb649 --- /dev/null +++ b/Kernel/Modules/SCSI/SCSI.hxx @@ -0,0 +1,14 @@ +/* ------------------------------------------- + + Copyright Zeta Electronics Corporation + +------------------------------------------- */ + +#pragma once + +#include <NewKit/Defines.hpp> + +/// @file SCSI.hxx +/// @brief Serial SCSI driver. + +typedef NewOS::UInt16 scsi_packet_type[12]; diff --git a/Kernel/Modules/WiFi/.gitkeep b/Kernel/Modules/WiFi/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Kernel/Modules/WiFi/.gitkeep diff --git a/Kernel/Modules/WiFi/compile_flags.txt b/Kernel/Modules/WiFi/compile_flags.txt new file mode 100644 index 00000000..1bc51142 --- /dev/null +++ b/Kernel/Modules/WiFi/compile_flags.txt @@ -0,0 +1,4 @@ +-I./ +-I../ +-I../../ +-std=c++20 diff --git a/Kernel/Modules/XHCI/.gitkeep b/Kernel/Modules/XHCI/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Kernel/Modules/XHCI/.gitkeep diff --git a/Kernel/Modules/XHCI/Defines.hxx b/Kernel/Modules/XHCI/Defines.hxx new file mode 100644 index 00000000..91147a58 --- /dev/null +++ b/Kernel/Modules/XHCI/Defines.hxx @@ -0,0 +1,70 @@ +/* ------------------------------------------- + + Copyright Zeta Electronics Corporation + + File: Defines.hxx + Purpose: XHCI (and backwards) header. + + Revision History: + + 01/02/24: Added file (amlel) + 03/02/24: Update filename to Defines.hxx (amlel) + +------------------------------------------- */ + +#pragma once + +#include <NewKit/Defines.hpp> + +using namespace NewOS; + +#define kUSBCommand (UInt16)0x0 +#define kUSBStatus (UInt16)0x2 +#define kUSBInterruptEnable (UInt16)0x4 +#define kUSBFrameNum (UInt16)0x6 +#define kUSBFrameListBaseAddress (UInt16)0x8 +#define kUSBFrameModifyStart (UInt16)0xC +#define kUSBPort1StatusCtrl (UInt16)0x10 +#define kUSBPort2StatusCtrl (UInt16)0x12 + +typedef struct USBCommandRegister final +{ + UInt8 mReserved[8]; // Reserved + UInt8 + mMaxPacket; // 0 = Max packet size 32 bits 1 = Max packet size 64 bits + UInt8 mConfigure; + UInt8 mSoftwareDebug; + UInt8 mGlobalResume; + UInt8 mGlobalSuspend; + UInt8 mHostCtrlReset; + UInt8 mRun; // 1 = Controller execute frame list entries +} USBCommandRegister; + +typedef struct USBStatusRegister final +{ + UInt8 mReserved[8]; // Reserved + UInt8 mHalted; // 1 = bit 0 in CMD is zero 0 = bit 0 in CMD is 1 + UInt8 mProcessError; + UInt8 mSystemError; + UInt8 mResumeDetected; + UInt8 mErrorInterrupt; + UInt8 mInterrupt; +} USBStatusRegister; + +typedef struct USBInterruptEnableRegister final +{ + UInt8 mReserved[4]; // Reserved + UInt8 mShortPacket; // 1=Enable interrupt 0=Disable interrupt + UInt8 mComplete; // 1=Enable interrupt 0=Disable interrupt + UInt8 mResume; // 1=Enable interrupt 0=Disable interrupt + UInt8 mTimeoutCRC; // 1=Enable interrupt 0=Disable interrupt +} USBInterruptEnableRegister; + +/* + Some terminology: + + Frame Number: Number of processed entry of the Frame List. + Frame List Base Address: + 32-bit physical adress of Frame List. Remember that first 12 bytes are + always 0. The Frame List must contain 1024 entries. +*/ diff --git a/Kernel/Modules/XHCI/compile_flags.txt b/Kernel/Modules/XHCI/compile_flags.txt new file mode 100644 index 00000000..1bc51142 --- /dev/null +++ b/Kernel/Modules/XHCI/compile_flags.txt @@ -0,0 +1,4 @@ +-I./ +-I../ +-I../../ +-std=c++20 |
