Adapt PCIe driver and tests for the new frame generator

This commit is contained in:
2023-09-13 21:44:20 +02:00
parent f3e85deb31
commit 0b95456d3d
13 changed files with 99 additions and 48 deletions
+17 -6
View File
@@ -92,14 +92,25 @@ bool PCIExpressDevice::HW_SendWorkRequest(uint32_t handle) {
return true;
}
void PCIExpressDevice::FPGA_StartAction() {
if (ioctl(fd, IOCTL_JFJOCH_SET_INT_PKT, internal_pkt_gen_frame.data()) != 0)
throw JFJochException(JFJochExceptionCategory::PCIeError,
"Failed loading internal packet generator frame", errno);
void PCIExpressDevice::FPGA_StartAction(const DiffractionExperiment &experiment) {
if (experiment.IsUsingInternalPacketGen()) {
if (ioctl(fd, IOCTL_JFJOCH_SET_INT_PKT, internal_pkt_gen_frame.data()) != 0)
throw JFJochException(JFJochExceptionCategory::PCIeError,
"Failed loading internal packet generator frame", errno);
}
if (ioctl(fd, IOCTL_JFJOCH_START) != 0)
throw JFJochException(JFJochExceptionCategory::PCIeError,
"Failed starting action", errno);
throw JFJochException(JFJochExceptionCategory::PCIeError, "Failed starting action", errno);
if (experiment.IsUsingInternalPacketGen()) {
FrameGeneratorConfig config{};
config.frames = experiment.GetFrameNum() + DELAY_FRAMES_STOP_AND_QUIT + 1;
config.modules = experiment.GetModulesNum(data_stream);
config.dest_ipv4_addr = ipv4_addr;
config.dest_mac_addr = mac_addr;
if (ioctl(fd, IOCTL_JFJOCH_RUN_FRAME_GEN) != 0)
throw JFJochException(JFJochExceptionCategory::PCIeError, "Failed starting frame generator", errno);
}
}
void PCIExpressDevice::FPGA_EndAction() {