DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
IONode.hpp
Go to the documentation of this file.
1
12#ifndef TIMING_INCLUDE_TIMING_IONODE_HPP_
13#define TIMING_INCLUDE_TIMING_IONODE_HPP_
14
15// PDT Headers
16#include "timing/TimingNode.hpp"
17
18#include "TimingIssues.hpp"
19
20#include "timing/DACNode.hpp"
24#include "timing/I2CSFPNode.hpp"
25#include "timing/I2CSlave.hpp"
26#include "timing/SI534xNode.hpp"
27
28// uHal Headers
29#include "uhal/DerivedNode.hpp"
30
31// C++ Headers
32#include <chrono>
33#include <memory>
34#include <string>
35#include <vector>
36
37namespace dunedaq {
38namespace timing {
39
43class IONode : public TimingNode
44{
45
46public:
47 IONode(const uhal::Node& node,
48 std::string uid_i2c_bus,
49 std::string pll_i2c_bus,
50 std::string pll_i2c_device,
51 std::vector<std::string> clock_names,
52 std::vector<std::string> sfp_i2c_buses);
53 virtual ~IONode();
54
60 virtual std::string get_uid_address_parameter_name() const = 0;
61
67 virtual uint32_t read_board_type() const; // NOLINT(build/unsigned)
68
74 virtual uint32_t read_carrier_type() const; // NOLINT(build/unsigned)
75
81 virtual uint32_t read_design_type() const; // NOLINT(build/unsigned)
82
88 virtual uint32_t read_firmware_frequency() const; // NOLINT(build/unsigned)
89
95 virtual uint64_t read_board_uid() const; // NOLINT(build/unsigned)
96
102 virtual BoardRevision get_board_revision() const;
103
107 virtual std::string get_hardware_info(bool print_out = false) const;
108
114 virtual std::string get_full_clock_config_file_path(const ClockSource& clock_source) const;
115
121 template<class T>
122 std::unique_ptr<const T> get_i2c_device(const std::string& i2c_bus_name, const std::string& i2c_device_name) const;
123
129 virtual std::unique_ptr<const SI534xSlave> get_pll() const;
130
134 virtual void configure_pll(const std::string& clock_config_file = "") const;
135
139 virtual std::vector<double> read_clock_frequencies() const;
140
144 virtual std::string get_clock_frequencies_table(bool print_out = false) const;
145
149 virtual std::string get_pll_status(bool print_out = false) const;
150
154 virtual std::string get_sfp_status(uint32_t sfp_id, bool print_out = false) const; // NOLINT(build/unsigned)
155
159 virtual void switch_sfp_soft_tx_control_bit(uint32_t sfp_id, bool turn_on) const; // NOLINT(build/unsigned)
160
164 virtual void switch_sfp_tx(uint32_t sfp_id, bool turn_on) const = 0; // NOLINT(build/unsigned)
165
169 virtual void soft_reset() const;
170
174 virtual void reset(const std::string& clock_config_file) const = 0;
175
179 virtual void reset(const ClockSource& clock_source) const;
180
184 virtual bool clocks_ok() const = 0;
185
186 virtual void get_info(timinghardwareinfo::TimingPLLMonitorData& mon_data) const {get_pll()->get_info(mon_data);}
187
188 static const std::map<BoardType, std::string>& get_board_type_map() { return board_type_map; }
189
190 static const std::map<CarrierType, std::string>& get_carrier_type_map() { return carrier_type_map; }
191
192 static const std::map<BoardRevision, std::string>& get_board_revision_map() { return board_revision_map; }
193 static const std::map<uint64_t, BoardRevision>& get_board_uid_revision_map() { return board_uid_revision_map; }
194 static const std::map<DesignType, std::string>& get_design_type_map() { return design_type_map; }
195 static const std::map<std::string, std::string>& get_clock_config_map() { return clock_config_map; }
196 static const std::vector<BoardType>& get_library_supported_boards() { return library_supported_boards; }
197 static const std::vector<DesignType>& get_library_supported_designs() { return library_supported_designs; }
198
199protected:
200 const std::string m_uid_i2c_bus;
201 const std::string m_pll_i2c_bus;
202 const std::string m_pll_i2c_device;
203 const std::vector<std::string> m_clock_names;
204 const std::vector<std::string> m_sfp_i2c_buses;
205
209 virtual void write_soft_reset_register() const;
210
211 static inline const std::map<BoardType, std::string> board_type_map = { { kBoardFMC, "fmc" },
212 { kBoardSim, "sim" },
213 { kBoardPC059, "pc059" },
214 { kBoardMicrozed, "microzed" },
215 { kBoardTLU, "tlu" },
216 { kBoardFIB, "fib" },
217 { kBoardMIB, "mib" },
218 { kBoardPC069, "pc069" },
219 { kBoardGIB, "gib" },
220 { kBoardUnknown, "unknown" }
221 };
222
223 static inline const std::map<CarrierType, std::string> carrier_type_map = { { kCarrierEnclustraA35, "enclustra-a35" },
224 { kCarrierKC705, "kc705" },
225 { kCarrierMicrozed, "microzed" },
226 { kCarrierATFC, "atfc" },
227 { kCarrierAFC, "afc" },
228 { kCarrierNexusVideo, "nexus-video" },
229 { kCarrierTrenzTE0712, "trenz-te0712" },
230 { kCarrierUnknown, "unknown" }
231 };
232 static inline const std::map<BoardRevision, std::string> board_revision_map = {
233 { kFMCRev1, "kFMCRev1" }, { kFMCRev2, "kFMCRev2" }, { kFMCRev3, "kFMCRev3" },
234 { kPC059Rev1, "kPC059Rev1" }, { kTLURev1, "kTLURev1" }, { kSIMRev1, "kSIMRev1" },
235 { kFIBRev1, "kFIBRev1" }, { kFMCRev4, "kFMCRev4" }, { kMIBRev1, "kMIBRev1" },
236 { kPC069a, "pc069a" }, { kPC069b, "pc069b" }, { kPC069c, "pc069c" }, { kMIBRev2, "kMIBRev2" }, { kGIBRev1, "kGIBRev1" },
237 { kFIBRev2, "kFIBRev2" }, { kBoardRevisionUnknown, "unknown" }
238 };
239
240 static inline const std::map<DesignType, std::string> design_type_map = {
241 { kDesignMaster, "master" },
242 { kDesignOuroboros, "ouroboros" },
243 { kDesignOuroborosSim, "ouroboros-sim" },
244 { kDesignTest, "test-design" },
245 { kDesignEndpoint, "endpoint" },
246 { kDesignFanout, "fanout" },
247 { kDesignOverlord, "overlord" },
248 { kDesignEndpoBICRT, "endpoint-bi-crt" },
249 { kDesignChronos, "chronos" },
250 { kDesignBoreas, "boreas" },
251 { kDesignKerberos, "kerberos" },
252 { kDesignGaia, "gaia" },
253 { kDesignCharon, "charon" },
254 { kDesignHades, "hades" },
255 { kDesignUnknown, "unknown" },
256 };
257
258 // NOLINTNEXTLINE(build/unsigned)
259 static inline const std::map<uint64_t, BoardRevision> board_uid_revision_map = {
260 { 0xd880395e720b, kFMCRev1 },
261 { 0xd880395e501a, kFMCRev1 },
262 { 0xd880395e50b8, kFMCRev1 },
263 { 0xd880395e501b, kFMCRev1 },
264 { 0xd880395e7201, kFMCRev1 },
265 { 0xd880395e4fcc, kFMCRev1 },
266 { 0xd880395e5069, kFMCRev1 },
267 { 0xd880395e7206, kFMCRev1 },
268 { 0xd880395e1c86, kFMCRev2 },
269 { 0xd880395e2630, kFMCRev2 },
270 { 0xd880395e262b, kFMCRev2 },
271 { 0xd880395e2b38, kFMCRev2 },
272 { 0xd880395e1a6a, kFMCRev2 },
273 { 0xd880395e36ae, kFMCRev2 },
274 { 0xd880395e2b2e, kFMCRev2 },
275 { 0xd880395e2b33, kFMCRev2 },
276 { 0xd880395e1c81, kFMCRev2 },
277 { 0x049162b67ce6, kFMCRev3 },
278 { 0x049162b62947, kFMCRev3 },
279 { 0x049162b67cdf, kFMCRev3 },
280 { 0x49162b62050, kFMCRev3 },
281 { 0x49162b62951, kFMCRev3 },
282 { 0x49162b675e3, kFMCRev3 },
283 { 0xd88039d980cf, kPC059Rev1 },
284 { 0xd88039d98adf, kPC059Rev1 },
285 { 0xd88039d92491, kPC059Rev1 },
286 { 0xd88039d9248e, kPC059Rev1 },
287 { 0xd88039d98ae9, kPC059Rev1 },
288 { 0xd88039d92498, kPC059Rev1 },
289 { 0x5410ecbba408, kTLURev1 },
290 { 0x5410ecbb9426, kTLURev1 },
291 { 0x801f12f5ce48, kFIBRev1 },
292 { 0x801f12f5e9ae, kFIBRev1 },
293 { 0x49162b65025, kFMCRev3 },
294 { 0x49162b62948, kFMCRev3 },
295 { 0x49162b675ea, kFMCRev3 },
296 { 0x49162b645cd, kFMCRev3 },
297 { 0xd880395dab52, kFMCRev4 },
298 { 0xd880395d99b3, kFMCRev4 },
299 { 0xd880395df010, kFMCRev4 },
300 { 0xd880395df00f, kFMCRev4 },
301 { 0xd880395de4a4, kFMCRev4 },
302 { 0xd880395d99a9, kFMCRev4 },
303 { 0xd880395d99b0, kFMCRev4 },
304 { 0xd880395de452, kFMCRev4 },
305 { 0xd880395da48e, kFMCRev4 },
306 { 0xd880395dbcee, kFMCRev4 },
307 { 0x803428749c04, kPC069a },
308 { 0x5410ecbb6845, kTLURev1 },
309 { 0x801f12ee6739, kMIBRev1 },
310 { 0x801f12f5e183, kFIBRev1 },
311 { 0x49162b1d910, kMIBRev2 },
312 { 0x801f12ee56f3, kGIBRev1 },
313 { 0x80342874c33d, kPC069a },
314 { 0x803428748902, kPC069a },
315 { 0x8034287498ea, kPC069a },
316 { 0xfc0fe700bece, kPC069b },
317 { 0xfc0fe700c286, kPC069b },
318 { 0xfc0fe700d293, kPC069b },
319 { 0xfc0fe700bec4, kPC069b },
320 { 0xfc0fe700c281, kPC069b },
321 { 0xfc0fe700bec9, kPC069b },
322 { 0xfc0fe700d28e, kPC069b },
323 { 0xfc0fe700d289, kPC069b },
324 { 0xfc0fe700d298, kPC069b },
325 { 0xfc0fe700c28b, kPC069b },
326 { 0xfc0fe7ea5d1e, kPC069b },
327 { 0x049162b1d4bf, kMIBRev2 },
328 { 0xfc0fe7ea5d1e, kPC069c },
329 { 0xfc0fe7ea9113, kPC069c },
330 { 0xfc0fe7ea5d28, kPC069c },
331 { 0xfc0fe7eaa20c, kPC069c },
332 { 0xfc0fe7ea51e4, kPC069c },
333 { 0xfc0fe7ea6251, kPC069c },
334 { 0xfc0fe7ea51da, kPC069c },
335 { 0xfc0fe7ea5d2d, kPC069c },
336 { 0xfc0fe7ea9112, kPC069c },
337 { 0xfc0fe7ea51df, kPC069c },
338 { 0xfc0fe7eaa202, kPC069c },
339 { 0xfc0fe7ea5d23, kPC069c },
340 { 0xfc0fe7eaa203, kPC069c },
341 { 0xfc0fe7eaa20d, kPC069c },
342 { 0xfc0fe7ea6256, kPC069c },
343 { 0xd8478fa99d2d, kPC069b },
344 { 0xd8478fa99b57, kPC069b },
345 };
346
347 static inline const std::map<ClockSource, std::string> clock_source_map = {
348 { kFreeRun, "free_run" },
349 { kInput0, "input_0" },
350 { kInput1, "input_1" },
351 { kInput2, "input_2" },
352 { kInput3, "input_3" },
353 };
354
355 static inline const std::map<std::string, std::string> clock_config_map = {
356
357 // 62.5 MHz mappings (no cdr)
358 { "fmc_5344_ouroboros_free_run", "SI5344/PDTS0003.txt" },
359 { "fmc_5394_ouroboros_free_run", "SI5344/PDTS0003.txt" },
360
361 { "fmc_5344_master_free_run", "SI5344/PDTS0003.txt" },
362 { "fmc_5394_master_free_run", "SI5344/PDTS0003.txt" },
363
364 { "fmc_5344_overlord_free_run", "SI5344/PDTS0003.txt" },
365 { "fmc_5394_overlord_free_run", "SI5344/PDTS0003.txt" },
366
367 { "fmc_5344_boreas_free_run", "SI5344/PDTS0003.txt" },
368 { "fmc_5394_boreas_free_run", "SI5344/PDTS0003.txt" },
369
370 { "fmc_5344_endpoint_input_1", "devel/ENDPOINT-Si5344-50MHzRef.txt" },
371 { "fmc_5394_endpoint_input_1", "devel/ENDPOINT-Si5344-50MHzRef.txt" },
372
373 { "fmc_5344_chronos_input_1", "devel/ENDPOINT-Si5344-50MHzRef.txt" },
374 { "fmc_5394_chronos_input_1", "devel/ENDPOINT-Si5344-50MHzRef.txt" },
375
376 { "fmc_5344_charon_input_1", "devel/ENDPOINT-Si5344-50MHzRef.txt" },
377 { "fmc_5394_charon_input_1", "devel/ENDPOINT-Si5344-50MHzRef.txt" },
378
379 { "fmc_5344_hades_input_1", "devel/ENDPOINT-Si5344-50MHzRef.txt" },
380 { "fmc_5394_hades_input_1", "devel/ENDPOINT-Si5344-50MHzRef.txt" },
381
382 { "tlu_5345_boreas_free_run", "nocdr/DUNE_TLU-4_45_M-Registers.txt" },
383
384 { "pc059_5345_master_free_run", "devel/PDTS_PC059_FANOUT.txt" },
385 { "pc059_5345_fanout_input_1", "devel/PDTS_PC059_FANOUT_SFP_IN.txt" },
386
387 { "pc069_5395_master_free_run", "nocdr/Si5395-RevA-069a_mst-Registers.txt" },
388 { "pc069_5395_boreas_free_run", "nocdr/Si5395-RevA-069a_mst-Registers.txt" },
389
390 { "pc069_5395_endpoint_input_1", "nocdr/Si5395-RevA-069a_ep-Registers.txt" },
391 { "pc069_5395_chronos_input_1", "nocdr/Si5395-RevA-069a_ep-Registers.txt" },
392 { "pc069_5395_charon_input_1", "nocdr/Si5395-RevA-069a_ep-Registers.txt" },
393 { "pc069_5395_hades_input_1", "nocdr/Si5395-RevA-069a_ep-Registers.txt" },
394
395 { "pc069_5345_master_free_run", "nocdr/Si5345-RevD-pc69bmst-Registers.txt" },
396 { "pc069_5345_boreas_free_run", "nocdr/Si5345-RevD-pc69bmst-Registers.txt" },
397
398 { "pc069_5345_chronos_input_1", "nocdr/Si5345-RevD-pc69bept-Registers.txt" },
399 { "pc069_5345_charon_input_1", "nocdr/Si5345-RevD-pc69bept-Registers.txt" },
400 { "pc069_5345_endpoint_input_1", "nocdr/Si5345-RevD-pc69bept-Registers.txt" },
401 { "pc069_5345_hades_input_1", "nocdr/Si5345-RevD-pc69bept-Registers.txt" },
402
403 { "gib_5395_gaia_free_run", "nocdr/GIB_Debug_01.txt" },
404
405 { "gib_5395_gaia_input_0", "nocdr/Si5395-RevA-GIB10MHZ-Registers.txt" },
406
407 { "mib_5395_kerberos_free_run",
408 "nocdr/Si5395-RevA-MIB_FREE-Registers.txt" },
409 { "mib_5395_kerberos_input_0",
410 "nocdr/Si5395-RevA-MIB_INSW-Registers.txt" },
411 { "mib_5395_kerberos_input_1",
412 "nocdr/Si5395-RevA-MIB_INSW-Registers.txt" },
413 { "mib_5395_kerberos_input_2",
414 "nocdr/Si5395-RevA-MIB_INSW-Registers.txt" },
415
416 { "fib_5395_fanout_input_1",
417 "nocdr/Si5395-RevA-FIB_FAN_AFCv4-FIBBP250-Registers.txt" }, // fanout design, data and clock from backplane
418 };
419
420 static inline const std::vector<BoardType> library_supported_boards = {
422 };
423
427
428 static inline std::string clock_source_to_string(const ClockSource& source)
429 {
430 if (auto source_it = clock_source_map.find(source); source_it != clock_source_map.end())
431 {
432 return source_it->second;
433 }
434 else
435 {
436 throw MissingClockSourceMapEntry(ERS_HERE, format_reg_value(source));
437 }
438 }
439
440};
441
442} // namespace timing
443} // namespace dunedaq
444
446
447#endif // TIMING_INCLUDE_TIMING_IONODE_HPP_
#define ERS_HERE
Base class for timing IO nodes.
Definition IONode.hpp:44
virtual uint32_t read_board_type() const
Read the word identifying the timing board.
Definition IONode.cpp:48
virtual void write_soft_reset_register() const
Write soft reset register.
Definition IONode.cpp:296
virtual void switch_sfp_soft_tx_control_bit(uint32_t sfp_id, bool turn_on) const
control tx laser of on-board SFP softly (I2C command)
Definition IONode.cpp:343
static const std::vector< BoardType > & get_library_supported_boards()
Definition IONode.hpp:196
virtual void reset(const std::string &clock_config_file) const =0
Reset timing node.
static const std::map< CarrierType, std::string > carrier_type_map
Definition IONode.hpp:223
virtual std::vector< double > read_clock_frequencies() const
Read frequencies of on-board clocks.
Definition IONode.cpp:264
virtual BoardRevision get_board_revision() const
Read the word identifying the timing board.
Definition IONode.cpp:104
const std::string m_pll_i2c_bus
Definition IONode.hpp:201
virtual void switch_sfp_tx(uint32_t sfp_id, bool turn_on) const =0
control tx laser of on-board SFP
IONode(const uhal::Node &node, std::string uid_i2c_bus, std::string pll_i2c_bus, std::string pll_i2c_device, std::vector< std::string > clock_names, std::vector< std::string > sfp_i2c_buses)
Definition IONode.cpp:25
const std::string m_pll_i2c_device
Definition IONode.hpp:202
virtual uint32_t read_carrier_type() const
Read the word identifying the FPFA carrier board.
Definition IONode.cpp:58
static const std::map< std::string, std::string > & get_clock_config_map()
Definition IONode.hpp:195
static const std::vector< BoardType > library_supported_boards
Definition IONode.hpp:420
virtual std::string get_sfp_status(uint32_t sfp_id, bool print_out=false) const
Print status of on-board SFP.
Definition IONode.cpp:324
virtual std::string get_hardware_info(bool print_out=false) const
Print hardware information.
Definition IONode.cpp:118
virtual std::string get_uid_address_parameter_name() const =0
Get the UID address parameter name.
virtual uint32_t read_design_type() const
Read the word identifying the firmware design in the FPGA.
Definition IONode.cpp:68
const std::string m_uid_i2c_bus
Definition IONode.hpp:200
static const std::map< BoardRevision, std::string > board_revision_map
Definition IONode.hpp:232
virtual void soft_reset() const
Reset timing node.
Definition IONode.cpp:305
const std::vector< std::string > m_clock_names
Definition IONode.hpp:203
virtual std::string get_full_clock_config_file_path(const ClockSource &clock_source) const
Get the full config path.
Definition IONode.cpp:167
static const std::vector< DesignType > & get_library_supported_designs()
Definition IONode.hpp:197
const std::vector< std::string > m_sfp_i2c_buses
Definition IONode.hpp:204
virtual std::unique_ptr< const SI534xSlave > get_pll() const
Get the PLL chip.
Definition IONode.cpp:239
static const std::map< uint64_t, BoardRevision > & get_board_uid_revision_map()
Definition IONode.hpp:193
virtual bool clocks_ok() const =0
Clocks ready?
static const std::map< BoardType, std::string > board_type_map
Definition IONode.hpp:211
static const std::vector< DesignType > library_supported_designs
Definition IONode.hpp:424
static const std::map< uint64_t, BoardRevision > board_uid_revision_map
Definition IONode.hpp:259
virtual uint64_t read_board_uid() const
Read the word containing the timing board UID.
Definition IONode.cpp:88
virtual uint32_t read_firmware_frequency() const
Read the word identifying the frequency [units of Hz] of the firmware in the FPGA.
Definition IONode.cpp:78
static const std::map< DesignType, std::string > design_type_map
Definition IONode.hpp:240
static const std::map< DesignType, std::string > & get_design_type_map()
Definition IONode.hpp:194
static const std::map< ClockSource, std::string > clock_source_map
Definition IONode.hpp:347
static const std::map< std::string, std::string > clock_config_map
Definition IONode.hpp:355
virtual void configure_pll(const std::string &clock_config_file="") const
Configure clock chip.
Definition IONode.cpp:247
static const std::map< BoardRevision, std::string > & get_board_revision_map()
Definition IONode.hpp:192
virtual std::string get_clock_frequencies_table(bool print_out=false) const
Print frequencies of on-board clocks.
Definition IONode.cpp:272
virtual void get_info(timinghardwareinfo::TimingPLLMonitorData &mon_data) const
Definition IONode.hpp:186
static const std::map< BoardType, std::string > & get_board_type_map()
Definition IONode.hpp:188
std::unique_ptr< const T > get_i2c_device(const std::string &i2c_bus_name, const std::string &i2c_device_name) const
Get the an I2C chip.
Definition IONode.hxx:6
virtual std::string get_pll_status(bool print_out=false) const
Print status of on-board PLL.
Definition IONode.cpp:288
static const std::map< CarrierType, std::string > & get_carrier_type_map()
Definition IONode.hpp:190
static std::string clock_source_to_string(const ClockSource &source)
Definition IONode.hpp:428
Base class for timing nodes.
std::string format_reg_value(T reg_value, uint32_t base)
Definition toolbox.hxx:117
Including Qt Headers.