GPIO

The GPIO component provides an interface to the General Purpose Input/Output (GPIO) pins of the FPGA. The component is implemented as multiple singleton classes, each representing a single GPIO IP-Core of the hardware design.

ZC706 has two measurement channels. ZCU102 has four. Every per-channel GPIO setting is programmed independently on each core.

On ZCU102, 16-bit (and similarly packed) settings put channels 1/2 in GPIO_DATA of a slot and channels 3/4 in GPIO2_DATA of the same slot. Package size, CFD amplitude, height fractions and decimation use a second AXI-GPIO slot for channels 3/4. Charge and fraction windows also need a second slot, because GPIO2 of the primary slot already holds the window start.

The C++ GPIO API is set_X(channel, value) / get_X(channel) with a 0-based index (0 .. kDmaCount-1). Board channel count comes from kDmaCount (ZCU102: 4, ZC706: 2). There are no *_c1 / *_c2 wrappers.

Trapezoid pulse-height parameters are per channel (GPIO slots 43..46; slots 43/44 = channels 1/2 on ZC706, 43..46 = channels 1..4 on ZCU102). The API uses sample counts N (sample-accurate) and G (multiple of 4). N/4 + G/4 must be less than 256.

The START/SETTINGS JSON encoding of these settings is documented on nexmess::components::network::MessageType (kStart).

Coincidence window and measurement time are global, not per-channel.

Classes

Base GPIO Class

class Gpio

Represents a GPIO (General Purpose Input/Output) interface.

This class provides methods to control and access GPIO pins. It prevents move construction and move assignment to ensure proper resource management. The GPIO pins are accessed through a memory map provided by the memorycontrol::MemoryMap class.

Subclassed by nexmess::components::gpio::GpioBLRPreGate, nexmess::components::gpio::GpioCfdDelay, nexmess::components::gpio::GpioChargeWindow, nexmess::components::gpio::GpioCoincidenceWindow, nexmess::components::gpio::GpioEnabled, nexmess::components::gpio::GpioFirCoeffSet, nexmess::components::gpio::GpioFractionWindow, nexmess::components::gpio::GpioLongGate, nexmess::components::gpio::GpioMeasurementInterrupt, nexmess::components::gpio::GpioMeasurementTime, nexmess::components::gpio::GpioMovingAverageLength, nexmess::components::gpio::GpioMovingAverageNum, nexmess::components::gpio::GpioMpkThreshold, nexmess::components::gpio::GpioOffset, nexmess::components::gpio::GpioPreGate, nexmess::components::gpio::GpioSignalCount, nexmess::components::gpio::GpioTriggerValue, nexmess::components::gpio::GpioUntriggerValue

Public Functions

Gpio() = delete
~Gpio() = default
Gpio(const Gpio&) = delete
Gpio(Gpio&&) = delete
Gpio &operator=(Gpio&&) = delete
Gpio(uint32_t register_base, int mem)

Constructs a new Gpio object.

Parameters:
  • register_base – The base address of the GPIO registers.

  • mem – The memory identifier.

void operator=(const Gpio&) = delete
bool has_error() const

Checks if there is any error with the GPIO.

Returns:

true if there is an error, false otherwise.

Protected Functions

void set_value(uint32_t value)

Sets the value of the first data register.

Parameters:

value – The value to be set.

uint32_t get_value()

Gets the value of the first data register.

Returns:

The value of the first data register.

void set_value2(uint32_t value)

Sets the value of the second data register.

Parameters:

value – The value to be set.

uint32_t get_value2()

Gets the value of the second data register.

Returns:

The value of the second data register.

void write_data_reg(uint8_t data_reg, uint32_t value)

Writes GPIO_DATA (data_reg 0) or GPIO2_DATA (data_reg 1).

Private Members

memorycontrol::MemoryMap memory_map_

The memory map used to access the GPIO registers.

Friends

friend class DualSlotGpio
friend class GpioChargeWindow
friend class GpioFractionWindow

Dual-slot GPIO helper

class DualSlotGpio

Writes per-channel values that may live on a second AXI-GPIO slot.

Channel 0/1 use the primary slot; channel 2/3 use extra_base_ when it is nonzero (ZCU102). data_reg 0 is GPIO_DATA, 1 is GPIO2_DATA.

Public Functions

DualSlotGpio(uint32_t primary_base, uint32_t extra_base, int mem)

Maps the primary AXI-GPIO slot and, when extra_base is nonzero, the extra slot.

Parameters:
  • primary_base – Physical base of the primary AXI-GPIO.

  • extra_base – Physical base of the extra AXI-GPIO, or 0 if unused.

  • mem – File descriptor for /dev/mem.

void write_loc(GpioChanLoc loc, uint32_t value)

Writes a 32-bit value to the GPIO data register for loc.

Parameters:
  • loc – Channel location (base and GPIO_DATA vs GPIO2_DATA).

  • value – Word to write.

bool has_error() const

Reports a mapping or access error on either slot.

Returns:

true if either GPIO object has an error.

Enables GPIO Class

class GpioEnabled : public nexmess::components::gpio::Gpio

The GpioEnabled class represents a GPIO interface especially for the GPIO to enable ADC channels and processing options.

This class inherits from the Gpio class and provides functionality for controlling GPIO pins to enable ADC channels and various processing options. It is a singleton class, meaning that only one instance of this class can exist.

Public Functions

GpioEnabled() = delete
GpioEnabled(const GpioEnabled&) = delete
void operator=(const GpioEnabled&) = delete
GpioEnabled(GpioEnabled&&) = delete
GpioEnabled &operator=(GpioEnabled&&) = delete

Public Static Functions

static void init(int mem)

Initializes the GpioEnabled instance with the specified memory address.

Parameters:

mem – The memory address to be used for GPIO operations.

static void deactivate_all()

Deactivates all ADC channels and processing options.

static void activate_specific(uint8_t channel_value)

Activates the specified ADC channels for DMA operations.

This function uses a bit mask for the configuration of the ADC channels. The structure is as follows:

  • bit [0]: activate channel 1 for DMA operation

  • bit [1]: activate channel 2 for DMA operation

For example, a mask of 0b000000000001 would activate the first channel for DMA operation.

Parameters:

channel_value – A bit mask specifying the ADC channels to be activated.

static uint8_t get_dma_channels()

Gets the channels for DMA operations.

Returns:

The channels for DMA operations.

static uint8_t get_invert_channels()

Gets the channels for inversions.

Returns:

The channels for inversions.

static void set_invert_channels(uint8_t invert_channel_value)

Sets the specified ADC channels to invert.

This function uses a bit mask for the configuration of the ADC channels. The structure is at follows:

  • bit [0]: activate channel 1 inversion

  • bit [1]: activate channel 2 inversion

