RMM API 2.0.0
Loading...
Searching...
No Matches
RMMAPI Class Reference

Base class for controlling and monitoring the RMM system. More...

#include <RMMApi.h>

Collaboration diagram for RMMAPI:

Public Types

enum class  LEMOImpedance : uint8_t { IMP_100K_OHM , IMP_50_OHM }
 Enum class representing the possible impedance values for LEMO connectors. More...
 
enum class  LogTopic : uint8_t {
  ALL , RMM_API , REGISTER_ACCESS , CLOCK ,
  OUTPUT_QUEUES , RAILS , RINGS , UDP_CORE ,
  SIDE_CHANNELS
}
 Enum class representing the possible logging topics in the RMM. More...
 

Public Member Functions

 RMMAPI (const std::string &serverIP, int serverPort, const char *configFile)
 Constructs an RMMAPI object and initializes the system.
 
RMMRegisterAccessgetRMMRegAccess ()
 Provides access to the RMM register interface.
 
TopologygetTopology ()
 Provides access to the topology structure.
 
void loadConfig (const std::string &cfgJsonPath)
 Loads the RMM configuration from a JSON file.
 
rmmStatus fillDetectorConfigFromJson (json &detectorConfig)
 Fills the detector configuration from a JSON object.
 
double getTemperature ()
 Gets the temperature of the RMM FPGA.
 
rmmStatus enablePowerMonitoring (int interval_ms)
 Enables the internal state machine to start reading out the Voltage, Current, and Power of various power rails on the VCU118.
 
rmmStatus disablePowerMonitoring ()
 Disables the internal state machine that reads out the power rail information.
 
rmmStatus tearDownAllRings ()
 Teardown all possible rings.
 
rmmStatus tearDownRing (int ring, bool waitTime)
 Teardown a specific ring of the RMM.
 
rmmStatus setupAllClocks (TimingMode timingMode)
 Setup all clocks and the timing system.
 
rmmStatus configUDPCore ()
 Configure the UDP Core with the configuration storaged into udpCore struct.
 
rmmStatus bringUpAllRings ()
 Initializes and configures all active rings.
 
rmmStatus bringUpAllRingsInSequence ()
 Initializes and configures all active rings, one by one.
 
rmmStatus checkRings ()
 Perform a slow control read from all FEs in the topology to confirm the ring is active.
 
rmmStatus configOutputQueues ()
 Configures the output queues for data processing.
 
rmmStatus readyForBulkData ()
 Inform all FEs in the topology that they can start sending bulk data.
 
rmmStatus configAllFE ()
 Configures all front-end nodes in the topology.
 
rmmStatus getTimingStatus (TimingStatus *time)
 Get the status of the timestamping system (including the embedded EVR) in the RMM.
 
rmmStatus getCurrentTiming (uint32_t *currentTime)
 Get the current timestamping for RMM.
 
rmmStatus getFirmwareInfo (std::unordered_map< std::string, std::string > *info)
 Gets the firmware information, including FPGA DNA, git hash, and build time.
 
rmmStatus getRegBankVersion (RegBankVersion *banks)
 Gets the register bank version details for the different register banks.
 
rmmStatus config (TimingMode timingMode=TimingMode::LCL, BringUpMode=BringUpMode::CONCURRENT, uint32_t eventCode=0x10)
 Configures the RMM for operation.
 
rmmStatus resetPacketCounters ()
 Reset all packet counters back to 0. Useful if the counters start saturating at 0xFFFF_FFFF.
 
rmmStatus getPacketCounters (PacketCountMap *packets)
 Return the updated packet counters.. There are 2 types of counters, one set that counts the per-fibre (odd and even) bulk data packets, and then one set that counts per-node in the output queues.
 
rmmStatus arpStatus (const int index, std::unordered_map< std::string, int > *status)
 Get the ARP status.
 
rmmStatus getPowerVoltageCurrent (float voltageTolerancePercent, PowerResultsMap *result)
 Gets the power, voltage, and current for all INA226 sensors on the VCU118.
 
rmmStatus getOutputQueuesData (const int ring, std::shared_ptr< OutputQueueBase > &result)
 Retrieves the output queue data for a specific ring.
 
rmmStatus getUDPCoreData (UDPCoreData *result)
 Retrieve the UDP core configuration data.
 
