jfjoch_action_test: refactor to remove MakeAcquisitionDevice
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "MakeAcquisitionDevice.h"
|
||||
#include "HLSSimulatedDevice.h"
|
||||
#include "PCIExpressDevice.h"
|
||||
#include "MockAcquisitionDevice.h"
|
||||
#include "../../common/JFJochException.h"
|
||||
|
||||
std::unique_ptr<AcquisitionDevice> MakeAcquisitionDevice(AcquisitionDeviceType type, uint16_t data_stream,
|
||||
size_t in_frame_buffer_size_modules,
|
||||
uint16_t pci_slot_number,
|
||||
int16_t numa_node) {
|
||||
switch (type) {
|
||||
case AcquisitionDeviceType::HLS:
|
||||
if (data_stream != 0)
|
||||
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds,
|
||||
"HLS simulation possible with a single data stream only");
|
||||
return std::make_unique<HLSSimulatedDevice>(data_stream, in_frame_buffer_size_modules, numa_node);
|
||||
case AcquisitionDeviceType::PCIe:
|
||||
return std::make_unique<PCIExpressDevice>(data_stream, pci_slot_number);
|
||||
case AcquisitionDeviceType::Mock:
|
||||
default: {
|
||||
auto tmp = std::make_unique<MockAcquisitionDevice>(data_stream, in_frame_buffer_size_modules);
|
||||
tmp->Terminate();
|
||||
return tmp;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright (2019-2022) Paul Scherrer Institute
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#ifndef JUNGFRAUJOCH_MAKEACQUISITIONDEVICE_H
|
||||
#define JUNGFRAUJOCH_MAKEACQUISITIONDEVICE_H
|
||||
|
||||
#include "AcquisitionDevice.h"
|
||||
|
||||
enum class AcquisitionDeviceType {PCIe, HLS, Mock};
|
||||
|
||||
std::unique_ptr<AcquisitionDevice> MakeAcquisitionDevice(AcquisitionDeviceType type, uint16_t data_stream,
|
||||
size_t in_frame_buffer_size_modules = 1024,
|
||||
uint16_t pci_slot_number = 0,
|
||||
int16_t numa_node = -1);
|
||||
#endif //JUNGFRAUJOCH_MAKEACQUISITIONDEVICE_H
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "host/MakeAcquisitionDevice.h"
|
||||
#include "host/PCIExpressDevice.h"
|
||||
#include "JFJochReceiverTest.h"
|
||||
#include "../tests/FPGAUnitTest.h"
|
||||
|
||||
@@ -38,19 +38,22 @@ int main(int argc, char **argv) {
|
||||
x.SpotFindingPeriod(std::chrono::milliseconds(processing_period)).MaskModuleEdges(false).MaskChipEdges(false);
|
||||
x.Compression(JFJochProtoBuf::BSHUF_LZ4);
|
||||
|
||||
std::vector<int16_t> pci_slot_number = {0,2,1,3};
|
||||
std::vector<std::string> dev_name = {
|
||||
"/dev/jfjoch0",
|
||||
"/dev/jfjoch2",
|
||||
"/dev/jfjoch1",
|
||||
"/dev/jfjoch3"
|
||||
};
|
||||
std::vector<int16_t> numa_node = {0,1,0,1};
|
||||
bool verbose = false;
|
||||
bool print_status_updates = true;
|
||||
size_t frame_buffer_size = 4096;
|
||||
uint16_t nthreads = 64;
|
||||
AcquisitionDeviceType dev_type = AcquisitionDeviceType::PCIe;
|
||||
uint64_t clock_MHz = 200;
|
||||
|
||||
logger.Verbose(verbose);
|
||||
|
||||
if (nstreams > pci_slot_number.size()) {
|
||||
logger.Error("Only {} data streams allowed on this platform", pci_slot_number.size());
|
||||
if (nstreams > dev_name.size()) {
|
||||
logger.Error("Only {} data streams allowed on this platform", dev_name.size());
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -62,7 +65,7 @@ int main(int argc, char **argv) {
|
||||
LoadBinaryFile(image_path, input.data(), RAW_MODULE_SIZE);
|
||||
|
||||
for (int i = 0; i < nstreams; i++) {
|
||||
oc_devices.push_back(MakeAcquisitionDevice(dev_type, i, frame_buffer_size, pci_slot_number[i], numa_node[i]));
|
||||
oc_devices.push_back(std::make_unique<PCIExpressDevice>(dev_name[i], i));
|
||||
oc_devices[i]->SetCustomInternalGeneratorFrame(input);
|
||||
oc_devices[i]->EnableLogging(&logger);
|
||||
aq_devices.push_back(oc_devices[i].get());
|
||||
|
||||
Reference in New Issue
Block a user