Skip to content

Commit fa26c28

Browse files
committed
Start/stop CRU datataking
1 parent f88c35f commit fa26c28

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/Cru/CruBar.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,11 @@ int CruBar::getDdgBurstLength()
561561
return Utilities::getWidth(burst);
562562
}
563563

564+
void CruBar::enableDataTaking()
565+
{
566+
modifyRegister(Cru::Registers::BSP_USER_CONTROL.index, 0, 1, 0x1);
567+
}
568+
564569
void CruBar::disableDataTaking()
565570
{
566571
modifyRegister(Cru::Registers::BSP_USER_CONTROL.index, 0, 1, 0x0);

src/Cru/CruBar.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ class CruBar final : public BarInterfaceBase
4949
virtual int32_t getLinks() override;
5050
virtual int32_t getLinksPerWrapper(int wrapper) override;
5151

52-
53-
5452
void pushSuperpageDescriptor(uint32_t link, uint32_t pages, uintptr_t busAddress);
5553
uint32_t getSuperpageCount(uint32_t link);
5654
void setDataEmulatorEnabled(bool enabled);
@@ -72,6 +70,9 @@ class CruBar final : public BarInterfaceBase
7270
void setWrapperCount();
7371
void configure() override;
7472
Cru::ReportInfo report();
73+
74+
void enableDataTaking();
75+
void disableDataTaking();
7576

7677
void setDebugModeEnabled(bool enabled);
7778
bool getDebugModeEnabled();
@@ -89,7 +90,6 @@ class CruBar final : public BarInterfaceBase
8990
uint32_t getFpgaChipHigh();
9091
uint32_t getFpgaChipLow();
9192
std::vector<Link> populateLinkList();
92-
void disableDataTaking();
9393
int getDdgBurstLength();
9494
//void checkParameters();
9595

src/Cru/CruDmaChannel.cxx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ void CruDmaChannel::deviceStartDma()
152152

153153
// Start DMA
154154
setBufferReady();
155+
156+
// Enable data taking
157+
if (dataSourceSelection == Cru::Registers::DATA_SOURCE_SELECT_GBT) {
158+
getBar2()->disableDataTaking(); // Make sure we don't start from a bad state
159+
getBar2()->enableDataTaking();
160+
}
155161
}
156162

157163
/// Set buffer to ready
@@ -170,6 +176,7 @@ void CruDmaChannel::setBufferNonReady()
170176
void CruDmaChannel::deviceStopDma()
171177
{
172178
setBufferNonReady();
179+
getBar2()->disableDataTaking();
173180
int moved = 0;
174181
for (auto& link : mLinks) {
175182
int32_t superpageCount = getBar()->getSuperpageCount(link.id);

0 commit comments

Comments
 (0)