rmmStatus configSideChannels ()
 Configures all side channels based on stored settings.
 
rmmStatus getSideChannelStats (SideChannelStatsData &stats)
 Retrieves statistics for the side channels.
 
rmmStatus getSideChannelPacketCounters (const uint8_t sideChIdx, uint32_t *value)
 Retrieves the packet counter value for a specific side channel.
 
rmmStatus fetchSideChannelData (const uint8_t sideChIdx, SideChannelsData &data)
 Fetches and populates the data for a specific side channel.
 
rmmStatus setLEMOTermination (const uint8_t inLEMOIdx, LEMOImpedance impedance)
 Sets the termination impedance for a specified LEMO input. Each bit in the gpio_input_term value corresponds to the termination impedance of a LEMO input. Bit 0 -> LEMO IN0, Bit 1 -> LEMO IN1, etc.
 
rmmStatus getLEMOTermination (const uint8_t inLEMOIdx, LEMOImpedance &impedance)
 Retrieves the termination impedance for a specified LEMO input.
 
rmmStatus getLogMsg (std::string *msg, LogTopic topic=LogTopic::RMM_API)
 Retrieves the latest log message for the specified log topic.
 
void allLogRelays (std::string logLevel, FILE *out)
 Relays log output to a specified file for all RMM components.
 
rmmStatus setLogMasks (int logMask, LogTopic topic=LogTopic::ALL)
 Sets the log mask for the specified log topic.
 
void setAllLogTimeouts (int milliseconds)
 Sets the log timeout for all components.
 
void setAllFileWriteTimeouts (int milliseconds)
 Sets the file write timeout for all components.
 
int getPollTimeout ()
 Gets the timeout for polling in seconds.
 
void setPollTimeout (int value)
 Sets the timeout for polling in seconds. Timeout starts counting after the polling exceeds initial estimated, not at start of polling.
 
rmmStatus setLogFilePathAll (std::string filePath, bool useName=false)
 Sets the log file path for all components.
 
rmmStatus setLogFilePathAll (std::string path, std::string name)
 Sets the log file path for all components with a custom file name.
 
rmmStatus setWriteToFileAll (bool option, char mode='w')
 Enables or disables writing to log files for all components *.
 
void requestStop ()
 Requests to stop ongoing operations in the RMM system.
 
RMMResult regRead (const std::string &regName, RegisterTag tag=RegisterTag::ALL)
 Reads a register value by its name from the register map.
 
RMMResult regRead (uint32_t address)
 Reads a register value using its address.
 
RMMResult regWrite (const std::string &regName, uint32_t data, RegisterTag tag=RegisterTag::ALL)
 Writes a value to a named register.
 
RMMResult regWrite (uint32_t address, uint32_t data)
 Performs a write operation to a register using its address.
 
RMMResult fieldRead (const std::string &reg, RegisterTag tag, int bitBegin, int bitWidth)
 Reads a field from a register in the RMM space using a register name.
 
RMMResult fieldRead (uint32_t reg, int bitBegin, int bitWidth)
 
RMMResult fieldWrite (const std::string &reg, RegisterTag tag, int bitBegin, int bitWidth, uint32_t data)
 Writes a field to a register in the RMM space using a register name.
 
RMMResult fieldWrite (uint32_t reg, int bitBegin, int bitWidth, uint32_t data)
 Writes a field to a register in the RMM space using a register address.
 
bool isLegacyFW ()
 Checks if the FW version is legagy (Non UDP Core version).
 
const std::vector< DetectorConfig > & getDetectorConfigs () const
 Retrieves the list of detector configurations.
 

Public Attributes

RMMLog rmmLog
 Log handler for RMM API messages.
 
json jsonConfigData
 Stores the JSON configuration data.
 

Detailed Description

Base class for controlling and monitoring the RMM system.

The RMMAPI class serves as the primary interface for interacting with various RMM components. It acts as a wrapper for the underlying component classes, providing a unified API for system control, monitoring, and configuration

Member Enumeration Documentation

◆ LEMOImpedance

enum class RMMAPI::LEMOImpedance : uint8_t
strong

Enum class representing the possible impedance values for LEMO connectors.

  • IMP_100K_OHM: Represents 100K Ohm impedance [High impedance].
  • IMP_50_OHM: Represents 50 Ohm impedance.

