Skip to content

Commit acc0901

Browse files
committed
[sca] Append svl to connect and reset operations
1 parent 74f3a33 commit acc0901

File tree

6 files changed

+42
-42
lines changed

6 files changed

+42
-42
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,16 @@ The services are DIM RPC services. Every RPC is called with a string and expects
8080
* Operations may be:
8181
* An SCA command and data pair (e.g. `0x0000f00d,0x0000cafe`)
8282
* A wait operation (e.g. `30,wait`) in ms, defaults to 3
83-
* An SCA connect operation (e.g. `connect`)
84-
* An SCA reset operation (`reset`)
83+
* An SCA supervisory level connect operation (e.g. `svl_connect`)
84+
* An SCA supervisory level reset operation (`svl_reset`)
8585
* An SC global reset operation (`sc_reset`)
8686
* An instruction to execute the sequence atomically (`lock` - needs to lead the sequence)
8787
* Returns:
8888
* Sequence of SCA output as follows:
8989
* SCA command and SCA read pairs
9090
* Wait confirmations with time waited
91-
* Connect confirmations made up of a "connect" string
92-
* No entries for `reset`, `sc_reset`, and `lock` directives
91+
* Connect confirmations made up of a "svl_connect" string
92+
* No entries for `svl_reset`, `sc_reset`, and `lock` directives
9393

9494
* Example:
9595
* DIM input: `0x00000010,0x00000011\n3\n0x000000020,0x00000021`

apps/AlfClient.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ class AlfClient : public AliceO2::Common::Program
190190

