<commit_before>#ifndef VME_HARDWARE_INCLUDE_VME_BASE_HH_
#define VME_HARDWARE_INCLUDE_VME_BASE_HH_

/*===========================================================================*\

  author: <NAME>
  email:  <EMAIL>
  file:   vme_base.hh

  about:  Implements the some basic vme functionality to form a base
          class that vme devices can inherit.  It really just defines
	  the most basic read, write, and block transfer vme functions.
	  Sis3100VmeDev is a better class to inherit from if more
	  functionality is needed.

\*===========================================================================*/

//--- std includes ----------------------------------------------------------//
#include <ctime>
#include <fcntl.h>
#include <iostream>
#include <errno.h>

//--- other includes --------------------------------------------------------//
#include "boost/property_tree/ptree.hpp"
#include "boost/property_tree/json_parser.hpp"
#include "vme/sis3100_vme_calls.h"
#include "TFile.h"

//--- project includes ------------------------------------------------------//
#include "common_base.hh"
#include "common.hh"

namespace hw {

// This class pulls data from a vme device.
// The template is the data structure for the device.
class VmeBase : virtual public CommonBase {

public:

  // Ctor params:
  // name - used in naming output data
  // conf - load parameters from a json configuration file
  // num_ch_ - number of channels in the digitizer
  // read_trace_len - length of each trace in units of sizeof(uint)
  VmeBase(std::string name, std::string conf) : CommonBase(name) {
    boost::property_tree::ptree pt;
    boost::property_tree::read_json(conf, pt);
    // Get the base address for the device.  Convert from hex.
    base_address_ = std::stoul(pt.get<std::string>("base_address"), nullptr, 0);
  };

  // VmeBase(std::string name, boost::property_tree::ptree pt) :
  // CommonBase(name, conf);

protected:

  const int max_read_attempts_ = 100;
  const int wait_time_us_ = 50;

  int device_;
  int read_len_;
  uint base_address_; // contained in the conf file.

  inline int Read(uint addr, uint &msg);        // A32D32
  inline int Write(uint addr, uint msg);        // A32D32
  inline int Read16(uint addr, ushort &msg);    // A16D16
  inline int Write16(uint addr, ushort msg);    // A16D16
  inline int ReadTrace(uint addr, uint *trace); // 2eVME (A32)
  inline int ReadTrace(uint addr, uint *trace, int trace_len); // 2eVME (A32)
  inline int ReadTraceFifo(uint addr, uint *trace); // 2eVMEFIFO (A32)
  inline int ReadTraceFifo(uint addr, uint *trace, int trace_len); // 2eVMEFIFO (A32)
  inline int ReadTraceDma32Fifo(uint addr, uint *trace);
  inline int ReadTraceDma32Fifo(uint addr, uint *trace, int trace_len);
  inline int ReadTraceMblt64(uint addr, uint *trace, int trace_len);<commit_msg>Adjusts vme nonblocking pattern.<commit_after>#ifndef VME_HARDWARE_INCLUDE_VME_BASE_HH_
#define VME_HARDWARE_INCLUDE_VME_BASE_HH_

/*===========================================================================*\

  author: <NAME>
  email:  <EMAIL>
  file:   vme_base.hh

  about:  Implements the some basic vme functionality to form a base
          class that vme devices can inherit.  It really just defines
	  the most basic read, write, and block transfer vme functions.
	  Sis3100VmeDev is a better class to inherit from if more
	  functionality is needed.

\*===========================================================================*/

//--- std includes ----------------------------------------------------------//
#include <ctime>
#include <fcntl.h>
#include <iostream>
#include <errno.h>

//--- other includes --------------------------------------------------------//
#include "boost/property_tree/ptree.hpp"
#include "boost/property_tree/json_parser.hpp"
#include "vme/sis3100_vme_calls.h"
#include "TFile.h"

//--- project includes ------------------------------------------------------//
#include "common_base.hh"
#include "common.hh"

namespace hw {

// This class pulls data from a vme device.
// The template is the data structure for the device.
class VmeBase : virtual public CommonBase {

public:

  // Ctor params:
  // name - used in naming output data
  // conf - load parameters from a json configuration file
  // num_ch_ - number of channels in the digitizer
  // read_trace_len - length of each trace in units of sizeof(uint)
  VmeBase(std::string name, std::string conf) : CommonBase(name) {
    boost::property_tree::ptree pt;
    boost::property_tree::read_json(conf, pt);
    // Get the base address for the device.  Convert from hex.
    base_address_ = std::stoul(pt.get<std::string>("base_address"), nullptr, 0);
  };

  // VmeBase(std::string name, boost::property_tree::ptree pt) :
  // CommonBase(name, conf);

protected:

  const int max_read_attempts_ = 100;
  const int wait_time_us_ = 1000;

  int device_;
  int read_len_;
  uint base_address_; // contained in the conf file.

  inline int Read(uint addr, uint &msg);        // A32D32
  inline int Write(uint addr, uint msg);        // A32D32
  inline int Read16(uint addr, ushort &msg);    // A16D16
  inline int Write16(uint addr, ushort msg);    // A16D16
  inline int ReadTrace(uint addr, uint *trace); // 2eVME (A32)
  inline int ReadTrace(uint addr, uint *trace, int trace_len); // 2eVME (A32)
  inline int ReadTraceFifo(uint addr, uint *trace); // 2eVMEFIFO (A32)
  inline int ReadTraceFifo(uint addr, uint *trace, int trace_len); // 2eVMEFIFO (A32)
  inline int ReadTraceDma32Fifo(uint addr, uint *trace);
  inline int ReadTraceDma32Fifo(uint addr, uint *trace, int trace_len);
  inline int ReadTraceMblt64(uint addr, uint *trace, int trace_len);
{'fraction_non_alphanumeric': 0.20931052724387234, 'fraction_numerical': 0.018691588785046728, 'mean_word_length': 3.0084805653710247, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2343885', 'n_tokens_mistral': 1812, 'n_tokens_neox': 1686, 'n_words': 546}