Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
lerwys committed Mar 23, 2021
2 parents 119d151 + 1b1b0d2 commit ecff152
Show file tree
Hide file tree
Showing 71 changed files with 5,389 additions and 62 deletions.
21 changes: 19 additions & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ set(gcc_c "$<$<COMPILE_LANGUAGE:C>:$<C_COMPILER_ID:GNU>>")
set(clang_c "$<$<COMPILE_LANGUAGE:C>:$<C_COMPILER_ID:Clang>>")
target_compile_options(halcs_examples_compiler_flags
INTERFACE
"$<${gcc_c}:$<BUILD_INTERFACE:-Wall;-O2;-Wno-missing-field-initializers;-Wno-missing-braces;-Wno-cpp>>"
"$<${clang_c}:$<BUILD_INTERFACE:-Wall;-O2;-Wno-missing-field-initializers;-Wno-missing-braces;-Wno-error=\#warnings>>"
"$<${gcc_c}:$<BUILD_INTERFACE:-Wall;-O2;-g;-Wno-missing-field-initializers;-Wno-missing-braces;-Wno-cpp>>"
"$<${clang_c}:$<BUILD_INTERFACE:-Wall;-O2;-g;-Wno-missing-field-initializers;-Wno-missing-braces;-Wno-error=\#warnings>>"
)

# add binaries to bin_target_outputs
Expand Down Expand Up @@ -416,6 +416,18 @@ if(BUILD_EXAMPLE_trigger)
list(APPEND bin_target_outputs "trigger")
endif()

option(BUILD_EXAMPLE_fofb_ctrl "Whether or not to build example fofb_ctrl tool" ON)

if(BUILD_EXAMPLE_fofb_ctrl)
list(APPEND bin_target_outputs "fofb_ctrl")
endif()

option(BUILD_EXAMPLE_rtmlamp_ohwr_ctl "Whether or not to build example rtmlamp_ohwr_ctl tool" ON)

if(BUILD_EXAMPLE_rtmlamp_ohwr_ctl)
list(APPEND bin_target_outputs "rtmlamp_ohwr_ctl")
endif()