For example, a mask of 0b000000000100 would activate the first channel inversion.

Parameters:

invert_channel_value – A bit mask specifying the ADC channels to be activated.

static uint8_t get_fir_channels()

Gets the channels for FIR operations.

Returns:

The channels for FIR operations.

static void set_fir_channels(uint8_t fir_channel_value)

Sets the specified ADC channels for FIR filtering.

This function uses a bit mask for the configuration of the ADC channels. The structure is at follows:

  • bit [0]: activate channel 1 for FIR filtering

  • bit [1]: activate channel 2 for FIR filtering

For example, a mask of 0b000000010000 would activate the first channel for FIR filtering.

Parameters:

fir_channel_value – A bit mask specifying the ADC channels to be activated.

static uint8_t get_blr_channels()

Gets the channels for baseline restoration.

Returns:

The channels for baseline restoration.

static void set_blr_channels(uint8_t blr_channel_value)

Sets the specified ADC channels for baseline restoration.

This function uses a bit mask for the configuration of the ADC channels. The structure is at follows:

  • bit [0]: activate channel 1 for baseline restoration

  • bit [1]: activate channel 2 for baseline restoration

For example, a mask of 0b000001000000 would activate the first channel for baseline restoration.

Parameters:

blr_channel_value – A bit mask specifying the ADC channels to be activated.

static uint8_t get_cfd_trigger_channels()

Gets the channels for CFD triggering.

This selects channels that generate triggers from the Constant Fraction Discriminator instead of standard threshold triggering.

Returns:

The channels for CFD triggering.

static void set_cfd_trigger_channels(uint8_t cfd_trigger_value)

Sets the specified ADC channels for CFD triggering.

This function uses a bit mask for the configuration of the ADC channels. The structure is at follows:

  • bit [0]: activate channel 1 for CFD triggering

  • bit [1]: activate channel 2 for CFD triggering

For example, a mask of 0b000100000000 would activate the first channel for baseline restoration.

Parameters:

cfd_trigger_value – A bit mask specifying the ADC channels to be activated.

static uint8_t get_cfd_data_channels()

Gets the channels for CFD data output.

When enabled, the channel outputs the CFD-processed signal (sum of partial CFD signals) instead of the regular triggered pulse output.

Returns:

The channels for CFD data output.

static void set_cfd_data_channels(uint8_t cfd_data_value)

Sets the specified ADC channels for baseline restoration.

This function uses a bit mask for the configuration of the ADC channels. The structure is at follows:

  • bit [0]: activate channel 1 for CFD data output

  • bit [1]: activate channel 2 for CFD data output

For example, a mask of 0b010000000000 would activate the first channel for baseline restoration.

Parameters:

cfd_data_value – A bit mask specifying the ADC channels to be activated.

static uint8_t get_coincidence_channels()

Gets the channels participating in coincidence filtering.

Returns:

Bitmask of ADC channels (bit 0 is channel 1). On ZC706 the hardware field is one bit.

static void set_coincidence_channels(uint8_t coincidence_channels)

Sets the channels participating in coincidence filtering.

Parameters:

coincidence_channels – Bitmask of ADC channels (bit 0 is channel 1). On ZCU102 each bit selects that channel; on ZC706 only bit 0 is stored.

static uint8_t get_untrigger_channels()

Gets the channels for trigger fallback functionality.

Returns:

Channels where trigger fallback logic is enabled.

static void set_untrigger_channels(uint8_t untrigger_channel_value)

Sets the channels for trigger fallback functionality.

This is used to set whether threshold checking for re-enabling triggering is enabled on channel 1 and/or channel 2.

Parameters:

untrigger_channel_value – A bit mask specifying the ADC channels to be activated for trigger fallback behaviour.

static uint8_t get_moving_average_channels()

Gets the channels for moving-average enable.

Returns:

Bitmask of channels where moving-average is enabled.

static void set_moving_average_channels(uint8_t moving_average_channel_value)

Sets which channels have moving-average enabled.

Parameters:

moving_average_channel_value – Bitmask for channel enables.

static void reset_custom_ip_cores()

Resets all custom IP cores in the hardware design.

The second value register is set to 0, then back to 1 after 1 ms each.

static bool has_error()

Checks if any error has occurred during GPIO operations.

Returns:

true if an error has occurred, false otherwise.

Private Functions

explicit GpioEnabled(int mem)

Constructor for the GpioEnabled class.

This constructor initializes a new GpioEnabled object with all ADC channels and processing options disabled. This is done to ensure a clean state, preventing potential issues with channels that were left enabled from previous operations.

Parameters:

mem – The memory address to be used for the GPIO operations.

~GpioEnabled()

Destructor for the GpioEnabled class.

Before the GpioEnabled object is destructed, this destructor disables all ADC channels and processing options. This ensures that no channels or processing paths remain active beyond the lifetime of the GpioEnabled object.

Private Members

uint32_t enableds_ = 0

GPIO1 image of ADC and processing enables.

uint32_t enableds2_ = 1

GPIO2 image; bit 0 is custom-IP reset.

Private Static Functions

static GpioEnabled &get_instance_impl(int mem = 0)

The implementation of get_instance with parameters.

This is called once by init().

Parameters:

mem – The memory address to be used for the GPIO operations.

Returns:

The instance of the GPIO object.

static GpioEnabled &get_instance()

The implementation of get_instance without parameters.

Returns:

The instance of the GPIO object.

static void write_field(GpioBitField field, uint8_t value)

Writes a bitfield in the enabled GPIO registers.

Parameters:
  • field – Packed field descriptor.

  • value – Value to store in the field.

static uint8_t read_field(GpioBitField field)

Reads a bitfield from the enabled GPIO registers.

Parameters:

field – Packed field descriptor.

Returns:

Current field value.

Long gate GPIO Class

class GpioLongGate : public nexmess::components::gpio::Gpio

Per-channel long gate in samples.

Channel index is 0 .. kDmaCount-1. Packing uses one 32-bit word per two channels (GPIO_DATA then GPIO2_DATA).

Public Functions

