summaryrefslogtreecommitdiffhomepage
path: root/StorageKit/PRDT.hpp
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-06 09:14:11 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-06 09:14:11 +0100
commit5339d016c07bf717ee388f4feb73544087324af0 (patch)
tree94be6f67ed626091f24aee24ec3b3be03d01e4e7 /StorageKit/PRDT.hpp
git: port from mercurial repo.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'StorageKit/PRDT.hpp')
-rw-r--r--StorageKit/PRDT.hpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/StorageKit/PRDT.hpp b/StorageKit/PRDT.hpp
new file mode 100644
index 00000000..152bc6f1
--- /dev/null
+++ b/StorageKit/PRDT.hpp
@@ -0,0 +1,54 @@
+/*
+ * ========================================================
+ *
+ * hCore
+ * Copyright Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
+#pragma once
+
+#include <KernelKit/PCI/Dma.hpp>
+#include <KernelKit/PCI/Iterator.hpp>
+
+#define PRDT_TRANSFER_SIZE (sizeof(hCore::UShort))
+
+namespace hCore
+{
+ class PRDT final
+ {
+ public:
+ PRDT() = delete;
+ explicit PRDT(const UIntPtr &physAddr);
+ ~PRDT();
+
+ PRDT &operator=(const PRDT &) = default;
+ PRDT(const PRDT &) = default;
+
+ public:
+ const UInt &Low();
+ const UShort &High();
+ const UIntPtr &PhysicalAddress();
+
+ public:
+ PRDT &operator=(const UIntPtr& prdtAddress);
+
+ public:
+ operator bool()
+ {
+ return m_PrdtAddr != 0;
+ }
+
+ private:
+ union
+ {
+ UInt m_Low;
+ UShort m_High;
+ };
+
+ UIntPtr m_PrdtAddr;
+
+ };
+
+ using PhysicalAddress = PRDT; // here
+} // namespace hCore