◆ LogTopic

enum class RMMAPI::LogTopic : uint8_t
strong

Enum class representing the possible logging topics in the RMM.

  • ALL: Retrieves all log messages.
  • RMM_API: Logs related to the RMM API.
  • REGISTER_ACCESS: Logs related to register access operations.
  • CLOCK: Logs related to clock configuration and management.
  • OUTPUT_QUEUES: Logs related to output queue operations.
  • RAILS: Logs related to power rails.
  • RINGS: Logs related to the RMM ring management.
  • UDP_CORE: Logs related to the UDP core module.
  • SIDE_CHANNELS: Logs related to side-channel communications.

Constructor & Destructor Documentation

◆ RMMAPI()

RMMAPI::RMMAPI ( const std::string & serverIP,
int serverPort,
const char * configFile )

Constructs an RMMAPI object and initializes the system.

This constructor initializes the RMMAPI class by setting up logging, establishing register access, and configuring various system components. It also loads the configuration from the provided JSON file.

Parameters
[in]serverIPThe IP address of the RMM.
[in]serverPortThe port number of the RMM.
[in]configFilePath to the configuration file.

Member Function Documentation

◆ allLogRelays()

void RMMAPI::allLogRelays ( std::string logLevel,
FILE * out )

Relays log output to a specified file for all RMM components.

This method configures logging redirection for multiple subsystems, setting the log output file for the specified log level.

Parameters
[in]logLevelThe log level to be redirected. Valid values are: "debug", "info", "warn", "error", "critical".
[in]outThe file pointer where the logs should be written.
Exceptions
std::invalid_argumentIf an invalid log level is provided.

◆ arpStatus()

rmmStatus RMMAPI::arpStatus ( const int index,
std::unordered_map< std::string, int > * status )

Get the ARP status.

Parameters
indexThe index of the ARP status entry.
statusPointer to std::unordered_map<std::string, int> to be populated with status info.
Returns
rmmStatus success

◆ bringUpAllRings()

rmmStatus RMMAPI::bringUpAllRings ( )

Initializes and configures all active rings.

This method performs the setup required to bring up all rings in the system. It first calls commonRingSetup() to apply common configurations, then iterates over all active rings retrieved from the topology and asynchronously executes ringSetup() for each ring.

The setup tasks are executed concurrently using std::async to improve performance, and the method waits for all tasks to complete before returning.

◆ bringUpAllRingsInSequence()

rmmStatus RMMAPI::bringUpAllRingsInSequence ( )

Initializes and configures all active rings, one by one.

same as RMMRings::bringUpAllRings, but with sequential execution. Intended to be used by developers who want to troubleshoot problematic ring so that error logs are not flooded by other rings that are working well.

◆ checkRings()

rmmStatus RMMAPI::checkRings ( )

Perform a slow control read from all FEs in the topology to confirm the ring is active.

Returns
ringStatus An enumeration indicating the status of the operation.
See also
ringStatus

◆ config()

rmmStatus RMMAPI::config ( TimingMode timingMode = TimingMode::LCL,
BringUpMode bringUpMode = BringUpMode::CONCURRENT,
uint32_t eventCode = 0x10 )

Configures the RMM for operation.

This method performs a series of initialization and configuration steps to prepare the RMM for operation. The setup includes disabling power monitoring, configuring clocks, bringing up all rings, configuring UDP cores, setting up output queues, and configuring front-end components.

The method executes certain operations asynchronously for efficiency, including tearing down all rings and setting up clocks.

Parameters
[in]timingModeThe timing mode to be used for clock configuration.

The following TimingMode values are supported:

  • MRF: Mode for MRF-based timing configuration.
  • LCL: Local mode for internal clock synchronization.
  • EXT: External mode for using external clock sources.

If the timingMode is omitted, LCL (Local mode) is selected by default.

Parameters
[in]bringUpModeThe bringup mode to be used for ring configuration.

The following TimingMode values are supported:

  • CONCURRENT: Run ring bringup in parallel for all rings on topology.
  • SEQUENCTIAL: Run ring bringup one by one.

If the bringUpMode is omitted, CONCURRENT is selected by default.

Parameters
[in]eventCodeThe EVR event code to be used on MRF timing configuration. If the eventCode is omitted, 0x10 (event16) is selected by default.
Returns
rmmStatus Returns rmmSuccess upon successful configuration.

