CDT I-BM API 1.0.0
|
Class for managing the Ion Beam Monitor API (CdtIonBMAPI). More...
#include <cdtIbmApi.h>
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 |
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.
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.
[in] | rmmApi | Pointer to the RMMAPI instance used for communication and management of the RMM |
[in] | ring | The ring number. |
[in] | node | The node number. |
[in] | version | Version selector for tia board version:
|
[in] | name | The name to identify the front-end instance. |
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.
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).
[in] | enable | Set to true to enable emulated ADC data; false to disable it. |
uint8_t CdtIonBMAPI::getADCSummation | ( | ) |
Retrieves the summation over 'n' ADC samples.
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.
uint32_t CdtIonBMAPI::getFirmwareHash | ( | ) |
Retrieves the ESS firmware hash.
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>".
double CdtIonBMAPI::getSamplingPeriod | ( | ) |
Retrieves the current sampling period.
Reads the TIA SERDES sampling register and converts the value to microseconds.
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.
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.
bool CdtIonBMAPI::isHVRampRunning | ( | ) | const |
Checks if the high-voltage (HV) ramp process is currently running.
bool CdtIonBMAPI::isMeasRunning | ( | ) |
Checks if the measurement is currently running.
bool CdtIonBMAPI::isStopHVRequested | ( | ) | const |
Checks if a stop request has been issued.
void CdtIonBMAPI::measurementEnable | ( | bool | enable | ) |
Enables or disables the measurement process.
[in] | enable | Set to true to start measurement, false to stop it. |
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.
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.
[in] | value | The number of consecutive samples to sum (must be in [1, 32]). |
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.
[in] | value | The 24-bit ADC value to emulate. |
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.
[in] | sampling | Sampling period in microseconds. |
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.
[in] | value | The counter stop value to set. |
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".
[in] | seconds | The desired integration window duration in seconds. |
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.
[in] | voltage | The target voltage to set. |
[in] | voltagePerSec | The rate at which voltage should change (volts per second). |