pflib v3.9.4-21-gd880bab
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
ECON.h
1#ifndef PFLIB_ECON_H_INCLUDED
2#define PFLIB_ECON_H_INCLUDED
3
4#include <iostream>
5#include <map>
6#include <string>
7#include <vector>
8
9#include "pflib/Compile.h"
10#include "pflib/I2C.h"
11#include "pflib/logging/Logging.h"
12
13namespace pflib {
14
18class ECON {
19 public:
20 ECON(std::shared_ptr<I2C> i2c, uint8_t econ_base_addr,
21 const std::string& type_version);
22
23 ECON(const ECON&) = delete;
24 ECON& operator=(const ECON&) = delete;
25
26 const std::string& type() const { return type_; }
27 void setRunMode(bool active = true, int edgesel = -1, int fcmd_invert = -1);
28 int getPUSMRunValue();
29 int getPUSMStateValue();
30 bool isRunMode();
32 int nLinks();
33
34 std::vector<uint8_t> getValues(int reg_addr, int nbytes);
35 void setValue(int reg_addr, uint64_t value, int nbytes);
36 void setValues(int reg_addr, const std::vector<uint8_t>& values);
37
38 void setRegisters(const std::map<int, std::map<int, uint8_t>>& registers);
39 void loadParameters(const std::string& file_path, bool prepend_defaults);
41 const std::map<int, std::map<int, uint8_t>>& selected);
44 void applyParameter(const std::string& page, const std::string& param,
45 const uint64_t& val);
46
49 bool print_values = true);
51 const std::string& file_path);
52 uint64_t readParameter(const std::string& page, const std::string& param,
53 bool print_values = false);
54
55 void dumpSettings(const std::string& filename, bool should_decompile);
56
58 std::map<int, std::map<int, uint8_t>> previous_registers_;
59 ECON& econ_;
60
61 public:
63 ECON& econ,
69 TestParameters& operator=(const TestParameters&) = delete;
71 class Builder {
73 ECON& econ_;
74
75 public:
77 Builder& add(const std::string& page, const std::string& param,
78 const uint64_t& val);
79 [[nodiscard]] TestParameters apply();
80 };
81 };
82
83 TestParameters::Builder testParameters();
84
85 private:
87 uint8_t econ_base_;
88 Compiler compiler_;
89 std::string type_;
90 std::map<uint16_t, size_t> econ_reg_nbytes_lut_;
91 mutable ::pflib::logging::logger the_log_{::pflib::logging::get("econ")};
92};
93
94} // namespace pflib
95
96#endif // PFLIB_ECON_H_INCLUDED
Definition of compiling and decompiling functions between page numbers, register numbers,...
The object that does the compiling.
Definition Compile.h:55
Build a TestParameters parameter by parameter.
Definition ECON.h:71
Definition ECON.h:57
~TestParameters()
applies the unset parameters to the ECON
Definition ECON.cxx:458
TestParameters(const TestParameters &)=delete
cannot copy or assign this lock
Definition ECON.h:18
std::map< int, std::map< int, uint8_t > > applyParameters(const std::map< std::string, std::map< std::string, uint64_t > > &parameters)
Definition ECON.cxx:277
void dumpSettings(const std::string &filename, bool should_decompile)
Definition ECON.cxx:374
int nLinks()
get the number of readout links that are enabled
Definition ECON.cxx:433
void loadParameters(const std::string &file_path, bool prepend_defaults)
Definition ECON.cxx:316
static void econ(const std::string &cmd, Target *pft)
ECON menu commands.
Definition econ.cxx:147
logger get(const std::string &name)
Gets a logger with the input name for its channel.
Definition Logging.cxx:24
This version of the fast control code interfaces with the CMS Fast control library which can be contr...
Definition Backend.cxx:3