AcquisitionDevice: Completion queue is handled by particular implementation of the device

This commit is contained in:
2023-04-25 15:58:07 +02:00
parent f01f2e79d1
commit bf2a23ef7e
15 changed files with 64 additions and 71 deletions
+21 -7
View File
@@ -3,11 +3,25 @@
#include "FPGAAcquisitionDevice.h"
Completion FPGAAcquisitionDevice::ReadCompletion() {
uint32_t values[12];
while (!HW_ReadMailbox(values)) {
// The receiving FIFO level is less than or equal to the RIT threshold
std::this_thread::sleep_for(std::chrono::microseconds(10));
}
return parse_hw_completion(values);
void FPGAAcquisitionDevice::HW_StartAction() {
FPGA_StartAction();
read_work_completion_future = std::async(std::launch::async, &FPGAAcquisitionDevice::ReadWorkCompletionThread, this);
}
void FPGAAcquisitionDevice::HW_EndAction() {
read_work_completion_future.get();
FPGA_EndAction();
}
void FPGAAcquisitionDevice::ReadWorkCompletionThread() {
uint32_t values[12];
Completion c;
do {
while (!HW_ReadMailbox(values))
std::this_thread::sleep_for(std::chrono::microseconds(10));
c = parse_hw_completion(values);
work_completion_queue.PutBlocking(c);
} while (c.type != Completion::Type::End);
}