pflib v3.9.4-7-gb2e7f4f
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
ROC.h
1#ifndef PFLIB_ROC_H_INCLUDED
2#define PFLIB_ROC_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 ROC {
19 static const int N_REGISTERS_PER_PAGE = 32;
20
21 public:
22 ROC(std::shared_ptr<I2C> i2c, uint8_t roc_base_addr,
23 const std::string& type_version);
24
25 void setRunMode(bool active = true);
26 bool isRunMode();
27 const std::string& type() const;
28
29 std::vector<uint8_t> readPage(int ipage, int len);
30 uint8_t getValue(int page, int offset);
31 void setValue(int page, int offset, uint8_t value);
32
33 std::vector<std::string> getDirectAccessParameters();
34 bool getDirectAccess(const std::string& name);
35 bool getDirectAccess(int reg, int bit);
36 void setDirectAccess(const std::string& name, bool val);
37 void setDirectAccess(int reg, int bit, bool val);
38
45 void setRegisters(const std::map<int, std::map<int, uint8_t>>& registers);
46
54 const std::map<int, std::map<int, uint8_t>>& selected = {});
55
63 void loadRegisters(const std::string& file_path);
64
71
82
95
104 void loadParameters(const std::string& file_path, bool prepend_defaults);
105
115 void applyParameter(const std::string& page, const std::string& param,
116 const uint64_t& val);
117
125 void dumpSettings(const std::string& filepath, bool decompile);
126
131 std::map<int, std::map<int, uint8_t>> previous_registers_;
132 ROC& roc_;
133
134 public:
142 ROC& roc,
148 TestParameters& operator=(const TestParameters&) = delete;
150 class Builder {
152 ROC& roc_;
153
154 public:
155 Builder(ROC& roc);
156 Builder& add(const std::string& page, const std::string& param,
157 const uint64_t& val);
158 Builder& add_all_channels(const std::string& param, const uint64_t& val);
159 [[nodiscard]] TestParameters apply();
160 };
161 };
162
184
185 private:
187 uint8_t roc_base_;
188 std::string type_version_;
189 Compiler compiler_;
190 mutable ::pflib::logging::logger the_log_{::pflib::logging::get("roc")};
191};
192
193} // namespace pflib
194
195#endif // PFLIB_ROC_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 ROC.h:150
test certain parameters before setting them back to old values
Definition ROC.h:130
TestParameters(const TestParameters &)=delete
cannot copy or assign this lock
~TestParameters()
applies the unset parameters to the ROC
Definition ROC.cxx:356
TestParameters(ROC &roc, std::map< std::string, std::map< std::string, uint64_t > > new_params)
Construct a set of test parameters.
Definition ROC.cxx:350
Definition ROC.h:18
void dumpSettings(const std::string &filepath, bool decompile)
Dump the settings of the HGCROC into the input filepath.
Definition ROC.cxx:301
std::map< int, std::map< int, uint8_t > > applyParameters(const std::map< std::string, std::map< std::string, uint64_t > > &parameters)
Apply the input parameter mapping onto the chip.
Definition ROC.cxx:240
void loadParameters(const std::string &file_path, bool prepend_defaults)
Load the input parameters onto the chip.
Definition ROC.cxx:272
std::map< std::string, uint64_t > getParameters(const std::string &page)
Get the parameters for the input page.
Definition ROC.cxx:214
TestParameters::Builder testParameters()
start a set of test parameters
Definition ROC.cxx:380
void setRegisters(const std::map< int, std::map< int, uint8_t > > &registers)
set registers on the HGCROC to specific values
Definition ROC.cxx:163
void loadRegisters(const std::string &file_path)
set registers on the HGCROC to specific values
Definition ROC.cxx:203
std::map< std::string, std::map< std::string, uint64_t > > defaults()
Retrieve all of the manual-documented defaults for all parameters.
Definition ROC.cxx:236
std::map< int, std::map< int, uint8_t > > getRegisters(const std::map< int, std::map< int, uint8_t > > &selected={})
get registers from the HGCROC
Definition ROC.cxx:171
void applyParameter(const std::string &page, const std::string &param, const uint64_t &val)
Short-hand for applying a single parameter.
Definition ROC.cxx:294
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
static void roc(const std::string &cmd, Target *pft)
ROC menu commands.
Definition roc.cxx:121