Skip to content

Commit 25ff1ef

Browse files
committed
[status] Add optical power for the CRORC links
1 parent e9b2a2c commit 25ff1ef

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

src/Crorc/Constants.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,9 @@ static constexpr Register C_CSR(0x00000010);
373373
// At bit 13
374374
static constexpr uint32_t LINK_DOWN(0x00002000);
375375

376+
static constexpr IntervalRegister OPT_POWER_QSFP0(0x00000144, 0x4);
377+
static constexpr IntervalRegister OPT_POWER_QSFP1(0x00000158, 0x4);
378+
376379
} // namespace Registers
377380
} //namespace Crorc
378381

src/Crorc/CrorcBar.cxx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ void CrorcBar::configure(bool /*force*/)
7878
Crorc::ReportInfo CrorcBar::report()
7979
{
8080
std::map<int, Crorc::Link> linkMap = initializeLinkMap();
81+
getOpticalPowers(linkMap);
8182
Crorc::ReportInfo reportInfo = {
8283
linkMap,
8384
getCrorcId(),
@@ -137,5 +138,19 @@ bool CrorcBar::getDynamicOffsetEnabled()
137138
return (readRegister(Crorc::Registers::CFG_CONTROL.index) & 0x1);
138139
}
139140

141+
void CrorcBar::getOpticalPowers(std::map<int, Crorc::Link>& linkMap)
142+
{
143+
for (auto& el : linkMap) {
144+
auto linkNo = el.first;
145+
auto& link = el.second;
146+
if (linkNo < 4) {
147+
link.opticalPower = readRegister(Crorc::Registers::OPT_POWER_QSFP0.get(linkNo).index) & 0xffff;
148+
} else {
149+
link.opticalPower = readRegister(Crorc::Registers::OPT_POWER_QSFP1.get(linkNo % 4).index) & 0xffff;
150+
}
151+
link.opticalPower /= 10;
152+
}
153+
}
154+
140155
} // namespace roc
141156
} // namespace AliceO2

src/Crorc/CrorcBar.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class CrorcBar final : public BarInterfaceBase
6060
bool getDynamicOffsetEnabled();
6161
void setCrorcId(uint16_t cruId);
6262
uint16_t getCrorcId();
63+
void getOpticalPowers(std::map<int, Crorc::Link>& linkMap);
6364

6465
uint16_t mCrorcId;
6566
bool mDynamicOffset;

0 commit comments

Comments
 (0)