◆ configAllFE()

rmmStatus RMMAPI::configAllFE ( )

Configures all front-end nodes in the topology.

This method iterates through all entries in the topology and calls the configFE() method on each front-end instance, thereby configuring all front-end nodes in the system.

The topology is retrieved using the getTopology() method, and each front-end entry is accessed to perform the configuration.

Returns
rmmStatus Returns rmmSuccess upon successful configuration of all front-end nodes.

◆ configOutputQueues()

rmmStatus RMMAPI::configOutputQueues ( )

Configures the output queues for data processing.

This method sets up the output queues by writing appropriate values to hardware registers. It first disables all output queues and packet generators before applying configuration settings. The method then iterates through all available output queues, applying necessary configurations based on the OutputQueueData structure.

◆ configSideChannels()

rmmStatus RMMAPI::configSideChannels ( )

Configures all side channels based on stored settings.

This method disables both side channels before applying configurations to ensure synchronization with the JSON configuration file. It then iterates through all side channels and applies their respective settings.

Returns
rmmStatus Returns rmmSuccess on successful configuration, or rmmError if any side channel fails to configure.

◆ configUDPCore()

rmmStatus RMMAPI::configUDPCore ( )

Configure the UDP Core with the configuration storaged into udpCore struct.

◆ disablePowerMonitoring()

rmmStatus RMMAPI::disablePowerMonitoring ( )

Disables the internal state machine that reads out the power rail information.

Returns
status.

◆ enablePowerMonitoring()

rmmStatus RMMAPI::enablePowerMonitoring ( int interval_ms)

Enables the internal state machine to start reading out the Voltage, Current, and Power of various power rails on the VCU118.

Parameters
interval_msinterval between updates.
Returns
status.

◆ fetchSideChannelData()

rmmStatus RMMAPI::fetchSideChannelData ( const uint8_t sideChIdx,
SideChannelsData & data )

Fetches and populates the data for a specific side channel.

Parameters
[in]sideChIdxThe index of the side channel to fetch data for (0-based). Valid range is 0 to NUMBER_SIDE_CHANNELS - 1.
[out]dataA reference to a SideChannelsData structure where the fetched data will be stored.
Returns
rmmSuccess if the operation was successful.
rmmError if the sideChIdx is out of the valid range or any other error occurs.

◆ fieldRead() [1/2]

RMMResult RMMAPI::fieldRead ( const std::string & reg,
RegisterTag tag,
int bitBegin,
int bitWidth )

Reads a field from a register in the RMM space using a register name.

This method reads a field from the specified register, identified by its name (reg). The requested field is extracted based on the bit index (bitBegin) and the field width (bitWidth).

Parameters
[in]regThe name of the register to read from.
[in]tagThe tag identifying which address map to use. Valid values for tag are defined in the RMMRegisterAccess::RegisterTag enum class.
[in]bitBeginThe index of the lowest bit in the register that is part of the field.
[in]bitWidthThe width of the field in bits.
Returns
RMMResult The result of the write operation, containing:
  • value: The final register value after modification.
  • status: The status of the operation (e.g., rmmSuccess or an error status).
Exceptions
std::invalid_argumentIf any of the following conditions are met:
  • The field width (bitWidth) is greater than 32 bits.
  • The sum of bitBegin and bitWidth exceeds 32 bits.
  • The bitWidth is 0.

◆ fieldRead() [2/2]

RMMResult RMMAPI::fieldRead ( uint32_t reg,
int bitBegin,
int bitWidth )

◆ fieldWrite() [1/2]

RMMResult RMMAPI::fieldWrite ( const std::string & reg,
RegisterTag tag,
int bitBegin,
int bitWidth,
uint32_t data )

Writes a field to a register in the RMM space using a register name.

Parameters
[in]regThe name of the register to write to.
[in]tagThe tag identifying which address map to use. Valid values for tag are defined in the RMMRegisterAccess::RegisterTag enum class.
[in]bitBeginThe index of the lowest bit in the register that is part of the field.
[in]bitWidthThe width of the field in bits.
[in]dataThe data to write to the field.
Returns
RMMResult The result of the write operation, containing:
  • value: The final register value after modification.
  • status: The status of the operation (e.g., rmmSuccess or an error status).
