merge from 4.0.1

This commit is contained in:
maliakal_d 2019-02-11 14:04:09 +01:00
commit 907d1655d1
79 changed files with 1911 additions and 851 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
...

45
.travis.yml Normal file
View File

@ -0,0 +1,45 @@
sudo: false
language: cpp
matrix:
include:
- os: linux
env: CONDA_PY=3.6
dist: trusty
install:
- sudo apt-get update
- ldd --version
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- rm -f miniconda.sh
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda config --add channels conda-forge
- conda config --add channels slsdetectorgroup
- conda update conda
- conda update --all
- conda install conda-build anaconda-client
# Useful for debugging any issues with conda
- conda info -a
# Replace dep1 dep2 ... with your dependencies
- conda create -q -n test-environment python=$CONDA_PY
- source activate test-environment
- conda-build .
script:
- echo "No test scripts to be run!"
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.1-rc

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,205 @@
SLS Detector Package 4.0.0 released on 27.09.2018
=================================================
SLS Detector Package 4.0.1 released on 08.02.2018 (Bug Fix Release)
===================================================================
This document describes the differences between 4.0.1 and 4.0.0 releases.
CONTENTS
--------
1. Topics Concerning
2. Resolved Issues
3. Known Issues
4. Firmware Requirements
5. Download, Documentation & Support
1. Topics Concerning
====================
- Jungfrau server (new firmware mapped)
- Eiger server (measuredPeriod, reg)
- Gotthard server(ADC channel shift, ROI, 25um slave packets)
- Receiver (padding, releasing resources segfault, gappixels)
- Users class (detectorSize, ROI, versions, status)
- API (config error, ROI)
- Compile (Options prefix, static libraries, Makefile for API)
- Gui (multi module)
INTRODUCTION
2. Resolved Issues
==================
This document describes the differences between 4.0.0 and 3.1.4 releases.
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
-------
General Software related:
dhanya.thattil@psi.ch
anna.bergamaschi@psi.ch
Python related:
erik.frojdh@psi.ch
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
Detector Server
---------------
1. (Jungfrau): Latest Jungfrau firmware release mapped.
2. (Eiger): Measured subperiod initially wrapped around 4.29s. Now, upto 42.9s.
Jungfrau
========
Minimum compatible version : 15.06.2018
Latest version : 15.06.2018
Advanced command "reg" was writing only to right FPGA.
3. (Gotthard 25/50um): Since Gotthard only sends packet numbers, one had to
remember to take even number of images in ROI mode, if they wanted to
switch back to non ROI mode.
This is fixed now, but temporary fix involves sending an image during
configuration, which will not be captured by the receiver. Hence, it takes
longer to configure. Permanent fix will require a firmware update.
The detector output is shifted by 1 for every 32 channels. This is fixed now.
Receiver
--------
1. Receiver padding was enabled only if deactivated padding was also enabled.
Receiver padding enable and receiver deactivated padding enable are independent now.
2. Starting and stopping receiver without listening resulted in seg faults.
3. Gappixels in receiver bug fix.
Client
------
1. (Users class): DetectorSize modified to set/get ROI if ROI is only 1 in number.
Allowed setting/getting ROI at single detector level via API.
(ROI for Gotthard only). Added them to the users class as setROI and getROI.
Retrieving versions at module level is possible now.
Added "stopped" as status in getRunStatus list.
2. (API): Incorrect mac address in config file will set error flag in API and not just
print the error.
ROI possible at module level.
Compile
-------
1. CMake options now have a prefix 'SLS_'.
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. Static libraries removed.
2. slsDetectorPackage/manual/manual-api/Makefile modified to use libraries
from slsDetectorPackage/bin as the main Makefile copies the libraries there.
No effect when using CMakeFiles.
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 us 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
Gui
---
1. Adding multiple detectors in x and y direction incremented number of detectors
in y direction incorrectly. Effect seen only in GUI (segfault) if
detsizechan has multi detectors in both direction. Fixed.
3. Known Issues
===============
Detector Specific
-----------------
1. (Gotthard 25 um): Slave misses or captures an extra frame. Occurs irregularly.
2. (Gotthard 25/50um): Using ROI (2 chips, 256 channels) missses last pixel
of that ADC.
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 : 22
Latest compatible version : 22
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://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.
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/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
-------
General Software related:
dhanya.thattil@psi.ch
anna.bergamaschi@psi.ch
Python related:
erik.frojdh@psi.ch

