pflib v2.7.0-1-gd371ab6a
Polarfire Interaction Library
PolarfireTarget.h
1#ifndef PFLIB_POLARFIRETARGET_H
2#define PFLIB_POLARFIRETARGET_H
3
4#include <ostream>
5#include <memory>
6#include <functional>
7#include <string>
8
9#include "pflib/WishboneInterface.h"
10#include "pflib/Backend.h"
11#include "pflib/Hcal.h"
12
21namespace pflib {
22
43 static const int N_PAGES;
45 static const int N_REGISTERS_PER_PAGE;
51 static int NLINKS;
52
64 PolarfireTarget(WishboneInterface* wbi, Backend* be, bool same = false);
65
76 template<class T>
77 PolarfireTarget(T* t) : PolarfireTarget(t,t,true) {};
78
84
90
100 std::vector<uint32_t> elinksBigSpy(int ilink, int presamples, bool do_l1a);
101
106 void elinkStatus(std::ostream& os);
107
124 void loadIntegerCSV(const std::string& file_name,
125 const std::function<void(const std::vector<int>&)>& Action);
126
135 void loadROCRegisters(int roc, const std::string& file_name);
136
145 void loadROCParameters(int roc, const std::string& file_name, bool prepend_defaults);
146
151
156
164 void dumpSettings(int roc, const std::string& file_name, bool decompile);
165
166 void prepareNewRun();
167
172 void daqStatus(std::ostream& os);
173
178 void enableZeroSuppression(int link, bool full_suppress);
179
184 void daqSoftReset();
185
190 void daqHardReset();
191
197
203
207 void setBiasSetting(int board, bool led, int hdmi, int val);
208
226 bool loadBiasSettings(const std::string& file_name);
227
229 void elink_relink(int ilink,int min_delay = 0, int max_delay = 128);
230
240 void delay_loop(int ilink, int min_delay, int max_delay);
241
255 bool bitslip_loop(int ilink, int& best_slip, int& best_count);
256
257 private:
258 int samples_per_event_;
259 std::vector<std::string> default_configs_;
260};
261
262}
263
264#endif
Abstract interface for various backend manipulations.
Definition: Backend.h:16
representing a standard HCAL motherboard
Definition: Hcal.h:17
Abstract interface for wishbone transactions, used by ~all classes in pflib.
Definition: WishboneInterface.h:15
Polarfire Interaction Library.
Definition: Backend.h:8
std::map< std::string, std::map< std::string, int > > decompile(const std::map< int, std::map< int, uint8_t > > &compiled_config, bool be_careful)
unpack register values into the page names, parameter names and parameter values mapping
Definition: Compile.cxx:474
Interface to a single polarfire.
Definition: PolarfireTarget.h:33
bool loadBiasSettings(const std::string &file_name)
Definition: PolarfireTarget.cxx:441
Backend * backend
handle to opened backend connection
Definition: PolarfireTarget.h:39
PolarfireTarget(T *t)
If only a single pointer is provided, assume that object is BOTH the WBI and backend.
Definition: PolarfireTarget.h:77
void loadDefaultROCParameters()
Loads the default ROC config on boards where it is specified.
Definition: PolarfireTarget.cxx:205
void daqStatus(std::ostream &os)
Print a decoded daq status to the input ostream MOVE TO DAQ.
Definition: PolarfireTarget.cxx:289
void enableZeroSuppression(int link, bool full_suppress)
Enable zero suppression in the input link.
Definition: PolarfireTarget.cxx:331
void elinkStatus(std::ostream &os)
Print a decoded elink status to the input ostream MOVE TO ELINKS.
Definition: PolarfireTarget.cxx:115
~PolarfireTarget()
Cleanup the wishbone interface and backend checking if they are the same.
Definition: PolarfireTarget.cxx:90
WishboneInterface * wb
handle to opened wishbone interface
Definition: PolarfireTarget.h:37
static const int N_REGISTERS_PER_PAGE
number of registers per page of HGC ROC
Definition: PolarfireTarget.h:45
void dumpSettings(int roc, const std::string &file_name, bool decompile)
Request all of the ROC setting register values.
Definition: PolarfireTarget.cxx:217
void loadIntegerCSV(const std::string &file_name, const std::function< void(const std::vector< int > &)> &Action)
Load an integer CSV and pass the rows one at a time to the input Action.
Definition: PolarfireTarget.cxx:157
bool bitslip_loop(int ilink, int &best_slip, int &best_count)
check all bitslip values and find the one with the most correct idle patterns
Definition: PolarfireTarget.cxx:491
static int NLINKS
number of links
Definition: PolarfireTarget.h:51
void delay_loop(int ilink, int min_delay, int max_delay)
Go from min_delay up to max_delay stopping only if alignment is achieved.
Definition: PolarfireTarget.cxx:474
std::vector< uint32_t > elinksBigSpy(int ilink, int presamples, bool do_l1a)
Entire ldmx_link function commented out pretty much.
Definition: PolarfireTarget.cxx:107
void daqSoftReset()
daq soft reset stays here becauses uses FC as well as DAQ
Definition: PolarfireTarget.cxx:350
std::vector< uint32_t > daqReadEvent()
daq read event make sure to prepareNewRun before!
Definition: PolarfireTarget.cxx:378
void elink_relink(int ilink, int min_delay=0, int max_delay=128)
Carries out the standard elink alignment process.
Definition: PolarfireTarget.cxx:465
Hcal hcal
object representing hcal motherboard
Definition: PolarfireTarget.h:41
std::vector< uint32_t > daqReadDirect()
daq read direct uses backend
Definition: PolarfireTarget.cxx:368
void daqHardReset()
daq hard reset stays here because uses backend
Definition: PolarfireTarget.cxx:362
bool wb_be_same
are the WBI and Backend the same object?
Definition: PolarfireTarget.h:35
void findDefaultROCParameters(std::vector< std::string > paths)
Stores paths of default ROC config files, as given by the pftoolrc.
Definition: PolarfireTarget.cxx:201
void setBiasSetting(int board, bool led, int hdmi, int val)
set a single bias setting
Definition: PolarfireTarget.cxx:435
void loadROCRegisters(int roc, const std::string &file_name)
Load register values onto ROC chip from inptu file.
Definition: PolarfireTarget.cxx:174
std::pair< int, int > getFirmwareVersion()
deduce firmware major/minor version
Definition: PolarfireTarget.cxx:102
static const int N_PAGES
number of availabe pages on HGC ROC
Definition: PolarfireTarget.h:43
void loadROCParameters(int roc, const std::string &file_name, bool prepend_defaults)
Compile the input YAML file including the defaults if prepend_defaults is true, otherwise using curre...
Definition: PolarfireTarget.cxx:187
PolarfireTarget(WishboneInterface *wbi, Backend *be, bool same=false)
Define where the polarfire we will be talking to is.
Definition: PolarfireTarget.cxx:87