Exceptions
std::invalid_argumentIf any of the following conditions are met:
  • The field width (bitWidth) is greater than 32 bits.
  • The sum of bitBegin and bitWidth exceeds 32 bits.
  • The bitWidth is 0.

◆ fieldWrite() [2/2]

RMMResult RMMAPI::fieldWrite ( uint32_t reg,
int bitBegin,
int bitWidth,
uint32_t data )

Writes a field to a register in the RMM space using a register address.

Parameters
[in]regThe numerical address of the register to write to.
[in]bitBeginThe index of the lowest bit in the register that is part of the field.
[in]bitWidthThe width of the field in bits.
[in]dataThe data to write to the field.
Returns
RMMResult The result of the write operation, containing:
  • value: The final register value after modification.
  • status: The status of the operation (e.g., rmmSuccess or an error status).
Exceptions
std::invalid_argumentIf any of the following conditions are met:
  • The field width (bitWidth) is greater than 32 bits.
  • The sum of bitBegin and bitWidth exceeds 32 bits.
  • The bitWidth is 0.

◆ fillDetectorConfigFromJson()

rmmStatus RMMAPI::fillDetectorConfigFromJson ( json & detectorConfig)

Fills the detector configuration from a JSON object.

This method parses a JSON configuration describing detectors and their associated ring topologies.

The resulting configuration objects are stored in the class member detConfigs.

Parameters
[in]detectorConfigReference to a JSON object containing the detector configuration.
Returns
rmmStatus
  • rmmSuccess if the configuration was successfully parsed and stored.
  • rmmError if parsing failed or an exception occurred.
Exceptions
std::exceptionIf any error occurs during parsing, it is caught internally and logged via rmmLog, and the method returns rmmError.

◆ getCurrentTiming()

rmmStatus RMMAPI::getCurrentTiming ( uint32_t * currentTime)

Get the current timestamping for RMM.

Parameters
currentTimepointer to current time.
Returns
rmmStatus

◆ getDetectorConfigs()

const std::vector< DetectorConfig > & RMMAPI::getDetectorConfigs ( ) const
inline

Retrieves the list of detector configurations.

Returns
const reference to the vector of DetectorConfig objects.

◆ getFirmwareInfo()

rmmStatus RMMAPI::getFirmwareInfo ( std::unordered_map< std::string, std::string > * info)

Gets the firmware information, including FPGA DNA, git hash, and build time.

Parameters
[out]infoPointer to a std::unordered_map<std::string, std::string> to store the firmware information. The map will contain:
  • "vcu118_dna": Hex string of RMM FPGA DNA (96-bit internal serial number).
  • "git_hash": Hex string of the first 96 bits of the 'dgro_master' git hash.
  • "build_time": Build time of RMM firmware in human-readable format.
Returns
rmmStatus indicating success or failure.

◆ getLEMOTermination()

rmmStatus RMMAPI::getLEMOTermination ( const uint8_t inLEMOIdx,
LEMOImpedance & impedance )

Retrieves the termination impedance for a specified LEMO input.

Parameters
[in]inLEMOIdxThe index of the LEMO input to query. Valid values are 0, 1, 2, or 3.
[out]impedanceA reference to a LEMOImpedance enum where the retrieved impedance will be stored.
Returns
  • rmmSuccess if the termination impedance was successfully retrieved.
  • rmmError if the specified LEMO index is invalid or if the read operation fails.

◆ getLogMsg()

rmmStatus RMMAPI::getLogMsg ( std::string * msg,
LogTopic topic = LogTopic::RMM_API )

Retrieves the latest log message for the specified log topic.

Parameters
[out]msgA pointer to a string where the log message will be stored.
[in]topicThe log topic to retrieve the message for. Valid topics include are defined on RMMAPI::LogTopic.
Returns
rmmStatus Returns rmmSuccess if the message was successfully retrieved, or rmmError if the topic is invalid.

◆ getOutputQueuesData()

rmmStatus RMMAPI::getOutputQueuesData ( const int ring,
std::shared_ptr< OutputQueueBase > & result )

Retrieves the output queue data for a specific ring.

Parameters
[in]ringThe ring identifier.
[out]resultPointer to store the output queue data.
Returns
rmmSuccess if the ring is found, rmmError otherwise.

