Class FromHostBuffer
Defined in File fromhost_buffer.hpp
Inheritance Relationships
Derived Types
public FileFromHostBuffer
(Class FileFromHostBuffer)public FlxFromHostBuffer
(Class FlxFromHostBuffer)
Class Documentation
-
class FromHostBuffer
Abstract class representing a FromHost DMA buffer. The elinks enabled for the corresponding DMA buffers are read from the device in the constructors.
Subclassed by FileFromHostBuffer, FlxFromHostBuffer
Public Functions
FromHostBuffer contructor.
- Parameters:
d -- Device shared pointer.
-
inline size_t get_size() const
- Returns:
size of DMA buffer.
-
inline size_t get_trickle_config_size()
- Returns:
size of the trickle configuration message.
-
inline void set_trickle_config_size(size_t size)
- Parameters:
size -- : size of trickle configuration message
-
inline void set_encoder_data_format(int format)
- Parameters:
format -- : FromHost data format supported by firmware.
-
inline int get_dmaid() const
- Returns:
identifier of DMA buffer.
-
inline void set_dmaid(int dma_id)
- Parameters:
dma_id -- identifier of DMA buffer.
- Returns:
null.
-
inline void stop()
- Returns:
stop DMA transfer operations.
-
inline std::vector<Elink> get_elinks()
- Parameters:
m_dmaid -- DMA identifier
- Returns:
vector of enabled e-links.
-
inline std::vector<Elink> get_elinks_of_type(elink_type_t t)
- Parameters:
m_dmaid -- DMA identifier
- Returns:
vector of enabled e-links of a given type (DAQ, DCS...)
-
inline void increment_writer_counter()
increment the counter of writers concurrently acessing the DMA buffer
-
inline bool has_multiple_writers() const
- Returns:
whether the FromHost DMA buffer is in use by more than a writer.
-
inline size_t compute_msg_dma_occupancy(size_t size)
- Parameters:
size -- of message to be encoded and written.
- Returns:
size of the encoded messagesss provided by encoder.
-
void encode_and_write(uint64_t elink, const uint8_t *source, size_t size, bool trickle = false)
encode and write message in the FromHost buffer.
- Parameters:
elink -- of message to be encoded and written.
source -- of message to be encoded and written.
size -- of message to be encoded and written.
-
FromHostDmaStats get_monitoring_data()
- Returns:
monitoring information with rates.
-
virtual void allocate_buffer(size_t size, const std::string &name, bool vmem, bool free_previous_cmem = true) = 0
- Parameters:
size -- of the FromHost DMA buffer.
name -- of the buffer passed to the CMEM driver.
vmem -- allocate the buffer without using the CMEM driver.
free_previous_cmem -- claim an unlocked/orphaned CMEM buffer with the same name.
Public Members
-
std::mutex m_buffer_mutex
Protected Functions
-
virtual void set_oneshot_trickle_buffer(size_t config_size) = 0
-
virtual void dma_start_continuous() = 0
-
virtual void dma_start_circular_trickle_buffer() = 0
-
virtual bool dma_is_full() = 0
-
virtual uint64_t dma_get_read_offset() = 0
-
virtual uint64_t dma_get_write_ptr() = 0
-
virtual uint64_t dma_get_write_offset() = 0
-
virtual void dma_set_write_offset(uint64_t offset) = 0
-
virtual void dma_advance_write_ptr(size_t bytes) = 0
-
inline size_t dma_compute_free_bytes(uint64_t fw_rd_ptr, uint64_t pc_wr_ptr, bool even)