acquisition_device: give each device sole ownership of its buffers
The base AcquisitionDevice no longer allocates or frees frame buffers; buffer_device is now just a non-owning view of addresses. Each subclass owns its backing memory and the matching lifecycle: - PCIExpressDevice mmap's the kernel DMA buffers and munmap's them in its own destructor (and on ctor failure), symmetric with MapKernelBuffer. - HLSSimulatedDevice owns plain zeroed heap buffers it points buffer_device into, declared before the HLSDevice so they outlive the action thread that writes them. The buffers are page-aligned to match the real device's kernel DMA buffers - the modelled AXI datamover and FPGAIntegrationTest require aligned output buffers. This drops the NUMA/mmap dance from the simulated path (not performance-critical) - removing libnuma from acquisition_device - and replaces the base-class cleanup that had to guess the allocation strategy with a single clear owner per device. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,15 @@ PCIExpressDevice::PCIExpressDevice(uint16_t data_stream, const std::string &devi
|
||||
}
|
||||
}
|
||||
|
||||
PCIExpressDevice::~PCIExpressDevice() {
|
||||
UnmapBuffers();
|
||||
}
|
||||
|
||||
void PCIExpressDevice::UnmapBuffers() {
|
||||
for (auto &buf: buffer_device)
|
||||
if (buf != nullptr) dev.UnmapKernelBuffer(buf);
|
||||
}
|
||||
|
||||
bool PCIExpressDevice::HW_ReadMailbox(uint32_t *values) {
|
||||
PCI_EXCEPT(return dev.ReadWorkCompletion(values);)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user