mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-25 07:40:03 +02:00
Merge branch 'developer' into mysocket
This commit is contained in:
commit
0972b803dd
@ -1,13 +1,9 @@
|
|||||||
cmake_minimum_required(VERSION 3.9)
|
cmake_minimum_required(VERSION 3.9)
|
||||||
project(slsDetectorPackage)
|
project(slsDetectorPackage)
|
||||||
|
|
||||||
set(PROJECT_VERSION 5.0.0)
|
set(PROJECT_VERSION 5.0.0)
|
||||||
|
|
||||||
include(CheckIPOSupported)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
include(cmake/project_version.cmake)
|
include(cmake/project_version.cmake)
|
||||||
|
include(CheckIPOSupported)
|
||||||
|
|
||||||
# Include additional modules that are used unconditionally
|
# Include additional modules that are used unconditionally
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
@ -35,11 +31,11 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
option (SLS_USE_HDF5 "HDF5 File format" OFF)
|
option (SLS_USE_HDF5 "HDF5 File format" OFF)
|
||||||
option (SLS_USE_TEXTCLIENT "Text Client" OFF)
|
option (SLS_USE_TEXTCLIENT "Text Client" ON)
|
||||||
option (SLS_USE_RECEIVER "Receiver" OFF)
|
option (SLS_USE_RECEIVER "Receiver" ON)
|
||||||
option (SLS_USE_GUI "GUI" OFF)
|
option (SLS_USE_GUI "GUI" OFF)
|
||||||
option (SLS_USE_TESTS "TESTS" ON)
|
option (SLS_USE_TESTS "TESTS" OFF)
|
||||||
option (SLS_USE_INTEGRATION_TESTS "Integration Tests" ON)
|
option (SLS_USE_INTEGRATION_TESTS "Integration Tests" OFF)
|
||||||
option(SLS_USE_SANITIZER "Sanitizers for debugging" OFF)
|
option(SLS_USE_SANITIZER "Sanitizers for debugging" OFF)
|
||||||
option(SLS_USE_PYTHON "Python bindings" OFF)
|
option(SLS_USE_PYTHON "Python bindings" OFF)
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
@ -91,12 +87,10 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|||||||
-Wno-misleading-indentation # mostly in rapidjson remove using clang format
|
-Wno-misleading-indentation # mostly in rapidjson remove using clang format
|
||||||
-Wduplicated-cond
|
-Wduplicated-cond
|
||||||
-Wnull-dereference )
|
-Wnull-dereference )
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
|
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
|
||||||
target_compile_options(slsProjectWarnings INTERFACE
|
target_compile_options(slsProjectWarnings INTERFACE
|
||||||
-Wno-class-memaccess )
|
-Wno-class-memaccess )
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -106,11 +100,10 @@ if(SLS_USE_SANITIZER)
|
|||||||
target_link_libraries(slsProjectOptions INTERFACE -fsanitize=address,undefined)
|
target_link_libraries(slsProjectOptions INTERFACE -fsanitize=address,undefined)
|
||||||
# target_compile_options(slsProjectOptions INTERFACE -fsanitize=thread)
|
# target_compile_options(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||||
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
|
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||||
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# Install fake the library
|
# Install fake the libraries
|
||||||
install(TARGETS slsProjectOptions slsProjectWarnings
|
install(TARGETS slsProjectOptions slsProjectWarnings
|
||||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
@ -122,8 +115,6 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|||||||
set(CMAKE_INSTALL_RPATH "$ORIGIN")
|
set(CMAKE_INSTALL_RPATH "$ORIGIN")
|
||||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
find_package(Doxygen)
|
find_package(Doxygen)
|
||||||
find_package(ZeroMQ 4 REQUIRED)
|
find_package(ZeroMQ 4 REQUIRED)
|
||||||
|
|
||||||
@ -132,15 +123,13 @@ if (SLS_USE_TESTS)
|
|||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif(SLS_USE_TESTS)
|
endif(SLS_USE_TESTS)
|
||||||
|
|
||||||
# Support library containing functionallity common to
|
# Common functionallity to detector and receiver
|
||||||
# detector and receiver
|
|
||||||
add_subdirectory(slsSupportLib)
|
add_subdirectory(slsSupportLib)
|
||||||
|
|
||||||
if (SLS_USE_TEXTCLIENT)
|
if (SLS_USE_TEXTCLIENT)
|
||||||
add_subdirectory(slsDetectorSoftware)
|
add_subdirectory(slsDetectorSoftware)
|
||||||
endif (SLS_USE_TEXTCLIENT)
|
endif (SLS_USE_TEXTCLIENT)
|
||||||
|
|
||||||
|
|
||||||
if (SLS_USE_RECEIVER)
|
if (SLS_USE_RECEIVER)
|
||||||
if (SLS_USE_HDF5)
|
if (SLS_USE_HDF5)
|
||||||
find_package(HDF5 1.10 COMPONENTS CXX REQUIRED)
|
find_package(HDF5 1.10 COMPONENTS CXX REQUIRED)
|
||||||
@ -157,8 +146,6 @@ if (SLS_USE_GUI)
|
|||||||
endif()
|
endif()
|
||||||
endif (SLS_USE_GUI)
|
endif (SLS_USE_GUI)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (SLS_USE_INTEGRATION_TESTS)
|
if (SLS_USE_INTEGRATION_TESTS)
|
||||||
add_subdirectory(integrationTests)
|
add_subdirectory(integrationTests)
|
||||||
endif (SLS_USE_INTEGRATION_TESTS)
|
endif (SLS_USE_INTEGRATION_TESTS)
|
||||||
@ -173,13 +160,9 @@ configure_file( .clang-tidy
|
|||||||
|
|
||||||
|
|
||||||
if (DOXYGEN_FOUND)
|
if (DOXYGEN_FOUND)
|
||||||
# set input and output files
|
|
||||||
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/doxygen/Doxyfile.in)
|
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/doxygen/Doxyfile.in)
|
||||||
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
|
||||||
|
|
||||||
# request to configure the file
|
|
||||||
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
|
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
|
||||||
message("Doxygen build started")
|
|
||||||
|
|
||||||
# note the option ALL which allows to build the docs together with the application
|
# note the option ALL which allows to build the docs together with the application
|
||||||
add_custom_target( docs
|
add_custom_target( docs
|
||||||
|
58
configure
vendored
58
configure
vendored
@ -1,58 +0,0 @@
|
|||||||
##!/bin/bash
|
|
||||||
|
|
||||||
: ${INSTALLROOT=$PWD}
|
|
||||||
read -p "Installation directory [default:\"$INSTALLROOT\"]:" -e t3
|
|
||||||
if [ -z "$t3" ]
|
|
||||||
then
|
|
||||||
echo
|
|
||||||
else
|
|
||||||
INSTALLROOT=$t3
|
|
||||||
fi
|
|
||||||
echo "INSTALLROOT will be \"$INSTALLROOT\""
|
|
||||||
export INSTALLROOT
|
|
||||||
|
|
||||||
: ${BINDIR="bin"}
|
|
||||||
read -p "Binaries directory [default:\"$BINDIR\"]:" -e t4
|
|
||||||
if [ -z "$t4" ]
|
|
||||||
then
|
|
||||||
BINDIR=$INSTALLROOT/$BINDIR
|
|
||||||
else
|
|
||||||
BINDIR=$INSTALLROOT/$t4
|
|
||||||
fi
|
|
||||||
echo "BINDIR will be \"$BINDIR\""
|
|
||||||
export BINDIR
|
|
||||||
|
|
||||||
: ${LIBDIR="bin"}
|
|
||||||
read -p "Libraries directory [default:\"$LIBDIR\"]:" -e t5
|
|
||||||
if [ -z "$t5" ]
|
|
||||||
then
|
|
||||||
LIBDIR=$INSTALLROOT/$LIBDIR
|
|
||||||
else
|
|
||||||
LIBDIR=$INSTALLROOT/$t5
|
|
||||||
fi
|
|
||||||
echo "LIBDIR will be \"$LIBDIR\""
|
|
||||||
export LIBDIR
|
|
||||||
|
|
||||||
: ${INCDIR="include"}
|
|
||||||
read -p "Includes directory [default:\"$INCDIR\"]:" -e t6
|
|
||||||
if [ -z "$t6" ]
|
|
||||||
then
|
|
||||||
INCDIR=$INSTALLROOT/$INCDIR
|
|
||||||
else
|
|
||||||
INCDIR=$INSTALLROOT/$t6
|
|
||||||
fi
|
|
||||||
echo "INCDIR will be \"$INCDIR\""
|
|
||||||
export INCDIR
|
|
||||||
|
|
||||||
: ${DOCDIR="doc"}
|
|
||||||
read -p "Documentation directory [default:\"$DOCDIR\"]:" -e t7
|
|
||||||
if [ -z "$t7" ]
|
|
||||||
then
|
|
||||||
DOCDIR=$INSTALLROOT/$DOCDIR
|
|
||||||
else
|
|
||||||
DOCDIR=$INSTALLROOT/$t7
|
|
||||||
fi
|
|
||||||
echo "DOCDIR will be \"$DOCDIR\""
|
|
||||||
export DOCDIR
|
|
||||||
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
|||||||
module 0 center 6.395E+02 +- 0.00E+00 conversion 6.5660E-05 +- 7.10E-09 offset 0.00000 +- 0.00015
|
|
||||||
module 1 center 6.395E+02 +- 0.00E+00 conversion 6.5650E-05 +- 7.09E-09 offset 5.00211 +- 0.00015
|
|
||||||
module 2 center 6.395E+02 +- 0.00E+00 conversion 6.5625E-05 +- 7.09E-09 offset 10.00733 +- 0.00015
|
|
||||||
module 3 center 6.395E+02 +- 0.00E+00 conversion 6.5618E-05 +- 7.09E-09 offset 15.00742 +- 0.00015
|
|
||||||
module 4 center 6.395E+02 +- 0.00E+00 conversion 6.5642E-05 +- 7.15E-09 offset 20.00620 +- 0.00015
|
|
||||||
module 5 center 6.395E+02 +- 0.00E+00 conversion 6.5612E-05 +- 7.09E-09 offset 25.00281 +- 0.00015
|
|
||||||
module 6 center 6.395E+02 +- 0.00E+00 conversion 6.5623E-05 +- 6.93E-09 offset 30.00704 +- 0.00015
|
|
||||||
module 7 center 6.395E+02 +- 0.00E+00 conversion 6.5605E-05 +- 7.10E-09 offset 34.99715 +- 0.00015
|
|
||||||
module 8 center 6.395E+02 +- 0.00E+00 conversion 6.5643E-05 +- 7.21E-09 offset 39.99533 +- 0.00015
|
|
||||||
module 9 center 6.395E+02 +- 0.00E+00 conversion 6.5638E-05 +- 7.09E-09 offset 44.99969 +- 0.00015
|
|
||||||
module 10 center 6.395E+02 +- 0.00E+00 conversion 6.5638E-05 +- 6.94E-09 offset 49.99859 +- 0.00015
|
|
||||||
module 11 center 6.395E+02 +- 0.00E+00 conversion 6.5644E-05 +- 7.10E-09 offset 54.99499 +- 0.00015
|
|
||||||
module 12 center 6.395E+02 +- 0.00E+00 conversion 6.5618E-05 +- 7.09E-09 offset 59.99120 +- 0.00015
|
|
||||||
module 13 center 6.395E+02 +- 0.00E+00 conversion 6.5607E-05 +- 7.11E-09 offset 64.98880 +- 0.00015
|
|
||||||
module 14 center 6.395E+02 +- 0.00E+00 conversion 6.5609E-05 +- 7.09E-09 offset 69.98205 +- 0.00015
|
|
||||||
module 15 center 6.395E+02 +- 0.00E+00 conversion 6.5611E-05 +- 7.09E-09 offset 74.98379 +- 0.00015
|
|
||||||
module 16 center 6.395E+02 +- 0.00E+00 conversion 6.5619E-05 +- 4.72E-09 offset 79.98559 +- 0.00015
|
|
||||||
module 17 center 6.395E+02 +- 0.00E+00 conversion 6.5604E-05 +- 7.09E-09 offset 84.98376 +- 0.00015
|
|
||||||
module 18 center 6.395E+02 +- 0.00E+00 conversion 6.5605E-05 +- 7.09E-09 offset 89.98307 +- 0.00015
|
|
||||||
module 19 center 6.395E+02 +- 0.00E+00 conversion 6.5616E-05 +- 7.09E-09 offset 94.98907 +- 0.00015
|
|
||||||
module 20 center 6.395E+02 +- 0.00E+00 conversion 6.5634E-05 +- 7.08E-09 offset 99.97965 +- 0.00015
|
|
||||||
module 21 center 6.395E+02 +- 0.00E+00 conversion 6.5608E-05 +- 4.16E-09 offset 104.99732 +- 0.00016
|
|
||||||
module 22 center 6.395E+02 +- 0.00E+00 conversion 6.5608E-05 +- 7.09E-09 offset 109.98646 +- 0.00015
|
|
||||||
module 23 center 6.395E+02 +- 0.00E+00 conversion 6.5649E-05 +- 7.09E-09 offset 114.98765 +- 0.00015
|
|
@ -1,5 +0,0 @@
|
|||||||
15
|
|
||||||
1528
|
|
||||||
5000
|
|
||||||
6513
|
|
||||||
|
|
39
examples/config_gen_script/generic_example.config
Normal file
39
examples/config_gen_script/generic_example.config
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
hostname hostname1+hostname2+hostname3+hostname55+
|
||||||
|
header_var1 wow
|
||||||
|
header_var2 great
|
||||||
|
header_var3 very nice
|
||||||
|
|
||||||
|
0:counter1 100
|
||||||
|
0:counter2 1024
|
||||||
|
0:counter3 1500
|
||||||
|
0:forallmodules val_mod1
|
||||||
|
0:constant1 const1
|
||||||
|
0:constant2 const2
|
||||||
|
0:constant3 const3 /path/to/something
|
||||||
|
|
||||||
|
1:counter1 101
|
||||||
|
1:counter2 1036
|
||||||
|
1:counter3 1503
|
||||||
|
1:forallmodules val_mod2
|
||||||
|
1:constant1 const1
|
||||||
|
1:constant2 const2
|
||||||
|
1:constant3 const3 /path/to/something
|
||||||
|
|
||||||
|
2:counter1 102
|
||||||
|
2:counter2 1048
|
||||||
|
2:counter3 1506
|
||||||
|
2:forallmodules val_mod3
|
||||||
|
2:constant1 const1
|
||||||
|
2:constant2 const2
|
||||||
|
2:constant3 const3 /path/to/something
|
||||||
|
|
||||||
|
3:counter1 103
|
||||||
|
3:counter2 1060
|
||||||
|
3:counter3 1509
|
||||||
|
3:forallmodules val_mod4
|
||||||
|
3:constant1 const1
|
||||||
|
3:constant2 const2
|
||||||
|
3:constant3 const3 /path/to/something
|
||||||
|
|
||||||
|
footer1 foot1
|
||||||
|
footer2 somethingelseathebottom
|
47
examples/config_gen_script/generic_example.config_gen
Executable file
47
examples/config_gen_script/generic_example.config_gen
Executable file
@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# local variables
|
||||||
|
a_variable=/path/to/something
|
||||||
|
|
||||||
|
# HOSTNAMES is special
|
||||||
|
# Beside of the hostname line it also defines the amount of modules
|
||||||
|
# for the body part
|
||||||
|
# take care for the last space
|
||||||
|
HOSTNAMES="hostname1 hostname2 hostname3 hostname55 "
|
||||||
|
|
||||||
|
## header contains constant values at the beginning of the file
|
||||||
|
header=(
|
||||||
|
header_var1="wow"
|
||||||
|
header_var2="great"
|
||||||
|
header_var3="very nice"
|
||||||
|
)
|
||||||
|
|
||||||
|
## the body part is for each half module
|
||||||
|
# counters will count automatically
|
||||||
|
# the number behind ':' indicates the incrementation value
|
||||||
|
|
||||||
|
counters=(
|
||||||
|
counter1="100:1"
|
||||||
|
counter2="1024:12"
|
||||||
|
counter3="1500:3"
|
||||||
|
)
|
||||||
|
|
||||||
|
# constant values
|
||||||
|
constants=(
|
||||||
|
constant1="const1"
|
||||||
|
constant2="const2"
|
||||||
|
constant3="const3 ${a_variable}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# lists contains space separated lists each value for each half module
|
||||||
|
lists=(
|
||||||
|
forallmodules="val_mod1 val_mod2 val_mod3 val_mod4"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
## footer contains constant values for the end of the file
|
||||||
|
footer=(
|
||||||
|
footer1=foot1
|
||||||
|
footer2=somethingelseathebottom
|
||||||
|
)
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
type Mythen+
|
|
||||||
0:hostname mcs1x21
|
|
||||||
0:port 1952
|
|
||||||
0:stopport 1953
|
|
||||||
0:settingsdir /afs/psi.ch/user/b/bergamaschi
|
|
||||||
0:outdir /afs/psi.ch/user/b/bergamaschi
|
|
||||||
0:angdir 1.000000
|
|
||||||
0:moveflag 1.000000
|
|
||||||
0:lock 0
|
|
||||||
0:caldir /afs/psi.ch/user/b/bergamaschi
|
|
||||||
0:ffdir /afs/psi.ch/user/b/bergamaschi
|
|
||||||
0:nmod 1
|
|
||||||
0:waitstates 13
|
|
||||||
0:setlength 3
|
|
||||||
0:clkdivider 6
|
|
||||||
0:extsig:0 gate_in_active_high
|
|
||||||
0:extsig:1 trigger_in_rising_edge
|
|
||||||
0:extsig:2 off
|
|
||||||
0:extsig:3 off
|
|
||||||
master -1
|
|
||||||
sync none
|
|
||||||
outdir /afs/psi.ch/user/b/bergamaschi
|
|
||||||
ffdir /afs/psi.ch/user/b/bergamaschi
|
|
||||||
headerbefore none
|
|
||||||
headerafter none
|
|
||||||
headerbeforepar none
|
|
||||||
headerafterpar none
|
|
||||||
badchannels none
|
|
||||||
angconv none
|
|
||||||
globaloff 0.000000
|
|
||||||
binsize 0.001000
|
|
||||||
threaded 1
|
|
@ -1 +0,0 @@
|
|||||||
dataport 1955
|
|
@ -1,10 +0,0 @@
|
|||||||
#!/bin/csh -f
|
|
||||||
#set l = `ipcs -m | grep "$USER"| cut -c12-19`
|
|
||||||
set l = `ipcs -m | cut -c0-10`
|
|
||||||
foreach s ( $l )
|
|
||||||
echo $s
|
|
||||||
ipcrm -M $s
|
|
||||||
end
|
|
||||||
#if ($#l != 0 )
|
|
||||||
echo $#l shared memory\(s\) for $user removed
|
|
||||||
|
|
@ -1,142 +0,0 @@
|
|||||||
#! /bin/awk -f
|
|
||||||
|
|
||||||
# this is an awk script to start a run
|
|
||||||
# you first need to run inimodule.awk to initialize
|
|
||||||
# the pattern, set Vc and set the trimbits
|
|
||||||
#
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
# revision history #
|
|
||||||
#####################################################################
|
|
||||||
# 31.10.2001 first version #
|
|
||||||
#####################################################################
|
|
||||||
# #
|
|
||||||
# Bernd Schmitt #
|
|
||||||
# #
|
|
||||||
# bernd.schmitt@psi.ch #
|
|
||||||
# #
|
|
||||||
#####################################################################
|
|
||||||
# #
|
|
||||||
# modifications: #
|
|
||||||
# #
|
|
||||||
# 1.3.2002 BS adapted for use with DCB #
|
|
||||||
# #
|
|
||||||
# 25.5.2002 BS adapted to new convert program #
|
|
||||||
# #
|
|
||||||
# 29.5.2002 sleep -> usleep for meas. time , TS #
|
|
||||||
# #
|
|
||||||
#####################################################################
|
|
||||||
|
|
||||||
BEGIN {
|
|
||||||
|
|
||||||
# initialize variables
|
|
||||||
NPAR=3
|
|
||||||
|
|
||||||
PAR[1]="nrun"
|
|
||||||
PAR[2]="fn"
|
|
||||||
PAR[3]="par"
|
|
||||||
|
|
||||||
# initialize default values
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PARVAL[1] = 100
|
|
||||||
PARVAL[2] = "microstrip_july2007"
|
|
||||||
PARVAL[3]=0
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
printf("\n\nnumber of command line arguments: %i (incl. command)\n\n", ARGC);
|
|
||||||
|
|
||||||
# read command line defined variables
|
|
||||||
if (ARGC>1) {
|
|
||||||
printf("\n\nnumber of command line arguments: %i (incl. command)\n\n", ARGC);
|
|
||||||
for (i=1; i<=ARGC; i++) {
|
|
||||||
printf("%s \n", ARGV[i]);
|
|
||||||
nsplit=split(ARGV[i],array,"=")
|
|
||||||
VAR = array[1];
|
|
||||||
VAL = array[2];
|
|
||||||
|
|
||||||
for (j=1; j<=NPAR; j++) {
|
|
||||||
if ( VAR==PAR[j] ) {
|
|
||||||
PARVAL[j] = VAL
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
run=PARVAL[1]
|
|
||||||
fn=PARVAL[2]
|
|
||||||
par=PARVAL[3]
|
|
||||||
|
|
||||||
|
|
||||||
# print command line arguments
|
|
||||||
for (i=1; i<=NPAR; i++){
|
|
||||||
printf("\t... %2i.\t%7s = %s\n", i, PAR[i], PARVAL[i] );
|
|
||||||
}
|
|
||||||
printf("\n\n");
|
|
||||||
|
|
||||||
# generate parameter file
|
|
||||||
|
|
||||||
fnamep=fn".parab"
|
|
||||||
printf("header before\n")>> fnamep
|
|
||||||
system("date >>"fnamep)
|
|
||||||
printf("run=%i \n", run ) >> fnamep
|
|
||||||
|
|
||||||
#print detector parameters to file
|
|
||||||
if (par==1) {
|
|
||||||
|
|
||||||
command="sls_detector_get exptime| awk -F \" \" '{print $2}'"
|
|
||||||
command | getline var
|
|
||||||
printf("acquisition time = %11.6f second(s)\n", var) >> fnamep
|
|
||||||
|
|
||||||
command="sls_detector_get settings| awk -F \" \" '{print $2}'"
|
|
||||||
command | getline var
|
|
||||||
printf("settings = %s\n", var) >> fnamep;
|
|
||||||
|
|
||||||
command="sls_detector_get threshold| awk -F \" \" '{print $2}'"
|
|
||||||
command | getline var
|
|
||||||
printf("threshold energy = %d eV\n", var) >> fnamep;
|
|
||||||
|
|
||||||
command="sls_detector_get badchannels| awk -F \" \" '{print $2}'"
|
|
||||||
command | getline var
|
|
||||||
printf("bad channel list = %s\n",var) >> fnamep;
|
|
||||||
|
|
||||||
|
|
||||||
command="sls_detector_get angconv| awk -F \" \" '{print $2}'"
|
|
||||||
command | getline var
|
|
||||||
printf("angle calibration conversion = %s\n",var) >> fnamep;
|
|
||||||
|
|
||||||
|
|
||||||
command="sls_detector_get globaloff| awk -F \" \" '{print $2}'"
|
|
||||||
command | getline var
|
|
||||||
printf("beamline offset = %f deg\n", var) >> fnamep;
|
|
||||||
|
|
||||||
command="sls_detector_get fineoff| awk -F \" \" '{print $2}'"
|
|
||||||
command | getline var
|
|
||||||
printf("fine offset = %f deg\n", var) >> fnamep;
|
|
||||||
|
|
||||||
command="sls_detector_get flatfield| awk -F \" \" '{print $2}'"
|
|
||||||
command | getline var
|
|
||||||
printf("Flat field corrections = %s\n",var) >> fnamep;
|
|
||||||
|
|
||||||
command="sls_detector_get ratecorr| awk -F \" \" '{print $2}'"
|
|
||||||
command | getline var
|
|
||||||
printf("Dead time corrections tau = %d ns\n",var) >> fnamep;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#print beamline parameters to file
|
|
||||||
|
|
||||||
#read detector position
|
|
||||||
system("caget X04SA-ES2-TH2:RO.RBV >>"fnamep)
|
|
||||||
#read I0
|
|
||||||
system("caget X04SA-ES2-SC:CH6>>"fnamep)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
|||||||
#! /bin/awk -f
|
|
||||||
|
|
||||||
# this is an awk script to start a run
|
|
||||||
# you first need to run inimodule.awk to initialize
|
|
||||||
# the pattern, set Vc and set the trimbits
|
|
||||||
#
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
# revision history #
|
|
||||||
#####################################################################
|
|
||||||
# 31.10.2001 first version #
|
|
||||||
#####################################################################
|
|
||||||
# #
|
|
||||||
# Bernd Schmitt #
|
|
||||||
# #
|
|
||||||
# bernd.schmitt@psi.ch #
|
|
||||||
# #
|
|
||||||
#####################################################################
|
|
||||||
# #
|
|
||||||
# modifications: #
|
|
||||||
# #
|
|
||||||
# 1.3.2002 BS adapted for use with DCB #
|
|
||||||
# #
|
|
||||||
# 25.5.2002 BS adapted to new convert program #
|
|
||||||
# #
|
|
||||||
# 29.5.2002 sleep -> usleep for meas. time , TS #
|
|
||||||
# #
|
|
||||||
#####################################################################
|
|
||||||
|
|
||||||
BEGIN {
|
|
||||||
|
|
||||||
# initialize variables
|
|
||||||
NPAR=4
|
|
||||||
|
|
||||||
PAR[1]="nrun"
|
|
||||||
PAR[2]="fn"
|
|
||||||
PAR[3]="var"
|
|
||||||
PAR[4]="par"
|
|
||||||
|
|
||||||
|
|
||||||
# initialize default values
|
|
||||||
PARVAL[1] = 100
|
|
||||||
PARVAL[2] = "myfname"
|
|
||||||
PARVAL[3] = 0
|
|
||||||
PARVAL[2] = "none"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# read command line defined variables
|
|
||||||
if (ARGC>1) {
|
|
||||||
printf("\n\nnumber of command line arguments: %i (incl. command)\n\n", ARGC);
|
|
||||||
for (i=1; i<=ARGC; i++) {
|
|
||||||
|
|
||||||
nsplit=split(ARGV[i],array,"=")
|
|
||||||
VAR = array[1];
|
|
||||||
VAL = array[2];
|
|
||||||
|
|
||||||
for (j=1; j<=NPAR; j++) {
|
|
||||||
if ( VAR==PAR[j] ) {
|
|
||||||
PARVAL[j] = VAL
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
run=PARVAL[1]
|
|
||||||
fn=PARVAL[2]
|
|
||||||
var=PARVAL[3]
|
|
||||||
par=PARVAL[4]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# print command line arguments
|
|
||||||
for (i=1; i<=NPAR; i++){
|
|
||||||
printf("\t... %2i.\t%7s = %s\n", i, PAR[i], PARVAL[i] );
|
|
||||||
}
|
|
||||||
|
|
||||||
#execute you command hereafter e.g. change temperature etc.
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,100 +0,0 @@
|
|||||||
#! /bin/awk -f
|
|
||||||
|
|
||||||
# this is an awk script to start a run
|
|
||||||
# you first need to run inimodule.awk to initialize
|
|
||||||
# the pattern, set Vc and set the trimbits
|
|
||||||
#
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
# revision history #
|
|
||||||
#####################################################################
|
|
||||||
# 31.10.2001 first version #
|
|
||||||
#####################################################################
|
|
||||||
# #
|
|
||||||
# Bernd Schmitt #
|
|
||||||
# #
|
|
||||||
# bernd.schmitt@psi.ch #
|
|
||||||
# #
|
|
||||||
#####################################################################
|
|
||||||
# #
|
|
||||||
# modifications: #
|
|
||||||
# #
|
|
||||||
# 1.3.2002 BS adapted for use with DCB #
|
|
||||||
# #
|
|
||||||
# 25.5.2002 BS adapted to new convert program #
|
|
||||||
# #
|
|
||||||
# 29.5.2002 sleep -> usleep for meas. time , TS #
|
|
||||||
# #
|
|
||||||
#####################################################################
|
|
||||||
|
|
||||||
BEGIN {
|
|
||||||
|
|
||||||
# initialize variables
|
|
||||||
NPAR=7
|
|
||||||
|
|
||||||
PAR[1]="nrun"
|
|
||||||
PAR[2]="fn"
|
|
||||||
PAR[3]="par"
|
|
||||||
PAR[4]="sv0"
|
|
||||||
PAR[5]="sv1"
|
|
||||||
PAR[6]="p0"
|
|
||||||
PAR[7]="p1"
|
|
||||||
|
|
||||||
# initialize default values
|
|
||||||
PARVAL[1] = 100
|
|
||||||
PARVAL[2] = "myfname"
|
|
||||||
PARVAL[3] = 1
|
|
||||||
PARVAL[4] = 0
|
|
||||||
PARVAL[5] = 0
|
|
||||||
PARVAL[6] = "none"
|
|
||||||
PARVAL[7] = "none"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# read command line defined variables
|
|
||||||
if (ARGC>1) {
|
|
||||||
printf("\n\nnumber of command line arguments: %i (incl. command)\n\n", ARGC);
|
|
||||||
for (i=1; i<=ARGC; i++) {
|
|
||||||
|
|
||||||
nsplit=split(ARGV[i],array,"=")
|
|
||||||
VAR = array[1];
|
|
||||||
VAL = array[2];
|
|
||||||
|
|
||||||
for (j=1; j<=NPAR; j++) {
|
|
||||||
if ( VAR==PAR[j] ) {
|
|
||||||
PARVAL[j] = VAL
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
run=PARVAL[1]
|
|
||||||
fn=PARVAL[2]
|
|
||||||
"par"PAR[3]=
|
|
||||||
sv0=PAR[4]
|
|
||||||
sv1=PAR[5]
|
|
||||||
p0=PAR[6]
|
|
||||||
p1=PAR[7]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# print command line arguments
|
|
||||||
for (i=1; i<=NPAR; i++){
|
|
||||||
printf("\t... %2i.\t%7s = %s\n", i, PAR[i], PARVAL[i] );
|
|
||||||
}
|
|
||||||
# printf("\n\n");
|
|
||||||
# system("close_shutter_g95")
|
|
||||||
|
|
||||||
# execute your actions hereafter
|
|
||||||
if (par==1) {
|
|
||||||
#open shutter
|
|
||||||
} else {
|
|
||||||
#close shutter
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,79 +0,0 @@
|
|||||||
#! /bin/awk -f
|
|
||||||
|
|
||||||
# this is an awk script to start a run
|
|
||||||
# you first need to run inimodule.awk to initialize
|
|
||||||
# the pattern, set Vc and set the trimbits
|
|
||||||
#
|
|
||||||
|
|
||||||
#####################################################################
|
|
||||||
# revision history #
|
|
||||||
#####################################################################
|
|
||||||
# 31.10.2001 first version #
|
|
||||||
#####################################################################
|
|
||||||
# #
|
|
||||||
# Bernd Schmitt #
|
|
||||||
# #
|
|
||||||
# bernd.schmitt@psi.ch #
|
|
||||||
# #
|
|
||||||
#####################################################################
|
|
||||||
# #
|
|
||||||
# modifications: #
|
|
||||||
# #
|
|
||||||
# 1.3.2002 BS adapted for use with DCB #
|
|
||||||
# #
|
|
||||||
# 25.5.2002 BS adapted to new convert program #
|
|
||||||
# #
|
|
||||||
# 29.5.2002 sleep -> usleep for meas. time , TS #
|
|
||||||
# #
|
|
||||||
#####################################################################
|
|
||||||
|
|
||||||
BEGIN {
|
|
||||||
|
|
||||||
# initialize variables
|
|
||||||
NPAR=2
|
|
||||||
|
|
||||||
PAR[1]="nrun"
|
|
||||||
PAR[2]="par"
|
|
||||||
|
|
||||||
|
|
||||||
# initialize default values
|
|
||||||
PARVAL[1] = 100
|
|
||||||
PARVAL[2] = "none"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# read command line defined variables
|
|
||||||
if (ARGC>1) {
|
|
||||||
printf("\n\nnumber of command line arguments: %i (incl. command)\n\n", ARGC);
|
|
||||||
for (i=1; i<=ARGC; i++) {
|
|
||||||
|
|
||||||
nsplit=split(ARGV[i],array,"=")
|
|
||||||
VAR = array[1];
|
|
||||||
VAL = array[2];
|
|
||||||
|
|
||||||
for (j=1; j<=NPAR; j++) {
|
|
||||||
if ( VAR==PAR[j] ) {
|
|
||||||
PARVAL[j] = VAL
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
run=PARVAL[1]
|
|
||||||
par=PARVAL[2]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# print command line arguments
|
|
||||||
for (i=1; i<=NPAR; i++){
|
|
||||||
printf("\t... %2i.\t%7s = %s\n", i, PAR[i], PARVAL[i] );
|
|
||||||
}
|
|
||||||
#execute action hereafter
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
|||||||
#####Any line with a # is not read######
|
|
||||||
|
|
||||||
#type Gotthard+
|
|
||||||
hostname bchip007+bchip009+
|
|
||||||
|
|
||||||
#0:hostname bchip007
|
|
||||||
#0:port 1952
|
|
||||||
#0:stopport 1953
|
|
||||||
#0:rx_tcpport 1956
|
|
||||||
0:settingsdir /home/l_msdetect/dhanya/slsDetectorsPackage/settingsdir/gotthard
|
|
||||||
0:angdir 1.000000
|
|
||||||
0:moveflag 0.000000
|
|
||||||
0:lock 0
|
|
||||||
0:caldir /home/l_msdetect/dhanya/slsDetectorsPackage/settingsdir/gotthard
|
|
||||||
0:ffdir /home/l_msdetect
|
|
||||||
0:extsig:0 off
|
|
||||||
0:extsig:1 off
|
|
||||||
0:extsig:2 off
|
|
||||||
0:extsig:3 off
|
|
||||||
#0:detectorip 10.1.1.2
|
|
||||||
#0:detectormac 00:aa:bb:cc:dd:ee
|
|
||||||
#0:rx_udpport 50001
|
|
||||||
#0:rx_udpip 10.1.1.1
|
|
||||||
#0:rx_hostname 129.129.202.134
|
|
||||||
0:outdir /data/speedt
|
|
||||||
0:vhighvoltage 120
|
|
||||||
|
|
||||||
|
|
||||||
#1:hostname bchip009
|
|
||||||
#1:port 1952
|
|
||||||
#1:stopport 1953
|
|
||||||
1:rx_tcpport 1957
|
|
||||||
1:settingsdir /home/l_msdetect/dhanya/slsDetectorsPackage/settingsdir/gotthard
|
|
||||||
1:angdir 1.000000
|
|
||||||
1:moveflag 0.000000
|
|
||||||
1:lock 0
|
|
||||||
1:caldir /home/l_msdetect/dhanya/slsDetectorsPackage/settingsdir/gotthard
|
|
||||||
1:ffdir /home/l_msdetect
|
|
||||||
1:extsig:0 off
|
|
||||||
1:extsig:1 off
|
|
||||||
1:extsig:2 off
|
|
||||||
1:extsig:3 off
|
|
||||||
#1:detectorip 10.1.2.2
|
|
||||||
#1:detectormac 00:aa:bb:cc:dd:ee
|
|
||||||
#1:rx_udpport 50004
|
|
||||||
#1:rx_udpip 10.1.2.1
|
|
||||||
#1:rx_hostname 129.129.202.134
|
|
||||||
1:outdir /data/speedt
|
|
||||||
1:vhighvoltage 120
|
|
||||||
|
|
||||||
|
|
||||||
master -1
|
|
||||||
sync none
|
|
||||||
outdir /data/speedt
|
|
||||||
ffdir /home/l_msdetect
|
|
||||||
headerbefore none
|
|
||||||
headerafter none
|
|
||||||
headerbeforepar none
|
|
||||||
headerafterpar none
|
|
||||||
badchannels none
|
|
||||||
angconv none
|
|
||||||
globaloff 0.000000
|
|
||||||
binsize 0.001000
|
|
||||||
threaded 1
|
|
@ -197,15 +197,16 @@
|
|||||||
#define CONFIG_RDT_TMR_MSK (0x0000FFFF << CONFIG_RDT_TMR_OFST)
|
#define CONFIG_RDT_TMR_MSK (0x0000FFFF << CONFIG_RDT_TMR_OFST)
|
||||||
#define CONFIG_OPRTN_MDE_2_X_10GbE_OFST (16)
|
#define CONFIG_OPRTN_MDE_2_X_10GbE_OFST (16)
|
||||||
#define CONFIG_OPRTN_MDE_2_X_10GbE_MSK (0x00000001 << CONFIG_OPRTN_MDE_2_X_10GbE_OFST)
|
#define CONFIG_OPRTN_MDE_2_X_10GbE_MSK (0x00000001 << CONFIG_OPRTN_MDE_2_X_10GbE_OFST)
|
||||||
#define CONFIG_OPRTN_MDE_1_X_10GBE_VAL ((0x0 << CONFIG_OPRTN_MDE_2_X_10GbE_OFST) & CONFIG_OPRTN_MDE_2_X_10GbE_MSK)
|
// if 0, outer is the primary interface
|
||||||
|
#define CONFIG_INNR_PRIMRY_INTRFCE_OFST (17)
|
||||||
|
#define CONFIG_INNR_PRIMRY_INTRFCE_MSK (0x00000001 << CONFIG_INNR_PRIMRY_INTRFCE_OFST)
|
||||||
#define CONFIG_READOUT_SPEED_OFST (20)
|
#define CONFIG_READOUT_SPEED_OFST (20)
|
||||||
#define CONFIG_READOUT_SPEED_MSK (0x00000003 << CONFIG_READOUT_SPEED_OFST)
|
#define CONFIG_READOUT_SPEED_MSK (0x00000003 << CONFIG_READOUT_SPEED_OFST)
|
||||||
#define CONFIG_QUARTER_SPEED_10MHZ_VAL ((0x0 << CONFIG_READOUT_SPEED_OFST) & CONFIG_READOUT_SPEED_MSK)
|
#define CONFIG_QUARTER_SPEED_10MHZ_VAL ((0x0 << CONFIG_READOUT_SPEED_OFST) & CONFIG_READOUT_SPEED_MSK)
|
||||||
#define CONFIG_HALF_SPEED_20MHZ_VAL ((0x1 << CONFIG_READOUT_SPEED_OFST) & CONFIG_READOUT_SPEED_MSK)
|
#define CONFIG_HALF_SPEED_20MHZ_VAL ((0x1 << CONFIG_READOUT_SPEED_OFST) & CONFIG_READOUT_SPEED_MSK)
|
||||||
#define CONFIG_FULL_SPEED_40MHZ_VAL ((0x2 << CONFIG_READOUT_SPEED_OFST) & CONFIG_READOUT_SPEED_MSK)
|
#define CONFIG_FULL_SPEED_40MHZ_VAL ((0x2 << CONFIG_READOUT_SPEED_OFST) & CONFIG_READOUT_SPEED_MSK)
|
||||||
#define CONFIG_TDMA_OFST (24)
|
#define CONFIG_TDMA_ENABLE_OFST (24)
|
||||||
#define CONFIG_TDMA_MSK (0x00000001 << CONFIG_TDMA_OFST)
|
#define CONFIG_TDMA_ENABLE_MSK (0x00000001 << CONFIG_TDMA_ENABLE_OFST)
|
||||||
#define CONFIG_TDMA_DISABLE_VAL ((0x0 << CONFIG_TDMA_OFST) & CONFIG_TDMA_MSK)
|
|
||||||
#define CONFIG_TDMA_TIMESLOT_OFST (25) // 1ms
|
#define CONFIG_TDMA_TIMESLOT_OFST (25) // 1ms
|
||||||
#define CONFIG_TDMA_TIMESLOT_MSK (0x0000001F << CONFIG_TDMA_TIMESLOT_OFST)
|
#define CONFIG_TDMA_TIMESLOT_MSK (0x0000001F << CONFIG_TDMA_TIMESLOT_OFST)
|
||||||
#define CONFIG_ETHRNT_FLW_CNTRL_OFST (31)
|
#define CONFIG_ETHRNT_FLW_CNTRL_OFST (31)
|
||||||
@ -234,6 +235,12 @@
|
|||||||
#define CONTROL_ACQ_FIFO_CLR_MSK (0x00000001 << CONTROL_ACQ_FIFO_CLR_OFST)
|
#define CONTROL_ACQ_FIFO_CLR_MSK (0x00000001 << CONTROL_ACQ_FIFO_CLR_OFST)
|
||||||
#define CONTROL_STORAGE_CELL_NUM_OFST (16)
|
#define CONTROL_STORAGE_CELL_NUM_OFST (16)
|
||||||
#define CONTROL_STORAGE_CELL_NUM_MSK (0x0000000F << CONTROL_STORAGE_CELL_NUM_OFST)
|
#define CONTROL_STORAGE_CELL_NUM_MSK (0x0000000F << CONTROL_STORAGE_CELL_NUM_OFST)
|
||||||
|
#define CONTROL_RX_ADDTNL_ENDPTS_NUM_OFST (20)
|
||||||
|
#define CONTROL_RX_ADDTNL_ENDPTS_NUM_MSK (0x0000003F << CONTROL_RX_ADDTNL_ENDPTS_NUM_OFST)
|
||||||
|
#define CONTROL_RX_ENDPTS_START_OFST (26)
|
||||||
|
#define CONTROL_RX_ENDPTS_START_MSK (0x0000003F << CONTROL_RX_ENDPTS_START_OFST)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Reconfiguratble PLL Paramater Register */
|
/* Reconfiguratble PLL Paramater Register */
|
||||||
#define PLL_PARAM_REG (0x50 << MEM_MAP_SHIFT)
|
#define PLL_PARAM_REG (0x50 << MEM_MAP_SHIFT)
|
||||||
@ -400,6 +407,32 @@
|
|||||||
#define COORD_0_Z_OFST (0)
|
#define COORD_0_Z_OFST (0)
|
||||||
#define COORD_0_Z_MSK (0x0000FFFF << COORD_0_Z_OFST)
|
#define COORD_0_Z_MSK (0x0000FFFF << COORD_0_Z_OFST)
|
||||||
|
|
||||||
|
/** Module row coordinates */
|
||||||
|
/*#define COORD_ROW_REG (0x7C << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
|
#define COORD_ROW_OUTER_OFST (0)
|
||||||
|
#define COORD_ROW_OUTER_MSK (0x0000FFFF << COORD_ROW_OUTER_OFST)
|
||||||
|
#define COORD_ROW_INNER_OFST (16)
|
||||||
|
#define COORD_ROW_INNER_MSK (0x0000FFFF << COORD_ROW_INNER_OFST)
|
||||||
|
*/
|
||||||
|
/** Module column coordinates */
|
||||||
|
/*#define COORD_COL_REG (0x7D << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
|
#define COORD_COL_OUTER_OFST (0)
|
||||||
|
#define COORD_COL_OUTER_MSK (0x0000FFFF << COORD_COL_OUTER_OFST)
|
||||||
|
#define COORD_COL_INNER_OFST (16)
|
||||||
|
#define COORD_COL_INNER_MSK (0x0000FFFF << COORD_COL_INNER_OFST)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Module column coordinates */
|
||||||
|
/*#define COORD_RESERVED_REG (0x7E << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
|
#define COORD_RESERVED_OUTER_OFST (0)
|
||||||
|
#define COORD_RESERVED_OUTER_MSK (0x0000FFFF << COORD_RESERVED_OUTER_OFST)
|
||||||
|
#define COORD_RESERVED_INNER_OFST (16)
|
||||||
|
#define COORD_RESERVED_INNER_MSK (0x0000FFFF << COORD_RESERVED_INNER_OFST)
|
||||||
|
*/
|
||||||
|
|
||||||
/* ASIC Control Register */
|
/* ASIC Control Register */
|
||||||
#define ASIC_CTRL_REG (0x7F << MEM_MAP_SHIFT)
|
#define ASIC_CTRL_REG (0x7F << MEM_MAP_SHIFT)
|
||||||
// tPC = (PCT + 1) * 25ns
|
// tPC = (PCT + 1) * 25ns
|
||||||
@ -440,6 +473,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Round Robin */
|
||||||
|
#define RXR_ENDPOINTS_MAX (64)
|
||||||
|
#define RXR_ENDPOINT_OUTER_START_REG (0x1000 << MEM_MAP_SHIFT)
|
||||||
|
#define RXR_ENDPOINT_INNER_START_REG (0x2000 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
|
#define RXR_ENDPOINT_OFST (0x10 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BIN
slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer
Executable file
BIN
slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer
Executable file
Binary file not shown.
Binary file not shown.
@ -34,7 +34,6 @@ int highvoltage = 0;
|
|||||||
int dacValues[NDAC] = {0};
|
int dacValues[NDAC] = {0};
|
||||||
int adcPhase = 0;
|
int adcPhase = 0;
|
||||||
|
|
||||||
|
|
||||||
int isFirmwareCheckDone() {
|
int isFirmwareCheckDone() {
|
||||||
return firmware_check_done;
|
return firmware_check_done;
|
||||||
}
|
}
|
||||||
@ -172,8 +171,8 @@ int checkType() {
|
|||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
volatile u_int32_t type = ((bus_r(FPGA_VERSION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST);
|
volatile u_int32_t type = ((bus_r(FPGA_VERSION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST);
|
||||||
if (type != BOARD_JUNGFRAU_TYPE){
|
if (type != JUNGFRAU){
|
||||||
FILE_LOG(logERROR, ("This is not a Jungfrau Server (read %d, expected %d)\n", type, BOARD_JUNGFRAU_TYPE));
|
FILE_LOG(logERROR, ("This is not a Jungfrau Server (read %d, expected %d)\n", type, JUNGFRAU));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,11 +422,11 @@ void setupDetector() {
|
|||||||
resetCore();
|
resetCore();
|
||||||
|
|
||||||
alignDeserializer();
|
alignDeserializer();
|
||||||
|
|
||||||
|
|
||||||
configureASICTimer();
|
configureASICTimer();
|
||||||
bus_w(ADC_PORT_INVERT_REG, ADC_PORT_INVERT_VAL);
|
bus_w(ADC_PORT_INVERT_REG, ADC_PORT_INVERT_VAL);
|
||||||
|
|
||||||
|
initReadoutConfiguration();
|
||||||
|
|
||||||
//Initialization of acquistion parameters
|
//Initialization of acquistion parameters
|
||||||
setSettings(DEFAULT_SETTINGS);
|
setSettings(DEFAULT_SETTINGS);
|
||||||
|
|
||||||
@ -654,12 +653,12 @@ int64_t getTimeLeft(enum timerIndex ind){
|
|||||||
retval = get64BitReg(GET_PERIOD_LSB_REG, GET_PERIOD_MSB_REG) / (1E-3 * CLK_SYNC);
|
retval = get64BitReg(GET_PERIOD_LSB_REG, GET_PERIOD_MSB_REG) / (1E-3 * CLK_SYNC);
|
||||||
FILE_LOG(logINFO, ("Getting period left: %lldns\n", (long long int)retval));
|
FILE_LOG(logINFO, ("Getting period left: %lldns\n", (long long int)retval));
|
||||||
break;
|
break;
|
||||||
/*
|
|
||||||
case DELAY_AFTER_TRIGGER:
|
case DELAY_AFTER_TRIGGER:
|
||||||
retval = get64BitReg(xxx) / (1E-3 * CLK_SYNC);
|
retval = get64BitReg(GET_DELAY_LSB_REG, GET_DELAY_MSB_REG) / (1E-3 * CLK_SYNC);
|
||||||
FILE_LOG(logINFO, ("Getting delay left: %lldns\n", (long long int)retval));
|
FILE_LOG(logINFO, ("Getting delay left: %lldns\n", (long long int)retval));
|
||||||
break;
|
break;
|
||||||
*/
|
|
||||||
case CYCLES_NUMBER:
|
case CYCLES_NUMBER:
|
||||||
retval = get64BitReg(GET_CYCLES_LSB_REG, GET_CYCLES_MSB_REG);
|
retval = get64BitReg(GET_CYCLES_LSB_REG, GET_CYCLES_MSB_REG);
|
||||||
FILE_LOG(logINFO, ("Getting number of cycles left: %lld\n", (long long int)retval));
|
FILE_LOG(logINFO, ("Getting number of cycles left: %lld\n", (long long int)retval));
|
||||||
@ -983,40 +982,106 @@ enum externalCommunicationMode getTiming() {
|
|||||||
|
|
||||||
|
|
||||||
/* configure mac */
|
/* configure mac */
|
||||||
|
void setNumberofUDPInterfaces(int val) {
|
||||||
|
uint32_t addr = CONFIG_REG;
|
||||||
|
|
||||||
|
// enable 2 interfaces
|
||||||
|
if (val > 1) {
|
||||||
|
FILE_LOG(logINFOBLUE, ("Setting #Interfaces: 2\n"));
|
||||||
|
bus_w(addr, bus_r(addr) | CONFIG_OPRTN_MDE_2_X_10GbE_MSK);
|
||||||
|
}
|
||||||
|
// enable only 1 interface
|
||||||
|
else {
|
||||||
|
FILE_LOG(logINFOBLUE, ("Setting #Interfaces: 1\n"));
|
||||||
|
bus_w(addr, bus_r(addr) &~ CONFIG_OPRTN_MDE_2_X_10GbE_MSK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
long int calcChecksum(int sourceip, int destip) {
|
void selectPrimaryInterface(int val) {
|
||||||
ip_header ip;
|
uint32_t addr = CONFIG_REG;
|
||||||
ip.ip_ver = 0x4;
|
|
||||||
ip.ip_ihl = 0x5;
|
|
||||||
ip.ip_tos = 0x0;
|
|
||||||
ip.ip_len = IP_PACKETSIZE;
|
|
||||||
ip.ip_ident = 0x0000;
|
|
||||||
ip.ip_flag = 0x2; //not nibble aligned (flag& offset
|
|
||||||
ip.ip_offset = 0x000;
|
|
||||||
ip.ip_ttl = 0x40;
|
|
||||||
ip.ip_protocol = 0x11;
|
|
||||||
ip.ip_chksum = 0x0000 ; // pseudo
|
|
||||||
ip.ip_sourceip = sourceip;
|
|
||||||
ip.ip_destip = destip;
|
|
||||||
|
|
||||||
int count = sizeof(ip);
|
// inner (user input: 1)
|
||||||
|
if (val == 1) {
|
||||||
|
FILE_LOG(logINFOBLUE, ("Setting Primary Interface: 1 (Inner)\n"));
|
||||||
|
bus_w(addr, bus_r(addr) | CONFIG_INNR_PRIMRY_INTRFCE_MSK);
|
||||||
|
}
|
||||||
|
// outer (user input: 2)
|
||||||
|
else {
|
||||||
|
FILE_LOG(logINFOBLUE, ("Setting Primary Interface: 2 (Outer)\n"));
|
||||||
|
bus_w(addr, bus_r(addr) &~ CONFIG_INNR_PRIMRY_INTRFCE_MSK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unsigned short *addr;
|
void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip, uint64_t destmac, uint32_t destport, uint64_t sourcemac, uint32_t sourceip, uint32_t sourceport) {
|
||||||
addr = (unsigned short*) &(ip); /* warning: assignment from incompatible pointer type */
|
|
||||||
|
// start addr
|
||||||
|
uint32_t addr = (type == INNER ? RXR_ENDPOINT_INNER_START_REG : RXR_ENDPOINT_OUTER_START_REG);
|
||||||
|
// calculate rxr endpoint offset
|
||||||
|
addr += (iRxEntry * RXR_ENDPOINT_OFST);
|
||||||
|
// get struct memory
|
||||||
|
udp_header *udp = (udp_header*) (CSP0BASE + addr * 2);
|
||||||
|
memset(udp, 0, sizeof(udp_header));
|
||||||
|
|
||||||
|
// mac addresses
|
||||||
|
// msb (32) + lsb (16)
|
||||||
|
udp->udp_destmac_msb = ((destmac >> 16) & BIT32_MASK);
|
||||||
|
udp->udp_destmac_lsb = ((destmac >> 0) & BIT16_MASK);
|
||||||
|
// msb (16) + lsb (32)
|
||||||
|
udp->udp_srcmac_msb = ((sourcemac >> 32) & BIT16_MASK);
|
||||||
|
udp->udp_srcmac_lsb = ((sourcemac >> 0) & BIT32_MASK);
|
||||||
|
|
||||||
|
// ip addresses
|
||||||
|
udp->ip_srcip_msb = ((sourceip >> 16) & BIT16_MASK);
|
||||||
|
udp->ip_srcip_lsb = ((sourceip >> 0) & BIT16_MASK);
|
||||||
|
udp->ip_destip_msb = ((destip >> 16) & BIT16_MASK);
|
||||||
|
udp->ip_destip_lsb = ((destip >> 0) & BIT16_MASK);
|
||||||
|
|
||||||
|
// source port
|
||||||
|
udp->udp_srcport = sourceport;
|
||||||
|
udp->udp_destport = destport;
|
||||||
|
|
||||||
|
// other defines
|
||||||
|
udp->udp_ethertype = 0x800;
|
||||||
|
udp->ip_ver = 0x4;
|
||||||
|
udp->ip_ihl = 0x5;
|
||||||
|
udp->ip_flags = 0x2; //FIXME
|
||||||
|
udp->ip_ttl = 0x40;
|
||||||
|
udp->ip_protocol = 0x11;
|
||||||
|
// total length is redefined in firmware
|
||||||
|
|
||||||
|
calcChecksum(udp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void calcChecksum(udp_header* udp) {
|
||||||
|
int count = IP_HEADER_SIZE;
|
||||||
long int sum = 0;
|
long int sum = 0;
|
||||||
while( count > 1 ) {
|
|
||||||
|
// start at ip_tos as the memory is not continous for ip header
|
||||||
|
uint16_t *addr = (uint16_t*) (&(udp->ip_tos));
|
||||||
|
|
||||||
|
sum += *addr++;
|
||||||
|
count -= 2;
|
||||||
|
|
||||||
|
// ignore ethertype (from udp header)
|
||||||
|
addr++;
|
||||||
|
|
||||||
|
// from identification to srcip_lsb
|
||||||
|
while( count > 2 ) {
|
||||||
sum += *addr++;
|
sum += *addr++;
|
||||||
count -= 2;
|
count -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ignore src udp port (from udp header)
|
||||||
|
addr++;
|
||||||
|
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
sum += *addr; // Add left-over byte, if any
|
sum += *addr; // Add left-over byte, if any
|
||||||
while (sum>>16)
|
while (sum >> 16)
|
||||||
sum = (sum & 0xffff) + (sum >> 16);// Fold 32-bit sum to 16 bits
|
sum = (sum & 0xffff) + (sum >> 16);// Fold 32-bit sum to 16 bits
|
||||||
long int checksum = (~sum) & 0xffff;
|
long int checksum = sum & 0xffff;
|
||||||
FILE_LOG(logINFO, ("IP checksum is 0x%lx\n",checksum));
|
checksum += UDP_IP_HEADER_LENGTH_BYTES;
|
||||||
return checksum;
|
FILE_LOG(logINFO, ("\tIP checksum is 0x%lx\n",checksum));
|
||||||
|
udp->ip_checksum = checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1034,6 +1099,7 @@ int configureMAC(int numInterfaces, int selInterface,
|
|||||||
FILE_LOG(logINFO, ("\t#Interfaces : %d\n", numInterfaces));
|
FILE_LOG(logINFO, ("\t#Interfaces : %d\n", numInterfaces));
|
||||||
FILE_LOG(logINFO, ("\tInterface : %d\n\n", selInterface));
|
FILE_LOG(logINFO, ("\tInterface : %d\n\n", selInterface));
|
||||||
|
|
||||||
|
FILE_LOG(logINFO, ("\tInner\n"));
|
||||||
FILE_LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n",
|
FILE_LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n",
|
||||||
(sourceip>>24)&0xff,(sourceip>>16)&0xff,(sourceip>>8)&0xff,(sourceip)&0xff, sourceip));
|
(sourceip>>24)&0xff,(sourceip>>16)&0xff,(sourceip>>8)&0xff,(sourceip)&0xff, sourceip));
|
||||||
FILE_LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n",
|
FILE_LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n",
|
||||||
@ -1059,6 +1125,7 @@ int configureMAC(int numInterfaces, int selInterface,
|
|||||||
FILE_LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n\n",udpport, udpport));
|
FILE_LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n\n",udpport, udpport));
|
||||||
|
|
||||||
uint32_t sourceport2 = DEFAULT_TX_UDP_PORT + 1;
|
uint32_t sourceport2 = DEFAULT_TX_UDP_PORT + 1;
|
||||||
|
FILE_LOG(logINFO, ("\tOuter\n"));
|
||||||
FILE_LOG(logINFO, ("\tSource IP2 : %d.%d.%d.%d \t\t(0x%08x)\n",
|
FILE_LOG(logINFO, ("\tSource IP2 : %d.%d.%d.%d \t\t(0x%08x)\n",
|
||||||
(sourceip2>>24)&0xff,(sourceip2>>16)&0xff,(sourceip2>>8)&0xff,(sourceip2)&0xff, sourceip2));
|
(sourceip2>>24)&0xff,(sourceip2>>16)&0xff,(sourceip2>>8)&0xff,(sourceip2)&0xff, sourceip2));
|
||||||
FILE_LOG(logINFO, ("\tSource MAC2 : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n",
|
FILE_LOG(logINFO, ("\tSource MAC2 : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n",
|
||||||
@ -1083,35 +1150,16 @@ int configureMAC(int numInterfaces, int selInterface,
|
|||||||
(long long unsigned int)destmac2));
|
(long long unsigned int)destmac2));
|
||||||
FILE_LOG(logINFO, ("\tDest. Port2 : %d \t\t\t(0x%08x)\n",udpport2, udpport2));
|
FILE_LOG(logINFO, ("\tDest. Port2 : %d \t\t\t(0x%08x)\n",udpport2, udpport2));
|
||||||
|
|
||||||
long int checksum=calcChecksum(sourceip, destip);
|
// default one rxr entry (others not yet implemented in client yet)
|
||||||
bus_w(TX_IP_REG, sourceip);
|
int iRxEntry = 0;
|
||||||
bus_w(RX_IP_REG, destip);
|
// top
|
||||||
|
setupHeader(iRxEntry, INNER, destip, destmac, udpport, sourcemac, sourceip, sourceport);
|
||||||
|
// bottom
|
||||||
|
setupHeader(iRxEntry, OUTER, destip2, destmac2, udpport2, sourcemac2, sourceip2, sourceport2);
|
||||||
|
|
||||||
uint32_t val = 0;
|
setNumberofUDPInterfaces(numInterfaces);
|
||||||
|
selectPrimaryInterface(selInterface);
|
||||||
|
|
||||||
val = ((sourcemac >> LSB_OF_64_BIT_REG_OFST) & BIT_32_MSK);
|
|
||||||
bus_w(TX_MAC_LSB_REG, val);
|
|
||||||
FILE_LOG(logDEBUG1, ("Read from TX_MAC_LSB_REG: 0x%08x\n", bus_r(TX_MAC_LSB_REG)));
|
|
||||||
|
|
||||||
val = ((sourcemac >> MSB_OF_64_BIT_REG_OFST) & BIT_32_MSK);
|
|
||||||
bus_w(TX_MAC_MSB_REG,val);
|
|
||||||
FILE_LOG(logDEBUG1, ("Read from TX_MAC_MSB_REG: 0x%08x\n", bus_r(TX_MAC_MSB_REG)));
|
|
||||||
|
|
||||||
val = ((destmac >> LSB_OF_64_BIT_REG_OFST) & BIT_32_MSK);
|
|
||||||
bus_w(RX_MAC_LSB_REG, val);
|
|
||||||
FILE_LOG(logDEBUG1, ("Read from RX_MAC_LSB_REG: 0x%08x\n", bus_r(RX_MAC_LSB_REG)));
|
|
||||||
|
|
||||||
val = ((destmac >> MSB_OF_64_BIT_REG_OFST) & BIT_32_MSK);
|
|
||||||
bus_w(RX_MAC_MSB_REG, val);
|
|
||||||
FILE_LOG(logDEBUG1, ("Read from RX_MAC_MSB_REG: 0x%08x\n", bus_r(RX_MAC_MSB_REG)));
|
|
||||||
|
|
||||||
val = (((sourceport << UDP_PORT_TX_OFST) & UDP_PORT_TX_MSK) |
|
|
||||||
((udpport << UDP_PORT_RX_OFST) & UDP_PORT_RX_MSK));
|
|
||||||
bus_w(UDP_PORT_REG, val);
|
|
||||||
FILE_LOG(logDEBUG1, ("Read from UDP_PORT_REG: 0x%08x\n", bus_r(UDP_PORT_REG)));
|
|
||||||
|
|
||||||
bus_w(TX_IP_CHECKSUM_REG,(checksum << TX_IP_CHECKSUM_OFST) & TX_IP_CHECKSUM_MSK);
|
|
||||||
FILE_LOG(logDEBUG1, ("Read from TX_IP_CHECKSUM_REG: 0x%08x\n", bus_r(TX_IP_CHECKSUM_REG)));
|
|
||||||
cleanFifos();
|
cleanFifos();
|
||||||
resetCore();
|
resetCore();
|
||||||
alignDeserializer();
|
alignDeserializer();
|
||||||
@ -1121,20 +1169,20 @@ int configureMAC(int numInterfaces, int selInterface,
|
|||||||
|
|
||||||
int setDetectorPosition(int pos[]) {
|
int setDetectorPosition(int pos[]) {
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
FILE_LOG(logDEBUG1, ("Setting detector position: (%d, %d)\n", pos[0], pos[1]));
|
FILE_LOG(logDEBUG1, ("Setting detector position: (%d, %d)\n", pos[X], pos[Y]));
|
||||||
|
|
||||||
bus_w(COORD_0_REG, bus_r(COORD_0_REG) & (~(COORD_0_X_MSK)));
|
bus_w(COORD_0_REG, bus_r(COORD_0_REG) & (~(COORD_0_X_MSK)));
|
||||||
bus_w(COORD_0_REG, bus_r(COORD_0_REG) | ((pos[0] << COORD_0_X_OFST) & COORD_0_X_MSK));
|
bus_w(COORD_0_REG, bus_r(COORD_0_REG) | ((pos[X] << COORD_0_X_OFST) & COORD_0_X_MSK));
|
||||||
if ((bus_r(COORD_0_REG) & COORD_0_X_MSK) != ((pos[0] << COORD_0_X_OFST) & COORD_0_X_MSK))
|
if ((bus_r(COORD_0_REG) & COORD_0_X_MSK) != ((pos[X] << COORD_0_X_OFST) & COORD_0_X_MSK))
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
|
|
||||||
bus_w(COORD_0_REG, bus_r(COORD_0_REG) & (~(COORD_0_Y_MSK)));
|
bus_w(COORD_0_REG, bus_r(COORD_0_REG) & (~(COORD_0_Y_MSK)));
|
||||||
bus_w(COORD_0_REG, bus_r(COORD_0_REG) | ((pos[1] << COORD_0_Y_OFST) & COORD_0_Y_MSK));
|
bus_w(COORD_0_REG, bus_r(COORD_0_REG) | ((pos[Y] << COORD_0_Y_OFST) & COORD_0_Y_MSK));
|
||||||
if ((bus_r(COORD_0_REG) & COORD_0_Y_MSK) != ((pos[1] << COORD_0_Y_OFST) & COORD_0_Y_MSK))
|
if ((bus_r(COORD_0_REG) & COORD_0_Y_MSK) != ((pos[Y] << COORD_0_Y_OFST) & COORD_0_Y_MSK))
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
|
|
||||||
if (ret == OK) {
|
if (ret == OK) {
|
||||||
FILE_LOG(logINFO, ("Position set to [%d, %d]\n", pos[0], pos[1]));
|
FILE_LOG(logINFO, ("Position set to [%d, %d]\n", pos[X], pos[Y]));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1143,6 +1191,42 @@ int setDetectorPosition(int pos[]) {
|
|||||||
|
|
||||||
/* jungfrau specific - powerchip, autocompdisable, asictimer, clockdiv, pll, flashing fpga */
|
/* jungfrau specific - powerchip, autocompdisable, asictimer, clockdiv, pll, flashing fpga */
|
||||||
|
|
||||||
|
void initReadoutConfiguration() {
|
||||||
|
|
||||||
|
FILE_LOG(logINFO, ("Initializing Readout Configuration:\n"
|
||||||
|
"\t Reset readout Timer\n"
|
||||||
|
"\t 1 x 10G mode\n"
|
||||||
|
"\t outer interface is primary\n"
|
||||||
|
"\t half speed\n"
|
||||||
|
"\t TDMA disabled, 0 as TDMA slot\n"
|
||||||
|
"\t Ethernet overflow disabled\n"
|
||||||
|
"\t Reset Round robin entries\n"));
|
||||||
|
|
||||||
|
uint32_t val = 0;
|
||||||
|
// reset readouttimer
|
||||||
|
val &= ~CONFIG_RDT_TMR_MSK;
|
||||||
|
// 1 x 10G mode
|
||||||
|
val &= ~CONFIG_OPRTN_MDE_2_X_10GbE_MSK;
|
||||||
|
// outer interface
|
||||||
|
val &= ~CONFIG_INNR_PRIMRY_INTRFCE_MSK;
|
||||||
|
// half speed
|
||||||
|
val &= ~CONFIG_READOUT_SPEED_MSK;
|
||||||
|
val |= CONFIG_HALF_SPEED_20MHZ_VAL;
|
||||||
|
// tdma disable
|
||||||
|
val &= ~CONFIG_TDMA_ENABLE_MSK;
|
||||||
|
// tdma slot 0
|
||||||
|
val &= ~CONFIG_TDMA_TIMESLOT_MSK;
|
||||||
|
// no ethernet overflow
|
||||||
|
val &= ~CONFIG_ETHRNT_FLW_CNTRL_MSK;
|
||||||
|
bus_w(CONFIG_REG, val);
|
||||||
|
|
||||||
|
val = bus_r(CONTROL_REG);
|
||||||
|
// reset (addtional round robin entry) rx endpoints num
|
||||||
|
val &= CONTROL_RX_ADDTNL_ENDPTS_NUM_MSK;
|
||||||
|
// reset start of round robin entry to 0
|
||||||
|
val &= CONTROL_RX_ENDPTS_START_MSK;
|
||||||
|
bus_w(CONTROL_REG, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int powerChip (int on){
|
int powerChip (int on){
|
||||||
@ -1191,62 +1275,56 @@ void setClockDivider(int val) {
|
|||||||
if(runBusy())
|
if(runBusy())
|
||||||
stopStateMachine();
|
stopStateMachine();
|
||||||
|
|
||||||
uint32_t txndelay_msk = 0;
|
switch(val) {
|
||||||
|
|
||||||
switch(val){
|
case FULL_SPEED:
|
||||||
|
FILE_LOG(logINFO, ("Setting Full Speed (40 MHz):\n"));
|
||||||
|
|
||||||
// todo in firmware, for now setting half speed
|
bus_w(SAMPLE_REG, SAMPLE_ADC_FULL_SPEED);
|
||||||
case FULL_SPEED://40
|
FILE_LOG(logINFO, ("\tSet Sample Reg to 0x%x\n", bus_r(SAMPLE_REG)));
|
||||||
FILE_LOG(logINFO, ("Setting Half Speed (20 MHz):\n"));
|
|
||||||
|
|
||||||
FILE_LOG(logINFO, ("\tSetting Sample Reg to 0x%x\n", SAMPLE_ADC_HALF_SPEED));
|
bus_w(CONFIG_REG, (bus_r(CONFIG_REG) & ~CONFIG_READOUT_SPEED_MSK) | CONFIG_FULL_SPEED_40MHZ_VAL);
|
||||||
bus_w(SAMPLE_REG, SAMPLE_ADC_HALF_SPEED);
|
FILE_LOG(logINFO, ("\tSet Config Reg to 0x%x\n", bus_r(CONFIG_REG)));
|
||||||
|
|
||||||
txndelay_msk = (bus_r(CONFIG_REG) & CONFIG_TDMA_TIMESLOT_MSK); // read config tdma timeslot value
|
bus_w(ADC_OFST_REG, ADC_OFST_FULL_SPEED_VAL);
|
||||||
FILE_LOG(logINFO, ("\tSetting Config Reg to 0x%x\n", CONFIG_HALF_SPEED | txndelay_msk));
|
FILE_LOG(logINFO, ("\tSet ADC Ofst Reg to 0x%x\n", bus_r(ADC_OFST_REG)));
|
||||||
bus_w(CONFIG_REG, CONFIG_HALF_SPEED | txndelay_msk);
|
|
||||||
|
|
||||||
FILE_LOG(logINFO, ("\tSetting ADC Ofst Reg to 0x%x\n", ADC_OFST_HALF_SPEED_VAL));
|
|
||||||
bus_w(ADC_OFST_REG, ADC_OFST_HALF_SPEED_VAL);
|
|
||||||
|
|
||||||
FILE_LOG(logINFO, ("\tSetting ADC Phase Reg to 0x%x\n", ADC_PHASE_HALF_SPEED));
|
|
||||||
setAdcPhase(ADC_PHASE_HALF_SPEED, 0);
|
|
||||||
|
|
||||||
|
setAdcPhase(ADC_PHASE_FULL_SPEED, 0);
|
||||||
|
FILE_LOG(logINFO, ("\tSet ADC Phase Reg to 0x%x\n", ADC_PHASE_FULL_SPEED));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HALF_SPEED:
|
case HALF_SPEED:
|
||||||
FILE_LOG(logINFO, ("Setting Half Speed (20 MHz):\n"));
|
FILE_LOG(logINFO, ("Setting Half Speed (20 MHz):\n"));
|
||||||
|
|
||||||
FILE_LOG(logINFO, ("\tSetting Sample Reg to 0x%x\n", SAMPLE_ADC_HALF_SPEED));
|
|
||||||
bus_w(SAMPLE_REG, SAMPLE_ADC_HALF_SPEED);
|
bus_w(SAMPLE_REG, SAMPLE_ADC_HALF_SPEED);
|
||||||
|
FILE_LOG(logINFO, ("\tSet Sample Reg to 0x%x\n", bus_r(SAMPLE_REG)));
|
||||||
|
|
||||||
txndelay_msk = (bus_r(CONFIG_REG) & CONFIG_TDMA_TIMESLOT_MSK); // read config tdma timeslot value
|
bus_w(CONFIG_REG, (bus_r(CONFIG_REG) & ~CONFIG_READOUT_SPEED_MSK) | CONFIG_HALF_SPEED_20MHZ_VAL);
|
||||||
FILE_LOG(logINFO, ("\tSetting Config Reg to 0x%x\n", CONFIG_HALF_SPEED | txndelay_msk));
|
FILE_LOG(logINFO, ("\tSet Config Reg to 0x%x\n", bus_r(CONFIG_REG)));
|
||||||
bus_w(CONFIG_REG, CONFIG_HALF_SPEED | txndelay_msk);
|
|
||||||
|
|
||||||
FILE_LOG(logINFO, ("\tSetting ADC Ofst Reg to 0x%x\n", ADC_OFST_HALF_SPEED_VAL));
|
|
||||||
bus_w(ADC_OFST_REG, ADC_OFST_HALF_SPEED_VAL);
|
bus_w(ADC_OFST_REG, ADC_OFST_HALF_SPEED_VAL);
|
||||||
|
FILE_LOG(logINFO, ("\tSet ADC Ofst Reg to 0x%x\n", bus_r(ADC_OFST_REG)));
|
||||||
|
|
||||||
FILE_LOG(logINFO, ("\tSetting ADC Phase Reg to 0x%x\n", ADC_PHASE_HALF_SPEED));
|
|
||||||
setAdcPhase(ADC_PHASE_HALF_SPEED, 0);
|
setAdcPhase(ADC_PHASE_HALF_SPEED, 0);
|
||||||
|
FILE_LOG(logINFO, ("\tSet ADC Phase Reg to 0x%x\n", ADC_PHASE_HALF_SPEED));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QUARTER_SPEED:
|
case QUARTER_SPEED:
|
||||||
FILE_LOG(logINFO, ("Setting Half Speed (10 MHz):\n"));
|
FILE_LOG(logINFO, ("Setting Half Speed (10 MHz):\n"));
|
||||||
|
|
||||||
FILE_LOG(logINFO, ("\tSetting Sample Reg to 0x%x\n", SAMPLE_ADC_QUARTER_SPEED));
|
|
||||||
bus_w(SAMPLE_REG, SAMPLE_ADC_QUARTER_SPEED);
|
bus_w(SAMPLE_REG, SAMPLE_ADC_QUARTER_SPEED);
|
||||||
|
FILE_LOG(logINFO, ("\tSet Sample Reg to 0x%x\n", bus_r(SAMPLE_REG)));
|
||||||
|
|
||||||
txndelay_msk = (bus_r(CONFIG_REG) & CONFIG_TDMA_TIMESLOT_MSK); // read config tdma timeslot value
|
bus_w(CONFIG_REG, (bus_r(CONFIG_REG) & ~CONFIG_READOUT_SPEED_MSK) | CONFIG_QUARTER_SPEED_10MHZ_VAL);
|
||||||
FILE_LOG(logINFO, ("\tSetting Config Reg to 0x%x\n", CONFIG_QUARTER_SPEED | txndelay_msk));
|
FILE_LOG(logINFO, ("\tSet Config Reg to 0x%x\n", bus_r(CONFIG_REG)));
|
||||||
bus_w(CONFIG_REG, CONFIG_QUARTER_SPEED | txndelay_msk);
|
|
||||||
|
|
||||||
FILE_LOG(logINFO, ("\tSetting ADC Ofst Reg to 0x%x\n", ADC_OFST_QUARTER_SPEED_VAL));
|
|
||||||
bus_w(ADC_OFST_REG, ADC_OFST_QUARTER_SPEED_VAL);
|
bus_w(ADC_OFST_REG, ADC_OFST_QUARTER_SPEED_VAL);
|
||||||
|
FILE_LOG(logINFO, ("\tSet ADC Ofst Reg to 0x%x\n", bus_r(ADC_OFST_REG)));
|
||||||
|
|
||||||
FILE_LOG(logINFO, ("\tSetting ADC Phase Reg to 0x%x\n", ADC_PHASE_QUARTER_SPEED));
|
|
||||||
setAdcPhase(ADC_PHASE_QUARTER_SPEED, 0);
|
setAdcPhase(ADC_PHASE_QUARTER_SPEED, 0);
|
||||||
|
FILE_LOG(logINFO, ("\tSet ADC Phase Reg to 0x%x\n", ADC_PHASE_QUARTER_SPEED));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1410,22 +1488,38 @@ void alignDeserializer() {
|
|||||||
|
|
||||||
|
|
||||||
int setNetworkParameter(enum NETWORKINDEX mode, int value) {
|
int setNetworkParameter(enum NETWORKINDEX mode, int value) {
|
||||||
if (mode != TXN_FRAME)
|
switch(mode) {
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (value >= 0) {
|
case TXN_FRAME:
|
||||||
FILE_LOG(logINFO, ("Setting transmission delay: %d\n", value));
|
if (value >= 0) {
|
||||||
bus_w(CONFIG_REG, (bus_r(CONFIG_REG) &~CONFIG_TDMA_TIMESLOT_MSK)
|
FILE_LOG(logINFO, ("Setting transmission delay: %d\n", value));
|
||||||
| (((value << CONFIG_TDMA_TIMESLOT_OFST) & CONFIG_TDMA_TIMESLOT_MSK)));
|
bus_w(CONFIG_REG, (bus_r(CONFIG_REG) &~CONFIG_TDMA_TIMESLOT_MSK)
|
||||||
if (value == 0)
|
| (((value << CONFIG_TDMA_TIMESLOT_OFST) & CONFIG_TDMA_TIMESLOT_MSK)));
|
||||||
bus_w(CONFIG_REG, bus_r(CONFIG_REG) &~ CONFIG_TDMA_MSK);
|
if (value == 0) {
|
||||||
else
|
FILE_LOG(logINFO, ("Switching off transmission delay\n"));
|
||||||
bus_w(CONFIG_REG, bus_r(CONFIG_REG) | CONFIG_TDMA_MSK);
|
bus_w(CONFIG_REG, bus_r(CONFIG_REG) &~ CONFIG_TDMA_ENABLE_MSK);
|
||||||
FILE_LOG(logDEBUG1, ("Transmission delay read %d\n",
|
} else {
|
||||||
((bus_r(CONFIG_REG) & CONFIG_TDMA_TIMESLOT_MSK) >> CONFIG_TDMA_TIMESLOT_OFST)));
|
FILE_LOG(logINFO, ("Switching on transmission delay\n"));
|
||||||
}
|
bus_w(CONFIG_REG, bus_r(CONFIG_REG) | CONFIG_TDMA_ENABLE_MSK);
|
||||||
|
}
|
||||||
|
FILE_LOG(logDEBUG1, ("Transmission delay read %d\n",
|
||||||
|
((bus_r(CONFIG_REG) & CONFIG_TDMA_TIMESLOT_MSK) >> CONFIG_TDMA_TIMESLOT_OFST)));
|
||||||
|
}
|
||||||
|
return ((bus_r(CONFIG_REG) & CONFIG_TDMA_TIMESLOT_MSK) >> CONFIG_TDMA_TIMESLOT_OFST);
|
||||||
|
|
||||||
|
case FLOW_CONTROL_10G:
|
||||||
|
if (value == 0) {
|
||||||
|
FILE_LOG(logINFO, ("Switching off 10G flow control\n"));
|
||||||
|
bus_w(CONFIG_REG, bus_r(CONFIG_REG) &~ CONFIG_ETHRNT_FLW_CNTRL_MSK);
|
||||||
|
} else {
|
||||||
|
FILE_LOG(logINFO, ("Switching on 10G flow control\n"));
|
||||||
|
bus_w(CONFIG_REG, bus_r(CONFIG_REG) | CONFIG_ETHRNT_FLW_CNTRL_MSK);
|
||||||
|
}
|
||||||
|
return ((bus_r(CONFIG_REG) & CONFIG_ETHRNT_FLW_CNTRL_MSK) >> CONFIG_ETHRNT_FLW_CNTRL_OFST);
|
||||||
|
|
||||||
return ((bus_r(CONFIG_REG) & CONFIG_TDMA_TIMESLOT_MSK) >> CONFIG_TDMA_TIMESLOT_OFST);
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,24 +4,36 @@
|
|||||||
|
|
||||||
|
|
||||||
#define MIN_REQRD_VRSN_T_RD_API 0x171220
|
#define MIN_REQRD_VRSN_T_RD_API 0x171220
|
||||||
#define REQRD_FRMWR_VRSN 0x181206 // temp bug fix from last version, timing mode is backwards compatible
|
#define REQRD_FRMWR_VRSN 0x190509
|
||||||
|
|
||||||
#define BOARD_JUNGFRAU_TYPE (8)
|
|
||||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||||
|
|
||||||
/* Struct Definitions */
|
/* Struct Definitions */
|
||||||
typedef struct ip_header_struct {
|
typedef struct udp_header_struct {
|
||||||
uint16_t ip_len;
|
uint32_t udp_destmac_msb;
|
||||||
uint8_t ip_tos;
|
uint16_t udp_srcmac_msb;
|
||||||
uint8_t ip_ihl:4 ,ip_ver:4;
|
uint16_t udp_destmac_lsb;
|
||||||
uint16_t ip_offset:13,ip_flag:3;
|
uint32_t udp_srcmac_lsb;
|
||||||
uint16_t ip_ident;
|
uint8_t ip_tos;
|
||||||
uint16_t ip_chksum;
|
uint8_t ip_ihl: 4, ip_ver: 4;
|
||||||
uint8_t ip_protocol;
|
uint16_t udp_ethertype;
|
||||||
uint8_t ip_ttl;
|
uint16_t ip_identification;
|
||||||
uint32_t ip_sourceip;
|
uint16_t ip_totallength;
|
||||||
uint32_t ip_destip;
|
uint8_t ip_protocol;
|
||||||
} ip_header;
|
uint8_t ip_ttl;
|
||||||
|
uint16_t ip_fragmentoffset: 13, ip_flags: 3;
|
||||||
|
uint16_t ip_srcip_msb;
|
||||||
|
uint16_t ip_checksum;
|
||||||
|
uint16_t ip_destip_msb;
|
||||||
|
uint16_t ip_srcip_lsb;
|
||||||
|
uint16_t udp_srcport;
|
||||||
|
uint16_t ip_destip_lsb;
|
||||||
|
uint16_t udp_checksum;
|
||||||
|
uint16_t udp_destport;
|
||||||
|
} udp_header;
|
||||||
|
|
||||||
|
#define IP_HEADER_SIZE 20
|
||||||
|
|
||||||
|
|
||||||
/* Enums */
|
/* Enums */
|
||||||
enum CLK_SPEED_INDEX {FULL_SPEED, HALF_SPEED, QUARTER_SPEED};
|
enum CLK_SPEED_INDEX {FULL_SPEED, HALF_SPEED, QUARTER_SPEED};
|
||||||
@ -36,7 +48,7 @@ enum DACINDEX {VB_COMP, VDD_PROT, VIN_COM, VREF_PRECH, VB_PIXBUF, VB_DS, VREF
|
|||||||
480, /* VREF_DS */ \
|
480, /* VREF_DS */ \
|
||||||
420 /* VREF_COMP */ \
|
420 /* VREF_COMP */ \
|
||||||
};
|
};
|
||||||
enum NETWORKINDEX { TXN_FRAME };
|
enum NETWORKINDEX { TXN_FRAME, FLOWCTRL_10G };
|
||||||
|
|
||||||
/* Hardware Definitions */
|
/* Hardware Definitions */
|
||||||
#define NCHAN (256 * 256)
|
#define NCHAN (256 * 256)
|
||||||
@ -46,7 +58,6 @@ enum NETWORKINDEX { TXN_FRAME };
|
|||||||
#define DYNAMIC_RANGE (16)
|
#define DYNAMIC_RANGE (16)
|
||||||
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8)
|
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8)
|
||||||
#define DATA_BYTES (NCHIP * NCHAN * NUM_BYTES_PER_PIXEL)
|
#define DATA_BYTES (NCHIP * NCHAN * NUM_BYTES_PER_PIXEL)
|
||||||
#define IP_PACKETSIZE (0x2052)
|
|
||||||
#define CLK_RUN (40) /* MHz */
|
#define CLK_RUN (40) /* MHz */
|
||||||
#define CLK_SYNC (20) /* MHz */
|
#define CLK_SYNC (20) /* MHz */
|
||||||
|
|
||||||
@ -77,19 +88,21 @@ enum NETWORKINDEX { TXN_FRAME };
|
|||||||
#define MAX_STORAGE_CELL_DLY_NS_VAL ((ASIC_CTRL_EXPSRE_TMR_MSK >> ASIC_CTRL_EXPSRE_TMR_OFST) * ASIC_CTRL_EXPSRE_TMR_STEPS)
|
#define MAX_STORAGE_CELL_DLY_NS_VAL ((ASIC_CTRL_EXPSRE_TMR_MSK >> ASIC_CTRL_EXPSRE_TMR_OFST) * ASIC_CTRL_EXPSRE_TMR_STEPS)
|
||||||
#define ACQ_TIME_MIN_CLOCK (2)
|
#define ACQ_TIME_MIN_CLOCK (2)
|
||||||
|
|
||||||
|
#define SAMPLE_ADC_FULL_SPEED (SAMPLE_ADC_HALF_SPEED)
|
||||||
#define SAMPLE_ADC_HALF_SPEED (SAMPLE_DECMT_FACTOR_2_VAL + SAMPLE_DGTL_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_0_VAL + SAMPLE_ADC_SAMPLE_0_VAL) /* 0x1000 */
|
#define SAMPLE_ADC_HALF_SPEED (SAMPLE_DECMT_FACTOR_2_VAL + SAMPLE_DGTL_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_0_VAL + SAMPLE_ADC_SAMPLE_0_VAL) /* 0x1000 */
|
||||||
#define SAMPLE_ADC_QUARTER_SPEED (SAMPLE_DECMT_FACTOR_4_VAL + SAMPLE_DGTL_SAMPLE_8_VAL + SAMPLE_ADC_DECMT_FACTOR_1_VAL + SAMPLE_ADC_SAMPLE_0_VAL) /* 0x2810 */
|
#define SAMPLE_ADC_QUARTER_SPEED (SAMPLE_DECMT_FACTOR_4_VAL + SAMPLE_DGTL_SAMPLE_8_VAL + SAMPLE_ADC_DECMT_FACTOR_1_VAL + SAMPLE_ADC_SAMPLE_0_VAL) /* 0x2810 */
|
||||||
#define CONFIG_HALF_SPEED (CONFIG_TDMA_DISABLE_VAL + CONFIG_HALF_SPEED_20MHZ_VAL + CONFIG_OPRTN_MDE_1_X_10GBE_VAL) /**0x100000 */
|
|
||||||
#define CONFIG_QUARTER_SPEED (CONFIG_TDMA_DISABLE_VAL + CONFIG_QUARTER_SPEED_10MHZ_VAL + CONFIG_OPRTN_MDE_1_X_10GBE_VAL)
|
#define ADC_OFST_FULL_SPEED_VAL (0x20)//(0x1f) //(0x20)
|
||||||
#define ADC_OFST_HALF_SPEED_VAL (0x20)//(0x1f) //(0x20)
|
#define ADC_OFST_HALF_SPEED_VAL (0x20)//(0x1f) //(0x20)
|
||||||
#define ADC_OFST_QUARTER_SPEED_VAL (0x0f) //(0x0f)
|
#define ADC_OFST_QUARTER_SPEED_VAL (0x0f) //(0x0f)
|
||||||
|
|
||||||
|
#define ADC_PHASE_FULL_SPEED (0x2D) //45
|
||||||
#define ADC_PHASE_HALF_SPEED (0x2D) //45
|
#define ADC_PHASE_HALF_SPEED (0x2D) //45
|
||||||
#define ADC_PHASE_QUARTER_SPEED (0x2D) //45
|
#define ADC_PHASE_QUARTER_SPEED (0x2D) //45
|
||||||
|
|
||||||
#define ADC_PORT_INVERT_VAL (0x5A5A5A5A)//(0x453b2a9c)
|
#define ADC_PORT_INVERT_VAL (0x5A5A5A5A)//(0x453b2a9c)
|
||||||
#define MAX_PHASE_SHIFTS (160)
|
#define MAX_PHASE_SHIFTS (160)
|
||||||
|
|
||||||
/* MSB & LSB DEFINES */
|
|
||||||
#define MSB_OF_64_BIT_REG_OFST (32)
|
|
||||||
#define LSB_OF_64_BIT_REG_OFST (0)
|
|
||||||
#define BIT_32_MSK (0xFFFFFFFF)
|
|
||||||
|
|
||||||
|
#define BIT16_MASK (0xFFFF)
|
||||||
|
#define UDP_IP_HEADER_LENGTH_BYTES (28)
|
@ -524,7 +524,8 @@ int Server_SendResult(int fileDes, intType itype, int update, void* retval, int
|
|||||||
|
|
||||||
void getMacAddressinString(char* cmac, int size, uint64_t mac) {
|
void getMacAddressinString(char* cmac, int size, uint64_t mac) {
|
||||||
memset(cmac, 0, size);
|
memset(cmac, 0, size);
|
||||||
sprintf(cmac,"%02x:%02x:%02x:%02x:%02x:%02x",(unsigned int)((mac>>40)&0xFF),
|
sprintf(cmac,"%02x:%02x:%02x:%02x:%02x:%02x",
|
||||||
|
(unsigned int)((mac>>40)&0xFF),
|
||||||
(unsigned int)((mac>>32)&0xFF),
|
(unsigned int)((mac>>32)&0xFF),
|
||||||
(unsigned int)((mac>>24)&0xFF),
|
(unsigned int)((mac>>24)&0xFF),
|
||||||
(unsigned int)((mac>>16)&0xFF),
|
(unsigned int)((mac>>16)&0xFF),
|
||||||
@ -535,4 +536,4 @@ void getMacAddressinString(char* cmac, int size, uint64_t mac) {
|
|||||||
void getIpAddressinString(char* cip, uint32_t ip) {
|
void getIpAddressinString(char* cip, uint32_t ip) {
|
||||||
memset(cip, 0, INET_ADDRSTRLEN);
|
memset(cip, 0, INET_ADDRSTRLEN);
|
||||||
inet_ntop(AF_INET, &ip, cip, INET_ADDRSTRLEN);
|
inet_ntop(AF_INET, &ip, cip, INET_ADDRSTRLEN);
|
||||||
}
|
}
|
||||||
|
@ -67,4 +67,5 @@ void getMacAddressinString(char* cmac, int size, uint64_t mac);
|
|||||||
*/
|
*/
|
||||||
void getIpAddressinString(char* cip, uint32_t ip);
|
void getIpAddressinString(char* cip, uint32_t ip);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,6 +13,7 @@ Here are the definitions, but the actual implementation should be done for each
|
|||||||
|
|
||||||
****************************************************/
|
****************************************************/
|
||||||
|
|
||||||
|
enum interfaceType {OUTER, INNER};
|
||||||
|
|
||||||
// basic tests
|
// basic tests
|
||||||
int isFirmwareCheckDone();
|
int isFirmwareCheckDone();
|
||||||
@ -213,6 +214,11 @@ int getExtSignal();
|
|||||||
// configure mac
|
// configure mac
|
||||||
#ifdef GOTTHARDD
|
#ifdef GOTTHARDD
|
||||||
void calcChecksum(mac_conf* mac, int sourceip, int destip);
|
void calcChecksum(mac_conf* mac, int sourceip, int destip);
|
||||||
|
#elif JUNGFRAUD
|
||||||
|
void setNumberofUDPInterfaces(int val);
|
||||||
|
void selectPrimaryInterface(int val);
|
||||||
|
void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip, uint64_t destmac, uint32_t destport, uint64_t sourcemac, uint32_t sourceip, uint32_t sourceport);
|
||||||
|
void calcChecksum(udp_header* udp);
|
||||||
#endif
|
#endif
|
||||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||||
long int calcChecksum(int sourceip, int destip);
|
long int calcChecksum(int sourceip, int destip);
|
||||||
@ -285,6 +291,7 @@ int resetCounterBlock(int startACQ);
|
|||||||
|
|
||||||
// jungfrau specific - powerchip, autocompdisable, clockdiv, asictimer, clock, pll, flashing firmware
|
// jungfrau specific - powerchip, autocompdisable, clockdiv, asictimer, clock, pll, flashing firmware
|
||||||
#elif JUNGFRAUD
|
#elif JUNGFRAUD
|
||||||
|
void initReadoutConfiguration();
|
||||||
int powerChip (int on);
|
int powerChip (int on);
|
||||||
int autoCompDisable(int on);
|
int autoCompDisable(int on);
|
||||||
void configureASICTimer();
|
void configureASICTimer();
|
||||||
|
@ -1719,13 +1719,6 @@ int get_time_left(int file_des) {
|
|||||||
|
|
||||||
// only get
|
// only get
|
||||||
// check index
|
// check index
|
||||||
#ifdef JUNGFRAUD
|
|
||||||
if (ind == DELAY_AFTER_TRIGGER) {
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess,"Timer Left Index (%d) is not implemented for this release.\n", (int)ind);
|
|
||||||
FILE_LOG(logERROR,(mess));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (ret == OK) {
|
if (ret == OK) {
|
||||||
switch(ind) {
|
switch(ind) {
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
@ -2417,9 +2410,9 @@ int configure_mac(int file_des) {
|
|||||||
#endif
|
#endif
|
||||||
#if defined(JUNGFRAUD) || defined(EIGERD)
|
#if defined(JUNGFRAUD) || defined(EIGERD)
|
||||||
int pos[2] = {0, 0};
|
int pos[2] = {0, 0};
|
||||||
sscanf(args[12], "%x", &pos[0]);
|
sscanf(args[12], "%x", &pos[X]);
|
||||||
sscanf(args[13], "%x", &pos[1]);
|
sscanf(args[13], "%x", &pos[Y]);
|
||||||
FILE_LOG(logDEBUG1, ("Position: [%d, %d]\n", pos[0], pos[1]));
|
FILE_LOG(logDEBUG1, ("Position: [%d, %d]\n", pos[X], pos[Y]));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -3227,10 +3220,12 @@ int set_network_parameter(int file_des) {
|
|||||||
if ((value == -1) || (Server_VerifyLock() == OK)) {
|
if ((value == -1) || (Server_VerifyLock() == OK)) {
|
||||||
// check index
|
// check index
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
#ifdef EIGERD
|
|
||||||
case FLOW_CONTROL_10G:
|
case FLOW_CONTROL_10G:
|
||||||
serverIndex = FLOWCTRL_10G;
|
serverIndex = FLOWCTRL_10G;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef EIGERD
|
||||||
case DETECTOR_TXN_DELAY_LEFT:
|
case DETECTOR_TXN_DELAY_LEFT:
|
||||||
serverIndex = TXN_LEFT;
|
serverIndex = TXN_LEFT;
|
||||||
break;
|
break;
|
||||||
|
@ -29,14 +29,14 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
|||||||
* @param action can be PUT_ACTION or GET_ACTION(from text client even READOUT_ACTION for acquisition)
|
* @param action can be PUT_ACTION or GET_ACTION(from text client even READOUT_ACTION for acquisition)
|
||||||
* @param detPos -1 for all detectors in multi detector list or position of a specific detector in list
|
* @param detPos -1 for all detectors in multi detector list or position of a specific detector in list
|
||||||
*/
|
*/
|
||||||
std::string executeLine(int narg, char *args[], int action, int detPos = -1);
|
std::string executeLine(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
/* returns the help for the executeLine command */
|
/* returns the help for the executeLine command */
|
||||||
/* \param os output stream to return the help to */
|
/* \param os output stream to return the help to */
|
||||||
/* \param action can be PUT_ACTION or GET_ACTION (from text client even READOUT_ACTION for acquisition) */
|
/* \param action can be PUT_ACTION or GET_ACTION (from text client even READOUT_ACTION for acquisition) */
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
std::string helpLine(int narg, char *args[], int action=HELP_ACTION, int detPos = -1);
|
std::string helpLine(int narg, const char * const args[], int action=HELP_ACTION, int detPos = -1);
|
||||||
static std::string helpAcquire(int action);
|
static std::string helpAcquire(int action);
|
||||||
static std::string helpData(int action);
|
static std::string helpData(int action);
|
||||||
static std::string helpStatus(int action);
|
static std::string helpStatus(int action);
|
||||||
@ -96,56 +96,56 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
multiSlsDetector *myDet;
|
multiSlsDetector *myDet;
|
||||||
|
|
||||||
std::string cmdUnderDevelopment(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdUnderDevelopment(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdUnknown(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdUnknown(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdAcquire(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdAcquire(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdData(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdData(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdStatus(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdStatus(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdDataStream(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdDataStream(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdFree(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdFree(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdHostname(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdHostname(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdUser(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdUser(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdHelp(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdHelp(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdExitServer(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdExitServer(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdSettingsDir(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdSettingsDir(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdTrimEn(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdTrimEn(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdOutDir(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdOutDir(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdFileName(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdFileName(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdFileIndex(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdFileIndex(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdRateCorr(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdRateCorr(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdNetworkParameter(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdNetworkParameter(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdPort(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdPort(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdLock(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdLock(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdLastClient(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdLastClient(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdOnline(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdOnline(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdConfigureMac(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdConfigureMac(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdDetectorSize(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdDetectorSize(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdSettings(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdSettings(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdSN(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdSN(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdDigiTest(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdDigiTest(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdRegister(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdRegister(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdDAC(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdDAC(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdTiming(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdTiming(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdTimer(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdTimer(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdTimeLeft(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdTimeLeft(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdSpeed(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdSpeed(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdAdvanced(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdAdvanced(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdConfiguration(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdConfiguration(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdImage(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdImage(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdCounter(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdCounter(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdADC(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdADC(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdTempControl(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdTempControl(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdEnablefwrite(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdEnablefwrite(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdOverwrite(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdOverwrite(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdReceiver(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdReceiver(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdPattern(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdPattern(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdPulse(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdPulse(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdProcessor(int narg, char *args[], int action, int detPos = -1);
|
std::string cmdProcessor(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
|
|
||||||
int numberOfCommands;
|
int numberOfCommands;
|
||||||
std::string cmd;
|
std::string cmd;
|
||||||
|
|
||||||
typedef std::string (slsDetectorCommand::*MemFuncGetter)(int narg, char *args[], int action, int detPos);
|
typedef std::string (slsDetectorCommand::*MemFuncGetter)(int narg, const char * const args[], int action, int detPos);
|
||||||
|
|
||||||
|
|
||||||
struct FuncTable
|
struct FuncTable
|
||||||
|
@ -521,7 +521,7 @@ public:
|
|||||||
int setHighVoltage(int i = -1, int detPos = -1);
|
int setHighVoltage(int i = -1, int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set 10GbE Flow Control (Eiger)
|
* Set 10GbE Flow Control (Eiger and Jungfrau)
|
||||||
* @param enable 1 to set, 0 to unset, -1 gets
|
* @param enable 1 to set, 0 to unset, -1 gets
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
* @returns 10GbE flow Control
|
* @returns 10GbE flow Control
|
||||||
|
@ -1437,7 +1437,7 @@ int slsDetector::configureMAC() {
|
|||||||
// 2d positions to detector to put into udp header
|
// 2d positions to detector to put into udp header
|
||||||
{
|
{
|
||||||
int pos[2] = {0, 0};
|
int pos[2] = {0, 0};
|
||||||
int max = shm()->multiSize[1] * (shm()->numUDPInterfaces);
|
int max = shm()->multiSize[Y] * (shm()->numUDPInterfaces);
|
||||||
// row
|
// row
|
||||||
pos[0] = (detId % max);
|
pos[0] = (detId % max);
|
||||||
// col for horiz. udp ports
|
// col for horiz. udp ports
|
||||||
|
@ -676,19 +676,12 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page timing
|
/*! \page timing
|
||||||
- <b>delayl</b> gets delay left. Used in GOTTHARD only. Only get! \c Returns \c (double with 9 decimal digits)
|
- <b>delayl</b> gets delay left. Used in GOTTHARD, JUNGFRAU, MOENCH and CTB only. Only get! \c Returns \c (double with 9 decimal digits)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "delayl";
|
descrToFuncMap[i].m_pFuncName = "delayl";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdTimeLeft;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdTimeLeft;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page timing
|
|
||||||
- <b>gatesl</b> gets number of gates left. Used in GOTTHARD only. Only get! \c Returns \c (double with 9 decimal digits)
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "gatesl";
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdTimeLeft;
|
|
||||||
++i;
|
|
||||||
|
|
||||||
/*! \page config
|
/*! \page config
|
||||||
- <b>framesl</b> gets number of frames left. Used in GOTTHARD and Jungfrau only. Only get! \c Returns \c (double with 9 decimal digits)
|
- <b>framesl</b> gets number of frames left. Used in GOTTHARD and Jungfrau only. Only get! \c Returns \c (double with 9 decimal digits)
|
||||||
*/
|
*/
|
||||||
@ -1700,7 +1693,7 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page network
|
/*! \page network
|
||||||
- <b>flowcontrol_10g [delay]</b> Enables/disables 10 GbE flow control. 1 enables, 0 disables. Used for EIGER only. \c Returns \c (int)
|
- <b>flowcontrol_10g [delay]</b> Enables/disables 10 GbE flow control. 1 enables, 0 disables. Used for EIGER and JUNGFRAU only. \c Returns \c (int)
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName = "flowcontrol_10g";
|
descrToFuncMap[i].m_pFuncName = "flowcontrol_10g";
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdNetworkParameter;
|
||||||
@ -2130,7 +2123,7 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
|
|
||||||
//-----------------------------------------------------------
|
//-----------------------------------------------------------
|
||||||
|
|
||||||
std::string slsDetectorCommand::executeLine(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::executeLine(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
if (action == READOUT_ACTION)
|
if (action == READOUT_ACTION)
|
||||||
return cmdAcquire(narg, args, action, detPos);
|
return cmdAcquire(narg, args, action, detPos);
|
||||||
@ -2161,14 +2154,14 @@ std::string slsDetectorCommand::executeLine(int narg, char *args[], int action,
|
|||||||
return cmdUnknown(narg, args, action, detPos);
|
return cmdUnknown(narg, args, action, detPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdUnknown(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdUnknown(int narg, const char * const args[], int action, int detPos) {
|
||||||
return std::string("Unknown command ") + std::string(args[0]) + std::string("\n") + helpLine(0, args, action, detPos);
|
return std::string("Unknown command ") + std::string(args[0]) + std::string("\n") + helpLine(0, args, action, detPos);
|
||||||
}
|
}
|
||||||
std::string slsDetectorCommand::cmdUnderDevelopment(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdUnderDevelopment(int narg, const char * const args[], int action, int detPos) {
|
||||||
return std::string("Must still develop ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
return std::string("Must still develop ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::helpLine(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::helpLine(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
|
|
||||||
@ -2187,7 +2180,7 @@ std::string slsDetectorCommand::helpLine(int narg, char *args[], int action, int
|
|||||||
return executeLine(narg, args, HELP_ACTION, detPos);
|
return executeLine(narg, args, HELP_ACTION, detPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdAcquire(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdAcquire(int narg, const char * const args[], int action, int detPos) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||||
#endif
|
#endif
|
||||||
@ -2232,7 +2225,7 @@ std::string slsDetectorCommand::helpAcquire(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdData(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdData(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||||
@ -2264,7 +2257,7 @@ std::string slsDetectorCommand::helpData(int action) {
|
|||||||
return std::string("data \t gets all data from the detector (if any) processes them and writes them to file according to the preferences already setup\n");
|
return std::string("data \t gets all data from the detector (if any) processes them and writes them to file according to the preferences already setup\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdStatus(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdStatus(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||||
@ -2317,7 +2310,7 @@ std::string slsDetectorCommand::helpStatus(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdDataStream(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdDataStream(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||||
@ -2351,7 +2344,7 @@ std::string slsDetectorCommand::helpDataStream(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdFree(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdFree(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||||
@ -2367,7 +2360,7 @@ std::string slsDetectorCommand::helpFree(int action) {
|
|||||||
return std::string("free \t frees the shared memory\n");
|
return std::string("free \t frees the shared memory\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdHostname(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdHostname(int narg, const char * const args[], int action, int detPos) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||||
#endif
|
#endif
|
||||||
@ -2429,7 +2422,7 @@ std::string slsDetectorCommand::helpHostname(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdUser(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdUser(int narg, const char * const args[], int action, int detPos) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||||
#endif
|
#endif
|
||||||
@ -2459,7 +2452,7 @@ std::string slsDetectorCommand::helpUser(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdHelp(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdHelp(int narg, const char * const args[], int action, int detPos) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||||
#endif
|
#endif
|
||||||
@ -2472,7 +2465,7 @@ std::string slsDetectorCommand::cmdHelp(int narg, char *args[], int action, int
|
|||||||
return helpLine(0, args, action, detPos);
|
return helpLine(0, args, action, detPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdExitServer(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdExitServer(int narg, const char * const args[], int action, int detPos) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||||
#endif
|
#endif
|
||||||
@ -2520,7 +2513,7 @@ std::string slsDetectorCommand::helpExitServer(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdSettingsDir(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdSettingsDir(int narg, const char * const args[], int action, int detPos) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||||
#endif
|
#endif
|
||||||
@ -2548,7 +2541,7 @@ std::string slsDetectorCommand::helpSettingsDir(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdTrimEn(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdTrimEn(int narg, const char * const args[], int action, int detPos) {
|
||||||
std::vector<int> energies;
|
std::vector<int> energies;
|
||||||
if (action == HELP_ACTION)
|
if (action == HELP_ACTION)
|
||||||
return helpTrimEn(action);
|
return helpTrimEn(action);
|
||||||
@ -2579,7 +2572,7 @@ std::string slsDetectorCommand::helpTrimEn(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdOutDir(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdOutDir(int narg, const char * const args[], int action, int detPos) {
|
||||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||||
if (action == HELP_ACTION)
|
if (action == HELP_ACTION)
|
||||||
return helpOutDir(action);
|
return helpOutDir(action);
|
||||||
@ -2599,7 +2592,7 @@ std::string slsDetectorCommand::helpOutDir(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdFileName(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdFileName(int narg, const char * const args[], int action, int detPos) {
|
||||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||||
if (action == HELP_ACTION)
|
if (action == HELP_ACTION)
|
||||||
return helpFileName(action);
|
return helpFileName(action);
|
||||||
@ -2635,7 +2628,7 @@ std::string slsDetectorCommand::helpFileName(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdEnablefwrite(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdEnablefwrite(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
char ans[100];
|
char ans[100];
|
||||||
@ -2681,7 +2674,7 @@ std::string slsDetectorCommand::helpEnablefwrite(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdOverwrite(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdOverwrite(int narg, const char * const args[], int action, int detPos) {
|
||||||
int i;
|
int i;
|
||||||
char ans[100];
|
char ans[100];
|
||||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||||
@ -2707,7 +2700,7 @@ std::string slsDetectorCommand::helpOverwrite(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdFileIndex(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdFileIndex(int narg, const char * const args[], int action, int detPos) {
|
||||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||||
if (action == HELP_ACTION) {
|
if (action == HELP_ACTION) {
|
||||||
return helpFileName(action);
|
return helpFileName(action);
|
||||||
@ -2727,7 +2720,7 @@ std::string slsDetectorCommand::helpFileIndex(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdRateCorr(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdRateCorr(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
if (action == HELP_ACTION) {
|
if (action == HELP_ACTION) {
|
||||||
return helpRateCorr(action);
|
return helpRateCorr(action);
|
||||||
@ -2754,7 +2747,7 @@ std::string slsDetectorCommand::helpRateCorr(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
// std::string slsDetectorCommand::cmdThreaded(int narg, char *args[], int action, int detPos){
|
// std::string slsDetectorCommand::cmdThreaded(int narg, const char * const args[], int action, int detPos){
|
||||||
// int ival;
|
// int ival;
|
||||||
// char answer[1000];
|
// char answer[1000];
|
||||||
|
|
||||||
@ -2780,7 +2773,7 @@ std::string slsDetectorCommand::helpThreaded(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdImage(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdImage(int narg, const char * const args[], int action, int detPos) {
|
||||||
std::string sval;
|
std::string sval;
|
||||||
int retval = FAIL;
|
int retval = FAIL;
|
||||||
if (action == HELP_ACTION)
|
if (action == HELP_ACTION)
|
||||||
@ -2815,7 +2808,7 @@ std::string slsDetectorCommand::helpImage(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdCounter(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdCounter(int narg, const char * const args[], int action, int detPos) {
|
||||||
int ival;
|
int ival;
|
||||||
char answer[100];
|
char answer[100];
|
||||||
std::string sval;
|
std::string sval;
|
||||||
@ -2876,7 +2869,7 @@ std::string slsDetectorCommand::helpCounter(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdNetworkParameter(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdNetworkParameter(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
char ans[100] = {0};
|
char ans[100] = {0};
|
||||||
int i;
|
int i;
|
||||||
@ -3076,7 +3069,7 @@ std::string slsDetectorCommand::helpNetworkParameter(int action) {
|
|||||||
os << "txndelay_left port \n sets detector transmission delay of the left port" << std::endl;
|
os << "txndelay_left port \n sets detector transmission delay of the left port" << std::endl;
|
||||||
os << "txndelay_right port \n sets detector transmission delay of the right port" << std::endl;
|
os << "txndelay_right port \n sets detector transmission delay of the right port" << std::endl;
|
||||||
os << "txndelay_frame port \n sets detector transmission delay of the entire frame" << std::endl;
|
os << "txndelay_frame port \n sets detector transmission delay of the entire frame" << std::endl;
|
||||||
os << "flowcontrol_10g port \n sets flow control for 10g for eiger" << std::endl;
|
os << "flowcontrol_10g port \n sets flow control for 10g for eiger and jungfrau" << std::endl;
|
||||||
os << "zmqport port \n sets the 0MQ (TCP) port of the client to where final data is streamed to (eg. for GUI). The default already connects with rx_zmqport for the GUI. "
|
os << "zmqport port \n sets the 0MQ (TCP) port of the client to where final data is streamed to (eg. for GUI). The default already connects with rx_zmqport for the GUI. "
|
||||||
"Use single-detector command to set individually or multi-detector command to calculate based on port for the rest."
|
"Use single-detector command to set individually or multi-detector command to calculate based on port for the rest."
|
||||||
"Must restart streaming in client with new port from gui/external gui"
|
"Must restart streaming in client with new port from gui/external gui"
|
||||||
@ -3116,7 +3109,7 @@ std::string slsDetectorCommand::helpNetworkParameter(int action) {
|
|||||||
os << "txndelay_left \n gets detector transmission delay of the left port" << std::endl;
|
os << "txndelay_left \n gets detector transmission delay of the left port" << std::endl;
|
||||||
os << "txndelay_right \n gets detector transmission delay of the right port" << std::endl;
|
os << "txndelay_right \n gets detector transmission delay of the right port" << std::endl;
|
||||||
os << "txndelay_frame \n gets detector transmission delay of the entire frame" << std::endl;
|
os << "txndelay_frame \n gets detector transmission delay of the entire frame" << std::endl;
|
||||||
os << "flowcontrol_10g \n gets flow control for 10g for eiger" << std::endl;
|
os << "flowcontrol_10g \n gets flow control for 10g for eiger and jungfrau" << std::endl;
|
||||||
os << "zmqport \n gets the 0MQ (TCP) port of the client to where final data is streamed to" << std::endl;
|
os << "zmqport \n gets the 0MQ (TCP) port of the client to where final data is streamed to" << std::endl;
|
||||||
os << "rx_zmqport \n gets the 0MQ (TCP) port of the receiver from where data is streamed from" << std::endl;
|
os << "rx_zmqport \n gets the 0MQ (TCP) port of the receiver from where data is streamed from" << std::endl;
|
||||||
os << "zmqip \n gets the 0MQ (TCP) ip of the client to where final data is streamed to.If no custom ip, empty until first time connect to receiver" << std::endl;
|
os << "zmqip \n gets the 0MQ (TCP) ip of the client to where final data is streamed to.If no custom ip, empty until first time connect to receiver" << std::endl;
|
||||||
@ -3127,7 +3120,7 @@ std::string slsDetectorCommand::helpNetworkParameter(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdPort(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdPort(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
if (action == HELP_ACTION)
|
if (action == HELP_ACTION)
|
||||||
return helpPort(action);
|
return helpPort(action);
|
||||||
@ -3175,7 +3168,7 @@ std::string slsDetectorCommand::helpPort(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdLock(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdLock(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
if (action == HELP_ACTION)
|
if (action == HELP_ACTION)
|
||||||
return helpLock(action);
|
return helpLock(action);
|
||||||
@ -3226,7 +3219,7 @@ std::string slsDetectorCommand::helpLock(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdLastClient(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdLastClient(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
if (action == HELP_ACTION)
|
if (action == HELP_ACTION)
|
||||||
return helpLastClient(action);
|
return helpLastClient(action);
|
||||||
@ -3257,7 +3250,7 @@ std::string slsDetectorCommand::helpLastClient(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdOnline(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdOnline(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
if (action == HELP_ACTION) {
|
if (action == HELP_ACTION) {
|
||||||
return helpOnline(action);
|
return helpOnline(action);
|
||||||
@ -3341,7 +3334,7 @@ std::string slsDetectorCommand::helpOnline(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdConfigureMac(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdConfigureMac(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
if (action == HELP_ACTION) {
|
if (action == HELP_ACTION) {
|
||||||
return helpConfigureMac(action);
|
return helpConfigureMac(action);
|
||||||
@ -3372,7 +3365,7 @@ std::string slsDetectorCommand::helpConfigureMac(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdDetectorSize(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
if (action == HELP_ACTION)
|
if (action == HELP_ACTION)
|
||||||
return helpDetectorSize(action);
|
return helpDetectorSize(action);
|
||||||
@ -3489,7 +3482,7 @@ std::string slsDetectorCommand::helpDetectorSize(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdSettings(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdSettings(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
if (action == HELP_ACTION)
|
if (action == HELP_ACTION)
|
||||||
return helpSettings(action);
|
return helpSettings(action);
|
||||||
@ -3607,7 +3600,7 @@ std::string slsDetectorCommand::helpSettings(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdSN(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdSN(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
char answer[1000];
|
char answer[1000];
|
||||||
|
|
||||||
@ -3700,7 +3693,7 @@ std::string slsDetectorCommand::helpSN(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdDigiTest(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdDigiTest(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
char answer[1000];
|
char answer[1000];
|
||||||
|
|
||||||
@ -3751,7 +3744,7 @@ std::string slsDetectorCommand::helpDigiTest(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdRegister(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdRegister(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
if (action == HELP_ACTION)
|
if (action == HELP_ACTION)
|
||||||
return helpRegister(action);
|
return helpRegister(action);
|
||||||
@ -3869,7 +3862,7 @@ std::string slsDetectorCommand::helpRegister(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdDAC(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdDAC(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
if (action == HELP_ACTION)
|
if (action == HELP_ACTION)
|
||||||
return helpDAC(action);
|
return helpDAC(action);
|
||||||
@ -4215,7 +4208,7 @@ std::string slsDetectorCommand::helpDAC(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdADC(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdADC(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
dacIndex adc;
|
dacIndex adc;
|
||||||
int idac;
|
int idac;
|
||||||
@ -4342,7 +4335,7 @@ std::string slsDetectorCommand::helpADC(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdTempControl(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdTempControl(int narg, const char * const args[], int action, int detPos) {
|
||||||
char answer[1000] = "";
|
char answer[1000] = "";
|
||||||
int val = -1;
|
int val = -1;
|
||||||
|
|
||||||
@ -4409,7 +4402,7 @@ std::string slsDetectorCommand::helpTempControl(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdTiming(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdTiming(int narg, const char * const args[], int action, int detPos) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||||
#endif
|
#endif
|
||||||
@ -4435,7 +4428,7 @@ std::string slsDetectorCommand::helpTiming(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdTimer(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdTimer(int narg, const char * const args[], int action, int detPos) {
|
||||||
timerIndex index;
|
timerIndex index;
|
||||||
int64_t t = -1, ret;
|
int64_t t = -1, ret;
|
||||||
double val, rval;
|
double val, rval;
|
||||||
@ -4565,7 +4558,7 @@ std::string slsDetectorCommand::helpTimer(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdTimeLeft(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdTimeLeft(int narg, const char * const args[], int action, int detPos) {
|
||||||
timerIndex index;
|
timerIndex index;
|
||||||
int64_t ret;
|
int64_t ret;
|
||||||
double rval;
|
double rval;
|
||||||
@ -4581,8 +4574,6 @@ std::string slsDetectorCommand::cmdTimeLeft(int narg, char *args[], int action,
|
|||||||
index = FRAME_PERIOD;
|
index = FRAME_PERIOD;
|
||||||
else if (cmd == "delayl")
|
else if (cmd == "delayl")
|
||||||
index = DELAY_AFTER_TRIGGER;
|
index = DELAY_AFTER_TRIGGER;
|
||||||
else if (cmd == "gatesl")
|
|
||||||
index = GATES_NUMBER;
|
|
||||||
else if (cmd == "framesl")
|
else if (cmd == "framesl")
|
||||||
index = FRAME_NUMBER;
|
index = FRAME_NUMBER;
|
||||||
else if (cmd == "cyclesl")
|
else if (cmd == "cyclesl")
|
||||||
@ -4635,7 +4626,7 @@ std::string slsDetectorCommand::helpTimeLeft(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdSpeed(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdSpeed(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
speedVariable index;
|
speedVariable index;
|
||||||
int t = -1, ret = 0, mode = 0;
|
int t = -1, ret = 0, mode = 0;
|
||||||
@ -4732,7 +4723,7 @@ std::string slsDetectorCommand::helpSpeed(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdAdvanced(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
|
|
||||||
char answer[1000] = "";
|
char answer[1000] = "";
|
||||||
@ -4970,7 +4961,7 @@ std::string slsDetectorCommand::helpAdvanced(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdConfiguration(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdConfiguration(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
if (action == HELP_ACTION)
|
if (action == HELP_ACTION)
|
||||||
return helpConfiguration(action);
|
return helpConfiguration(action);
|
||||||
@ -5040,7 +5031,7 @@ std::string slsDetectorCommand::helpConfiguration(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdReceiver(int narg, const char * const args[], int action, int detPos) {
|
||||||
char answer[100];
|
char answer[100];
|
||||||
int ival = -1;
|
int ival = -1;
|
||||||
|
|
||||||
@ -5288,7 +5279,7 @@ std::string slsDetectorCommand::helpPattern(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdPattern(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdPattern(int narg, const char * const args[], int action, int detPos) {
|
||||||
|
|
||||||
if (action == HELP_ACTION)
|
if (action == HELP_ACTION)
|
||||||
return helpPattern(action);
|
return helpPattern(action);
|
||||||
@ -5758,7 +5749,7 @@ std::string slsDetectorCommand::helpPulse(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdPulse(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdPulse(int narg, const char * const args[], int action, int detPos) {
|
||||||
int retval = FAIL;
|
int retval = FAIL;
|
||||||
|
|
||||||
if (action == HELP_ACTION)
|
if (action == HELP_ACTION)
|
||||||
@ -5820,7 +5811,7 @@ std::string slsDetectorCommand::helpProcessor(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdProcessor(int narg, char *args[], int action, int detPos) {
|
std::string slsDetectorCommand::cmdProcessor(int narg, const char * const args[], int action, int detPos) {
|
||||||
if (action == HELP_ACTION)
|
if (action == HELP_ACTION)
|
||||||
return helpProcessor(action);
|
return helpProcessor(action);
|
||||||
|
|
||||||
|
@ -27,9 +27,6 @@ public:
|
|||||||
/** Number of Pixels in y axis */
|
/** Number of Pixels in y axis */
|
||||||
uint32_t nPixelsY;
|
uint32_t nPixelsY;
|
||||||
|
|
||||||
/** emptybuffer (mainly for jungfrau) */
|
|
||||||
uint32_t emptyHeader;
|
|
||||||
|
|
||||||
/** Size of header in Packet */
|
/** Size of header in Packet */
|
||||||
uint32_t headerSizeinPacket;
|
uint32_t headerSizeinPacket;
|
||||||
|
|
||||||
@ -95,7 +92,6 @@ public:
|
|||||||
myDetectorType(slsDetectorDefs::GENERIC),
|
myDetectorType(slsDetectorDefs::GENERIC),
|
||||||
nPixelsX(0),
|
nPixelsX(0),
|
||||||
nPixelsY(0),
|
nPixelsY(0),
|
||||||
emptyHeader(0),
|
|
||||||
headerSizeinPacket(0),
|
headerSizeinPacket(0),
|
||||||
dataSize(0),
|
dataSize(0),
|
||||||
packetSize(0),
|
packetSize(0),
|
||||||
@ -228,7 +224,6 @@ public:
|
|||||||
FILE_LOG(level) << "myDetectorType: " << slsDetectorDefs::detectorTypeToString(myDetectorType);
|
FILE_LOG(level) << "myDetectorType: " << slsDetectorDefs::detectorTypeToString(myDetectorType);
|
||||||
FILE_LOG(level) << "Pixels X: " << nPixelsX;
|
FILE_LOG(level) << "Pixels X: " << nPixelsX;
|
||||||
FILE_LOG(level) << "Pixels Y: " << nPixelsY;
|
FILE_LOG(level) << "Pixels Y: " << nPixelsY;
|
||||||
FILE_LOG(level) << "Empty Header: " << emptyHeader;
|
|
||||||
FILE_LOG(level) << "Header Size in Packet: " << headerSizeinPacket;
|
FILE_LOG(level) << "Header Size in Packet: " << headerSizeinPacket;
|
||||||
FILE_LOG(level) << "Data Size: " << dataSize;
|
FILE_LOG(level) << "Data Size: " << dataSize;
|
||||||
FILE_LOG(level) << "Packet Size: " << packetSize;
|
FILE_LOG(level) << "Packet Size: " << packetSize;
|
||||||
@ -506,8 +501,7 @@ class JungfrauData : public GeneralData {
|
|||||||
myDetectorType = slsDetectorDefs::JUNGFRAU;
|
myDetectorType = slsDetectorDefs::JUNGFRAU;
|
||||||
nPixelsX = (256*4);
|
nPixelsX = (256*4);
|
||||||
nPixelsY = 512;
|
nPixelsY = 512;
|
||||||
emptyHeader = 6;
|
headerSizeinPacket = sizeof(slsDetectorDefs::sls_detector_header);
|
||||||
headerSizeinPacket = emptyHeader + sizeof(slsDetectorDefs::sls_detector_header);
|
|
||||||
dataSize = 8192;
|
dataSize = 8192;
|
||||||
packetSize = headerSizeinPacket + dataSize;
|
packetSize = headerSizeinPacket + dataSize;
|
||||||
packetsPerFrame = 128;
|
packetsPerFrame = 128;
|
||||||
|
@ -284,7 +284,7 @@ public:
|
|||||||
}
|
}
|
||||||
catch(Exception error){
|
catch(Exception error){
|
||||||
FILE_LOG(logERROR) << "Could not extend dataset in object " << ind;
|
FILE_LOG(logERROR) << "Could not extend dataset in object " << ind;
|
||||||
error.printError();
|
error.printErrorStack();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -353,7 +353,6 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
|||||||
uint32_t numpackets = 0;
|
uint32_t numpackets = 0;
|
||||||
uint32_t dsize = generalData->dataSize;
|
uint32_t dsize = generalData->dataSize;
|
||||||
uint32_t hsize = generalData->headerSizeinPacket; //(includes empty header)
|
uint32_t hsize = generalData->headerSizeinPacket; //(includes empty header)
|
||||||
uint32_t esize = generalData->emptyHeader;
|
|
||||||
uint32_t fifohsize = generalData->fifoBufferHeaderSize;
|
uint32_t fifohsize = generalData->fifoBufferHeaderSize;
|
||||||
uint32_t pperFrame = generalData->packetsPerFrame;
|
uint32_t pperFrame = generalData->packetsPerFrame;
|
||||||
bool isHeaderEmpty = true;
|
bool isHeaderEmpty = true;
|
||||||
@ -397,13 +396,13 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
|||||||
//check if its the current image packet
|
//check if its the current image packet
|
||||||
// -------------------------- new header ----------------------------------------------------------------------
|
// -------------------------- new header ----------------------------------------------------------------------
|
||||||
if (standardheader) {
|
if (standardheader) {
|
||||||
old_header = (sls_detector_header*) (&carryOverPacket[esize]);
|
old_header = (sls_detector_header*) (&carryOverPacket[0]);
|
||||||
fnum = old_header->frameNumber;
|
fnum = old_header->frameNumber;
|
||||||
pnum = old_header->packetNumber;
|
pnum = old_header->packetNumber;
|
||||||
}
|
}
|
||||||
// -------------------old header -----------------------------------------------------------------------------
|
// -------------------old header -----------------------------------------------------------------------------
|
||||||
else {
|
else {
|
||||||
generalData->GetHeaderInfo(index, &carryOverPacket[esize],
|
generalData->GetHeaderInfo(index, &carryOverPacket[0],
|
||||||
*dynamicRange, oddStartingPacket, fnum, pnum, snum, bid);
|
*dynamicRange, oddStartingPacket, fnum, pnum, snum, bid);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------
|
||||||
@ -515,7 +514,7 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
|||||||
|
|
||||||
// -------------------------- new header ----------------------------------------------------------------------
|
// -------------------------- new header ----------------------------------------------------------------------
|
||||||
if (standardheader) {
|
if (standardheader) {
|
||||||
old_header = (sls_detector_header*) (&listeningPacket[esize]);
|
old_header = (sls_detector_header*) (&listeningPacket[0]);
|
||||||
fnum = old_header->frameNumber;
|
fnum = old_header->frameNumber;
|
||||||
pnum = old_header->packetNumber;
|
pnum = old_header->packetNumber;
|
||||||
}
|
}
|
||||||
@ -523,10 +522,10 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
|||||||
else {
|
else {
|
||||||
// set first packet to be odd or even (check required when switching from roi to no roi)
|
// set first packet to be odd or even (check required when switching from roi to no roi)
|
||||||
if (myDetectorType == GOTTHARD && !measurementStartedFlag) {
|
if (myDetectorType == GOTTHARD && !measurementStartedFlag) {
|
||||||
oddStartingPacket = generalData->SetOddStartingPacket(index, &listeningPacket[esize]);
|
oddStartingPacket = generalData->SetOddStartingPacket(index, &listeningPacket[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
generalData->GetHeaderInfo(index, &listeningPacket[esize],
|
generalData->GetHeaderInfo(index, &listeningPacket[0],
|
||||||
*dynamicRange, oddStartingPacket, fnum, pnum, snum, bid);
|
*dynamicRange, oddStartingPacket, fnum, pnum, snum, bid);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -6,18 +6,17 @@
|
|||||||
|
|
||||||
class CmdLineParser {
|
class CmdLineParser {
|
||||||
public:
|
public:
|
||||||
void Parse(int argc, char *argv[]);
|
void Parse(int argc, const char * const argv[]);
|
||||||
void Parse(const std::string &s);
|
void Parse(const std::string &s);
|
||||||
void Print();
|
void Print();
|
||||||
|
|
||||||
//getters
|
|
||||||
int multi_id() const { return multi_id_; };
|
int multi_id() const { return multi_id_; };
|
||||||
int detector_id() const { return detector_id_; };
|
int detector_id() const { return detector_id_; };
|
||||||
int n_arguments() const { return arguments_.size(); }
|
int n_arguments() const { return arguments_.size(); }
|
||||||
const std::string &command() const { return command_; }
|
const std::string &command() const { return command_; }
|
||||||
const std::string &executable() const { return executable_; }
|
const std::string &executable() const { return executable_; }
|
||||||
const std::vector<std::string> &arguments() const { return arguments_; };
|
const std::vector<std::string> &arguments() const { return arguments_; };
|
||||||
std::vector<char *> argv();
|
std::vector<const char *> argv() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DecodeIdAndPosition(const char *c);
|
void DecodeIdAndPosition(const char *c);
|
||||||
|
@ -2,9 +2,10 @@
|
|||||||
#define GITBRANCH "refgui"
|
#define GITBRANCH "refgui"
|
||||||
#define APIGOTTHARD 0x190108
|
#define APIGOTTHARD 0x190108
|
||||||
#define APIMOENCH 0x181108
|
#define APIMOENCH 0x181108
|
||||||
#define APIJUNGFRAU 0x190405
|
|
||||||
#define APILIB 0x190405
|
#define APILIB 0x190405
|
||||||
#define APIRECEIVER 0x190405
|
#define APIRECEIVER 0x190405
|
||||||
#define APIGUI 0x190405
|
#define APIGUI 0x190405
|
||||||
#define APICTB 0x190514
|
|
||||||
#define APIEIGER 0x190516
|
#define APIEIGER 0x190516
|
||||||
|
#define APICTB 0x190516
|
||||||
|
|
||||||
|
#define APIJUNGFRAU 0x190517
|
||||||
|
@ -5,10 +5,11 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
//printing function for debugging
|
|
||||||
void CmdLineParser::Print() {
|
void CmdLineParser::Print() {
|
||||||
std::cout << "\nCmdLineParser::Print()\n";
|
std::cout << "\nCmdLineParser::Print()\n";
|
||||||
std::cout << "\tmulti_id: " << multi_id_ << ", detector_id: " << detector_id_ << std::endl;
|
std::cout << "\tmulti_id: " << multi_id_
|
||||||
|
<< ", detector_id: " << detector_id_ << std::endl;
|
||||||
std::cout << "\texecutable: " << executable_ << '\n';
|
std::cout << "\texecutable: " << executable_ << '\n';
|
||||||
std::cout << "\tcommand: " << command_ << '\n';
|
std::cout << "\tcommand: " << command_ << '\n';
|
||||||
std::cout << "\tn_arguments: " << n_arguments() << '\n';
|
std::cout << "\tn_arguments: " << n_arguments() << '\n';
|
||||||
@ -19,27 +20,22 @@ void CmdLineParser::Print() {
|
|||||||
std::cout << "\n\n";
|
std::cout << "\n\n";
|
||||||
};
|
};
|
||||||
|
|
||||||
void CmdLineParser::Parse(int argc, char *argv[]) {
|
void CmdLineParser::Parse(int argc, const char * const argv[]) {
|
||||||
//first element of argv is the command used to call the executable ->skipping
|
executable_ = argv[0]; //first arg is calling binary
|
||||||
//and if this is the only command skip all
|
|
||||||
executable_ = argv[0];
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
//second element is cmd string that needs to be decoded
|
|
||||||
DecodeIdAndPosition(argv[1]);
|
DecodeIdAndPosition(argv[1]);
|
||||||
//The rest of the arguments goes into a vector for later processing
|
|
||||||
for (int i = 2; i < argc; ++i) {
|
for (int i = 2; i < argc; ++i) {
|
||||||
arguments_.emplace_back(std::string(argv[i]));
|
arguments_.emplace_back(argv[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
void CmdLineParser::Parse(const std::string &s) {
|
void CmdLineParser::Parse(const std::string &s) {
|
||||||
std::istringstream iss(s);
|
std::istringstream iss(s);
|
||||||
auto it = std::istream_iterator<std::string>(iss);
|
auto it = std::istream_iterator<std::string>(iss);
|
||||||
//read the first element and increment
|
|
||||||
command_ = *it++;
|
command_ = *it++;
|
||||||
arguments_ = std::vector<std::string>(it, std::istream_iterator<std::string>());
|
arguments_ =
|
||||||
;
|
std::vector<std::string>(it, std::istream_iterator<std::string>());
|
||||||
DecodeIdAndPosition(command_.c_str());
|
DecodeIdAndPosition(command_.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,19 +47,23 @@ void CmdLineParser::DecodeIdAndPosition(const char *c) {
|
|||||||
if (contains_id && contains_pos) {
|
if (contains_id && contains_pos) {
|
||||||
int r = sscanf(c, "%d-%d:%s", &multi_id_, &detector_id_, tmp);
|
int r = sscanf(c, "%d-%d:%s", &multi_id_, &detector_id_, tmp);
|
||||||
if (r != 3) {
|
if (r != 3) {
|
||||||
throw(std::invalid_argument("Cannot decode client or detector id from: \"" + std::string(c) + "\"\n"));
|
throw(std::invalid_argument(
|
||||||
|
"Cannot decode client or detector id from: \"" +
|
||||||
|
std::string(c) + "\"\n"));
|
||||||
}
|
}
|
||||||
command_ = tmp;
|
command_ = tmp;
|
||||||
} else if (contains_id && !contains_pos) {
|
} else if (contains_id && !contains_pos) {
|
||||||
int r = sscanf(c, "%d-%s", &multi_id_, tmp);
|
int r = sscanf(c, "%d-%s", &multi_id_, tmp);
|
||||||
if (r != 2) {
|
if (r != 2) {
|
||||||
throw(std::invalid_argument("Cannot decode client id from: \"" + std::string(c) + "\"\n"));
|
throw(std::invalid_argument("Cannot decode client id from: \"" +
|
||||||
|
std::string(c) + "\"\n"));
|
||||||
}
|
}
|
||||||
command_ = tmp;
|
command_ = tmp;
|
||||||
} else if (!contains_id && contains_pos) {
|
} else if (!contains_id && contains_pos) {
|
||||||
int r = sscanf(c, "%d:%s", &detector_id_, tmp);
|
int r = sscanf(c, "%d:%s", &detector_id_, tmp);
|
||||||
if (r != 2) {
|
if (r != 2) {
|
||||||
throw(std::invalid_argument("Cannot decode detector id from: \"" + std::string(c) + "\"\n"));
|
throw(std::invalid_argument("Cannot decode detector id from: \"" +
|
||||||
|
std::string(c) + "\"\n"));
|
||||||
}
|
}
|
||||||
command_ = tmp;
|
command_ = tmp;
|
||||||
} else {
|
} else {
|
||||||
@ -71,12 +71,11 @@ void CmdLineParser::DecodeIdAndPosition(const char *c) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<char *> CmdLineParser::argv() {
|
std::vector<const char *> CmdLineParser::argv() const {
|
||||||
std::vector<char *> vec;
|
std::vector<const char *> vec;
|
||||||
if (command_.empty()!=true){
|
if (command_.empty() != true) {
|
||||||
vec.push_back(&command_.front());
|
vec.push_back(&command_.front());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &arg : arguments_) {
|
for (auto &arg : arguments_) {
|
||||||
vec.push_back(&arg.front());
|
vec.push_back(&arg.front());
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,7 @@ IpAddr::IpAddr(const std::string &address) {
|
|||||||
inet_pton(AF_INET, address.c_str(), &addr_);
|
inet_pton(AF_INET, address.c_str(), &addr_);
|
||||||
}
|
}
|
||||||
|
|
||||||
IpAddr::IpAddr(const char *address) {
|
IpAddr::IpAddr(const char *address) { inet_pton(AF_INET, address, &addr_); }
|
||||||
inet_pton(AF_INET, address, &addr_);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string IpAddr::str() const {
|
std::string IpAddr::str() const {
|
||||||
char ipstring[INET_ADDRSTRLEN]{};
|
char ipstring[INET_ADDRSTRLEN]{};
|
||||||
@ -35,9 +33,9 @@ std::string IpAddr::str() const {
|
|||||||
}
|
}
|
||||||
std::string IpAddr::hex() const {
|
std::string IpAddr::hex() const {
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
|
ss << std::hex << std::setfill('0');
|
||||||
for (int i = 0; i != 4; ++i) {
|
for (int i = 0; i != 4; ++i) {
|
||||||
ss << std::hex << std::setfill('0') << std::setw(2)
|
ss << std::setw(2) << ((addr_ >> i * 8) & 0xFF);
|
||||||
<< ((addr_ >> i * 8) & 0xFF);
|
|
||||||
}
|
}
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
@ -60,18 +58,14 @@ std::string MacAddr::to_hex(const char delimiter) const {
|
|||||||
for (int i = 32; i >= 0; i -= 8) {
|
for (int i = 32; i >= 0; i -= 8) {
|
||||||
if (delimiter)
|
if (delimiter)
|
||||||
ss << delimiter;
|
ss << delimiter;
|
||||||
ss << ((addr_ >> i) & 0xFF);
|
ss << std::setw(2) << ((addr_ >> i) & 0xFF);
|
||||||
}
|
}
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MacAddr::str() const {
|
std::string MacAddr::str() const { return to_hex(':'); }
|
||||||
return to_hex(':');
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string MacAddr::hex() const {
|
std::string MacAddr::hex() const { return to_hex(); }
|
||||||
return to_hex();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const IpAddr &addr) {
|
std::ostream &operator<<(std::ostream &out, const IpAddr &addr) {
|
||||||
return out << addr.str();
|
return out << addr.str();
|
||||||
|
@ -2,18 +2,126 @@
|
|||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <string>
|
#include <string>
|
||||||
//tests to add
|
// tests to add
|
||||||
//help for all docs
|
// help for all docs
|
||||||
//command for all depreciated commands
|
// command for all depreciated commands
|
||||||
|
|
||||||
TEST_CASE("Parse with no arguments results in no command and default id") {
|
using vs = std::vector<std::string>;
|
||||||
//build up argc and argv
|
|
||||||
//first argument is the command used to call the binary
|
SCENARIO("Construction", "[support]") {
|
||||||
|
GIVEN("A default constructed CmdLineParser") {
|
||||||
|
CmdLineParser p;
|
||||||
|
THEN("The state of the object is valid") {
|
||||||
|
REQUIRE(p.detector_id() == -1);
|
||||||
|
REQUIRE(p.multi_id() == 0);
|
||||||
|
REQUIRE(p.command().empty());
|
||||||
|
REQUIRE(p.arguments().empty());
|
||||||
|
REQUIRE(p.argv().empty());
|
||||||
|
REQUIRE(p.argv().data() == nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SCENARIO("Parsing a string with the command line parser", "[support]") {
|
||||||
|
GIVEN("A CmdLineParser") {
|
||||||
|
CmdLineParser p;
|
||||||
|
WHEN("Parsing an empty string") {
|
||||||
|
std::string s;
|
||||||
|
p.Parse(s);
|
||||||
|
THEN("command and arguments are empty") {
|
||||||
|
REQUIRE(p.detector_id() == -1);
|
||||||
|
REQUIRE(p.multi_id() == 0);
|
||||||
|
REQUIRE(p.command().empty());
|
||||||
|
REQUIRE(p.arguments().empty());
|
||||||
|
REQUIRE(p.argv().empty());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WHEN("Parsing a string with a single command") {
|
||||||
|
std::string s = "vrf";
|
||||||
|
p.Parse(s);
|
||||||
|
THEN("command is assigned and id's remain default") {
|
||||||
|
REQUIRE(p.command() == "vrf");
|
||||||
|
REQUIRE(p.detector_id() == -1);
|
||||||
|
REQUIRE(p.multi_id() == 0);
|
||||||
|
REQUIRE(p.arguments().empty());
|
||||||
|
REQUIRE(p.argv().size() == 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WHEN("Parsing a string with command and value") {
|
||||||
|
std::string s = "vthreshold 1500";
|
||||||
|
p.Parse(s);
|
||||||
|
THEN("cmd and value are assigned and id's remain default") {
|
||||||
|
REQUIRE(p.command() == "vthreshold");
|
||||||
|
REQUIRE(p.arguments()[0] == "1500");
|
||||||
|
REQUIRE(p.arguments().size() == 1);
|
||||||
|
REQUIRE(p.detector_id() == -1);
|
||||||
|
REQUIRE(p.multi_id() == 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WHEN("Parsing a string with detector id and command") {
|
||||||
|
vs arg{"9:vcp", "53:vthreshold", "128:vtrim", "5:threshold"};
|
||||||
|
std::vector<int> det_id{9, 53, 128, 5};
|
||||||
|
vs res{"vcp", "vthreshold", "vtrim", "threshold"};
|
||||||
|
|
||||||
|
THEN("Values are correctly decoded") {
|
||||||
|
for (size_t i = 0; i != arg.size(); ++i) {
|
||||||
|
p.Parse(arg[i]);
|
||||||
|
REQUIRE(p.detector_id() == det_id[i]);
|
||||||
|
REQUIRE(p.multi_id() == 0);
|
||||||
|
REQUIRE(p.command() == res[i]);
|
||||||
|
REQUIRE(p.arguments().empty());
|
||||||
|
REQUIRE(p.argv().size() == 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WHEN("Parsing a string with multi_id detector id and command") {
|
||||||
|
vs arg{"8-12:vrf", "0-52:vcmp", "19-10:vtrim", "31-127:threshold"};
|
||||||
|
std::vector<int> det_id{12, 52, 10, 127};
|
||||||
|
std::vector<int> multi_id{8, 0, 19, 31};
|
||||||
|
vs res{"vrf", "vcmp", "vtrim", "threshold"};
|
||||||
|
|
||||||
|
THEN("Values are correctly decoded") {
|
||||||
|
for (size_t i = 0; i != arg.size(); ++i) {
|
||||||
|
p.Parse(arg[i]);
|
||||||
|
REQUIRE(p.detector_id() == det_id[i]);
|
||||||
|
REQUIRE(p.multi_id() == multi_id[i]);
|
||||||
|
REQUIRE(p.command() == res[i]);
|
||||||
|
REQUIRE(p.arguments().empty());
|
||||||
|
REQUIRE(p.argv().size() == 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WHEN("Parsing string with cmd and multiple arguments") {
|
||||||
|
std::string s = "trimen 5000 6000 7000";
|
||||||
|
p.Parse(s);
|
||||||
|
THEN("cmd and args are correct") {
|
||||||
|
REQUIRE(p.command() == "trimen");
|
||||||
|
REQUIRE(p.arguments().size() == 3);
|
||||||
|
REQUIRE(p.arguments()[0] == "5000");
|
||||||
|
REQUIRE(p.arguments()[1] == "6000");
|
||||||
|
REQUIRE(p.arguments()[2] == "7000");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WHEN("Cliend id and or detector id cannot be decoded") {
|
||||||
|
vs arg{"o:cmd", "-5:cmd", "aedpva:cmd",
|
||||||
|
"5-svc:vrf", "asv-5:cmd", "savc-asa:cmd"};
|
||||||
|
THEN("Parsing Throws") {
|
||||||
|
for (size_t i = 0; i != arg.size(); ++i) {
|
||||||
|
REQUIRE_THROWS(p.Parse(arg[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Parse with no arguments results in no command and default id",
|
||||||
|
"[support]") {
|
||||||
|
// build up argc and argv
|
||||||
|
// first argument is the command used to call the binary
|
||||||
int argc = 1;
|
int argc = 1;
|
||||||
char *argv[argc];
|
const char* const argv[]{"call"};
|
||||||
char a0[] = "call";
|
|
||||||
argv[0] = static_cast<char *>(a0);
|
|
||||||
|
|
||||||
CmdLineParser p;
|
CmdLineParser p;
|
||||||
p.Parse(argc, argv);
|
p.Parse(argc, argv);
|
||||||
|
|
||||||
@ -23,25 +131,11 @@ TEST_CASE("Parse with no arguments results in no command and default id") {
|
|||||||
REQUIRE(p.arguments().empty());
|
REQUIRE(p.arguments().empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Parse empty string") {
|
TEST_CASE(
|
||||||
std::string s;
|
"Parse a command without client id and detector id results in default",
|
||||||
CmdLineParser p;
|
"[support]") {
|
||||||
p.Parse(s);
|
|
||||||
|
|
||||||
REQUIRE(p.detector_id() == -1);
|
|
||||||
REQUIRE(p.multi_id() == 0);
|
|
||||||
REQUIRE(p.command().empty());
|
|
||||||
REQUIRE(p.arguments().empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Parse a command without client id and detector id results in default") {
|
|
||||||
int argc = 2;
|
int argc = 2;
|
||||||
char *argv[argc];
|
const char*const argv[]{"caller", "vrf"};
|
||||||
char a0[] = "call";
|
|
||||||
char a1[] = "vrf";
|
|
||||||
argv[0] = static_cast<char *>(a0);
|
|
||||||
argv[1] = static_cast<char *>(a1);
|
|
||||||
|
|
||||||
CmdLineParser p;
|
CmdLineParser p;
|
||||||
p.Parse(argc, argv);
|
p.Parse(argc, argv);
|
||||||
|
|
||||||
@ -51,27 +145,10 @@ TEST_CASE("Parse a command without client id and detector id results in default"
|
|||||||
REQUIRE(p.arguments().empty());
|
REQUIRE(p.arguments().empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Parse a string without client id and detector id results in default") {
|
TEST_CASE("Parse a command with value but without client or detector id",
|
||||||
std::string s = "vrf";
|
"[support]") {
|
||||||
CmdLineParser p;
|
|
||||||
p.Parse(s);
|
|
||||||
|
|
||||||
REQUIRE(p.detector_id() == -1);
|
|
||||||
REQUIRE(p.multi_id() == 0);
|
|
||||||
REQUIRE(p.command() == "vrf");
|
|
||||||
REQUIRE(p.arguments().empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Parse a command with value but without client or detector id") {
|
|
||||||
int argc = 3;
|
int argc = 3;
|
||||||
char *argv[argc];
|
const char* const argv[]{"caller", "vrf", "3000"};
|
||||||
char a0[] = "call";
|
|
||||||
char a1[] = "vrf";
|
|
||||||
char a2[] = "3000";
|
|
||||||
argv[0] = static_cast<char *>(a0);
|
|
||||||
argv[1] = static_cast<char *>(a1);
|
|
||||||
argv[2] = static_cast<char *>(a2);
|
|
||||||
|
|
||||||
CmdLineParser p;
|
CmdLineParser p;
|
||||||
p.Parse(argc, argv);
|
p.Parse(argc, argv);
|
||||||
|
|
||||||
@ -81,26 +158,10 @@ TEST_CASE("Parse a command with value but without client or detector id") {
|
|||||||
REQUIRE(p.arguments().size() == 1);
|
REQUIRE(p.arguments().size() == 1);
|
||||||
REQUIRE(p.arguments()[0] == "3000");
|
REQUIRE(p.arguments()[0] == "3000");
|
||||||
}
|
}
|
||||||
TEST_CASE("Parse a string with value but without client or detector id") {
|
|
||||||
std::string s = "vrf 3000\n";
|
|
||||||
|
|
||||||
CmdLineParser p;
|
|
||||||
p.Parse(s);
|
|
||||||
|
|
||||||
REQUIRE(p.detector_id() == -1);
|
|
||||||
REQUIRE(p.multi_id() == 0);
|
|
||||||
REQUIRE(p.command() == "vrf");
|
|
||||||
REQUIRE(p.arguments().size() == 1);
|
|
||||||
REQUIRE(p.arguments()[0] == "3000");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Decodes position") {
|
TEST_CASE("Decodes position") {
|
||||||
int argc = 2;
|
int argc = 2;
|
||||||
char *argv[argc];
|
const char*const argv[]{"caller", "7:vrf"};
|
||||||
char a0[] = "call";
|
|
||||||
char a1[] = "7:vrf";
|
|
||||||
argv[0] = static_cast<char *>(a0);
|
|
||||||
argv[1] = static_cast<char *>(a1);
|
|
||||||
|
|
||||||
CmdLineParser p;
|
CmdLineParser p;
|
||||||
p.Parse(argc, argv);
|
p.Parse(argc, argv);
|
||||||
@ -110,26 +171,10 @@ TEST_CASE("Decodes position") {
|
|||||||
REQUIRE(p.command() == "vrf");
|
REQUIRE(p.command() == "vrf");
|
||||||
REQUIRE(p.arguments().empty());
|
REQUIRE(p.arguments().empty());
|
||||||
}
|
}
|
||||||
TEST_CASE("Decodes position from string") {
|
|
||||||
std::string s = "7:vrf\n";
|
|
||||||
|
|
||||||
CmdLineParser p;
|
TEST_CASE("Decodes double digit position", "[support]") {
|
||||||
p.Parse(s);
|
|
||||||
|
|
||||||
REQUIRE(p.detector_id() == 7);
|
|
||||||
REQUIRE(p.multi_id() == 0);
|
|
||||||
REQUIRE(p.command() == "vrf");
|
|
||||||
REQUIRE(p.arguments().empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Decodes double digit position") {
|
|
||||||
int argc = 2;
|
int argc = 2;
|
||||||
char *argv[argc];
|
const char* const argv[]{"caller", "73:vcmp"};
|
||||||
char a0[] = "call";
|
|
||||||
char a1[] = "73:vcmp";
|
|
||||||
argv[0] = static_cast<char *>(a0);
|
|
||||||
argv[1] = static_cast<char *>(a1);
|
|
||||||
|
|
||||||
CmdLineParser p;
|
CmdLineParser p;
|
||||||
p.Parse(argc, argv);
|
p.Parse(argc, argv);
|
||||||
|
|
||||||
@ -139,26 +184,9 @@ TEST_CASE("Decodes double digit position") {
|
|||||||
REQUIRE(p.arguments().empty());
|
REQUIRE(p.arguments().empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Decodes double digit position from string") {
|
TEST_CASE("Decodes position and id", "[support]") {
|
||||||
|
|
||||||
std::string s = "73:vcmp";
|
|
||||||
CmdLineParser p;
|
|
||||||
p.Parse(s);
|
|
||||||
|
|
||||||
REQUIRE(p.detector_id() == 73);
|
|
||||||
REQUIRE(p.multi_id() == 0);
|
|
||||||
REQUIRE(p.command() == "vcmp");
|
|
||||||
REQUIRE(p.arguments().empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Decodes position and id") {
|
|
||||||
int argc = 2;
|
int argc = 2;
|
||||||
char *argv[argc];
|
const char* const argv[]{"caller", "5-8:vrf"};
|
||||||
char a0[] = "call";
|
|
||||||
char a1[] = "5-8:vrf";
|
|
||||||
argv[0] = static_cast<char *>(a0);
|
|
||||||
argv[1] = static_cast<char *>(a1);
|
|
||||||
|
|
||||||
CmdLineParser p;
|
CmdLineParser p;
|
||||||
p.Parse(argc, argv);
|
p.Parse(argc, argv);
|
||||||
|
|
||||||
@ -167,94 +195,34 @@ TEST_CASE("Decodes position and id") {
|
|||||||
REQUIRE(p.command() == "vrf");
|
REQUIRE(p.command() == "vrf");
|
||||||
REQUIRE(p.arguments().empty());
|
REQUIRE(p.arguments().empty());
|
||||||
}
|
}
|
||||||
TEST_CASE("Decodes position and id from string") {
|
|
||||||
std::string s = "5-8:vrf";
|
|
||||||
CmdLineParser p;
|
|
||||||
p.Parse(s);
|
|
||||||
|
|
||||||
REQUIRE(p.detector_id() == 8);
|
TEST_CASE("Double digit id", "[support]") {
|
||||||
REQUIRE(p.multi_id() == 5);
|
|
||||||
REQUIRE(p.command() == "vrf");
|
|
||||||
REQUIRE(p.arguments().empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Double digit id") {
|
|
||||||
int argc = 2;
|
int argc = 2;
|
||||||
char *argv[argc];
|
const char *const argv[]{"caller", "56-8:vrf"};
|
||||||
char a0[] = "call";
|
|
||||||
char a1[] = "56-8:vrf";
|
|
||||||
argv[0] = static_cast<char *>(a0);
|
|
||||||
argv[1] = static_cast<char *>(a1);
|
|
||||||
|
|
||||||
CmdLineParser p;
|
CmdLineParser p;
|
||||||
p.Parse(argc, argv);
|
p.Parse(argc, argv);
|
||||||
|
|
||||||
REQUIRE(p.detector_id() == 8);
|
REQUIRE(p.detector_id() == 8);
|
||||||
REQUIRE(p.multi_id() == 56);
|
REQUIRE(p.multi_id() == 56);
|
||||||
REQUIRE(p.command() == "vrf");
|
REQUIRE(p.command() == "vrf");
|
||||||
REQUIRE(p.arguments().empty());
|
REQUIRE(p.arguments().empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Double digit id from string") {
|
TEST_CASE("Calling with wrong id throws invalid_argument", "[support]") {
|
||||||
std::string s = "56-8:vrf";
|
|
||||||
CmdLineParser p;
|
|
||||||
p.Parse(s);
|
|
||||||
|
|
||||||
REQUIRE(p.detector_id() == 8);
|
|
||||||
REQUIRE(p.multi_id() == 56);
|
|
||||||
REQUIRE(p.command() == std::string("vrf"));
|
|
||||||
REQUIRE(p.arguments().empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Calling with wrong id throws invalid_argument") {
|
|
||||||
|
|
||||||
int argc = 2;
|
int argc = 2;
|
||||||
char *argv[argc];
|
const char *const argv[]{"caller", "asvldkn:vrf"};
|
||||||
char a0[] = "call";
|
|
||||||
char a1[] = "asvldkn:vrf";
|
|
||||||
argv[0] = static_cast<char *>(a0);
|
|
||||||
argv[1] = static_cast<char *>(a1);
|
|
||||||
|
|
||||||
CmdLineParser p;
|
CmdLineParser p;
|
||||||
CHECK_THROWS(p.Parse(argc, argv));
|
CHECK_THROWS(p.Parse(argc, argv));
|
||||||
}
|
}
|
||||||
TEST_CASE("Calling with string with wrong id throws invalid_argument") {
|
|
||||||
std::string s = "asvldkn:vrf";
|
|
||||||
CmdLineParser p;
|
|
||||||
CHECK_THROWS(p.Parse(s));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Calling with wrong client throws invalid_argument") {
|
TEST_CASE("Calling with wrong client throws invalid_argument", "[support]") {
|
||||||
int argc = 2;
|
int argc = 2;
|
||||||
char *argv[argc];
|
const char *const argv[]{"caller", "lki-3:vrf"};
|
||||||
char a0[] = "call";
|
|
||||||
char a1[] = "lki-3:vrf";
|
|
||||||
argv[0] = static_cast<char *>(a0);
|
|
||||||
argv[1] = static_cast<char *>(a1);
|
|
||||||
|
|
||||||
CmdLineParser p;
|
CmdLineParser p;
|
||||||
CHECK_THROWS(p.Parse(argc, argv));
|
CHECK_THROWS(p.Parse(argc, argv));
|
||||||
}
|
}
|
||||||
TEST_CASE("Calling with string with wrong client throws invalid_argument") {
|
|
||||||
std::string s = "lki-3:vrf";
|
|
||||||
CmdLineParser p;
|
|
||||||
CHECK_THROWS(p.Parse(s));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Parses string with two arguments") {
|
TEST_CASE("Build up argv", "[support]") {
|
||||||
std::string s = "trimen 3000 4000\n";
|
|
||||||
CmdLineParser p;
|
CmdLineParser p;
|
||||||
p.Parse(s);
|
|
||||||
|
|
||||||
REQUIRE("trimen" == p.command());
|
|
||||||
REQUIRE("3000" == p.arguments()[0]);
|
|
||||||
REQUIRE("4000" == p.arguments()[1]);
|
|
||||||
REQUIRE(p.arguments().size() == 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Build up argv"){
|
|
||||||
CmdLineParser p;
|
|
||||||
// p.argv();
|
|
||||||
REQUIRE(p.argv().empty());
|
REQUIRE(p.argv().empty());
|
||||||
REQUIRE(p.argv().data() == nullptr);
|
REQUIRE(p.argv().data() == nullptr);
|
||||||
|
|
||||||
@ -262,5 +230,4 @@ TEST_CASE("Build up argv"){
|
|||||||
p.Parse(s);
|
p.Parse(s);
|
||||||
REQUIRE(p.argv().data() != nullptr);
|
REQUIRE(p.argv().data() != nullptr);
|
||||||
REQUIRE(p.argv().size() == 3);
|
REQUIRE(p.argv().size() == 3);
|
||||||
|
|
||||||
}
|
}
|
@ -11,9 +11,9 @@ using namespace sls;
|
|||||||
|
|
||||||
TEST_CASE("Convert mac address using classes", "[support]") {
|
TEST_CASE("Convert mac address using classes", "[support]") {
|
||||||
|
|
||||||
std::vector<uint64_t> vec_addr{346856806822, 346856806852, 262027939863028};
|
std::vector<uint64_t> vec_addr{346856806822, 346856806852, 262027939863028,0, 281474976710655};
|
||||||
std::vector<std::string> vec_ans{"00:50:c2:46:d9:a6", "00:50:c2:46:d9:c4",
|
std::vector<std::string> vec_ans{"00:50:c2:46:d9:a6", "00:50:c2:46:d9:c4",
|
||||||
"ee:50:22:46:d9:f4"};
|
"ee:50:22:46:d9:f4", "00:00:00:00:00:00", "ff:ff:ff:ff:ff:ff"};
|
||||||
for (size_t i = 0; i != vec_addr.size(); ++i) {
|
for (size_t i = 0; i != vec_addr.size(); ++i) {
|
||||||
auto mac0 = MacAddr(vec_addr[i]);
|
auto mac0 = MacAddr(vec_addr[i]);
|
||||||
auto mac1 = MacAddr(vec_ans[i]);
|
auto mac1 = MacAddr(vec_ans[i]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user