felix-direct-readout API

The felix-direct-readout interface provides very simple function to read ToHost DMA buffers. An instance of the interface class reads a single DMA buffer defined by:

  • a host-level unique id defined as 10 * device number + DMA ID;

  • the buffer size in units of ToHost blocks;

  • the NUMA node on which the buffer must be allocated.

An instance is created using the factory function:

1felix_readout::FelixInputBufferInterface* felix_input_buffer_factory(unsigned int u_id, unsigned int size_blocks, unsigned int numa_node)

The interface enables reading of the enabled (e-)links in the DMA buffer. The (e-)link fids contain the detector and connector identifier set by the registers DETECTOR_ID_VALUE and CONNECTOR_ID_X_VALUE, provided that the corresponding DETECTOR_ID_VALID and CONNECTOR_ID_X_VALID are true.

virtual std::vector<enabled_elink_t> felix_readout::FelixInputBufferInterface::get_enabled_elinks() = 0
Returns:

vector of enabled e-links for the device and DMA buffer passed in the contructor. Each e-link is pair contanining the fid and the local e-link number.

The blocks available, that is those in between the write pointer maintained by firmware and the read pointer maintained by software are returned by:

virtual block_spans felix_readout::FelixInputBufferInterface::get_available_blocks(uint64_t processed_blocks) noexcept = 0
Parameters:

processed_blocks – is used to determine where to count blocks from. This argument allows the support of multiple readers. The function does not access contended resources.

Returns:

the blocks available to read in two std::spans representing the two segments of the circular DMA buffer.

The read pointer is advanced using a uint64_t block counter.

virtual void felix_readout::FelixInputBufferInterface::set_read_ptr_blocks(uint64_t processed_blocks) noexcept = 0

set the read pointer to a new block index.

firmware will not be allowed to write over the block pointed at by the index. The function is NOT thread-safe.

Example

The felix-direct-readout interface is used by Data Handler, which loads the implementation library dynamically using the felix_proxy wrapper.