Compare commits

..

5 Commits

Author SHA1 Message Date
98f0b967e3 suppressed warning in qwt + added reason 2022-11-23 09:13:12 +01:00
a36670df42 added comments 2022-11-21 16:47:06 +01:00
670ec18c3b cleanup 2022-11-21 16:26:37 +01:00
0ae15e5aa2 static linking of qwt 2022-11-21 16:12:04 +01:00
b08bf08ea9 using external qwt 2022-11-21 11:41:12 +01:00
111 changed files with 1186 additions and 3162 deletions

View File

@ -2,7 +2,7 @@
# Copyright (C) 2021 Contributors to the SLS Detector Package
cmake_minimum_required(VERSION 3.12)
project(slsDetectorPackage)
set(PROJECT_VERSION 7.0.0)
set(PROJECT_VERSION 6.1.1)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")

File diff suppressed because it is too large Load Diff

View File

@ -21,4 +21,4 @@ echo "Building using: ${NCORES} cores"
cmake --build . -- -j${NCORES}
cmake --build . --target install
CTEST_OUTPUT_ON_FAILURE=1 ctest -j 1
CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2

View File

@ -1,8 +1,9 @@
python:
- 3.6
- 3.7
- 3.8
- 3.9
- 3.10
- 3.11
numpy:
- 1.17

View File

@ -17,7 +17,8 @@ requirements:
- {{ compiler('c') }}
- {{compiler('cxx')}}
- cmake
- qt 5.*
- qwt 6.*
- qt 4.8.*
- zeromq
- xorg-libx11
- xorg-libice
@ -110,10 +111,12 @@ outputs:
- {{ compiler('c') }}
- {{compiler('cxx')}}
- {{ pin_subpackage('slsdetlib', exact=True) }}
- qwt 6.*
run:
- {{ pin_subpackage('slsdetlib', exact=True) }}
- qt 5.*
- qwt 6.*
- qt 4.8.*
- expat
- name: moenchzmq

View File

@ -21,8 +21,10 @@ the shared libraries these are needed:
GUI
-----------------------
* Qt 5.9
* Qwt 6.1.5 (packaged in libs/)
The GUI is currently using Qt4 but watch out for an upgrade to 5.
* Qt 4.8
* Qwt 6.1
-----------------------
Python bindings

View File

@ -92,30 +92,19 @@ Download
Upgrade
^^^^^^^^
.. warning ::
In case you have had issues in the past with programming via software:
* 6.1.2 server has a fix for seamless fpga programming
* We recommend first updating the on-board detector server to 6.1.2 (with client 6.1.x) using command 'updatedetectorserver' or 'copydetectorserver'.
* Then use command 'programfpga' to only update firmware or use command 'update' to update firmware and server to the latest release.
.. note ::
These instructions are for upgrades from v5.0.0. For earlier versions, contact us.
Check :ref:`firmware troubleshooting <blackfin firmware troubleshooting>` if you run into issues while programming firmware.
Always ensure that the client and server software are of the same release.
Program from console
.. code-block:: bash
# These instructions are for upgrades from v5.0.0. For earlier versions, please contact us.
# Always ensure that the client and server software are of the same release.
# copies server from tftp folder of pc, links new server to jungfrauDetectorServer,
# removes old server from respawn, sets up new lnked server to respawn
# programs fpga,
@ -166,6 +155,10 @@ Upgrade
Mythen III
-----------
.. note ::
As it is still in development, the rbf files must be picked up from us.
Download
^^^^^^^^^^^^^
@ -177,11 +170,11 @@ Download
Upgrade
^^^^^^^^
Always ensure that the client and server software are of the same release.
Program from console
.. code-block:: bash
# Always ensure that the client and server software are of the same release.
# copies server from tftp folder of pc, links new server to mythen3DetectorServer,
# programs fpga,
# reboots
@ -206,11 +199,11 @@ Download
Upgrade
^^^^^^^^
Always ensure that the client and server software are of the same release.
Program from console
.. code-block:: bash
# Always ensure that the client and server software are of the same release.
# copies server from tftp folder of pc, links new server to gotthard2DetectorServer,
# programs fpga,
# reboots
@ -237,26 +230,13 @@ Download
Upgrade
^^^^^^^^
.. warning ::
In case you have had issues in the past with programming via software:
* 6.1.2 server has a fix for seamless fpga programming
* We recommend first updating the on-board detector server to 6.1.2 (with client 6.1.x) using command 'updatedetectorserver' or 'copydetectorserver'.
* Then use command 'programfpga' to only update firmware or use command 'update' to update firmware and server to the latest release.
Check :ref:`firmware troubleshooting <blackfin firmware troubleshooting>` if you run into issues while programming firmware.
Always ensure that the client and server software are of the same release.
Program from console
.. code-block:: bash
# Always ensure that the client and server software are of the same release.
# copies server from tftp folder of pc, links new server to moenchDetectorServer,
# removes old server from respawn, sets up new lnked server to respawn
# programs fpga,
@ -282,12 +262,11 @@ Upgrade
Check :ref:`firmware troubleshooting <blackfin firmware troubleshooting>` if you run into issues while programming firmware.
Always ensure that the client and server software are of the same release.
Program from console
.. code-block:: bash
# Always ensure that the client and server software are of the same release.
# copies server from tftp folder of pc, links new server to ctbDetectorServer,
# removes old server from respawn, sets up new lnked server to respawn
# programs fpga,

View File

@ -13,149 +13,54 @@
Before building from source make sure that you have the
:doc:`dependencies <../dependencies>` installed. If installing using conda, conda will
manage the dependencies. Avoid also installing packages with pip.
manage the dependencies.
.. _Installation:
Installation
===============
Install binaries using conda
-------------------------------
Conda is not only useful to manage python environments but can also
be used as a user space package manager. Dates in the tag (for eg. 2020.07.23.dev0)
are from the developer branch. Please use released tags for stability.
We have three different packages available:
* **slsdetlib** shared libraries and command line utilities
* **slsdetgui** GUI
* **slsdet** Python bindings
.. code-block:: bash
#Add channels for dependencies and our library
conda config --add channels conda-forge
conda config --add channels slsdetectorgroup
conda config --set channel_priority strict
#create and activate an environment with our library
#replace 6.1.1 with the required tag
conda create -n myenv slsdetlib=6.1.1
conda activate myenv
#ready to use
sls_detector_get exptime
etc ...
.. code-block:: bash
#List available versions
# lib and binaries
conda search slsdetlib
# python
conda search slsdet
# gui
conda search slsdetgui
Build from source
-------------------
1. Download Source Code from github
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: bash
git clone https://github.com/slsdetectorgroup/slsDetectorPackage.git --branch 6.1.1
| **Pybind for Python**
| v7.0.0+:
| pybind11 packaged into 'libs/pybind'. No longer a submodule. No need for "recursive" or "submodule update".
|
| Older versions:
| pybind11 is a submodule. Must be cloned using "recursive" and updated when switching between versions using the following commands.
.. code-block:: bash
# clone using recursive to get pybind11 submodule
git clone --recursive https://github.com/slsdetectorgroup/slsDetectorPackage.git
# update submodule when switching between releases
cd slsDetectorPackage
git submodule update --init
==============================================
.. _build from source using cmake:
Build from source using CMake
---------------------------------
Note that on some systems, for example RH7, cmake v3+ is available under the cmake3 alias.
It is also required to clone with the option --recursive to get the pybind11 submodules used
in the package. (Only needed for older versions than v7.0.0)
2. Build from Source
^^^^^^^^^^^^^^^^^^^^^^^^^^
Build using CMake
^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: bash
# outside slsDetecorPackage folder
git clone --recursive https://github.com/slsdetectorgroup/slsDetectorPackage.git
# if older than v7.0.0 and using python, update pybind11 submodules
cd slsDetectorPackage
git submodule update --init
mkdir build && cd build
# configure & generate Makefiles using cmake
# by listing all your options (alternately use ccmake described below)
# cmake3 for some systems
cmake ../slsDetectorPackage -DCMAKE_INSTALL_PREFIX=/your/install/path
# compiled to the build/bin directory
make -j12 #or whatever number of cores you are using to build
# install headers and libs in /your/install/path directory
make install
Instead of the cmake command, one can use ccmake to get a list of options to configure and generate Makefiles at ease.
The easiest way to configure options is to use the ccmake utility.
.. code-block:: bash
# ccmake3 for some systems
ccmake ..
# choose the options
# first press [c] - configure
# then press [g] - generate
#from the build directory
ccmake .
=============================== ===========================================
Example cmake options Comment
=============================== ===========================================
-DSLS_USE_PYTHON=ON Python
-DPython_FIND_VIRTUALENV=ONLY Python from only the conda environment
-DZeroMQ_HINT=/usr/lib64 Use system zmq instead
-DSLS_USE_GUI=ON GUI
=============================== ===========================================
Build using in-built cmk.sh script
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Build using cmk.sh script
-------------------------
These are mainly aimed at those not familiar with using ccmake and cmake.
.. code-block:: bash
The binaries are generated in slsDetectorPackage/build/bin directory.
Usage: ./cmk.sh [-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: ./cmk.sh [-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]
-[no option]: only make
-b: Builds/Rebuilds CMake files normal mode
-c: Clean
@ -181,19 +86,48 @@ Build using in-built cmk.sh script
# get all options
./cmk.sh -?
# new build and compile in parallel:
# new build and compile in parallel:
./cmk.sh -bj5
# new build, python and compile in parallel:
./cmk.sh -bpj5
#To use the system zmq (/usr/lib64) instead
./cmk.sh -bj5 -q /usr/lib64
Install binaries using conda
--------------------------------
Conda is not only useful to manage python environments but can also
be used as a user space package manager.
We have three different packages available:
* **slsdetlib**, shared libraries and command line utilities
* **slsdetgui**, GUI
* **slsdet**, Python bindings
.. code-block:: bash
Build on old distributions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#Add channels for dependencies and our library
conda config --add channels conda-forge
conda config --add channels slsdetectorgroup
conda config --set channel_priority strict
#cerate an environment with our library, then activate
#replace 2020.07.20.dev0 with the required tag
conda create -n myenv slsdetlib=2020.07.23.dev0
conda activate myenv
#ready to use
sls_detector_get exptime
etc ...
.. code-block:: bash
#List available versions
conda search slsdet
Build from source on old distributions
-----------------------------------------
If your linux distribution doesn't come with a C++11 compiler (gcc>4.8) then
it's possible to install a newer gcc using conda and build the slsDetectorPackage
@ -204,64 +138,12 @@ using this compiler
#Create an environment with the dependencies
conda create -n myenv gxx_linux-64 cmake zmq
conda activate myenv
# outside slsDetecorPackage folder
mkdir build && cd build
cmake ../slsDetectorPackage -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
make -j12
Build slsDetectorGui (Qt5)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1. Using pre-built binary on conda
.. code-block:: bash
conda create -n myenv slsdetgui=7.0.0
conda activate myenv
2. Using system installation on RHEL7
.. code-block:: bash
yum install qt5-qtbase-devel.x86_64
yum install qt5-qtsvg-devel.x86_64
3. Using conda
.. code-block:: bash
#Add channels for dependencies and our library
conda config --add channels conda-forge
conda config --add channels slsdetectorgroup
conda config --set channel_priority strict
# create environment to compile
# on rhel7
conda create -n slsgui zeromq gxx_linux-64 gxx_linux-64 mesa-libgl-devel-cos6-x86_64 qt
# on fedora or newer systems
conda create -n slsgui zeromq qt
# when using conda compilers, would also need libgl, but no need for it on fedora unless maybe using it with ROOT
# activate environment
conda activate slsgui
# compile with cmake outside slsDetecorPackage folder
mkdir build && cd build
cmake ../slsDetectorPackage -DSLS_USE_GUI=ON
make -j12
# or compile with cmk.sh
cd slsDetectorPackage
./cmk.sh -cbgj9
Build this documentation
^^^^^^^^^^^^^^^^^^^^^^^^
-------------------------------
The documentation for the slsDetectorPackage is build using a combination
of Doxygen, Sphinx and Breathe. The easiest way to install the dependencies
@ -269,15 +151,11 @@ is to use conda
.. code-block:: bash
conda create -n myenv python sphinx_rtd_theme breathe
conda create -n myenv python sphinx sphinx_rtd_theme
Then enable the option SLS_BUILD_DOCS to create the targets
.. code-block:: bash
# using cmake or ccmake to enable DSLS_BUILD_DOCS
# outside slsDetecorPackage folder
mkdir build && cd build
cmake ../slsDetectorPackage -DSLS_BUILD_DOCS=ON
make docs # generate API docs and build Sphinx RST
make rst # rst only, saves time in case the API did not change
make rst # rst only, saves time in case the API did not change

View File

@ -10,46 +10,27 @@ open an issue in our our `github repo
Setting exposure time
------------------------------------
Setting and reading back exposure time can be done either using a Python
datetime.timedelta, DurationWrapper or by setting the time in seconds.
Setting and reading back exposure time can be done either using a Python datetime.timedelta
or by setting the time in seconds.
::
# Set exposure time to 1.2 seconds
>>> d.exptime = 1.2
>>> d.exptime = 5e-07
# Setting exposure time using timedelta (upto microseconds precision)
# Setting exposure time using timedelta
import datetime as dt
>>> d.exptime = dt.timedelta(seconds = 1.2)
>>> d.exptime = dt.timedelta(seconds = 1, microseconds = 3)
# With timedelta any arbitrary combination of units can be used
>>> t = dt.timedelta(microseconds = 100, seconds = 5.3, minutes = .3)
# using DurationWrapper to set in seconds
>>> from slsdet import DurationWrapper
>>> d.exptime = DurationWrapper(1.2)
# using DurationWrapper to set in ns
>>> t = DurationWrapper()
>>> t.set_count(500)
>>> d.exptime = t
# To set exposure time for individual detector one have to resort
# to the C++ style API.
# Sets exposure time to 1.2 seconds for module 0, 6 and 12
>>> d.setExptime(1.2, [0, 6, 12])
>>> d.setExptime(dt.timedelta(seconds = 1.2), [0, 6, 12])
# to get in seconds
>>> d.period
181.23
# to get in DurationWrapper
>>> d.getExptime()
[sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)]
------------------------------------
@ -239,7 +220,8 @@ Setting and getting times
# This sets the exposure time for all modules
d.exptime = 0.5
# exptime also accepts a python datetime.timedelta (upto microseconds resolution)
# exptime also accepts a python datetime.timedelta
# which can be used to set the time in almost any unit
t = dt.timedelta(milliseconds = 2.3)
d.exptime = t
@ -247,25 +229,16 @@ Setting and getting times
t = dt.timedelta(minutes = 3, seconds = 1.23)
d.exptime = t
# using DurationWrapper to set in seconds
>>> from slsdet import DurationWrapper
>>> d.exptime = DurationWrapper(1.2)
# using DurationWrapper to set in ns
>>> t = DurationWrapper()
>>> t.set_count(500)
>>> d.exptime = t
# exptime however always returns the time in seconds
>>> d.exptime
181.23
# To get back the exposure time for each module
# it's possible to use getExptime, this also returns
# the values as DurationWrapper
# the values as datetime.timedelta
>>> d.getExptime()
[sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)]
[datetime.timedelta(seconds=181, microseconds=230000), datetime.timedelta(seconds=181, microseconds=230000)]
# In case the values are the same it's possible to use the
# element_if_equal function to reduce the values to a single
@ -273,8 +246,7 @@ Setting and getting times
>>> t = d.getExptime()
>>> element_if_equal(t)
sls::DurationWrapper(total_seconds: 1.2 count: 1200000000)
datetime.timedelta(seconds=1)
--------------
Reading dacs

View File

@ -6,7 +6,7 @@ Getting Started
Which Python?
--------------------
We require at least Python 3.6 and strongly recommended that you don't use the system
We require at lest Python 3.6 and strongly recommended that you don't use the system
Python installation. The examples in this documentation uses `conda
<https://docs.conda.io/en/latest/miniconda.html>`_ since it provides good support
also for non Python packages but there are also other alternatives like, pyenv.
@ -14,35 +14,44 @@ also for non Python packages but there are also other alternatives like, pyenv.
Using something like conda also allows you to quickly switch beteen different Python
environments.
.. warning ::
If you use conda avoid also installing packages with pip.
---------------------
Building from Source
PYBIND11
---------------------
**v7.0.0 of slsDetectorPackage:**
If you are not installing slsdet binaries from conda, but instead building from
source, please refer to :ref:`the installation section<Installation>` for details.
#. It is packaged into libs (pybind)
#. No longer a submodule of the slsDetectorPackage
Don't forget to compile with the option SLS_USE_PYTHON=ON to enable the Python
bindings or if you use the cmk.sh script -p.
**Older than v7.0.0:**
.. note ::
#. Submodule in libs (pybind11)
#. Switching between versions will require an update of the submodule as well using:
Ensure that the sls det python lib compiled is for the expected python version.
For example, build/bin/_slsdet.cpython-39-x86_64-linux-gnu.so for Python v3.9.x
.. code-block:: bash
git submodule update --init #from the main slsDetectorPackage folder
---------------------
PYTHONPATH
---------------------
If you install slsdet binaries using conda everything is set up and you can
If you install slsdet using conda everything is set up and you can
directly start using the Python bindings. However, if you build
from source you need to tell Python where to find slsdet to use it. This
can be done by adding your build/bin directory to PYTHONPATH.
from source you need to tell Python where to find slsdet. This
is be done by adding your build/bin directory to PYTHONPATH.
.. code-block:: bash
export PYTHONPATH = /path/to/your/build/bin:$PYTHONPATH
.. note ::
Don't forget to compile with the option SLS_USE_PYTHON=ON to enable
the Python bindings or if you use the cmk.sh script -p.
--------------------------------------
Which detector class should I use?
--------------------------------------
@ -153,11 +162,9 @@ their name.
::
>>> [item for item in dir(d) if 'time' in item]
['compdisabletime', 'exptime', 'exptimel', 'frametime', 'getExptime',
'getExptimeForAllGates', 'getExptimeLeft', 'getSubExptime', 'patwaittime',
'patwaittime0', 'patwaittime1', 'patwaittime2', 'runtime', 'setExptime',
'setSubExptime', 'subdeadtime', 'subexptime']
['exptime', 'getExptime', 'getExptimeForAllGates', 'getExptimeLeft',
'getSubExptime', 'patwaittime0', 'patwaittime1', 'patwaittime2',
'setExptime', 'setSubExptime', 'subdeadtime', 'subexptime']
The above method works on any Python object but for convenience we also
included two functions to find names. View prints the names one per line
@ -169,7 +176,6 @@ while find returns a list of names.
>>> view('exptime')
exptime
exptimel
getExptime
getExptimeForAllGates
getExptimeLeft
@ -178,7 +184,6 @@ while find returns a list of names.
setSubExptime
subexptime
>>> find('exptime')
['exptime', 'getExptime', 'getExptimeForAllGates', 'getExptimeLeft',
'getSubExptime', 'setExptime', 'setSubExptime', 'subexptime']
@ -196,39 +201,19 @@ To access the documentation of a function directly from the Python prompt use he
Help on property:
Period between frames, accepts either a value in seconds or datetime.timedelta
Note
-----
:getter: always returns in seconds. To get in DurationWrapper, use getPeriod
Example
:getter: always returns in seconds. To get in datetime.delta, use getPeriod
Examples
-----------
>>> # setting directly in seconds
>>> d.period = 1.05
>>>
>>> # setting directly in seconds
>>> d.period = 5e-07
>>>
>>> # using timedelta (up to microseconds precision)
>>> from datatime import timedelta
>>> d.period = timedelta(seconds = 1, microseconds = 3)
>>>
>>> # using DurationWrapper to set in seconds
>>> from slsdet import DurationWrapper
>>> d.period = DurationWrapper(1.2)
>>>
>>> # using DurationWrapper to set in ns
>>> t = DurationWrapper()
>>> t.set_count(500)
>>> d.period = t
>>>
>>> # to get in seconds
>>> d.period = datetime.timedelta(minutes = 3, seconds = 1.23)
>>> d.period
181.23
>>>
>>> d.getExptime()
[sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)]
>>> d.getPeriod()
[datetime.timedelta(seconds=181, microseconds=230000)]
----------------------
@ -248,12 +233,11 @@ The enums can be found in slsdet.enums
import slsdet
>>> [e for e in dir(slsdet.enums) if not e.startswith('_')]
['M3_GainCaps', 'burstMode', 'clockIndex', 'cls', 'dacIndex', 'detectorSettings',
'detectorType', 'dimension', 'externalSignalFlag', 'fileFormat',
'frameDiscardPolicy', 'gainMode', 'name', 'polarity', 'portPosition',
'readoutMode', 'runStatus', 'speedLevel', 'streamingInterface', 'timingMode',
'timingSourceType', 'vetoAlgorithm']
['burstMode', 'clockIndex', 'dacIndex',
'detectorSettings', 'detectorType', 'dimension', 'externalSignalFlag',
'fileFormat', 'frameDiscardPolicy',
'readoutMode', 'runStatus', 'speedLevel', 'timingMode',
'timingSourceType']
# Even though importing using * is not recommended one could
# get all the enums like this:

View File

@ -66,15 +66,11 @@ For a Single Module
# sets destination udp ports (not needed, default is 50001)
udp_dstport 50012
# 1g data out
# source udp ips must be same subnet at destintaion udp ips
# udp_srcip 192.168.1.112
# destination udp ip picked up from rx_hostname (if auto)
# udp_dstip auto
udp_srcip 192.168.1.112
# 10g data out
udp_srcip 10.30.20.200
udp_dstip 10.30.20.6
# destination udp ip picked up from rx_hostname (if auto)
udp_dstip auto
# set file path
fpath /tmp

