@@ -44,7 +44,6 @@ namespace sc_regs = AliceO2::roc::Cru::ScRegisters;
4444
4545Swt::Swt (AlfLink link) : mBar2 (link.bar), mLink (link)
4646{
47- setChannel (mLink .linkId ); // TODO: Decouple this from the class?
4847 mLlaSession = std::make_unique<LlaSession>(" DDT" , link.cardSequence );
4948}
5049
@@ -73,10 +72,6 @@ void Swt::init(const roc::Parameters::CardIdType& cardId, int linkId)
7372 };
7473
7574 mLlaSession = std::make_unique<LlaSession>(" DDT" , card.sequenceId );
76-
77- if (mLink .linkId != -1 ) {
78- setChannel (mLink .linkId );
79- }
8075}
8176
8277void Swt::setChannel (int gbtChannel)
@@ -97,6 +92,12 @@ void Swt::checkChannelSet()
9792 if (mLink .linkId == -1 ) {
9893 BOOST_THROW_EXCEPTION (SwtException () << ErrorInfo::Message (" No SWT channel selected" ));
9994 }
95+
96+ uint32_t channel = (barRead (sc_regs::SWT_MON.index ) >> 8 ) & 0xff ;
97+
98+ if (channel != mLink .linkId ) {
99+ setChannel (mLink .linkId );
100+ }
100101}
101102
102103std::vector<SwtWord> Swt::read (SwtWord::Size wordSize, TimeOut msTimeOut)
@@ -189,14 +190,11 @@ std::vector<std::pair<Swt::Operation, Swt::Data>> Swt::executeSequence(std::vect
189190 mLlaSession ->start ();
190191 }
191192
192- // force set the channel within the atomic part of the sequence
193- // to be changed as soon as FW provides set channel
194193 try {
195194 checkChannelSet ();
196195 } catch (const SwtException& e) {
197196 return { { Operation::Error, e.what () } };
198197 }
199- setChannel (mLink .linkId );
200198
201199 std::vector<std::pair<Operation, Data>> ret;
202200
0 commit comments