◆ getPacketCounters()

rmmStatus RMMAPI::getPacketCounters ( PacketCountMap * packets)

Return the updated packet counters.. There are 2 types of counters, one set that counts the per-fibre (odd and even) bulk data packets, and then one set that counts per-node in the output queues.

Parameters
packetspointer to packets counters map to be updated.
Returns
rmmStatus success

◆ getPollTimeout()

int RMMAPI::getPollTimeout ( )

Gets the timeout for polling in seconds.

Returns
timeout for polling in seconds after estimated time.

◆ getPowerVoltageCurrent()

rmmStatus RMMAPI::getPowerVoltageCurrent ( float voltageTolerancePercent,
PowerResultsMap * result )

Gets the power, voltage, and current for all INA226 sensors on the VCU118.

Internal power monitoring must be enabled first using enablePowerMonitoring(interval_ms) to set the internal polling interval.

Parameters
voltageTolerancePercentPercent tolerance of voltage from expected values (default = 1.0).
resultPointer to a PowerResultsMap that will be filled with power, voltage, and current data for all sensors.
Returns
Dictionary with the following entry for each sensor: "$sensor": { "V" : Voltage in Volts (float), "V_OK" : Voltage within tolerance (bool), "A" : Current in Amperes (float), "W" : Power in Watts (float) }

◆ getRegBankVersion()

rmmStatus RMMAPI::getRegBankVersion ( RegBankVersion * banks)

Gets the register bank version details for the different register banks.

Parameters
[out]banksPointer to a RegBankVersion structure where the register bank versions will be populated.
Returns
rmmStatus indicating success or failure.

◆ getRMMRegAccess()

RMMRegisterAccess & RMMAPI::getRMMRegAccess ( )
inline

Provides access to the RMM register interface.

This method returns a reference to the RMMRegisterAccess instance, allowing direct interaction with the underlying register access mechanism.

Returns
RMMRegisterAccess& Reference to the register access instance.

◆ getSideChannelPacketCounters()

rmmStatus RMMAPI::getSideChannelPacketCounters ( const uint8_t sideChIdx,
uint32_t * value )

Retrieves the packet counter value for a specific side channel.

Parameters
[in]sideChIdxThe side channel index for which the packet counter is requested. Valid indices are 0 and 1.
[out]valuePointer to a uint32_t variable where the packet counter value will be stored.
Returns
rmmSuccess if the packet counter was successfully retrieved.
rmmError if the side channel index is invalid.

◆ getSideChannelStats()

rmmStatus RMMAPI::getSideChannelStats ( SideChannelStatsData & stats)

Retrieves statistics for the side channels.

This method reads the frequency and overflow status for each side channel.

Parameters
[out]statsA reference to a SideChannelStatsData structure where the retrieved statistics will be stored.
Returns
rmmStatus Returns rmmSuccess upon successful retrieval of statistics.

◆ getTemperature()

double RMMAPI::getTemperature ( )

Gets the temperature of the RMM FPGA.

Returns
float Temperature in degrees Celsius of the hottest temperature sensor.

◆ getTimingStatus()

rmmStatus RMMAPI::getTimingStatus ( TimingStatus * time)

Get the status of the timestamping system (including the embedded EVR) in the RMM.

Parameters
timepointer to struct of timing status registers to be populated.
Returns
rmmStatus success

◆ getTopology()

Topology & RMMAPI::getTopology ( )
inline

Provides access to the topology structure.

This function returns a reference to the Topology instance managed by RMMAPI, allowing users to query the active topology, retrieve register maps, and obtain information about connected front-end nodes.

Returns
Reference to the Topology object.

◆ getUDPCoreData()

rmmStatus RMMAPI::getUDPCoreData ( UDPCoreData * result)

Retrieve the UDP core configuration data.

This function reads the hardware registers to populate a UDPCoreData structure with the current configuration of the UDP core.

Parameters
[out]resultPointer to a UDPCoreData structure to store the retrieved data.
Returns
rmmStatus.

◆ isLegacyFW()

bool RMMAPI::isLegacyFW ( )

Checks if the FW version is legagy (Non UDP Core version).

Returns
True if version is <= 1.0, false otherwise.

◆ loadConfig()

void RMMAPI::loadConfig ( const std::string & cfgJsonPath)

