27 lines
794 B
C++
27 lines
794 B
C++
// Copyright (2019-2023) Paul Scherrer Institute
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#include "FPGAAcquisitionDevice.h"
|
|
|
|
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);
|
|
} |