Skip to content

Commit 201e185

Browse files
committed
added option to read register
1 parent dfc9829 commit 201e185

File tree

2 files changed

+34
-11
lines changed

2 files changed

+34
-11
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,17 @@ DIM_DNS_NODE=thedimdns.cern.ch
2323
o2-alf-client is the binary of an ALF client used solely for testing purposes. On top of the DIM Nameserver it expects the hostname of the node hosting the ALF server, the card's serial and endpoint, and the link number as command-line arguments. Different arguments to test different types of services are available (run with `--help`).
2424

2525
`
26-
o2-alf-client --dim-dns-node thedimdns.cern.ch --alf-id thealfserver --serial 1041 --endpoint 1 --link 4
26+
o2-alf-client --dim-dns-node thedimdns.cern.ch --alf-id thealfserver --serial 1041 --endpoint 1 --link 4 ...
2727
`
2828

29+
By default, no operations are done. One should add the corresponding action(s) on the command line.
30+
31+
For example, to read a register:
32+
`
33+
o2-alf-client --dim-dns-node=localhost --alf-id=flpdev1 --serial=0239 --endpoint=0 --reg-read=0x00C19020
34+
`
35+
36+
2937
### o2-alf-lib-client
3038
o2-alf-lib-client is the binary of an ALF SC library client used solely for testing purposes. It expects parameters for the SC modules to test, the card and link ID (run with `--help` for the different options).
3139

apps/AlfClient.cxx

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ class AlfClient : public AliceO2::Common::Program
9797
options.add_options()("swt-stress-words",
9898
po::value<int>(&mOptions.swtStressWords)->default_value(1000),
9999
"Number of SWT words to write and read in one go");
100+
options.add_options()("reg-seq-write",
101+
po::bool_switch(&mOptions.registerSequenceWrite)->default_value(false),
102+
"test register write sequence");
103+
options.add_options()("reg-read",
104+
po::value<std::string>(&mOptions.registerRead)->default_value(""),
105+
"read given register");
100106
}
101107

102108
virtual void run(const po::variables_map&) override
@@ -164,15 +170,22 @@ class AlfClient : public AliceO2::Common::Program
164170
IcSequenceRpc icSequence(names.icSequence());
165171
IcGbtI2cWriteRpc icGbtI2cWriteRpc(names.icGbtI2cWrite());
166172

167-
// Test register sequence
168-
auto regOut = registerSequence.write({ std::make_pair("0x00c00000", ""),
169-
std::make_pair("0x00c00004", ""),
170-
std::make_pair("0x00c00008", ""),
171-
std::make_pair("0x00cfffff", "0x00080000"),
172-
std::make_pair("0x00c00004", "0x00080000"),
173-
std::make_pair("0x00c00004", ""),
174-
std::make_pair("0x0badadd7", "") });
175-
std::cout << "[REGISTER SEQUENCE] output: " << regOut << std::endl;
173+
if (mOptions.registerRead != "") {
174+
auto regOut = registerSequence.write({ std::make_pair(mOptions.registerRead, "") });
175+
std::cout << "[READ REGISTER] output: " << regOut << std::endl;
176+
}
177+
178+
if (mOptions.registerSequenceWrite) {
179+
// Test register sequence
180+
auto regOut = registerSequence.write({ std::make_pair("0x00c00000", ""),
181+
std::make_pair("0x00c00004", ""),
182+
std::make_pair("0x00c00008", ""),
183+
std::make_pair("0x00cfffff", "0x00080000"),
184+
std::make_pair("0x00c00004", "0x00080000"),
185+
std::make_pair("0x00c00004", ""),
186+
std::make_pair("0x0badadd7", "") });
187+
std::cout << "[REGISTER SEQUENCE] output: " << regOut << std::endl;
188+
}
176189

177190
if (mOptions.swt) {
178191
auto swtOut = swtSequence.write({ std::make_pair("", "lock"),
@@ -298,7 +311,7 @@ class AlfClient : public AliceO2::Common::Program
298311

299312
}
300313

301-
std::cout << "See ya!" << std::endl;
314+
std::cout << "Operations completed" << std::endl;
302315
}
303316

304317
private:
@@ -319,6 +332,8 @@ class AlfClient : public AliceO2::Common::Program
319332
bool parallelSc = false;
320333
int swtStressCycles = 2;
321334
int swtStressWords = 1000;
335+
bool registerSequenceWrite = false;
336+
std::string registerRead = "";
322337
} mOptions;
323338
};
324339

0 commit comments

Comments
 (0)