CDT I-BM API 1.0.0
Loading...
Searching...
No Matches
CdtIonBMAPI Class Reference

Class for managing the Ion Beam Monitor API (CdtIonBMAPI). More...

#include <cdtIbmApi.h>

Inheritance diagram for CdtIonBMAPI:
Collaboration diagram for CdtIonBMAPI:

Public Member Functions

 CdtIonBMAPI (RMMAPI *rmmApi, int ring, int node, TiaBoardVersion tia_board_version, std::string name)
 Constructor for the CdtIonBMAPI class.
 
void configFE ()
 Configures the FEN with default values.
 
std::string getFirmwareVersionLegacy ()
 Retrieves the legacy firmware version.
 
uint32_t getFirmwareHash ()
 Retrieves the ESS firmware hash.
 
double readHV ()
 Reads the measured voltage from the HV chip via I2C.
 
void writeHV (const double voltage, const double voltagePerSec)
 Writes a voltage value to the HV chip, ensuring proper enabling and smooth ramping.
 
bool isHVRampRunning () const
 Checks if the high-voltage (HV) ramp process is currently running.
 
void measurementEnable (bool enable)
 Enables or disables the measurement process.
 
bool isMeasRunning ()
 Checks if the measurement is currently running.
 
double getWindowTime ()
 Retrieves the current integration window time from the CDRE board.
 
void setWindowTime (double seconds)
 Sets the integration window time for the CDRE board.
 
void requestHVStop ()
 Requests to stop ongoing operations.
 
void resetHVStop ()
 Resets the stop request flag, allowing operations to continue.
 
bool isStopHVRequested () const
 Checks if a stop request has been issued.
 
rmmStatus setSamplingPeriod (double sampling)
 Sets the sampling period in microseconds.
 
double getSamplingPeriod ()
 Retrieves the current sampling period.
 
rmmStatus setSumCounterStop (uint32_t value)
 Sets the TIA SERDES sum counter stop value.
 
rmmStatus setADCSummation (uint8_t value)
 Sets the summation over 'n' consecutive ADC samples.
 
uint8_t getADCSummation ()
 Retrieves the summation over 'n' ADC samples.
 
rmmStatus enableEmulateADCData (bool enable)
 Enables or disables emulation of ADC data.
 
rmmStatus setEmulatedADCValue (uint32_t value)
 Sets the emulated ADC value.
 
RMMResult isEmulatedADCDataEnabled ()
 Checks whether ADC data emulation is currently enabled.
 
RMMResult getEmulatedADCValue ()
 Retrieves the current emulated ADC value.
 
RMMResult setADCDataInjection (bool enable, uint32_t value)
 
TiaBoardVersion getTiaBoardVersion () const
 
const std::string & getTiaBoardVersionLabel () const
 

Detailed Description

Class for managing the Ion Beam Monitor API (CdtIonBMAPI).

The CdtIonBMAPI class is responsible for managing the front-end configuration and controlling high-voltage (HV) operations for the I-BM frontend node.

Constructor & Destructor Documentation

◆ CdtIonBMAPI()

CdtIonBMAPI::CdtIonBMAPI ( RMMAPI * rmmApi,
int ring,
int node,
TiaBoardVersion version,
std::string name )

Constructor for the CdtIonBMAPI class.

Initializes a new instance of the CdtIonBMAPI class by calling the constructor of the FrontEndBase class to set up the base class parameters and configuration.

Parameters
[in]rmmApiPointer to the RMMAPI instance used for communication and management of the RMM
[in]ringThe ring number.
[in]nodeThe node number.
[in]versionVersion selector for tia board version:
  • 0: Use tia_board_version_3_0
  • 1: Use tia_board_version_3_2
[in]nameThe name to identify the front-end instance.

Member Function Documentation

◆ configFE()

void CdtIonBMAPI::configFE ( )

Configures the FEN with default values.

This function is used to configure the FEN by performing the setup tasks related to the system.

◆ enableEmulateADCData()

rmmStatus CdtIonBMAPI::enableEmulateADCData ( bool enable)

Enables or disables emulation of ADC data.

This method sets bit 31 of the tia_adc_control register to either enable or disable ADC data emulation. A value of true sets the bit to 1 (enabled), while false sets it to 0 (disabled).

Parameters
[in]enableSet to true to enable emulated ADC data; false to disable it.
Returns
rmmStatus indicating success or failure of the operation.

◆ getADCSummation()

uint8_t CdtIonBMAPI::getADCSummation ( )

Retrieves the summation over 'n' ADC samples.

Returns
Summation over 'n' ADC samples value.

◆ getEmulatedADCValue()

RMMResult CdtIonBMAPI::getEmulatedADCValue ( )

Retrieves the current emulated ADC value.

Reads bits 23 downto 0 of the tia_adc_control register to obtain the current emulated ADC value.

Returns
RMMResult containing the 24-bit emulated ADC value and the status of the read operation.

◆ getFirmwareHash()

uint32_t CdtIonBMAPI::getFirmwareHash ( )

Retrieves the ESS firmware hash.

Returns
A uint32_t hash value.

◆ getFirmwareVersionLegacy()

std::string CdtIonBMAPI::getFirmwareVersionLegacy ( )

Retrieves the legacy firmware version.

