Compare commits

..

127 Commits
4.0.0 ... 4.1.0

Author SHA1 Message Date
59b56c764f Merge branch 'main-rc' into b4.1.0 2020-11-30 17:09:23 +01:00
ff7afd0de7 Merge branch 'main-rc' into b4.0.2 2020-11-30 17:05:39 +01:00
835e62425f Merge branch 'main-rc' into b4.0.1 2020-11-30 17:03:16 +01:00
62c86f56b1 Merge branch 'main' into test 2020-11-20 14:27:25 +01:00
77080a524a Merge branch 'main' into test 2020-11-20 14:26:37 +01:00
3dce1e46f9 Merge branch 'main' into test 2020-11-20 14:25:45 +01:00
f7cb2b5dcd conda pkg 2019-10-08 12:48:51 +02:00
9ea3cbc8f1 Update RELEASE.txt 2019-10-04 10:56:14 +02:00
53bb677f8c eiger doc updated 2019-10-04 10:41:13 +02:00
663999a539 updated versions 2019-10-04 10:35:42 +02:00
98b45b32fd added jungfrau virtual binaries 2019-10-04 10:29:57 +02:00
74c08cd742 updated binaries in sererbin 2019-10-04 09:42:07 +02:00
696073b505 fixed eiger virtual software versions 2019-10-04 09:41:21 +02:00
e4645a8273 Update RELEASE.txt 2019-10-02 09:37:26 +02:00
c0cd25460d Update RELEASE.txt 2019-10-02 09:35:59 +02:00
e7e30693f0 transmission delays 2019-08-21 20:29:07 +02:00
dd96aac3cd build for conda 2019-08-20 12:24:39 +02:00
5697393a70 Merge branch '4.1.0-rc' of github.com:slsdetectorgroup/slsDetectorPackage into 4.1.0-rc 2019-08-16 15:33:04 +02:00
052dd8058f updated eiger binary 2019-08-16 15:32:49 +02:00
4d99ce8c52 receiver master file includes quad, gap pixels enable, version updated for binary and hdf5 2019-08-14 20:33:40 +02:00
633c646239 eiger bug fix: 4 bit mode gap pixels, also added quad to shm 2019-08-14 15:31:18 +02:00
2a88bc6a1e Merge branch '4.1.0-rc' of github.com:slsdetectorgroup/slsDetectorPackage into 4.1.0-rc 2019-08-14 10:43:15 +02:00
d8af2e594a eiger bug fix: quad mode, without gap pixels, data messed up 2019-08-14 10:42:54 +02:00
8da7c3e805 eiger manual 2019-08-13 16:57:22 +02:00
ddfbea76be eiger server bug fix: interrupt subframe wrong bit mapped, virtual compilation 2019-08-06 17:22:54 +02:00
c5f2275703 eiger serveR: minor fix for beb check quad fail 2019-07-31 15:20:25 +02:00
8c491f18fd quad enabled with gap pixels without the extra vertical pixel line 2019-07-31 13:00:12 +02:00
e07e2f2da0 eiger server bug fix: split quad and interruptframe into set and get to catch fails in set and when quad and interrupt subframe used together(different register values for tl and tr) 2019-07-31 10:58:49 +02:00
d981e1b8e5 eiger server: interrupt subframe, quad change flipping, registers set left and right separately 2019-07-29 15:19:46 +02:00
58e6338f9c eiger server for v24 2019-07-29 09:36:45 +02:00
27f3af5365 updated release text 2019-07-29 09:32:17 +02:00
350b4f0368 bug fix on quad: if no data streaming enabled in the beginning 2019-07-22 17:09:34 +02:00
445f3c66fd bug fix for previous commit to work for bottom module 2019-07-10 17:56:32 +02:00
1189b991e5 quad implemented 2019-07-10 17:39:43 +02:00
3e2b471ee1 client bug fix: framesl, cyclesl printed in float, fixed 2019-07-10 11:13:35 +02:00
8c76d5d52c updated release.txt 2019-06-14 09:19:34 +02:00
e7eee67fed Update RELEASE.txt 2019-06-13 11:44:43 +02:00
fade48dcfa updated release.rxt 2019-06-13 11:43:06 +02:00
8e58e7f8bf Updated release.txt : eiger firmware version 23 2019-06-13 11:41:50 +02:00
c8f56ee23c qwt 2019-06-13 10:44:45 +02:00
32d951e28a Merge branch '4.0.2' of github.com:slsdetectorgroup/slsDetectorPackage into 4.0.2 2019-06-13 09:01:47 +02:00
5c63c8fc8f gui bug fix: switching to tab plot while acquiring produced error messages 2019-06-13 09:01:39 +02:00
7b70274d4f checking online when refreshing (during acquire) is removed 2019-06-13 08:56:29 +02:00
1cd905c08b disable gui 2019-06-12 16:02:43 +02:00
13e809acd4 updated versions 2019-06-12 15:40:19 +02:00
46533b0411 updated server binaries 2019-06-12 15:37:17 +02:00
4f4de15d3a 1s sleep for large JF during powerchip 2019-06-12 14:53:52 +02:00
4f99aeabd2 bug fix: hdf5 printError still called once. replcaed with printErrorStack 2019-05-22 19:09:45 +02:00
5e246c0754 Merge branch '4.0.2-rc' of github.com:slsdetectorgroup/slsDetectorPackage into 4.0.2-rc 2019-04-11 16:13:42 +02:00
518c6783cc Client (data call back API) and Gui (Eiger 4 bit mode with multiple images) bug fix: npixelsx and npixelsy was not updated to complete detector level when calling call back function to give complete image 2019-04-11 16:13:31 +02:00
0706564694 deploy only on specific branch 2019-04-11 09:31:27 +02:00
2108bbda66 Merge branch '4.0.2-rc' of github.com:slsdetectorgroup/slsDetectorPackage into 4.0.2-rc 2019-04-08 18:06:19 +02:00
82feed1ab8 updated server binaries 2019-04-08 18:06:06 +02:00
4be0b5d436 jungfrau server bug fix: setting detector position gave error when switching between different sized detector configurations 2019-04-08 18:05:05 +02:00
f7eb256eb6 version 2019-03-15 14:45:44 +01:00
250fc26308 fixed deloyment 2019-03-15 14:40:12 +01:00
06a50520c1 gotthard server: bug fix get settings should not set default dacs 2019-03-11 14:54:53 +01:00
fc766055d4 receiver bug fix release text updated 2019-03-04 11:42:54 +01:00
828b1479c7 receiver bug fix jungfrau as root 2019-03-04 11:28:56 +01:00
22ed52605c receiverbug fixe affecting jungfrau receivers as root 2019-03-04 11:15:53 +01:00
a1a95ebb20 receiver bug fixaffecting Jungfrau receivers as root (optlen size as int), but setting buffer size is uint32_t size. setting it to uint64_t 2019-03-04 11:02:10 +01:00
d7ce5fedfd path 2019-02-12 15:06:15 +01:00
3a2682ffe7 missing headers updated build number 2019-02-12 14:46:56 +01:00
bf74a4135e travis 2019-02-11 10:25:58 +01:00
252ecf2769 travis 2019-02-11 10:15:57 +01:00
de01ab75e9 travis 2019-02-11 09:24:39 +01:00
a7ba5eb0d8 updated release.txt 2019-02-08 17:46:13 +01:00
6bf1a944da updaterev 2019-02-08 17:28:44 +01:00
3c77447868 removed minor warnings 2019-02-08 16:32:23 +01:00
046fb11e5e Merge branch '4.0.1-rc' of github.com:slsdetectorgroup/slsDetectorPackage into 4.0.1-rc 2019-02-08 16:02:15 +01:00
b89d56001e CMake: prefixing the options with SLS_ 2019-02-08 16:02:05 +01:00
de204dee38 Merge branch '4.0.1-rc' of github.com:slsdetectorgroup/slsDetectorPackage into 4.0.1-rc 2019-02-08 14:03:56 +01:00
0ef030354f warning 2019-02-08 14:03:49 +01:00
dccce9bf55 Merge branch 'esrf-bliss-add-targets-export-name' into 4.0.1-rc 2019-02-08 13:09:06 +01:00
441c3dc5db Merge branch 'add-targets-export-name' of https://github.com/esrf-bliss/slsDetectorPackage into esrf-bliss-add-targets-export-name
Pull request from Samuel ESRF
2019-02-08 13:07:08 +01:00
afd9e29424 updated release.txt to have eriks bug fix for receiver gap pixels enable in reciever 2019-02-08 12:53:58 +01:00
ce939b3cd6 Merge branch '4.0.1-rc' of github.com:slsdetectorgroup/slsDetectorPackage into 4.0.1-rc 2019-02-08 12:45:45 +01:00
0984654fd0 updated release.txt 2019-02-08 12:33:04 +01:00
cd738106ec printf and uninitialized variables 2019-02-08 11:14:16 +01:00
0e120330f4 fixed comparisons to build with clang 2019-02-08 10:16:32 +01:00
bf0e0ac601 updated binaries in serverbin 2019-02-07 17:06:07 +01:00
143682cfb1 updaterev 2019-02-07 16:55:01 +01:00
22686e1e25 eiger server bug fix: getmeasured period and exptime gets 32 bit from Febinterface and needs to be casted to int64_t before multiplying by 10 2019-02-06 14:52:52 +01:00
e13ecc8625 Add slsReceiver and slsDetector targets to the export set (used by donwstream project)
set TARGETS_EXPORT_NAME if the project is built directly.
2019-02-05 11:51:03 +01:00
ef3e01b9bd Merge branch '4.0.1-rc' of github.com:slsdetectorgroup/slsDetectorPackage into 4.0.1-rc 2019-02-05 10:49:46 +01:00
dffa4d9de5 eiger manual 2019-02-05 10:46:37 +01:00
dfca81208b manual acq: uncomment insignificant 2019-02-05 10:36:33 +01:00
37be7d0e2b manual acq config added 2019-02-04 17:54:58 +01:00
49812a34ae manual acq changes for debugging 2019-02-04 17:31:58 +01:00
133b82ad61 Merge branch '4.0.1-rc' of github.com:slsdetectorgroup/slsDetectorPackage into 4.0.1-rc 2019-02-04 16:43:44 +01:00
61e769773b got rid of insignificant printouts from debugging 2019-02-04 16:43:37 +01:00
23dce681b2 added clang format and clang tidy from refactor 2019-02-04 14:11:06 +01:00
7481c7f0e6 Merge branch '4.0.1-rc' of github.com:slsdetectorgroup/slsDetectorPackage into 4.0.1-rc 2019-02-01 18:50:08 +01:00
3c2bbf6ad4 gotthard server: possible fix for master and slave sync problem when configuring mac for different frames and sending dummy image, still problem of missing or extra 2 packets inslave or master not sending any frames sometimes, multi: possible fix of image reconstruction in x direction in gui 2019-02-01 18:48:51 +01:00
b8fec6c050 gotthard server: possible fix for master and slave sync problem when configuring mac for different frames and sending dummy image, still problem of missing or extra 2 packets inslave or master not sending any frames sometimes 2019-02-01 18:48:25 +01:00
2f11681d3f gotthard server: configmac should also set cycles for sending dummy frame 2019-01-30 18:24:25 +01:00
12f8166d25 manual acq changed config file, added some changes for jungfrau that aren;t tested, but soleil acq test passed 2019-01-29 15:49:41 +01:00
fd68a41918 udp socket creation error, udpsocket assigned only after. unique ptr later 2019-01-16 19:46:08 +01:00
d45375947f only destroy sem if it was initialized 2019-01-16 11:53:16 +01:00
73ae8c6151 removing static libs 2019-01-15 17:24:20 +01:00
615dd2a84f jungfrau server: minor change 2019-01-07 12:06:04 +01:00
dc80dccb8a jungfrau server: updated binaries 2019-01-07 11:52:36 +01:00
de34d85761 jungfrau server for firmware 0.7, updated required FW version to run current code 2019-01-07 11:51:25 +01:00
f747c908dc soleils test plus some modifications 2019-01-04 11:09:53 +01:00
64d94b978b for temporary testing 2019-01-04 09:13:33 +01:00
f810a9e9fb updated rev 2019-01-04 09:13:00 +01:00
152186ee59 updated gotthard server binaries 2019-01-03 14:14:17 +01:00
d9551fa07f gotthard server: updated gotthard api version 2019-01-03 11:45:39 +01:00
8738c6b9a2 jungfrau server: updated severdefs to correspond to registerdefs update, need to update firmware version required for jungffrau server exe 2019-01-03 11:43:21 +01:00
f701c731fb few changes to jungfrau server registers, mainly temp 2018-12-18 18:06:52 +01:00
e2306bd41c conda recipe 2018-12-12 16:46:01 +01:00
5e71aeb85f binaries modified 2018-12-04 13:39:27 +01:00
3a51d107bd gotthard server bug fix: switching between roi and no roi has complex fnum reengineering as fnum and pnum doesnt exist for gotthard, sol at the moment: send an image when configuremac, identify first packet if first two channels is 0xcacacaca, ifthe fnum is odd, then increment. Looking at this only at first image in an acquisition, also reduces roi time by configuring mac only when setting roi, not when getting 2018-12-04 12:09:46 +01:00
6b4a9be870 in between 2018-12-04 10:45:55 +01:00
b4b38cb607 bugfix for gotthard roi and noroi frame number, temporary fix to look at CACACACA to know if its a second packet, and first time look at last bit to know wheter to increment or not for consecutive frames fr no roi 2018-12-03 16:25:24 +01:00
03e7a83e74 incorrect mac address in config file should set error flag and give fail upon calling readconfig file 2018-12-03 12:10:37 +01:00
0869a975e4 updated makefile in manual-api to point to binaries in bin and not build/bin. cmake points to build/bin anyway 2018-12-03 12:05:38 +01:00
2cebec90ee users: added setroi and getroi, modified multi to allow imod for setroi on sls level, modified detectorsize to set a single roi or give roi if only one roi 2018-12-03 11:50:56 +01:00
c611523352 updated users class: get/set detector size sets one roi /get roi if roi enabled. mythen is not supported anymore, hence 2018-12-03 11:17:30 +01:00
a774c62cd4 binaries udpated 2018-12-03 10:56:24 +01:00
550ed4b1c2 eiger server bug fix: read and write reg only wrote to the right fpga, fixed 2018-12-03 10:55:32 +01:00
2c08c1e7ce updated binary 2018-12-03 10:49:26 +01:00
2b0208bd98 gotthard server bug fix: adc channel shifted by one fixed changin token timing rev for board 2 2018-12-03 10:48:52 +01:00
05d8ef6277 bug fix for starting and stopping receiver, without listening 2018-12-03 10:45:46 +01:00
228cfa35c0 receiver bug fix: padding was set only if deactivated, frame padding enabled and deactivated padding enabled. Fixed that frame padding and deactivated padding is independent. Padding is done if frame padding enabled or if deactivated and deactivated padding enabled 2018-11-30 16:10:13 +01:00
f120f9c3dd users bug fix:getting id(version) for single/multi detector 2018-11-30 16:00:27 +01:00
262bf1b307 users class: added stopped to getrunstatus list 2018-11-30 15:42:13 +01:00
120 changed files with 3413 additions and 1333 deletions

6
.clang-format Normal file
View File

@ -0,0 +1,6 @@
BasedOnStyle: LLVM
IndentWidth: 4
UseTab: Never
ColumnLimit: 0
AlignConsecutiveAssignments: false

7
.clang-tidy Normal file
View File

@ -0,0 +1,7 @@
---
Checks: '*, -google-runtime-references, -hicpp-no-array-decay, -cppcoreguidelines-pro-bounds-array-to-pointer-decay, -cppcoreguidelines-pro-bounds-pointer-arithmetic, -fuchsia*,-readability-else-after-return,-readability-avoid-const-params-in-decls,-hicpp-signed-bitwise,-cppcoreguidelines-pro-bounds-constant-array-index,-llvm-header-guard,-readability-static-accessed-through-instance,-google-readability-todo'
WarningsAsErrors: '*'
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
FormatStyle: none
...

View File

@ -41,5 +41,4 @@ deploy:
provider: script
script: find $HOME/miniconda/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
on:
branch: 4.0.0
branch: 4.1.0

View File

@ -2,17 +2,32 @@ cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
set (CALIBRATE OFF)
option (USE_HDF5 "HDF5 File format" OFF)
option (USE_TEXTCLIENT "Text Client" OFF)
option (USE_RECEIVER "Receiver" OFF)
option (USE_GUI "GUI" OFF)
# Check if project is being used directly or via add_subdirectory
set(SLS_MASTER_PROJECT OFF)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(SLS_MASTER_PROJECT ON)
endif()
option (SLS_USE_HDF5 "HDF5 File format" OFF)
option (SLS_USE_TEXTCLIENT "Text Client" OFF)
option (SLS_USE_RECEIVER "Receiver" OFF)
option (SLS_USE_GUI "GUI" OFF)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++98 -Wno-misleading-indentation")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++98")
endif ()
#Flags to always be used
# -Wno-unused-parameter should eventually be removes
# -Wno-overloaded-virtual TODO! remove warnings in refactor
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-overloaded-virtual -Wno-unused-parameter -std=c++98")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# clang does not support -Wno-misleading-indentation
# add any special clang flags
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-misleading-indentation")
endif ()
endif()
find_package(Qt4)
find_package(Qwt 6)
@ -20,9 +35,9 @@ find_package(CBF)
find_package(Doxygen)
# find_package(PNG REQUIRED)
if (USE_HDF5)
if (SLS_USE_HDF5)
find_package(HDF5 1.10 COMPONENTS CXX)
endif (USE_HDF5)
endif (SLS_USE_HDF5)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
@ -30,22 +45,26 @@ set(CMAKE_INSTALL_RPATH "$ORIGIN")
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
if (USE_TEXTCLIENT)
if (SLS_USE_TEXTCLIENT)
add_subdirectory(slsDetectorSoftware)
endif (USE_TEXTCLIENT)
endif (SLS_USE_TEXTCLIENT)
if (USE_RECEIVER)
if (SLS_USE_RECEIVER)
add_subdirectory(slsReceiverSoftware)
add_subdirectory(manual/manual-api)
endif (USE_RECEIVER)
endif (SLS_USE_RECEIVER)
if (USE_GUI)
if (SLS_USE_GUI)
if (QT4_FOUND AND QWT_FOUND)
add_subdirectory(slsDetectorGui)
endif()
endif (USE_GUI)
endif (SLS_USE_GUI)
if (SLS_MASTER_PROJECT)
# Set targets export name (otherwise set by upstream project)
set(TARGETS_EXPORT_NAME "slsdetector-targets")
endif (SLS_MASTER_PROJECT)
if (CALIBRATE)
if (DEFINED ENV{ROOTSYS})

View File

@ -75,13 +75,13 @@ Use cmake to create out-of-source builds, by creating a build folder parallel to
$ cd ..
$ mkdir slsDetectorPackage-build
$ cd slsDetectorPackage-build
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DUSE_HDF5=OFF
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=OFF
$ make
```
Use the following as an example to compile statically and using specific hdf5 folder
```
$ HDF5_ROOT=/opt/hdf5v1.10.0 cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DUSE_HDF5=ON
$ HDF5_ROOT=/opt/hdf5v1.10.0 cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=ON
```
After compiling, the libraries and executables will be found at `bin` directory
```

View File

@ -1,508 +1,167 @@
SLS Detector Package 4.0.0 released on 27.09.2018
=================================================
SLS Detector Package 4.1.0 released on 04.10.2019 (Minor Release)
=================================================================
This document describes the differences between 4.1.0 and 4.0.2 releases.
CONTENTS
--------
1. Topics Concerning
2. Resolved Issues
3. Known Issues
4. Firmware Requirements
5. Download, Documentation & Support
1. Topics Concerning
====================
- software for eiger quad hardware integrated
- command line framesl, cyclesl was printing in float (jungfrau, gotthard)
- eiger interrupt subframe flag
- eiger server reg command (+0x100 for left and +0x200 for right)
- additional eiger parameters included i master file
INTRODUCTION
2. Resolved Issues
==================
This document describes the differences between 4.0.0 and 3.1.4 releases.
Client
------
1. Command line quad integrates Eiger quad hardware
2. Command line commands framesl, cyclesl, fatesl, problesl and nframes was
printing the result in decimals. It is now fixed to print as whole numbers.
Download
--------
The Source Code (Default C++ API):
https://github.com/slsdetectorgroup/slsDetectorPackage
The Conda Lib Package:
https://github.com/slsdetectorgroup/sls_detector_lib
The Conda GUI Package:
https://github.com/slsdetectorgroup/sls_detector_gui
The Python Interface (including the package):
https://github.com/slsdetectorgroup/sls_detector
Documentation
-------------
Manual (HTML & PDF):
https://www.psi.ch/detectors/documentation
slsDetectorPackage/manual/docs/
Command Line Documentation:
manual/docs/html/slsDetectorClientDocs/index.html
manual/docs/pdf/slsDetectorClientDocs.pdf
C++ API Documentation:
manual/docs/html/slsDetectorUsersDocs/index.html
manual/docs/pdf/slsDetectorUsersDocs.pdf
C++ API Example:
manual/manual-api/mainClient.cpp
manual/manual-api/mainReceiver.cpp
Python API Documentation:
https://slsdetectorgroup.github.io/sls_detector/
Further Documentation:
https://www.psi.ch/detectors/users-support
Support
-------
Detector Server (Eiger)
-----------------------
General Software related:
dhanya.thattil@psi.ch
anna.bergamaschi@psi.ch
Python related:
erik.frojdh@psi.ch
1. Command line quad integrates Eiger quad hardware
2. Control flag to set last subframe to be interrupted depending on subexptime.
By default, it is disabled and will wait till the last sub frame has finished
exposing.
3. Left and Right FEB registers accessed independently using addr (+0x100 and +0x200)
respectively.
Receiver
--------
1. Command line quad integrates Eiger quad hardware
2. Master file has additional parameters for Eiger (Quad Enable, Gap Pixels Enable).
Writer version update to 4.0.
3. Zmq Json Header has additional informaion
CONTENTS
1. Firmware Requirements
2. Changes in User Interface
3. New/Modified Commands
4. Other New Features
5. Resolved Issues
6. Known Issues
7. Next Major Release Plans
1. Firmware Requirements
========================
Gotthard
========
Minimum compatible version : 11.01.2013
Latest version : 08.02.2018 (50um and 25um Master)
09.02.2018 (25 um Slave)
Eiger
=====
Minimum compatible version : 22
Latest version : 22
Jungfrau
========
Minimum compatible version : 15.06.2018
Latest version : 15.06.2018
Detector Upgrade
================
Gotthard Cannot be upgraded remotely. Requires programming via USB blaster
Eiger Can be upgraded remotely via bit files
Jungfrau Can be upgraded remotely using sls_detector_put programfpga <pof>
Instructions available at
https://www.psi.ch/detectors/installation-instructions
under Detector Upgrade -> [Detector Type] -> Firmware.
Please refer to the link below for more details on the firmware versions.
https://www.psi.ch/detectors/firmware.
2. Changes in User Interface
============================
Client
------
1. Shared Memory:
POSIX shared memory has been implemented and they are typically created in
/dev/shm/ folder.
A multiSlsDetector object will create a shared memory segment with naming style:
slsDetectorPackage_x_[_z]
and an slsDetector object will create a shared memory segment with naming style:
slsDetectorPackage_x_sls_y[_z]
where
x is the multi detector id
y is the sls detector id
z is the environment variable SLSDETNAME, if set.
They can be deleted directly.
Environment variable SLSDETNAME included for user-friendliness
of using 2 different detectors from the same client pc. One needn't use
different multi detector id if the SLSDETNAME is different for both consoles.
Constructor will fail if shared memory size is different (different package
releases/detectors). Loading config file cleans shared memory.
2. Exceptions in constructors:
All constructors that have an error throws an exception. For this release,
this is caught within the package and interfaced as error codes or messages
to the users using command line or API.
As a result:
- slsDetectorsUsers constructor signature now includes a success flag.
- If one uses multiSlsDetector, slsDetector, ZmqSocket classes directly,
catch exceptions from constructors.
- In future releases, the exception will be thrown
outside the package for the users to handle it.
3. API Compatibility:
Client now checks API version of Detector Server - Client and Receiver - Client
when connecting for the first time to detector server or receiver server
and the online flags have not been set in shm.
Upon failure, error messages will ensue and further commands will not
be executed. Detector servers referred to are only for Eiger, Jungfrau and Gotthard.
Previously, the detector server would exit on mismatched Firmware-Detector
server mismatch. They now wait for client to ask for compatibility check,
which is done the first time client connects to the detector and the
online flag in shm has not been set.
4. Commands "type", "id" and "replace" are removed.
Receiver
--------
1. Reciever Header Structure in file writing and call back:
sls_receiver_header structure added to sls_receiver_defs.h for image headers
in file writing.
#define MAX_NUM_PACKETS 512
typedef std::bitset<MAX_NUM_PACKETS> sls_bitset;
typedef struct {
sls_detector_header detHeader; /**< is the detector header */
sls_bitset packetsMask; /**< is the packets caught bit mask */
} sls_receiver_header;
It includes the detector header structure + bitmask of 512 bits,
where each bit represents a packet caught. This is useful in saving time
in writing to file by not padding missing packets and still retaining useful data.
The binary and HDF5 writer version number changed from 1.0 to 2.0.
The detector header version remains as 1.0.
registerCallBackRawDataReady modified to give this structure pointer,
instead of individual structure member pointers.
2. ZmqSocket class:
If one uses ZmqSocket.h, then the json header has to be parsed outside
the class to allow the user to remove the restriction in extracting all data
from the json header.
3. Receiver Call back with modified size:
registerCallBackRawDataModifyReady call back that is similar to the receiver
registerCallBackRawDataReady has been added to allow the call back to
specify an updated size of image after call back. This is in view to process
an image in call back (including extract only a region of the image) and
provide this updated size in callback. This new resized/processed image
will be written to file or streamed out via zmq. This is useful in ROI
selection in the receiver.
This also means that the call back is now called before writing to file.
3. New/Modified Commands
========================
Client
------
1. add (modified):
appends detector to end of multi detector list.
2. replace:
sets hostname/ip address for a single detector.
3. user:
get user details from shared memory.
4. checkdetversion:
checks client version compatibility with detector server.
5. checkrecversion:
checks client version compatibility with receiver server.
Receiver
--------
1. rx_zmqip:
sets/gets the zmq (TCP) ip of the receiver from where data is streamed
out from. (Eg. to the gui or intermediate process). By default, it is
the same as the zmqip.
2. zmqip:
sets/gets the zmq (TCP) ip, where client listens to, to reconstuct images.
(Eg. from receiver or intermediate process). By default, it is the same
as rx_zmqip.
3. rx_jsonaddheader:
sets/gets additional json header to be streamed out with the zmq from
receiver. Default is empty. Eg. p rx_jsonaddheader \"what\":\"nothing\"
4. r_discardpolicy:
sets/gets the frame discard policy in the receiver.
nodiscard - no discard (default),
discardempty - discard only empty frames,
discardpartial - discard any partial frame(fastest)
5. r_padding:
sets/gets the frame padding in the receiver.
0 does not pad partial frames(fastest),
1 (default) pads partial frames.
One can look at bitmask in the sls_receiver_header to process the unpadded
partial frames later.
6. activate (modified):
Extra option added to pad or unpad images in receivers when deactivated.
activate i [padding option], where i is activate/deactivate and padding
option is "padding" (default) or "nopadding".
7. rx_udpsocksize:
sets/gets the UDP socket buffer size. Already attempts to set by default
to 100mb, 2gb for Jungfrau. Does not remember custom values in client
shared memory, so must be initialized each time after setting receiver
hostname in config file.
8. rx_realudpsocksize:
gets the actual UDP socket buffer size. Usually double the set udp socket
buffer size due to kernel bookkeeping.
9. r_framesperfile:
sets/gets the frames per file in receiver. 0 means infinite or all frames
in a single file. Default of Eiger changed from 2k to 10k.
Eiger Specific
--------------
1. status trigger:
To trigger internally via software, one can use "status trigger".
2. subdeadtime:
sets/gets sub frame dead time in s in 32 bit mode. Subperiod is set in
the detector by subexptime + subdeadtime. This value is normally a
constant set by an expert catered to individual detector modules in the
config file. Receiver files writes master file metadata subperiod
instead of subdeadtime.
3. gappixels:
enables/disables gap pixels in system (detector & receiver). 1 sets,
0 unsets. In Receiver, 4 bit gap pixels mode is not implemented, but is
implemented in client data call back. Gap pixels are at module level
and not at multi module level.
4. measuredperiod:
gets the measured frame period (time between last frame and the previous
one) in s. Makes sense only for acquisitions of more than 1 frame.
5. measuredsubperiod:
gets the measured subframe period (time between last subframe and the
previous one) in s in 32 bit mode.
6. flags(modified):
extra flags "nooverflow" (default) and "overflow" for sub images in 32
bit mode. If set to overflow, it will set MSB of pixel data high if
there was any saturation in any of the sub images 32 bit mode.
Jungfrau Specific
-----------------
1. storagecells:
sets/gets number of additional storage cells per acquisition. For very
advanced users only. Range: 0-15. Default: 0.
The #images = #frames * #cycles * (#storagecells +1).
2. storage_start:
sets/gets the storage cell that stores the first acquisition of the series.
For very advanced users only. Range: 0-15. Default: 15(0xf).
4. Other New Features
=====================
Client
------
1. (Jungfrau & Gotthard) Settingsdir and caldir is removed from config file.
Default dacs are stored in detector server. Hence, these folders
are also removed from slsDetectorPackage/settingsdir. Eiger and Mythen
continue to have them.
2. Depending on 1d position of detectors and detsizechan in config file,
row and column (previously xcoord and ycoord) are given to detector
servers (Eiger and Jungfrau) to encode into the udp header.
3. (Eiger) Setting threshold energy changes such as CAL dac is irrelevant
when interpolating between two energies and VRS dac is interpolated, not copied.
4. Users API updated with the following functions:
- setReceiverFramesDiscardPolicy
- setReceiverPartialFramesPadding
- setReceiverFramesPerFile
- sendSoftwareTrigger
- setSubFrameExposureDeadTime
- setSubFrameExposureTime
- enableGapPixels
- getMeasuredPeriod
- getMeasuredSubFramePeriod
- setOverflowMode
- setNumberOfStorageCells
- setStoragecellStart
- setThresholdEnergy (overloaded)
- resetFramesCaughtInReceiver
- setReceiverFifoDepth
- setFlowControl10G
- setTenGigabitEthernet
- getNMods
- setReceiverDataStreamingOutIP
- setClientDataStreamingInIP
SlsReceiver
-----------
1. slsMultiReceiver executable added that creates multiple receiver child processes.
./slsMultiReceiver [start_tcp_port] [num_receivers] [1 for call back, 0 for none]
2. Default row and column (previously xcoord and ycoord) are hardcoded
for missing packets. (Eiger and Jungfrau)
Gui
---
1. (Jungfrau) Gain plot included. Option under 2D options in Plot tab.
2. Option to maintain aspect ratio
3. Start and Stop separated to prevent multiple click syndrome.
Detector Server
---------------
1. (Jungfrau) To use programfpga command, one must start server with -update
mode and then restart server without -update mode.
2. (Jungfrau) ASIC Timer configured at server start up and changed a few
startup values for firmware v0.7 such as adc phase, ADC_PORT_INVERT_VAL
and ADC offset half speed value.
3. (Jungfrau) Minimum exposure time of 50 ns was implemented.
4. (Eiger and Jungfrau) They can be configured to have x and y coord values
of the detector in their udp header.
5. Resolved Issues
==================
Client
------
memory leak for multi threading
1. Compiler flag -std=c++98 enforced. Debug flag removed.
2. If trimen gives different list from different detectors, it returns a -1.
3. Version format for each submodule of the package changed to just date YYMMDD.
Users class fixed to give correct version, instead of -1.
4. Getting settings in users class gave -1. Fixed now.
5. (Jungfrau) Programming FPGA now creates the rawbin file from pof in tmp
rather than source file location (for permission issues).
6. (Gotthard) ROI segmentation fault fixed.
Receiver
--------
1. Silent feature of receiver fixed.
2. Socket descriptor misused earlier for success flag, instead exceptions
used that are handled inside the package.
3. Global optind variable initialized to instantiate multiple receivers
in same process. Also removed static members to enable this feature.
4. Socket buffer size attempts to set for each acquiistion and provide
warning if no capabilities. Warnings can be removed using instruction with
error provided. Default Jungfrau UDP socket buffer size if 2 GB, default is
100 MB.
5. Refactored code a bit for performance and robustness, blocking push
in buffer between listener and dataprocessor
Detector Server
---------------
1. (Jungfrau) Stop server also mapped during a reset. Reading power status
instead of user input register for power.
2. (Eiger) Bug fix for saving trimbits to file (Advanced users).
3. (Gotthard 25um) config.txt is not read again after detector startup,
no matter the number of times the detector server is restarted.
6. Known Issues
3. Known Issues
===============
4. Firmware Requirements
========================
Receiver
--------
1. HDF5 compression and filters are not implemented yet.
Detector Server
---------------
1. (Eiger) Registers mapped differently between firmware v20 and v22.
So, please ensure correct on-board server before switching between
firmware versions. Else one cannot ping it anymore. Will need to flash firmware
again to recover.
2. (Gotthard) To switch back to all ADC from single ADC ROI, one must take
even number of images for the receiver to understand complete images.
This will be fixed in the next firmware upgrade.
7. Next Major Release Plans
===========================
Gotthard
========
Minimum compatible version : 11.01.2013
Latest compatible version : 08.02.2018 (50um and 25um Master)
09.02.2018 (25 um Slave)
Eiger
=====
Minimum compatible version : 24
Latest compatible version : 24
Jungfrau
========
Minimum compatible version : 26.02.2018
Latest compatible version : 06.12.2018
Client
------
1. Exceptions thrown to the user to be handled.
2. Compilation using c++11.
3. Support of Mythen II restricted to this major and its minor releases.
4. Restructuring and refactoring of client code.
Detector Upgrade
================
Gotthard Cannot be upgraded remotely. Requires programming via USB blaster
Eiger Can be upgraded remotely via bit files
Jungfrau Can be upgraded remotely using sls_detector_put programfpga <pof>
Instructions available at
https://slsdetectorgroup.github.io/slsDetectorPackage/docs/html/slsDetectorInstall/GOTTHARD_Firmware.html
https://slsdetectorgroup.github.io/slsDetectorPackage/docs/html/slsDetectorInstall/EIGER_Firmware.html
https://slsdetectorgroup.github.io/slsDetectorPackage/docs/html/slsDetectorInstall/JUNGFRAU_Firmware.html
Please refer to the link below for more details on the firmware versions.
https://www.psi.ch/en/detectors/firmware
5. Download, Documentation & Support
====================================
Download
--------
The Source Code (Default C++ API):
https://github.com/slsdetectorgroup/slsDetectorPackage
The Conda Lib Package:
https://github.com/slsdetectorgroup/sls_detector_lib
The Conda GUI Package:
https://github.com/slsdetectorgroup/sls_detector_gui
The Python Interface (including the package):
https://github.com/slsdetectorgroup/sls_detector
Documentation
-------------
Manual (HTML & PDF):
https://www.psi.ch/en/detectors/documentation
slsDetectorPackage/manual/docs/
Command Line Documentation:
https://slsdetectorgroup.github.io/slsDetectorPackage/docs/html/slsDetectorClientDocs/index.html
https://slsdetectorgroup.github.io/slsDetectorPackage/docs/pdf/slsDetectorClientDocs.pdf
manual/docs/html/slsDetectorClientDocs/index.html
manual/docs/pdf/slsDetectorClientDocs.pdf
C++ API Documentation:
https://slsdetectorgroup.github.io/slsDetectorPackage/docs/html/slsDetectorUsersDocs/index.html
https://slsdetectorgroup.github.io/slsDetectorPackage/docs/pdf/slsDetectorUsersDocs.pdf
manual/docs/html/slsDetectorUsersDocs/index.html
manual/docs/pdf/slsDetectorUsersDocs.pdf
C++ API Example:
https://slsdetectorgroup.github.io/slsDetectorPackage/exampleCode/slsDetectorUsersExample/index.html
manual/manual-api/mainClient.cpp
manual/manual-api/mainReceiver.cpp
Python API Documentation:
https://slsdetectorgroup.github.io/sls_detector/
TroubleShotting:
https://www.psi.ch/en/detectors/troubleshooting
Further Documentation:
https://www.psi.ch/en/detectors/users-support
Support
-------
dhanya.thattil@psi.ch
erik.frojdh@psi.ch
anna.bergamaschi@psi.ch