191191
if (mOptions.sca) {
192192
auto scaOut = scaSequence.write({ std::make_pair("", "sc_reset"),
193-
std::make_pair("", "reset"),
194-
std::make_pair("", "connect"),
193+
std::make_pair("", "svl_reset"),
194+
std::make_pair("", "svl_connect"),
195195
std::make_pair("1000", "wait"),
196196
std::make_pair("0x00010002", "0xff000000"),
197197
std::make_pair("0x00020004", "0xff000000"),

apps/AlfLibClient.cxx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ class AlfLibClient : public AliceO2::Common::Program
7070

7171
std::cout << "Running simple SCA operations" << std::endl;
7272
try {
73-
sca.reset();
74-
sca.connect();
73+
sca.svlReset();
74+
sca.svlConnect();
7575
auto scaOut = sca.executeCommand({ 0x00010002, 0xff000000 });
7676
std::cout << scaOut.command << " " << scaOut.data << std::endl;
7777
} catch (const ScaException& e) {
@@ -82,8 +82,8 @@ class AlfLibClient : public AliceO2::Common::Program
8282
std::vector<std::pair<Sca::Operation, Sca::Data>> ops;
8383
sca.setChannel(1);
8484
ops.push_back({ Sca::Operation::SCReset, {} });
85-
ops.push_back({ Sca::Operation::Reset, {} });
86-
ops.push_back({ Sca::Operation::Connect, {} });
85+
ops.push_back({ Sca::Operation::SVLReset, {} });
86+
ops.push_back({ Sca::Operation::SVLConnect, {} });
8787
ops.push_back({ Sca::Operation::Command, Sca::CommandData{ 0x00100002, 0xff000000 } });
8888
ops.push_back({ Sca::Operation::Command, Sca::CommandData{ 0x00100003, 0xff000000 } });
8989
ops.push_back({ Sca::Operation::Wait, 100 });
@@ -94,12 +94,12 @@ class AlfLibClient : public AliceO2::Common::Program
9494
std::cout << "Command: " << boost::get<Sca::CommandData>(out.second) << std::endl;
9595
} else if (out.first == Sca::Operation::Wait) {
9696
std::cout << "Wait: " << std::dec << boost::get<Sca::WaitTime>(out.second) << std::endl;
97-
} else if (out.first == Sca::Operation::Reset) {
98-
std::cout << "Reset" << std::endl;
97+
} else if (out.first == Sca::Operation::SVLReset) {
98+
std::cout << "SVL Reset" << std::endl;
9999
} else if (out.first == Sca::Operation::SCReset) {
100100
std::cout << "SC Reset" << std::endl;
101-
} else if (out.first == Sca::Operation::Connect) {
102-
std::cout << "Connect " << std::endl;
101+
} else if (out.first == Sca::Operation::SVLConnect) {
102+
std::cout << "SVL Connect " << std::endl;
103103
} else if (out.first == Sca::Operation::Error) {
104104
std::cout << "Error: " << boost::get<std::string>(out.second) << std::endl;
105105
} else {

include/Alf/Sca.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ class Sca
5353
enum Operation { Command,
5454
Wait,
5555
SCReset,
56-
Reset,
57-
Connect,
56+
SVLReset,
57+
SVLConnect,
5858
Error,
5959
Lock };
6060

@@ -84,10 +84,10 @@ class Sca
8484
void scReset();
8585

8686
/// Executes an SCA reset
87-
void reset();
87+
void svlReset();
8888

8989
/// Executes an SCA connect
90-
void connect();
90+
void svlConnect();
9191

9292
/// Executes an SCA command
9393
/// \param commandData SCA command, data pair

src/AlfServer.cxx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -296,23 +296,23 @@ std::pair<Sca::Operation, Sca::Data> AlfServer::stringToScaPair(const std::strin
296296
} catch (const std::exception& e) {
297297
BOOST_THROW_EXCEPTION(SwtException() << ErrorInfo::Message("SCA Wait Time provided cannot be converted to int"));
298298
}
299-
} else if (scaPair[scaPair.size() - 1] == "reset") {
300-
operation = Sca::Operation::Reset;
299+
} else if (scaPair[scaPair.size() - 1] == "svl_reset") {
300+
operation = Sca::Operation::SVLReset;
301301
if (scaPair.size() != 1) {
302302
BOOST_THROW_EXCEPTION(
303-
AlfException() << ErrorInfo::Message("Too many arguments for RESET operation"));
303+
AlfException() << ErrorInfo::Message("Too many arguments for SVL RESET operation"));
304304
}
305-
} else if (scaPair[scaPair.size() - 1] == "sc_reset") {
306-
operation = Sca::Operation::SCReset;
305+
} else if (scaPair[scaPair.size() - 1] == "svl_connect") {
306+
operation = Sca::Operation::SVLConnect;
307307
if (scaPair.size() != 1) {
308308
BOOST_THROW_EXCEPTION(
309-
AlfException() << ErrorInfo::Message("Too many arguments for SC RESET operation"));
309+
AlfException() << ErrorInfo::Message("Too many arguments for SVL CONNECT operation"));
310310
}
311-
} else if (scaPair[scaPair.size() - 1] == "connect") {
312-
operation = Sca::Operation::Connect;
311+
} else if (scaPair[scaPair.size() - 1] == "sc_reset") {
312+
operation = Sca::Operation::SCReset;
313313
if (scaPair.size() != 1) {
314314
BOOST_THROW_EXCEPTION(
315-
AlfException() << ErrorInfo::Message("Too many arguments for CONNECT operation"));
315+
AlfException() << ErrorInfo::Message("Too many arguments for SC RESET operation"));
316316
}
317317
} else { // regular sca command
318318
operation = Sca::Operation::Command;

src/Sca.cxx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ void Sca::scReset()
102102
barWrite(sc_regs::SC_RESET.index, 0x0); //void cmd to sync clocks
103103
}
104104

105-
void Sca::reset()
105+
void Sca::svlReset()
106106
{
107107
barWrite(sc_regs::SCA_WR_CTRL.index, 0x1);
108108
barWrite(sc_regs::SCA_WR_CTRL.index, 0x0);
109109
}
110110

