DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
wibmod
src
WIB1
WIB_spybuffer.cpp
Go to the documentation of this file.
1
#include "
wibmod/WIB1/WIB.hh
"
2
#include "
wibmod/WIB1/WIBException.hh
"
3
4
std::vector<data_8b10b_t>
WIB::ReadOutCDLinkSpyBuffer
(){
5
if
(
Read
(
"FEMB_SPY.FIFO_EMPTY"
)){
6
BUException::WIB_ERROR e;
7
e.Append(
"CD Spy fifo is empty!"
);
8
throw
e;
9
}
10
11
std::vector<data_8b10b_t> data;
12
while
(!
Read
(
"FEMB_SPY.FIFO_EMPTY"
)){
13
uint32_t val =
Read
(
"FEMB_SPY.DATA"
);
14
data.push_back(
data_8b10b_t
((val>>8)&0x1,uint8_t(val&0xff)));
15
}
16
return
data;
17
}
18
19
20
std::vector<data_8b10b_t>
WIB::ReadDAQLinkSpyBuffer
(uint8_t iDAQLink,uint8_t trigger_mode){
21
//TODO read DAQ link count
22
std::string base(
"DAQ_LINK_"
);
23
base.push_back(
GetDAQLinkChar
(iDAQLink));
24
base.append(
".SPY_BUFFER."
);
25
26
//Check if there is an active capture
27
if
(
ReadWithRetry
(base+
"CAPTURING_DATA"
)){
28
BUException::WIB_BUSY e;
29
e.Append(base);
30
e.Append(
" is busy\n"
);
31
throw
e;
32
}
33
//The spy buffer isn't busy, so let's make sure the fifo is empty
34
while
(!
ReadWithRetry
(base+
"EMPTY"
)){
35
//Read out a workd from the fifo
36
WriteWithRetry
(base+
"DATA"
,0x0);
37
}
38
39
//write trigger mode
40
WriteWithRetry
(base+
"TRIGGER_MODE"
,trigger_mode & 0x1);
41
42
//Start the capture
43
Write
(base+
"START"
,0x1);
44
45
//Wait for capture to finish
46
while
(
ReadWithRetry
(base+
"CAPTURING_DATA"
)){
47
}
48
49
//Read out the data
50
std::vector<data_8b10b_t> ret;
51
52
while
(!
ReadWithRetry
(base+
"EMPTY"
)){
53
//read out the k-chars
54
uint32_t k_data =
ReadWithRetry
(base+
"K_DATA"
);
55
//read out the data
56
uint32_t data =
ReadWithRetry
(base+
"DATA"
);
57
58
// printf("0x%08X 0x%08X\n",k_data,data);
59
60
for
(
size_t
iWord = 0; iWord < 4;iWord++){
61
ret.push_back(
data_8b10b_t
((k_data>>iWord)&0x1,
62
(data >>(iWord*8) &0xFF)));
63
}
64
//mark word as read
65
Write
(base+
"DATA"
,0x0);
66
}
67
return
ret;
68
}
WIBException.hh
WIB.hh
WIBBase::WriteWithRetry
void WriteWithRetry(uint16_t address, uint32_t value)
Definition
WIBBase.cpp:129
WIBBase::ReadWithRetry
uint32_t ReadWithRetry(uint16_t address)
Definition
WIBBase.cpp:116
WIBBase::Read
uint32_t Read(uint16_t address)
Definition
WIBBase.cpp:119
WIBBase::Write
void Write(uint16_t address, uint32_t value)
Definition
WIBBase.cpp:132
WIB::ReadOutCDLinkSpyBuffer
std::vector< data_8b10b_t > ReadOutCDLinkSpyBuffer()
Definition
WIB_spybuffer.cpp:4
WIB::GetDAQLinkChar
char GetDAQLinkChar(uint8_t iDAQLink)
Definition
WIB.cpp:518
WIB::ReadDAQLinkSpyBuffer
std::vector< data_8b10b_t > ReadDAQLinkSpyBuffer(uint8_t iDAQLink, uint8_t trigger_mode=0)
Definition
WIB_spybuffer.cpp:20
data_8b10b_t
Definition
WIB.hh:20
Generated on
for DUNE-DAQ by
1.17.0