DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
DeviceInterface.hpp
Go to the documentation of this file.
1
8#ifndef SSPMODULES_SRC_ANLBOARD_DEVICEINTERFACE_HPP_
9#define SSPMODULES_SRC_ANLBOARD_DEVICEINTERFACE_HPP_
10
11#include "logging/Logging.hpp"
14
15#include "DeviceManager.hpp"
16#include "Device.hpp"
17#include "EventPacket.hpp"
18
19#include <string>
20#include <memory>
21#include <map>
22#include <deque>
23#include <queue>
24#include <vector>
25
26namespace dunedaq {
27namespace sspmodules {
28
30 unsigned long startTime; // NOLINT(runtime/int)
31 unsigned long endTime; // NOLINT(runtime/int)
32 unsigned long triggerTime; // NOLINT(runtime/int)
33 unsigned short triggerType; // NOLINT(runtime/int)
34};
35
37
38public:
39
41
42 //Just sets the fields needed to request the device.
43 //Real work is done in Initialize which is called manually.
44 explicit DeviceInterface();
45
47
48 void OpenSlowControl();
49
51
52
53 //Called by ReadEvents
54 //Get an event off the hardware buffer.
55 //Timeout after some wait period
57
58 //Obtain current state of device
59 //inline State_t State(){return fState;}
60
61 //Setter for single register
62 //If mask is given then only bits which are high in the mask will be set.
63 void SetRegister(unsigned int address, unsigned int value, unsigned int mask=0xFFFFFFFF);
64
65 //Setter for series of contiguous registers, with vector input
66 void SetRegisterArray(unsigned int address, std::vector<unsigned int> value);
67
68 //Setter for series of contiguous registers, with C array input
69 void SetRegisterArray(unsigned int address, unsigned int* value, unsigned int size);
70
71 //Getter for single register
72 //If mask is set then bits which are low in the mask will be returned as zeros.
73 void ReadRegister(unsigned int address, unsigned int& value, unsigned int mask=0xFFFFFFFF);
74
75 //Getter for series of contiguous registers, with vector output
76 void ReadRegisterArray(unsigned int address, std::vector<unsigned int>& value, unsigned int size);
77
78 //Getter for series of contiguous registers, with C array output
79 void ReadRegisterArray(unsigned int address, unsigned int* value, unsigned int size);
80
81 //Methods to set registers with names (as defined in SSPDAQ::RegMap)
82
83 //Set single named register
84 void SetRegisterByName(std::string name, unsigned int value);
85
86 //Set single element of an array of registers
87 void SetRegisterElementByName(std::string name, unsigned int index, unsigned int value);
88
89 //Set all elements of an array to a single value
90 void SetRegisterArrayByName(std::string name, unsigned int value);
91
92 //Set all elements of an array using values vector
93 void SetRegisterArrayByName(std::string name, std::vector<unsigned int> values);
94
95 //Read single named register
96 void ReadRegisterByName(std::string name, unsigned int& value);
97
98 //Read single element of an array of registers
99 void ReadRegisterElementByName(std::string name, unsigned int index, unsigned int& value);
100
101 //Read all elements of an array into values vector
102 void ReadRegisterArrayByName(std::string name, std::vector<unsigned int>& values);
103
104 void SetHardwareClockRateInMHz(unsigned int rate){fHardwareClockRateInMHz = rate;}
105
107
109
110 void SetPartitionNumber(unsigned int val){fPartitionNumber=val;}
111
112 void SetTimingAddress(unsigned int val){fTimingAddress=val;}
113
114 void PrintHardwareState();
115
116 std::string GetIdentifier();
117
118 bool exception() const { return exception_.load(); }
119
120private:
121
122 //Internal device object used for hardware operations.
123 //Owned by the device manager, not this object.
125
126 //Index of the device in the hardware-returned list
127 unsigned long fDeviceId; // NOLINT(runtime/int)
128
129 //Holds current device state. Hopefully this matches the state of the
130 //hardware itself.
132
133 void set_exception( bool exception ) { exception_.store( exception ); }
134
136
138
140
142
143 unsigned int fPartitionNumber;
144
145 unsigned int fTimingAddress;
146
147
148 std::atomic<bool> exception_;
149
150};
151
152} // namespace sspmodules
153} // namespace dunedaq
154
155#endif // SSPMODULES_SRC_ANLBOARD_DEVICEINTERFACE_HPP_
void SetRegisterByName(std::string name, unsigned int value)
void SetRegister(unsigned int address, unsigned int value, unsigned int mask=0xFFFFFFFF)
void ReadRegister(unsigned int address, unsigned int &value, unsigned int mask=0xFFFFFFFF)
void SetHardwareClockRateInMHz(unsigned int rate)
void ReadRegisterArray(unsigned int address, std::vector< unsigned int > &value, unsigned int size)
void ReadEventFromDevice(EventPacket &event)
void SetRegisterArrayByName(std::string name, unsigned int value)
void ReadRegisterArrayByName(std::string name, std::vector< unsigned int > &values)
void SetRegisterElementByName(std::string name, unsigned int index, unsigned int value)
void ReadRegisterByName(std::string name, unsigned int &value)
void ReadRegisterElementByName(std::string name, unsigned int index, unsigned int &value)
void ConfigureLEDCalib(const appmodel::SSPLEDCalibModule *conf)
void SetRegisterArray(unsigned int address, std::vector< unsigned int > value)
Including Qt Headers.
Unable to receive within timeout period(timeout period was " << timeout << " milliseconds)"
FELIX Initialization std::string initerror FELIX queue timed std::string queuename Unexpected chunk size