CYNQ  0.3.0
Framework to develop FPGA applications in C++ with the easiness of PYNQ
memory.hpp
1 /*
2  * See LICENSE for more information about licensing
3  *
4  * Copyright 2023
5  * Author: Luis G. Leon-Vega <luis.leon@ieee.org>
6  * Diego Arturo Avila Torres <diego.avila@uned.cr>
7  *
8  */
9 #pragma once
10 
11 #include <cynq/dma/datamover.hpp>
12 #include <cynq/enums.hpp>
13 #include <cynq/memory.hpp>
14 #include <cynq/status.hpp>
15 #include <cynq/xrt/datamover.hpp>
16 #include <memory>
17 
18 namespace cynq {
25 class XRTMemory : public IMemory {
26  public:
37  XRTMemory(const std::size_t size, uint8_t* hostptr, uint8_t* devptr,
38  void* moverptr);
45  XRTMemory() = delete;
51  virtual ~XRTMemory();
61  Status Sync(const SyncType type) override;
68  size_t Size() override;
69 
71  friend class DMADataMover;
72  friend class XRTDataMover;
73 
74  protected:
82  std::shared_ptr<uint8_t> GetHostAddress() override;
90  std::shared_ptr<uint8_t> GetDeviceAddress() override;
91 
92  private:
94  std::size_t size_;
96  uint8_t* host_ptr_;
98  uint8_t* dev_ptr_;
100  void* mover_ptr_;
101 };
102 } // namespace cynq
DMADataMover class Provides the api from which to interact with the data buffers responsable for memo...
Definition: datamover.hpp:37
Interface for standardising the API of Memory devices: XRTMemory.
Definition: memory.hpp:21
XRTDataMover class Provides the API to interact with the data buffers responsible for memory operatio...
Definition: datamover.hpp:34
XRTMemory class Provides the api for configuring the data buffers, this class is based on the Buffer ...
Definition: memory.hpp:25
std::shared_ptr< uint8_t > GetHostAddress() override
GetHostAddress method Get the Address that belongs to the host. [Reference] shared memory pointer wit...
Definition: memory.cpp:48
Status Sync(const SyncType type) override
Sync method Synchronizes the memory in terms of transactions.
Definition: memory.cpp:25
size_t Size() override
Size method Gives the value for the memory size in bytes.
Definition: memory.cpp:46
virtual ~XRTMemory()
~XRTMemory destructor method Destroy the XRTMemory object.
Definition: memory.cpp:92
XRTMemory()=delete
Default constructor.
std::shared_ptr< uint8_t > GetDeviceAddress() override
GetDeviceAddress method Get the Address that belongs to the device. [Reference] shared memory pointer...
Definition: memory.cpp:69
Structure to define the return characteristics of each function.
Definition: status.hpp:19