pflib v3.9.5-18-g30f792c
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 uint8_t getValue(int page, int offset);
32 void setValue(int page, int offset, uint8_t value);
33
34 std::vector<std::string> getDirectAccessParameters();
35 bool getDirectAccess(const std::string& name);
36 bool getDirectAccess(int reg, int bit);
37 void setDirectAccess(const std::string& name, bool val);
38 void setDirectAccess(int reg, int bit, bool val);
39
46 void setRegisters(const std::map<int, std::map<int, uint8_t>>& registers);
47
55 const std::map<int, std::map<int, uint8_t>>& selected = {});
56
64 void loadRegisters(const std::string& file_path);
65
72
83
96
105 void loadParameters(const std::string& file_path, bool prepend_defaults);
106
116 void applyParameter(const std::string& page, const std::string& param,
117 const uint64_t& val);
118
126 void dumpSettings(const std::string& filepath, bool decompile);
127
149
150 private:
152 uint8_t roc_base_;
153 std::string type_version_;
154 Compiler compiler_;
155 mutable ::pflib::logging::logger the_log_{::pflib::logging::get("roc")};
156};
157
158} // namespace pflib
159
160#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
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
TempParameters< ROC >::Builder testParameters()
start a set of test parameters
Definition ROC.cxx:350
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
Build a TempParameters class parameter by parameters.
Definition TempParameters.h:23
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