GpioLongGate() = delete
GpioLongGate(const GpioLongGate&) = delete
void operator=(const GpioLongGate&) = delete
GpioLongGate(GpioLongGate&&) = delete
GpioLongGate &operator=(GpioLongGate&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_long_gate(uint8_t channel, uint16_t value)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • value – Value to write.

static uint16_t get_long_gate(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioLongGate(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioLongGate()

Releases mapped GPIO resources.

Private Members

std::array<uint32_t, kPackedWords> packed_ = {}

Packed GPIO_DATA / GPIO2_DATA words.

Private Static Functions

static GpioLongGate &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioLongGate &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

Multi-peak threshold GPIO Class

class GpioMpkThreshold : public nexmess::components::gpio::Gpio

Per-channel multi-peak reject threshold.

Channel index is 0 .. kDmaCount-1. Packing uses one 32-bit word per two channels (GPIO_DATA then GPIO2_DATA).

Public Functions

GpioMpkThreshold() = delete
GpioMpkThreshold(const GpioMpkThreshold&) = delete
void operator=(const GpioMpkThreshold&) = delete
GpioMpkThreshold(GpioMpkThreshold&&) = delete
GpioMpkThreshold &operator=(GpioMpkThreshold&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_mpk_threshold(uint8_t channel, uint16_t value)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • value – Value to write.

static uint16_t get_mpk_threshold(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioMpkThreshold(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioMpkThreshold()

Releases mapped GPIO resources.

Private Members

std::array<uint32_t, kPackedWords> packed_ = {}

Packed GPIO_DATA / GPIO2_DATA words.

Private Static Functions

static GpioMpkThreshold &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioMpkThreshold &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

Pre gate GPIO Class

class GpioPreGate : public nexmess::components::gpio::Gpio

Per-channel pre-gate in samples.

Channel index is 0 .. kDmaCount-1. Packing uses one 32-bit word per two channels (GPIO_DATA then GPIO2_DATA).

Public Functions

GpioPreGate() = delete
GpioPreGate(const GpioPreGate&) = delete
void operator=(const GpioPreGate&) = delete
GpioPreGate(GpioPreGate&&) = delete
GpioPreGate &operator=(GpioPreGate&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_pre_gate(uint8_t channel, uint16_t value)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • value – Value to write.

static uint16_t get_pre_gate(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioPreGate(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioPreGate()

Releases mapped GPIO resources.

Private Members

std::array<uint32_t, kPackedWords> packed_ = {}

Packed GPIO_DATA / GPIO2_DATA words.

Private Static Functions

static GpioPreGate &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioPreGate &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

Trigger value GPIO Class

class GpioTriggerValue : public nexmess::components::gpio::Gpio

Per-channel trigger threshold in ADC units.

Channel index is 0 .. kDmaCount-1. Packing uses one 32-bit word per two channels (GPIO_DATA then GPIO2_DATA).

Public Functions

GpioTriggerValue() = delete
GpioTriggerValue(const GpioTriggerValue&) = delete
void operator=(const GpioTriggerValue&) = delete
GpioTriggerValue(GpioTriggerValue&&) = delete
GpioTriggerValue &operator=(GpioTriggerValue&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_trigger_value(uint8_t channel, int16_t value)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • value – Value to write.

static int16_t get_trigger_value(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioTriggerValue(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioTriggerValue()

Releases mapped GPIO resources.

Private Members

std::array<uint32_t, kPackedWords> packed_ = {}

Packed GPIO_DATA / GPIO2_DATA words.

Private Static Functions

static GpioTriggerValue &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioTriggerValue &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

Untrigger value GPIO Class

class GpioUntriggerValue : public nexmess::components::gpio::Gpio

Per-channel retrigger fallback threshold in ADC units.

Channel index is 0 .. kDmaCount-1. Packing uses one 32-bit word per two channels (GPIO_DATA then GPIO2_DATA).

Public Functions

GpioUntriggerValue() = delete
GpioUntriggerValue(const GpioUntriggerValue&) = delete
void operator=(const GpioUntriggerValue&) = delete
GpioUntriggerValue(GpioUntriggerValue&&) = delete
GpioUntriggerValue &operator=(GpioUntriggerValue&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_untrigger_value(uint8_t channel, int16_t value)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • value – Value to write.

static int16_t get_untrigger_value(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioUntriggerValue(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioUntriggerValue()

Releases mapped GPIO resources.

Private Members

std::array<uint32_t, kPackedWords> packed_ = {}

Packed GPIO_DATA / GPIO2_DATA words.

Private Static Functions

static GpioUntriggerValue &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioUntriggerValue &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

Measurement interrupt GPIO Class

class GpioMeasurementInterrupt : public nexmess::components::gpio::Gpio

Represents a GPIO measurement interrupt.

This class extends the Gpio class and provides functionality for handling measurement interrupts.

This class checks if the measurement is stopped and if a DMA transfer is complete. It also provides functionality for preventing further interrupts from being triggered once a measurement is stopped.

It is a singleton class, meaning that only one instance of this class can exist.

Public Functions

GpioMeasurementInterrupt() = delete
GpioMeasurementInterrupt(const GpioMeasurementInterrupt&) = delete
void operator=(const GpioMeasurementInterrupt&) = delete
GpioMeasurementInterrupt(GpioMeasurementInterrupt&&) = delete
GpioMeasurementInterrupt &operator=(GpioMeasurementInterrupt&&) = delete

Public Static Functions

static void init(int mem)

Initializes the GPIO measurement interrupt.

Parameters:

mem – The memory value.

static void check_status()

Checks the status of the GPIO measurement interrupt.

In case a measurement was stopped it sets the 2nd GPIO register to 0 so no further interrupts are triggered!

static bool get_stopped(uint16_t dma_id)

Gets the stopped flag for a specific ID.

Parameters:

dma_id – The ID value.

Returns:

true if the stopped flag is set, false otherwise.

static bool get_dma_interrupt(uint16_t dma_interrupt_id)

Gets the DMA interrupt for a specific DMA.

Parameters:

dma_interrupt_id – The ID value.

Returns:

true if the DMA interrupt is set, false otherwise.

static void reset()

Resets the GPIO measurement interrupt.

static bool has_error()

Checks if any error has occurred during GPIO operations.

Returns:

true if an error has occurred, false otherwise.

Private Functions

explicit GpioMeasurementInterrupt(int mem)

Constructor for the GpioMeasurementInterrupt class.

This constructor initializes a new GpioMeasurementInterrupt object with all ADC channels disabled. This is done to ensure a clean state, preventing potential issues with channels that were left enabled from previous operations.

Parameters:

mem – The memory address to be used for the GPIO operations.

~GpioMeasurementInterrupt() = default

Destructor for the GpioMeasurementInterrupt class.

Before the GpioMeasurementInterrupt object is destructed, this destructor disables all ADC channels. This ensures that no ADC channels remain active beyond the lifetime of the GpioMeasurementInterrupt object, preventing potential issues with dangling resources.

Private Members

uint32_t measurement_interrupt_status_ = 0

The measurement interrupt status.

The This value represents the following data:

  • bit [0..1]: stopped status of ADC channel 0 and 1

  • bit [2..3]: DMA interrupt status of ADC channel 0 and 1

Private Static Functions

static GpioMeasurementInterrupt &get_instance_impl(int mem = 0)

The implementation of get_instance with parameters.

This is called once by init()

Parameters:

mem – The memory address to be used for the GPIO operations.

Returns:

The instance of of the GPIO object.

static GpioMeasurementInterrupt &get_instance()

The implementation of get_instance with parameters.

Returns:

The instance of of the GPIO object.

Measurement time GPIO Class

class GpioMeasurementTime : public nexmess::components::gpio::Gpio

The GpioMeasurementTime class represents a GPIO interface especially for the GPIO to set the measurement time.

This class inherits from the Gpio class and provides functionality for setting the measurement time in ms. It is a singleton class, meaning that only one instance of this class can exist.

Public Functions

GpioMeasurementTime() = delete
GpioMeasurementTime(const GpioMeasurementTime&) = delete
void operator=(const GpioMeasurementTime&) = delete
GpioMeasurementTime(GpioMeasurementTime&&) = delete
GpioMeasurementTime &operator=(GpioMeasurementTime&&) = delete

Public Static Functions

static void init(int mem)

Initializes the GpioMeasurementTime instance with the specified memory address.

Parameters:

mem – The memory address to be used for GPIO operations.

static void set_time(uint32_t time)

Sets the measurement time.

Parameters:

time – The measurement time in ms. 0 means infinite.

static uint32_t get_time()

Gets the measurement time.

Returns:

The measurement time in ms. 0 means infinite.

static void stop_measurement()

Stops the measurement.

The time is set to 1ms so that the hardware actually triggers the stop.

static bool stop_requested()

True while stop_measurement() was called and not reset again.

Software-visible stop signal used by the test input, where the PL measurement interrupt does not fire.

static void reset_stop_measurement()

Resets the stop measurement.

The time is set to the previous value. This should be called after stop_measurement() once the stop was handled.

static bool has_error()

Checks if any error has occurred during GPIO operations.

Returns:

true if an error has occurred, false otherwise.

Private Functions

explicit GpioMeasurementTime(int mem)

Constructor for the GpioMeasurementTime class.

This constructor initializes a new GpioMeasurementTime object. The measurement time is initialized to 0.

Parameters:

mem – The memory address to be used for the GPIO operations.

~GpioMeasurementTime()

Destructor for the GpioMeasurementTime class.

Before the GpioMeasurementTime object is destructed, this destructor resets the measurement time to 0.

Private Members

uint32_t time_ = 0

The measurement time in ms. 0 means infinite.

Private Static Functions

static GpioMeasurementTime &get_instance_impl(int mem = 0)

The implementation of get_instance with parameters.

This is called once by init()

Parameters:

mem – The memory address to be used for the GPIO operations.

Returns:

The instance of of the GPIO object.

static GpioMeasurementTime &get_instance()

The implementation of get_instance with parameters.

Returns:

The instance of of the GPIO object.

Private Static Attributes

static std::atomic<bool> stop_requested_

Coincidence window GPIO Class

class GpioCoincidenceWindow : public nexmess::components::gpio::Gpio

The GpioCoincidenceWindow class represents a GPIO interface especially for the GPIO to set the coincidence window.

This class inherits from the Gpio class and provides functionality for setting the coincidence window in number of samples. It is a singleton class, meaning that only one instance of this class can exist.

Public Functions

GpioCoincidenceWindow() = delete
GpioCoincidenceWindow(const GpioCoincidenceWindow&) = delete
void operator=(const GpioCoincidenceWindow&) = delete
GpioCoincidenceWindow(GpioCoincidenceWindow&&) = delete
GpioCoincidenceWindow &operator=(GpioCoincidenceWindow&&) = delete

Public Static Functions

static void init(int mem)

Initializes the GpioCoincidenceWindow instance with the specified memory address.

Parameters:

mem – The memory address to be used for GPIO operations.

static void set_coincidence_window(uint32_t coincidence_window)

Sets the coincidence window.

Parameters:

coincidence_window – The coincidence window in number of samples.

static uint32_t get_coincidence_window()

Gets the coincidence window.

Returns:

The coincidence window in number of samples.

static bool has_error()

Checks if any error has occurred during GPIO operations.

Returns:

true if an error has occurred, false otherwise.

Private Functions

explicit GpioCoincidenceWindow(int mem)

Constructor for the GpioCoincidenceWindow class.

This constructor initializes a new GpioCoincidenceWindow object. The coincidence window is initialized to 0.

Parameters:

mem – The memory address to be used for the GPIO operations.

~GpioCoincidenceWindow()

Destructor for the GpioCoincidenceWindow class.

Before the GpioCoincidenceWindow object is destructed, this destructor resets the coincidence window to 0.

Private Members

uint32_t coincidence_window_ = 0

The coincidence window in number of samples.

Private Static Functions

static GpioCoincidenceWindow &get_instance_impl(int mem = 0)

The implementation of get_instance with parameters.

This is called once by init()

Parameters:

mem – The memory address to be used for the GPIO operations.

Returns:

The instance of of the GPIO object.

static GpioCoincidenceWindow &get_instance()

The implementation of get_instance with parameters.

Returns:

The instance of of the GPIO object.

Raw data package size GPIO Class

class GpioRawPackageSize

GPIO interface for the raw-data package size of each ADC channel.

Public Functions

GpioRawPackageSize() = delete
GpioRawPackageSize(const GpioRawPackageSize&) = delete
void operator=(const GpioRawPackageSize&) = delete
GpioRawPackageSize(GpioRawPackageSize&&) = delete
GpioRawPackageSize &operator=(GpioRawPackageSize&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_package_size(uint8_t channel, uint32_t package_size)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • package_size – Value to write.

static uint32_t get_package_size(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioRawPackageSize(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioRawPackageSize()

Releases mapped GPIO resources.

Private Members

DualSlotGpio gpio_

Primary AXI-GPIO slot and optional extra slot.

std::array<uint32_t, kDmaCount> package_sizes_ = {}

Package size per ADC channel.

Private Static Functions

static GpioRawPackageSize &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioRawPackageSize &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

Count data package size GPIO Class

class GpioCountPackageSize

GPIO interface for the count-data package size of each ADC channel.

Public Functions

GpioCountPackageSize() = delete
GpioCountPackageSize(const GpioCountPackageSize&) = delete
void operator=(const GpioCountPackageSize&) = delete
GpioCountPackageSize(GpioCountPackageSize&&) = delete
GpioCountPackageSize &operator=(GpioCountPackageSize&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_package_size(uint8_t channel, uint32_t package_size)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • package_size – Value to write.

static uint32_t get_package_size(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioCountPackageSize(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioCountPackageSize()

Releases mapped GPIO resources.

Private Members

DualSlotGpio gpio_

Primary AXI-GPIO slot and optional extra slot.

std::array<uint32_t, kDmaCount> package_sizes_ = {}

Package size per ADC channel.

Private Static Functions

static GpioCountPackageSize &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioCountPackageSize &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

Charge data package size GPIO Class

class GpioChargePackageSize

GPIO interface for the charge-data package size of each ADC channel.

Public Functions

GpioChargePackageSize() = delete
GpioChargePackageSize(const GpioChargePackageSize&) = delete
void operator=(const GpioChargePackageSize&) = delete
GpioChargePackageSize(GpioChargePackageSize&&) = delete
GpioChargePackageSize &operator=(GpioChargePackageSize&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_package_size(uint8_t channel, uint32_t package_size)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • package_size – Value to write.

static uint32_t get_package_size(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioChargePackageSize(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioChargePackageSize()

Releases mapped GPIO resources.

Private Members

DualSlotGpio gpio_

Primary AXI-GPIO slot and optional extra slot.

std::array<uint32_t, kDmaCount> package_sizes_ = {}

Package size per ADC channel.

Private Static Functions

static GpioChargePackageSize &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioChargePackageSize &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

Fraction data package size GPIO Class

class GpioFractionPackageSize

GPIO interface for the fraction-data package size of each ADC channel.

Public Functions

GpioFractionPackageSize() = delete
GpioFractionPackageSize(const GpioFractionPackageSize&) = delete
void operator=(const GpioFractionPackageSize&) = delete
GpioFractionPackageSize(GpioFractionPackageSize&&) = delete
GpioFractionPackageSize &operator=(GpioFractionPackageSize&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_package_size(uint8_t channel, uint32_t package_size)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • package_size – Value to write.

static uint32_t get_package_size(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioFractionPackageSize(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioFractionPackageSize()

Releases mapped GPIO resources.

Private Members

DualSlotGpio gpio_

Primary AXI-GPIO slot and optional extra slot.

std::array<uint32_t, kDmaCount> package_sizes_ = {}

Package size per ADC channel.

Private Static Functions

static GpioFractionPackageSize &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioFractionPackageSize &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

Maximum height data package size GPIO Class

class GpioMaxPackageSize

GPIO interface for the max-data package size of each ADC channel.

Public Functions

GpioMaxPackageSize() = delete
GpioMaxPackageSize(const GpioMaxPackageSize&) = delete
void operator=(const GpioMaxPackageSize&) = delete
GpioMaxPackageSize(GpioMaxPackageSize&&) = delete
GpioMaxPackageSize &operator=(GpioMaxPackageSize&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_package_size(uint8_t channel, uint32_t package_size)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • package_size – Value to write.

static uint32_t get_package_size(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioMaxPackageSize(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioMaxPackageSize()

Releases mapped GPIO resources.

Private Members

DualSlotGpio gpio_

Primary AXI-GPIO slot and optional extra slot.

std::array<uint32_t, kDmaCount> package_sizes_ = {}

Package size per ADC channel.

Private Static Functions

static GpioMaxPackageSize &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioMaxPackageSize &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

Risetime data package size GPIO Class

class GpioRisetimePackageSize

GPIO interface for the risetime-data package size of each ADC channel.

Public Functions

GpioRisetimePackageSize() = delete
GpioRisetimePackageSize(const GpioRisetimePackageSize&) = delete
void operator=(const GpioRisetimePackageSize&) = delete
GpioRisetimePackageSize(GpioRisetimePackageSize&&) = delete
GpioRisetimePackageSize &operator=(GpioRisetimePackageSize&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_package_size(uint8_t channel, uint32_t package_size)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • package_size – Value to write.

static uint32_t get_package_size(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioRisetimePackageSize(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioRisetimePackageSize()

Releases mapped GPIO resources.

Private Members

DualSlotGpio gpio_

Primary AXI-GPIO slot and optional extra slot.

std::array<uint32_t, kDmaCount> package_sizes_ = {}

Package size per ADC channel.

Private Static Functions

static GpioRisetimePackageSize &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioRisetimePackageSize &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

Signal count GPIO Class

class GpioSignalCount : public nexmess::components::gpio::Gpio

The GpioSignalCount class represents a GPIO interface especially for the GPIO to get the signal count for a specific channel.

This class inherits from the Gpio class and provides functionality for getting the signal count.

Public Functions

GpioSignalCount(uint32_t register_base, int mem)

Constructor for the GpioSignalCount class.

This constructor initializes a new GpioSignalCount. The signal count is initialized to DEFAULT_SIGNAL_COUNT.

Parameters:
  • register_base – The register base address.

  • mem – The memory address to be used for the GPIO operations.

GpioSignalCount(GpioSignalCount&&) = delete
GpioSignalCount &operator=(GpioSignalCount&&) = delete
GpioSignalCount() = delete
GpioSignalCount(const GpioSignalCount&) = delete
void operator=(const GpioSignalCount&) = delete
~GpioSignalCount() = default
uint64_t get_signal_count()

Gets the signal count.

Returns:

The signal count.

Offset GPIO Class

class GpioOffset : public nexmess::components::gpio::Gpio

Per-channel ADC offset.

GPIO_DATA packs channels 0/1; GPIO2_DATA packs 2/3.

Channel index is 0 .. kDmaCount-1. Packing uses one 32-bit word per two channels (GPIO_DATA then GPIO2_DATA).

Public Functions

GpioOffset() = delete
GpioOffset(const GpioOffset&) = delete
void operator=(const GpioOffset&) = delete
GpioOffset(GpioOffset&&) = delete
GpioOffset &operator=(GpioOffset&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_offset(uint8_t channel, int16_t value)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • value – Value to write.

static int16_t get_offset(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioOffset(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioOffset()

Releases mapped GPIO resources.

Private Members

std::array<uint32_t, kPackedWords> packed_ = {}

Packed GPIO_DATA / GPIO2_DATA words.

Private Static Functions

static GpioOffset &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioOffset &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

BLR pre gate GPIO Class

class GpioBLRPreGate : public nexmess::components::gpio::Gpio

Per-channel baseline-restorer pre-gate in samples.

Channel index is 0 .. kDmaCount-1. Packing uses one 32-bit word per two channels (GPIO_DATA then GPIO2_DATA).

Public Functions

GpioBLRPreGate() = delete
GpioBLRPreGate(const GpioBLRPreGate&) = delete
void operator=(const GpioBLRPreGate&) = delete
GpioBLRPreGate(GpioBLRPreGate&&) = delete
GpioBLRPreGate &operator=(GpioBLRPreGate&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_blr_pre_gate(uint8_t channel, uint16_t value)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • value – Value to write.

static uint16_t get_blr_pre_gate(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioBLRPreGate(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioBLRPreGate()

Releases mapped GPIO resources.

Private Members

std::array<uint32_t, kPackedWords> packed_ = {}

Packed GPIO_DATA / GPIO2_DATA words.

Private Static Functions

static GpioBLRPreGate &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioBLRPreGate &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

Moving-average length GPIO Class

class GpioMovingAverageLength : public nexmess::components::gpio::Gpio

Per-channel moving-average window length.

Channel index is 0 .. kDmaCount-1. Packing uses one 32-bit word per two channels (GPIO_DATA then GPIO2_DATA).

Public Functions

GpioMovingAverageLength() = delete
GpioMovingAverageLength(const GpioMovingAverageLength&) = delete
void operator=(const GpioMovingAverageLength&) = delete
GpioMovingAverageLength(GpioMovingAverageLength&&) = delete
GpioMovingAverageLength &operator=(GpioMovingAverageLength&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_moving_average_length(uint8_t channel, uint8_t value)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • value – Value to write.

static uint8_t get_moving_average_length(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioMovingAverageLength(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioMovingAverageLength()

Releases mapped GPIO resources.

Private Members

std::array<uint32_t, kPackedWords> packed_ = {}

Packed GPIO_DATA / GPIO2_DATA words.

Private Static Functions

static GpioMovingAverageLength &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioMovingAverageLength &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

Moving-average count GPIO Class

class GpioMovingAverageNum : public nexmess::components::gpio::Gpio

Per-channel number of successive moving-average stages.

Channel index is 0 .. kDmaCount-1. Packing uses one 32-bit word per two channels (GPIO_DATA then GPIO2_DATA).

Public Functions

GpioMovingAverageNum() = delete
GpioMovingAverageNum(const GpioMovingAverageNum&) = delete
void operator=(const GpioMovingAverageNum&) = delete
GpioMovingAverageNum(GpioMovingAverageNum&&) = delete
GpioMovingAverageNum &operator=(GpioMovingAverageNum&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_moving_average_num(uint8_t channel, uint8_t value)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • value – Value to write.

static uint8_t get_moving_average_num(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioMovingAverageNum(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioMovingAverageNum()

Releases mapped GPIO resources.

Private Members

std::array<uint32_t, kPackedWords> packed_ = {}

Packed GPIO_DATA / GPIO2_DATA words.

Private Static Functions

static GpioMovingAverageNum &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioMovingAverageNum &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

CFD delay GPIO Class

class GpioCfdDelay : public nexmess::components::gpio::Gpio

Per-channel CFD delay in samples.

Channel index is 0 .. kDmaCount-1. Packing uses one 32-bit word per two channels (GPIO_DATA then GPIO2_DATA).

Public Functions

GpioCfdDelay() = delete
GpioCfdDelay(const GpioCfdDelay&) = delete
void operator=(const GpioCfdDelay&) = delete
GpioCfdDelay(GpioCfdDelay&&) = delete
GpioCfdDelay &operator=(GpioCfdDelay&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_cfd_delay(uint8_t channel, uint16_t value)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • value – Value to write.

static uint16_t get_cfd_delay(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioCfdDelay(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioCfdDelay()

Releases mapped GPIO resources.

Private Members

std::array<uint32_t, kPackedWords> packed_ = {}

Packed GPIO_DATA / GPIO2_DATA words.

Private Static Functions

static GpioCfdDelay &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioCfdDelay &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

CFD amplification GPIO Class

class GpioCfdAmp

GPIO interface for the CFD amplitude of each ADC channel.

Public Functions

GpioCfdAmp() = delete
GpioCfdAmp(const GpioCfdAmp&) = delete
void operator=(const GpioCfdAmp&) = delete
GpioCfdAmp(GpioCfdAmp&&) = delete
GpioCfdAmp &operator=(GpioCfdAmp&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_cfd_amp(uint8_t channel, float cfd_amp)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • cfd_amp – Value to write.

static float get_cfd_amp(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioCfdAmp(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioCfdAmp()

Releases mapped GPIO resources.

Private Members

DualSlotGpio gpio_

Primary AXI-GPIO slot and optional extra slot.

std::array<uint32_t, kDmaCount> cfd_amp_ = {}

Encoded CFD amplitude per channel.

Private Static Functions

static GpioCfdAmp &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioCfdAmp &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

FIR coefficient GPIO Class

class GpioFirCoeffSet : public nexmess::components::gpio::Gpio

The GpioFirCoeffSet class represents a GPIO interface for setting the FIR filter coefficient / cutoff configuration per ADC channel.

This class inherits from the Gpio class and packs one 3-bit field per ADC channel into a single register (channel index 0 .. kDmaCount-1). It is a singleton class, meaning that only one instance of this class can exist.

Public Functions

GpioFirCoeffSet() = delete
GpioFirCoeffSet(const GpioFirCoeffSet&) = delete
void operator=(const GpioFirCoeffSet&) = delete
GpioFirCoeffSet(GpioFirCoeffSet&&) = delete
GpioFirCoeffSet &operator=(GpioFirCoeffSet&&) = delete

Public Static Functions

static void init(int mem)

Initializes the GpioFirCoeffSet instance with the specified memory address.

Parameters:

mem – The memory address to be used for GPIO operations.

static void set_fir_coeff(uint8_t channel, FirCoeffSet fir_coeff)

Sets the FIR coefficient / cutoff set for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • fir_coeff – Coefficient set to apply.

static FirCoeffSet get_fir_coeff(uint8_t channel)

Gets the FIR coefficient / cutoff set for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored coefficient set.

static bool has_error()

Checks if any error has occurred during GPIO operations.

Returns:

true if an error has occurred, false otherwise.

Private Functions

explicit GpioFirCoeffSet(int mem)

Constructor for the GpioFirCoeffSet class.

The FIR coefficient set is set to 2 (150 MHz) for every channel by default.

Parameters:

mem – The memory address to be used for the GPIO operations.

~GpioFirCoeffSet()

Destructor for the GpioFirCoeffSet class.

Before the GpioFirCoeffSet object is destructed, the FIR coefficient set is set to 2 (150 MHz) for every channel in hardware.

Private Members

std::array<FirCoeffSet, kDmaCount> fir_coeff_ = {}

FIR coefficient set per ADC channel.

uint32_t fir_coeffs_ = 0

Packed FIR coefficient configuration register.

Private Static Functions

static GpioFirCoeffSet &get_instance_impl(int mem = 0)

The implementation of get_instance with parameters.

This is called once by init()

Parameters:

mem – The memory address to be used for the GPIO operations.

Returns:

The instance of of the GPIO object.

static GpioFirCoeffSet &get_instance()

The implementation of get_instance with parameters.

Returns:

The instance of of the GPIO object.

enum class nexmess::components::gpio::FirCoeffSet : uint32_t

Valid FIR filter coefficient / cutoff configurations per ADC channel.

Maps to the lowpass cutoff selected by gpio_fir_coeff_set:

  • k50MHz -> 50 MHz cutoff

  • k100MHz -> 100 MHz cutoff

  • k150MHz -> 150 MHz cutoff (default)

  • k200MHz -> 200 MHz cutoff

Values:

enumerator k50MHz
enumerator k100MHz
enumerator k150MHz
enumerator k200MHz

Decimation factor GPIO Class

class GpioDecimationFactor

GPIO interface for the decimation factor of each ADC channel.

Public Functions

GpioDecimationFactor() = delete
GpioDecimationFactor(const GpioDecimationFactor&) = delete
void operator=(const GpioDecimationFactor&) = delete
GpioDecimationFactor(GpioDecimationFactor&&) = delete
GpioDecimationFactor &operator=(GpioDecimationFactor&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_decimation_factor(uint8_t channel, DecimationFactor value)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • value – Value to write.

static DecimationFactor get_decimation_factor(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioDecimationFactor(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioDecimationFactor()

Releases mapped GPIO resources.

Private Members

DualSlotGpio gpio_

Primary AXI-GPIO slot and optional extra slot.

std::array<DecimationFactor, kDmaCount> decimation_factor_ = {}

Decimation factor per ADC channel.

Private Static Functions

static GpioDecimationFactor &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioDecimationFactor &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

enum class nexmess::components::gpio::DecimationFactor : uint32_t

Valid decimation factors for ADC channels.

Values:

enumerator k1
enumerator k2
enumerator k4
enumerator k8
enumerator k16
enumerator k32

Short window GPIO Class

class GpioFractionWindow : public nexmess::components::gpio::Gpio

Per-channel fraction integration window (size and start).

Primary slot: GPIO_DATA packs sizes for channels 0/1, GPIO2_DATA packs starts. On ZCU102 a second AXI-GPIO slot holds channels 2/3 the same way.

Public Functions

GpioFractionWindow() = delete
GpioFractionWindow(const GpioFractionWindow&) = delete
void operator=(const GpioFractionWindow&) = delete
GpioFractionWindow(GpioFractionWindow&&) = delete
GpioFractionWindow &operator=(GpioFractionWindow&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_fraction_window(uint8_t channel, uint16_t fraction_window)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • fraction_window – Value to write.

static uint16_t get_fraction_window(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static void set_fraction_window_start(uint8_t channel, uint16_t fraction_window_start)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • fraction_window_start – Value to write.

static uint16_t get_fraction_window_start(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioFractionWindow(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioFractionWindow()

Releases mapped GPIO resources.

Private Members

std::array<uint32_t, kPackedWords> sizes_ = {}

Packed window sizes.

std::array<uint32_t, kPackedWords> starts_ = {}

Packed window start offsets.

std::unique_ptr<Gpio> extra_ = {}

Second AXI-GPIO slot for channels 2/3.

Private Static Functions

static GpioFractionWindow &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioFractionWindow &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

Long window GPIO Class

class GpioChargeWindow : public nexmess::components::gpio::Gpio

Per-channel charge integration window (size and start).

Primary slot: GPIO_DATA packs sizes for channels 0/1, GPIO2_DATA packs starts. On ZCU102 a second AXI-GPIO slot holds channels 2/3 the same way.

Public Functions

GpioChargeWindow() = delete
GpioChargeWindow(const GpioChargeWindow&) = delete
void operator=(const GpioChargeWindow&) = delete
GpioChargeWindow(GpioChargeWindow&&) = delete
GpioChargeWindow &operator=(GpioChargeWindow&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_charge_window(uint8_t channel, uint16_t charge_window)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • charge_window – Value to write.

static uint16_t get_charge_window(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static void set_charge_window_start(uint8_t channel, uint16_t charge_window_start)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • charge_window_start – Value to write.

static uint16_t get_charge_window_start(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioChargeWindow(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioChargeWindow()

Releases mapped GPIO resources.

Private Members

std::array<uint32_t, kPackedWords> sizes_ = {}

Packed window sizes.

std::array<uint32_t, kPackedWords> starts_ = {}

Packed window start offsets.

std::unique_ptr<Gpio> extra_ = {}

Second AXI-GPIO slot for channels 2/3.

Private Static Functions

static GpioChargeWindow &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioChargeWindow &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

Minimum height fraction GPIO Class

class GpioMinHeightFraction

GPIO interface for the minimum height fraction of each ADC channel.

Public Functions

GpioMinHeightFraction() = delete
GpioMinHeightFraction(const GpioMinHeightFraction&) = delete
void operator=(const GpioMinHeightFraction&) = delete
GpioMinHeightFraction(GpioMinHeightFraction&&) = delete
GpioMinHeightFraction &operator=(GpioMinHeightFraction&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_min_height_fraction(uint8_t channel, float value)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • value – Value to write.

static float get_min_height_fraction(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioMinHeightFraction(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioMinHeightFraction()

Releases mapped GPIO resources.

Private Members

DualSlotGpio gpio_

Primary AXI-GPIO slot and optional extra slot.

std::array<uint32_t, kDmaCount> min_height_fraction_ = {}

Encoded min height fraction per channel.

Private Static Functions

static GpioMinHeightFraction &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioMinHeightFraction &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

Maximum height fraction GPIO Class

class GpioMaxHeightFraction

GPIO interface for the maximum height fraction of each ADC channel.

Public Functions

GpioMaxHeightFraction() = delete
GpioMaxHeightFraction(const GpioMaxHeightFraction&) = delete
void operator=(const GpioMaxHeightFraction&) = delete
GpioMaxHeightFraction(GpioMaxHeightFraction&&) = delete
GpioMaxHeightFraction &operator=(GpioMaxHeightFraction&&) = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Parameters:

mem – File descriptor for /dev/mem.

static void set_max_height_fraction(uint8_t channel, float value)

Writes the setting for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • value – Value to write.

static float get_max_height_fraction(uint8_t channel)

Reads the setting for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored value.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.

Private Functions

explicit GpioMaxHeightFraction(int mem)

Constructs the singleton.

Parameters:

mem – File descriptor for /dev/mem.

~GpioMaxHeightFraction()

Releases mapped GPIO resources.

Private Members

DualSlotGpio gpio_

Primary AXI-GPIO slot and optional extra slot.

std::array<uint32_t, kDmaCount> max_height_fraction_ = {}

Encoded max height fraction per channel.

Private Static Functions

static GpioMaxHeightFraction &get_instance_impl(int mem = 0)

Returns the singleton, creating it on the first call from init().

Parameters:

mem – File descriptor for /dev/mem.

Returns:

The GPIO singleton.

static GpioMaxHeightFraction &get_instance()

Returns the existing singleton.

Returns:

The GPIO singleton.

FMC coupling GPIO Class

class GpioFmcCoupling

GPIO and ADS54J60 interface for FMC ADC AC/DC coupling (ZCU102 only).

Idle state is AC: live offset correction, EN INPUT DC COUPLING cleared, ENDCC bits cleared. DC loads a stored interleaving-core offset profile, freezes it, then sets ENDCC. AC is restored after each measurement. ENDCC is per channel. Analog input DC mode (ADS54J60 4Fh) is chip-wide and is enabled when any measurement channel requests DC.

On ZCU102 the profile in /var/lib/adc500cd/offset-corr must be captured at least once (calibrate() or akr2daq3 –calibrate-offset) with idle AC-coupled inputs. A missing file uses zeros and prints a warning.

On platforms without FMC coupling hardware (ZC706) the methods are no-ops.

Bit assignment in the first data register (ENDCC):

  • bit 4: channel 1 (1 = DC, 0 = AC)

  • bit 5: channel 2 (1 = DC, 0 = AC)

  • bit 6: channel 3 (ZCU102)

  • bit 7: channel 4 (ZCU102)

Public Functions

GpioFmcCoupling() = delete

Public Static Functions

static void init(int mem)

Initializes the GpioFmcCoupling instance.

On ZCU102 both channels are forced to AC and the on-disk offset profile is loaded into RAM. A missing file uses zeros and prints a warning.

Parameters:

mem – File descriptor for /dev/mem.

static void set_coupling(uint8_t channel, Coupling coupling)

Sets AC/DC coupling for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • coupling – Requested coupling.

static Coupling get_coupling(uint8_t channel)

Gets the requested AC/DC coupling for one ADC channel.

Parameters:

channel – 0-based ADC channel.

Returns:

The stored coupling.

static bool apply_requested()

Applies the requested coupling for a measurement.

DC loads stored core offsets and waits only for the analog switch.

Returns:

false if SPI or GPIO programming failed.

static void restore_ac()

Returns both channels to AC (idle) after a measurement.

static bool calibrate(bool store, uint8_t channels)

Estimates interleaving-core offsets on AC with an idle input.

Updates the in-memory profile for the selected channels. When store is true, also writes /var/lib/adc500cd/offset-corr (other channels in the file are kept).

Parameters:
  • store – Write the captured values to the on-disk profile.

  • channels – Nonzero ADC-channel bitmask (1 << kDmaCount is invalid).

Returns:

false if SPI or GPIO programming failed.

static std::array<uint16_t, kOffsetCorrCores> offset_cores(uint8_t channel)

Returns the in-memory 11-bit core offsets for a measurement channel.

Parameters:

channel – 0 for channel 1, 1 for channel 2.

static bool has_error()

Checks if any error has occurred during GPIO operations.

Returns:

true if an error has occurred, false otherwise.

enum class nexmess::components::gpio::Coupling : uint8_t

AC/DC input coupling for an ADC channel on the FMC-ADC500CD mezzanine.

Values:

enumerator kAc

AC coupling (ENDCC bit cleared).

enumerator kDc

DC coupling (ENDCC bit set).

Trapezoid height-filter GPIO Class

class GpioTrapez

Per-channel trapezoid pulse-height configuration (GPIO slots 43..46; channel 0..1 on ZC706, 0..3 on ZCU102).

Each ADC channel has its own 32-bit GPIO_DATA register plus GPIO2:

  • bits [15:0] k_uq16 PZ coefficient K (0 = bypass)

  • bits [23:16] rise rise length in beats minus 1; N = 4*(rise+1) + r

  • bits [29:24] flat flat top in beats minus 1; G = 4*(flat+1) samples

  • bit [30] mode 1 = trapezoid, 0 = original sliding-window peak

  • bit [31] reserved (shape rejection is always enabled in the HDL)

  • GPIO2 [1:0] r rise remainder N mod 4

  • GPIO2 [15:8] delay trapezoid start delay in samples, sample-exact, anchored at the capture-window head sample (window start including the pre gate); 0 = start at the window head, pre_gate = start at the trigger crossing (legacy)

The C++ API uses sample counts N and G, matching trapezfit output. G is a multiple of 4; N is sample-accurate. The height is emitted on the existing max DMA stream.

Public Functions

GpioTrapez() = delete

Public Static Functions

static void init(int mem)

Creates the singleton with the given /dev/mem descriptor.

Programs K=47, N=72, G=32, original peak mode, start delay 0 on every channel.

Parameters:

mem – File descriptor for /dev/mem.

static void set_cfg(uint8_t channel, uint16_t k_uq16, uint16_t rise_samples, uint16_t flat_samples, bool mode, uint8_t start_delay = kDefaultTrapezStartDelay)

Writes the packed trapez_cfg register for one ADC channel.

Parameters:
  • channel – 0-based ADC channel.

  • k_uq16 – PZ coefficient K (0 = bypass).

  • rise_samples – Rise length N in samples.

  • flat_samples – Flat-top length G in samples.

  • mode – True for trapezoid, false for original peak.

  • start_delay – Trapezoid start delay in samples, anchored at the capture-window head (0 = window start including the pre gate; pre_gate = trigger crossing, legacy).

static uint16_t get_k(uint8_t channel)

Returns the stored PZ coefficient K for one ADC channel.

Parameters:

channel – 0-based ADC channel.

static uint16_t get_rise(uint8_t channel)

Returns the stored rise length N in samples for one ADC channel.

Parameters:

channel – 0-based ADC channel.

static uint16_t get_flat(uint8_t channel)

Returns the stored flat-top length G in samples for one ADC channel.

Parameters:

channel – 0-based ADC channel.

static bool get_mode(uint8_t channel)

Returns true if trapezoid mode is selected for one ADC channel.

Parameters:

channel – 0-based ADC channel.

static uint8_t get_start_delay(uint8_t channel)

Returns the stored trapezoid start delay in samples for one ADC channel.

Parameters:

channel – 0-based ADC channel.

static bool has_error()

Checks whether a GPIO access error has occurred.

Returns:

true if an error occurred.