17
cmk.sh
View File

@ -60,6 +60,7 @@ while getopts ":bchd:j:trge" opt ; do
b)
echo "Building of CMake files Required"
REBUILD=1
CLEAN=1
;;
c)
echo "Clean Required"
@ -69,6 +70,7 @@ while getopts ":bchd:j:trge" opt ; do
echo "Building of CMake files with HDF5 option Required"
HDF5=1
REBUILD=1
CLEAN=1
;;
d)
echo "New HDF5 directory: $OPTARG"
@ -82,16 +84,19 @@ while getopts ":bchd:j:trge" opt ; do
echo "Compiling Options: Text Client"
TEXTCLIENT=1
REBUILD=1
CLEAN=1
;;
r)
echo "Compiling Options: Receiver"
RECEIVER=1
REBUILD=1
CLEAN=1
;;
g)
echo "Compiling Options: GUI"
GUI=1
REBUILD=1
CLEAN=1
;;
e)
echo "Compiling Options: Debug"
@ -116,20 +121,20 @@ done
if [ $TEXTCLIENT -eq 0 ] && [ $RECEIVER -eq 0 ] && [ $GUI -eq 0 ]; then
CMAKE_POST+=" -DUSE_TEXTCLIENT=ON -DUSE_RECEIVER=ON -DUSE_GUI=ON "
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON -DSLS_USE_RECEIVER=ON -DSLS_USE_GUI=ON "
echo "Compile Option: TextClient, Receiver and GUI"
else
if [ $TEXTCLIENT -eq 1 ]; then
CMAKE_POST+=" -DUSE_TEXTCLIENT=ON "
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON "
echo "Compile Option: TextClient"
fi
if [ $RECEIVER -eq 1 ]; then
CMAKE_POST+=" -DUSE_RECEIVER=ON "
CMAKE_POST+=" -DSLS_USE_RECEIVER=ON "
echo "Compile Option: Receiver"
fi
if [ $GUI -eq 1 ]; then
CMAKE_POST+=" -DUSE_GUI=ON "
CMAKE_POST+=" -DSLS_USE_GUI=ON "
echo "Compile Option: GUI"
fi
fi
@ -161,10 +166,10 @@ fi
#hdf5 rebuild
if [ $HDF5 -eq 1 ]; then
CMAKE_PRE+="HDF5_ROOT="$HDF5DIR
CMAKE_POST+=" -DUSE_HDF5=ON "
CMAKE_POST+=" -DSLS_USE_HDF5=ON "
#normal mode rebuild
else
CMAKE_POST+=" -DUSE_HDF5=OFF "
CMAKE_POST+=" -DSLS_USE_HDF5=OFF "
fi

View File

@ -33,7 +33,7 @@ source directory.
$ cd ..
$ mkdir slsDetectorPackage-build
$ cd slsDetectorPackage-build
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DUSE_HDF5=OFF
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=OFF
$ make
</PRE>
@ -42,7 +42,7 @@ Use the following as an example to compile statically and using specific hdf5
folder
<PRE>
$ HDF5_ROOT=/opt/hdf5v1.10.0 cmake ../slsDetectorPackage
-DCMAKE_BUILD_TYPE=Debug -DUSE_HDF5=ON
-DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=ON
</PRE>
<P>

Binary file not shown.

View File

@ -0,0 +1,26 @@
INCLUDES = -I .
SRC_TEST = main.cpp
LIBDIR = ../../bin
ZLIBDIR = ../../slsReceiverSoftware/include
LBITS := $(shell getconf LONG_BIT)
SERVER_TYPE = "64 bits compile server detected..."
LDFLAG_DET = -I. -L$(LIBDIR) -L$(ZLIBDIR) -lSlsReceiver -lSlsDetector -L/usr/lib64/ -pthread -lrt -L. -lzmq
all: manual-acq
manual-acq:$(SRC_TEST)
@echo "------------------------------------------------------------"
@echo "creating test software"
@echo $(SERVER_TYPE)
@echo "------------------------------------------------------------"
mkdir -p bin
g++ -o bin/manual-acq $(SRC_TEST) $(INCLUDES) $(LDFLAG_DET) -lm -lstdc++
cp bin/manual-acq ../../bin
clean:
@echo "------------------------------------------------------------"
@echo "cleaning test software"
@echo "------------------------------------------------------------"
rm -rf bin/manual-acq

1
manual/manual-acq/ansi.h Symbolic link
View File

@ -0,0 +1 @@
../../slsReceiverSoftware/include/ansi.h

View File

@ -0,0 +1,21 @@
hostname bchip065+bchip195+
0:rx_tcpport 1954
0:rx_udpport 50005
0:detectorip 10.1.2.185
0:rx_udpip 10.1.2.102
1:rx_tcpport 1955
1:rx_udpport 50006
1:detectorip 10.1.2.186
1:rx_udpip 10.1.2.102
rx_hostname pc1875
outdir /home/l_msdetect/dhanya/outdir
vhighvoltage 0
enablefwrite 0
timing auto

1
manual/manual-acq/libzmq.a Symbolic link
View File

@ -0,0 +1 @@
../../slsReceiverSoftware/include/libzmq.a

900
manual/manual-acq/main.cpp Normal file
View File

@ -0,0 +1,900 @@
//------------------------------------------------------------------------------------------------------
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <stdint.h>
#include <algorithm>
#include <functional>
#include <cctype>
#include <locale>
#include <sstream>
#include <unistd.h>
#include "sls_receiver_defs.h"
#include "slsReceiverUsers.h"
#include "sls_detector_defs.h"
#include "slsDetectorUsers.h"
//#define GOTTHARD_25_TEST
//#define JUNGFRAU_TEST
#define GOTTHARD_TEST
//======================================================================================================
// test configuration
//======================================================================================================
int acquisition_nb = 1; // number of acquisition to make
int acquisition_nb_ok = 0; // number of correct acquisition
uint64_t last_acquisition_received_frames; // number of received frames during the last acquisition
std::vector <int> acquisition_nb_list;
bool use_trace = false; // activate the acquisition log
//------------------------------------------------------------------------------------------------------
// GOTTHARD 25um
//------------------------------------------------------------------------------------------------------
#ifdef GOTTHARD_25_TEST
const int receivers_nb = 2; // number of receivers
const int receivers_rx_tcpport[receivers_nb] = {1954, 1955}; // tcp port for each receiver
const int detector_id = 0; // detector identifier for slsDetectorUsers constructor
const std::string detector_config_file_name = "gotthard25.config"; // configuration file name (must be present in the same folder of this application)
const long detector_receiver_fifo_depth = 2500;
double detector_exposure_time_sec = 0.005;
double detector_exposure_period_sec = 0.10;
const double detector_delay_after_trigger_sec = 0.0;
const std::string detector_trig_mode = "auto"; // "auto" or "trigger"
int64_t detector_nb_frames_per_cycle = 10;
const int64_t detector_nb_cycles = 1;
int detector_module_index[receivers_nb] = {0, 1};
#else
//------------------------------------------------------------------------------------------------------
// GOTTHARD
//------------------------------------------------------------------------------------------------------
#ifdef GOTTHARD_TEST
const int receivers_nb = 1; // number of receivers
const int receivers_rx_tcpport[receivers_nb] = {1954}; // tcp port for each receiver
const int detector_id = 0; // detector identifier for slsDetectorUsers constructor
const std::string detector_config_file_name = "gotthard25.config"; // configuration file name (must be present in the same folder of this application)
const long detector_receiver_fifo_depth = 2500;
double detector_exposure_time_sec = 0.005;
double detector_exposure_period_sec = 0.1;
const double detector_delay_after_trigger_sec = 0.0;
const std::string detector_trig_mode = "auto"; // "auto" or "trigger"
int64_t detector_nb_frames_per_cycle = 10;
const int64_t detector_nb_cycles = 1;
int detector_module_index[receivers_nb] = {0};
#else
//------------------------------------------------------------------------------------------------------
// JUNGFRAU
//------------------------------------------------------------------------------------------------------
#ifdef JUNGFRAU_TEST
const int receivers_nb = 1; // number of receivers
const int receivers_rx_tcpport[receivers_nb] = {1954}; // tcp port for each receiver
const int detector_id = 0; // detector identifier for slsDetectorUsers constructor
const std::string detector_config_file_name = "jungfrau_nanoscopium_switch.config"; // configuration file name (must be present in the same folder of this application)
const long detector_receiver_fifo_depth = 2500;
double detector_exposure_time_sec = 0.0005;
double detector_exposure_period_sec = 0.001;
const double detector_delay_after_trigger_sec = 0.0;
const std::string detector_trig_mode = "auto"; // "auto" or "trigger"
int64_t detector_nb_frames_per_cycle = 10000;
const int64_t detector_nb_cycles = 1;
const int detector_clock_divider = 1;
int detector_module_index[receivers_nb] = {0};
#endif
#endif
#endif
//------------------------------------------------------------------------------------------------------
// test instances
//------------------------------------------------------------------------------------------------------
std::vector<slsReceiverUsers *> receivers;
slsDetectorUsers * detector = NULL;
//------------------------------------------------------------------------------------------------------
// tools functions
//------------------------------------------------------------------------------------------------------
/** Define Colors to print data call back in different colors for different recievers */
#define PRINT_IN_COLOR(c,f, ...) printf ("\033[%dm" f RESET, 30 + c+1, ##__VA_ARGS__)
#define PRINT_SEPARATOR() cprintf(MAGENTA, "============================================\n")
/************************************************************************
* \brief cleans the shared memory used by the camera
************************************************************************/
void clean_shared_memory()
{
std::string cmd = "rm /dev/shm/slsDetectorPackage*;";
std::system(cmd.c_str());
}
/*******************************************************************
* \brief converts a version id to a string
* \return version in string format (uppercase & hexa)
*******************************************************************/
std::string convertVersionToString(int64_t in_version)
{
std::stringstream tempStream;
tempStream << "0x" << std::uppercase << std::hex << in_version;
return tempStream.str();
}
//==================================================================
// Related to commands (put & get)
//==================================================================
/*******************************************************************
* \brief Converts a standard string to args arguments
* \param in_command command in command line format
* \param out_argv output c-strings c-array
* \param out_argc output number of arguments of out_argv
*******************************************************************/
void convertStringToArgs(const std::string & in_command,
char * * & out_argv ,
int & out_argc )
{
out_argv = NULL;
out_argc = 0 ;
// filling a string vector with the command line elements
std::vector<std::string> elements;
std::stringstream ss(in_command);
while (ss)
{
std::string element;
ss >> element;
if(element.size() > 0)
{
elements.push_back(element);
}
}
// setting argc value
out_argc = elements.size();
// allocating argv array
out_argv = new char * [out_argc];
// filling argv array
for (int element_index = 0; element_index < out_argc; element_index++)
{
out_argv[element_index] = new char[elements[element_index].size() + 1]; // adding the allocation of end of c-string
strcpy(out_argv[element_index], elements[element_index].c_str()); // copying the string including the eos
}
}
/*******************************************************************
* \brief Releases args arguments
* \param in_out_argv output c-strings c-array*(static_cast<int *>(p))
* \param in_out_argc output number of arguments of out_argv
*******************************************************************/
void releaseArgs(char * * & in_out_argv ,
int & in_out_argc )
{
if(in_out_argv != NULL)
{
// releasing the c_strings array content
for (int element_index = 0; element_index < in_out_argc; element_index++)
{
delete [] in_out_argv[element_index];
}
// releasing the c_strings array
delete [] in_out_argv;
in_out_argv = NULL;
in_out_argc = 0 ;
}
}
/*******************************************************************
* \brief Executes a set command
* \param in_command command in command line format
* \param in_module_index module index
* \return the command result
*******************************************************************/
std::string setCmd(const std::string & in_command, int in_module_index=-1)
{
std::cout << "setCmd - execute set command:\"" << in_command << "\"" << std::endl;
char * * argv ;
int argc ;
std::string result;
convertStringToArgs(in_command, argv, argc);
if(argc > 0)
{
result = detector->putCommand(argc, argv, in_module_index);
}
releaseArgs(argv, argc);
std::cout << "result=\"" << result << "\"" << std::endl;
return result;
}
/*******************************************************************
* \brief Executes a get command
* \param in_command command in command line format
* \param in_module_index module index
* \return the command result
*******************************************************************/
std::string getCmd(const std::string & in_command, int in_module_index=-1)
{
std::cout << "getCmd - execute get command:\"" << in_command << "\"" << std::endl;
char * * argv ;
int argc ;
std::string result;
convertStringToArgs(in_command, argv, argc);
if(argc > 0)
{
result = detector->getCommand(argc, argv, in_module_index);
}
releaseArgs(argv, argc);
std::cout << "result=\"" << result << "\"" << std::endl;
return result;
}
//------------------------------------------------------------------------------------------------------
// Receivers callbacks
//------------------------------------------------------------------------------------------------------
/**
* Start Acquisition Call back
* slsReceiver writes data if file write enabled.
* Users get data to write using call back if registerCallBackRawDataReady is registered.
* @param filepath file path
* @param filename file name
* @param fileindex file index
* @param datasize data size in bytes
* @param p pointer to object
* \returns ignored
*/
int StartAcq(char* filepath, char* filename, uint64_t fileindex, uint32_t datasize, void*p){
cprintf(BLUE, "#### StartAcq: filepath:%s filename:%s fileindex:%llu datasize:%u ####\n",
filepath, filename, fileindex, datasize);
cprintf(BLUE, "--StartAcq: returning 0\n");
last_acquisition_received_frames = 0LL;
return 0;
}
/**
* Acquisition Finished Call back
* @param frames Number of frames caught
* @param p pointer to object
*/
void AcquisitionFinished(uint64_t frames, void*p){
cprintf(BLUE, "#### AcquisitionFinished: frames:%llu ####\n",frames);
last_acquisition_received_frames = frames;
}
/**
* Get Receiver Data Call back
* Prints in different colors(for each receiver process) the different headers for each image call back.
* @param metadata sls_receiver_header metadata
* @param datapointer pointer to data
* @param datasize data size in bytes.
* @param p pointer to object
*/
void GetData(char* metadata, char* datapointer, uint32_t datasize, void* p)
{
if(use_trace)
{
slsReceiverDefs::sls_receiver_header* header = (slsReceiverDefs::sls_receiver_header*)metadata;
const slsReceiverDefs::sls_detector_header & detectorHeader = header->detHeader;
PRINT_IN_COLOR (*(static_cast<int *>(p)),
"#### %d GetData: ####\n"
"frameNumber: %llu\t\texpLength: %u\t\tpacketNumber: %u\t\tbunchId: %llu"
"\t\ttimestamp: %llu\t\tmodId: %u\t\t"
"row: %u\t\tcolumn: %u\t\treserved: %u\t\tdebug: %u"
"\t\troundRNumber: %u\t\tdetType: %u\t\tversion: %u"
//"\t\tpacketsMask:%s"
"\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n",
*(static_cast<int *>(p)),
(long long unsigned int)detectorHeader.frameNumber,
detectorHeader.expLength,
detectorHeader.packetNumber,
(long long unsigned int)detectorHeader.bunchId,
(long long unsigned int)detectorHeader.timestamp,
detectorHeader.modId,
detectorHeader.row,
detectorHeader.column,
detectorHeader.reserved,
detectorHeader.debug,
detectorHeader.roundRNumber,
detectorHeader.detType,
detectorHeader.version,
//header->packetsMask.to_string().c_str(),
((uint8_t)(*((uint8_t*)(datapointer)))),
datasize);
}
if((datapointer != NULL) && (datasize > 0))
{
char * buffer = new char[datasize];
memcpy(buffer, datapointer, datasize);
delete [] buffer;
}
}
//------------------------------------------------------------------------------------------------------
// CreateReceivers
//------------------------------------------------------------------------------------------------------
void CreateReceivers(void)
{
// preparing the args for receivers creation
char temp_port[10];
const int argc = 3;
char * args[argc] = {(char*)"slsReceiver", (char*)"--rx_tcpport", temp_port};
// creating the receivers instances
for(int i = 0 ; i < receivers_nb ; i++)
{
int ret = slsReceiverDefs::OK;
// changing the udp port in the args
sprintf(temp_port, "%d", receivers_rx_tcpport[i]);
// creating the receiver using the args
slsReceiverUsers * receiver = new slsReceiverUsers(argc, args, ret);
// managing a failed result
if(ret==slsReceiverDefs::FAIL)
{
delete receiver;
exit(EXIT_FAILURE);
}
// adding the receiver to the receivers container
receivers.push_back(receiver);
std::cout << "receiver (" << i << ") created - port (" << receivers_rx_tcpport[i] << ")" << std::endl;
// registering callbacks
// Call back for start acquisition
cprintf(BLUE, "Registering StartAcq()\n");
receiver->registerCallBackStartAcquisition(StartAcq, NULL);
// Call back for acquisition finished
cprintf(BLUE, "Registering AcquisitionFinished()\n");
receiver->registerCallBackAcquisitionFinished(AcquisitionFinished, NULL);
// Call back for raw data
cprintf(BLUE, "Registering GetData() \n");
receiver->registerCallBackRawDataReady(GetData, NULL);//&(detector_module_index[i]));
// starting tcp server thread
if (receiver->start() == slsReceiverDefs::FAIL)
{
delete receiver;
cprintf(BLUE,"Could not start receiver (%d)\n", i);
exit(EXIT_FAILURE);
}
}
}
//------------------------------------------------------------------------------------------------------
// ReleaseReceivers
//------------------------------------------------------------------------------------------------------
void ReleaseReceivers(void)
{
// deleting the receivers instances
for(int i = 0 ; i < receivers.size() ; i++)
{
slsReceiverUsers * receiver = receivers[i];
// stoping tcp server thread
receiver->stop();
delete receiver;
}
}
//------------------------------------------------------------------------------------------------------
// CreateDetector
//------------------------------------------------------------------------------------------------------
void CreateDetector(void)
{
int result;
// create the detector instance
detector = new slsDetectorUsers(result, detector_id);
if(result == slsDetectorDefs::FAIL)
{
std::cout << "slsDetectorUsers constructor failed! Could not initialize the camera!" << std::endl;
exit(EXIT_FAILURE);
}
// configuration file is used to properly configure advanced settings in the shared memory
result = detector->readConfigurationFile(detector_config_file_name);
if(result == slsDetectorDefs::FAIL)
{
std::cout << "readConfigurationFile failed! Could not initialize the camera!" << std::endl;
exit(EXIT_FAILURE);
}
// set detector in shared memory online (in case no config file was used) */
detector->setOnline(slsDetectorDefs::ONLINE_FLAG);
// set receiver in shared memory online (in case no config file was used) */
detector->setReceiverOnline(slsDetectorDefs::ONLINE_FLAG);
// disabling the file write by the camera
detector->enableWriteToFile(slsDetectorDefs::DISABLED);
// logging some versions informations
std::cout << "Detector developer : " << detector->getDetectorDeveloper() << std::endl;
std::cout << "Detector type : " << detector->getDetectorType() << std::endl;
std::cout << "Detector Firmware Version : " << convertVersionToString(detector->getDetectorFirmwareVersion()) << std::endl;
std::cout << "Detector Software Version : " << convertVersionToString(detector->getDetectorSoftwareVersion()) << std::endl;
// ensuring detector status is idle
int status = detector->getDetectorStatus();
if((status != slsDetectorDefs::IDLE) && (status != slsDetectorDefs::STOPPED))
{
std::cout << "Detector not ready: " << slsDetectorUsers::runStatusType(status) << std::endl;
exit(EXIT_FAILURE);
}
}
//------------------------------------------------------------------------------------------------------
// ReleaseDetector
//------------------------------------------------------------------------------------------------------
void ReleaseDetector(void)
{
if(detector != NULL)
{
detector->setReceiverOnline(slsDetectorDefs::OFFLINE_FLAG);
detector->setOnline(slsDetectorDefs::OFFLINE_FLAG);
delete detector;
detector = NULL;
}
}
//------------------------------------------------------------------------------------------------------
// RunAcquisition
//------------------------------------------------------------------------------------------------------
int RunAcquisition(void)
{
std::string trig_mode_label;
double exposure_time ;
double exposure_period;
double delay_after_trigger;
int64_t nb_frames_per_cycle;
int64_t nb_cycles;
int64_t nb_frames;
#ifdef JUNGFRAU_TEST
int clock_divider;
#endif
//----------------------------------------------------------------------------------------------------
// setting the receiver fifo depth (number of frames in the receiver memory)
detector->setReceiverFifoDepth(detector_receiver_fifo_depth);
//----------------------------------------------------------------------------------------------------
detector->setExposureTime (detector_exposure_time_sec , true); // in seconds
detector->setExposurePeriod (detector_exposure_period_sec, true); // in seconds
detector->setDelayAfterTrigger(detector_delay_after_trigger_sec, true); // in seconds
exposure_time = detector->setExposureTime (-1, true); // in seconds
exposure_period = detector->setExposurePeriod (-1, true); // in seconds
delay_after_trigger = detector->setDelayAfterTrigger(-1, true, 0); // in seconds
//----------------------------------------------------------------------------------------------------
// initing the number of frames per cycle and number of cycles
// to avoid problems during the trigger mode change.
detector->setNumberOfFrames(1);
detector->setNumberOfCycles(1);
// conversion of trigger mode label to trigger mode index
int trigger_mode_index = slsDetectorUsers::getTimingMode(detector_trig_mode);
// apply the trigger change
detector->setTimingMode(trigger_mode_index);
// converting trigger mode index to trigger mode label
trig_mode_label = slsDetectorUsers::getTimingMode(trigger_mode_index);
// setting the number of cycles
nb_cycles = detector->setNumberOfCycles(detector_nb_cycles);
// setting the number of frames per cycle
nb_frames_per_cycle = detector->setNumberOfFrames(detector_nb_frames_per_cycle);
// setting the gain mode
detector->setSettings(slsDetectorUsers::getDetectorSettings("dynamicgain"));
#ifndef JUNGFRAU_TEST
detector->setSettings(slsDetectorUsers::getDetectorSettings("mediumgain"));
#else
detector->setSettings(slsDetectorUsers::getDetectorSettings("dynamichg0"));
#endif
// computing the number of frames
nb_frames = nb_cycles * nb_frames_per_cycle;
//----------------------------------------------------------------------------------------------------
#ifdef JUNGFRAU_TEST
// clock divider
detector->setClockDivider(detector_clock_divider);
clock_divider = detector->setClockDivider(-1);
#endif
//----------------------------------------------------------------------------------------------------
std::cout << "receiver fifo depth : " << detector_receiver_fifo_depth << std::endl;
std::cout << "Exposure time in seconds : " << exposure_time << std::endl;
std::cout << "Exposure period in seconds : " << exposure_period << std::endl;
std::cout << "Delay after trigger in seconds : " << delay_after_trigger << std::endl;
std::cout << "Trigger mode : " << trig_mode_label << std::endl;
std::cout << "Nb frames per cycle : " << nb_frames_per_cycle << std::endl;
std::cout << "Nb cycles : " << nb_cycles << std::endl;
std::cout << "Nb frames : " << nb_frames << std::endl;
#ifdef JUNGFRAU_TEST
std::cout << "Clock divider : " << clock_divider << std::endl;
#endif
std::cout << "Estimated frame rate : " << (1.0 / exposure_period) << std::endl;
//----------------------------------------------------------------------------------------------------
// reset the number of caught frames in the sdk
detector->resetFramesCaughtInReceiver();
//----------------------------------------------------------------------------------------------------
const unsigned int sleep_time_sec = 1; // sleep the thread in seconds
// starting receiver listening mode
if(detector->startReceiver() == slsDetectorDefs::FAIL)
{
std::cout << "Could not start the receiver listening mode!" << std::endl;
return slsDetectorDefs::FAIL;
}
// starting real time acquisition in non blocking mode
// returns OK if all detectors are properly started, FAIL otherwise
if(detector->startAcquisition() == slsDetectorDefs::FAIL)
{
detector->stopReceiver();
std::cout << "Could not start real time acquisition!" << std::endl;
return slsDetectorDefs::FAIL;
}
for(;;)
{
// checking if the hardware acquisition is running
int status = detector->getDetectorStatus();
if((status == slsDetectorDefs::IDLE ) ||
(status == slsDetectorDefs::STOPPED) ||
(status == slsDetectorDefs::ERROR ))
{
// we stop the treatment
break;
}
else
// hardware acquisition is running, we are waiting for new frames not using the cpu during this time
{
usleep(sleep_time_sec * 1000 * 1000); // sleep the thread in seconds
}
}
// stopping receiver listening mode
if(detector->stopReceiver() == slsDetectorDefs::FAIL)
{
std::cout << "Could not stop real time acquisition!" << std::endl;
return slsDetectorDefs::FAIL;
}
//----------------------------------------------------------------------------------------------------
PRINT_SEPARATOR();
std::cout << "receiver fifo depth : " << detector_receiver_fifo_depth << std::endl;
std::cout << "Exposure time in seconds : " << exposure_time << std::endl;
std::cout << "Exposure period in seconds : " << exposure_period << std::endl;
std::cout << "Delay after trigger in seconds : " << delay_after_trigger << std::endl;
std::cout << "Trigger mode : " << trig_mode_label << std::endl;
std::cout << "Nb frames per cycle : " << nb_frames_per_cycle << std::endl;
std::cout << "Nb cyles : " << nb_cycles << std::endl;
std::cout << "Nb frames : " << nb_frames << std::endl;
#ifdef JUNGFRAU_TEST
std::cout << "Clock divider : " << clock_divider << std::endl;
#endif
std::cout << "Estimated frame rate : " << (1.0 / exposure_period) << std::endl;
if(last_acquisition_received_frames == nb_frames)
{
acquisition_nb_ok++;
return slsDetectorDefs::OK;
}
PRINT_SEPARATOR();
return slsDetectorDefs::FAIL;
}
//------------------------------------------------------------------------------------------------------
// test
//------------------------------------------------------------------------------------------------------
void Test(void)
{
try
{
PRINT_SEPARATOR();
std::cout << "CreateReceivers" << std::endl;
PRINT_SEPARATOR();
CreateReceivers();
PRINT_SEPARATOR();
std::cout << "CreateDetector" << std::endl;
PRINT_SEPARATOR();
CreateDetector();
PRINT_SEPARATOR();
std::cout << "RunAcquisition" << std::endl;
PRINT_SEPARATOR();
for(int acquisition_index = 0 ; acquisition_index < acquisition_nb ; acquisition_index++)
{
cprintf(MAGENTA, "Acquisition number : %d\n", acquisition_index);
if (RunAcquisition() == slsDetectorDefs::FAIL) {
acquisition_nb_list.push_back(acquisition_index);
}
}
PRINT_SEPARATOR();
std::cout << "ReleaseDetector" << std::endl;
PRINT_SEPARATOR();
ReleaseDetector();
PRINT_SEPARATOR();
std::cout << "ReleaseReceivers" << std::endl;
PRINT_SEPARATOR();
ReleaseReceivers();
PRINT_SEPARATOR();
if (acquisition_nb - acquisition_nb_ok)
cprintf(BOLD RED, "Correct acquisition(s) %d/%d\n", acquisition_nb_ok, acquisition_nb);
else
cprintf(BOLD GREEN, "Correct acquisition(s) %d/%d\n", acquisition_nb_ok, acquisition_nb);
if (acquisition_nb - acquisition_nb_ok) {
cprintf(RED, "Acquisition(s) gone wrong :\n");
for (int list_index = 0; list_index < acquisition_nb_list.size(); ++list_index) {
cprintf(RED, "%d\n", acquisition_nb_list[list_index]);
}
}
PRINT_SEPARATOR();
}
catch (...)
{
std::cout << "unknown exception!" << std::endl;
exit(EXIT_FAILURE);
}
}
std::string roi_result =
"detector 0:\n"
"0 255 -1 -1\n"
"detector 1:\n"
"1024 1279 -1 -1\n"
"\n"
"xmin xmax ymin ymax\n"
"0 255 -1 -1\n"
"2304 2559 -1 -1\n"
"roi 2\n";
#include <vector>
// use example :
// std::vector<slsReceiverDefs::ROI> rois;
// get_rois_from_string(roi_result, rois);
/*******************************************************************
* \brief Cuts the string in pieces
* \param[in] in_string source string
* \param[in] in_delimitor line delimitor
* \param[out] out_lines line container result
*******************************************************************/
void split_string_line(const std::string & in_string, const char in_delimitor, std::vector<std::string> & out_lines)
{
std::stringstream ss(in_string);
std::string sub_string;
while (getline(ss, sub_string, in_delimitor))
{
out_lines.push_back(sub_string);
}
}
/*******************************************************************
* \brief retrieve the ROIs from a string
* \param[in] in_rois_string string from "get roi" command
* \param[out] out_rois ROI container result (empty if no set ROI)
*******************************************************************/
void get_rois_from_string(const std::string & in_rois_string, std::vector<slsReceiverDefs::ROI> & out_rois)
{
out_rois.clear();
try
{
// cuts the string in lines
std::vector<std::string> lines;
split_string_line(in_rois_string, '\n', lines);
if(lines.size() >= 1)
{
// checks if no ROI ?
if(lines[0] != "roi 0")
{
for(int roi_index = 0 ; roi_index < 2 ; roi_index++)
{
if(lines.size() >= ((roi_index + 1) * 2)) // two lines per ROI definition
{
std::stringstream detector_name;
detector_name << "detector " << roi_index << ":";
// checks the first line
if(lines[roi_index * 2] == detector_name.str())
{
std::stringstream ss(lines[(roi_index * 2) + 1]);
slsReceiverDefs::ROI roi;
ss >> roi.xmin;
ss >> roi.xmax;
ss >> roi.ymin;
ss >> roi.ymax;
out_rois.push_back(roi);
}
}
}
}
}
}
catch(...)
{
out_rois.clear();
}
}
//------------------------------------------------------------------------------------------------------
// read_simple_option
//------------------------------------------------------------------------------------------------------
bool read_simple_option(int argc, char* argv[], const char * in_option_name)
{
int option_index = 1;
while(option_index < argc)
{
if (strcmp(argv[option_index], in_option_name) == 0)
{
std::cout << "Found option:" << in_option_name << std::endl;
return true;
}
option_index++;
}
return false;
}
//------------------------------------------------------------------------------------------------------
// read_option_value
//------------------------------------------------------------------------------------------------------
template <typename T> bool read_option_value(int argc, char* argv[], const char * in_option_name, T & out_option_value)
{
int option_index = 1;
while(option_index < argc)
{
if (strcmp(argv[option_index], in_option_name) == 0)
{
option_index++;
if(option_index < argc)
{
std::stringstream ss(std::string(argv[option_index]));
ss >> out_option_value;
std::cout << "Found option: " << in_option_name << " " << out_option_value << std::endl;
return true;
}
}
option_index++;
}
return false;
}
//------------------------------------------------------------------------------------------------------
// main
//------------------------------------------------------------------------------------------------------
int main (int argc, char* argv[])
{
if(read_simple_option(argc, argv, "-help") || read_simple_option(argc, argv, "--help"))
{
PRINT_SEPARATOR();
std::cout << "Options:" << std::endl;
std::cout << "-clean -> clean shared memory" << std::endl;
std::cout << "-trace -> activate acquisition log" << std::endl;
std::cout << "-exp <value> -> set exposure time value in seconds (for example: -exp 0.0005)" << std::endl;
std::cout << "-period <value> -> set period time value in seconds (for example: -period 0.001)" << std::endl;
std::cout << "-frames <value> -> set number of frames (for example: -frames 10000)" << std::endl;
std::cout << "-acq <value> -> set number of acquisition (for example: -acq 10)" << std::endl;
std::cout << std::endl;
std::cout << "example: ./manual-acq -clean -trace -acq 1 -exp 0.0005 -period 0.001 -frames 1000" << std::endl;
PRINT_SEPARATOR();
return 0;
}
if(read_simple_option(argc, argv, "-clean"))
{
PRINT_SEPARATOR();
std::cout << "Cleaning shared memory" << std::endl;
PRINT_SEPARATOR();
clean_shared_memory();
}
if(read_simple_option(argc, argv, "-trace"))
{
PRINT_SEPARATOR();
std::cout << "Activating acquisition log..." << std::endl;
PRINT_SEPARATOR();
use_trace = true;
}
int64_t frames_value;
if(read_option_value(argc, argv, "-frames", frames_value))
{
detector_nb_frames_per_cycle = frames_value;
}
double exp_value;
if(read_option_value(argc, argv, "-exp", exp_value))
{
detector_exposure_time_sec = exp_value;
}
double period_value;
if(read_option_value(argc, argv, "-period", period_value))
{
detector_exposure_period_sec = period_value;
}
int acq_nb;
if(read_option_value(argc, argv, "-acq", acq_nb))
{
acquisition_nb = acq_nb;
}
Test();
std::cout << "====================== ENDING ======================" << std::endl;
return 0;
}
//------------------------------------------------------------------------------------------------------

