9#include "RMMRegisterAccess.h"
11#include "si5341_config.h"
41enum class TimingMode { MRF = 0, LCL = 1, EXT = 2 };
42enum class BringUpMode { CONCURRENT, SEQUENCTIAL };
52 rmmStatus
setupAll(TimingMode timingMode);
59 static constexpr double CMN_IN_REFCLK_FREQ = 88.0525;
60 static constexpr double SI570_RESET_FREQ = 156.25;
61 static constexpr double SI570_TAR_FREQ = 176.105;
62 static constexpr double SI5341_IN_TAR_FREQ = 158.4945;
63 static constexpr double TIMESTAMP_TAR_FREQ = 88.0525;
64 static constexpr double FREQ_TOLERANCE = 0.001;
65 static constexpr int SI5341_ADDR = 0x77;
66 static constexpr int SI5341_PAGE = 0x01;
68 static constexpr uint32_t PPS_TARGET = 0x053F9313;
69 static constexpr uint32_t LCL_SYNC_TARGET = 0x005FF839;
72 int si5341_line_count;
73 int si5341_total_lines;
77 rmmStatus configSi570(
double new_freq = SI570_TAR_FREQ,
double reset_freq = SI570_RESET_FREQ);
78 rmmStatus configTiming(TimingMode mode);
79 rmmStatus configSi5341();
80 double getSi570Frequency();
81 double getCmnInRefClkFreq();
82 double getSi5341InputFreq();
84 int si5341PageSafeWrite(std::vector<si5341EntryType> si5341_map_data,
int old_page);
85 void si5341ProgStatusInc();
86 double getTimestampingFreq();
88 uint32_t getTimingModeRaw();
89 std::string getTimingSource();
90 std::string getTimingSync();
91 std::string getTimingMode();
rmmStatus getCurrentTime(uint32_t *currentTime)
Get the current timestamping for RMM.
Definition RMMClocks.cpp:601
rmmStatus setEventCode(uint32_t eventCode)
Set MRF event code.
Definition RMMClocks.cpp:620
RMMLog rmmLog
Log handler for RMMClocks messages.
Definition RMMClocks.h:56
rmmStatus setupAll(TimingMode timingMode)
Setup all clocks and the timing system.
Definition RMMClocks.cpp:42
RMMClocks(RMMRegisterAccess &RMMRegs)
Constructor of the RMMClocks.
Definition RMMClocks.cpp:28
rmmStatus getTimingStatus(TimingStatus *time)
Get the status of the timestamping system (including the embedded EVR) in the RMM.
Definition RMMClocks.cpp:529
Class for managing and writing log messages to different log levels and files.
Definition RMMLog.h:47
Class to handle register access over the ESS Readout Master Module.
Definition RMMRegisterAccess.h:57
Struct to hold timing-related information and status for the RMM.
Definition RMMClocks.h:17
uint32_t currentTime
The current timestamp value.
Definition RMMClocks.h:31
uint32_t mrfTopology
The MRF topology ID.
Definition RMMClocks.h:38
double cmnInRefclkFreqMHz
Frequency of the reference clock used for synchronization, usually around 88.0252MHz.
Definition RMMClocks.h:20
uint32_t mrfStatus
Status of progress of the delay compensation of the Embedded EVR, such as whether it is in reset,...
Definition RMMClocks.h:33
uint32_t mrfMeasDelay
Measured delay value for the MRF system.
Definition RMMClocks.h:36
double syncFreqHz
Frequency of the synchronization pulse in Hz.
Definition RMMClocks.h:32
std::string modeOfSource
The source of the current timing mode.
Definition RMMClocks.h:18
bool tsFreqOk
True if timestamping frequency is within tolerance, false otherwise.
Definition RMMClocks.h:29
std::string modeOfSync
The synchronization method used by the current timing system.
Definition RMMClocks.h:19
bool clkMuxLocked
Indicates whether the clock mux is locked.
Definition RMMClocks.h:30
double si570FreqMHz
Frequency of the Si570 clock in MHz. The Si570 is used as the reference clock for the GTY and the tim...
Definition RMMClocks.h:22
std::string mrfMsg
A human-readable string describing the status of the MRF system.
Definition RMMClocks.h:35
double si5341InFreqMHz
Frequency of the input clock driving the Si5341 in MHz. This clock is sourced from the timestamping s...
Definition RMMClocks.h:25
uint32_t mrfTarDelay
Target delay value for the MRF system.
Definition RMMClocks.h:37
bool si5341InFreqOk
True if the Si5341 input frequency is within tolerance, false otherwise.
Definition RMMClocks.h:27
bool cmnInRefclkFreqOk
True if common input reference clock frequency is within tolerance, false otherwise.
Definition RMMClocks.h:21
bool si570FreqOk
True if the Si570 frequency is within tolerance, false otherwise.
Definition RMMClocks.h:24
double tsFreqMHz
Frequency of the timestamping clock in MHz. Expected value is around 88.0252MHz.
Definition RMMClocks.h:28