View File

@ -23,19 +23,15 @@ Arguments
.. code-block:: bash
Possible arguments are:
-v, --version : Software version
-p, --port <port> : TCP communication port with client.
-g, --nomodule : [Mythen3][Gotthard2]
Generic or No Module mode. Skips detector type checks.
-f, --phaseshift <value> : [Gotthard] only. Sets phase shift.
-d, --devel : Developer mode. Skips firmware checks.
-u, --update : Update mode. Skips firmware checks and initial detector setup.
-i, --ignore-config : [Eiger][Jungfrau][Gotthard][Gotthard2][Moench]
Ignore config file.
-m, --master <master> : [Eiger][Mythen3][Gotthard][Gotthard2]
Set Master to 0 or 1. Precedence over config file. Only for virtual servers except Eiger.
-t, --top <top> : [Eiger] Set Top to 0 or 1. Precedence over config file.
-s, --stopserver : Stop server. Do not use as it is created by control server
-v, --version : Software version
-p, --port <port> : TCP communication port with client.
-g, --nomodule : [Mythen3][Gotthard2] Generic or No Module mode.
Skips detector type checks.
-f, --phaseshift <value> : [Gotthard] only. Sets phase shift.
-d, --devel : Developer mode. Skips firmware checks.
-u, --update : Update mode. Skips firmware checks and initial detector setup.
-s, --stopserver : Stop server. Do not use as it is created by control server
.. _Automatic start servers:
@ -92,8 +88,6 @@ One can start the on-board detector server automatically upon powering on the bo
.. code-block:: bash
sync
# physically reboot for Gotthard II or Mythen III
reboot
# verify

View File

@ -86,160 +86,16 @@ Client Commands
sls_detector_get -h rx_framescaught
ZMQ: Json Header Format
------------------------
**Change in field names from slsDetectorPackage v6.x.x to v7.0.0**
* detSpec1 <- bunchId
* detSpec2 <- reserved
* detSpec3 <- debug
* detSpec4 <- roundRNumber
**Format**
.. code-block:: bash
{
"jsonversion": unsigned int,
"bitmode": unsigned int,
"fileIndex": unsigned long int,
"detshape": [
unsigned int,
unsigned int
],
"shape": [
unsigned int,
unsigned int
],
"size": unsigned int,
"acqIndex": unsigned long int,
"frameIndex": unsigned long int,
"progress": double,
"fname": string,
"data": unsigned int,
"completeImage": unsigned int,
"frameNumber": unsigned long long int,
"expLength": unsigned int,
"packetNumber": unsigned int,
"detSpec1": unsigned long int,
"timestamp": unsigned long int,
"modId": unsigned int,
"row": unsigned int,
"column": unsigned int,
"detSpec2": unsigned int,
"detSpec3": unsigned int,
"detSpec4": unsigned int,
"detType": unsigned int,
"version": unsigned int,
"flipRows": unsigned int,
"quad": unsigned int,
"addJsonHeader": {
string : string
}
}
+--------------+----------------------------------------------+
| Field | Description |
+--------------+----------------------------------------------+
| jsonversion | Version of the json header. |
| | Value at 4 for v6.x.x and v7.x.x |
+--------------+----------------------------------------------+
| bitmode | Bits per pixel [4|8|16|32] |
+--------------+----------------------------------------------+
| fileIndex | Current file acquisition index |
+--------------+----------------------------------------------+
| detshape | Geometry of the entire detector |
+--------------+----------------------------------------------+
| shape | Geometry of the current port streamed out |
+--------------+----------------------------------------------+
| size | Size of image of current port in bytesout |
+--------------+----------------------------------------------+
| acqIndex | Frame number from the detector (redundant) |
+--------------+----------------------------------------------+
| frameIndex | Frame number of current acquisition |
| | (Starting at 0) |
+--------------+----------------------------------------------+
| progress | Progress of current acquisition in % |
+--------------+----------------------------------------------+
| fname | Current file name |
+--------------+----------------------------------------------+
| data | 1 if there is data following |
| | 0 if dummy header |
+--------------+----------------------------------------------+
| completeImage| 1 if no missing packets for this frame |
| | in this port, else 0 |
+--------------+----------------------------------------------+
| frameNumber | Frame number |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| expLength | subframe number (32 bit eiger) |
| | or real time exposure time in 100ns (others) |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| packetNumber | Number of packets caught for that frame |
+--------------+----------------------------------------------+
| detSpec1 | See :ref:`here<Detector Specific Fields>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| timestamp | Timestamp with 10 MHz clock |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| modId | Module Id |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| row | Row number in detector |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| column | Column number in detector |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| detSpec2 | See :ref:`here<Detector Specific Fields>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| detSpec3 | See :ref:`here<Detector Specific Fields>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| detSpec4 | See :ref:`here<Detector Specific Fields>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| detType | Detector type enum |
| detSpec3 | See :ref:`Detector enum<Detector Enum>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| version | Detector header version. At 2 |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| flipRows | 1 if rows should be flipped. |
| | Usually for Eiger bottom. |
+--------------+----------------------------------------------+
| quad | 1 if its an Eiger quad. |
+--------------+----------------------------------------------+
| addJsonHeader| Optional custom parameters that is required |
| | for processing code. |
+--------------+----------------------------------------------+
File format
--------------
Master file is in json format.
* The file name format is [fpath]/[fname]_dx_fy_[findex].raw, where x is module index and y is file index. **fname** is file name prefix and by default "run". **fpath** is '/' by default.
The file name format is [fpath]/[fname]_dx_fy_[findex].raw, where x is module index and y is file index. **fname** is file name prefix and by default "run". **fpath** is '/' by default.
* Each acquisition will have an increasing acquisition index or findex (if file write enabled). This can be retrieved by using **findex** command.
* Each acquisition can have multiple files (the file index number **y**), with **rx_framesperfile** being the maximum number of frames per file. The default varies for each detector type.
Each acquisition will have an increasing acquisition index or findex (if file write enabled). This can be retrieved by using **findex** command.
Each acquisition can have multiple files (the file index number **y**), with **rx_framesperfile** being the maximum number of frames per file. The default varies for each detector type.
Some file name examples:
* Some file name examples:
.. code-block:: bash
@ -252,21 +108,17 @@ Some file name examples:
# second acquisition, first file
path-to-file/run_d0_f0_1.raw
* Each acquisition will create a master file that can be enabled/disabled using **fmaster**. This should have parameters relevant to the acquisition.
Each acquisition will create a master file that can be enabled/disabled using **fmaster**. This should have parameters relevant to the acquisition.
SLS Receiver Header consist of SLS Detector Header + 64 bytes of bitmask, altogether 112 bytes. The packetNumber in the sls detector header part, will be updated to number of packets caught by receiver for that frame. Furthermore, the bit mask will specify which packets have been received.
* SLS Receiver Header consist of SLS Detector Header + 64 bytes of bitmask, altogether 112 bytes. The packetNumber in the sls detector header part, will be updated to number of packets caught by receiver for that frame. Furthermore, the bit mask will specify which packets have been received.
**Binary file format**
This is the default file format.
* This is the default file format.
* Each data file will consist of frames, each consisting of slsReceiver Header followed by data for 1 frame.
Each data file will consist of frames, each consisting of slsReceiver Header followed by data for 1 frame.
Master file is of ASCII format and will also include the format of the slsReceiver Header.
* Master file is of ASCII format and will also include the format of the slsReceiver Header.
**HDF5 file formats**
@ -308,7 +160,7 @@ When handling callbacks, the control should be returned as soon as possible, to
**Example**
* `main cpp file <https://github.com/slsdetectorgroup/api-examples/blob/master/e4-receiver_callbacks.cpp>`_
* `cmake file <https://github.com/slsdetectorgroup/api-examples/blob/master/CMakeLists.txt>`_.
* how to install the slsDetectorPackage with cmake is provided :ref:`here <build from source using cmake>`.
* how to install the slsDetectorPackage is provided :ref:`here <build from source using cmake>`.
* compile the example **e4-rxr** by:
.. code-block:: bash

View File

