@@ -498,7 +498,7 @@ Cru::ReportInfo CruBar::report(bool forConfig)
498498 for (auto & el : linkMap) {
499499 auto & link = el.second ;
500500 link.datapathMode = datapathWrapper.getDatapathMode (link);
501- link.enabled = datapathWrapper.getLinkEnabled (link);
501+ link.enabled = datapathWrapper.isLinkEnabled (link);
502502 link.allowRejection = datapathWrapper.getFlowControl (link.dwrapper );
503503 link.stickyBit = gbt.getStickyBit (link);
504504 link.rxFreq = gbt.getRxClockFrequency (link) / 1e6 ; // Hz -> Mhz
@@ -534,12 +534,12 @@ Cru::ReportInfo CruBar::report(bool forConfig)
534534 Link userLogicLink;
535535 userLogicLink.dwrapper = mEndpoint ;
536536 userLogicLink.dwrapperId = 15 ;
537- bool userLogicEnabled = datapathWrapper.getLinkEnabled (userLogicLink);
537+ bool userLogicEnabled = datapathWrapper.isLinkEnabled (userLogicLink);
538538
539539 Link runStatsLink;
540540 runStatsLink.dwrapper = mEndpoint ;
541541 runStatsLink.dwrapperId = (mEndpoint == 0 ) ? 13 : 14 ;
542- bool runStatsEnabled = datapathWrapper.getLinkEnabled (runStatsLink);
542+ bool runStatsEnabled = datapathWrapper.isLinkEnabled (runStatsLink);
543543
544544 bool userAndCommonLogicEnabled = datapathWrapper.getUserAndCommonLogicEnabled (mEndpoint );
545545 uint16_t timeFrameLength = getTimeFrameLength ();
@@ -913,6 +913,46 @@ std::map<int, Link> CruBar::initializeLinkMap()
913913 return newLinkMap;
914914}
915915
916+ // Returns a vector of the link ids that should participate in data taking
917+ // A link participates in data taking if it is enabled in the datapath and is not down
918+ std::vector<int > CruBar::getDataTakingLinks ()
919+ {
920+ std::vector<int > links;
921+ DatapathWrapper datapathWrapper = DatapathWrapper (mPdaBar );
922+ auto linkMap = initializeLinkMap ();
923+ if (mWrapperCount == 0 ) {
924+ setWrapperCount ();
925+ }
926+ Gbt gbt = Gbt (mPdaBar , linkMap, mWrapperCount , mEndpoint );
927+
928+ // Insert GBT links
929+ for (auto const & el : linkMap) {
930+ int id = el.first ;
931+ Link link = el.second ;
932+ if (!datapathWrapper.isLinkEnabled (link) || gbt.getStickyBit (link) == Cru::LinkStatus::Down) {
933+ continue ;
934+ }
935+ links.push_back (id);
936+ }
937+
938+ Cru::Link newLink;
939+ newLink.dwrapper = mEndpoint ;
940+
941+ // Insert Run Statistics link
942+ newLink.dwrapperId = (mEndpoint == 0 ) ? 13 : 14 ;
943+ if (datapathWrapper.isLinkEnabled (newLink)) {
944+ links.push_back (newLink.dwrapperId );
945+ }
946+
947+ // Insert UL link
948+ newLink.dwrapperId = 15 ;
949+ if (datapathWrapper.isLinkEnabled (newLink)) {
950+ links.push_back (newLink.dwrapperId );
951+ }
952+
953+ return links;
954+ }
955+
916956// / Initializes and Populates the linkMap with the GBT configuration parameters
917957// / Also runs the corresponding configuration
918958void CruBar::populateLinkMap (std::map<int , Link>& linkMap)
0 commit comments