DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
sspmodules
src
anlBoard
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
"
12
#include "
appmodel/SSPLEDCalibModule.hpp
"
13
#include "
appmodel/SSPRegister.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
26
namespace
dunedaq
{
27
namespace
sspmodules
{
28
29
struct
TriggerInfo
{
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
36
class
DeviceInterface
{
37
38
public
:
39
40
enum
State_t
{
kUninitialized
,
kInitialized
,
kRunning
,
kStopping
,
kStopped
,
kBad
};
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
46
~DeviceInterface
(){ }
47
48
void
OpenSlowControl
();
49
50
void
ConfigureLEDCalib
(
const
appmodel::SSPLEDCalibModule
* conf);
51
52
53
//Called by ReadEvents
54
//Get an event off the hardware buffer.
55
//Timeout after some wait period
56
void
ReadEventFromDevice
(
EventPacket
& event);
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
106
void
SetDummyPeriod
(
int
period){
fDummyPeriod
=period;}
107
108
void
SetUseExternalTimestamp
(
bool
val){
fUseExternalTimestamp
= val;}
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
120
private
:
121
122
//Internal device object used for hardware operations.
123
//Owned by the device manager, not this object.
124
Device
*
fDevice
;
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.
131
State_t
fState
;
132
133
void
set_exception
(
bool
exception
) {
exception_
.store(
exception
); }
134
135
bool
fUseExternalTimestamp
;
136
137
unsigned
int
fHardwareClockRateInMHz
;
138
139
int
fDummyPeriod
;
140
141
bool
fSlowControlOnly
;
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_
DeviceManager.hpp
Device.hpp
EventPacket.hpp
dunedaq::appmodel::SSPLEDCalibModule
Definition
SSPLEDCalibModule.hpp:36
dunedaq::sspmodules::DeviceInterface::fTimingAddress
unsigned int fTimingAddress
Definition
DeviceInterface.hpp:145
dunedaq::sspmodules::DeviceInterface::fUseExternalTimestamp
bool fUseExternalTimestamp
Definition
DeviceInterface.hpp:135
dunedaq::sspmodules::DeviceInterface::fState
State_t fState
Definition
DeviceInterface.hpp:131
dunedaq::sspmodules::DeviceInterface::SetRegisterByName
void SetRegisterByName(std::string name, unsigned int value)
Definition
DeviceInterface.cxx:199
dunedaq::sspmodules::DeviceInterface::exception_
std::atomic< bool > exception_
Definition
DeviceInterface.hpp:148
dunedaq::sspmodules::DeviceInterface::SetRegister
void SetRegister(unsigned int address, unsigned int value, unsigned int mask=0xFFFFFFFF)
Definition
DeviceInterface.cxx:147
dunedaq::sspmodules::DeviceInterface::ReadRegister
void ReadRegister(unsigned int address, unsigned int &value, unsigned int mask=0xFFFFFFFF)
Definition
DeviceInterface.cxx:172
dunedaq::sspmodules::DeviceInterface::~DeviceInterface
~DeviceInterface()
Definition
DeviceInterface.hpp:46
dunedaq::sspmodules::DeviceInterface::PrintHardwareState
void PrintHardwareState()
Definition
DeviceInterface.cxx:406
dunedaq::sspmodules::DeviceInterface::SetHardwareClockRateInMHz
void SetHardwareClockRateInMHz(unsigned int rate)
Definition
DeviceInterface.hpp:104
dunedaq::sspmodules::DeviceInterface::fPartitionNumber
unsigned int fPartitionNumber
Definition
DeviceInterface.hpp:143
dunedaq::sspmodules::DeviceInterface::ReadRegisterArray
void ReadRegisterArray(unsigned int address, std::vector< unsigned int > &value, unsigned int size)
Definition
DeviceInterface.cxx:183
dunedaq::sspmodules::DeviceInterface::State_t
State_t
Definition
DeviceInterface.hpp:40
dunedaq::sspmodules::DeviceInterface::kRunning
@ kRunning
Definition
DeviceInterface.hpp:40
dunedaq::sspmodules::DeviceInterface::kStopping
@ kStopping
Definition
DeviceInterface.hpp:40
dunedaq::sspmodules::DeviceInterface::kBad
@ kBad
Definition
DeviceInterface.hpp:40
dunedaq::sspmodules::DeviceInterface::kInitialized
@ kInitialized
Definition
DeviceInterface.hpp:40
dunedaq::sspmodules::DeviceInterface::kUninitialized
@ kUninitialized
Definition
DeviceInterface.hpp:40
dunedaq::sspmodules::DeviceInterface::kStopped
@ kStopped
Definition
DeviceInterface.hpp:40
dunedaq::sspmodules::DeviceInterface::ReadEventFromDevice
void ReadEventFromDevice(EventPacket &event)
dunedaq::sspmodules::DeviceInterface::fHardwareClockRateInMHz
unsigned int fHardwareClockRateInMHz
Definition
DeviceInterface.hpp:137
dunedaq::sspmodules::DeviceInterface::SetRegisterArrayByName
void SetRegisterArrayByName(std::string name, unsigned int value)
Definition
DeviceInterface.cxx:215
dunedaq::sspmodules::DeviceInterface::exception
bool exception() const
Definition
DeviceInterface.hpp:118
dunedaq::sspmodules::DeviceInterface::SetTimingAddress
void SetTimingAddress(unsigned int val)
Definition
DeviceInterface.hpp:112
dunedaq::sspmodules::DeviceInterface::SetUseExternalTimestamp
void SetUseExternalTimestamp(bool val)
Definition
DeviceInterface.hpp:108
dunedaq::sspmodules::DeviceInterface::GetIdentifier
std::string GetIdentifier()
Definition
DeviceInterface.cxx:395
dunedaq::sspmodules::DeviceInterface::fDevice
Device * fDevice
Definition
DeviceInterface.hpp:124
dunedaq::sspmodules::DeviceInterface::OpenSlowControl
void OpenSlowControl()
Definition
DeviceInterface.cxx:50
dunedaq::sspmodules::DeviceInterface::fSlowControlOnly
bool fSlowControlOnly
Definition
DeviceInterface.hpp:141
dunedaq::sspmodules::DeviceInterface::ReadRegisterArrayByName
void ReadRegisterArrayByName(std::string name, std::vector< unsigned int > &values)
Definition
DeviceInterface.cxx:254
dunedaq::sspmodules::DeviceInterface::fDeviceId
unsigned long fDeviceId
Definition
DeviceInterface.hpp:127
dunedaq::sspmodules::DeviceInterface::set_exception
void set_exception(bool exception)
Definition
DeviceInterface.hpp:133
dunedaq::sspmodules::DeviceInterface::fDummyPeriod
int fDummyPeriod
Definition
DeviceInterface.hpp:139
dunedaq::sspmodules::DeviceInterface::SetPartitionNumber
void SetPartitionNumber(unsigned int val)
Definition
DeviceInterface.hpp:110
dunedaq::sspmodules::DeviceInterface::DeviceInterface
DeviceInterface()
Definition
DeviceInterface.cxx:36
dunedaq::sspmodules::DeviceInterface::SetDummyPeriod
void SetDummyPeriod(int period)
Definition
DeviceInterface.hpp:106
dunedaq::sspmodules::DeviceInterface::SetRegisterElementByName
void SetRegisterElementByName(std::string name, unsigned int index, unsigned int value)
Definition
DeviceInterface.cxx:207
dunedaq::sspmodules::DeviceInterface::ReadRegisterByName
void ReadRegisterByName(std::string name, unsigned int &value)
Definition
DeviceInterface.cxx:236
dunedaq::sspmodules::DeviceInterface::ReadRegisterElementByName
void ReadRegisterElementByName(std::string name, unsigned int index, unsigned int &value)
Definition
DeviceInterface.cxx:244
dunedaq::sspmodules::DeviceInterface::ConfigureLEDCalib
void ConfigureLEDCalib(const appmodel::SSPLEDCalibModule *conf)
Definition
DeviceInterface.cxx:261
dunedaq::sspmodules::DeviceInterface::SetRegisterArray
void SetRegisterArray(unsigned int address, std::vector< unsigned int > value)
Definition
DeviceInterface.cxx:158
dunedaq::sspmodules::Device
Definition
Device.hpp:28
dunedaq::sspmodules::EventPacket
Definition
EventPacket.hpp:23
SSPLEDCalibModule.hpp
SSPRegister.hpp
Logging.hpp
dunedaq::sspmodules
Definition
anlExceptions.hpp:15
dunedaq
Including Qt Headers.
Definition
module.cpp:16
dunedaq::size
FELIX Initialization std::string initerror FELIX queue timed std::string queuename Unexpected chunk size
Definition
FelixIssues.hpp:28
dunedaq::address
Invalid address
Definition
CommonIssues.hpp:29
dunedaq::sspmodules::TriggerInfo
Definition
DeviceInterface.hpp:29
dunedaq::sspmodules::TriggerInfo::startTime
unsigned long startTime
Definition
DeviceInterface.hpp:30
dunedaq::sspmodules::TriggerInfo::endTime
unsigned long endTime
Definition
DeviceInterface.hpp:31
dunedaq::sspmodules::TriggerInfo::triggerTime
unsigned long triggerTime
Definition
DeviceInterface.hpp:32
dunedaq::sspmodules::TriggerInfo::triggerType
unsigned short triggerType
Definition
DeviceInterface.hpp:33
Generated on
for DUNE-DAQ by
1.17.0