mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-09 08:02:04 +02:00
Move JF specific receiver to generic
This commit is contained in:
+1
-1
@@ -31,7 +31,7 @@ add_subdirectory(
|
||||
EXCLUDE_FROM_ALL)
|
||||
|
||||
add_subdirectory("core-buffer")
|
||||
add_subdirectory("jf-udp-recv")
|
||||
add_subdirectory("std-udp-recv")
|
||||
#add_subdirectory("jf-buffer-writer")
|
||||
add_subdirectory("jf-assembler")
|
||||
add_subdirectory("sf-stream")
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
file(GLOB SOURCES
|
||||
src/*.cpp)
|
||||
|
||||
add_library(jf-udp-recv-lib STATIC ${SOURCES})
|
||||
target_include_directories(jf-udp-recv-lib PUBLIC include/)
|
||||
target_link_libraries(jf-udp-recv-lib
|
||||
external
|
||||
core-buffer-lib)
|
||||
|
||||
add_executable(jf-udp-recv src/main.cpp)
|
||||
|
||||
if (USE_EIGER)
|
||||
set (LIB_NAME_UDP_RECV "eiger_udp_recv")
|
||||
else()
|
||||
set (LIB_NAME_UDP_RECV "jf_udp_recv")
|
||||
endif()
|
||||
|
||||
set_target_properties(jf-udp-recv PROPERTIES OUTPUT_NAME ${LIB_NAME_UDP_RECV})
|
||||
|
||||
target_link_libraries(jf-udp-recv
|
||||
jf-udp-recv-lib
|
||||
zmq
|
||||
rt)
|
||||
|
||||
enable_testing()
|
||||
add_subdirectory(test/)
|
||||
@@ -0,0 +1,26 @@
|
||||
file(GLOB SOURCES
|
||||
src/*.cpp)
|
||||
|
||||
add_library(std-udp-recv-lib STATIC ${SOURCES})
|
||||
target_include_directories(std-udp-recv-lib PUBLIC include/)
|
||||
target_link_libraries(std-udp-recv-lib
|
||||
external
|
||||
core-buffer-lib)
|
||||
|
||||
add_executable(std-udp-recv src/main.cpp)
|
||||
|
||||
if (USE_EIGER)
|
||||
set (LIB_NAME_UDP_RECV "eiger_udp_recv")
|
||||
else()
|
||||
set (LIB_NAME_UDP_RECV "jf_udp_recv")
|
||||
endif()
|
||||
|
||||
set_target_properties(std-udp-recv PROPERTIES OUTPUT_NAME ${LIB_NAME_UDP_RECV})
|
||||
|
||||
target_link_libraries(std-udp-recv
|
||||
std-udp-recv-lib
|
||||
zmq
|
||||
rt)
|
||||
|
||||
enable_testing()
|
||||
add_subdirectory(test/)
|
||||
@@ -20,27 +20,24 @@ int main (int argc, char *argv[]) {
|
||||
|
||||
if (argc != 4) {
|
||||
cout << endl;
|
||||
#ifndef USE_EIGER
|
||||
cout << "Usage: jf_udp_recv [detector_json_filename] [module_id] [bit_depth]";
|
||||
#else
|
||||
cout << "Usage: eiger_udp_recv [detector_json_filename] [module_id] [bit_depth]";
|
||||
#endif
|
||||
|
||||
cout << "Usage: std_udp_recv [udp_recv_config_filename] [module_id] [bit_depth]";
|
||||
cout << endl;
|
||||
cout << "\tdetector_json_filename: detector config file path." << endl;
|
||||
cout << "\tudp_recv_config_filename: detector config file path." << endl;
|
||||
cout << "\tmodule_id: id of the module for this process." << endl;
|
||||
cout << "\tbit_depth: bit depth of the incoming udp packets." << endl;
|
||||
cout << endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
const auto config = read_json_config(string(argv[1]));
|
||||
const auto config = UdpRecvConfig.from_json_file(string(argv[1]));
|
||||
const int module_id = atoi(argv[2]);
|
||||
const int bit_depth = atoi(argv[3]);
|
||||
const int n_receivers = config.n_modules * config.n_submodules;
|
||||
const auto udp_port = config.start_udp_port + module_id;
|
||||
|
||||
FrameUdpReceiver receiver(module_id, udp_port, n_receivers, config.n_submodules, bit_depth);
|
||||
RamBuffer buffer(config.detector_name, n_receivers, config.n_submodules, bit_depth);
|
||||
RamBuffer frame_buffer(config.detector_name, n_receivers, config.n_submodules, bit_depth);
|
||||
FrameStats stats(config.detector_name, n_receivers, module_id, bit_depth, STATS_TIME);
|
||||
|
||||
auto ctx = zmq_ctx_new();
|
||||
@@ -62,7 +59,7 @@ int main (int argc, char *argv[]) {
|
||||
( (meta.frame_index-frame_index_previous) > 1000 ) ){
|
||||
bad_pulse_id = true;
|
||||
} else {
|
||||
buffer.write_frame(meta, data);
|
||||
frame_buffer.write_frame(meta, data);
|
||||
|
||||
zmq_send(socket, &pulse_id, sizeof(pulse_id), 0);
|
||||
|
||||
Reference in New Issue
Block a user