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

            Line data    Source code
       1              : /**
       2              :  * @file I2CSlave.cpp
       3              :  *
       4              :  * File:   OpenCoresI2CMasterNode.cpp
       5              :  * Author: ale
       6              :  *
       7              :  * Created on August 29, 2014, 4:47 PM
       8              :  *
       9              :  * This is part of the DUNE DAQ Software Suite, copyright 2020.
      10              :  * Licensing/copyright details are in the COPYING file that you should have
      11              :  * received with this code.
      12              :  */
      13              : 
      14              : #include "timing/I2CSlave.hpp"
      15              : 
      16              : #include "ers/ers.hpp"
      17              : #include "timing/I2CMasterNode.hpp"
      18              : #include "timing/TimingIssues.hpp"
      19              : #include "timing/toolbox.hpp"
      20              : 
      21              : #include <boost/lexical_cast.hpp>
      22              : #include <boost/range/adaptor/map.hpp>
      23              : #include <boost/range/algorithm/copy.hpp>
      24              : #include <boost/unordered/unordered_map.hpp>
      25              : 
      26              : #include <string>
      27              : #include <vector>
      28              : 
      29              : namespace dunedaq {
      30              : namespace timing {
      31              : 
      32              : //-----------------------------------------------------------------------------
      33            0 : I2CSlave::I2CSlave(const I2CMasterNode* i2c_master, uint8_t i2c_device_address) // NOLINT(build/unsigned)
      34            0 :   : m_i2c_master(i2c_master)
      35            0 :   , m_i2c_device_address(i2c_device_address)
      36            0 : {}
      37              : //-----------------------------------------------------------------------------
      38              : 
      39              : //-----------------------------------------------------------------------------
      40            0 : I2CSlave::~I2CSlave() {}
      41              : //-----------------------------------------------------------------------------
      42              : 
      43              : // comodity functions
      44              : //-----------------------------------------------------------------------------
      45              : uint8_t                                                                         // NOLINT(build/unsigned)
      46            0 : I2CSlave::read_i2c(uint32_t i2c_device_address, uint32_t i2c_reg_address) const // NOLINT(build/unsigned)
      47              : {
      48            0 :   return m_i2c_master->read_i2c(i2c_device_address, i2c_reg_address);
      49              : }
      50              : //-----------------------------------------------------------------------------
      51              : 
      52              : //-----------------------------------------------------------------------------
      53              : uint8_t                                            // NOLINT(build/unsigned)
      54            0 : I2CSlave::read_i2c(uint32_t i2c_reg_address) const // NOLINT(build/unsigned)
      55              : {
      56            0 :   return m_i2c_master->read_i2c(m_i2c_device_address, i2c_reg_address);
      57              : }
      58              : //-----------------------------------------------------------------------------
      59              : 
      60              : //-----------------------------------------------------------------------------
      61              : uint8_t                                                                         // NOLINT(build/unsigned)
      62            0 : I2CSlave::read_i2c_atomic(uint32_t i2c_device_address, uint32_t i2c_reg_address) const // NOLINT(build/unsigned)
      63              : {
      64            0 :   return m_i2c_master->read_i2c(i2c_device_address, i2c_reg_address, true);
      65              : }
      66              : //-----------------------------------------------------------------------------
      67              : 
      68              : //-----------------------------------------------------------------------------
      69              : uint8_t                                            // NOLINT(build/unsigned)
      70            0 : I2CSlave::read_i2c_atomic(uint32_t i2c_reg_address) const // NOLINT(build/unsigned)
      71              : {
      72            0 :   return m_i2c_master->read_i2c(m_i2c_device_address, i2c_reg_address, true);
      73              : }
      74              : //-----------------------------------------------------------------------------
      75              : 
      76              : //-----------------------------------------------------------------------------
      77              : void
      78            0 : I2CSlave::write_i2c(uint32_t i2c_device_address, // NOLINT(build/unsigned)
      79              :                     uint32_t i2c_reg_address,    // NOLINT(build/unsigned)
      80              :                     uint8_t data,                // NOLINT(build/unsigned)
      81              :                     bool send_stop) const
      82              : {
      83            0 :   m_i2c_master->write_i2c(i2c_device_address, i2c_reg_address, data, send_stop);
      84            0 : }
      85              : //-----------------------------------------------------------------------------
      86              : 
      87              : //-----------------------------------------------------------------------------
      88              : void
      89            0 : I2CSlave::write_i2c(uint32_t i2c_reg_address, uint8_t data, bool send_stop) const // NOLINT(build/unsigned)
      90              : {
      91            0 :   m_i2c_master->write_i2c(m_i2c_device_address, i2c_reg_address, data, send_stop);
      92            0 : }
      93              : //-----------------------------------------------------------------------------
      94              : 
      95              : //-----------------------------------------------------------------------------
      96              : std::vector<uint8_t>                                    // NOLINT(build/unsigned)
      97            0 : I2CSlave::read_i2cArray(uint32_t i2c_device_address,    // NOLINT(build/unsigned)
      98              :                         uint32_t i2c_reg_address,       // NOLINT(build/unsigned)
      99              :                         uint32_t number_of_words) const // NOLINT(build/unsigned)
     100              : {
     101            0 :   return m_i2c_master->read_i2cArray(i2c_device_address, i2c_reg_address, number_of_words);
     102              : }
     103              : //-----------------------------------------------------------------------------
     104              : 
     105              : //-----------------------------------------------------------------------------
     106              : std::vector<uint8_t>                                                              // NOLINT(build/unsigned)
     107            0 : I2CSlave::read_i2cArray(uint32_t i2c_reg_address, uint32_t number_of_words) const // NOLINT(build/unsigned)
     108              : {
     109            0 :   return m_i2c_master->read_i2cArray(m_i2c_device_address, i2c_reg_address, number_of_words);
     110              : }
     111              : //-----------------------------------------------------------------------------
     112              : 
     113              : //-----------------------------------------------------------------------------
     114              : std::vector<uint8_t>                                           // NOLINT(build/unsigned)
     115            0 : I2CSlave::read_i2cArray_atomic(uint32_t i2c_device_address,    // NOLINT(build/unsigned)
     116              :                         uint32_t i2c_reg_address,              // NOLINT(build/unsigned)
     117              :                         uint32_t number_of_words) const        // NOLINT(build/unsigned)
     118              : {
     119            0 :   return m_i2c_master->read_i2cArray(i2c_device_address, i2c_reg_address, number_of_words, true);
     120              : }
     121              : //-----------------------------------------------------------------------------
     122              : 
     123              : //-----------------------------------------------------------------------------
     124              : std::vector<uint8_t>                                                                     // NOLINT(build/unsigned)
     125            0 : I2CSlave::read_i2cArray_atomic(uint32_t i2c_reg_address, uint32_t number_of_words) const // NOLINT(build/unsigned)
     126              : {
     127            0 :   return m_i2c_master->read_i2cArray(m_i2c_device_address, i2c_reg_address, number_of_words, true);
     128              : }
     129              : //-----------------------------------------------------------------------------
     130              : 
     131              : //-----------------------------------------------------------------------------
     132              : void
     133            0 : I2CSlave::write_i2cArray(uint32_t i2c_device_address, // NOLINT(build/unsigned)
     134              :                          uint32_t i2c_reg_address,    // NOLINT(build/unsigned)
     135              :                          std::vector<uint8_t> data,   // NOLINT(build/unsigned)
     136              :                          bool send_stop) const
     137              : {
     138            0 :   m_i2c_master->write_i2cArray(i2c_device_address, i2c_reg_address, data, send_stop);
     139            0 : }
     140              : //-----------------------------------------------------------------------------
     141              : 
     142              : //-----------------------------------------------------------------------------
     143              : void
     144            0 : I2CSlave::write_i2cArray(uint32_t i2c_reg_address,  // NOLINT(build/unsigned)
     145              :                          std::vector<uint8_t> data, // NOLINT(build/unsigned)
     146              :                          bool send_stop) const
     147              : {
     148            0 :   m_i2c_master->write_i2cArray(m_i2c_device_address, i2c_reg_address, data, send_stop);
     149            0 : }
     150              : //-----------------------------------------------------------------------------
     151              : 
     152              : // comodity functions
     153              : //-----------------------------------------------------------------------------
     154              : std::vector<uint8_t>                                        // NOLINT(build/unsigned)
     155            0 : I2CSlave::read_i2cPrimitive(uint32_t number_of_bytes) const // NOLINT(build/unsigned)
     156              : {
     157            0 :   return m_i2c_master->read_i2cPrimitive(m_i2c_device_address, number_of_bytes);
     158              : }
     159              : //-----------------------------------------------------------------------------
     160              : 
     161              : //-----------------------------------------------------------------------------
     162              : void
     163            0 : I2CSlave::write_i2cPrimitive(const std::vector<uint8_t>& data, bool send_stop) const // NOLINT(build/unsigned)
     164              : {
     165            0 :   m_i2c_master->write_i2cPrimitive(m_i2c_device_address, data, send_stop);
     166            0 : }
     167              : //-----------------------------------------------------------------------------
     168              : 
     169              : //-----------------------------------------------------------------------------
     170              : bool
     171            0 : I2CSlave::ping(bool throw_excp) const
     172              : {
     173            0 :   return m_i2c_master->ping(m_i2c_device_address, throw_excp);
     174              : }
     175              : //-----------------------------------------------------------------------------
     176              : 
     177              : //-----------------------------------------------------------------------------
     178              : std::string
     179            0 : I2CSlave::get_master_id() const
     180              : {
     181            0 :   return m_i2c_master->getId();
     182              : }
     183              : //-----------------------------------------------------------------------------
     184              : 
     185              : } // namespace timing
     186              : } // namespace dunedaq
        

Generated by: LCOV version 2.0-1