Loads the RMM configuration from a JSON file.

Reads the specified JSON configuration file and stores its contents in the jsonConfigData member. If the file does not exist or cannot be opened, an error is logged, and an exception is thrown.

Parameters
[in]cfgJsonPathPath to the JSON configuration file.
Exceptions
std::runtime_errorif the configuration file cannot be opened.

◆ readyForBulkData()

rmmStatus RMMAPI::readyForBulkData ( )

Inform all FEs in the topology that they can start sending bulk data.

◆ regRead() [1/2]

RMMResult RMMAPI::regRead ( const std::string & regName,
RegisterTag tag = RegisterTag::ALL )

Reads a register value by its name from the register map.

This method retrieves the address of the specified register using the register map and performs a raw read operation.

Parameters
[in]regNameThe name of the register to read from the register map.
[in]tag(Optional) The tag identifying which address map to use. If not specified, RegisterTag::ALL is assumed, and all maps are searched. Valid values for tag are defined in the RMMRegisterAccess::RegisterTag enum class.
Returns
A RMMResult object containing the register value and the status of the operation. If the register is not found, the value is set to 0, and the status indicates an error.

◆ regRead() [2/2]

RMMResult RMMAPI::regRead ( uint32_t address)

Reads a register value using its address.

This method formats the given 32-bit address as an 8-character uppercase hexadecimal string and performs a raw read using the RMMRegisterAccess instance.

Parameters
addressThe 32-bit address of the register to read.
Returns
An RMMResult containing the register value and the status of the operation. If the read fails, the status indicates an error.

◆ regWrite() [1/2]

RMMResult RMMAPI::regWrite ( const std::string & regName,
uint32_t data,
RegisterTag tag = RegisterTag::ALL )

Writes a value to a named register.

This method retrieves the address of the specified register using the register map and performs a write operation.

Parameters
[in]regNameThe name of the register to write to.
[in]dataThe 32-bit value to be written.
[in]tag(Optional) The tag identifying which address map to use. If not specified, RegisterTag::ALL is assumed, and all maps are searched. Valid values for tag are defined in the RMMRegisterAccess::RegisterTag enum class.
Returns
RMMResult containing the register value and the status of the write operation.

◆ regWrite() [2/2]

RMMResult RMMAPI::regWrite ( uint32_t address,
uint32_t data )

Performs a write operation to a register using its address.

This method formats the given 32-bit address as an 8-character uppercase hexadecimal string and performs a raw write using the RMMRegisterAccess instance.

Parameters
[in]addressThe 32-bit address of the register to read.
[in]dataThe 32-bit value to be written to the register.
Returns
An RMMResult containing the register value and the status of the operation. If the write fails, the status indicates an error.

◆ requestStop()

void RMMAPI::requestStop ( )

Requests to stop ongoing operations in the RMM system.

This method forwards the stop request to the RMMRegisterAccess instance, setting the stop flag to indicate that operations should be halted.

◆ resetPacketCounters()

rmmStatus RMMAPI::resetPacketCounters ( )

Reset all packet counters back to 0. Useful if the counters start saturating at 0xFFFF_FFFF.

◆ setAllFileWriteTimeouts()

void RMMAPI::setAllFileWriteTimeouts ( int milliseconds)

Sets the file write timeout for all components.

Parameters
[in]millisecondsThe timeout value in milliseconds.

◆ setAllLogTimeouts()

void RMMAPI::setAllLogTimeouts ( int milliseconds)

Sets the log timeout for all components.

Parameters
[in]millisecondsThe timeout value in milliseconds.

◆ setLEMOTermination()

rmmStatus RMMAPI::setLEMOTermination ( const uint8_t inLEMOIdx,
LEMOImpedance impedance )

Sets the termination impedance for a specified LEMO input. Each bit in the gpio_input_term value corresponds to the termination impedance of a LEMO input. Bit 0 -> LEMO IN0, Bit 1 -> LEMO IN1, etc.

Parameters
inLEMOIdxThe index of the LEMO input to configure. Valid values are 0, 1, 2, or 3.
impedanceThe desired termination impedance, represented as a LEMOImpedance enum.
Returns
  • rmmOK if the termination impedance was successfully set.
  • rmmError if the specified LEMO index is invalid or if the write operation fails.

◆ setLogFilePathAll() [1/2]

