mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-19 00:07: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 system frequency is the same irrespective of timing source
|
||||
- (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)
|
||||
-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
|
||||
|
130
cmk.sh
130
cmk.sh
@ -18,7 +18,6 @@ CTBGUI=0
|
||||
MANUALS=0
|
||||
MANUALS_ONLY_RST=0
|
||||
MOENCHZMQ=0
|
||||
ZMQ_HINT_DIR=""
|
||||
|
||||
|
||||
CLEAN=0
|
||||
@ -27,26 +26,25 @@ CMAKE_PRE=""
|
||||
CMAKE_POST=""
|
||||
|
||||
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
|
||||
-b: Builds/Rebuilds CMake files normal mode
|
||||
-c: Clean
|
||||
-d: HDF5 Custom Directory
|
||||
-e: Debug mode
|
||||
-g: Build/Rebuilds only gui
|
||||
-b: Builds/Rebuilds CMake files normal mode
|
||||
-p: Builds/Rebuilds Python API
|
||||
-h: Builds/Rebuilds Cmake files with HDF5 package
|
||||
-i: Builds tests
|
||||
-j: Number of threads to compile through
|
||||
-d: HDF5 Custom Directory
|
||||
-k: CMake command
|
||||
-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
|
||||
-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
|
||||
|
||||
Rebuild when you switch to a new build and compile in parallel:
|
||||
@ -83,50 +81,69 @@ For rebuilding only certain sections
|
||||
|
||||
" ; exit 1; }
|
||||
|
||||
while getopts ":bcd:eghij:k:l:mnpq:rstuz" opt ; do
|
||||
while getopts ":bpchd:k:l:j:trgeisumnz" opt ; do
|
||||
case $opt in
|
||||
b)
|
||||
echo "Building of CMake files Required"
|
||||
REBUILD=1
|
||||
;;
|
||||
p)
|
||||
echo "Compiling Options: Python"
|
||||
PYTHON=1
|
||||
REBUILD=1
|
||||
;;
|
||||
c)
|
||||
echo "Clean Required"
|
||||
CLEAN=1
|
||||
;;
|
||||
d)
|
||||
echo "New HDF5 directory: $OPTARG"
|
||||
HDF5DIR=$OPTARG
|
||||
;;
|
||||
e)
|
||||
echo "Compiling Options: Debug"
|
||||
DEBUG=1
|
||||
;;
|
||||
g)
|
||||
echo "Compiling Options: GUI"
|
||||
GUI=1
|
||||
REBUILD=1
|
||||
;;
|
||||
h)
|
||||
echo "Building of CMake files with HDF5 option Required"
|
||||
HDF5=1
|
||||
REBUILD=1
|
||||
;;
|
||||
i)
|
||||
echo "Compiling Options: Tests"
|
||||
TESTS=1
|
||||
;;
|
||||
j)
|
||||
echo "Number of compiler threads: $OPTARG"
|
||||
COMPILERTHREADS=$OPTARG
|
||||
;;
|
||||
k)
|
||||
echo "CMake command: $OPTARG"
|
||||
CMAKE="$OPTARG"
|
||||
d)
|
||||
echo "New HDF5 directory: $OPTARG"
|
||||
HDF5DIR=$OPTARG
|
||||
;;
|
||||
l)
|
||||
echo "CMake install directory: $OPTARG"
|
||||
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)
|
||||
echo "Compiling Options: GUI"
|
||||
GUI=1
|
||||
REBUILD=1
|
||||
;;
|
||||
e)
|
||||
echo "Compiling Options: Debug"
|
||||
DEBUG=1
|
||||
;;
|
||||
i)
|
||||
echo "Compiling Options: Tests"
|
||||
TESTS=1
|
||||
;;
|
||||
s)
|
||||
echo "Compiling Options: Simulator"
|
||||
SIMULATOR=1
|
||||
;;
|
||||
m)
|
||||
echo "Compiling Manuals"
|
||||
MANUALS=1
|
||||
@ -135,37 +152,14 @@ while getopts ":bcd:eghij:k:l:mnpq:rstuz" opt ; do
|
||||
echo "Compiling Manuals (Only RST)"
|
||||
MANUALS_ONLY_RST=1
|
||||
;;
|
||||
p)
|
||||
echo "Compiling Options: Python"
|
||||
PYTHON=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
|
||||
z)
|
||||
echo "Compiling Moench Zmq Processor"
|
||||
MOENCHZMQ=1
|
||||
;;
|
||||
u)
|
||||
echo "Compiling Options: Chip Test Gui"
|
||||
CTBGUI=1
|
||||
;;
|
||||
z)
|
||||
echo "Compiling Moench Zmq Processor"
|
||||
MOENCHZMQ=1
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG"
|
||||
usage
|
||||
@ -260,12 +254,6 @@ if [ $TESTS -eq 1 ]; then
|
||||
echo "Tests Option enabled"
|
||||
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
|
||||
if [ $HDF5 -eq 1 ]; then
|
||||
|
@ -828,14 +828,14 @@ void ctbAcquisition::setCanvas(TCanvas* c) {
|
||||
myCanvas->AddExec("dynamic",Form("((ctbAcquisition*)%p)->canvasClicked()",this));
|
||||
// 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
|
||||
((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
|
||||
{
|
||||
class Detector;
|
||||
class detectorData;
|
||||
};
|
||||
class detectorData;
|
||||
|
||||
template <class dataType> class slsDetectorData;
|
||||
|
||||
@ -201,10 +201,10 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
void setBitGraph (int i ,int en, Pixel_t col);
|
||||
void startAcquisition();
|
||||
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 plotData(sls::detectorData*, int);
|
||||
int plotData(detectorData*, int);
|
||||
|
||||
void setPatternFile(const char* t);
|
||||
|
||||
|
@ -409,18 +409,18 @@ patword 018d 0008599f0008503a
|
||||
patioctrl 8f0effff6dbffdbf
|
||||
patclkctrl 0000000000000000
|
||||
patlimits 0000 018c
|
||||
patloop 0 013a 016b
|
||||
patnloop 0 199
|
||||
patloop 1 0400 0400
|
||||
patnloop 1 0
|
||||
patloop 2 0400 0400
|
||||
patnloop 2 0
|
||||
patwait 0 00aa
|
||||
patwaittime 0 10000
|
||||
patwait 1 0400
|
||||
patwaittime 1 0
|
||||
patwait 2 0400
|
||||
patwaittime 2 0
|
||||
patloop0 013a 016b
|
||||
patnloop0 199
|
||||
patloop1 0400 0400
|
||||
patnloop1 0
|
||||
patloop2 0400 0400
|
||||
patnloop2 0
|
||||
patwait0 00aa
|
||||
patwaittime0 10000
|
||||
patwait1 0400
|
||||
patwaittime1 0
|
||||
patwait2 0400
|
||||
patwaittime2 0
|
||||
|
||||
#############################################
|
||||
### edit with hostname or 1Gbs IP address of your server
|
||||
|
@ -427,18 +427,18 @@ patword 0x018c 0x0008599f0008503a
|
||||
patword 0x018d 0x0008599f0008503a
|
||||
patioctrl 0x8f0effff6dbffdbf
|
||||
patlimits 0x0000 0x018c
|
||||
patloop 0 0x013a 0x016b
|
||||
patnloop 0 0x199
|
||||
patloop 1 0x0400 0x0400
|
||||
patnloop 1 0
|
||||
patloop 2 0x0400 0x0400
|
||||
patnloop 2 0
|
||||
patwait 0 0x00aa
|
||||
patwaittime 0 10000
|
||||
patwait 1 0x0400
|
||||
patwaittime 1 0
|
||||
patwait 2 0x0400
|
||||
patwaittime 2 0
|
||||
patloop0 0x013a 0x016b
|
||||
patnloop0 0x199
|
||||
patloop1 0x0400 0x0400
|
||||
patnloop1 0
|
||||
patloop2 0x0400 0x0400
|
||||
patnloop2 0
|
||||
patwait0 0x00aa
|
||||
patwaittime0 10000
|
||||
patwait1 0x0400
|
||||
patwaittime1 0
|
||||
patwait2 0x0400
|
||||
patwaittime2 0
|
||||
|
||||
# dacs
|
||||
dac 6 800
|
||||
|
@ -29,7 +29,6 @@ set( PYTHON_FILES
|
||||
decorators.py
|
||||
detector_property.py
|
||||
detector.py
|
||||
defines.py
|
||||
eiger.py
|
||||
enums.py
|
||||
errors.py
|
||||
|
@ -11,7 +11,7 @@ enums.cpp
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
from parse import remove_comments, remove_ifdefs
|
||||
from parse import remove_comments
|
||||
|
||||
|
||||
allow_bitwise_op = ["streamingInterface", "M3_GainCaps"]
|
||||
@ -98,25 +98,25 @@ def generate_enum_string(enums):
|
||||
return ''.join(data)
|
||||
|
||||
|
||||
# def remove_ifdefs(lines):
|
||||
# """Keeps C++ version of the code"""
|
||||
# out = []
|
||||
# it = iter(lines)
|
||||
# skip = False
|
||||
# for line in it:
|
||||
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 "#ifdef __cplusplus" in line:
|
||||
line = next(it)
|
||||
|
||||
# if "#else" in line:
|
||||
# skip = True
|
||||
if "#else" in line:
|
||||
skip = True
|
||||
|
||||
# if "#endif" in line:
|
||||
# skip = False
|
||||
if "#endif" in line:
|
||||
skip = False
|
||||
|
||||
# if not skip and "#endif" not in line:
|
||||
# out.append(line)
|
||||
# return out
|
||||
if not skip and "#endif" not in line:
|
||||
out.append(line)
|
||||
return out
|
||||
|
||||
|
||||
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)
|
||||
|
||||
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
|
||||
|
@ -17,9 +17,8 @@ import _slsdet
|
||||
xy = _slsdet.xy
|
||||
defs = _slsdet.slsDetectorDefs
|
||||
|
||||
#Make enums and #defines available at top level
|
||||
from .enums import *
|
||||
from .defines import *
|
||||
|
||||
|
||||
IpAddr = _slsdet.IpAddr
|
||||
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 _slsdet import xy
|
||||
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
|
||||
import datetime as dt
|
||||
|
||||
@ -3098,24 +3098,6 @@ class Detector(CppDetectorApi):
|
||||
def patmask(self, 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
|
||||
@element
|
||||
def patwait0(self):
|
||||
@ -3176,23 +3158,6 @@ class Detector(CppDetectorApi):
|
||||
addr = ut.merge_args(2, 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
|
||||
@element
|
||||
def patwaittime0(self):
|
||||
@ -3227,23 +3192,6 @@ class Detector(CppDetectorApi):
|
||||
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
|
||||
@element
|
||||
def patloop0(self):
|
||||
@ -3306,24 +3254,6 @@ class Detector(CppDetectorApi):
|
||||
addr = ut.merge_args(2, 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
|
||||
@element
|
||||
def patnloop0(self):
|
||||
|
@ -2,24 +2,14 @@
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
from .utils import element_if_equal
|
||||
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 unpack:
|
||||
for dkey, dvalue in value.items():
|
||||
func(key, *dvalue, [dkey])
|
||||
else:
|
||||
for dkey, dvalue in value.items():
|
||||
func(key, dvalue, [dkey])
|
||||
for dkey, dvalue in value.items():
|
||||
func(key, dvalue, [dkey])
|
||||
else:
|
||||
if unpack:
|
||||
func(key, *value)
|
||||
else:
|
||||
func(key, value)
|
||||
|
||||
func(key, value)
|
||||
|
||||
class JsonProxy:
|
||||
"""
|
||||
@ -137,118 +127,4 @@ class ClkFreqProxy:
|
||||
else:
|
||||
rstr += f'{i}: {r}\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')
|
||||
return rstr.strip('\n')
|
@ -14,7 +14,7 @@ void init_pattern(py::module &m) {
|
||||
using pat = sls::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);
|
||||
|
||||
patternParameters.def(py::init());
|
||||
|
@ -15,8 +15,6 @@
|
||||
#include <qwt_symbol.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace sls {
|
||||
|
||||
#define QwtLog10ScaleEngine QwtLogScaleEngine // hmm
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "SlsQt2DPlot.h"
|
||||
// #include "sls/ansi.h"
|
||||
#include <array>
|
||||
|
||||
#include <qlist.h>
|
||||
#include <qprinter.h>
|
||||
|
@ -568,72 +568,6 @@
|
||||
#define PATTERN_SET_LSB_REG (0x82 << 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 */
|
||||
#define I2C_TRANSFER_COMMAND_FIFO_REG (0x100 << 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"
|
||||
|
||||
#define MIN_REQRD_VRSN_T_RD_API 0x181130
|
||||
#define REQRD_FRMWR_VRSN 0x220714
|
||||
#define REQRD_FRMWR_VRSN 0x201005
|
||||
|
||||
#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
|
||||
patioctrl 0x8f0effff6dbffdbf
|
||||
patlimits 0x0000 0x0110
|
||||
patloop 0 0x00be 0x00ef
|
||||
patnloop 0 199
|
||||
patloop 1 0x0400 0x0400
|
||||
patnloop 1 0
|
||||
patloop 2 0x0400 0x0400
|
||||
patnloop 2 0
|
||||
patwait 0 0x002e
|
||||
patwaittime 0 800
|
||||
patwait 1 0x0400
|
||||
patwaittime 1 0
|
||||
patwait 2 0x0400
|
||||
patwaittime 2 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
|
||||
patloop0 0x00be 0x00ef
|
||||
patnloop0 199
|
||||
patloop1 0x0400 0x0400
|
||||
patnloop1 0
|
||||
patloop2 0x0400 0x0400
|
||||
patnloop2 0
|
||||
patwait0 0x002e
|
||||
patwaittime0 800
|
||||
patwait1 0x0400
|
||||
patwaittime1 0
|
||||
patwait2 0x0400
|
||||
patwaittime2 0
|
||||
|
@ -572,72 +572,5 @@
|
||||
#define PATTERN_SET_LSB_REG (0x82 << 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 */
|
||||
#define RXR_ENDPOINT_START_REG (0x1000 << MEM_MAP_SHIFT)
|
||||
|
@ -274,28 +274,15 @@ patword 0x0110 0x0008599f0008503a
|
||||
patword 0x0111 0x0008599f0008503a
|
||||
patioctrl 0x8f0effff6dbffdbf
|
||||
patlimits 0x0000 0x0110
|
||||
patloop 0 0x00be 0x00ef
|
||||
patnloop 0 199
|
||||
patloop 1 0x0400 0x0400
|
||||
patnloop 1 0
|
||||
patloop 2 0x0400 0x0400
|
||||
patnloop 2 0
|
||||
patwait 0 0x002e
|
||||
patwaittime 0 800
|
||||
patwait 1 0x0400
|
||||
patwaittime 1 0
|
||||
patwait 2 0x0400
|
||||
patwaittime 2 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
|
||||
patloop0 0x00be 0x00ef
|
||||
patnloop0 199
|
||||
patloop1 0x0400 0x0400
|
||||
patnloop1 0
|
||||
patloop2 0x0400 0x0400
|
||||
patnloop2 0
|
||||
patwait0 0x002e
|
||||
patwaittime0 800
|
||||
patwait1 0x0400
|
||||
patwaittime1 0
|
||||
patwait2 0x0400
|
||||
patwaittime2 0
|
||||
|
Binary file not shown.
@ -5,7 +5,7 @@
|
||||
#include "sls/sls_detector_defs.h"
|
||||
|
||||
#define MIN_REQRD_VRSN_T_RD_API 0x180314
|
||||
#define REQRD_FRMWR_VRSN 0x220714
|
||||
#define REQRD_FRMWR_VRSN 0x201005
|
||||
|
||||
#define LINKED_SERVER_NAME "moenchDetectorServer"
|
||||
|
||||
|
@ -242,15 +242,15 @@ patword 0x00f0 0x0000000000000000
|
||||
patword 0x00f1 0x0000000000000000
|
||||
patword 0x00f2 0x0000000000000000
|
||||
patlimits 0x0000 0x00f2
|
||||
patloop 0 0x0400 0x0400
|
||||
patnloop 0 0
|
||||
patloop 1 0x0400 0x0400
|
||||
patnloop 1 0
|
||||
patloop 2 0x0400 0x0400
|
||||
patnloop 2 0
|
||||
patwait 0 0x0400
|
||||
patwaittime 0 0
|
||||
patwait 1 0x0400
|
||||
patwaittime 1 0
|
||||
patwait 2 0x0400
|
||||
patwaittime 2 0
|
||||
patloop0 0x0400 0x0400
|
||||
patnloop0 0
|
||||
patloop1 0x0400 0x0400
|
||||
patnloop1 0
|
||||
patloop2 0x0400 0x0400
|
||||
patnloop2 0
|
||||
patwait0 0x0400
|
||||
patwaittime0 0
|
||||
patwait1 0x0400
|
||||
patwaittime1 0
|
||||
patwait2 0x0400
|
||||
patwaittime2 0
|
||||
|
@ -242,15 +242,15 @@ patword 0x00f0 0x0000000000000000
|
||||
patword 0x00f1 0x0000000000000000
|
||||
patword 0x00f2 0x0000000000000000
|
||||
patlimits 0x0000 0x00f2
|
||||
patloop 0 0x0400 0x0400
|
||||
patnloop 0 0
|
||||
patloop 1 0x0400 0x0400
|
||||
patnloop 1 0
|
||||
patloop 2 0x0400 0x0400
|
||||
patnloop 2 0
|
||||
patwait 0 0x0400
|
||||
patwaittime 0 0
|
||||
patwait 1 0x0400
|
||||
patwaittime 1 0
|
||||
patwait 2 0x0400
|
||||
patwaittime 2 0
|
||||
patloop0 0x0400 0x0400
|
||||
patnloop0 0
|
||||
patloop1 0x0400 0x0400
|
||||
patnloop1 0
|
||||
patloop2 0x0400 0x0400
|
||||
patnloop2 0
|
||||
patwait0 0x0400
|
||||
patwaittime0 0
|
||||
patwait1 0x0400
|
||||
patwaittime1 0
|
||||
patwait2 0x0400
|
||||
patwaittime2 0
|
||||
|
Binary file not shown.
@ -73,13 +73,13 @@ patternParameters *setChipStatusRegisterPattern(int csr) {
|
||||
error = 1;
|
||||
}
|
||||
// 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;
|
||||
// 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;
|
||||
pat->startloop[i] = MAX_PATTERN_LENGTH - 1;
|
||||
pat->stoploop[i] = MAX_PATTERN_LENGTH - 1;
|
||||
pat->loop[i * 2 + 0] = MAX_PATTERN_LENGTH - 1;
|
||||
pat->loop[i * 2 + 1] = MAX_PATTERN_LENGTH - 1;
|
||||
pat->nloop[i] = 0;
|
||||
}
|
||||
|
||||
@ -349,13 +349,13 @@ patternParameters *setChannelRegisterChip(int ichip, int *mask, int *trimbits) {
|
||||
error = 1;
|
||||
}
|
||||
// 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;
|
||||
// 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;
|
||||
pat->startloop[i] = MAX_PATTERN_LENGTH - 1;
|
||||
pat->stoploop[i] = MAX_PATTERN_LENGTH - 1;
|
||||
pat->loop[i * 2 + 0] = MAX_PATTERN_LENGTH - 1;
|
||||
pat->loop[i * 2 + 1] = MAX_PATTERN_LENGTH - 1;
|
||||
pat->nloop[i] = 0;
|
||||
}
|
||||
|
||||
|
@ -2456,51 +2456,21 @@ void *start_timer(void *arg) {
|
||||
// Generate data
|
||||
char imageData[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;
|
||||
|
||||
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;
|
||||
*((uint8_t *)(imageData + i)) = (uint8_t)i;
|
||||
break;
|
||||
case 16:
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) = (uint16_t)j;
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) = (uint16_t)i;
|
||||
break;
|
||||
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;
|
||||
default:
|
||||
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
|
||||
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 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)
|
||||
#ifdef VIRTUAL
|
||||
void initializePatternWord() {
|
||||
@ -163,9 +157,9 @@ void writePatternWord(int addr, uint64_t word) {
|
||||
|
||||
int validate_getPatternWaitAddresses(char *message, int level, int *addr) {
|
||||
// validate input
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
if (level < 0 || level > 2) {
|
||||
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));
|
||||
return FAIL;
|
||||
}
|
||||
@ -184,17 +178,6 @@ int getPatternWaitAddress(int level) {
|
||||
case 2:
|
||||
return ((bus_r(PATTERN_WAIT_2_ADDR_REG) & PATTERN_WAIT_2_ADDR_MSK) >>
|
||||
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:
|
||||
return -1;
|
||||
}
|
||||
@ -202,9 +185,9 @@ int getPatternWaitAddress(int level) {
|
||||
|
||||
int validate_setPatternWaitAddresses(char *message, int level, int addr) {
|
||||
// validate input
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
if (level < 0 || level > 2) {
|
||||
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));
|
||||
return FAIL;
|
||||
}
|
||||
@ -251,20 +234,6 @@ void setPatternWaitAddress(int level, int addr) {
|
||||
bus_w(PATTERN_WAIT_2_ADDR_REG,
|
||||
((addr << PATTERN_WAIT_2_ADDR_OFST) & PATTERN_WAIT_2_ADDR_MSK));
|
||||
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:
|
||||
return;
|
||||
}
|
||||
@ -272,9 +241,9 @@ void setPatternWaitAddress(int level, int addr) {
|
||||
|
||||
int validate_getPatternWaitTime(char *message, int level, uint64_t *waittime) {
|
||||
// validate input
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
if (level < 0 || level > 2) {
|
||||
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));
|
||||
return FAIL;
|
||||
}
|
||||
@ -293,17 +262,6 @@ uint64_t getPatternWaitTime(int level) {
|
||||
case 2:
|
||||
return get64BitReg(PATTERN_WAIT_TIMER_2_LSB_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:
|
||||
return -1;
|
||||
}
|
||||
@ -311,9 +269,9 @@ uint64_t getPatternWaitTime(int level) {
|
||||
|
||||
int validate_setPatternWaitTime(char *message, int level, uint64_t waittime) {
|
||||
// validate input
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
if (level < 0 || level > 2) {
|
||||
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));
|
||||
return FAIL;
|
||||
}
|
||||
@ -353,20 +311,6 @@ void setPatternWaitTime(int level, uint64_t t) {
|
||||
set64BitReg(t, PATTERN_WAIT_TIMER_2_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_2_MSB_REG);
|
||||
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:
|
||||
return;
|
||||
}
|
||||
@ -374,9 +318,9 @@ void setPatternWaitTime(int level, uint64_t t) {
|
||||
|
||||
int validate_getPatternLoopCycles(char *message, int level, int *numLoops) {
|
||||
// validate input
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
if (level < 0 || level > 2) {
|
||||
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));
|
||||
return FAIL;
|
||||
}
|
||||
@ -392,14 +336,6 @@ int getPatternLoopCycles(int level) {
|
||||
return bus_r(PATTERN_LOOP_1_ITERATION_REG);
|
||||
case 2:
|
||||
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:
|
||||
return -1;
|
||||
}
|
||||
@ -407,9 +343,9 @@ int getPatternLoopCycles(int level) {
|
||||
|
||||
int validate_setPatternLoopCycles(char *message, int level, int numLoops) {
|
||||
// validate input
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
if (level < 0 || level > 2) {
|
||||
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));
|
||||
return FAIL;
|
||||
}
|
||||
@ -449,17 +385,6 @@ void setPatternLoopCycles(int level, int nLoop) {
|
||||
case 2:
|
||||
bus_w(PATTERN_LOOP_2_ITERATION_REG, nLoop);
|
||||
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:
|
||||
return;
|
||||
}
|
||||
@ -518,10 +443,10 @@ void setPatternLoopLimits(int startAddr, int stopAddr) {
|
||||
int validate_getPatternLoopAddresses(char *message, int level, int *startAddr,
|
||||
int *stopAddr) {
|
||||
// validate input
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
if (level < 0 || level > 2) {
|
||||
sprintf(
|
||||
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));
|
||||
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) >>
|
||||
PATTERN_LOOP_2_ADDR_STP_OFST);
|
||||
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:
|
||||
return;
|
||||
}
|
||||
@ -590,10 +489,10 @@ void getPatternLoopAddresses(int level, int *startAddr, int *stopAddr) {
|
||||
int validate_setPatternLoopAddresses(char *message, int level, int startAddr,
|
||||
int stopAddr) {
|
||||
// validate input
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
if (level < 0 || level > 2) {
|
||||
sprintf(
|
||||
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));
|
||||
return FAIL;
|
||||
}
|
||||
@ -660,29 +559,6 @@ void setPatternLoopAddresses(int level, int startAddr, int stopAddr) {
|
||||
((stopAddr << PATTERN_LOOP_2_ADDR_STP_OFST) &
|
||||
PATTERN_LOOP_2_ADDR_STP_MSK));
|
||||
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:
|
||||
return;
|
||||
}
|
||||
@ -749,10 +625,10 @@ int loadPattern(char *message, enum TLogLevel printLevel,
|
||||
}
|
||||
|
||||
if (ret == OK) {
|
||||
for (int i = 0; i < MAX_LEVELS; ++i) {
|
||||
for (int i = 0; i <= 2; ++i) {
|
||||
// loop addr
|
||||
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) {
|
||||
break;
|
||||
}
|
||||
@ -809,15 +685,15 @@ int getPattern(char *message, patternParameters *pat) {
|
||||
pat->limits[1] = retval2;
|
||||
}
|
||||
if (ret == OK) {
|
||||
for (int i = 0; i < MAX_LEVELS; ++i) {
|
||||
for (int i = 0; i <= 2; ++i) {
|
||||
// loop addr
|
||||
ret = validate_getPatternLoopAddresses(message, i, &retval1,
|
||||
&retval2);
|
||||
if (ret == FAIL) {
|
||||
break;
|
||||
}
|
||||
pat->startloop[i] = retval1;
|
||||
pat->stoploop[i] = retval2;
|
||||
pat->loop[i * 2 + 0] = retval1;
|
||||
pat->loop[i * 2 + 1] = retval2;
|
||||
|
||||
// num loops
|
||||
ret = validate_getPatternLoopCycles(message, i, &retval1);
|
||||
@ -970,14 +846,26 @@ int loadPatternFile(char *patFname, char *errMessage) {
|
||||
}
|
||||
|
||||
// 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;
|
||||
if (!strncmp(line, "patloop0", strlen("patloop0"))) {
|
||||
level = 0;
|
||||
} else if (!strncmp(line, "patloop1", strlen("patloop1"))) {
|
||||
level = 1;
|
||||
} else {
|
||||
level = 2;
|
||||
}
|
||||
|
||||
int startAddr = 0;
|
||||
int stopAddr = 0;
|
||||
// cannot scan values
|
||||
if (sscanf(line, "%s %d 0x%x 0x%x", command, &level, &startAddr, &stopAddr) !=
|
||||
4) {
|
||||
strcpy(temp, "Could not scan patloop arguments.\n");
|
||||
if (sscanf(line, "%s 0x%x 0x%x", command, &startAddr, &stopAddr) !=
|
||||
3) {
|
||||
sprintf(temp, "Could not scan patloop%d arguments.\n", level);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -988,12 +876,24 @@ int loadPatternFile(char *patFname, char *errMessage) {
|
||||
}
|
||||
|
||||
// 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;
|
||||
if (!strncmp(line, "patnloop0", strlen("patnloop0"))) {
|
||||
level = 0;
|
||||
} else if (!strncmp(line, "patnloop1", strlen("patnloop1"))) {
|
||||
level = 1;
|
||||
} else {
|
||||
level = 2;
|
||||
}
|
||||
|
||||
int numLoops = -1;
|
||||
// cannot scan values
|
||||
if (sscanf(line, "%s %d %d", command, &level, &numLoops) != 3) {
|
||||
strcpy(temp, "Could not scan patnloop arguments.\n");
|
||||
if (sscanf(line, "%s %d", command, &numLoops) != 2) {
|
||||
sprintf(temp, "Could not scan patnloop %d arguments.\n", level);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1003,12 +903,24 @@ int loadPatternFile(char *patFname, char *errMessage) {
|
||||
}
|
||||
|
||||
// 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;
|
||||
if (!strncmp(line, "patwait0", strlen("patwait0"))) {
|
||||
level = 0;
|
||||
} else if (!strncmp(line, "patwait1", strlen("patwait1"))) {
|
||||
level = 1;
|
||||
} else {
|
||||
level = 2;
|
||||
}
|
||||
|
||||
int addr = 0;
|
||||
// cannot scan values
|
||||
if (sscanf(line, "%s %d 0x%x", command, &level, &addr) != 3) {
|
||||
strcpy(temp, "Could not scan patwait arguments.\n");
|
||||
if (sscanf(line, "%s 0x%x", command, &addr) != 2) {
|
||||
sprintf(temp, "Could not scan patwait%d arguments.\n", level);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1018,15 +930,27 @@ int loadPatternFile(char *patFname, char *errMessage) {
|
||||
}
|
||||
|
||||
// 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;
|
||||
if (!strncmp(line, "patwaittime0", strlen("patwaittime0"))) {
|
||||
level = 0;
|
||||
} else if (!strncmp(line, "patwaittime1", strlen("patwaittime1"))) {
|
||||
level = 1;
|
||||
} else {
|
||||
level = 2;
|
||||
}
|
||||
|
||||
uint64_t waittime = 0;
|
||||
|
||||
// cannot scan values
|
||||
#ifdef VIRTUAL
|
||||
if (sscanf(line, "%s %d %ld", command, &level, &waittime) != 3) {
|
||||
if (sscanf(line, "%s %ld", command, &waittime) != 2) {
|
||||
#else
|
||||
if (sscanf(line, "%s %d %lld", command, &level, &waittime) != 3) {
|
||||
if (sscanf(line, "%s %lld", command, &waittime) != 2) {
|
||||
#endif
|
||||
sprintf(temp, "Could not scan patwaittime%d arguments.\n",
|
||||
level);
|
||||
|
@ -9249,25 +9249,8 @@ int clear_all_udp_dst(int file_des) {
|
||||
if (check_detector_idle("clear all udp destinations") == OK) {
|
||||
memset(udpDetails, 0, sizeof(udpDetails));
|
||||
// minimum 1 destination in fpga
|
||||
int numdest = 1;
|
||||
// set number of destinations
|
||||
#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));
|
||||
}
|
||||
}
|
||||
numUdpDestinations = 1;
|
||||
configure_mac();
|
||||
}
|
||||
}
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
|
@ -913,6 +913,15 @@ class Detector {
|
||||
|
||||
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 */
|
||||
|
@ -13,11 +13,11 @@ typedef struct __attribute__((packed)) {
|
||||
uint64_t word[MAX_PATTERN_LENGTH];
|
||||
uint64_t ioctrl;
|
||||
uint32_t limits[2];
|
||||
uint32_t startloop[MAX_PATTERN_LEVELS];
|
||||
uint32_t stoploop[MAX_PATTERN_LEVELS];
|
||||
uint32_t nloop[MAX_PATTERN_LEVELS];
|
||||
uint32_t wait[MAX_PATTERN_LEVELS];
|
||||
uint64_t waittime[MAX_PATTERN_LEVELS];
|
||||
// loop0 start, loop0 stop .. loop2 start, loop2 stop
|
||||
uint32_t loop[6];
|
||||
uint32_t nloop[3];
|
||||
uint32_t wait[3];
|
||||
uint64_t waittime[3];
|
||||
} patternParameters;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -65,11 +65,6 @@ int main(int argc, char *argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// prevent mem size check
|
||||
if (parser.command() == "config" && action == slsDetectorDefs::PUT_ACTION) {
|
||||
sls::freeSharedMemory(parser.multi_id());
|
||||
}
|
||||
|
||||
try {
|
||||
sls::Detector det(parser.multi_id());
|
||||
sls::CmdProxy proxy(&det);
|
||||
|
@ -2705,30 +2705,7 @@ std::string CmdProxy::PatternWord(int action) {
|
||||
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) {
|
||||
if (cmd != "patlimits" && cmd != "patloop0" && cmd != "patloop1" && cmd != "patloop2" && cmd != "patloop") {
|
||||
throw RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
}
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
@ -2736,30 +2713,53 @@ std::string CmdProxy::PatternLoopAddresses(int action) {
|
||||
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits "
|
||||
"of complete pattern."
|
||||
<< '\n';
|
||||
} else if (cmd == "patloop") {
|
||||
os << "[0-6] [start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits of the loop level provided."
|
||||
<< "\n\t[Mythen3] Level options: 0-3 only."
|
||||
} else if (cmd == "patloop0") {
|
||||
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits "
|
||||
"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';
|
||||
} else {
|
||||
os << "Depreciated command. Use patloop."
|
||||
<< '\n';
|
||||
}
|
||||
throw RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
}
|
||||
} else {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 2;
|
||||
if (cmd != "patlimits") {
|
||||
GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs, nPutArgs);
|
||||
int level = -1;
|
||||
if (cmd == "patlimits") {
|
||||
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 (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t =
|
||||
det->getPatternLoopAddresses(level, std::vector<int>{det_id});
|
||||
os << OutStringHex(t, 4) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
int start = StringTo<int>(args[iArg++]);
|
||||
int stop = StringTo<int>(args[iArg++]);
|
||||
if (args.size() != 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
int start = StringTo<int>(args[0]);
|
||||
int stop = StringTo<int>(args[1]);
|
||||
det->setPatternLoopAddresses(level, start, stop,
|
||||
std::vector<int>{det_id});
|
||||
std::vector<int>{det_id});
|
||||
os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4)
|
||||
<< "]\n";
|
||||
<< "]\n";
|
||||
} else {
|
||||
throw RuntimeError("Unknown action");
|
||||
}
|
||||
@ -2768,32 +2768,50 @@ std::string CmdProxy::PatternLoopAddresses(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;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
if (cmd == "patnloop") {
|
||||
os << "[0-6] [n_cycles] \n\t[Ctb][Moench][Mythen3] Number of cycles of "
|
||||
"the loop level provided."
|
||||
<< "\n\t[Mythen3] Level options: 0-3 only."
|
||||
if (cmd == "patnloop0") {
|
||||
os << "[n_cycles] \n\t[Ctb][Moench][Mythen3] Number of cycles of "
|
||||
"loop 0."
|
||||
<< '\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';
|
||||
} else {
|
||||
os << "Depreciated command. Use patnloop."
|
||||
<< '\n';
|
||||
}
|
||||
throw RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
}
|
||||
} else {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs, nPutArgs);
|
||||
int level = -1;
|
||||
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 (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getPatternLoopCycles(level, std::vector<int>{det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
int nloops = StringTo<int>(args[iArg++]);
|
||||
det->setPatternLoopCycles(level, nloops, std::vector<int>{det_id});
|
||||
os << nloops << '\n';
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setPatternLoopCycles(level, StringTo<int>(args[0]),
|
||||
std::vector<int>{det_id});
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
throw RuntimeError("Unknown action");
|
||||
}
|
||||
@ -2802,28 +2820,42 @@ std::string CmdProxy::PatternLoopCycles(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;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
if (cmd == "patwait") {
|
||||
os << "[0-6] [addr] \n\t[Ctb][Moench][Mythen3] Wait address for loop level provided."
|
||||
<< "\n\t[Mythen3] Level options: 0-3 only.";
|
||||
if (cmd == "patwait0") {
|
||||
os << "[addr] \n\t[Ctb][Moench][Mythen3] Wait 0 address." << '\n';
|
||||
} 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 {
|
||||
os << "Depreciated command. Use patwait.";
|
||||
throw RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
}
|
||||
os << '\n';
|
||||
} else {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs, nPutArgs);
|
||||
int level = -1;
|
||||
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 (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getPatternWaitAddr(level, std::vector<int>{det_id});
|
||||
os << OutStringHex(t, 4) << '\n';
|
||||
} 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});
|
||||
os << ToStringHex(addr, 4) << '\n';
|
||||
} else {
|
||||
@ -2834,32 +2866,50 @@ std::string CmdProxy::PatternWaitAddress(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;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
if (cmd == "patwaittime") {
|
||||
os << "[0-6] [n_clk] \n\t[Ctb][Moench][Mythen3] Wait time in clock "
|
||||
"cycles for the loop provided."
|
||||
<< "\n\t[Mythen3] Level options: 0-3 only."
|
||||
if (cmd == "patwaittime0") {
|
||||
os << "[n_clk] \n\t[Ctb][Moench][Mythen3] Wait 0 time in clock "
|
||||
"cycles."
|
||||
<< '\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';
|
||||
} else {
|
||||
os << "Depreciated command. Use patwaittime."
|
||||
<< '\n';
|
||||
}
|
||||
throw RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
}
|
||||
} else {
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs, nPutArgs);
|
||||
int level = -1;
|
||||
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 (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getPatternWaitTime(level, std::vector<int>{det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
uint64_t waittime = StringTo<uint64_t>(args[iArg++]);
|
||||
det->setPatternWaitTime(level, waittime, {det_id});
|
||||
os << waittime << '\n';
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setPatternWaitTime(level, StringTo<uint64_t>(args[0]),
|
||||
{det_id});
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
throw RuntimeError("Unknown action");
|
||||
}
|
||||
|
@ -911,6 +911,7 @@ class CmdProxy {
|
||||
{"rx_arping", &CmdProxy::rx_arping},
|
||||
{"rx_roi", &CmdProxy::Rx_ROI},
|
||||
{"rx_clearroi", &CmdProxy::rx_clearroi},
|
||||
{"rx_bunchsize", &CmdProxy::rx_bunchsize},// FIXME: rx_fifobunchsize?
|
||||
|
||||
/* File */
|
||||
{"fformat", &CmdProxy::fformat},
|
||||
@ -1049,19 +1050,15 @@ class CmdProxy {
|
||||
{"patioctrl", &CmdProxy::patioctrl},
|
||||
{"patword", &CmdProxy::PatternWord},
|
||||
{"patlimits", &CmdProxy::PatternLoopAddresses},
|
||||
{"patloop", &CmdProxy::PatternLoopAddresses},
|
||||
{"patloop0", &CmdProxy::PatternLoopAddresses},
|
||||
{"patloop1", &CmdProxy::PatternLoopAddresses},
|
||||
{"patloop2", &CmdProxy::PatternLoopAddresses},
|
||||
{"patnloop", &CmdProxy::PatternLoopCycles},
|
||||
{"patnloop0", &CmdProxy::PatternLoopCycles},
|
||||
{"patnloop1", &CmdProxy::PatternLoopCycles},
|
||||
{"patnloop2", &CmdProxy::PatternLoopCycles},
|
||||
{"patwait", &CmdProxy::PatternWaitAddress},
|
||||
{"patwait0", &CmdProxy::PatternWaitAddress},
|
||||
{"patwait1", &CmdProxy::PatternWaitAddress},
|
||||
{"patwait2", &CmdProxy::PatternWaitAddress},
|
||||
{"patwaittime", &CmdProxy::PatternWaitTime},
|
||||
{"patwaittime0", &CmdProxy::PatternWaitTime},
|
||||
{"patwaittime1", &CmdProxy::PatternWaitTime},
|
||||
{"patwaittime2", &CmdProxy::PatternWaitTime},
|
||||
@ -1196,7 +1193,6 @@ class CmdProxy {
|
||||
/* Pattern */
|
||||
std::string Pattern(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 PatternLoopCycles(int action);
|
||||
std::string PatternWaitAddress(int action);
|
||||
@ -1762,6 +1758,10 @@ class CmdProxy {
|
||||
"Resets Region of interest in receiver. Default is all "
|
||||
"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 */
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
|
@ -1225,6 +1225,14 @@ void Detector::setRxROI(const defs::ROI value) { pimpl->setRxROI(value); }
|
||||
|
||||
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
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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
|
||||
slsDetectorDefs::fileFormat Module::getFileFormat() const {
|
||||
return sendToReceiver<fileFormat>(F_GET_RECEIVER_FILE_FORMAT);
|
||||
|
@ -294,6 +294,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
defs::ROI getRxROI() const;
|
||||
void setRxROI(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])
|
||||
return false;
|
||||
}
|
||||
for (size_t i = 0; i < (sizeof(pat->startloop) / sizeof(pat->startloop[0])); ++i) {
|
||||
if (pat->startloop[i] != other.pat->startloop[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])
|
||||
for (size_t i = 0; i < (sizeof(pat->loop) / sizeof(pat->loop[0])); ++i) {
|
||||
if (pat->loop[i] != other.pat->loop[i])
|
||||
return false;
|
||||
}
|
||||
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[1]) + std::string("]"));
|
||||
}
|
||||
for (int i = 0; i != MAX_PATTERN_LEVELS; ++i) {
|
||||
if (pat->startloop[i] >= MAX_PATTERN_LENGTH ||
|
||||
pat->stoploop[i] >= MAX_PATTERN_LENGTH) {
|
||||
for (int i = 0; i != 3; ++i) {
|
||||
if (pat->loop[i * 2 + 0] >= MAX_PATTERN_LENGTH ||
|
||||
pat->loop[i * 2 + 1] >= MAX_PATTERN_LENGTH) {
|
||||
throw RuntimeError(
|
||||
"Invalid Pattern loop address for level " + ToString(i) +
|
||||
std::string(" [") + ToString(pat->startloop[i]) +
|
||||
std::string(", ") + ToString(pat->stoploop[i]) +
|
||||
std::string(" [") + ToString(pat->loop[i * 2 + 0]) +
|
||||
std::string(", ") + ToString(pat->loop[i * 2 + 1]) +
|
||||
std::string("]"));
|
||||
}
|
||||
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[1] = StringTo<uint32_t>(args[2]);
|
||||
}
|
||||
else if (cmd == "patloop0" || cmd == "patloop1" ||
|
||||
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) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
}
|
||||
level = cmd[cmd.find_first_of("012")] - '0';
|
||||
} else if (cmd == "patloop0" || cmd == "patloop1" ||
|
||||
cmd == "patloop2") {
|
||||
if (nargs != 2) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
}
|
||||
if (level < 0 || level >= MAX_PATTERN_LEVELS) {
|
||||
throw RuntimeError("Invalid Pattern level. Options 0-" + std::to_string(MAX_PATTERN_LEVELS - 1));
|
||||
}
|
||||
int loop1 = StringTo<uint32_t>(args[iArg++]);
|
||||
int loop2 = StringTo<uint32_t>(args[iArg++]);
|
||||
pat->startloop[level] = loop1;
|
||||
pat->stoploop[level] = loop2;
|
||||
int level = cmd[cmd.find_first_of("012")] - '0';
|
||||
int loop1 = StringTo<uint32_t>(args[1]);
|
||||
int loop2 = StringTo<uint32_t>(args[2]);
|
||||
pat->loop[level * 2 + 0] = loop1;
|
||||
pat->loop[level * 2 + 1] = loop2;
|
||||
} else if (cmd == "patnloop0" || cmd == "patnloop1" ||
|
||||
cmd == "patnloop2" || cmd == "patnloop") {
|
||||
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) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
}
|
||||
level = cmd[cmd.find_first_of("012")] - '0';
|
||||
cmd == "patnloop2") {
|
||||
if (nargs != 1) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
}
|
||||
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++]);
|
||||
int level = cmd[cmd.find_first_of("012")] - '0';
|
||||
pat->nloop[level] = StringTo<uint32_t>(args[1]);
|
||||
} else if (cmd == "patwait0" || cmd == "patwait1" ||
|
||||
cmd == "patwait2" || cmd == "patwait") {
|
||||
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) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
}
|
||||
level = cmd[cmd.find_first_of("012")] - '0';
|
||||
cmd == "patwait2") {
|
||||
if (nargs != 1) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
}
|
||||
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++]);
|
||||
int level = cmd[cmd.find_first_of("012")] - '0';
|
||||
pat->wait[level] = StringTo<uint32_t>(args[1]);
|
||||
} else if (cmd == "patwaittime0" || cmd == "patwaittime1" ||
|
||||
cmd == "patwaittime2" || cmd == "patwaittime") {
|
||||
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) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
}
|
||||
level = cmd[cmd.find_first_of("012")] - '0';
|
||||
cmd == "patwaittime2") {
|
||||
if (nargs != 1) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
}
|
||||
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++]);
|
||||
int level = cmd[cmd.find_first_of("012")] - '0';
|
||||
pat->waittime[level] = StringTo<uint64_t>(args[1]);
|
||||
} else {
|
||||
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) << " "
|
||||
<< 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
|
||||
output_file << "patloop " << i << " "
|
||||
<< ToStringHex(pat->startloop[i], 4) << " "
|
||||
<< ToStringHex(pat->stoploop[i], 4) << std::endl;
|
||||
output_file << "patloop" << i << " "
|
||||
<< ToStringHex(pat->loop[i * 2 + 0], 4) << " "
|
||||
<< ToStringHex(pat->loop[i * 2 + 1], 4) << std::endl;
|
||||
// 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
|
||||
output_file << "patwait " << i << " " << ToStringHex(pat->wait[i], 4)
|
||||
output_file << "patwait" << i << " " << ToStringHex(pat->wait[i], 4)
|
||||
<< std::endl;
|
||||
// patwaittime
|
||||
output_file << "patwaittime " << i << " " << pat->waittime[i]
|
||||
output_file << "patwaittime" << i << " " << pat->waittime[i]
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
@ -276,17 +219,23 @@ std::string Pattern::str() const {
|
||||
}
|
||||
oss << "patioctrl " << ToStringHex(pat->ioctrl, word_width) << std::endl
|
||||
<< "patlimits " << ToStringHex(pat->limits[0], addr_width) << " "
|
||||
<< ToStringHex(pat->limits[1], addr_width) << std::endl;
|
||||
|
||||
for (int i = 0; i != MAX_PATTERN_LEVELS; ++i) {
|
||||
oss << "patloop " << i << ' ' << ToStringHex(pat->startloop[i], addr_width) << " "
|
||||
<< ToStringHex(pat->stoploop[i], addr_width) << std::endl
|
||||
<< "patnloop " << pat->nloop[i] << std::endl
|
||||
<< "patwait " << i << ' ' << ToStringHex(pat->wait[i], addr_width) << std::endl
|
||||
<< "patwaittime " << i << ' ' << pat->waittime[i] << std::endl;
|
||||
}
|
||||
|
||||
oss << ']';
|
||||
<< ToStringHex(pat->limits[1], addr_width) << std::endl
|
||||
<< "patloop0 " << ToStringHex(pat->loop[0], addr_width) << " "
|
||||
<< ToStringHex(pat->loop[1], addr_width) << std::endl
|
||||
<< "patnloop0 " << pat->nloop[0] << std::endl
|
||||
<< "patloop1 " << ToStringHex(pat->loop[2], addr_width) << " "
|
||||
<< ToStringHex(pat->loop[3], addr_width) << std::endl
|
||||
<< "patnloop1 " << pat->nloop[1] << std::endl
|
||||
<< "patloop2 " << ToStringHex(pat->loop[4], addr_width) << " "
|
||||
<< ToStringHex(pat->loop[5], addr_width) << std::endl
|
||||
<< "patnloop2 " << pat->nloop[2] << std::endl
|
||||
<< "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();
|
||||
}
|
||||
|
||||
|
@ -154,187 +154,315 @@ TEST_CASE("patlimits", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patloop", "[.cmd]") {
|
||||
TEST_CASE("patloop0", "[.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) {
|
||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
||||
// 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;
|
||||
proxy.Call(deprecatedCmd, {"0x20", "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " [0x0020, 0x005c]\n");
|
||||
}
|
||||
{// depreciated
|
||||
std::ostringstream oss;
|
||||
proxy.Call(deprecatedCmd, {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " [0x0020, 0x005c]\n");
|
||||
}
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop", {sLoop, "0x20", "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patloop [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});
|
||||
}
|
||||
auto prev_val = det.getPatternLoopAddresses(0);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop0", {"0x20", "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patloop0 [0x0020, 0x005c]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop0", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patloop0 [0x0020, 0x005c]\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopAddresses(0, prev_val[i][0], prev_val[i][1], {i});
|
||||
}
|
||||
} 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;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
||||
// 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;
|
||||
proxy.Call(deprecatedCmd, {"5"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " 5\n");
|
||||
}
|
||||
{// depreciated
|
||||
std::ostringstream oss;
|
||||
proxy.Call(deprecatedCmd, {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " 5\n");
|
||||
}
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patnloop", {sLoop, "5"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patnloop 5\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});
|
||||
}
|
||||
auto prev_val = det.getPatternLoopAddresses(1);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop1", {"0x20", "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patloop1 [0x0020, 0x005c]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop1", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patloop1 [0x0020, 0x005c]\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopAddresses(1, prev_val[i][0], prev_val[i][1], {i});
|
||||
}
|
||||
} 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;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
||||
// 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;
|
||||
proxy.Call(deprecatedCmd, {"0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " 0x005c\n");
|
||||
}
|
||||
{// depreciated
|
||||
std::ostringstream oss;
|
||||
proxy.Call(deprecatedCmd, {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " 0x005c\n");
|
||||
}
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait", {sLoop, "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwait 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});
|
||||
}
|
||||
auto prev_val = det.getPatternLoopAddresses(2);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop2", {"0x20", "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patloop2 [0x0020, 0x005c]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop2", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patloop2 [0x0020, 0x005c]\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopAddresses(2, prev_val[i][0], prev_val[i][1], {i});
|
||||
}
|
||||
} 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;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
||||
// 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;
|
||||
proxy.Call(deprecatedCmd, {"8589936640"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " 8589936640\n");
|
||||
}
|
||||
{// depreciated
|
||||
std::ostringstream oss;
|
||||
proxy.Call(deprecatedCmd, {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " 8589936640\n");
|
||||
}
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwaittime", {sLoop, "8589936640"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwaittime 8589936640\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});
|
||||
}
|
||||
auto prev_val = det.getPatternLoopCycles(0);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patnloop0", {"5"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patnloop0 5\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patnloop0", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patnloop0 5\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopCycles(0, prev_val[i], {i});
|
||||
}
|
||||
} 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);
|
||||
REQUIRE(oss.str() == "rx_fifodepth 100\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("rx_fifodepth", {"0"}, -1, PUT));
|
||||
for (int i = 0; i != det.size(); ++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 */
|
||||
|
||||
TEST_CASE("fformat", "[.cmd]") {
|
||||
|
@ -14,9 +14,9 @@ TEST_CASE("Pattern is default constructable and has zeroed fields") {
|
||||
|
||||
TEST_CASE("Copy construct pattern") {
|
||||
Pattern p;
|
||||
p.data()->startloop[0] = 7;
|
||||
p.data()->loop[0] = 7;
|
||||
Pattern p1(p);
|
||||
REQUIRE(p1.data()->startloop[0] == 7);
|
||||
REQUIRE(p1.data()->loop[0] == 7);
|
||||
}
|
||||
|
||||
TEST_CASE("Compare patterns") {
|
||||
|
@ -223,6 +223,8 @@ int ClientInterface::functionTable(){
|
||||
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_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++) {
|
||||
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) {
|
||||
auto size = socket.Receive<int>();
|
||||
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) {
|
||||
verifyIdle(socket);
|
||||
@ -1780,4 +1782,29 @@ int ClientInterface::set_receiver_roi_metadata(Interface &socket) {
|
||||
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
|
||||
|
@ -170,6 +170,9 @@ class ClientInterface : private virtual slsDetectorDefs {
|
||||
int get_receiver_roi(ServerInterface &socket);
|
||||
int set_receiver_roi(ServerInterface &socket);
|
||||
int set_receiver_roi_metadata(ServerInterface &socket);
|
||||
int get_bunch_size(ServerInterface &socket);
|
||||
int set_bunch_size(ServerInterface &socket);
|
||||
|
||||
|
||||
Implementation *impl() {
|
||||
if (receiver != nullptr) {
|
||||
|
@ -44,6 +44,7 @@ DataProcessor::DataProcessor(int index, detectorType detectorType, Fifo *fifo,
|
||||
ctbAnalogDataBytes_(ctbAnalogDataBytes) {
|
||||
|
||||
LOG(logDEBUG) << "DataProcessor " << index << " created";
|
||||
vetoThread = (detectorType_ == GOTTHARD2 && index != 0);
|
||||
}
|
||||
|
||||
DataProcessor::~DataProcessor() { DeleteFiles(); }
|
||||
@ -57,7 +58,10 @@ void DataProcessor::SetActivate(bool enable) { activated_ = enable; }
|
||||
void DataProcessor::SetReceiverROI(ROI roi) {
|
||||
receiverRoi_ = roi;
|
||||
receiverRoiEnabled_ = receiverRoi_.completeRoi() ? false : true;
|
||||
receiverNoRoi_ = receiverRoi_.noRoi();
|
||||
}
|
||||
|
||||
void DataProcessor::SetBunchSize(size_t value) {
|
||||
fifoBunchSize = value;
|
||||
}
|
||||
|
||||
void DataProcessor::ResetParametersforNewAcquisition() {
|
||||
@ -69,6 +73,12 @@ void DataProcessor::ResetParametersforNewAcquisition() {
|
||||
firstStreamerFrame_ = true;
|
||||
streamCurrentFrame_ = false;
|
||||
completeImageToStreamBeforeCropping = make_unique<char[]>(generalData_->imageSize);
|
||||
|
||||
fifoBunchSizeBytes = generalData_->imageSize;
|
||||
if (vetoThread) {
|
||||
fifoBunchSizeBytes = generalData_->vetoDataSize;
|
||||
}
|
||||
fifoBunchSizeBytes += generalData_->fifoBufferHeaderSize;
|
||||
}
|
||||
|
||||
void DataProcessor::RecordFirstIndex(uint64_t fnum) {
|
||||
@ -126,8 +136,8 @@ void DataProcessor::CreateFirstFiles(
|
||||
}
|
||||
CloseFiles();
|
||||
|
||||
// deactivated (half module/ single port or no roi), dont write file
|
||||
if (!activated_ || !detectorDataStream || receiverNoRoi_) {
|
||||
// deactivated (half module/ single port), dont write file
|
||||
if (!activated_ || !detectorDataStream) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -250,31 +260,36 @@ std::string DataProcessor::CreateMasterFile(
|
||||
void DataProcessor::ThreadExecution() {
|
||||
char *buffer = nullptr;
|
||||
fifo_->PopAddress(buffer);
|
||||
LOG(logDEBUG5) << "DataProcessor " << index << ", " << std::hex
|
||||
<< static_cast<void *>(buffer) << std::dec << ":" << buffer;
|
||||
LOG(logDEBUG1) << "DataProcessor " << index << ", " << std::hex
|
||||
<< static_cast<void *>(buffer) << std::dec;
|
||||
|
||||
// check dummy
|
||||
auto numBytes = *reinterpret_cast<uint32_t *>(buffer);
|
||||
LOG(logDEBUG1) << "DataProcessor " << index << ", Numbytes:" << numBytes;
|
||||
if (numBytes == DUMMY_PACKET_VALUE) {
|
||||
StopProcessing(buffer);
|
||||
return;
|
||||
}
|
||||
bool streamImageInBunch = false;
|
||||
char* tempBuffer = buffer;
|
||||
for (size_t iFrame = 0; iFrame != fifoBunchSize; iFrame ++) {
|
||||
|
||||
try {
|
||||
ProcessAnImage(buffer);
|
||||
} catch (const std::exception &e) {
|
||||
fifo_->FreeAddress(buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
// stream (if time/freq to stream) or free
|
||||
if (streamCurrentFrame_) {
|
||||
// copy the complete image back if roi enabled
|
||||
if (receiverRoiEnabled_) {
|
||||
(*((uint32_t *)buffer)) = generalData_->imageSize;
|
||||
memcpy(buffer + generalData_->fifoBufferHeaderSize, &completeImageToStreamBeforeCropping[0], generalData_->imageSize);
|
||||
// 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) {
|
||||
StopProcessing(buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
ProcessAnImage(tempBuffer);
|
||||
if (streamCurrentFrame_) {
|
||||
streamImageInBunch = true;
|
||||
}
|
||||
}
|
||||
// exception from callback
|
||||
catch (const std::exception &e) {
|
||||
;
|
||||
}
|
||||
tempBuffer += fifoBunchSizeBytes;
|
||||
}
|
||||
|
||||
// stream or free
|
||||
if (streamImageInBunch) {
|
||||
fifo_->PushAddressToStream(buffer);
|
||||
} else {
|
||||
fifo_->FreeAddress(buffer);
|
||||
@ -284,7 +299,7 @@ void DataProcessor::ThreadExecution() {
|
||||
void DataProcessor::StopProcessing(char *buf) {
|
||||
LOG(logDEBUG1) << "DataProcessing " << index << ": Dummy";
|
||||
|
||||
// stream or free
|
||||
// stream dummy or free
|
||||
if (*dataStreamEnable_)
|
||||
fifo_->PushAddressToStream(buf);
|
||||
else
|
||||
@ -340,8 +355,13 @@ void DataProcessor::ProcessAnImage(char *buf) {
|
||||
(uint32_t)(fnum - firstIndex_);
|
||||
}
|
||||
streamCurrentFrame_ = true;
|
||||
// needed to know which one to stream from the bunch
|
||||
(*((uint32_t *)(buf + FIFO_HEADER_STREAM_ENABLE))) = 1;
|
||||
|
||||
} else {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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() {
|
||||
@ -426,11 +455,11 @@ bool DataProcessor::CheckTimer() {
|
||||
}
|
||||
|
||||
bool DataProcessor::CheckCount() {
|
||||
if (currentFreqCount_ == *streamingFrequency_) {
|
||||
if (currentFreqCount_ >= *streamingFrequency_) {
|
||||
currentFreqCount_ = 1;
|
||||
return true;
|
||||
}
|
||||
currentFreqCount_++;
|
||||
++currentFreqCount_;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -456,7 +485,7 @@ void DataProcessor::PadMissingPackets(char *buf) {
|
||||
sls_bitset pmask = header->packetsMask;
|
||||
|
||||
uint32_t dsize = generalData_->dataSize;
|
||||
if (detectorType_ == GOTTHARD2 && index != 0) {
|
||||
if (vetoThread) {
|
||||
dsize = generalData_->vetoDataSize;
|
||||
}
|
||||
uint32_t fifohsize = generalData_->fifoBufferHeaderSize;
|
||||
|
@ -44,6 +44,7 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
void SetReceiverROI(ROI roi);
|
||||
void ResetParametersforNewAcquisition();
|
||||
void SetGeneralData(GeneralData *generalData);
|
||||
void SetBunchSize(size_t value);
|
||||
|
||||
void CloseFiles();
|
||||
void DeleteFiles();
|
||||
@ -156,7 +157,8 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
bool activated_{false};
|
||||
ROI receiverRoi_{};
|
||||
bool receiverRoiEnabled_{false};
|
||||
bool receiverNoRoi_{false};
|
||||
bool vetoThread{false};
|
||||
|
||||
std::unique_ptr<char[]> completeImageToStreamBeforeCropping;
|
||||
/** if 0, sending random images with a timer */
|
||||
uint32_t *streamingFrequency_;
|
||||
@ -184,6 +186,10 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
|
||||
File *dataFile_{nullptr};
|
||||
|
||||
size_t fifoBunchSize{0};
|
||||
/** size in memory including headers */
|
||||
size_t fifoBunchSizeBytes{0};
|
||||
|
||||
// call back
|
||||
/**
|
||||
* Call back for raw data
|
||||
|
@ -18,14 +18,15 @@ namespace sls {
|
||||
|
||||
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,
|
||||
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),
|
||||
totalNumFrames(tot) {
|
||||
|
||||
LOG(logDEBUG) << "DataStreamer " << ind << " created";
|
||||
vetoThread = (detType == GOTTHARD2 && index != 0);
|
||||
}
|
||||
|
||||
DataStreamer::~DataStreamer() {
|
||||
@ -50,6 +51,11 @@ void DataStreamer::ResetParametersforNewAcquisition(const std::string &fname) {
|
||||
completeBuffer = new char[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) {
|
||||
@ -75,6 +81,10 @@ void DataStreamer::SetAdditionalJsonHeader(
|
||||
isAdditionalJsonUpdated = true;
|
||||
}
|
||||
|
||||
void DataStreamer::SetBunchSize(size_t value) {
|
||||
fifoBunchSize = value;
|
||||
}
|
||||
|
||||
void DataStreamer::CreateZmqSockets(int *nunits, uint32_t port,
|
||||
const IpAddr ip, int hwm) {
|
||||
uint32_t portnum = port + index;
|
||||
@ -115,15 +125,23 @@ void DataStreamer::ThreadExecution() {
|
||||
"pop 0x"
|
||||
<< std::hex << (void *)(buffer) << std::dec << ":" << buffer;
|
||||
|
||||
// check dummy
|
||||
auto numBytes = *reinterpret_cast<uint32_t *>(buffer);
|
||||
LOG(logDEBUG1) << "DataStreamer " << index << ", Numbytes:" << numBytes;
|
||||
if (numBytes == DUMMY_PACKET_VALUE) {
|
||||
StopProcessing(buffer);
|
||||
return;
|
||||
}
|
||||
char* tempBuffer = buffer;
|
||||
for (size_t iFrame = 0; iFrame != fifoBunchSize; iFrame ++) {
|
||||
|
||||
ProcessAnImage(buffer);
|
||||
// end of acquisition (check dummy)
|
||||
auto numBytes = *reinterpret_cast<uint32_t *>(tempBuffer);
|
||||
LOG(logDEBUG1) << "DataStreamer " << index << ", Numbytes:" << numBytes;
|
||||
if (numBytes == DUMMY_PACKET_VALUE) {
|
||||
StopProcessing(buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
// process only if it needs to be streamed
|
||||
if (*((uint32_t *)(tempBuffer + FIFO_HEADER_STREAM_ENABLE))) {
|
||||
ProcessAnImage(tempBuffer);
|
||||
}
|
||||
tempBuffer += fifoBunchSizeBytes;
|
||||
}
|
||||
|
||||
// free
|
||||
fifo->FreeAddress(buffer);
|
||||
|
@ -30,6 +30,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
* Calls Base Class CreateThread(), sets ErrorMask if error and increments
|
||||
* NumberofDataStreamers
|
||||
* @param ind self index
|
||||
* @param dType detector type
|
||||
* @param f address of Fifo pointer
|
||||
* @param dr pointer to dynamic range
|
||||
* @param r detectorRoi
|
||||
@ -39,7 +40,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
* @param qe pointer to quad Enable
|
||||
* @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);
|
||||
|
||||
/**
|
||||
@ -55,6 +56,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
void SetFlipRows(bool fd);
|
||||
void
|
||||
SetAdditionalJsonHeader(const std::map<std::string, std::string> &json);
|
||||
void SetBunchSize(size_t value);
|
||||
|
||||
/**
|
||||
* Creates Zmq Sockets
|
||||
@ -105,6 +107,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
static const std::string TypeName;
|
||||
const GeneralData *generalData{nullptr};
|
||||
Fifo *fifo;
|
||||
detectorType detType;
|
||||
ZmqSocket *zmqSocket{nullptr};
|
||||
uint32_t *dynamicRange;
|
||||
ROI *detectorRoi;
|
||||
@ -112,6 +115,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
uint64_t *fileIndex;
|
||||
bool flipRows;
|
||||
std::map<std::string, std::string> additionalJsonHeader;
|
||||
bool vetoThread{false};
|
||||
|
||||
/** Used by streamer thread to update local copy (reduce number of locks
|
||||
* during streaming) */
|
||||
@ -132,6 +136,10 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
xy numPorts{1, 1};
|
||||
bool *quadEnable;
|
||||
uint64_t *totalNumFrames;
|
||||
|
||||
size_t fifoBunchSize{0};
|
||||
/** size in memory including headers */
|
||||
size_t fifoBunchSizeBytes{0};
|
||||
};
|
||||
|
||||
} // namespace sls
|
||||
|
@ -65,6 +65,7 @@ class GeneralData {
|
||||
uint32_t adcEnableMaskTenGiga{BIT32_MASK};
|
||||
slsDetectorDefs::ROI roi{};
|
||||
uint32_t counterMask{0};
|
||||
uint32_t defaultBunchSize{1};
|
||||
|
||||
GeneralData(){};
|
||||
virtual ~GeneralData(){};
|
||||
@ -445,10 +446,11 @@ class Gotthard2Data : public GeneralData {
|
||||
maxFramesPerFile = GOTTHARD2_MAX_FRAMES_PER_FILE;
|
||||
fifoBufferHeaderSize =
|
||||
FIFO_HEADER_NUMBYTES + sizeof(slsDetectorDefs::sls_receiver_header);
|
||||
defaultFifoDepth = 50000;
|
||||
defaultFifoDepth = 50;
|
||||
standardheader = true;
|
||||
vetoDataSize = 160;
|
||||
vetoHsize = 16;
|
||||
defaultBunchSize = 10000;
|
||||
UpdateImageSize();
|
||||
};
|
||||
|
||||
|
@ -67,16 +67,17 @@ void Implementation::SetThreadPriorities() {
|
||||
void Implementation::SetupFifoStructure() {
|
||||
fifo.clear();
|
||||
for (int i = 0; i < numUDPInterfaces; ++i) {
|
||||
uint32_t datasize = generalData->imageSize;
|
||||
size_t datasize = generalData->imageSize;
|
||||
// veto data size
|
||||
if (detType == GOTTHARD2 && i != 0) {
|
||||
datasize = generalData->vetoImageSize;
|
||||
}
|
||||
datasize += generalData->fifoBufferHeaderSize;
|
||||
datasize *= bunchSize;
|
||||
|
||||
// create fifo structure
|
||||
try {
|
||||
fifo.push_back(sls::make_unique<Fifo>(
|
||||
i, datasize + (generalData->fifoBufferHeaderSize), fifoDepth));
|
||||
fifo.push_back(sls::make_unique<Fifo>(i, datasize, fifoDepth));
|
||||
} catch (...) {
|
||||
fifo.clear();
|
||||
fifoDepth = 0;
|
||||
@ -93,9 +94,7 @@ void Implementation::SetupFifoStructure() {
|
||||
dataStreamer[i]->SetFifo(fifo[i].get());
|
||||
|
||||
LOG(logINFO) << "Memory Allocated for Fifo " << i << ": "
|
||||
<< (double)(((size_t)(datasize) +
|
||||
(size_t)(generalData->fifoBufferHeaderSize)) *
|
||||
(size_t)fifoDepth) /
|
||||
<< (double)(datasize * (size_t)fifoDepth) /
|
||||
(double)(1024 * 1024)
|
||||
<< " MB";
|
||||
}
|
||||
@ -169,6 +168,7 @@ void Implementation::setDetectorType(const detectorType d) {
|
||||
adcEnableMaskTenGiga = generalData->adcEnableMaskTenGiga;
|
||||
detectorRoi = generalData->roi;
|
||||
counterMask = generalData->counterMask;
|
||||
bunchSize = generalData->defaultBunchSize;
|
||||
|
||||
SetLocalNetworkParameters();
|
||||
SetupFifoStructure();
|
||||
@ -204,10 +204,12 @@ void Implementation::setDetectorType(const detectorType d) {
|
||||
for (const auto &it : listener) {
|
||||
it->SetGeneralData(generalData);
|
||||
it->SetActivate(activated);
|
||||
it->SetBunchSize(bunchSize);
|
||||
}
|
||||
for (const auto &it : dataProcessor) {
|
||||
it->SetGeneralData(generalData);
|
||||
it->SetActivate(activated);
|
||||
it->SetBunchSize(bunchSize);
|
||||
}
|
||||
SetThreadPriorities();
|
||||
|
||||
@ -440,8 +442,6 @@ void Implementation::setReceiverROI(const slsDetectorDefs::ROI arg) {
|
||||
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)
|
||||
dataProcessor[i]->SetReceiverROI(portRois[i]);
|
||||
LOG(logINFO) << "receiver roi: " << ToString(receiverRoi);
|
||||
@ -455,6 +455,22 @@ void Implementation::setReceiverROIMetadata(const ROI arg) {
|
||||
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 *
|
||||
@ -677,12 +693,15 @@ void Implementation::stopReceiver() {
|
||||
while (running) {
|
||||
running = false;
|
||||
for (const auto &it : listener)
|
||||
if (it->IsRunning())
|
||||
if (it->IsRunning()) {
|
||||
running = true;
|
||||
|
||||
//LOG(logINFOBLUE) << "listener NOT done";
|
||||
}
|
||||
for (const auto &it : dataProcessor)
|
||||
if (it->IsRunning())
|
||||
if (it->IsRunning()) {
|
||||
running = true;
|
||||
//LOG(logINFOBLUE) << "processor NOT done";
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
||||
}
|
||||
|
||||
@ -723,10 +742,7 @@ void Implementation::stopReceiver() {
|
||||
} else if (!detectorDataStream[i]) {
|
||||
summary = (i == 0 ? "\n\tDeactivated Left 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;
|
||||
os << "\n\tMissing Packets\t\t: " << mpMessage
|
||||
<< "\n\tComplete Frames\t\t: " << nf
|
||||
@ -1007,7 +1023,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
||||
&silentMode));
|
||||
listener[i]->SetGeneralData(generalData);
|
||||
listener[i]->SetActivate(activated);
|
||||
listener[i]->SetNoRoi(portRois[i].noRoi());
|
||||
listener[i]->SetBunchSize(bunchSize);
|
||||
|
||||
int ctbAnalogDataBytes = 0;
|
||||
if (detType == CHIPTESTBOARD) {
|
||||
@ -1022,6 +1038,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
||||
dataProcessor[i]->SetGeneralData(generalData);
|
||||
dataProcessor[i]->SetActivate(activated);
|
||||
dataProcessor[i]->SetReceiverROI(portRois[i]);
|
||||
dataProcessor[i]->SetBunchSize(bunchSize);
|
||||
} catch (...) {
|
||||
listener.clear();
|
||||
dataProcessor.clear();
|
||||
@ -1037,7 +1054,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
||||
flip = (i == 1 ? true : false);
|
||||
}
|
||||
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
||||
i, fifo[i].get(), &dynamicRange, &detectorRoi,
|
||||
i, detType, fifo[i].get(), &dynamicRange, &detectorRoi,
|
||||
&fileIndex, flip, numPorts, &quadEnable,
|
||||
&numberOfTotalFrames));
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
@ -1046,6 +1063,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
||||
streamingHwm);
|
||||
dataStreamer[i]->SetAdditionalJsonHeader(
|
||||
additionalJsonHeader);
|
||||
dataStreamer[i]->SetBunchSize(bunchSize);
|
||||
} catch (...) {
|
||||
if (dataStreamEnable) {
|
||||
dataStreamer.clear();
|
||||
@ -1164,7 +1182,7 @@ void Implementation::setDataStreamEnable(const bool enable) {
|
||||
flip = (i == 1 ? true : false);
|
||||
}
|
||||
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
||||
i, fifo[i].get(), &dynamicRange, &detectorRoi,
|
||||
i, detType, fifo[i].get(), &dynamicRange, &detectorRoi,
|
||||
&fileIndex, flip, numPorts, &quadEnable,
|
||||
&numberOfTotalFrames));
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
@ -1173,6 +1191,7 @@ void Implementation::setDataStreamEnable(const bool enable) {
|
||||
streamingHwm);
|
||||
dataStreamer[i]->SetAdditionalJsonHeader(
|
||||
additionalJsonHeader);
|
||||
dataStreamer[i]->SetBunchSize(bunchSize);
|
||||
} catch (...) {
|
||||
dataStreamer.clear();
|
||||
dataStreamEnable = false;
|
||||
|
@ -59,6 +59,8 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
ROI getReceiverROI() const;
|
||||
void setReceiverROI(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{};
|
||||
// receiver roi for complete detector for metadata
|
||||
ROI receiverRoiMetadata{};
|
||||
size_t bunchSize{0};
|
||||
|
||||
// file parameters
|
||||
fileFormat fileFormatType{BINARY};
|
||||
|
@ -32,6 +32,7 @@ Listener::Listener(int ind, detectorType dtype, Fifo *f,
|
||||
actualUDPSocketBufferSize(as), framesPerFile(fpf), frameDiscardMode(fdp),
|
||||
detectorDataStream(detds), silentMode(sm) {
|
||||
LOG(logDEBUG) << "Listener " << ind << " created";
|
||||
vetoThread = (myDetectorType == GOTTHARD2 && index != 0);
|
||||
}
|
||||
|
||||
Listener::~Listener() = default;
|
||||
@ -48,7 +49,10 @@ uint64_t Listener::GetLastFrameIndexCaught() const {
|
||||
|
||||
int64_t Listener::GetNumMissingPacket(bool stoppedFlag,
|
||||
uint64_t numPackets) const {
|
||||
if (!activated || !(*detectorDataStream) || noRoi) {
|
||||
if (!activated) {
|
||||
return 0;
|
||||
}
|
||||
if (!(*detectorDataStream)) {
|
||||
return 0;
|
||||
}
|
||||
if (!stoppedFlag) {
|
||||
@ -82,7 +86,7 @@ void Listener::ResetParametersforNewAcquisition() {
|
||||
lastCaughtFrameIndex = 0;
|
||||
carryOverFlag = false;
|
||||
uint32_t packetSize = generalData->packetSize;
|
||||
if (myDetectorType == GOTTHARD2 && index != 0) {
|
||||
if (vetoThread) {
|
||||
packetSize = generalData->vetoPacketSize;
|
||||
}
|
||||
carryOverPacket = make_unique<char[]>(packetSize);
|
||||
@ -95,6 +99,12 @@ void Listener::ResetParametersforNewAcquisition() {
|
||||
// reset fifo statistic
|
||||
fifo->GetMaxLevelForFifoBound();
|
||||
fifo->GetMinLevelForFifoFree();
|
||||
|
||||
fifoBunchSizeBytes = generalData->imageSize;
|
||||
if (vetoThread) {
|
||||
fifoBunchSizeBytes = generalData->vetoDataSize;
|
||||
}
|
||||
fifoBunchSizeBytes += generalData->fifoBufferHeaderSize;
|
||||
}
|
||||
|
||||
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::SetNoRoi(bool enable) {noRoi = enable; }
|
||||
void Listener::SetBunchSize(size_t value) {
|
||||
fifoBunchSize = value;
|
||||
}
|
||||
|
||||
void Listener::CreateUDPSockets() {
|
||||
if (!activated || !(*detectorDataStream) || noRoi) {
|
||||
if (!activated || !(*detectorDataStream)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -134,7 +146,7 @@ void Listener::CreateUDPSockets() {
|
||||
ShutDownUDPSocket();
|
||||
|
||||
uint32_t packetSize = generalData->packetSize;
|
||||
if (myDetectorType == GOTTHARD2 && index != 0) {
|
||||
if (vetoThread) {
|
||||
packetSize = generalData->vetoPacketSize;
|
||||
}
|
||||
|
||||
@ -169,7 +181,7 @@ void Listener::CreateDummySocketForUDPSocketBufferSize(int s) {
|
||||
LOG(logINFO) << "Testing UDP Socket Buffer size " << s << " with test port "
|
||||
<< *udpPortNumber;
|
||||
|
||||
if (!activated || !(*detectorDataStream) || noRoi) {
|
||||
if (!activated || !(*detectorDataStream)) {
|
||||
*actualUDPSocketBufferSize = (s * 2);
|
||||
return;
|
||||
}
|
||||
@ -183,7 +195,7 @@ void Listener::CreateDummySocketForUDPSocketBufferSize(int s) {
|
||||
}
|
||||
|
||||
uint32_t packetSize = generalData->packetSize;
|
||||
if (myDetectorType == GOTTHARD2 && index != 0) {
|
||||
if (vetoThread) {
|
||||
packetSize = generalData->vetoPacketSize;
|
||||
}
|
||||
|
||||
@ -219,55 +231,42 @@ void Listener::SetHardCodedPosition(uint16_t r, uint16_t c) {
|
||||
|
||||
void Listener::ThreadExecution() {
|
||||
char *buffer;
|
||||
int rc = 0;
|
||||
|
||||
fifo->GetNewAddress(buffer);
|
||||
LOG(logDEBUG5) << "Listener " << index
|
||||
LOG(logDEBUG1) << "Listener " << index
|
||||
<< ", "
|
||||
"pop 0x"
|
||||
<< 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
|
||||
if ((*status != TRANSMITTING &&
|
||||
(!activated || !(*detectorDataStream) || noRoi || udpSocketAlive)) ||
|
||||
carryOverFlag) {
|
||||
rc = ListenToAnImage(buffer);
|
||||
}
|
||||
|
||||
// error check, (should not be here) if not transmitting yet (previous if)
|
||||
// rc should be > 0
|
||||
if (rc == 0) {
|
||||
if (!udpSocketAlive) {
|
||||
(*((uint32_t *)buffer)) = 0;
|
||||
char* tempBuffer = buffer;
|
||||
for (size_t iFrame = 0; iFrame != fifoBunchSize; iFrame ++) {
|
||||
|
||||
// end of acquisition or not activated
|
||||
if ((*status == TRANSMITTING || !udpSocketAlive) && !carryOverFlag) {
|
||||
(*((uint32_t *)tempBuffer)) = DUMMY_PACKET_VALUE;
|
||||
StopListening(buffer);
|
||||
} else
|
||||
fifo->FreeAddress(buffer);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
int rc = ListenToAnImage(tempBuffer);
|
||||
|
||||
// discarding image
|
||||
else if (rc < 0) {
|
||||
fifo->FreeAddress(buffer);
|
||||
return;
|
||||
// socket closed or discarding image (free retake)
|
||||
// weird frame numbers (print and rc = 0), then retake
|
||||
if (rc <= 0) {
|
||||
if (udpSocketAlive) {
|
||||
--iFrame;
|
||||
}
|
||||
} else {
|
||||
(*((uint32_t *)tempBuffer)) = rc;
|
||||
tempBuffer += fifoBunchSizeBytes;
|
||||
numFramesStatistic++;
|
||||
}
|
||||
}
|
||||
|
||||
(*((uint32_t *)buffer)) = rc;
|
||||
|
||||
// push into fifo
|
||||
fifo->PushAddress(buffer);
|
||||
|
||||
// Statistics
|
||||
if (!(*silentMode)) {
|
||||
numFramesStatistic++;
|
||||
if (numFramesStatistic >=
|
||||
// second condition also for infinite #number of frames
|
||||
(((*framesPerFile) == 0) ? STATISTIC_FRAMENUMBER_INFINITE
|
||||
@ -277,12 +276,10 @@ void Listener::ThreadExecution() {
|
||||
}
|
||||
|
||||
void Listener::StopListening(char *buf) {
|
||||
(*((uint32_t *)buf)) = DUMMY_PACKET_VALUE;
|
||||
fifo->PushAddress(buf);
|
||||
StopRunning();
|
||||
LOG(logDEBUG1) << index << ": Listening Packets (" << *udpPortNumber
|
||||
LOG(logDEBUG1) << index << ": Listening Completed (" << *udpPortNumber
|
||||
<< ") : " << numPacketsCaught;
|
||||
LOG(logDEBUG1) << index << ": Listening Completed";
|
||||
}
|
||||
|
||||
/* 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 fifohsize = generalData->fifoBufferHeaderSize;
|
||||
bool standardheader = generalData->standardheader;
|
||||
if (myDetectorType == GOTTHARD2 && index != 0) {
|
||||
if (vetoThread) {
|
||||
dsize = generalData->vetoDataSize;
|
||||
imageSize = generalData->vetoImageSize;
|
||||
packetSize = generalData->vetoPacketSize;
|
||||
@ -316,11 +313,6 @@ uint32_t Listener::ListenToAnImage(char *buf) {
|
||||
memset(buf, 0, fifohsize);
|
||||
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
|
||||
if (carryOverFlag) {
|
||||
LOG(logDEBUG3) << index << "carry flag";
|
||||
@ -345,6 +337,7 @@ uint32_t Listener::ListenToAnImage(char *buf) {
|
||||
<< "(Weird), With carry flag: Frame number " << fnum
|
||||
<< " less than current frame number " << currentFrameIndex;
|
||||
carryOverFlag = false;
|
||||
exit(-1);//***************************
|
||||
return 0;
|
||||
}
|
||||
switch (*frameDiscardMode) {
|
||||
@ -509,7 +502,7 @@ uint32_t Listener::ListenToAnImage(char *buf) {
|
||||
|
||||
lastCaughtFrameIndex = fnum;
|
||||
|
||||
LOG(logDEBUG1) << "Listening " << index
|
||||
LOG(logDEBUG) << "Listening " << index
|
||||
<< ": currentfindex:" << currentFrameIndex
|
||||
<< ", fnum:" << fnum << ", pnum:" << pnum
|
||||
<< ", numpackets:" << numpackets;
|
||||
|
@ -65,7 +65,8 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
||||
void ResetParametersforNewAcquisition();
|
||||
void SetGeneralData(GeneralData *g);
|
||||
void SetActivate(bool enable);
|
||||
void SetNoRoi(bool enable);
|
||||
void SetBunchSize(size_t value);
|
||||
|
||||
void CreateUDPSockets();
|
||||
void ShutDownUDPSocket();
|
||||
|
||||
@ -130,8 +131,8 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
||||
frameDiscardPolicy *frameDiscardMode;
|
||||
bool activated{false};
|
||||
bool *detectorDataStream;
|
||||
bool noRoi{false};
|
||||
bool *silentMode;
|
||||
bool vetoThread{false};
|
||||
|
||||
/** row hardcoded as 1D or 2d,
|
||||
* 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::atomic<bool> udpSocketAlive{false};
|
||||
|
||||
size_t fifoBunchSize{0};
|
||||
/** size in memory including headers */
|
||||
size_t fifoBunchSizeBytes{0};
|
||||
|
||||
// for print progress during acquisition*/
|
||||
uint32_t numPacketsStatistic{0};
|
||||
uint32_t numFramesStatistic{0};
|
||||
|
@ -39,8 +39,7 @@ namespace sls {
|
||||
// fifo
|
||||
#define FIFO_HEADER_NUMBYTES (16)
|
||||
#define FIFO_DATASIZE_NUMBYTES (4)
|
||||
#define FIFO_PADDING_NUMBYTES \
|
||||
(4) // for 8 byte alignment due to sls_receiver_header structure
|
||||
#define FIFO_HEADER_STREAM_ENABLE (8)
|
||||
|
||||
// hdf5
|
||||
#define MAX_CHUNKED_IMAGES (1)
|
||||
|
@ -20,7 +20,6 @@
|
||||
// C++ includes
|
||||
#include "sls/sls_detector_exceptions.h"
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <bitset>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
@ -70,8 +69,6 @@
|
||||
#define SHORT_STR_LENGTH 20
|
||||
|
||||
#define MAX_PATTERN_LENGTH 0x2000
|
||||
#define MAX_PATTERN_LEVELS 6
|
||||
#define M3_MAX_PATTERN_LEVELS 3
|
||||
|
||||
#define DEFAULT_STREAMING_TIMER_IN_MS 500
|
||||
|
||||
|
@ -379,6 +379,8 @@ enum detFuncs {
|
||||
F_RECEIVER_GET_RECEIVER_ROI,
|
||||
F_RECEIVER_SET_RECEIVER_ROI,
|
||||
F_RECEIVER_SET_RECEIVER_ROI_METADATA,
|
||||
F_GET_RECEIVER_BUNCH_SIZE,
|
||||
F_SET_RECEIVER_BUNCH_SIZE,
|
||||
|
||||
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_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_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";
|
||||
default: return "Unknown Function";
|
||||
|
@ -2,13 +2,13 @@
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
/** API versions */
|
||||
#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 APIRECEIVER 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