Skip to content

Commit b0ba9ef

Browse files
committed
[sca-mft-psu] Use dedicated register for identifying an MFT PSU link
1 parent 08c58ad commit b0ba9ef

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

include/Alf/ScaMftPsu.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ class ScaMftPsu
9999
/// o2::alf::ScaMftPsuException on invalid operation or error
100100
std::string writeSequence(const std::vector<std::pair<Operation, Data>>& operations, bool lock = false);
101101

102+
/// Checks if the link should be used for the MFT PSU service
103+
/// \param link The AlfLink to check
104+
/// \return A bool if the link should be used for the MFT PSU service
105+
static bool isAnMftPsuLink(AlfLink link);
106+
102107
private:
103108
uint32_t barRead(uint32_t index);
104109
void barWrite(uint32_t index, uint32_t data);

src/AlfServer.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ void AlfServer::makeRpcServers(std::vector<AlfLink> links)
563563
.setCardId(link.serialId);
564564
mSessions[link.serialId] = std::make_shared<lla::Session>(params);
565565

566-
if (kMftPsuSerials.find(link.serialId.getSerial()) != kMftPsuSerials.end()) {
566+
if (ScaMftPsu::isAnMftPsuLink(link)) {
567567
// SCA MFT PSU Sequence
568568
servers.push_back(makeServer(names.scaMftPsuSequence(),
569569
[link, this](auto parameter) { return scaMftPsuBlobWrite(parameter, link); }));

src/AlfServer.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ class AlfServer
7777
/// serialId -> link -> vector of RPC servers
7878
std::map<roc::SerialId, std::map<int, std::vector<std::unique_ptr<StringRpcServer>>>, serialIdComparator> mRpcServers;
7979
std::map<roc::SerialId, std::shared_ptr<lla::Session>, serialIdComparator> mSessions;
80-
81-
const std::unordered_set<int> kMftPsuSerials = { 0, 553 };
8280
};
8381

8482
} // namespace alf

src/ScaMftPsu.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,5 +333,10 @@ std::string ScaMftPsu::writeSequence(const std::vector<std::pair<Operation, Data
333333
return resultBuffer.str();
334334
}
335335

336+
// static
337+
bool ScaMftPsu::isAnMftPsuLink(AlfLink link) {
338+
return link.bar->readRegister(sc_regs::SCA_MFT_PSU_ID.index) == 0x1;
339+
}
340+
336341
} // namespace alf
337342
} // namespace o2

0 commit comments

Comments
 (0)