summaryrefslogtreecommitdiffhomepage
path: root/dev/modules
diff options
context:
space:
mode:
authorAmlal El Mahrouss <zka-holder@mahrouss-logic.com>2024-10-07 02:47:43 +0000
committerAmlal El Mahrouss <zka-holder@mahrouss-logic.com>2024-10-07 02:47:43 +0000
commit1c67d9655979b48a71fd3a9ba087142ed1bb28ea (patch)
treec8f443887364aee7a7d29c7143de4c9e115ebc8c /dev/modules
parent95bbfd872a311bafa0071880c577ec5b94810957 (diff)
IMP: User.cxx, make hashing stronger.
IMP: NVME.hxx, add documentation. IMP: LTE.hxx, adding new function to manipulate SIM card filesystem.
Diffstat (limited to 'dev/modules')
-rw-r--r--dev/modules/AHCI/AHCI.hxx8
-rw-r--r--dev/modules/LTE/.keepme0
-rw-r--r--dev/modules/LTE/IO.hxx28
-rw-r--r--dev/modules/LTE/LTE.hxx40
-rw-r--r--dev/modules/NVME/.gitkeep0
-rw-r--r--dev/modules/NVME/NVME.hxx61
6 files changed, 77 insertions, 60 deletions
diff --git a/dev/modules/AHCI/AHCI.hxx b/dev/modules/AHCI/AHCI.hxx
index dd9806db..25fd9b6e 100644
--- a/dev/modules/AHCI/AHCI.hxx
+++ b/dev/modules/AHCI/AHCI.hxx
@@ -16,7 +16,7 @@
#include <NewKit/Defines.hxx>
#include <modules/ACPI/ACPI.hxx>
-// Forward declarations of structs.
+/// @note Forward declarations of structs.
#define kAHCISectorSize (512U)
@@ -328,8 +328,6 @@ typedef struct HbaCmdTbl final
struct HbaPrdtEntry prdtEntries[1]; // Physical region descriptor table entries, 0 ~ 65535
} HbaCmdTbl;
-/* EOF */
-
#if defined(__AHCI__)
/// @brief Initializes an AHCI disk.
@@ -367,4 +365,6 @@ Kernel::SizeT drv_get_sector_count();
/// @brief get device size.
Kernel::SizeT drv_get_size();
-#endif // ifdef __NEWOSKRNL__
+#endif // ifdef __AHCI__
+
+/* EOF */
diff --git a/dev/modules/LTE/.keepme b/dev/modules/LTE/.keepme
deleted file mode 100644
index e69de29b..00000000
--- a/dev/modules/LTE/.keepme
+++ /dev/null
diff --git a/dev/modules/LTE/IO.hxx b/dev/modules/LTE/IO.hxx
deleted file mode 100644
index 15546515..00000000
--- a/dev/modules/LTE/IO.hxx
+++ /dev/null
@@ -1,28 +0,0 @@
-/* -------------------------------------------
-
-Copyright ZKA Technologies..
-
-File: LTE\IO.hxx.
-Purpose: LTE I/O.
-
-------------------------------------------- */
-
-#ifndef _INC_NETWORK_LTE_IO_HXX_
-#define _INC_NETWORK_LTE_IO_HXX_
-
-#include <NewKit/Defines.hxx>
-#include <NewKit/String.hxx>
-
-/// @brief Long Term Evolution I/O routines.
-
-/// @brief Turn on SIM slot.
-Kernel::Boolean lte_turn_on_slot(Kernel::Int32 slot);
-
-/// @brief Turn off SIM slot.
-Kernel::Boolean lte_turn_off_slot(Kernel::Int32 slot);
-
-/// @brief Send AT command.
-Kernel::Boolean lte_send_at_command(Kernel::Char* buf,
- Kernel::Size bufSz);
-
-#endif // ifndef _INC_NETWORK_LTE_IO_HXX_
diff --git a/dev/modules/LTE/LTE.hxx b/dev/modules/LTE/LTE.hxx
new file mode 100644
index 00000000..1a0dfcd7
--- /dev/null
+++ b/dev/modules/LTE/LTE.hxx
@@ -0,0 +1,40 @@
+/* -------------------------------------------
+
+Copyright ZKA Technologies..
+
+File: LTE\LTE.hxx.
+Purpose: LTE Standard Library.
+
+------------------------------------------- */
+
+#ifndef _INC_NETWORK_LTE_HXX_
+#define _INC_NETWORK_LTE_HXX_
+
+#include <NewKit/Defines.hxx>
+#include <NewKit/String.hxx>
+
+/// @brief Long Term Evolution I/O routines.
+
+/// @brief Turn on SIM slot.
+Kernel::Boolean lte_turn_on_sim(Kernel::Int32 simSlot);
+
+/// @brief Turn off SIM slot.
+Kernel::Boolean lte_turn_off_sim(Kernel::Int32 simSlot);
+
+/// @brief Send AT command.
+Kernel::Boolean lte_send_at_command(Kernel::Char* buf,
+ Kernel::Size bufReadSz,
+ Kernel::Int32 simSlot);
+
+Kernel::Boolean lte_write_sim_file(Kernel::Char* file,
+ Kernel::VoidPtr buf,
+ Kernel::Size bufSz,
+ Kernel::Size offset,
+ Kernel::Int32 simSlot);
+
+Kernel::VoidPtr lte_read_sim_file(Kernel::Char* file,
+ Kernel::Size bufSz,
+ Kernel::Size offset,
+ Kernel::Int32 simSlot);
+
+#endif // ifndef _INC_NETWORK_LTE_HXX_
diff --git a/dev/modules/NVME/.gitkeep b/dev/modules/NVME/.gitkeep
deleted file mode 100644
index e69de29b..00000000
--- a/dev/modules/NVME/.gitkeep
+++ /dev/null
diff --git a/dev/modules/NVME/NVME.hxx b/dev/modules/NVME/NVME.hxx
index 3667b980..b0795cb4 100644
--- a/dev/modules/NVME/NVME.hxx
+++ b/dev/modules/NVME/NVME.hxx
@@ -16,46 +16,47 @@
/// TODO: checklist in: https://wiki.osdev.org/NVMe
-#define ALIGN_NVME ATTRIBUTE(aligned(sizeof(Kernel::NVMEInt32)))
+#define ALIGN_NVME ATTRIBUTE(aligned(sizeof(Kernel::UInt32)))
namespace Kernel
{
- typedef UInt32 NVMEInt32;
-
- struct ALIGN_NVME NVMEBar0 final
+ struct ALIGN_NVME HAL_NVME_BAR_0 final
{
- NVMEInt32 fCapabilities;
- NVMEInt32 fVersion;
- NVMEInt32 fIntMaskSet;
- NVMEInt32 fIntMaskClr;
- NVMEInt32 fContrlConf;
- NVMEInt32 fContrlStat;
- NVMEInt32 fAdminQueueAttr;
- NVMEInt32 fAdminSubmissionQueue;
- NVMEInt32 fAdminCompletionQueue;
+ UInt32 fCapabilities;
+ UInt32 fVersion;
+ UInt32 fIntMaskSet;
+ UInt32 fIntMaskClr;
+ UInt32 fContrlConf;
+ UInt32 fContrlStat;
+ UInt32 fAdminQueueAttr;
+ UInt32 fAdminSubmissionQueue;
+ UInt32 fAdminCompletionQueue;
};
- struct ALIGN_NVME NVMEQueue final
+ struct ALIGN_NVME HAL_NVME_QUEUE final
{
- NVMEInt32 fOpcode;
- NVMEInt32 fNSID;
- NVMEInt32 fReserved[3];
- NVMEInt32 fMetadataPtr[5];
- NVMEInt32 fDataPtr[9];
- NVMEInt32 CommandSpecific[15];
+ UInt32 fOpcode;
+ UInt32 fNSID;
+ UInt32 fReserved[3];
+ UInt32 fMetadataPtr[5];
+ UInt32 fDataPtr[9];
+ UInt32 CommandSpecific[15];
};
enum
{
- eCreateCompletionQueueNVME = 0x05,
- eCreateSubmissionQueueNVME = 0x01,
- eIdentifyNVME = 0x06,
- eReadNVME = 0x02,
- eWriteNVME = 0x01,
+ kCreateCompletionQueueNVME = 0x05,
+ kCreateSubmissionQueueNVME = 0x01,
+ kIdentifyNVME = 0x06,
+ kReadNVME = 0x02,
+ kWriteNVME = 0x01,
};
+ /// @brief Creates an admin command for a DMA operation.
template <Int32 Opcode>
- inline Bool nvme_create_admin_command(NVMEQueue* entry, UInt32 nsid, UInt32 prpTransfer[3], UInt32 startingLba[2], UInt32 lowTransferBlocks)
+ inline Bool nvme_create_admin_command(HAL_NVME_QUEUE* entry, UInt32 nsid,
+ UInt32 prpTransfer[3], UInt32 startingLba[2],
+ UInt32 lowTransferBlocks)
{
if (entry == nullptr)
return false;
@@ -74,8 +75,12 @@ namespace Kernel
return true;
}
+ /// @brief Creates an I/O command for a DMA operation.
template <Int32 Opcode>
- inline Bool nvme_create_io_command(NVMEQueue* entry, UInt64 baseAddress, UInt32 identLoAndQueueSizeHi, UInt32 flagsLoAndQueueComplIdHi, UInt32 identify, Bool provideIdentify = false, Bool namespaceIdentify = false)
+ inline Bool nvme_create_io_command(HAL_NVME_QUEUE* entry, UInt64 baseAddress,
+ UInt32 identLoAndQueueSizeHi, UInt32 flagsLoAndQueueComplIdHi,
+ UInt32 identify, Bool provideIdentify = false,
+ Bool namespaceIdentify = false)
{
if (entry == nullptr)
return false;
@@ -103,7 +108,7 @@ namespace Kernel
}
}
- // use (1 << 0) as contigunous is better supported.
+ // Use (1 << 0) as contigunous is better supported.
return true;
}