12
cmk.sh
View File

@ -116,20 +116,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 +161,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

@ -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.

View File

@ -64,7 +64,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}
@ -560,12 +561,23 @@ 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}}. 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. If the exposure time is unknow, it is recommended that you switch off the rate corrections. 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.
\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}
@ -1046,6 +1058,12 @@ 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 theshold 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{Troubleshooting}
\subsection{Cannot successfully finish an acquisition}
@ -1167,6 +1185,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}
@ -1190,6 +1215,13 @@ 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 reaturn 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}.

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

15
recipe/build.sh Normal file
View File

@ -0,0 +1,15 @@
mkdir build
mkdir install
cd build
cmake .. \
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
-DCMAKE_INSTALL_PREFIX=install \
-DSLS_USE_TEXTCLIENT=ON \
-DSLS_USE_RECEIVER=ON \
-DSLS_USE_GUI=ON \
-DCMAKE_BUILD_TYPE=Release \
-DSLS_USE_HDF5=OFF\
cmake --build . -- -j10
cmake --build . --target install

15
recipe/copy_gui.sh Normal file
View File

@ -0,0 +1,15 @@
mkdir $PREFIX/lib
mkdir $PREFIX/bin
mkdir $PREFIX/include
#No libs for gui?
#Binaries
cp build/bin/gui_client $PREFIX/bin/.
cp build/bin/slsDetectorGui $PREFIX/bin/.
#Which headers do we need for development??
# cp include/some_lib.h $PREFIX/include/.

23
recipe/copy_lib.sh Normal file
View File