View File

@ -0,0 +1 @@
../../slsDetectorSoftware/slsDetector/slsDetectorUsers.h

View File

@ -0,0 +1 @@
../../slsReceiverSoftware/include/slsReceiverUsers.h

View File

@ -0,0 +1 @@
../../slsDetectorSoftware/commonFiles/sls_detector_defs.h

View File

@ -0,0 +1 @@
../../slsDetectorSoftware/commonFiles/sls_detector_funcs.h

View File

@ -0,0 +1 @@
../../slsReceiverSoftware/include/sls_receiver_defs.h

View File

@ -0,0 +1 @@
../../slsReceiverSoftware/include/sls_receiver_funcs.h

1
manual/manual-acq/zmq.h Symbolic link
View File

@ -0,0 +1 @@
../../slsReceiverSoftware/include/zmq.h

View File

@ -1,5 +1,5 @@
PKGDIR = ../..
LIBDIR = $(PKGDIR)/build/bin
LIBDIR = $(PKGDIR)/bin
INCLUDES = -I . -I$(PKGDIR)/slsReceiverSoftware/include -I$(PKGDIR)/slsDetectorSoftware/slsDetectorAnalysis -I$(LIBDIR) -I$(PKGDIR)/slsDetectorSoftware/slsDetector
SRC_DET = mainClient.cpp
SRC_REC = mainReceiver.cpp

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

View File

