DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
wibmod
src
WIB1
WIB_FAKE_CD.cpp
Go to the documentation of this file.
1
#include "
wibmod/WIB1/WIB.hh
"
2
#include "
wibmod/WIB1/WIBException.hh
"
3
4
void
5
WIB::ConfigWIBFakeData
(
bool
enableFakeFEMB1,
6
bool
enableFakeFEMB2,
7
bool
enableFakeFEMB3,
8
bool
enableFakeFEMB4,
9
bool
counter)
10
{
// counter==true: counter instead of COLDATA frame, else samples in COLDATA frame
11
12
if
(
DAQMode
==
FELIX
) {
13
// Don't allow fake mode on only half of a FELIX link
14
if
((enableFakeFEMB1 ^ enableFakeFEMB2) || (enableFakeFEMB3 ^ enableFakeFEMB4)) {
15
BUException::WIB_FAKE_DATA_ON_HALF_FELIX_LINK e;
16
throw
e;
17
}
18
}
19
20
// Setup the FEMBs/Links
21
for
(
size_t
iFEMB = 1; iFEMB <=
FEMBCount
; iFEMB++) {
22
for
(
size_t
iCDA = 1; iCDA <=
FEMBCDACount
; iCDA++) {
23
SetFEMBFakeCOLDATAMode
(iFEMB, iCDA, counter);
24
}
25
}
26
27
for
(
size_t
iStream = 1; iStream <=
FEMBStreamCount
; iStream++) {
28
SetFEMBStreamSource
(1, iStream, !enableFakeFEMB1);
29
SetFEMBStreamSource
(2, iStream, !enableFakeFEMB2);
30
SetFEMBStreamSource
(3, iStream, !enableFakeFEMB3);
31
SetFEMBStreamSource
(4, iStream, !enableFakeFEMB4);
32
}
33
34
uint64_t enableWord1 = 0;
35
uint64_t enableWord2 = 0;
36
uint64_t enableWord3 = 0;
37
uint64_t enableWord4 = 0;
38
if
(enableFakeFEMB1)
39
enableWord1 = 0xF;
40
if
(enableFakeFEMB2)
41
enableWord2 = 0xF;
42
if
(enableFakeFEMB3)
43
enableWord3 = 0xF;
44
if
(enableFakeFEMB4)
45
enableWord4 = 0xF;
46
SourceFEMB
(1, enableWord1);
47
SourceFEMB
(2, enableWord2);
48
SourceFEMB
(3, enableWord3);
49
SourceFEMB
(4, enableWord4);
50
}
51
52
uint8_t
53
WIB::GetFEMBStreamSource
(uint8_t iFEMB, uint8_t iStream)
54
{
55
CheckFEMBStreamInRange
(iStream);
56
std::string base =
"FEMB0.DAQ.FAKE_CD.RX_DATA_SOURCE"
;
57
base[4] =
GetFEMBChar
(iFEMB);
58
// Read the current settings
59
uint32_t data =
Read
(base);
60
return
(data >> (iStream - 1)) & 0x1;
61
}
62
void
63
WIB::SetFEMBStreamSource
(uint8_t iFEMB, uint8_t iStream,
bool
real)
64
{
65
CheckFEMBStreamInRange
(iStream);
66
std::string base =
"FEMB0.DAQ.FAKE_CD.RX_DATA_SOURCE"
;
67
base[4] =
GetFEMBChar
(iFEMB);
68
// Read the current settings
69
uint32_t data =
Read
(base);
70
// update the mask
71
iStream--;
// iStream is 1-4, but we want bits 0 to 3
72
if
(real) {
73
data &= ~(0x1 << iStream);
74
}
else
{
75
data |= 0x1 << iStream;
76
}
77
Write
(base, data);
78
}
79
80
void
81
WIB::SetFEMBFakeCOLDATAMode
(uint8_t iFEMB, uint8_t iCD,
bool
mode)
82
{
83
std::string base(
"FEMB0.DAQ.FAKE_CD.CD0."
);
84
base[4] =
GetFEMBChar
(iFEMB);
85
base[20] =
GetFEMBCDChar
(iCD);
86
87
// Set this COLDATA ASIC
88
Write
(base +
"FAKE_MODE"
, uint32_t(mode));
89
}
90
91
uint8_t
92
WIB::GetFEMBFakeCOLDATAMode
(uint8_t iFEMB, uint8_t iCD)
93
{
94
std::string base(
"FEMB0.DAQ.FAKE_CD.CD0."
);
95
base[4] =
GetFEMBChar
(iFEMB);
96
base[20] =
GetFEMBCDChar
(iCD);
97
98
return
Read
(base +
"FAKE_MODE"
);
99
}
WIBException.hh
WIB.hh
WIBBase::Read
uint32_t Read(uint16_t address)
Definition
WIBBase.cpp:147
WIBBase::Write
void Write(uint16_t address, uint32_t value)
Definition
WIBBase.cpp:168
WIB::CheckFEMBStreamInRange
bool CheckFEMBStreamInRange(uint8_t iStream)
Definition
WIB.cpp:605
WIB::FELIX
@ FELIX
Definition
WIB.hh:208
WIB::FEMBCDACount
uint8_t FEMBCDACount
Definition
WIB.hh:234
WIB::GetFEMBFakeCOLDATAMode
uint8_t GetFEMBFakeCOLDATAMode(uint8_t iFEMB, uint8_t iCD)
Definition
WIB_FAKE_CD.cpp:92
WIB::GetFEMBCDChar
char GetFEMBCDChar(uint8_t iCD)
Definition
WIB.cpp:627
WIB::FEMBStreamCount
uint8_t FEMBStreamCount
Definition
WIB.hh:233
WIB::SetFEMBStreamSource
void SetFEMBStreamSource(uint8_t iFEMB, uint8_t iStream, bool real=true)
Definition
WIB_FAKE_CD.cpp:63
WIB::GetFEMBStreamSource
uint8_t GetFEMBStreamSource(uint8_t iFEMB, uint8_t iStream)
Definition
WIB_FAKE_CD.cpp:53
WIB::DAQMode
WIB_DAQ_t DAQMode
Definition
WIB.hh:231
WIB::SourceFEMB
void SourceFEMB(uint64_t iDAQLink, uint64_t real)
Definition
WIB.cpp:652
WIB::SetFEMBFakeCOLDATAMode
void SetFEMBFakeCOLDATAMode(uint8_t iFEMB, uint8_t iCD, bool mode=0)
Definition
WIB_FAKE_CD.cpp:81
WIB::FEMBCount
uint8_t FEMBCount
Definition
WIB.hh:232
WIB::ConfigWIBFakeData
void ConfigWIBFakeData(bool enableFakeFEMB1, bool enableFakeFEMB2, bool enableFakeFEMB3, bool enableFakeFEMB4, bool counter)
Definition
WIB_FAKE_CD.cpp:5
WIB::GetFEMBChar
char GetFEMBChar(uint8_t iFEMB)
Definition
WIB.cpp:574
Generated on
for DUNE-DAQ by
1.18.0