mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-19 08:17:13 +02:00
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
6964be2aeb | |||
32e3457e84 | |||
97a2a3d7c1 | |||
37a8c61124 | |||
421c2c161a | |||
59eea1a1fd | |||
2b5470ef59 | |||
b5d02ac398 | |||
7536c16a48 | |||
4fe520fdaf | |||
1cfebf667b | |||
23e4dde063 | |||
12c2609978 |
@ -79,6 +79,7 @@ This document describes the differences between v7.0.0 and v6.x.x
|
|||||||
- g2 and m3 clkdiv 2 (system clock) change should affect time settings (g2: exptime, period, delayaftertrigger, burstperiod, m3: exptime, gatedelay, gateperiod, period, delayaftertrigger)
|
- g2 and m3 clkdiv 2 (system clock) change should affect time settings (g2: exptime, period, delayaftertrigger, burstperiod, m3: exptime, gatedelay, gateperiod, period, delayaftertrigger)
|
||||||
- g2 system frequency is the same irrespective of timing source
|
- g2 system frequency is the same irrespective of timing source
|
||||||
- (apparently) rxr doesnt get stuck anymore from 6.1.1
|
- (apparently) rxr doesnt get stuck anymore from 6.1.1
|
||||||
|
-rx_bunchsize, (default fifodepth for g2 changed to 50)
|
||||||
- rxr mem size changed (fifo header size from 8 to 16) due to sls rxr header = 112.. 112+ 16=128 (reduces packet losss especially for g2)
|
- rxr mem size changed (fifo header size from 8 to 16) due to sls rxr header = 112.. 112+ 16=128 (reduces packet losss especially for g2)
|
||||||
-udp_srcip and udp_Srcip2: can set to auto (for virtual or 1g data networks)
|
-udp_srcip and udp_Srcip2: can set to auto (for virtual or 1g data networks)
|
||||||
- set dataset name for all hdf5 files to "data" only
|
- set dataset name for all hdf5 files to "data" only
|
||||||
|
118
cmk.sh
118
cmk.sh
@ -18,7 +18,6 @@ CTBGUI=0
|
|||||||
MANUALS=0
|
MANUALS=0
|
||||||
MANUALS_ONLY_RST=0
|
MANUALS_ONLY_RST=0
|
||||||
MOENCHZMQ=0
|
MOENCHZMQ=0
|
||||||
ZMQ_HINT_DIR=""
|
|
||||||
|
|
||||||
|
|
||||||
CLEAN=0
|
CLEAN=0
|
||||||
@ -27,26 +26,25 @@ CMAKE_PRE=""
|
|||||||
CMAKE_POST=""
|
CMAKE_POST=""
|
||||||
|
|
||||||
usage() { echo -e "
|
usage() { echo -e "
|
||||||
Usage: $0 [-b] [-c] [-d <HDF5 directory>] [e] [g] [-h] [i] [-j <Number of threads>] [-k <CMake command>] [-l <Install directory>] [m] [n] [-p] [-q <Zmq hint directory>] [r] [s] [t] [u] [z]
|
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [m] [n] [-h] [z] [-d <HDF5 directory>] [-l Install directory] [-k <CMake command>] [-j <Number of threads>]
|
||||||
-[no option]: only make
|
-[no option]: only make
|
||||||
-b: Builds/Rebuilds CMake files normal mode
|
|
||||||
-c: Clean
|
-c: Clean
|
||||||
-d: HDF5 Custom Directory
|
-b: Builds/Rebuilds CMake files normal mode
|
||||||
-e: Debug mode
|
-p: Builds/Rebuilds Python API
|
||||||
-g: Build/Rebuilds only gui
|
|
||||||
-h: Builds/Rebuilds Cmake files with HDF5 package
|
-h: Builds/Rebuilds Cmake files with HDF5 package
|
||||||
-i: Builds tests
|
-d: HDF5 Custom Directory
|
||||||
-j: Number of threads to compile through
|
|
||||||
-k: CMake command
|
-k: CMake command
|
||||||
-l: Install directory
|
-l: Install directory
|
||||||
|
-t: Build/Rebuilds only text client
|
||||||
|
-r: Build/Rebuilds only receiver
|
||||||
|
-g: Build/Rebuilds only gui
|
||||||
|
-s: Simulator
|
||||||
|
-u: Chip Test Gui
|
||||||
|
-j: Number of threads to compile through
|
||||||
|
-e: Debug mode
|
||||||
|
-i: Builds tests
|
||||||
-m: Manuals
|
-m: Manuals
|
||||||
-n: Manuals without compiling doxygen (only rst)
|
-n: Manuals without compiling doxygen (only rst)
|
||||||
-p: Builds/Rebuilds Python API
|
|
||||||
-q: Zmq hint directory
|
|
||||||
-r: Build/Rebuilds only receiver
|
|
||||||
-s: Simulator
|
|
||||||
-t: Build/Rebuilds only text client
|
|
||||||
-u: Chip Test Gui
|
|
||||||
-z: Moench zmq processor
|
-z: Moench zmq processor
|
||||||
|
|
||||||
Rebuild when you switch to a new build and compile in parallel:
|
Rebuild when you switch to a new build and compile in parallel:
|
||||||
@ -83,49 +81,68 @@ For rebuilding only certain sections
|
|||||||
|
|
||||||
" ; exit 1; }
|
" ; exit 1; }
|
||||||
|
|
||||||
while getopts ":bcd:eghij:k:l:mnpq:rstuz" opt ; do
|
while getopts ":bpchd:k:l:j:trgeisumnz" opt ; do
|
||||||
case $opt in
|
case $opt in
|
||||||
b)
|
b)
|
||||||
echo "Building of CMake files Required"
|
echo "Building of CMake files Required"
|
||||||
REBUILD=1
|
REBUILD=1
|
||||||
;;
|
;;
|
||||||
|
p)
|
||||||
|
echo "Compiling Options: Python"
|
||||||
|
PYTHON=1
|
||||||
|
REBUILD=1
|
||||||
|
;;
|
||||||
c)
|
c)
|
||||||
echo "Clean Required"
|
echo "Clean Required"
|
||||||
CLEAN=1
|
CLEAN=1
|
||||||
;;
|
;;
|
||||||
|
h)
|
||||||
|
echo "Building of CMake files with HDF5 option Required"
|
||||||
|
HDF5=1
|
||||||
|
REBUILD=1
|
||||||
|
;;
|
||||||
d)
|
d)
|
||||||
echo "New HDF5 directory: $OPTARG"
|
echo "New HDF5 directory: $OPTARG"
|
||||||
HDF5DIR=$OPTARG
|
HDF5DIR=$OPTARG
|
||||||
;;
|
;;
|
||||||
e)
|
l)
|
||||||
echo "Compiling Options: Debug"
|
echo "CMake install directory: $OPTARG"
|
||||||
DEBUG=1
|
INSTALLDIR="$OPTARG"
|
||||||
|
;;
|
||||||
|
k)
|
||||||
|
echo "CMake command: $OPTARG"
|
||||||
|
CMAKE="$OPTARG"
|
||||||
|
;;
|
||||||
|
j)
|
||||||
|
echo "Number of compiler threads: $OPTARG"
|
||||||
|
COMPILERTHREADS=$OPTARG
|
||||||
|
;;
|
||||||
|
t)
|
||||||
|
echo "Compiling Options: Text Client"
|
||||||
|
TEXTCLIENT=1
|
||||||
|
REBUILD=1
|
||||||
|
;;
|
||||||
|
r)
|
||||||
|
echo "Compiling Options: Receiver"
|
||||||
|
RECEIVER=1
|
||||||
|
REBUILD=1
|
||||||
;;
|
;;
|
||||||
g)
|
g)
|
||||||
echo "Compiling Options: GUI"
|
echo "Compiling Options: GUI"
|
||||||
GUI=1
|
GUI=1
|
||||||
REBUILD=1
|
REBUILD=1
|
||||||
;;
|
;;
|
||||||
h)
|
e)
|
||||||
echo "Building of CMake files with HDF5 option Required"
|
echo "Compiling Options: Debug"
|
||||||
HDF5=1
|
DEBUG=1
|
||||||
REBUILD=1
|
|
||||||
;;
|
;;
|
||||||
i)
|
i)
|
||||||
echo "Compiling Options: Tests"
|
echo "Compiling Options: Tests"
|
||||||
TESTS=1
|
TESTS=1
|
||||||
;;
|
;;
|
||||||
j)
|
s)
|
||||||
echo "Number of compiler threads: $OPTARG"
|
echo "Compiling Options: Simulator"
|
||||||
COMPILERTHREADS=$OPTARG
|
SIMULATOR=1
|
||||||
;;
|
|
||||||
k)
|
|
||||||
echo "CMake command: $OPTARG"
|
|
||||||
CMAKE="$OPTARG"
|
|
||||||
;;
|
|
||||||
l)
|
|
||||||
echo "CMake install directory: $OPTARG"
|
|
||||||
INSTALLDIR="$OPTARG"
|
|
||||||
;;
|
;;
|
||||||
m)
|
m)
|
||||||
echo "Compiling Manuals"
|
echo "Compiling Manuals"
|
||||||
@ -135,37 +152,14 @@ while getopts ":bcd:eghij:k:l:mnpq:rstuz" opt ; do
|
|||||||
echo "Compiling Manuals (Only RST)"
|
echo "Compiling Manuals (Only RST)"
|
||||||
MANUALS_ONLY_RST=1
|
MANUALS_ONLY_RST=1
|
||||||
;;
|
;;
|
||||||
p)
|
z)
|
||||||
echo "Compiling Options: Python"
|
echo "Compiling Moench Zmq Processor"
|
||||||
PYTHON=1
|
MOENCHZMQ=1
|
||||||
REBUILD=1
|
|
||||||
;;
|
|
||||||
q)
|
|
||||||
echo "Zmq hint directory: $OPTARG"
|
|
||||||
ZMQ_HINT_DIR=$OPTARG
|
|
||||||
;;
|
|
||||||
r)
|
|
||||||
echo "Compiling Options: Receiver"
|
|
||||||
RECEIVER=1
|
|
||||||
REBUILD=1
|
|
||||||
;;
|
|
||||||
s)
|
|
||||||
echo "Compiling Options: Simulator"
|
|
||||||
SIMULATOR=1
|
|
||||||
;;
|
|
||||||
t)
|
|
||||||
echo "Compiling Options: Text Client"
|
|
||||||
TEXTCLIENT=1
|
|
||||||
REBUILD=1
|
|
||||||
;;
|
;;
|
||||||
u)
|
u)
|
||||||
echo "Compiling Options: Chip Test Gui"
|
echo "Compiling Options: Chip Test Gui"
|
||||||
CTBGUI=1
|
CTBGUI=1
|
||||||
;;
|
;;
|
||||||
z)
|
|
||||||
echo "Compiling Moench Zmq Processor"
|
|
||||||
MOENCHZMQ=1
|
|
||||||
;;
|
|
||||||
\?)
|
\?)
|
||||||
echo "Invalid option: -$OPTARG"
|
echo "Invalid option: -$OPTARG"
|
||||||
usage
|
usage
|
||||||
@ -260,12 +254,6 @@ if [ $TESTS -eq 1 ]; then
|
|||||||
echo "Tests Option enabled"
|
echo "Tests Option enabled"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#zmq hint dir
|
|
||||||
if [ -n "$ZMQ_HINT_DIR" ]; then
|
|
||||||
CMAKE_POST+=" -DZeroMQ_HINT="$ZMQ_HINT_DIR
|
|
||||||
CMAKE_POST+=" -DZeroMQ_DIR="
|
|
||||||
# echo "Enabling Zmq Hint Directory: $ZMQ_HINT_DIR"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#hdf5 rebuild
|
#hdf5 rebuild
|
||||||
if [ $HDF5 -eq 1 ]; then
|
if [ $HDF5 -eq 1 ]; then
|
||||||
|
@ -828,14 +828,14 @@ void ctbAcquisition::setCanvas(TCanvas* c) {
|
|||||||
myCanvas->AddExec("dynamic",Form("((ctbAcquisition*)%p)->canvasClicked()",this));
|
myCanvas->AddExec("dynamic",Form("((ctbAcquisition*)%p)->canvasClicked()",this));
|
||||||
// myCanvas->AddExec("ex","canvasClicked()");
|
// myCanvas->AddExec("ex","canvasClicked()");
|
||||||
}
|
}
|
||||||
void ctbAcquisition::dataCallback(sls::detectorData *data, long unsigned int index, unsigned int dum, void* pArgs) {
|
void ctbAcquisition::dataCallback(detectorData *data, long unsigned int index, unsigned int dum, void* pArgs) {
|
||||||
|
|
||||||
// return
|
// return
|
||||||
((ctbAcquisition*)pArgs)->plotData(data,index);
|
((ctbAcquisition*)pArgs)->plotData(data,index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ctbAcquisition::plotData(sls::detectorData *data, int index) {
|
int ctbAcquisition::plotData(detectorData *data, int index) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
******************************************************************
|
******************************************************************
|
||||||
|
@ -28,8 +28,8 @@ class TGTextButton;
|
|||||||
namespace sls
|
namespace sls
|
||||||
{
|
{
|
||||||
class Detector;
|
class Detector;
|
||||||
class detectorData;
|
|
||||||
};
|
};
|
||||||
|
class detectorData;
|
||||||
|
|
||||||
template <class dataType> class slsDetectorData;
|
template <class dataType> class slsDetectorData;
|
||||||
|
|
||||||
@ -201,10 +201,10 @@ class ctbAcquisition : public TGGroupFrame {
|
|||||||
void setBitGraph (int i ,int en, Pixel_t col);
|
void setBitGraph (int i ,int en, Pixel_t col);
|
||||||
void startAcquisition();
|
void startAcquisition();
|
||||||
static void progressCallback(double,void*);
|
static void progressCallback(double,void*);
|
||||||
static void dataCallback(sls::detectorData*, long unsigned int, unsigned int, void*);
|
static void dataCallback(detectorData*, long unsigned int, unsigned int, void*);
|
||||||
int StopFlag;
|
int StopFlag;
|
||||||
|
|
||||||
int plotData(sls::detectorData*, int);
|
int plotData(detectorData*, int);
|
||||||
|
|
||||||
void setPatternFile(const char* t);
|
void setPatternFile(const char* t);
|
||||||
|
|
||||||
|
@ -409,18 +409,18 @@ patword 018d 0008599f0008503a
|
|||||||
patioctrl 8f0effff6dbffdbf
|
patioctrl 8f0effff6dbffdbf
|
||||||
patclkctrl 0000000000000000
|
patclkctrl 0000000000000000
|
||||||
patlimits 0000 018c
|
patlimits 0000 018c
|
||||||
patloop 0 013a 016b
|
patloop0 013a 016b
|
||||||
patnloop 0 199
|
patnloop0 199
|
||||||
patloop 1 0400 0400
|
patloop1 0400 0400
|
||||||
patnloop 1 0
|
patnloop1 0
|
||||||
patloop 2 0400 0400
|
patloop2 0400 0400
|
||||||
patnloop 2 0
|
patnloop2 0
|
||||||
patwait 0 00aa
|
patwait0 00aa
|
||||||
patwaittime 0 10000
|
patwaittime0 10000
|
||||||
patwait 1 0400
|
patwait1 0400
|
||||||
patwaittime 1 0
|
patwaittime1 0
|
||||||
patwait 2 0400
|
patwait2 0400
|
||||||
patwaittime 2 0
|
patwaittime2 0
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
### edit with hostname or 1Gbs IP address of your server
|
### edit with hostname or 1Gbs IP address of your server
|
||||||
|
@ -427,18 +427,18 @@ patword 0x018c 0x0008599f0008503a
|
|||||||
patword 0x018d 0x0008599f0008503a
|
patword 0x018d 0x0008599f0008503a
|
||||||
patioctrl 0x8f0effff6dbffdbf
|
patioctrl 0x8f0effff6dbffdbf
|
||||||
patlimits 0x0000 0x018c
|
patlimits 0x0000 0x018c
|
||||||
patloop 0 0x013a 0x016b
|
patloop0 0x013a 0x016b
|
||||||
patnloop 0 0x199
|
patnloop0 0x199
|
||||||
patloop 1 0x0400 0x0400
|
patloop1 0x0400 0x0400
|
||||||
patnloop 1 0
|
patnloop1 0
|
||||||
patloop 2 0x0400 0x0400
|
patloop2 0x0400 0x0400
|
||||||
patnloop 2 0
|
patnloop2 0
|
||||||
patwait 0 0x00aa
|
patwait0 0x00aa
|
||||||
patwaittime 0 10000
|
patwaittime0 10000
|
||||||
patwait 1 0x0400
|
patwait1 0x0400
|
||||||
patwaittime 1 0
|
patwaittime1 0
|
||||||
patwait 2 0x0400
|
patwait2 0x0400
|
||||||
patwaittime 2 0
|
patwaittime2 0
|
||||||
|
|
||||||
# dacs
|
# dacs
|
||||||
dac 6 800
|
dac 6 800
|
||||||
|
@ -29,7 +29,6 @@ set( PYTHON_FILES
|
|||||||
decorators.py
|
decorators.py
|
||||||
detector_property.py
|
detector_property.py
|
||||||
detector.py
|
detector.py
|
||||||
defines.py
|
|
||||||
eiger.py
|
eiger.py
|
||||||
enums.py
|
enums.py
|
||||||
errors.py
|
errors.py
|
||||||
|
@ -11,7 +11,7 @@ enums.cpp
|
|||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from parse import remove_comments, remove_ifdefs
|
from parse import remove_comments
|
||||||
|
|
||||||
|
|
||||||
allow_bitwise_op = ["streamingInterface", "M3_GainCaps"]
|
allow_bitwise_op = ["streamingInterface", "M3_GainCaps"]
|
||||||
@ -98,25 +98,25 @@ def generate_enum_string(enums):
|
|||||||
return ''.join(data)
|
return ''.join(data)
|
||||||
|
|
||||||
|
|
||||||
# def remove_ifdefs(lines):
|
def remove_ifdefs(lines):
|
||||||
# """Keeps C++ version of the code"""
|
"""Keeps C++ version of the code"""
|
||||||
# out = []
|
out = []
|
||||||
# it = iter(lines)
|
it = iter(lines)
|
||||||
# skip = False
|
skip = False
|
||||||
# for line in it:
|
for line in it:
|
||||||
|
|
||||||
# if "#ifdef __cplusplus" in line:
|
if "#ifdef __cplusplus" in line:
|
||||||
# line = next(it)
|
line = next(it)
|
||||||
|
|
||||||
# if "#else" in line:
|
if "#else" in line:
|
||||||
# skip = True
|
skip = True
|
||||||
|
|
||||||
# if "#endif" in line:
|
if "#endif" in line:
|
||||||
# skip = False
|
skip = False
|
||||||
|
|
||||||
# if not skip and "#endif" not in line:
|
if not skip and "#endif" not in line:
|
||||||
# out.append(line)
|
out.append(line)
|
||||||
# return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
with open('../../slsSupportLib/include/sls/sls_detector_defs.h') as f:
|
with open('../../slsSupportLib/include/sls/sls_detector_defs.h') as f:
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
import re
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
from parse import remove_comments, remove_ifdefs
|
|
||||||
|
|
||||||
with open('../../slsSupportLib/include/sls/sls_detector_defs.h') as f:
|
|
||||||
data = f.read()
|
|
||||||
|
|
||||||
data = remove_comments(data)
|
|
||||||
data = data.splitlines()
|
|
||||||
# data = remove_ifdefs(data)
|
|
||||||
|
|
||||||
|
|
||||||
ignore = ['#define MYROOT', '#define __cplusplus']
|
|
||||||
|
|
||||||
defines = {}
|
|
||||||
for i, line in enumerate(data):
|
|
||||||
if line.startswith('#define') and line not in ignore:
|
|
||||||
_, name, value = line.split(maxsplit = 2)
|
|
||||||
print(f'{name}={value}')
|
|
||||||
defines[name]=value
|
|
||||||
|
|
||||||
|
|
||||||
warning = '#WARINING This file is auto generated any edits might be overwritten without warning\n\n'
|
|
||||||
with open('../slsdet/defines.py', 'w') as f:
|
|
||||||
f.write(warning)
|
|
||||||
for key, value in defines.items():
|
|
||||||
f.write(f'{key}={value}\n')
|
|
@ -25,25 +25,7 @@ def remove_comments(text):
|
|||||||
)
|
)
|
||||||
return re.sub(pattern, replacer, text)
|
return re.sub(pattern, replacer, text)
|
||||||
|
|
||||||
def remove_ifdefs(lines):
|
|
||||||
"""Keeps C++ version of the code"""
|
|
||||||
out = []
|
|
||||||
it = iter(lines)
|
|
||||||
skip = False
|
|
||||||
for line in it:
|
|
||||||
|
|
||||||
if "#ifdef __cplusplus" in line:
|
|
||||||
line = next(it)
|
|
||||||
|
|
||||||
if "#else" in line:
|
|
||||||
skip = True
|
|
||||||
|
|
||||||
if "#endif" in line:
|
|
||||||
skip = False
|
|
||||||
|
|
||||||
if not skip and "#endif" not in line:
|
|
||||||
out.append(line)
|
|
||||||
return out
|
|
||||||
|
|
||||||
|
|
||||||
#based on ccsyspath: https://github.com/AndrewWalker/ccsyspath
|
#based on ccsyspath: https://github.com/AndrewWalker/ccsyspath
|
||||||
|
@ -17,9 +17,8 @@ import _slsdet
|
|||||||
xy = _slsdet.xy
|
xy = _slsdet.xy
|
||||||
defs = _slsdet.slsDetectorDefs
|
defs = _slsdet.slsDetectorDefs
|
||||||
|
|
||||||
#Make enums and #defines available at top level
|
|
||||||
from .enums import *
|
from .enums import *
|
||||||
from .defines import *
|
|
||||||
|
|
||||||
IpAddr = _slsdet.IpAddr
|
IpAddr = _slsdet.IpAddr
|
||||||
MacAddr = _slsdet.MacAddr
|
MacAddr = _slsdet.MacAddr
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
#WARINING This file is auto generated any edits might be overwritten without warning
|
|
||||||
|
|
||||||
BIT32_MASK=0xFFFFFFFF
|
|
||||||
MAX_RX_DBIT=64
|
|
||||||
DEFAULT_PORTNO=1952
|
|
||||||
DEFAULT_UDP_PORTNO=50001
|
|
||||||
DEFAULT_ZMQ_CL_PORTNO=30001
|
|
||||||
DEFAULT_ZMQ_RX_PORTNO=30001
|
|
||||||
DEFAULT_UDP_SRC_PORTNO=32410
|
|
||||||
DEFAULT_UDP_DST_PORTNO=50001
|
|
||||||
MAX_UDP_DESTINATION=32
|
|
||||||
SLS_DETECTOR_HEADER_VERSION=0x2
|
|
||||||
SLS_DETECTOR_JSON_HEADER_VERSION=0x4
|
|
||||||
UDP_PACKET_DATA_BYTES=(1344)
|
|
||||||
MAX_TRIMEN=100
|
|
||||||
MAX_BLACKFIN_PROGRAM_SIZE=(128 * 1024)
|
|
||||||
GET_FLAG=-1
|
|
||||||
DEFAULT_DET_MAC="00:aa:bb:cc:dd:ee"
|
|
||||||
DEFAULT_DET_IP="129.129.202.45"
|
|
||||||
DEFAULT_DET_MAC2="00:aa:bb:cc:dd:ff"
|
|
||||||
DEFAULT_DET_IP2="129.129.202.46"
|
|
||||||
LOCALHOST_IP="127.0.0.1"
|
|
||||||
MAX_STR_LENGTH=1000
|
|
||||||
SHORT_STR_LENGTH=20
|
|
||||||
MAX_PATTERN_LENGTH=0x2000
|
|
||||||
MAX_PATTERN_LEVELS=6
|
|
||||||
M3_MAX_PATTERN_LEVELS=3
|
|
||||||
DEFAULT_STREAMING_TIMER_IN_MS=500
|
|
||||||
NUM_RX_THREAD_IDS=9
|
|
||||||
MAX_NUM_PACKETS=512
|
|
||||||
TRIMBITMASK=0x3f
|
|
@ -17,7 +17,7 @@ from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask
|
|||||||
from .utils import Geometry, to_geo, element, reduce_time, is_iterable
|
from .utils import Geometry, to_geo, element, reduce_time, is_iterable
|
||||||
from _slsdet import xy
|
from _slsdet import xy
|
||||||
from . import utils as ut
|
from . import utils as ut
|
||||||
from .proxy import JsonProxy, SlowAdcProxy, ClkDivProxy, MaxPhaseProxy, ClkFreqProxy, PatLoopProxy, PatNLoopProxy, PatWaitProxy, PatWaitTimeProxy
|
from .proxy import JsonProxy, SlowAdcProxy, ClkDivProxy, MaxPhaseProxy, ClkFreqProxy
|
||||||
from .registers import Register, Adc_register
|
from .registers import Register, Adc_register
|
||||||
import datetime as dt
|
import datetime as dt
|
||||||
|
|
||||||
@ -3098,24 +3098,6 @@ class Detector(CppDetectorApi):
|
|||||||
def patmask(self, mask):
|
def patmask(self, mask):
|
||||||
ut.set_using_dict(self.setPatternMask, mask)
|
ut.set_using_dict(self.setPatternMask, mask)
|
||||||
|
|
||||||
@property
|
|
||||||
# @element
|
|
||||||
def patwait(self):
|
|
||||||
"""
|
|
||||||
[Ctb][Moench][Mythen3] Wait address of loop level provided.
|
|
||||||
|
|
||||||
Example
|
|
||||||
-------
|
|
||||||
>>> d.patwait[0] = 5
|
|
||||||
>>> d.patwait[0]
|
|
||||||
5
|
|
||||||
>>> d.patwait
|
|
||||||
0: 5
|
|
||||||
1: 20
|
|
||||||
2: 30
|
|
||||||
"""
|
|
||||||
return PatWaitProxy(self)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def patwait0(self):
|
def patwait0(self):
|
||||||
@ -3176,23 +3158,6 @@ class Detector(CppDetectorApi):
|
|||||||
addr = ut.merge_args(2, addr)
|
addr = ut.merge_args(2, addr)
|
||||||
ut.set_using_dict(self.setPatternWaitAddr, *addr)
|
ut.set_using_dict(self.setPatternWaitAddr, *addr)
|
||||||
|
|
||||||
@property
|
|
||||||
def patwaittime(self):
|
|
||||||
"""
|
|
||||||
[Ctb][Moench][Mythen3] Wait time in clock cycles of loop level provided.
|
|
||||||
|
|
||||||
Example
|
|
||||||
-------
|
|
||||||
>>> d.patwaittime[0] = 5
|
|
||||||
>>> d.patwaittime[0]
|
|
||||||
5
|
|
||||||
>>> d.patwaittime
|
|
||||||
0: 5
|
|
||||||
1: 20
|
|
||||||
2: 30
|
|
||||||
"""
|
|
||||||
return PatWaitTimeProxy(self)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def patwaittime0(self):
|
def patwaittime0(self):
|
||||||
@ -3227,23 +3192,6 @@ class Detector(CppDetectorApi):
|
|||||||
ut.set_using_dict(self.setPatternWaitTime, *nclk)
|
ut.set_using_dict(self.setPatternWaitTime, *nclk)
|
||||||
|
|
||||||
|
|
||||||
@property
|
|
||||||
def patloop(self):
|
|
||||||
"""
|
|
||||||
[Ctb][Moench][Mythen3] Limits (start and stop address) of the loop provided.
|
|
||||||
|
|
||||||
Example
|
|
||||||
-------
|
|
||||||
>>> d.patloop[0] = [5, 20]
|
|
||||||
>>> d.patloop[0]
|
|
||||||
[5, 20]
|
|
||||||
>>> d.patloop
|
|
||||||
0: [5, 20]
|
|
||||||
1: [20, 4]
|
|
||||||
2: [30, 5]
|
|
||||||
"""
|
|
||||||
return PatLoopProxy(self)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def patloop0(self):
|
def patloop0(self):
|
||||||
@ -3306,24 +3254,6 @@ class Detector(CppDetectorApi):
|
|||||||
addr = ut.merge_args(2, addr)
|
addr = ut.merge_args(2, addr)
|
||||||
ut.set_using_dict(self.setPatternLoopAddresses, *addr)
|
ut.set_using_dict(self.setPatternLoopAddresses, *addr)
|
||||||
|
|
||||||
|
|
||||||
@property
|
|
||||||
def patnloop(self):
|
|
||||||
"""
|
|
||||||
[Ctb][Moench][Mythen3] Number of cycles of the loop provided.
|
|
||||||
|
|
||||||
Example
|
|
||||||
-------
|
|
||||||
>>> d.patnloop[0] = 5
|
|
||||||
>>> d.patnloop[0]
|
|
||||||
5
|
|
||||||
>>> d.patnloop
|
|
||||||
0: 5
|
|
||||||
1: 20
|
|
||||||
2: 30
|
|
||||||
"""
|
|
||||||
return PatNLoopProxy(self)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def patnloop0(self):
|
def patnloop0(self):
|
||||||
|
@ -2,25 +2,15 @@
|
|||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
from .utils import element_if_equal
|
from .utils import element_if_equal
|
||||||
from .enums import dacIndex
|
from .enums import dacIndex
|
||||||
from .defines import M3_MAX_PATTERN_LEVELS, MAX_PATTERN_LEVELS
|
|
||||||
from _slsdet import slsDetectorDefs
|
|
||||||
|
|
||||||
|
|
||||||
def set_proxy_using_dict(func, key, value, unpack = False):
|
def set_proxy_using_dict(func, key, value):
|
||||||
if isinstance(value, dict) and all(isinstance(k, int) for k in value.keys()):
|
if isinstance(value, dict) and all(isinstance(k, int) for k in value.keys()):
|
||||||
if unpack:
|
|
||||||
for dkey, dvalue in value.items():
|
|
||||||
func(key, *dvalue, [dkey])
|
|
||||||
else:
|
|
||||||
for dkey, dvalue in value.items():
|
for dkey, dvalue in value.items():
|
||||||
func(key, dvalue, [dkey])
|
func(key, dvalue, [dkey])
|
||||||
else:
|
|
||||||
if unpack:
|
|
||||||
func(key, *value)
|
|
||||||
else:
|
else:
|
||||||
func(key, value)
|
func(key, value)
|
||||||
|
|
||||||
|
|
||||||
class JsonProxy:
|
class JsonProxy:
|
||||||
"""
|
"""
|
||||||
Proxy class to allow for intuitive setting and getting of rx_jsonpara
|
Proxy class to allow for intuitive setting and getting of rx_jsonpara
|
||||||
@ -138,117 +128,3 @@ class ClkFreqProxy:
|
|||||||
rstr += f'{i}: {r}\n'
|
rstr += f'{i}: {r}\n'
|
||||||
|
|
||||||
return rstr.strip('\n')
|
return rstr.strip('\n')
|
||||||
|
|
||||||
class PatLoopProxy:
|
|
||||||
"""
|
|
||||||
Proxy class to allow for more intuitive reading patloop
|
|
||||||
"""
|
|
||||||
def __init__(self, det):
|
|
||||||
self.det = det
|
|
||||||
|
|
||||||
def __getitem__(self, key):
|
|
||||||
return element_if_equal(self.det.getPatternLoopAddresses(key))
|
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
|
||||||
set_proxy_using_dict(self.det.setPatternLoopAddresses, key, value, unpack = True)
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
max_levels = MAX_PATTERN_LEVELS
|
|
||||||
if self.det.type == slsDetectorDefs.detectorType.MYTHEN3:
|
|
||||||
max_levels = M3_MAX_PATTERN_LEVELS
|
|
||||||
rstr = ''
|
|
||||||
for i in range(max_levels):
|
|
||||||
r = self.__getitem__(i)
|
|
||||||
if isinstance(r[0], list):
|
|
||||||
part = ' '.join(f'{item}' for item in r)
|
|
||||||
rstr += f'{i}: {part}\n'
|
|
||||||
else:
|
|
||||||
rstr += f'{i}: {r}\n'
|
|
||||||
|
|
||||||
return rstr.strip('\n')
|
|
||||||
|
|
||||||
|
|
||||||
class PatNLoopProxy:
|
|
||||||
"""
|
|
||||||
Proxy class to allow for more intuitive reading patnloop
|
|
||||||
"""
|
|
||||||
def __init__(self, det):
|
|
||||||
self.det = det
|
|
||||||
|
|
||||||
def __getitem__(self, key):
|
|
||||||
return element_if_equal(self.det.getPatternLoopCycles(key))
|
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
|
||||||
set_proxy_using_dict(self.det.setPatternLoopCycles, key, value)
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
max_levels = MAX_PATTERN_LEVELS
|
|
||||||
if self.det.type == slsDetectorDefs.detectorType.MYTHEN3:
|
|
||||||
max_levels = M3_MAX_PATTERN_LEVELS
|
|
||||||
rstr = ''
|
|
||||||
for i in range(max_levels):
|
|
||||||
r = element_if_equal(self.__getitem__(i))
|
|
||||||
if isinstance(r, list):
|
|
||||||
part = ', '.join(f'{item}' for item in r)
|
|
||||||
rstr += f'{i}: {part}\n'
|
|
||||||
else:
|
|
||||||
rstr += f'{i}: {r}\n'
|
|
||||||
|
|
||||||
return rstr.strip('\n')
|
|
||||||
|
|
||||||
|
|
||||||
class PatWaitProxy:
|
|
||||||
"""
|
|
||||||
Proxy class to allow for more intuitive reading patwait
|
|
||||||
"""
|
|
||||||
def __init__(self, det):
|
|
||||||
self.det = det
|
|
||||||
|
|
||||||
def __getitem__(self, key):
|
|
||||||
return element_if_equal(self.det.getPatternWaitAddr(key))
|
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
|
||||||
set_proxy_using_dict(self.det.setPatternWaitAddr, key, value)
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
max_levels = MAX_PATTERN_LEVELS
|
|
||||||
if self.det.type == slsDetectorDefs.detectorType.MYTHEN3:
|
|
||||||
max_levels = M3_MAX_PATTERN_LEVELS
|
|
||||||
rstr = ''
|
|
||||||
for i in range(max_levels):
|
|
||||||
r = element_if_equal(self.__getitem__(i))
|
|
||||||
if isinstance(r, list):
|
|
||||||
part = ', '.join(f'{item}' for item in r)
|
|
||||||
rstr += f'{i}: {part}\n'
|
|
||||||
else:
|
|
||||||
rstr += f'{i}: {r}\n'
|
|
||||||
|
|
||||||
return rstr.strip('\n')
|
|
||||||
|
|
||||||
class PatWaitTimeProxy:
|
|
||||||
"""
|
|
||||||
Proxy class to allow for more intuitive reading patwaittime
|
|
||||||
"""
|
|
||||||
def __init__(self, det):
|
|
||||||
self.det = det
|
|
||||||
|
|
||||||
def __getitem__(self, key):
|
|
||||||
return element_if_equal(self.det.getPatternWaitTime(key))
|
|
||||||
|
|
||||||
def __setitem__(self, key, value):
|
|
||||||
set_proxy_using_dict(self.det.setPatternWaitTime, key, value)
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
max_levels = MAX_PATTERN_LEVELS
|
|
||||||
if self.det.type == slsDetectorDefs.detectorType.MYTHEN3:
|
|
||||||
max_levels = M3_MAX_PATTERN_LEVELS
|
|
||||||
rstr = ''
|
|
||||||
for i in range(max_levels):
|
|
||||||
r = element_if_equal(self.__getitem__(i))
|
|
||||||
if isinstance(r, list):
|
|
||||||
part = ', '.join(f'{item}' for item in r)
|
|
||||||
rstr += f'{i}: {part}\n'
|
|
||||||
else:
|
|
||||||
rstr += f'{i}: {r}\n'
|
|
||||||
|
|
||||||
return rstr.strip('\n')
|
|
||||||
|
@ -14,7 +14,7 @@ void init_pattern(py::module &m) {
|
|||||||
using pat = sls::patternParameters;
|
using pat = sls::patternParameters;
|
||||||
py::class_<pat> patternParameters(m, "patternParameters");
|
py::class_<pat> patternParameters(m, "patternParameters");
|
||||||
|
|
||||||
PYBIND11_NUMPY_DTYPE(pat, word, ioctrl, limits, startloop, stoploop, nloop, wait,
|
PYBIND11_NUMPY_DTYPE(pat, word, ioctrl, limits, loop, nloop, wait,
|
||||||
waittime);
|
waittime);
|
||||||
|
|
||||||
patternParameters.def(py::init());
|
patternParameters.def(py::init());
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
#include <qwt_symbol.h>
|
#include <qwt_symbol.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <array>
|
|
||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
|
|
||||||
#define QwtLog10ScaleEngine QwtLogScaleEngine // hmm
|
#define QwtLog10ScaleEngine QwtLogScaleEngine // hmm
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
#include "SlsQt2DPlot.h"
|
#include "SlsQt2DPlot.h"
|
||||||
// #include "sls/ansi.h"
|
// #include "sls/ansi.h"
|
||||||
#include <array>
|
|
||||||
|
|
||||||
#include <qlist.h>
|
#include <qlist.h>
|
||||||
#include <qprinter.h>
|
#include <qprinter.h>
|
||||||
|
@ -568,72 +568,6 @@
|
|||||||
#define PATTERN_SET_LSB_REG (0x82 << MEM_MAP_SHIFT)
|
#define PATTERN_SET_LSB_REG (0x82 << MEM_MAP_SHIFT)
|
||||||
#define PATTERN_SET_MSB_REG (0x83 << MEM_MAP_SHIFT)
|
#define PATTERN_SET_MSB_REG (0x83 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Pattern Loop 3 Address RW regiser */
|
|
||||||
#define PATTERN_LOOP_3_ADDR_REG (0x84 << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
#define PATTERN_LOOP_3_ADDR_STRT_OFST (0)
|
|
||||||
#define PATTERN_LOOP_3_ADDR_STRT_MSK \
|
|
||||||
(0x00001FFF << PATTERN_LOOP_3_ADDR_STRT_OFST)
|
|
||||||
#define PATTERN_LOOP_3_ADDR_STP_OFST (16)
|
|
||||||
#define PATTERN_LOOP_3_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_3_ADDR_STP_OFST)
|
|
||||||
|
|
||||||
/* Pattern Loop 3 Iteration RW regiser */
|
|
||||||
#define PATTERN_LOOP_3_ITERATION_REG (0x85 << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
/* Pattern Loop 4 Address RW regiser */
|
|
||||||
#define PATTERN_LOOP_4_ADDR_REG (0x86 << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
#define PATTERN_LOOP_4_ADDR_STRT_OFST (0)
|
|
||||||
#define PATTERN_LOOP_4_ADDR_STRT_MSK \
|
|
||||||
(0x00001FFF << PATTERN_LOOP_4_ADDR_STRT_OFST)
|
|
||||||
#define PATTERN_LOOP_4_ADDR_STP_OFST (16)
|
|
||||||
#define PATTERN_LOOP_4_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_4_ADDR_STP_OFST)
|
|
||||||
|
|
||||||
/* Pattern Loop 4 Iteration RW regiser */
|
|
||||||
#define PATTERN_LOOP_4_ITERATION_REG (0x87 << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
/* Pattern Loop 5 Address RW regiser */
|
|
||||||
#define PATTERN_LOOP_5_ADDR_REG (0x88 << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
#define PATTERN_LOOP_5_ADDR_STRT_OFST (0)
|
|
||||||
#define PATTERN_LOOP_5_ADDR_STRT_MSK \
|
|
||||||
(0x00001FFF << PATTERN_LOOP_5_ADDR_STRT_OFST)
|
|
||||||
#define PATTERN_LOOP_5_ADDR_STP_OFST (16)
|
|
||||||
#define PATTERN_LOOP_5_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_5_ADDR_STP_OFST)
|
|
||||||
|
|
||||||
/* Pattern Loop 5 Iteration RW regiser */
|
|
||||||
#define PATTERN_LOOP_5_ITERATION_REG (0x89 << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
/* Pattern Wait 3 RW regiser */
|
|
||||||
#define PATTERN_WAIT_3_ADDR_REG (0x8A << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
#define PATTERN_WAIT_3_ADDR_OFST (0)
|
|
||||||
#define PATTERN_WAIT_3_ADDR_MSK (0x00001FFF << PATTERN_WAIT_3_ADDR_OFST)
|
|
||||||
|
|
||||||
/* Pattern Wait 4 RW regiser */
|
|
||||||
#define PATTERN_WAIT_4_ADDR_REG (0x8B << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
#define PATTERN_WAIT_4_ADDR_OFST (0)
|
|
||||||
#define PATTERN_WAIT_4_ADDR_MSK (0x00001FFF << PATTERN_WAIT_4_ADDR_OFST)
|
|
||||||
|
|
||||||
/* Pattern Wait 5 RW regiser */
|
|
||||||
#define PATTERN_WAIT_5_ADDR_REG (0x8C << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
#define PATTERN_WAIT_5_ADDR_OFST (0)
|
|
||||||
#define PATTERN_WAIT_5_ADDR_MSK (0x00001FFF << PATTERN_WAIT_5_ADDR_OFST)
|
|
||||||
|
|
||||||
/* Pattern Wait Timer 3 64 bit RW register. t = PWT1 x T run clock */
|
|
||||||
#define PATTERN_WAIT_TIMER_3_LSB_REG (0x8D << MEM_MAP_SHIFT)
|
|
||||||
#define PATTERN_WAIT_TIMER_3_MSB_REG (0x8E << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
/* Pattern Wait Timer 4 64 bit RW register. t = PWT1 x T run clock */
|
|
||||||
#define PATTERN_WAIT_TIMER_4_LSB_REG (0x8F << MEM_MAP_SHIFT)
|
|
||||||
#define PATTERN_WAIT_TIMER_4_MSB_REG (0x90 << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
/* Pattern Wait Timer 5 64 bit RW register. t = PWT1 x T run clock */
|
|
||||||
#define PATTERN_WAIT_TIMER_5_LSB_REG (0x91 << MEM_MAP_SHIFT)
|
|
||||||
#define PATTERN_WAIT_TIMER_5_MSB_REG (0x92 << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
/** I2C Control register */
|
/** I2C Control register */
|
||||||
#define I2C_TRANSFER_COMMAND_FIFO_REG (0x100 << MEM_MAP_SHIFT)
|
#define I2C_TRANSFER_COMMAND_FIFO_REG (0x100 << MEM_MAP_SHIFT)
|
||||||
#define I2C_RX_DATA_FIFO_REG (0x101 << MEM_MAP_SHIFT)
|
#define I2C_RX_DATA_FIFO_REG (0x101 << MEM_MAP_SHIFT)
|
||||||
|
Binary file not shown.
@ -5,7 +5,7 @@
|
|||||||
#include "sls/sls_detector_defs.h"
|
#include "sls/sls_detector_defs.h"
|
||||||
|
|
||||||
#define MIN_REQRD_VRSN_T_RD_API 0x181130
|
#define MIN_REQRD_VRSN_T_RD_API 0x181130
|
||||||
#define REQRD_FRMWR_VRSN 0x220714
|
#define REQRD_FRMWR_VRSN 0x201005
|
||||||
|
|
||||||
#define LINKED_SERVER_NAME "ctbDetectorServer"
|
#define LINKED_SERVER_NAME "ctbDetectorServer"
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -274,28 +274,15 @@ patword 0x0110 0x0008599f0008503a
|
|||||||
patword 0x0111 0x0008599f0008503a
|
patword 0x0111 0x0008599f0008503a
|
||||||
patioctrl 0x8f0effff6dbffdbf
|
patioctrl 0x8f0effff6dbffdbf
|
||||||
patlimits 0x0000 0x0110
|
patlimits 0x0000 0x0110
|
||||||
patloop 0 0x00be 0x00ef
|
patloop0 0x00be 0x00ef
|
||||||
patnloop 0 199
|
patnloop0 199
|
||||||
patloop 1 0x0400 0x0400
|
patloop1 0x0400 0x0400
|
||||||
patnloop 1 0
|
patnloop1 0
|
||||||
patloop 2 0x0400 0x0400
|
patloop2 0x0400 0x0400
|
||||||
patnloop 2 0
|
patnloop2 0
|
||||||
patwait 0 0x002e
|
patwait0 0x002e
|
||||||
patwaittime 0 800
|
patwaittime0 800
|
||||||
patwait 1 0x0400
|
patwait1 0x0400
|
||||||
patwaittime 1 0
|
patwaittime1 0
|
||||||
patwait 2 0x0400
|
patwait2 0x0400
|
||||||
patwaittime 2 0
|
patwaittime2 0
|
||||||
|
|
||||||
patloop 3 0x0000 0x0000
|
|
||||||
patnloop 3 0
|
|
||||||
patloop 4 0x0000 0x0000
|
|
||||||
patnloop 4 0
|
|
||||||
patloop 5 0x0000 0x0000
|
|
||||||
patnloop 5 0
|
|
||||||
patwait 3 0x0000
|
|
||||||
patwaittime 3 0
|
|
||||||
patwait 4 0x0000
|
|
||||||
patwaittime 4 0
|
|
||||||
patwait 5 0x0000
|
|
||||||
patwaittime 5 0
|
|
||||||
|
@ -572,72 +572,5 @@
|
|||||||
#define PATTERN_SET_LSB_REG (0x82 << MEM_MAP_SHIFT)
|
#define PATTERN_SET_LSB_REG (0x82 << MEM_MAP_SHIFT)
|
||||||
#define PATTERN_SET_MSB_REG (0x83 << MEM_MAP_SHIFT)
|
#define PATTERN_SET_MSB_REG (0x83 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
|
|
||||||
/* Pattern Loop 3 Address RW regiser */
|
|
||||||
#define PATTERN_LOOP_3_ADDR_REG (0x84 << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
#define PATTERN_LOOP_3_ADDR_STRT_OFST (0)
|
|
||||||
#define PATTERN_LOOP_3_ADDR_STRT_MSK \
|
|
||||||
(0x00001FFF << PATTERN_LOOP_3_ADDR_STRT_OFST)
|
|
||||||
#define PATTERN_LOOP_3_ADDR_STP_OFST (16)
|
|
||||||
#define PATTERN_LOOP_3_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_3_ADDR_STP_OFST)
|
|
||||||
|
|
||||||
/* Pattern Loop 3 Iteration RW regiser */
|
|
||||||
#define PATTERN_LOOP_3_ITERATION_REG (0x85 << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
/* Pattern Loop 4 Address RW regiser */
|
|
||||||
#define PATTERN_LOOP_4_ADDR_REG (0x86 << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
#define PATTERN_LOOP_4_ADDR_STRT_OFST (0)
|
|
||||||
#define PATTERN_LOOP_4_ADDR_STRT_MSK \
|
|
||||||
(0x00001FFF << PATTERN_LOOP_4_ADDR_STRT_OFST)
|
|
||||||
#define PATTERN_LOOP_4_ADDR_STP_OFST (16)
|
|
||||||
#define PATTERN_LOOP_4_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_4_ADDR_STP_OFST)
|
|
||||||
|
|
||||||
/* Pattern Loop 4 Iteration RW regiser */
|
|
||||||
#define PATTERN_LOOP_4_ITERATION_REG (0x87 << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
/* Pattern Loop 5 Address RW regiser */
|
|
||||||
#define PATTERN_LOOP_5_ADDR_REG (0x88 << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
#define PATTERN_LOOP_5_ADDR_STRT_OFST (0)
|
|
||||||
#define PATTERN_LOOP_5_ADDR_STRT_MSK \
|
|
||||||
(0x00001FFF << PATTERN_LOOP_5_ADDR_STRT_OFST)
|
|
||||||
#define PATTERN_LOOP_5_ADDR_STP_OFST (16)
|
|
||||||
#define PATTERN_LOOP_5_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_5_ADDR_STP_OFST)
|
|
||||||
|
|
||||||
/* Pattern Loop 5 Iteration RW regiser */
|
|
||||||
#define PATTERN_LOOP_5_ITERATION_REG (0x89 << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
/* Pattern Wait 3 RW regiser */
|
|
||||||
#define PATTERN_WAIT_3_ADDR_REG (0x8A << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
#define PATTERN_WAIT_3_ADDR_OFST (0)
|
|
||||||
#define PATTERN_WAIT_3_ADDR_MSK (0x00001FFF << PATTERN_WAIT_3_ADDR_OFST)
|
|
||||||
|
|
||||||
/* Pattern Wait 4 RW regiser */
|
|
||||||
#define PATTERN_WAIT_4_ADDR_REG (0x8B << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
#define PATTERN_WAIT_4_ADDR_OFST (0)
|
|
||||||
#define PATTERN_WAIT_4_ADDR_MSK (0x00001FFF << PATTERN_WAIT_4_ADDR_OFST)
|
|
||||||
|
|
||||||
/* Pattern Wait 5 RW regiser */
|
|
||||||
#define PATTERN_WAIT_5_ADDR_REG (0x8C << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
#define PATTERN_WAIT_5_ADDR_OFST (0)
|
|
||||||
#define PATTERN_WAIT_5_ADDR_MSK (0x00001FFF << PATTERN_WAIT_5_ADDR_OFST)
|
|
||||||
|
|
||||||
/* Pattern Wait Timer 3 64 bit RW register. t = PWT1 x T run clock */
|
|
||||||
#define PATTERN_WAIT_TIMER_3_LSB_REG (0x8D << MEM_MAP_SHIFT)
|
|
||||||
#define PATTERN_WAIT_TIMER_3_MSB_REG (0x8E << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
/* Pattern Wait Timer 4 64 bit RW register. t = PWT1 x T run clock */
|
|
||||||
#define PATTERN_WAIT_TIMER_4_LSB_REG (0x8F << MEM_MAP_SHIFT)
|
|
||||||
#define PATTERN_WAIT_TIMER_4_MSB_REG (0x90 << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
/* Pattern Wait Timer 5 64 bit RW register. t = PWT1 x T run clock */
|
|
||||||
#define PATTERN_WAIT_TIMER_5_LSB_REG (0x91 << MEM_MAP_SHIFT)
|
|
||||||
#define PATTERN_WAIT_TIMER_5_MSB_REG (0x92 << MEM_MAP_SHIFT)
|
|
||||||
|
|
||||||
/* Round Robin */
|
/* Round Robin */
|
||||||
#define RXR_ENDPOINT_START_REG (0x1000 << MEM_MAP_SHIFT)
|
#define RXR_ENDPOINT_START_REG (0x1000 << MEM_MAP_SHIFT)
|
||||||
|
@ -274,28 +274,15 @@ patword 0x0110 0x0008599f0008503a
|
|||||||
patword 0x0111 0x0008599f0008503a
|
patword 0x0111 0x0008599f0008503a
|
||||||
patioctrl 0x8f0effff6dbffdbf
|
patioctrl 0x8f0effff6dbffdbf
|
||||||
patlimits 0x0000 0x0110
|
patlimits 0x0000 0x0110
|
||||||
patloop 0 0x00be 0x00ef
|
patloop0 0x00be 0x00ef
|
||||||
patnloop 0 199
|
patnloop0 199
|
||||||
patloop 1 0x0400 0x0400
|
patloop1 0x0400 0x0400
|
||||||
patnloop 1 0
|
patnloop1 0
|
||||||
patloop 2 0x0400 0x0400
|
patloop2 0x0400 0x0400
|
||||||
patnloop 2 0
|
patnloop2 0
|
||||||
patwait 0 0x002e
|
patwait0 0x002e
|
||||||
patwaittime 0 800
|
patwaittime0 800
|
||||||
patwait 1 0x0400
|
patwait1 0x0400
|
||||||
patwaittime 1 0
|
patwaittime1 0
|
||||||
patwait 2 0x0400
|
patwait2 0x0400
|
||||||
patwaittime 2 0
|
patwaittime2 0
|
||||||
|
|
||||||
patloop 3 0x0000 0x0000
|
|
||||||
patnloop 3 0
|
|
||||||
patloop 4 0x0000 0x0000
|
|
||||||
patnloop 4 0
|
|
||||||
patloop 5 0x0000 0x0000
|
|
||||||
patnloop 5 0
|
|
||||||
patwait 3 0x0000
|
|
||||||
patwaittime 3 0
|
|
||||||
patwait 4 0x0000
|
|
||||||
patwaittime 4 0
|
|
||||||
patwait 5 0x0000
|
|
||||||
patwaittime 5 0
|
|
||||||
|
Binary file not shown.
@ -5,7 +5,7 @@
|
|||||||
#include "sls/sls_detector_defs.h"
|
#include "sls/sls_detector_defs.h"
|
||||||
|
|
||||||
#define MIN_REQRD_VRSN_T_RD_API 0x180314
|
#define MIN_REQRD_VRSN_T_RD_API 0x180314
|
||||||
#define REQRD_FRMWR_VRSN 0x220714
|
#define REQRD_FRMWR_VRSN 0x201005
|
||||||
|
|
||||||
#define LINKED_SERVER_NAME "moenchDetectorServer"
|
#define LINKED_SERVER_NAME "moenchDetectorServer"
|
||||||
|
|
||||||
|
@ -242,15 +242,15 @@ patword 0x00f0 0x0000000000000000
|
|||||||
patword 0x00f1 0x0000000000000000
|
patword 0x00f1 0x0000000000000000
|
||||||
patword 0x00f2 0x0000000000000000
|
patword 0x00f2 0x0000000000000000
|
||||||
patlimits 0x0000 0x00f2
|
patlimits 0x0000 0x00f2
|
||||||
patloop 0 0x0400 0x0400
|
patloop0 0x0400 0x0400
|
||||||
patnloop 0 0
|
patnloop0 0
|
||||||
patloop 1 0x0400 0x0400
|
patloop1 0x0400 0x0400
|
||||||
patnloop 1 0
|
patnloop1 0
|
||||||
patloop 2 0x0400 0x0400
|
patloop2 0x0400 0x0400
|
||||||
patnloop 2 0
|
patnloop2 0
|
||||||
patwait 0 0x0400
|
patwait0 0x0400
|
||||||
patwaittime 0 0
|
patwaittime0 0
|
||||||
patwait 1 0x0400
|
patwait1 0x0400
|
||||||
patwaittime 1 0
|
patwaittime1 0
|
||||||
patwait 2 0x0400
|
patwait2 0x0400
|
||||||
patwaittime 2 0
|
patwaittime2 0
|
||||||
|
@ -242,15 +242,15 @@ patword 0x00f0 0x0000000000000000
|
|||||||
patword 0x00f1 0x0000000000000000
|
patword 0x00f1 0x0000000000000000
|
||||||
patword 0x00f2 0x0000000000000000
|
patword 0x00f2 0x0000000000000000
|
||||||
patlimits 0x0000 0x00f2
|
patlimits 0x0000 0x00f2
|
||||||
patloop 0 0x0400 0x0400
|
patloop0 0x0400 0x0400
|
||||||
patnloop 0 0
|
patnloop0 0
|
||||||
patloop 1 0x0400 0x0400
|
patloop1 0x0400 0x0400
|
||||||
patnloop 1 0
|
patnloop1 0
|
||||||
patloop 2 0x0400 0x0400
|
patloop2 0x0400 0x0400
|
||||||
patnloop 2 0
|
patnloop2 0
|
||||||
patwait 0 0x0400
|
patwait0 0x0400
|
||||||
patwaittime 0 0
|
patwaittime0 0
|
||||||
patwait 1 0x0400
|
patwait1 0x0400
|
||||||
patwaittime 1 0
|
patwaittime1 0
|
||||||
patwait 2 0x0400
|
patwait2 0x0400
|
||||||
patwaittime 2 0
|
patwaittime2 0
|
||||||
|
Binary file not shown.
@ -73,13 +73,13 @@ patternParameters *setChipStatusRegisterPattern(int csr) {
|
|||||||
error = 1;
|
error = 1;
|
||||||
}
|
}
|
||||||
// set pattern wait address
|
// set pattern wait address
|
||||||
for (int i = 0; i < M3_MAX_PATTERN_LEVELS; i++)
|
for (int i = 0; i <= 2; i++)
|
||||||
pat->wait[i] = MAX_PATTERN_LENGTH - 1;
|
pat->wait[i] = MAX_PATTERN_LENGTH - 1;
|
||||||
// pattern loop
|
// pattern loop
|
||||||
for (int i = 0; i < M3_MAX_PATTERN_LEVELS; i++) {
|
for (int i = 0; i <= 2; i++) {
|
||||||
// int stop = MAX_PATTERN_LENGTH - 1, nloop = 0;
|
// int stop = MAX_PATTERN_LENGTH - 1, nloop = 0;
|
||||||
pat->startloop[i] = MAX_PATTERN_LENGTH - 1;
|
pat->loop[i * 2 + 0] = MAX_PATTERN_LENGTH - 1;
|
||||||
pat->stoploop[i] = MAX_PATTERN_LENGTH - 1;
|
pat->loop[i * 2 + 1] = MAX_PATTERN_LENGTH - 1;
|
||||||
pat->nloop[i] = 0;
|
pat->nloop[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,13 +349,13 @@ patternParameters *setChannelRegisterChip(int ichip, int *mask, int *trimbits) {
|
|||||||
error = 1;
|
error = 1;
|
||||||
}
|
}
|
||||||
// set pattern wait address
|
// set pattern wait address
|
||||||
for (int i = 0; i < M3_MAX_PATTERN_LEVELS; i++)
|
for (int i = 0; i <= 2; i++)
|
||||||
pat->wait[i] = MAX_PATTERN_LENGTH - 1;
|
pat->wait[i] = MAX_PATTERN_LENGTH - 1;
|
||||||
// pattern loop
|
// pattern loop
|
||||||
for (int i = 0; i < M3_MAX_PATTERN_LEVELS; i++) {
|
for (int i = 0; i <= 2; i++) {
|
||||||
// int stop = MAX_PATTERN_LENGTH - 1, nloop = 0;
|
// int stop = MAX_PATTERN_LENGTH - 1, nloop = 0;
|
||||||
pat->startloop[i] = MAX_PATTERN_LENGTH - 1;
|
pat->loop[i * 2 + 0] = MAX_PATTERN_LENGTH - 1;
|
||||||
pat->stoploop[i] = MAX_PATTERN_LENGTH - 1;
|
pat->loop[i * 2 + 1] = MAX_PATTERN_LENGTH - 1;
|
||||||
pat->nloop[i] = 0;
|
pat->nloop[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2456,51 +2456,21 @@ void *start_timer(void *arg) {
|
|||||||
// Generate data
|
// Generate data
|
||||||
char imageData[imageSize];
|
char imageData[imageSize];
|
||||||
memset(imageData, 0, imageSize);
|
memset(imageData, 0, imageSize);
|
||||||
// {
|
|
||||||
// const int nchannels = NCHAN_1_COUNTER * NCHIP * ncounters;
|
|
||||||
|
|
||||||
// for (int i = 0; i < nchannels; ++i) {
|
|
||||||
// int j = rand();
|
|
||||||
// switch (dr) {
|
|
||||||
// //case 1: // TODO: Not implemented in firmware yet
|
|
||||||
// // break;
|
|
||||||
|
|
||||||
// case 8:
|
|
||||||
// *((uint8_t *)(imageData + i)) = (uint8_t)j;
|
|
||||||
// break;
|
|
||||||
// case 16:
|
|
||||||
// *((uint16_t *)(imageData + i * sizeof(uint16_t))) = (uint16_t)j;
|
|
||||||
// break;
|
|
||||||
// case 32:
|
|
||||||
// *((uint32_t *)(imageData + i * sizeof(uint32_t))) = ((uint32_t)j & 0xFFFFFF); // 24 bit
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Send data
|
|
||||||
// loop over number of frames
|
|
||||||
for (int frameNr = 0; frameNr != numFrames; ++frameNr) {
|
|
||||||
|
|
||||||
{
|
{
|
||||||
const int nchannels = NCHAN_1_COUNTER * NCHIP * ncounters;
|
const int nchannels = NCHAN_1_COUNTER * NCHIP * ncounters;
|
||||||
|
|
||||||
for (int i = 0; i < nchannels; ++i) {
|
for (int i = 0; i < nchannels; ++i) {
|
||||||
int j = rand();
|
|
||||||
switch (dr) {
|
switch (dr) {
|
||||||
//case 1: // TODO: Not implemented in firmware yet
|
//case 1: // TODO: Not implemented in firmware yet
|
||||||
// break;
|
// break;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
*((uint8_t *)(imageData + i)) = (uint8_t)j;
|
*((uint8_t *)(imageData + i)) = (uint8_t)i;
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) = (uint16_t)j;
|
*((uint16_t *)(imageData + i * sizeof(uint16_t))) = (uint16_t)i;
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
*((uint32_t *)(imageData + i * sizeof(uint32_t))) = ((uint32_t)j & 0xFFFFFF); // 24 bit
|
*((uint32_t *)(imageData + i * sizeof(uint32_t))) = ((uint32_t)i & 0xFFFFFF); // 24 bit
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -2508,6 +2478,9 @@ void *start_timer(void *arg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send data
|
||||||
|
// loop over number of frames
|
||||||
|
for (int frameNr = 0; frameNr != numFrames; ++frameNr) {
|
||||||
|
|
||||||
// check if manual stop
|
// check if manual stop
|
||||||
if (sharedMemory_getStop() == 1) {
|
if (sharedMemory_getStop() == 1) {
|
||||||
|
@ -24,12 +24,6 @@ extern u_int32_t bus_r(u_int32_t offset);
|
|||||||
extern int64_t get64BitReg(int aLSB, int aMSB);
|
extern int64_t get64BitReg(int aLSB, int aMSB);
|
||||||
extern int64_t set64BitReg(int64_t value, int aLSB, int aMSB);
|
extern int64_t set64BitReg(int64_t value, int aLSB, int aMSB);
|
||||||
|
|
||||||
#ifdef MYTHEN3D
|
|
||||||
#define MAX_LEVELS M3_MAX_PATTERN_LEVELS
|
|
||||||
#else
|
|
||||||
#define MAX_LEVELS MAX_PATTERN_LEVELS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
void initializePatternWord() {
|
void initializePatternWord() {
|
||||||
@ -163,9 +157,9 @@ void writePatternWord(int addr, uint64_t word) {
|
|||||||
|
|
||||||
int validate_getPatternWaitAddresses(char *message, int level, int *addr) {
|
int validate_getPatternWaitAddresses(char *message, int level, int *addr) {
|
||||||
// validate input
|
// validate input
|
||||||
if (level < 0 || level >= MAX_LEVELS) {
|
if (level < 0 || level > 2) {
|
||||||
sprintf(message,
|
sprintf(message,
|
||||||
"Cannot get patwait address. Level %d must be between 0 and %d.\n", level, MAX_LEVELS - 1);
|
"Cannot get patwait address. Level must be between 0 and 2.\n");
|
||||||
LOG(logERROR, (message));
|
LOG(logERROR, (message));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -184,17 +178,6 @@ int getPatternWaitAddress(int level) {
|
|||||||
case 2:
|
case 2:
|
||||||
return ((bus_r(PATTERN_WAIT_2_ADDR_REG) & PATTERN_WAIT_2_ADDR_MSK) >>
|
return ((bus_r(PATTERN_WAIT_2_ADDR_REG) & PATTERN_WAIT_2_ADDR_MSK) >>
|
||||||
PATTERN_WAIT_2_ADDR_OFST);
|
PATTERN_WAIT_2_ADDR_OFST);
|
||||||
#ifndef MYTHEN3D
|
|
||||||
case 3:
|
|
||||||
return ((bus_r(PATTERN_WAIT_3_ADDR_REG) & PATTERN_WAIT_3_ADDR_MSK) >>
|
|
||||||
PATTERN_WAIT_3_ADDR_OFST);
|
|
||||||
case 4:
|
|
||||||
return ((bus_r(PATTERN_WAIT_4_ADDR_REG) & PATTERN_WAIT_4_ADDR_MSK) >>
|
|
||||||
PATTERN_WAIT_4_ADDR_OFST);
|
|
||||||
case 5:
|
|
||||||
return ((bus_r(PATTERN_WAIT_5_ADDR_REG) & PATTERN_WAIT_5_ADDR_MSK) >>
|
|
||||||
PATTERN_WAIT_5_ADDR_OFST);
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -202,9 +185,9 @@ int getPatternWaitAddress(int level) {
|
|||||||
|
|
||||||
int validate_setPatternWaitAddresses(char *message, int level, int addr) {
|
int validate_setPatternWaitAddresses(char *message, int level, int addr) {
|
||||||
// validate input
|
// validate input
|
||||||
if (level < 0 || level >= MAX_LEVELS) {
|
if (level < 0 || level > 2) {
|
||||||
sprintf(message,
|
sprintf(message,
|
||||||
"Cannot set patwait address. Level %d must be between 0 and %d.\n", level, MAX_LEVELS - 1);
|
"Cannot set patwait address. Level must be between 0 and 2.\n");
|
||||||
LOG(logERROR, (message));
|
LOG(logERROR, (message));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -251,20 +234,6 @@ void setPatternWaitAddress(int level, int addr) {
|
|||||||
bus_w(PATTERN_WAIT_2_ADDR_REG,
|
bus_w(PATTERN_WAIT_2_ADDR_REG,
|
||||||
((addr << PATTERN_WAIT_2_ADDR_OFST) & PATTERN_WAIT_2_ADDR_MSK));
|
((addr << PATTERN_WAIT_2_ADDR_OFST) & PATTERN_WAIT_2_ADDR_MSK));
|
||||||
break;
|
break;
|
||||||
#ifndef MYTHEN3D
|
|
||||||
case 3:
|
|
||||||
bus_w(PATTERN_WAIT_3_ADDR_REG,
|
|
||||||
((addr << PATTERN_WAIT_3_ADDR_OFST) & PATTERN_WAIT_3_ADDR_MSK));
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
bus_w(PATTERN_WAIT_4_ADDR_REG,
|
|
||||||
((addr << PATTERN_WAIT_4_ADDR_OFST) & PATTERN_WAIT_4_ADDR_MSK));
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
bus_w(PATTERN_WAIT_5_ADDR_REG,
|
|
||||||
((addr << PATTERN_WAIT_5_ADDR_OFST) & PATTERN_WAIT_5_ADDR_MSK));
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -272,9 +241,9 @@ void setPatternWaitAddress(int level, int addr) {
|
|||||||
|
|
||||||
int validate_getPatternWaitTime(char *message, int level, uint64_t *waittime) {
|
int validate_getPatternWaitTime(char *message, int level, uint64_t *waittime) {
|
||||||
// validate input
|
// validate input
|
||||||
if (level < 0 || level >= MAX_LEVELS) {
|
if (level < 0 || level > 2) {
|
||||||
sprintf(message,
|
sprintf(message,
|
||||||
"Cannot get patwaittime. Level %d must be between 0 and %d.\n", level, MAX_LEVELS - 1);
|
"Cannot get patwaittime. Level must be between 0 and 2.\n");
|
||||||
LOG(logERROR, (message));
|
LOG(logERROR, (message));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -293,17 +262,6 @@ uint64_t getPatternWaitTime(int level) {
|
|||||||
case 2:
|
case 2:
|
||||||
return get64BitReg(PATTERN_WAIT_TIMER_2_LSB_REG,
|
return get64BitReg(PATTERN_WAIT_TIMER_2_LSB_REG,
|
||||||
PATTERN_WAIT_TIMER_2_MSB_REG);
|
PATTERN_WAIT_TIMER_2_MSB_REG);
|
||||||
#ifndef MYTHEN3D
|
|
||||||
case 3:
|
|
||||||
return get64BitReg(PATTERN_WAIT_TIMER_3_LSB_REG,
|
|
||||||
PATTERN_WAIT_TIMER_3_MSB_REG);
|
|
||||||
case 4:
|
|
||||||
return get64BitReg(PATTERN_WAIT_TIMER_4_LSB_REG,
|
|
||||||
PATTERN_WAIT_TIMER_4_MSB_REG);
|
|
||||||
case 5:
|
|
||||||
return get64BitReg(PATTERN_WAIT_TIMER_5_LSB_REG,
|
|
||||||
PATTERN_WAIT_TIMER_5_MSB_REG);
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -311,9 +269,9 @@ uint64_t getPatternWaitTime(int level) {
|
|||||||
|
|
||||||
int validate_setPatternWaitTime(char *message, int level, uint64_t waittime) {
|
int validate_setPatternWaitTime(char *message, int level, uint64_t waittime) {
|
||||||
// validate input
|
// validate input
|
||||||
if (level < 0 || level >= MAX_LEVELS) {
|
if (level < 0 || level > 2) {
|
||||||
sprintf(message,
|
sprintf(message,
|
||||||
"Cannot set patwaittime. Level %d must be between 0 and %d.\n", level, MAX_LEVELS - 1);
|
"Cannot set patwaittime. Level must be between 0 and 2.\n");
|
||||||
LOG(logERROR, (message));
|
LOG(logERROR, (message));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -353,20 +311,6 @@ void setPatternWaitTime(int level, uint64_t t) {
|
|||||||
set64BitReg(t, PATTERN_WAIT_TIMER_2_LSB_REG,
|
set64BitReg(t, PATTERN_WAIT_TIMER_2_LSB_REG,
|
||||||
PATTERN_WAIT_TIMER_2_MSB_REG);
|
PATTERN_WAIT_TIMER_2_MSB_REG);
|
||||||
break;
|
break;
|
||||||
#ifndef MYTHEN3D
|
|
||||||
case 3:
|
|
||||||
set64BitReg(t, PATTERN_WAIT_TIMER_3_LSB_REG,
|
|
||||||
PATTERN_WAIT_TIMER_3_MSB_REG);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
set64BitReg(t, PATTERN_WAIT_TIMER_4_LSB_REG,
|
|
||||||
PATTERN_WAIT_TIMER_4_MSB_REG);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
set64BitReg(t, PATTERN_WAIT_TIMER_5_LSB_REG,
|
|
||||||
PATTERN_WAIT_TIMER_5_MSB_REG);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -374,9 +318,9 @@ void setPatternWaitTime(int level, uint64_t t) {
|
|||||||
|
|
||||||
int validate_getPatternLoopCycles(char *message, int level, int *numLoops) {
|
int validate_getPatternLoopCycles(char *message, int level, int *numLoops) {
|
||||||
// validate input
|
// validate input
|
||||||
if (level < 0 || level >= MAX_LEVELS) {
|
if (level < 0 || level > 2) {
|
||||||
sprintf(message,
|
sprintf(message,
|
||||||
"Cannot get patnloop. Level %d must be between 0 and %d.\n", level, MAX_LEVELS - 1);
|
"Cannot get patnloop. Level must be between 0 and 2.\n");
|
||||||
LOG(logERROR, (message));
|
LOG(logERROR, (message));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -392,14 +336,6 @@ int getPatternLoopCycles(int level) {
|
|||||||
return bus_r(PATTERN_LOOP_1_ITERATION_REG);
|
return bus_r(PATTERN_LOOP_1_ITERATION_REG);
|
||||||
case 2:
|
case 2:
|
||||||
return bus_r(PATTERN_LOOP_2_ITERATION_REG);
|
return bus_r(PATTERN_LOOP_2_ITERATION_REG);
|
||||||
#ifndef MYTHEN3D
|
|
||||||
case 3:
|
|
||||||
return bus_r(PATTERN_LOOP_3_ITERATION_REG);
|
|
||||||
case 4:
|
|
||||||
return bus_r(PATTERN_LOOP_4_ITERATION_REG);
|
|
||||||
case 5:
|
|
||||||
return bus_r(PATTERN_LOOP_5_ITERATION_REG);
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -407,9 +343,9 @@ int getPatternLoopCycles(int level) {
|
|||||||
|
|
||||||
int validate_setPatternLoopCycles(char *message, int level, int numLoops) {
|
int validate_setPatternLoopCycles(char *message, int level, int numLoops) {
|
||||||
// validate input
|
// validate input
|
||||||
if (level < 0 || level >= MAX_LEVELS) {
|
if (level < 0 || level > 2) {
|
||||||
sprintf(message,
|
sprintf(message,
|
||||||
"Cannot set patnloop. Level %d must be between 0 and %d.\n", level, MAX_LEVELS);
|
"Cannot set patnloop. Level must be between 0 and 2.\n");
|
||||||
LOG(logERROR, (message));
|
LOG(logERROR, (message));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -449,17 +385,6 @@ void setPatternLoopCycles(int level, int nLoop) {
|
|||||||
case 2:
|
case 2:
|
||||||
bus_w(PATTERN_LOOP_2_ITERATION_REG, nLoop);
|
bus_w(PATTERN_LOOP_2_ITERATION_REG, nLoop);
|
||||||
break;
|
break;
|
||||||
#ifndef MYTHEN3D
|
|
||||||
case 3:
|
|
||||||
bus_w(PATTERN_LOOP_3_ITERATION_REG, nLoop);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
bus_w(PATTERN_LOOP_4_ITERATION_REG, nLoop);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
bus_w(PATTERN_LOOP_5_ITERATION_REG, nLoop);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -518,10 +443,10 @@ void setPatternLoopLimits(int startAddr, int stopAddr) {
|
|||||||
int validate_getPatternLoopAddresses(char *message, int level, int *startAddr,
|
int validate_getPatternLoopAddresses(char *message, int level, int *startAddr,
|
||||||
int *stopAddr) {
|
int *stopAddr) {
|
||||||
// validate input
|
// validate input
|
||||||
if (level < 0 || level >= MAX_LEVELS) {
|
if (level < 0 || level > 2) {
|
||||||
sprintf(
|
sprintf(
|
||||||
message,
|
message,
|
||||||
"Cannot get patloop addresses. Level %d must be between 0 and %d.\n", level, MAX_LEVELS - 1);
|
"Cannot get patloop addresses. Level must be between 0 and 2.\n");
|
||||||
LOG(logERROR, (message));
|
LOG(logERROR, (message));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -556,32 +481,6 @@ void getPatternLoopAddresses(int level, int *startAddr, int *stopAddr) {
|
|||||||
((bus_r(PATTERN_LOOP_2_ADDR_REG) & PATTERN_LOOP_2_ADDR_STP_MSK) >>
|
((bus_r(PATTERN_LOOP_2_ADDR_REG) & PATTERN_LOOP_2_ADDR_STP_MSK) >>
|
||||||
PATTERN_LOOP_2_ADDR_STP_OFST);
|
PATTERN_LOOP_2_ADDR_STP_OFST);
|
||||||
break;
|
break;
|
||||||
#ifndef MYTHEN3D
|
|
||||||
case 3:
|
|
||||||
*startAddr =
|
|
||||||
((bus_r(PATTERN_LOOP_3_ADDR_REG) & PATTERN_LOOP_3_ADDR_STRT_MSK) >>
|
|
||||||
PATTERN_LOOP_3_ADDR_STRT_OFST);
|
|
||||||
*stopAddr =
|
|
||||||
((bus_r(PATTERN_LOOP_3_ADDR_REG) & PATTERN_LOOP_3_ADDR_STP_MSK) >>
|
|
||||||
PATTERN_LOOP_3_ADDR_STP_OFST);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
*startAddr =
|
|
||||||
((bus_r(PATTERN_LOOP_4_ADDR_REG) & PATTERN_LOOP_4_ADDR_STRT_MSK) >>
|
|
||||||
PATTERN_LOOP_4_ADDR_STRT_OFST);
|
|
||||||
*stopAddr =
|
|
||||||
((bus_r(PATTERN_LOOP_4_ADDR_REG) & PATTERN_LOOP_4_ADDR_STP_MSK) >>
|
|
||||||
PATTERN_LOOP_4_ADDR_STP_OFST);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
*startAddr =
|
|
||||||
((bus_r(PATTERN_LOOP_5_ADDR_REG) & PATTERN_LOOP_5_ADDR_STRT_MSK) >>
|
|
||||||
PATTERN_LOOP_5_ADDR_STRT_OFST);
|
|
||||||
*stopAddr =
|
|
||||||
((bus_r(PATTERN_LOOP_5_ADDR_REG) & PATTERN_LOOP_5_ADDR_STP_MSK) >>
|
|
||||||
PATTERN_LOOP_5_ADDR_STP_OFST);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -590,10 +489,10 @@ void getPatternLoopAddresses(int level, int *startAddr, int *stopAddr) {
|
|||||||
int validate_setPatternLoopAddresses(char *message, int level, int startAddr,
|
int validate_setPatternLoopAddresses(char *message, int level, int startAddr,
|
||||||
int stopAddr) {
|
int stopAddr) {
|
||||||
// validate input
|
// validate input
|
||||||
if (level < 0 || level >= MAX_LEVELS) {
|
if (level < 0 || level > 2) {
|
||||||
sprintf(
|
sprintf(
|
||||||
message,
|
message,
|
||||||
"Cannot set patloop addresses. Level %d must be between 0 and %d.\n", level, MAX_LEVELS - 1);
|
"Cannot set patloop addresses. Level must be between 0 and 2.\n");
|
||||||
LOG(logERROR, (message));
|
LOG(logERROR, (message));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -660,29 +559,6 @@ void setPatternLoopAddresses(int level, int startAddr, int stopAddr) {
|
|||||||
((stopAddr << PATTERN_LOOP_2_ADDR_STP_OFST) &
|
((stopAddr << PATTERN_LOOP_2_ADDR_STP_OFST) &
|
||||||
PATTERN_LOOP_2_ADDR_STP_MSK));
|
PATTERN_LOOP_2_ADDR_STP_MSK));
|
||||||
break;
|
break;
|
||||||
#ifndef MYTHEN3D
|
|
||||||
case 3:
|
|
||||||
bus_w(PATTERN_LOOP_3_ADDR_REG,
|
|
||||||
((startAddr << PATTERN_LOOP_3_ADDR_STRT_OFST) &
|
|
||||||
PATTERN_LOOP_3_ADDR_STRT_MSK) |
|
|
||||||
((stopAddr << PATTERN_LOOP_3_ADDR_STP_OFST) &
|
|
||||||
PATTERN_LOOP_3_ADDR_STP_MSK));
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
bus_w(PATTERN_LOOP_4_ADDR_REG,
|
|
||||||
((startAddr << PATTERN_LOOP_4_ADDR_STRT_OFST) &
|
|
||||||
PATTERN_LOOP_4_ADDR_STRT_MSK) |
|
|
||||||
((stopAddr << PATTERN_LOOP_4_ADDR_STP_OFST) &
|
|
||||||
PATTERN_LOOP_4_ADDR_STP_MSK));
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
bus_w(PATTERN_LOOP_5_ADDR_REG,
|
|
||||||
((startAddr << PATTERN_LOOP_5_ADDR_STRT_OFST) &
|
|
||||||
PATTERN_LOOP_5_ADDR_STRT_MSK) |
|
|
||||||
((stopAddr << PATTERN_LOOP_5_ADDR_STP_OFST) &
|
|
||||||
PATTERN_LOOP_5_ADDR_STP_MSK));
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -749,10 +625,10 @@ int loadPattern(char *message, enum TLogLevel printLevel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ret == OK) {
|
if (ret == OK) {
|
||||||
for (int i = 0; i < MAX_LEVELS; ++i) {
|
for (int i = 0; i <= 2; ++i) {
|
||||||
// loop addr
|
// loop addr
|
||||||
ret = validate_setPatternLoopAddresses(
|
ret = validate_setPatternLoopAddresses(
|
||||||
message, i, pat->startloop[i], pat->stoploop[i]);
|
message, i, pat->loop[i * 2 + 0], pat->loop[i * 2 + 1]);
|
||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -809,15 +685,15 @@ int getPattern(char *message, patternParameters *pat) {
|
|||||||
pat->limits[1] = retval2;
|
pat->limits[1] = retval2;
|
||||||
}
|
}
|
||||||
if (ret == OK) {
|
if (ret == OK) {
|
||||||
for (int i = 0; i < MAX_LEVELS; ++i) {
|
for (int i = 0; i <= 2; ++i) {
|
||||||
// loop addr
|
// loop addr
|
||||||
ret = validate_getPatternLoopAddresses(message, i, &retval1,
|
ret = validate_getPatternLoopAddresses(message, i, &retval1,
|
||||||
&retval2);
|
&retval2);
|
||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pat->startloop[i] = retval1;
|
pat->loop[i * 2 + 0] = retval1;
|
||||||
pat->stoploop[i] = retval2;
|
pat->loop[i * 2 + 1] = retval2;
|
||||||
|
|
||||||
// num loops
|
// num loops
|
||||||
ret = validate_getPatternLoopCycles(message, i, &retval1);
|
ret = validate_getPatternLoopCycles(message, i, &retval1);
|
||||||
@ -970,14 +846,26 @@ int loadPatternFile(char *patFname, char *errMessage) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// patloop
|
// patloop
|
||||||
if (!strncmp(line, "patloop", strlen("patloop"))){
|
if ((!strncmp(line, "patloop0", strlen("patloop0"))) ||
|
||||||
|
(!strncmp(line, "patloop1", strlen("patloop1"))) ||
|
||||||
|
(!strncmp(line, "patloop2", strlen("patloop2")))) {
|
||||||
|
|
||||||
|
// level
|
||||||
int level = -1;
|
int level = -1;
|
||||||
|
if (!strncmp(line, "patloop0", strlen("patloop0"))) {
|
||||||
|
level = 0;
|
||||||
|
} else if (!strncmp(line, "patloop1", strlen("patloop1"))) {
|
||||||
|
level = 1;
|
||||||
|
} else {
|
||||||
|
level = 2;
|
||||||
|
}
|
||||||
|
|
||||||
int startAddr = 0;
|
int startAddr = 0;
|
||||||
int stopAddr = 0;
|
int stopAddr = 0;
|
||||||
// cannot scan values
|
// cannot scan values
|
||||||
if (sscanf(line, "%s %d 0x%x 0x%x", command, &level, &startAddr, &stopAddr) !=
|
if (sscanf(line, "%s 0x%x 0x%x", command, &startAddr, &stopAddr) !=
|
||||||
4) {
|
3) {
|
||||||
strcpy(temp, "Could not scan patloop arguments.\n");
|
sprintf(temp, "Could not scan patloop%d arguments.\n", level);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -988,12 +876,24 @@ int loadPatternFile(char *patFname, char *errMessage) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// patnloop
|
// patnloop
|
||||||
if (!strncmp(line, "patnloop", strlen("patnloop"))) {
|
if ((!strncmp(line, "patnloop0", strlen("patnloop0"))) ||
|
||||||
|
(!strncmp(line, "patnloop1", strlen("patnloop1"))) ||
|
||||||
|
(!strncmp(line, "patnloop2", strlen("patnloop2")))) {
|
||||||
|
|
||||||
|
// level
|
||||||
int level = -1;
|
int level = -1;
|
||||||
|
if (!strncmp(line, "patnloop0", strlen("patnloop0"))) {
|
||||||
|
level = 0;
|
||||||
|
} else if (!strncmp(line, "patnloop1", strlen("patnloop1"))) {
|
||||||
|
level = 1;
|
||||||
|
} else {
|
||||||
|
level = 2;
|
||||||
|
}
|
||||||
|
|
||||||
int numLoops = -1;
|
int numLoops = -1;
|
||||||
// cannot scan values
|
// cannot scan values
|
||||||
if (sscanf(line, "%s %d %d", command, &level, &numLoops) != 3) {
|
if (sscanf(line, "%s %d", command, &numLoops) != 2) {
|
||||||
strcpy(temp, "Could not scan patnloop arguments.\n");
|
sprintf(temp, "Could not scan patnloop %d arguments.\n", level);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1003,12 +903,24 @@ int loadPatternFile(char *patFname, char *errMessage) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// patwait
|
// patwait
|
||||||
if (!strncmp(line, "patwait ", strlen("patwait "))) {
|
if ((!strncmp(line, "patwait0", strlen("patwait0"))) ||
|
||||||
|
(!strncmp(line, "patwait1", strlen("patwait1"))) ||
|
||||||
|
(!strncmp(line, "patwait2", strlen("patwait2")))) {
|
||||||
|
|
||||||
|
// level
|
||||||
int level = -1;
|
int level = -1;
|
||||||
|
if (!strncmp(line, "patwait0", strlen("patwait0"))) {
|
||||||
|
level = 0;
|
||||||
|
} else if (!strncmp(line, "patwait1", strlen("patwait1"))) {
|
||||||
|
level = 1;
|
||||||
|
} else {
|
||||||
|
level = 2;
|
||||||
|
}
|
||||||
|
|
||||||
int addr = 0;
|
int addr = 0;
|
||||||
// cannot scan values
|
// cannot scan values
|
||||||
if (sscanf(line, "%s %d 0x%x", command, &level, &addr) != 3) {
|
if (sscanf(line, "%s 0x%x", command, &addr) != 2) {
|
||||||
strcpy(temp, "Could not scan patwait arguments.\n");
|
sprintf(temp, "Could not scan patwait%d arguments.\n", level);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1018,15 +930,27 @@ int loadPatternFile(char *patFname, char *errMessage) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// patwaittime
|
// patwaittime
|
||||||
if (!strncmp(line, "patwaittime", strlen("patwaittime"))) {
|
if ((!strncmp(line, "patwaittime0", strlen("patwaittime0"))) ||
|
||||||
|
(!strncmp(line, "patwaittime1", strlen("patwaittime1"))) ||
|
||||||
|
(!strncmp(line, "patwaittime2", strlen("patwaittime2")))) {
|
||||||
|
|
||||||
|
// level
|
||||||
int level = -1;
|
int level = -1;
|
||||||
|
if (!strncmp(line, "patwaittime0", strlen("patwaittime0"))) {
|
||||||
|
level = 0;
|
||||||
|
} else if (!strncmp(line, "patwaittime1", strlen("patwaittime1"))) {
|
||||||
|
level = 1;
|
||||||
|
} else {
|
||||||
|
level = 2;
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t waittime = 0;
|
uint64_t waittime = 0;
|
||||||
|
|
||||||
// cannot scan values
|
// cannot scan values
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
if (sscanf(line, "%s %d %ld", command, &level, &waittime) != 3) {
|
if (sscanf(line, "%s %ld", command, &waittime) != 2) {
|
||||||
#else
|
#else
|
||||||
if (sscanf(line, "%s %d %lld", command, &level, &waittime) != 3) {
|
if (sscanf(line, "%s %lld", command, &waittime) != 2) {
|
||||||
#endif
|
#endif
|
||||||
sprintf(temp, "Could not scan patwaittime%d arguments.\n",
|
sprintf(temp, "Could not scan patwaittime%d arguments.\n",
|
||||||
level);
|
level);
|
||||||
|
@ -9249,25 +9249,8 @@ int clear_all_udp_dst(int file_des) {
|
|||||||
if (check_detector_idle("clear all udp destinations") == OK) {
|
if (check_detector_idle("clear all udp destinations") == OK) {
|
||||||
memset(udpDetails, 0, sizeof(udpDetails));
|
memset(udpDetails, 0, sizeof(udpDetails));
|
||||||
// minimum 1 destination in fpga
|
// minimum 1 destination in fpga
|
||||||
int numdest = 1;
|
numUdpDestinations = 1;
|
||||||
// set number of destinations
|
configure_mac();
|
||||||
#if defined(JUNGFRAUD) || defined(EIGERD)
|
|
||||||
if (setNumberofDestinations(numdest) == FAIL) {
|
|
||||||
ret = FAIL;
|
|
||||||
strcpy(mess, "Could not clear udp destinations to 1 entry.\n");
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
numUdpDestinations = numdest;
|
|
||||||
LOG(logINFOBLUE, ("Number of UDP Destinations: %d\n",
|
|
||||||
numUdpDestinations));
|
|
||||||
ret = configureMAC();
|
|
||||||
if (ret == FAIL) {
|
|
||||||
strcpy(mess, "Could not clear all destinations in the fpga.\n");
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
|
@ -913,6 +913,15 @@ class Detector {
|
|||||||
|
|
||||||
void clearRxROI();
|
void clearRxROI();
|
||||||
|
|
||||||
|
Result<int> getRxBunchSize(Positions pos = {}) const;
|
||||||
|
|
||||||
|
/** Number of frames the receiver listens to before pushing into fifo
|
||||||
|
* (buffer between listener and writer threads).
|
||||||
|
* Higher number results in fewer locks between fifo access. \n
|
||||||
|
* Default is 1. */
|
||||||
|
void setRxBunchSize(int value, Positions pos = {});
|
||||||
|
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
/** @name File */
|
/** @name File */
|
||||||
|
@ -13,11 +13,11 @@ typedef struct __attribute__((packed)) {
|
|||||||
uint64_t word[MAX_PATTERN_LENGTH];
|
uint64_t word[MAX_PATTERN_LENGTH];
|
||||||
uint64_t ioctrl;
|
uint64_t ioctrl;
|
||||||
uint32_t limits[2];
|
uint32_t limits[2];
|
||||||
uint32_t startloop[MAX_PATTERN_LEVELS];
|
// loop0 start, loop0 stop .. loop2 start, loop2 stop
|
||||||
uint32_t stoploop[MAX_PATTERN_LEVELS];
|
uint32_t loop[6];
|
||||||
uint32_t nloop[MAX_PATTERN_LEVELS];
|
uint32_t nloop[3];
|
||||||
uint32_t wait[MAX_PATTERN_LEVELS];
|
uint32_t wait[3];
|
||||||
uint64_t waittime[MAX_PATTERN_LEVELS];
|
uint64_t waittime[3];
|
||||||
} patternParameters;
|
} patternParameters;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -65,11 +65,6 @@ int main(int argc, char *argv[]) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// prevent mem size check
|
|
||||||
if (parser.command() == "config" && action == slsDetectorDefs::PUT_ACTION) {
|
|
||||||
sls::freeSharedMemory(parser.multi_id());
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sls::Detector det(parser.multi_id());
|
sls::Detector det(parser.multi_id());
|
||||||
sls::CmdProxy proxy(&det);
|
sls::CmdProxy proxy(&det);
|
||||||
|
@ -2705,30 +2705,7 @@ std::string CmdProxy::PatternWord(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CmdProxy::GetLevelAndUpdateArgIndex(int action, std::string levelSeparatedCommand, int& level, int& iArg, size_t nGetArgs, size_t nPutArgs) {
|
|
||||||
if (cmd == levelSeparatedCommand) {
|
|
||||||
++nGetArgs;
|
|
||||||
++nPutArgs;
|
|
||||||
} else {
|
|
||||||
LOG(logWARNING) << "This command is deprecated and will be removed. Please migrate to " << levelSeparatedCommand;
|
|
||||||
}
|
|
||||||
if (action == defs::GET_ACTION && args.size() != nGetArgs) {
|
|
||||||
WrongNumberOfParameters(nGetArgs);
|
|
||||||
} else if (action == defs::PUT_ACTION && args.size() != nPutArgs) {
|
|
||||||
WrongNumberOfParameters(nPutArgs);
|
|
||||||
}
|
|
||||||
if (cmd == levelSeparatedCommand) {
|
|
||||||
level = StringTo<int>(args[iArg++]);
|
|
||||||
} else {
|
|
||||||
level = cmd[cmd.find_first_of("012")] - '0';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CmdProxy::PatternLoopAddresses(int action) {
|
std::string CmdProxy::PatternLoopAddresses(int action) {
|
||||||
if (cmd != "patlimits" && cmd != "patloop0" && cmd != "patloop1" && cmd != "patloop2" && cmd != "patloop") {
|
|
||||||
throw RuntimeError(
|
|
||||||
"Unknown command, use list to list all commands");
|
|
||||||
}
|
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
@ -2736,26 +2713,49 @@ std::string CmdProxy::PatternLoopAddresses(int action) {
|
|||||||
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits "
|
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits "
|
||||||
"of complete pattern."
|
"of complete pattern."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (cmd == "patloop") {
|
} else if (cmd == "patloop0") {
|
||||||
os << "[0-6] [start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits of the loop level provided."
|
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits "
|
||||||
<< "\n\t[Mythen3] Level options: 0-3 only."
|
"of loop 0."
|
||||||
|
<< '\n';
|
||||||
|
} else if (cmd == "patloop1") {
|
||||||
|
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits "
|
||||||
|
"of loop 1."
|
||||||
|
<< '\n';
|
||||||
|
} else if (cmd == "patloop2") {
|
||||||
|
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits "
|
||||||
|
"of loop 2."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else {
|
} else {
|
||||||
os << "Depreciated command. Use patloop."
|
throw RuntimeError(
|
||||||
<< '\n';
|
"Unknown command, use list to list all commands");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 2;
|
int level = -1;
|
||||||
if (cmd != "patlimits") {
|
if (cmd == "patlimits") {
|
||||||
GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs, nPutArgs);
|
level = -1;
|
||||||
|
} else if (cmd == "patloop0") {
|
||||||
|
level = 0;
|
||||||
|
} else if (cmd == "patloop1") {
|
||||||
|
level = 1;
|
||||||
|
} else if (cmd == "patloop2") {
|
||||||
|
level = 2;
|
||||||
|
} else {
|
||||||
|
throw RuntimeError(
|
||||||
|
"Unknown command, use list to list all commands");
|
||||||
}
|
}
|
||||||
if (action == defs::GET_ACTION) {
|
if (action == defs::GET_ACTION) {
|
||||||
|
if (!args.empty()) {
|
||||||
|
WrongNumberOfParameters(0);
|
||||||
|
}
|
||||||
auto t =
|
auto t =
|
||||||
det->getPatternLoopAddresses(level, std::vector<int>{det_id});
|
det->getPatternLoopAddresses(level, std::vector<int>{det_id});
|
||||||
os << OutStringHex(t, 4) << '\n';
|
os << OutStringHex(t, 4) << '\n';
|
||||||
} else if (action == defs::PUT_ACTION) {
|
} else if (action == defs::PUT_ACTION) {
|
||||||
int start = StringTo<int>(args[iArg++]);
|
if (args.size() != 2) {
|
||||||
int stop = StringTo<int>(args[iArg++]);
|
WrongNumberOfParameters(2);
|
||||||
|
}
|
||||||
|
int start = StringTo<int>(args[0]);
|
||||||
|
int stop = StringTo<int>(args[1]);
|
||||||
det->setPatternLoopAddresses(level, start, stop,
|
det->setPatternLoopAddresses(level, start, stop,
|
||||||
std::vector<int>{det_id});
|
std::vector<int>{det_id});
|
||||||
os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4)
|
os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4)
|
||||||
@ -2768,32 +2768,50 @@ std::string CmdProxy::PatternLoopAddresses(int action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string CmdProxy::PatternLoopCycles(int action) {
|
std::string CmdProxy::PatternLoopCycles(int action) {
|
||||||
if (cmd != "patnloop0" && cmd != "patnloop1" && cmd != "patnloop2" && cmd != "patnloop") {
|
|
||||||
throw RuntimeError(
|
|
||||||
"Unknown command, use list to list all commands");
|
|
||||||
}
|
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
if (cmd == "patnloop") {
|
if (cmd == "patnloop0") {
|
||||||
os << "[0-6] [n_cycles] \n\t[Ctb][Moench][Mythen3] Number of cycles of "
|
os << "[n_cycles] \n\t[Ctb][Moench][Mythen3] Number of cycles of "
|
||||||
"the loop level provided."
|
"loop 0."
|
||||||
<< "\n\t[Mythen3] Level options: 0-3 only."
|
<< '\n';
|
||||||
|
} else if (cmd == "patnloop1") {
|
||||||
|
os << "[n_cycles] \n\t[Ctb][Moench][Mythen3] Number of cycles of "
|
||||||
|
"loop 1."
|
||||||
|
<< '\n';
|
||||||
|
} else if (cmd == "patnloop2") {
|
||||||
|
os << "[n_cycles] \n\t[Ctb][Moench][Mythen3] Number of cycles of "
|
||||||
|
"loop 2."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else {
|
} else {
|
||||||
os << "Depreciated command. Use patnloop."
|
throw RuntimeError(
|
||||||
<< '\n';
|
"Unknown command, use list to list all commands");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
int level = -1;
|
||||||
GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs, nPutArgs);
|
if (cmd == "patnloop0") {
|
||||||
|
level = 0;
|
||||||
|
} else if (cmd == "patnloop1") {
|
||||||
|
level = 1;
|
||||||
|
} else if (cmd == "patnloop2") {
|
||||||
|
level = 2;
|
||||||
|
} else {
|
||||||
|
throw RuntimeError(
|
||||||
|
"Unknown command, use list to list all commands");
|
||||||
|
}
|
||||||
if (action == defs::GET_ACTION) {
|
if (action == defs::GET_ACTION) {
|
||||||
|
if (!args.empty()) {
|
||||||
|
WrongNumberOfParameters(0);
|
||||||
|
}
|
||||||
auto t = det->getPatternLoopCycles(level, std::vector<int>{det_id});
|
auto t = det->getPatternLoopCycles(level, std::vector<int>{det_id});
|
||||||
os << OutString(t) << '\n';
|
os << OutString(t) << '\n';
|
||||||
} else if (action == defs::PUT_ACTION) {
|
} else if (action == defs::PUT_ACTION) {
|
||||||
int nloops = StringTo<int>(args[iArg++]);
|
if (args.size() != 1) {
|
||||||
det->setPatternLoopCycles(level, nloops, std::vector<int>{det_id});
|
WrongNumberOfParameters(1);
|
||||||
os << nloops << '\n';
|
}
|
||||||
|
det->setPatternLoopCycles(level, StringTo<int>(args[0]),
|
||||||
|
std::vector<int>{det_id});
|
||||||
|
os << args.front() << '\n';
|
||||||
} else {
|
} else {
|
||||||
throw RuntimeError("Unknown action");
|
throw RuntimeError("Unknown action");
|
||||||
}
|
}
|
||||||
@ -2802,28 +2820,42 @@ std::string CmdProxy::PatternLoopCycles(int action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string CmdProxy::PatternWaitAddress(int action) {
|
std::string CmdProxy::PatternWaitAddress(int action) {
|
||||||
if (cmd != "patwait0" && cmd != "patwait1" && cmd != "patwait2" && cmd != "patwait") {
|
|
||||||
throw RuntimeError(
|
|
||||||
"Unknown command, use list to list all commands");
|
|
||||||
}
|
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
if (cmd == "patwait") {
|
if (cmd == "patwait0") {
|
||||||
os << "[0-6] [addr] \n\t[Ctb][Moench][Mythen3] Wait address for loop level provided."
|
os << "[addr] \n\t[Ctb][Moench][Mythen3] Wait 0 address." << '\n';
|
||||||
<< "\n\t[Mythen3] Level options: 0-3 only.";
|
} else if (cmd == "patwait1") {
|
||||||
|
os << "[addr] \n\t[Ctb][Moench][Mythen3] Wait 1 address." << '\n';
|
||||||
|
} else if (cmd == "patwait2") {
|
||||||
|
os << "[addr] \n\t[Ctb][Moench][Mythen3] Wait 2 address." << '\n';
|
||||||
} else {
|
} else {
|
||||||
os << "Depreciated command. Use patwait.";
|
throw RuntimeError(
|
||||||
|
"Unknown command, use list to list all commands");
|
||||||
}
|
}
|
||||||
os << '\n';
|
|
||||||
} else {
|
} else {
|
||||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
int level = -1;
|
||||||
GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs, nPutArgs);
|
if (cmd == "patwait0") {
|
||||||
|
level = 0;
|
||||||
|
} else if (cmd == "patwait1") {
|
||||||
|
level = 1;
|
||||||
|
} else if (cmd == "patwait2") {
|
||||||
|
level = 2;
|
||||||
|
} else {
|
||||||
|
throw RuntimeError(
|
||||||
|
"Unknown command, use list to list all commands");
|
||||||
|
}
|
||||||
if (action == defs::GET_ACTION) {
|
if (action == defs::GET_ACTION) {
|
||||||
|
if (!args.empty()) {
|
||||||
|
WrongNumberOfParameters(0);
|
||||||
|
}
|
||||||
auto t = det->getPatternWaitAddr(level, std::vector<int>{det_id});
|
auto t = det->getPatternWaitAddr(level, std::vector<int>{det_id});
|
||||||
os << OutStringHex(t, 4) << '\n';
|
os << OutStringHex(t, 4) << '\n';
|
||||||
} else if (action == defs::PUT_ACTION) {
|
} else if (action == defs::PUT_ACTION) {
|
||||||
int addr = StringTo<int>(args[iArg++]);
|
if (args.size() != 1) {
|
||||||
|
WrongNumberOfParameters(1);
|
||||||
|
}
|
||||||
|
int addr = StringTo<int>(args[0]);
|
||||||
det->setPatternWaitAddr(level, addr, std::vector<int>{det_id});
|
det->setPatternWaitAddr(level, addr, std::vector<int>{det_id});
|
||||||
os << ToStringHex(addr, 4) << '\n';
|
os << ToStringHex(addr, 4) << '\n';
|
||||||
} else {
|
} else {
|
||||||
@ -2834,32 +2866,50 @@ std::string CmdProxy::PatternWaitAddress(int action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string CmdProxy::PatternWaitTime(int action) {
|
std::string CmdProxy::PatternWaitTime(int action) {
|
||||||
if (cmd != "patwaittime0" && cmd != "patwaittime1" && cmd != "patwaittime2" && cmd != "patwaittime") {
|
|
||||||
throw RuntimeError(
|
|
||||||
"Unknown command, use list to list all commands");
|
|
||||||
}
|
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
if (cmd == "patwaittime") {
|
if (cmd == "patwaittime0") {
|
||||||
os << "[0-6] [n_clk] \n\t[Ctb][Moench][Mythen3] Wait time in clock "
|
os << "[n_clk] \n\t[Ctb][Moench][Mythen3] Wait 0 time in clock "
|
||||||
"cycles for the loop provided."
|
"cycles."
|
||||||
<< "\n\t[Mythen3] Level options: 0-3 only."
|
<< '\n';
|
||||||
|
} else if (cmd == "patwaittime1") {
|
||||||
|
os << "[n_clk] \n\t[Ctb][Moench][Mythen3] Wait 1 time in clock "
|
||||||
|
"cycles."
|
||||||
|
<< '\n';
|
||||||
|
} else if (cmd == "patwaittime2") {
|
||||||
|
os << "[n_clk] \n\t[Ctb][Moench][Mythen3] Wait 2 time in clock "
|
||||||
|
"cycles."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else {
|
} else {
|
||||||
os << "Depreciated command. Use patwaittime."
|
throw RuntimeError(
|
||||||
<< '\n';
|
"Unknown command, use list to list all commands");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
int level = -1;
|
||||||
GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs, nPutArgs);
|
if (cmd == "patwaittime0") {
|
||||||
|
level = 0;
|
||||||
|
} else if (cmd == "patwaittime1") {
|
||||||
|
level = 1;
|
||||||
|
} else if (cmd == "patwaittime2") {
|
||||||
|
level = 2;
|
||||||
|
} else {
|
||||||
|
throw RuntimeError(
|
||||||
|
"Unknown command, use list to list all commands");
|
||||||
|
}
|
||||||
if (action == defs::GET_ACTION) {
|
if (action == defs::GET_ACTION) {
|
||||||
|
if (!args.empty()) {
|
||||||
|
WrongNumberOfParameters(0);
|
||||||
|
}
|
||||||
auto t = det->getPatternWaitTime(level, std::vector<int>{det_id});
|
auto t = det->getPatternWaitTime(level, std::vector<int>{det_id});
|
||||||
os << OutString(t) << '\n';
|
os << OutString(t) << '\n';
|
||||||
} else if (action == defs::PUT_ACTION) {
|
} else if (action == defs::PUT_ACTION) {
|
||||||
uint64_t waittime = StringTo<uint64_t>(args[iArg++]);
|
if (args.size() != 1) {
|
||||||
det->setPatternWaitTime(level, waittime, {det_id});
|
WrongNumberOfParameters(1);
|
||||||
os << waittime << '\n';
|
}
|
||||||
|
det->setPatternWaitTime(level, StringTo<uint64_t>(args[0]),
|
||||||
|
{det_id});
|
||||||
|
os << args.front() << '\n';
|
||||||
} else {
|
} else {
|
||||||
throw RuntimeError("Unknown action");
|
throw RuntimeError("Unknown action");
|
||||||
}
|
}
|
||||||
|
@ -911,6 +911,7 @@ class CmdProxy {
|
|||||||
{"rx_arping", &CmdProxy::rx_arping},
|
{"rx_arping", &CmdProxy::rx_arping},
|
||||||
{"rx_roi", &CmdProxy::Rx_ROI},
|
{"rx_roi", &CmdProxy::Rx_ROI},
|
||||||
{"rx_clearroi", &CmdProxy::rx_clearroi},
|
{"rx_clearroi", &CmdProxy::rx_clearroi},
|
||||||
|
{"rx_bunchsize", &CmdProxy::rx_bunchsize},// FIXME: rx_fifobunchsize?
|
||||||
|
|
||||||
/* File */
|
/* File */
|
||||||
{"fformat", &CmdProxy::fformat},
|
{"fformat", &CmdProxy::fformat},
|
||||||
@ -1049,19 +1050,15 @@ class CmdProxy {
|
|||||||
{"patioctrl", &CmdProxy::patioctrl},
|
{"patioctrl", &CmdProxy::patioctrl},
|
||||||
{"patword", &CmdProxy::PatternWord},
|
{"patword", &CmdProxy::PatternWord},
|
||||||
{"patlimits", &CmdProxy::PatternLoopAddresses},
|
{"patlimits", &CmdProxy::PatternLoopAddresses},
|
||||||
{"patloop", &CmdProxy::PatternLoopAddresses},
|
|
||||||
{"patloop0", &CmdProxy::PatternLoopAddresses},
|
{"patloop0", &CmdProxy::PatternLoopAddresses},
|
||||||
{"patloop1", &CmdProxy::PatternLoopAddresses},
|
{"patloop1", &CmdProxy::PatternLoopAddresses},
|
||||||
{"patloop2", &CmdProxy::PatternLoopAddresses},
|
{"patloop2", &CmdProxy::PatternLoopAddresses},
|
||||||
{"patnloop", &CmdProxy::PatternLoopCycles},
|
|
||||||
{"patnloop0", &CmdProxy::PatternLoopCycles},
|
{"patnloop0", &CmdProxy::PatternLoopCycles},
|
||||||
{"patnloop1", &CmdProxy::PatternLoopCycles},
|
{"patnloop1", &CmdProxy::PatternLoopCycles},
|
||||||
{"patnloop2", &CmdProxy::PatternLoopCycles},
|
{"patnloop2", &CmdProxy::PatternLoopCycles},
|
||||||
{"patwait", &CmdProxy::PatternWaitAddress},
|
|
||||||
{"patwait0", &CmdProxy::PatternWaitAddress},
|
{"patwait0", &CmdProxy::PatternWaitAddress},
|
||||||
{"patwait1", &CmdProxy::PatternWaitAddress},
|
{"patwait1", &CmdProxy::PatternWaitAddress},
|
||||||
{"patwait2", &CmdProxy::PatternWaitAddress},
|
{"patwait2", &CmdProxy::PatternWaitAddress},
|
||||||
{"patwaittime", &CmdProxy::PatternWaitTime},
|
|
||||||
{"patwaittime0", &CmdProxy::PatternWaitTime},
|
{"patwaittime0", &CmdProxy::PatternWaitTime},
|
||||||
{"patwaittime1", &CmdProxy::PatternWaitTime},
|
{"patwaittime1", &CmdProxy::PatternWaitTime},
|
||||||
{"patwaittime2", &CmdProxy::PatternWaitTime},
|
{"patwaittime2", &CmdProxy::PatternWaitTime},
|
||||||
@ -1196,7 +1193,6 @@ class CmdProxy {
|
|||||||
/* Pattern */
|
/* Pattern */
|
||||||
std::string Pattern(int action);
|
std::string Pattern(int action);
|
||||||
std::string PatternWord(int action);
|
std::string PatternWord(int action);
|
||||||
void GetLevelAndUpdateArgIndex(int action, std::string levelSeparatedCommand, int& level, int& iArg, size_t nGetArgs, size_t nPutArgs);
|
|
||||||
std::string PatternLoopAddresses(int action);
|
std::string PatternLoopAddresses(int action);
|
||||||
std::string PatternLoopCycles(int action);
|
std::string PatternLoopCycles(int action);
|
||||||
std::string PatternWaitAddress(int action);
|
std::string PatternWaitAddress(int action);
|
||||||
@ -1762,6 +1758,10 @@ class CmdProxy {
|
|||||||
"Resets Region of interest in receiver. Default is all "
|
"Resets Region of interest in receiver. Default is all "
|
||||||
"channels/pixels enabled.");
|
"channels/pixels enabled.");
|
||||||
|
|
||||||
|
INTEGER_COMMAND_VEC_ID(
|
||||||
|
rx_bunchsize, getRxBunchSize, setRxBunchSize, StringTo<int>,
|
||||||
|
"[n_frames]\n\tSet the number of frames the receiver listens to before pushing into fifo (buffer between listener and writer threads). Higher number results in fewer locks between fifo access. Default is 1. Expect signed 32 bit integer. ");
|
||||||
|
|
||||||
/* File */
|
/* File */
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
|
@ -1225,6 +1225,14 @@ void Detector::setRxROI(const defs::ROI value) { pimpl->setRxROI(value); }
|
|||||||
|
|
||||||
void Detector::clearRxROI() { pimpl->clearRxROI(); }
|
void Detector::clearRxROI() { pimpl->clearRxROI(); }
|
||||||
|
|
||||||
|
Result<int> Detector::getRxBunchSize(Positions pos) const {
|
||||||
|
return pimpl->Parallel(&Module::getRxBunchSize, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setRxBunchSize(int value, Positions pos) {
|
||||||
|
pimpl->Parallel(&Module::setRxBunchSize, pos, value);
|
||||||
|
}
|
||||||
|
|
||||||
// File
|
// File
|
||||||
|
|
||||||
Result<defs::fileFormat> Detector::getFileFormat(Positions pos) const {
|
Result<defs::fileFormat> Detector::getFileFormat(Positions pos) const {
|
||||||
|
@ -1388,6 +1388,15 @@ void Module::setRxROIMetadata(const slsDetectorDefs::ROI arg) {
|
|||||||
sendToReceiver(F_RECEIVER_SET_RECEIVER_ROI_METADATA, arg, nullptr);
|
sendToReceiver(F_RECEIVER_SET_RECEIVER_ROI_METADATA, arg, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Module::getRxBunchSize() const {
|
||||||
|
return sendToReceiver<int>(F_GET_RECEIVER_BUNCH_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Module::setRxBunchSize(int value) {
|
||||||
|
sendToReceiver<int>(F_SET_RECEIVER_BUNCH_SIZE, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// File
|
// File
|
||||||
slsDetectorDefs::fileFormat Module::getFileFormat() const {
|
slsDetectorDefs::fileFormat Module::getFileFormat() const {
|
||||||
return sendToReceiver<fileFormat>(F_GET_RECEIVER_FILE_FORMAT);
|
return sendToReceiver<fileFormat>(F_GET_RECEIVER_FILE_FORMAT);
|
||||||
|
@ -294,6 +294,8 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
defs::ROI getRxROI() const;
|
defs::ROI getRxROI() const;
|
||||||
void setRxROI(const slsDetectorDefs::ROI arg);
|
void setRxROI(const slsDetectorDefs::ROI arg);
|
||||||
void setRxROIMetadata(const slsDetectorDefs::ROI arg);
|
void setRxROIMetadata(const slsDetectorDefs::ROI arg);
|
||||||
|
int getRxBunchSize() const;
|
||||||
|
void setRxBunchSize(int value);
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
|
@ -29,12 +29,8 @@ bool Pattern::operator==(const Pattern &other) const {
|
|||||||
if (pat->limits[i] != other.pat->limits[i])
|
if (pat->limits[i] != other.pat->limits[i])
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < (sizeof(pat->startloop) / sizeof(pat->startloop[0])); ++i) {
|
for (size_t i = 0; i < (sizeof(pat->loop) / sizeof(pat->loop[0])); ++i) {
|
||||||
if (pat->startloop[i] != other.pat->startloop[i])
|
if (pat->loop[i] != other.pat->loop[i])
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (size_t i = 0; i < (sizeof(pat->stoploop) / sizeof(pat->stoploop[0])); ++i) {
|
|
||||||
if (pat->stoploop[i] != other.pat->stoploop[i])
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < (sizeof(pat->nloop) / sizeof(pat->nloop[0])); ++i) {
|
for (size_t i = 0; i < (sizeof(pat->nloop) / sizeof(pat->nloop[0])); ++i) {
|
||||||
@ -67,13 +63,13 @@ void Pattern::validate() const {
|
|||||||
ToString(pat->limits[0]) + std::string(", ") +
|
ToString(pat->limits[0]) + std::string(", ") +
|
||||||
ToString(pat->limits[1]) + std::string("]"));
|
ToString(pat->limits[1]) + std::string("]"));
|
||||||
}
|
}
|
||||||
for (int i = 0; i != MAX_PATTERN_LEVELS; ++i) {
|
for (int i = 0; i != 3; ++i) {
|
||||||
if (pat->startloop[i] >= MAX_PATTERN_LENGTH ||
|
if (pat->loop[i * 2 + 0] >= MAX_PATTERN_LENGTH ||
|
||||||
pat->stoploop[i] >= MAX_PATTERN_LENGTH) {
|
pat->loop[i * 2 + 1] >= MAX_PATTERN_LENGTH) {
|
||||||
throw RuntimeError(
|
throw RuntimeError(
|
||||||
"Invalid Pattern loop address for level " + ToString(i) +
|
"Invalid Pattern loop address for level " + ToString(i) +
|
||||||
std::string(" [") + ToString(pat->startloop[i]) +
|
std::string(" [") + ToString(pat->loop[i * 2 + 0]) +
|
||||||
std::string(", ") + ToString(pat->stoploop[i]) +
|
std::string(", ") + ToString(pat->loop[i * 2 + 1]) +
|
||||||
std::string("]"));
|
std::string("]"));
|
||||||
}
|
}
|
||||||
if (pat->wait[i] >= MAX_PATTERN_LENGTH) {
|
if (pat->wait[i] >= MAX_PATTERN_LENGTH) {
|
||||||
@ -129,94 +125,41 @@ void Pattern::load(const std::string &fname) {
|
|||||||
}
|
}
|
||||||
pat->limits[0] = StringTo<uint32_t>(args[1]);
|
pat->limits[0] = StringTo<uint32_t>(args[1]);
|
||||||
pat->limits[1] = StringTo<uint32_t>(args[2]);
|
pat->limits[1] = StringTo<uint32_t>(args[2]);
|
||||||
}
|
} else if (cmd == "patloop0" || cmd == "patloop1" ||
|
||||||
else if (cmd == "patloop0" || cmd == "patloop1" ||
|
cmd == "patloop2") {
|
||||||
cmd == "patloop2" || cmd == "patloop") {
|
|
||||||
int level = -1, iArg = 1;
|
|
||||||
if (cmd == "patloop") {
|
|
||||||
if (nargs != 3) {
|
|
||||||
throw RuntimeError("Invalid arguments for " +
|
|
||||||
ToString(args));
|
|
||||||
}
|
|
||||||
level = StringTo<int>(args[iArg++]);
|
|
||||||
} else {
|
|
||||||
LOG(logWARNING) << "Depreciated command. Please use patloop next time.";
|
|
||||||
if (nargs != 2) {
|
if (nargs != 2) {
|
||||||
throw RuntimeError("Invalid arguments for " +
|
throw RuntimeError("Invalid arguments for " +
|
||||||
ToString(args));
|
ToString(args));
|
||||||
}
|
}
|
||||||
level = cmd[cmd.find_first_of("012")] - '0';
|
int level = cmd[cmd.find_first_of("012")] - '0';
|
||||||
}
|
int loop1 = StringTo<uint32_t>(args[1]);
|
||||||
if (level < 0 || level >= MAX_PATTERN_LEVELS) {
|
int loop2 = StringTo<uint32_t>(args[2]);
|
||||||
throw RuntimeError("Invalid Pattern level. Options 0-" + std::to_string(MAX_PATTERN_LEVELS - 1));
|
pat->loop[level * 2 + 0] = loop1;
|
||||||
}
|
pat->loop[level * 2 + 1] = loop2;
|
||||||
int loop1 = StringTo<uint32_t>(args[iArg++]);
|
|
||||||
int loop2 = StringTo<uint32_t>(args[iArg++]);
|
|
||||||
pat->startloop[level] = loop1;
|
|
||||||
pat->stoploop[level] = loop2;
|
|
||||||
} else if (cmd == "patnloop0" || cmd == "patnloop1" ||
|
} else if (cmd == "patnloop0" || cmd == "patnloop1" ||
|
||||||
cmd == "patnloop2" || cmd == "patnloop") {
|
cmd == "patnloop2") {
|
||||||
int level = -1, iArg = 1;
|
|
||||||
if (cmd == "patnloop") {
|
|
||||||
if (nargs != 2) {
|
|
||||||
throw RuntimeError("Invalid arguments for " +
|
|
||||||
ToString(args));
|
|
||||||
}
|
|
||||||
level = StringTo<int>(args[iArg++]);
|
|
||||||
} else {
|
|
||||||
LOG(logWARNING) << "Depreciated command. Please use patnloop next time.";
|
|
||||||
if (nargs != 1) {
|
if (nargs != 1) {
|
||||||
throw RuntimeError("Invalid arguments for " +
|
throw RuntimeError("Invalid arguments for " +
|
||||||
ToString(args));
|
ToString(args));
|
||||||
}
|
}
|
||||||
level = cmd[cmd.find_first_of("012")] - '0';
|
int level = cmd[cmd.find_first_of("012")] - '0';
|
||||||
}
|
pat->nloop[level] = StringTo<uint32_t>(args[1]);
|
||||||
if (level < 0 || level >= MAX_PATTERN_LEVELS) {
|
|
||||||
throw RuntimeError("Invalid Pattern level. Options 0-" + std::to_string(MAX_PATTERN_LEVELS - 1));
|
|
||||||
}
|
|
||||||
pat->nloop[level] = StringTo<uint32_t>(args[iArg++]);
|
|
||||||
} else if (cmd == "patwait0" || cmd == "patwait1" ||
|
} else if (cmd == "patwait0" || cmd == "patwait1" ||
|
||||||
cmd == "patwait2" || cmd == "patwait") {
|
cmd == "patwait2") {
|
||||||
int level = -1, iArg = 1;
|
|
||||||
if (cmd == "patwait") {
|
|
||||||
if (nargs != 2) {
|
|
||||||
throw RuntimeError("Invalid arguments for " +
|
|
||||||
ToString(args));
|
|
||||||
}
|
|
||||||
level = StringTo<int>(args[iArg++]);
|
|
||||||
} else {
|
|
||||||
LOG(logWARNING) << "Depreciated command. Please use patwait next time.";
|
|
||||||
if (nargs != 1) {
|
if (nargs != 1) {
|
||||||
throw RuntimeError("Invalid arguments for " +
|
throw RuntimeError("Invalid arguments for " +
|
||||||
ToString(args));
|
ToString(args));
|
||||||
}
|
}
|
||||||
level = cmd[cmd.find_first_of("012")] - '0';
|
int level = cmd[cmd.find_first_of("012")] - '0';
|
||||||
}
|
pat->wait[level] = StringTo<uint32_t>(args[1]);
|
||||||
if (level < 0 || level >= MAX_PATTERN_LEVELS) {
|
|
||||||
throw RuntimeError("Invalid Pattern level. Options 0-" + std::to_string(MAX_PATTERN_LEVELS - 1));
|
|
||||||
}
|
|
||||||
pat->wait[level] = StringTo<uint32_t>(args[iArg++]);
|
|
||||||
} else if (cmd == "patwaittime0" || cmd == "patwaittime1" ||
|
} else if (cmd == "patwaittime0" || cmd == "patwaittime1" ||
|
||||||
cmd == "patwaittime2" || cmd == "patwaittime") {
|
cmd == "patwaittime2") {
|
||||||
int level = -1, iArg = 1;
|
|
||||||
if (cmd == "patwaittime") {
|
|
||||||
if (nargs != 2) {
|
|
||||||
throw RuntimeError("Invalid arguments for " +
|
|
||||||
ToString(args));
|
|
||||||
}
|
|
||||||
level = StringTo<int>(args[iArg++]);
|
|
||||||
} else {
|
|
||||||
LOG(logWARNING) << "Depreciated command. Please use patwaittime next time.";
|
|
||||||
if (nargs != 1) {
|
if (nargs != 1) {
|
||||||
throw RuntimeError("Invalid arguments for " +
|
throw RuntimeError("Invalid arguments for " +
|
||||||
ToString(args));
|
ToString(args));
|
||||||
}
|
}
|
||||||
level = cmd[cmd.find_first_of("012")] - '0';
|
int level = cmd[cmd.find_first_of("012")] - '0';
|
||||||
}
|
pat->waittime[level] = StringTo<uint64_t>(args[1]);
|
||||||
if (level < 0 || level >= MAX_PATTERN_LEVELS) {
|
|
||||||
throw RuntimeError("Invalid Pattern level. Options 0-" + std::to_string(MAX_PATTERN_LEVELS - 1));
|
|
||||||
}
|
|
||||||
pat->waittime[level] = StringTo<uint64_t>(args[iArg++]);
|
|
||||||
} else {
|
} else {
|
||||||
throw RuntimeError("Unknown command in pattern file " + cmd);
|
throw RuntimeError("Unknown command in pattern file " + cmd);
|
||||||
}
|
}
|
||||||
@ -244,21 +187,21 @@ void Pattern::save(const std::string &fname) {
|
|||||||
output_file << "patlimits " << ToStringHex(pat->limits[0], 4) << " "
|
output_file << "patlimits " << ToStringHex(pat->limits[0], 4) << " "
|
||||||
<< ToStringHex(pat->limits[1], 4) << std::endl;
|
<< ToStringHex(pat->limits[1], 4) << std::endl;
|
||||||
|
|
||||||
for (size_t i = 0; i < MAX_PATTERN_LEVELS; ++i) {
|
for (size_t i = 0; i < 3; ++i) {
|
||||||
// patloop
|
// patloop
|
||||||
output_file << "patloop " << i << " "
|
output_file << "patloop" << i << " "
|
||||||
<< ToStringHex(pat->startloop[i], 4) << " "
|
<< ToStringHex(pat->loop[i * 2 + 0], 4) << " "
|
||||||
<< ToStringHex(pat->stoploop[i], 4) << std::endl;
|
<< ToStringHex(pat->loop[i * 2 + 1], 4) << std::endl;
|
||||||
// patnloop
|
// patnloop
|
||||||
output_file << "patnloop " << i << " " << pat->nloop[i] << std::endl;
|
output_file << "patnloop" << i << " " << pat->nloop[i] << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < MAX_PATTERN_LEVELS; ++i) {
|
for (size_t i = 0; i < 3; ++i) {
|
||||||
// patwait
|
// patwait
|
||||||
output_file << "patwait " << i << " " << ToStringHex(pat->wait[i], 4)
|
output_file << "patwait" << i << " " << ToStringHex(pat->wait[i], 4)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
// patwaittime
|
// patwaittime
|
||||||
output_file << "patwaittime " << i << " " << pat->waittime[i]
|
output_file << "patwaittime" << i << " " << pat->waittime[i]
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -276,17 +219,23 @@ std::string Pattern::str() const {
|
|||||||
}
|
}
|
||||||
oss << "patioctrl " << ToStringHex(pat->ioctrl, word_width) << std::endl
|
oss << "patioctrl " << ToStringHex(pat->ioctrl, word_width) << std::endl
|
||||||
<< "patlimits " << ToStringHex(pat->limits[0], addr_width) << " "
|
<< "patlimits " << ToStringHex(pat->limits[0], addr_width) << " "
|
||||||
<< ToStringHex(pat->limits[1], addr_width) << std::endl;
|
<< ToStringHex(pat->limits[1], addr_width) << std::endl
|
||||||
|
<< "patloop0 " << ToStringHex(pat->loop[0], addr_width) << " "
|
||||||
for (int i = 0; i != MAX_PATTERN_LEVELS; ++i) {
|
<< ToStringHex(pat->loop[1], addr_width) << std::endl
|
||||||
oss << "patloop " << i << ' ' << ToStringHex(pat->startloop[i], addr_width) << " "
|
<< "patnloop0 " << pat->nloop[0] << std::endl
|
||||||
<< ToStringHex(pat->stoploop[i], addr_width) << std::endl
|
<< "patloop1 " << ToStringHex(pat->loop[2], addr_width) << " "
|
||||||
<< "patnloop " << pat->nloop[i] << std::endl
|
<< ToStringHex(pat->loop[3], addr_width) << std::endl
|
||||||
<< "patwait " << i << ' ' << ToStringHex(pat->wait[i], addr_width) << std::endl
|
<< "patnloop1 " << pat->nloop[1] << std::endl
|
||||||
<< "patwaittime " << i << ' ' << pat->waittime[i] << std::endl;
|
<< "patloop2 " << ToStringHex(pat->loop[4], addr_width) << " "
|
||||||
}
|
<< ToStringHex(pat->loop[5], addr_width) << std::endl
|
||||||
|
<< "patnloop2 " << pat->nloop[2] << std::endl
|
||||||
oss << ']';
|
<< "patwait0 " << ToStringHex(pat->wait[0], addr_width) << std::endl
|
||||||
|
<< "patwaittime0 " << pat->waittime[0] << std::endl
|
||||||
|
<< "patwait1 " << ToStringHex(pat->wait[1], addr_width) << std::endl
|
||||||
|
<< "patwaittime1 " << pat->waittime[1] << std::endl
|
||||||
|
<< "patwait2 " << ToStringHex(pat->wait[2], addr_width) << std::endl
|
||||||
|
<< "patwaittime2 " << pat->waittime[2] << std::endl
|
||||||
|
<< ']';
|
||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,187 +154,315 @@ TEST_CASE("patlimits", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patloop", "[.cmd]") {
|
TEST_CASE("patloop0", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||||
det_type == defs::MYTHEN3) {
|
det_type == defs::MYTHEN3) {
|
||||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
auto prev_val = det.getPatternLoopAddresses(0);
|
||||||
// m3 only has 3 levels
|
{
|
||||||
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
auto prev_val = det.getPatternLoopAddresses(iLoop);
|
|
||||||
std::string sLoop = ToString(iLoop);
|
|
||||||
if (iLoop < 3) {
|
|
||||||
std::string deprecatedCmd = "patloop" + sLoop;
|
|
||||||
{// depreciated
|
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call(deprecatedCmd, {"0x20", "0x5c"}, -1, PUT, oss);
|
proxy.Call("patloop0", {"0x20", "0x5c"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " [0x0020, 0x005c]\n");
|
REQUIRE(oss.str() == "patloop0 [0x0020, 0x005c]\n");
|
||||||
}
|
|
||||||
{// depreciated
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call(deprecatedCmd, {}, -1, GET, oss);
|
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " [0x0020, 0x005c]\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patloop", {sLoop, "0x20", "0x5c"}, -1, PUT, oss);
|
proxy.Call("patloop0", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "patloop [0x0020, 0x005c]\n");
|
REQUIRE(oss.str() == "patloop0 [0x0020, 0x005c]\n");
|
||||||
}
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call("patloop", {sLoop}, -1, GET, oss);
|
|
||||||
REQUIRE(oss.str() == "patloop [0x0020, 0x005c]\n");
|
|
||||||
}
|
|
||||||
for (int iDet = 0; iDet != det.size(); ++iDet) {
|
|
||||||
det.setPatternLoopAddresses(iLoop, prev_val[iDet][0], prev_val[iDet][1], {iDet});
|
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setPatternLoopAddresses(0, prev_val[i][0], prev_val[i][1], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("patloop", {"0"}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("patloop0", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patnloop", "[.cmd]") {
|
TEST_CASE("patloop1", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||||
det_type == defs::MYTHEN3) {
|
det_type == defs::MYTHEN3) {
|
||||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
auto prev_val = det.getPatternLoopAddresses(1);
|
||||||
// m3 only has 3 levels
|
{
|
||||||
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
auto prev_val = det.getPatternLoopCycles(iLoop);
|
|
||||||
std::string sLoop = ToString(iLoop);
|
|
||||||
if (iLoop < 3) {
|
|
||||||
std::string deprecatedCmd = "patnloop" + sLoop;
|
|
||||||
{// depreciated
|
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call(deprecatedCmd, {"5"}, -1, PUT, oss);
|
proxy.Call("patloop1", {"0x20", "0x5c"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " 5\n");
|
REQUIRE(oss.str() == "patloop1 [0x0020, 0x005c]\n");
|
||||||
}
|
|
||||||
{// depreciated
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call(deprecatedCmd, {}, -1, GET, oss);
|
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " 5\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patnloop", {sLoop, "5"}, -1, PUT, oss);
|
proxy.Call("patloop1", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "patnloop 5\n");
|
REQUIRE(oss.str() == "patloop1 [0x0020, 0x005c]\n");
|
||||||
}
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call("patnloop", {sLoop}, -1, GET, oss);
|
|
||||||
REQUIRE(oss.str() == "patnloop 5\n");
|
|
||||||
}
|
|
||||||
for (int iDet = 0; iDet != det.size(); ++iDet) {
|
|
||||||
det.setPatternLoopCycles(iLoop, prev_val[iDet], {iDet});
|
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setPatternLoopAddresses(1, prev_val[i][0], prev_val[i][1], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("patnloop", {"0"}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("patloop1", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patwait", "[.cmd]") {
|
TEST_CASE("patloop2", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||||
det_type == defs::MYTHEN3) {
|
det_type == defs::MYTHEN3) {
|
||||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
auto prev_val = det.getPatternLoopAddresses(2);
|
||||||
// m3 only has 3 levels
|
{
|
||||||
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
auto prev_val = det.getPatternWaitAddr(iLoop);
|
|
||||||
std::string sLoop = ToString(iLoop);
|
|
||||||
if (iLoop < 3) {
|
|
||||||
std::string deprecatedCmd = "patwait" + sLoop;
|
|
||||||
{// depreciated
|
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call(deprecatedCmd, {"0x5c"}, -1, PUT, oss);
|
proxy.Call("patloop2", {"0x20", "0x5c"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " 0x005c\n");
|
REQUIRE(oss.str() == "patloop2 [0x0020, 0x005c]\n");
|
||||||
}
|
|
||||||
{// depreciated
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call(deprecatedCmd, {}, -1, GET, oss);
|
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " 0x005c\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patwait", {sLoop, "0x5c"}, -1, PUT, oss);
|
proxy.Call("patloop2", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "patwait 0x005c\n");
|
REQUIRE(oss.str() == "patloop2 [0x0020, 0x005c]\n");
|
||||||
}
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call("patwait", {sLoop}, -1, GET, oss);
|
|
||||||
REQUIRE(oss.str() == "patwait 0x005c\n");
|
|
||||||
}
|
|
||||||
for (int iDet = 0; iDet != det.size(); ++iDet) {
|
|
||||||
det.setPatternWaitAddr(iLoop, prev_val[iDet], {iDet});
|
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setPatternLoopAddresses(2, prev_val[i][0], prev_val[i][1], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("patwait", {"0"}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("patloop2", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patwaittime", "[.cmd]") {
|
TEST_CASE("patnloop0", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||||
det_type == defs::MYTHEN3) {
|
det_type == defs::MYTHEN3) {
|
||||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
auto prev_val = det.getPatternLoopCycles(0);
|
||||||
// m3 only has 3 levels
|
{
|
||||||
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
auto prev_val = det.getPatternWaitTime(iLoop);
|
|
||||||
std::string sLoop = ToString(iLoop);
|
|
||||||
if (iLoop < 3) {
|
|
||||||
std::string deprecatedCmd = "patwaittime" + sLoop;
|
|
||||||
{// depreciated
|
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call(deprecatedCmd, {"8589936640"}, -1, PUT, oss);
|
proxy.Call("patnloop0", {"5"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " 8589936640\n");
|
REQUIRE(oss.str() == "patnloop0 5\n");
|
||||||
}
|
|
||||||
{// depreciated
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call(deprecatedCmd, {}, -1, GET, oss);
|
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " 8589936640\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patwaittime", {sLoop, "8589936640"}, -1, PUT, oss);
|
proxy.Call("patnloop0", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "patwaittime 8589936640\n");
|
REQUIRE(oss.str() == "patnloop0 5\n");
|
||||||
}
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call("patwaittime", {sLoop}, -1, GET, oss);
|
|
||||||
REQUIRE(oss.str() == "patwaittime 8589936640\n");
|
|
||||||
}
|
|
||||||
for (int iDet = 0; iDet != det.size(); ++iDet) {
|
|
||||||
det.setPatternWaitTime(iLoop, prev_val[iDet], {iDet});
|
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setPatternLoopCycles(0, prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("patwaittime", {"0"}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("patnloop0", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("patnloop1", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||||
|
det_type == defs::MYTHEN3) {
|
||||||
|
auto prev_val = det.getPatternLoopCycles(1);
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("patnloop1", {"5"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "patnloop1 5\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("patnloop1", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "patnloop1 5\n");
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setPatternLoopCycles(1, prev_val[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("patnloop1", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("patnloop2", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||||
|
det_type == defs::MYTHEN3) {
|
||||||
|
auto prev_val = det.getPatternLoopCycles(2);
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("patnloop2", {"5"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "patnloop2 5\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("patnloop2", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "patnloop2 5\n");
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setPatternLoopCycles(2, prev_val[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("patnloop2", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("patwait0", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||||
|
det_type == defs::MYTHEN3) {
|
||||||
|
auto prev_val = det.getPatternWaitAddr(0);
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("patwait0", {"0x5c"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "patwait0 0x005c\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("patwait0", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "patwait0 0x005c\n");
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setPatternWaitAddr(0, prev_val[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("patwait0", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("patwait1", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||||
|
det_type == defs::MYTHEN3) {
|
||||||
|
auto prev_val = det.getPatternWaitAddr(1);
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("patwait1", {"0x5c"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "patwait1 0x005c\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("patwait1", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "patwait1 0x005c\n");
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setPatternWaitAddr(1, prev_val[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("patwait1", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("patwait2", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||||
|
det_type == defs::MYTHEN3) {
|
||||||
|
auto prev_val = det.getPatternWaitAddr(2);
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("patwait2", {"0x5c"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "patwait2 0x005c\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("patwait2", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "patwait2 0x005c\n");
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setPatternWaitAddr(2, prev_val[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("patwait2", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("patwaittime0", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||||
|
det_type == defs::MYTHEN3) {
|
||||||
|
auto prev_val = det.getPatternWaitTime(0);
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("patwaittime0", {"8589936640"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "patwaittime0 8589936640\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("patwaittime0", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "patwaittime0 8589936640\n");
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setPatternWaitTime(0, prev_val[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("patwaittime0", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("patwaittime1", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||||
|
det_type == defs::MYTHEN3) {
|
||||||
|
auto prev_val = det.getPatternWaitTime(1);
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("patwaittime1", {"8589936640"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "patwaittime1 8589936640\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("patwaittime1", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "patwaittime1 8589936640\n");
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setPatternWaitTime(1, prev_val[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("patwaittime1", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("patwaittime2", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||||
|
det_type == defs::MYTHEN3) {
|
||||||
|
auto prev_val = det.getPatternWaitTime(2);
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("patwaittime2", {"8589936640"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "patwaittime2 8589936640\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("patwaittime2", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "patwaittime2 8589936640\n");
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setPatternWaitTime(2, prev_val[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("patwaittime2", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,6 +254,7 @@ TEST_CASE("rx_fifodepth", "[.cmd][.rx]") {
|
|||||||
proxy.Call("rx_fifodepth", {}, -1, GET, oss);
|
proxy.Call("rx_fifodepth", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "rx_fifodepth 100\n");
|
REQUIRE(oss.str() == "rx_fifodepth 100\n");
|
||||||
}
|
}
|
||||||
|
REQUIRE_THROWS(proxy.Call("rx_fifodepth", {"0"}, -1, PUT));
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setRxFifoDepth(prev_val[i], {i});
|
det.setRxFifoDepth(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
@ -513,6 +514,32 @@ TEST_CASE("rx_clearroi", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST_CASE("rx_bunchsize", "[.cmd][.rx]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto prev_val = det.getRxBunchSize();
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("rx_bunchsize", {"10"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "rx_bunchsize 10\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("rx_bunchsize", {"100"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "rx_bunchsize 100\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("rx_bunchsize", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "rx_bunchsize 100\n");
|
||||||
|
}
|
||||||
|
REQUIRE_THROWS(proxy.Call("rx_bunchsize", {"0"}, -1, PUT));
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setRxBunchSize(prev_val[i], {i});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* File */
|
/* File */
|
||||||
|
|
||||||
TEST_CASE("fformat", "[.cmd]") {
|
TEST_CASE("fformat", "[.cmd]") {
|
||||||
|
@ -14,9 +14,9 @@ TEST_CASE("Pattern is default constructable and has zeroed fields") {
|
|||||||
|
|
||||||
TEST_CASE("Copy construct pattern") {
|
TEST_CASE("Copy construct pattern") {
|
||||||
Pattern p;
|
Pattern p;
|
||||||
p.data()->startloop[0] = 7;
|
p.data()->loop[0] = 7;
|
||||||
Pattern p1(p);
|
Pattern p1(p);
|
||||||
REQUIRE(p1.data()->startloop[0] == 7);
|
REQUIRE(p1.data()->loop[0] == 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Compare patterns") {
|
TEST_CASE("Compare patterns") {
|
||||||
|
@ -223,6 +223,8 @@ int ClientInterface::functionTable(){
|
|||||||
flist[F_RECEIVER_GET_RECEIVER_ROI] = &ClientInterface::get_receiver_roi;
|
flist[F_RECEIVER_GET_RECEIVER_ROI] = &ClientInterface::get_receiver_roi;
|
||||||
flist[F_RECEIVER_SET_RECEIVER_ROI] = &ClientInterface::set_receiver_roi;
|
flist[F_RECEIVER_SET_RECEIVER_ROI] = &ClientInterface::set_receiver_roi;
|
||||||
flist[F_RECEIVER_SET_RECEIVER_ROI_METADATA] = &ClientInterface::set_receiver_roi_metadata;
|
flist[F_RECEIVER_SET_RECEIVER_ROI_METADATA] = &ClientInterface::set_receiver_roi_metadata;
|
||||||
|
flist[F_GET_RECEIVER_BUNCH_SIZE] = &ClientInterface::get_bunch_size;
|
||||||
|
flist[F_SET_RECEIVER_BUNCH_SIZE] = &ClientInterface::set_bunch_size;
|
||||||
|
|
||||||
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
|
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
|
||||||
LOG(logDEBUG1) << "function fnum: " << i << " (" <<
|
LOG(logDEBUG1) << "function fnum: " << i << " (" <<
|
||||||
@ -1176,7 +1178,7 @@ int ClientInterface::get_additional_json_header(Interface &socket) {
|
|||||||
int ClientInterface::set_udp_socket_buffer_size(Interface &socket) {
|
int ClientInterface::set_udp_socket_buffer_size(Interface &socket) {
|
||||||
auto size = socket.Receive<int>();
|
auto size = socket.Receive<int>();
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
throw RuntimeError("Receiver socket buffer size must be > 0.");
|
throw RuntimeError("Receiver socket buffer size must be greater than 0.");
|
||||||
}
|
}
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
verifyIdle(socket);
|
verifyIdle(socket);
|
||||||
@ -1780,4 +1782,29 @@ int ClientInterface::set_receiver_roi_metadata(Interface &socket) {
|
|||||||
return socket.Send(OK);
|
return socket.Send(OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ClientInterface::get_bunch_size(Interface &socket) {
|
||||||
|
int retval = static_cast<int>(impl()->getBunchSize());
|
||||||
|
LOG(logDEBUG1) << "bunch size retval:" << retval;
|
||||||
|
return socket.sendResult(retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ClientInterface::set_bunch_size(Interface &socket) {
|
||||||
|
auto value = socket.Receive<int>();
|
||||||
|
if (value <= 0) {
|
||||||
|
throw RuntimeError("Could not set rx bunch size. Must be greater than 0.");
|
||||||
|
}
|
||||||
|
verifyIdle(socket);
|
||||||
|
LOG(logDEBUG1) << "Setting bunch size:" << value;
|
||||||
|
try {
|
||||||
|
impl()->setBunchSize(static_cast<size_t>(value));
|
||||||
|
} catch (const RuntimeError &e) {
|
||||||
|
throw RuntimeError("Could not set rx bunch size due to fifo structure memory allocation.");
|
||||||
|
}
|
||||||
|
|
||||||
|
int retval = impl()->getBunchSize();
|
||||||
|
validate(value, retval, std::string("set bunch size"), DEC);
|
||||||
|
LOG(logDEBUG1) << "bunch size retval:" << retval;
|
||||||
|
return socket.sendResult(retval);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace sls
|
} // namespace sls
|
||||||
|
@ -170,6 +170,9 @@ class ClientInterface : private virtual slsDetectorDefs {
|
|||||||
int get_receiver_roi(ServerInterface &socket);
|
int get_receiver_roi(ServerInterface &socket);
|
||||||
int set_receiver_roi(ServerInterface &socket);
|
int set_receiver_roi(ServerInterface &socket);
|
||||||
int set_receiver_roi_metadata(ServerInterface &socket);
|
int set_receiver_roi_metadata(ServerInterface &socket);
|
||||||
|
int get_bunch_size(ServerInterface &socket);
|
||||||
|
int set_bunch_size(ServerInterface &socket);
|
||||||
|
|
||||||
|
|
||||||
Implementation *impl() {
|
Implementation *impl() {
|
||||||
if (receiver != nullptr) {
|
if (receiver != nullptr) {
|
||||||
|
@ -44,6 +44,7 @@ DataProcessor::DataProcessor(int index, detectorType detectorType, Fifo *fifo,
|
|||||||
ctbAnalogDataBytes_(ctbAnalogDataBytes) {
|
ctbAnalogDataBytes_(ctbAnalogDataBytes) {
|
||||||
|
|
||||||
LOG(logDEBUG) << "DataProcessor " << index << " created";
|
LOG(logDEBUG) << "DataProcessor " << index << " created";
|
||||||
|
vetoThread = (detectorType_ == GOTTHARD2 && index != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataProcessor::~DataProcessor() { DeleteFiles(); }
|
DataProcessor::~DataProcessor() { DeleteFiles(); }
|
||||||
@ -57,7 +58,10 @@ void DataProcessor::SetActivate(bool enable) { activated_ = enable; }
|
|||||||
void DataProcessor::SetReceiverROI(ROI roi) {
|
void DataProcessor::SetReceiverROI(ROI roi) {
|
||||||
receiverRoi_ = roi;
|
receiverRoi_ = roi;
|
||||||
receiverRoiEnabled_ = receiverRoi_.completeRoi() ? false : true;
|
receiverRoiEnabled_ = receiverRoi_.completeRoi() ? false : true;
|
||||||
receiverNoRoi_ = receiverRoi_.noRoi();
|
}
|
||||||
|
|
||||||
|
void DataProcessor::SetBunchSize(size_t value) {
|
||||||
|
fifoBunchSize = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataProcessor::ResetParametersforNewAcquisition() {
|
void DataProcessor::ResetParametersforNewAcquisition() {
|
||||||
@ -69,6 +73,12 @@ void DataProcessor::ResetParametersforNewAcquisition() {
|
|||||||
firstStreamerFrame_ = true;
|
firstStreamerFrame_ = true;
|
||||||
streamCurrentFrame_ = false;
|
streamCurrentFrame_ = false;
|
||||||
completeImageToStreamBeforeCropping = make_unique<char[]>(generalData_->imageSize);
|
completeImageToStreamBeforeCropping = make_unique<char[]>(generalData_->imageSize);
|
||||||
|
|
||||||
|
fifoBunchSizeBytes = generalData_->imageSize;
|
||||||
|
if (vetoThread) {
|
||||||
|
fifoBunchSizeBytes = generalData_->vetoDataSize;
|
||||||
|
}
|
||||||
|
fifoBunchSizeBytes += generalData_->fifoBufferHeaderSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataProcessor::RecordFirstIndex(uint64_t fnum) {
|
void DataProcessor::RecordFirstIndex(uint64_t fnum) {
|
||||||
@ -126,8 +136,8 @@ void DataProcessor::CreateFirstFiles(
|
|||||||
}
|
}
|
||||||
CloseFiles();
|
CloseFiles();
|
||||||
|
|
||||||
// deactivated (half module/ single port or no roi), dont write file
|
// deactivated (half module/ single port), dont write file
|
||||||
if (!activated_ || !detectorDataStream || receiverNoRoi_) {
|
if (!activated_ || !detectorDataStream) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,31 +260,36 @@ std::string DataProcessor::CreateMasterFile(
|
|||||||
void DataProcessor::ThreadExecution() {
|
void DataProcessor::ThreadExecution() {
|
||||||
char *buffer = nullptr;
|
char *buffer = nullptr;
|
||||||
fifo_->PopAddress(buffer);
|
fifo_->PopAddress(buffer);
|
||||||
LOG(logDEBUG5) << "DataProcessor " << index << ", " << std::hex
|
LOG(logDEBUG1) << "DataProcessor " << index << ", " << std::hex
|
||||||
<< static_cast<void *>(buffer) << std::dec << ":" << buffer;
|
<< static_cast<void *>(buffer) << std::dec;
|
||||||
|
|
||||||
// check dummy
|
bool streamImageInBunch = false;
|
||||||
auto numBytes = *reinterpret_cast<uint32_t *>(buffer);
|
char* tempBuffer = buffer;
|
||||||
LOG(logDEBUG1) << "DataProcessor " << index << ", Numbytes:" << numBytes;
|
for (size_t iFrame = 0; iFrame != fifoBunchSize; iFrame ++) {
|
||||||
|
|
||||||
|
// end of acquisition (check dummy)
|
||||||
|
auto numBytes = *reinterpret_cast<uint32_t *>(tempBuffer);
|
||||||
|
LOG(logDEBUG1) << "DataProcessor " << index << ", Numbytes:" << numBytes << " " << std::hex << static_cast<void *>(tempBuffer) << std::dec;
|
||||||
if (numBytes == DUMMY_PACKET_VALUE) {
|
if (numBytes == DUMMY_PACKET_VALUE) {
|
||||||
StopProcessing(buffer);
|
StopProcessing(buffer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ProcessAnImage(buffer);
|
ProcessAnImage(tempBuffer);
|
||||||
} catch (const std::exception &e) {
|
if (streamCurrentFrame_) {
|
||||||
fifo_->FreeAddress(buffer);
|
streamImageInBunch = true;
|
||||||
return;
|
}
|
||||||
|
}
|
||||||
|
// exception from callback
|
||||||
|
catch (const std::exception &e) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
tempBuffer += fifoBunchSizeBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// stream (if time/freq to stream) or free
|
// stream or free
|
||||||
if (streamCurrentFrame_) {
|
if (streamImageInBunch) {
|
||||||
// copy the complete image back if roi enabled
|
|
||||||
if (receiverRoiEnabled_) {
|
|
||||||
(*((uint32_t *)buffer)) = generalData_->imageSize;
|
|
||||||
memcpy(buffer + generalData_->fifoBufferHeaderSize, &completeImageToStreamBeforeCropping[0], generalData_->imageSize);
|
|
||||||
}
|
|
||||||
fifo_->PushAddressToStream(buffer);
|
fifo_->PushAddressToStream(buffer);
|
||||||
} else {
|
} else {
|
||||||
fifo_->FreeAddress(buffer);
|
fifo_->FreeAddress(buffer);
|
||||||
@ -284,7 +299,7 @@ void DataProcessor::ThreadExecution() {
|
|||||||
void DataProcessor::StopProcessing(char *buf) {
|
void DataProcessor::StopProcessing(char *buf) {
|
||||||
LOG(logDEBUG1) << "DataProcessing " << index << ": Dummy";
|
LOG(logDEBUG1) << "DataProcessing " << index << ": Dummy";
|
||||||
|
|
||||||
// stream or free
|
// stream dummy or free
|
||||||
if (*dataStreamEnable_)
|
if (*dataStreamEnable_)
|
||||||
fifo_->PushAddressToStream(buf);
|
fifo_->PushAddressToStream(buf);
|
||||||
else
|
else
|
||||||
@ -340,8 +355,13 @@ void DataProcessor::ProcessAnImage(char *buf) {
|
|||||||
(uint32_t)(fnum - firstIndex_);
|
(uint32_t)(fnum - firstIndex_);
|
||||||
}
|
}
|
||||||
streamCurrentFrame_ = true;
|
streamCurrentFrame_ = true;
|
||||||
|
// needed to know which one to stream from the bunch
|
||||||
|
(*((uint32_t *)(buf + FIFO_HEADER_STREAM_ENABLE))) = 1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
streamCurrentFrame_ = false;
|
streamCurrentFrame_ = false;
|
||||||
|
// needed to know which one not to stream from the bunch
|
||||||
|
(*((uint32_t *)(buf + FIFO_HEADER_STREAM_ENABLE))) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -391,6 +411,15 @@ void DataProcessor::ProcessAnImage(char *buf) {
|
|||||||
// via stopReceiver tcp)
|
// via stopReceiver tcp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy the complete image back if roi enabled
|
||||||
|
if (streamCurrentFrame_) {
|
||||||
|
if (receiverRoiEnabled_) {
|
||||||
|
(*((uint32_t *)buf)) = generalData_->imageSize;
|
||||||
|
memcpy(buf + generalData_->fifoBufferHeaderSize, &completeImageToStreamBeforeCropping[0], generalData_->imageSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataProcessor::SendToStreamer() {
|
bool DataProcessor::SendToStreamer() {
|
||||||
@ -426,11 +455,11 @@ bool DataProcessor::CheckTimer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DataProcessor::CheckCount() {
|
bool DataProcessor::CheckCount() {
|
||||||
if (currentFreqCount_ == *streamingFrequency_) {
|
if (currentFreqCount_ >= *streamingFrequency_) {
|
||||||
currentFreqCount_ = 1;
|
currentFreqCount_ = 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
currentFreqCount_++;
|
++currentFreqCount_;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,7 +485,7 @@ void DataProcessor::PadMissingPackets(char *buf) {
|
|||||||
sls_bitset pmask = header->packetsMask;
|
sls_bitset pmask = header->packetsMask;
|
||||||
|
|
||||||
uint32_t dsize = generalData_->dataSize;
|
uint32_t dsize = generalData_->dataSize;
|
||||||
if (detectorType_ == GOTTHARD2 && index != 0) {
|
if (vetoThread) {
|
||||||
dsize = generalData_->vetoDataSize;
|
dsize = generalData_->vetoDataSize;
|
||||||
}
|
}
|
||||||
uint32_t fifohsize = generalData_->fifoBufferHeaderSize;
|
uint32_t fifohsize = generalData_->fifoBufferHeaderSize;
|
||||||
|
@ -44,6 +44,7 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
void SetReceiverROI(ROI roi);
|
void SetReceiverROI(ROI roi);
|
||||||
void ResetParametersforNewAcquisition();
|
void ResetParametersforNewAcquisition();
|
||||||
void SetGeneralData(GeneralData *generalData);
|
void SetGeneralData(GeneralData *generalData);
|
||||||
|
void SetBunchSize(size_t value);
|
||||||
|
|
||||||
void CloseFiles();
|
void CloseFiles();
|
||||||
void DeleteFiles();
|
void DeleteFiles();
|
||||||
@ -156,7 +157,8 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
bool activated_{false};
|
bool activated_{false};
|
||||||
ROI receiverRoi_{};
|
ROI receiverRoi_{};
|
||||||
bool receiverRoiEnabled_{false};
|
bool receiverRoiEnabled_{false};
|
||||||
bool receiverNoRoi_{false};
|
bool vetoThread{false};
|
||||||
|
|
||||||
std::unique_ptr<char[]> completeImageToStreamBeforeCropping;
|
std::unique_ptr<char[]> completeImageToStreamBeforeCropping;
|
||||||
/** if 0, sending random images with a timer */
|
/** if 0, sending random images with a timer */
|
||||||
uint32_t *streamingFrequency_;
|
uint32_t *streamingFrequency_;
|
||||||
@ -184,6 +186,10 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
|
|
||||||
File *dataFile_{nullptr};
|
File *dataFile_{nullptr};
|
||||||
|
|
||||||
|
size_t fifoBunchSize{0};
|
||||||
|
/** size in memory including headers */
|
||||||
|
size_t fifoBunchSizeBytes{0};
|
||||||
|
|
||||||
// call back
|
// call back
|
||||||
/**
|
/**
|
||||||
* Call back for raw data
|
* Call back for raw data
|
||||||
|
@ -18,14 +18,15 @@ namespace sls {
|
|||||||
|
|
||||||
const std::string DataStreamer::TypeName = "DataStreamer";
|
const std::string DataStreamer::TypeName = "DataStreamer";
|
||||||
|
|
||||||
DataStreamer::DataStreamer(int ind, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi,
|
DataStreamer::DataStreamer(int ind, detectorType dType, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi,
|
||||||
bool fr, slsDetectorDefs::xy np, bool *qe,
|
bool fr, slsDetectorDefs::xy np, bool *qe,
|
||||||
uint64_t *tot)
|
uint64_t *tot)
|
||||||
: ThreadObject(ind, TypeName), fifo(f), dynamicRange(dr), detectorRoi(r),
|
: ThreadObject(ind, TypeName), fifo(f), detType(dType), dynamicRange(dr), detectorRoi(r),
|
||||||
fileIndex(fi), flipRows(fr), numPorts(np), quadEnable(qe),
|
fileIndex(fi), flipRows(fr), numPorts(np), quadEnable(qe),
|
||||||
totalNumFrames(tot) {
|
totalNumFrames(tot) {
|
||||||
|
|
||||||
LOG(logDEBUG) << "DataStreamer " << ind << " created";
|
LOG(logDEBUG) << "DataStreamer " << ind << " created";
|
||||||
|
vetoThread = (detType == GOTTHARD2 && index != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataStreamer::~DataStreamer() {
|
DataStreamer::~DataStreamer() {
|
||||||
@ -50,6 +51,11 @@ void DataStreamer::ResetParametersforNewAcquisition(const std::string &fname) {
|
|||||||
completeBuffer = new char[generalData->imageSizeComplete];
|
completeBuffer = new char[generalData->imageSizeComplete];
|
||||||
memset(completeBuffer, 0, generalData->imageSizeComplete);
|
memset(completeBuffer, 0, generalData->imageSizeComplete);
|
||||||
}
|
}
|
||||||
|
fifoBunchSizeBytes = generalData->imageSize;
|
||||||
|
if (vetoThread) {
|
||||||
|
fifoBunchSizeBytes = generalData->vetoDataSize;
|
||||||
|
}
|
||||||
|
fifoBunchSizeBytes += generalData->fifoBufferHeaderSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataStreamer::RecordFirstIndex(uint64_t fnum, char *buf) {
|
void DataStreamer::RecordFirstIndex(uint64_t fnum, char *buf) {
|
||||||
@ -75,6 +81,10 @@ void DataStreamer::SetAdditionalJsonHeader(
|
|||||||
isAdditionalJsonUpdated = true;
|
isAdditionalJsonUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataStreamer::SetBunchSize(size_t value) {
|
||||||
|
fifoBunchSize = value;
|
||||||
|
}
|
||||||
|
|
||||||
void DataStreamer::CreateZmqSockets(int *nunits, uint32_t port,
|
void DataStreamer::CreateZmqSockets(int *nunits, uint32_t port,
|
||||||
const IpAddr ip, int hwm) {
|
const IpAddr ip, int hwm) {
|
||||||
uint32_t portnum = port + index;
|
uint32_t portnum = port + index;
|
||||||
@ -115,15 +125,23 @@ void DataStreamer::ThreadExecution() {
|
|||||||
"pop 0x"
|
"pop 0x"
|
||||||
<< std::hex << (void *)(buffer) << std::dec << ":" << buffer;
|
<< std::hex << (void *)(buffer) << std::dec << ":" << buffer;
|
||||||
|
|
||||||
// check dummy
|
char* tempBuffer = buffer;
|
||||||
auto numBytes = *reinterpret_cast<uint32_t *>(buffer);
|
for (size_t iFrame = 0; iFrame != fifoBunchSize; iFrame ++) {
|
||||||
|
|
||||||
|
// end of acquisition (check dummy)
|
||||||
|
auto numBytes = *reinterpret_cast<uint32_t *>(tempBuffer);
|
||||||
LOG(logDEBUG1) << "DataStreamer " << index << ", Numbytes:" << numBytes;
|
LOG(logDEBUG1) << "DataStreamer " << index << ", Numbytes:" << numBytes;
|
||||||
if (numBytes == DUMMY_PACKET_VALUE) {
|
if (numBytes == DUMMY_PACKET_VALUE) {
|
||||||
StopProcessing(buffer);
|
StopProcessing(buffer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessAnImage(buffer);
|
// process only if it needs to be streamed
|
||||||
|
if (*((uint32_t *)(tempBuffer + FIFO_HEADER_STREAM_ENABLE))) {
|
||||||
|
ProcessAnImage(tempBuffer);
|
||||||
|
}
|
||||||
|
tempBuffer += fifoBunchSizeBytes;
|
||||||
|
}
|
||||||
|
|
||||||
// free
|
// free
|
||||||
fifo->FreeAddress(buffer);
|
fifo->FreeAddress(buffer);
|
||||||
|
@ -30,6 +30,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
* Calls Base Class CreateThread(), sets ErrorMask if error and increments
|
* Calls Base Class CreateThread(), sets ErrorMask if error and increments
|
||||||
* NumberofDataStreamers
|
* NumberofDataStreamers
|
||||||
* @param ind self index
|
* @param ind self index
|
||||||
|
* @param dType detector type
|
||||||
* @param f address of Fifo pointer
|
* @param f address of Fifo pointer
|
||||||
* @param dr pointer to dynamic range
|
* @param dr pointer to dynamic range
|
||||||
* @param r detectorRoi
|
* @param r detectorRoi
|
||||||
@ -39,7 +40,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
* @param qe pointer to quad Enable
|
* @param qe pointer to quad Enable
|
||||||
* @param tot pointer to total number of frames
|
* @param tot pointer to total number of frames
|
||||||
*/
|
*/
|
||||||
DataStreamer(int ind, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi, bool fr,
|
DataStreamer(int ind, detectorType dType, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi, bool fr,
|
||||||
xy np, bool *qe, uint64_t *tot);
|
xy np, bool *qe, uint64_t *tot);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,6 +56,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
void SetFlipRows(bool fd);
|
void SetFlipRows(bool fd);
|
||||||
void
|
void
|
||||||
SetAdditionalJsonHeader(const std::map<std::string, std::string> &json);
|
SetAdditionalJsonHeader(const std::map<std::string, std::string> &json);
|
||||||
|
void SetBunchSize(size_t value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates Zmq Sockets
|
* Creates Zmq Sockets
|
||||||
@ -105,6 +107,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
static const std::string TypeName;
|
static const std::string TypeName;
|
||||||
const GeneralData *generalData{nullptr};
|
const GeneralData *generalData{nullptr};
|
||||||
Fifo *fifo;
|
Fifo *fifo;
|
||||||
|
detectorType detType;
|
||||||
ZmqSocket *zmqSocket{nullptr};
|
ZmqSocket *zmqSocket{nullptr};
|
||||||
uint32_t *dynamicRange;
|
uint32_t *dynamicRange;
|
||||||
ROI *detectorRoi;
|
ROI *detectorRoi;
|
||||||
@ -112,6 +115,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
uint64_t *fileIndex;
|
uint64_t *fileIndex;
|
||||||
bool flipRows;
|
bool flipRows;
|
||||||
std::map<std::string, std::string> additionalJsonHeader;
|
std::map<std::string, std::string> additionalJsonHeader;
|
||||||
|
bool vetoThread{false};
|
||||||
|
|
||||||
/** Used by streamer thread to update local copy (reduce number of locks
|
/** Used by streamer thread to update local copy (reduce number of locks
|
||||||
* during streaming) */
|
* during streaming) */
|
||||||
@ -132,6 +136,10 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
xy numPorts{1, 1};
|
xy numPorts{1, 1};
|
||||||
bool *quadEnable;
|
bool *quadEnable;
|
||||||
uint64_t *totalNumFrames;
|
uint64_t *totalNumFrames;
|
||||||
|
|
||||||
|
size_t fifoBunchSize{0};
|
||||||
|
/** size in memory including headers */
|
||||||
|
size_t fifoBunchSizeBytes{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
} // namespace sls
|
||||||
|
@ -65,6 +65,7 @@ class GeneralData {
|
|||||||
uint32_t adcEnableMaskTenGiga{BIT32_MASK};
|
uint32_t adcEnableMaskTenGiga{BIT32_MASK};
|
||||||
slsDetectorDefs::ROI roi{};
|
slsDetectorDefs::ROI roi{};
|
||||||
uint32_t counterMask{0};
|
uint32_t counterMask{0};
|
||||||
|
uint32_t defaultBunchSize{1};
|
||||||
|
|
||||||
GeneralData(){};
|
GeneralData(){};
|
||||||
virtual ~GeneralData(){};
|
virtual ~GeneralData(){};
|
||||||
@ -445,10 +446,11 @@ class Gotthard2Data : public GeneralData {
|
|||||||
maxFramesPerFile = GOTTHARD2_MAX_FRAMES_PER_FILE;
|
maxFramesPerFile = GOTTHARD2_MAX_FRAMES_PER_FILE;
|
||||||
fifoBufferHeaderSize =
|
fifoBufferHeaderSize =
|
||||||
FIFO_HEADER_NUMBYTES + sizeof(slsDetectorDefs::sls_receiver_header);
|
FIFO_HEADER_NUMBYTES + sizeof(slsDetectorDefs::sls_receiver_header);
|
||||||
defaultFifoDepth = 50000;
|
defaultFifoDepth = 50;
|
||||||
standardheader = true;
|
standardheader = true;
|
||||||
vetoDataSize = 160;
|
vetoDataSize = 160;
|
||||||
vetoHsize = 16;
|
vetoHsize = 16;
|
||||||
|
defaultBunchSize = 10000;
|
||||||
UpdateImageSize();
|
UpdateImageSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -67,16 +67,17 @@ void Implementation::SetThreadPriorities() {
|
|||||||
void Implementation::SetupFifoStructure() {
|
void Implementation::SetupFifoStructure() {
|
||||||
fifo.clear();
|
fifo.clear();
|
||||||
for (int i = 0; i < numUDPInterfaces; ++i) {
|
for (int i = 0; i < numUDPInterfaces; ++i) {
|
||||||
uint32_t datasize = generalData->imageSize;
|
size_t datasize = generalData->imageSize;
|
||||||
// veto data size
|
// veto data size
|
||||||
if (detType == GOTTHARD2 && i != 0) {
|
if (detType == GOTTHARD2 && i != 0) {
|
||||||
datasize = generalData->vetoImageSize;
|
datasize = generalData->vetoImageSize;
|
||||||
}
|
}
|
||||||
|
datasize += generalData->fifoBufferHeaderSize;
|
||||||
|
datasize *= bunchSize;
|
||||||
|
|
||||||
// create fifo structure
|
// create fifo structure
|
||||||
try {
|
try {
|
||||||
fifo.push_back(sls::make_unique<Fifo>(
|
fifo.push_back(sls::make_unique<Fifo>(i, datasize, fifoDepth));
|
||||||
i, datasize + (generalData->fifoBufferHeaderSize), fifoDepth));
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
fifo.clear();
|
fifo.clear();
|
||||||
fifoDepth = 0;
|
fifoDepth = 0;
|
||||||
@ -93,9 +94,7 @@ void Implementation::SetupFifoStructure() {
|
|||||||
dataStreamer[i]->SetFifo(fifo[i].get());
|
dataStreamer[i]->SetFifo(fifo[i].get());
|
||||||
|
|
||||||
LOG(logINFO) << "Memory Allocated for Fifo " << i << ": "
|
LOG(logINFO) << "Memory Allocated for Fifo " << i << ": "
|
||||||
<< (double)(((size_t)(datasize) +
|
<< (double)(datasize * (size_t)fifoDepth) /
|
||||||
(size_t)(generalData->fifoBufferHeaderSize)) *
|
|
||||||
(size_t)fifoDepth) /
|
|
||||||
(double)(1024 * 1024)
|
(double)(1024 * 1024)
|
||||||
<< " MB";
|
<< " MB";
|
||||||
}
|
}
|
||||||
@ -169,6 +168,7 @@ void Implementation::setDetectorType(const detectorType d) {
|
|||||||
adcEnableMaskTenGiga = generalData->adcEnableMaskTenGiga;
|
adcEnableMaskTenGiga = generalData->adcEnableMaskTenGiga;
|
||||||
detectorRoi = generalData->roi;
|
detectorRoi = generalData->roi;
|
||||||
counterMask = generalData->counterMask;
|
counterMask = generalData->counterMask;
|
||||||
|
bunchSize = generalData->defaultBunchSize;
|
||||||
|
|
||||||
SetLocalNetworkParameters();
|
SetLocalNetworkParameters();
|
||||||
SetupFifoStructure();
|
SetupFifoStructure();
|
||||||
@ -204,10 +204,12 @@ void Implementation::setDetectorType(const detectorType d) {
|
|||||||
for (const auto &it : listener) {
|
for (const auto &it : listener) {
|
||||||
it->SetGeneralData(generalData);
|
it->SetGeneralData(generalData);
|
||||||
it->SetActivate(activated);
|
it->SetActivate(activated);
|
||||||
|
it->SetBunchSize(bunchSize);
|
||||||
}
|
}
|
||||||
for (const auto &it : dataProcessor) {
|
for (const auto &it : dataProcessor) {
|
||||||
it->SetGeneralData(generalData);
|
it->SetGeneralData(generalData);
|
||||||
it->SetActivate(activated);
|
it->SetActivate(activated);
|
||||||
|
it->SetBunchSize(bunchSize);
|
||||||
}
|
}
|
||||||
SetThreadPriorities();
|
SetThreadPriorities();
|
||||||
|
|
||||||
@ -440,8 +442,6 @@ void Implementation::setReceiverROI(const slsDetectorDefs::ROI arg) {
|
|||||||
portRois[iPort] = portRoi;
|
portRois[iPort] = portRoi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i != listener.size(); ++i)
|
|
||||||
listener[i]->SetNoRoi(portRois[i].noRoi());
|
|
||||||
for (size_t i = 0; i != dataProcessor.size(); ++i)
|
for (size_t i = 0; i != dataProcessor.size(); ++i)
|
||||||
dataProcessor[i]->SetReceiverROI(portRois[i]);
|
dataProcessor[i]->SetReceiverROI(portRois[i]);
|
||||||
LOG(logINFO) << "receiver roi: " << ToString(receiverRoi);
|
LOG(logINFO) << "receiver roi: " << ToString(receiverRoi);
|
||||||
@ -455,6 +455,22 @@ void Implementation::setReceiverROIMetadata(const ROI arg) {
|
|||||||
LOG(logINFO) << "receiver roi Metadata: " << ToString(receiverRoiMetadata);
|
LOG(logINFO) << "receiver roi Metadata: " << ToString(receiverRoiMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t Implementation::getBunchSize() const { return bunchSize; }
|
||||||
|
|
||||||
|
void Implementation::setBunchSize(const size_t i) {
|
||||||
|
if (bunchSize != i) {
|
||||||
|
bunchSize = i;
|
||||||
|
for (const auto &it : listener)
|
||||||
|
it->SetBunchSize(i);
|
||||||
|
for (const auto &it : dataProcessor)
|
||||||
|
it->SetBunchSize(i);
|
||||||
|
for (const auto &it : dataStreamer)
|
||||||
|
it->SetBunchSize(i);
|
||||||
|
SetupFifoStructure();
|
||||||
|
}
|
||||||
|
LOG(logINFO) << "Fifo Bunch Size: " << i;
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
* File Parameters *
|
* File Parameters *
|
||||||
@ -677,12 +693,15 @@ void Implementation::stopReceiver() {
|
|||||||
while (running) {
|
while (running) {
|
||||||
running = false;
|
running = false;
|
||||||
for (const auto &it : listener)
|
for (const auto &it : listener)
|
||||||
if (it->IsRunning())
|
if (it->IsRunning()) {
|
||||||
running = true;
|
running = true;
|
||||||
|
//LOG(logINFOBLUE) << "listener NOT done";
|
||||||
|
}
|
||||||
for (const auto &it : dataProcessor)
|
for (const auto &it : dataProcessor)
|
||||||
if (it->IsRunning())
|
if (it->IsRunning()) {
|
||||||
running = true;
|
running = true;
|
||||||
|
//LOG(logINFOBLUE) << "processor NOT done";
|
||||||
|
}
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -723,9 +742,6 @@ void Implementation::stopReceiver() {
|
|||||||
} else if (!detectorDataStream[i]) {
|
} else if (!detectorDataStream[i]) {
|
||||||
summary = (i == 0 ? "\n\tDeactivated Left Port"
|
summary = (i == 0 ? "\n\tDeactivated Left Port"
|
||||||
: "\n\tDeactivated Right Port");
|
: "\n\tDeactivated Right Port");
|
||||||
} else if (portRois[i].noRoi()) {
|
|
||||||
summary = (i == 0 ? "\n\tNo Roi on Left Port"
|
|
||||||
: "\n\tNo Roi on Right Port");
|
|
||||||
} else {
|
} else {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "\n\tMissing Packets\t\t: " << mpMessage
|
os << "\n\tMissing Packets\t\t: " << mpMessage
|
||||||
@ -1007,7 +1023,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
|||||||
&silentMode));
|
&silentMode));
|
||||||
listener[i]->SetGeneralData(generalData);
|
listener[i]->SetGeneralData(generalData);
|
||||||
listener[i]->SetActivate(activated);
|
listener[i]->SetActivate(activated);
|
||||||
listener[i]->SetNoRoi(portRois[i].noRoi());
|
listener[i]->SetBunchSize(bunchSize);
|
||||||
|
|
||||||
int ctbAnalogDataBytes = 0;
|
int ctbAnalogDataBytes = 0;
|
||||||
if (detType == CHIPTESTBOARD) {
|
if (detType == CHIPTESTBOARD) {
|
||||||
@ -1022,6 +1038,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
|||||||
dataProcessor[i]->SetGeneralData(generalData);
|
dataProcessor[i]->SetGeneralData(generalData);
|
||||||
dataProcessor[i]->SetActivate(activated);
|
dataProcessor[i]->SetActivate(activated);
|
||||||
dataProcessor[i]->SetReceiverROI(portRois[i]);
|
dataProcessor[i]->SetReceiverROI(portRois[i]);
|
||||||
|
dataProcessor[i]->SetBunchSize(bunchSize);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
listener.clear();
|
listener.clear();
|
||||||
dataProcessor.clear();
|
dataProcessor.clear();
|
||||||
@ -1037,7 +1054,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
|||||||
flip = (i == 1 ? true : false);
|
flip = (i == 1 ? true : false);
|
||||||
}
|
}
|
||||||
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
||||||
i, fifo[i].get(), &dynamicRange, &detectorRoi,
|
i, detType, fifo[i].get(), &dynamicRange, &detectorRoi,
|
||||||
&fileIndex, flip, numPorts, &quadEnable,
|
&fileIndex, flip, numPorts, &quadEnable,
|
||||||
&numberOfTotalFrames));
|
&numberOfTotalFrames));
|
||||||
dataStreamer[i]->SetGeneralData(generalData);
|
dataStreamer[i]->SetGeneralData(generalData);
|
||||||
@ -1046,6 +1063,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
|||||||
streamingHwm);
|
streamingHwm);
|
||||||
dataStreamer[i]->SetAdditionalJsonHeader(
|
dataStreamer[i]->SetAdditionalJsonHeader(
|
||||||
additionalJsonHeader);
|
additionalJsonHeader);
|
||||||
|
dataStreamer[i]->SetBunchSize(bunchSize);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
if (dataStreamEnable) {
|
if (dataStreamEnable) {
|
||||||
dataStreamer.clear();
|
dataStreamer.clear();
|
||||||
@ -1164,7 +1182,7 @@ void Implementation::setDataStreamEnable(const bool enable) {
|
|||||||
flip = (i == 1 ? true : false);
|
flip = (i == 1 ? true : false);
|
||||||
}
|
}
|
||||||
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
||||||
i, fifo[i].get(), &dynamicRange, &detectorRoi,
|
i, detType, fifo[i].get(), &dynamicRange, &detectorRoi,
|
||||||
&fileIndex, flip, numPorts, &quadEnable,
|
&fileIndex, flip, numPorts, &quadEnable,
|
||||||
&numberOfTotalFrames));
|
&numberOfTotalFrames));
|
||||||
dataStreamer[i]->SetGeneralData(generalData);
|
dataStreamer[i]->SetGeneralData(generalData);
|
||||||
@ -1173,6 +1191,7 @@ void Implementation::setDataStreamEnable(const bool enable) {
|
|||||||
streamingHwm);
|
streamingHwm);
|
||||||
dataStreamer[i]->SetAdditionalJsonHeader(
|
dataStreamer[i]->SetAdditionalJsonHeader(
|
||||||
additionalJsonHeader);
|
additionalJsonHeader);
|
||||||
|
dataStreamer[i]->SetBunchSize(bunchSize);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
dataStreamer.clear();
|
dataStreamer.clear();
|
||||||
dataStreamEnable = false;
|
dataStreamEnable = false;
|
||||||
|
@ -59,6 +59,8 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
ROI getReceiverROI() const;
|
ROI getReceiverROI() const;
|
||||||
void setReceiverROI(const ROI arg);
|
void setReceiverROI(const ROI arg);
|
||||||
void setReceiverROIMetadata(const ROI arg);
|
void setReceiverROIMetadata(const ROI arg);
|
||||||
|
size_t getBunchSize() const;
|
||||||
|
void setBunchSize(const size_t i);
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
@ -311,6 +313,7 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
std::array<ROI, 2> portRois{};
|
std::array<ROI, 2> portRois{};
|
||||||
// receiver roi for complete detector for metadata
|
// receiver roi for complete detector for metadata
|
||||||
ROI receiverRoiMetadata{};
|
ROI receiverRoiMetadata{};
|
||||||
|
size_t bunchSize{0};
|
||||||
|
|
||||||
// file parameters
|
// file parameters
|
||||||
fileFormat fileFormatType{BINARY};
|
fileFormat fileFormatType{BINARY};
|
||||||
|
@ -32,6 +32,7 @@ Listener::Listener(int ind, detectorType dtype, Fifo *f,
|
|||||||
actualUDPSocketBufferSize(as), framesPerFile(fpf), frameDiscardMode(fdp),
|
actualUDPSocketBufferSize(as), framesPerFile(fpf), frameDiscardMode(fdp),
|
||||||
detectorDataStream(detds), silentMode(sm) {
|
detectorDataStream(detds), silentMode(sm) {
|
||||||
LOG(logDEBUG) << "Listener " << ind << " created";
|
LOG(logDEBUG) << "Listener " << ind << " created";
|
||||||
|
vetoThread = (myDetectorType == GOTTHARD2 && index != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Listener::~Listener() = default;
|
Listener::~Listener() = default;
|
||||||
@ -48,7 +49,10 @@ uint64_t Listener::GetLastFrameIndexCaught() const {
|
|||||||
|
|
||||||
int64_t Listener::GetNumMissingPacket(bool stoppedFlag,
|
int64_t Listener::GetNumMissingPacket(bool stoppedFlag,
|
||||||
uint64_t numPackets) const {
|
uint64_t numPackets) const {
|
||||||
if (!activated || !(*detectorDataStream) || noRoi) {
|
if (!activated) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (!(*detectorDataStream)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!stoppedFlag) {
|
if (!stoppedFlag) {
|
||||||
@ -82,7 +86,7 @@ void Listener::ResetParametersforNewAcquisition() {
|
|||||||
lastCaughtFrameIndex = 0;
|
lastCaughtFrameIndex = 0;
|
||||||
carryOverFlag = false;
|
carryOverFlag = false;
|
||||||
uint32_t packetSize = generalData->packetSize;
|
uint32_t packetSize = generalData->packetSize;
|
||||||
if (myDetectorType == GOTTHARD2 && index != 0) {
|
if (vetoThread) {
|
||||||
packetSize = generalData->vetoPacketSize;
|
packetSize = generalData->vetoPacketSize;
|
||||||
}
|
}
|
||||||
carryOverPacket = make_unique<char[]>(packetSize);
|
carryOverPacket = make_unique<char[]>(packetSize);
|
||||||
@ -95,6 +99,12 @@ void Listener::ResetParametersforNewAcquisition() {
|
|||||||
// reset fifo statistic
|
// reset fifo statistic
|
||||||
fifo->GetMaxLevelForFifoBound();
|
fifo->GetMaxLevelForFifoBound();
|
||||||
fifo->GetMinLevelForFifoFree();
|
fifo->GetMinLevelForFifoFree();
|
||||||
|
|
||||||
|
fifoBunchSizeBytes = generalData->imageSize;
|
||||||
|
if (vetoThread) {
|
||||||
|
fifoBunchSizeBytes = generalData->vetoDataSize;
|
||||||
|
}
|
||||||
|
fifoBunchSizeBytes += generalData->fifoBufferHeaderSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Listener::RecordFirstIndex(uint64_t fnum) {
|
void Listener::RecordFirstIndex(uint64_t fnum) {
|
||||||
@ -116,10 +126,12 @@ void Listener::SetGeneralData(GeneralData *g) { generalData = g; }
|
|||||||
|
|
||||||
void Listener::SetActivate(bool enable) { activated = enable; }
|
void Listener::SetActivate(bool enable) { activated = enable; }
|
||||||
|
|
||||||
void Listener::SetNoRoi(bool enable) {noRoi = enable; }
|
void Listener::SetBunchSize(size_t value) {
|
||||||
|
fifoBunchSize = value;
|
||||||
|
}
|
||||||
|
|
||||||
void Listener::CreateUDPSockets() {
|
void Listener::CreateUDPSockets() {
|
||||||
if (!activated || !(*detectorDataStream) || noRoi) {
|
if (!activated || !(*detectorDataStream)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +146,7 @@ void Listener::CreateUDPSockets() {
|
|||||||
ShutDownUDPSocket();
|
ShutDownUDPSocket();
|
||||||
|
|
||||||
uint32_t packetSize = generalData->packetSize;
|
uint32_t packetSize = generalData->packetSize;
|
||||||
if (myDetectorType == GOTTHARD2 && index != 0) {
|
if (vetoThread) {
|
||||||
packetSize = generalData->vetoPacketSize;
|
packetSize = generalData->vetoPacketSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +181,7 @@ void Listener::CreateDummySocketForUDPSocketBufferSize(int s) {
|
|||||||
LOG(logINFO) << "Testing UDP Socket Buffer size " << s << " with test port "
|
LOG(logINFO) << "Testing UDP Socket Buffer size " << s << " with test port "
|
||||||
<< *udpPortNumber;
|
<< *udpPortNumber;
|
||||||
|
|
||||||
if (!activated || !(*detectorDataStream) || noRoi) {
|
if (!activated || !(*detectorDataStream)) {
|
||||||
*actualUDPSocketBufferSize = (s * 2);
|
*actualUDPSocketBufferSize = (s * 2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -183,7 +195,7 @@ void Listener::CreateDummySocketForUDPSocketBufferSize(int s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t packetSize = generalData->packetSize;
|
uint32_t packetSize = generalData->packetSize;
|
||||||
if (myDetectorType == GOTTHARD2 && index != 0) {
|
if (vetoThread) {
|
||||||
packetSize = generalData->vetoPacketSize;
|
packetSize = generalData->vetoPacketSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,55 +231,42 @@ void Listener::SetHardCodedPosition(uint16_t r, uint16_t c) {
|
|||||||
|
|
||||||
void Listener::ThreadExecution() {
|
void Listener::ThreadExecution() {
|
||||||
char *buffer;
|
char *buffer;
|
||||||
int rc = 0;
|
|
||||||
|
|
||||||
fifo->GetNewAddress(buffer);
|
fifo->GetNewAddress(buffer);
|
||||||
LOG(logDEBUG5) << "Listener " << index
|
LOG(logDEBUG1) << "Listener " << index
|
||||||
<< ", "
|
<< ", "
|
||||||
"pop 0x"
|
"pop 0x"
|
||||||
<< std::hex << (void *)(buffer) << std::dec << ":" << buffer;
|
<< std::hex << (void *)(buffer) << std::dec << ":" << buffer;
|
||||||
|
|
||||||
// udpsocket doesnt exist
|
|
||||||
if (activated && *detectorDataStream && !noRoi &&!udpSocketAlive && !carryOverFlag) {
|
|
||||||
// LOG(logERROR) << "Listening_Thread " << index << ": UDP Socket not
|
|
||||||
// created or shut down earlier";
|
|
||||||
(*((uint32_t *)buffer)) = 0;
|
|
||||||
StopListening(buffer);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get data
|
// get data
|
||||||
if ((*status != TRANSMITTING &&
|
char* tempBuffer = buffer;
|
||||||
(!activated || !(*detectorDataStream) || noRoi || udpSocketAlive)) ||
|
for (size_t iFrame = 0; iFrame != fifoBunchSize; iFrame ++) {
|
||||||
carryOverFlag) {
|
|
||||||
rc = ListenToAnImage(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
// error check, (should not be here) if not transmitting yet (previous if)
|
// end of acquisition or not activated
|
||||||
// rc should be > 0
|
if ((*status == TRANSMITTING || !udpSocketAlive) && !carryOverFlag) {
|
||||||
if (rc == 0) {
|
(*((uint32_t *)tempBuffer)) = DUMMY_PACKET_VALUE;
|
||||||
if (!udpSocketAlive) {
|
|
||||||
(*((uint32_t *)buffer)) = 0;
|
|
||||||
StopListening(buffer);
|
StopListening(buffer);
|
||||||
} else
|
|
||||||
fifo->FreeAddress(buffer);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
int rc = ListenToAnImage(tempBuffer);
|
||||||
|
|
||||||
// discarding image
|
// socket closed or discarding image (free retake)
|
||||||
else if (rc < 0) {
|
// weird frame numbers (print and rc = 0), then retake
|
||||||
fifo->FreeAddress(buffer);
|
if (rc <= 0) {
|
||||||
return;
|
if (udpSocketAlive) {
|
||||||
|
--iFrame;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
(*((uint32_t *)tempBuffer)) = rc;
|
||||||
|
tempBuffer += fifoBunchSizeBytes;
|
||||||
|
numFramesStatistic++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(*((uint32_t *)buffer)) = rc;
|
|
||||||
|
|
||||||
// push into fifo
|
// push into fifo
|
||||||
fifo->PushAddress(buffer);
|
fifo->PushAddress(buffer);
|
||||||
|
|
||||||
// Statistics
|
// Statistics
|
||||||
if (!(*silentMode)) {
|
if (!(*silentMode)) {
|
||||||
numFramesStatistic++;
|
|
||||||
if (numFramesStatistic >=
|
if (numFramesStatistic >=
|
||||||
// second condition also for infinite #number of frames
|
// second condition also for infinite #number of frames
|
||||||
(((*framesPerFile) == 0) ? STATISTIC_FRAMENUMBER_INFINITE
|
(((*framesPerFile) == 0) ? STATISTIC_FRAMENUMBER_INFINITE
|
||||||
@ -277,12 +276,10 @@ void Listener::ThreadExecution() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Listener::StopListening(char *buf) {
|
void Listener::StopListening(char *buf) {
|
||||||
(*((uint32_t *)buf)) = DUMMY_PACKET_VALUE;
|
|
||||||
fifo->PushAddress(buf);
|
fifo->PushAddress(buf);
|
||||||
StopRunning();
|
StopRunning();
|
||||||
LOG(logDEBUG1) << index << ": Listening Packets (" << *udpPortNumber
|
LOG(logDEBUG1) << index << ": Listening Completed (" << *udpPortNumber
|
||||||
<< ") : " << numPacketsCaught;
|
<< ") : " << numPacketsCaught;
|
||||||
LOG(logDEBUG1) << index << ": Listening Completed";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* buf includes the fifo header and packet header */
|
/* buf includes the fifo header and packet header */
|
||||||
@ -299,7 +296,7 @@ uint32_t Listener::ListenToAnImage(char *buf) {
|
|||||||
uint32_t hsize = generalData->headerSizeinPacket;
|
uint32_t hsize = generalData->headerSizeinPacket;
|
||||||
uint32_t fifohsize = generalData->fifoBufferHeaderSize;
|
uint32_t fifohsize = generalData->fifoBufferHeaderSize;
|
||||||
bool standardheader = generalData->standardheader;
|
bool standardheader = generalData->standardheader;
|
||||||
if (myDetectorType == GOTTHARD2 && index != 0) {
|
if (vetoThread) {
|
||||||
dsize = generalData->vetoDataSize;
|
dsize = generalData->vetoDataSize;
|
||||||
imageSize = generalData->vetoImageSize;
|
imageSize = generalData->vetoImageSize;
|
||||||
packetSize = generalData->vetoPacketSize;
|
packetSize = generalData->vetoPacketSize;
|
||||||
@ -316,11 +313,6 @@ uint32_t Listener::ListenToAnImage(char *buf) {
|
|||||||
memset(buf, 0, fifohsize);
|
memset(buf, 0, fifohsize);
|
||||||
new_header = (sls_receiver_header *)(buf + FIFO_HEADER_NUMBYTES);
|
new_header = (sls_receiver_header *)(buf + FIFO_HEADER_NUMBYTES);
|
||||||
|
|
||||||
// deactivated port (eiger) or deactivated (eiger)
|
|
||||||
if (!(*detectorDataStream) || !activated || noRoi) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// look for carry over
|
// look for carry over
|
||||||
if (carryOverFlag) {
|
if (carryOverFlag) {
|
||||||
LOG(logDEBUG3) << index << "carry flag";
|
LOG(logDEBUG3) << index << "carry flag";
|
||||||
@ -345,6 +337,7 @@ uint32_t Listener::ListenToAnImage(char *buf) {
|
|||||||
<< "(Weird), With carry flag: Frame number " << fnum
|
<< "(Weird), With carry flag: Frame number " << fnum
|
||||||
<< " less than current frame number " << currentFrameIndex;
|
<< " less than current frame number " << currentFrameIndex;
|
||||||
carryOverFlag = false;
|
carryOverFlag = false;
|
||||||
|
exit(-1);//***************************
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
switch (*frameDiscardMode) {
|
switch (*frameDiscardMode) {
|
||||||
@ -509,7 +502,7 @@ uint32_t Listener::ListenToAnImage(char *buf) {
|
|||||||
|
|
||||||
lastCaughtFrameIndex = fnum;
|
lastCaughtFrameIndex = fnum;
|
||||||
|
|
||||||
LOG(logDEBUG1) << "Listening " << index
|
LOG(logDEBUG) << "Listening " << index
|
||||||
<< ": currentfindex:" << currentFrameIndex
|
<< ": currentfindex:" << currentFrameIndex
|
||||||
<< ", fnum:" << fnum << ", pnum:" << pnum
|
<< ", fnum:" << fnum << ", pnum:" << pnum
|
||||||
<< ", numpackets:" << numpackets;
|
<< ", numpackets:" << numpackets;
|
||||||
|
@ -65,7 +65,8 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
void ResetParametersforNewAcquisition();
|
void ResetParametersforNewAcquisition();
|
||||||
void SetGeneralData(GeneralData *g);
|
void SetGeneralData(GeneralData *g);
|
||||||
void SetActivate(bool enable);
|
void SetActivate(bool enable);
|
||||||
void SetNoRoi(bool enable);
|
void SetBunchSize(size_t value);
|
||||||
|
|
||||||
void CreateUDPSockets();
|
void CreateUDPSockets();
|
||||||
void ShutDownUDPSocket();
|
void ShutDownUDPSocket();
|
||||||
|
|
||||||
@ -130,8 +131,8 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
frameDiscardPolicy *frameDiscardMode;
|
frameDiscardPolicy *frameDiscardMode;
|
||||||
bool activated{false};
|
bool activated{false};
|
||||||
bool *detectorDataStream;
|
bool *detectorDataStream;
|
||||||
bool noRoi{false};
|
|
||||||
bool *silentMode;
|
bool *silentMode;
|
||||||
|
bool vetoThread{false};
|
||||||
|
|
||||||
/** row hardcoded as 1D or 2d,
|
/** row hardcoded as 1D or 2d,
|
||||||
* if detector does not send them yet or
|
* if detector does not send them yet or
|
||||||
@ -166,6 +167,10 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
std::unique_ptr<char[]> listeningPacket;
|
std::unique_ptr<char[]> listeningPacket;
|
||||||
std::atomic<bool> udpSocketAlive{false};
|
std::atomic<bool> udpSocketAlive{false};
|
||||||
|
|
||||||
|
size_t fifoBunchSize{0};
|
||||||
|
/** size in memory including headers */
|
||||||
|
size_t fifoBunchSizeBytes{0};
|
||||||
|
|
||||||
// for print progress during acquisition*/
|
// for print progress during acquisition*/
|
||||||
uint32_t numPacketsStatistic{0};
|
uint32_t numPacketsStatistic{0};
|
||||||
uint32_t numFramesStatistic{0};
|
uint32_t numFramesStatistic{0};
|
||||||
|
@ -39,8 +39,7 @@ namespace sls {
|
|||||||
// fifo
|
// fifo
|
||||||
#define FIFO_HEADER_NUMBYTES (16)
|
#define FIFO_HEADER_NUMBYTES (16)
|
||||||
#define FIFO_DATASIZE_NUMBYTES (4)
|
#define FIFO_DATASIZE_NUMBYTES (4)
|
||||||
#define FIFO_PADDING_NUMBYTES \
|
#define FIFO_HEADER_STREAM_ENABLE (8)
|
||||||
(4) // for 8 byte alignment due to sls_receiver_header structure
|
|
||||||
|
|
||||||
// hdf5
|
// hdf5
|
||||||
#define MAX_CHUNKED_IMAGES (1)
|
#define MAX_CHUNKED_IMAGES (1)
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
// C++ includes
|
// C++ includes
|
||||||
#include "sls/sls_detector_exceptions.h"
|
#include "sls/sls_detector_exceptions.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@ -70,8 +69,6 @@
|
|||||||
#define SHORT_STR_LENGTH 20
|
#define SHORT_STR_LENGTH 20
|
||||||
|
|
||||||
#define MAX_PATTERN_LENGTH 0x2000
|
#define MAX_PATTERN_LENGTH 0x2000
|
||||||
#define MAX_PATTERN_LEVELS 6
|
|
||||||
#define M3_MAX_PATTERN_LEVELS 3
|
|
||||||
|
|
||||||
#define DEFAULT_STREAMING_TIMER_IN_MS 500
|
#define DEFAULT_STREAMING_TIMER_IN_MS 500
|
||||||
|
|
||||||
|
@ -379,6 +379,8 @@ enum detFuncs {
|
|||||||
F_RECEIVER_GET_RECEIVER_ROI,
|
F_RECEIVER_GET_RECEIVER_ROI,
|
||||||
F_RECEIVER_SET_RECEIVER_ROI,
|
F_RECEIVER_SET_RECEIVER_ROI,
|
||||||
F_RECEIVER_SET_RECEIVER_ROI_METADATA,
|
F_RECEIVER_SET_RECEIVER_ROI_METADATA,
|
||||||
|
F_GET_RECEIVER_BUNCH_SIZE,
|
||||||
|
F_SET_RECEIVER_BUNCH_SIZE,
|
||||||
|
|
||||||
NUM_REC_FUNCTIONS
|
NUM_REC_FUNCTIONS
|
||||||
};
|
};
|
||||||
@ -756,6 +758,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_RECEIVER_GET_RECEIVER_ROI: return "F_RECEIVER_GET_RECEIVER_ROI";
|
case F_RECEIVER_GET_RECEIVER_ROI: return "F_RECEIVER_GET_RECEIVER_ROI";
|
||||||
case F_RECEIVER_SET_RECEIVER_ROI: return "F_RECEIVER_SET_RECEIVER_ROI";
|
case F_RECEIVER_SET_RECEIVER_ROI: return "F_RECEIVER_SET_RECEIVER_ROI";
|
||||||
case F_RECEIVER_SET_RECEIVER_ROI_METADATA: return "F_RECEIVER_SET_RECEIVER_ROI_METADATA";
|
case F_RECEIVER_SET_RECEIVER_ROI_METADATA: return "F_RECEIVER_SET_RECEIVER_ROI_METADATA";
|
||||||
|
case F_GET_RECEIVER_BUNCH_SIZE: return "F_GET_RECEIVER_BUNCH_SIZE";
|
||||||
|
case F_SET_RECEIVER_BUNCH_SIZE: return "F_SET_RECEIVER_BUNCH_SIZE";
|
||||||
|
|
||||||
case NUM_REC_FUNCTIONS: return "NUM_REC_FUNCTIONS";
|
case NUM_REC_FUNCTIONS: return "NUM_REC_FUNCTIONS";
|
||||||
default: return "Unknown Function";
|
default: return "Unknown Function";
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
/** API versions */
|
/** API versions */
|
||||||
#define GITBRANCH "developer"
|
#define GITBRANCH "developer"
|
||||||
|
#define APICTB 0x220524
|
||||||
|
#define APIGOTTHARD 0x220524
|
||||||
|
#define APIJUNGFRAU 0x220524
|
||||||
|
#define APIMOENCH 0x220519
|
||||||
|
#define APIEIGER 0x220524
|
||||||
|
#define APIGOTTHARD2 0x220602
|
||||||
|
#define APIMYTHEN3 0x220607
|
||||||
#define APILIB 0x220609
|
#define APILIB 0x220609
|
||||||
#define APIRECEIVER 0x220609
|
#define APIRECEIVER 0x220609
|
||||||
#define APIGUI 0x220609
|
#define APIGUI 0x220609
|
||||||
#define APICTB 0x220714
|
|
||||||
#define APIGOTTHARD 0x220714
|
|
||||||
#define APIGOTTHARD2 0x220714
|
|
||||||
#define APIJUNGFRAU 0x220714
|
|
||||||
#define APIMYTHEN3 0x220714
|
|
||||||
#define APIMOENCH 0x220714
|
|
||||||
#define APIEIGER 0x220714
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
git submodule update --init
|
|
||||||
|
|
Reference in New Issue
Block a user