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-Code of the hardware design.
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::GpioEnabled, nexmess::components::gpio::GpioLongGate, nexmess::components::gpio::GpioMeasurementInterrupt, nexmess::components::gpio::GpioMeasurementTime, nexmess::components::gpio::GpioOffset, nexmess::components::gpio::GpioPackageSize, nexmess::components::gpio::GpioPreGate, nexmess::components::gpio::GpioSignalCount, nexmess::components::gpio::GpioTriggerValue
Public Functions
-
Gpio() = delete
-
~Gpio() = default
-
Gpio(uint32_t registerBase, int mem)
Constructs a new Gpio object.
- Parameters:
registerBase – The base address of the GPIO registers.
mem – The memory identifier.
-
bool hasError() const
Checks if there is any error with the GPIO.
- Returns:
true
if there is an error,false
otherwise.
Protected Functions
-
void setValue(uint32_t value)
Sets the value of the first data register.
- Parameters:
value – The value to be set.
-
uint32_t getValue()
Gets the value of the first data register.
- Returns:
The value of the first data register.
-
void setValue2(uint32_t value)
Sets the value of the second data register.
- Parameters:
value – The value to be set.
-
uint32_t getValue2()
Gets the value of the second data register.
- Returns:
The value of the second data register.
-
Gpio() = delete
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.
This class inherits from the Gpio class and provides functionality for controlling GPIO pins to enable ADC channels. 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
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 deactivateAll()
Deactivates all ADC channels.
-
static void activateSpecific(uint8_t channelValue)
Activates the specified ADC channels for DMA operations.
This function uses a bit mask for the configuration of the ADC channels. The structure is at follows:
bit [0]: activate channel 1 for DMA operation
bit [1]: activate channel 2 for DMA operation
For example, a mask of 0b00000001 would activate the first channel for DMA operation.
- Parameters:
channelValue – A bit mask specifying the ADC channels to be activated.
-
static uint32_t getChannels()
Gets the channel configuration for DMA operations and inversions.
- Returns:
The channel configuration for DMA operations and inversions.
-
static uint8_t getDMAChannels()
Gets the channels for DMA operations.
- Returns:
The channels for DMA operations.
-
static uint8_t getInvertChannels()
Gets the channels for inversions.
- Returns:
The channels for inversions.
-
static void setInvertChannels(uint8_t invertChannelValue)
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 0b00000001 would activate the first channel inversion.
- Parameters:
invertChannelValue – A bit mask specifying the ADC channels to be activated.
-
static uint8_t getFirChannels()
Gets the channels for FIR operations.
- Returns:
The channels for FIR operations.
-
static void setFirChannels(uint8_t firChannelValue)
Sets the specified ADC channels to FIR.
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 operation
bit [1]: activate channel 2 for FIR operation
For example, a mask of 0b00000001 would activate the first channel for FIR operation.
- Parameters:
firChannelValue – A bit mask specifying the ADC channels to be activated.
-
static bool hasError()
Checks if any error has occurred during GPIO operations.
- Returns:
true if an error has occurred, false otherwise.
Private Functions
-
GpioEnabled(int mem)
Constructor for the GpioEnabled class.
This constructor initializes a new GpioEnabled 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.
-
GpioEnabled(GpioEnabled&&) = delete
-
GpioEnabled &operator=(GpioEnabled&&) = delete
-
~GpioEnabled()
Destructor for the GpioEnabled class.
Before the GpioEnabled object is destructed, this destructor disables all ADC channels. This ensures that no ADC channels remain active beyond the lifetime of the GpioEnabled object, preventing potential issues with dangling resources.
Private Members
-
uint32_t mEnableds = 0
Sets the state of the sensor (0 -> off, 1 -> on). Each bit is one sensor.
Private Static Functions
-
static GpioEnabled &getInstanceImpl(int mem = 0)
The implementation of getInstance 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 GpioEnabled &getInstance()
The implementation of getInstance with parameters.
- Returns:
The instance of of the GPIO object.
-
GpioEnabled() = delete
Long gate GPIO Class
-
class GpioLongGate : public nexmess::components::gpio::Gpio
The GpioLongGate class represents a GPIO interface especially for the GPIO to set the number of samples to be measured once a trigger occurs.
This class inherits from the Gpio class and provides functionality for setting the long gate. It is a singleton class, meaning that only one instance of this class can exist.
Public Functions
-
GpioLongGate() = delete
-
GpioLongGate(const GpioLongGate&) = delete
-
void operator=(const GpioLongGate&) = delete
Public Static Functions
-
static void init(int mem)
Initializes the GpioLongGate instance with the specified memory address.
- Parameters:
mem – The memory address to be used for GPIO operations.
-
static void setLongGates(uint16_t longGateC1, uint16_t longGateC2)
Sets the long gates of channel 1 and channel 2.
- Parameters:
longGateC1 – The long gate of channel 1 in number of samples.
longGateC2 – The long gate of channel 2 in number of samples.
-
static void setLongGateC1(uint16_t longGateC1)
Sets the long gate of channel 1.
- Parameters:
longGateC1 – The long gate of channel 1 in number of samples.
-
static void setLongGateC2(uint16_t longGateC2)
Sets the long gate of channel 2.
- Parameters:
longGateC2 – The long gate of channel 2 in number of samples.
-
static uint32_t getLongGates()
Gets the long gate configuration of both channels.
- Returns:
The long gate configuration of both channels.
-
static uint16_t getLongGateC1()
Gets the long gate of channel 1.
- Returns:
The long gate of channel 1 in number of samples.
-
static uint16_t getLongGateC2()
Gets the long gate of channel 2.
- Returns:
The long gate of channel 2 in number of samples.
-
static bool hasError()
Checks if any error has occurred during GPIO operations.
- Returns:
true if an error has occurred, false otherwise.
Private Functions
-
GpioLongGate(int mem)
Constructor for the GpioLongGate class.
The value is set to 0 by default.
- Parameters:
mem – The memory address to be used for the GPIO operations.
-
GpioLongGate(GpioLongGate&&) = delete
-
GpioLongGate &operator=(GpioLongGate&&) = delete
-
~GpioLongGate()
Destructor for the GpioLongGate class.
Before the GpioLongGate object is destructed, the value is set to 0 in hardware.
Private Members
-
uint32_t mLongGates = 0
Number of samples for the long gate.
Private Static Functions
-
static GpioLongGate &getInstanceImpl(int mem = 0)
The implementation of getInstance 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 GpioLongGate &getInstance()
The implementation of getInstance with parameters.
- Returns:
The instance of of the GPIO object.
-
GpioLongGate() = delete
Pre gate GPIO Class
-
class GpioPreGate : public nexmess::components::gpio::Gpio
The GpioPreGate class represents a GPIO interface especially for the GPIO to set the number of samples to be outputted before a trigger occurred.
For each channel an individual pre gate can be set.
This class inherits from the Gpio class and provides functionality for setting the pre gate. It is a singleton class, meaning that only one instance of this class can exist.
Public Functions
-
GpioPreGate() = delete
-
GpioPreGate(const GpioPreGate&) = delete
-
void operator=(const GpioPreGate&) = delete
Public Static Functions
-
static void init(int mem)
Initializes the GpioPreGate instance with the specified memory address.
- Parameters:
mem – The memory address to be used for GPIO operations.
-
static void setPreGates(uint16_t preGateC1, uint16_t preGateC2)
Sets the pre gates of channel 1 and channel 2.
- Parameters:
preGateC1 – The pre gate of channel 1 in number of samples.
preGateC2 – The pre gate of channel 1 in number of samples.
-
static void setPreGateC1(uint16_t preGateC1)
Sets the pre gate of channel 1.
- Parameters:
preGateC1 – The pre gate of channel 1 in number of samples.
-
static void setPreGateC2(uint16_t preGateC2)
Sets the pre gate of channel 2.
- Parameters:
preGateC2 – The pre gate of channel 2 in number of samples.
-
static uint32_t getPreGates()
Gets the pre gate configuration of both channels.
- Returns:
The pre gate configuration of both channels.
-
static uint16_t getPreGateC1()
Gets the pre gate of channel 1.
- Returns:
The pre gate of channel 1 in number of samples.
-
static uint16_t getPreGateC2()
Gets the pre gate of channel 2.
- Returns:
The pre gate of channel 2 in number of samples.
-
static bool hasError()
Checks if any error has occurred during GPIO operations.
- Returns:
true if an error has occurred, false otherwise.
Private Functions
-
GpioPreGate(int mem)
Constructor for the GpioPreGate class.
The value is set to 0 by default.
- Parameters:
mem – The memory address to be used for the GPIO operations.
-
GpioPreGate(GpioPreGate&&) = delete
-
GpioPreGate &operator=(GpioPreGate&&) = delete
-
~GpioPreGate()
Destructor for the GpioPreGate class.
Before the GpioPreGate object is destructed, the value is set to 0 in hardware.
Private Members
-
uint32_t mPreGates = 0
Number of samples for the pre gate.
Private Static Functions
-
static GpioPreGate &getInstanceImpl(int mem = 0)
The implementation of getInstance 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 GpioPreGate &getInstance()
The implementation of getInstance with parameters.
- Returns:
The instance of of the GPIO object.
-
GpioPreGate() = delete
Trigger value GPIO Class
-
class GpioTriggerValue : public nexmess::components::gpio::Gpio
The GpioTriggerValue class represents a GPIO interface especially for the GPIO to set the trigger value.
This class inherits from the Gpio class and provides functionality for setting the trigger value. The value corresponds to the values given by the ADC. It is a singleton class, meaning that only one instance of this class can exist.
Public Functions
-
GpioTriggerValue() = delete
-
GpioTriggerValue(const GpioTriggerValue&) = delete
-
void operator=(const GpioTriggerValue&) = delete
Public Static Functions
-
static void init(int mem)
Initializes the GpioTriggerValue instance with the specified memory address.
- Parameters:
mem – The memory address to be used for GPIO operations.
-
static void setTriggerValues(int16_t triggerValueC1, int16_t triggerValueC2)
Sets the trigger values for channel 1 and channel 2.
- Parameters:
triggerValueC1 – The trigger value for channel 1 in units of the ADC.
triggerValueC2 – The trigger value for channel 2 in units of the ADC.
-
static void setTriggerValueC1(int16_t triggerValueC1)
Sets the trigger value of channel 1.
- Parameters:
triggerValueC1 – The trigger value of channel 1 in units of the ADC.
-
static void setTriggerValueC2(int16_t triggerValueC2)
Sets the trigger value of channel 2.
- Parameters:
triggerValueC2 – The trigger value of channel 2 in units of the ADC.
-
static uint32_t getTriggerValues()
Gets the trigger value configuration of both channels.
- Returns:
The trigger value configuration of both channels.
-
static int16_t getTriggerValueC1()
Gets the trigger value for channel 1.
- Returns:
The trigger value for channel 1 in units of the ADC.
-
static int16_t getTriggerValueC2()
Gets the trigger value for channel 2.
- Returns:
The trigger value for channel 2 in units of the ADC.
-
static bool hasError()
Checks if any error has occurred during GPIO operations.
- Returns:
true if an error has occurred, false otherwise.
Private Functions
-
GpioTriggerValue(int mem)
Constructor for the GpioTriggerValue class.
The value is set to 0 by default.
- Parameters:
mem – The memory address to be used for the GPIO operations.
-
GpioTriggerValue(GpioTriggerValue&&) = delete
-
GpioTriggerValue &operator=(GpioTriggerValue&&) = delete
-
~GpioTriggerValue()
Destructor for the GpioTriggerValue class.
Before the GpioLongGate object is destructed, the value is set to 0 in hardware.
Private Members
-
uint32_t mTriggerValues = 0
Trigger value in units of the ADC.
Private Static Functions
-
static GpioTriggerValue &getInstanceImpl(int mem = 0)
The implementation of getInstance 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 GpioTriggerValue &getInstance()
The implementation of getInstance with parameters.
- Returns:
The instance of of the GPIO object.
-
GpioTriggerValue() = delete
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
Public Static Functions
-
static void init(int mem)
Initializes the GPIO measurement interrupt.
- Parameters:
mem – The memory value.
-
static void checkStatus()
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 getStopped(uint16_t id)
Gets the stopped flag for a specific ID.
- Parameters:
id – The ID value.
- Returns:
true if the stopped flag is set, false otherwise.
-
static bool getDmaInterrupt(uint16_t id)
Gets the DMA interrupt for a specific DMA.
- Parameters:
id – The ID value.
- Returns:
true if the DMA interrupt is set, false otherwise.
-
static void reset()
Resets the GPIO measurement interrupt.
-
static bool hasError()
Checks if any error has occurred during GPIO operations.
- Returns:
true if an error has occurred, false otherwise.
Private Functions
-
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(GpioMeasurementInterrupt&&) = delete
-
GpioMeasurementInterrupt &operator=(GpioMeasurementInterrupt&&) = delete
-
~GpioMeasurementInterrupt()
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 m_measurementInterruptStatus = 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 &getInstanceImpl(int mem = 0)
The implementation of getInstance 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 &getInstance()
The implementation of getInstance with parameters.
- Returns:
The instance of of the GPIO object.
-
GpioMeasurementInterrupt() = delete
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
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 setTime(uint32_t time)
Sets the measurement time.
- Parameters:
time – The measurement time in ms. 0 means infinite.
-
static uint32_t getTime()
Gets the measurement time.
- Returns:
The measurement time in ms. 0 means infinite.
-
static void stopMeasurement()
Stops the measurement.
The time is set to 1ms so that the hardware actually triggers the stop.
-
static void resetStopMeasurement()
Resets the stop measurement.
The time is set to the previous value. This should be called after stopMeasurement() once the stop was handled.
-
static bool hasError()
Checks if any error has occurred during GPIO operations.
- Returns:
true if an error has occurred, false otherwise.
Private Functions
-
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(GpioMeasurementTime&&) = delete
-
GpioMeasurementTime &operator=(GpioMeasurementTime&&) = delete
-
~GpioMeasurementTime()
Destructor for the GpioMeasurementTime class.
Before the GpioMeasurementTime object is destructed, this destructor resets the measurement time to 0.
Private Members
-
uint32_t mTime = 0
The measurement time in ms. 0 means infinite.
Private Static Functions
-
static GpioMeasurementTime &getInstanceImpl(int mem = 0)
The implementation of getInstance 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 &getInstance()
The implementation of getInstance with parameters.
- Returns:
The instance of of the GPIO object.
-
GpioMeasurementTime() = delete
Package size GPIO Class
-
class GpioPackageSize : public nexmess::components::gpio::Gpio
The GpioPackageSize class represents a GPIO interface especially for the GPIO to set the package size for the counter.
This class inherits from the Gpio class and provides functionality for setting the package size. It is a singleton class, meaning that only one instance of this class can exist.
Public Functions
-
GpioPackageSize() = delete
-
GpioPackageSize(const GpioPackageSize&) = delete
-
void operator=(const GpioPackageSize&) = delete
Public Static Functions
-
static void init(int mem)
Initializes the GpioPackageSize instance with the specified memory address.
- Parameters:
mem – The memory address to be used for GPIO operations.
-
static void setPackageSizeC1(uint32_t packageSize)
Sets the package size for channel 1.
- Parameters:
packageSize – The package size.
-
static uint32_t getPackageSizeC1()
Gets the package size for channel 1.
- Returns:
The package size.
-
static void setPackageSizeC2(uint32_t packageSize)
Sets the package size for channel 2.
- Parameters:
packageSize – The package size.
-
static uint32_t getPackageSizeC2()
Gets the package size for channel 2.
- Returns:
The package size.
-
static bool hasError()
Checks if any error has occurred during GPIO operations.
- Returns:
true if an error has occurred, false otherwise.
Private Functions
-
GpioPackageSize(int mem)
Constructor for the GpioPackageSize class.
The value is set to 524288 by default.
- Parameters:
mem – The memory address to be used for the GPIO operations.
-
GpioPackageSize(GpioPackageSize&&) = delete
-
GpioPackageSize &operator=(GpioPackageSize&&) = delete
-
~GpioPackageSize()
Destructor for the GpioPackageSize class.
Before the GpioPackageSize object is destructed, the value is set to 524288 in hardware.
Private Members
-
uint32_t mPackageSizeC1 = DEFAULT_PACKAGE_SIZE
Package size for channel 1.
-
uint32_t mPackageSizeC2 = DEFAULT_PACKAGE_SIZE
Package size for channel 2.
Private Static Functions
-
static GpioPackageSize &getInstanceImpl(int mem = 0)
The implementation of getInstance 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 GpioPackageSize &getInstance()
The implementation of getInstance with parameters.
- Returns:
The instance of of the GPIO object.
-
GpioPackageSize() = delete
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 yount.
Public Functions
-
GpioSignalCount(uint32_t registerBase, int mem)
Constructor for the GpioSignalCount class.
This constructor initializes a new GpioSignalCount. The signal count is initialized to DEFAULT_SIGNAL_COUNT.
- Parameters:
registerBase – The register base address.
mem – The memory address to be used for the GPIO operations.
-
~GpioSignalCount() = default
-
uint64_t getSignalCount()
Gets the signal count.
- Returns:
The signal count.
Private Functions
-
GpioSignalCount(GpioSignalCount&&) = delete
-
GpioSignalCount &operator=(GpioSignalCount&&) = delete
-
GpioSignalCount() = delete
-
GpioSignalCount(const GpioSignalCount&) = delete
-
void operator=(const GpioSignalCount&) = delete
-
GpioSignalCount(uint32_t registerBase, int mem)