pflib v3.14.3-4-g3289bd3
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/TempParameters.h"
12#include "pflib/logging/Logging.h"
13
14namespace pflib {
15
19class ROC {
20 static const int N_REGISTERS_PER_PAGE = 32;
21
22 public:
23 ROC(std::shared_ptr<I2C> i2c, uint8_t roc_base_addr,
24 const std::string& type_version);
25
26 void setRunMode(bool active = true);
27 bool isRunMode();
28 const std::string& type() const;
29
30 std::vector<uint8_t> readPage(int ipage, int len);
31 void writePage(int ipage, std::vector<uint8_t> vals);
32 uint8_t getValue(int page, int offset);
33 void setValue(int page, int offset, uint8_t value);
34
35 std::vector<std::string> getDirectAccessParameters();
36 bool getDirectAccess(const std::string& name);
37 bool getDirectAccess(int reg, int bit);
38 void setDirectAccess(const std::string& name, bool val);
39 void setDirectAccess(int reg, int bit, bool val);
40
47 void setRegisters(const std::map<int, std::map<int, uint8_t>>& registers);
48
56 const std::map<int, std::map<int, uint8_t>>& selected = {});
57
64
75
88
97 void loadParameters(const std::string& file_path, bool prepend_defaults);
98
108 void applyParameter(const std::string& page, const std::string& param,
109 const uint64_t& val);
110
120 void dumpSettings(const std::string& filepath, bool decompile, bool use_csv);
121
133 void loadSettings(const std::string& filepath, bool is_csv);
134
156
157 private:
159 uint8_t roc_base_;
160 std::string type_version_;
161 Compiler compiler_;
162 mutable ::pflib::logging::logger the_log_{::pflib::logging::get("roc")};
163};
164
165} // namespace pflib
166
167#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
Definition ROC.h:19
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:362
void loadParameters(const std::string &file_path, bool prepend_defaults)
Load the input parameters onto the chip.
Definition ROC.cxx:414
std::map< std::string, uint64_t > getParameters(const std::string &page)
Get the parameters for the input page.
Definition ROC.cxx:336
TempParameters< ROC >::Builder testParameters()
start a set of test parameters
Definition ROC.cxx:511
void setRegisters(const std::map< int, std::map< int, uint8_t > > &registers)
set registers on the HGCROC to specific values
Definition ROC.cxx:272
void dumpSettings(const std::string &filepath, bool decompile, bool use_csv)
Dump the settings of the HGCROC into the input filepath.
Definition ROC.cxx:443
std::vector< uint8_t > readPage(int ipage, int len)
Definition ROC.cxx:52
std::map< std::string, std::map< std::string, uint64_t > > defaults()
Retrieve all of the manual-documented defaults for all parameters.
Definition ROC.cxx:358
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:280
void loadSettings(const std::string &filepath, bool is_csv)
load the settings from the input filepath onto the HGCROC
Definition ROC.cxx:312
void writePage(int ipage, std::vector< uint8_t > vals)
Definition ROC.cxx:104
void applyParameter(const std::string &page, const std::string &param, const uint64_t &val)
Short-hand for applying a single parameter.
Definition ROC.cxx:436
Build a TempParameters class parameter by parameters.
Definition TempParameters.h:41
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