@ -6,6 +6,7 @@
\usepackage{verbatim}
\usepackage{xspace}
\usepackage{hyperref}
\usepackage{xcolor}
\newcommand{\E}{EIGER\xspace}
\newcommand{\p}{sls\_detector\_put}
\newcommand{\g}{sls\_detector\_get}
@ -24,12 +25,10 @@ Figure ~\ref{boards} show the readout board basic components on an Eiger half mo
\begin{center}
\includegraphics[width=1\textwidth]{Boards}
\end{center}
\caption{Picture with most relevant components of the EIGER readout system. The readout system starts with the Front End Boards (FEB) which performs data descrambling (also converts the packets from 12 $\to$ 16 bits) and rate correction. The BackEndBoard (BEB) has 2x2GB DDR2 memories and can perform data buffering (storing images on board) and data summation (16 bit $\to$ 32 bits). The controls to the detector are passed through the 1Gb, while in most installations, the data are sent out through the 10GB ethernet connection.}
\caption{Picture with most relevant components of the EIGER readout system. The readout system starts with the Front End Boards (FEB) which performs data descrambling (also converts the packets from 12 $\to$ 16 bits) and rate correction. The BackEndBoard (BEB) has 2x2GB DDR2 memories and can perform data buffering (storing images on board) and data summation (16 bit $\to$ 32 bits). The controls to the detector are passed through the 1Gb, while in most installations, the data are sent out through the 10~GB ethernet connection.}
\label{boards}
\end{figure}
\subsection{Mandatory setup - Hardware}
An EIGER single module (500~kpixels) needs:
\begin{itemize}
@ -66,7 +65,8 @@ The directory contains some executables that are needed to make your detector to
\begin{verbatim}
./on #to switch modules on
./off #to switch modules off
./hvget #gets the current HV value
./state #tells you if is ON or OFF
cat /var/log/pcu.log #displays the log if there are problem
./waterflow #returns the current waterflow returned by the flowmeter
./temp #returns the water temperature returned by the flowmeter
\end{verbatim}
@ -93,10 +93,14 @@ The receiver is a process run on a PC closely connected to the detector. Open on
where xxxx, yyyy are the tcp port numbers. Use 1955 and 1956 for example. The receiver for the bottom is open without arguments but still in the configuration file one needs to write {\tt{n:flippeddatax 1}}, where {\tt{2n+1}} indicated the half module number, 1 if it is a module.
\\ Open as many receiver as half module boards. A single module has two half module boards.
From the software version 3.0.1, one can decide weather start a zmq callback from the receiver to the client (for example to visualize data in the slsDetectorGui or another gui). If the zmq steam is not required (cased of the command line for example, one can switch off the streaming with {\tt{./sls\_detector\_put rx\_datastream 0}}, enable it with {\tt{./sls\_detector\_put rx\_datastream 1}}. In the case of inizialising the stream to use the slsDetectorGui, nothing needs to be taken care of by the user. If instead you want to stream the streaming on different channels, the zmq port of the client can be set stealing from the slsDetectorGui stream having {\tt{./sls\_detector\_put zmqport 300y}}. Note that if this is done globally (not for every half module n independently, then the client automatically takes into account that for every half module, there are 2 zmq stream. The receiver stream {\tt{./sls\_detector\_put rx\_zmqport 300y}} has to match such that the GUI can work.
From the software version 3.0.1, one can decide weather start a zmq callback from the receiver to the client (for example to visualize data in the slsDetectorGui or another gui). If the zmq steam is not required (cased of the command line for example, one can switch off the streaming with {\tt{./sls\_detector\_put rx\_datastream 0}}, enable it with {\tt{./sls\_detector\_put rx\_datastream 1}}. In the case of initializing the stream to use the slsDetectorGui, nothing needs to be taken care of by the user. If instead you want to stream the streaming on different channels, the zmq port of the client can be set stealing from the slsDetectorGui stream having {\tt{./sls\_detector\_put zmqport 300y}}. Note that if this is done globally (not for every half module n independently, then the client automatically takes into account that for every half module, there are 2 zmq stream. The receiver stream {\tt{./sls\_detector\_put rx\_zmqport 300y}} has to match such that the GUI can work.
If one desires to set the zmqport manually, he offset has to be taken into account: {\tt{./sls\_detector\_put 0:rx\_zmqport 300y}}, {\tt{./sls\_detector\_put 1:rx\_zmqport 300y+2}} and so on..
There is an example code that can be compiled in {\tt{manual/manual-api/mainReceiver.cpp}} and gives the executable {\tt{./detReceiver}}, use it with two or more receivers to open all receivers in one single terminal: {\tt{./detReceiver startTCPPort numReceivers withCallback}}, where startTCPPort assumes the other ports are consecutively increased.
{\tt{slsMultiReceiver}} uses two or more receivers in one single terminal: {\tt{./slsMultiReceiver startTCPPort numReceivers withCallback}}, where startTCPPort assumes the other ports are consecutively increased.
The command {\tt{r\_framesperfile}} sets the number of frames written in the same file. By default now it is 10000. It can be changes. It needs to be lowered particularly if one wants to parallelize the following conversion of the files.
\subsection{Mandatory setup - Client}
@ -153,6 +157,14 @@ outdir /sls/X12SA/data/x12saop/Data10/Eiger0.5M
threaded 1
\end{verbatim}
The geometry on af an EIGER module, showing the quadrants corresponding to the udp ports and the 2 receivers is shown in figure~\ref{fig:eigerports}.
\begin{figure}[t]
\begin{center}
\includegraphics[width=0.9\textwidth]{Eiger-Chips}
\end{center}
\caption{Geometry of UDP ports and receivers in a singel module.}
\label{fig:eigerports}
\end{figure}
In the case you are developing your own receiver, then you need to remove the 1Gb receiver hostname {\tt{rx\_hostname}} and substitute it with the mac address of the device:
\begin{verbatim}
@ -160,7 +172,6 @@ configuremac 0
rx_udpmac xx:xx:...
\end{verbatim}
One can configure all the detector settings in a parameter file {\tt{setup.det}}, which is loaded by doing:
\begin{verbatim}
sls_detector_put 0-parameters setup.det
@ -216,6 +227,7 @@ We have added a special command, {\tt{thresholdnotb}}, which allows to scan the
\begin{verbatim}
sls_detector_put 0-thresholdnotb energy_in_eV
\end{verbatim}
See section~\ref{sec:fastthresholdscan}.
\section{Standard acquisition}
@ -282,30 +294,81 @@ The detector will not accept other commands while acquiring. If an acquisition w
\end{itemize}
this same command can be used after a non proper abortion of the acquisition to reset to normal status the detector.
\section{Gap pixels inside a module}
A module is composed of 2$\times$4 chips. Each chip is of dimension 256$\times$256 pixels. There is no dead area in a module, as a single sensor covers the 8 chips. The physical pixels at the border of the chips in the sensor are double in size, to allow not to loose photons in the gaps between the chip alignment. They count double what the other normal pixels would count. In the corner between chips, the pixels are 4-times the normal size. See figure~\ref{fgappix} to check the geometry.
\begin{figure}[t]
\begin{center}
\includegraphics[width=0.9\textwidth]{GapPixels}
\end{center}
\caption{Geometry of gap pixels between a module.}
\label{fgappix}
\end{figure}
It is possible to interpolated the value on the larger pixels by splitting the events (or properly interpolating) introducing a virtual pixel for every double pixel, or 3 virtual pixels for every corner. In this way the counts of a single large pixel can be shared among the correct amount of pixels of the normal dimension.
The gap pixels can be added for the slsDetectorGui, from the datacall back or stealing the zmq port from the GUI (see later). The detector size can be added in the configuration file as first thing.
Putting the long side of the module first always as a convection for the code, WITHOUT GAP PIXELS an EIGER module is:
\begin{verbatim}
detsizechan 1024 512
\end{verbatim}
and the client needs to be set {\tt{sls\_detector\_put gappixels 0}}, which is the default behavior.\\
If you want to have GAP PIXELS included:
\begin{verbatim}
detsizechan 1030 514
\end{verbatim}
and the client needs to be set {\tt{sls\_detector\_put gappixels 1}}.
The size of the gap pixels between modules to insert is
\begin{verbatim}
GapPixelsBetweenModules_x = 8
GapPixelsBetweenModules_y = 36
\end{verbatim}
where the {\tt{GapPixelsBetweenModules\_x}} are the one on the short side of the module, while {\tt{GapPixelsBetweenModules\_y}} are the ones on the long side of the module (where the wirebonds take physical space).
\section{QUAD special geometry}
Starting from release 4.1.0, we support a special geometry with 2x2 pixels. This is for a Quad, where a single half module reads out 4 chips but in a quad shape. For now this hardware is only available as a PEEM detector at SIM.
The {\tt{detsizechan 1024 512}} needs to remain set like this for a half module. However, thanks to the command:
\begin{verbatim}
./sls_detector_put quad 1
\end{verbatim}
a 512x512 geomtry will be read out if {\tt{gappixels 0}} and 514x514 will be readout if {\tt{gappixels 1}}. Note that as above, {\tt{gappixels 1}} is not supported for {\tt{dr 4}}.
If {\tt{gappixels 0}}, in the master.raw file you will read:
\begin{verbatim}
row : 512 pixels
col : 256 pixels
\end{verbatim}
else if {\tt{gappixels 1}}, in the master.raw file you will read:
\begin{verbatim}
row : 514 pixels
col : 257 pixels
\end{verbatim}
\section{Readout timing- maximum frame rate}\label{timing}
IMPORTANT: to have faster readout and smaller dead time, one can configure {\tt{clkdivider}}, i.e. the speed at which the data are read, i.e. 200/100/50~MHz for {\tt{clkdivider 0/1/2}} and the dead time between frames through {\tt{flags parallel}}, i.e. acquire and read at the same time or acquire and then read out.
The configuration of this timing variables allows to achieve different frame rates. NOTE THAT IN EIGER, WHATEVER YOU DO, THE FRAME RATE LIMITATIONS COME FROM THE NETWORK BOTTLENECK AS THE HARDWARE GOES FASTER THAN THE DATA OUT.
In the case of REAL CONTINUOUS readout, i.e. continuous acquire and readout from the boards (independent on how the chip is set), the continuous frame rates are listed in table~\ref{tcont}.
In the case of REAL CONTINUOUS readout, i.e. continuous acquire and readout from the boards (independent on how the chip is set), the continuous frame rates are listed in table~\ref{tcont}. The time to send out the frame out of the board
\begin{table}
\begin{tabular}{|c|c|c|c|}
\begin{tabular}{|c|c|c|c|c|}
\hline
GbE & dynamic range & continuos maximum frame rate(Hz) & minimum period ($\mu$s)\\
\tiny{GbE} & \tiny{dynamic range} & \tiny{continuos maximum frame rate(Hz)} & \tiny{minimum period ($\mu$s)}& \tiny{calculated/measered time to send out data ($\mu$s)}\\
\hline
1 & 16 & \textbf{256} & 3901\\
1 & 16 & \textbf{256} & 3901 & \\
\hline
1 & 32 & \textbf{128} & 7820\\
1 & 32 & \textbf{128} & 7820 & \\
\hline
10 & 16 & \textbf{2560} & 391\\
10 & 4 & \textbf{10240} & 98 & 105/128\\
\hline
10 & 32 & \textbf{1280}& 782\\
\hline
10 & 8 & \textbf{5120} & 196\\
\hline
10 & 4 & \textbf{10240} & 98\\
10 & 8 & \textbf{5120} & 196 & 210/250\\
\hline
10 & 16 & \textbf{2560} & 391 & 420/490\\
\hline
10 & 32 & \textbf{1280} & 782 & 840/977\\
\hline
\end{tabular}
\caption{Frame rate limits for the CONTINUOS streaming out of images, i.e. the data rate out is just below 1Gb/s or 10Gb/s.}
\caption{Frame rate limits for the CONTINUOS streaming out of images, i.e. the data rate out is just below 1Gb/s or 10Gb/s. 1280~Hz for 32-bit, 10GbE is obtained from the 10GbE limitation. The maximum achievable frame rate is 977~Hz.}
\label{tcont}\end{table}
Note that in the {\tt{continuous}} flag mode, some buffering is still done on the memories, so a higher frame rate than the proper real continuous one can be achieved. Still, this extra buffering is possible till the memories are not saturated. The number of images that can be stored on the DDR2 on board memories are listed in table~\ref{timgs}.
\begin{table}
@ -369,49 +432,33 @@ where the 'minimum time between frames' and the minimum period will be discussed
\begin{tiny}
\begin{table}
\begin{flushleft}
\begin{tabular}{|c|c|c|c|c|c|c|}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline
\tiny{dr} & \tiny{clkdivider} & \tiny{flags} & \tiny{t between frames($\mu$s) } & \tiny{max frame rate (kHz)} & \tiny{min period ($\mu$s)} & \tiny{max imgs (nominal/our network)}\\
\tiny{dr} & \tiny{clkdivider} & \tiny{flags} & \tiny{$\Delta$t frames($\mu$s) } & \tiny{max FR (kHz)} & \tiny{min period ($\mu$s)} & \tiny{meas. period ($\mu$s)} & \tiny{max imgs (nominal/our network)}\\
\hline
4 & 0 & parallel & 3.4 & 22 & 44 & 30k/50k\\
\hline
4 & 1 & parallel & 6 & 10.5 & 92 & 30k/100k\\
\hline
4 & 2 & parallel & 11.2 & 5.4 & 197 & infinite\\
4 & 0 & \tiny {parallel} & 3.4 & 22 & 44 & 44.01 & 30k/50k\\
\hline
\hline
8 & 0 & parallel & 3.4 & 11.1 & 89 & 15k/24k\\
8 & 0 & \tiny {parallel} & 3.4 & 11.1 & 89 & 89.01 & 15k/24k\\
\hline
8 & 1 & parallel & 6.1 & 5.7 & 181 & 15k/52k\\
16 & 0 & \tiny {parallel} & 3.4 & 6.1 & (126+38)* =164 & 164.02 & 8k/12k\\
\hline
8 & 2 & parallel & 11.2 & 2.9 & 342 & infinite\\
16 & 0 & \tiny {nonparallel} & 127 & 5.6 & (126+52)*= 179 & 179.01& 8k/23k\\
\hline
16 & 1 & \tiny {parallel} & 6.1 & 3.9 & 257 & 257.01 & 8k/28k\\
\hline
16 & 0 & parallel & 3.4 & 6.1 & (126+38)* =164 & 8k/12k\\
16 & 1 & \tiny {nonparallel} & 255 & 3.3 & 303 & 303.01 & infinite\\
\hline
16 & 0 & nonparallel & 126 & 5.6 & (126+52)*= 179 & 8k/23k\\
\hline
16 & 1 & parallel & 6.1 & 3.9 & 257 & 8k/28k\\
\hline
16 & 1 & nonparallel & 255 & 3.3 & 303 & infinite\\
\hline
16 & 2 & parallel & 11 & 1.9 & 526 & infinite \\
\hline
16 & 2 & nonparallel & 504 & 1.8 & 555 & infinite\\
\hline
%32 & 2 & parallel & 11 & 2& & &\\
%\hline
%32 & 2 & nonparallel & 504 & $<2$& & &\\
%\hline
\end{tabular}
\caption{Readout settings. The {\tiny{min exptime}} possible is 5$-$10~$\mu$s. This is due to the time to pass the pixel enable signal in the whole chip. The time between frames has been measured with the oscilloscope and the maximum frames rate has been tested with an external gating from a pulse generator at known frequence. The minimum period is obtained as 1/$\textrm{max frame rate}$.}
\caption{Readout settings. The {\tiny{min exptime}} possible is 5$-$10~$\mu$s. This is due to the time to pass the pixel enable signal in the whole chip. The time between frames ($\Delta$t) has been measured with the oscilloscope and the maximum frames rate (max FR) has been tested with an external gating from a pulse generator at known frequency. The minimum period is obtained as 1/$\textrm{max frame rate}$.}
\label{tframes}
\end{flushleft}
\end{table}
\end{tiny}
\textbf{As if you run too fast, the detector could become noisier, it is important to match the detector settings to your frame rate. This can be done having more parameters files and load the one suitable with your experiment.} We experienced that with low energy settings could not reach 6~kHz and no noise.
\textbf{From software version 4.0.0, there is a very useful function {\tt{sls\_detector\_get measuredperiod}} which return the measured period AFTER the acquisition. This is important to check that the settings to obtain the targeted frame rate was correct.}
\textbf{If you run too fast, the detector could become noisier (see problem shooting), it is important to match the detector settings to your frame rate. This can be done having more parameters files and load the one suitable with your experiment.} We experienced that with low energy settings could not reach 6~kHz and no noise.
In 16 bit mode, it could make sense, in case of noise and low threshold to either reduce the frame rate:
\begin{equation}
\textrm{new period} = \textrm{exptime} + \textrm{minimum time between frames} + (\textrm{10$-$20 }\mu \textrm{s})
@ -421,7 +468,56 @@ to let the signal settle or, if the frame rate is important, leave the {\tt{pe
\textrm{new exptime} = \textrm{old exptime} - (\textrm{10$-$20 }\mu \textrm{s})
\end{equation}
In general, choose first the desired dead time: this will tell you if you want to run in parallel or non parallel mode, although most likely it is parallel mode. Then, choose the maximum frame rate you want to aim, not exceeding what you aim for not to increase the noise. In 4 and 8 bit modes it makes no sense to run nonparallel as the exposure time is too small compared to the readout time.
In general, choose the maximum frame rate you want to aim, not exceeding what you aim for not to increase the noise. In 4 and 8 bit modes it makes no sense to run nonparallel as the exposure time is too small compared to the readout time.
Here below are the final tables for settting the detcetor correctly:
\begin{itemize}
\item CONTINUOUS redout (imagesnot stored on board memories, frames can be achieved. {\tt{flags parallel}}, {\tt{clkdivider 0}} are always set. In 32-bit no extra {\tt{subdeadtime}} is assumed. The difference between {\tt{exptime}} and {\tt{period}} has to be $\approx$5 $\mu$s:
\begin{center}
\begin{tabular}{ |c| c| }
\hline
max frame rate & settings\\
\hline
\textcolor{red}{189~Hz (977~Hz max)} & \textcolor{red}{32-bit} \\
& Nframes=infinite\\
\hline
\textcolor{red}{2.56 kHz} & \textcolor{red}{16-bit}\\
& Nframes=infinite\\
\hline
\textcolor{red}{5.1 kHz} & \textcolor{red}{8-bit}\\
& Nframes=infinite\\
\hline
\textcolor{red}{10.2 kHz} & \textcolor{red}{4-bit}\\
& Nframes=infinite\\
\hline
\end{tabular}
\end{center}
BE CAREFUL that if you have the transmission delays setup (see sec.~\ref{network}), this will slow down the sending of the data and you risk to fill up the memories of the boards on eiger (30000 images in 4 bit mode) and you will get corrupted data (parts of the memory on the boads will be overwritten).
\item BUFFERED readout (images stored on board memories, such that the maximum frame rate can be achieved for a limited amount of frames. {\tt{flags parallel}}, {\tt{clkdivider 0}} are always set. In 32-bit no extra {\tt{subdeadtime}} is assumed. The difference between {\tt{exptime}} and {\tt{period}} has to be $\approx$5 $\mu$s:
\begin{center}
\begin{tabular}{ |c| c| }
\hline
max frame rate & settings\\
\hline
\textcolor{red}{189~Hz (977~Hz)} & \textcolor{red}{32-bit} \\
& Nframes=infinite\\
\hline
\textcolor{red}{6.1 kHz} & \textcolor{red}{16-bit}\\
& Nframes=7600\\
\hline
\textcolor{red}{11.1 kHz} & \textcolor{red}{8-bit}\\
& Nframes=15000\\
\hline
\textcolor{red}{22 kHz} & \textcolor{red}{4-bit}\\
& Nframes=30000\\
\hline
\end{tabular}
\end{center}
\end{itemize}
\subsubsection{4 and 8 bit mode}
In {\tt{parallel}} mode, the minimum time between frames is due to the time required to latch the values of the counter with capacitors. These values are determined in firmware and they can be estimated as:
@ -459,16 +555,16 @@ The time between 12-bit subframes are listed in table~\ref{t32bitframe}.
\begin{tiny}
\begin{table}
\begin{flushleft}
\begin{tabular}{|c|c|c|c|c|c|}
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
\tiny{dr} & \tiny{clkdivider} & \tiny{flags} & \tiny{t difference between subframes($\mu$s)} & \tiny{max internal subframe rate (kHz)} & \tiny{maximum frame rate (Hz)}\\
\tiny{dr} & \tiny{clkdivider} & \tiny{flags} & \tiny{subexptime (s)} & \tiny{t difference between subframes($\mu$s)} & \tiny{max internal subframe rate (kHz)} & \tiny{maximum frame rate (Hz)}\\
\hline
32 & 2 & parallel & 12 & 2 & 170\\
32 & 2 & parallel & 0.00262144 & 12 & 380 & 189\\
\hline
32 & 2 & nonparallel & 504 & $<2$ & 160\\
32 & 2 & parallel & 0.000490 & 12 & 2 & 997\\
\hline
\end{tabular}
\caption{Timing for the 32bit case. The maximum frame rate has been computed assuming 2 subframes of default {\tt{subexptime}} of 2.62144 ms.}
\caption{Timing for the 32bit case. The maximum frame rate has been computed assuming 2 subframes of default {\tt{subexptime}} of 2.62144 ms, which is the default value. By setting up {\tt{subexptime}} to 490~$\mu$s one can achieve a maximum frame rate. Note that one has to leave 490$\mu$s extra between a frame and the following.}
\label{t32bitframe}
\end{flushleft}
\end{table}
@ -482,6 +578,12 @@ The number of subframes composing a single 32bit acquisition can be calculated a
\end{equation}
This also means that {\tt{exptime}}$<${\tt{subexptime}} will be rounded to{\tt{subexptime}}. If you want shorter acquisitions, either reduce the {\tt{subexptime}} or switch two 16-bit mode (you can always sum offline if needed).
From release 4.0.0, an extra {\tt{flag overflow/nooverflow}} is added, with {\tt{nooverflow}} default:
\begin{itemize}
\item {\tt{nooverflow}}: the internal 12-bit result is summed, even if there was saturation of the 12-bit counter (4095) in any of the subframes. Note that if there is saturation for every subframe, you might get as a result a value of the counter equal to (4095$\times$~number~of~subframes), which you need to correctly identify. On the other hand if the saturation occurred only one time, you will get something "close'' to the real number.
\item {\tt{overflow}}: In this case, even if a pixel saturate only 1 time in a subframe, you will be returned as a value of the counter for that pixel: $2^{32}-1$, i.e. 4294967295.
\end{itemize}
The UDP header will contain, after you receive the data, the effective number of subframe per image (see section~\ref{UDP}) as "SubFrame Num or Exp Time", i.e. the number of subframes recorded (32 bit eiger).
The effective time the detector has recorded data can be computed as:
\begin{equation}
@ -489,7 +591,9 @@ The effective time the detector has recorded data can be computed as:
%\label{esubframes}
\end{equation}
In the future release, a configurable extra time difference between subframes will be introduced for the parallel mode, so that some noise appearing in detectors at low threshold can be removed. This will enlarge the time difference between frames form the default 12~$\mu$s to something configurable, expected to be 15-40~$\mu$s (for the 9M it is currently 200~$\mu$s due to a noisier module).
From release 4.0.0, a configurable extra time difference between subframes can be introduced for the parallel mode, so that some noise appearing in detectors at low threshold can be removed. This is obtained through the {\tt{subdeadtime}}. You need to add values specific for your detector (ask the detector group). Typically, values between 15-40~$\mu$s should be used (for the 9M it is currently 200~$\mu$s due to a noisier module).
\section{External triggering options}\label{triggering}
The detector can be setup such to receive external triggers. Connect a LEMO signal to the TRIGGER IN connector in the Power Distribution Board (see Fig.). The logic 0 for the board is passed by low level 0$-$0.7~V, the logic 1 is passed to the board with a signal between 1.2$-$5~V. Eiger is 50~$\Omega$ terminated. By default the positive polarity is used (negative should not be passed to the board).
@ -515,12 +619,26 @@ Here are the implemented options so far:
\item {\tt{auto}} is the software controlled acquisition (does not use triggers), where {\tt{exptime}} and {\tt{period}} have to be set. Set number of cycles (i.e. triggers) to 1 using {\tt{cycles}}. Set number of frames using {\tt{frames}}.
\item {\tt{trigger}} 1 frame taken for 1 trigger. Your {\tt{frames}} needs to be 1 always, {\tt{cycles}} can be changed and defines how many triggers are considered. {\tt{exptime}} needs to be set. In the GUI this is called trigger exposure series.
\item {\tt{burst\_trigger}} gets only 1 trigger, but allows to take many frames. With {\tt{frames}} one can change the number of frames. {\tt{cycles}} needs to be 1. {\tt{exptime}} and {\tt{period}} have to be set. In the gui it is called trigger readout.
\item{\tt{gating}} allows to get a frame only when the trigger pulse is gating. Note that in this case the exp time and period only depend on the gating signal. {\tt{cycles}} allows to select how many gates to consider. Set number of frames to 1 using {\tt{frames}}.
\item{\tt{gating}} allows to get a frame only when the trigger pulse is gating. Note that in this case the exp time and period only depend on the gating signal. {\tt{cycles}} allows to select how many gates to consider. Set number of frames to 1 using {\tt{frames}}. IMPORTANT: Up to firmware 23, the last subframe is oblige to finish being taken, despite the gate signal going down. This will be configurable from later fw and software version. Also, in gating mode, due to timimg of the state machine, you need to leave 500~$\mu$s deadtime between the end on an acquisition and the next. This is as the state machine is unable to check for changes in the status in the first 500~$\mu$s. ATTENTION: if you are in 16 bit mode and you are applying online rate corrections, as now the exptime is generated by the trigger, you might not have correct rate corrections. If you know what the exposure time is in the gating signal, then you can set the {\tt{exptime}} once and the rate corrections will be correct. In 32 bit mode, it does not matter as the rate corrections depends on the {\tt{subexptime}} which is software set independently from the gate exptime.
When using 32-bit mode, by default the acquisition ends the last complete subframe that was started when still the acquisition time was valid. This has been chosen as many people wants to know the exact acquisition time for when the detector was taking data and also, if {\tt{ratecorr}} are active, the last subframe will be correctly corrected, while otherwise it will be corrected with a wrong subdeadtime.
However, from 4.1.0, in gating mode, an option to immediately terminate the subframe when the gate signal goes down it is implemented to stop the acquisition at the same time. This option is {\tt{./sls\_detector\_put interruptsubframe 1}} while the default option is {\tt{./sls\_detector\_put interruptsubframe 0}}.
\end{itemize}
Hardware-wise, the ENABLE OUT signal outputs when the chips are really acquiring. This means that the single subframes will be output in 32 bit mode. The TRIGGER OUT outputs the sum-up-signal at the moment (which is useless). This will be changed in the future to output the envelop of the enable signal.
We are planning to change some functionality, i.e. unify the {\tt{trigger}} and {\tt{burst}} trigger modes and make both {\tt{frames}} and {\tt{cycles}} configurable at the same time.
We are planning to change some functionality, i.e. unify the {\tt{trigger}} and {\tt{burst\_trigger}} trigger modes and make both {\tt{frames}} and {\tt{cycles}} configurable at the same time.
There is the possibility to use {\tt{timing trigger/burst\_trigger}} and send software single commands to fake the trigger. This is done with:
\begin{verbatim}
sls_detector_put 0-timing [trigger/burst_trigger]
sls_detector_put 0-frames x
sls_detector_put 0-cycles y
sls_detector_status trigger
\end{verbatim}
Note that this functionality is very (!) useful if you need to do something between and acquisition and the next. This can be used to do a fast threshold scan for example. See section~\ref{sec:fastthresholdscan}.
\section{Autosumming and rate corrections} \label{advanced}
@ -559,6 +677,19 @@ sls_detector_put 0-ratecorr -1
Every time either the rate corrections are activated, $\tau$ is changed or the subframe length is changed, then a new correction table is evaluated. Note that computing the correction table is time consuming.
Here in figure~\ref{rateplots} you can find typical values of $\tau$ and typical values of the rates for which we have small non linerities (10\% non linearity) as a function of the beam energy.
\begin{figure}[t]
\begin{center}
\includegraphics[width=.7\textwidth]{tauvsE}
\includegraphics[width=.7\textwidth]{Ratecapabilityflux}
\end{center}
\caption{Typical values of the dead time for the detector and safe fluxes as a function of the beam energy}.
\label{rateplots}
\end{figure}
\section{Dependent parameters and limits}
Here is a list of dependent parameters:
\begin{enumerate}
@ -607,7 +738,7 @@ LEDs on the backpanel board at the back of each half module signal:
\subsection{Delays in sending for 1Gb/s, 10Gb/s, 10Gb flow control, receiver fifo}
\subsection{Delays in sending for 1Gb/s, 10Gb/s, 10Gb flow control, receiver fifo}\label{network}
Extremely advanced options allow to:
\begin{itemize}
@ -636,6 +767,7 @@ for X in $(seq 0 4); do ./sls_detector_put $X:txndelay_left $((X*100000)); done
./sls_detector_put txndelay_frame zzzz
\end{verbatim}
In the example before, it would be: {\tt{zzzz}}=4*100000+ 100000
To decide the size of the transmission delays, look at subsection~\ref{delays}.
\item Readjust the size of the fifo of the receiver between listening and writing (useful when writing is limited)
\begin{verbatim}
@ -654,35 +786,132 @@ To activate back a module, do:
\end{verbatim}
\end{itemize}
\subsection{Setting up 10Gb correctly: experience so far}\label{10g}
\section{Choose correct transmission delays}\label{delays}
Transmission delays should be chosen only to accomodate the writing speed of the disk. The 10Gb network should be optimised independently to allow no packet loss situation. This can be done by turning off the writing of the files and check only for missing frames.
Table~\ref{tcont} gives the times that are needed to transfer 1 images out of the 10~Gb Ethernet connection. This reflects the CONTINUOS frame rate achieavable. The disk speed can be monitored with {\tt{dstat}}. One you have worked out this, you can calculated the {\tt{txndelay\_frame}} delay as:
\begin{equation}
{\tt{txndelay\_frame}}=-t_sending+dr \cdot \frac{4*256*256*N\_half\_modules}{1024 \cdot 1000 \cdot disk\_speed [MB/s] \cdot 8}
\end{equation}
In 4-bit mode, for a disk seed of 320MB/s, the {\tt{txndelay\_frame}} is 300~$\mu$s (30000 to be set up to the detector). The sending time is 100~$\mu$s, such that an total ackievable writing speed of 1/400~$\mu$s (2.5~kHz) in achieved.
Note that:
\begin{enumerate}
\item The continuos frame rate goes down when transmission delays are introduced:
\begin{equation}
continuos\_frame\_rate= \frac{1}{\tt{txndelay\_frame}+t\_sending}
\end{equation}
\item If your transmission delays reduce the continuos frame rate, you will saturate the memory on board at some point and you will corrupt images. Conservatively, we say that the number of maximum images in buffered mode is the one listed in table~\ref{timgs}, call N\_images. However, one can approximately say that (and here we need to test more, so do not believe to these numbers yet),
\begin{equation}
N\_tot\_images= N\_images+\frac{ N\_images}{frame\_rate \cdot (t\_delay\_frame + t\_sending) }
\end{equation}
\end{enumerate}
\section{Setting up the PC settings for 10Gb}\label{10g}
For configuring well the 10Gb card not to loose packets,
\begin{itemize}
\item MTU must be set up to 9000 (jumbo frames) on all the involved sides: detector, switch, server NIC
\item you should set up static MAC address tables with separated VLANs
\end{itemize}
As root, also do:
As root, also first check your ethtool settings (-small letter arguments), then change the settings (-capital letter arguments):
\begin{verbatim}
ethtool -G xth1 rx 4096, ethtool -C xth1 rx-usecs 100
ethtool -g xth1
ethtool -c xth1
ethtool -a xth1
\end{verbatim}
where {\tt{xth1}} can be replaced with the correct 10Gb device. To minimise loosing packets, priorities are set better as root user, so have the receiver as root.
To change settings:
\begin{verbatim}
ethtool -G xth1 rx 4096 #or wheterver is the max number for your pc
ethtool -C xth1 rx-usecs 100
ethtool -A xth1 rx on
\end{verbatim}
where {\tt{xth1}} can be replaced with the correct 10Gb device.
NOTE THAT THIS SETTINGS WILL BE LOST IF YOU REBOOT THE COMPUTER.
Very important is to activate the flow control in 10Gb (in 1Gb it is on by default and not configurable)
\begin{verbatim}
./sls_detector_put flowcontrol_10g 1
\end{verbatim}
You ned to check that flow control is setup on the reeceiving interfaces. Check with:
\begin{verbatim}
ethtool -a eth1
\end{verbatim}
.RX should be ON. Set the transmission delays as explained in the manual if necessary. These transmission delays should help matching teh writing speed performance of your disk. You can check how fast you are writing using the {\tt{dstat}} command.
Now setup the computer server propery:
Check the size of:
\begin{verbatim}
sysctl -a | grep backlog
sysctl -a | grep rmem
\end{verbatim}
Set it correctly with:
\begin{verbatim}
sysctl net.core.netdev_max_backlog=250000
sysctl net.core.rmem_default=$((100*1024*1024))
sysctl net.core.rmem_max=$((100*1024*1024))
\end{verbatim}
Other way to setup the same, increase the socket receiving buffer size and the maximum length of the input queue:
\begin{verbatim}
echo $((100*1024*1024)) > /proc/sys/net/core/rmem_max
echo 250000 > /proc/sys/net/core/netdev_max_backlog
\end{verbatim}
to make the settings permanent, edit /etc/sysctl.conf:
\begin{verbatim}
# 100MiB
net.core.rmem_max = 104857600
net.core.rmem_default= 104857600
net.core.netdev_max_backlog = 250000
\end{verbatim}
and run \textbf{sysctl -p}.
To minimise loosing packets, priorities are set better as root user, so have the receiver as root.
To try to bypass being root, we trued something like this:
\begin{verbatim}
/etc/security/limits.conf username rtprio 99
\end{verbatim}
but somehow it did not fully worked so we kept the trick of being root.
Very important is to activate the flow control in 10Gb (in 1Gb it is on by default and not configurable)
Last, you can disable power saving in the CPU frequency (chose the appropriate command for your system):
\begin{verbatim}
./sls_detector_put flowcontrol_10g 1
cpupower frequency-info
cpupower frequency-set -g performance
\end{verbatim}
or
\begin{verbatim}
cpufreq-info
for i in `seq 0 7`; do cpufreq-set -c $i -g performance; done
\end{verbatim}
Set the transmission delays as explained in the manual.
It can help to increase the fifo size of the receiver to {\tt{rx\_fifodepth}} to 1000 images
\begin{verbatim}
./sls_detector_put rx_fifodepth 1000
\end{verbatim}
One needs to keep into account that in 16 bit mode for 1 image we expect each slsReceiver to allocate 0.5MB. So for 1000 images, we expect 500MB memory for each receiver. This can be monitored in Linux with "top" or "free -m".
One needs to keep into account that in 16 bit mode for 1 image we expect each slsReceiver to allocate 0.5MB. So for 1000 images, we expect 500MB memory for each receiver. This can be monitored in Linux with "top" or "free -m". To receive the max number of images possible on the detector, a minimum of 8~GB of memories are required.
For very high frame rate, very long measurements, we had to increase the {\tt{rx\_fifodepth}} to 10000 images but this only in 4, 8, 16 bit mode. In 32 bit mode it will assign 40~GB of memory, which is more than what normal PC would have. So make sure you do not require too much memory.
Last, it is very important that not too many files are created. There is high possibility to loose packets in the time to close and open files for the writer. IN 3.1.x, the default number of images written per file, in Eiger is 2000. This is defined by the line:
\begin{verbatim}
#define EIGER_MAX_FRAMES_PER_FILE 2000
\end{verbatim}
in {\tt{slsDetectorsPackage/slsReceiverSoftware/include/sls\_receiver\_defs.h}}. In 4.0.x, this is interactively defined using the command: {\tt{r\_framesperfile}}. By default it is 10000.
If you do not have a large disk, you can write to memory if your pc is not fast enough:
\begin{verbatim}
mount -t tmpfs none /ramdisk_folder
\end{verbatim}
or
\begin{verbatim}
mount -t tmpfs none /mnt/ramdisk -o size=10G
\end{verbatim}
check how many GB memory you can allocate, to avoid swapping otherwise
\section{Offline processing and monitoring}
@ -718,44 +947,61 @@ white the option {\tt{n:flippeddatax 1}}, which flips in vertical the content of
\subsection{``raw'' files}
If you use the option of writing raw files, you will have a raw file for each UDP port (meaning most likely 2 chips), 4 files per module. In addition to the raw files, you will get also a ``master'' file, containing in ascii some detector general parameters and the explanation of how to interpret the data from the raw files.
The master file is named: {\tt{filename\_master\_0.raw}} and for version ``3.0'' of the slsDetectorSoftware looks like:
The master file is named: {\tt{filename\_master\_0.raw}} and for version ``4.0.0'' of the slsDetectorSoftware looks like:
\begin{verbatim}
Version : 1.0
Dynamic Range : 16
Ten Giga : 1
Image Size : 262144 bytes
x : 512 pixels
y : 256 pixels
Total Frames : 1
Exptime (ns) : 1000000000
SubExptime (ns) : 2621440
Period (ns) : 1000000000
Timestamp : Thu Aug 17 10:55:19 2017
Version : 4.0
Detector Type : 3
Dynamic Range : 32
Ten Giga : 1
Image Size : 524288 bytes
nPixelsX : 512 pixels
nPixelsY : 256 pixels
Max Frames Per File : 10000
Total Frames : 3
Exptime (ns) : 10000000
SubExptime (ns) : 2621440
SubPeriod(ns) : 2621440
Period (ns) : 0
Gap Pixels Enable : 0
Quad Enable : 0
Timestamp : Wed Aug 21 16:30:20 2019
#Frame Header
Frame Number : 8 bytes
SubFrame Number : 4 bytes
Packet Number : 4 bytes
Bunch ID : 8 bytes
Timestamp : 8 bytes
Module Id : 2 bytes
X Coordinate : 2 bytes
Y Coordinate : 2 bytes
Z Coordinate : 2 bytes
Debug : 4 bytes
Round Robin Number : 2 bytes
Detector Type : 1 byte
Header Version : 1 byte
Frame Number : 8 bytes
SubFrame Number/ExpLength : 4 bytes
Packet Number : 4 bytes
Bunch ID : 8 bytes
Timestamp : 8 bytes
Module Id : 2 bytes
Row : 2 bytes
Column : 2 bytes
Reserved : 2 bytes
Debug : 4 bytes
Round Robin Number : 2 bytes
Detector Type : 1 byte
Header Version : 1 byte
Packets Caught Mask : 64 bytes
\end{verbatim}
Note that if one wants to reconstruct the real time the detector was acquiring in 32 bit (autosumming mode), one would have to multiply the SubExptime (ns) for the SubFrame Number.
\subsection{Offline image reconstruction}
The offline image reconstruction{\tt{slsImageReconstruction}} is not part of the package anymore.
The offline image reconstruction{\tt{slsImageReconstruction}} is not part of the package anymore. The code is still available doing \\
{\tt{git clone git@git.psi.ch:sls\_detectors\_software/sls\_image\_reconstruction.git slsImageReconstruction}}.
Checkout the {\tt{developer}} branch if in a 3.1.X release, the {\tt{v4.0.0}} branch if in 4.0.X release, or the {\tt{v4.1}} branch if in 4.1.X release of the {\tt{slsDetector}} code.
The detector writes 2 raw files per receiver. An offline image reconstruction executable has been written to collate the possible files together and produce cbf files. The executable uses the CBFlib-0.9.5 library (downloaded from the web as it download some architecture dependent packages at installation).\\
Three possible conversions are possible: into \textbf{cbf}, \textbf{hdf5} and \textbf{root} format. The detector writes 4 raw files per receiver. An offline image reconstruction executable has been written to collate the possible files together and produce output files. By default an interpolation between the values of the large pixels is performed. Gap pixels between modules are also inserted.
Note that the number of images per file in the 3.1.X release is hardcoded and needs to match whatever you are using in {\tt{slsDetectorsPackage/slsReceiverSoftware/include/sls\_receiver\_defs.h}}:
\begin{verbatim}
#define EIGER_MAX_FRAMES_PER_FILE 2000
\end{verbatim}
The default is 2000 in the 3.1.X release. The default has been changed to 10000 frm realease 4.0.X and now this is picked up automatically without doing anything.
\subsubsection{cbf}
The cbf executable executable uses the CBFlib-0.9.5 library (downloaded from the web as it downloads architecture dependent packages at installation).Edit the Makefile to correclty point at it.\\
\underline{At cSAXS, the CBFlib-0.9.5 has been compiled -such that the required packages are}\\\underline{ downloaded in /sls/X12SA/data/x12saop/EigerPackage/CBFlib-0.9.5.}\\
To use it for a single module:
@ -765,29 +1011,90 @@ cbfMaker [filename with dir]
eg.
{\tt{cbfMaker /scratch/run\_63\_d1\_f000000000000\_3.raw}}\\
To use it for a 1.5 multi modules:
\begin{verbatim}
cbfMaker [filename] [pixels x] [pixels y] ([singlemodulelongside_x] [start det])
\end{verbatim}
To use it any geometry:\\
{\tt{cbfMaker [filename] [outdir, def=same as filename] [pixels x, def=1024] [pixels y, def=512] [singlemodulelongside\_x, def=1] [fillgaps, def=Interpolate Big Pixels] [hdf5datasetname, def="Eiger"] [start det,def=0]}}\\
eg.
{\tt cbfMaker /scratch/run\_63\_d0\_f000000000000\_3.raw 3072 512 1 0}.\\
The {\tt{[singlemodulelongside\_x]}} {\tt{[option to interpolate gap pixels]}} param are optional. Defaults are ``1'', the detector long side is on the x coordinate and start to reconstruct from module 0.
{\tt cbfMaker /scratch/run\_63\_d0\_f000000000000\_3.raw 3072 512 1 2 ``Eiger'' 0}.\\
The {\tt{[singlemodulelongside\_x]}} {\tt{[option to interpolate gap pixels]}} param are optional. Defaults are ``1'', the detector long side is on the x coordinate and to start to reconstruct from module 0.
The interpolation scheme fro the gap pixels between chips is by default ``interpolate large big pixels'', =2;
If you want to change interpolation scheme, use:\\
\begin{tabular}{|c|c|}
\hline
interpolation scheme & argument\\
\hline
insert gap pixels and assign value only to the first one & 0\\
\hline
equally divide the value of the counter bettern the two pixels & 1\\
\hline
interpolate large pixel value & 2\\
\hline
mask the value of the two gap pixels & 3\\
\hline
\end{tabular}
\ \\
\ \\
The executables:
\begin{verbatim}
bcfMaker1.5M [file_name_with_dir]
bcfMaker9M [file_name_with_dir]
cbfMaker1.5M [file_name_with_dir]
cbfMakerOMNY [file_name_with_dir]
cbfMaker9M [file_name_with_dir]
\end{verbatim}
contain the hardcoded geometry for the 1.5M (3 modules horizontal on the long side) and for the 9M at cSAXS: 6(short side)$\times$3 (long side) modules.\\
contain the hardcoded geometry for the 1.5M (3 modules horizontal on the long side), the 1.5M OMNY geometry (3 modules next to each other on the long side) and for the 9M at cSAXS: 6(short side)$\times$3 (long side) modules.\\
Missing packets in a frame and border pixels ($\times 2$ and $\times 4$ are given with value $-1$ at the present time.
It is important to know, that the pixels at the edge between 2 chips count more as double size. We can virtually introduced 1 virtual pixel per double larger pixel, so to have an even number of counts everywhere. Virtual pixels (not filled ) between module gaps are also inserted.
Make sure the following options are uncommented in the {\tt{slsImageReconstruction/src/main\_csaxs.cpp}} file.
\begin{verbatim}
#define MYCBF
##following line only if you need to process with
##BUBBLE (Material Science / uXAS beamlines).
#define MSHeader
\end{verbatim}
Compile it with:
\begin{verbatim}
make cbfMaker; make cbfMakerOMNY;
\end{verbatim}
\begin{verbatim}
GapPixelsBetweenChips_x = 2;
GapPixelsBetweenChips_y = 2;
GapPixelsBetweenModules_x = 8;
GapPixelsBetweenModules_y = 36;
\end{verbatim}
\subsubsection{hdf5}
In case of HDF5 output file, we rely on having the HDF5 1.10.1 library installed and {\tt{HDF5-External-Filter-Plugins}} installed. With HDF5 1.10.3, no need of the external plugings package is needed, but a small modification to the file is needed. Edit the Makefile to correclty point at it. Different compression methods are being tried so different external filters might be to be installed. This work is not finished yet.
To choose HDF5, with ZLIB implementation, open {\tt{slsImageReconstruction/src/main\_csaxs.cpp}} and make sure that
\begin{verbatim}
#define HDF5f
#define ZLIB
\end{verbatim}
are not commented out. All other options need to be commented out. Copile the code with
\begin{verbatim}
make hdf5Maker; make hdf5MakerOMNY;
\end{verbatim}
If you are at cSAXS. all images collected will be written in a single file. If you are not at CSAXS, most likely you want to have all the images written in a single raw file into an HDF5 file. The multiple HDF5 files are then linked in a master file, with many subdatasets (can be read by albula) or by a virtual file with a single dataset. If you want a master o virtual file, uncomment this option:
\begin{verbatim}
#define MASTERVIRTUAL
\end{verbatim}
and recompile.
To use it for a single module:
\begin{verbatim}
hdf5Maker [filename with dir]
\end{verbatim}
eg.
{\tt{hdf5Maker /scratch/run\_63\_d1\_f000000000000\_3.raw}}\\
To use it any geometry:\\
{\tt{hdf5Maker [filename] [pixels x, def=1024] [pixels y, def=512] [singlemodulelongside\_x, def=1] [fillgaps, def=Interpolate Big Pixels] [hdf5datasetname, def="Eiger"] [start det,def=0]}}\\
eg.
{\tt hdf5Maker /scratch/run\_63\_d0\_f000000000000\_3.raw 3072 512 1 2 ``Eiger'' 0}.\\
\subsubsection{root}
The data will be written as TH2D in root format. Edit the {\tt{Makefile}} to point to the correct ROOT library location. Compile the executable as:
\begin{verbatim}
make image
\end{verbatim}
There is no program other executable that already keeps into account the geometry for it.
To use it any geometry:\\
{\tt{image [filename] [pixels x, def=1024] [pixels y, def=512] [singlemodulelongside\_x, def=1] [fillgaps, def=Interpolate Big Pixels] [hdf5datasetname, def="Eiger"] [start det,def=0]}}\\
eg.
{\tt image /scratch/run\_63\_d0\_f000000000000\_3.raw 3072 512 1 2 ``Eiger'' 0}.\\
\subsection{Read temperatures/HV from boards}
@ -851,6 +1158,16 @@ ssh root@$i sync; done
\section{Loading firmware bitfiles}
\textbf{As a new procedure, the first thing to do is to kill the server on the boards, copy the new one there without starting it.} Note that failure to do this step before may cause the linux on the boards to crash and not being able to ping it (this if the registers between the old and new firmware change).
This is the procedure from a terminal;
\begin{verbatim}
for i in beb111 beb070;
do ssh root@$i killall eigerDetectorServer;
scp eigerDetectorServer root@$i:~/executables/eigerDetectorServer ;
ssh root@$i sync; done
\end{verbatim}
A \textbf{bcp} executable (which needs \textbf{tftp} installed on the PC, is needed.
\begin{enumerate}
\item Manual way: you need to press something on the detector. To program bitfiles (firmware files), do a hard reset with a pin/thin stuff in the holes at the very back of the module. They are between the top 7 LED and the bottom 1 and opposite for the other side. Push hard till all LEDs are alternating green and red.
@ -909,7 +1226,7 @@ for j in $(seq 0 255) ; do
sls_detector_put pulsenmove N 0 1;
done;
done;
sls_detector_p resmat 0
sls_detector_put resmat 0
sls_detector_acquire
\end{verbatim}
You read {\tt{N}} in every pixel if you are setup correctly.
@ -921,6 +1238,40 @@ To load the special noise file look at {\tt{settingsdir/eiger/standard/eigernois
\begin{verbatim}
sls_detector_put trimbits ../settingsdir/eiger/standard/eigernoise
\end{verbatim}
To exit from this pattern noise, just set the threshold to something known.
\begin{verbatim}
\item sls_detector_put threshold 50000 standard
\end{verbatim}
where 5000 would be a value in eV and {/tt{standard}} is important in this case.
\section{(Fast) threshold scans during beam operation}\label{sec:fastthresholdscan}
Occasionally you might need to do threshold scans during your data taking (for example for Laue experiments or to get any spectral information). Setting the threshold in this case would be not optimal as you would change trimbits at every energy and this could give you a ``step'' behaviour. What you could do is to use the
\begin{verbatim}
\item sls_detector_put thresholdnotb 50000
\end{verbatim}
which set the threshold to an energy but does not change trimbits. We suggest that before using this function you load the {\tt{threshold}} at an energy in the middle of your scan range and then change {\tt{thresholdnotb}}.
We have also been requested if we could speed up the threshold scan. At the moment no specific function has been integrated in firmware, but one could use the software trigger option to perform what you need:
\begin{verbatim}
./sls_detector_put exptime 0.01
./sls_detector_put timing trigger
./sls_detector_put enablefwrite 0
./sls_detector_put resetframescaught 0
./sls_detector_put index 0
./sls_detector_put cycles 21
./sls_detector_put receiver start
./sls_detector_put status start
for i in $(seq 0 20);
do
#./sls_detector_put thresholdnotb 5000 ##this is still too slow as it loads the module
./sls_detector_put 0:vrf 3199 #need to know the appropriate vrf at every energy
./sls_detector_put 1:vrf 3199 #need to know the appropriate vrf at every energy
./sls_detector_put status trigger
#sleep 0.005
done
./sls_detector_put receiver stop
./sls_detector_put resetframescaught 0
./sls_detector_put timing auto
\end{verbatim}
\section{Troubleshooting}
\subsection{Cannot successfully finish an acquisition}
@ -1017,6 +1368,10 @@ Note that occasionally if there is a shared memory of a different size (from an
\end{verbatim}
This needs to be cleaned with {\tt{ipcs -m}} and then {\tt{ipcrm -M xxx}}, where xxx are the keys with nattch 0. Alternative in the main slsDetectorFolder there is a script that can be used as {\tt{sh cleansharedmemory.sh}}. Note that you need to run the script with the account of the client user, as the shared memory belongs to the client. It is good procedure to implement an automatic cleanup of the shared memory if the client user changes often.
\subsection{Client has shared memory iusses}
The shared memory from software version 4.0.0 creates shared memory segments in /dev/shm/. You can look at them and cancel them directly. Note that this is still user dependent.
Environment variable SLSDETNAME can be set for using 2 different detectors from the same client pc. One needs a different multi detector id if the SLSDETNAME is different for both consoles.
\subsection{Measure the HV}
For every system:
\begin{itemize}
@ -1038,6 +1393,13 @@ If you see strange lines in vertical occurring at period patterns, it is a memor
\subsection{ssh to the boards takes long}
Depending on your network setup, to speed up the ssh to the boards from a pc with internal dhcp server running: \textbf{iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE; echo "1" > /proc/sys/net/ipv4/ip\_forward}, where eth1 has to be the 1Gb network device on the pc
\subsection{Generate keys on the boards not to have to type the password}
\begin{verbatim}
export AFSDIRS64=/afs/psi.ch/intranet/Controls/Software/Trolltech/SL6-x86_64
ssh-copy-id -i /afs/psi.ch/user/t/tinti_g/.ssh/id_rsa.pub root@beb100
ssh-keygen
\end{verbatim}
\subsection{Check firmware version installed on BEB}
You can either ask in the client as described in section~\ref{api}, or login to the boards directly. Follow some steps described in Section~\ref{server}.
\begin{verbatim}
@ -1061,13 +1423,24 @@ Scroll up in the terminal till you find:\\
*************** MASTER/SLAVE ***************\\
*************** NORMAL/SPECIAL ***************\\
There is also an easier way, that is that only the master module will return the real value of the HV. If you have more than 1 detector system, then you will have more than 1 physical master, as the HV needs to be applied to all the systems.
\begin{verbatim}
for i in $(seq 0 36); do sls_detector_put $i:vhighvoltage; done
\end{verbatim}
Only the master will return to you a sensible number (150 normally). the others will return -999.
\subsection{'Cannot connect to socket'}
This error is typically due to the detector server not running. For why, see section~\ref{servernot}.
\subsection{Running at low frame rate, the communication to receiver stops}
If running in 32-bit mode (or even in 16-bit mode), if more memory than what your machine can handle is asked for, the receiver process could be terminated by the kernel of your machine. It would loook like you had executed a clean control-c on the receiver executable. This has been the case, when setting up by mistake
\tt{rx\_fifodepth} to 10000 images in 32 bit mode. In 32 bit mode it will assign 40~GB of memory, which is more than what normal PC would have. So make sure you do not require too much memory. The same is tru also for smaller values of {\tt{rx\_fifodepth}} if your machine has not much memory.
\subsection{Detector server is not running}\label{servernot}
The detector server could not be running: either the detector was powered off, or it powered off itself due to too high temperature or, in the case of the 9M, if the waterflow sensor detected no flux and powered it off (the chiller stops occasionally as cSAXS).
If the powering and the temperature are OK, instead, it can be that the firmware version is incompatible to the server version and/or the client software version. So check the consistency of firmware/software/server versions.
If the powering and the temperature are OK, instead, it can be that the firmware version is incompatible to the server version and/or the client software version. In software packages 3.x.y, the eigerDetectorServer was killed automatically. So check the consistency of firmware/software/server versions if using this version of the software. From 4.x.y onwards, the server, if associated to a wrong firmware, does not kill itself.
\subsection{'Acquire has already started' error message}
If you see the client returning the following error message:\\
@ -1078,15 +1451,14 @@ If you see the client returning the following error message:\\
\end{verbatim}
\subsection{There is noise running the detector in 32-bit}
Short story (for now): You are running in {\tt{parallel}} mode, switch {\tt{flags}} to non {\tt{nonparallel}} mode.
Long story: If you are running the detector in 32-bit (autosumming), there might be some noise, particularly at lower thereshold energies. This is due to the fact that the analog part of the chips require some latency time to settle which is larger than the redout time. At the present moment it is possible to run the detector only in {\tt{parallel}} or {\tt{nonparallel}} mode, respectively with readout times between frames of 12~$\mu$s and 504~$\mu$s. If you switch {\tt{flags}} to non {\tt{nonparallel}} mode you will giveenough time for teh signals to settle. For future realeas we are planning to introduce some configurable delay, such that you can remain with the {\tt{parallel}} flag, but can obtain a configurable dead time between frames in the range 12$-$504~$\mu$s.
If you are running the detector in 32-bit (autosumming), there might be some noise, particularly at lower threshold energies. This is due to the fact that the analog part of the chips require some latency time to settle which is larger than the readout time. It is possible to run the detector only in {\tt{parallel}} or {\tt{nonparallel}} mode, respectively with readout times between frames of 12~$\mu$s and 504~$\mu$s. If you switch {\tt{flags}} to non {\tt{nonparallel}} mode you will give enough time for the signals to settle. From release 4.0.0, there is a configurable delay that can be set through the {\tt{subdeadtime}} variable, such that you can remain with the {\tt{parallel}} flag, but can obtain a configurable dead time between frames. Ask the SLS detector group for an appropriate dead time for your detector, but typically a dead time of 20-50~$\mu$s should be enough. Note that this {\tt{subdeadtime}} need to include the 12~$\mu$s minimum readout time, so it has to be larger than 12~$\mu$s to do anything.
\subsection{There is noise running the detector at high frame rate(4,8,16 bit)}
If are running in {\tt{parallel}} mode, in particular at low thereshold energies, you might encounter some noise. The reason is that the analog part of the chips require some latency time to settle which is larger than the redout time.
If are running in {\tt{parallel}} mode, in particular at low threshold energies, you might encounter some noise. The reason is that the analog part of the chips require some latency time to settle which is larger than the readout time.
\begin{enumerate}
\item You can lower the frame rate and relax requirements on period:
At low frame rate, you normally leave enough time between the end of the acquisition and the starting of the next, so you should not see this effect. In any case setting a {\tt{period}}={\tt{exptime}}+readout time from Table~\ref{tchipro} +extra 20$\mu$s cures the problem. The 20$\mu$s could also be 10~$\mu$s, they are very hardware dependent.
\item The frame rate requirement are stingent (as for time resolved measurements): the only option here is to reduce the {\tt{exptime}} to let the extra 20~$\mu$s (or 10)~$\mu$s. The {\tt{period}} remains the same.
\item The frame rate requirement are stringent (as for time resolved measurements): the only option here is to reduce the {\tt{exptime}} to let the extra 20~$\mu$s (or 10)~$\mu$s. The {\tt{period}} remains the same.
\end{enumerate}
\section{Client checks - command line}
@ -1289,7 +1661,7 @@ In table~\ref{tframescomplete} is a list of all the readout times in the differe
\end{table}
\end{tiny}
Table~\ref{tx} shows the bandwidth of data trasnferring between the FEB and BEB and of the DDR2 memory access. the GTX lanes are only capable of 25.6~Gbit/s. This limits the 12/16 bit frame rate. The 2$\times$DDR2 memories have a bandwidth or 2$\cdot$25.6~Gb/s=51.2~Gb/s. Due to this memory access bandwidth, the 32 bit autosumming mode can only run in {\tt{clkdivider}} 2.
Table~\ref{tx} shows the bandwidth of data transferring between the FEB and BEB and of the DDR2 memory access. the GTX lanes are only capable of 25.6~Gbit/s. This limits the 12/16 bit frame rate. The 2$\times$DDR2 memories have a bandwidth or 2$\cdot$25.6~Gb/s=51.2~Gb/s. Due to this memory access bandwidth, the 32 bit autosumming mode can only run in {\tt{clkdivider}} 2.
\begin{figure}[t]
\begin{center}
\includegraphics[width=1.\textwidth]{TansmissionRates}

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -369,7 +369,7 @@ source directory.
$ cd ..
$ mkdir slsDetectorPackage-build
$ cd slsDetectorPackage-build
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DUSE_HDF5=OFF
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=OFF
$ make
\end{verbatim}
@ -377,7 +377,7 @@ Use the following as an example to compile statically and using specific hdf5
folder
\begin{verbatim}
$ HDF5_ROOT=/opt/hdf5v1.10.0 cmake ../slsDetectorPackage
-DCMAKE_BUILD_TYPE=Debug -DUSE_HDF5=ON
-DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=ON
\end{verbatim}
After compiling, the libraries and executables will be found at `bin` directory

View File

@ -4,11 +4,11 @@ cd build
cmake .. \
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
-DCMAKE_INSTALL_PREFIX=install \
-DUSE_TEXTCLIENT=ON \
-DUSE_RECEIVER=ON \
-DUSE_GUI=ON \
-DSLS_USE_TEXTCLIENT=ON \
-DSLS_USE_RECEIVER=ON \
-DSLS_USE_GUI=ON \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_HDF5=OFF\
-DSLS_USE_HDF5=OFF\
cmake --build . -- -j10

View File

@ -6,9 +6,9 @@ mkdir $PREFIX/include/slsDetectorPackage
#Shared and static libraries
cp build/bin/libSlsDetector.so $PREFIX/lib/.
cp build/bin/libSlsDetector.a $PREFIX/lib/.
# cp build/bin/libSlsDetector.a $PREFIX/lib/.
cp build/bin/libSlsReceiver.so $PREFIX/lib/.
cp build/bin/libSlsReceiver.a $PREFIX/lib/.
# cp build/bin/libSlsReceiver.a $PREFIX/lib/.
#Binaries
cp build/bin/sls_detector_acquire $PREFIX/bin/.

View File

@ -1,13 +1,12 @@
package:
name: sls_detector_software
version: 4.0.0
version: 4.1.0
source:
- path: ..
build:
number: 0
number: 1
rpaths:
- lib/
@ -16,8 +15,7 @@ requirements:
- {{ compiler('c') }}
- {{compiler('cxx')}}
- cmake
- qwt 6.*
- qt=4.8.7=7
- qwt 6.1.4=hf484d3e_1001
- zeromq=4.2.5=hfc679d8_5
- pyzmq
- xorg-libx11
@ -52,22 +50,21 @@ requirements:
outputs:
- name: sls_detector_lib
version: 4.0.0
version: 4.1.0
script: copy_lib.sh
requirements:
build:
- {{ compiler('c') }}
- {{compiler('cxx')}}
- name: sls_detector_gui
version: 4.0.0
version: 4.1.0
script: copy_gui.sh
requirements:
build:
- {{ compiler('c') }}
- {{compiler('cxx')}}
- cmake
- qwt 6.*
- qt=4.8.7=7
- qwt 6.1.4=hf484d3e_1001
- zeromq=4.2.5=hfc679d8_5
- pyzmq
- xorg-libx11
@ -84,6 +81,5 @@ outputs:
- {{ cdt('libxdamage') }} # [linux]
- {{ cdt('libxxf86vm') }} # [linux]
run:
- sls_detector_lib=4.0.0
- qwt 6.*
- qt=4.8.7=7
- sls_detector_lib=4.1.0
- qwt 6.1.4=hf484d3e_1001

View File

@ -1 +0,0 @@
../slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv4.0.0.22.0

View File

@ -0,0 +1 @@
../slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv4.1.0.24.5

View File

@ -1 +0,0 @@
../slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServerv4.0.0.3

View File

@ -0,0 +1 @@
../slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServerv4.0.2.0

View File

@ -1 +0,0 @@
../slsDetectorSoftware/jungfrauDetectorServer/bin/jungfrauDetectorServerv4.0.0.0

View File

@ -0,0 +1 @@
../slsDetectorSoftware/jungfrauDetectorServer/bin/jungfrauDetectorServerv4.0.2.0

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorGui
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: d2bce7e372c241cd235977b92be18555bca6a77d
Revision: 521
Branch: 4.0.0
Repsitory UUID: 98b45b32fd6653fb2758afdc3f804e2a785c504d
Revision: 532
Branch: 4.1.0
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 4020
Last Changed Date: 2018-09-27 16:09:16.000000002 +0200 ./src/qTabSettings.cpp
Last Changed Rev: 4141
Last Changed Date: 2019-10-04 09:28:27.000000001 +0200 ./src/qTabSettings.cpp

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "d2bce7e372c241cd235977b92be18555bca6a77d"
#define GITREPUUID "98b45b32fd6653fb2758afdc3f804e2a785c504d"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x4020
#define GITDATE 0x20180927
#define GITBRANCH "4.0.0"
#define GITREV 0x4141
#define GITDATE 0x20191004
#define GITBRANCH "4.1.0"

View File

@ -690,9 +690,9 @@ void qDetectorMain::ExecuteHelp(QAction *action){
void qDetectorMain::Refresh(int index){
myDet->setOnline(slsDetectorDefs::ONLINE_FLAG);
myDet->setReceiverOnline(slsDetectorDefs::ONLINE_FLAG);
qDefs::checkErrorMessage(myDet,"qDetectorMain::Refresh");
//myDet->setOnline(slsDetectorDefs::ONLINE_FLAG);
//myDet->setReceiverOnline(slsDetectorDefs::ONLINE_FLAG);
//qDefs::checkErrorMessage(myDet,"qDetectorMain::Refresh");
if(!tabs->isTabEnabled(index))
tabs->setCurrentIndex((index++)<(tabs->count()-1)?index:Measurement);
else{

View File

@ -121,12 +121,24 @@ void qDrawPlot::SetupWidgetWindow(){
nPixelsX = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X);
nPixelsY = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::Y);
if (detType == slsDetectorDefs::JUNGFRAUCTB) {
npixelsy_jctb = (myDet->setTimer(slsDetectorDefs::SAMPLES_JCTB, -1) * 2)/25;// for moench 03
nPixelsX = npixelsx_jctb;
nPixelsY = npixelsy_jctb;
switch(detType) {
case slsDetectorDefs::JUNGFRAUCTB:
npixelsy_jctb = (myDet->setTimer(slsDetectorDefs::SAMPLES_JCTB, -1) * 2)/25;// for moench 03
nPixelsX = npixelsx_jctb;
nPixelsY = npixelsy_jctb;
break;
case slsDetectorDefs::EIGER:
if (myDet->setQuad()) {
nPixelsX /= 2;
nPixelsY *= 2;
if (nPixelsX != nPixelsY) {
--nPixelsX;
}
}
break;
default:
break;
}
cout<<"nPixelsX:"<<nPixelsX<<endl;
cout<<"nPixelsY:"<<nPixelsY<<endl;
@ -583,13 +595,29 @@ void qDrawPlot::SetScanArgument(int scanArg){
maxPixelsY = 0;
minPixelsY = 0;
nPixelsX = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X);
nPixelsY = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::Y);
if (detType == slsDetectorDefs::JUNGFRAUCTB) {
npixelsy_jctb = (myDet->setTimer(slsDetectorDefs::SAMPLES_JCTB, -1) * 2)/25; // for moench 03
nPixelsX = npixelsx_jctb;
nPixelsY = npixelsy_jctb;
switch(detType) {
case slsDetectorDefs::JUNGFRAUCTB:
npixelsy_jctb = (myDet->setTimer(slsDetectorDefs::SAMPLES_JCTB, -1) * 2)/25;// for moench 03
nPixelsX = npixelsx_jctb;
nPixelsY = npixelsy_jctb;
break;
case slsDetectorDefs::EIGER:
if (myDet->setQuad()) {
nPixelsX /= 2;
nPixelsY *= 2;
if (nPixelsX != nPixelsY) {
--nPixelsX;
}
}
break;
default:
break;
}
cout<<"nPixelsX:"<<nPixelsX<<endl;
cout<<"nPixelsY:"<<nPixelsY<<endl;
//cannot do this in between measurements , so update instantly
if(scanArgument==qDefs::Level0){
@ -1215,7 +1243,6 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
}else
gainPlotEnable = false;
//recalculating pedestal
if(startPedestalCal){
//start adding frames to get to the pedestal value

View File

@ -23,33 +23,24 @@ set(HEADERS
)
include_directories(
commonFiles
multiSlsDetector
sharedMemory
slsDetector
slsDetectorUtils
slsDetectorCommand
slsDetectorAnalysis
slsReceiverInterface
threadFiles
usersFunctions
../slsReceiverSoftware/include
../slsReceiverSoftware/MySocketTCP
commonFiles
multiSlsDetector
sharedMemory
slsDetector
slsDetectorUtils
slsDetectorCommand
slsDetectorAnalysis
slsReceiverInterface
threadFiles
usersFunctions
../slsReceiverSoftware/include
../slsReceiverSoftware/MySocketTCP
)
add_definitions(
-DDACS_INT
)
add_library(slsDetectorStatic STATIC
${SOURCES}
${HEADERS}
)
set_target_properties(slsDetectorStatic PROPERTIES
ARCHIVE_OUTPUT_NAME SlsDetector
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
add_library(slsDetectorShared SHARED
${SOURCES}
${HEADERS}
@ -78,6 +69,8 @@ set(PUBLICHEADERS
multiSlsDetector/multiSlsDetector.h
slsReceiverInterface/receiverInterface.h
../slsReceiverSoftware/include/sls_receiver_exceptions.h
slsDetector/slsDetectorUsers.h
../slsReceiverSoftware/include/slsReceiverUsers.h
)
set_target_properties(slsDetectorShared PROPERTIES
LIBRARY_OUTPUT_NAME SlsDetector
@ -98,7 +91,8 @@ if(DOXYGEN_FOUND)
)
endif()
install(TARGETS slsDetectorShared slsDetectorStatic
install(TARGETS slsDetectorShared
EXPORT "${TARGETS_EXPORT_NAME}"
LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION include
ARCHIVE DESTINATION lib)

View File

@ -52,6 +52,7 @@
#define CLEANUP_ACQUISITION 0x0000080000000000ULL
#define REGISER_WRITE_READ 0x0000040000000000ULL
#define VERSION_COMPATIBILITY 0x0000020000000000ULL
#define SOME_ERROR 0x0000010000000000ULL
// 0xFFFFFF0000000000ULL
// 0x000000FFFFFFFFFFULL
@ -174,6 +175,10 @@ public:
if(slsErrorMask&VERSION_COMPATIBILITY)
retval.append("Incompatible versions with detector or receiver. Please check log for more details.\n");
if(slsErrorMask&SOME_ERROR)
retval.append("Some error has occurred. Please check log for more details.\n");
if(slsErrorMask&COULD_NOT_CONFIGURE_MAC)

View File

@ -123,6 +123,8 @@ enum detFuncs{
F_CHECK_VERSION, /** < check version compatibility */
F_SOFTWARE_TRIGGER, /** < software trigger */
F_QUAD,
F_INTERRUPT_SUBFRAME,
/* Always append functions hereafter!!! */
/* Always append functions before!!! */

View File

@ -1,5 +1,5 @@
/** API versions */
#define APIRECEIVER 0x180823
#define APIEIGER 0x180820
#define APIJUNGFRAU 0x180823
#define APIGOTTHARD 0x180927
#define APIEIGER 0x181130
#define APIJUNGFRAU 0x190107
#define APIGOTTHARD 0x190201

View File

@ -50,6 +50,8 @@
uint32_t Beb_detid = 0;
int Beb_top =0;
int Beb_quadEnable = 0;
int Beb_positions[3] = {0, 0, 0};
@ -1210,16 +1212,38 @@ void Beb_SetDetectorNumber(uint32_t detid) {
printf("detector id %d has been set in udp header\n", detid);
}
int Beb_SetQuad(int val) {
if (val < 0)
return OK;
printf("Setting Quad to %d in Beb\n", val);
Beb_quadEnable = (val == 0 ? 0 : 1);
return Beb_SetDetectorPosition(Beb_positions);
}
int Beb_GetQuad() {
return Beb_quadEnable;
}
int Beb_SetDetectorPosition(int pos[]) {
if(!Beb_activated)
return OK;
cprintf(BLUE,"Got Position values %d %d %d...\n", pos[0],pos[1], pos[2]);
pos[0] = Beb_swap_uint16(pos[0]);
//pos[1] = Beb_swap_uint16(pos[1]);
pos[2] = Beb_swap_uint16(pos[2]);
cprintf(BLUE,"Got Position values [%d %d %d]\n", pos[0], pos[1], pos[2]);
// save positions
Beb_positions[0] = pos[0];
Beb_positions[1] = pos[1];
Beb_positions[2] = pos[2];
// get left and right
int posLeft[3] = {pos[0], Beb_top ? pos[1] : pos[1] + 1, pos[2]};
int posRight[3] = {pos[0], Beb_top ? pos[1] + 1 : pos[1], pos[2]};
if (Beb_quadEnable) {
posRight[0] = 1; // right is next row
posRight[1] = 0; // right same first column
}
int ret = FAIL;
//mapping new memory to read master top module configuration
@ -1233,26 +1257,28 @@ int Beb_SetDetectorPosition(int pos[]) {
uint32_t value = 0;
ret = OK;
// x left
int posval = Beb_swap_uint16(posLeft[0]);
value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST);
value &= UDP_HEADER_ID_MSK; // to keep previous id value
Beb_Write32(csp0base, UDP_HEADER_A_LEFT_OFST, value | ((pos[0] << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK));
Beb_Write32(csp0base, UDP_HEADER_A_LEFT_OFST, value | ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK));
value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST);
if((value & UDP_HEADER_X_MSK) != ((pos[0] << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK))
if((value & UDP_HEADER_X_MSK) != ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK))
ret = FAIL;
// x right
posval = Beb_swap_uint16(posRight[0]);
value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST);
value &= UDP_HEADER_ID_MSK; // to keep previous id value
Beb_Write32(csp0base, UDP_HEADER_A_RIGHT_OFST, value | ((pos[0] << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK));
Beb_Write32(csp0base, UDP_HEADER_A_RIGHT_OFST, value | ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK));
value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST);
if((value & UDP_HEADER_X_MSK) != ((pos[0] << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK))
if((value & UDP_HEADER_X_MSK) != ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK))
ret = FAIL;
// y left (column)
// overwriting z anyway, so no need to look at previous z value
int posval = Beb_swap_uint16(Beb_top ? pos[1] : (pos[1]+1));
posval = Beb_swap_uint16(posLeft[1]);
Beb_Write32(csp0base, UDP_HEADER_B_LEFT_OFST, ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK));
value = Beb_Read32(csp0base, UDP_HEADER_B_LEFT_OFST);
if(value != ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK))
@ -1260,7 +1286,7 @@ int Beb_SetDetectorPosition(int pos[]) {
// y right
// overwriting z anyway, so no need to look at previous z value
posval = Beb_swap_uint16(Beb_top ? (pos[1]+1) : pos[1]);
posval = Beb_swap_uint16(posRight[1]);
Beb_Write32(csp0base, UDP_HEADER_B_RIGHT_OFST, ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK));
value = Beb_Read32(csp0base, UDP_HEADER_B_RIGHT_OFST);
if(value != ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK))
@ -1269,19 +1295,21 @@ int Beb_SetDetectorPosition(int pos[]) {
// z left
posval = Beb_swap_uint16(posLeft[2]);
value = Beb_Read32(csp0base, UDP_HEADER_B_LEFT_OFST);
value &= UDP_HEADER_Y_MSK; // to keep previous y value
Beb_Write32(csp0base, UDP_HEADER_B_LEFT_OFST, value | ((pos[2] << UDP_HEADER_Z_OFST) & UDP_HEADER_Z_MSK));
Beb_Write32(csp0base, UDP_HEADER_B_LEFT_OFST, value | ((posval << UDP_HEADER_Z_OFST) & UDP_HEADER_Z_MSK));
value = Beb_Read32(csp0base, UDP_HEADER_B_LEFT_OFST);
if((value & UDP_HEADER_Z_MSK) != ((pos[2] << UDP_HEADER_Z_OFST) & UDP_HEADER_Z_MSK))
if((value & UDP_HEADER_Z_MSK) != ((posval << UDP_HEADER_Z_OFST) & UDP_HEADER_Z_MSK))
ret = FAIL;
// z right
posval = Beb_swap_uint16(posRight[2]);
value = Beb_Read32(csp0base, UDP_HEADER_B_RIGHT_OFST);
value &= UDP_HEADER_Y_MSK; // to keep previous y value
Beb_Write32(csp0base, UDP_HEADER_B_RIGHT_OFST, value | ((pos[2] << UDP_HEADER_Z_OFST) & UDP_HEADER_Z_MSK));
Beb_Write32(csp0base, UDP_HEADER_B_RIGHT_OFST, value | ((posval << UDP_HEADER_Z_OFST) & UDP_HEADER_Z_MSK));
value = Beb_Read32(csp0base, UDP_HEADER_B_RIGHT_OFST);
if((value & UDP_HEADER_Z_MSK) != ((pos[2] << UDP_HEADER_Z_OFST) & UDP_HEADER_Z_MSK))
if((value & UDP_HEADER_Z_MSK) != ((posval << UDP_HEADER_Z_OFST) & UDP_HEADER_Z_MSK))
ret = FAIL;
@ -1292,8 +1320,7 @@ int Beb_SetDetectorPosition(int pos[]) {
cprintf(BLUE, "Position set to...\n"
"Left: [%d, %d, %d]\n"
"Right:[%d, %d, %d]\n",
Beb_swap_uint16(pos[0]), Beb_top ? pos[1] : (pos[1]+1), Beb_swap_uint16(pos[2]),
Beb_swap_uint16(pos[0]), Beb_top ? (pos[1]+1) : pos[1], Beb_swap_uint16(pos[2]));
posLeft[0], posLeft[1], posLeft[2], posRight[0], posRight[1], posRight[2]);
}
return ret;

View File

@ -91,6 +91,8 @@ struct BebInfo{
int Beb_GetBebFPGATemp();
void Beb_SetDetectorNumber(uint32_t detid);
int Beb_SetQuad(int val);
int Beb_GetQuad();
int Beb_SetDetectorPosition(int pos[]);
uint16_t Beb_swap_uint16( uint16_t val);

View File

@ -1966,7 +1966,7 @@ int64_t Feb_Control_GetMeasuredPeriod() {
unsigned int value = 0;
Feb_Interface_ReadRegister(sub_num,MEAS_PERIOD_REG, &value);
return value*10;
return (int64_t)value*10;
}
int64_t Feb_Control_GetSubMeasuredPeriod() {
@ -1976,7 +1976,7 @@ int64_t Feb_Control_GetSubMeasuredPeriod() {
unsigned int value = 0;
Feb_Interface_ReadRegister(sub_num,MEAS_SUBPERIOD_REG, &value);
return value*10;
return (int64_t)value*10;
}
@ -2009,36 +2009,172 @@ int Feb_Control_SoftwareTrigger() {
return 1;
}
int Feb_Control_SetInterruptSubframe(int val) {
printf("Setting Interrupt Subframe to %d\n", val);
uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
uint32_t value=0;
if(Module_TopAddressIsValid(&modules[1])){
if(!Feb_Interface_WriteRegister(Module_GetTopRightAddress (&modules[1]),offset, data,0, 0)) {
cprintf(RED,"Could not read value. Value read:%d\n", value);
value = 0;
// they need to be written separately because the left and right registers have different values for this particular register
uint32_t offset = DAQ_REG_HRDWRE;
uint32_t regVal = 0;
char side[2][10] = {"right", "left"};
char isTop[10]; strcpy(isTop, Module_TopAddressIsValid(&modules[1]) ? "top" : "bottom");
unsigned int addr[2];
addr[0] = Module_TopAddressIsValid(&modules[1]) ? Module_GetTopRightAddress (&modules[1]) : Module_GetBottomRightAddress (&modules[1]);
addr[1] = Module_TopAddressIsValid(&modules[1]) ? Module_GetTopLeftAddress (&modules[1]) : Module_GetBottomLeftAddress (&modules[1]);
int iloop = 0;
for(iloop = 0; iloop < 2; ++iloop) {
// get previous value to keep it
if(!Feb_Interface_ReadRegister(addr[iloop], offset, &regVal)) {
cprintf(RED, "Could not read %s %s interrupt subframe\n", isTop, side[iloop]);
return 0;
}
} else {
if(!Feb_Interface_WriteRegister(Module_GetBottomRightAddress (&modules[1]),offset, data,0, 0)) {
cprintf(RED,"Could not read value. Value read:%d\n", value);
value = 0;
uint32_t data = ((val == 0) ? (regVal &~ DAQ_REG_HRDWRE_INTRRPT_SF_MSK) : (regVal | DAQ_REG_HRDWRE_INTRRPT_SF_MSK));
if(!Feb_Interface_WriteRegister(addr[iloop], offset, data, 0, 0)) {
cprintf(RED, "Could not write 0x%x to %s %s interrupt subframe addr 0x%x\n", data, isTop, side[iloop], offset);
return 0;
}
}
return Feb_Control_ReadRegister(offset);
return 1;
}
int Feb_Control_GetInterruptSubframe() {
// they need to be written separately because the left and right registers have different values for this particular register
uint32_t offset = DAQ_REG_HRDWRE;
uint32_t regVal = 0;
char side[2][10] = {"right", "left"};
char isTop[10]; strcpy(isTop, Module_TopAddressIsValid(&modules[1]) ? "top" : "bottom");
unsigned int addr[2];
addr[0] = Module_TopAddressIsValid(&modules[1]) ? Module_GetTopRightAddress (&modules[1]) : Module_GetBottomRightAddress (&modules[1]);
addr[1] = Module_TopAddressIsValid(&modules[1]) ? Module_GetTopLeftAddress (&modules[1]) : Module_GetBottomLeftAddress (&modules[1]);
uint32_t value[2] = {0, 0};
int iloop = 0;
for(iloop = 0; iloop < 2; ++iloop) {
if(!Feb_Interface_ReadRegister(addr[iloop], offset, &regVal)) {
cprintf(RED, "Could not read back %s %s interrupt subframe\n", isTop, side[iloop]);
return -1;
}
value[iloop] = (regVal & DAQ_REG_HRDWRE_INTRRPT_SF_MSK) >> DAQ_REG_HRDWRE_INTRRPT_SF_OFST;
}
// inconsistent
if (value[0] != value[1]) {
cprintf(RED, "Inconsistent values of interrupt subframe betweeen left %d and right %d\n", value[0], value[1]);
return -1;
}
return value[0];
}
int Feb_Control_SetQuad(int val) {
// no bottom for quad
if (!Module_TopAddressIsValid(&modules[1])) {
return 1;
}
uint32_t offset = DAQ_REG_HRDWRE;
printf("Setting Quad to %d in Feb\n", val);
unsigned int addr = Module_GetTopRightAddress (&modules[1]);
uint32_t regVal = 0;
if(!Feb_Interface_ReadRegister(addr, offset, &regVal)) {
cprintf(RED, "Could not read top right quad reg\n");
return 0;
}
uint32_t data = ((val == 0) ? (regVal &~ DAQ_REG_HRDWRE_OW_MSK) : ((regVal | DAQ_REG_HRDWRE_OW_MSK) &~ DAQ_REG_HRDWRE_TOP_MSK));
if(!Feb_Interface_WriteRegister(addr, offset, data, 0, 0)) {
cprintf(RED, "Could not write 0x%x to top right quad addr 0x%x\n", data, offset);
return 0;
}
return 1;
}
uint32_t Feb_Control_ReadRegister(uint32_t offset) {
uint32_t value=0;
if(Module_TopAddressIsValid(&modules[1])){
if(!Feb_Interface_ReadRegister(Module_GetTopRightAddress (&modules[1]),offset, &value)) {
cprintf(RED,"Could not read value. Value read:%d\n", value);
value = 0;
}
} else {
if(!Feb_Interface_ReadRegister(Module_GetBottomRightAddress (&modules[1]),offset, &value)) {
cprintf(RED,"Could not read value. Value read:%d\n", value);
value = 0;
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
uint32_t actualOffset = offset;
char side[2][10] = {"right", "left"};
char isTop[10]; strcpy(isTop, Module_TopAddressIsValid(&modules[1]) ? "top" : "bottom");
unsigned int addr[2];
addr[0] = Module_TopAddressIsValid(&modules[1]) ? Module_GetTopRightAddress (&modules[1]) : Module_GetBottomRightAddress (&modules[1]);
addr[1] = Module_TopAddressIsValid(&modules[1]) ? Module_GetTopLeftAddress (&modules[1]) : Module_GetBottomLeftAddress (&modules[1]);
int run[2] = {0, 0};
// both registers
if (offset < 0x100) {
run[0] = 1;
run[1] = 1;
}
// right registers only
else if (offset >= 0x200) {
run[0] = 1;
actualOffset = offset - 0x200;
}
// left registers only
else {
run[1] = 1;
actualOffset = offset - 0x100;
}
int iloop = 0;
for(iloop = 0; iloop < 2; ++iloop) {
if(run[iloop]) {
printf("Writing 0x%x to %s %s 0x%x\n", data, isTop, side[iloop], actualOffset);
if(!Feb_Interface_WriteRegister(addr[iloop],actualOffset, data, 0, 0)) {
cprintf(RED, "Could not write 0x%x to %s %s addr 0x%x\n", data, isTop, side[iloop], actualOffset);
return 0;
}
}
}
return value;
return 1;
}
int Feb_Control_ReadRegister(uint32_t offset, uint32_t* retval) {
uint32_t actualOffset = offset;
char side[2][10] = {"right", "left"};
char isTop[10]; strcpy(isTop, Module_TopAddressIsValid(&modules[1]) ? "top" : "bottom");
unsigned int addr[2];
addr[0] = Module_TopAddressIsValid(&modules[1]) ? Module_GetTopRightAddress (&modules[1]) : Module_GetBottomRightAddress (&modules[1]);
addr[1] = Module_TopAddressIsValid(&modules[1]) ? Module_GetTopLeftAddress (&modules[1]) : Module_GetBottomLeftAddress (&modules[1]);
uint32_t value[2] = {0, 0};
int run[2] = {0, 0};
// both registers
if (offset < 0x100) {
run[0] = 1;
run[1] = 1;
}
// right registers only
else if (offset >= 0x200) {
run[0] = 1;
actualOffset = offset - 0x200;
}
// left registers only
else {
run[1] = 1;
actualOffset = offset - 0x100;
}
int iloop = 0;
for(iloop = 0; iloop < 2; ++iloop) {
if(run[iloop]) {
if(!Feb_Interface_ReadRegister(addr[iloop],actualOffset, &value[iloop])) {
cprintf(RED, "Could not read from %s %s addr 0x%x\n", isTop, side[iloop], actualOffset);
return 0;
}
printf("Read 0x%x from %s %s 0x%x\n", value[iloop], isTop, side[iloop], actualOffset);
*retval = value[iloop];
// if not the other (left, not right OR right, not left), return the value
if (!run[iloop ? 0 : 1]) {
return 1;
}
}
}
// Inconsistent values
if (value[0] != value[1]) {
cprintf(RED, "Inconsistent values read from left 0x%x and right 0x%x\n", value[0], value[1]);
return 0;
}
return 1;
}

View File

@ -204,7 +204,10 @@ int Feb_Control_GetModuleNumber();
int64_t Feb_Control_GetSubMeasuredPeriod();
int Feb_Control_SoftwareTrigger();
int Feb_Control_SetInterruptSubframe(int val);
int Feb_Control_GetInterruptSubframe();
int Feb_Control_SetQuad(int val);
uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
uint32_t Feb_Control_ReadRegister(uint32_t offset);
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
int Feb_Control_ReadRegister(uint32_t offset, uint32_t* retval);
#endif

View File

@ -20,8 +20,16 @@
#define DAQ_REG_SUBFRAME_EXPOSURES 6
#define DAQ_REG_SUBFRAME_PERIOD 7 //also pg and fifo status register
#define DAQ_REG_HRDWRE 12
#define DAQ_REG_RO_OFFSET 12
#define DAQ_REG_HRDWRE_OW_OFST (0)
#define DAQ_REG_HRDWRE_OW_MSK (0x00000001 << DAQ_REG_HRDWRE_OW_OFST)
#define DAQ_REG_HRDWRE_TOP_OFST (1)
#define DAQ_REG_HRDWRE_TOP_MSK (0x00000001 << DAQ_REG_HRDWRE_TOP_OFST)
#define DAQ_REG_HRDWRE_INTRRPT_SF_OFST (2)
#define DAQ_REG_HRDWRE_INTRRPT_SF_MSK (0x00000001 << DAQ_REG_HRDWRE_INTRRPT_SF_OFST)
#define DAQ_REG_RO_OFFSET 20
#define DAQ_REG_STATUS (DAQ_REG_RO_OFFSET + 0) //also pg and fifo status register
#define FEB_REG_STATUS (DAQ_REG_RO_OFFSET + 3)
#define MEAS_SUBPERIOD_REG (DAQ_REG_RO_OFFSET + 4)
@ -29,6 +37,7 @@
#define DAQ_CTRL_RESET 0x80000000
#define DAQ_CTRL_START 0x40000000
#define ACQ_CTRL_START 0x50000000 //this is 0x10000000 (acq) | 0x40000000 (daq)

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: 63c130a3806b47332b1532ab00f9f344c5839e0e
Revision: 348
Branch: 4.0.0-rc
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 3986
Last Changed Date: 2018-08-20 11:38:13.000000002 +0200 ./Makefile.virtual
Repsitory UUID: e4645a8273c8265bc584579d5f7f8eb6dc4379f7
Revision: 360
Branch: 4.1.0-rc
Last Changed Author: GitHub_GitHub
Last Changed Rev: 4138
Last Changed Date: 2019-10-04 09:28:27.000000001 +0200 ./xparameters.h

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "63c130a3806b47332b1532ab00f9f344c5839e0e"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x3986
#define GITDATE 0x20180820
#define GITBRANCH "4.0.0-rc"
#define GITREPUUID "e4645a8273c8265bc584579d5f7f8eb6dc4379f7"
#define GITAUTH "GitHub_GitHub"
#define GITREV 0x4138
#define GITDATE 0x20191004
#define GITBRANCH "4.1.0-rc"

View File

@ -10,11 +10,11 @@
#endif
#include "slsDetectorFunctionList.h"
#ifndef VIRTUAL
#include "versionAPI.h"
#include "gitInfoEiger.h"
#ifndef VIRTUAL
#include "FebControl.h"
#include "Beb.h"
#include "versionAPI.h"
#endif
int default_tau_from_file= -1;
@ -200,19 +200,18 @@ void checkFirmwareCompatibility(int flag){
/* Ids */
int64_t getDetectorId(enum idMode arg){
#ifdef VIRTUAL
return 0;
#else
int64_t retval = -1;
int64_t retval = 0;
switch(arg){
case DETECTOR_SERIAL_NUMBER:
retval = getDetectorNumber();/** to be implemented with mac? */
break;
case DETECTOR_FIRMWARE_VERSION:
return (int64_t)getFirmwareVersion();
return (int64_t)getFirmwareVersion();
case SOFTWARE_FIRMWARE_API_VERSION:
#ifndef VIRTUAL
return (int64_t)Beb_GetFirmwareSoftwareAPIVersion();
#endif
case DETECTOR_SOFTWARE_VERSION:
return (GITDATE & 0xFFFFFF);
case CLIENT_SOFTWARE_API_VERSION:
@ -220,9 +219,7 @@ int64_t getDetectorId(enum idMode arg){
default:
break;
}
return retval;
#endif
return retval;
}
u_int64_t getFirmwareVersion() {
@ -486,19 +483,25 @@ void setupDetector() {
/* advanced read/write reg */
uint32_t writeRegister(uint32_t offset, uint32_t data) {
int writeRegister(uint32_t offset, uint32_t data) {
#ifdef VIRTUAL
return 0;
return OK;
#else
return Feb_Control_WriteRegister(offset, data);
if(!Feb_Control_WriteRegister(offset, data)) {
return FAIL;
}
return OK;
#endif
}
uint32_t readRegister(uint32_t offset) {
int readRegister(uint32_t offset, uint32_t* retval) {
#ifdef VIRTUAL
return 0;
return OK;
#else
return Feb_Control_ReadRegister(offset);
if(!Feb_Control_ReadRegister(offset, retval)) {
return FAIL;
}
return OK;
#endif
}
@ -1220,6 +1223,47 @@ int setDetectorPosition(int pos[]) {
int setQuad(int value) {
if (value < 0)
return OK;
#ifndef VIRTUAL
if (Beb_SetQuad(value) == FAIL) {
return FAIL;
}
if (!Feb_Control_SetQuad(value)) {
return FAIL;
}
#endif
return OK;
}
int getQuad() {
#ifdef VIRTUAL
return 0;
#else
return Beb_GetQuad();
#endif
}
int setInterruptSubframe(int value) {
if(value < 0)
return FAIL;
#ifndef VIRTUAL
if(!Feb_Control_SetInterruptSubframe(value)) {
return FAIL;
}
#endif
return OK;
}
int getInterruptSubframe() {
#ifdef VIRTUAL
return 0;
#else
return Feb_Control_GetInterruptSubframe();
#endif
}
/* eiger specific - iodelay, 10g, pulse, rate, temp, activate, delay nw parameter */

View File

@ -12,7 +12,7 @@
#include <stdint.h>
#define GOODBYE (-200)
#define REQUIRED_FIRMWARE_VERSION (22)
#define REQUIRED_FIRMWARE_VERSION (24)
#define IDFILECOMMAND "more /home/root/executables/detid.txt"
#define STATUS_IDLE 0

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: d2bce7e372c241cd235977b92be18555bca6a77d
Revision: 2040
Branch: 4.0.0
Repsitory UUID: 98b45b32fd6653fb2758afdc3f804e2a785c504d
Revision: 2094
Branch: 4.1.0
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 4020
Last Changed Date: 2018-09-27 18:22:10.000000002 +0200 ./sharedMemory/SharedMemory.o
Last Changed Rev: 4141
Last Changed Date: 2019-10-04 10:33:35.000000001 +0200 ./threadFiles/ThreadPool.o

View File

@ -887,7 +887,7 @@ int64_t get64BitReg(int aLSB, int aMSB){
return v64;
}
int64_t setFrames(int64_t value){
int64_t setFrames(int64_t value){printf("setting frames to %lld\n", (long long int)value);
return set64BitReg(value, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
}
@ -895,7 +895,7 @@ int64_t getFrames(){
return get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
}
int64_t setExposureTime(int64_t value){
int64_t setExposureTime(int64_t value){printf("setting exptime to %lld ns\n", (long long int)value);
/* time is in ns */
if (value!=-1) {
value = (value * 1E-3 * CLK_FREQ ) + 0.5;
@ -909,7 +909,7 @@ int64_t getExposureTime(){
(1E-3 * CLK_FREQ)) + 0.5;
}
int64_t setGates(int64_t value){
int64_t setGates(int64_t value){printf("setting gates to %lld\n", (long long int)value);
return set64BitReg(value, SET_GATES_LSB_REG, SET_GATES_MSB_REG);
}
@ -917,7 +917,7 @@ int64_t getGates(){
return get64BitReg(GET_GATES_LSB_REG, GET_GATES_MSB_REG);
}
int64_t setPeriod(int64_t value){
int64_t setPeriod(int64_t value){printf("setting period to %lld ns\n", (long long int)value);
/* time is in ns */
if (value!=-1) {
value = (value * 1E-3 * CLK_FREQ ) + 0.5;
@ -931,7 +931,7 @@ int64_t getPeriod(){
(1E-3 * CLK_FREQ)) + 0.5;
}
int64_t setDelay(int64_t value){
int64_t setDelay(int64_t value){printf("setting delay to %lld ns\n", (long long int)value);
/* time is in ns */
if (value!=-1) {
if (masterflags == IS_MASTER) {
@ -955,7 +955,7 @@ int64_t getDelay(){
(1E-3 * CLK_FREQ)) + 0.5;
}
int64_t setTrains(int64_t value){
int64_t setTrains(int64_t value){printf("setting cycles to %lld\n", (long long int)value);
return set64BitReg(value, SET_TRAINS_LSB_REG, SET_TRAINS_MSB_REG);
}
@ -1438,6 +1438,56 @@ int configureMAC(int ipad,long long int macad,long long int detectormacad, int d
usleep(1000 * 1000);
/** send out first image as first packet does not give 0xcacacaca (needed to know if first image
* when switching back and forth between roi and no roi
*/
// remember old parameters
int oldtiming = setTiming(-1);
uint64_t oldframes = setFrames(-1);
uint64_t oldcycles = setTrains(-1);
uint64_t oldPeriod = setPeriod(-1);
uint64_t oldExptime = setExposureTime(-1);
// set to basic parameters
cprintf(BLUE,"Setting basic parameters\n"
"\tTiming: auto, frames: 1, cycles: 1, period: 1s, exptime: 900ms\n");
setTiming(AUTO_TIMING);
setFrames(1);
setTrains(1);
setPeriod(1e9); // important to keep this until we have to wait for acquisition to start
setExposureTime(900 * 1000);
// take an image
if (masterflags == IS_MASTER)
usleep(1 * 1000 * 1000); // required to ensure master starts acquisition only after slave has changed to basic parameters and is waiting
int loop = 0;
startStateMachine();
// wait for acquisition to start (trigger from master)
printf(" Waiting for acquisition to start\n");
while(!runBusy()) {
usleep(0);
++loop;
}
cprintf(MAGENTA, "waited %d loops to start\n", loop);
cprintf(BLUE, " Waiting for acquisition to end (frames left: %lld)\n", (long long int)getFrames());
waitForAcquisitionFinish();
// set to previous parameters
cprintf(BLUE,"Setting previous parameters:\n"
"\tTiming: %d, "
"frames: %lld, "
"cycles: %lld, "
"period: %lld ns, "
"exptime:%lld ns\n",
oldtiming, oldframes, oldcycles, oldPeriod, oldExptime);
setTiming(oldtiming);
setFrames(oldframes);
setTrains(oldcycles);
setPeriod(oldPeriod);
setExposureTime(oldExptime);
return adcConfigured;
}
@ -1448,6 +1498,7 @@ int getAdcConfigured(){
u_int32_t runBusy(void) {
u_int32_t s = bus_r(STATUS_REG) & RUN_BUSY_BIT;
//printf("runBusy: 0x%08x\n", s);
return s;
}
@ -1478,7 +1529,8 @@ u_int32_t runState(void) {
int startStateMachine(){
//#ifdef VERBOSE
printf("*******Starting State Machine*******\n");
cprintf(GREEN,"*******Starting State Machine*******\n");
cprintf(GREEN,"Number of frames to acquire:%lld\n", (long long int)setFrames(-1));
//#endif
cleanFifo();
// fifoReset();
@ -1559,28 +1611,29 @@ u_int32_t fifo_full(void)
void waitForAcquisitionFinish(){
volatile u_int32_t t = bus_r(LOOK_AT_ME_REG);
volatile u_int32_t t = bus_r(LOOK_AT_ME_REG);
#ifdef VERBOSE
printf("lookatmereg=x%x\n",t);
printf("lookatmereg=x%x\n",t);
#endif
while((t&0x1)==0) {
if (runBusy()==0) {
t = bus_r(LOOK_AT_ME_REG);
if ((t&0x1)==0) {
while((t&0x1)==0) {
if (runBusy() == 0) {
t = bus_r(LOOK_AT_ME_REG);
if ((t&0x1)==0) {
#ifdef VERBOSE
printf("no frame found - exiting ");
printf("%08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG));
printf("no frame found - exiting ");
printf("%08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG));
#endif
return;
} else {
return;
} else {
#ifdef VERBOSE
printf("no frame found %x status %x\n", bus_r(LOOK_AT_ME_REG),runState());
printf("no frame found %x status %x\n", bus_r(LOOK_AT_ME_REG),runState());
#endif
break;
}
}
t = bus_r(LOOK_AT_ME_REG);
}
break;
}
}
t = bus_r(LOOK_AT_ME_REG);
}
}

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/gotthardDetectorServer
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: c2db073d5e936d64733ba9bdfdce311a556ae212
Revision: 241
Branch: 4.0.0
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 4018
Last Changed Date: 2018-09-27 16:32:41.000000002 +0200 ./firmware_funcs.c
Repsitory UUID: 4f4de15d3a55dc043775050cf5f0521934e2c9ce
Revision: 250
Branch: 4.0.2-rc
Last Changed Author: Erik_Frojdh
Last Changed Rev: 4106
Last Changed Date: 2019-06-12 14:40:26.000000002 +0200 ./.target-makefrag

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "c2db073d5e936d64733ba9bdfdce311a556ae212"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x4018
#define GITDATE 0x20180927
#define GITBRANCH "4.0.0"
#define GITREPUUID "4f4de15d3a55dc043775050cf5f0521934e2c9ce"
#define GITAUTH "Erik_Frojdh"
#define GITREV 0x4106
#define GITDATE 0x20190612
#define GITBRANCH "4.0.2-rc"

View File

@ -42,7 +42,7 @@
#define TOKEN_RESTART_DELAY 0x88000000
#define TOKEN_RESTART_DELAY_ROI 0x1b000000
#define TOKEN_TIMING_REV1 0x1f16
#define TOKEN_TIMING_REV2 0x1f0f
#define TOKEN_TIMING_REV2 0x1f10
#define DEFAULT_PHASE_SHIFT 120
#define DEFAULT_IP_PACKETSIZE 0x0522

View File

@ -1692,7 +1692,7 @@ int set_settings(int file_des) {
printf("Warning: %s",mess);
}
else {
else if (isett != GET_SETTINGS){
ret = setDefaultDacs();
if (ret == FAIL) {
strcpy(mess,"Could change settings, but could not set to default dacs\n");
@ -1829,7 +1829,7 @@ int get_run_status(int file_des) {
#endif
retval= runState();
printf("\n\nSTATUS=%08x\n",retval);
printf("STATUS=%08x\n",retval);
//stopped (external stop, also maybe fifo full)
@ -2046,9 +2046,9 @@ int set_timer(int file_des) {
printf(mess);
}
//#ifdef VERBOSE
#ifdef VERBOSE
printf("setting timer %d to %lld ns\n",ind,tns);
//#endif
#endif
if (ret==OK) {
if (differentClients==1 && lockStatus==1 && tns!=-1) {
@ -2593,7 +2593,7 @@ int configure_mac(int file_des) {
sscanf(arg[3], "%llx", &idetectormacadd);
sscanf(arg[4], "%x", &detipad);
//arg[5] is udpport2 for eiger
#ifdef VERBOSE
//#ifdef VERBOSE
int i;
printf("\ndigital_test_bit in server %d\t",digitalTestBit);
printf("\nipadd %x\t",ipad);
@ -2606,8 +2606,9 @@ int configure_mac(int file_des) {
for (i=0;i<6;i++)
printf("detector mac adress %d is 0x%x \n",6-i,(unsigned int)(((idetectormacadd>>(8*i))&0xFF)));
printf("detipad %x\n",detipad);
printf("destination ip is %d.%d.%d.%d = 0x%x \n",(detipad>>24)&0xff,(detipad>>16)&0xff,(detipad>>8)&0xff,(detipad)&0xff,detipad);
printf("\n");
#endif
//#endif

View File

@ -11,11 +11,11 @@
#define DETECTOR_TYPE_OFST (24)
#define DETECTOR_TYPE_MSK (0x000000FF << DETECTOR_TYPE_OFST)
/* Fix pattern register */
#define FIX_PATT_REG (0x01 << MEM_MAP_SHIFT)
#define FIX_PATT_VAL (0xACDC2014)
/* Status register */
#define STATUS_REG (0x02 << MEM_MAP_SHIFT)
@ -32,7 +32,6 @@
#define RUNMACHINE_BUSY_OFST (17)
#define RUNMACHINE_BUSY_MSK (0x00000001 << RUNMACHINE_BUSY_OFST)
/* Look at me register */
#define LOOK_AT_ME_REG (0x03 << MEM_MAP_SHIFT) //Not used in firmware or software
@ -86,20 +85,19 @@
#define GET_FRAMES_LSB_REG (0x16 << MEM_MAP_SHIFT)
#define GET_FRAMES_MSB_REG (0x17 << MEM_MAP_SHIFT)
/* Get Period 64 bit register */
/* Get Period 64 bit register tT = T x 50 ns */
#define GET_PERIOD_LSB_REG (0x18 << MEM_MAP_SHIFT)
#define GET_PERIOD_MSB_REG (0x19 << MEM_MAP_SHIFT)
/** Get Temperature Carlos, incorrectl as get gates */
#define GET_TEMPERATURE_TMP112_REG (0x1c << MEM_MAP_SHIFT) // (after multiplying by 625) in 10ths of millidegrees of TMP112
#define TEMPERATURE_POLARITY_BIT (15)
#define TEMPERATURE_POLARITY_MSK (0x00000001 << TEMPERATURE_POLARITY_BIT)
#define TEMPERATURE_VALUE_BIT (0)
#define TEMPERATURE_VALUE_MSK (0x00007FFF << TEMPERATURE_VALUE_BIT)
#define TEMPERATURE_VALUE_MSK (0x000007FF << TEMPERATURE_VALUE_BIT)
#define TEMPERATURE_POLARITY_BIT (11)
#define TEMPERATURE_POLARITY_MSK (0x00000001 << TEMPERATURE_POLARITY_BIT)
/* Get Frames from Start 64 bit register (frames from start Run Control) */
/* Get Frames from Start 64 bit register (frames from last reset using CONTROL_CRST) */
#define FRAMES_FROM_START_PG_LSB_REG (0x24 << MEM_MAP_SHIFT)
#define FRAMES_FROM_START_PG_MSB_REG (0x25 << MEM_MAP_SHIFT)
@ -140,6 +138,15 @@
/* ADC Port Invert Register */
#define ADC_PORT_INVERT_REG (0x43 << MEM_MAP_SHIFT)
#define ADC_PORT_INVERT_ADC_0_OFST (0)
#define ADC_PORT_INVERT_ADC_0_MSK (0x000000FF << ADC_PORT_INVERT_ADC_0_OFST)
#define ADC_PORT_INVERT_ADC_1_OFST (8)
#define ADC_PORT_INVERT_ADC_1_MSK (0x000000FF << ADC_PORT_INVERT_ADC_1_OFST)
#define ADC_PORT_INVERT_ADC_2_OFST (16)
#define ADC_PORT_INVERT_ADC_2_MSK (0x000000FF << ADC_PORT_INVERT_ADC_2_OFST)
#define ADC_PORT_INVERT_ADC_3_OFST (24)
#define ADC_PORT_INVERT_ADC_3_MSK (0x000000FF << ADC_PORT_INVERT_ADC_3_OFST)
/* Receiver IP Address Register */
#define RX_IP_REG (0x45 << MEM_MAP_SHIFT)
@ -181,10 +188,12 @@
/* Configuration Register */
#define CONFIG_REG (0x4D << MEM_MAP_SHIFT)
#define CONFIG_OPERATION_MODE_OFST (16)
#define CONFIG_OPERATION_MODE_MSK (0x00000001 << CONFIG_OPERATION_MODE_OFST)
#define CONFIG_MODE_1_X_10GBE_VAL ((0x0 << CONFIG_OPERATION_MODE_OFST) & CONFIG_OPERATION_MODE_MSK)
#define CONFIG_MODE_2_X_10GBE_VAL ((0x1 << CONFIG_OPERATION_MODE_OFST) & CONFIG_OPERATION_MODE_MSK)
// readout timer (from chip) to stabilize (esp in burst acquisition mode) tRDT = (RDT + 1) * 25ns
#define CONFIG_RDT_TMR_OFST (0)
#define CONFIG_RDT_TMR_MSK (0x0000FFFF << CONFIG_RDT_TMR_OFST)
#define CONFIG_OPRTN_MDE_2_X_10GbE_OFST (16)
#define CONFIG_OPRTN_MDE_2_X_10GbE_MSK (0x00000001 << CONFIG_OPRTN_MDE_2_X_10GbE_OFST)
#define CONFIG_OPRTN_MDE_1_X_10GBE_VAL ((0x0 << CONFIG_OPRTN_MDE_2_X_10GbE_OFST) & CONFIG_OPRTN_MDE_2_X_10GbE_MSK)
#define CONFIG_READOUT_SPEED_OFST (20)
#define CONFIG_READOUT_SPEED_MSK (0x00000003 << CONFIG_READOUT_SPEED_OFST)
#define CONFIG_QUARTER_SPEED_10MHZ_VAL ((0x0 << CONFIG_READOUT_SPEED_OFST) & CONFIG_READOUT_SPEED_MSK)
@ -192,17 +201,17 @@
#define CONFIG_FULL_SPEED_40MHZ_VAL ((0x2 << CONFIG_READOUT_SPEED_OFST) & CONFIG_READOUT_SPEED_MSK)
#define CONFIG_TDMA_OFST (24)
#define CONFIG_TDMA_MSK (0x00000001 << CONFIG_TDMA_OFST)
#define CONFIG_TDMA_DISABLE_VAL ((0x0 << CONFIG_TDMA_OFST) & CONFIG_TDMA_MSK)
#define CONFIG_TDMA_ENABLE_VAL ((0x1 << CONFIG_TDMA_OFST) & CONFIG_TDMA_MSK)
#define CONFIG_TDMA_TIMESLOT_OFST (25)
#define CONFIG_TDMA_DISABLE_VAL ((0x0 << CONFIG_TDMA_OFST) & CONFIG_TDMA_MSK)
#define CONFIG_TDMA_TIMESLOT_OFST (25) // 1ms
#define CONFIG_TDMA_TIMESLOT_MSK (0x0000001F << CONFIG_TDMA_TIMESLOT_OFST)
#define CONFIG_ETHRNT_FLW_CNTRL_OFST (31)
#define CONFIG_ETHRNT_FLW_CNTRL_MSK (0x00000001 << CONFIG_ETHRNT_FLW_CNTRL_OFST)
/* External Signal Register */
#define EXT_SIGNAL_REG (0x4E << MEM_MAP_SHIFT)
#define EXT_SIGNAL_OFST (0)
#define EXT_SIGNAL_MSK (0x00000003 << EXT_SIGNAL_OFST) //enabled when both bits high
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
/* Control Register */
#define CONTROL_REG (0x4F << MEM_MAP_SHIFT)
@ -250,7 +259,7 @@
#define SAMPLE_ADC_SAMPLE_5_VAL ((0x5 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
#define SAMPLE_ADC_SAMPLE_6_VAL ((0x6 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
#define SAMPLE_ADC_SAMPLE_7_VAL ((0x7 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
// Decimation = ADF + 1
#define SAMPLE_ADC_DECMT_FACTOR_OFST (4)
#define SAMPLE_ADC_DECMT_FACTOR_MSK (0x00000007 << SAMPLE_ADC_DECMT_FACTOR_OFST)
#define SAMPLE_ADC_DECMT_FACTOR_0_VAL ((0x0 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
@ -283,6 +292,7 @@
#define SAMPLE_DGTL_DECMT_FACTOR_OFST (12)
#define SAMPLE_DGTL_DECMT_FACTOR_MSK (0x00000003 << SAMPLE_DGTL_DECMT_FACTOR_OFST)
// 1 = full speed, 2 = half speed, 4 = quarter speed
#define SAMPLE_DECMT_FACTOR_1_VAL ((0x0 << SAMPLE_DGTL_DECMT_FACTOR_OFST) & SAMPLE_DGTL_DECMT_FACTOR_MSK)
#define SAMPLE_DECMT_FACTOR_2_VAL ((0x1 << SAMPLE_DGTL_DECMT_FACTOR_OFST) & SAMPLE_DGTL_DECMT_FACTOR_MSK)
#define SAMPLE_DECMT_FACTOR_4_VAL ((0x2 << SAMPLE_DGTL_DECMT_FACTOR_OFST) & SAMPLE_DGTL_DECMT_FACTOR_MSK)
@ -293,7 +303,7 @@
#define VREF_COMP_MOD_OFST (0)
#define VREF_COMP_MOD_MSK (0x00000FFF << VREF_COMP_MOD_OFST)
#define VREF_COMP_MOD_ENABLE_OFST (31)
#define VREF_COMP_MOD_ENABLE_MSK (0x00000FFF << VREF_COMP_MOD_ENABLE_OFST)
#define VREF_COMP_MOD_ENABLE_MSK (0x00000001 << VREF_COMP_MOD_ENABLE_OFST)
/** DAQ Register */
@ -343,10 +353,9 @@
#define TEMP_CTRL_PROTCT_THRSHLD_MSK (0x000007FF << TEMP_CTRL_PROTCT_THRSHLD_OFST)
#define TEMP_CTRL_PROTCT_ENABLE_OFST (16)
#define TEMP_CTRL_PROTCT_ENABLE_MSK (0x00000001 << TEMP_CTRL_PROTCT_ENABLE_OFST)
// set when temp higher than over threshold, write 1 to clear it
#define TEMP_CTRL_OVR_TMP_EVNT_OFST (31)
#define TEMP_CTRL_OVR_TMP_EVNT_MSK (0x00000001 << TEMP_CTRL_OVR_TMP_EVNT_OFST)
#define TEMP_CTRL_CLR_OVR_TMP_EVNT_VAL ((0x1 << TEMP_CTRL_OVR_TMP_EVNT_OFST) & TEMP_CTRL_OVR_TMP_EVNT_MSK)
/* Set Delay 64 bit register */
#define SET_DELAY_LSB_REG (0x60 << MEM_MAP_SHIFT) // different kind of delay
@ -360,11 +369,11 @@
#define SET_FRAMES_LSB_REG (0x64 << MEM_MAP_SHIFT)
#define SET_FRAMES_MSB_REG (0x65 << MEM_MAP_SHIFT)
/* Set Period 64 bit register */
/* Set Period 64 bit register tT = T x 50 ns */
#define SET_PERIOD_LSB_REG (0x66 << MEM_MAP_SHIFT)
#define SET_PERIOD_MSB_REG (0x67 << MEM_MAP_SHIFT)
/* Set Period 64 bit register */
/* Set Exposure Time 64 bit register eEXP = Exp x 25 ns */
#define SET_EXPTIME_LSB_REG (0x68 << MEM_MAP_SHIFT)
#define SET_EXPTIME_MSB_REG (0x69 << MEM_MAP_SHIFT)
@ -388,13 +397,17 @@
/* ASIC Control Register */
#define ASIC_CTRL_REG (0x7F << MEM_MAP_SHIFT)
// tPC = (PCT + 1) * 25ns
#define ASIC_CTRL_PRCHRG_TMR_OFST (0)
#define ASIC_CTRL_PRCHRG_TMR_MSK (0x000000FF << ASIC_CTRL_PRCHRG_TMR_OFST)
#define ASIC_CTRL_PRCHRG_TMR_VAL ((0x1F << ASIC_CTRL_PRCHRG_TMR_OFST) & ASIC_CTRL_PRCHRG_TMR_MSK)
// tDS = (DST + 1) * 25ns
#define ASIC_CTRL_DS_TMR_OFST (8)
#define ASIC_CTRL_DS_TMR_MSK (0x000000FF << ASIC_CTRL_DS_TMR_OFST)
#define ASIC_CTRL_DS_TMR_VAL ((0x1F << ASIC_CTRL_DS_TMR_OFST) & ASIC_CTRL_DS_TMR_MSK)
// tET = (ET + 1) * 25ns (increase timeout range between 2 consecutive storage cells)
#define ASIC_CTRL_EXPSRE_TMR_OFST (16)
#define ASIC_CTRL_EXPSRE_TMR_MSK (0x0000FFFF << ASIC_CTRL_EXPSRE_TMR_OFST)
#endif //REGISTERS_G_H

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/jungfrauDetectorServer
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: b163180d6f2505ff8a84f10e586cc2e0bbdaac86
Revision: 163
Branch: 4.0.0
Repsitory UUID: 74c08cd74240c08b395c9acf8897d5254839d9c3
Revision: 172
Branch: 4.1.0-rc
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 4009
Last Changed Date: 2018-09-25 12:19:12.000000002 +0200 ./RegisterDefs.h
Last Changed Rev: 4140
Last Changed Date: 2019-10-04 09:28:27.000000001 +0200 ./RegisterDefs.h

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "b163180d6f2505ff8a84f10e586cc2e0bbdaac86"
#define GITREPUUID "74c08cd74240c08b395c9acf8897d5254839d9c3"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x4009
#define GITDATE 0x20180925
#define GITBRANCH "4.0.0"
#define GITREV 0x4140
#define GITDATE 0x20191004
#define GITBRANCH "4.1.0-rc"

View File

@ -1313,14 +1313,17 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
int setDetectorPosition(int pos[]) {
int ret = OK;
bus_w(COORD_0_REG, bus_r(COORD_0_REG) & (~COORD_0_X_MSK));
bus_w(COORD_0_REG, bus_r(COORD_0_REG) | ((pos[0] << COORD_0_X_OFST) & COORD_0_X_MSK));
if ((bus_r(COORD_0_REG) & COORD_0_X_MSK) != ((pos[0] << COORD_0_X_OFST) & COORD_0_X_MSK))
ret = FAIL;
bus_w(COORD_0_REG, bus_r(COORD_0_REG) & (~COORD_0_Y_MSK));
bus_w(COORD_0_REG, bus_r(COORD_0_REG) | ((pos[1] << COORD_0_Y_OFST) & COORD_0_Y_MSK));
if ((bus_r(COORD_0_REG) & COORD_0_Y_MSK) != ((pos[1] << COORD_0_Y_OFST) & COORD_0_Y_MSK))
ret = FAIL;
bus_w(COORD_1_REG, bus_r(COORD_1_REG) & (~COORD_0_Z_MSK));
bus_w(COORD_1_REG, bus_r(COORD_1_REG) | ((pos[2] << COORD_0_Z_OFST) & COORD_0_Z_MSK));
if ((bus_r(COORD_1_REG) & COORD_0_Z_MSK) != ((pos[2] << COORD_0_Z_OFST) & COORD_0_Z_MSK))
ret = FAIL;
@ -1588,6 +1591,7 @@ enum runStatus getRunStatus(){
//not running
else {
// stopped or error
if ((retval & STOPPED_MSK) >> STOPPED_OFST) {
printf("-----------------------------------STOPPED--------------------------\n");
s=STOPPED;

View File

@ -10,7 +10,7 @@
#define GOODBYE (-200)
#define PROGRAMMING_MODE (-200)
#define MIN_REQRD_VRSN_T_RD_API 0x171220
#define REQRD_FRMWR_VRSN 0x180615
#define REQRD_FRMWR_VRSN 0x181206 // temp bug fix from last version, timing mode is backwards compatible
/* Struct Definitions */
@ -76,8 +76,6 @@ enum NETWORKINDEX { TXN_FRAME };
#define DEFAULT_STRG_CLL_STRT (0xf)
/* Defines in the Firmware */
#define FIX_PATT_VAL (0xACDC2014)
#define ADC_PORT_INVERT_VAL (0x453b2a9c)
#define MAX_TIMESLOT_VAL (0x1F)
#define MAX_THRESHOLD_TEMP_VAL (127999) //millidegrees
#define MAX_STORAGE_CELL_VAL (15) //0xF
@ -86,8 +84,8 @@ enum NETWORKINDEX { TXN_FRAME };
#define SAMPLE_ADC_HALF_SPEED (SAMPLE_DECMT_FACTOR_2_VAL + SAMPLE_DGTL_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_0_VAL + SAMPLE_ADC_SAMPLE_0_VAL) /* 0x1000 */
#define SAMPLE_ADC_QUARTER_SPEED (SAMPLE_DECMT_FACTOR_4_VAL + SAMPLE_DGTL_SAMPLE_8_VAL + SAMPLE_ADC_DECMT_FACTOR_1_VAL + SAMPLE_ADC_SAMPLE_0_VAL) /* 0x2810 */
#define CONFIG_HALF_SPEED (CONFIG_TDMA_DISABLE_VAL + CONFIG_HALF_SPEED_20MHZ_VAL + CONFIG_MODE_1_X_10GBE_VAL)
#define CONFIG_QUARTER_SPEED (CONFIG_TDMA_DISABLE_VAL + CONFIG_QUARTER_SPEED_10MHZ_VAL + CONFIG_MODE_1_X_10GBE_VAL)
#define CONFIG_HALF_SPEED (CONFIG_TDMA_DISABLE_VAL + CONFIG_HALF_SPEED_20MHZ_VAL + CONFIG_OPRTN_MDE_1_X_10GBE_VAL)
#define CONFIG_QUARTER_SPEED (CONFIG_TDMA_DISABLE_VAL + CONFIG_QUARTER_SPEED_10MHZ_VAL + CONFIG_OPRTN_MDE_1_X_10GBE_VAL)
#define ADC_OFST_HALF_SPEED_VAL (0x1f) //(0x20)
#define ADC_OFST_QUARTER_SPEED_VAL (0x0f) //(0x0f)
#define ADC_PHASE_HALF_SPEED (0x2D) //45

View File

@ -604,7 +604,7 @@ int64_t multiSlsDetector::getId(idMode mode, int imod) {
slsDetector* multiSlsDetector::getSlsDetector(unsigned int pos) {
if (pos >= 0 && pos < detectors.size()) {
if (pos < detectors.size()) {
return detectors[pos];
}
return 0;
@ -1315,7 +1315,9 @@ void multiSlsDetector::updateOffsets() {
numY_gp += detectors[idet]->getTotalNumberOfChannelsInclGapPixels(Y);
maxY += detectors[idet]->getMaxNumberOfChannels(Y);
maxY_gp += detectors[idet]->getMaxNumberOfChannelsInclGapPixels(Y);
++thisMultiDetector->numberOfDetector[Y];
// increment in y again only in the first column (else you double increment)
if (thisMultiDetector->numberOfDetector[X] == 1)
++thisMultiDetector->numberOfDetector[Y];
#ifdef VERBOSE
cout << "incrementing in y direction" << endl;
#endif
@ -2341,7 +2343,7 @@ int multiSlsDetector::sendSoftwareTrigger() {
int multiSlsDetector::startReadOut() {
unsigned int i = 0;
int i = 0;
int ret = OK, ret1 = OK;
i = thisMultiDetector->masterPosition;
if (i >= 0) {
@ -2351,7 +2353,7 @@ int multiSlsDetector::startReadOut() {
if (ret != OK)
ret1 = FAIL;
}
for (i = 0; i < detectors.size(); ++i) {
for (i = 0; i < (int)detectors.size(); ++i) {
ret = detectors[i]->startReadOut();
if (detectors[i]->getErrorMask())
setErrorMask(getErrorMask() | (1 << i));
@ -3261,7 +3263,10 @@ void multiSlsDetector::verifyMinMaxROI(int n, ROI r[]) {
}
}
int multiSlsDetector::setROI(int n, ROI roiLimits[]) {
int multiSlsDetector::setROI(int n, ROI roiLimits[], int imod) {
if (imod > 0 && imod < (int)detectors.size()) {
return detectors[imod]->setROI(n, roiLimits, imod);
}
int ret1 = -100, ret;
int i, xmin, xmax, ymin, ymax, channelX, channelY, idet, lastChannelX,
lastChannelY, index, offsetX, offsetY;
@ -3393,8 +3398,10 @@ int multiSlsDetector::setROI(int n, ROI roiLimits[]) {
}
slsDetectorDefs::ROI* multiSlsDetector::getROI(int& n) {
slsDetectorDefs::ROI* multiSlsDetector::getROI(int& n, int imod) {
if (imod > 0 && imod < (int)detectors.size()) {
return detectors[imod]->getROI(n, imod);
}
n = 0;
int num = 0, i, j;
int ndet = detectors.size();
@ -3900,9 +3907,11 @@ int multiSlsDetector::resetFPGA() {
int multiSlsDetector::powerChip(int ival) {
int ret = OK, ret1 = OK;
for (unsigned int i = 0; i < detectors.size(); ++i) {
ret = detectors[i]->powerChip(ival);
// 1s sleep per module for large systems
if(ival >=0 && detectors.size() > 3)
usleep(1000 * 1000);
if (detectors[i]->getErrorMask())
setErrorMask(getErrorMask() | (1 << i));
if (ret == FAIL)
@ -4974,17 +4983,13 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy) {
}
void multiSlsDetector::readFrameFromReceiver() {
int nX = thisMultiDetector->numberOfDetector[X]; // to copy data in multi module
int nY = thisMultiDetector->numberOfDetector[Y]; // for eiger, to reverse the data
int nX = 0;
int nY = 0;
int nDetPixelsX = 0;
int nDetPixelsY = 0;
bool gappixelsenable = false;
bool eiger = false;
if (getDetectorsType() == EIGER) {
eiger = true;
nX *= 2;
gappixelsenable = detectors[0]->enableGapPixels(-1) >= 1 ? true : false;
}
bool quadEnable = false;
bool eiger = false;
bool runningList[zmqSocket.size()], connectList[zmqSocket.size()];
int numRunning = 0;
for (unsigned int i = 0; i < zmqSocket.size(); ++i) {
@ -5059,6 +5064,16 @@ void multiSlsDetector::readFrameFromReceiver() {
// shape
nPixelsX = doc["shape"][0].GetUint();
nPixelsY = doc["shape"][1].GetUint();
// detector shape
nX = doc["detshape"][0].GetUint();
nY = doc["detshape"][1].GetUint();
nDetPixelsX = nX * nPixelsX;
nDetPixelsY = nY * nPixelsY;
// det type
eiger = (doc["detType"].GetUint() == (int)EIGER) ? true : false;
// gap pixels enable
gappixelsenable = (doc["gappixels"].GetUint() == 0) ? false : true;
quadEnable = (doc["quad"].GetUint() == 0) ? false : true;
#ifdef VERBOSE
cprintf(BLUE, "(Debug) One Time Header Info:\n"
@ -5067,9 +5082,14 @@ void multiSlsDetector::readFrameFromReceiver() {
"dynamicRange: %u\n"
"bytesPerPixel: %f\n"
"nPixelsX: %u\n"
"nPixelsY: %u\n",
"nPixelsY: %u\n"
"nX: %u\n"
"nY: %u\n"
"eiger: %d\n"
"gappixelsenable: %d\n"
"quadEnable: %d\n",
size, multisize, dynamicRange, bytesPerPixel,
nPixelsX, nPixelsY);
nPixelsX, nPixelsY, nX, nY, eiger, gappixelsenable, quadEnable);
#endif
}
// each time, parse rest of header
@ -5137,22 +5157,32 @@ void multiSlsDetector::readFrameFromReceiver() {
}
}
}
#ifdef VERBOSE
cprintf(BLUE,"nPixelsX:%d, nPixelsY:%d nx:%d ny:%d quadEnable:%d\n", nDetPixelsX, nDetPixelsY, nX, nY, quadEnable);
#endif
//send data to callback
if (data) {
if (data) {
// 4bit gap pixels
if (dynamicRange == 4 && gappixelsenable) {
int n = processImageWithGapPixels(multiframe, multigappixels);
nPixelsX = thisMultiDetector->numberOfChannelInclGapPixels[X];
nPixelsY = thisMultiDetector->numberOfChannelInclGapPixels[Y];
if (quadEnable) {
nDetPixelsX += 2;
nDetPixelsY += 2;
} else {
nDetPixelsX = nX * (nPixelsX + 3);
nDetPixelsY = nY * (nPixelsY + 1);
}
#ifdef VERBOSE
cprintf(RED,"Corrected nPixelsX:%d, nPixelsY:%d quadEnable:%d\n", nDetPixelsX, nDetPixelsY, quadEnable);
#endif
int n = processImageWithGapPixels(multiframe, multigappixels, quadEnable);
thisData = new detectorData(NULL, NULL, NULL, getCurrentProgress(),
currentFileName.c_str(), nPixelsX, nPixelsY,
currentFileName.c_str(), nDetPixelsX, nDetPixelsY,
multigappixels, n, dynamicRange, currentFileIndex);
}
// normal pixels
else {
thisData = new detectorData(NULL, NULL, NULL, getCurrentProgress(),
currentFileName.c_str(), nPixelsX, nPixelsY,
currentFileName.c_str(), nDetPixelsX, nDetPixelsY,
multiframe, multisize, dynamicRange, currentFileIndex);
}
dataReady(thisData, currentFrameIndex,
@ -5196,14 +5226,23 @@ void multiSlsDetector::readFrameFromReceiver() {
delete[] multigappixels;
}
int multiSlsDetector::processImageWithGapPixels(char* image, char*& gpImage) {
// eiger 4 bit mode
int nxb = thisMultiDetector->numberOfDetector[X] * (512 + 3);
int nyb = thisMultiDetector->numberOfDetector[Y] * (256 + 1);
int gapdatabytes = nxb * nyb;
int multiSlsDetector::processImageWithGapPixels(char* image, char*& gpImage, bool quadEnable) {
// eiger 4 bit mode (divided by 2 already)
int nxb = thisMultiDetector->numberOfDetector[X] * (512 + 3);
int nyb = thisMultiDetector->numberOfDetector[Y] * (256 + 1);
int nchipInRow = 4;
int nxchip = thisMultiDetector->numberOfDetector[X] * 4;
int nychip = thisMultiDetector->numberOfDetector[Y] * 1;
if (quadEnable) {
nxb = thisMultiDetector->numberOfDetector[X] * (256 + 1);
nyb = thisMultiDetector->numberOfDetector[Y] * (512 + 2);
nxchip /= 2;
nychip *= 2;
nchipInRow /= 2;
}
int gapdatabytes = nxb * nyb;
// allocate
if (gpImage == NULL)
@ -5219,13 +5258,13 @@ int multiSlsDetector::processImageWithGapPixels(char* image, char*& gpImage) {
// copying line by line
src = image;
dst = gpImage;
for (int row = 0; row < nychip; ++row) { // for each chip in a row
for (int row = 0; row < nychip; ++row) { // for each chip row
for (int ichipy = 0; ichipy < b1chipy; ++ichipy) { //for each row in a chip
for (int col = 0; col < nxchip; ++col) {
for (int col = 0; col < nxchip; ++col) { // for each chip in a row
memcpy(dst, src, b1chipx);
src += b1chipx;
dst += b1chipx;
if ((col + 1) % 4)
if ((col + 1) % nchipInRow) // 1, 2, and 3rd chip, skip gap pixels
++dst;
}
}
@ -5238,11 +5277,11 @@ int multiSlsDetector::processImageWithGapPixels(char* image, char*& gpImage) {
uint8_t temp, g1, g2;
int mod;
dst = gpImage;
for (int row = 0; row < nychip; ++row) { // for each chip in a row
for (int row = 0; row < nychip; ++row) { // for each chip row
for (int ichipy = 0; ichipy < b1chipy; ++ichipy) { //for each row in a chip
for (int col = 0; col < nxchip; ++col) {
for (int col = 0; col < nxchip; ++col) { // for each chip in a row
dst += b1chipx;
mod = (col + 1) % 4;
mod = (col + 1) % nchipInRow; // 1, 2, and 3rd chip, get gap pixels
// copy gap pixel(chip 0, 1, 2)
if (mod) {
// neighbouring gap pixels to left
@ -5273,8 +5312,8 @@ int multiSlsDetector::processImageWithGapPixels(char* image, char*& gpImage) {
{
uint8_t temp, g1, g2;
char* dst_prevline = 0;
dst = gpImage;
for (int row = 0; row < nychip; ++row) { // for each chip in a row
dst = gpImage;
for (int row = 0; row < nychip; ++row) { // for each chip row
dst += (b1chipy * nxb);
// horizontal copying of gap pixels from neighboring past line (bottom parts)
if (row < nychip - 1) {
@ -5379,7 +5418,7 @@ int multiSlsDetector::setCTBPattern(std::string fname) {
uint64_t word;
int addr = 0;
FILE* fd = fopen(fname.c_str(), "r");
if (fd > 0) {
if (fd) {
while (fread(&word, sizeof(word), 1, fd)) {
for (unsigned int idet = 0; idet < detectors.size(); ++idet)
detectors[idet]->setCTBWord(addr, word);
@ -5419,3 +5458,13 @@ int multiSlsDetector::setCTBPatWaitAddr(int level, int addr) {
int multiSlsDetector::setCTBPatWaitTime(int level, uint64_t t) {
return callDetectorMember(&slsDetector::setCTBPatWaitTime, level, t);
}
int multiSlsDetector::setQuad(int val) {
if (getNumberOfDetectors() > 1)
val = 0;
return callDetectorMember(&slsDetector::setQuad, val);
}
int multiSlsDetector::setInterruptSubframe(int val) {
return callDetectorMember(&slsDetector::setInterruptSubframe, val);
}

View File

@ -1222,16 +1222,18 @@ public:
* At the moment only one set allowed
* @param n number of rois
* @param roiLimits array of roi
* @param imod module number (-1 for all)
* @returns OK or FAIL
*/
int setROI(int n=-1,ROI roiLimits[]=NULL);
int setROI(int n=-1,ROI roiLimits[]=NULL, int imod = -1);
/**
* Get ROI from each detector and convert it to the multi detector scale (Gotthard)
* @param n number of rois
* @returns OK or FAIL
* @param imod module number (-1 for all)
* @returns pointer to array of ROI structure
*/
ROI* getROI(int &n);
ROI* getROI(int &n, int imod = -1);
/**
* Write to ADC register (Gotthard, Jungfrau, ChipTestBoard). For expert users
@ -1867,6 +1869,20 @@ public:
*/
int setCTBPatWaitTime(int level, uint64_t t=-1);
/**
* Set or Get Quad Type (Only for Eiger Quad detector hardware)
* @param val 1 if quad type set, else 0, -1 gets
* @returns 1 if quad type set, else 0
*/
int setQuad(int val = -1);
/**
* Set or Get Interrupt last sub frame(Only for Eiger)
* @param val 1 if interrupt last subframe set, else 0, -1 gets
* @returns 1 if interrupt last subframe set, else 0, -1 different values
*/
int setInterruptSubframe(int val = -1);
private:
/**
@ -1910,9 +1926,10 @@ private:
* add gap pixels to the image (only for Eiger in 4 bit mode)
* @param image pointer to image without gap pixels
* @param gpImage poiner to image with gap pixels, if NULL, allocated inside function
* @param quadEnable quad enabled
* @returns number of data bytes of image with gap pixels
*/
int processImageWithGapPixels(char* image, char*& gpImage);
int processImageWithGapPixels(char* image, char*& gpImage, bool quadEnable);
/** Multi detector Id */

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "d2bce7e372c241cd235977b92be18555bca6a77d"
#define GITREPUUID "98b45b32fd6653fb2758afdc3f804e2a785c504d"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x4020
#define GITDATE 0x20180927
#define GITBRANCH "4.0.0"
#define GITREV 0x4141
#define GITDATE 0x20191004
#define GITBRANCH "4.1.0"

View File

@ -752,6 +752,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
thisDetector->activated = true;
thisDetector->receiver_deactivatedPaddingEnable = true;
thisDetector->receiver_silentMode = false;
thisDetector->quadEnable = false;
// get the detector parameters based on type
detParameterList detlist;
@ -2213,7 +2214,7 @@ string slsDetector::getLastClientIP() {
int slsDetector::exitServer() {
int retval;
int retval = FAIL;
int fnum=F_EXIT_SERVER;
if (thisDetector->onlineFlag==ONLINE_FLAG) {
@ -2367,6 +2368,12 @@ int slsDetector::updateDetectorNoWait() {
getTotalNumberOfChannels();
}
if(thisDetector->myDetectorType == EIGER){
n += controlSocket->ReceiveDataOnly( &nm,sizeof(int32_t));
thisDetector->quadEnable = nm;
}
if (!n)
printf("n: %d\n", n);
@ -3158,13 +3165,15 @@ string slsDetector::getSettingsDir() {
return std::string(thisDetector->settingsDir);
}
string slsDetector::setSettingsDir(string s) {
sprintf(thisDetector->settingsDir, s.c_str()); return thisDetector->settingsDir;
sprintf(thisDetector->settingsDir, "%s", s.c_str());
return thisDetector->settingsDir;
}
string slsDetector::getCalDir() {
return thisDetector->calDir;
}
string slsDetector::setCalDir(string s) {
sprintf(thisDetector->calDir, s.c_str()); return thisDetector->calDir;
sprintf(thisDetector->calDir, "%s", s.c_str());
return thisDetector->calDir;
}
@ -4338,7 +4347,7 @@ int64_t slsDetector::getTimeLeft(timerIndex index, int imod) {
int fnum=F_GET_TIME_LEFT;
int64_t retval;
int64_t retval = FAIL;
char mess[MAX_STR_LENGTH]="";
int ret=OK;
@ -4627,7 +4636,7 @@ dacs_t slsDetector::setDAC(dacs_t val, dacIndex index, int mV, int imod) {
dacs_t slsDetector::getADC(dacIndex index, int imod) {
dacs_t retval;
dacs_t retval = 0;
int fnum=F_GET_ADC;
int ret=FAIL;
char mess[MAX_STR_LENGTH]="";
@ -4957,6 +4966,7 @@ uint32_t slsDetector::clearBit(uint32_t addr, int n) {
string slsDetector::setNetworkParameter(networkParameter index, string value) {
int i;
uint64_t i64 = -1;
switch (index) {
case DETECTOR_MAC:
return setDetectorMAC(value);
@ -4998,8 +5008,8 @@ string slsDetector::setNetworkParameter(networkParameter index, string value) {
case ADDITIONAL_JSON_HEADER:
return setAdditionalJsonHeader(value);
case RECEIVER_UDP_SCKT_BUF_SIZE:
sscanf(value.c_str(),"%d",&i);
setReceiverUDPSocketBufferSize(i);
sscanf(value.c_str(),"%ld",&i64);
setReceiverUDPSocketBufferSize(i64);
return getReceiverUDPSocketBufferSize();
default:
@ -5107,7 +5117,7 @@ string slsDetector::getReceiverRealUDPSocketBufferSize() {
int fnum=F_RECEIVER_REAL_UDP_SOCK_BUF_SIZE;
int ret = FAIL;
int retval = -1;
int64_t retval = -1;
if(thisDetector->receiverOnlineFlag == ONLINE_FLAG){
#ifdef VERBOSE
@ -5303,6 +5313,9 @@ string slsDetector::setReceiver(string receiverIP) {
if(thisDetector->myDetectorType == GOTTHARD)
sendROI(-1, NULL);
if (thisDetector->myDetectorType == EIGER) {
setQuad(-1);
}
}
}
@ -5353,12 +5366,13 @@ string slsDetector::setReceiverUDPMAC(string udpmac) {
if((udpmac[2]==':')&&(udpmac[5]==':')&&(udpmac[8]==':')&&
(udpmac[11]==':')&&(udpmac[14]==':')){
strcpy(thisDetector->receiverUDPMAC,udpmac.c_str());
if(!strcmp(thisDetector->receiver_hostname,"none"))
if(!strcmp(thisDetector->receiver_hostname,"none")) {
#ifdef VERBOSE
std::cout << "Warning: Receiver hostname not set yet." << endl;
#else
;
#endif
}
/* else if(setUDPConnection()==FAIL){ commented out to be replaced by user
* defined udpmac
std::cout<< "Warning: UDP connection set up failed" << std::endl;
@ -5588,12 +5602,12 @@ string slsDetector::setAdditionalJsonHeader(string jsonheader) {
}
string slsDetector::setReceiverUDPSocketBufferSize(int udpsockbufsize) {
string slsDetector::setReceiverUDPSocketBufferSize(uint64_t udpsockbufsize) {
int fnum=F_RECEIVER_UDP_SOCK_BUF_SIZE;
int ret = FAIL;
int retval = -1;
int arg = udpsockbufsize;
int64_t retval = -1;
int64_t arg = udpsockbufsize;
if(thisDetector->receiverOnlineFlag == ONLINE_FLAG){
#ifdef VERBOSE
@ -5732,8 +5746,10 @@ int slsDetector::setUDPConnection() {
std::cout << "could not configure mac" << endl;
}
}
}else
}else {
ret=FAIL;
setErrorMask((getErrorMask())|(COULD_NOT_CONFIGURE_MAC));
}
#ifdef VERBOSE
printReceiverConfiguration();
#endif
@ -6017,7 +6033,7 @@ int slsDetector::setCounterBit(int i) {
int slsDetector::setROI(int n,ROI roiLimits[]) {
int slsDetector::setROI(int n,ROI roiLimits[], int imod) {
int ret = FAIL;
//sort ascending order
int temp;
@ -6053,7 +6069,7 @@ int slsDetector::setROI(int n,ROI roiLimits[]) {
}
slsDetectorDefs::ROI* slsDetector::getROI(int &n) {
slsDetectorDefs::ROI* slsDetector::getROI(int &n, int imod) {
sendROI(-1,NULL);
n=thisDetector->nROI;
if(thisDetector->myDetectorType==JUNGFRAUCTB) getTotalNumberOfChannels();
@ -6126,7 +6142,7 @@ int slsDetector::sendROI(int n,ROI roiLimits[]) {
#endif
// old firmware requires configuremac after setting roi
if (thisDetector->myDetectorType == GOTTHARD) {
if (thisDetector->myDetectorType == GOTTHARD && n != -1) {
configureMAC();
}
@ -6362,7 +6378,7 @@ int slsDetector::setFlippedData(dimension d, int value) {
int slsDetector::setAllTrimbits(int val, int imod) {
int fnum=F_SET_ALL_TRIMBITS;
int retval;
int retval = FAIL;
char mess[MAX_STR_LENGTH]="";
int ret=OK;
@ -7663,17 +7679,13 @@ int slsDetector::setChip(int reg, int ichip, int imod) {
int slsDetector::setChip(sls_detector_chip chip) {
int fnum=F_SET_CHIP;
int retval;
int retval = FAIL;
int ret=FAIL;
char mess[MAX_STR_LENGTH]="";
int ichi=chip.chip;
int im=chip.module;
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectControl() == OK){
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
@ -8490,7 +8502,7 @@ string slsDetector::getReceiverLastClientIP() {
int slsDetector::exitReceiver() {
int retval;
int retval = FAIL;
int fnum=F_EXIT_RECEIVER;
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
@ -8662,7 +8674,7 @@ void slsDetector::sendMultiDetectorSize() {
ret=thisReceiver->sendIntArray(fnum,retval,arg);
disconnectData();
}
if((ret==FAIL)){
if(ret==FAIL){
std::cout << "Could not set position Id" << std::endl;
setErrorMask((getErrorMask())|(RECEIVER_MULTI_DET_SIZE_NOT_SET));
}
@ -9561,7 +9573,7 @@ int slsDetector::setCTBPattern(string fname) {
int addr=0;
FILE *fd=fopen(fname.c_str(),"r");
if (fd>0) {
if (fd) {
while (fread(&word, sizeof(word), 1,fd)) {
setCTBWord(addr,word);
// cout << hex << addr << " " << word << dec << endl;
@ -9754,5 +9766,83 @@ int slsDetector::setCTBPatWaitTime(int level, uint64_t t) {
}
int slsDetector::setQuad(int val) {
int fnum = F_QUAD, fnum2 = F_RECEIVER_QUAD;
int ret = FAIL;
int retval = -1;
#ifdef VERBOSE
std::cout<<"Setting Quad to " <<val << std::endl;
#endif
// set row column header in detector
if (val >= 0) {
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectControl() == OK){
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
controlSocket->SendDataOnly(&val,sizeof(val));
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret==FAIL){
char mess[MAX_STR_LENGTH] = {};
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
setErrorMask((getErrorMask())|(SOME_ERROR));
}
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
thisDetector->quadEnable = retval;
disconnectControl();
if (ret==FORCE_UPDATE)
updateDetector();
}
}
} else
ret = OK;
// set quad type to receiver (flipped data and detector shape, numdet)
if (ret != FAIL) {
ret = FAIL;
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
if(val ==-1) {
val = thisDetector->quadEnable;
}
#ifdef VERBOSE
std::cout<< "Setting Receiver Quad Mode to " << val << endl;
#endif
if (connectData() == OK){
ret=thisReceiver->sendInt(fnum2,retval,val);
disconnectData();
}
if(ret==FAIL)
setErrorMask((getErrorMask())|(RECEIVER_PARAMETER_NOT_SET));
}
}
return retval;
}
int slsDetector::setInterruptSubframe(int val) {
int fnum = F_INTERRUPT_SUBFRAME;
int ret = FAIL;
int retval = -1;
#ifdef VERBOSE
std::cout<<"Setting Interrupt Sub frame to " <<val << std::endl;
#endif
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectControl() == OK){
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
controlSocket->SendDataOnly(&val,sizeof(val));
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret==FAIL){
char mess[MAX_STR_LENGTH] = {};
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
setErrorMask((getErrorMask())|(SOME_ERROR));
}
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
disconnectControl();
if (ret==FORCE_UPDATE)
updateDetector();
}
}
return retval;
}

View File

@ -19,7 +19,7 @@ class multiSlsDetector;
class SharedMemory;
class receiverInterface;
#define SLS_SHMVERSION 0x180629
#define SLS_SHMVERSION 0x180630
#define NMODMAXX 24
#define NMODMAXY 24
#define NCHIPSMAX 10
@ -384,6 +384,9 @@ private:
/** silent receiver */
bool receiver_silentMode;
/** quad enable */
bool quadEnable;
} sharedSlsDetector;
@ -1500,16 +1503,18 @@ public:
* At the moment only one set allowed
* @param n number of rois
* @param roiLimits array of roi
* @param imod module number (ignored)
* @returns OK or FAIL
*/
int setROI(int n=-1,ROI roiLimits[]=NULL);
int setROI(int n=-1,ROI roiLimits[]=NULL, int imod = -1);
/**
* Get ROI from each detector and convert it to the multi detector scale (Gotthard)
* @param n number of rois
* @returns OK or FAIL
*/
slsDetectorDefs::ROI* getROI(int &n);
/**
* Get ROI from each detector and convert it to the multi detector scale (Gotthard)
* @param n number of rois
* @param imod module number (ignored)
* @returns pointer to array of ROI structure
*/
ROI* getROI(int &n, int imod = -1);
/**
* Returns number of rois
@ -2272,6 +2277,20 @@ public:
*/
int setCTBPatWaitTime(int level, uint64_t t=-1);
/**
* Set or Get Quad Type (Only for Eiger Quad detector hardware)
* @param val 1 if quad type set, else 0, -1 gets
* @returns 1 if quad type set, else 0
*/
int setQuad(int val = -1);
/**
* Set or Get Interrupt last sub frame(Only for Eiger)
* @param val 1 if interrupt last subframe set, else 0, -1 gets
* @returns 1 if interrupt last subframe set, else 0, -1 different values
*/
int setInterruptSubframe(int val = -1);
private:
/**
@ -2420,7 +2439,7 @@ private:
* @param udpsockbufsize additional json header
* @returns receiver udp socket buffer size
*/
std::string setReceiverUDPSocketBufferSize(int udpsockbufsize=-1);
std::string setReceiverUDPSocketBufferSize(uint64_t udpsockbufsize=-1);
/**
* Sets the transmission delay for left, right or entire frame

View File

@ -343,11 +343,11 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
\returns id
*/
virtual int64_t getId(idMode mode, int imod=0)=0;
int64_t getModuleFirmwareVersion(){return getId(MODULE_FIRMWARE_VERSION,-1);};
int64_t getModuleFirmwareVersion(int imod=-1){return getId(MODULE_FIRMWARE_VERSION,imod);};
int64_t getModuleSerialNumber(int imod=-1){return getId(MODULE_SERIAL_NUMBER,imod);};
int64_t getDetectorFirmwareVersion(){return getId(DETECTOR_FIRMWARE_VERSION,-1);};
int64_t getDetectorSerialNumber(){return getId(DETECTOR_SERIAL_NUMBER,-1);};
int64_t getDetectorSoftwareVersion(){return getId(DETECTOR_SOFTWARE_VERSION,-1);};
int64_t getDetectorFirmwareVersion(int imod=-1){return getId(DETECTOR_FIRMWARE_VERSION,imod);};
int64_t getDetectorSerialNumber(int imod=-1){return getId(DETECTOR_SERIAL_NUMBER,imod);};
int64_t getDetectorSoftwareVersion(int imod=-1){return getId(DETECTOR_SOFTWARE_VERSION,imod);};
int64_t getThisSoftwareVersion(){return getId(THIS_SOFTWARE_VERSION,-1);};
/**
@ -846,6 +846,7 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
case RUNNING: return std::string("running");\
case TRANSMITTING: return std::string("data"); \
case RUN_FINISHED: return std::string("finished"); \
case STOPPED: return std::string("stopped"); \
default: return std::string("idle"); \
}};

View File

@ -378,6 +378,13 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
++i;
/*! \page config
- <b>quad [i] </b> if 1, sets the detector size to a quad (Specific to an EIGER quad hardware). 0 by default. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName="quad"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
++i;
/*! \page config
- <b>roimask [i]</b> ?? \c Returns \c (int) in hexadecimal
*/
@ -421,6 +428,14 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdAdvanced;
++i;
/*! \page config
- <b>interruptsubframe [i]</b> sets/gets the interrupt subframe flag. Setting it to 1 will interrupt the last subframe at the required exposure time. By default, this is disabled and set to 0, ie. it will wait for the last sub frame to finish exposing. Used for EIGER in 32 bit mode only. \c Returns \c (int).
*/
descrToFuncMap[i].m_pFuncName="interruptsubframe";
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdAdvanced;
++i;
/*! \page config
- <b>extsig:[i] [flag]</b> sets/gets the mode of the external signal i. Options: \c off, \c gate_in_active_high, \c gate_in_active_low, \c trigger_in_rising_edge, \c trigger_in_falling_edge,
\c ro_trigger_in_rising_edge, \c ro_trigger_in_falling_edge, \c gate_out_active_high, \c gate_out_active_low, \c trigger_out_rising_edge, \c trigger_out_falling_edge, \c ro_trigger_out_rising_edge,
@ -3434,34 +3449,27 @@ string slsDetectorCommand::cmdAngConv(int narg, char *args[], int action){
} else {
return string("none");
}
}else{
return "unknown action";
}
} else if (string(args[0])==string("globaloff")) {
c=GLOBAL_OFFSET;
} else if (string(args[0])==string("fineoff")) {
c=FINE_OFFSET;
} else if (string(args[0])==string("binsize")) {
c=BIN_SIZE;
} else if (string(args[0])==string("angdir")) {
c=ANGULAR_DIRECTION;
} else if (string(args[0])==string("moveflag")) {
c=MOVE_FLAG;
} else if (string(args[0])==string("samplex")) {
c=SAMPLE_X;
} else if (string(args[0])==string("sampley")) {
c=SAMPLE_Y;
}
else
}else{
return string("could not decode angular conversion parameter ")+cmd;
}
if (action==PUT_ACTION) {
if (sscanf(args[1],"%lf",&fval))
@ -3568,7 +3576,7 @@ string slsDetectorCommand::helpThreaded(int narg, char *args[], int action){
string slsDetectorCommand::cmdImage(int narg, char *args[], int action){
string sval;
int retval;
int retval = FAIL;
if (action==HELP_ACTION)
return helpImage(narg,args,HELP_ACTION);
else if (action==GET_ACTION)
@ -3609,7 +3617,7 @@ string slsDetectorCommand::cmdCounter(int narg, char *args[], int action){
int ival;
char answer[100];
string sval;
int retval;
int retval = FAIL;
if (action==HELP_ACTION)
return helpCounter(narg,args,HELP_ACTION);
else if (action==PUT_ACTION)
@ -4047,7 +4055,8 @@ string slsDetectorCommand::cmdNetworkParameter(int narg, char *args[], int actio
} else if (cmd=="rx_udpsocksize") {
t=RECEIVER_UDP_SCKT_BUF_SIZE;
if (action==PUT_ACTION){
if (!(sscanf(args[1],"%d",&i)))
uint64_t ival = -1;
if (!(sscanf(args[1],"%ld",&ival)))
return ("cannot parse argument") + string(args[1]);
}
} else if (cmd=="rx_realudpsocksize") {
@ -4464,7 +4473,7 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
myDet->setOnline(ONLINE_FLAG);
if (cmd == "roi")
if (cmd == "roi" || cmd == "quad")
myDet->setReceiverOnline(ONLINE_FLAG);
if (action==PUT_ACTION) {
@ -4500,6 +4509,13 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
myDet->setMaxNumberOfChannelsPerDetector(Y,val);
}
if(cmd=="quad"){
if (val >=0 ) {
sprintf(ans, "%d", myDet->setQuad(val));
return string(ans);
}
}
if(cmd=="flippeddatax"){
if ((!sscanf(args[1],"%d",&val)) || (val!=0 && val != 1))
return string ("cannot scan flippeddata x mode: must be 0 or 1");
@ -4533,11 +4549,19 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
myDet->setReceiverOnline(ONLINE_FLAG);
ret=myDet->setDynamicRange(val);
} else if (cmd=="roi") {
myDet->getROI(ret);
ROI* r = myDet->getROI(ret);
if (myDet->isMultiSlsDetectorClass() && r != NULL)
delete [] r;
} else if (cmd=="detsizechan") {
sprintf(ans,"%d %d",myDet->getMaxNumberOfChannelsPerDetector(X),myDet->getMaxNumberOfChannelsPerDetector(Y));
return string(ans);
}
else if (cmd=="quad") {
sprintf(ans, "%d", myDet->setQuad());
return string(ans);
}
else if(cmd=="flippeddatax"){
myDet->setReceiverOnline(ONLINE_FLAG);
ret = myDet->getFlippedData(X);
@ -4575,6 +4599,7 @@ string slsDetectorCommand::helpDetectorSize(int narg, char *args[], int action)
os << "dr i \n sets the dynamic range of the detector"<< std::endl;
os << "roi i xmin xmax ymin ymax \n sets region of interest where i is number of rois;i=0 to clear rois"<< std::endl;
os << "detsizechan x y \n sets the maximum number of channels for complete detector set in both directions; -1 is no limit"<< std::endl;
os << "quad i \n if i = 1, sets the detector size to a quad (Specific to an EIGER quad hardware). 0 by default."<< std::endl;
os << "flippeddatax x \n sets if the data should be flipped on the x axis"<< std::endl;
os << "flippeddatay y \n sets if the data should be flipped on the y axis"<< std::endl;
os << "gappixels i \n enables/disables gap pixels in system (detector & receiver). 1 sets, 0 unsets. Used in EIGER only and multidetector level." << std::endl;
@ -4585,6 +4610,7 @@ string slsDetectorCommand::helpDetectorSize(int narg, char *args[], int action)
os << "dr \n gets the dynamic range of the detector"<< std::endl;
os << "roi \n gets region of interest"<< std::endl;
os << "detsizechan \n gets the maximum number of channels for complete detector set in both directions; -1 is no limit"<< std::endl;
os << "quad \n returns 1 if the detector size is a quad (Specific to an EIGER quad hardware). 0 by default."<< std::endl;
os << "flippeddatax\n gets if the data will be flipped on the x axis"<< std::endl;
os << "flippeddatay\n gets if the data will be flipped on the y axis"<< std::endl;
os << "gappixels\n gets if gap pixels is enabled in system. Used in EIGER only and multidetector level." << std::endl;
@ -5824,18 +5850,14 @@ string slsDetectorCommand::cmdTimeLeft(int narg, char *args[], int action) {
if ((ret!=-1) && (index==ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER
|| index==ACTUAL_TIME || index==MEASUREMENT_TIME ||
MEASURED_PERIOD || MEASURED_SUBPERIOD))
MEASURED_PERIOD || MEASURED_SUBPERIOD)) {
rval=(double)ret*1E-9;
else rval=ret;
sprintf(answer,"%0.9f",rval);
} else {
sprintf(answer,"%lld",(long long int)ret);
}
sprintf(answer,"%0.9f",rval);
return string(answer);
}
@ -6048,7 +6070,18 @@ string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action) {
return string("unknown");
} else if (cmd=="extsig") {
} else if (cmd=="interruptsubframe") {
myDet->setOnline(ONLINE_FLAG);
if (action==PUT_ACTION) {
int ival = -1;
if (!sscanf(args[1],"%d",&ival))
return string("could not scan interrupt sub frame parameter " + string(args[1]));
myDet->setInterruptSubframe(ival);
}
char ans[100];
sprintf(ans,"%d",myDet->setInterruptSubframe(-1));
return std::string(ans);
} else if (cmd=="extsig") {
externalSignalFlag flag=GET_EXTERNAL_SIGNAL_FLAG;
int is=-1;
if (sscanf(args[0],"extsig:%d",&is))
@ -6148,6 +6181,7 @@ string slsDetectorCommand::helpAdvanced(int narg, char *args[], int action) {
os << "extsig:i mode \t sets the mode of the external signal i. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl;
os << "flags mode \t sets the readout flags to mode. can be none, storeinram, tot, continous, parallel, nonparallel, safe, digital, analog_digital, overlow, nooverflow, unknown." << std::endl;
os << "interruptsubframe flag \t sets the interrupt subframe flag. Setting it to 1 will interrupt the last subframe at the required exposure time. By default, this is disabled and set to 0, ie. it will wait for the last sub frame to finish exposing. Used for EIGER in 32 bit mode only." << std::endl;
os << "programfpga f \t programs the fpga with file f (with .pof extension)." << std::endl;
os << "resetfpga f \t resets fpga, f can be any value" << std::endl;
@ -6161,6 +6195,7 @@ string slsDetectorCommand::helpAdvanced(int narg, char *args[], int action) {
os << "extsig:i \t gets the mode of the external signal i. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl;
os << "flags \t gets the readout flags. can be none, storeinram, tot, continous, parallel, nonparallel, safe, digital, analog_digital, overflow, nooverflow, unknown" << std::endl;
os << "interruptsubframe \t gets the interrupt subframe flag. Setting it to 1 will interrupt the last subframe at the required exposure time. By default, this is disabled and set to 0, ie. it will wait for the last sub frame to finish exposing. Used for EIGER in 32 bit mode only." << std::endl;
os << "led \t returns led status (0 off, 1 on)" << std::endl;
os << "powerchip \t gets if the chip has been powered on or off" << std::endl;
os << "auto_comp_disable \t Currently not implemented. gets if the automatic comparator diable mode is enabled/disabled" << std::endl;
@ -6207,7 +6242,8 @@ string slsDetectorCommand::cmdConfiguration(int narg, char *args[], int action)
myDet->setReceiverOnline(ONLINE_FLAG);
if (action==PUT_ACTION)
return string("cannot put");
return string(""+myDet->printReceiverConfiguration());
myDet->printReceiverConfiguration();
return string("");
}else if (cmd=="parameters") {
myDet->setReceiverOnline(ONLINE_FLAG);
if (action==PUT_ACTION) {
@ -6995,6 +7031,8 @@ string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
}
}
os << hex << reg << dec;
if (myDet->isMultiSlsDetectorClass() && aa != NULL)
delete [] aa;
//os <<" "<< hex << myDet->readRegister(120) << dec;

View File

@ -115,18 +115,37 @@ int slsDetectorUsers::getPositions(double *pos){
}
int slsDetectorUsers::setDetectorSize(int x0, int y0, int nx, int ny){
if(myDetector->getTotalNumberOfChannels(slsDetectorDefs::Y)>1)
return 1;
int nmod=nx/(myDetector->getChansPerMod(0));
cout << myDetector->getChansPerMod(0) << " " << nx << " " << nmod << endl;
return myDetector->setNumberOfModules(nmod)*myDetector->getChansPerMod(0);}
// only one roi
slsDetectorDefs::ROI roi[1];
roi[0].xmin = x0;
roi[0].ymin = y0;
roi[0].xmax = x0 + nx;
roi[0].ymax = y0 + ny;
return myDetector->setROI(1, roi);
}
int slsDetectorUsers::getDetectorSize(int &x0, int &y0, int &nx, int &ny){
y0=0;
x0=0;
nx=myDetector->getTotalNumberOfChannels(slsDetectorDefs::X);
ny=myDetector->getTotalNumberOfChannels(slsDetectorDefs::Y);
return nx*ny;
// default (no roi)
y0=0;
x0=0;
nx=myDetector->getTotalNumberOfChannels(slsDetectorDefs::X);
ny=myDetector->getTotalNumberOfChannels(slsDetectorDefs::Y);
int n = 0;
slsDetectorDefs::ROI* roi = myDetector->getROI(n);
// roi
if (roi != NULL && n == 1) {
x0 = roi[0].xmin;
y0 = roi[0].ymin;
nx = roi[0].xmax - roi[0].xmin;
ny = roi[0].ymax - roi[0].ymin;
}
if (roi != NULL)
delete [] roi;
return nx*ny;
}
int slsDetectorUsers::getMaximumDetectorSize(int &nx, int &ny){
@ -267,24 +286,24 @@ string slsDetectorUsers::setClientDataStreamingInIP(string ip){
return myDetector->setClientDataStreamingInIP(ip);
}
int64_t slsDetectorUsers::getModuleFirmwareVersion(){
return myDetector->getModuleFirmwareVersion();
int64_t slsDetectorUsers::getModuleFirmwareVersion(int imod){
return myDetector->getModuleFirmwareVersion(imod);
}
int64_t slsDetectorUsers::getModuleSerialNumber(int imod){
return myDetector->getModuleSerialNumber(imod);
}
int64_t slsDetectorUsers::getDetectorFirmwareVersion(){
return myDetector->getDetectorFirmwareVersion();
int64_t slsDetectorUsers::getDetectorFirmwareVersion(int imod){
return myDetector->getDetectorFirmwareVersion(imod);
}
int64_t slsDetectorUsers::getDetectorSerialNumber(){
return myDetector->getDetectorSerialNumber();
int64_t slsDetectorUsers::getDetectorSerialNumber(int imod){
return myDetector->getDetectorSerialNumber(imod);
}
int64_t slsDetectorUsers::getDetectorSoftwareVersion(){
return myDetector->getDetectorSoftwareVersion();
int64_t slsDetectorUsers::getDetectorSoftwareVersion(int imod){
return myDetector->getDetectorSoftwareVersion(imod);
}
int64_t slsDetectorUsers::getThisSoftwareVersion(){
@ -494,3 +513,11 @@ int64_t slsDetectorUsers::setNumberOfStorageCells(int64_t t, int imod) {
int slsDetectorUsers::setStoragecellStart(int pos) {
return myDetector->setStoragecellStart(pos);
}
int slsDetectorUsers::setROI(int n, slsDetectorDefs::ROI roiLimits[], int imod) {
return myDetector->setROI(n, roiLimits, imod);
}
slsDetectorDefs::ROI* slsDetectorUsers::getROI(int &n, int imod) {
return myDetector->getROI(n, imod);
}

View File

@ -17,6 +17,8 @@ class detectorData;
class multiSlsDetector;
class multiSlsDetectorCommand;
#include "sls_detector_defs.h"
#include <stdint.h>
#include <string>
@ -247,7 +249,7 @@ class slsDetectorUsers
int getPositions(double *pos=NULL);
/**
@short sets the detector size
@short sets the detector size (only 1 ROI)
\param x0 horizontal position origin in channel number (-1 unchanged)
\param y0 vertical position origin in channel number (-1 unchanged)
\param nx number of channels in horiziontal (-1 unchanged)
@ -256,14 +258,13 @@ class slsDetectorUsers
*/
int setDetectorSize(int x0=-1, int y0=-1, int nx=-1, int ny=-1);
/**
@short gets detector size
@short gets detector size (roi size if only one roi)
\param x0 horizontal position origin in channel number
\param y0 vertical position origin in channel number
\param nx number of channels in horiziontal
\param ny number of channels in vertical
\returns OK/FAIL
\returns total number of channels
*/
int getDetectorSize(int &x0, int &y0, int &nx, int &ny);
/**
@ -505,12 +506,13 @@ class slsDetectorUsers
/**
get get Module Firmware Version
@param imod module number
\returns id
*/
int64_t getModuleFirmwareVersion();
int64_t getModuleFirmwareVersion(int imod=-1);
/**
get get Module Serial Number
get get Module Serial Number (only mythen)
@param imod module number
\returns id
*/
@ -518,21 +520,24 @@ class slsDetectorUsers
/**
get get Detector Firmware Version
@param imod module number
\returns id
*/
int64_t getDetectorFirmwareVersion();
int64_t getDetectorFirmwareVersion(int imod=-1);
/**
get get Detector Serial Number
@param imod module number
\returns id
*/
int64_t getDetectorSerialNumber();
int64_t getDetectorSerialNumber(int imod=-1);
/**
get get Detector Software Version
@param imod module number
\returns id
*/
int64_t getDetectorSoftwareVersion();
int64_t getDetectorSoftwareVersion(int imod=-1);
/**
get this Software Version
@ -814,6 +819,25 @@ class slsDetectorUsers
*/
int setStoragecellStart(int pos=-1);
/**
* Set ROI (Gotthard) (>= 1 roi, but max 1 roi per module)
* At the moment only one set allowed
* @param n number of rois
* @param roiLimits array of roi
* @param imod module number (-1 for all)
* @returns OK or FAIL
*/
int setROI(int n=-1, slsDetectorDefs::ROI roiLimits[]=NULL, int imod = -1);
/**
* Get ROI from each detector and convert it to the multi detector scale (Gotthard)
* >= 1 roi, but max 1 roi per module
* @param n number of rois
* @param imod module number (ignored)
* @returns pointer to array of ROI structure
*/
slsDetectorDefs::ROI* getROI(int &n, int imod = -1);
/************************************************************************
STATIC FUNCTIONS
@ -832,6 +856,7 @@ class slsDetectorUsers
case 3: return std::string("finished"); \
case 4: return std::string("data"); \
case 5: return std::string("running"); \
case 6: return std::string("stoppped"); \
default: return std::string("unknown"); \
}};
@ -888,9 +913,9 @@ class slsDetectorUsers
} };
/**
@short returns external communication mode std::string from index
\param s index for communication mode
\returns auto, trigger, ro_trigger, gating, triggered_gating, unknown when wrong mode
@short returns external communication mode index from std::string
\param s auto, trigger, ro_trigger, gating, triggered_gating, burst_trigger, unknown when wrong mode
\returns index for communication mode
*/
static int getTimingMode(std::string s){ \
@ -899,7 +924,8 @@ class slsDetectorUsers
if (s== "ro_trigger") return 2; \
if (s== "gating") return 3; \
if (s== "triggered_gating") return 4; \
return -1; };
if (s== "burst_trigger") return 5; \
return -1; }; \
private:

View File

@ -869,16 +869,18 @@ virtual int calibratePedestal(int frames = 0)=0;
set roi
\param n number of rois
\param roiLimits array of roi
\param imod module number (-1 for all)
\returns success or failure
*/
virtual int setROI(int n=-1,ROI roiLimits[]=NULL)=0;
virtual int setROI(int n=-1,ROI roiLimits[]=NULL, int imod = -1)=0;
/**
get roi from each detector and convert it to the multi detector scale
\param n number of rois
\returns an array of multidetector's rois
\param imod module number (-1 for all)
\returns pointer to array of ROI structure
*/
virtual ROI* getROI(int &n)=0;
virtual ROI* getROI(int &n, int imod = -1)=0;
/** Sets the read receiver frequency
if data required from receiver randomly readRxrFrequency=0,
@ -1019,11 +1021,22 @@ virtual int setReceiverSilentMode(int i = -1)=0;
*/
virtual int checkVersionCompatibility(portType t) = 0;
/**
* Set or Get Quad Type (Only for Eiger Quad detector hardware)
* @param val 1 if quad type set, else 0, -1 gets
* @returns 1 if quad type set, else 0
*/
virtual int setQuad(int val = -1) = 0;
/**
* Set or Get Interrupt last sub frame(Only for Eiger)
* @param val 1 if interrupt last subframe set, else 0, -1 gets
* @returns 1 if interrupt last subframe set, else 0, -1 different values
*/
virtual int setInterruptSubframe(int val = -1) = 0;
protected:
static const int64_t thisSoftwareVersion=0x20141013;
//protected:

View File

@ -96,7 +96,7 @@ double angularConversionStatic::convertAngle(double pos, int ich, angleConversio
// cout << "no ang conv " << endl;
double enc=0, trans=0;
double ang;
double ang=0;
switch (mF) {
case 0:

View File

@ -93,7 +93,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
*/
virtual std::string setFilePath(std::string s) {
pthread_mutex_lock(&mf);
sprintf(filePath, s.c_str());
sprintf(filePath, "%s", s.c_str());
pthread_mutex_unlock(&mf);
return std::string(filePath);
};
@ -105,7 +105,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
*/
virtual std::string setFileName(std::string s) {
pthread_mutex_lock(&mf);
sprintf(fileName, s.c_str());
sprintf(fileName, "%s", s.c_str());
pthread_mutex_unlock(&mf);
return std::string(fileName);};

View File

@ -103,7 +103,7 @@ int postProcessingFuncs::addFrame(double *data, double *pos, double *I0, double
if (I0>0) {
if (I0 != NULL) {
i0=*I0;
totalI0+=i0;
} else

View File

@ -1,5 +1,5 @@
#ifndef POSTPROCESSINGFUNCS_H
#define POSTPROCESSINGFUNC_H
#define POSTPROCESSINGFUNCS_H
@ -77,4 +77,4 @@ class postProcessingFuncs : public virtual angularConversionStatic
};
#endif
#endif //POSTPROCESSINGFUNCS_H

View File

@ -73,8 +73,8 @@ int setDefaultDacs();
extern u_int32_t writeRegister(u_int32_t offset, u_int32_t data); // blackfin.h
extern u_int32_t readRegister(u_int32_t offset); // blackfin.h
#else
uint32_t writeRegister(uint32_t offset, uint32_t data);
uint32_t readRegister(uint32_t offset);
int writeRegister(uint32_t offset, uint32_t data);
int readRegister(uint32_t offset, uint32_t* retval);
#endif
@ -194,6 +194,12 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32
#if defined(JUNGFRAUD) || defined(EIGERD)
int setDetectorPosition(int pos[]);
#endif
#ifdef EIGERD
int setQuad(int val);
int getQuad();
int setInterruptSubframe(int val);
int getInterruptSubframe();
#endif
// very detector specific

View File

@ -211,6 +211,8 @@ const char* getFunctionName(enum detFuncs func) {
case F_STORAGE_CELL_START: return "F_STORAGE_CELL_START";
case F_CHECK_VERSION: return "F_CHECK_VERSION";
case F_SOFTWARE_TRIGGER: return "F_SOFTWARE_TRIGGER";
case F_QUAD: return "F_QUAD";
case F_INTERRUPT_SUBFRAME: return "F_INTERRUPT_SUBFRAME";
default: return "Unknown Function";
}
@ -297,6 +299,8 @@ void function_table() {
flist[F_STORAGE_CELL_START] = &storage_cell_start;
flist[F_CHECK_VERSION] = &check_version;
flist[F_SOFTWARE_TRIGGER] = &software_trigger;
flist[F_QUAD] = &set_quad;
flist[F_INTERRUPT_SUBFRAME] = &set_interrupt_subframe;
// check
if (NUM_DET_FUNCTIONS >= TOO_MANY_FUNCTIONS_DEFINED) {
@ -1454,8 +1458,22 @@ int write_register(int file_des) {
#ifdef VERBOSE
printf("writing to register 0x%x data 0x%x\n", addr, val);
#endif
#ifdef EIGERD
if(writeRegister(addr, val) == FAIL) {
ret = FAIL;
sprintf(mess,"Could not write to register 0x%x.\n", addr);
cprintf(RED, "Warning: %s", mess);
} else {
if(readRegister(addr, &retval) == FAIL) {
ret = FAIL;
sprintf(mess,"Could not read register 0x%x.\n", addr);
cprintf(RED, "Warning: %s", mess);
}
}
#else
retval=writeRegister(addr,val);
if (retval!=val) {
#endif
if (ret == OK && retval!=val) {
ret = FAIL;
sprintf(mess,"Writing to register 0x%x failed: wrote 0x%x but read 0x%x\n", addr, val, retval);
cprintf(RED, "Warning: %s", mess);
@ -1505,8 +1523,16 @@ int read_register(int file_des) {
printf("reading register 0x%x\n", addr);
#endif
#ifdef SLS_DETECTOR_FUNCTION_LIST
#ifdef EIGERD
if(readRegister(addr, &retval) == FAIL) {
ret = FAIL;
sprintf(mess,"Could not read register 0x%x.\n", addr);
cprintf(RED, "Warning: %s", mess);
}
#else
retval=readRegister(addr);
#endif
#endif
#ifdef VERBOSE
printf("Returned value 0x%x\n", retval);
#endif
@ -3708,6 +3734,14 @@ int send_update(int file_des) {
if (n < 0) return printSocketReadError();
#ifdef EIGERD
#ifdef SLS_DETECTOR_FUNCTION_LIST
nm=getQuad();
#endif
n = sendData(file_des,&nm,sizeof(int32_t),INT32);
if (n < 0) return printSocketReadError();
#endif
if (lockStatus==0) {
strcpy(lastClientIP,thisClientIP);
}
@ -5926,3 +5960,133 @@ int software_trigger(int file_des) {
return ret;
}
int set_quad(int file_des) {
int ret=OK,ret1=OK;
int n=0;
int retval=-1;
sprintf(mess,"Setting quad failed\n");
// execute action
#ifndef EIGERD
//to receive any arguments
while (n > 0)
n = receiveData(file_des,mess,MAX_STR_LENGTH,OTHER);
ret = FAIL;
sprintf(mess,"Function (set_quad) is not implemented for this detector\n");
cprintf(RED, "Warning: %s", mess);
#else
// receive arguments
int arg=-1;
n = receiveData(file_des,&arg,sizeof(arg),INT32);
if (n < 0) return printSocketReadError();
// execute action
if (differentClients && lockStatus && arg!=-1) {
ret = FAIL;
sprintf(mess,"Detector locked by %s\n",lastClientIP);
cprintf(RED, "Warning: %s", mess);
}
#ifdef SLS_DETECTOR_FUNCTION_LIST
else {
#ifdef VERBOSE
printf("Setting Quad :%d \n",arg);
#endif
if(arg != -1 && setQuad(arg) == FAIL) {
ret=FAIL;
strcpy(mess, "setting quad failed\n");
cprintf(RED, "Warning: %s", mess);
}
retval = getQuad();
if(ret == OK && (arg != -1) && (retval != arg)) {
ret=FAIL;
cprintf(RED, "Warning: %s", mess);
}
}
#endif
if (ret==OK && differentClients)
ret=FORCE_UPDATE;
#endif
// ret could be swapped during sendData
ret1 = ret;
// send ok / fail
n = sendData(file_des,&ret1,sizeof(ret),INT32);
// send return argument
if (ret==FAIL) {
n += sendData(file_des,mess,sizeof(mess),OTHER);
}
n += sendData(file_des,&retval,sizeof(retval),INT32);
// return ok / fail
return ret;
}
int set_interrupt_subframe(int file_des) {
int ret=OK,ret1=OK;
int n=0;
int retval=-1;
sprintf(mess,"Setting interrupt subframe failed\n");
// execute action
#ifndef EIGERD
//to receive any arguments
while (n > 0)
n = receiveData(file_des,mess,MAX_STR_LENGTH,OTHER);
ret = FAIL;
sprintf(mess,"Function (set_interrupt_subframe) is not implemented for this detector\n");
cprintf(RED, "Warning: %s", mess);
#else
// receive arguments
int arg=-1;
n = receiveData(file_des,&arg,sizeof(arg),INT32);
if (n < 0) return printSocketReadError();
// execute action
if (differentClients && lockStatus && arg!=-1) {
ret = FAIL;
sprintf(mess,"Detector locked by %s\n",lastClientIP);
cprintf(RED, "Warning: %s", mess);
}
#ifdef SLS_DETECTOR_FUNCTION_LIST
else {
#ifdef VERBOSE
printf("Setting Interrupt subframe :%d \n",arg);
#endif
if (arg != -1 && setInterruptSubframe(arg) == FAIL) {
ret=FAIL;
strcpy(mess, "setting interrupt subframe failed\n");
cprintf(RED, "Warning: %s", mess);
}
retval = getInterruptSubframe();
#ifdef VERBOSE
printf("retval Interrupt subframe :%d \n",retval);
#endif
if(ret == OK && (arg != -1) && (retval != arg)) {
ret=FAIL;
sprintf(mess, "setting interrupt subframe failed. Set %d, got %d\n", arg, retval);
cprintf(RED, "Warning: %s", mess);
}
}
#endif
if (ret==OK && differentClients)
ret=FORCE_UPDATE;
#endif
// ret could be swapped during sendData
ret1 = ret;
// send ok / fail
n = sendData(file_des,&ret1,sizeof(ret),INT32);
// send return argument
if (ret==FAIL) {
n += sendData(file_des,mess,sizeof(mess),OTHER);
}
n += sendData(file_des,&retval,sizeof(retval),INT32);
// return ok / fail
return ret;
}

View File

@ -97,5 +97,7 @@ int auto_comp_disable(int);
int storage_cell_start(int);
int check_version(int);
int software_trigger(int);
int set_quad(int);
int set_interrupt_subframe(int);
#endif

View File

@ -18,7 +18,7 @@ set(SOURCES
# HDF5
if (USE_HDF5)
if (SLS_USE_HDF5)
if (HDF5_FOUND)
include_directories(
${HDF5_INCLUDE_DIRS}
@ -30,7 +30,7 @@ if (USE_HDF5)
src/HDF5File.cpp
)
endif ()
endif (USE_HDF5)
endif (SLS_USE_HDF5)
add_definitions(
@ -48,15 +48,6 @@ set_target_properties(zmq PROPERTIES
IMPORTED_LOCATION ${ZMQ_STATIC_ARCHIVE}
)
add_library(slsReceiverStatic STATIC
${SOURCES}
${HEADERS}
)
set_target_properties(slsReceiverStatic PROPERTIES
ARCHIVE_OUTPUT_NAME SlsReceiver
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
add_library(slsReceiverShared SHARED
${SOURCES}
${HEADERS}
@ -98,12 +89,12 @@ endif ()
install(TARGETS slsReceiverShared slsReceiverStatic slsReceiver
install(TARGETS slsReceiverShared slsReceiver
EXPORT "${TARGETS_EXPORT_NAME}"
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
PUBLIC_HEADER DESTINATION include)
install(FILES ${ZMQ_STATIC_ARCHIVE}
DESTINATION lib)
DESTINATION lib)

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsReceiverSoftware
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: d2bce7e372c241cd235977b92be18555bca6a77d
Revision: 839
Branch: 4.0.0
Repsitory UUID: 98b45b32fd6653fb2758afdc3f804e2a785c504d
Revision: 870
Branch: 4.1.0
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 4020
Last Changed Date: 2018-09-27 17:58:04.000000002 +0200 ./src/UDPStandardImplementation.cpp
Last Changed Rev: 4141
Last Changed Date: 2019-10-04 09:28:28.000000001 +0200 ./updateAPIVersion.sh

View File

@ -58,19 +58,10 @@ class BinaryFile : private virtual slsReceiverDefs, public File, public BinaryFi
/**
* Create master file
* @param en ten giga enable
* @param size image size
* @param nx number of pixels in x direction
* @param ny number of pixels in y direction
* @param at acquisition time
* @param st sub exposure time
* @param sp sub period
* @param ap acquisition period
* @param attr master file attributes
* @returns OK or FAIL
*/
int CreateMasterFile(bool en, uint32_t size,
uint32_t nx, uint32_t ny, uint64_t at, uint64_t st, uint64_t sp,
uint64_t ap);
int CreateMasterFile(masterAttributes& attr);
/**
* Close Current File

View File

@ -100,26 +100,11 @@ class BinaryFileStatic {
* @param fd pointer to file handle
* @param fname master file name
* @param owenable overwrite enable
* @param dr dynamic range
* @param tenE ten giga enable
* @param size image size
* @param nPixelsX number of pixels in x direction
* @param nPixelsY number of pixels in y direction
* @param nf number of images
* @param maxf maximum frames per file
* @param acquisitionTime acquisition time
* @param acquisitionPeriod acquisition period
* @param subexposuretime sub exposure time
* @param subperiod sub period
* @param version version of software for binary writing
* @param attr master file attributes
* @returns 0 for success and 1 for fail
*/
static int CreateMasterDataFile(FILE*& fd, std::string fname, bool owenable,
uint32_t dr, bool tenE, uint32_t size,
uint32_t nPixelsX, uint32_t nPixelsY, uint64_t nf,
uint32_t maxf,
uint64_t acquisitionTime, uint64_t subexposuretime,
uint64_t subperiod, uint64_t acquisitionPeriod, double version)
masterAttributes& attr)
{
if(!owenable){
if (NULL == (fd = fopen((const char *) fname.c_str(), "wx"))){
@ -136,17 +121,20 @@ class BinaryFileStatic {
char message[MAX_MASTER_FILE_LENGTH];
sprintf(message,
"Version : %.1f\n"
"Detector Type : %d\n"
"Dynamic Range : %d\n"
"Ten Giga : %d\n"
"Image Size : %d bytes\n"
"row : %d pixels\n"
"col : %d pixels\n"
"Max. Frames Per File : %u\n"
"nPixelsX : %d pixels\n"
"nPixelsY : %d pixels\n"
"Max Frames Per File : %u\n"
"Total Frames : %lld\n"
"Exptime (ns) : %lld\n"
"SubExptime (ns) : %lld\n"
"SubPeriod(ns) : %lld\n"
"Period (ns) : %lld\n"
"Gap Pixels Enable : %d\n"
"Quad Enable : %d\n"
"Timestamp : %s\n\n"
"#Frame Header\n"
@ -165,18 +153,21 @@ class BinaryFileStatic {
"Header Version : 1 byte\n"
"Packets Caught Mask : 64 bytes\n"
,
version,
dr,
tenE,
size,
nPixelsX,
nPixelsY,
maxf,
(long long int)nf,
(long long int)acquisitionTime,
(long long int)subexposuretime,
(long long int)subperiod,
(long long int)acquisitionPeriod,
attr.version,
attr.detectorType,
attr.dynamicRange,
attr.tenGiga,
attr.imageSize,
attr.nPixelsX,
attr.nPixelsY,
attr.maxFramesPerFile,
(long long int)attr.totalFrames,
(long long int)attr.exptimeNs,
(long long int)attr.subExptimeNs,
(long long int)attr.subPeriodNs,
(long long int)attr.periodNs,
attr.gapPixelsEnable,
attr.quadEnable,
ctime(&t));
if (strlen(message) > MAX_MASTER_FILE_LENGTH) {
cprintf(RED,"Master File Size %d is greater than max str size %d\n",

View File

@ -10,6 +10,7 @@
*/
#include "ThreadObject.h"
#include "receiver_defs.h"
class GeneralData;
class Fifo;
@ -38,6 +39,7 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
* @param act pointer to activated
* @param depaden pointer to deactivated padding enable
* @param sm pointer to silent mode
* @param qe pointer to quad Enable
* @param dataReadycb pointer to data ready call back function
* @param dataModifyReadycb pointer to data ready call back function with modified
* @param pDataReadycb pointer to arguments of data ready call back function. To write/stream a smaller size of processed data, change this value (only smaller value is allowed).
@ -45,7 +47,7 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
DataProcessor(int ind, detectorType dtype, Fifo*& f, fileFormat* ftype,
bool fwenable, bool* dsEnable, bool* gpEnable, uint32_t* dr,
uint32_t* freq, uint32_t* timer,
bool* fp, bool* act, bool* depaden, bool* sm,
bool* fp, bool* act, bool* depaden, bool* sm, bool* qe,
void (*dataReadycb)(char*, char*, uint32_t, void*),
void (*dataModifyReadycb)(char*, char*, uint32_t &, void*),
void *pDataReadycb);
@ -175,16 +177,10 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
/**
* Create New File
* @param en ten giga enable
* @param nf number of frames
* @param at acquisition time
* @param st sub exposure time
* @param sp sub period
* @param ap acquisition period
* @param attr master file attributes
* @returns OK or FAIL
*/
int CreateNewFile(bool en, uint64_t nf, uint64_t at, uint64_t st,
uint64_t sp, uint64_t ap);
int CreateNewFile(masterAttributes& attr);
/**
* Closes files
@ -341,6 +337,9 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
/** Silent Mode */
bool* silentMode;
/** quad enable */
bool* quadEnable;
/** frame padding */
bool* framePadding;

View File

@ -27,12 +27,15 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
* @param dr pointer to dynamic range
* @param r roi
* @param fi pointer to file index
* @param fd flipped data enable for x and y dimensions
* @param fd flipped data enable for x dimension
* @param ajh additional json header
* @param sm pointer to silent mode
* @param nd pointer to number of detectors in each dimension
* @param gpEnable pointer to gap pixels enable
* @param qe pointer to quad Enable
*/
DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI>* r,
uint64_t* fi, int* fd, char* ajh, bool* sm);
uint64_t* fi, int fd, char* ajh, bool* sm, int* nd, bool* gpEnable, bool* qe);
/**
* Destructor
@ -88,6 +91,18 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
*/
int SetThreadPriority(int priority);
/**
* Set number of detectors
* @param number of detectors in both dimensions
*/
void SetNumberofDetectors(int* nd);
/**
* Set Flipped data enable across x dimension
* @param flipped data enable in x dimension
*/
void SetFlippedDataX(int fd);
/**
* Creates Zmq Sockets
* (throws an exception if it couldnt create zmq sockets)
@ -183,16 +198,12 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
/** Pointer to file index */
uint64_t* fileIndex;
/** flipped data across both dimensions enable */
int* flippedData;
/** flipped data across x dimension */
int flippedDataX;
/** additional json header */
char* additionJsonHeader;
/** Silent Mode */
bool* silentMode;
/** Aquisition Started flag */
bool acquisitionStartedFlag;
@ -211,5 +222,13 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
/** Complete buffer used for roi, eg. shortGotthard */
char* completeBuffer;
/** Number of Detectors in X and Y dimension */
int numDet[2];
/** Gap Pixels Enable */
bool* gapPixelsEnable;
/** quad enable */
bool* quadEnable;
};

View File

@ -10,6 +10,7 @@
#include "sls_receiver_defs.h"
#include "logger.h"
#include "receiver_defs.h"
#include <string>
@ -121,19 +122,10 @@ class File : private virtual slsReceiverDefs {
/**
* Create master file
* @param en ten giga enable
* @param size image size
* @param nx number of pixels in x direction
* @param ny number of pixels in y direction
* @param at acquisition time
* @param st sub exposure time
* @param sp sub period
* @param ap acquisition period
* @param attr master file attributes
* @returns OK or FAIL
*/
virtual int CreateMasterFile(bool en, uint32_t size,
uint32_t nx, uint32_t ny, uint64_t at, uint64_t st,
uint64_t sp, uint64_t ap) {
virtual int CreateMasterFile(masterAttributes& attr) {
cprintf(RED,"This is a generic function CreateMasterFile that "
"should be overloaded by a derived class\n");
return OK;

View File

@ -89,7 +89,6 @@ public:
/** Cosntructor */
GeneralData():
myDetectorType(slsReceiverDefs::GENERIC),
@ -120,32 +119,18 @@ public:
/** Destructor */
virtual ~GeneralData(){};
/**
* Get Header Infomation (frame number, packet number)
* @param index thread index for debugging purposes
* @param packetData pointer to data
* @param frameNumber frame number
* @param packetNumber packet number
*/
virtual void GetHeaderInfo(int index, char* packetData, uint64_t& frameNumber, uint32_t& packetNumber) const
{
frameNumber = ((uint32_t)(*((uint32_t*)(packetData))));
frameNumber++;
packetNumber = frameNumber&packetIndexMask;
frameNumber = (frameNumber & frameIndexMask) >> frameIndexOffset;
}
/**
* Get Header Infomation (frame number, packet number)
* @param index thread index for debugging purposes
* @param packetData pointer to data
* @param dynamicRange dynamic range to assign subframenumber if 32 bit mode
* @param oddStartingPacket odd starting packet (gotthard)
* @param frameNumber frame number
* @param packetNumber packet number
* @param subFrameNumber sub frame number if applicable
* @param bunchId bunch id
*/
virtual void GetHeaderInfo(int index, char* packetData, uint32_t dynamicRange,
virtual void GetHeaderInfo(int index, char* packetData, uint32_t dynamicRange, bool oddStartingPacket,
uint64_t& frameNumber, uint32_t& packetNumber, uint32_t& subFrameNumber, uint64_t& bunchId) const
{
subFrameNumber = -1;
@ -170,7 +155,7 @@ public:
* @param i pointer to a vector of ROI pointers
* @returns adc configured
*/
virtual const int GetAdcConfigured(int index, std::vector<slsReceiverDefs::ROI>* i) const{
virtual int GetAdcConfigured(int index, std::vector<slsReceiverDefs::ROI>* i) const{
cprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
return 0;
};
@ -205,11 +190,24 @@ public:
/**
* Enable Gap Pixels changes member variables
* @param enable true if gap pixels enable, else false
* @param dr dynamic range
* @param q quad enable
*/
virtual void SetGapPixelsEnable(bool b, int dr) {
virtual void SetGapPixelsEnable(bool b, int dr, bool q) {
cprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
};
/**
* Set odd starting packet (gotthard)
* @param index thread index for debugging purposes
* @param packetData pointer to data
* @returns true or false for odd starting packet number
*/
virtual bool SetOddStartingPacket(int index, char* packetData) {
cprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
return false;
};
/**
* Print all variables
@ -270,44 +268,26 @@ private:
};
/**
* Get Header Infomation (frame number, packet number)
* @param index thread index for debugging purposes
* @param packetData pointer to data
* @param frameNumber frame number
* @param packetNumber packet number
*/
virtual void GetHeaderInfo(int index, char* packetData, uint64_t& frameNumber, uint32_t& packetNumber) const
{
if (nPixelsX == 1280) {
frameNumber = ((uint32_t)(*((uint32_t*)(packetData))));
frameNumber++;
packetNumber = frameNumber&packetIndexMask;
frameNumber = (frameNumber & frameIndexMask) >> frameIndexOffset;
} else {
frameNumber = ((uint32_t)(*((uint32_t*)(packetData))));
packetNumber = 0;
}
}
/**
* Get Header Infomation (frame number, packet number)
* @param index thread index for debugging purposes
* @param packetData pointer to data
* @param dynamicRange dynamic range to assign subframenumber if 32 bit mode
* @param oddStartingPacket odd starting packet (gotthard)
* @param frameNumber frame number
* @param packetNumber packet number
* @param subFrameNumber sub frame number if applicable
* @param bunchId bunch id
*/
virtual void GetHeaderInfo(int index, char* packetData, uint32_t dynamicRange,
void GetHeaderInfo(int index, char* packetData, uint32_t dynamicRange, bool oddStartingPacket,
uint64_t& frameNumber, uint32_t& packetNumber, uint32_t& subFrameNumber, uint64_t& bunchId) const
{
if (nPixelsX == 1280) {
subFrameNumber = -1;
bunchId = -1;
frameNumber = ((uint32_t)(*((uint32_t*)(packetData))));
frameNumber++;
if (oddStartingPacket)
frameNumber++;
packetNumber = frameNumber&packetIndexMask;
frameNumber = (frameNumber & frameIndexMask) >> frameIndexOffset;
} else {
@ -323,7 +303,7 @@ private:
* Set ROI
* @param i ROI
*/
virtual void SetROI(std::vector<slsReceiverDefs::ROI> i) {
void SetROI(std::vector<slsReceiverDefs::ROI> i) {
// all adcs
if(!i.size()) {
nPixelsX = 1280;
@ -367,7 +347,7 @@ private:
* @param i pointer to a vector of ROI
* @returns adc configured
*/
virtual const int GetAdcConfigured(int index, std::vector<slsReceiverDefs::ROI>* i) const{
int GetAdcConfigured(int index, std::vector<slsReceiverDefs::ROI>* i) const{
int adc = -1;
// single adc
if(i->size()) {
@ -392,6 +372,40 @@ private:
return adc;
};
/**
* Set odd starting packet (gotthard)
* @param index thread index for debugging purposes
* @param packetData pointer to data
* @returns true or false for odd starting packet number
*/
bool SetOddStartingPacket(int index, char* packetData) {
bool oddStartingPacket = true;
// care only if no roi
if (nPixelsX == 1280) {
uint32_t fnum = ((uint32_t)(*((uint32_t*)(packetData))));
uint32_t firstData = ((uint32_t)(*((uint32_t*)(packetData + 4))));
// first packet
if (firstData == 0xCACACACA) {
// packet number should be 0, but is 1 => so odd starting packet
if (fnum & packetIndexMask) {
oddStartingPacket = true;
} else {
oddStartingPacket = false;
}
}
// second packet
else {
// packet number should be 1, but is 0 => so odd starting packet
if (!(fnum & packetIndexMask)) {
oddStartingPacket = true;
} else {
oddStartingPacket = false;
}
}
}
return oddStartingPacket;
};
};
@ -520,29 +534,18 @@ private:
defaultFifoDepth = 2500;
};
/**
* Get Header Infomation (frame number, packet number)
* @param index thread index for debugging purposes
* @param packetData pointer to data
* @param frameNumber frame number
* @param packetNumber packet number
*/
virtual void GetHeaderInfo(int index, char* packetData, uint64_t& frameNumber, uint32_t& packetNumber) const {
jfrauctb_packet_header_t* header = (jfrauctb_packet_header_t*)(packetData);
frameNumber = (uint64_t)((*( (uint32_t*) header->frameNumber)) & frameIndexMask);
packetNumber = (uint32_t)(*( (uint8_t*) header->packetNumber));
}
/**
* Get Header Infomation (frame number, packet number)
* @param index thread index for debugging purposes
* @param packetData pointer to data
* @param dynamicRange dynamic range to assign subframenumber if 32 bit mode
* @param oddStartingPacket odd starting packet (gotthard)
* @param frameNumber frame number * @param packetNumber packet number
* @param subFrameNumber sub frame number if applicable
* @param bunchId bunch id
*/
void GetHeaderInfo(int index, char* packetData, uint32_t dynamicRange,
void GetHeaderInfo(int index, char* packetData, uint32_t dynamicRange, bool oddStartingPacket,
uint64_t& frameNumber, uint32_t& packetNumber, uint32_t& subFrameNumber, uint64_t& bunchId) const {
subFrameNumber = -1;
jfrauctb_packet_header_t* header = (jfrauctb_packet_header_t*)(packetData);
@ -645,13 +648,17 @@ class EigerData : public GeneralData {
* Enable Gap Pixels changes member variables
* @param enable true if gap pixels enable, else false
* @param dr dynamic range
* @param q quad enable
*/
void SetGapPixelsEnable(bool b, int dr) {
void SetGapPixelsEnable(bool b, int dr, bool q) {
if (dr == 4)
b = 0;
switch((int)b) {
case 1:
nPixelsX = (256 * 2) + 3;
if (q) {
--nPixelsX; // if quad, remove last line
}
nPixelsY = 256 + 1;
imageSize = nPixelsX * nPixelsY * ((dr > 16) ? 4 : // 32 bit
((dr > 8) ? 2 : // 16 bit

View File

@ -93,19 +93,10 @@ class HDF5File : private virtual slsReceiverDefs, public File, public HDF5FileSt
/**
* Create master file
* @param en ten giga enable
* @param size image size
* @param nx number of pixels in x direction
* @param ny number of pixels in y direction
* @param at acquisition time
* @param st sub exposure time
* @param sp sub period
* @param ap acquisition period
* @param attr master file attributes
* @returns OK or FAIL
*/
int CreateMasterFile(bool en, uint32_t size,
uint32_t nx, uint32_t ny, uint64_t at, uint64_t st, uint64_t sp,
uint64_t ap);
int CreateMasterFile(masterAttributes& attr);
/**
* End of Acquisition

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