111-
void Sca::connect()
111+
void Sca::svlConnect()
112112
{
113113
barWrite(sc_regs::SCA_WR_CTRL.index, 0x2);
114114
barWrite(sc_regs::SCA_WR_CTRL.index, 0x0);
@@ -298,15 +298,15 @@ std::vector<std::pair<Sca::Operation, Sca::Data>> Sca::executeSequence(const std
298298
}
299299
std::this_thread::sleep_for(std::chrono::milliseconds(waitTime));
300300
ret.push_back({ operation, waitTime });
301-
} else if (operation == Operation::Reset) {
302-
reset();
303-
ret.push_back({ Operation::Reset, {} });
301+
} else if (operation == Operation::SVLReset) {
302+
svlReset();
303+
ret.push_back({ Operation::SVLReset, {} });
304304
} else if (operation == Operation::SCReset) {
305305
scReset();
306306
ret.push_back({ Operation::SCReset, {} });
307-
} else if (operation == Operation::Connect) {
308-
connect();
309-
ret.push_back({ Operation::Connect, {} });
307+
} else if (operation == Operation::SVLConnect) {
308+
svlConnect();
309+
ret.push_back({ Operation::SVLConnect, {} });
310310
} else {
311311
BOOST_THROW_EXCEPTION(ScaException() << ErrorInfo::Message("SCA operation type unknown"));
312312
}
@@ -318,12 +318,12 @@ std::vector<std::pair<Sca::Operation, Sca::Data>> Sca::executeSequence(const std
318318
meaningfulMessage = (boost::format("SCA_SEQUENCE cmd=0x%08x data=0x%08x serialId=%s link=%d error='%s'") % boost::get<CommandData>(data).command % boost::get<CommandData>(data).data % mLink.serialId % mLink.linkId % e.what()).str();
319319
} else if (operation == Operation::Wait) {
320320
meaningfulMessage = (boost::format("SCA_SEQUENCE WAIT waitTime=%d serialId=%s link=%d error='%s'") % boost::get<WaitTime>(data) % mLink.serialId % mLink.linkId % e.what()).str();
321-
} else if (operation == Operation::Reset) {
322-
meaningfulMessage = (boost::format("SCA_SEQUENCE RESET serialId=%s link=%d error='%s'") % mLink.serialId % mLink.linkId % e.what()).str();
321+
} else if (operation == Operation::SVLReset) {
322+
meaningfulMessage = (boost::format("SCA_SEQUENCE SVL RESET serialId=%s link=%d error='%s'") % mLink.serialId % mLink.linkId % e.what()).str();
323323
} else if (operation == Operation::SCReset) {
324324
meaningfulMessage = (boost::format("SCA_SEQUENCE SC RESET serialId=%s link=%d error='%s'") % mLink.serialId % mLink.linkId % e.what()).str();
325-
} else if (operation == Operation::Connect) {
326-
meaningfulMessage = (boost::format("SCA_SEQUENCE CONNECT serialId=%s link=%d error='%s'") % mLink.serialId % mLink.linkId % e.what()).str();
325+
} else if (operation == Operation::SVLConnect) {
326+
meaningfulMessage = (boost::format("SCA_SEQUENCE SVL CONNECT serialId=%s link=%d error='%s'") % mLink.serialId % mLink.linkId % e.what()).str();
327327
} else {
328328
meaningfulMessage = (boost::format("SCA_SEQUENCE UNKNOWN serialId=%s link=%d error='%s'") % mLink.serialId % mLink.linkId % e.what()).str();
329329
}
@@ -352,10 +352,10 @@ std::string Sca::writeSequence(const std::vector<std::pair<Operation, Data>>& op
352352
resultBuffer << data << "\n"; // "[cmd],[data]\n"
353353
} else if (operation == Operation::Wait) {
354354
resultBuffer << std::dec << data << "\n"; // "[time]\n"
355-
} else if (operation == Operation::Reset || operation == Operation::SCReset) {
355+
} else if (operation == Operation::SVLReset || operation == Operation::SCReset) {
356356
/* DO NOTHING */
357-
} else if (operation == Operation::Connect) {
358-
resultBuffer << "connect\n"; // echo
357+
} else if (operation == Operation::SVLConnect) {
358+
resultBuffer << "svl_connect\n"; // echo
359359
} else if (operation == Operation::Error) {
360360
resultBuffer << data; // "[error_msg]"
361361
Logger::get().err() << data << endm;

0 commit comments

Comments
 (0)