Skip to content

Commit bc8a7e6

Browse files
committed
Allow for variable dma page size in CRU DMA channel
1 parent 5c70eeb commit bc8a7e6

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/Cru/CruDmaChannel.cxx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,19 @@ CruDmaChannel::CruDmaChannel(const Parameters& parameters)
3939
mGeneratorInitialValue(0), // Start from 0
4040
mGeneratorInitialWord(0), // First word
4141
mGeneratorSeed(0), // Presumably for random patterns, incremental doesn't really need it
42-
mGeneratorDataSize(parameters.getGeneratorDataSize().get_value_or(Cru::DMA_PAGE_SIZE)) // Can use page size
42+
mGeneratorDataSize(parameters.getGeneratorDataSize().get_value_or(Cru::DMA_PAGE_SIZE)), // Can use page size
43+
mDmaPageSize(parameters.getDmaPageSize().get_value_or(Cru::DMA_PAGE_SIZE))
4344
{
4445

45-
if (auto pageSize = parameters.getDmaPageSize()) {
46+
//TODO: Figure out how to approach errors here
47+
//TODO: PageSize > 0?8?128? PageSize< 8K?
48+
/*if (auto pageSize = parameters.getDmaPageSize()) {
4649
if (pageSize.get() != Cru::DMA_PAGE_SIZE) {
4750
BOOST_THROW_EXCEPTION(CruException()
4851
<< ErrorInfo::Message("CRU only supports an 8KiB page size")
4952
<< ErrorInfo::DmaPageSize(pageSize.get()));
5053
}
51-
}
54+
}*/
5255

5356
if (mLoopbackMode == LoopbackMode::Diu || mLoopbackMode == LoopbackMode::Siu) {
5457
BOOST_THROW_EXCEPTION(CruException() << ErrorInfo::Message("CRU does not support given loopback mode")
@@ -265,7 +268,7 @@ void CruDmaChannel::pushSuperpage(Superpage superpage)
265268

266269
// Once we've confirmed the link has a slot available, we push the superpage
267270
pushSuperpageToLink(link, superpage);
268-
auto dmaPages = superpage.getSize() / Cru::DMA_PAGE_SIZE;
271+
auto dmaPages = superpage.getSize() / mDmaPageSize;
269272
auto busAddress = getBusOffsetAddress(superpage.getOffset());
270273
getBar()->pushSuperpageDescriptor(link.id, dmaPages, busAddress);
271274
}

src/Cru/CruDmaChannel.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ class CruDmaChannel final : public DmaChannelPdaBase
174174

175175
/// Flag to know if we should reset the debug register after we fiddle with it
176176
bool mDebugRegisterReset = false;
177+
178+
/// DMA page size, as specified when opening the channel
179+
const size_t mDmaPageSize;
177180
};
178181

179182
} // namespace roc

0 commit comments

Comments
 (0)