LCOV - code coverage report
Current view: top level - timinglibs/plugins - TimingMasterControllerPDII.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 25 0
Test Date: 2025-12-21 13:07:08 Functions: 0.0 % 5 0

            Line data    Source code
       1              : /**
       2              :  * @file TimingMasterControllerPDII.cpp TimingMasterControllerPDII class
       3              :  * implementation
       4              :  *
       5              :  * This is part of the DUNE DAQ Software Suite, copyright 2020.
       6              :  * Licensing/copyright details are in the COPYING file that you should have
       7              :  * received with this code.
       8              :  */
       9              : 
      10              : #include "TimingMasterControllerPDII.hpp"
      11              : 
      12              : #include "timinglibs/timingcmd/Nljs.hpp"
      13              : #include "timinglibs/timingcmd/Structs.hpp"
      14              : 
      15              : #include "timing/timingfirmwareinfo/Nljs.hpp"
      16              : #include "timing/timingfirmwareinfo/Structs.hpp"
      17              : 
      18              : #include "appfwk/cmd/Nljs.hpp"
      19              : #include "ers/Issue.hpp"
      20              : 
      21              : #include <chrono>
      22              : #include <cstdlib>
      23              : #include <string>
      24              : #include <thread>
      25              : #include <vector>
      26              : 
      27              : namespace dunedaq {
      28              : namespace timinglibs {
      29              : 
      30              : void
      31            0 : TimingMasterControllerPDII::process_device_info(nlohmann::json info)
      32              : {
      33            0 :   ++m_device_infos_received_count;
      34              : 
      35            0 :   timing::timingfirmwareinfo::TimingDeviceInfo device_info;
      36            0 :   from_json(info, device_info);
      37              : 
      38            0 :   auto master_info = device_info.master_info;
      39              : 
      40            0 :   uint64_t master_timestamp = master_info.timestamp;
      41            0 :   bool timestamp_valid = master_info.ts_valid;
      42            0 :   bool timestamp_tx_error = master_info.ts_tx_err;
      43            0 :   bool transmit_error = master_info.tx_err;
      44            0 :   bool counters_ready = master_info.ctrs_rdy;
      45              : 
      46            0 :   TLOG_DEBUG(3) << "Master timestamp: 0x" << std::hex << master_timestamp
      47            0 :   << ", ts_valid: " << timestamp_valid
      48            0 :   << ", ts_tx_err: " << timestamp_tx_error
      49            0 :   << ", tx_err: " << transmit_error
      50            0 :   << ", ctrs_rdy: " << counters_ready << std::dec
      51            0 :   << ", infos received: " << m_device_infos_received_count;
      52              : 
      53            0 :   if (master_timestamp && timestamp_valid && !timestamp_tx_error && !transmit_error && counters_ready)
      54              :   {
      55            0 :     if (!m_device_ready)
      56              :     {
      57            0 :       m_device_ready = true;
      58            0 :       TLOG_DEBUG(2) << "Timing master became ready";
      59              :     }
      60              :   }
      61              :   else
      62              :   {
      63            0 :     if (m_device_ready)
      64              :     {
      65            0 :       m_device_ready = false;
      66            0 :       TLOG_DEBUG(2) << "Timing master no longer ready";
      67              :     }
      68              :   }
      69            0 : }
      70              : 
      71              : } // namespace timinglibs
      72              : } // namespace dunedaq
      73              : 
      74            0 : DEFINE_DUNE_DAQ_MODULE(dunedaq::timinglibs::TimingMasterControllerPDII)
      75              : 
      76              : // Local Variables:
      77              : // c-basic-offset: 2
      78              : // End:
        

Generated by: LCOV version 2.0-1