@ -8,24 +8,21 @@ open an issue at our `github repo issues
Common
------
Missing Packets
^^^^^^^^^^^^^^^
Possible causes could be the following:
1. Total Failure of Packet Delivery
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#. Receiver PC is not tuned for socket buffer size and input packet queue.
* Refer to :ref:`Increase rmem_default, rmem_max and max_backlog<Receiver PC Tuning>`
#. Data cable plugged into the wrong interface on board (Jungfrau)
* Please ensure that the data cable is plugged into the rightmost interface (default for single interface). The inner one is disabled for PCB v1.0 and must be selected via command for PCB v2.0.
#. Wiring
* Faulty wiring or connecting cable to incorrect interface.
#. Link up and speed
* Check ethtool and find if Link Deteced:Yes and Speed is acceptable (>10k).
* Check to see if the 10G link is up (blue or red LED on board, close to SFP+). If not:
* Check transeiver and fibers are compatible (all MMF 850nm or all SMF 1030nm)
* Check fiber
* Check fiber polarity (if short range, unplug the link anywhere, and look at the light/dark pattern: dark has to mate with light)
* Check to see if there is a blue LED on board to signal that the link is up. Check ethtool and find if Link Deteced:Yes and Speed is acceptable (>10k).
#. Detector is not acquiring (Not Eiger)
* Take an acquisition with many images and using the following steps instead of acquire:
.. code-block:: bash
sls_detector_put status start
@ -33,63 +30,37 @@ Common
# which means the detector is acquiring.
sls_detector_get framesl
# If you are using multiple modules, the previous command can return -1 because each module will return different values. Then, check for a single module instead: sls_detector_get 0:framesl
.. note ::
If you are using multiple modules, the previous command can return -1 because each module will return different values. Then, check for a single module instead: sls_detector_get 0:framesl
#. Data cable plugged into the wrong interface on board (Jungfrau)
* Please ensure that the data cable is plugged into the rightmost interface. The middle one is disabled for PCB v1.0 and must be selected via command for PCB v2.0.
#. Detector is not sending data (Except Eiger)
* Check the board to see if the green LED close to SFP is blinking (detector is sending data). If not, detector is not operated properly (period too short/long, no trigger in trigger mode) or misconfigured and needs reboot.
#. Detector is not sending data
* Check the board to see if the green LED is blinking next to the data cable, which means that the detector is sending data.
#. Power supply
* Check if power supply has enough current.
* For Jungfrau, refer to :ref:`Jungfrau Power Supply Troubleshooting<Jungfrau Troubleshooting Power Supply>`.
#. Firewall or security feature
* A firewall or some security feature could be blocking the reception of data.
#. Ethernet interface not configured properly
* Ensure that the interfaces used are configured properly with the right mask and ip. Eg. use ifconfig and route commands to verify.
#. Ethernet interface not configured for Jumbo frames (10Gb)
* Ensure that the interfaces (on NIC and the switch) used in receiver pc have MTU 9000 (jumbo frames) enabled.
* Ensure that the interfaces used in receiver pc have MTU 9000 (jumbo frames) enabled.
#. Detector IP (Not Eiger)
* Ensure it is valid and does not end if 0 or 255. Also ensure that the detector ip is in the same subnet as rx_udpip and the masking in the interface configuration ensures this rule.
#. Check if 'rx_frames' counter in 'ifconfig' do not increment for interface.
* If no, check switch configuration if present. Port counters of switch can also help to identify problem.
* If yes, but receiver software does not see it:
* Check no firewall (eg. firewalld) is present or add rules
* Check that selinux is disabled ( or add rules)
#. Source UDP IP in config file (Not Eiger)
* Ensure it is valid and does not end if 0 or 255. Also ensure that the source ip 'udp_srcip' is in the same subnet as destination ip 'udp_dstip' and the masking in the interface configuration ensures this rule.
* Eg. If interface IP is 102.10.10.110 and mask is 255.255.255.0, udp_srcip has to be 102.10.10.xxx (same subnet)
* Use ifconfig and route commands to verify etheret interface configuration
#. Netstat and netcat
* Try with netstat to see if its really listening to the right interface. Or netcat to see if you get packets.
#. Wireshark or Tcpdump
#. Tcpdump or wireshark
* Use one of these to confirm that you receive packets (with the right filtering ie. source and destination ports, ip).
2. Partial or Random Packet Loss (Performance)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. note ::
The following suggestions are for convenience. Please do not follow blindly, research each parameter and adapt it to your system.
#. Receiver PC is not tuned for socket buffer size and input packet queue or other parameters.
* Refer to :ref:`Receiver PC Tuning<Receiver PC Tuning>`
#. Wiring
* Faulty wiring or connecting cable to incorrect interface.
#. Check SFP modules
* Check if the SFP modules on both sides of the fiber are of same type.
#. Pinging the subnet (receiving only a few number of packets each time)
* If a switch is used between a receiver pc and detector instead of plugging the cables directly, one might have to ping any ip in the subnet of the Ethernet interface constantly so that it does not forget the ip during operation.
* Eg. if rx_udpip is 10.2.3.100, then ping constantly 10.2.3.xxx, where xxx is any ip other than 100.
* Using slsReceiver, you can use a command that does this for you:
.. code-block:: bash
# arping the interface in a separate thread every minute
sls_detector_put rx_arping 1
@ -97,12 +68,6 @@ Common
Receiver PC Tuning Options
^^^^^^^^^^^^^^^^^^^^^^^^^^
.. note ::
| xth1 is example interface name in the following examples.
| These settings are lost at pc reboot.
#. Increase maximum receive socket buffer size and socket input packet queue.
* Temporarily (until shut down)
.. code-block:: bash
@ -146,7 +111,6 @@ Receiver PC Tuning Options
# check how many GB memory you can allocate, to avoid swapping otherwise
#. Modify ethtool settings.
* rx ring parameters
.. code-block:: bash
@ -163,9 +127,6 @@ Receiver PC Tuning Options
# check
ethtool -c xth1
# enable adaptive xoalescence parameters
ethtool -C xth1 adaptive-rx on
# set to max value in your pc settings
ethtool -C xth1 rx-usecs 100
@ -177,18 +138,13 @@ Receiver PC Tuning Options
# set to max value in your pc settings
ethtool -A xth1 rx on
* generic receiver offload (might not always work)
.. code-block:: bash
.. note ::
# check
ethtool -k xth1
| xth1 is example interface name.
| These settings are lost at pc reboot.
# enable generic receiver offload
ethtool -K xth1 gro
#. Disable power saving in CPU frequency scaling and set system to performance
#. Disable CPU frequency scaling and set system to performance
* Check current policy (default might be powersave or schedutil)
.. code-block:: bash
@ -203,10 +159,7 @@ Receiver PC Tuning Options
# set to performance
sudo cpupower frequency-set -g performance
# or
cpufreq-info
for i in seq 0 7; do cpufreq-set -c $i -g performance; done
* Permanently
.. code-block:: bash
@ -226,29 +179,18 @@ Receiver PC Tuning Options
This is also set if slsReceiver is run as root user.
#. Some more advanced options:
.. warning ::
Please do not try if you do not understand
#. Disable power saving in CPU frequency
.. code-block:: bash
#. reduce the number of queue per NIC to the number of expected streams: ethtool -L xth0 combined 2
#. assign each queue to its stream: ethtool -U xth0 flow-type tcp4 dst-port 50004 action 1
#. assign to each queue (IRQ) one CPU on the right socket: echo "3"> /proc/irq/47/smp_affinity_list #change the numbers looking at /proc/interrupts
#. disable irqbalance service
#. Be sure that the switch knows the receiver mac address. Most switches reset the mac lists every few minutes, and since the receiver only receives, there is not a periodic refresh of the mac list. In this case, one can set a fixed mac list in the switch, or setup some kind of script arping or pinging out from that interface (will be available in 7.0.0).
#. assign the receiver numa node (also with -m) to the socket where the NIC is attached. To know it, cat /sys/class/net/ethxxx/device/numa_node
#. ensure file system performance can handle sustained high data rate:
* One can use dd:
# or similar command depending on your distribution
cpupower frequency-info
cpupower frequency-set -g performance
.. code-block:: bash
dd if=/dev/zero of=/testpath/testfile bs=1M count=100000
* Or better fio (which needs to be installed)
# or
cpufreq-info
for i in seq 0 7; do cpufreq-set -c $i -g performance; done
.. code-block:: bash
fio --name=global directory=/testpath/ --rw=write --ioengine=libaio --direct=0 --size=200G -- numjobs=2 --iodepth=1 --bs=1M name=job
slsReceiver Tuning
^^^^^^^^^^^^^^^^^^
@ -256,25 +198,18 @@ slsReceiver Tuning
#. Starting receiver as root to have scheduling privileges.
#. For 10g, enable flow control
.. code-block:: bash
sls_detector_put flowcontrol10g 1
#. Increase slsReceiver ring buffer depth
This can be tuned depending on the number of receivers (modules) and memory available.
#. Increase slsReceiver fifo depth between listening and processing threads.
.. code-block:: bash
# sugggested not to use more than half memory of CPU socket in case of NUMA systems) for this
sls_detector_get rx_fifodepth
# sets number of frames in fifo to 1024 ~1GB per receiver. Default is 2500
sls_detector_put rx_fifodepth 1024
#. Increase number of frames per file
This can reduce time taken to open and close files.
# sets number of frames in fifo to 5000
sls_detector_put rx_fifodepth 5000
#. Increase number of frames per file to reduce time taken to open and close files.
.. code-block:: bash
sls_detector_get rx_framesperfile
@ -282,31 +217,10 @@ slsReceiver Tuning
# writes all frames into a single file
sls_detector_put rx_framesperfile 0
#. Disable file write
This can ensure it is not the file system performance hampering high date rate.
.. code-block:: bash
sls_detector_put fwrite 0
Shared memory error
^^^^^^^^^^^^^^^^^^^
For errors due to access or size, use any of the following suggestions.
#. Delete shared memory files and try again
#. Use environment variable to use a different shared memory ending in jfxx
.. code-block:: bash
# shared memory ending in jfxx
export SLSDETNAME=jfxx
#. USe a different multi shared memory ID
.. code-block:: bash
sls_detector_put 2-config xxxx.config
# or
sls_detector_put 2-hostname bchipxxx
| For errors due to access or size, delete shared memory files nd try again.
To list all shared memory files of sls detector package.
.. code-block:: bash
@ -417,7 +331,6 @@ Cannot get multi module data
#. Check :ref:`Common Multi Module Troubleshooting<common troubleshooting multi module data>`
#. Power Supply
* Jungfrau needs a ~4A per module for a short time at startup. If not, it reboots misconfigured.
* Comment out this line in the config file: powerchip 1
* Powering on the chip increases the power consumption by a considerable amount. If commenting out this line aids in getting data (strange data due to powered off chip), then it could be the power supply current limit. Fix it (possibly to 8A current limit) and uncomment the powerchip line back in config file.

View File

@ -6,10 +6,6 @@ Config file
Commands to configure the UDP in the config file:
.. note ::
These command are recommended to be placed before "rx_hostname" if it is used.
Source Port
-----------
Hardcoded in detector server, starting at 32410.

View File

@ -1,20 +1,11 @@
.. _detector specific fields:
Detector Specific Fields
========================
Please check out :ref:`the current detector header <detector udp header>` to see
where the detector specific fields are placed.
Eiger
------
-----
.. table:: Detector Specific Field
.. table::
+----------+------------------------------+
| expLength| Sub Frame Number |
+----------+------------------------------+
| detSpec1 | 0x0 |
+----------+------------------------------+
@ -26,127 +17,3 @@ Eiger
+----------+------------------------------+
Jungfrau
---------
.. table:: Detector Specific Field
+----------+------------------------------+
| detSpec1 | Bunch Id [#]_ |
+----------+------------------------------+
| detSpec2 | 0 |
+----------+------------------------------+
| detSpec3 | DAQ info |
+----------+------------------------------+
| detSpec4 | 0 |
+----------+------------------------------+
.. table:: DAQ Info Field
+----------+--------------------+----------------------------------------------+
| Bits | Name | Description |
+----------+--------------------+-----+----------------------------------------+
| 0 | High gain | 1 | High Gain enabled |
| | +-----+----------------------------------------+
| | | 0 | High Gain disabled |
+----------+--------------------+-----+----------------------------------------+
| 1 | Fix gain stage 1 | 1 | Gain stage 1 fixed. The switch that |
| | | | selects the gains stage 1 is active all|
| | | | the time. |
| | +-----+----------------------------------------+
| | | 0 | Gain stage 1 unset. The switch that |
| | | | selects the gains stage 1 is inactive |
| | | | all the time. |
+----------+--------------------+-----+----------------------------------------+
| 2 | Fix gain stage 2 | 1 | Gain stage 2 fixed. The switch that |
| | | | selects the gains stage 2 is active all|
| | | | the time. |
| | +-----+----------------------------------------+
| | | 0 | Gain stage 2 unset. The switch that |
| | | | selects the gains stage 2 is inactive |
| | | | all the time. |
+----------+--------------------+-----+----------------------------------------+
| 4 | Comparator reset | 1 | On-chip comparator in reset state. |
| | | | Dynamic-gain switching is therefore |
| | | | disabled. |
| | +-----+----------------------------------------+
| | | 0 | On-chip comparator active. |
+----------+--------------------+-----+-----+-----+----------------------------+
| 7-5 | Jungfrau chip |Bit 7|Bit 6|Bit 5| Description |
| | version +-----+-----+-----+----------------------------+
| | | 0 | 0 | 0 | v1.0 |
| | +-----+-----+-----+----------------------------+
| | | 0 | 0 | 1 | v1.1 |
| | +-----+-----+-----+----------------------------+
| | | 0 | 1 | X | Reserved |
| | +-----+-----+-----+----------------------------+
| | | 1 | X | X | Reserved |
+----------+--------------------+-----+-----+-----+----------------------------+
| 11-8 | Storage cell select|Storage cell used for this exposure. This |
| | |field defines the storage cell that was used |
| | |to acquire the data of this frame |
+----------+--------------------+-----+----------------------------------------+
| 12 | Force switching | 1 | Forced switching to gain stage 1 at the|
| | to gain stage 1 | | start of the exposure period. |
| | +-----+----------------------------------------+
| | | 0 | Disabled forced gain switching to gain |
| | | | stage 1. Dynamic gain switching |
| | | | conditions apply. |
+----------+--------------------+-----+----------------------------------------+
| 13 | Force switching | 1 | Forced switching to gain stage 2 at the|
| | to gain stage 2 | | start of the exposure period. |
| | +-----+----------------------------------------+
| | | 0 | Disabled forced gain switching to gain |
| | | | stage 2. Dynamic gain switching |
| | | | conditions apply. |
+----------+--------------------+-----+-----+-----+----------------------------+
| 23-16 | 10-Gigabit event |The 8-bit event code contains value of the |
| | code |event received over the 10 GbE interface by |
| | |JUNGFRAU detector at the moment of the frame |
| | |acquisition. |
+----------+--------------------+-----+----------------------------------------+
| 31 | External input flag| 1 | External input flag detected in the |
| | | | last exposure. |
| | +-----+----------------------------------------+
| | | 0 | External input flag not detected in the|
| | | | last exposure. |
+----------+--------------------+-----+----------------------------------------+
Gotthard2
----------
.. table:: Detector Specific Field
+----------+------------------------------+
| detSpec1 | Train Id [#]_ |
+----------+------------------------------+
| detSpec2 | Bunch Id [#]_ |
+----------+------------------------------+
| detSpec3 | 0 |
+----------+------------------------------+
| detSpec4 | 0 |
+----------+------------------------------+
Mythen3
----------
.. table:: Detector Specific Field
+----------+------------------------------+
| detSpec1 | 0 |
+----------+------------------------------+
| detSpec2 | 0 |
+----------+------------------------------+
| detSpec3 | 0 |
+----------+------------------------------+
| detSpec4 | 0 |
+----------+------------------------------+
.. [#] **Bunch Id**: bunch identification number received by the detector at the moment of frame acquisition.
.. [#] **Train Id**: train identification number received by the detector at the moment of frame acquisition.
.. [#] **Bunch Id**: bunch identification number to identify every single exposure during a burst acquisition.

View File

@ -9,7 +9,7 @@ The UDP data format for the packets consist of a common header for all detectors
Current Version
---------------------------
**v2.0 (slsDetectorPackage v7.0.0+)**
**v3.0 (slsDetectorPackage v7.0.0+)**
.. table:: <---------------------------------------------------- 8 bytes ---------------------------------------------------->
:align: center
@ -30,57 +30,6 @@ Current Version
+-------------------------------+---------------+-------+-------+
.. note ::
Since there is no difference in the format of the UDP header from the detector
from the previous version (v2.0), the version number stays the same.
Only the struture member names have changed in sls_detector_defs.h
Description
------------
* **Detector specific field** descriptions are found :ref:`here<detector specific fields>`.
* **frameNumber**: framenumber to which the current packet belongs to.
* **expLength**: measured exposure time of the frame in tenths of microsecond. It is instead the sub frame number for Eiger.
* **packetNumber**: packet number of the frame to which the current data belongs to.
* **timestamp**: time measured at the start of frame exposure since the start of the current measurement. It is expressed in tenths of microsecond.
* **modId**: module ID picked up from det_id_[detector type].txt on the detector cpu.
* **row**: row position of the module in the detector system. It is calculated by the order of the module in hostname command, as well as the detsize command.
* **column**: column position of the module in the detector system. It is calculated by the order of the module in hostname command, as well as the detsize command.
* **detType**: detector type from enum of detectorType in the package.
* **version**: current version of the detector header (0x2).
Detector Enum
--------------
================ ========
Detector Type Value
================ ========
GENERIC 0
EIGER 1
GOTTHARD 2
JUNGFRAU 3
CHIPTESTBOARD 4
MOENCH 5
MYTHEN3 6
GOTTHARD2 7
================ ========
Previous Versions
-----------------
**v2.0 (Package v4.0.0 - 6.x.x)**
@ -103,6 +52,7 @@ Previous Versions
| debug | roundRNumber |detType|version|
+-------------------------------+---------------+-------+-------+
**v1.0 (Package v3.0.0 - 3.1.5)**
.. table:: <---------------------------------------------------- 8 bytes ---------------------------------------------------->

View File

@ -13,14 +13,16 @@ Compilation
* Using cmk.sh script,
.. code-block:: bash
./cmk.sh -bsj9 # option -s is for simulator
./cmk.sh -bsj9 #option s is for simulator
Binaries
^^^^^^^^
.. code-block:: bash
eigerDetectorServer_virtual
eigerDetectorServerMaster_virtual
eigerDetectorServerSlaveTop_virtual
eigerDetectorServerSlaveBottom_virtual
jungfrauDetectorServer_virtual
gotthardDetectorServer_virtual
gotthard2DetectorServer_virtual
@ -65,15 +67,7 @@ Sample Config file
^^^^^^^^^^^^^^^^^^
There are sample config files for each detector in slsDetectorPackage/examples folder.
For a Single Module (Basic)
.. code-block:: bash
hostname localhost
rx_hostname localhost
udp_dstip auto
For a Single Module (With Options)
For a Single Module
.. code-block:: bash
# connects to control port 1912
@ -146,7 +140,7 @@ Gui
Limitations
-----------
#. Data coming out of virtual server is fake.
#. Data coming out of virtual server is fake. Value at each pixel/ channel is incremented by 1.
#. A stop will stop the virtual acquisition only at the start of every new frame.

View File

@ -1,6 +0,0 @@
0
10, 30
40:45 50:52
1279
# all bad channels are applied for all counters in deector

View File

@ -5,7 +5,7 @@ detsize 1024 1024
hostname bchip048+bchip052+
# 1Gb receiver pc hostname (default tcpport: 1954)
rx_hostname pcmoench01:1954+pcmoench01:1955+
rx_hostname pcmoench01+pcmoench01:1955

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 KiB

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 24 09:44:53 2017
@ -17,9 +16,13 @@ from numpy import *
from matplotlib.pyplot import *
from matplotlib.patches import Rectangle
import os
import argparse
###############################################################################
# Input the folder of the pattern file
Folder = "./patterns/"
# Prefix name of the .pat and .alias file
File_pat = "test_v2"
# COLORS AND LINE STYLES
# alternating colors of the plots (2 needed)
colors_plot = ['tab:blue', 'tab:orange']
@ -31,7 +34,7 @@ alpha_wait = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5]
alpha_wait_rect = [0.2, 0.2, 0.2, 0.2, 0.2, 0.2]
# Loop colors and line styles (6 needed from 0 to 5)
colors_loop = ['tab:green', 'tab:red', 'tab:purple', 'tab:brown', 'tab:pink', 'tab:grey']
colors_loop = ['tab:green', 'tab:red', 'tab:purple', 'tab:brown', 'tab:ping', 'tab:grey']
linestyles_loop = ['-.', '-.', '-.', '-.', '-.', '-.']
alpha_loop = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5]
alpha_loop_rect = [0.2, 0.2, 0.2, 0.2, 0.2, 0.2]
@ -40,6 +43,8 @@ alpha_loop_rect = [0.2, 0.2, 0.2, 0.2, 0.2, 0.2]
clock_vertical_lines_spacing = 1
show_clocks_number = True
# Verbosity
verbose = False
###############################################################################
@ -82,20 +87,6 @@ def hex2binary(string_num, width=None):
return dec2binary(hex2dec(string_num.upper()), width=width)
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--directory', required = True, help = "Working directory where the pattern is located")
parser.add_argument('-p', '--pattern', required = True, help = "Pattern name")
parser.add_argument('-a', '--alias', help = "Alias name")
parser.add_argument('-v', '--verbose', action='store_true')
args = parser.parse_args()
Folder = args.directory
File_pat = args.pattern
File_alias = args.alias
verbose = args.verbose
# Look at the alias file and generate the lookup table for pin names
# Create a 64 bit look up table
table = []
@ -111,34 +102,26 @@ for i in range(64):
table.append([str(i+1), ""])
# Loop all lines
try:
with open(Folder + "/" + File_alias + ".alias") as f:
lines = f.readlines()
f.close()
nlines = len(lines)
except:
nlines = 0
if nlines > 0:
for i in range(nlines):
# whether the line is bit definition
if lines[i][0:3] == "BIT":
# split words
words = lines[i].split()
bit_num = int(words[0][3:])
table[bit_num][0] = words[0][3:]
table[bit_num][1] = words[1]
else:
for i in range(64):
table[i][0] = i
table[i][1] = f'BIT#{i}'
with open(Folder+"/" + File_pat + ".alias") as f:
lines = f.readlines()
f.close()
nlines = len(lines)
for i in range(nlines):
# whether the line is bit definition
if lines[i][0:3] == "BIT":
# split words
words = lines[i].split()
bit_num = int(words[0][3:])
table[bit_num][0] = words[0][3:]
table[bit_num][1] = words[1]
if verbose:
print(table)
# Load the pattern and get all lines
# Loop all lines
with open(Folder + "/" + File_pat + ".pat") as f_pat:
with open(Folder+"/"+File_pat+".pat") as f_pat:
lines_pat = f_pat.readlines()
f_pat.close()
@ -148,7 +131,6 @@ nlines_pat = len(lines_pat)
cnt = 0
if verbose:
print("The total number of lines of pattern:", nlines_pat)
# Loop all lines of pattern
waittime0 = None
waittime1 = None
@ -527,7 +509,7 @@ for idx, i in enumerate(range(nbiteff)):
linestyle=linestyles_loop[2], color=colors_loop[2], alpha=alpha_loop[2],
label="loop 2: " + str(nloop2) + " times" if idx == 0 else "", linewidth=2.0)
axs2[idx].plot([loop2_end, loop2_end], [-10, 10],
linestyle=linestyles_loop[2], color=colors_loop[2], alpha=alpha_loop[2], linewidth=2.0)
linestyle=linestyles_loop[0], color=colors_loop[0], alpha=alpha_loop[2], linewidth=2.0)
# Loop 3
if nloop3 is not None:

201
patternGenerator/test.p Executable file
View File

@ -0,0 +1,201 @@
//define signals and directions (Input, outputs, clocks)
#define compTestIN 1
setoutput(compTestIN);
#define curON 32
setoutput(curON);
#define side_clk 2
setclk(side_clk);
#define side_din 3
setoutput(side_din);
#define clear_shr 4
setoutput(clear_shr);
#define bottom_din 5
setoutput(bottom_din);
#define bottom_clk 6
setclk(bottom_clk);
#define gHG 7
setoutput(gHG);
#define bypassCDS 31
setoutput(bypassCDS);
#define ENprechPRE 8
setoutput(ENprechPRE);
#define res 9
setoutput(res);
#define pulseOFF 30
setoutput(pulseOFF);
#define connCDS 27
setoutput(connCDS);
#define Dsg_1 24
setoutput(Dsg_1);
#define Dsg_2 25
setoutput(Dsg_2);
#define Dsg_3 23
setoutput(Dsg_3);
#define sto0 10
setoutput(sto0);
#define sto1 11
setoutput(sto1);
#define sto2 12
setoutput(sto2);
#define resCDS 13
setoutput(resCDS);
#define prechargeConnect 14
setoutput(prechargeConnect);
#define pulse 15
setoutput(pulse);
#define PCT_mode 21
setoutput(PCT_mode);
#define res_DGS 16
setoutput(res_DGS);
#define adc_ena 17
setoutput(adc_ena);
#define CLKBIT 18
setclk(CLKBIT);
#define adc_sync 63
setoutput(adc_sync);
#define PW pw()
#define SB(x) setbit(x)
#define CB(x) clearbit(x)
#define CLOCK clearbit(CLKBIT); pw();setbit(CLKBIT);pw()
#define LCLOCK clearbit(CLKBIT); pw();setbit(CLKBIT);pw();clearbit(CLKBIT); pw()
#define CLOCKS(x) for (i=0;i<x;i++) {clearbit(CLKBIT);pw(); setbit(CLKBIT); pw();}
#define STOP setstop();
#define START setstart();
#define REPEAT(x) for (i=0;i<(x);i++) {pw();}
#define DOFOR(x) for (j=0;j<(x);j++) {
// }
#define STARTUP1 CB(compTestIN);SB(clear_shr);CB(side_clk);CB(side_din);CB(bottom_din);CB(bottom_clk);
#define STARTUP2 CB(pulse);SB(PCT_mode);SB(pulseOFF);CB(curON);
#define STARTUP3 SB(res);SB(gHG);SB(ENprechPRE);
#define STARTUP4 SB(bypassCDS); CB(connCDS);CB(sto0);SB(sto1);SB(sto2);
#define STARTUP5 SB(resCDS);CB(Dsg_1);CB(Dsg_2);SB(Dsg_3);CB(prechargeConnect);SB(res_DGS);
#define STARTUP STARTUP1 STARTUP2 STARTUP3 STARTUP4 STARTUP5 PW;
//****NOTES****//
//FUNCTIONS
//Declare functions at the beginning
void load_pix(int nx, int ny)
{//SELECT PIXEL 1,1 for readout
SB(clear_shr);PW;PW;
CB(clear_shr);PW;PW;PW;PW;
SB(side_din);PW;
SB(side_clk);PW;
CB(side_din);
setstartloop(0); //loop on the rows
SB(side_clk);PW;
setstoploop(0); //finish loop on the rows
setnloop(0,ny); //set number row selected -can be changed dynamically
CB(side_clk);PW;
SB(bottom_din);PW;
SB(bottom_clk);PW;
CB(bottom_din);
setstartloop(1); //loop on the columns
SB(bottom_clk);PW;
setstoploop(1); //loop on the columns
setnloop(1,ny); //set number columns selected -can be changed dynamically
}
void load_col(void)
{//SELECT COLUMN 1 for readout
SB(clear_shr);PW;PW;
CB(clear_shr);PW;PW;PW;PW;
SB(bottom_din);PW;
SB(bottom_clk);PW;
CB(bottom_clk);PW;
CB(bottom_din);PW;
}
//END of FUNCTIONS
////////////////////////////////////////////////////////
//LET BYPASS PREAMP AND CDS and write on preamp out.//
//THIS ALLOWS CHECKING SOURCE FOLLOWERS //
////////////////////////////////////////////////////////
PW;
SB(5); PW;
CB(5); PW;
START; //pattern starts from here
STARTUP;
setwaitpoint(0); //set wait points
PW;
setwaittime(0,20); //wait time - can be changed dynamically
SB(adc_ena);PW;
printf("ADC sync %x %d %llx\n",iaddr,adc_sync, pat);
SB(adc_sync);PW;
printf("ADC sync %x %d %llx\n",iaddr, adc_sync, pat);
CB(gHG);
setwaitpoint(1); //set wait points
setwaittime(1,16); //wait time - can be changed dynamically
CB(adc_sync);PW;
load_pix(10, 20);
CB(res);
//CB(Dsg_3);PW;
CB(res_DGS);
setwaitpoint(2); //set wait points
setwaittime(2,1000); //wait time - can be changed dynamically
//SB(res_DGS);
//PW;
//SB(Dsg_3);
//
//CB(connCDS);
//TEST SIGNALS END
//
REPEAT(20)
//****************//
//*FINAL COMMANDS*//
//****************//
CB(adc_ena);PW;
//STARTUP;
STOP; PW; //stops here
//REPEAT(4);

View File

@ -7,7 +7,7 @@ Build upon the pybind11 example found here: https://github.com/pybind/python_exa
import os
import sys
sys.path.append('../libs/pybind')
sys.path.append('../libs/pybind11')
from setuptools import setup, find_packages
from pybind11.setup_helpers import Pybind11Extension, build_ext
@ -22,25 +22,19 @@ def get_conda_path():
return os.environ['CONDA_PREFIX']
#TODO migrate to CMake build or fetch files from cmake?
#TODO migrate to CMake build?
ext_modules = [
Pybind11Extension(
'_slsdet',
['src/main.cpp',
'src/enums.cpp',
'src/current.cpp',
'src/enums.cpp',
'src/detector.cpp',
'src/network.cpp',
'src/pattern.cpp',
'src/scan.cpp',
'src/duration.cpp',
'src/DurationWrapper.cpp',
]
,
'src/scan.cpp',],
include_dirs=[
os.path.join('../libs/pybind/include'),
os.path.join('../libs/pybind11/include'),
os.path.join(get_conda_path(), 'include'),
],

View File

@ -14,7 +14,7 @@ streamingInterface = slsDetectorDefs.streamingInterface
defs = slsDetectorDefs
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, hostname_list
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
@ -162,8 +162,12 @@ class Detector(CppDetectorApi):
@hostname.setter
def hostname(self, hostnames):
args = hostname_list(hostnames)
self.setHostname(args)
if isinstance(hostnames, str):
hostnames = [hostnames]
if isinstance(hostnames, list):
self.setHostname(hostnames)
else:
raise ValueError("hostname needs to be string or list of strings")
@property
@ -225,14 +229,6 @@ class Detector(CppDetectorApi):
"""
return self.getDetectorServerVersion()
@property
@element
def hardwareversion(self):
"""
[Jungfrau][Gotthard2][Myhten3][Gotthard][Ctb][Moench] Hardware version of detector.
"""
return ut.lhex(self.getHardwareVersion())
@property
@element
def kernelversion(self):
@ -462,35 +458,16 @@ class Detector(CppDetectorApi):
-----
[Mythen3] sets exposure time to all gate signals in auto and trigger mode (internal gating). To specify gateIndex, use getExptime or setExptime.
:getter: always returns in seconds. To get in DurationWrapper, use getExptime
:getter: always returns in seconds. To get in datetime.delta, use getExptime
Example
-----------
>>> # setting directly in seconds
>>> d.exptime = 1.05
>>>
>>> # setting directly in seconds
>>> d.exptime = 5e-07
>>>
>>> # using timedelta (up to microseconds precision)
>>> from datatime import timedelta
>>> d.exptime = timedelta(seconds = 1, microseconds = 3)
>>>
>>> # using DurationWrapper to set in seconds
>>> from slsdet import DurationWrapper
>>> d.exptime = DurationWrapper(1.2)
>>>
>>> # using DurationWrapper to set in ns
>>> t = DurationWrapper()
>>> t.set_count(500)
>>> d.exptime = t
>>>
>>> # to get in seconds
>>> d.exptime = datetime.timedelta(minutes = 3, seconds = 1.23)
>>> d.exptime
181.23
>>>
>>> d.getExptime()
[sls::DurationWrapper(total_seconds: 1e-08 count: 10)]
[datetime.timedelta(seconds=181, microseconds=230000)]
"""
if self.type == detectorType.MYTHEN3:
res = self.getExptimeForAllGates()
@ -518,35 +495,16 @@ class Detector(CppDetectorApi):
Note
-----
:getter: always returns in seconds. To get in DurationWrapper, use getPeriod
:getter: always returns in seconds. To get in datetime.delta, use getPeriod
Example
-----------
>>> # setting directly in seconds
>>> d.period = 1.05
>>>
>>> # setting directly in seconds
>>> d.period = 5e-07
>>>
>>> # using timedelta (up to microseconds precision)
>>> from datatime import timedelta
>>> d.period = timedelta(seconds = 1, microseconds = 3)
>>>
>>> # using DurationWrapper to set in seconds
>>> from slsdet import DurationWrapper
>>> d.period = DurationWrapper(1.2)
>>>
>>> # using DurationWrapper to set in ns
>>> t = DurationWrapper()
>>> t.set_count(500)
>>> d.period = t
>>>
>>> # to get in seconds
>>> d.period = datetime.timedelta(minutes = 3, seconds = 1.23)
>>> d.period
181.23
>>>
>>> d.getExptime()
sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)
>>> d.getPeriod()
[datetime.timedelta(seconds=181, microseconds=230000)]
"""
res = self.getPeriod()
return reduce_time(res)
@ -566,7 +524,7 @@ class Detector(CppDetectorApi):
-----
[Gotthard2] only in continuous mode.
:getter: always returns in seconds. To get in DurationWrapper, use getPeriodLeft
:getter: always returns in seconds. To get in datetime.delta, use getPeriodLeft
:setter: Not Implemented
Example
@ -574,7 +532,7 @@ class Detector(CppDetectorApi):
>>> d.periodl
181.23
>>> d.getPeriodLeft()
[sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)]
[datetime.timedelta(seconds=181, microseconds=230000)]
"""
return self.getPeriodLeft()
@ -582,40 +540,21 @@ class Detector(CppDetectorApi):
@element
def delay(self):
"""
[Gotthard][Jungfrau][CTB][Moench][Mythen3][Gotthard2] Delay after trigger, accepts either a value in seconds, DurationWrapper or datetime.timedelta
[Gotthard][Jungfrau][CTB][Moench][Mythen3][Gotthard2] Delay after trigger, accepts either a value in seconds or datetime.timedelta
Note
-----
:getter: always returns in seconds. To get in DurationWrapper, use getDelayAfterTrigger
:getter: always returns in seconds. To get in datetime.delta, use getDelayAfterTrigger
Example
-----------
>>> # setting directly in seconds
>>> d.delay = 1.05
>>>
>>> # setting directly in seconds
>>> d.delay = 5e-07
>>>
>>> # using timedelta (up to microseconds precision)
>>> from datatime import timedelta
>>> d.delay = timedelta(seconds = 1, microseconds = 3)
>>>
>>> # using DurationWrapper to set in seconds
>>> from slsdet import DurationWrapper
>>> d.delay = DurationWrapper(1.2)
>>>
>>> # using DurationWrapper to set in ns
>>> t = DurationWrapper()
>>> t.set_count(500)
>>> d.delay = t
>>>
>>> # to get in seconds
>>> d.delay = datetime.timedelta(minutes = 3, seconds = 1.23)
>>> d.delay
181.23
>>>
>>> d.getDelayAfterTrigger()
sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)
[datetime.timedelta(seconds=181, microseconds=230000)]
"""
return ut.reduce_time(self.getDelayAfterTrigger())
@ -627,13 +566,13 @@ class Detector(CppDetectorApi):
@element
def delayl(self):
"""
[Gotthard][Jungfrau][CTB][Moench][Mythen3][Gotthard2] Delay left after trigger during acquisition, accepts either a value in seconds, datetime.timedelta or DurationWrapper
[Gotthard][Jungfrau][CTB][Moench][Mythen3][Gotthard2] Delay left after trigger during acquisition, accepts either a value in seconds or datetime.timedelta
Note
-----
[Gotthard2] only in continuous mdoe.
:getter: always returns in seconds. To get in DurationWrapper, use getDelayAfterTriggerLeft
:getter: always returns in seconds. To get in datetime.delta, use getDelayAfterTriggerLeft
:setter: Not Implemented
Example
@ -641,7 +580,7 @@ class Detector(CppDetectorApi):
>>> d.delayl
181.23
>>> d.getDelayAfterTriggerLeft()
[sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)]
[datetime.timedelta(seconds=181, microseconds=230000)]
"""
return ut.reduce_time(self.getDelayAfterTriggerLeft())
@ -680,46 +619,25 @@ class Detector(CppDetectorApi):
@property
@element
def txdelay(self):
"""
[Eiger][Jungfrau][Mythen3] Set transmission delay for all modules in the detector using the step size provided.
Note
----
Sets up the following for every module:\n
\t\t[Eiger] txdelay_left to (2 * mod_index * n_delay), \n
\t\t[Eiger] txdelay_right to ((2 * mod_index + 1) * n_delay) and \n
\t\t[Eiger] txdelay_frame to (2 *num_modules * n_delay) \n
\t\t[Jungfrau][Mythen3] txdelay_frame to (num_modules * n_delay)\n\n
Please refer txdelay_left, txdelay_right and txdelay_frame for details.
"""
return self.getTransmissionDelay()
@txdelay.setter
def txdelay(self, args):
ut.set_using_dict(self.setTransmissionDelay, args)
@property
@element
def txdelay_frame(self):
def txndelay_frame(self):
"""
[Eiger][Jungfrau][Mythen3] Transmission delay of first udp packet being streamed out of the module.\n
Note
----
[Jungfrau] [0-31] Each value represents 1 ms. \n
[Eiger] Additional delay to txdelay_left and txdelay_right. Each value represents 10ns. Typical value is 50000. \n
[Eiger] Additional delay to txndelay_left and txndelay_right. Each value represents 10ns. Typical value is 50000. \n
[Mythen3] [0-16777215] Each value represents 8 ns (125 MHz clock), max is 134 ms.
"""
return self.getTransmissionDelayFrame()
@txdelay_frame.setter
def txdelay_frame(self, args):
@txndelay_frame.setter
def txndelay_frame(self, args):
ut.set_using_dict(self.setTransmissionDelayFrame, args)
@property
@element
def txdelay_left(self):
def txndelay_left(self):
"""[Eiger] Transmission delay of first packet in an image being streamed out of the module's left UDP port.
Note
@ -728,13 +646,13 @@ class Detector(CppDetectorApi):
"""
return self.getTransmissionDelayLeft()
@txdelay_left.setter
def txdelay_left(self, args):
@txndelay_left.setter
def txndelay_left(self, args):
ut.set_using_dict(self.setTransmissionDelayLeft, args)
@property
@element
def txdelay_right(self):
def txndelay_right(self):
"""
[Eiger] Transmission delay of first packet in an image being streamed out of the module's right UDP port.
@ -744,8 +662,8 @@ class Detector(CppDetectorApi):
"""
return self.getTransmissionDelayRight()
@txdelay_right.setter
def txdelay_right(self, args):
@txndelay_right.setter
def txndelay_right(self, args):
ut.set_using_dict(self.setTransmissionDelayRight, args)
@property
@ -780,8 +698,7 @@ class Detector(CppDetectorApi):
@rx_hostname.setter
def rx_hostname(self, hostname):
args = hostname_list(hostname)
self.setRxHostname(args)
self.setRxHostname(hostname)
@property
@element
@ -1565,20 +1482,6 @@ class Detector(CppDetectorApi):
def trimval(self, value):
ut.set_using_dict(self.setAllTrimbits, value)
@property
@element
def fliprows(self):
"""
[Eiger] flips rows paramater sent to slsreceiver to stream as json parameter to flip rows in gui. \n
[Jungfrau] flips rows in the detector itself. For bottom module and number of interfaces must be set to 2. slsReceiver and slsDetectorGui does not handle.
"""
return self.getFlipRows()
@fliprows.setter
def fliprows(self, value):
ut.set_using_dict(self.setFlipRows, value)
@property
@element
def master(self):
@ -1813,21 +1716,11 @@ class Detector(CppDetectorApi):
@property
def versions(self):
if self.type == detectorType.EIGER:
return {'type': self.type,
'package': self.packageversion,
'client': self.clientversion,
'firmware': self.firmwareversion,
'detectorserver': self.detectorserverversion,
'kernel': self.kernelversion,
'receiver': self.rx_version}
return {'type': self.type,
'package': self.packageversion,
'client': self.clientversion,
'firmware': self.firmwareversion,
'detectorserver': self.detectorserverversion,
'hardware':self.hardwareversion,
'kernel': self.kernelversion,
'receiver': self.rx_version}
@ -2102,35 +1995,16 @@ class Detector(CppDetectorApi):
----
Subperiod = subexptime + subdeadtime.
:getter: always returns in seconds. To get in DurationWrapper, use getSubExptime
:getter: always returns in seconds. To get in datetime.delta, use getSubExptime
Example
-----------
>>> # setting directly in seconds
>>> d.subexptime = 1.230203
>>>
>>> # setting directly in seconds
>>> d.subexptime = 5e-07
>>>
>>> # using timedelta (up to microseconds precision)
>>> from datatime import timedelta
>>> d.subexptime = timedelta(seconds = 1.23, microseconds = 203)
>>>
>>> # using DurationWrapper to set in seconds
>>> from slsdet import DurationWrapper
>>> d.subexptime = DurationWrapper(1.2)
>>>
>>> # using DurationWrapper to set in ns
>>> t = DurationWrapper()
>>> t.set_count(500)
>>> d.subexptime = t
>>>
>>> # to get in seconds
>>> d.subexptime = datetime.timedelta(seconds = 1.23, microseconds = 203)
>>> d.subexptime
181.23
>>>
1.230203
>>> d.getSubExptime()
sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)
[datetime.timedelta(seconds = 1, microseconds = 203)]
"""
res = self.getSubExptime()
return reduce_time(res)
@ -2162,41 +2036,22 @@ class Detector(CppDetectorApi):
@property
def subdeadtime(self):
"""
[Eiger] Dead time of EIGER subframes in 32 bit mode, accepts either a value in seconds, datetime.timedelta or DurationWrapper
[Eiger] Dead time of EIGER subframes in 32 bit mode, accepts either a value in seconds or datetime.timedelta
Note
----
Subperiod = subexptime + subdeadtime.
:getter: always returns in seconds. To get in DurationWrapper, use getSubDeadTime
:getter: always returns in seconds. To get in datetime.delta, use getSubDeadTime
Example
-----------
>>> # setting directly in seconds
>>> d.subdeadtime = 1.230203
>>>
>>> # setting directly in seconds
>>> d.subdeadtime = 5e-07
>>>
>>> # using timedelta (up to microseconds precision)
>>> from datatime import timedelta
>>> d.subdeadtime = timedelta(seconds = 1.23, microseconds = 203)
>>>
>>> # using DurationWrapper to set in seconds
>>> from slsdet import DurationWrapper
>>> d.subdeadtime = DurationWrapper(1.2)
>>>
>>> # using DurationWrapper to set in ns
>>> t = DurationWrapper()
>>> t.set_count(500)
>>> d.subdeadtime = t
>>>
>>> # to get in seconds
>>> d.subdeadtime = datetime.timedelta(seconds = 1.23, microseconds = 203)
>>> d.subdeadtime
181.23
>>>
1.230203
>>> d.getSubDeadTime()
sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)
[datetime.timedelta(seconds = 1, microseconds = 203)]
"""
res = self.getSubDeadTime()
return reduce_time(res)
@ -2372,35 +2227,16 @@ class Detector(CppDetectorApi):
-----
It is only possible for chipv1.1.
:getter: always returns in seconds. To get in DurationWrapper, use getComparatorDisableTime
:getter: always returns in seconds. To get in datetime.delta, use getComparatorDisableTime
Example
-----------
>>> # setting directly in seconds
>>> d.compdisabletime = 1.05
>>>
>>> # setting directly in seconds
>>> d.compdisabletime = 5e-07
>>>
>>> # using timedelta (up to microseconds precision)
>>> from datatime import timedelta
>>> d.compdisabletime = timedelta(seconds = 1, microseconds = 3)
>>>
>>> # using DurationWrapper to set in seconds
>>> from slsdet import DurationWrapper
>>> d.compdisabletime = DurationWrapper(1.2)
>>>
>>> # using DurationWrapper to set in ns
>>> t = DurationWrapper()
>>> t.set_count(500)
>>> d.compdisabletime = t
>>>
>>> # to get in seconds
>>> d.compdisabletime = datetime.timedelta(minutes = 3, seconds = 1.23)
>>> d.compdisabletime
181.23
>>>
>>> d.getComparatorDisableTime()
sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)
[datetime.timedelta(seconds=181, microseconds=230000)]
"""
return ut.reduce_time(self.getComparatorDisableTime())
@ -2458,42 +2294,23 @@ class Detector(CppDetectorApi):
@property
def storagecell_delay(self):
"""
[Jungfrau] Additional time delay between 2 consecutive exposures in burst mode, accepts either a value in seconds, datetime.timedelta or DurationWrapper
[Jungfrau] Additional time delay between 2 consecutive exposures in burst mode, accepts either a value in seconds or datetime.timedelta
Note
-----
Only applicable for chipv1.0. For advanced users only \n
Value: 0-1638375 ns (resolution of 25ns)
:getter: always returns in seconds. To get in DurationWrapper, use getStorageCellDelay
:getter: always returns in seconds. To get in datetime.delta, use getStorageCellDelay
Example
-----------
>>> # setting directly in seconds
>>> d.storagecell_delay = 1.05
>>>
>>> # setting directly in seconds
>>> d.storagecell_delay = 5e-07
>>>
>>> # using timedelta (up to microseconds precision)
>>> from datatime import timedelta
>>> d.storagecell_delay = timedelta(seconds = 1, microseconds = 3)
>>>
>>> # using DurationWrapper to set in seconds
>>> from slsdet import DurationWrapper
>>> d.storagecell_delay = DurationWrapper(1.2)
>>>
>>> # using DurationWrapper to set in ns
>>> t = DurationWrapper()
>>> t.set_count(500)
>>> d.storagecell_delay = t
>>>
>>> # to get in seconds
>>> d.storagecell_delay = 0.00056
>>> d.storagecell_delay = datetime.timedelta(microseconds = 45)
>>> d.storagecell_delay
181.23
>>>
4.5e-05
>>> d.getStorageCellDelay()
sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)
[datetime.timedelta(microseconds=45)]
"""
return ut.reduce_time(self.getStorageCellDelay())
@ -2767,36 +2584,18 @@ class Detector(CppDetectorApi):
Note
-----
:getter: always returns in seconds. To get in DurationWrapper, use getBurstPeriod
:getter: always returns in seconds. To get in datetime.delta, use getBurstPeriod
:setter: Not Implemented
Example
-----------
>>> # setting directly in seconds
>>> d.burstperiod = 1.05
>>>
>>> # setting directly in seconds
>>> d.burstperiod = 5e-07
>>>
>>> # using timedelta (up to microseconds precision)
>>> from datatime import timedelta
>>> d.burstperiod = timedelta(seconds = 1, microseconds = 3)
>>>
>>> # using DurationWrapper to set in seconds
>>> from slsdet import DurationWrapper
>>> d.burstperiod = DurationWrapper(1.2)
>>>
>>> # using DurationWrapper to set in ns
>>> t = DurationWrapper()
>>> t.set_count(500)
>>> d.burstperiod = t
>>>
>>> # to get in seconds
>>> d.burstperiod = datetime.timedelta(minutes = 3, seconds = 1.23)
>>> d.burstperiod
181.23
>>>
>>> d.getBurstPeriod()
sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)
[datetime.timedelta(seconds=181, microseconds=230000)]
"""
return ut.reduce_time(self.getBurstPeriod())
@ -2921,41 +2720,25 @@ class Detector(CppDetectorApi):
@property
def gatedelay(self):
"""
[Mythen3] Gate Delay of all gate signals in auto and trigger mode (internal gating), accepts either a value in seconds, datetime.timedelta or DurationWrapper
[Mythen3] Gate Delay of all gate signals in auto and trigger mode (internal gating), accepts either a value in seconds or datetime.timedelta
Note
-----
To specify gateIndex, use getGateDelay or setGateDelay.
:getter: always returns in seconds. To get in DurationWrapper, use getGateDelayForAllGates or getGateDelay(gateIndex)
:getter: always returns in seconds. To get in datetime.delta, use getGateDelayForAllGates or getGateDelay(gateIndex)
Example
-----------
>>> # setting directly in seconds
>>> d.gatedelay = 1.05
>>>
>>> # setting directly in seconds
>>> d.gatedelay = 5e-07
>>>
>>> # using timedelta (up to microseconds precision)
>>> from datatime import timedelta
>>> d.gatedelay = timedelta(seconds = 1, microseconds = 3)
>>>
>>> # using DurationWrapper to set in seconds
>>> from slsdet import DurationWrapper
>>> d.gatedelay = DurationWrapper(1.2)
>>>
>>> # using DurationWrapper to set in ns
>>> t = DurationWrapper()
>>> t.set_count(500)
>>> d.gatedelay = t
>>>
>>> # to get in seconds
>>> d.gatedelay = datetime.timedelta(minutes = 3, seconds = 1.23)
>>> d.gatedelay
181.23
>>>
>>> d.setGateDelay(1, datetime.timedelta(seconds = 2))
>>> d.gatedelay
>>> [1.0, 2.0, 1.0]
>>> d.getExptimeForAllGates()
sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)
>>> [[datetime.timedelta(seconds=181, microseconds=230000), datetime.timedelta(seconds=181, microseconds=230000), datetime.timedelta(seconds=181, microseconds=230000)]]
"""
return reduce_time(self.getGateDelayForAllGates())
@ -3759,7 +3542,7 @@ class Detector(CppDetectorApi):
Note
-----
:getter: always returns in seconds. To get in DurationWrapper, use getExptimeLeft
:getter: always returns in seconds. To get in datetime.delta, use getExptimeLeft
:setter: Not Implemented
Example
@ -3767,7 +3550,7 @@ class Detector(CppDetectorApi):
>>> d.exptimel
181.23
>>> d.getExptimeLeft()
[sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)]
[datetime.timedelta(seconds=181, microseconds=230000)]
"""
t = self.getExptimeLeft()
return reduce_time(t)

View File

@ -260,21 +260,4 @@ def merge_args(*args):
return (ret,)
else:
raise ValueError("Multiple dictionaries passes cannot merge args")
def hostname_list(args):
"""
Generates a list from a hostname string
* Lists are passed through
* as are tuples (conversion in pybind11 to vector)
* if + is found it splits the string
"""
if isinstance(args, (list, tuple)):
return args
elif(isinstance(args, str)):
hosts = args.split('+')
hosts = [it for it in hosts if len(it)]
return hosts
else:
raise ValueError("hostname needs to be string or list of strings")
raise ValueError("Multiple dictionaries passes cannot merge args")

View File

@ -66,11 +66,6 @@ void init_det(py::module &m) {
(Result<std::string>(Detector::*)(sls::Positions) const) &
Detector::getDetectorServerVersion,
py::arg() = Positions{});
CppDetectorApi.def(
"getHardwareVersion",
(Result<std::string>(Detector::*)(sls::Positions) const) &
Detector::getHardwareVersion,
py::arg() = Positions{});
CppDetectorApi.def(
"getKernelVersion",
(Result<std::string>(Detector::*)(sls::Positions) const) &
@ -783,12 +778,6 @@ void init_det(py::module &m) {
(void (Detector::*)(int, sls::Positions)) &
Detector::setTransmissionDelayRight,
py::arg(), py::arg() = Positions{});
CppDetectorApi.def("getTransmissionDelay",
(int (Detector::*)() const) &
Detector::getTransmissionDelay);
CppDetectorApi.def(
"setTransmissionDelay",
(void (Detector::*)(int)) & Detector::setTransmissionDelay, py::arg());
CppDetectorApi.def("getUseReceiverFlag",
(Result<bool>(Detector::*)(sls::Positions) const) &
Detector::getUseReceiverFlag,

View File

@ -12,7 +12,6 @@ void init_duration(py::module &m) {
.def("total_seconds", &DurationWrapper::total_seconds)
.def("count", &DurationWrapper::count)
.def("set_count", &DurationWrapper::set_count)
.def("__eq__", &DurationWrapper::operator==)
.def("__repr__", [](const DurationWrapper &self) {
std::stringstream ss;
ss << "sls::DurationWrapper(total_seconds: " << self.total_seconds()

View File

@ -8,7 +8,7 @@ Testing functions from utils.py
import pytest
from slsdet.utils import *
from slsdet import IpAddr, MacAddr, DurationWrapper
from slsdet import IpAddr, MacAddr
import datetime as dt
import pathlib
from pathlib import Path
@ -22,11 +22,7 @@ def test_iterable():
def test_reduce_time_to_single_value_from_list():
t = [dt.timedelta(seconds=1) for i in range(3)]
assert reduce_time(t) == 1
def test_reduce_time_to_single_value_from_list_DurationWrapper():
t = [DurationWrapper(1) for i in range(3)]
t = 3 * [dt.timedelta(seconds=1)]
assert reduce_time(t) == 1
@ -87,12 +83,6 @@ def test_all_equal_str_fails():
assert all_equal('aaab') == False
def test_all_equal_DurationWrapper():
assert all_equal([DurationWrapper(1), DurationWrapper(1)])
def test_all_equal_DurationWrapper_fail():
assert not all_equal([DurationWrapper(1), DurationWrapper(2)])
def test_element_if_equal_int():
assert element_if_equal([5, 5]) == 5
@ -351,33 +341,4 @@ def test_merge_args_tuple():
assert merge_args(*("a", "b"), 5) == ("a", "b", 5)
def test_merge_args_dict_with_tuple():
assert merge_args({0: (1,2)}, 3) == ({0: (1,2,3)},)
def test_hostname_to_list():
s = "localhost"
r = hostname_list(s)
assert r == [s]
def test_hostname_to_list_passthrough():
args = ["localhost"]
ret = hostname_list(args)
assert ret == args
args = ("localhost",)
ret = hostname_list(args)
assert ret == args
def test_splitting_hostname():
args = 'apple+banana+pear+'
ret = hostname_list(args)
assert ret == ['apple', 'banana', 'pear']
#not sensitive to trailing +
args = 'apple+banana+pear'
ret = hostname_list(args)
assert ret == ['apple', 'banana', 'pear']
def test_hostame_throws_on_wrong_args():
with pytest.raises(Exception) as e:
hostname_list(5)
assert merge_args({0: (1,2)}, 3) == ({0: (1,2,3)},)

View File

@ -0,0 +1 @@
../slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv6.1.0

View File

@ -1 +0,0 @@
../slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv7.0.0.rc1

View File

@ -0,0 +1 @@
../slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServerv6.1.0

View File

@ -1 +0,0 @@
../slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServerv7.0.0.rc1

View File

@ -0,0 +1 @@
../slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv6.1.0

View File

@ -1 +0,0 @@
../slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv7.0.0.rc1

View File

@ -0,0 +1 @@
../slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServerv6.1.0

View File

@ -1 +0,0 @@
../slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServerv7.0.0.rc2

View File

@ -0,0 +1 @@
../slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv6.1.0

View File

@ -1 +0,0 @@
../slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv7.0.0.rc1

View File

@ -0,0 +1 @@
../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv6.1.0

View File

@ -1 +0,0 @@
../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv7.0.0.rc1

View File

@ -0,0 +1 @@
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv6.1.0

View File

@ -1 +0,0 @@
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv7.0.0.rc2

View File

@ -333,20 +333,20 @@ int main(int argc, char *argv[]) {
// uint32_t dynamicRange = 0;
// infinite loop
uint32_t packetNumber = 0;
uint64_t detSpec1 = 0;
uint64_t bunchId = 0;
uint64_t timestamp = 0;
int16_t modId = 0;
uint32_t expLength = 0;
uint16_t xCoord = 0;
uint16_t yCoord = 0;
// uint16_t zCoord = 0;
uint32_t detSpec3 = 0;
uint32_t debug = 0;
// uint32_t dr = 16;
// int16_t *dout;//=new int16_t [nnx*nny];
uint32_t dr = 32;
int32_t *dout = NULL; //=new int32_t [nnx*nny];
float *doutf = NULL; //=new int32_t [nnx*nny];
uint16_t detSpec4 = 0;
uint16_t roundRNumber = 0;
uint8_t detType = 0;
uint8_t version = 0;
string additionalJsonHeader = "";
@ -555,9 +555,9 @@ int main(int argc, char *argv[]) {
// zmqsocket2->SendHeaderData (0,
// false,SLS_DETECTOR_JSON_HEADER_VERSION , dr,
// fileindex, 1,1,nnx,nny,nnx*nny*dr/8,acqIndex,
// frameIndex, fname,acqIndex,0 , packetNumber,detSpec1,
// timestamp, modId,xCoord, yCoord, zCoord,detSpec3,
// detSpec4, detType, version, 0,0,
// frameIndex, fname,acqIndex,0 , packetNumber,bunchId,
// timestamp, modId,xCoord, yCoord, zCoord,debug,
// roundRNumber, detType, version, 0,0,
// 0,&additionalJsonHeader);
outHeader.data = true;
@ -574,13 +574,13 @@ int main(int argc, char *argv[]) {
outHeader.frameNumber = acqIndex;
outHeader.expLength = expLength;
outHeader.packetNumber = packetNumber;
outHeader.detSpec1 = detSpec1;
outHeader.bunchId = bunchId;
outHeader.timestamp = timestamp;
outHeader.modId = modId;
outHeader.row = xCoord;
outHeader.column = yCoord;
outHeader.detSpec3 = detSpec3;
outHeader.detSpec4 = detSpec4;
outHeader.debug = debug;
outHeader.roundRNumber = roundRNumber;
outHeader.detType = detType;
outHeader.version = version;
@ -634,11 +634,11 @@ int main(int argc, char *argv[]) {
expLength = zHeader.expLength; // doc["expLength"].GetUint();
packetNumber =
zHeader.packetNumber; // doc["packetNumber"].GetUint();
detSpec1 = zHeader.detSpec1; // doc["detSpec1"].GetUint();
bunchId = zHeader.bunchId; // doc["bunchId"].GetUint();
timestamp = zHeader.timestamp; // doc["timestamp"].GetUint();
modId = zHeader.modId; // doc["modId"].GetUint();
detSpec3 = zHeader.detSpec3; // doc["detSpec3"].GetUint();
// detSpec4=r.detSpec4;//doc["detSpec4"].GetUint();
debug = zHeader.debug; // doc["debug"].GetUint();
// roundRNumber=r.roundRNumber;//doc["roundRNumber"].GetUint();
detType = zHeader.detType; // doc["detType"].GetUint();
version = zHeader.version; // doc["version"].GetUint();
/*document["bitmode"].GetUint(); zHeader.dynamicRange
@ -815,11 +815,11 @@ int main(int argc, char *argv[]) {
// subFrameIndex = doc["expLength"].GetUint();
// detSpec1=doc["detSpec1"].GetUint();
// bunchId=doc["bunchId"].GetUint();
// timestamp=doc["timestamp"].GetUint();
packetNumber = zHeader.packetNumber; // doc["packetNumber"].GetUint();
// cout << acqIndex << " " << frameIndex << " " << subFrameIndex << "
// "<< detSpec1 << " " << timestamp << " " << packetNumber << endl;
// "<< bunchId << " " << timestamp << " " << packetNumber << endl;
// cprintf(GREEN, "frame\n");
if (packetNumber >= 40) {
//*((int*)buff)=frameIndex;
@ -902,15 +902,15 @@ int main(int argc, char *argv[]) {
// zmqsocket2->SendHeaderData (0,
// false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex,
// 1,1,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0
// , packetNumber,detSpec1, timestamp, modId,xCoord, yCoord,
// zCoord,detSpec3, detSpec4, detType, version, 0,0,
// , packetNumber,bunchId, timestamp, modId,xCoord, yCoord,
// zCoord,debug, roundRNumber, detType, version, 0,0,
// 0,&additionalJsonHeader);
// zmqsocket2->SendHeaderData (0,
// false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex,
// 1,1,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0
// , packetNumber,detSpec1, timestamp, modId,xCoord, yCoord,
// zCoord,detSpec3, detSpec4, detType, version, 0,0,
// , packetNumber,bunchId, timestamp, modId,xCoord, yCoord,
// zCoord,debug, roundRNumber, detType, version, 0,0,
// 0,&additionalJsonHeader);
outHeader.data = true;
@ -927,13 +927,13 @@ int main(int argc, char *argv[]) {
outHeader.frameNumber = acqIndex;
outHeader.expLength = expLength;
outHeader.packetNumber = packetNumber;
outHeader.detSpec1 = detSpec1;
outHeader.bunchId = bunchId;
outHeader.timestamp = timestamp;
outHeader.modId = modId;
outHeader.row = xCoord;
outHeader.column = yCoord;
outHeader.detSpec3 = detSpec3;
outHeader.detSpec4 = detSpec4;
outHeader.debug = debug;
outHeader.roundRNumber = roundRNumber;
outHeader.detType = detType;
outHeader.version = version;

View File

@ -5,9 +5,9 @@
#include "qVersionResolve.h"
#include "sls/logger.h"
// Suppressing warning until qwt has a fix, avoid
// patching and should be backwards compatible
// https://doc.qt.io/qt-5/qflags-obsolete.html
//Suppressing warning until qwt has a fix, avoid
//patching and should be backwards compatible
//https://doc.qt.io/qt-5/qflags-obsolete.html
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <qlist.h>

View File

@ -116,9 +116,7 @@ void basictests() {
return;
}
#endif
char hversion[MAX_STR_LENGTH] = {0};
memset(hversion, 0, MAX_STR_LENGTH);
getHardwareVersion(hversion);
uint16_t hversion = getHardwareVersionNumber();
uint16_t hsnumber = getHardwareSerialNumber();
uint32_t ipadd = getDetectorIP();
uint64_t macadd = getDetectorMAC();
@ -132,7 +130,7 @@ void basictests() {
sw_fw_apiversion = getFirmwareAPIVersion();
LOG(logINFOBLUE,
("**************************************************\n"
"Hardware Version:\t\t %s\n"
"Hardware Version:\t\t 0x%x\n"
"Hardware Serial Nr:\t\t 0x%x\n"
"Detector IP Addr:\t\t 0x%x\n"
@ -343,24 +341,9 @@ uint64_t getFirmwareAPIVersion() {
return ((bus_r(API_VERSION_REG) & API_VERSION_MSK) >> API_VERSION_OFST);
}
void getHardwareVersion(char *version) {
strcpy(version, "unknown");
int hwversion = getHardwareVersionNumber();
const int hwNumberList[] = HARDWARE_VERSION_NUMBERS;
const char *hwNamesList[] = HARDWARE_VERSION_NAMES;
for (int i = 0; i != NUM_HARDWARE_VERSIONS; ++i) {
LOG(logDEBUG, ("0x%x %d 0x%x %s\n", hwversion, i, hwNumberList[i],
hwNamesList[i]));
if (hwNumberList[i] == hwversion) {
strcpy(version, hwNamesList[i]);
return;
}
}
}
uint16_t getHardwareVersionNumber() {
#ifdef VIRTUAL
return 0x3f;
return 0;
#endif
return ((bus_r(MOD_SERIAL_NUMBER_REG) & MOD_SERIAL_NUMBER_VRSN_MSK) >>
MOD_SERIAL_NUMBER_VRSN_OFST);
@ -2066,7 +2049,7 @@ void *start_timer(void *arg) {
// set header
sls_detector_header *header = (sls_detector_header *)(packetData);
header->detType = (uint16_t)myDetectorType;
header->version = SLS_DETECTOR_HEADER_VERSION;
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
header->frameNumber = frameNr + iframes;
header->packetNumber = i;
header->modId = 0;

View File

@ -5,92 +5,12 @@
#include "sls/sls_detector_defs.h"
#define MIN_REQRD_VRSN_T_RD_API 0x181130
#define REQRD_FRMWR_VRSN 0x221205
#define NUM_HARDWARE_VERSIONS (1)
#define HARDWARE_VERSION_NUMBERS \
{ 0x3f }
#define HARDWARE_VERSION_NAMES \
{ "5.1" }
#define REQRD_FRMWR_VRSN 0x220825
#define LINKED_SERVER_NAME "ctbDetectorServer"
#define CTRL_SRVR_INIT_TIME_US (2 * 1000 * 1000)
/* Hardware Definitions */
#define NCHAN (36)
#define NCHAN_ANALOG (32)
#define NCHAN_DIGITAL (64)
#define NCHIP (1)
#define NDAC (24)
#define NPWR (6)
#define NDAC_ONLY (NDAC - NPWR)
#define DYNAMIC_RANGE (16)
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8)
#define CLK_FREQ (156.25) // MHz
#define I2C_POWER_VIO_DEVICE_ID (0x40)
#define I2C_POWER_VA_DEVICE_ID (0x41)
#define I2C_POWER_VB_DEVICE_ID (0x42)
#define I2C_POWER_VC_DEVICE_ID (0x43)
#define I2C_POWER_VD_DEVICE_ID (0x44)
#define I2C_SHUNT_RESISTER_OHMS (0.005)
/** Default Parameters */
#define DEFAULT_DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL)
#define DEFAULT_STARTING_FRAME_NUMBER (1)
#define DEFAULT_NUM_SAMPLES (1)
#define DEFAULT_NUM_FRAMES (1)
#define DEFAULT_EXPTIME (0)
#define DEFAULT_NUM_CYCLES (1)
#define DEFAULT_PERIOD (1 * 1000 * 1000) // ns
#define DEFAULT_DELAY (0)
#define DEFAULT_HIGH_VOLTAGE (0)
#define DEFAULT_VLIMIT (-100)
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
#define DEFAULT_TX_UDP_PORT (0x7e9a)
#define DEFAULT_RUN_CLK (200) // 40
#define DEFAULT_ADC_CLK (40) // 20
#define DEFAULT_SYNC_CLK (40) // 20
#define DEFAULT_DBIT_CLK (200)
#define UDP_HEADER_MAX_FRAME_VALUE (0xFFFFFFFFFFFF)
#define HIGHVOLTAGE_MIN (60)
#define HIGHVOLTAGE_MAX (200) // min dac val
#define DAC_MIN_MV (0)
#define DAC_MAX_MV (2500)
#define VCHIP_MIN_MV (1673)
#define VCHIP_MAX_MV (2668) // min dac val
#define POWER_RGLTR_MIN (636)
#define POWER_RGLTR_MAX \
(2638) // min dac val (not vchip-max) because of dac conversions
#define VCHIP_POWER_INCRMNT (200)
#define VIO_MIN_MV (1200) // for fpga to function
/* Defines in the Firmware */
#define DIGITAL_IO_DELAY_MAXIMUM_PS \
((OUTPUT_DELAY_0_OTPT_STTNG_MSK >> OUTPUT_DELAY_0_OTPT_STTNG_OFST) * \
OUTPUT_DELAY_0_OTPT_STTNG_STEPS)
#define MAX_PHASE_SHIFTS_STEPS (8)
#define WAIT_TME_US_FR_ACQDONE_REG \
(100) // wait time in us after acquisition done to ensure there is no data
// in fifo
#define WAIT_TIME_US_PLL (10 * 1000)
#define WAIT_TIME_US_STP_ACQ (100)
#define WAIT_TIME_CONFIGURE_MAC (2 * 1000 * 1000)
#define WAIT_TIME_PATTERN_READ (10)
#define WAIT_TIME_1US_FOR_LOOP_CNT (50) // around 30 is 1 us in blackfin
/* MSB & LSB DEFINES */
#define MSB_OF_64_BIT_REG_OFST (32)
#define LSB_OF_64_BIT_REG_OFST (0)
#define BIT32_MSK (0xFFFFFFFF)
#define BIT16_MASK (0xFFFF)
#define MAXIMUM_ADC_CLK (65)
#define PLL_VCO_FREQ_MHZ (800)
/* Struct Definitions */
typedef struct udp_header_struct {
uint32_t udp_destmac_msb;
@ -168,3 +88,77 @@ enum DACINDEX {
};
enum CLKINDEX { RUN_CLK, ADC_CLK, SYNC_CLK, DBIT_CLK, NUM_CLOCKS };
#define CLK_NAMES "run", "adc", "sync", "dbit"
/* Hardware Definitions */
#define NCHAN (36)
#define NCHAN_ANALOG (32)
#define NCHAN_DIGITAL (64)
#define NCHIP (1)
#define NDAC (24)
#define NPWR (6)
#define NDAC_ONLY (NDAC - NPWR)
#define DYNAMIC_RANGE (16)
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8)
#define CLK_FREQ (156.25) // MHz
#define I2C_POWER_VIO_DEVICE_ID (0x40)
#define I2C_POWER_VA_DEVICE_ID (0x41)
#define I2C_POWER_VB_DEVICE_ID (0x42)
#define I2C_POWER_VC_DEVICE_ID (0x43)
#define I2C_POWER_VD_DEVICE_ID (0x44)
#define I2C_SHUNT_RESISTER_OHMS (0.005)
/** Default Parameters */
#define DEFAULT_DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL)
#define DEFAULT_STARTING_FRAME_NUMBER (1)
#define DEFAULT_NUM_SAMPLES (1)
#define DEFAULT_NUM_FRAMES (1)
#define DEFAULT_EXPTIME (0)
#define DEFAULT_NUM_CYCLES (1)
#define DEFAULT_PERIOD (1 * 1000 * 1000) // ns
#define DEFAULT_DELAY (0)
#define DEFAULT_HIGH_VOLTAGE (0)
#define DEFAULT_VLIMIT (-100)
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
#define DEFAULT_TX_UDP_PORT (0x7e9a)
#define DEFAULT_RUN_CLK (200) // 40
#define DEFAULT_ADC_CLK (40) // 20
#define DEFAULT_SYNC_CLK (40) // 20
#define DEFAULT_DBIT_CLK (200)
#define UDP_HEADER_MAX_FRAME_VALUE (0xFFFFFFFFFFFF)
#define HIGHVOLTAGE_MIN (60)
#define HIGHVOLTAGE_MAX (200) // min dac val
#define DAC_MIN_MV (0)
#define DAC_MAX_MV (2500)
#define VCHIP_MIN_MV (1673)
#define VCHIP_MAX_MV (2668) // min dac val
#define POWER_RGLTR_MIN (636)
#define POWER_RGLTR_MAX \
(2638) // min dac val (not vchip-max) because of dac conversions
#define VCHIP_POWER_INCRMNT (200)
#define VIO_MIN_MV (1200) // for fpga to function
/* Defines in the Firmware */
#define DIGITAL_IO_DELAY_MAXIMUM_PS \
((OUTPUT_DELAY_0_OTPT_STTNG_MSK >> OUTPUT_DELAY_0_OTPT_STTNG_OFST) * \
OUTPUT_DELAY_0_OTPT_STTNG_STEPS)
#define MAX_PHASE_SHIFTS_STEPS (8)
#define WAIT_TME_US_FR_ACQDONE_REG \
(100) // wait time in us after acquisition done to ensure there is no data
// in fifo
#define WAIT_TIME_US_PLL (10 * 1000)
#define WAIT_TIME_US_STP_ACQ (100)
#define WAIT_TIME_CONFIGURE_MAC (2 * 1000 * 1000)
#define WAIT_TIME_PATTERN_READ (10)
#define WAIT_TIME_1US_FOR_LOOP_CNT (50) // around 30 is 1 us in blackfin
/* MSB & LSB DEFINES */
#define MSB_OF_64_BIT_REG_OFST (32)
#define LSB_OF_64_BIT_REG_OFST (0)
#define BIT32_MSK (0xFFFFFFFF)
#define BIT16_MASK (0xFFFF)
#define MAXIMUM_ADC_CLK (65)
#define PLL_VCO_FREQ_MHZ (800)

View File

@ -113,9 +113,7 @@ void basictests() {
return;
}
#endif
char hversion[MAX_STR_LENGTH] = {0};
memset(hversion, 0, MAX_STR_LENGTH);
getHardwareVersion(hversion);
uint16_t hversion = getHardwareVersionNumber();
uint32_t ipadd = getDetectorIP();
uint64_t macadd = getDetectorMAC();
int64_t fwversion = getFirmwareVersion();
@ -127,7 +125,7 @@ void basictests() {
LOG(logINFOBLUE,
("**************************************************\n"
"Hardware Version:\t\t %s\n"
"Hardware Version:\t\t 0x%x\n"
"Detector IP Addr:\t\t 0x%x\n"
"Detector MAC Addr:\t\t 0x%llx\n\n"
@ -269,34 +267,14 @@ u_int64_t getFirmwareAPIVersion() {
return ((bus_r(API_VERSION_REG) & API_VERSION_MSK) >> API_VERSION_OFST);
}
void getHardwareVersion(char *version) {
strcpy(version, "unknown");
int hwversion = getHardwareVersionNumber();
const int hwNumberList[] = HARDWARE_VERSION_NUMBERS;
const char *hwNamesList[] = HARDWARE_VERSION_NAMES;
for (int i = 0; i != NUM_HARDWARE_VERSIONS; ++i) {
LOG(logDEBUG, ("0x%x %d 0x%x %s\n", hwversion, i, hwNumberList[i],
hwNamesList[i]));
if (hwNumberList[i] == hwversion) {
strcpy(version, hwNamesList[i]);
return;
}
}
}
u_int16_t getHardwareVersionNumber() {
#ifdef VIRTUAL
return 0x2;
return 0;
#endif
return ((bus_r(MCB_SERIAL_NO_REG) & MCB_SERIAL_NO_VRSN_MSK) >>
MCB_SERIAL_NO_VRSN_OFST);
}
int isHardwareVersion_1_0() {
const int hwNumberList[] = HARDWARE_VERSION_NUMBERS;
return ((getHardwareVersionNumber() == hwNumberList[0]) ? 1 : 0);
}
u_int32_t getDetectorNumber() {
#ifdef VIRTUAL
return 0;
@ -3334,7 +3312,7 @@ void *start_timer(void *arg) {
// set header
sls_detector_header *header = (sls_detector_header *)(packetData);
header->detType = (uint16_t)myDetectorType;
header->version = SLS_DETECTOR_HEADER_VERSION;
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
header->frameNumber = virtual_currentFrameNumber;
header->packetNumber = 0;
header->modId = virtual_moduleid;

View File

@ -3,15 +3,10 @@
#pragma once
#include "sls/sls_detector_defs.h"
#define REQRD_FRMWRE_VRSN (0x221123)
#define REQRD_FRMWRE_VRSN (0x220901)
#define KERNEL_DATE_VRSN "Mon May 10 18:00:21 CEST 2021"
#define ID_FILE "detid_gotthard2.txt"
#define NUM_HARDWARE_VERSIONS (2)
#define HARDWARE_VERSION_NUMBERS {0x0, 0x2};
#define HARDWARE_VERSION_NAMES \
{ "1.0", "1.2" }
#define LINKED_SERVER_NAME "gotthard2DetectorServer"
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)

View File

@ -103,9 +103,7 @@ void basictests() {
return;
}
#endif
char hversion[MAX_STR_LENGTH] = {0};
memset(hversion, 0, MAX_STR_LENGTH);
getHardwareVersion(hversion);
uint32_t boardrev = getBoardRevision();
uint32_t ipadd = getDetectorIP();
uint64_t macadd = getDetectorMAC();
int64_t fwversion = getFirmwareVersion();
@ -115,7 +113,7 @@ void basictests() {
LOG(logINFOBLUE,
("**************************************************\n"
"Hardware Revision : %s\n"
"Board Revision : 0x%x\n"
"Detector IP Addr : 0x%x\n"
"Detector MAC Addr : 0x%llx\n\n"
@ -123,7 +121,7 @@ void basictests() {
"Firmware Version : 0x%llx\n"
"Software Version : %s\n"
"********************************************************\n",
hversion,
boardrev,
ipadd, (long long unsigned int)macadd,
@ -337,34 +335,14 @@ u_int32_t getDetectorIP() {
return res;
}
void getHardwareVersion(char *version) {
strcpy(version, "unknown");
int hwversion = getHardwareVersionNumber();
const int hwNumberList[] = HARDWARE_VERSION_NUMBERS;
const char *hwNamesList[] = HARDWARE_VERSION_NAMES;
for (int i = 0; i != NUM_HARDWARE_VERSIONS; ++i) {
LOG(logDEBUG, ("0x%x %d 0x%x %s\n", hwversion, i, hwNumberList[i],
hwNamesList[i]));
if (hwNumberList[i] == hwversion) {
strcpy(version, hwNamesList[i]);
return;
}
}
}
u_int16_t getHardwareVersionNumber() {
u_int32_t getBoardRevision() {
#ifdef VIRTUAL
return 0x2;
return 0;
#endif
return ((bus_r(BOARD_REVISION_REG) & BOARD_REVISION_MSK) >>
BOARD_REVISION_OFST);
}
int isHardwareVersion_1_0() {
const int hwNumberList[] = HARDWARE_VERSION_NUMBERS;
return ((getHardwareVersionNumber() == hwNumberList[0]) ? 1 : 0);
}
/* initialization */
void initControlServer() {
@ -416,7 +394,7 @@ void setupDetector() {
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
// adc
if (isHardwareVersion_1_0()) {
if (getBoardRevision() == 1) {
AD9252_SetDefines(ADC_SPI_REG, ADC_SPI_SRL_CS_OTPT_MSK,
ADC_SPI_SRL_CLK_OTPT_MSK, ADC_SPI_SRL_DT_OTPT_MSK,
ADC_SPI_SRL_DT_OTPT_OFST);
@ -601,7 +579,7 @@ void setDAQRegister() {
// 0x1f16(board rev 1) 0x1f0f(board rev 2)
u_int32_t tokenTiming =
((isHardwareVersion_1_0()) ? DAQ_TKN_TMNG_BRD_RVSN_1_VAL
((getBoardRevision() == 1) ? DAQ_TKN_TMNG_BRD_RVSN_1_VAL
: DAQ_TKN_TMNG_BRD_RVSN_2_VAL);
// 0x13f(no roi), 0x7f(roi)
@ -1007,9 +985,7 @@ int setDelayAfterTrigger(int64_t val) {
// validate for tolerance
int64_t retval = getDelayAfterTrigger();
val /= (1E-9 * CLK_FREQ);
if (master) {
val -= masterdefaultdelay;
}
val -= masterdefaultdelay;
if (val != retval) {
return FAIL;
}

View File

@ -4,12 +4,6 @@
#include "sls/sls_detector_defs.h"
#include <stdlib.h>
#define NUM_HARDWARE_VERSIONS (2)
#define HARDWARE_VERSION_NUMBERS \
{ 0x1, 0x2 }
#define HARDWARE_VERSION_NAMES \
{ "1.0", "2.0" }
#define LINKED_SERVER_NAME "gotthardDetectorServer"
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)

View File

@ -42,4 +42,3 @@ install(TARGETS jungfrauDetectorServer_virtual
)
configure_file(config_jungfrau.txt ${CMAKE_BINARY_DIR}/bin/config_jungfrau.txt COPYONLY)
configure_file(detid_jungfrau.txt ${CMAKE_BINARY_DIR}/bin/detid_jungfrau.txt COPYONLY)

View File

@ -37,7 +37,6 @@ $(PROGS): $(OBJS)
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
mv $(PROGS) $(DESTDIR)
cp config_jungfrau.txt $(DESTDIR)
cp detid_jungfrau.txt $(DESTDIR)
rm *.gdb
rm $(main_src)*.o $(md5_dir)*.o

View File

@ -61,6 +61,7 @@
#define HARDWARE_SERIAL_NUM_MSK (0x000000FF << HARDWARE_SERIAL_NUM_OFST)
#define HARDWARE_VERSION_NUM_OFST (16)
#define HARDWARE_VERSION_NUM_MSK (0x0000003F << HARDWARE_VERSION_NUM_OFST)
#define HARDWARE_VERSION_2_VAL ((0x2 << HARDWARE_VERSION_NUM_OFST) & HARDWARE_VERSION_NUM_MSK)
/* API Version Register */
#define API_VERSION_REG (0x0F << MEM_MAP_SHIFT)
@ -439,11 +440,13 @@ Time before end of exposure when comparator is disabled */
#define COORD_COL_INNER_OFST (16)
#define COORD_COL_INNER_MSK (0x0000FFFF << COORD_COL_INNER_OFST)
/** Module ID coordinates */
#define MOD_ID_REG (0x7E << MEM_MAP_SHIFT)
/** Module column coordinates */
#define COORD_RESERVED_REG (0x7E << MEM_MAP_SHIFT)
#define MOD_ID_OFST (0)
#define MOD_ID_MSK (0x0000FFFF << MOD_ID_OFST)
#define COORD_RESERVED_OUTER_OFST (0)
#define COORD_RESERVED_OUTER_MSK (0x0000FFFF << COORD_RESERVED_OUTER_OFST)
#define COORD_RESERVED_INNER_OFST (16)
#define COORD_RESERVED_INNER_MSK (0x0000FFFF << COORD_RESERVED_INNER_OFST)
/* ASIC Control Register */
#define ASIC_CTRL_REG (0x7F << MEM_MAP_SHIFT)

View File

@ -42,7 +42,6 @@ char initErrorMessage[MAX_STR_LENGTH];
#ifdef VIRTUAL
pthread_t pthread_virtual_tid;
int virtual_image_test_mode = 0;
int virtual_moduleid = 0;
#endif
enum detectorSettings thisSettings = UNINITIALIZED;
@ -98,9 +97,7 @@ void basictests() {
return;
}
#endif
char hversion[MAX_STR_LENGTH] = {0};
memset(hversion, 0, MAX_STR_LENGTH);
getHardwareVersion(hversion);
uint16_t hversion = getHardwareVersionNumber();
uint16_t hsnumber = getHardwareSerialNumber();
uint32_t ipadd = getDetectorIP();
uint64_t macadd = getDetectorMAC();
@ -110,15 +107,14 @@ void basictests() {
getServerVersion(swversion);
int64_t sw_fw_apiversion = 0;
uint32_t requiredFirmwareVersion =
(isHardwareVersion_1_0() ? REQRD_FRMWRE_VRSN_BOARD2
: REQRD_FRMWRE_VRSN);
(isHardwareVersion2() ? REQRD_FRMWRE_VRSN_BOARD2 : REQRD_FRMWRE_VRSN);
if (fwversion >= MIN_REQRD_VRSN_T_RD_API)
sw_fw_apiversion = getFirmwareAPIVersion();
LOG(logINFOBLUE,
("************ Jungfrau Server *********************\n"
"Hardware Version:\t\t %s\n"
"Hardware Version:\t\t 0x%x\n"
"Hardware Serial Nr:\t\t 0x%x\n"
"Detector IP Addr:\t\t 0x%x\n"
@ -277,24 +273,9 @@ u_int64_t getFirmwareAPIVersion() {
return ((bus_r(API_VERSION_REG) & API_VERSION_MSK) >> API_VERSION_OFST);
}
void getHardwareVersion(char *version) {
strcpy(version, "unknown");
int hwversion = getHardwareVersionNumber();
const int hwNumberList[] = HARDWARE_VERSION_NUMBERS;
const char *hwNamesList[] = HARDWARE_VERSION_NAMES;
for (int i = 0; i != NUM_HARDWARE_VERSIONS; ++i) {
LOG(logDEBUG, ("0x%x %d 0x%x %s\n", hwversion, i, hwNumberList[i],
hwNamesList[i]));
if (hwNumberList[i] == hwversion) {
strcpy(version, hwNamesList[i]);
return;
}
}
}
u_int16_t getHardwareVersionNumber() {
#ifdef VIRTUAL
return 0x3;
return 0;
#endif
return ((bus_r(MOD_SERIAL_NUM_REG) & HARDWARE_VERSION_NUM_MSK) >>
HARDWARE_VERSION_NUM_OFST);
@ -308,9 +289,15 @@ u_int16_t getHardwareSerialNumber() {
HARDWARE_SERIAL_NUM_OFST);
}
int isHardwareVersion_1_0() {
const int hwNumberList[] = HARDWARE_VERSION_NUMBERS;
return ((getHardwareVersionNumber() == hwNumberList[0]) ? 1 : 0);
// is board 1.0?, with value 2 (resistor network)
int isHardwareVersion2() {
#ifdef VIRTUAL
return 0;
#endif
return (((bus_r(MOD_SERIAL_NUM_REG) & HARDWARE_VERSION_NUM_MSK) ==
HARDWARE_VERSION_2_VAL)
? 1
: 0);
}
int getChipVersion() {
@ -339,29 +326,6 @@ u_int32_t getDetectorNumber() {
return bus_r(MOD_SERIAL_NUM_REG);
}
int getModuleId(int *ret, char *mess) {
return ((bus_r(MOD_ID_REG) & MOD_ID_MSK) >> MOD_ID_OFST);
}
void setModuleId(int modid) {
LOG(logINFOBLUE, ("Setting module id in fpga: %d\n", modid));
bus_w(MOD_ID_REG, bus_r(MOD_ID_REG) & ~MOD_ID_MSK);
bus_w(MOD_ID_REG,
bus_r(MOD_ID_REG) | ((modid << MOD_ID_OFST) & MOD_ID_MSK));
}
int updateModuleId() {
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
if (initError == FAIL) {
return FAIL;
}
#ifdef VIRTUAL
virtual_moduleid = modid;
#endif
setModuleId(modid);
return OK;
}
u_int64_t getDetectorMAC() {
#ifdef VIRTUAL
return 0;
@ -505,10 +469,6 @@ void setupDetector() {
return;
}
if (updateModuleId() == FAIL) {
return;
}
setReadoutSpeed(HALF_SPEED);
cleanFifos();
resetCore();
@ -516,8 +476,8 @@ void setupDetector() {
alignDeserializer();
configureASICTimer();
bus_w(ADC_PORT_INVERT_REG,
(isHardwareVersion_1_0() ? ADC_PORT_INVERT_BOARD2_VAL
: ADC_PORT_INVERT_VAL));
(isHardwareVersion2() ? ADC_PORT_INVERT_BOARD2_VAL
: ADC_PORT_INVERT_VAL));
initReadoutConfiguration();
@ -549,7 +509,7 @@ void setupDetector() {
setFilterResistor(DEFAULT_FILTER_RESISTOR);
setNumberOfFilterCells(DEFAULT_FILTER_CELL);
}
if (!isHardwareVersion_1_0()) {
if (!isHardwareVersion2()) {
setFlipRows(DEFAULT_FLIP_ROWS);
setReadNRows(MAX_ROWS_PER_READOUT);
}
@ -788,11 +748,11 @@ int readConfigFile() {
version, line);
break;
}
// chipversion 1.1 and HW 1.0 is incompatible
if (version == 11 && isHardwareVersion_1_0()) {
// version 1.1 and HW 1.0 (version reg value = 2) is incompatible
if (version == 11 && isHardwareVersion2()) {
strcpy(initErrorMessage,
"Chip version 1.1 (from on-board config file) is "
"incompatible with hardware version v1.0. Please update "
"incompatible with old board (v1.0). Please update "
"board or correct on-board config file.\n");
break;
}
@ -867,9 +827,8 @@ int getDynamicRange(int *retval) {
void setADCInvertRegister(uint32_t val) {
LOG(logINFO, ("Setting ADC Port Invert Reg to 0x%x\n", val));
uint32_t defaultValue =
(isHardwareVersion_1_0() ? ADC_PORT_INVERT_BOARD2_VAL
: ADC_PORT_INVERT_VAL);
uint32_t defaultValue = (isHardwareVersion2() ? ADC_PORT_INVERT_BOARD2_VAL
: ADC_PORT_INVERT_VAL);
uint32_t changeValue = defaultValue ^ val;
LOG(logINFO, ("\t default: 0x%x, final:0x%x\n", defaultValue, changeValue));
bus_w(ADC_PORT_INVERT_REG, changeValue);
@ -877,8 +836,8 @@ void setADCInvertRegister(uint32_t val) {
uint32_t getADCInvertRegister() {
uint32_t readValue = bus_r(ADC_PORT_INVERT_REG);
int32_t defaultValue = (isHardwareVersion_1_0() ? ADC_PORT_INVERT_BOARD2_VAL
: ADC_PORT_INVERT_VAL);
int32_t defaultValue = (isHardwareVersion2() ? ADC_PORT_INVERT_BOARD2_VAL
: ADC_PORT_INVERT_VAL);
uint32_t val = defaultValue ^ readValue;
LOG(logDEBUG1, ("\tread:0x%x, default:0x%x returned:0x%x\n", readValue,
defaultValue, val));
@ -1792,9 +1751,9 @@ int setReadNRows(int value) {
LOG(logERROR, ("Invalid number of rows %d\n", value));
return FAIL;
}
if (isHardwareVersion_1_0()) {
if (isHardwareVersion2()) {
LOG(logERROR, ("Could not set number of rows. Only available for "
"Hardware Board version v2.0.\n"));
"Hardware Board version 2.0.\n"));
return FAIL;
}
@ -1817,7 +1776,7 @@ int setReadNRows(int value) {
int getReadNRows() {
// cannot set it in old board
if (isHardwareVersion_1_0()) {
if (isHardwareVersion2()) {
return MAX_ROWS_PER_READOUT;
}
int enable = (bus_r(READ_N_ROWS_REG) & READ_N_ROWS_ENBL_MSK);
@ -1990,7 +1949,7 @@ int setReadoutSpeed(int val) {
switch (val) {
case FULL_SPEED:
if (isHardwareVersion_1_0()) {
if (isHardwareVersion2()) {
LOG(logERROR, ("Cannot set full speed. Should not be here\n"));
return FAIL;
}
@ -2011,7 +1970,7 @@ int setReadoutSpeed(int val) {
case HALF_SPEED:
LOG(logINFO, ("Setting Half Speed (20 MHz):\n"));
if (isHardwareVersion_1_0()) {
if (isHardwareVersion2()) {
adcOfst = ADC_OFST_HALF_SPEED_BOARD2_VAL;
sampleAdcSpeed = SAMPLE_ADC_HALF_SPEED_BOARD2;
adcPhase = ADC_PHASE_HALF_SPEED_BOARD2;
@ -2032,7 +1991,7 @@ int setReadoutSpeed(int val) {
case QUARTER_SPEED:
LOG(logINFO, ("Setting Half Speed (10 MHz):\n"));
if (isHardwareVersion_1_0()) {
if (isHardwareVersion2()) {
adcOfst = ADC_OFST_QUARTER_SPEED_BOARD2_VAL;
sampleAdcSpeed = SAMPLE_ADC_QUARTER_SPEED_BOARD2;
adcPhase = ADC_PHASE_QUARTER_SPEED_BOARD2;
@ -2292,7 +2251,7 @@ int getFlipRows() {
}
void setFlipRows(int arg) {
if (isHardwareVersion_1_0()) {
if (isHardwareVersion2()) {
LOG(logERROR, ("Could not set flip rows. Only available for "
"Hardware Board version 2.0.\n"));
return;
@ -2686,10 +2645,10 @@ void *start_timer(void *arg) {
sls_detector_header *header =
(sls_detector_header *)(packetData);
header->detType = (uint16_t)myDetectorType;
header->version = SLS_DETECTOR_HEADER_VERSION;
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
header->frameNumber = frameNr + iframes;
header->packetNumber = pnum;
header->modId = virtual_moduleid;
header->modId = 0;
header->row = row0;
header->column = col0;
@ -2713,10 +2672,10 @@ void *start_timer(void *arg) {
sls_detector_header *header =
(sls_detector_header *)(packetData2);
header->detType = (uint16_t)myDetectorType;
header->version = SLS_DETECTOR_HEADER_VERSION;
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
header->frameNumber = frameNr + iframes;
header->packetNumber = pnum;
header->modId = virtual_moduleid;
header->modId = 0;
header->row = row1;
header->column = col1;

View File

@ -5,20 +5,83 @@
#include "sls/sls_detector_defs.h"
#define MIN_REQRD_VRSN_T_RD_API 0x171220
#define REQRD_FRMWRE_VRSN_BOARD2 0x221104 // 1.0 pcb (version = 010)
#define REQRD_FRMWRE_VRSN 0x221103 // 2.0 pcb (version = 011)
#define REQRD_FRMWRE_VRSN_BOARD2 0x220421 // 1.0 pcb (version = 010)
#define REQRD_FRMWRE_VRSN 0x220422 // 2.0 pcb (version = 011)
#define NUM_HARDWARE_VERSIONS (2)
#define HARDWARE_VERSION_NUMBERS \
{ 0x2, 0x3 }
#define HARDWARE_VERSION_NAMES \
{ "1.0", "2.0" }
#define ID_FILE "detid_jungfrau.txt"
#define LINKED_SERVER_NAME "jungfrauDetectorServer"
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
/* Struct Definitions */
typedef struct udp_header_struct {
uint32_t udp_destmac_msb;
uint16_t udp_srcmac_msb;
uint16_t udp_destmac_lsb;
uint32_t udp_srcmac_lsb;
uint8_t ip_tos;
uint8_t ip_ihl : 4, ip_ver : 4;
uint16_t udp_ethertype;
uint16_t ip_identification;
uint16_t ip_totallength;
uint8_t ip_protocol;
uint8_t ip_ttl;
uint16_t ip_fragmentoffset : 13, ip_flags : 3;
uint16_t ip_srcip_msb;
uint16_t ip_checksum;
uint16_t ip_destip_msb;
uint16_t ip_srcip_lsb;
uint16_t udp_srcport;
uint16_t ip_destip_lsb;
uint16_t udp_checksum;
uint16_t udp_destport;
} udp_header;
#define IP_HEADER_SIZE (20)
#define UDP_IP_HEADER_LENGTH_BYTES (28)
/* Enums */
enum ADCINDEX { TEMP_FPGA, TEMP_ADC };
enum DACINDEX {
J_VB_COMP,
J_VDD_PROT,
J_VIN_COM,
J_VREF_PRECH,
J_VB_PIXBUF,
J_VB_DS,
J_VREF_DS,
J_VREF_COMP
};
#define DAC_NAMES \
"vb_comp", "vdd_prot", "vin_com", "vref_prech", "vb_pixbuf", "vb_ds", \
"vref_ds", "vref_comp"
#define DEFAULT_DAC_VALS \
{ \
1220, /* J_VB_COMP */ \
3000, /* J_VDD_PROT */ \
1053, /* J_VIN_COM */ \
1450, /* J_VREF_PRECH */ \
750, /* J_VB_PIXBUF */ \
1000, /* J_VB_DS */ \
480, /* J_VREF_DS */ \
420 /* J_VREF_COMP */ \
};
enum MASTERINDEX { MASTER_HARDWARE, OW_MASTER, OW_SLAVE };
#define MASTER_NAMES "hardware", "master", "slave"
#define NUMSETTINGS (2)
#define NSPECIALDACS (3)
#define SPECIALDACINDEX {J_VREF_PRECH, J_VREF_DS, J_VREF_COMP};
#define SPECIAL_DEFAULT_DYNAMIC_GAIN_VALS \
{ 1450, 480, 420 }
#define SPECIAL_DEFAULT_DYNAMICHG0_GAIN_VALS \
{ 1550, 450, 620 }
enum NETWORKINDEX { TXN_FRAME, FLOWCTRL_10G };
enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
#define CLK_NAMES "run", "adc", "dbit"
/* Hardware Definitions */
#define NCHAN (256 * 256)
#define NCHIP (8)
@ -144,73 +207,3 @@
#define ADC_OFST_HALF_SPEED_BOARD2_VAL (0x10)
#define ADC_OFST_QUARTER_SPEED_BOARD2_VAL (0x08)
/* Struct Definitions */
typedef struct udp_header_struct {
uint32_t udp_destmac_msb;
uint16_t udp_srcmac_msb;
uint16_t udp_destmac_lsb;
uint32_t udp_srcmac_lsb;
uint8_t ip_tos;
uint8_t ip_ihl : 4, ip_ver : 4;
uint16_t udp_ethertype;
uint16_t ip_identification;
uint16_t ip_totallength;
uint8_t ip_protocol;
uint8_t ip_ttl;
uint16_t ip_fragmentoffset : 13, ip_flags : 3;
uint16_t ip_srcip_msb;
uint16_t ip_checksum;
uint16_t ip_destip_msb;
uint16_t ip_srcip_lsb;
uint16_t udp_srcport;
uint16_t ip_destip_lsb;
uint16_t udp_checksum;
uint16_t udp_destport;
} udp_header;
#define IP_HEADER_SIZE (20)
#define UDP_IP_HEADER_LENGTH_BYTES (28)
/* Enums */
enum ADCINDEX { TEMP_FPGA, TEMP_ADC };
enum DACINDEX {
J_VB_COMP,
J_VDD_PROT,
J_VIN_COM,
J_VREF_PRECH,
J_VB_PIXBUF,
J_VB_DS,
J_VREF_DS,
J_VREF_COMP
};
#define DAC_NAMES \
"vb_comp", "vdd_prot", "vin_com", "vref_prech", "vb_pixbuf", "vb_ds", \
"vref_ds", "vref_comp"
#define DEFAULT_DAC_VALS \
{ \
1220, /* J_VB_COMP */ \
3000, /* J_VDD_PROT */ \
1053, /* J_VIN_COM */ \
1450, /* J_VREF_PRECH */ \
750, /* J_VB_PIXBUF */ \
1000, /* J_VB_DS */ \
480, /* J_VREF_DS */ \
420 /* J_VREF_COMP */ \
};
enum MASTERINDEX { MASTER_HARDWARE, OW_MASTER, OW_SLAVE };
#define MASTER_NAMES "hardware", "master", "slave"
#define NUMSETTINGS (2)
#define NSPECIALDACS (3)
#define SPECIALDACINDEX {J_VREF_PRECH, J_VREF_DS, J_VREF_COMP};
#define SPECIAL_DEFAULT_DYNAMIC_GAIN_VALS \
{ 1450, 480, 420 }
#define SPECIAL_DEFAULT_DYNAMICHG0_GAIN_VALS \
{ 1550, 450, 620 }
enum NETWORKINDEX { TXN_FRAME, FLOWCTRL_10G };
enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
#define CLK_NAMES "run", "adc", "dbit"

View File

@ -120,9 +120,7 @@ void basictests() {
return;
}
#endif
char hversion[MAX_STR_LENGTH] = {0};
memset(hversion, 0, MAX_STR_LENGTH);
getHardwareVersion(hversion);
uint16_t hversion = getHardwareVersionNumber();
uint16_t hsnumber = getHardwareSerialNumber();
uint32_t ipadd = getDetectorIP();
uint64_t macadd = getDetectorMAC();
@ -136,7 +134,7 @@ void basictests() {
sw_fw_apiversion = getFirmwareAPIVersion();
LOG(logINFOBLUE,
("**************************************************\n"
"Hardware Version:\t\t %s\n"
"Hardware Version:\t\t 0x%x\n"
"Hardware Serial Nr:\t\t 0x%x\n"
"Detector IP Addr:\t\t 0x%x\n"
@ -347,24 +345,9 @@ uint64_t getFirmwareAPIVersion() {
return ((bus_r(API_VERSION_REG) & API_VERSION_MSK) >> API_VERSION_OFST);
}
void getHardwareVersion(char *version) {
strcpy(version, "unknown");
int hwversion = getHardwareVersionNumber();
const int hwNumberList[] = HARDWARE_VERSION_NUMBERS;
const char *hwNamesList[] = HARDWARE_VERSION_NAMES;
for (int i = 0; i != NUM_HARDWARE_VERSIONS; ++i) {
LOG(logDEBUG, ("0x%x %d 0x%x %s\n", hwversion, i, hwNumberList[i],
hwNamesList[i]));
if (hwNumberList[i] == hwversion) {
strcpy(version, hwNamesList[i]);
return;
}
}
}
uint16_t getHardwareVersionNumber() {
#ifdef VIRTUAL
return 0x1;
return 0;
#endif
return ((bus_r(MOD_SERIAL_NUMBER_REG) & MOD_SERIAL_NUMBER_VRSN_MSK) >>
MOD_SERIAL_NUMBER_VRSN_OFST);
@ -1739,7 +1722,7 @@ void *start_timer(void *arg) {
memset(packetData, 0, packetSize);
sls_detector_header *header = (sls_detector_header *)(packetData);
header->detType = (uint16_t)myDetectorType;
header->version = SLS_DETECTOR_HEADER_VERSION;
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
header->frameNumber = frameNr + iframes;
header->packetNumber = i;
header->modId = 0;

View File

@ -5,13 +5,7 @@
#include "sls/sls_detector_defs.h"
#define MIN_REQRD_VRSN_T_RD_API 0x180314
#define REQRD_FRMWR_VRSN 0x221205
#define NUM_HARDWARE_VERSIONS (1)
#define HARDWARE_VERSION_NUMBERS \
{ 0x1 }
#define HARDWARE_VERSION_NAMES \
{ "1.0" }
#define REQRD_FRMWR_VRSN 0x220825
#define LINKED_SERVER_NAME "moenchDetectorServer"

View File

@ -313,7 +313,7 @@ patternParameters *setChannelRegisterChip(int ichip, char *mask,
chanReg, ichip * NCHAN + ich * NCOUNTERS,
ichip * NCHAN_1_COUNTER + ich, ichip, ich));
}
for (int i = 0; i < 23; i++) {
for (int i = 0; i < 24; i++) {
patword = clearBit(SIGNAL_clk, patword);
pat->word[iaddr++] = patword;

View File

@ -106,9 +106,7 @@ void basictests() {
return;
}
#endif
char hversion[MAX_STR_LENGTH] = {0};
memset(hversion, 0, MAX_STR_LENGTH);
getHardwareVersion(hversion);
uint16_t hversion = getHardwareVersionNumber();
uint32_t ipadd = getDetectorIP();
uint64_t macadd = getDetectorMAC();
int64_t fwversion = getFirmwareVersion();
@ -120,7 +118,7 @@ void basictests() {
LOG(logINFOBLUE,
("**************************************************\n"
"Hardware Version:\t\t %s\n"
"Hardware Version:\t\t 0x%x\n"
"Detector IP Addr:\t\t 0x%x\n"
"Detector MAC Addr:\t\t 0x%llx\n\n"
@ -261,34 +259,14 @@ u_int64_t getFirmwareAPIVersion() {
return ((bus_r(API_VERSION_REG) & API_VERSION_MSK) >> API_VERSION_OFST);
}
void getHardwareVersion(char *version) {
strcpy(version, "unknown");
int hwversion = getHardwareVersionNumber();
const int hwNumberList[] = HARDWARE_VERSION_NUMBERS;
const char *hwNamesList[] = HARDWARE_VERSION_NAMES;
for (int i = 0; i != NUM_HARDWARE_VERSIONS; ++i) {
LOG(logDEBUG, ("0x%x %d 0x%x %s\n", hwversion, i, hwNumberList[i],
hwNamesList[i]));
if (hwNumberList[i] == hwversion) {
strcpy(version, hwNamesList[i]);
return;
}
}
}
u_int16_t getHardwareVersionNumber() {
#ifdef VIRTUAL
return 0x2;
return 0;
#endif
return ((bus_r(MCB_SERIAL_NO_REG) & MCB_SERIAL_NO_VRSN_MSK) >>
MCB_SERIAL_NO_VRSN_OFST);
}
int isHardwareVersion_1_0() {
const int hwNumberList[] = HARDWARE_VERSION_NUMBERS;
return ((getHardwareVersionNumber() == hwNumberList[0]) ? 1 : 0);
}
u_int32_t getDetectorNumber() {
#ifdef VIRTUAL
return 0;
@ -2605,7 +2583,7 @@ void *start_timer(void *arg) {
// set header
sls_detector_header *header = (sls_detector_header *)(packetData);
header->detType = (uint16_t)myDetectorType;
header->version = SLS_DETECTOR_HEADER_VERSION;
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
header->frameNumber = virtual_currentFrameNumber;
header->packetNumber = i;
header->modId = virtual_moduleid;

View File

@ -3,15 +3,10 @@
#pragma once
#include "sls/sls_detector_defs.h"
#define REQRD_FRMWRE_VRSN (0x221205)
#define REQRD_FRMWRE_VRSN (0x220824)
#define KERNEL_DATE_VRSN "Mon May 10 18:00:21 CEST 2021"
#define ID_FILE "detid_mythen3.txt"
#define NUM_HARDWARE_VERSIONS (2)
#define HARDWARE_VERSION_NUMBERS {0x0, 0x2};
#define HARDWARE_VERSION_NAMES \
{ "1.0", "1.2" }
#define LINKED_SERVER_NAME "mythen3DetectorServer"
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
@ -57,9 +52,9 @@
#define DEFAULT_TRIMBIT_VALUE (0)
#define DEFAULT_COUNTER_DISABLED_VTH_VAL (2800)
#define DEFAULT_READOUT_C0 (10) //(100000000) // rdo_clk, 100 MHz
#define DEFAULT_READOUT_C1 (10) //(100000000) // rdo_smp_clk, 100 MHz
#define DEFAULT_SYSTEM_C0 (10) //(100000000) // run_clk, 100 MHz
#define DEFAULT_READOUT_C0 (12) //(083333333) // rdo_clk, 83.33 MHz
#define DEFAULT_READOUT_C1 (12) //(083333333) // rdo_smp_clk, 83.33 MHz
#define DEFAULT_SYSTEM_C0 (20) //(050000000) // run_clk, 20 MHz
#define DEFAULT_SYSTEM_C1 (8) //(125000000) // str_clk, 125 MHz const
#define DEFAULT_SYSTEM_C2 (5) //(200000000) // smp_clk, 200 MHz const
#define DEFAULT_TRIMMING_RUN_CLKDIV (40) // (25000000) // 25 MHz

View File

@ -78,36 +78,35 @@ int getTestImageMode();
void getServerVersion(char *version);
u_int64_t getFirmwareVersion();
u_int64_t getFirmwareAPIVersion();
#ifndef EIGERD
void getHardwareVersion(char *version);
#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || \
defined(MYTHEN3D) || defined(GOTTHARD2D)
u_int16_t getHardwareVersionNumber();
#endif
#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
u_int16_t getHardwareSerialNumber();
#endif
#if defined(JUNGFRAUD) || defined(GOTTHARD2D) || defined(MYTHEN3D) || \
defined(GOTTHARDD)
int isHardwareVersion_1_0();
#endif
#ifdef JUNGFRAUD
int isHardwareVersion2();
int getChipVersion();
void setChipVersion(int version);
#endif
#ifndef EIGERD
u_int32_t getDetectorNumber();
#endif
#if defined(GOTTHARD2D) || defined(EIGERD) || defined(MYTHEN3D) || \
defined(JUNGFRAUD)
#if defined(GOTTHARD2D) || defined(EIGERD) || defined(MYTHEN3D)
int getModuleId(int *ret, char *mess);
#endif
#if defined(EIGERD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
int updateModuleId();
#ifndef EIGERD
#endif
#if defined(GOTTHARD2D) || defined(MYTHEN3D)
void setModuleId(int modid);
#endif
#endif
u_int64_t getDetectorMAC();
u_int32_t getDetectorIP();
#ifdef GOTTHARDD
u_int32_t getBoardRevision();
#endif
// initialization
void initControlServer();

View File

@ -305,4 +305,3 @@ int set_digital_pulsing(int);
int get_module(int);
int get_synchronization(int);
int set_synchronization(int);
int get_hardware_version(int);

View File

@ -224,17 +224,10 @@ int getModuleIdInFile(int *ret, char *mess, char *fileName) {
// open id file
FILE *fd = fopen(fname, "r");
if (fd == NULL) {
#ifdef JUNGFRAUD
*ret = OK;
LOG(logWARNING,
("Could not find detid_jungfrau.txt to set module id\n"));
return 0;
#else
*ret = FAIL;
strcpy(mess, "Could not find detid file\n");
LOG(logERROR, ("%s\n\n", mess));
return -1;
#endif
}
LOG(logINFOBLUE, ("Reading det id file %s\n", fileName));

View File

@ -87,8 +87,7 @@ int updateModeAllowedFunction(int file_des) {
F_PROGRAM_FPGA, F_RESET_FPGA, F_INITIAL_CHECKS,
F_REBOOT_CONTROLLER, F_GET_KERNEL_VERSION, F_UPDATE_KERNEL,
F_UPDATE_DETECTOR_SERVER, F_GET_UPDATE_MODE, F_SET_UPDATE_MODE,
F_GET_NUM_CHANNELS, F_GET_NUM_INTERFACES, F_ACTIVATE,
F_GET_HARDWARE_VERSION};
F_GET_NUM_CHANNELS, F_GET_NUM_INTERFACES, F_ACTIVATE};
size_t allowedFuncsSize = sizeof(allowedFuncs) / sizeof(enum detFuncs);
for (unsigned int i = 0; i < allowedFuncsSize; ++i) {
@ -470,7 +469,6 @@ void function_table() {
flist[F_GET_MODULE] = &get_module;
flist[F_GET_SYNCHRONIZATION] = &get_synchronization;
flist[F_SET_SYNCHRONIZATION] = &set_synchronization;
flist[F_GET_HARDWARE_VERSION] = &get_hardware_version;
// check
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
@ -3451,7 +3449,7 @@ int write_adc_register(int file_des) {
#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
AD9257_Set(addr, val);
#elif GOTTHARDD
if (isHardwareVersion_1_0()) {
if (getBoardRevision() == 1) {
AD9252_Set(addr, val);
} else {
AD9257_Set(addr, val);
@ -4219,7 +4217,7 @@ int reboot_controller(int file_des) {
#elif VIRTUAL
ret = GOODBYE;
#elif defined(MYTHEN3D) || defined(GOTTHARD2D)
if (isHardwareVersion_1_0()) {
if (getHardwareVersionNumber() == 0) {
ret = FAIL;
strcpy(mess, "Old board version, reboot by yourself please!\n");
LOG(logINFORED, (mess));
@ -4704,7 +4702,9 @@ int set_read_n_rows(int file_des) {
"of %d\n",
arg, READ_N_ROWS_MULTIPLE);
LOG(logERROR, (mess));
} else if (isHardwareVersion_1_0()) {
}
// only for HW 2.0 (version = 3)
else if (isHardwareVersion2()) {
ret = FAIL;
strcpy(mess, "Could not set number of rows. Only available for "
"Hardware Board version 2.0.\n");
@ -8801,7 +8801,8 @@ int get_flip_rows(int file_des) {
functionNotImplemented();
#else
// get only
if (isHardwareVersion_1_0()) {
// only for HW 2.0 (version = 3)
if (isHardwareVersion2()) {
ret = FAIL;
strcpy(mess, "Could not get flip rows. Only available for "
"Hardware Board version 2.0.\n");
@ -8834,7 +8835,9 @@ int set_flip_rows(int file_des) {
sprintf(mess, "Could not set flip rows. Invalid argument %d.\n",
arg);
LOG(logERROR, (mess));
} else if (isHardwareVersion_1_0()) {
}
// only for HW 2.0 (version = 3)
else if (isHardwareVersion2()) {
ret = FAIL;
strcpy(mess, "Could not set flip rows. Only available for "
"Hardware Board version 2.0.\n");
@ -9006,8 +9009,7 @@ int get_module_id(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int retval = -1;
#if !(defined(GOTTHARD2D) || defined(EIGERD) || defined(MYTHEN3D) || \
defined(JUNGFRAUD))
#if !(defined(GOTTHARD2D) || defined(EIGERD) || defined(MYTHEN3D))
functionNotImplemented();
#else
retval = getModuleId(&ret, mess);
@ -9352,7 +9354,7 @@ int set_readout_speed(int file_des) {
// only set
if (Server_VerifyLock() == OK) {
#ifdef JUNGFRAUD
if (arg == (int)FULL_SPEED && isHardwareVersion_1_0()) {
if (arg == (int)FULL_SPEED && isHardwareVersion2()) {
ret = FAIL;
strcpy(
mess,
@ -10169,17 +10171,3 @@ int set_synchronization(int file_des) {
#endif
return Server_SendResult(file_des, INT32, NULL, 0);
}
int get_hardware_version(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
char retvals[MAX_STR_LENGTH];
memset(retvals, 0, MAX_STR_LENGTH);
#ifdef EIGERD
functionNotImplemented();
#else
getHardwareVersion(retvals);
LOG(logDEBUG1, ("hardware version retval: %s\n", retvals));
#endif
return Server_SendResult(file_des, OTHER, retvals, sizeof(retvals));
}

View File

@ -80,16 +80,13 @@ class Detector {
Result<std::string> getDetectorServerVersion(Positions pos = {}) const;
/** [Jungfrau][Gotthard2][Myhten3][Gotthard][Ctb][Moench] */
Result<std::string> getHardwareVersion(Positions pos = {}) const;
Result<std::string> getKernelVersion(Positions pos = {}) const;
/* [Jungfrau][Gotthard][Mythen3][Gotthard2][CTB][Moench] */
Result<int64_t> getSerialNumber(Positions pos = {}) const;
/** [Eiger][Gotthard2][Mythen3][Jungfrau] 6 bit value (ideally unique) that
* is streamed out in the UDP header of the detector.*/
/** [Eiger][Gotthard2][Mythen3] 6 bit value (ideally unique) that is
* streamed out in the UDP header of the detector.*/
Result<int> getModuleId(Positions pos = {}) const;
Result<std::string> getReceiverVersion(Positions pos = {}) const;
@ -665,7 +662,7 @@ class Detector {
* *
* ************************************************/
/** [Jungfrau][Gotthard2][Eiger] */
/** [Jungfrau][Gotthard2] */
Result<int> getNumberofUDPInterfaces(Positions pos = {}) const;
/** [Jungfrau][Gotthard2] Number of udp interfaces to stream data from
@ -835,20 +832,6 @@ class Detector {
* port
*/
void setTransmissionDelayRight(int value, Positions pos = {});
/** [Eiger][Jungfrau] */
int getTransmissionDelay() const;
/**
* [Eiger][Jungfrau][Mythen3] Set transmission delay for all modules in the
* detector using the step size provided.Sets up \n\t\t[Eiger] txdelay_left
* to (2 * mod_index * n_delay), \n\t\t[Eiger] txdelay_right to ((2 *
* mod_index + 1) * n_delay) and \n\t\t[Eiger] txdelay_frame to (2
* *num_modules * n_delay) \n\t\t[Jungfrau][Mythen3] txdelay_frame to
* (num_modules * n_delay) \nfor every module.
*/
void setTransmissionDelay(int step);
///@}
/** @name Receiver Configuration */

View File

@ -274,27 +274,22 @@ std::string CmdProxy::Versions(int action) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
bool eiger = (det->getDetectorType().squash() == defs::EIGER);
auto t = det->getFirmwareVersion(std::vector<int>{det_id});
os << "\nType : " << OutString(det->getDetectorType())
<< "\nRelease : " << det->getPackageVersion() << std::hex
<< "\nClient : " << det->getClientVersion();
os << "\nFirmware : ";
if (eiger) {
os << OutString(t);
os << "\nDetector Type: " << OutString(det->getDetectorType())
<< "\nPackage Version: " << det->getPackageVersion() << std::hex
<< "\nClient Version: " << det->getClientVersion();
if (det->getDetectorType().squash() == defs::EIGER) {
os << "\nFirmware Version: " << OutString(t);
} else {
os << OutStringHex(t);
os << "\nFirmware Version: " << OutStringHex(t);
}
os << "\nServer : "
os << "\nDetector Server Version: "
<< OutString(
det->getDetectorServerVersion(std::vector<int>{det_id}));
if (!eiger)
os << "\nHardware : "
<< OutString(det->getHardwareVersion(std::vector<int>{det_id}));
os << "\nKernel : "
os << "\nDetector Kernel Version: "
<< OutString(det->getKernelVersion({std::vector<int>{det_id}}));
if (det->getUseReceiverFlag().squash(true)) {
os << "\nReceiver : "
os << "\nReceiver Version: "
<< OutString(det->getReceiverVersion(std::vector<int>{det_id}));
}
os << std::dec << '\n';
@ -1707,42 +1702,6 @@ std::string CmdProxy::UDPDestinationIP2(int action) {
return os.str();
}
std::string CmdProxy::TransmissionDelay(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[n_delay]\n\t[Eiger][Jungfrau][Mythen3] Set transmission delay "
"for all modules in the detector using the step size "
"provided.Sets up \n\t\t[Eiger] txdelay_left to (2 * mod_index * "
"n_delay), \n\t\t[Eiger] txdelay_right to ((2 * mod_index + 1) * "
"n_delay) and \n\t\t[Eiger] txdelay_frame to (2 *num_modules * "
"n_delay) \n\t\t[Jungfrau][Mythen3] txdelay_frame to "
"(num_modules * n_delay) \nfor every module."
<< '\n';
} else if (action == defs::GET_ACTION) {
if (det_id != -1) {
throw RuntimeError("Cannot execute this at module level");
}
if (args.size() != 0) {
WrongNumberOfParameters(0);
}
auto t = det->getTransmissionDelay();
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (det_id != -1) {
throw RuntimeError("Cannot execute this at module level");
}
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
det->setTransmissionDelay(StringTo<int>(args[0]));
os << args.front() << '\n';
} else {
throw RuntimeError("Unknown action");
}
return os.str();
}
/* Receiver Config */
std::string CmdProxy::ReceiverHostname(int action) {
std::ostringstream os;
@ -2839,7 +2798,6 @@ std::string CmdProxy::PatternLoopAddresses(int action) {
if (cmd != "patlimits") {
GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs,
nPutArgs);
os << level << ' ';
}
if (action == defs::GET_ACTION) {
auto t =
@ -2879,7 +2837,6 @@ std::string CmdProxy::PatternLoopCycles(int action) {
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs,
nPutArgs);
os << level << ' ';
if (action == defs::GET_ACTION) {
auto t = det->getPatternLoopCycles(level, std::vector<int>{det_id});
os << OutString(t) << '\n';
@ -2914,7 +2871,6 @@ std::string CmdProxy::PatternWaitAddress(int action) {
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs,
nPutArgs);
os << level << ' ';
if (action == defs::GET_ACTION) {
auto t = det->getPatternWaitAddr(level, std::vector<int>{det_id});
os << OutStringHex(t, 4) << '\n';
@ -2948,7 +2904,6 @@ std::string CmdProxy::PatternWaitTime(int action) {
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs,
nPutArgs);
os << level << ' ';
if (action == defs::GET_ACTION) {
auto t = det->getPatternWaitTime(level, std::vector<int>{det_id});
os << OutString(t) << '\n';

View File

@ -697,9 +697,6 @@ class CmdProxy {
{"rx_udpport", "udp_dstport"},
{"rx_udpport2", "udp_dstport2"},
{"flowcontrol_10g", "flowcontrol10g"},
{"txndelay_frame", "txdelay_frame"},
{"txndelay_left", "txdelay_left"},
{"txndelay_right", "txdelay_right"},
/* Receiver Config */
{"r_silent", "rx_silent"},
@ -770,7 +767,6 @@ class CmdProxy {
{"packageversion", &CmdProxy::PackageVersion},
{"clientversion", &CmdProxy::ClientVersion},
{"firmwareversion", &CmdProxy::FirmwareVersion},
{"hardwareversion", &CmdProxy::hardwareversion},
{"detectorserverversion", &CmdProxy::detectorserverversion},
{"kernelversion", &CmdProxy::kernelversion},
{"rx_version", &CmdProxy::rx_version},
@ -896,10 +892,9 @@ class CmdProxy {
{"rx_printconfig", &CmdProxy::rx_printconfig},
{"tengiga", &CmdProxy::tengiga},
{"flowcontrol10g", &CmdProxy::flowcontrol10g},
{"txdelay_frame", &CmdProxy::txdelay_frame},
{"txdelay_left", &CmdProxy::txdelay_left},
{"txdelay_right", &CmdProxy::txdelay_right},
{"txdelay", &CmdProxy::TransmissionDelay},
{"txndelay_frame", &CmdProxy::txndelay_frame},
{"txndelay_left", &CmdProxy::txndelay_left},
{"txndelay_right", &CmdProxy::txndelay_right},
/* Receiver Config */
{"rx_hostname", &CmdProxy::ReceiverHostname},
@ -1162,7 +1157,6 @@ class CmdProxy {
std::string UDPSourceIP2(int action);
std::string UDPDestinationIP(int action);
std::string UDPDestinationIP2(int action);
std::string TransmissionDelay(int action);
/* Receiver Config */
std::string ReceiverHostname(int action);
std::string Rx_ROI(int action);
@ -1241,10 +1235,6 @@ class CmdProxy {
GET_COMMAND(detectorserverversion, getDetectorServerVersion,
"\n\tOn-board detector server software version");
GET_COMMAND(hardwareversion, getHardwareVersion,
"\n\t[Jungfrau][Gotthard2][Myhten3][Gotthard][Ctb][Moench] "
"Hardware version of detector.");
GET_COMMAND(
kernelversion, getKernelVersion,
"\n\tGet kernel version on the detector including time and date.");
@ -1256,9 +1246,9 @@ class CmdProxy {
"Serial number of detector.");
GET_COMMAND(moduleid, getModuleId,
"\n\t[Gotthard2][Eiger][Mythen3][Jungfrau] 16 bit value "
"(ideally unique) that is streamed out in the UDP header of "
"the detector. Picked up from a file on the module.");
"\n\t[Gotthard2][Eiger][Mythen3] 16 bit value (ideally unique) "
"that is streamed out in the UDP header of the detector. "
"Picked up from a file on the module.");
GET_COMMAND(type, getDetectorType,
"\n\tReturns detector type. Can be Eiger, Jungfrau, Gotthard, "
@ -1599,7 +1589,7 @@ class CmdProxy {
"data from detector. Default: 1.\n\tAlso enables second interface in "
"receiver for listening (Writes a file per interface if writing "
"enabled).\n\tAlso restarts client and receiver zmq sockets if zmq "
"streaming enabled.\n\t[Eiger] Only gets with result 2.");
"streaming enabled.");
INTEGER_COMMAND_VEC_ID(
selinterface, getSelectedUDPInterface, selectUDPInterface,
@ -1694,24 +1684,24 @@ class CmdProxy {
"[0, 1]\n\t[Eiger][Jungfrau] 10GbE Flow Control.");
INTEGER_COMMAND_VEC_ID(
txdelay_frame, getTransmissionDelayFrame, setTransmissionDelayFrame,
txndelay_frame, getTransmissionDelayFrame, setTransmissionDelayFrame,
StringTo<int>,
"[n_delay]\n\t[Eiger][Jungfrau][Mythen3] Transmission delay of first "
"udp packet being streamed out of the module.\n\t[Jungfrau] [0-31] "
"Each value represents 1 ms\n\t[Eiger] Additional delay to "
"txdelay_left and txdelay_right. Each value represents 10ns. Typical "
"txndelay_left and txndelay_right. Each value represents 10ns. Typical "
"value is 50000.\n\t[Mythen3] [0-16777215] Each value represents 8 ns "
"(125 MHz clock), max is 134 ms.");
INTEGER_COMMAND_VEC_ID(
txdelay_left, getTransmissionDelayLeft, setTransmissionDelayLeft,
txndelay_left, getTransmissionDelayLeft, setTransmissionDelayLeft,
StringTo<int>,
"[n_delay]\n\t[Eiger] Transmission delay of first packet in an image "
"being streamed out of the module's left UDP port. Each value "
"represents 10ns. Typical value is 50000.");
INTEGER_COMMAND_VEC_ID(
txdelay_right, getTransmissionDelayRight, setTransmissionDelayRight,
txndelay_right, getTransmissionDelayRight, setTransmissionDelayRight,
StringTo<int>,
"[n_delay]\n\t[Eiger] Transmission delay of first packet in an image "
"being streamed out of the module's right UDP port. Each value "

View File

@ -128,10 +128,6 @@ Result<std::string> Detector::getDetectorServerVersion(Positions pos) const {
return pimpl->Parallel(&Module::getDetectorServerVersion, pos);
}
Result<std::string> Detector::getHardwareVersion(Positions pos) const {
return pimpl->Parallel(&Module::getHardwareVersion, pos);
}
Result<std::string> Detector::getKernelVersion(Positions pos) const {
return pimpl->Parallel(&Module::getKernelVersion, pos);
}
@ -821,24 +817,7 @@ void Detector::startDetectorReadout() {
}
void Detector::stopDetector(Positions pos) {
// stop and check status X times
int retries{0};
// avoid default construction of runStatus::IDLE on squash
auto status = getDetectorStatus().squash(defs::runStatus::RUNNING);
while (status != defs::runStatus::IDLE &&
status != defs::runStatus::STOPPED) {
if (status == defs::runStatus::ERROR) {
throw RuntimeError(
"Could not stop detector. Returned error status.");
}
pimpl->Parallel(&Module::stopAcquisition, pos);
status = getDetectorStatus().squash(defs::runStatus::RUNNING);
++retries;
if (retries == 10)
throw RuntimeError("Could not stop detector");
}
pimpl->Parallel(&Module::stopAcquisition, pos);
// validate consistent frame numbers
switch (getDetectorType().squash()) {
@ -1137,14 +1116,6 @@ void Detector::setTransmissionDelayRight(int value, Positions pos) {
pimpl->Parallel(&Module::setTransmissionDelayRight, pos, value);
}
int Detector::getTransmissionDelay() const {
return pimpl->getTransmissionDelay();
}
void Detector::setTransmissionDelay(int step) {
pimpl->setTransmissionDelay(step);
}
// Receiver
Result<bool> Detector::getUseReceiverFlag(Positions pos) const {
@ -2329,7 +2300,6 @@ void Detector::setAdditionalJsonParameter(const std::string &key,
void Detector::programFPGA(const std::string &fname,
const bool forceDeleteNormalFile, Positions pos) {
LOG(logINFO) << "Updating Firmware...";
LOG(logINFO) << "Hardware Version: " << getHardwareVersion();
std::vector<char> buffer = pimpl->readProgrammingFile(fname);
pimpl->Parallel(&Module::programFPGA, pos, buffer, forceDeleteNormalFile);
rebootController(pos);

View File

@ -50,7 +50,7 @@ void DetectorImpl::setupDetector(bool verify, bool update) {
ctb_shm.openSharedMemory(verify);
}
bool DetectorImpl::isAllPositions(Positions pos) const {
bool DetectorImpl::isAllPositions(const Positions pos) const {
return (pos.empty() || (pos.size() == 1 && pos[0] == -1) ||
(pos.size() == modules.size()));
}
@ -342,32 +342,28 @@ void DetectorImpl::updateDetectorSize() {
"updating detector size. ");
}
int maxx = shm()->numberOfChannels.x;
int maxy = shm()->numberOfChannels.y;
int nModx = 0, nMody = 0;
// 1d, add modules along x axis
if (modSize.y == 1) {
int detSizeX = shm()->numberOfChannels.x;
int maxChanX = modSize.x * size();
// user given detsizex used only within max value
if (detSizeX > 1 && detSizeX <= maxChanX) {
maxChanX = detSizeX;
if (maxx == 0) {
maxx = modSize.x * size();
}
nModx = maxChanX / modSize.x;
nModx = maxx / modSize.x;
nMody = size() / nModx;
if ((maxChanX % modSize.x) > 0) {
if ((maxx % modSize.x) > 0) {
++nMody;
}
}
// 2d, add modules along y axis (due to eiger top/bottom)
else {
int detSizeY = shm()->numberOfChannels.y;
int maxChanY = modSize.y * size();
// user given detsizey used only within max value
if (detSizeY > 1 && detSizeY <= maxChanY) {
maxChanY = detSizeY;
if (maxy == 0) {
maxy = modSize.y * size();
}
nMody = maxChanY / modSize.y;
nMody = maxy / modSize.y;
nModx = size() / nMody;
if ((maxChanY % modSize.y) > 0) {
if ((maxy % modSize.y) > 0) {
++nModx;
}
}
@ -435,90 +431,6 @@ void DetectorImpl::setGapPixelsinCallback(const bool enable) {
shm()->gapPixels = enable;
}
int DetectorImpl::getTransmissionDelay() const {
bool eiger = false;
switch (shm()->detType) {
case JUNGFRAU:
case MYTHEN3:
break;
case EIGER:
eiger = true;
break;
default:
throw RuntimeError(
"Transmission delay is not implemented for the this detector.");
}
if (!eiger && size() <= 1) {
throw RuntimeError(
"Cannot get intermodule transmission delays with just one module");
}
int step = 0;
if (eiger) {
// between left and right
step = modules[0]->getTransmissionDelayRight();
} else {
// between first and second
step = modules[1]->getTransmissionDelayFrame();
}
for (int i = 0; i != size(); ++i) {
if (eiger) {
if ((modules[i]->getTransmissionDelayLeft() != (2 * i * step)) ||
(modules[i]->getTransmissionDelayRight() !=
((2 * i + 1) * step)) ||
(modules[i]->getTransmissionDelayFrame() !=
(2 * size() * step))) {
return -1;
}
} else {
if (modules[i]->getTransmissionDelayFrame() != (i * step)) {
return -1;
}
}
}
return step;
}
void DetectorImpl::setTransmissionDelay(int step) {
bool eiger = false;
switch (shm()->detType) {
case JUNGFRAU:
case MYTHEN3:
break;
case EIGER:
eiger = true;
break;
default:
throw RuntimeError(
"Transmission delay is not implemented for the this detector.");
}
// using a asyc+future directly (instead of Parallel) to pass different
// values
std::vector<std::future<void>> futures;
for (int i = 0; i != size(); ++i) {
if (eiger) {
futures.push_back(std::async(std::launch::async,
&Module::setTransmissionDelayLeft,
modules[i].get(), 2 * i * step));
futures.push_back(std::async(std::launch::async,
&Module::setTransmissionDelayRight,
modules[i].get(), (2 * i + 1) * step));
futures.push_back(std::async(std::launch::async,
&Module::setTransmissionDelayFrame,
modules[i].get(), 2 * size() * step));
} else {
futures.push_back(std::async(std::launch::async,
&Module::setTransmissionDelayFrame,
modules[i].get(), i * step));
}
}
// wait for calls to complete
for (auto &f : futures)
f.get();
}
int DetectorImpl::destroyReceivingDataSockets() {
LOG(logINFO) << "Going to destroy data sockets";
// close socket
@ -1794,24 +1706,20 @@ void DetectorImpl::setBadChannels(const std::string &fname, Positions pos) {
" out of bounds.");
}
int ch = badchannel % nchan;
size_t imod = badchannel / nchan;
if (imod >= modules.size()) {
int imod = badchannel / nchan;
if (imod >= (int)modules.size()) {
throw RuntimeError("Invalid bad channel list. " +
std::to_string(badchannel) +
" out of bounds.");
}
if (badchannels.size() != imod + 1) {
if ((int)badchannels.size() != imod + 1) {
badchannels.push_back(std::vector<int>{});
}
badchannels[imod].push_back(ch);
}
for (size_t imod = 0; imod != modules.size(); ++imod) {
// add empty vector if no bad channels in this module
if (badchannels.size() != imod + 1) {
badchannels.push_back(std::vector<int>{});
}
Parallel(&Module::setBadChannels, {static_cast<int>(imod)},
badchannels[imod]);
for (int imod = 0; imod != (int)modules.size(); ++imod) {
Parallel(&Module::setBadChannels, {imod}, badchannels[imod]);
}
} else if (pos.size() != 1) {

View File

@ -190,7 +190,7 @@ class DetectorImpl : public virtual slsDetectorDefs {
}
}
bool isAllPositions(Positions pos) const;
bool isAllPositions(const Positions pos) const;
/** set acquiring flag in shared memory */
void setAcquiringFlag(bool flag);
@ -237,10 +237,11 @@ class DetectorImpl : public virtual slsDetectorDefs {
* Sets maximum number of channels of all sls modules */
void setNumberOfChannels(const slsDetectorDefs::xy c);
/** [Eiger][Jungfrau] */
bool getGapPixelsinCallback() const;
/** [Eiger][Jungfrau] */
void setGapPixelsinCallback(const bool enable);
int getTransmissionDelay() const;
void setTransmissionDelay(int step);
bool getDataStreamingToClient();
void setDataStreamingToClient(bool enable);
int getClientStreamingHwm() const;

View File

@ -76,7 +76,7 @@ void Module::setHostname(const std::string &hostname,
initialDetectorServerChecks();
checkDetectorVersionCompatibility();
LOG(logINFO) << "Module Version Compatibility - Success";
} catch (const RuntimeError &e) {
} catch (const DetectorError &e) {
if (!initialChecks) {
LOG(logWARNING) << "Bypassing Initial Checks at your own risk!";
} else {
@ -109,12 +109,6 @@ std::string Module::getDetectorServerVersion() const {
return v.concise();
}
std::string Module::getHardwareVersion() const {
char retval[MAX_STR_LENGTH]{};
sendToDetector(F_GET_HARDWARE_VERSION, nullptr, retval);
return retval;
}
std::string Module::getKernelVersion() const {
char retval[MAX_STR_LENGTH]{};
sendToDetector(F_GET_KERNEL_VERSION, nullptr, retval);

View File

@ -93,7 +93,6 @@ class Module : public virtual slsDetectorDefs {
std::string getControlServerLongVersion() const;
std::string getStopServerLongVersion() const;
std::string getDetectorServerVersion() const;
std::string getHardwareVersion() const;
std::string getKernelVersion() const;
int64_t getSerialNumber() const;
int getModuleId() const;

View File

@ -9,15 +9,7 @@
namespace sls {
Pattern::Pattern() {
// initialize pattern addresses
for (int i = 0; i != MAX_PATTERN_LEVELS; ++i) {
pat->startloop[i] = MAX_PATTERN_LENGTH - 1;
pat->stoploop[i] = MAX_PATTERN_LENGTH - 1;
pat->wait[i] = MAX_PATTERN_LENGTH - 1;
}
}
Pattern::Pattern() = default;
Pattern::~Pattern() { delete pat; }
Pattern::Pattern(const Pattern &other) {

View File

@ -112,23 +112,23 @@ TEST_CASE("adcvpp", "[.cmd]") {
{
std::ostringstream oss;
proxy.Call("adcvpp", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "adcvpp 1\n");
REQUIRE(oss.str() == "dac adcvpp 1\n");
}
{
std::ostringstream oss;
proxy.Call("adcvpp", {"1140", "mv"}, -1, PUT, oss);
REQUIRE(oss.str() == "adcvpp 1140 mV\n");
REQUIRE(oss.str() == "dac adcvpp 1140 mV\n");
}
{
std::ostringstream oss;
proxy.Call("adcvpp", {"mv"}, -1, GET, oss);
REQUIRE(oss.str() == "adcvpp 1140 mV\n");
REQUIRE(oss.str() == "dac adcvpp 1140 mV\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setADCVpp(prev_val[i], false, {i});
}
} else {
REQUIRE_THROWS(proxy.Call("adcvpp", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("dac adcvpp", {}, -1, GET));
}
}

View File

@ -235,7 +235,7 @@ TEST_CASE("Setting and reading back EIGER dacs", "[.cmd][.dacs]") {
/* Network Configuration (Detector<->Receiver) */
TEST_CASE("txdelay_left", "[.cmd]") {
TEST_CASE("txndelay_left", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
@ -243,20 +243,20 @@ TEST_CASE("txdelay_left", "[.cmd]") {
auto prev_val = det.getTransmissionDelayLeft();
{
std::ostringstream oss1, oss2;
proxy.Call("txdelay_left", {"5000"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "txdelay_left 5000\n");
proxy.Call("txdelay_left", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "txdelay_left 5000\n");
proxy.Call("txndelay_left", {"5000"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "txndelay_left 5000\n");
proxy.Call("txndelay_left", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "txndelay_left 5000\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setTransmissionDelayLeft(prev_val[i]);
}
} else {
REQUIRE_THROWS(proxy.Call("txdelay_left", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("txndelay_left", {}, -1, GET));
}
}
TEST_CASE("txdelay_right", "[.cmd]") {
TEST_CASE("txndelay_right", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
@ -264,16 +264,16 @@ TEST_CASE("txdelay_right", "[.cmd]") {
auto prev_val = det.getTransmissionDelayRight();
{
std::ostringstream oss1, oss2;
proxy.Call("txdelay_right", {"5000"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "txdelay_right 5000\n");
proxy.Call("txdelay_right", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "txdelay_right 5000\n");
proxy.Call("txndelay_right", {"5000"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "txndelay_right 5000\n");
proxy.Call("txndelay_right", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "txndelay_right 5000\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setTransmissionDelayRight(prev_val[i]);
}
} else {
REQUIRE_THROWS(proxy.Call("txdelay_right", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("txndelay_right", {}, -1, GET));
}
}

View File

@ -105,25 +105,20 @@ TEST_CASE("roi", "[.cmd]") {
auto det_type = det.getDetectorType().squash();
if (det_type == defs::GOTTHARD) {
if (det.size() > 1) {
REQUIRE_THROWS(proxy.Call("roi", {"0", "255"}, -1, PUT));
REQUIRE_NOTHROW(proxy.Call("roi", {}, -1, GET));
} else {
auto prev_val = det.getROI();
{
std::ostringstream oss;
proxy.Call("roi", {"0", "255"}, -1, PUT, oss);
REQUIRE(oss.str() == "roi [0, 255]\n");
}
{
std::ostringstream oss;
proxy.Call("roi", {"256", "511"}, -1, PUT, oss);
REQUIRE(oss.str() == "roi [256, 511]\n");
}
REQUIRE_THROWS(proxy.Call("roi", {"0", "256"}, -1, PUT));
for (int i = 0; i != det.size(); ++i) {
det.setROI(prev_val[i], i);
}
auto prev_val = det.getROI();
{
std::ostringstream oss;
proxy.Call("roi", {"0", "255"}, -1, PUT, oss);
REQUIRE(oss.str() == "roi [0, 255]\n");
}
{
std::ostringstream oss;
proxy.Call("roi", {"256", "511"}, -1, PUT, oss);
REQUIRE(oss.str() == "roi [256, 511]\n");
}
REQUIRE_THROWS(proxy.Call("roi", {"0", "256"}, -1, PUT));
for (int i = 0; i != det.size(); ++i) {
det.setROI(prev_val[i], i);
}
} else {
REQUIRE_THROWS(proxy.Call("roi", {}, -1, GET));
@ -140,7 +135,7 @@ TEST_CASE("clearroi", "[.cmd]") {
{
std::ostringstream oss;
proxy.Call("clearroi", {}, -1, PUT, oss);
REQUIRE(oss.str() == "clearroi successful\n");
REQUIRE(oss.str() == "clearroi [-1, -1]\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setROI(prev_val[i], i);

View File

@ -33,7 +33,7 @@ TEST_CASE("timegotthard2", "[.cmd]") {
{
std::ostringstream oss;
proxy.Call("exptime", {}, -1, GET, oss);
REQUIRE(oss.str() == "exptime 221ns\n");
REQUIRE(oss.str() == "exptime 222ns\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setExptime(prev_val[i], {i});
@ -48,7 +48,7 @@ TEST_CASE("timegotthard2", "[.cmd]") {
{
std::ostringstream oss;
proxy.Call("burstperiod", {}, -1, GET, oss);
REQUIRE(oss.str() == "burstperiod 221ns\n");
REQUIRE(oss.str() == "burstperiod 222ns\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setBurstPeriod(prev_val[i], {i});
@ -63,7 +63,7 @@ TEST_CASE("timegotthard2", "[.cmd]") {
{
std::ostringstream oss;
proxy.Call("delay", {}, -1, GET, oss);
REQUIRE(oss.str() == "delay 221ns\n");
REQUIRE(oss.str() == "delay 222ns\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setDelayAfterTrigger(prev_val[i], {i});
@ -80,7 +80,7 @@ TEST_CASE("timegotthard2", "[.cmd]") {
{
std::ostringstream oss;
proxy.Call("period", {}, -1, GET, oss);
REQUIRE(oss.str() == "period 221ns\n");
REQUIRE(oss.str() == "period 222ns\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setPeriod(prev_val[i], {i});
@ -96,7 +96,7 @@ TEST_CASE("timegotthard2", "[.cmd]") {
{
std::ostringstream oss;
proxy.Call("period", {}, -1, GET, oss);
REQUIRE(oss.str() == "period 221ns\n");
REQUIRE(oss.str() == "period 222ns\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setPeriod(prev_val[i], {i});
@ -586,8 +586,7 @@ TEST_CASE("vetostream", "[.cmd]") {
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::GOTTHARD2) {
auto prev_val =
det.getVetoStream().tsquash("inconsistent veto stream to test");
auto prev_val = det.getVetoStream();
{
std::ostringstream oss;
proxy.Call("vetostream", {"none"}, -1, PUT, oss);
@ -619,7 +618,9 @@ TEST_CASE("vetostream", "[.cmd]") {
REQUIRE(oss.str() == "vetostream lll, 10gbe\n");
}
REQUIRE_THROWS(proxy.Call("vetostream", {"lll", "none"}, -1, PUT));
det.setVetoStream(prev_val);
for (int i = 0; i != det.size(); ++i) {
det.setVetoStream(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("vetostream", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vetostream", {"none"}, -1, PUT));

View File

@ -98,6 +98,39 @@ TEST_CASE("Setting and reading back Jungfrau dacs", "[.cmd][.dacs]") {
/* Network Configuration (Detector<->Receiver) */
TEST_CASE("numinterfaces", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU) {
auto prev_val = det.getNumberofUDPInterfaces().tsquash(
"inconsistent numinterfaces to test");
{
std::ostringstream oss;
proxy.Call("numinterfaces", {"2"}, -1, PUT, oss);
REQUIRE(oss.str() == "numinterfaces 2\n");
}
{
std::ostringstream oss;
proxy.Call("numinterfaces", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "numinterfaces 1\n");
}
{
std::ostringstream oss;
proxy.Call("numinterfaces", {}, -1, GET, oss);
REQUIRE(oss.str() == "numinterfaces 1\n");
}
det.setNumberofUDPInterfaces(prev_val);
} else {
std::ostringstream oss;
proxy.Call("numinterfaces", {}, -1, GET, oss);
REQUIRE(oss.str() == "numinterfaces 1\n");
REQUIRE_THROWS(proxy.Call("numinterfaces", {"1"}, -1, PUT));
}
REQUIRE_THROWS(proxy.Call("numinterfaces", {"3"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("numinterfaces", {"0"}, -1, PUT));
}
TEST_CASE("selinterface", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);

Some files were not shown because too many files have changed in this diff Show More