summaryrefslogtreecommitdiffhomepage
path: root/StorageKit/PRDT.hpp
blob: 152bc6f1259402ab292b999d6340c7b99112519b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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