@ -0,0 +1,23 @@
mkdir $PREFIX/lib
mkdir $PREFIX/bin
mkdir $PREFIX/include
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/libSlsReceiver.so $PREFIX/lib/.
cp build/bin/libSlsReceiver.a $PREFIX/lib/.
#Binaries
cp build/bin/sls_detector_acquire $PREFIX/bin/.
cp build/bin/sls_detector_get $PREFIX/bin/.
cp build/bin/sls_detector_put $PREFIX/bin/.
cp build/bin/sls_detector_help $PREFIX/bin/.
cp build/bin/slsReceiver $PREFIX/bin/.
cp build/bin/slsMultiReceiver $PREFIX/bin/.
#Which headers do we need for development??
cp build/install/include/* $PREFIX/include/slsDetectorPackage/
# cp include/some_lib.h $PREFIX/include/.

89
recipe/meta.yaml Normal file
View File

@ -0,0 +1,89 @@
package:
name: sls_detector_software
version: 4.0.1
source:
- path: ..
build:
number: 0
rpaths:
- lib/
requirements:
build:
- {{ compiler('c') }}
- {{compiler('cxx')}}
- cmake
- qwt 6.*
- qt=4.8.7=7
- zeromq=4.2.5=hfc679d8_5
- pyzmq
- xorg-libx11
- xorg-libice
- xorg-libxext
- xorg-libsm
- xorg-libxau
- xorg-libxrender
- xorg-libxfixes
- {{ cdt('mesa-libgl-devel') }} # [linux]
- {{ cdt('mesa-libegl-devel') }} # [linux]
- {{ cdt('mesa-dri-drivers') }} # [linux]
- {{ cdt('libselinux') }} # [linux]
- {{ cdt('libxdamage') }} # [linux]
- {{ cdt('libxxf86vm') }} # [linux]
host:
- libstdcxx-ng
- libgcc-ng
- libpng >=1.6.32,<1.6.35
- xorg-libx11
- xorg-libice
- xorg-libxext
- xorg-libsm
- xorg-libxau
- xorg-libxrender
- xorg-libxfixes
run:
- libstdcxx-ng
- libgcc-ng
outputs:
- name: sls_detector_lib
version: 4.0.1
script: copy_lib.sh
requirements:
build:
- {{ compiler('c') }}
- {{compiler('cxx')}}
- name: sls_detector_gui
version: 4.0.1
script: copy_gui.sh
requirements:
build:
- {{ compiler('c') }}
- {{compiler('cxx')}}
- cmake
- qwt 6.*
- qt=4.8.7=7
- zeromq=4.2.5=hfc679d8_5
- pyzmq
- xorg-libx11
- xorg-libice
- xorg-libxext
- xorg-libsm
- xorg-libxau
- xorg-libxrender
- xorg-libxfixes
- {{ cdt('mesa-libgl-devel') }} # [linux]
- {{ cdt('mesa-libegl-devel') }} # [linux]
- {{ cdt('mesa-dri-drivers') }} # [linux]
- {{ cdt('libselinux') }} # [linux]
- {{ cdt('libxdamage') }} # [linux]
- {{ cdt('libxxf86vm') }} # [linux]
run:
- sls_detector_lib=4.0.1
- qwt 6.*
- qt=4.8.7=7

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1 @@
../slsDetectorSoftware/jungfrauDetectorServer/bin/jungfrauDetectorServerv4.0.1.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: 3c774478681813e451df683e2bc8403b37490323
Revision: 524
Branch: 4.0.1
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: 4084
Last Changed Date: 2019-02-07 18:05:28.000000002 +0100 ./src/qTabSettings.cpp

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "d2bce7e372c241cd235977b92be18555bca6a77d"
#define GITREPUUID "3c774478681813e451df683e2bc8403b37490323"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x4020
#define GITDATE 0x20180927
#define GITBRANCH "4.0.0"
#define GITREV 0x4084
#define GITDATE 0x20190207
#define GITBRANCH "4.0.1"

View File

@ -41,15 +41,6 @@ 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}
@ -98,7 +89,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

@ -1,6 +1,5 @@
/** API versions */
#define APIRECEIVER 0x180927
#define APIEIGER 0x180820
#define APIJUNGFRAU 0x180925
#define APIGOTTHARD 0x180928
#define APIEIGER 0x190207
#define APIJUNGFRAU 0x190107
#define APIGOTTHARD 0x190201

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;
}
@ -2014,14 +2014,24 @@ 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);
cprintf(RED,"Could not read tr value. Value read:%d\n", value);
value = 0;
}
if(!Feb_Interface_WriteRegister(Module_GetTopLeftAddress (&modules[1]),offset, data,0, 0)) {
cprintf(RED,"Could not read tl value. Value read:%d\n", value);
value = 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);
cprintf(RED,"Could not read br value. Value read:%d\n", value);
value = 0;
}
if(!Feb_Interface_WriteRegister(Module_GetBottomLeftAddress (&modules[1]),offset, data,0, 0)) {
cprintf(RED,"Could not read bl value. Value read:%d\n", value);
value = 0;
}
}
return Feb_Control_ReadRegister(offset);
}
@ -2029,16 +2039,34 @@ uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
uint32_t Feb_Control_ReadRegister(uint32_t offset) {
uint32_t value=0;
uint32_t value1=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;
}
if(!Feb_Interface_ReadRegister(Module_GetTopRightAddress (&modules[1]),offset, &value)) {
cprintf(RED,"Could not read value. Value read:%d\n", value);
value = 0;
}
printf("Read top right addr: 0x%08x\n", value);
if(!Feb_Interface_ReadRegister(Module_GetTopLeftAddress (&modules[1]),offset, &value1)) {
cprintf(RED,"Could not read value. Value read:%d\n", value1);
value1 = 0;
}
printf("Read top left addr: 0x%08x\n", value1);
if (value != value1)
value = -1;
} else {
if(!Feb_Interface_ReadRegister(Module_GetBottomRightAddress (&modules[1]),offset, &value)) {
cprintf(RED,"Could not read value. Value read:%d\n", value);
value = 0;
}
if(!Feb_Interface_ReadRegister(Module_GetBottomRightAddress (&modules[1]),offset, &value)) {
cprintf(RED,"Could not read value. Value read:%d\n", value);
value = 0;
}
printf("Read bottom right addr: 0x%08x\n", value);
if(!Feb_Interface_ReadRegister(Module_GetBottomLeftAddress (&modules[1]),offset, &value1)) {
cprintf(RED,"Could not read value. Value read:%d\n", value1);
value1 = 0;
}
printf("Read bottom left addr: 0x%08x\n", value1);
if (value != value1)
value = -1;
}
return value;
}

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: c52025dd7c4b44b93e64353a22997d971996ab18
Revision: 350
Repsitory UUID: def79807f6f40ed1797b8154240adbc0e35c95e0
Revision: 352
Branch: developer
Last Changed Author: Gemma_Tinti
Last Changed Rev: 3999
Last Changed Date: 2018-09-28 14:11:53.000000002 +0200 ./Makefile.virtual
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 4039
Last Changed Date: 2019-02-07 18:05:28.000000002 +0100 ./xparameters.h

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "c52025dd7c4b44b93e64353a22997d971996ab18"
#define GITAUTH "Gemma_Tinti"
#define GITREV 0x3999
#define GITDATE 0x20180928
#define GITREPUUID "def79807f6f40ed1797b8154240adbc0e35c95e0"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x4039
#define GITDATE 0x20190207
#define GITBRANCH "developer"

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: 3c774478681813e451df683e2bc8403b37490323
Revision: 2071
Branch: 4.0.1
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: 4084
Last Changed Date: 2019-02-08 17:25:57.000000002 +0100 ./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: c52025dd7c4b44b93e64353a22997d971996ab18
Revision: 237
Repsitory UUID: def79807f6f40ed1797b8154240adbc0e35c95e0
Revision: 244
Branch: developer
Last Changed Author: Gemma_Tinti
Last Changed Rev: 3999
Last Changed Date: 2018-09-28 16:10:41.000000002 +0200 ./server_funcs.c
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 4039
Last Changed Date: 2019-02-11 11:53:14.000000002 +0100 ./server_funcs.c

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "c52025dd7c4b44b93e64353a22997d971996ab18"
#define GITAUTH "Gemma_Tinti"
#define GITREV 0x3999
#define GITDATE 0x20180928
#define GITREPUUID "def79807f6f40ed1797b8154240adbc0e35c95e0"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x4039
#define GITDATE 0x20190211
#define GITBRANCH "developer"

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

