Class FileFromHostBuffer

Inheritance Relationships

Base Type

Class Documentation

class FileFromHostBuffer : public FromHostBuffer

FromHost DMA buffer with FLX card emulation. The card is emulated by a separate thread that can copy the data to a file or a fifo.

Public Functions

explicit FileFromHostBuffer(std::shared_ptr<Device> d, std::string &filename, bool fifo)
~FileFromHostBuffer() override
virtual void allocate_buffer(size_t size, const std::string &name, bool vmem, bool free_previous_cmem = false) override
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.

virtual void dma_start_circular_trickle_buffer() override

This function does not wraparound, it reads the trickle DMA buffer just one time.

Be careful since the behaviour might be unexpected. I start a circular buffer and in the function copy_trickle_buffer_to_file I only read it once. This is because the generated file is very large, and having it N times bigger would be problematic

Change this comment if this is no longer true

inline virtual void set_oneshot_trickle_buffer() override

Mock funcion that emulates the behaviour of the real hardware.

inline virtual bool can_write_trickle() override

Return whether we can write into the buffer.

Returns:

true, since we can always write into the file

virtual void dma_start_continuous() override
virtual bool dma_is_full() override
virtual uint64_t dma_get_read_offset() override
virtual size_t dma_free_bytes() override
Returns:

free space in the FromHost buffer in bytes.

virtual uint64_t dma_get_write_offset() override
virtual uint64_t dma_get_write_ptr() override
virtual void dma_set_write_offset(uint64_t addr) override
virtual void dma_advance_write_ptr(size_t bytes) override