vrt::Buffer
-
template<typename T>
class Buffer Class representing a buffer.
This class provides an interface for managing a buffer in a device. It supports memory mapped QDMA connections.
- Template Parameters:
T – The type of the elements in the buffer.
Public Functions
-
Buffer(Device device, size_t size, MemoryRangeType type)
Constructor for Buffer.
- Parameters:
device – VRT Device of the buffer.
size – The size of the buffer.
type – The type of memory range.
-
Buffer(Device device, size_t size, MemoryRangeType type, uint8_t port)
Constructor for Buffer.
- Parameters:
device – VRT Device of the buffer.
size – The size of the buffer.
type – The type of memory range.
port – The HBM port number. Only valid when type is MemoryRangeType::HBM.
-
Buffer(Device device, size_t size, MemoryConfig config)
Constructor for Buffer from a MemoryConfig.
- Parameters:
device – VRT Device of the buffer.
size – The size of the buffer.
config – Memory configuration, typically obtained via Kernel::portMemoryConfig() or Kernel::argMemoryConfig().
-
T &operator[](size_t index)
Overloads the subscript operator to access buffer elements.
- Parameters:
index – The index of the element to access.
- Returns:
A reference to the element at the specified index.
-
const T &operator[](size_t index) const
Overloads the subscript operator to access buffer elements (const version).
- Parameters:
index – The index of the element to access.
- Returns:
A const reference to the element at the specified index.
-
MemoryRangeType getMemoryRangeType() const
Gets the memory range type of the buffer.
- Returns:
The memory range type.
-
uint8_t getHBMPort() const
Gets the HBM port number of the buffer.
- Returns:
The HBM port number, or 0 if no specific port was set.
-
uint64_t getPhysAddr() const
Gets the physical address of the buffer.
- Returns:
The physical address of the buffer.
-
uint32_t getPhysAddrLow() const
Gets the lower 32 bits of the physical address of the buffer.
- Returns:
The lower 32 bits of the physical address of the buffer.
-
uint32_t getPhysAddrHigh() const
Gets the upper 32 bits of the physical address of the buffer.
- Returns:
The upper 32 bits of the physical address of the buffer.
-
void sync(SyncType syncType)
Synchronizes the buffer.
- Parameters:
syncType – The type of synchronization.