pflib v3.9.0-rc3-11-g2537d8f
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 reset_link() = 0;
26
27 virtual void run_linktrick() {}
28 virtual bool get_rx_polarity() = 0;
29 virtual bool get_tx_polarity() = 0;
30 virtual void set_rx_polarity(bool polarity) = 0;
31 virtual void set_tx_polarity(bool polarity) = 0;
32
33 virtual std::map<std::string, uint32_t> opto_status() = 0;
34 virtual std::map<std::string, uint32_t> opto_rates() = 0;
35
36 // get the necessary transport for creating an lpGBT object for the given link
37 virtual lpGBT_ConfigTransport& lpgbt_transport() = 0;
38
39 // get an lpGBT object using the transport
40 lpGBT& lpgbt() {
41 if (!lpgbt_) lpgbt_ = std::make_unique<lpGBT>(lpgbt_transport());
42 return *lpgbt_;
43 }
44
45 // setup various aspects
48 virtual int get_elink_tx_mode(int elink) = 0;
49 virtual void set_elink_tx_mode(int elink, int mode) = 0;
50
51 virtual void capture_ec(int mode, std::vector<uint8_t>& tx,
52 std::vector<uint8_t>& rx) = 0;
53 virtual void capture_ic(int mode, std::vector<uint8_t>& tx,
54 std::vector<uint8_t>& rx) = 0;
55
56 private:
58};
59
60} // namespace pflib
61
62#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