foreach(bin_target ${bin_target_outputs})
# add binary tool
add_executable(${bin_target} src/${bin_target}.c)
Expand Down Expand Up @@ -498,6 +510,8 @@ if(ENABLE_CPACK)
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY ">=")
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
# Generate debuginfo package
set(CPACK_DEBIAN_DEBUGINFO_PACKAGE ON)
set(CPACK_RPM_PACKAGE_AUTOREQ no)
set(CPACK_RPM_PACKAGE_AUTOPROV yes)
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION
Expand Down Expand Up @@ -529,6 +543,9 @@ if(ENABLE_CPACK)
set(CPACK_PACKAGE_VERSION_PATCH ${halcs_examples_VERSION_PATCH})
# set(CPACK_PACKAGE_INSTALL_DIRECTORY "HALCS examples Install Directory")
# set(CPACK_TEMPORARY_DIRECTORY "HALCS examples Temporary CPack Directory")
# Generate debuginfo package
set(CPACK_RPM_DEBUGINFO_PACKAGE ON)
set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/usr/src/debug/${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")

include(CPack)

Expand Down
2 changes: 1 addition & 1 deletion examples/include/halcs_examples_classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/* version macros for compile-time API detection */

#define HALCS_EXAMPLES_VERSION_MAJOR 2
#define HALCS_EXAMPLES_VERSION_MINOR 3
#define HALCS_EXAMPLES_VERSION_MINOR 4
#define HALCS_EXAMPLES_VERSION_PATCH 0

#define HALCS_EXAMPLES_MAKE_VERSION(major, minor, patch) \
Expand Down
23 changes: 23 additions & 0 deletions examples/scripts/cfg_fofb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -euo pipefail

# This must follow the format "<port_number>,<bitstream_name_without_extension>"
BOARDS="$1"

SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

OLDIFS=$IFS; IFS=',';
# Separate "tuple" arguments with positional notation
set -- ${BOARDS};
for board in ${BOARDS[*]}; do
printf "Configuring BPM board: %s\n" "${board}"
(cd build/ && ./examples/fofb_ctrl --brokerendp ipc:///tmp/malamute --boardslot ${board} --halcsnumber 0 --bpm_id ${board} --time_frame_len 10000 --cc_enable 0)
(cd build/ && ./examples/fofb_ctrl --brokerendp ipc:///tmp/malamute --boardslot ${board} --halcsnumber 1 --bpm_id ${board} --time_frame_len 10000 --cc_enable 0)
(cd build/ && ./examples/fofb_ctrl --brokerendp ipc:///tmp/malamute --boardslot ${board} --halcsnumber 0 --cc_enable 1)
(cd build/ && ./examples/fofb_ctrl --brokerendp ipc:///tmp/malamute --boardslot ${board} --halcsnumber 1 --cc_enable 1)
(cd build/ && ./examples/trigger --brokerendp ipc:///tmp/malamute --boardslot ${board} --halcsnumber 0 --channumber 1 --rcvsrc 0 --rcvsel 3)
(cd build/ && ./examples/trigger --brokerendp ipc:///tmp/malamute --boardslot ${board} --halcsnumber 1 --channumber 1 --rcvsrc 0 --rcvsel 3)
done;

IFS=$OLDIFS;
33 changes: 33 additions & 0 deletions examples/scripts/reformat_fofb_packet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env python3

import sys
import re

def conv_int32_to_uint32(x):
INT32_TO_UINT32 = (1 << 32)
INT32_SIGN_BIT = (1 << 31)
return x + INT32_TO_UINT32 if (x & INT32_SIGN_BIT) else x

LINE_PATTERN = "[\t ]*(-?\d+)[\t ]*(-?\d+)[\t ]*(-?\d+)[\t ]*(-?\d+)"
p = re.compile(LINE_PATTERN)

i = 0
print("| {:8} | {:10} | {:8} | {:6} | {:^17} | {:^17} | {:10} |".
format("packet #", "tf_cntr_16", "tf_start", "bpm_id", "bpm_x", "bpm_y", "tf_cntr_32"))
for line in sys.stdin:
m = re.match(p, line)
atoms = [conv_int32_to_uint32(int(g)) for g in m.groups()]
tf_cntr_16_lsb = (atoms[3] & 0xFFFF0000) >> 16
tf_start = (atoms[3] & 0x8000) >> 15
bpm_id = (atoms[3] & 0x7FFF)
bpm_pos_x_16_msb = (atoms[2] & 0xFFFF0000) >> 16
bpm_pos_x_16_lsb = (atoms[2] & 0xFFFF)
bpm_pos_y_16_msb = (atoms[1] & 0xFFFF0000) >> 16
bpm_pos_y_16_lsb = (atoms[1] & 0xFFFF)
tf_cnrt_32 = atoms[0]
print("| {:<8} | {:<10} | {:<8} | {:<6} | {:<8} | {:<8} | {:<8} | {:<8} | {:10} |".
format(i, tf_cntr_16_lsb, tf_start, bpm_id,
bpm_pos_x_16_msb, bpm_pos_x_16_lsb,
bpm_pos_y_16_msb, bpm_pos_y_16_lsb,
tf_cnrt_32))
i = i + 1
2 changes: 1 addition & 1 deletion examples/src/acq.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ int main (int argc, char *argv [])
else {
chan = strtoul (chan_str, NULL, 10);

if (chan > END_CHAN_ID-1) {
if (chan > MAX_NUM_CHANS-1) {
fprintf (stderr, "[client:acq]: Channel number too big. Maximum number is: %u\n",
MAX_NUM_CHANS);
goto err_opt_exit;
Expand Down
Loading

0 comments on commit ecff152

Please sign in to comment.