pflib v3.9.4-7-gb2e7f4f
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
OptoLink.h
1#ifndef LPGBT_OPTOLINK_INCLUDED
2#define LPGBT_OPTOLINK_INCLUDED 1
3
4#include <stdint.h>
5
6#include <map>
7#include <memory>
8#include <string>
9#include <vector>
10
11#include "pflib/lpGBT.h"
12
13namespace pflib {
14
18class OptoLink {
19 public:
21 virtual int ilink() = 0;
23 virtual bool is_bidirectional() { return true; }
25 virtual void soft_reset_link() {}
27 virtual void reset_link() = 0;
28
29 virtual void run_linktrick() {}
30 virtual bool get_rx_polarity() = 0;
31 virtual bool get_tx_polarity() = 0;
32 virtual void set_rx_polarity(bool polarity) = 0;
33 virtual void set_tx_polarity(bool polarity) = 0;
34
35 virtual std::map<std::string, uint32_t> opto_status() = 0;
36 virtual std::map<std::string, uint32_t> opto_rates() = 0;
37
38 // get the necessary transport for creating an lpGBT object for the given link
39 virtual lpGBT_ConfigTransport& lpgbt_transport() = 0;
40
41 // get an lpGBT object using the transport
42 lpGBT& lpgbt() {
43 if (!lpgbt_) lpgbt_ = std::make_unique<lpGBT>(lpgbt_transport());
44 return *lpgbt_;
45 }
46
47 // setup various aspects
50 virtual int get_elink_tx_mode(int elink) = 0;
51 virtual void set_elink_tx_mode(int elink, int mode) = 0;
52
53 virtual void capture_ec(int mode, std::vector<uint8_t>& tx,
54 std::vector<uint8_t>& rx) = 0;
55 virtual void capture_ic(int mode, std::vector<uint8_t>& tx,
56 std::vector<uint8_t>& rx) = 0;
57
58 private:
60};
61
62} // namespace pflib
63
64#endif // LPGBT_OPTOLINKS_INCLUDED
Definition lpGBT.h:16
Class which provides an interface with an lpGBT ASIC as mounted on an LDMX mezzanine.
Definition lpGBT.h:52
This version of the fast control code interfaces with the CMS Fast control library which can be contr...
Definition Backend.cxx:3