pflib v3.9.0-rc3-11-g2537d8f
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
register_maps_types.h
Go to the documentation of this file.
1
11#pragma once
12
13// need maps and strings for the LUTs
14#include <stdint.h>
15
16#include <map>
17#include <string>
18#include <vector>
19
25 const int reg;
27 const int min_bit;
29 const int n_bits;
31 const int mask;
39 RegisterLocation(int r, int m, int n)
40 : reg{r}, min_bit{m}, n_bits{n}, mask{((1 << n_bits) - 1)} {}
41};
42
47struct Parameter {
49 uint64_t def;
56 Parameter(int r, int m, int n, uint64_t def)
57 : Parameter({RegisterLocation(r, m, n)}, def) {}
59 Parameter() : def{0}, registers{} {}
60};
61
76 const int reg;
78 const int bit_location;
80 const bool def;
81};
82
95template <typename Key, typename Val>
96class NoCopyMap : public std::map<Key, Val> {
97 public:
99 NoCopyMap(const NoCopyMap&) = delete;
100 NoCopyMap& operator=(const NoCopyMap&) = delete;
115 NoCopyMap(const Mapping& contents) : Mapping(contents) {}
116};
117
120
124
128
forward declare register map LUT types
Definition register_maps_types.h:96
NoCopyMap(const Mapping &contents)
Constructor necessary to support a simpler definition syntax.
Definition register_maps_types.h:115
A direct access parameter is used to directly configure the HGCROC I2C connection in a fast but simpl...
Definition register_maps_types.h:73
const int bit_location
the bit location within the register that this parameter is in (0-7)
Definition register_maps_types.h:78
const int reg
the register this parameter is in (relative to the root I2C address of the HGCROC) (4-7)
Definition register_maps_types.h:76
const bool def
the default parameter value
Definition register_maps_types.h:80
A parameter for the HGC ROC includes one or more register locations and a default value defined in th...
Definition register_maps_types.h:47
Parameter()
default constructor for building maps
Definition register_maps_types.h:59
std::vector< RegisterLocation > registers
the locations that the parameter is split over
Definition register_maps_types.h:51
uint64_t def
the default parameter value
Definition register_maps_types.h:49
Parameter(int r, int m, int n, uint64_t def)
short constructor for single-location parameters
Definition register_maps_types.h:56
Parameter(std::initializer_list< RegisterLocation > r, uint64_t def)
pass locations and default value of parameter
Definition register_maps_types.h:53
Structure holding a location in the registers.
Definition register_maps_types.h:23
const int n_bits
the number of bits the location has in the register (1-8)
Definition register_maps_types.h:29
const int reg
the register the parameter is in (0-31)
Definition register_maps_types.h:25
const int mask
the mask for this number of bits
Definition register_maps_types.h:31
RegisterLocation(int r, int m, int n)
Usable constructor.
Definition register_maps_types.h:39
const int min_bit
the min bit the location is in the register (0-7)
Definition register_maps_types.h:27