@ -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: c52025dd7c4b44b93e64353a22997d971996ab18
Revision: 163
Repsitory UUID: def79807f6f40ed1797b8154240adbc0e35c95e0
Revision: 168
Branch: developer
Last Changed Author: Gemma_Tinti
Last Changed Rev: 3999
Last Changed Date: 2018-09-28 14:11:53.000000002 +0200 ./RegisterDefs.h
Last Changed Author: Dhanya_Thattil
Last Changed Rev: 4039
Last Changed Date: 2019-02-11 11:53:14.000000002 +0100 ./RegisterDefs.h

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "c52025dd7c4b44b93e64353a22997d971996ab18"
#define GITAUTH "Gemma_Tinti"
#define GITREV 0x3999
#define GITDATE 0x20180928
#define GITREPUUID "def79807f6f40ed1797b8154240adbc0e35c95e0"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x4039
#define GITDATE 0x20190211
#define GITBRANCH "developer"

View File

@ -1588,6 +1588,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();
@ -5379,7 +5386,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);

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

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "d2bce7e372c241cd235977b92be18555bca6a77d"
#define GITREPUUID "3c774478681813e451df683e2bc8403b37490323"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x4020
#define GITDATE 0x20180927
#define GITBRANCH "4.0.0"
#define GITREV 0x4084
#define GITDATE 0x20190208
#define GITBRANCH "4.0.1"

