DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq
sourcecode
wibmod
src
WIB1
WIB_localFlash.cpp
Go to the documentation of this file.
1
#include "
wibmod/WIB1/WIB.hh
"
2
#include "
wibmod/WIB1/WIBException.hh
"
3
4
uint32_t
WIB::ReadLocalFlash
(uint16_t address){
5
//load the address
6
Write
(
"SYSTEM.FLASH.ADDRESS"
,address);
7
//start the read transaction
8
Write
(
"SYSTEM.FLASH.RW"
,1);
9
Write
(
"SYSTEM.FLASH.RUN"
,1);
10
11
//Wait for transaction to finish
12
while
(
Read
(
"SYSTEM.FLASH.DONE"
) == 0){
13
printf(
"busy\n"
);
14
//sleep for 1ms
15
usleep(1000);
16
}
17
18
return
Read
(
"SYSTEM.FLASH.RD_DATA"
);
19
}
20
21
std::vector<uint32_t>
WIB::ReadLocalFlash
(uint16_t address,
size_t
n){
22
std::vector<uint32_t> readData;
23
size_t
current_address = address;
24
size_t
end_address = current_address + n;
25
for
(;current_address < end_address;current_address++){
26
readData.push_back(
ReadLocalFlash
(current_address));
27
}
28
return
readData;
29
}
30
31
32
void
WIB::WriteLocalFlash
(uint16_t address, uint32_t data){
33
//load the address
34
Write
(
"SYSTEM.FLASH.ADDRESS"
,address);
35
//load the data to write
36
Write
(
"SYSTEM.FLASH.WR_DATA"
,data);
37
38
//start the read transaction
39
Write
(
"SYSTEM.FLASH.RW"
,0);
40
Write
(
"SYSTEM.FLASH.RUN"
,1);
41
//Wait for finish
42
while
(
Read
(
"SYSTEM.FLASH.DONE"
) == 0){
43
//sleep for 1ms
44
usleep(1000);
45
}
46
}
47
48
49
void
WIB::WriteLocalFlash
(uint16_t address,std::vector<uint32_t>
const
& data){
50
for
(
size_t
iWord = 0; iWord < data.size();iWord++){
51
WriteLocalFlash
(address,data[iWord]);
52
address++;
53
}
54
}
WIBException.hh
WIB.hh
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::ReadLocalFlash
uint32_t ReadLocalFlash(uint16_t address)
Definition
WIB_localFlash.cpp:4
WIB::WriteLocalFlash
void WriteLocalFlash(uint16_t address, uint32_t data)
Definition
WIB_localFlash.cpp:32
Generated on Sat Jun 28 2025 for DUNE-DAQ by
1.12.0