This method reads the major and minor firmware version values from the status register and constructs a version string in the format "v<major>.<minor>".

Returns
A string representing the legacy firmware version.

◆ getSamplingPeriod()

double CdtIonBMAPI::getSamplingPeriod ( )

Retrieves the current sampling period.

Reads the TIA SERDES sampling register and converts the value to microseconds.

Returns
The sampling period in microseconds, or -1.0 if the read fails.

◆ getWindowTime()

double CdtIonBMAPI::getWindowTime ( )

Retrieves the current integration window time from the CDRE board.

This method reads the 64-bit cycle count from hardware registers "meas_abs_time_stop_low" and meas_abs_time_stop_high, reconstructs the full value, and converts it back to a time value in seconds based on the 100 ns measurement cycle duration used by the CDRE board.

Returns
The current integration window time in seconds.

◆ isEmulatedADCDataEnabled()

RMMResult CdtIonBMAPI::isEmulatedADCDataEnabled ( )

Checks whether ADC data emulation is currently enabled.

Reads bit 31 of the tia_adc_control field to determine the emulation status. A value of 1 indicates that emulation is enabled, while 0 means it is disabled.

Returns
RMMResult containing the bit value (1 or 0) and the status of the read operation.

◆ isHVRampRunning()

bool CdtIonBMAPI::isHVRampRunning ( ) const

Checks if the high-voltage (HV) ramp process is currently running.

Returns
True if the HV ramp process is running, false otherwise.

◆ isMeasRunning()

bool CdtIonBMAPI::isMeasRunning ( )

Checks if the measurement is currently running.

Returns
True if measurement is active, false otherwise.

◆ isStopHVRequested()

bool CdtIonBMAPI::isStopHVRequested ( ) const

Checks if a stop request has been issued.

Returns
True if a stop request has been issued, false otherwise.

◆ measurementEnable()

void CdtIonBMAPI::measurementEnable ( bool enable)

Enables or disables the measurement process.

Parameters
[in]enableSet to true to start measurement, false to stop it.

◆ readHV()

double CdtIonBMAPI::readHV ( )

Reads the measured voltage from the HV chip via I2C.

This method initiates an I2C request to read the measured voltage from the HV chip. It continuously checks the status register until the request is complete. The response is then processed to extract the voltage value.

Returns
The measured voltage in volts.

◆ setADCSummation()

rmmStatus CdtIonBMAPI::setADCSummation ( uint8_t value)

Sets the summation over 'n' consecutive ADC samples.

The mca_sum_counter_stop field defines how many consecutive 24-bit ADC values are summed together. To avoid overflow, the maximum number of samples that can be safely accumulated is 32.

This method ensures the provided value is within the valid range [1, 32]. A value of 0 is considered invalid and will be rejected. Upon successful validation, the value is written to bits 32 downto 24 of the mca_base register.

Parameters
[in]valueThe number of consecutive samples to sum (must be in [1, 32]).
Returns
rmmStatus indicating success or failure of the operation.

◆ setEmulatedADCValue()

rmmStatus CdtIonBMAPI::setEmulatedADCValue ( uint32_t value)

Sets the emulated ADC value.

Writes the specified 24-bit value into bits 23 downto 0 of the tia_adc_control field. This value is used during ADC data emulation.

Parameters
[in]valueThe 24-bit ADC value to emulate.
Returns
rmmStatus indicating success or failure of the operation.

◆ setSamplingPeriod()

rmmStatus CdtIonBMAPI::setSamplingPeriod ( double sampling)

Sets the sampling period in microseconds.

This method ensures the provided value is within the valid range [1.2us, 132.2us]. Upon successful validation, the us is converted to uint16 value and written to bits 23 downto 8 of the tia_serdes_base register.

Parameters
[in]samplingSampling period in microseconds.
Returns
rmmStatus indicating success or failure.

◆ setSumCounterStop()

rmmStatus CdtIonBMAPI::setSumCounterStop ( uint32_t value)

Sets the TIA SERDES sum counter stop value.

Writes the specified value to bits 32 downto 24 of the tia_serdes_base register.

Parameters
[in]valueThe counter stop value to set.
Returns
rmmStatus indicating success or failure.

◆ setWindowTime()

void CdtIonBMAPI::setWindowTime ( double seconds)

Sets the integration window time for the CDRE board.

This method converts a time value in seconds into the corresponding number of measurement cycles based on the CDRE board's timing resolution (100 ns per cycle). The resulting 64-bit cycle count is split into two 32-bit parts and written to hardware registers "meas_abs_time_stop_low" and "meas_abs_time_stop_high".

Parameters
[in]secondsThe desired integration window duration in seconds.

◆ writeHV()

void CdtIonBMAPI::writeHV ( const double voltage,
const double voltagePerSec )

Writes a voltage value to the HV chip, ensuring proper enabling and smooth ramping.

This method first determines whether the HV should be enabled or disabled based on the desired voltage. If the voltage is below 10V, the HV is disabled. Otherwise, the method ensures a smooth transition by checking the control register and writing the necessary values to safely apply the voltage.

Parameters
[in]voltageThe target voltage to set.
[in]voltagePerSecThe rate at which voltage should change (volts per second).

The documentation for this class was generated from the following files: