10#include "RMMInformations.h"
11#include "RMMOutputQueues.h"
13#include "RMMRegisterAccess.h"
15#include "RMMSideChannels.h"
16#include "RMMUDPCore.h"
19using json = nlohmann::json;
40 RMMAPI(
const std::string &serverIP,
int serverPort,
const char *configFile);
64 void loadConfig(
const std::string &cfgJsonPath);
83 rmmStatus
getFirmwareInfo(std::unordered_map<std::string, std::string> *info);
85 rmmStatus
config(TimingMode timingMode = TimingMode::LCL, BringUpMode = BringUpMode::CONCURRENT,
86 uint32_t eventCode = 0x10);
89 rmmStatus
arpStatus(
const int index, std::unordered_map<std::string, int> *status);
143 RMMResult regRead(
const std::string ®Name, RegisterTag tag = RegisterTag::ALL);
145 RMMResult regWrite(
const std::string ®Name, uint32_t data, RegisterTag tag = RegisterTag::ALL);
147 RMMResult fieldRead(
const std::string ®, RegisterTag tag,
int bitBegin,
int bitWidth);
149 RMMResult fieldWrite(
const std::string ®, RegisterTag tag,
int bitBegin,
int bitWidth, uint32_t data);
181 bool hasSideChannel =
false;
184 std::vector<DetectorConfig> detConfigs;
rmmStatus readyForBulkData()
Inform all FEs in the topology that they can start sending bulk data.
Definition RMMApi.cpp:267
rmmStatus getLogMsg(std::string *msg, LogTopic topic=LogTopic::RMM_API)
Retrieves the latest log message for the specified log topic.
Definition RMMApi.cpp:747
rmmStatus getSideChannelStats(SideChannelStatsData &stats)
Retrieves statistics for the side channels.
Definition RMMApi.cpp:203
RMMResult regWrite(const std::string ®Name, uint32_t data, RegisterTag tag=RegisterTag::ALL)
Writes a value to a named register.
Definition RMMApi.cpp:819
rmmStatus disablePowerMonitoring()
Disables the internal state machine that reads out the power rail information.
Definition RMMApi.cpp:131
rmmStatus resetPacketCounters()
Reset all packet counters back to 0. Useful if the counters start saturating at 0xFFFF_FFFF.
Definition RMMApi.cpp:317
rmmStatus setWriteToFileAll(bool option, char mode='w')
Enables or disables writing to log files for all components *.
Definition RMMApi.cpp:724
rmmStatus fetchSideChannelData(const uint8_t sideChIdx, SideChannelsData &data)
Fetches and populates the data for a specific side channel.
Definition RMMApi.cpp:217
rmmStatus configOutputQueues()
Configures the output queues for data processing.
Definition RMMApi.cpp:256
rmmStatus configUDPCore()
Configure the UDP Core with the configuration storaged into udpCore struct.
Definition RMMApi.cpp:182
rmmStatus getUDPCoreData(UDPCoreData *result)
Retrieve the UDP core configuration data.
Definition RMMApi.cpp:358
LEMOImpedance
Enum class representing the possible impedance values for LEMO connectors.
Definition RMMApi.h:103
rmmStatus config(TimingMode timingMode=TimingMode::LCL, BringUpMode=BringUpMode::CONCURRENT, uint32_t eventCode=0x10)
Configures the RMM for operation.
Definition RMMApi.cpp:407
rmmStatus tearDownRing(int ring, bool waitTime)
Teardown a specific ring of the RMM.
Definition RMMApi.cpp:161
bool isLegacyFW()
Checks if the FW version is legagy (Non UDP Core version).
Definition RMMApi.cpp:906
RMMAPI(const std::string &serverIP, int serverPort, const char *configFile)
Constructs an RMMAPI object and initializes the system.
Definition RMMApi.cpp:18
LogTopic
Enum class representing the possible logging topics in the RMM.
Definition RMMApi.h:120
rmmStatus getTimingStatus(TimingStatus *time)
Get the status of the timestamping system (including the embedded EVR) in the RMM.
Definition RMMApi.cpp:278
void setAllLogTimeouts(int milliseconds)
Sets the log timeout for all components.
Definition RMMApi.cpp:628
void setPollTimeout(int value)
Sets the timeout for polling in seconds. Timeout starts counting after the polling exceeds initial es...
Definition RMMApi.cpp:794
rmmStatus getOutputQueuesData(const int ring, std::shared_ptr< OutputQueueBase > &result)
Retrieves the output queue data for a specific ring.
Definition RMMApi.cpp:348
rmmStatus arpStatus(const int index, std::unordered_map< std::string, int > *status)
Get the ARP status.
Definition RMMApi.cpp:338
json jsonConfigData
Stores the JSON configuration data.
Definition RMMApi.h:162
rmmStatus enablePowerMonitoring(int interval_ms)
Enables the internal state machine to start reading out the Voltage, Current, and Power of various po...
Definition RMMApi.cpp:141
void requestStop()
Requests to stop ongoing operations in the RMM system.
Definition RMMApi.cpp:777
RMMRegisterAccess & getRMMRegAccess()
Provides access to the RMM register interface.
Definition RMMApi.h:51
rmmStatus getLEMOTermination(const uint8_t inLEMOIdx, LEMOImpedance &impedance)
Retrieves the termination impedance for a specified LEMO input.
Definition RMMApi.cpp:530
rmmStatus configAllFE()
Configures all front-end nodes in the topology.
Definition RMMApi.cpp:486
void loadConfig(const std::string &cfgJsonPath)
Loads the RMM configuration from a JSON file.
Definition RMMApi.cpp:68
Topology & getTopology()
Provides access to the topology structure.
Definition RMMApi.h:62
const std::vector< DetectorConfig > & getDetectorConfigs() const
Retrieves the list of detector configurations.
Definition RMMApi.h:169
RMMLog rmmLog
Log handler for RMM API messages.
Definition RMMApi.h:156
double getTemperature()
Gets the temperature of the RMM FPGA.
Definition RMMApi.cpp:51
rmmStatus checkRings()
Perform a slow control read from all FEs in the topology to confirm the ring is active.
Definition RMMApi.cpp:246
RMMResult regRead(const std::string ®Name, RegisterTag tag=RegisterTag::ALL)
Reads a register value by its name from the register map.
Definition RMMApi.cpp:799
RMMResult fieldRead(const std::string ®, RegisterTag tag, int bitBegin, int bitWidth)
Reads a field from a register in the RMM space using a register name.
Definition RMMApi.cpp:842
void setAllFileWriteTimeouts(int milliseconds)
Sets the file write timeout for all components.
Definition RMMApi.cpp:643
rmmStatus setLogFilePathAll(std::string filePath, bool useName=false)
Sets the log file path for all components.
Definition RMMApi.cpp:666
rmmStatus getRegBankVersion(RegBankVersion *banks)
Gets the register bank version details for the different register banks.
Definition RMMApi.cpp:307
rmmStatus getPowerVoltageCurrent(float voltageTolerancePercent, PowerResultsMap *result)
Gets the power, voltage, and current for all INA226 sensors on the VCU118.
Definition RMMApi.cpp:367
rmmStatus bringUpAllRings()
Initializes and configures all active rings.
Definition RMMApi.cpp:224
rmmStatus getSideChannelPacketCounters(const uint8_t sideChIdx, uint32_t *value)
Retrieves the packet counter value for a specific side channel.
Definition RMMApi.cpp:210
rmmStatus tearDownAllRings()
Teardown all possible rings.
Definition RMMApi.cpp:151
void allLogRelays(std::string logLevel, FILE *out)
Relays log output to a specified file for all RMM components.
Definition RMMApi.cpp:558
rmmStatus getFirmwareInfo(std::unordered_map< std::string, std::string > *info)
Gets the firmware information, including FPGA DNA, git hash, and build time.
Definition RMMApi.cpp:297
int getPollTimeout()
Gets the timeout for polling in seconds.
Definition RMMApi.cpp:784
rmmStatus bringUpAllRingsInSequence()
Initializes and configures all active rings, one by one.
Definition RMMApi.cpp:235
RMMResult fieldWrite(const std::string ®, RegisterTag tag, int bitBegin, int bitWidth, uint32_t data)
Writes a field to a register in the RMM space using a register name.
Definition RMMApi.cpp:856
rmmStatus setLogMasks(int logMask, LogTopic topic=LogTopic::ALL)
Sets the log mask for the specified log topic.
Definition RMMApi.cpp:582
rmmStatus fillDetectorConfigFromJson(json &detectorConfig)
Fills the detector configuration from a JSON object.
Definition RMMApi.cpp:105
rmmStatus getPacketCounters(PacketCountMap *packets)
Return the updated packet counters.. There are 2 types of counters, one set that counts the per-fibre...
Definition RMMApi.cpp:328
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 corr...
Definition RMMApi.cpp:509
rmmStatus setupAllClocks(TimingMode timingMode)
Setup all clocks and the timing system.
Definition RMMApi.cpp:171
rmmStatus getCurrentTiming(uint32_t *currentTime)
Get the current timestamping for RMM.
Definition RMMApi.cpp:288
rmmStatus configSideChannels()
Configures all side channels based on stored settings.
Definition RMMApi.cpp:193
Class to manage and configure timing and clock synchronization in the RMM system.
Definition RMMClocks.h:48
Class responsible for retrieving RMM firmware and register bank version info.
Definition RMMInformations.h:22
Class for managing and writing log messages to different log levels and files.
Definition RMMLog.h:47
Class for managing and configuring output queues.
Definition RMMOutputQueues.h:61
Class for managing power monitoring and temperature sensing on the RMM FPGA.
Definition RMMRails.h:28
Class to handle register access over the ESS Readout Master Module.
Definition RMMRegisterAccess.h:57
Classe to manage the setup, configuration, and teardown of RMM rings.
Definition RMMRings.h:52
Class to manage the configuration and data handling of side channels.
Definition RMMSideChannels.h:53
Class to manage UDP core functionality including ARP configuration and data handling.
Definition RMMUDPCore.h:39
Class to manage the topology of frontend devices.
Definition Topology.h:40
Struct to hold the information about the detector configuration.
Definition RMMApi.h:25
std::string name
Name of the detector config.
Definition RMMApi.h:26
std::map< uint8_t, uint8_t > ringTopology
Map to store ring index and number of nodes.
Definition RMMApi.h:27
Struct to represent the result of an RMM register operation.
Definition RMMRegisterAccess.h:37
Struct to store register bank version information.
Definition RMMInformations.h:9
Struct to hold parameters that define how side channels generate and format data.
Definition RMMSideChannels.h:14
Struct to hold timing-related information and status for the RMM.
Definition RMMClocks.h:17
Struct to hold data related to the UDP core.
Definition RMMUDPCore.h:23