View File

@ -2213,7 +2213,7 @@ string slsDetector::getLastClientIP() {
int slsDetector::exitServer() {
int retval;
int retval = FAIL;
int fnum=F_EXIT_SERVER;
if (thisDetector->onlineFlag==ONLINE_FLAG) {
@ -3158,13 +3158,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 +4340,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 +4629,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]="";
@ -5353,12 +5355,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;
@ -5732,8 +5735,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 +6022,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 +6058,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 +6131,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 +6367,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 +7668,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 +8491,7 @@ string slsDetector::getReceiverLastClientIP() {
int slsDetector::exitReceiver() {
int retval;
int retval = FAIL;
int fnum=F_EXIT_RECEIVER;
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
@ -8662,7 +8663,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 +9562,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;

View File

@ -1500,16 +1500,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

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

@ -3434,34 +3434,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 +3561,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 +3602,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)
@ -4533,7 +4526,9 @@ 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);
@ -6207,7 +6202,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 +6991,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"); \
}};

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,

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

@ -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: 3c774478681813e451df683e2bc8403b37490323
Revision: 858
Branch: 4.0.1
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: 4084
Last Changed Date: 2019-02-08 16:44:46.000000002 +0100 ./src/Listener.cpp

View File

@ -189,10 +189,6 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
/** additional json header */
char* additionJsonHeader;
/** Silent Mode */
bool* silentMode;
/** Aquisition Started flag */
bool acquisitionStartedFlag;

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;
};
@ -210,6 +195,17 @@ public:
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 +266,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 +301,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 +345,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 +370,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 +532,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);

View File

@ -202,7 +202,7 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
bool runningFlag;
/** GeneralData (Detector Data) object */
const GeneralData* generalData;
GeneralData* generalData;
/** Fifo structure */
Fifo* fifo;
@ -311,5 +311,11 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
/** number of images for statistic */
uint32_t numFramesStatistic;
/**
* starting packet number is odd or evern, accordingly increment frame number
* to get first packet number as 0
* (pecific to gotthard, can vary between modules, hence defined here) */
bool oddStartingPacket;
};

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "d2bce7e372c241cd235977b92be18555bca6a77d"
#define GITREPUUID "3c774478681813e451df683e2bc8403b37490323"
#define GITAUTH "Dhanya_Thattil"
#define GITREV 0x4020
#define GITDATE 0x20180927
#define GITBRANCH "4.0.0"
#define GITREV 0x4084
#define GITDATE 0x20190208
#define GITBRANCH "4.0.1"

View File

@ -115,7 +115,7 @@ inline std::string NowTime()
const int buffer_len = sizeof(buffer);
time_t t;
time(&t);
tm r = {0};
tm r;
strftime(buffer, buffer_len, "%X", localtime_r(&t, &r));
buffer[buffer_len - 1] = 0;
struct timeval tv;

View File

