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:
2026-06-17 19:18:32 +02:00
co-authored by Claude Opus 4.8
parent d373ba0490
commit 040cdeacf1
6 changed files with 29 additions and 44 deletions
+9
View File
@@ -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);)
}