@@ -45,22 +45,13 @@ namespace o2
4545namespace alf
4646{
4747
48- namespace ic_regs
49- {
50- static constexpr roc::Register IC_BASE (0x00f00000 );
51- static constexpr roc::Register IC_WR_DATA (IC_BASE.address + 0x20 );
52- static constexpr roc::Register IC_WR_CFG (IC_BASE.address + 0x24 );
53- static constexpr roc::Register IC_WR_CMD (IC_BASE.address + 0x28 );
54- static constexpr roc::Register IC_RD_DATA (IC_BASE.address + 0x30 );
55- } // namespace ic_regs
56-
5748Ic::Ic (AlfLink link, std::shared_ptr<lla::Session> llaSession)
5849 : ScBase(link, llaSession)
5950{
6051 Logger::setFacility (" ALF/IC" );
6152
6253 // Set CFG to 0x3 by default
63- barWrite (ic_regs ::IC_WR_CFG.index , 0x3 );
54+ barWrite (sc_regs ::IC_WR_CFG.index , 0x3 );
6455}
6556
6657Ic::Ic (const roc::Parameters::CardIdType& cardId, int linkId)
@@ -69,7 +60,7 @@ Ic::Ic(const roc::Parameters::CardIdType& cardId, int linkId)
6960 Logger::setFacility (" ALF/IC" );
7061
7162 // Set CFG to 0x3 by default
72- barWrite (ic_regs ::IC_WR_CFG.index , 0x3 );
63+ barWrite (sc_regs ::IC_WR_CFG.index , 0x3 );
7364}
7465
7566Ic::Ic (std::string cardId, int linkId)
@@ -78,7 +69,7 @@ Ic::Ic(std::string cardId, int linkId)
7869 Logger::setFacility (" ALF/IC" );
7970
8071 // Set CFG to 0x3 by default
81- barWrite (ic_regs ::IC_WR_CFG.index , 0x3 );
72+ barWrite (sc_regs ::IC_WR_CFG.index , 0x3 );
8273}
8374
8475uint32_t Ic::read (uint32_t address)
@@ -91,20 +82,20 @@ uint32_t Ic::read(uint32_t address)
9182 data = data + address;
9283
9384 // Write to the FIFO
94- barWrite (ic_regs ::IC_WR_DATA.index , data);
95- barWrite (ic_regs ::IC_WR_CMD.index , 0x1 );
96- barWrite (ic_regs ::IC_WR_CMD.index , 0x0 );
85+ barWrite (sc_regs ::IC_WR_DATA.index , data);
86+ barWrite (sc_regs ::IC_WR_CMD.index , 0x1 );
87+ barWrite (sc_regs ::IC_WR_CMD.index , 0x0 );
9788
9889 // Execute the RD State Machine
99- barWrite (ic_regs ::IC_WR_CMD.index , 0x8 );
100- barWrite (ic_regs ::IC_WR_CMD.index , 0x0 );
90+ barWrite (sc_regs ::IC_WR_CMD.index , 0x8 );
91+ barWrite (sc_regs ::IC_WR_CMD.index , 0x0 );
10192
10293 // Pulse the READ
103- barWrite (ic_regs ::IC_WR_CMD.index , 0x2 );
104- barWrite (ic_regs ::IC_WR_CMD.index , 0x0 );
94+ barWrite (sc_regs ::IC_WR_CMD.index , 0x2 );
95+ barWrite (sc_regs ::IC_WR_CMD.index , 0x0 );
10596
10697 // Read the status of the FIFO
107- uint32_t ret = barRead (ic_regs ::IC_RD_DATA.index );
98+ uint32_t ret = barRead (sc_regs ::IC_RD_DATA.index );
10899 // uint32_t gbtAddress = (ret >> 8) & 0xff;
109100 uint32_t retData = ret & 0xff ;
110101 // uint32_t empty = (ret >> 16) & 0x1;
@@ -124,18 +115,18 @@ uint32_t Ic::write(uint32_t address, uint32_t data)
124115 data += address;
125116
126117 // Write to the FIFO
127- barWrite (ic_regs ::IC_WR_DATA.index , data);
128- barWrite (ic_regs ::IC_WR_CMD.index , 0x1 );
129- barWrite (ic_regs ::IC_WR_CMD.index , 0x0 );
118+ barWrite (sc_regs ::IC_WR_DATA.index , data);
119+ barWrite (sc_regs ::IC_WR_CMD.index , 0x1 );
120+ barWrite (sc_regs ::IC_WR_CMD.index , 0x0 );
130121
131122 // Execute the WR State Machine
132- barWrite (ic_regs ::IC_WR_CMD.index , 0x4 );
133- barWrite (ic_regs ::IC_WR_CMD.index , 0x0 );
123+ barWrite (sc_regs ::IC_WR_CMD.index , 0x4 );
124+ barWrite (sc_regs ::IC_WR_CMD.index , 0x0 );
134125
135126 std::this_thread::sleep_for (std::chrono::milliseconds (10 ));
136127
137128 // Read the status of the FIFO
138- uint32_t ret = barRead (ic_regs ::IC_RD_DATA.index );
129+ uint32_t ret = barRead (sc_regs ::IC_RD_DATA.index );
139130 // uint32_t gbtAddress = (ret >> 8) & 0xff;
140131 // uint32_t retData = ret & 0xff;
141132 uint32_t empty = (ret >> 16 ) & 0x1 ;
@@ -149,7 +140,7 @@ uint32_t Ic::write(uint32_t address, uint32_t data)
149140
150141void Ic::writeGbtI2c (uint32_t data)
151142{
152- barWrite (ic_regs ::IC_WR_CFG.index , data);
143+ barWrite (sc_regs ::IC_WR_CFG.index , data);
153144}
154145
155146std::vector<std::pair<Ic::Operation, Ic::Data>> Ic::executeSequence (std::vector<std::pair<Operation, Data>> ops, bool lock)
@@ -184,7 +175,7 @@ std::vector<std::pair<Ic::Operation, Ic::Data>> Ic::executeSequence(std::vector<
184175 // If an IC error occurs, we stop executing the sequence of commands and return the results as far as we got them, plus
185176 // the error message.
186177 IcData icData = boost::get<IcData>(data);
187- std::string meaningfulMessage = (boost::format (" ic_regs ::IC_SEQUENCE address=0x%08x data=0x%08x serialId=%s link=%d, error='%s'" ) % icData.address % icData.data % mLink .serialId % mLink .linkId % e.what ()).str ();
178+ std::string meaningfulMessage = (boost::format (" sc_regs ::IC_SEQUENCE address=0x%08x data=0x%08x serialId=%s link=%d, error='%s'" ) % icData.address % icData.data % mLink .serialId % mLink .linkId % e.what ()).str ();
188179 // Logger::get().err() << meaningfulMessage << endm;
189180
190181 ret.push_back ({ Operation::Error, meaningfulMessage });
0 commit comments