LCOV - code coverage report
Current view: top level - sspmodules/src/anlBoard - Device.hpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 1 0
Test Date: 2025-12-21 13:07:08 Functions: 0.0 % 1 0

            Line data    Source code
       1              : /**
       2              :  * @file Device.h
       3              :  *
       4              :  * This is part of the DUNE DAQ , copyright 2020.
       5              :  * Licensing/copyright details are in the COPYING file that you should have
       6              :  * received with this code.
       7              :  */
       8              : #ifndef SSPMODULES_SRC_ANLBOARD_DEVICE_HPP_
       9              : #define SSPMODULES_SRC_ANLBOARD_DEVICE_HPP_
      10              : 
      11              : //#include "ftd2xx.h"
      12              : 
      13              : #include <cstdio>
      14              : #include <cstring>
      15              : #include <iomanip>
      16              : #include <iostream>
      17              : #include <stdint.h>
      18              : #include <string>
      19              : #include <unistd.h>
      20              : #include <vector>
      21              : 
      22              : namespace dunedaq {
      23              : namespace sspmodules {
      24              : 
      25              : // PABC defining low-level interface to an SSP board.
      26              : // Actual hardware calls must be implemented by derived classes.
      27              : class Device
      28              : {
      29              : 
      30              :   // Allow the DeviceManager access to call Open() to prepare
      31              :   // the hardware for use. User code must then call
      32              :   // DeviceManager::OpenDevice() to get a pointer to the object
      33              :   friend class DeviceManager;
      34              : 
      35              : public:
      36            0 :   virtual ~Device(){}
      37              : 
      38              :   // Return whether device is currently open
      39              :   virtual bool IsOpen() = 0;
      40              : 
      41              :   // Close the device. In order to open the device again, another device needs to be
      42              :   // requested from the DeviceManager
      43              :   virtual void Close() = 0;
      44              : 
      45              :   // Flush communication channel
      46              :   virtual void DevicePurgeComm() = 0;
      47              : 
      48              :   // Flush data channel
      49              :   virtual void DevicePurgeData() = 0;
      50              : 
      51              :   // Get number of bytes in data queue (put into numWords)
      52              :   virtual void DeviceQueueStatus(unsigned int* numWords) = 0;
      53              : 
      54              :   // Read data into vector, up to defined size
      55              :   virtual void DeviceReceive(std::vector<unsigned int>& data, unsigned int size) = 0;
      56              : 
      57              :   //============================//
      58              :   // Read from/write to registers//
      59              :   //============================//
      60              :   // Where mask is given, only read/write bits which are high in mask
      61              : 
      62              :   virtual void DeviceRead(unsigned int address, unsigned int* value) = 0;
      63              : 
      64              :   virtual void DeviceReadMask(unsigned int address, unsigned int mask, unsigned int* value) = 0;
      65              : 
      66              :   virtual void DeviceWrite(unsigned int address, unsigned int value) = 0;
      67              : 
      68              :   virtual void DeviceWriteMask(unsigned int address, unsigned int mask, unsigned int value) = 0;
      69              : 
      70              :   // Set bits high in mask to 1
      71              :   virtual void DeviceSet(unsigned int address, unsigned int mask) = 0;
      72              : 
      73              :   // Set bits high in mask to 0
      74              :   virtual void DeviceClear(unsigned int address, unsigned int mask) = 0;
      75              : 
      76              :   // Read series of contiguous registers, number to read given in "size"
      77              :   virtual void DeviceArrayRead(unsigned int address, unsigned int size, unsigned int* data) = 0;
      78              : 
      79              :   // Write series of contiguous registers, number to write given in "size"
      80              :   virtual void DeviceArrayWrite(unsigned int address, unsigned int size, unsigned int* data) = 0;
      81              : 
      82              :   //=============================
      83              : 
      84              : protected:
      85              :   bool fSlowControlOnly;
      86              : 
      87              : private:
      88              :   // Device can only be opened from the DeviceManager.
      89              :   virtual void Open(bool slowControlOnly = false) = 0;
      90              : };
      91              : 
      92              : } // namespace sspmodules
      93              : } // namespace dunedaq
      94              : 
      95              : #endif // SSPMODULES_SRC_ANLBOARD_DEVICE_HPP_
        

Generated by: LCOV version 2.0-1