LCOV - code coverage report
Current view: top level - timing/src - SIMIONode.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 78 0
Test Date: 2025-12-21 13:07:08 Functions: 0.0 % 27 0

            Line data    Source code
       1              : /**
       2              :  * @file SIMIONode.cpp
       3              :  *
       4              :  * This is part of the DUNE DAQ Software Suite, copyright 2020.
       5              :  * Licensing/copyright details are in the COPYING file that you should have
       6              :  * received with this code.
       7              :  */
       8              : 
       9              : #include "timing/SIMIONode.hpp"
      10              : 
      11              : #include "logging/Logging.hpp"
      12              : 
      13              : #include <string>
      14              : #include <utility>
      15              : #include <vector>
      16              : 
      17              : namespace dunedaq {
      18              : namespace timing {
      19              : 
      20            0 : UHAL_REGISTER_DERIVED_NODE(SIMIONode)
      21              : 
      22              : //-----------------------------------------------------------------------------
      23            0 : SIMIONode::SIMIONode(const uhal::Node& node)
      24            0 :   : IONode(node, "", "", "", {}, {})
      25            0 : {}
      26              : //-----------------------------------------------------------------------------
      27              : 
      28              : //-----------------------------------------------------------------------------
      29            0 : SIMIONode::~SIMIONode() {}
      30              : //-----------------------------------------------------------------------------
      31              : 
      32              : //-----------------------------------------------------------------------------
      33              : std::string
      34            0 : SIMIONode::get_uid_address_parameter_name() const
      35              : {
      36            0 :   return "";
      37              : }
      38              : //-----------------------------------------------------------------------------
      39              : 
      40              : //-----------------------------------------------------------------------------
      41              : std::string
      42            0 : SIMIONode::get_status(bool print_out) const
      43              : {
      44            0 :   std::stringstream status;
      45              : 
      46            0 :   auto subnodes = read_sub_nodes(getNode("csr.stat"));
      47            0 :   status << format_reg_table(subnodes, "SIM IO state");
      48              : 
      49            0 :   if (print_out)
      50            0 :     TLOG() << status.str();
      51            0 :   return status.str();
      52            0 : }
      53              : //-----------------------------------------------------------------------------
      54              : 
      55              : //-----------------------------------------------------------------------------
      56              : uint64_t // NOLINT(build/unsigned)
      57            0 : SIMIONode::read_board_uid() const
      58              : {
      59            0 :   return 0;
      60              : }
      61              : //-----------------------------------------------------------------------------
      62              : 
      63              : //-----------------------------------------------------------------------------
      64              : BoardRevision
      65            0 : SIMIONode::get_board_revision() const
      66              : {
      67            0 :   return kSIMRev1;
      68              : }
      69              : //-----------------------------------------------------------------------------
      70              : 
      71              : //-----------------------------------------------------------------------------
      72              : std::string
      73            0 : SIMIONode::get_hardware_info(bool print_out) const
      74              : {
      75            0 :   std::stringstream info;
      76            0 :   const BoardType board_type = convert_value_to_board_type(read_board_type());
      77            0 :   const BoardRevision board_revision = get_board_revision();
      78            0 :   const CarrierType carrier_type = convert_value_to_carrier_type(read_carrier_type());
      79            0 :   const DesignType design_type = convert_value_to_design_type(read_design_type());
      80              : 
      81            0 :   std::vector<std::pair<std::string, std::string>> hardware_info;
      82              : 
      83            0 :   try {
      84            0 :     hardware_info.push_back(std::make_pair("Board type", get_board_type_map().at(board_type)));
      85            0 :   } catch (const std::out_of_range& e) {
      86            0 :     throw MissingBoardTypeMapEntry(ERS_HERE, format_reg_value(board_type), e);
      87            0 :   }
      88              : 
      89            0 :   try {
      90            0 :     hardware_info.push_back(std::make_pair("Board revision", get_board_revision_map().at(board_revision)));
      91            0 :   } catch (const std::out_of_range& e) {
      92            0 :     throw MissingBoardRevisionMapEntry(ERS_HERE, format_reg_value(board_revision), e);
      93            0 :   }
      94              : 
      95            0 :   try {
      96            0 :     hardware_info.push_back(std::make_pair("Carrier type", get_carrier_type_map().at(carrier_type)));
      97            0 :   } catch (const std::out_of_range& e) {
      98            0 :     throw MissingCarrierTypeMapEntry(ERS_HERE, format_reg_value(carrier_type), e);
      99            0 :   }
     100              : 
     101            0 :   try {
     102            0 :     hardware_info.push_back(std::make_pair("Design type", get_design_type_map().at(design_type)));
     103            0 :   } catch (const std::out_of_range& e) {
     104            0 :     throw MissingDesignTypeMapEntry(ERS_HERE, format_reg_value(design_type), e);
     105            0 :   }
     106            0 :   info << format_reg_table(hardware_info, "Hardware info", { "", "" });
     107              : 
     108            0 :   if (print_out)
     109            0 :     TLOG() << info.str();
     110            0 :   return info.str();
     111            0 : }
     112              : //-----------------------------------------------------------------------------
     113              : 
     114              : //-----------------------------------------------------------------------------
     115              : void
     116            0 : SIMIONode::reset(const std::string& /*clock_config_file*/) const
     117              : {
     118              : 
     119            0 :   write_soft_reset_register();
     120            0 :   TLOG_DEBUG(0) << "Reset done";
     121            0 : }
     122              : //-----------------------------------------------------------------------------
     123              : 
     124              : //-----------------------------------------------------------------------------
     125            0 : void SIMIONode::reset_pll() const
     126              : {
     127            0 : }
     128              : //-----------------------------------------------------------------------------
     129              : 
     130              : //-----------------------------------------------------------------------------
     131              : void
     132            0 : SIMIONode::configure_pll(const std::string& /*clock_config_file*/) const
     133              : {
     134            0 :   TLOG_DEBUG(0) << "Simulation does not support PLL config";
     135            0 : }
     136              : //-----------------------------------------------------------------------------
     137              : 
     138              : //-----------------------------------------------------------------------------
     139              : std::vector<double>
     140            0 : SIMIONode::read_clock_frequencies() const
     141              : {
     142            0 :   TLOG_DEBUG(0) << "Simulation does not support reading of freq";
     143            0 :   return {};
     144              : }
     145              : //-----------------------------------------------------------------------------
     146              : 
     147              : //-----------------------------------------------------------------------------
     148              : std::string
     149            0 : SIMIONode::get_clock_frequencies_table(bool /*print_out*/) const
     150              : {
     151            0 :   TLOG_DEBUG(0) << "Simulation does not support freq table";
     152            0 :   return "Simulation does not support freq table";
     153              : }
     154              : //-----------------------------------------------------------------------------
     155              : 
     156              : //-----------------------------------------------------------------------------
     157              : std::string
     158            0 : SIMIONode::get_pll_status(bool /*print_out*/) const
     159              : {
     160            0 :   TLOG_DEBUG(0) << "Simulation does not support PLL status";
     161            0 :   return "Simulation does not support PLL status";
     162              : }
     163              : //-----------------------------------------------------------------------------
     164              : 
     165              : //-----------------------------------------------------------------------------
     166              : std::string
     167            0 : SIMIONode::get_sfp_status(uint32_t /*sfp_id*/, bool /*print_out*/) const // NOLINT(build/unsigned)
     168              : {
     169            0 :   TLOG_DEBUG(0) << "Simulation does not support SFP I2C";
     170            0 :   return "Simulation does not support SFP I2C";
     171              : }
     172              : //-----------------------------------------------------------------------------
     173              : 
     174              : //-----------------------------------------------------------------------------
     175              : void
     176            0 : SIMIONode::switch_sfp_soft_tx_control_bit(uint32_t /*sfp_id*/, bool /*turn_on*/) const // NOLINT(build/unsigned)
     177              : {
     178            0 :   TLOG_DEBUG(0) << "Simulation does not support SFP I2C";
     179            0 : }
     180              : //-----------------------------------------------------------------------------
     181              : 
     182              : //-----------------------------------------------------------------------------
     183              : void
     184            0 : SIMIONode::switch_sfp_tx(uint32_t /*sfp_id*/, bool /*turn_on*/) const // NOLINT(build/unsigned)
     185              : {
     186            0 :   TLOG_DEBUG(0) << "Simulation does not support SFP control";
     187            0 : }
     188              : //-----------------------------------------------------------------------------
     189              : 
     190              : } // namespace timing
     191              : } // namespace dunedaq
        

Generated by: LCOV version 2.0-1