From b75417b44d5f63ea0ead68cbe8f62bd76df62229 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 13 Feb 2024 17:20:30 +0100 Subject: HCR-15: Merge to master branch. Important commit and end of ticket. Signed-off-by: Amlal El Mahrouss --- Private/KernelKit/PCI/Dma.hpp | 91 +++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 47 deletions(-) (limited to 'Private/KernelKit/PCI') diff --git a/Private/KernelKit/PCI/Dma.hpp b/Private/KernelKit/PCI/Dma.hpp index 8e027179..0b4b55b8 100644 --- a/Private/KernelKit/PCI/Dma.hpp +++ b/Private/KernelKit/PCI/Dma.hpp @@ -9,73 +9,70 @@ #pragma once -#include +#include #include #include #include #include -namespace HCore -{ -enum class DmaKind -{ - PCI, // Bus mastering is required to be turned on. Basiaclly a request - // control system. 64-Bit access depends on the PAE bit and the device - // (if Double Address Cycle is available) - ISA, // Four DMA channels 0-3; 8 bit transfers and only a megabyte of RAM. - Invalid, +namespace HCore { +enum class DmaKind { + PCI, // Bus mastering is required to be turned on. Basiaclly a request + // control system. 64-Bit access depends on the PAE bit and the device + // (if Double Address Cycle is available) + ISA, // Four DMA channels 0-3; 8 bit transfers and only a megabyte of RAM. + Invalid, }; -class DMAWrapper final -{ - public: - explicit DMAWrapper() = delete; +class DMAWrapper final { + public: + explicit DMAWrapper() = delete; - public: - explicit DMAWrapper(nullPtr) = delete; - explicit DMAWrapper(voidPtr Ptr, DmaKind Kind = DmaKind::PCI) : m_Address(Ptr), m_Kind(Kind) - { - } + public: + explicit DMAWrapper(nullPtr) = delete; + explicit DMAWrapper(voidPtr Ptr, DmaKind Kind = DmaKind::PCI) + : m_Address(Ptr), m_Kind(Kind) {} - public: - DMAWrapper &operator=(voidPtr Ptr); + public: + DMAWrapper &operator=(voidPtr Ptr); - public: - DMAWrapper &operator=(const DMAWrapper &) = default; - DMAWrapper(const DMAWrapper &) = default; + public: + DMAWrapper &operator=(const DMAWrapper &) = default; + DMAWrapper(const DMAWrapper &) = default; - public: - ~DMAWrapper() = default; + public: + ~DMAWrapper() = default; - template T *operator->(); + template + T *operator->(); - template T *Get(const UIntPtr off = 0); + template + T *Get(const UIntPtr off = 0); - public: - operator bool(); - bool operator!(); + public: + operator bool(); + bool operator!(); - public: - bool Write(const UIntPtr &bit, const UIntPtr &offset); - UIntPtr Read(const UIntPtr &offset); - Boolean Check(UIntPtr offset) const; + public: + bool Write(const UIntPtr &bit, const UIntPtr &offset); + UIntPtr Read(const UIntPtr &offset); + Boolean Check(UIntPtr offset) const; - public: - UIntPtr operator[](const UIntPtr &offset); + public: + UIntPtr operator[](const UIntPtr &offset); - private: - voidPtr m_Address{nullptr}; - DmaKind m_Kind{DmaKind::Invalid}; + private: + voidPtr m_Address{nullptr}; + DmaKind m_Kind{DmaKind::Invalid}; - private: - friend class DMAFactory; + private: + friend class DMAFactory; }; -class DMAFactory final -{ - public: - static OwnPtr> Construct(OwnPtr &dma); +class DMAFactory final { + public: + static OwnPtr> Construct(OwnPtr &dma); }; -} // namespace HCore +} // namespace HCore #include -- cgit v1.2.3