Skip to content

Commit 13fcbda

Browse files
committed
[config] Don't allow user-and-common-logic w/o user-logic enabled
1 parent 7c194f0 commit 13fcbda

File tree

6 files changed

+28
-23
lines changed

6 files changed

+28
-23
lines changed

src/CommandLineUtilities/ProgramConfig.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ class ProgramConfig : public Program
110110
"Flag to switch off GBT");
111111
options.add_options()("user-logic",
112112
po::bool_switch(&mOptions.userLogicEnabled),
113-
"Flag to enable the User Logic link");
113+
"Flag to toggle the User Logic link");
114114
options.add_options()("run-stats",
115115
po::bool_switch(&mOptions.runStatsEnabled),
116-
"Flag to enable the Run Statistics link");
116+
"Flag to toggle the Run Statistics link");
117117
options.add_options()("user-and-common-logic",
118118
po::bool_switch(&mOptions.userAndCommonLogicEnabled),
119-
"Flag to enable the User and Common Logic");
119+
"Flag to toggle the User and Common Logic");
120120
Options::addOptionCardId(options);
121121
}
122122

src/CommandLineUtilities/ProgramStatus.cxx

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -224,15 +224,14 @@ class ProgramStatus : public Program
224224
std::cout << "CRU ID: " << reportInfo.cruId << std::endl;
225225
std::cout << clock << " clock | ";
226226
std::cout << offset << " offset" << std::endl;
227-
if (reportInfo.userLogicEnabled) {
227+
if (reportInfo.userLogicEnabled && reportInfo.userAndCommonLogicEnabled) {
228+
std::cout << "User and Common Logic enabled" << std::endl;
229+
} else if (reportInfo.userLogicEnabled) {
228230
std::cout << "User Logic enabled" << std::endl;
229231
}
230232
if (reportInfo.runStatsEnabled) {
231233
std::cout << "Run statistics enabled" << std::endl;
232234
}
233-
if (reportInfo.userAndCommonLogicEnabled) {
234-
std::cout << "User and Common logic enabled" << std::endl;
235-
}
236235
}
237236

238237
/* ONU PARAMETERS */
@@ -241,15 +240,15 @@ class ProgramStatus : public Program
241240

242241
if (mOptions.monitoring) {
243242
monitoring->send(Metric{ "onu" }
244-
.addValue(std::to_string(onuStatus.onuAddress), "onuAddress")
245-
.addValue(onuStatus.rx40Locked, "rx40Locked")
246-
.addValue(onuStatus.phaseGood, "phaseGood")
247-
.addValue(onuStatus.rxLocked, "rxLocked")
248-
.addValue(onuStatus.operational, "operational")
249-
.addValue(onuStatus.mgtTxReady, "mgtTxReady")
250-
.addValue(onuStatus.mgtRxReady, "mgtRxReady")
251-
.addValue(onuStatus.mgtTxPllLocked, "mgtTxPllLocked")
252-
.addValue(onuStatus.mgtRxPllLocked, "mgtRxPllLocked"));
243+
.addValue(std::to_string(onuStatus.onuAddress), "onuAddress")
244+
.addValue(onuStatus.rx40Locked, "rx40Locked")
245+
.addValue(onuStatus.phaseGood, "phaseGood")
246+
.addValue(onuStatus.rxLocked, "rxLocked")
247+
.addValue(onuStatus.operational, "operational")
248+
.addValue(onuStatus.mgtTxReady, "mgtTxReady")
249+
.addValue(onuStatus.mgtRxReady, "mgtRxReady")
250+
.addValue(onuStatus.mgtTxPllLocked, "mgtTxPllLocked")
251+
.addValue(onuStatus.mgtRxPllLocked, "mgtRxPllLocked"));
253252
} else if (mOptions.jsonOut) {
254253
root.put("ONU address", onuStatus.onuAddress);
255254
root.put("ONU RX40 locked", onuStatus.rx40Locked);
@@ -275,8 +274,6 @@ class ProgramStatus : public Program
275274
}
276275
}
277276

278-
279-
280277
/* PARAMETERS PER LINK */
281278
for (const auto& el : reportInfo.linkMap) {
282279
auto link = el.second;

src/Cru/CruBar.cxx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,13 @@ Cru::PacketMonitoringInfo CruBar::monitorPackets()
564564
return { linkPacketInfoMap, wrapperPacketInfoMap };
565565
}
566566

567+
void CruBar::checkConfigParameters()
568+
{
569+
if (mUserAndCommonLogicEnabled && !mUserLogicEnabled) {
570+
BOOST_THROW_EXCEPTION(ParameterException() << ErrorInfo::Message("User and Common logic switch invalid when User logic disabled"));
571+
}
572+
}
573+
567574
/// Configures the CRU according to the parameters passed on init
568575
void CruBar::configure(bool force)
569576
{
@@ -587,6 +594,7 @@ void CruBar::configure(bool force)
587594
return;
588595
}
589596

597+
checkConfigParameters();
590598
log("Reconfiguring");
591599

592600
Ttc ttc = Ttc(mPdaBar);
@@ -676,8 +684,8 @@ void CruBar::configure(bool force)
676684

677685
/* UL + CL */
678686
if (mUserAndCommonLogicEnabled != reportInfo.userAndCommonLogicEnabled || force) {
679-
log("Enabling User and Common Logic");
680-
datapathWrapper.enableUserAndCommonLogic(mUserAndCommonLogicEnabled, mEndpoint);
687+
log("Toggling User and Common Logic");
688+
datapathWrapper.toggleUserAndCommonLogic(mUserAndCommonLogicEnabled, mEndpoint);
681689
}
682690

683691
/* BSP */

src/Cru/CruBar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class CruBar final : public BarInterfaceBase
122122
void populateLinkMap(std::map<int, Link>& linkMap);
123123

124124
uint32_t getDdgBurstLength();
125-
//void checkParameters();
125+
void checkConfigParameters();
126126

127127
void setCruId(uint16_t cruId);
128128
uint16_t getCruId();

src/Cru/DatapathWrapper.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ uint32_t DatapathWrapper::getTriggerWindowSize(int wrapper)
284284
return mPdaBar->readRegister(address / 4);
285285
}
286286

287-
void DatapathWrapper::enableUserAndCommonLogic(bool enable, int wrapper)
287+
void DatapathWrapper::toggleUserAndCommonLogic(bool enable, int wrapper)
288288
{
289289
uint32_t value = enable ? 0x1 : 0x0;
290290
uint32_t address = (wrapper == 0) ? Cru::Registers::DWRAPPER_BASE0.index : Cru::Registers::DWRAPPER_BASE1.index;

src/Cru/DatapathWrapper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class DatapathWrapper
5454
uint32_t getForcedPackets(Link link);
5555
void setTriggerWindowSize(int wrapper, uint32_t size = 1000);
5656
uint32_t getTriggerWindowSize(int wrapper);
57-
void enableUserAndCommonLogic(bool enable, int wrapper);
57+
void toggleUserAndCommonLogic(bool enable, int wrapper);
5858
bool getUserAndCommonLogicEnabled(int wrapper);
5959

6060
private:

0 commit comments

Comments
 (0)