40 lines
1.5 KiB
C++
40 lines
1.5 KiB
C++
// Copyright (2019-2024) Paul Scherrer Institute
|
|
|
|
#include "../common/Logger.h"
|
|
#include "../fpga/host_library/JungfraujochDevice.h"
|
|
|
|
int main(int argc, char **argv) {
|
|
Logger logger("jfjoch_pcie_clock_cfg_test");
|
|
|
|
if (argc != 2) {
|
|
logger.Error("Usage: ./jfjoch_pcie_clock_cfg_test <device name>");
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
try {
|
|
JungfraujochDevice device(argv[1], true);
|
|
logger.Info("Current page {}", device.ReadClockConfig(0x1));
|
|
logger.Info("Device Ready {:x}", device.ReadClockConfig(0xFE));
|
|
|
|
device.WriteClockConfig(0x1, 0x0);
|
|
logger.Info("Current page {}", device.ReadClockConfig(0x1));
|
|
|
|
logger.Info("Base part 0x{:x}{:x}", device.ReadClockConfig(0x3), device.ReadClockConfig(0x2));
|
|
logger.Info("Base part 0x{:x}{:x}", device.ReadClockConfig(0x3), device.ReadClockConfig(0x2));
|
|
|
|
device.WriteClockConfig(0x1, 0x2);
|
|
logger.Info("Current page {}", device.ReadClockConfig(0x1));
|
|
logger.Info("OPN {:c}{:c}{:c}{:c}{:c}",
|
|
device.ReadClockConfig(0x78),
|
|
device.ReadClockConfig(0x79),
|
|
device.ReadClockConfig(0x7A),
|
|
device.ReadClockConfig(0x7B),
|
|
device.ReadClockConfig(0x7C));
|
|
|
|
device.WriteClockConfig(0x1, 0x0);
|
|
logger.Info("Current page {}", device.ReadClockConfig(0x1));
|
|
|
|
logger.Info("Done");
|
|
} catch (const std::runtime_error &e) {
|
|
logger.ErrorException(e);
|
|
}
|
|
} |