@ -146,7 +146,7 @@ void DataProcessor::ResetParametersforNewMeasurement(){
delete [] tempBuffer;
tempBuffer = 0;
}
if (*gapPixelsEnable >= 0) {
if (*gapPixelsEnable) {
tempBuffer = new char[generalData->imageSize];
memset(tempBuffer, 0, generalData->imageSize);
}
@ -363,10 +363,12 @@ void DataProcessor::ProcessAnImage(char* buf) {
*dynamicRange);
// frame padding
if (*activated && *framePadding && nump < generalData->packetsPerFrame)
PadMissingPackets(buf);
// deactivated and padding enabled
if ((!(*activated) && *deactivatedPaddingEnable) ||
// frame padding
(*framePadding && nump < generalData->packetsPerFrame))
else if (!(*activated) && *deactivatedPaddingEnable)
PadMissingPackets(buf);
// normal call back

View File

@ -28,7 +28,6 @@ DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI>* r,
fileIndex(fi),
flippedData(fd),
additionJsonHeader(ajh),
silentMode(sm),
acquisitionStartedFlag(false),
measurementStartedFlag(false),
firstAcquisitionIndex(0),

View File

@ -54,7 +54,8 @@ Listener::Listener(int ind, detectorType dtype, Fifo*& f, runStatus* s,
listeningPacket(0),
udpSocketAlive(0),
numPacketsStatistic(0),
numFramesStatistic(0)
numFramesStatistic(0),
oddStartingPacket(true)
{
if(ThreadObject::CreateThread() == FAIL)
throw std::exception();
@ -64,9 +65,11 @@ Listener::Listener(int ind, detectorType dtype, Fifo*& f, runStatus* s,
Listener::~Listener() {
if (udpSocket) delete udpSocket;
sem_post(&semaphore_socket);
sem_destroy(&semaphore_socket);
if (udpSocket){
delete udpSocket;
sem_post(&semaphore_socket);
sem_destroy(&semaphore_socket);
}
if (carryOverPacket) delete [] carryOverPacket;
if (listeningPacket) delete [] listeningPacket;
ThreadObject::DestroyThread();
@ -201,9 +204,10 @@ int Listener::CreateUDPSockets() {
ShutDownUDPSocket();
try{
udpSocket = new genericSocket(*udpPortNumber, genericSocket::UDP,
genericSocket* g = new genericSocket(*udpPortNumber, genericSocket::UDP,
generalData->packetSize, (strlen(eth)?eth:NULL), generalData->headerPacketSize,
*udpSocketBufferSize);
udpSocket = g;
FILE_LOG(logINFO) << index << ": UDP port opened at port " << *udpPortNumber;
} catch (...) {
FILE_LOG(logERROR) << "Could not create UDP socket on port " << *udpPortNumber;
@ -227,8 +231,10 @@ void Listener::ShutDownUDPSocket() {
udpSocket->ShutDownSocket();
FILE_LOG(logINFO) << "Shut down of UDP port " << *udpPortNumber;
fflush(stdout);
//delete socket at stoplistening
sem_wait(&semaphore_socket);
// wait only if the threads have started as it is the threads that
//give a post to semaphore(at stopListening)
if (runningFlag)
sem_wait(&semaphore_socket);
delete udpSocket;
udpSocket = 0;
sem_destroy(&semaphore_socket);
@ -427,7 +433,7 @@ uint32_t Listener::ListenToAnImage(char* buf) {
// -------------------old header -----------------------------------------------------------------------------
else {
generalData->GetHeaderInfo(index, carryOverPacket + esize,
*dynamicRange, fnum, pnum, snum, bid);
*dynamicRange, oddStartingPacket, fnum, pnum, snum, bid);
}
//------------------------------------------------------------------------------------------------------------
if (fnum != currentFrameIndex) {
@ -542,8 +548,13 @@ uint32_t Listener::ListenToAnImage(char* buf) {
}
// -------------------old header -----------------------------------------------------------------------------
else {
// set first packet to be odd or even (check required when switching from roi to no roi)
if (myDetectorType == GOTTHARD && !measurementStartedFlag) {
oddStartingPacket = generalData->SetOddStartingPacket(index, listeningPacket + esize);
}
generalData->GetHeaderInfo(index, listeningPacket + esize,
*dynamicRange, fnum, pnum, snum, bid);
*dynamicRange, oddStartingPacket, fnum, pnum, snum, bid);
}
//------------------------------------------------------------------------------------------------------------