rmmStatus RMMAPI::setLogFilePathAll ( std::string filePath,
bool useName = false )

Sets the log file path for all components.

This method sets the log file path for all components by calling the setLogFilePath method on each component's rmmLog object. Refer to RMMLog::setLogFilePath for details on how the file path is set.

Parameters
[in]filePathThe directory path where the log file will be stored.
[in]useNameA flag indicating whether to use the default component name for the log file.
Returns
rmmStatus Returns rmmSuccess if the log file path is successfully set for all components, or rmmError if any component fails to set the path.

◆ setLogFilePathAll() [2/2]

rmmStatus RMMAPI::setLogFilePathAll ( std::string path,
std::string name )

Sets the log file path for all components with a custom file name.

This method sets the log file path for all components by calling the setLogFilePath method on each component's rmmLog object. The log file name is specified by the name parameter. Refer to RMMLog::setLogFilePath for more details.

Parameters
[in]pathThe directory path where the log file will be stored.
[in]nameThe custom name for the log file. This name will be used for all components.
Returns
rmmStatus Returns rmmSuccess if the log file path is successfully set for all components, or rmmError if any component fails to set the path.

◆ setLogMasks()

rmmStatus RMMAPI::setLogMasks ( int logMask,
LogTopic topic = LogTopic::ALL )

Sets the log mask for the specified log topic.

This method allows the user to set the log mask for different log topics. The log mask determines which types of log messages are captured.

Parameters
[in]logMaskThe log mask to be set (should be between 0 and 31).
[in]topicThe log topic for which the log mask should be set. This can be one of the values from the RMMAPI::LogTopic enum class. The default value is LogTopic::ALL.
Returns
rmmStatus Returns rmmSuccess if the log mask is successfully set, or rmmError if the log topic is invalid or the log mask is out of the valid range.

◆ setPollTimeout()

void RMMAPI::setPollTimeout ( int value)

Sets the timeout for polling in seconds. Timeout starts counting after the polling exceeds initial estimated, not at start of polling.

Parameters
[in]valuevalue in seconds to set timeout.
Returns
void

◆ setupAllClocks()

rmmStatus RMMAPI::setupAllClocks ( TimingMode timingMode)

Setup all clocks and the timing system.

Parameters
[in]timingModeThe timing mode to be used for clock configuration.

The following TimingMode values are supported:

  • MRF: Mode for MRF-based timing configuration.
  • LCL: Local mode for internal clock synchronization.
  • EXT: External mode for using external clock sources.
Returns
rmmSuccess if all configurations are completed successfully. Otherwise, returns an appropriate error status if any clock configuration step fails.

◆ setWriteToFileAll()

rmmStatus RMMAPI::setWriteToFileAll ( bool option,
char mode = 'w' )

Enables or disables writing to log files for all components *.

This method retrieves the latest log message for a specific log topic and stores it in the provided string pointer. It checks the topic argument and calls the getMsg method of the corresponding log object.

If the topic is invalid, the method will set the message to "Unable to getMsg: Invalid Topic" and return an error..

This method enables or disables writing logs to files for all components by calling the setWriteToFile method on each component's rmmLog object. Refer to RMMLog::setWriteToFile for more details.

Parameters
[in]optionA boolean flag that enables (true) or disables (false) writing to the log file.
[in]modeThe write mode for the log file: 'w' for creating a new file, 'a' for appending to an existing file.
Returns
rmmStatus Returns rmmSuccess if the write-to-file option is successfully set for all components, or rmmError if any component fails to set the option.

◆ tearDownAllRings()

rmmStatus RMMAPI::tearDownAllRings ( )

Teardown all possible rings.

Returns
status

◆ tearDownRing()

rmmStatus RMMAPI::tearDownRing ( int ring,
bool waitTime )

Teardown a specific ring of the RMM.

Parameters
ringThe index of the ring to tear down.
waitTimeIf true, the function waits for the full teardown timeout.
Returns
- rmmSuccess if the teardown completed successfully or was already in progress.
  • mmError if the ring index is out of range or an error occurred while writing registers.

Member Data Documentation

◆ jsonConfigData

json RMMAPI::jsonConfigData

Stores the JSON configuration data.

The data is parsed and managed using the nlohmann::json library for seamless JSON handling.


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