Skip to content

Commit

Permalink
[sca-mft-psu] Use dedicated register for identifying an MFT PSU link
Browse files Browse the repository at this point in the history
  • Loading branch information
kostorr committed Aug 13, 2021
1 parent 08c58ad commit b0ba9ef
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions include/Alf/ScaMftPsu.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ class ScaMftPsu
/// o2::alf::ScaMftPsuException on invalid operation or error
std::string writeSequence(const std::vector<std::pair<Operation, Data>>& operations, bool lock = false);

/// Checks if the link should be used for the MFT PSU service
/// \param link The AlfLink to check
/// \return A bool if the link should be used for the MFT PSU service
static bool isAnMftPsuLink(AlfLink link);

private:
uint32_t barRead(uint32_t index);
void barWrite(uint32_t index, uint32_t data);
Expand Down
2 changes: 1 addition & 1 deletion src/AlfServer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ void AlfServer::makeRpcServers(std::vector<AlfLink> links)
.setCardId(link.serialId);
mSessions[link.serialId] = std::make_shared<lla::Session>(params);

if (kMftPsuSerials.find(link.serialId.getSerial()) != kMftPsuSerials.end()) {
if (ScaMftPsu::isAnMftPsuLink(link)) {
// SCA MFT PSU Sequence
servers.push_back(makeServer(names.scaMftPsuSequence(),
[link, this](auto parameter) { return scaMftPsuBlobWrite(parameter, link); }));
Expand Down
2 changes: 0 additions & 2 deletions src/AlfServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ class AlfServer
/// serialId -> link -> vector of RPC servers
std::map<roc::SerialId, std::map<int, std::vector<std::unique_ptr<StringRpcServer>>>, serialIdComparator> mRpcServers;
std::map<roc::SerialId, std::shared_ptr<lla::Session>, serialIdComparator> mSessions;

const std::unordered_set<int> kMftPsuSerials = { 0, 553 };
};

} // namespace alf
Expand Down
5 changes: 5 additions & 0 deletions src/ScaMftPsu.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -333,5 +333,10 @@ std::string ScaMftPsu::writeSequence(const std::vector<std::pair<Operation, Data
return resultBuffer.str();
}

// static
bool ScaMftPsu::isAnMftPsuLink(AlfLink link) {
return link.bar->readRegister(sc_regs::SCA_MFT_PSU_ID.index) == 0x1;
}

} // namespace alf
} // namespace o2

0 comments on commit b0ba9ef

Please sign in to comment.