mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-18 15:57:13 +02:00
Compare commits
118 Commits
Author | SHA1 | Date | |
---|---|---|---|
f08006db46 | |||
d5df63ce49 | |||
64d59b1dff | |||
a0bc843018 | |||
6126a401d0 | |||
7665d7b33a | |||
d3d8d7ba8e | |||
938d90bfb8 | |||
990f32397b | |||
53b1456f1a | |||
fbb901c8cc | |||
7b7641fb53 | |||
4de49906d4 | |||
c9b5db4d7f | |||
2e6378f241 | |||
692584ced8 | |||
4ae93dbc73 | |||
f37ceaf517 | |||
75a9002f2c | |||
cfec18e441 | |||
3ff7654c29 | |||
9781dbe49e | |||
e777c0fa79 | |||
9981632b2d | |||
d8436da540 | |||
4dc4c1ec0a | |||
6537aa1ceb | |||
467be41ccb | |||
73a39fcafe | |||
041c9fefa0 | |||
4f4f3baefc | |||
3523de8ba9 | |||
e77a93021d | |||
4dc14bf9d6 | |||
a5cdd687e6 | |||
89175586b4 | |||
c3bbe45b68 | |||
8f64449117 | |||
94fcf52e64 | |||
64214f22f9 | |||
36bd91daa3 | |||
40bfca588b | |||
b9446f40d1 | |||
ec66079f65 | |||
e6340456f6 | |||
f42d591845 | |||
e9029ba8f2 | |||
121747352d | |||
4cfea36b93 | |||
a829e69313 | |||
42124ca97c | |||
972f21258a | |||
6bb1188c37 | |||
a57c677105 | |||
254e8f85d8 | |||
56484daf18 | |||
6cc13f9dc1 | |||
93ab8d05d7 | |||
88c65c506f | |||
074636a7d6 | |||
e432e6f90d | |||
a3c686d271 | |||
9f79f132b7 | |||
4a7424d749 | |||
e4f2072067 | |||
8bae1059db | |||
4b39ca6e5f | |||
f0cccf9de8 | |||
89c774dbf7 | |||
5ca3a1b685 | |||
7d7302a90c | |||
ac3230c656 | |||
5761642da0 | |||
70ffdf9709 | |||
af2f2708ad | |||
c42b4b8c0e | |||
d9b88ea7d2 | |||
9f22c80081 | |||
ab6f448e1f | |||
53e5a097ab | |||
e527aad6ab | |||
a0208778c1 | |||
69897d4c78 | |||
41035808e9 | |||
2314fdabd1 | |||
abe63acc79 | |||
688e4e84d9 | |||
0210b7358c | |||
dd84337ef3 | |||
a9e375ed34 | |||
f881133795 | |||
8cbf3c62a9 | |||
ffc09ed19c | |||
3ea2520615 | |||
1dea112742 | |||
d8fccdcefa | |||
981b13494c | |||
7131f77a3a | |||
f08d430d16 | |||
9c89f6a63d | |||
e746256653 | |||
2e78484b61 | |||
1908a82627 | |||
bdf3a010c3 | |||
6bd0256172 | |||
5667353f47 | |||
c4137dc309 | |||
4b7edf2e62 | |||
0194d7ba1c | |||
23dffa47df | |||
5c35a33e02 | |||
65d95480bd | |||
6cfd0f8962 | |||
6e47f0b7f7 | |||
3c891495db | |||
95030bc55f | |||
e8bdf5a505 | |||
b6d9015ed0 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,6 +7,7 @@ bin/
|
|||||||
*.out
|
*.out
|
||||||
*.toc
|
*.toc
|
||||||
*.o
|
*.o
|
||||||
|
*.so
|
||||||
.*
|
.*
|
||||||
build
|
build
|
||||||
RELEASE.txt
|
RELEASE.txt
|
||||||
|
32
.travis.yml
32
.travis.yml
@ -4,39 +4,31 @@ language: cpp
|
|||||||
|
|
||||||
os: linux
|
os: linux
|
||||||
|
|
||||||
env:
|
# env:
|
||||||
matrix:
|
# matrix:
|
||||||
- CONDA_PY=3.6
|
# - CONDA_PY="3.7"
|
||||||
- CONDA_PY=3.7
|
|
||||||
- CONDA_PY=3.8
|
|
||||||
|
|
||||||
|
|
||||||
dist: trusty
|
|
||||||
|
dist: bionic
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- sudo apt-get update
|
- sudo apt-get update
|
||||||
- ldd --version
|
- ldd --version
|
||||||
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
|
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
|
||||||
- bash miniconda.sh -b -p $HOME/miniconda
|
- bash miniconda.sh -b -p $HOME/miniconda
|
||||||
- export PATH="$HOME/miniconda/bin:$PATH"
|
- source "$HOME/miniconda/etc/profile.d/conda.sh"
|
||||||
- rm -f miniconda.sh
|
- rm -f miniconda.sh
|
||||||
- hash -r
|
- hash -r
|
||||||
- conda config --set always_yes yes --set changeps1 no
|
- conda config --set always_yes yes --set changeps1 no
|
||||||
- conda config --add channels conda-forge
|
- conda config --add channels conda-forge
|
||||||
- conda config --add channels slsdetectorgroup
|
- conda config --add channels slsdetectorgroup
|
||||||
- conda update conda
|
- conda update -q conda
|
||||||
- conda update --all
|
|
||||||
- conda install conda-build=3.17
|
|
||||||
- conda install anaconda-client
|
|
||||||
- conda install conda-verify
|
|
||||||
|
|
||||||
# Useful for debugging any issues with conda
|
|
||||||
- conda info -a
|
- conda info -a
|
||||||
|
|
||||||
|
# Useful for debugging any issues with conda
|
||||||
# Replace dep1 dep2 ... with your dependencies
|
- conda create -q -n testenv conda-build anaconda-client conda-verify
|
||||||
- conda create -q -n test-environment python=$CONDA_PY
|
- conda activate testenv
|
||||||
- source activate test-environment
|
|
||||||
- conda-build .
|
- conda-build .
|
||||||
|
|
||||||
script:
|
script:
|
||||||
@ -45,7 +37,7 @@ script:
|
|||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
provider: script
|
provider: script
|
||||||
script: find $HOME/miniconda/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
|
script: find $HOME/miniconda/envs/testenv/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
|
||||||
on:
|
on:
|
||||||
branch: developer
|
branch: udp
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.11)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
project(slsDetectorPackage)
|
project(slsDetectorPackage)
|
||||||
set(PROJECT_VERSION 5.0.0)
|
set(PROJECT_VERSION 5.0.0)
|
||||||
include(CheckIPOSupported)
|
include(CheckIPOSupported)
|
||||||
@ -126,7 +126,7 @@ install(TARGETS slsProjectOptions slsProjectWarnings rapidjson
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
set(CMAKE_INSTALL_RPATH "$ORIGIN")
|
set(CMAKE_INSTALL_RPATH $ORIGIN)
|
||||||
# set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
# set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||||
|
|
||||||
@ -174,6 +174,7 @@ if (SLS_USE_INTEGRATION_TESTS)
|
|||||||
endif (SLS_USE_INTEGRATION_TESTS)
|
endif (SLS_USE_INTEGRATION_TESTS)
|
||||||
|
|
||||||
if (SLS_USE_PYTHON)
|
if (SLS_USE_PYTHON)
|
||||||
|
set(PYBIND11_CPP_STANDARD -std=c++11)
|
||||||
add_subdirectory(libs/pybind11)
|
add_subdirectory(libs/pybind11)
|
||||||
add_subdirectory(python)
|
add_subdirectory(python)
|
||||||
endif(SLS_USE_PYTHON)
|
endif(SLS_USE_PYTHON)
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
Draft
|
||||||
|
- dr 4, 8, 16 in eiger -> speed 0, 32 stays same (speed 1)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
mkdir build
|
mkdir build
|
||||||
mkdir install
|
mkdir install
|
||||||
cd build
|
cd build
|
||||||
@ -6,7 +7,7 @@ cmake .. \
|
|||||||
-DCMAKE_INSTALL_PREFIX=install \
|
-DCMAKE_INSTALL_PREFIX=install \
|
||||||
-DSLS_USE_TEXTCLIENT=ON \
|
-DSLS_USE_TEXTCLIENT=ON \
|
||||||
-DSLS_USE_RECEIVER=ON \
|
-DSLS_USE_RECEIVER=ON \
|
||||||
-DSLS_USE_GUI=OFF \
|
-DSLS_USE_GUI=ON \
|
||||||
-DSLS_USE_TESTS=ON \
|
-DSLS_USE_TESTS=ON \
|
||||||
-DSLS_USE_PYTHON=OFF \
|
-DSLS_USE_PYTHON=OFF \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
@ -1,14 +1,4 @@
|
|||||||
|
|
||||||
# mkdir $PREFIX/lib
|
echo "|<-------- starting python build"
|
||||||
# mkdir $PREFIX/include
|
|
||||||
|
|
||||||
|
|
||||||
# #Shared and static libraries
|
|
||||||
# cp build/bin/_sls_detector* $PREFIX/lib/.
|
|
||||||
|
|
||||||
|
|
||||||
# #Binaries
|
|
||||||
# cp -r build/bin/sls_detector $PREFIX/lib/.
|
|
||||||
|
|
||||||
cd python
|
cd python
|
||||||
${PYTHON} setup.py install
|
${PYTHON} setup.py install
|
7
conda-recepie/conda_build_config.yaml
Normal file
7
conda-recepie/conda_build_config.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
python:
|
||||||
|
- 3.6
|
||||||
|
- 3.7
|
||||||
|
- 3.8
|
||||||
|
|
||||||
|
numpy:
|
||||||
|
- 1.17
|
9
conda-recepie/copy_ctbgui.sh
Normal file
9
conda-recepie/copy_ctbgui.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
mkdir $PREFIX/lib
|
||||||
|
mkdir $PREFIX/bin
|
||||||
|
mkdir $PREFIX/include
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cp build/bin/ctbGui $PREFIX/bin/.
|
||||||
|
cp build/bin/libctbRootLib.so $PREFIX/lib/.
|
||||||
|
|
@ -1,15 +1,3 @@
|
|||||||
|
#Copy the GUI
|
||||||
mkdir $PREFIX/lib
|
|
||||||
mkdir $PREFIX/bin
|
mkdir $PREFIX/bin
|
||||||
mkdir $PREFIX/include
|
|
||||||
|
|
||||||
#No libs for gui?
|
|
||||||
|
|
||||||
#Binaries
|
|
||||||
cp build/bin/gui_client $PREFIX/bin/.
|
|
||||||
cp build/bin/slsDetectorGui $PREFIX/bin/.
|
cp build/bin/slsDetectorGui $PREFIX/bin/.
|
||||||
|
|
||||||
|
|
||||||
#Which headers do we need for development??
|
|
||||||
|
|
||||||
# cp include/some_lib.h $PREFIX/include/.
|
|
@ -1,13 +1,14 @@
|
|||||||
|
|
||||||
package:
|
package:
|
||||||
name: sls_detector_software
|
name: sls_detector_software
|
||||||
version: "developer"
|
version: "udp"
|
||||||
|
|
||||||
source:
|
source:
|
||||||
- path: ..
|
- path: ..
|
||||||
|
|
||||||
build:
|
build:
|
||||||
number: 1
|
number: 1
|
||||||
|
binary_relocation: True
|
||||||
rpaths:
|
rpaths:
|
||||||
- lib/
|
- lib/
|
||||||
|
|
||||||
@ -16,10 +17,9 @@ requirements:
|
|||||||
- {{ compiler('c') }}
|
- {{ compiler('c') }}
|
||||||
- {{compiler('cxx')}}
|
- {{compiler('cxx')}}
|
||||||
- cmake
|
- cmake
|
||||||
# - qwt 6.* #require qt5 investigate befor activating gui
|
- qwt 6.*
|
||||||
# - qt=4.8.7=7
|
- qt 4.8.*
|
||||||
- zeromq=4.2.5=hfc679d8_5
|
- zeromq
|
||||||
- pyzmq
|
|
||||||
- xorg-libx11
|
- xorg-libx11
|
||||||
- xorg-libice
|
- xorg-libice
|
||||||
- xorg-libxext
|
- xorg-libxext
|
||||||
@ -51,70 +51,46 @@ requirements:
|
|||||||
|
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
- name: sls_detector_lib
|
- name: slsdetlib
|
||||||
script: copy_lib.sh
|
script: copy_lib.sh
|
||||||
|
|
||||||
- name: sls_detector
|
requirements:
|
||||||
|
run:
|
||||||
|
- libstdcxx-ng
|
||||||
|
- libgcc-ng
|
||||||
|
- zeromq
|
||||||
|
|
||||||
|
- name: slsdet
|
||||||
|
|
||||||
script: build_pylib.sh
|
script: build_pylib.sh
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
build:
|
build:
|
||||||
|
- python
|
||||||
- {{ compiler('c') }}
|
- {{ compiler('c') }}
|
||||||
- {{compiler('cxx')}}
|
- {{compiler('cxx')}}
|
||||||
- python {{ python }}
|
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||||
- setuptools
|
- setuptools
|
||||||
- sls_detector_lib
|
|
||||||
- pyzmq
|
|
||||||
- pybind11 2.4
|
|
||||||
host:
|
host:
|
||||||
- python
|
- python
|
||||||
- pybind11 2.4
|
|
||||||
- pyzmq
|
run:
|
||||||
- sls_detector_lib
|
|
||||||
- libstdcxx-ng
|
- libstdcxx-ng
|
||||||
- libgcc-ng
|
- libgcc-ng
|
||||||
run:
|
|
||||||
- python
|
- python
|
||||||
- numpy
|
- numpy
|
||||||
- sls_detector_lib=developer
|
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||||
- pyzmq
|
|
||||||
- libstdcxx-ng
|
|
||||||
- libgcc-ng
|
|
||||||
test:
|
test:
|
||||||
imports:
|
imports:
|
||||||
- sls_detector
|
- slsdet
|
||||||
|
|
||||||
# requirements:
|
- name: slsdetgui
|
||||||
# build:
|
script: copy_gui.sh
|
||||||
# - {{ compiler('c') }}
|
requirements:
|
||||||
# - {{compiler('cxx')}}
|
run:
|
||||||
|
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||||
# - name: sls_detector_gui
|
- qwt 6.*
|
||||||
# version: "refactor"
|
- qt 4.8.*
|
||||||
# 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=refactor
|
|
||||||
# - qwt 6.*
|
|
||||||
# - qt=4.8.7=7
|
|
||||||
|
@ -71,6 +71,11 @@ target_link_libraries(ctbRootLib PUBLIC
|
|||||||
${ROOT_EXE_LINKER_FLAGS}
|
${ROOT_EXE_LINKER_FLAGS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set_target_properties(
|
||||||
|
ctbRootLib PROPERTIES
|
||||||
|
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||||
|
)
|
||||||
|
|
||||||
target_link_libraries(ctbGui PUBLIC
|
target_link_libraries(ctbGui PUBLIC
|
||||||
slsDetectorShared
|
slsDetectorShared
|
||||||
slsSupportLib
|
slsSupportLib
|
||||||
@ -80,4 +85,5 @@ target_link_libraries(ctbGui PUBLIC
|
|||||||
|
|
||||||
set_target_properties(ctbGui PROPERTIES
|
set_target_properties(ctbGui PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||||
|
|
||||||
)
|
)
|
@ -12,7 +12,7 @@ file writing etc.
|
|||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from sls_detector import Eiger
|
from slsdet import Eiger
|
||||||
|
|
||||||
d = Eiger()
|
d = Eiger()
|
||||||
threshold = range(0, 2000, 200)
|
threshold = range(0, 2000, 200)
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
#include "multiSlsDetector.h"
|
#include "DetectorImpl.h"
|
||||||
#include "string_utils.h"
|
#include "string_utils.h"
|
||||||
#include "tests/globals.h"
|
#include "tests/globals.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
class MultiDetectorFixture {
|
class MultiDetectorFixture {
|
||||||
protected:
|
protected:
|
||||||
multiSlsDetector d;
|
DetectorImpl d;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MultiDetectorFixture() : d(0, true, true) {
|
MultiDetectorFixture() : d(0, true, true) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "ClientSocket.h"
|
#include "ClientSocket.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "multiSlsDetector.h"
|
#include "DetectorImpl.h"
|
||||||
#include "slsDetector.h"
|
#include "slsDetector.h"
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
|
|
||||||
@ -252,7 +252,7 @@ TEST_CASE(
|
|||||||
int ratecorr = 125;
|
int ratecorr = 125;
|
||||||
|
|
||||||
// pick up multi detector from shm id 0
|
// pick up multi detector from shm id 0
|
||||||
multiSlsDetector m(0);
|
DetectorImpl m(0);
|
||||||
|
|
||||||
// ensure eiger detector type, hostname and online
|
// ensure eiger detector type, hostname and online
|
||||||
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
|
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
|
||||||
@ -302,7 +302,7 @@ TEST_CASE("Chiptestboard Loading Patterns", "[.ctbintegration]") {
|
|||||||
SingleDetectorConfig c;
|
SingleDetectorConfig c;
|
||||||
|
|
||||||
// pick up multi detector from shm id 0
|
// pick up multi detector from shm id 0
|
||||||
multiSlsDetector m(0);
|
DetectorImpl m(0);
|
||||||
|
|
||||||
// ensure ctb detector type, hostname and online
|
// ensure ctb detector type, hostname and online
|
||||||
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
|
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
|
||||||
@ -387,7 +387,7 @@ TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert", "[.ctbintegrat
|
|||||||
SingleDetectorConfig c;
|
SingleDetectorConfig c;
|
||||||
|
|
||||||
// pick up multi detector from shm id 0
|
// pick up multi detector from shm id 0
|
||||||
multiSlsDetector m(0);
|
DetectorImpl m(0);
|
||||||
|
|
||||||
// ensure ctb detector type, hostname and online
|
// ensure ctb detector type, hostname and online
|
||||||
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
|
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
|
||||||
@ -457,7 +457,7 @@ TEST_CASE("Eiger or Jungfrau startingfnum", "[.eigerintegration][.jungfrauintegr
|
|||||||
SingleDetectorConfig c;
|
SingleDetectorConfig c;
|
||||||
|
|
||||||
// pick up multi detector from shm id 0
|
// pick up multi detector from shm id 0
|
||||||
multiSlsDetector m(0);
|
DetectorImpl m(0);
|
||||||
|
|
||||||
// ensure ctb detector type, hostname and online
|
// ensure ctb detector type, hostname and online
|
||||||
REQUIRE(((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER) || (m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::JUNGFRAU)));
|
REQUIRE(((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER) || (m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::JUNGFRAU)));
|
||||||
@ -495,7 +495,7 @@ TEST_CASE("Eiger readnlines", "[.eigerintegration][readnlines]") {
|
|||||||
SingleDetectorConfig c;
|
SingleDetectorConfig c;
|
||||||
|
|
||||||
// pick up multi detector from shm id 0
|
// pick up multi detector from shm id 0
|
||||||
multiSlsDetector m(0);
|
DetectorImpl m(0);
|
||||||
|
|
||||||
// ensure detector type, hostname
|
// ensure detector type, hostname
|
||||||
REQUIRE((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER));
|
REQUIRE((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
#include "multiSlsDetector.h"
|
#include "DetectorImpl.h"
|
||||||
#include "string_utils.h"
|
#include "string_utils.h"
|
||||||
#include "tests/globals.h"
|
#include "tests/globals.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -9,7 +9,7 @@ using namespace Catch::literals;
|
|||||||
TEST_CASE("Initialize a multi detector", "[.integration][.multi]") {
|
TEST_CASE("Initialize a multi detector", "[.integration][.multi]") {
|
||||||
auto hostnames = sls::split(test::hostname, '+');
|
auto hostnames = sls::split(test::hostname, '+');
|
||||||
|
|
||||||
multiSlsDetector d(0, true, true);
|
DetectorImpl d(0, true, true);
|
||||||
d.setHostname(test::hostname.c_str());
|
d.setHostname(test::hostname.c_str());
|
||||||
|
|
||||||
CHECK(d.getHostname() == test::hostname);
|
CHECK(d.getHostname() == test::hostname);
|
||||||
@ -28,7 +28,7 @@ TEST_CASE("Initialize a multi detector", "[.integration][.multi]") {
|
|||||||
|
|
||||||
TEST_CASE("Set and read timers", "[.integration][.multi]") {
|
TEST_CASE("Set and read timers", "[.integration][.multi]") {
|
||||||
|
|
||||||
multiSlsDetector d(0, true, true);
|
DetectorImpl d(0, true, true);
|
||||||
d.setHostname(test::hostname.c_str());
|
d.setHostname(test::hostname.c_str());
|
||||||
|
|
||||||
// FRAME_NUMBER
|
// FRAME_NUMBER
|
||||||
|
Submodule libs/pybind11 updated: 80d452484c...4f72ef846f
@ -1,20 +1,22 @@
|
|||||||
|
|
||||||
pybind11_add_module(_sls_detector
|
# find_package (Python COMPONENTS Interpreter Development)
|
||||||
|
|
||||||
|
pybind11_add_module(_slsdet
|
||||||
src/main.cpp
|
src/main.cpp
|
||||||
src/enums.cpp
|
src/enums.cpp
|
||||||
src/detector.cpp
|
src/detector.cpp
|
||||||
src/network.cpp
|
src/network.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(_sls_detector PUBLIC
|
target_link_libraries(_slsdet PUBLIC
|
||||||
slsDetectorShared
|
slsDetectorShared
|
||||||
slsReceiverShared
|
slsReceiverShared
|
||||||
slsSupportLib
|
slsSupportLib
|
||||||
zmq )
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
set_target_properties(_sls_detector PROPERTIES
|
set_target_properties(_slsdet PROPERTIES
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -32,13 +34,14 @@ set( PYTHON_FILES
|
|||||||
jungfrau.py
|
jungfrau.py
|
||||||
mythen3.py
|
mythen3.py
|
||||||
registers.py
|
registers.py
|
||||||
|
lookup.py
|
||||||
utils.py
|
utils.py
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach(FILE ${PYTHON_FILES})
|
foreach(FILE ${PYTHON_FILES})
|
||||||
configure_file( sls_detector/${FILE}
|
configure_file( slsdet/${FILE}
|
||||||
${CMAKE_BINARY_DIR}/bin/sls_detector/${FILE} )
|
${CMAKE_BINARY_DIR}/bin/slsdet/${FILE} )
|
||||||
|
|
||||||
endforeach(FILE ${PYTHON_FILES})
|
endforeach(FILE ${PYTHON_FILES})
|
||||||
|
|
||||||
|
@ -4,12 +4,12 @@ import numpy as np
|
|||||||
sys.path.append(os.path.join(os.getcwd(), 'bin'))
|
sys.path.append(os.path.join(os.getcwd(), 'bin'))
|
||||||
|
|
||||||
from sls_detector import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb
|
from sls_detector import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb
|
||||||
from sls_detector import dacIndex
|
from sls_detector import dacIndex, readoutMode
|
||||||
|
from sls_detector.lookup import view, find
|
||||||
|
|
||||||
d = Detector()
|
d = Detector()
|
||||||
# e = Eiger()
|
# e = Eiger()
|
||||||
# c = Ctb()
|
c = Ctb()
|
||||||
# j = Jungfrau()
|
# j = Jungfrau()
|
||||||
m = Mythen3()
|
# m = Mythen3()
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ pycmd = dir(Detector)+dir(Eiger)+dir(Ctb)
|
|||||||
|
|
||||||
pycmd += ['vrf', 'vtr', 'vrs', 'vtgstv', 'vsvn', 'vtrim',
|
pycmd += ['vrf', 'vtr', 'vrs', 'vtgstv', 'vsvn', 'vtrim',
|
||||||
'vsvp', 'vth1', 'vth2', 'vth3', 'vshaper', 'vshaperneg', 'rxb_rb',
|
'vsvp', 'vth1', 'vth2', 'vth3', 'vshaper', 'vshaperneg', 'rxb_rb',
|
||||||
'rxb_lb', 'vref_prech', 'vref_restore', 'vref_cds',
|
'rxb_lb', 'vref_prech', 'vref_rstore', 'vref_cds',
|
||||||
'vpreamp', 'vref_comp', 'vref_comp_fe vref_ds', 'vref_h_adc',
|
'vpreamp', 'vref_comp', 'vref_comp_fe vref_ds', 'vref_h_adc',
|
||||||
'vref_l_adc', 'iodelay', 'list', 'vref_ds', 'vis', 'vpl',
|
'vref_l_adc', 'iodelay', 'list', 'vref_ds', 'vis', 'vpl',
|
||||||
'vref_comp_fe', 'vph', 'vout_cm', 'vcp', 'vcn', 'vcmp_ll', 'vcmp_lr'
|
'vref_comp_fe', 'vph', 'vout_cm', 'vcp', 'vcn', 'vcmp_ll', 'vcmp_lr'
|
||||||
|
@ -9,19 +9,7 @@ enums.cpp
|
|||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
from parse import remove_comments
|
||||||
# def remove_comments(text):
|
|
||||||
# def replacer(match):
|
|
||||||
# s = match.group(0)
|
|
||||||
# if s.startswith('/'):
|
|
||||||
# return " " # note: a space and not an empty string
|
|
||||||
# else:
|
|
||||||
# return s
|
|
||||||
# pattern = re.compile(
|
|
||||||
# r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',
|
|
||||||
# re.DOTALL | re.MULTILINE
|
|
||||||
# )
|
|
||||||
# return re.sub(pattern, replacer, text)
|
|
||||||
|
|
||||||
def extract_enums(lines):
|
def extract_enums(lines):
|
||||||
line_iter = iter(lines)
|
line_iter = iter(lines)
|
||||||
|
@ -8,7 +8,7 @@ import sys
|
|||||||
import setuptools
|
import setuptools
|
||||||
import os
|
import os
|
||||||
|
|
||||||
__version__ = 'refactor'
|
__version__ = 'udp'
|
||||||
|
|
||||||
|
|
||||||
def get_conda_path():
|
def get_conda_path():
|
||||||
@ -19,31 +19,32 @@ def get_conda_path():
|
|||||||
return os.environ['CONDA_PREFIX']
|
return os.environ['CONDA_PREFIX']
|
||||||
|
|
||||||
|
|
||||||
class get_pybind_include(object):
|
# class get_pybind_include(object):
|
||||||
"""Helper class to determine the pybind11 include path
|
# """Helper class to determine the pybind11 include path
|
||||||
The purpose of this class is to postpone importing pybind11
|
# The purpose of this class is to postpone importing pybind11
|
||||||
until it is actually installed, so that the ``get_include()``
|
# until it is actually installed, so that the ``get_include()``
|
||||||
method can be invoked. """
|
# method can be invoked. """
|
||||||
|
|
||||||
def __init__(self, user=False):
|
# def __init__(self, user=False):
|
||||||
self.user = user
|
# self.user = user
|
||||||
|
|
||||||
def __str__(self):
|
# def __str__(self):
|
||||||
import pybind11
|
# import pybind11
|
||||||
return pybind11.get_include(self.user)
|
# return pybind11.get_include(self.user)
|
||||||
|
|
||||||
|
|
||||||
ext_modules = [
|
ext_modules = [
|
||||||
Extension(
|
Extension(
|
||||||
'_sls_detector',
|
'_slsdet',
|
||||||
['src/main.cpp',
|
['src/main.cpp',
|
||||||
'src/enums.cpp',
|
'src/enums.cpp',
|
||||||
'src/detector.cpp',
|
'src/detector.cpp',
|
||||||
'src/network.cpp'],
|
'src/network.cpp'],
|
||||||
include_dirs=[
|
include_dirs=[
|
||||||
# Path to pybind11 headers
|
# Path to pybind11 headers
|
||||||
get_pybind_include(),
|
# get_pybind_include(),
|
||||||
get_pybind_include(user=True),
|
# get_pybind_include(user=True),
|
||||||
|
os.path.join('../libs/pybind11/include'),
|
||||||
os.path.join(get_conda_path(), 'include/slsDetectorPackage'),
|
os.path.join(get_conda_path(), 'include/slsDetectorPackage'),
|
||||||
|
|
||||||
],
|
],
|
||||||
@ -109,20 +110,28 @@ class BuildExt(build_ext):
|
|||||||
opts.append('/DVERSION_INFO=\\"%s\\"' % self.distribution.get_version())
|
opts.append('/DVERSION_INFO=\\"%s\\"' % self.distribution.get_version())
|
||||||
for ext in self.extensions:
|
for ext in self.extensions:
|
||||||
ext.extra_compile_args = opts
|
ext.extra_compile_args = opts
|
||||||
|
|
||||||
|
print('**************************************************')
|
||||||
|
print(ct)
|
||||||
|
print(opts)
|
||||||
|
print('**************************************************')
|
||||||
build_ext.build_extensions(self)
|
build_ext.build_extensions(self)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def get_shared_lib():
|
||||||
|
return [f for f in os.listdir('.') if '_slsdet' in f]
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='sls_detector',
|
name='slsdet',
|
||||||
version=__version__,
|
version=__version__,
|
||||||
author='Erik Frojdh',
|
author='Erik Frojdh',
|
||||||
author_email='erik.frojdh@psi.ch',
|
author_email='erik.frojdh@psi.ch',
|
||||||
url='https://github.com/slsdetectorgroup/sls_detector',
|
url='https://github.com/slsdetectorgroup/slsDetectorPackage',
|
||||||
description='Detector API for SLS Detector Group detectors',
|
description='Detector API for SLS Detector Group detectors',
|
||||||
long_description='',
|
long_description='',
|
||||||
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
|
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
|
||||||
ext_modules=ext_modules,
|
ext_modules=ext_modules,
|
||||||
install_requires=['pybind11>=2.2'],
|
|
||||||
cmdclass={'build_ext': BuildExt},
|
cmdclass={'build_ext': BuildExt},
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
)
|
)
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
# from .detector import Detector, DetectorError, free_shared_memory
|
|
||||||
from .eiger import Eiger
|
|
||||||
from .ctb import Ctb
|
|
||||||
from .dacs import DetectorDacs, Dac
|
|
||||||
from .detector import Detector
|
|
||||||
from .jungfrau import Jungfrau
|
|
||||||
from .mythen3 import Mythen3
|
|
||||||
# from .jungfrau_ctb import JungfrauCTB
|
|
||||||
# from _sls_detector import DetectorApi
|
|
||||||
|
|
||||||
import _sls_detector
|
|
||||||
|
|
||||||
defs = _sls_detector.slsDetectorDefs
|
|
||||||
runStatus = _sls_detector.slsDetectorDefs.runStatus
|
|
||||||
speedLevel = _sls_detector.slsDetectorDefs.speedLevel
|
|
||||||
timingMode = _sls_detector.slsDetectorDefs.timingMode
|
|
||||||
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
|
|
||||||
detectorType = _sls_detector.slsDetectorDefs.detectorType
|
|
||||||
detectorSettings = _sls_detector.slsDetectorDefs.detectorSettings
|
|
||||||
|
|
||||||
IpAddr = _sls_detector.IpAddr
|
|
||||||
MacAddr = _sls_detector.MacAddr
|
|
@ -1,121 +0,0 @@
|
|||||||
from .detector import Detector
|
|
||||||
from .utils import element_if_equal
|
|
||||||
from .dacs import DetectorDacs
|
|
||||||
import _sls_detector
|
|
||||||
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
|
|
||||||
from .detector_property import DetectorProperty
|
|
||||||
|
|
||||||
class CtbDacs(DetectorDacs):
|
|
||||||
"""
|
|
||||||
Ctb dacs
|
|
||||||
"""
|
|
||||||
_dacs = [('dac0', dacIndex(0), 0, 4000, 1400),
|
|
||||||
('dac1', dacIndex(1), 0, 4000, 1200),
|
|
||||||
('dac2', dacIndex(2), 0, 4000, 900),
|
|
||||||
('dac3', dacIndex(3), 0, 4000, 1050),
|
|
||||||
('dac4', dacIndex(4), 0, 4000, 1400),
|
|
||||||
('dac5', dacIndex(5), 0, 4000, 655),
|
|
||||||
('dac6', dacIndex(6), 0, 4000, 2000),
|
|
||||||
('dac7', dacIndex(7), 0, 4000, 1400),
|
|
||||||
('dac8', dacIndex(8), 0, 4000, 850),
|
|
||||||
('dac9', dacIndex(9), 0, 4000, 2000),
|
|
||||||
('dac10', dacIndex(10), 0, 4000, 2294),
|
|
||||||
('dac11', dacIndex(11), 0, 4000, 983),
|
|
||||||
('dac12', dacIndex(12), 0, 4000, 1475),
|
|
||||||
('dac13', dacIndex(13), 0, 4000, 1200),
|
|
||||||
('dac14', dacIndex(14), 0, 4000, 1600),
|
|
||||||
('dac15', dacIndex(15), 0, 4000, 1455),
|
|
||||||
('dac16', dacIndex(16), 0, 4000, 0),
|
|
||||||
('dac17', dacIndex(17), 0, 4000, 1000),
|
|
||||||
]
|
|
||||||
_dacnames = [_d[0] for _d in _dacs]
|
|
||||||
|
|
||||||
from .utils import element
|
|
||||||
class Ctb(Detector):
|
|
||||||
def __init__(self, id = 0):
|
|
||||||
super().__init__(id)
|
|
||||||
self._frozen = False
|
|
||||||
self._dacs = CtbDacs(self)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def dacs(self):
|
|
||||||
return self._dacs
|
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def v_a(self):
|
|
||||||
return self.getDAC(dacIndex.V_POWER_A, True)
|
|
||||||
|
|
||||||
@v_a.setter
|
|
||||||
def v_a(self, value):
|
|
||||||
self.setDAC(dacIndex.V_POWER_A, value, True)
|
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def v_b(self):
|
|
||||||
return self.getDAC(dacIndex.V_POWER_B, True)
|
|
||||||
|
|
||||||
@v_b.setter
|
|
||||||
def v_b(self, value):
|
|
||||||
self.setDAC(dacIndex.V_POWER_B, value, True)
|
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def v_c(self):
|
|
||||||
return self.getDAC(dacIndex.V_POWER_C, True)
|
|
||||||
|
|
||||||
@v_c.setter
|
|
||||||
def v_c(self, value):
|
|
||||||
self.setDAC(dacIndex.V_POWER_C, value, True)
|
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def v_d(self):
|
|
||||||
return self.getDAC(dacIndex.V_POWER_D, True)
|
|
||||||
|
|
||||||
@v_d.setter
|
|
||||||
def v_d(self, value):
|
|
||||||
self.setDAC(dacIndex.V_POWER_D, value, True)
|
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def v_io(self):
|
|
||||||
return self.getDAC(dacIndex.V_POWER_IO, True)
|
|
||||||
|
|
||||||
@v_io.setter
|
|
||||||
def v_io(self, value):
|
|
||||||
self.setDAC(dacIndex.V_POWER_IO, value, True)
|
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def v_limit(self):
|
|
||||||
return self.getDAC(dacIndex.V_LIMIT, True)
|
|
||||||
|
|
||||||
@v_limit.setter
|
|
||||||
def v_limit(self, value):
|
|
||||||
self.setDAC(dacIndex.V_LIMIT, value, True)
|
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def im_a(self):
|
|
||||||
return self.getMeasuredCurrent(dacIndex.I_POWER_A)
|
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def im_b(self):
|
|
||||||
return self.getMeasuredCurrent(dacIndex.I_POWER_B)
|
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def im_c(self):
|
|
||||||
return self.getMeasuredCurrent(dacIndex.I_POWER_C)
|
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def im_d(self):
|
|
||||||
return self.getMeasuredCurrent(dacIndex.I_POWER_D)
|
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def im_io(self):
|
|
||||||
return self.getMeasuredCurrent(dacIndex.I_POWER_IO)
|
|
23
python/slsdet/__init__.py
Executable file
23
python/slsdet/__init__.py
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
# from .detector import Detector, DetectorError, free_shared_memory
|
||||||
|
from .eiger import Eiger
|
||||||
|
from .ctb import Ctb
|
||||||
|
from .dacs import DetectorDacs, Dac
|
||||||
|
from .detector import Detector
|
||||||
|
from .jungfrau import Jungfrau
|
||||||
|
from .mythen3 import Mythen3
|
||||||
|
# from .jungfrau_ctb import JungfrauCTB
|
||||||
|
# from _slsdet import DetectorApi
|
||||||
|
|
||||||
|
import _slsdet
|
||||||
|
|
||||||
|
defs = _slsdet.slsDetectorDefs
|
||||||
|
runStatus = _slsdet.slsDetectorDefs.runStatus
|
||||||
|
speedLevel = _slsdet.slsDetectorDefs.speedLevel
|
||||||
|
timingMode = _slsdet.slsDetectorDefs.timingMode
|
||||||
|
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||||
|
detectorType = _slsdet.slsDetectorDefs.detectorType
|
||||||
|
detectorSettings = _slsdet.slsDetectorDefs.detectorSettings
|
||||||
|
readoutMode = _slsdet.slsDetectorDefs.readoutMode
|
||||||
|
|
||||||
|
IpAddr = _slsdet.IpAddr
|
||||||
|
MacAddr = _slsdet.MacAddr
|
43
python/slsdet/ctb.py
Normal file
43
python/slsdet/ctb.py
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
from .detector import Detector
|
||||||
|
from .utils import element_if_equal
|
||||||
|
from .dacs import DetectorDacs
|
||||||
|
import _slsdet
|
||||||
|
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||||
|
from .detector_property import DetectorProperty
|
||||||
|
|
||||||
|
class CtbDacs(DetectorDacs):
|
||||||
|
"""
|
||||||
|
Ctb dacs
|
||||||
|
"""
|
||||||
|
_dacs = [('dac0', dacIndex(0), 0, 4000, 1400),
|
||||||
|
('dac1', dacIndex(1), 0, 4000, 1200),
|
||||||
|
('dac2', dacIndex(2), 0, 4000, 900),
|
||||||
|
('dac3', dacIndex(3), 0, 4000, 1050),
|
||||||
|
('dac4', dacIndex(4), 0, 4000, 1400),
|
||||||
|
('dac5', dacIndex(5), 0, 4000, 655),
|
||||||
|
('dac6', dacIndex(6), 0, 4000, 2000),
|
||||||
|
('dac7', dacIndex(7), 0, 4000, 1400),
|
||||||
|
('dac8', dacIndex(8), 0, 4000, 850),
|
||||||
|
('dac9', dacIndex(9), 0, 4000, 2000),
|
||||||
|
('dac10', dacIndex(10), 0, 4000, 2294),
|
||||||
|
('dac11', dacIndex(11), 0, 4000, 983),
|
||||||
|
('dac12', dacIndex(12), 0, 4000, 1475),
|
||||||
|
('dac13', dacIndex(13), 0, 4000, 1200),
|
||||||
|
('dac14', dacIndex(14), 0, 4000, 1600),
|
||||||
|
('dac15', dacIndex(15), 0, 4000, 1455),
|
||||||
|
('dac16', dacIndex(16), 0, 4000, 0),
|
||||||
|
('dac17', dacIndex(17), 0, 4000, 1000),
|
||||||
|
]
|
||||||
|
_dacnames = [_d[0] for _d in _dacs]
|
||||||
|
|
||||||
|
from .utils import element
|
||||||
|
class Ctb(Detector):
|
||||||
|
def __init__(self, id = 0):
|
||||||
|
super().__init__(id)
|
||||||
|
self._frozen = False
|
||||||
|
self._dacs = CtbDacs(self)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def dacs(self):
|
||||||
|
return self._dacs
|
||||||
|
|
@ -1,9 +1,9 @@
|
|||||||
from .detector_property import DetectorProperty
|
from .detector_property import DetectorProperty
|
||||||
from functools import partial
|
from functools import partial
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import _sls_detector
|
import _slsdet
|
||||||
from .detector import freeze
|
from .detector import freeze
|
||||||
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
|
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||||
class Dac(DetectorProperty):
|
class Dac(DetectorProperty):
|
||||||
"""
|
"""
|
||||||
This class represents a dac on the detector. One instance handles all
|
This class represents a dac on the detector. One instance handles all
|
@ -1,33 +1,18 @@
|
|||||||
from _sls_detector import CppDetectorApi
|
from _slsdet import CppDetectorApi
|
||||||
from _sls_detector import slsDetectorDefs
|
from _slsdet import slsDetectorDefs
|
||||||
|
|
||||||
runStatus = slsDetectorDefs.runStatus
|
runStatus = slsDetectorDefs.runStatus
|
||||||
speedLevel = slsDetectorDefs.speedLevel
|
speedLevel = slsDetectorDefs.speedLevel
|
||||||
dacIndex = slsDetectorDefs.dacIndex
|
dacIndex = slsDetectorDefs.dacIndex
|
||||||
|
|
||||||
from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask
|
from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask
|
||||||
from .utils import Geometry, to_geo
|
from .utils import Geometry, to_geo, element
|
||||||
from .registers import Register, Adc_register
|
from .registers import Register, Adc_register
|
||||||
import datetime as dt
|
import datetime as dt
|
||||||
|
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
# class Register:
|
|
||||||
# """
|
|
||||||
# Helper class to read and write to registers using a
|
|
||||||
# more Pythonic syntax
|
|
||||||
# """
|
|
||||||
# def __init__(self, detector):
|
|
||||||
# self._detector = detector
|
|
||||||
|
|
||||||
# def __getitem__(self, key):
|
|
||||||
# return self._detector.readRegister(key)
|
|
||||||
|
|
||||||
# def __setitem__(self, key, value):
|
|
||||||
# self._detector.writeRegister(key, value)
|
|
||||||
|
|
||||||
|
|
||||||
def freeze(cls):
|
def freeze(cls):
|
||||||
cls._frozen = False
|
cls._frozen = False
|
||||||
|
|
||||||
@ -774,6 +759,22 @@ class Detector(CppDetectorApi):
|
|||||||
CTB stuff
|
CTB stuff
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@property
|
||||||
|
def runclk(self):
|
||||||
|
return element_if_equal(self.getRUNClock())
|
||||||
|
|
||||||
|
@runclk.setter
|
||||||
|
def runclk(self, freq):
|
||||||
|
self.setRUNClock(freq)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def romode(self):
|
||||||
|
return element_if_equal(self.getReadoutMode())
|
||||||
|
|
||||||
|
@romode.setter
|
||||||
|
def romode(self, mode):
|
||||||
|
self.setReadoutMode(mode)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def asamples(self):
|
def asamples(self):
|
||||||
return element_if_equal(self.getNumberOfAnalogSamples())
|
return element_if_equal(self.getNumberOfAnalogSamples())
|
||||||
@ -839,9 +840,249 @@ class Detector(CppDetectorApi):
|
|||||||
return element_if_equal(self.getMaxADCPhaseShift())
|
return element_if_equal(self.getMaxADCPhaseShift())
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def maxclkphaseshift(self):
|
def adcphase(self):
|
||||||
return element_if_equal(self.getMaxClockPhaseShift())
|
return element_if_equal(self.getADCPhase())
|
||||||
|
|
||||||
|
@adcphase.setter
|
||||||
|
def adcphase(self, value):
|
||||||
|
self.setADCPhase(value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def adcphase(self):
|
def adcpipeline(self):
|
||||||
return element_if_equal()
|
return element_if_equal(self.getADCPipeline())
|
||||||
|
|
||||||
|
@adcpipeline.setter
|
||||||
|
def adcpipeline(self, value):
|
||||||
|
self.setADCPipeline(value)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def adcclk(self):
|
||||||
|
return element_if_equal(self.getADCClock())
|
||||||
|
|
||||||
|
@adcclk.setter
|
||||||
|
def adcclk(self, value):
|
||||||
|
self.setADCClock(value)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def syncclk(self):
|
||||||
|
return element_if_equal(self.getSYNCClock())
|
||||||
|
|
||||||
|
@property
|
||||||
|
def pattern(self):
|
||||||
|
#TODO! Clean fix
|
||||||
|
print("Set only")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
@property
|
||||||
|
def patclkctrl(self):
|
||||||
|
return element_if_equal(self.getPatternClockControl())
|
||||||
|
|
||||||
|
@patclkctrl.setter
|
||||||
|
def patclkctrl(self, mask):
|
||||||
|
self.setPatternClockControl(mask)
|
||||||
|
|
||||||
|
# patioctrl
|
||||||
|
@property
|
||||||
|
def patioctrl(self):
|
||||||
|
return element_if_equal(self.getPatternIOControl())
|
||||||
|
|
||||||
|
@patioctrl.setter
|
||||||
|
def patioctrl(self, mask):
|
||||||
|
self.setPatternIOControl(mask)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def patlimits(self):
|
||||||
|
return element_if_equal(self.getPatternLoopAddresses(-1))
|
||||||
|
|
||||||
|
@patlimits.setter
|
||||||
|
def patlimits(self, lim):
|
||||||
|
self.setPatternLoopAddresses(-1, lim[0], lim[1])
|
||||||
|
|
||||||
|
@property
|
||||||
|
def patmask(self):
|
||||||
|
return element_if_equal(self.getPatternMask())
|
||||||
|
|
||||||
|
@patmask.setter
|
||||||
|
def patmask(self, mask):
|
||||||
|
self.setPatternMask(mask)
|
||||||
|
|
||||||
|
@pattern.setter
|
||||||
|
def pattern(self, fname):
|
||||||
|
self.setPattern(fname)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def patwait0(self):
|
||||||
|
return element_if_equal(self.getPatternWaitAddr(0))
|
||||||
|
|
||||||
|
@patwait0.setter
|
||||||
|
def patwait0(self, addr):
|
||||||
|
self.setPatternWaitAddr(0, addr)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def patwait1(self):
|
||||||
|
return element_if_equal(self.getPatternWaitAddr(1))
|
||||||
|
|
||||||
|
@patwait1.setter
|
||||||
|
def patwait1(self, addr):
|
||||||
|
self.setPatternWaitAddr(1, addr)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def patwait2(self):
|
||||||
|
return element_if_equal(self.getPatternWaitAddr(2))
|
||||||
|
|
||||||
|
@patwait2.setter
|
||||||
|
def patwait2(self, addr):
|
||||||
|
self.setPatternWaitAddr(2, addr)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def patwaittime0(self):
|
||||||
|
return element_if_equal(self.getPatternWaitTime(0))
|
||||||
|
|
||||||
|
@patwaittime0.setter
|
||||||
|
def patwaittime0(self, nclk):
|
||||||
|
self.setPatternWaitTime(0, nclk)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def patwaittime1(self):
|
||||||
|
return element_if_equal(self.getPatternWaitTime(1))
|
||||||
|
|
||||||
|
@patwaittime1.setter
|
||||||
|
def patwaittime1(self, nclk):
|
||||||
|
self.setPatternWaitTime(1, nclk)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def patwaittime2(self):
|
||||||
|
return element_if_equal(self.getPatternWaitTime(2))
|
||||||
|
|
||||||
|
@patwaittime2.setter
|
||||||
|
def patwaittime2(self, nclk):
|
||||||
|
self.setPatternWaitTime(2, nclk)
|
||||||
|
|
||||||
|
|
||||||
|
@property
|
||||||
|
def patloop0(self):
|
||||||
|
return element_if_equal(self.getPatternLoopAddresses(0))
|
||||||
|
|
||||||
|
@patloop0.setter
|
||||||
|
def patloop0(self, addr):
|
||||||
|
self.setPatternLoopAddresses(0, addr[0], addr[1])
|
||||||
|
|
||||||
|
@property
|
||||||
|
def patloop1(self):
|
||||||
|
return element_if_equal(self.getPatternLoopAddresses(1))
|
||||||
|
|
||||||
|
@patloop1.setter
|
||||||
|
def patloop1(self, addr):
|
||||||
|
self.setPatternLoopAddresses(1, addr[0], addr[1])
|
||||||
|
|
||||||
|
@property
|
||||||
|
def patloop2(self):
|
||||||
|
return element_if_equal(self.getPatternLoopAddresses(2))
|
||||||
|
|
||||||
|
@patloop2.setter
|
||||||
|
def patloop2(self, addr):
|
||||||
|
self.setPatternLoopAddresses(2, addr[0], addr[1])
|
||||||
|
|
||||||
|
@property
|
||||||
|
def patnloop0(self):
|
||||||
|
return element_if_equal(self.getPatternLoopCycles(0))
|
||||||
|
|
||||||
|
@patnloop0.setter
|
||||||
|
def patnloop0(self, n):
|
||||||
|
self.setPatternLoopCycles(0, n)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def patnloop1(self):
|
||||||
|
return element_if_equal(self.getPatternLoopCycles(1))
|
||||||
|
|
||||||
|
@patnloop1.setter
|
||||||
|
def patnloop1(self, n):
|
||||||
|
self.setPatternLoopCycles(1, n)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def patnloop2(self):
|
||||||
|
return element_if_equal(self.getPatternLoopCycles(2))
|
||||||
|
|
||||||
|
@patnloop2.setter
|
||||||
|
def patnloop2(self, n):
|
||||||
|
self.setPatternLoopCycles(2, n)
|
||||||
|
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def v_a(self):
|
||||||
|
return self.getDAC(dacIndex.V_POWER_A, True)
|
||||||
|
|
||||||
|
@v_a.setter
|
||||||
|
def v_a(self, value):
|
||||||
|
self.setDAC(dacIndex.V_POWER_A, value, True)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def v_b(self):
|
||||||
|
return self.getDAC(dacIndex.V_POWER_B, True)
|
||||||
|
|
||||||
|
@v_b.setter
|
||||||
|
def v_b(self, value):
|
||||||
|
self.setDAC(dacIndex.V_POWER_B, value, True)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def v_c(self):
|
||||||
|
return self.getDAC(dacIndex.V_POWER_C, True)
|
||||||
|
|
||||||
|
@v_c.setter
|
||||||
|
def v_c(self, value):
|
||||||
|
self.setDAC(dacIndex.V_POWER_C, value, True)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def v_d(self):
|
||||||
|
return self.getDAC(dacIndex.V_POWER_D, True)
|
||||||
|
|
||||||
|
@v_d.setter
|
||||||
|
def v_d(self, value):
|
||||||
|
self.setDAC(dacIndex.V_POWER_D, value, True)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def v_io(self):
|
||||||
|
return self.getDAC(dacIndex.V_POWER_IO, True)
|
||||||
|
|
||||||
|
@v_io.setter
|
||||||
|
def v_io(self, value):
|
||||||
|
self.setDAC(dacIndex.V_POWER_IO, value, True)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def v_limit(self):
|
||||||
|
return self.getDAC(dacIndex.V_LIMIT, True)
|
||||||
|
|
||||||
|
@v_limit.setter
|
||||||
|
def v_limit(self, value):
|
||||||
|
self.setDAC(dacIndex.V_LIMIT, value, True)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def im_a(self):
|
||||||
|
return self.getMeasuredCurrent(dacIndex.I_POWER_A)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def im_b(self):
|
||||||
|
return self.getMeasuredCurrent(dacIndex.I_POWER_B)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def im_c(self):
|
||||||
|
return self.getMeasuredCurrent(dacIndex.I_POWER_C)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def im_d(self):
|
||||||
|
return self.getMeasuredCurrent(dacIndex.I_POWER_D)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def im_io(self):
|
||||||
|
return self.getMeasuredCurrent(dacIndex.I_POWER_IO)
|
@ -11,8 +11,8 @@ from .detector import Detector
|
|||||||
|
|
||||||
# from .adcs import Adc, DetectorAdcs
|
# from .adcs import Adc, DetectorAdcs
|
||||||
from .dacs import DetectorDacs
|
from .dacs import DetectorDacs
|
||||||
import _sls_detector
|
import _slsdet
|
||||||
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
|
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||||
from .detector_property import DetectorProperty
|
from .detector_property import DetectorProperty
|
||||||
# from .utils import element_if_equal
|
# from .utils import element_if_equal
|
||||||
# from sls_detector.errors import DetectorValueError, DetectorError
|
# from sls_detector.errors import DetectorValueError, DetectorError
|
@ -9,8 +9,8 @@ from .detector import Detector, freeze
|
|||||||
|
|
||||||
# from .adcs import Adc, DetectorAdcs
|
# from .adcs import Adc, DetectorAdcs
|
||||||
from .dacs import DetectorDacs
|
from .dacs import DetectorDacs
|
||||||
import _sls_detector
|
import _slsdet
|
||||||
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
|
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||||
from .detector_property import DetectorProperty
|
from .detector_property import DetectorProperty
|
||||||
|
|
||||||
# @freeze
|
# @freeze
|
9
python/slsdet/lookup.py
Normal file
9
python/slsdet/lookup.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
from .detector import Detector
|
||||||
|
|
||||||
|
def view(name):
|
||||||
|
names = find(name)
|
||||||
|
for n in names:
|
||||||
|
print(n)
|
||||||
|
|
||||||
|
def find(name):
|
||||||
|
return [n for n in dir(Detector) if name in n]
|
@ -9,8 +9,8 @@ from .detector import Detector, freeze
|
|||||||
|
|
||||||
# from .adcs import Adc, DetectorAdcs
|
# from .adcs import Adc, DetectorAdcs
|
||||||
from .dacs import DetectorDacs
|
from .dacs import DetectorDacs
|
||||||
import _sls_detector
|
import _slsdet
|
||||||
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
|
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||||
from .detector_property import DetectorProperty
|
from .detector_property import DetectorProperty
|
||||||
|
|
||||||
# vcassh 1200,
|
# vcassh 1200,
|
@ -2,10 +2,13 @@
|
|||||||
Utility functions that are useful for testing and troubleshooting
|
Utility functions that are useful for testing and troubleshooting
|
||||||
but not directly used in controlling the detector
|
but not directly used in controlling the detector
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
import _sls_detector #C++ lib
|
import _slsdet #C++ lib
|
||||||
import functools
|
import functools
|
||||||
|
|
||||||
|
|
||||||
Geometry = namedtuple('Geometry', ['x', 'y'])
|
Geometry = namedtuple('Geometry', ['x', 'y'])
|
||||||
|
|
||||||
def get_set_bits(mask):
|
def get_set_bits(mask):
|
||||||
@ -26,7 +29,7 @@ def list_to_bitmask(values):
|
|||||||
return mask
|
return mask
|
||||||
|
|
||||||
def to_geo(value):
|
def to_geo(value):
|
||||||
if isinstance(value, _sls_detector.xy):
|
if isinstance(value, _slsdet.xy):
|
||||||
return Geometry(x = value.x, y = value.y)
|
return Geometry(x = value.x, y = value.y)
|
||||||
else:
|
else:
|
||||||
raise ValueError("Can only convert sls_detector.xy")
|
raise ValueError("Can only convert sls_detector.xy")
|
||||||
@ -65,3 +68,4 @@ def eiger_register_to_time(register):
|
|||||||
clocks = register >> 3
|
clocks = register >> 3
|
||||||
exponent = register & 0b111
|
exponent = register & 0b111
|
||||||
return clocks*10**exponent / 100e6
|
return clocks*10**exponent / 100e6
|
||||||
|
|
@ -2,7 +2,7 @@ C++ API
|
|||||||
=====================================================
|
=====================================================
|
||||||
|
|
||||||
|
|
||||||
.. py:currentmodule:: _sls_detector
|
.. py:currentmodule:: _slsdet
|
||||||
|
|
||||||
.. autoclass:: DetectorApi
|
.. autoclass:: DetectorApi
|
||||||
:members:
|
:members:
|
||||||
|
@ -2,7 +2,7 @@ sls_detector - Python interface for the slsDetectorsPackage
|
|||||||
==============================================================
|
==============================================================
|
||||||
|
|
||||||
sls_detector provide Python bindings to the slsDetectorsPackage using mainly the
|
sls_detector provide Python bindings to the slsDetectorsPackage using mainly the
|
||||||
multiSlsDetector API. This module contains two parts, a compiled C module to
|
DetectorImpl API. This module contains two parts, a compiled C module to
|
||||||
expose the API and a Python class to offer a more Pythonic interface.
|
expose the API and a Python class to offer a more Pythonic interface.
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,9 +74,12 @@ void init_det(py::module &m) {
|
|||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getNumberOfTriggersLeft", &Detector::getNumberOfTriggersLeft,
|
.def("getNumberOfTriggersLeft", &Detector::getNumberOfTriggersLeft,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
|
.def("getPeriodLeft", &Detector::getPeriodLeft, py::arg() = Positions{})
|
||||||
.def("getDelayAfterTriggerLeft", &Detector::getDelayAfterTriggerLeft,
|
.def("getDelayAfterTriggerLeft", &Detector::getDelayAfterTriggerLeft,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getPeriodLeft", &Detector::getPeriodLeft, py::arg() = Positions{})
|
.def("getTimingMode", &Detector::getTimingMode, py::arg() = Positions{})
|
||||||
|
.def("setTimingMode", &Detector::setTimingMode, py::arg(),
|
||||||
|
py::arg() = Positions{})
|
||||||
.def("getSpeed", &Detector::getSpeed, py::arg() = Positions{})
|
.def("getSpeed", &Detector::getSpeed, py::arg() = Positions{})
|
||||||
.def("setSpeed", &Detector::setSpeed, py::arg(),
|
.def("setSpeed", &Detector::setSpeed, py::arg(),
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
@ -109,6 +112,9 @@ void init_det(py::module &m) {
|
|||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getHighVoltage", &Detector::getHighVoltage,
|
.def("getHighVoltage", &Detector::getHighVoltage,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
|
.def("getPowerChip", &Detector::getPowerChip, py::arg() = Positions{})
|
||||||
|
.def("setPowerChip", &Detector::setPowerChip, py::arg(),
|
||||||
|
py::arg() = Positions{})
|
||||||
.def("setHighVoltage", &Detector::setHighVoltage, py::arg(),
|
.def("setHighVoltage", &Detector::setHighVoltage, py::arg(),
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getTemperature", &Detector::getTemperature, py::arg(),
|
.def("getTemperature", &Detector::getTemperature, py::arg(),
|
||||||
@ -121,9 +127,6 @@ void init_det(py::module &m) {
|
|||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setOnChipDAC", &Detector::setOnChipDAC, py::arg(), py::arg(),
|
.def("setOnChipDAC", &Detector::setOnChipDAC, py::arg(), py::arg(),
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getTimingMode", &Detector::getTimingMode, py::arg() = Positions{})
|
|
||||||
.def("setTimingMode", &Detector::setTimingMode, py::arg(),
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("acquire", &Detector::acquire)
|
.def("acquire", &Detector::acquire)
|
||||||
.def("clearAcquiringFlag", &Detector::clearAcquiringFlag)
|
.def("clearAcquiringFlag", &Detector::clearAcquiringFlag)
|
||||||
.def("startReceiver", &Detector::startReceiver)
|
.def("startReceiver", &Detector::startReceiver)
|
||||||
@ -395,9 +398,6 @@ void init_det(py::module &m) {
|
|||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("resetTemperatureEvent", &Detector::resetTemperatureEvent,
|
.def("resetTemperatureEvent", &Detector::resetTemperatureEvent,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getPowerChip", &Detector::getPowerChip, py::arg() = Positions{})
|
|
||||||
.def("setPowerChip", &Detector::setPowerChip, py::arg(),
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("getAutoCompDisable", &Detector::getAutoCompDisable,
|
.def("getAutoCompDisable", &Detector::getAutoCompDisable,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setAutoCompDisable", &Detector::setAutoCompDisable, py::arg(),
|
.def("setAutoCompDisable", &Detector::setAutoCompDisable, py::arg(),
|
||||||
@ -438,9 +438,9 @@ void init_det(py::module &m) {
|
|||||||
py::arg(), py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
.def("setVetoReference", &Detector::setVetoReference, py::arg(),
|
.def("setVetoReference", &Detector::setVetoReference, py::arg(),
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getBurstMode", &Detector::getBurstMode, py::arg() = Positions{})
|
||||||
.def("setBurstMode", &Detector::setBurstMode, py::arg(),
|
.def("setBurstMode", &Detector::setBurstMode, py::arg(),
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getBurstMode", &Detector::getBurstMode, py::arg() = Positions{})
|
|
||||||
.def("getCounterMask", &Detector::getCounterMask,
|
.def("getCounterMask", &Detector::getCounterMask,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setCounterMask", &Detector::setCounterMask, py::arg(),
|
.def("setCounterMask", &Detector::setCounterMask, py::arg(),
|
||||||
@ -610,6 +610,8 @@ void init_det(py::module &m) {
|
|||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("writeAdcRegister", &Detector::writeAdcRegister, py::arg(),
|
.def("writeAdcRegister", &Detector::writeAdcRegister, py::arg(),
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getInitialChecks", &Detector::getInitialChecks)
|
||||||
|
.def("setInitialChecks", &Detector::setInitialChecks, py::arg())
|
||||||
.def("getControlPort", &Detector::getControlPort,
|
.def("getControlPort", &Detector::getControlPort,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setControlPort", &Detector::setControlPort, py::arg(),
|
.def("setControlPort", &Detector::setControlPort, py::arg(),
|
||||||
|
@ -169,7 +169,7 @@ void init_enums(py::module &m) {
|
|||||||
.value("VB_COMP_FE", slsDetectorDefs::dacIndex::VB_COMP_FE)
|
.value("VB_COMP_FE", slsDetectorDefs::dacIndex::VB_COMP_FE)
|
||||||
.value("VB_COMP_ADC", slsDetectorDefs::dacIndex::VB_COMP_ADC)
|
.value("VB_COMP_ADC", slsDetectorDefs::dacIndex::VB_COMP_ADC)
|
||||||
.value("VCOM_CDS", slsDetectorDefs::dacIndex::VCOM_CDS)
|
.value("VCOM_CDS", slsDetectorDefs::dacIndex::VCOM_CDS)
|
||||||
.value("VREF_RESTORE", slsDetectorDefs::dacIndex::VREF_RESTORE)
|
.value("VREF_RSTORE", slsDetectorDefs::dacIndex::VREF_RSTORE)
|
||||||
.value("VB_OPA_1ST", slsDetectorDefs::dacIndex::VB_OPA_1ST)
|
.value("VB_OPA_1ST", slsDetectorDefs::dacIndex::VB_OPA_1ST)
|
||||||
.value("VREF_COMP_FE", slsDetectorDefs::dacIndex::VREF_COMP_FE)
|
.value("VREF_COMP_FE", slsDetectorDefs::dacIndex::VREF_COMP_FE)
|
||||||
.value("VCOM_ADC1", slsDetectorDefs::dacIndex::VCOM_ADC1)
|
.value("VCOM_ADC1", slsDetectorDefs::dacIndex::VCOM_ADC1)
|
||||||
@ -278,4 +278,10 @@ void init_enums(py::module &m) {
|
|||||||
slsDetectorDefs::detectorModeType::INTERPOLATING)
|
slsDetectorDefs::detectorModeType::INTERPOLATING)
|
||||||
.value("ANALOG", slsDetectorDefs::detectorModeType::ANALOG)
|
.value("ANALOG", slsDetectorDefs::detectorModeType::ANALOG)
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
|
py::enum_<slsDetectorDefs::burstMode>(Defs, "burstMode")
|
||||||
|
.value("BURST_OFF", slsDetectorDefs::burstMode::BURST_OFF)
|
||||||
|
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
|
||||||
|
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
|
||||||
|
.export_values();
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ void init_enums(py::module &);
|
|||||||
void init_experimental(py::module &);
|
void init_experimental(py::module &);
|
||||||
void init_det(py::module &);
|
void init_det(py::module &);
|
||||||
void init_network(py::module &);
|
void init_network(py::module &);
|
||||||
PYBIND11_MODULE(_sls_detector, m) {
|
PYBIND11_MODULE(_slsdet, m) {
|
||||||
m.doc() = R"pbdoc(
|
m.doc() = R"pbdoc(
|
||||||
C/C++ API
|
C/C++ API
|
||||||
-----------------------
|
-----------------------
|
||||||
|
@ -16,12 +16,12 @@ def d():
|
|||||||
|
|
||||||
|
|
||||||
def test_acq_call(d, mocker):
|
def test_acq_call(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.acq')
|
m = mocker.patch('_slsdet.DetectorApi.acq')
|
||||||
d.acq()
|
d.acq()
|
||||||
m.assert_called_once_with()
|
m.assert_called_once_with()
|
||||||
|
|
||||||
def test_busy_call(d, mocker):
|
def test_busy_call(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getAcquiringFlag')
|
m = mocker.patch('_slsdet.DetectorApi.getAcquiringFlag')
|
||||||
m.return_value = False
|
m.return_value = False
|
||||||
assert d.busy == False
|
assert d.busy == False
|
||||||
|
|
||||||
@ -31,103 +31,103 @@ def test_assign_to_detector_type(d):
|
|||||||
d.detector_type = 'Eiger'
|
d.detector_type = 'Eiger'
|
||||||
|
|
||||||
def test_det_type(d, mocker):
|
def test_det_type(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getDetectorType')
|
m = mocker.patch('_slsdet.DetectorApi.getDetectorType')
|
||||||
m.return_value = 'Eiger'
|
m.return_value = 'Eiger'
|
||||||
assert d.detector_type == 'Eiger'
|
assert d.detector_type == 'Eiger'
|
||||||
|
|
||||||
def test_set_dynamic_range_4(d, mocker):
|
def test_set_dynamic_range_4(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setDynamicRange')
|
m = mocker.patch('_slsdet.DetectorApi.setDynamicRange')
|
||||||
d.dynamic_range = 4
|
d.dynamic_range = 4
|
||||||
m.assert_called_with(4)
|
m.assert_called_with(4)
|
||||||
|
|
||||||
def test_set_dynamic_range_8(d, mocker):
|
def test_set_dynamic_range_8(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setDynamicRange')
|
m = mocker.patch('_slsdet.DetectorApi.setDynamicRange')
|
||||||
d.dynamic_range = 8
|
d.dynamic_range = 8
|
||||||
m.assert_called_with(8)
|
m.assert_called_with(8)
|
||||||
|
|
||||||
|
|
||||||
def test_set_dynamic_range_16(d, mocker):
|
def test_set_dynamic_range_16(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setDynamicRange')
|
m = mocker.patch('_slsdet.DetectorApi.setDynamicRange')
|
||||||
d.dynamic_range = 16
|
d.dynamic_range = 16
|
||||||
m.assert_called_with(16)
|
m.assert_called_with(16)
|
||||||
|
|
||||||
def test_set_dynamic_range_32(d, mocker):
|
def test_set_dynamic_range_32(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setDynamicRange')
|
m = mocker.patch('_slsdet.DetectorApi.setDynamicRange')
|
||||||
d.dynamic_range = 32
|
d.dynamic_range = 32
|
||||||
m.assert_called_with(32)
|
m.assert_called_with(32)
|
||||||
|
|
||||||
def test_set_dynamic_range_raises_exception(d, mocker):
|
def test_set_dynamic_range_raises_exception(d, mocker):
|
||||||
mocker.patch('_sls_detector.DetectorApi.setDynamicRange')
|
mocker.patch('_slsdet.DetectorApi.setDynamicRange')
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
d.dynamic_range = 17
|
d.dynamic_range = 17
|
||||||
|
|
||||||
def test_get_dynamic_range_32(d, mocker):
|
def test_get_dynamic_range_32(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getDynamicRange')
|
m = mocker.patch('_slsdet.DetectorApi.getDynamicRange')
|
||||||
m.return_value = 32
|
m.return_value = 32
|
||||||
dr = d.dynamic_range
|
dr = d.dynamic_range
|
||||||
assert dr == 32
|
assert dr == 32
|
||||||
|
|
||||||
def test_eiger_matrix_reset(d, mocker):
|
def test_eiger_matrix_reset(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getCounterBit')
|
m = mocker.patch('_slsdet.DetectorApi.getCounterBit')
|
||||||
m.return_value = True
|
m.return_value = True
|
||||||
assert d.eiger_matrix_reset == True
|
assert d.eiger_matrix_reset == True
|
||||||
|
|
||||||
def test_set_eiger_matrix_reset(d, mocker):
|
def test_set_eiger_matrix_reset(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setCounterBit')
|
m = mocker.patch('_slsdet.DetectorApi.setCounterBit')
|
||||||
d.eiger_matrix_reset = True
|
d.eiger_matrix_reset = True
|
||||||
m.assert_called_once_with(True)
|
m.assert_called_once_with(True)
|
||||||
|
|
||||||
|
|
||||||
def test_get_exposure_time(d, mocker):
|
def test_get_exposure_time(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getExposureTime')
|
m = mocker.patch('_slsdet.DetectorApi.getExposureTime')
|
||||||
m.return_value = 100000000
|
m.return_value = 100000000
|
||||||
assert d.exposure_time == 0.1
|
assert d.exposure_time == 0.1
|
||||||
|
|
||||||
def test_set_exposure_time(d, mocker):
|
def test_set_exposure_time(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setExposureTime')
|
m = mocker.patch('_slsdet.DetectorApi.setExposureTime')
|
||||||
d.exposure_time = 1.5
|
d.exposure_time = 1.5
|
||||||
m.assert_called_once_with(1500000000)
|
m.assert_called_once_with(1500000000)
|
||||||
|
|
||||||
def test_set_exposure_time_less_than_zero(d, mocker):
|
def test_set_exposure_time_less_than_zero(d, mocker):
|
||||||
mocker.patch('_sls_detector.DetectorApi.setExposureTime')
|
mocker.patch('_slsdet.DetectorApi.setExposureTime')
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
d.exposure_time = -7
|
d.exposure_time = -7
|
||||||
|
|
||||||
|
|
||||||
def test_get_file_index(d, mocker):
|
def test_get_file_index(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getFileIndex')
|
m = mocker.patch('_slsdet.DetectorApi.getFileIndex')
|
||||||
m.return_value = 8
|
m.return_value = 8
|
||||||
assert d.file_index == 8
|
assert d.file_index == 8
|
||||||
|
|
||||||
def test_set_file_index(d, mocker):
|
def test_set_file_index(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setFileIndex')
|
m = mocker.patch('_slsdet.DetectorApi.setFileIndex')
|
||||||
d.file_index = 9
|
d.file_index = 9
|
||||||
m.assert_called_with(9)
|
m.assert_called_with(9)
|
||||||
|
|
||||||
|
|
||||||
def test_set_file_index_raises_on_neg(d, mocker):
|
def test_set_file_index_raises_on_neg(d, mocker):
|
||||||
mocker.patch('_sls_detector.DetectorApi.setFileIndex')
|
mocker.patch('_slsdet.DetectorApi.setFileIndex')
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
d.file_index = -9
|
d.file_index = -9
|
||||||
|
|
||||||
|
|
||||||
def test_get_file_name(d, mocker):
|
def test_get_file_name(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getFileName')
|
m = mocker.patch('_slsdet.DetectorApi.getFileName')
|
||||||
d.file_name
|
d.file_name
|
||||||
m.assert_called_once_with()
|
m.assert_called_once_with()
|
||||||
|
|
||||||
def test_set_file_name(d, mocker):
|
def test_set_file_name(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setFileName')
|
m = mocker.patch('_slsdet.DetectorApi.setFileName')
|
||||||
d.file_name = 'hej'
|
d.file_name = 'hej'
|
||||||
m.assert_called_once_with('hej')
|
m.assert_called_once_with('hej')
|
||||||
|
|
||||||
def test_get_file_path(d, mocker):
|
def test_get_file_path(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getFilePath')
|
m = mocker.patch('_slsdet.DetectorApi.getFilePath')
|
||||||
d.file_path
|
d.file_path
|
||||||
m.assert_called_once_with()
|
m.assert_called_once_with()
|
||||||
|
|
||||||
def test_set_file_path_when_path_exists(d, mocker):
|
def test_set_file_path_when_path_exists(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setFilePath')
|
m = mocker.patch('_slsdet.DetectorApi.setFilePath')
|
||||||
#To avoid raising an exception because path is not there
|
#To avoid raising an exception because path is not there
|
||||||
mock_os = mocker.patch('os.path.exists')
|
mock_os = mocker.patch('os.path.exists')
|
||||||
mock_os.return_value = True
|
mock_os.return_value = True
|
||||||
@ -135,25 +135,25 @@ def test_set_file_path_when_path_exists(d, mocker):
|
|||||||
m.assert_called_once_with('/path/to/something/')
|
m.assert_called_once_with('/path/to/something/')
|
||||||
|
|
||||||
def test_set_file_path_raises_when_not_exists(d, mocker):
|
def test_set_file_path_raises_when_not_exists(d, mocker):
|
||||||
mocker.patch('_sls_detector.DetectorApi.setFilePath')
|
mocker.patch('_slsdet.DetectorApi.setFilePath')
|
||||||
mock_os = mocker.patch('os.path.exists')
|
mock_os = mocker.patch('os.path.exists')
|
||||||
mock_os.return_value = False
|
mock_os.return_value = False
|
||||||
with pytest.raises(FileNotFoundError):
|
with pytest.raises(FileNotFoundError):
|
||||||
d.file_path = '/path/to/something/'
|
d.file_path = '/path/to/something/'
|
||||||
|
|
||||||
def test_get_file_write(d, mocker):
|
def test_get_file_write(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getFileWrite')
|
m = mocker.patch('_slsdet.DetectorApi.getFileWrite')
|
||||||
m.return_value = False
|
m.return_value = False
|
||||||
assert d.file_write == False
|
assert d.file_write == False
|
||||||
|
|
||||||
def test_set_file_write(d, mocker):
|
def test_set_file_write(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setFileWrite')
|
m = mocker.patch('_slsdet.DetectorApi.setFileWrite')
|
||||||
d.file_write = True
|
d.file_write = True
|
||||||
m.assert_called_once_with(True)
|
m.assert_called_once_with(True)
|
||||||
|
|
||||||
|
|
||||||
def test_get_firmware_version(d, mocker):
|
def test_get_firmware_version(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getFirmwareVersion')
|
m = mocker.patch('_slsdet.DetectorApi.getFirmwareVersion')
|
||||||
m.return_value = 20
|
m.return_value = 20
|
||||||
assert d.firmware_version == 20
|
assert d.firmware_version == 20
|
||||||
|
|
||||||
@ -162,38 +162,38 @@ def test_cannot_set_fw_version(d):
|
|||||||
d.firmware_version = 20
|
d.firmware_version = 20
|
||||||
|
|
||||||
def test_get_high_voltage_call_signature(d, mocker):
|
def test_get_high_voltage_call_signature(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getDac')
|
m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||||
d.high_voltage
|
d.high_voltage
|
||||||
m.assert_called_once_with('vhighvoltage', -1)
|
m.assert_called_once_with('vhighvoltage', -1)
|
||||||
|
|
||||||
def test_get_high_voltage(d, mocker):
|
def test_get_high_voltage(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getDac')
|
m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||||
m.return_value = 80
|
m.return_value = 80
|
||||||
assert d.high_voltage == 80
|
assert d.high_voltage == 80
|
||||||
|
|
||||||
#self._api.setDac('vhighvoltage', -1, voltage)
|
#self._api.setDac('vhighvoltage', -1, voltage)
|
||||||
def test_set_high_voltage(d, mocker):
|
def test_set_high_voltage(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setDac')
|
m = mocker.patch('_slsdet.DetectorApi.setDac')
|
||||||
d.high_voltage = 80
|
d.high_voltage = 80
|
||||||
m.assert_called_once_with('vhighvoltage', -1, 80)
|
m.assert_called_once_with('vhighvoltage', -1, 80)
|
||||||
|
|
||||||
def test_decode_hostname_two_names(d, mocker):
|
def test_decode_hostname_two_names(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getHostname')
|
m = mocker.patch('_slsdet.DetectorApi.getHostname')
|
||||||
m.return_value = 'beb059+beb048+'
|
m.return_value = 'beb059+beb048+'
|
||||||
assert d.hostname == ['beb059', 'beb048']
|
assert d.hostname == ['beb059', 'beb048']
|
||||||
|
|
||||||
def test_decode_hostname_four_names(d, mocker):
|
def test_decode_hostname_four_names(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getHostname')
|
m = mocker.patch('_slsdet.DetectorApi.getHostname')
|
||||||
m.return_value = 'beb059+beb048+beb120+beb153+'
|
m.return_value = 'beb059+beb048+beb120+beb153+'
|
||||||
assert d.hostname == ['beb059', 'beb048', 'beb120', 'beb153']
|
assert d.hostname == ['beb059', 'beb048', 'beb120', 'beb153']
|
||||||
|
|
||||||
def test_decode_hostname_blank(d, mocker):
|
def test_decode_hostname_blank(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getHostname')
|
m = mocker.patch('_slsdet.DetectorApi.getHostname')
|
||||||
m.return_value = ''
|
m.return_value = ''
|
||||||
assert d.hostname == []
|
assert d.hostname == []
|
||||||
|
|
||||||
def test_get_image_size_gives_correct_size(d, mocker):
|
def test_get_image_size_gives_correct_size(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getImageSize')
|
m = mocker.patch('_slsdet.DetectorApi.getImageSize')
|
||||||
m.return_value = (512,1024)
|
m.return_value = (512,1024)
|
||||||
im_size = d.image_size
|
im_size = d.image_size
|
||||||
assert im_size.rows == 512
|
assert im_size.rows == 512
|
||||||
@ -202,7 +202,7 @@ def test_get_image_size_gives_correct_size(d, mocker):
|
|||||||
|
|
||||||
|
|
||||||
def test_load_config(d, mocker):
|
def test_load_config(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.readConfigurationFile')
|
m = mocker.patch('_slsdet.DetectorApi.readConfigurationFile')
|
||||||
#To avoid raising an exception because path is not there
|
#To avoid raising an exception because path is not there
|
||||||
mock_os = mocker.patch('os.path.isfile')
|
mock_os = mocker.patch('os.path.isfile')
|
||||||
mock_os.return_value = True
|
mock_os.return_value = True
|
||||||
@ -210,14 +210,14 @@ def test_load_config(d, mocker):
|
|||||||
m.assert_called_once_with('/path/to/my/file.config')
|
m.assert_called_once_with('/path/to/my/file.config')
|
||||||
|
|
||||||
def test_load_config_raises_when_file_is_not_found(d, mocker):
|
def test_load_config_raises_when_file_is_not_found(d, mocker):
|
||||||
mocker.patch('_sls_detector.DetectorApi.readConfigurationFile')
|
mocker.patch('_slsdet.DetectorApi.readConfigurationFile')
|
||||||
mock_os = mocker.patch('os.path.isfile')
|
mock_os = mocker.patch('os.path.isfile')
|
||||||
mock_os.return_value = False
|
mock_os.return_value = False
|
||||||
with pytest.raises(FileNotFoundError):
|
with pytest.raises(FileNotFoundError):
|
||||||
d.load_config('/path/to/my/file.config')
|
d.load_config('/path/to/my/file.config')
|
||||||
|
|
||||||
def test_load_parameters(d, mocker):
|
def test_load_parameters(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.readParametersFile')
|
m = mocker.patch('_slsdet.DetectorApi.readParametersFile')
|
||||||
#To avoid raising an exception because path is not there
|
#To avoid raising an exception because path is not there
|
||||||
mock_os = mocker.patch('os.path.isfile')
|
mock_os = mocker.patch('os.path.isfile')
|
||||||
mock_os.return_value = True
|
mock_os.return_value = True
|
||||||
@ -225,7 +225,7 @@ def test_load_parameters(d, mocker):
|
|||||||
m.assert_called_once_with('/path/to/my/file.par')
|
m.assert_called_once_with('/path/to/my/file.par')
|
||||||
|
|
||||||
def test_load_parameters_raises_when_file_is_not_found(d, mocker):
|
def test_load_parameters_raises_when_file_is_not_found(d, mocker):
|
||||||
mocker.patch('_sls_detector.DetectorApi.readParametersFile')
|
mocker.patch('_slsdet.DetectorApi.readParametersFile')
|
||||||
mock_os = mocker.patch('os.path.isfile')
|
mock_os = mocker.patch('os.path.isfile')
|
||||||
mock_os.return_value = False
|
mock_os.return_value = False
|
||||||
with pytest.raises(FileNotFoundError):
|
with pytest.raises(FileNotFoundError):
|
||||||
@ -233,14 +233,14 @@ def test_load_parameters_raises_when_file_is_not_found(d, mocker):
|
|||||||
|
|
||||||
#getDetectorGeometry
|
#getDetectorGeometry
|
||||||
def test_get_module_geometry_gives_correct_size(d, mocker):
|
def test_get_module_geometry_gives_correct_size(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getDetectorGeometry')
|
m = mocker.patch('_slsdet.DetectorApi.getDetectorGeometry')
|
||||||
m.return_value = (13,7)
|
m.return_value = (13,7)
|
||||||
g = d.module_geometry
|
g = d.module_geometry
|
||||||
assert g.vertical == 7
|
assert g.vertical == 7
|
||||||
assert g.horizontal == 13
|
assert g.horizontal == 13
|
||||||
|
|
||||||
def test_get_module_geometry_access(d, mocker):
|
def test_get_module_geometry_access(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getDetectorGeometry')
|
m = mocker.patch('_slsdet.DetectorApi.getDetectorGeometry')
|
||||||
m.return_value = (12,3)
|
m.return_value = (12,3)
|
||||||
assert d.module_geometry[0] == 12
|
assert d.module_geometry[0] == 12
|
||||||
assert d.module_geometry[1] == 3
|
assert d.module_geometry[1] == 3
|
||||||
@ -248,237 +248,237 @@ def test_get_module_geometry_access(d, mocker):
|
|||||||
assert d.module_geometry.horizontal == 12
|
assert d.module_geometry.horizontal == 12
|
||||||
|
|
||||||
def test_get_n_frames(d, mocker):
|
def test_get_n_frames(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getNumberOfFrames')
|
m = mocker.patch('_slsdet.DetectorApi.getNumberOfFrames')
|
||||||
m.return_value = 3
|
m.return_value = 3
|
||||||
assert d.n_frames == 3
|
assert d.n_frames == 3
|
||||||
|
|
||||||
def test_set_n_frames(d, mocker):
|
def test_set_n_frames(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
|
m = mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
|
||||||
d.n_frames = 9
|
d.n_frames = 9
|
||||||
m.assert_called_once_with(9)
|
m.assert_called_once_with(9)
|
||||||
|
|
||||||
def test_set_n_frames_raises_on_neg(d, mocker):
|
def test_set_n_frames_raises_on_neg(d, mocker):
|
||||||
mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
|
mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
d.n_frames = -1
|
d.n_frames = -1
|
||||||
|
|
||||||
def test_set_n_frames_raises_on_zero(d, mocker):
|
def test_set_n_frames_raises_on_zero(d, mocker):
|
||||||
mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
|
mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
d.n_frames = 0
|
d.n_frames = 0
|
||||||
|
|
||||||
def test_get_n_modules(d, mocker):
|
def test_get_n_modules(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
|
m = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
|
||||||
m.return_value = 12
|
m.return_value = 12
|
||||||
assert d.n_modules == 12
|
assert d.n_modules == 12
|
||||||
|
|
||||||
def test_get_period_time(d, mocker):
|
def test_get_period_time(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getPeriod')
|
m = mocker.patch('_slsdet.DetectorApi.getPeriod')
|
||||||
m.return_value = 130000000
|
m.return_value = 130000000
|
||||||
assert d.period == 0.13
|
assert d.period == 0.13
|
||||||
|
|
||||||
def test_set_period_time(d, mocker):
|
def test_set_period_time(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setPeriod')
|
m = mocker.patch('_slsdet.DetectorApi.setPeriod')
|
||||||
d.period = 1.953
|
d.period = 1.953
|
||||||
m.assert_called_once_with(1953000000)
|
m.assert_called_once_with(1953000000)
|
||||||
|
|
||||||
def test_set_period_time_less_than_zero(d, mocker):
|
def test_set_period_time_less_than_zero(d, mocker):
|
||||||
mocker.patch('_sls_detector.DetectorApi.setPeriod')
|
mocker.patch('_slsdet.DetectorApi.setPeriod')
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
d.period = -7
|
d.period = -7
|
||||||
|
|
||||||
def test_pulse_chip_call(d, mocker):
|
def test_pulse_chip_call(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.pulseChip')
|
m = mocker.patch('_slsdet.DetectorApi.pulseChip')
|
||||||
d.pulse_chip(15)
|
d.pulse_chip(15)
|
||||||
m.assert_called_once_with(15)
|
m.assert_called_once_with(15)
|
||||||
|
|
||||||
def test_pulse_chip_call_minus_one(d, mocker):
|
def test_pulse_chip_call_minus_one(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.pulseChip')
|
m = mocker.patch('_slsdet.DetectorApi.pulseChip')
|
||||||
d.pulse_chip(-1)
|
d.pulse_chip(-1)
|
||||||
m.assert_called_once_with(-1)
|
m.assert_called_once_with(-1)
|
||||||
|
|
||||||
def test_pulse_chip_asserts_on_smaller_than_minus_one(d, mocker):
|
def test_pulse_chip_asserts_on_smaller_than_minus_one(d, mocker):
|
||||||
mocker.patch('_sls_detector.DetectorApi.pulseChip')
|
mocker.patch('_slsdet.DetectorApi.pulseChip')
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
d.pulse_chip(-3)
|
d.pulse_chip(-3)
|
||||||
#--------------------------------------------------------------------subexptime
|
#--------------------------------------------------------------------subexptime
|
||||||
def test_get_sub_exposure_time(d, mocker):
|
def test_get_sub_exposure_time(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getSubExposureTime')
|
m = mocker.patch('_slsdet.DetectorApi.getSubExposureTime')
|
||||||
m.return_value = 2370000
|
m.return_value = 2370000
|
||||||
assert d.sub_exposure_time == 0.00237
|
assert d.sub_exposure_time == 0.00237
|
||||||
|
|
||||||
|
|
||||||
def test_set_sub_exposure_time(d, mocker):
|
def test_set_sub_exposure_time(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setSubExposureTime')
|
m = mocker.patch('_slsdet.DetectorApi.setSubExposureTime')
|
||||||
d.sub_exposure_time = 0.002
|
d.sub_exposure_time = 0.002
|
||||||
m.assert_called_once_with(2000000)
|
m.assert_called_once_with(2000000)
|
||||||
|
|
||||||
def test_set_sub_exposure_time_raises_on_zero(d, mocker):
|
def test_set_sub_exposure_time_raises_on_zero(d, mocker):
|
||||||
mocker.patch('_sls_detector.DetectorApi.setSubExposureTime')
|
mocker.patch('_slsdet.DetectorApi.setSubExposureTime')
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
d.sub_exposure_time = 0
|
d.sub_exposure_time = 0
|
||||||
|
|
||||||
#-------------------------------------------------------------Rate correction
|
#-------------------------------------------------------------Rate correction
|
||||||
def test_get_rate_correction(d, mocker):
|
def test_get_rate_correction(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getRateCorrection')
|
m = mocker.patch('_slsdet.DetectorApi.getRateCorrection')
|
||||||
m.return_value = [132,129]
|
m.return_value = [132,129]
|
||||||
assert d.rate_correction == [132,129]
|
assert d.rate_correction == [132,129]
|
||||||
|
|
||||||
def test_set_rate_correction(d, mocker):
|
def test_set_rate_correction(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setRateCorrection')
|
m = mocker.patch('_slsdet.DetectorApi.setRateCorrection')
|
||||||
mock_n = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
|
mock_n = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
|
||||||
mock_n.return_value = 3
|
mock_n.return_value = 3
|
||||||
d.rate_correction = [123,90,50]
|
d.rate_correction = [123,90,50]
|
||||||
m.assert_called_once_with([123,90,50])
|
m.assert_called_once_with([123,90,50])
|
||||||
|
|
||||||
def test_set_rate_correction_raises_on_wrong_number_of_values(d, mocker):
|
def test_set_rate_correction_raises_on_wrong_number_of_values(d, mocker):
|
||||||
mocker.patch('_sls_detector.DetectorApi.setRateCorrection')
|
mocker.patch('_slsdet.DetectorApi.setRateCorrection')
|
||||||
mock_n = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
|
mock_n = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
|
||||||
mock_n.return_value = 4
|
mock_n.return_value = 4
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
d.rate_correction = [123,90,50]
|
d.rate_correction = [123,90,50]
|
||||||
|
|
||||||
#----------------------------------------------------------------Readout clock
|
#----------------------------------------------------------------Readout clock
|
||||||
def test_get_readout_clock_0(d, mocker):
|
def test_get_readout_clock_0(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||||
m.return_value = 0
|
m.return_value = 0
|
||||||
assert d.readout_clock == 'Full Speed'
|
assert d.readout_clock == 'Full Speed'
|
||||||
|
|
||||||
def test_get_readout_clock_1(d, mocker):
|
def test_get_readout_clock_1(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||||
m.return_value = 1
|
m.return_value = 1
|
||||||
assert d.readout_clock == 'Half Speed'
|
assert d.readout_clock == 'Half Speed'
|
||||||
|
|
||||||
def test_get_readout_clock_2(d, mocker):
|
def test_get_readout_clock_2(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||||
m.return_value = 2
|
m.return_value = 2
|
||||||
assert d.readout_clock == 'Quarter Speed'
|
assert d.readout_clock == 'Quarter Speed'
|
||||||
|
|
||||||
def test_get_readout_clock_3(d, mocker):
|
def test_get_readout_clock_3(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||||
m.return_value = 3
|
m.return_value = 3
|
||||||
assert d.readout_clock == 'Super Slow Speed'
|
assert d.readout_clock == 'Super Slow Speed'
|
||||||
|
|
||||||
def test_set_readout_clock_0(d, mocker):
|
def test_set_readout_clock_0(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||||
d.readout_clock = 'Full Speed'
|
d.readout_clock = 'Full Speed'
|
||||||
m.assert_called_once_with(0)
|
m.assert_called_once_with(0)
|
||||||
|
|
||||||
def test_set_readout_clock_1(d, mocker):
|
def test_set_readout_clock_1(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||||
d.readout_clock = 'Half Speed'
|
d.readout_clock = 'Half Speed'
|
||||||
m.assert_called_once_with(1)
|
m.assert_called_once_with(1)
|
||||||
|
|
||||||
def test_set_readout_clock_2(d, mocker):
|
def test_set_readout_clock_2(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||||
d.readout_clock = 'Quarter Speed'
|
d.readout_clock = 'Quarter Speed'
|
||||||
m.assert_called_once_with(2)
|
m.assert_called_once_with(2)
|
||||||
|
|
||||||
def test_set_readout_clock_3(d, mocker):
|
def test_set_readout_clock_3(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||||
d.readout_clock = 'Super Slow Speed'
|
d.readout_clock = 'Super Slow Speed'
|
||||||
m.assert_called_once_with(3)
|
m.assert_called_once_with(3)
|
||||||
|
|
||||||
#----------------------------------------------------------------rx_datastream
|
#----------------------------------------------------------------rx_datastream
|
||||||
def test_get_rx_datastream(d, mocker):
|
def test_get_rx_datastream(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getRxDataStreamStatus')
|
m = mocker.patch('_slsdet.DetectorApi.getRxDataStreamStatus')
|
||||||
m.return_value = False
|
m.return_value = False
|
||||||
assert d.rx_datastream == False
|
assert d.rx_datastream == False
|
||||||
|
|
||||||
def test_set_rx_datastream(d, mocker):
|
def test_set_rx_datastream(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setRxDataStreamStatus')
|
m = mocker.patch('_slsdet.DetectorApi.setRxDataStreamStatus')
|
||||||
d.rx_datastream = True
|
d.rx_datastream = True
|
||||||
m.assert_called_once_with(True)
|
m.assert_called_once_with(True)
|
||||||
|
|
||||||
def test_get_rx_zmqip(d, mocker):
|
def test_get_rx_zmqip(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||||
d.rx_zmqip
|
d.rx_zmqip
|
||||||
m.assert_called_once_with('rx_zmqip')
|
m.assert_called_once_with('rx_zmqip')
|
||||||
|
|
||||||
def test_get_rx_zmqport_call(d, mocker):
|
def test_get_rx_zmqport_call(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||||
d.rx_zmqport
|
d.rx_zmqport
|
||||||
m.assert_called_once_with('rx_zmqport')
|
m.assert_called_once_with('rx_zmqport')
|
||||||
|
|
||||||
def test_get_rx_zmqport_decode(d, mocker):
|
def test_get_rx_zmqport_decode(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||||
m.return_value = '30001+30003+'
|
m.return_value = '30001+30003+'
|
||||||
assert d.rx_zmqport == [30001, 30002, 30003, 30004]
|
assert d.rx_zmqport == [30001, 30002, 30003, 30004]
|
||||||
|
|
||||||
def test_get_rx_zmqport_empty(d, mocker):
|
def test_get_rx_zmqport_empty(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||||
m.return_value = ''
|
m.return_value = ''
|
||||||
assert d.rx_zmqport == []
|
assert d.rx_zmqport == []
|
||||||
|
|
||||||
|
|
||||||
#--------------------------------------------------------------------status
|
#--------------------------------------------------------------------status
|
||||||
def test_status_call(d, mocker):
|
def test_status_call(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getRunStatus')
|
m = mocker.patch('_slsdet.DetectorApi.getRunStatus')
|
||||||
d.status
|
d.status
|
||||||
m.assert_called_once_with()
|
m.assert_called_once_with()
|
||||||
|
|
||||||
def test_start_acq_call(d, mocker):
|
def test_start_acq_call(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.startAcquisition')
|
m = mocker.patch('_slsdet.DetectorApi.startAcquisition')
|
||||||
d.start_acq()
|
d.start_acq()
|
||||||
m.assert_called_once_with()
|
m.assert_called_once_with()
|
||||||
|
|
||||||
def test_stop_acq_call(d, mocker):
|
def test_stop_acq_call(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.stopAcquisition')
|
m = mocker.patch('_slsdet.DetectorApi.stopAcquisition')
|
||||||
d.stop_acq()
|
d.stop_acq()
|
||||||
m.assert_called_once_with()
|
m.assert_called_once_with()
|
||||||
|
|
||||||
#--------------------------------------------------------------------subexptime
|
#--------------------------------------------------------------------subexptime
|
||||||
def test_get_sub_exposure_time(d, mocker):
|
def test_get_sub_exposure_time(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getSubExposureTime')
|
m = mocker.patch('_slsdet.DetectorApi.getSubExposureTime')
|
||||||
m.return_value = 2370000
|
m.return_value = 2370000
|
||||||
assert d.sub_exposure_time == 0.00237
|
assert d.sub_exposure_time == 0.00237
|
||||||
|
|
||||||
|
|
||||||
def test_set_sub_exposure_time(d, mocker):
|
def test_set_sub_exposure_time(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setSubExposureTime')
|
m = mocker.patch('_slsdet.DetectorApi.setSubExposureTime')
|
||||||
d.sub_exposure_time = 0.002
|
d.sub_exposure_time = 0.002
|
||||||
m.assert_called_once_with(2000000)
|
m.assert_called_once_with(2000000)
|
||||||
|
|
||||||
def test_set_sub_exposure_time_raises_on_zero(d, mocker):
|
def test_set_sub_exposure_time_raises_on_zero(d, mocker):
|
||||||
mocker.patch('_sls_detector.DetectorApi.setSubExposureTime')
|
mocker.patch('_slsdet.DetectorApi.setSubExposureTime')
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
d.sub_exposure_time = 0
|
d.sub_exposure_time = 0
|
||||||
|
|
||||||
#------------------------------------------------------------------timing mode
|
#------------------------------------------------------------------timing mode
|
||||||
def test_get_timing_mode(d, mocker):
|
def test_get_timing_mode(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getTimingMode')
|
m = mocker.patch('_slsdet.DetectorApi.getTimingMode')
|
||||||
d.timing_mode
|
d.timing_mode
|
||||||
m.assert_called_once_with()
|
m.assert_called_once_with()
|
||||||
|
|
||||||
def test_set_timing_mode(d, mocker):
|
def test_set_timing_mode(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setTimingMode')
|
m = mocker.patch('_slsdet.DetectorApi.setTimingMode')
|
||||||
d.timing_mode = 'auto'
|
d.timing_mode = 'auto'
|
||||||
m.assert_called_once_with('auto')
|
m.assert_called_once_with('auto')
|
||||||
|
|
||||||
#----------------------------------------------------------------vthreshold
|
#----------------------------------------------------------------vthreshold
|
||||||
def test_get_vthreshold(d, mocker):
|
def test_get_vthreshold(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getDac')
|
m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||||
d.vthreshold
|
d.vthreshold
|
||||||
m.assert_called_once_with('vthreshold', -1)
|
m.assert_called_once_with('vthreshold', -1)
|
||||||
|
|
||||||
def test_set_vthreshold(d, mocker):
|
def test_set_vthreshold(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setDac')
|
m = mocker.patch('_slsdet.DetectorApi.setDac')
|
||||||
d.vthreshold = 1675
|
d.vthreshold = 1675
|
||||||
m.assert_called_once_with('vthreshold', -1, 1675)
|
m.assert_called_once_with('vthreshold', -1, 1675)
|
||||||
|
|
||||||
#----------------------------------------------------------------trimbits
|
#----------------------------------------------------------------trimbits
|
||||||
def test_get_trimbits(d, mocker):
|
def test_get_trimbits(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.getAllTrimbits')
|
m = mocker.patch('_slsdet.DetectorApi.getAllTrimbits')
|
||||||
d.trimbits
|
d.trimbits
|
||||||
m.assert_called_once_with()
|
m.assert_called_once_with()
|
||||||
|
|
||||||
def test_set_trimbits(d, mocker):
|
def test_set_trimbits(d, mocker):
|
||||||
m = mocker.patch('_sls_detector.DetectorApi.setAllTrimbits')
|
m = mocker.patch('_slsdet.DetectorApi.setAllTrimbits')
|
||||||
d.trimbits = 15
|
d.trimbits = 15
|
||||||
m.assert_called_once_with(15)
|
m.assert_called_once_with(15)
|
||||||
|
|
||||||
def test_set_trimbits_raises_outside_range(d, mocker):
|
def test_set_trimbits_raises_outside_range(d, mocker):
|
||||||
mocker.patch('_sls_detector.DetectorApi.setAllTrimbits')
|
mocker.patch('_slsdet.DetectorApi.setAllTrimbits')
|
||||||
|
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
d.trimbits = 69
|
d.trimbits = 69
|
||||||
|
@ -15,7 +15,7 @@ from pytest_mock import mocker
|
|||||||
import sys
|
import sys
|
||||||
sys.path.append('/home/l_frojdh/slsdetectorgrup/sls_detector')
|
sys.path.append('/home/l_frojdh/slsdetectorgrup/sls_detector')
|
||||||
|
|
||||||
import _sls_detector
|
import _slsdet
|
||||||
from sls_detector.errors import DetectorValueError, DetectorError
|
from sls_detector.errors import DetectorValueError, DetectorError
|
||||||
from sls_detector.utils import all_equal, element_if_equal
|
from sls_detector.utils import all_equal, element_if_equal
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ def test_set_counters_single(d, mocker):
|
|||||||
|
|
||||||
|
|
||||||
# def test_busy_call(d, mocker):
|
# def test_busy_call(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getAcquiringFlag')
|
# m = mocker.patch('_slsdet.DetectorApi.getAcquiringFlag')
|
||||||
# m.return_value = False
|
# m.return_value = False
|
||||||
# assert d.busy == False
|
# assert d.busy == False
|
||||||
|
|
||||||
@ -73,34 +73,34 @@ def test_set_counters_single(d, mocker):
|
|||||||
# d.detector_type = 'Eiger'
|
# d.detector_type = 'Eiger'
|
||||||
|
|
||||||
# def test_det_type(d, mocker):
|
# def test_det_type(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getDetectorType')
|
# m = mocker.patch('_slsdet.DetectorApi.getDetectorType')
|
||||||
# m.return_value = 'Eiger'
|
# m.return_value = 'Eiger'
|
||||||
# assert d.detector_type == 'Eiger'
|
# assert d.detector_type == 'Eiger'
|
||||||
|
|
||||||
|
|
||||||
# def test_get_exposure_time(d, mocker):
|
# def test_get_exposure_time(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getExposureTime')
|
# m = mocker.patch('_slsdet.DetectorApi.getExposureTime')
|
||||||
# m.return_value = 100000000
|
# m.return_value = 100000000
|
||||||
# assert d.exposure_time == 0.1
|
# assert d.exposure_time == 0.1
|
||||||
|
|
||||||
# def test_set_exposure_time(d, mocker):
|
# def test_set_exposure_time(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.setExposureTime')
|
# m = mocker.patch('_slsdet.DetectorApi.setExposureTime')
|
||||||
# d.exposure_time = 1.5
|
# d.exposure_time = 1.5
|
||||||
# m.assert_called_once_with(1500000000)
|
# m.assert_called_once_with(1500000000)
|
||||||
|
|
||||||
# def test_set_exposure_time_less_than_zero(d, mocker):
|
# def test_set_exposure_time_less_than_zero(d, mocker):
|
||||||
# mocker.patch('_sls_detector.DetectorApi.setExposureTime')
|
# mocker.patch('_slsdet.DetectorApi.setExposureTime')
|
||||||
# with pytest.raises(DetectorValueError):
|
# with pytest.raises(DetectorValueError):
|
||||||
# d.exposure_time = -7
|
# d.exposure_time = -7
|
||||||
|
|
||||||
|
|
||||||
# def test_get_file_index(d, mocker):
|
# def test_get_file_index(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getFileIndex')
|
# m = mocker.patch('_slsdet.DetectorApi.getFileIndex')
|
||||||
# m.return_value = 8
|
# m.return_value = 8
|
||||||
# assert d.file_index == 8
|
# assert d.file_index == 8
|
||||||
|
|
||||||
# def test_set_file_index(d, mocker):
|
# def test_set_file_index(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.setFileIndex')
|
# m = mocker.patch('_slsdet.DetectorApi.setFileIndex')
|
||||||
# d.file_index = 9
|
# d.file_index = 9
|
||||||
# m.assert_called_with(9)
|
# m.assert_called_with(9)
|
||||||
|
|
||||||
@ -112,28 +112,28 @@ def test_set_counters_single(d, mocker):
|
|||||||
# assert d.dynamic_range == -100
|
# assert d.dynamic_range == -100
|
||||||
|
|
||||||
# def test_set_file_index_raises_on_neg(d, mocker):
|
# def test_set_file_index_raises_on_neg(d, mocker):
|
||||||
# mocker.patch('_sls_detector.DetectorApi.setFileIndex')
|
# mocker.patch('_slsdet.DetectorApi.setFileIndex')
|
||||||
# with pytest.raises(ValueError):
|
# with pytest.raises(ValueError):
|
||||||
# d.file_index = -9
|
# d.file_index = -9
|
||||||
|
|
||||||
|
|
||||||
# def test_get_file_name(d, mocker):
|
# def test_get_file_name(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getFileName')
|
# m = mocker.patch('_slsdet.DetectorApi.getFileName')
|
||||||
# d.file_name
|
# d.file_name
|
||||||
# m.assert_called_once_with()
|
# m.assert_called_once_with()
|
||||||
|
|
||||||
# def test_set_file_name(d, mocker):
|
# def test_set_file_name(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.setFileName')
|
# m = mocker.patch('_slsdet.DetectorApi.setFileName')
|
||||||
# d.file_name = 'hej'
|
# d.file_name = 'hej'
|
||||||
# m.assert_called_once_with('hej')
|
# m.assert_called_once_with('hej')
|
||||||
|
|
||||||
# def test_get_file_path(d, mocker):
|
# def test_get_file_path(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getFilePath')
|
# m = mocker.patch('_slsdet.DetectorApi.getFilePath')
|
||||||
# d.file_path
|
# d.file_path
|
||||||
# m.assert_called_once_with()
|
# m.assert_called_once_with()
|
||||||
|
|
||||||
# def test_set_file_path_when_path_exists(d, mocker):
|
# def test_set_file_path_when_path_exists(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.setFilePath')
|
# m = mocker.patch('_slsdet.DetectorApi.setFilePath')
|
||||||
# #To avoid raising an exception because path is not there
|
# #To avoid raising an exception because path is not there
|
||||||
# mock_os = mocker.patch('os.path.exists')
|
# mock_os = mocker.patch('os.path.exists')
|
||||||
# mock_os.return_value = True
|
# mock_os.return_value = True
|
||||||
@ -141,25 +141,25 @@ def test_set_counters_single(d, mocker):
|
|||||||
# m.assert_called_once_with('/path/to/something/')
|
# m.assert_called_once_with('/path/to/something/')
|
||||||
|
|
||||||
# def test_set_file_path_raises_when_not_exists(d, mocker):
|
# def test_set_file_path_raises_when_not_exists(d, mocker):
|
||||||
# mocker.patch('_sls_detector.DetectorApi.setFilePath')
|
# mocker.patch('_slsdet.DetectorApi.setFilePath')
|
||||||
# mock_os = mocker.patch('os.path.exists')
|
# mock_os = mocker.patch('os.path.exists')
|
||||||
# mock_os.return_value = False
|
# mock_os.return_value = False
|
||||||
# with pytest.raises(FileNotFoundError):
|
# with pytest.raises(FileNotFoundError):
|
||||||
# d.file_path = '/path/to/something/'
|
# d.file_path = '/path/to/something/'
|
||||||
|
|
||||||
# def test_get_file_write(d, mocker):
|
# def test_get_file_write(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getFileWrite')
|
# m = mocker.patch('_slsdet.DetectorApi.getFileWrite')
|
||||||
# m.return_value = False
|
# m.return_value = False
|
||||||
# assert d.file_write == False
|
# assert d.file_write == False
|
||||||
|
|
||||||
# def test_set_file_write(d, mocker):
|
# def test_set_file_write(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.setFileWrite')
|
# m = mocker.patch('_slsdet.DetectorApi.setFileWrite')
|
||||||
# d.file_write = True
|
# d.file_write = True
|
||||||
# m.assert_called_once_with(True)
|
# m.assert_called_once_with(True)
|
||||||
|
|
||||||
|
|
||||||
# def test_get_firmware_version(d, mocker):
|
# def test_get_firmware_version(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getFirmwareVersion')
|
# m = mocker.patch('_slsdet.DetectorApi.getFirmwareVersion')
|
||||||
# m.return_value = 20
|
# m.return_value = 20
|
||||||
# assert d.firmware_version == 20
|
# assert d.firmware_version == 20
|
||||||
|
|
||||||
@ -168,38 +168,38 @@ def test_set_counters_single(d, mocker):
|
|||||||
# d.firmware_version = 20
|
# d.firmware_version = 20
|
||||||
|
|
||||||
# def test_get_high_voltage_call_signature(d, mocker):
|
# def test_get_high_voltage_call_signature(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getDac')
|
# m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||||
# d.high_voltage
|
# d.high_voltage
|
||||||
# m.assert_called_once_with('vhighvoltage', -1)
|
# m.assert_called_once_with('vhighvoltage', -1)
|
||||||
|
|
||||||
# def test_get_high_voltage(d, mocker):
|
# def test_get_high_voltage(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getDac')
|
# m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||||
# m.return_value = 80
|
# m.return_value = 80
|
||||||
# assert d.high_voltage == 80
|
# assert d.high_voltage == 80
|
||||||
|
|
||||||
# #self._api.setDac('vhighvoltage', -1, voltage)
|
# #self._api.setDac('vhighvoltage', -1, voltage)
|
||||||
# def test_set_high_voltage(d, mocker):
|
# def test_set_high_voltage(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.setDac')
|
# m = mocker.patch('_slsdet.DetectorApi.setDac')
|
||||||
# d.high_voltage = 80
|
# d.high_voltage = 80
|
||||||
# m.assert_called_once_with('vhighvoltage', -1, 80)
|
# m.assert_called_once_with('vhighvoltage', -1, 80)
|
||||||
|
|
||||||
# def test_decode_hostname_two_names(d, mocker):
|
# def test_decode_hostname_two_names(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getHostname')
|
# m = mocker.patch('_slsdet.DetectorApi.getHostname')
|
||||||
# m.return_value = 'beb059+beb048+'
|
# m.return_value = 'beb059+beb048+'
|
||||||
# assert d.hostname == ['beb059', 'beb048']
|
# assert d.hostname == ['beb059', 'beb048']
|
||||||
|
|
||||||
# def test_decode_hostname_four_names(d, mocker):
|
# def test_decode_hostname_four_names(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getHostname')
|
# m = mocker.patch('_slsdet.DetectorApi.getHostname')
|
||||||
# m.return_value = 'beb059+beb048+beb120+beb153+'
|
# m.return_value = 'beb059+beb048+beb120+beb153+'
|
||||||
# assert d.hostname == ['beb059', 'beb048', 'beb120', 'beb153']
|
# assert d.hostname == ['beb059', 'beb048', 'beb120', 'beb153']
|
||||||
|
|
||||||
# def test_decode_hostname_blank(d, mocker):
|
# def test_decode_hostname_blank(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getHostname')
|
# m = mocker.patch('_slsdet.DetectorApi.getHostname')
|
||||||
# m.return_value = ''
|
# m.return_value = ''
|
||||||
# assert d.hostname == []
|
# assert d.hostname == []
|
||||||
|
|
||||||
# def test_get_image_size_gives_correct_size(d, mocker):
|
# def test_get_image_size_gives_correct_size(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getImageSize')
|
# m = mocker.patch('_slsdet.DetectorApi.getImageSize')
|
||||||
# m.return_value = (512,1024)
|
# m.return_value = (512,1024)
|
||||||
# im_size = d.image_size
|
# im_size = d.image_size
|
||||||
# assert im_size.rows == 512
|
# assert im_size.rows == 512
|
||||||
@ -208,7 +208,7 @@ def test_set_counters_single(d, mocker):
|
|||||||
|
|
||||||
|
|
||||||
# def test_load_config(d, mocker):
|
# def test_load_config(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.readConfigurationFile')
|
# m = mocker.patch('_slsdet.DetectorApi.readConfigurationFile')
|
||||||
# #To avoid raising an exception because path is not there
|
# #To avoid raising an exception because path is not there
|
||||||
# mock_os = mocker.patch('os.path.isfile')
|
# mock_os = mocker.patch('os.path.isfile')
|
||||||
# mock_os.return_value = True
|
# mock_os.return_value = True
|
||||||
@ -216,14 +216,14 @@ def test_set_counters_single(d, mocker):
|
|||||||
# m.assert_called_once_with('/path/to/my/file.config')
|
# m.assert_called_once_with('/path/to/my/file.config')
|
||||||
|
|
||||||
# def test_load_config_raises_when_file_is_not_found(d, mocker):
|
# def test_load_config_raises_when_file_is_not_found(d, mocker):
|
||||||
# mocker.patch('_sls_detector.DetectorApi.readConfigurationFile')
|
# mocker.patch('_slsdet.DetectorApi.readConfigurationFile')
|
||||||
# mock_os = mocker.patch('os.path.isfile')
|
# mock_os = mocker.patch('os.path.isfile')
|
||||||
# mock_os.return_value = False
|
# mock_os.return_value = False
|
||||||
# with pytest.raises(FileNotFoundError):
|
# with pytest.raises(FileNotFoundError):
|
||||||
# d.load_config('/path/to/my/file.config')
|
# d.load_config('/path/to/my/file.config')
|
||||||
|
|
||||||
# def test_load_parameters(d, mocker):
|
# def test_load_parameters(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.readParametersFile')
|
# m = mocker.patch('_slsdet.DetectorApi.readParametersFile')
|
||||||
# #To avoid raising an exception because path is not there
|
# #To avoid raising an exception because path is not there
|
||||||
# mock_os = mocker.patch('os.path.isfile')
|
# mock_os = mocker.patch('os.path.isfile')
|
||||||
# mock_os.return_value = True
|
# mock_os.return_value = True
|
||||||
@ -231,7 +231,7 @@ def test_set_counters_single(d, mocker):
|
|||||||
# m.assert_called_once_with('/path/to/my/file.par')
|
# m.assert_called_once_with('/path/to/my/file.par')
|
||||||
|
|
||||||
# def test_load_parameters_raises_when_file_is_not_found(d, mocker):
|
# def test_load_parameters_raises_when_file_is_not_found(d, mocker):
|
||||||
# mocker.patch('_sls_detector.DetectorApi.readParametersFile')
|
# mocker.patch('_slsdet.DetectorApi.readParametersFile')
|
||||||
# mock_os = mocker.patch('os.path.isfile')
|
# mock_os = mocker.patch('os.path.isfile')
|
||||||
# mock_os.return_value = False
|
# mock_os.return_value = False
|
||||||
# with pytest.raises(FileNotFoundError):
|
# with pytest.raises(FileNotFoundError):
|
||||||
@ -239,14 +239,14 @@ def test_set_counters_single(d, mocker):
|
|||||||
|
|
||||||
# #getDetectorGeometry
|
# #getDetectorGeometry
|
||||||
# def test_get_module_geometry_gives_correct_size(d, mocker):
|
# def test_get_module_geometry_gives_correct_size(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getDetectorGeometry')
|
# m = mocker.patch('_slsdet.DetectorApi.getDetectorGeometry')
|
||||||
# m.return_value = (13,7)
|
# m.return_value = (13,7)
|
||||||
# g = d.module_geometry
|
# g = d.module_geometry
|
||||||
# assert g.vertical == 7
|
# assert g.vertical == 7
|
||||||
# assert g.horizontal == 13
|
# assert g.horizontal == 13
|
||||||
|
|
||||||
# def test_get_module_geometry_access(d, mocker):
|
# def test_get_module_geometry_access(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getDetectorGeometry')
|
# m = mocker.patch('_slsdet.DetectorApi.getDetectorGeometry')
|
||||||
# m.return_value = (12,3)
|
# m.return_value = (12,3)
|
||||||
# assert d.module_geometry[0] == 12
|
# assert d.module_geometry[0] == 12
|
||||||
# assert d.module_geometry[1] == 3
|
# assert d.module_geometry[1] == 3
|
||||||
@ -259,12 +259,12 @@ def test_set_counters_single(d, mocker):
|
|||||||
# assert t.vertical == 0
|
# assert t.vertical == 0
|
||||||
|
|
||||||
# def test_get_n_frames(d, mocker):
|
# def test_get_n_frames(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getNumberOfFrames')
|
# m = mocker.patch('_slsdet.DetectorApi.getNumberOfFrames')
|
||||||
# m.return_value = 3
|
# m.return_value = 3
|
||||||
# assert d.n_frames == 3
|
# assert d.n_frames == 3
|
||||||
|
|
||||||
# def test_set_n_frames(d, mocker):
|
# def test_set_n_frames(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
|
# m = mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
|
||||||
# d.n_frames = 9
|
# d.n_frames = 9
|
||||||
# m.assert_called_once_with(9)
|
# m.assert_called_once_with(9)
|
||||||
|
|
||||||
@ -272,12 +272,12 @@ def test_set_counters_single(d, mocker):
|
|||||||
# assert d.n_frames == -100
|
# assert d.n_frames == -100
|
||||||
|
|
||||||
# def test_set_n_frames_raises_on_neg(d, mocker):
|
# def test_set_n_frames_raises_on_neg(d, mocker):
|
||||||
# mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
|
# mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
|
||||||
# with pytest.raises(DetectorValueError):
|
# with pytest.raises(DetectorValueError):
|
||||||
# d.n_frames = -1
|
# d.n_frames = -1
|
||||||
|
|
||||||
# def test_set_n_frames_raises_on_zero(d, mocker):
|
# def test_set_n_frames_raises_on_zero(d, mocker):
|
||||||
# mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
|
# mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
|
||||||
# with pytest.raises(DetectorValueError):
|
# with pytest.raises(DetectorValueError):
|
||||||
# d.n_frames = 0
|
# d.n_frames = 0
|
||||||
|
|
||||||
@ -285,12 +285,12 @@ def test_set_counters_single(d, mocker):
|
|||||||
# assert d.n_cycles == -100
|
# assert d.n_cycles == -100
|
||||||
|
|
||||||
# def test_set_n_cycles_raises_on_zero(d, mocker):
|
# def test_set_n_cycles_raises_on_zero(d, mocker):
|
||||||
# mocker.patch('_sls_detector.DetectorApi.setCycles')
|
# mocker.patch('_slsdet.DetectorApi.setCycles')
|
||||||
# with pytest.raises(DetectorValueError):
|
# with pytest.raises(DetectorValueError):
|
||||||
# d.n_cycles = 0
|
# d.n_cycles = 0
|
||||||
|
|
||||||
# def test_set_n_cycles(d, mocker):
|
# def test_set_n_cycles(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.setCycles')
|
# m = mocker.patch('_slsdet.DetectorApi.setCycles')
|
||||||
# d.n_cycles = 56
|
# d.n_cycles = 56
|
||||||
# m.assert_called_once_with(56)
|
# m.assert_called_once_with(56)
|
||||||
|
|
||||||
@ -300,12 +300,12 @@ def test_set_counters_single(d, mocker):
|
|||||||
# assert d.n_measurements == -100
|
# assert d.n_measurements == -100
|
||||||
|
|
||||||
# def test_set_n_measurements_raises_on_zero(d, mocker):
|
# def test_set_n_measurements_raises_on_zero(d, mocker):
|
||||||
# mocker.patch('_sls_detector.DetectorApi.setNumberOfMeasurements')
|
# mocker.patch('_slsdet.DetectorApi.setNumberOfMeasurements')
|
||||||
# with pytest.raises(DetectorValueError):
|
# with pytest.raises(DetectorValueError):
|
||||||
# d.n_measurements = 0
|
# d.n_measurements = 0
|
||||||
|
|
||||||
# def test_set_n_measurements(d, mocker):
|
# def test_set_n_measurements(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.setNumberOfMeasurements')
|
# m = mocker.patch('_slsdet.DetectorApi.setNumberOfMeasurements')
|
||||||
# d.n_measurements = 560
|
# d.n_measurements = 560
|
||||||
# m.assert_called_once_with(560)
|
# m.assert_called_once_with(560)
|
||||||
|
|
||||||
@ -313,33 +313,33 @@ def test_set_counters_single(d, mocker):
|
|||||||
# assert d.n_modules == 0
|
# assert d.n_modules == 0
|
||||||
|
|
||||||
# def test_get_n_modules(d, mocker):
|
# def test_get_n_modules(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
|
# m = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
|
||||||
# m.return_value = 12
|
# m.return_value = 12
|
||||||
# assert d.n_modules == 12
|
# assert d.n_modules == 12
|
||||||
|
|
||||||
# def test_get_period_time(d, mocker):
|
# def test_get_period_time(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getPeriod')
|
# m = mocker.patch('_slsdet.DetectorApi.getPeriod')
|
||||||
# m.return_value = 130000000
|
# m.return_value = 130000000
|
||||||
# assert d.period == 0.13
|
# assert d.period == 0.13
|
||||||
|
|
||||||
# def test_set_period_time(d, mocker):
|
# def test_set_period_time(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.setPeriod')
|
# m = mocker.patch('_slsdet.DetectorApi.setPeriod')
|
||||||
# d.period = 1.953
|
# d.period = 1.953
|
||||||
# m.assert_called_once_with(1953000000)
|
# m.assert_called_once_with(1953000000)
|
||||||
|
|
||||||
# def test_set_period_time_less_than_zero(d, mocker):
|
# def test_set_period_time_less_than_zero(d, mocker):
|
||||||
# mocker.patch('_sls_detector.DetectorApi.setPeriod')
|
# mocker.patch('_slsdet.DetectorApi.setPeriod')
|
||||||
# with pytest.raises(ValueError):
|
# with pytest.raises(ValueError):
|
||||||
# d.period = -7
|
# d.period = -7
|
||||||
|
|
||||||
|
|
||||||
# def test_get_online(d, mocker):
|
# def test_get_online(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getOnline')
|
# m = mocker.patch('_slsdet.DetectorApi.getOnline')
|
||||||
# d.online
|
# d.online
|
||||||
# m.assert_called_once_with()
|
# m.assert_called_once_with()
|
||||||
|
|
||||||
# def test_set_online(d, mocker):
|
# def test_set_online(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.setOnline')
|
# m = mocker.patch('_slsdet.DetectorApi.setOnline')
|
||||||
# d.online = True
|
# d.online = True
|
||||||
# m.assert_called_once_with(True)
|
# m.assert_called_once_with(True)
|
||||||
|
|
||||||
@ -347,116 +347,116 @@ def test_set_counters_single(d, mocker):
|
|||||||
# assert d.last_client_ip == ''
|
# assert d.last_client_ip == ''
|
||||||
|
|
||||||
# def test_last_cliten_ip_call(d, mocker):
|
# def test_last_cliten_ip_call(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getLastClientIP')
|
# m = mocker.patch('_slsdet.DetectorApi.getLastClientIP')
|
||||||
# d.last_client_ip
|
# d.last_client_ip
|
||||||
# m.assert_called_once_with()
|
# m.assert_called_once_with()
|
||||||
|
|
||||||
# #-------------------------------------------------------------Rate correction
|
# #-------------------------------------------------------------Rate correction
|
||||||
# def test_get_rate_correction(d, mocker):
|
# def test_get_rate_correction(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getRateCorrection')
|
# m = mocker.patch('_slsdet.DetectorApi.getRateCorrection')
|
||||||
# m.return_value = [132,129]
|
# m.return_value = [132,129]
|
||||||
# assert d.rate_correction == [132,129]
|
# assert d.rate_correction == [132,129]
|
||||||
|
|
||||||
# def test_set_rate_correction(d, mocker):
|
# def test_set_rate_correction(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.setRateCorrection')
|
# m = mocker.patch('_slsdet.DetectorApi.setRateCorrection')
|
||||||
# mock_n = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
|
# mock_n = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
|
||||||
# mock_n.return_value = 3
|
# mock_n.return_value = 3
|
||||||
# d.rate_correction = [123,90,50]
|
# d.rate_correction = [123,90,50]
|
||||||
# m.assert_called_once_with([123,90,50])
|
# m.assert_called_once_with([123,90,50])
|
||||||
|
|
||||||
# def test_set_rate_correction_raises_on_wrong_number_of_values(d, mocker):
|
# def test_set_rate_correction_raises_on_wrong_number_of_values(d, mocker):
|
||||||
# mocker.patch('_sls_detector.DetectorApi.setRateCorrection')
|
# mocker.patch('_slsdet.DetectorApi.setRateCorrection')
|
||||||
# mock_n = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
|
# mock_n = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
|
||||||
# mock_n.return_value = 4
|
# mock_n.return_value = 4
|
||||||
# with pytest.raises(ValueError):
|
# with pytest.raises(ValueError):
|
||||||
# d.rate_correction = [123,90,50]
|
# d.rate_correction = [123,90,50]
|
||||||
|
|
||||||
# #----------------------------------------------------------------Readout clock
|
# #----------------------------------------------------------------Readout clock
|
||||||
# def test_get_readout_clock_0(d, mocker):
|
# def test_get_readout_clock_0(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
# m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||||
# m.return_value = 0
|
# m.return_value = 0
|
||||||
# assert d.readout_clock == 'Full Speed'
|
# assert d.readout_clock == 'Full Speed'
|
||||||
|
|
||||||
# def test_get_readout_clock_1(d, mocker):
|
# def test_get_readout_clock_1(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
# m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||||
# m.return_value = 1
|
# m.return_value = 1
|
||||||
# assert d.readout_clock == 'Half Speed'
|
# assert d.readout_clock == 'Half Speed'
|
||||||
|
|
||||||
# def test_get_readout_clock_2(d, mocker):
|
# def test_get_readout_clock_2(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
# m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||||
# m.return_value = 2
|
# m.return_value = 2
|
||||||
# assert d.readout_clock == 'Quarter Speed'
|
# assert d.readout_clock == 'Quarter Speed'
|
||||||
|
|
||||||
# def test_get_readout_clock_3(d, mocker):
|
# def test_get_readout_clock_3(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
# m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||||
# m.return_value = 3
|
# m.return_value = 3
|
||||||
# assert d.readout_clock == 'Super Slow Speed'
|
# assert d.readout_clock == 'Super Slow Speed'
|
||||||
|
|
||||||
# def test_set_readout_clock_0(d, mocker):
|
# def test_set_readout_clock_0(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
# m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||||
# d.readout_clock = 'Full Speed'
|
# d.readout_clock = 'Full Speed'
|
||||||
# m.assert_called_once_with(0)
|
# m.assert_called_once_with(0)
|
||||||
|
|
||||||
# def test_set_readout_clock_1(d, mocker):
|
# def test_set_readout_clock_1(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
# m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||||
# d.readout_clock = 'Half Speed'
|
# d.readout_clock = 'Half Speed'
|
||||||
# m.assert_called_once_with(1)
|
# m.assert_called_once_with(1)
|
||||||
|
|
||||||
# def test_set_readout_clock_2(d, mocker):
|
# def test_set_readout_clock_2(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
# m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||||
# d.readout_clock = 'Quarter Speed'
|
# d.readout_clock = 'Quarter Speed'
|
||||||
# m.assert_called_once_with(2)
|
# m.assert_called_once_with(2)
|
||||||
|
|
||||||
# def test_set_readout_clock_3(d, mocker):
|
# def test_set_readout_clock_3(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
# m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||||
# d.readout_clock = 'Super Slow Speed'
|
# d.readout_clock = 'Super Slow Speed'
|
||||||
# m.assert_called_once_with(3)
|
# m.assert_called_once_with(3)
|
||||||
|
|
||||||
# #----------------------------------------------------------------rx_datastream
|
# #----------------------------------------------------------------rx_datastream
|
||||||
# def test_get_rx_datastream(d, mocker):
|
# def test_get_rx_datastream(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getRxDataStreamStatus')
|
# m = mocker.patch('_slsdet.DetectorApi.getRxDataStreamStatus')
|
||||||
# m.return_value = False
|
# m.return_value = False
|
||||||
# assert d.rx_datastream == False
|
# assert d.rx_datastream == False
|
||||||
|
|
||||||
# def test_set_rx_datastream(d, mocker):
|
# def test_set_rx_datastream(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.setRxDataStreamStatus')
|
# m = mocker.patch('_slsdet.DetectorApi.setRxDataStreamStatus')
|
||||||
# d.rx_datastream = True
|
# d.rx_datastream = True
|
||||||
# m.assert_called_once_with(True)
|
# m.assert_called_once_with(True)
|
||||||
|
|
||||||
# def test_get_rx_zmqip(d, mocker):
|
# def test_get_rx_zmqip(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
# m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||||
# d.rx_zmqip
|
# d.rx_zmqip
|
||||||
# m.assert_called_once_with('rx_zmqip')
|
# m.assert_called_once_with('rx_zmqip')
|
||||||
|
|
||||||
# def test_get_rx_zmqport_call(d, mocker):
|
# def test_get_rx_zmqport_call(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
# m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||||
# d.rx_zmqport
|
# d.rx_zmqport
|
||||||
# m.assert_called_once_with('rx_zmqport')
|
# m.assert_called_once_with('rx_zmqport')
|
||||||
|
|
||||||
# def test_get_rx_zmqport_decode(d, mocker):
|
# def test_get_rx_zmqport_decode(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
# m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||||
# m.return_value = ['30001', '30003']
|
# m.return_value = ['30001', '30003']
|
||||||
# assert d.rx_zmqport == [30001, 30003]
|
# assert d.rx_zmqport == [30001, 30003]
|
||||||
|
|
||||||
# def test_get_rx_zmqport_empty(d, mocker):
|
# def test_get_rx_zmqport_empty(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
# m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||||
# m.return_value = ''
|
# m.return_value = ''
|
||||||
# assert d.rx_zmqport == []
|
# assert d.rx_zmqport == []
|
||||||
|
|
||||||
|
|
||||||
# #--------------------------------------------------------------------status
|
# #--------------------------------------------------------------------status
|
||||||
# def test_status_call(d, mocker):
|
# def test_status_call(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getRunStatus')
|
# m = mocker.patch('_slsdet.DetectorApi.getRunStatus')
|
||||||
# d.status
|
# d.status
|
||||||
# m.assert_called_once_with()
|
# m.assert_called_once_with()
|
||||||
|
|
||||||
# def test_start_detecor(d, mocker):
|
# def test_start_detecor(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.startAcquisition')
|
# m = mocker.patch('_slsdet.DetectorApi.startAcquisition')
|
||||||
# d.start_detector()
|
# d.start_detector()
|
||||||
# m.assert_called_once_with()
|
# m.assert_called_once_with()
|
||||||
|
|
||||||
# def test_stop_acq_call(d, mocker):
|
# def test_stop_acq_call(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.stopAcquisition')
|
# m = mocker.patch('_slsdet.DetectorApi.stopAcquisition')
|
||||||
# d.stop_detector()
|
# d.stop_detector()
|
||||||
# m.assert_called_once_with()
|
# m.assert_called_once_with()
|
||||||
|
|
||||||
@ -464,23 +464,23 @@ def test_set_counters_single(d, mocker):
|
|||||||
|
|
||||||
# #------------------------------------------------------------------timing mode
|
# #------------------------------------------------------------------timing mode
|
||||||
# def test_get_timing_mode(d, mocker):
|
# def test_get_timing_mode(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getTimingMode')
|
# m = mocker.patch('_slsdet.DetectorApi.getTimingMode')
|
||||||
# d.timing_mode
|
# d.timing_mode
|
||||||
# m.assert_called_once_with()
|
# m.assert_called_once_with()
|
||||||
|
|
||||||
# def test_set_timing_mode(d, mocker):
|
# def test_set_timing_mode(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.setTimingMode')
|
# m = mocker.patch('_slsdet.DetectorApi.setTimingMode')
|
||||||
# d.timing_mode = 'auto'
|
# d.timing_mode = 'auto'
|
||||||
# m.assert_called_once_with('auto')
|
# m.assert_called_once_with('auto')
|
||||||
|
|
||||||
# #----------------------------------------------------------------vthreshold
|
# #----------------------------------------------------------------vthreshold
|
||||||
# def test_get_vthreshold(d, mocker):
|
# def test_get_vthreshold(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.getDac')
|
# m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||||
# d.vthreshold
|
# d.vthreshold
|
||||||
# m.assert_called_once_with('vthreshold', -1)
|
# m.assert_called_once_with('vthreshold', -1)
|
||||||
|
|
||||||
# def test_set_vthreshold(d, mocker):
|
# def test_set_vthreshold(d, mocker):
|
||||||
# m = mocker.patch('_sls_detector.DetectorApi.setDac')
|
# m = mocker.patch('_slsdet.DetectorApi.setDac')
|
||||||
# d.vthreshold = 1675
|
# d.vthreshold = 1675
|
||||||
# m.assert_called_once_with('vthreshold', -1, 1675)
|
# m.assert_called_once_with('vthreshold', -1, 1675)
|
||||||
|
|
||||||
|
@ -19,3 +19,18 @@ target_link_libraries(result
|
|||||||
set_target_properties(result PROPERTIES
|
set_target_properties(result PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_executable(udp udp.cpp)
|
||||||
|
target_link_libraries(udp
|
||||||
|
slsDetectorShared
|
||||||
|
slsSupportLib
|
||||||
|
pthread
|
||||||
|
rt
|
||||||
|
fmt
|
||||||
|
)
|
||||||
|
|
||||||
|
set_target_properties(udp PROPERTIES
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
65
sample/udp.cpp
Normal file
65
sample/udp.cpp
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#include "UdpRxSocket.h"
|
||||||
|
#include "sls_detector_defs.h"
|
||||||
|
#include <chrono>
|
||||||
|
#include <fmt/format.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include <thread>
|
||||||
|
#include "network_utils.h"
|
||||||
|
|
||||||
|
// Assume packages arrive in order
|
||||||
|
|
||||||
|
// Assume frame nr starts from 0
|
||||||
|
|
||||||
|
using header_t = slsDetectorDefs::sls_detector_header;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
fmt::print("Hej!\n");
|
||||||
|
|
||||||
|
|
||||||
|
constexpr ssize_t packet_size = 4144;
|
||||||
|
constexpr ssize_t payload_size = packet_size - sizeof(header_t);
|
||||||
|
int port = 50012;
|
||||||
|
|
||||||
|
char * buffer = new char[packet_size];
|
||||||
|
|
||||||
|
sls::UdpRxSocket s(port, packet_size, "10.1.1.107");
|
||||||
|
int n = 0;
|
||||||
|
while(true){
|
||||||
|
// s.ReceiveDataOnly(buffer);
|
||||||
|
if (s.ReceivePacket())
|
||||||
|
std::cout << n++ << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// auto header = reinterpret_cast<header_t *>(s.buffer());
|
||||||
|
// char *data = s.buffer() + sizeof(header_t);
|
||||||
|
// fmt::print("buffer start: {}\nheader: {}\ndata: {}\n", fmt::ptr(s.buffer()),
|
||||||
|
// fmt::ptr(header), fmt::ptr(data));
|
||||||
|
|
||||||
|
// int n = 0;
|
||||||
|
|
||||||
|
// fmt::print("Buffer size: {}\n", s.buffer_size());
|
||||||
|
// std::vector<uint16_t> image(n_pixels);
|
||||||
|
// char *image_data = (char *)image.data();
|
||||||
|
// uint64_t frame_nr = 0;
|
||||||
|
// while (true) {
|
||||||
|
|
||||||
|
// if (s.ReceivePacket()) {
|
||||||
|
|
||||||
|
// // fmt::print("frame: {} pkt: {} dst: {}\n", header->frameNumber,
|
||||||
|
// // header->packetNumber, header->packetNumber*payload_size);
|
||||||
|
// if (header->frameNumber != frame_nr) {
|
||||||
|
// // dispatch frame
|
||||||
|
// fmt::print("frame {} done! got: {} pkgs\n", frame_nr, n);
|
||||||
|
// frame_nr = header->frameNumber;
|
||||||
|
// n = 0;
|
||||||
|
// std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
|
// }
|
||||||
|
// ++n;
|
||||||
|
// memcpy(image_data + header->packetNumber * payload_size, data,
|
||||||
|
// payload_size);
|
||||||
|
|
||||||
|
// } else {
|
||||||
|
// std::cout << "timeout\n";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
@ -17,7 +17,7 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#include "analogDetector.h"
|
#include "analogDetector.h"
|
||||||
#include "circularFifo.h"
|
#include "CircularFifo.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
|
||||||
|
find_package(PNG REQUIRED)
|
||||||
|
find_package(ZLIB REQUIRED)
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
slsDetectorPlotting/src/SlsQt1DPlot.cxx
|
slsDetectorPlotting/src/SlsQt1DPlot.cxx
|
||||||
slsDetectorPlotting/src/SlsQt1DZoomer.cxx
|
slsDetectorPlotting/src/SlsQt1DZoomer.cxx
|
||||||
@ -89,8 +92,8 @@ target_link_libraries(slsDetectorGui PUBLIC
|
|||||||
${QT_QTCORE_LIBRARIES}
|
${QT_QTCORE_LIBRARIES}
|
||||||
${QT_QTGUI_LIBRARIES}
|
${QT_QTGUI_LIBRARIES}
|
||||||
${QWT_LIBRARIES}
|
${QWT_LIBRARIES}
|
||||||
png
|
PNG::PNG
|
||||||
z
|
ZLIB::ZLIB
|
||||||
Qt4::QtOpenGL
|
Qt4::QtOpenGL
|
||||||
Qt4::QtSvg
|
Qt4::QtSvg
|
||||||
)
|
)
|
||||||
|
@ -160,4 +160,5 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
|||||||
unsigned int nPixelsY{0};
|
unsigned int nPixelsY{0};
|
||||||
const static int npixelsx_jctb = 400;
|
const static int npixelsx_jctb = 400;
|
||||||
int npixelsy_jctb{0};
|
int npixelsy_jctb{0};
|
||||||
|
uint32_t pixelMask{0};
|
||||||
};
|
};
|
||||||
|
@ -229,6 +229,7 @@ void qDetectorMain::SetUpDetector(const std::string fName, int multiID) {
|
|||||||
case slsDetectorDefs::JUNGFRAU:
|
case slsDetectorDefs::JUNGFRAU:
|
||||||
case slsDetectorDefs::MOENCH:
|
case slsDetectorDefs::MOENCH:
|
||||||
case slsDetectorDefs::MYTHEN3:
|
case slsDetectorDefs::MYTHEN3:
|
||||||
|
case slsDetectorDefs::GOTTHARD2:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
@ -446,7 +447,7 @@ void qDetectorMain::ExecuteHelp(QAction *action) {
|
|||||||
clientVersion +
|
clientVersion +
|
||||||
"<br><br>"
|
"<br><br>"
|
||||||
"Common GUI to control the SLS Detectors: "
|
"Common GUI to control the SLS Detectors: "
|
||||||
"Eiger, Gotthard, Jungfrau and Moench.<br><br>"
|
"Eiger, Jungfrau, Mythen3, Gotthard, Gotthard2 and Moench.<br><br>"
|
||||||
"It can be operated in parallel with the command "
|
"It can be operated in parallel with the command "
|
||||||
"line interface:<br>"
|
"line interface:<br>"
|
||||||
"sls_detector_put,<br>sls_detector_get,<br>sls_"
|
"sls_detector_put,<br>sls_detector_get,<br>sls_"
|
||||||
|
@ -52,6 +52,19 @@ qDrawPlot::~qDrawPlot() {
|
|||||||
|
|
||||||
void qDrawPlot::SetupWidgetWindow() {
|
void qDrawPlot::SetupWidgetWindow() {
|
||||||
detType = det->getDetectorType().squash();
|
detType = det->getDetectorType().squash();
|
||||||
|
switch (detType) {
|
||||||
|
case slsDetectorDefs::JUNGFRAU:
|
||||||
|
case slsDetectorDefs::MOENCH:
|
||||||
|
pixelMask = ((1 << 15) - 1);
|
||||||
|
FILE_LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask << std::dec;
|
||||||
|
break;
|
||||||
|
case slsDetectorDefs::GOTTHARD2:
|
||||||
|
pixelMask = ((1 << 13) - 1);
|
||||||
|
FILE_LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask << std::dec;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
// save
|
// save
|
||||||
try {
|
try {
|
||||||
std::string temp = det->getFilePath().squash("/tmp/");
|
std::string temp = det->getFilePath().squash("/tmp/");
|
||||||
@ -317,9 +330,11 @@ void qDrawPlot::SetDataCallBack(bool enable) {
|
|||||||
FILE_LOG(logINFO) << "Setting data call back to " << std::boolalpha << enable << std::noboolalpha;
|
FILE_LOG(logINFO) << "Setting data call back to " << std::boolalpha << enable << std::noboolalpha;
|
||||||
if (enable) {
|
if (enable) {
|
||||||
isPlot = true;
|
isPlot = true;
|
||||||
|
det->setRxZmqDataStream(true);
|
||||||
det->registerDataCallback(&(GetDataCallBack), this);
|
det->registerDataCallback(&(GetDataCallBack), this);
|
||||||
} else {
|
} else {
|
||||||
isPlot = false;
|
isPlot = false;
|
||||||
|
det->setRxZmqDataStream(false);
|
||||||
det->registerDataCallback(nullptr, this);
|
det->registerDataCallback(nullptr, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -879,7 +894,7 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int data
|
|||||||
int halfbyte = 0;
|
int halfbyte = 0;
|
||||||
char cbyte = '\0';
|
char cbyte = '\0';
|
||||||
|
|
||||||
// mythen 3 debugging
|
// mythen3 / gotthard2 debugging
|
||||||
int discardBits = numDiscardBits;
|
int discardBits = numDiscardBits;
|
||||||
|
|
||||||
switch (dr) {
|
switch (dr) {
|
||||||
@ -903,14 +918,15 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int data
|
|||||||
|
|
||||||
case 16:
|
case 16:
|
||||||
if (detType == slsDetectorDefs::JUNGFRAU ||
|
if (detType == slsDetectorDefs::JUNGFRAU ||
|
||||||
detType == slsDetectorDefs::MOENCH) {
|
detType == slsDetectorDefs::MOENCH ||
|
||||||
|
detType == slsDetectorDefs::GOTTHARD2) {
|
||||||
|
|
||||||
// show gain plot
|
// show gain plot
|
||||||
if (gaindest != NULL) {
|
if (gaindest != NULL) {
|
||||||
for (ichan = 0; ichan < size; ++ichan) {
|
for (ichan = 0; ichan < size; ++ichan) {
|
||||||
uint16_t temp = (*((u_int16_t *)source));
|
uint16_t temp = (*((u_int16_t *)source));
|
||||||
gaindest[ichan] = ((temp & 0xC000) >> 14);
|
gaindest[ichan] = ((temp & 0xC000) >> 14);
|
||||||
dest[ichan] = (temp & 0x3FFF);
|
dest[ichan] = (temp & pixelMask);
|
||||||
source += 2;
|
source += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -918,7 +934,7 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int data
|
|||||||
// only data plot
|
// only data plot
|
||||||
else {
|
else {
|
||||||
for (ichan = 0; ichan < size; ++ichan) {
|
for (ichan = 0; ichan < size; ++ichan) {
|
||||||
dest[ichan] = ((*((u_int16_t *)source)) & 0x3FFF);
|
dest[ichan] = ((*((u_int16_t *)source)) & pixelMask);
|
||||||
source += 2;
|
source += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ void qTabAdvanced::SetupWidgetWindow() {
|
|||||||
tab_roi->setEnabled(true);
|
tab_roi->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::MYTHEN3:
|
case slsDetectorDefs::MYTHEN3:
|
||||||
|
case slsDetectorDefs::GOTTHARD2:
|
||||||
lblDiscardBits->setEnabled(true);
|
lblDiscardBits->setEnabled(true);
|
||||||
spinDiscardBits->setEnabled(true);
|
spinDiscardBits->setEnabled(true);
|
||||||
default:
|
default:
|
||||||
@ -361,7 +362,7 @@ void qTabAdvanced::SetDetectorUDPIP() {
|
|||||||
std::string s = dispDetectorUDPIP->text().toAscii().constData();
|
std::string s = dispDetectorUDPIP->text().toAscii().constData();
|
||||||
FILE_LOG(logINFO) << "Setting Detector UDP IP:" << s;
|
FILE_LOG(logINFO) << "Setting Detector UDP IP:" << s;
|
||||||
try {
|
try {
|
||||||
det->setSourceUDPIP(s, {comboDetector->currentIndex()});
|
det->setSourceUDPIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||||
} CATCH_HANDLE ("Could not set Detector UDP IP.",
|
} CATCH_HANDLE ("Could not set Detector UDP IP.",
|
||||||
"qTabAdvanced::SetDetectorUDPIP", this,
|
"qTabAdvanced::SetDetectorUDPIP", this,
|
||||||
&qTabAdvanced::GetDetectorUDPIP)
|
&qTabAdvanced::GetDetectorUDPIP)
|
||||||
@ -371,7 +372,7 @@ void qTabAdvanced::SetDetectorUDPMAC() {
|
|||||||
std::string s = dispDetectorUDPMAC->text().toAscii().constData();
|
std::string s = dispDetectorUDPMAC->text().toAscii().constData();
|
||||||
FILE_LOG(logINFO) << "Setting Detector UDP MAC:" << s;
|
FILE_LOG(logINFO) << "Setting Detector UDP MAC:" << s;
|
||||||
try {
|
try {
|
||||||
det->setSourceUDPMAC(s, {comboDetector->currentIndex()});
|
det->setSourceUDPMAC(sls::MacAddr{s}, {comboDetector->currentIndex()});
|
||||||
} CATCH_HANDLE ("Could not set Detector UDP MAC.",
|
} CATCH_HANDLE ("Could not set Detector UDP MAC.",
|
||||||
"qTabAdvanced::SetDetectorUDPMAC", this,
|
"qTabAdvanced::SetDetectorUDPMAC", this,
|
||||||
&qTabAdvanced::GetDetectorUDPMAC)
|
&qTabAdvanced::GetDetectorUDPMAC)
|
||||||
@ -390,7 +391,7 @@ void qTabAdvanced::SetCltZMQIP() {
|
|||||||
std::string s = dispZMQIP->text().toAscii().constData();
|
std::string s = dispZMQIP->text().toAscii().constData();
|
||||||
FILE_LOG(logINFO) << "Setting Client ZMQ IP:" << s;
|
FILE_LOG(logINFO) << "Setting Client ZMQ IP:" << s;
|
||||||
try {
|
try {
|
||||||
det->setClientZmqIp(s, {comboDetector->currentIndex()});
|
det->setClientZmqIp(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||||
} CATCH_HANDLE ("Could not set Client ZMQ IP.",
|
} CATCH_HANDLE ("Could not set Client ZMQ IP.",
|
||||||
"qTabAdvanced::SetCltZMQIP", this,
|
"qTabAdvanced::SetCltZMQIP", this,
|
||||||
&qTabAdvanced::GetCltZMQIP)
|
&qTabAdvanced::GetCltZMQIP)
|
||||||
@ -431,7 +432,7 @@ void qTabAdvanced::SetRxrUDPIP() {
|
|||||||
std::string s = dispRxrUDPIP->text().toAscii().constData();
|
std::string s = dispRxrUDPIP->text().toAscii().constData();
|
||||||
FILE_LOG(logINFO) << "Setting Receiver UDP IP:" << s;
|
FILE_LOG(logINFO) << "Setting Receiver UDP IP:" << s;
|
||||||
try {
|
try {
|
||||||
det->setDestinationUDPIP(s, {comboDetector->currentIndex()});
|
det->setDestinationUDPIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||||
} CATCH_HANDLE ("Could not set Receiver UDP IP.",
|
} CATCH_HANDLE ("Could not set Receiver UDP IP.",
|
||||||
"qTabAdvanced::SetRxrUDPIP", this,
|
"qTabAdvanced::SetRxrUDPIP", this,
|
||||||
&qTabAdvanced::GetRxrUDPIP)
|
&qTabAdvanced::GetRxrUDPIP)
|
||||||
@ -441,7 +442,7 @@ void qTabAdvanced::SetRxrUDPMAC() {
|
|||||||
std::string s = dispRxrUDPMAC->text().toAscii().constData();
|
std::string s = dispRxrUDPMAC->text().toAscii().constData();
|
||||||
FILE_LOG(logINFO) << "Setting Receiver UDP MAC:" << s;
|
FILE_LOG(logINFO) << "Setting Receiver UDP MAC:" << s;
|
||||||
try {
|
try {
|
||||||
det->setDestinationUDPMAC(s, {comboDetector->currentIndex()});
|
det->setDestinationUDPMAC(sls::MacAddr{s}, {comboDetector->currentIndex()});
|
||||||
} CATCH_HANDLE ("Could not set Receiver UDP MAC.",
|
} CATCH_HANDLE ("Could not set Receiver UDP MAC.",
|
||||||
"qTabAdvanced::SetRxrUDPMAC", this,
|
"qTabAdvanced::SetRxrUDPMAC", this,
|
||||||
&qTabAdvanced::GetRxrUDPMAC)
|
&qTabAdvanced::GetRxrUDPMAC)
|
||||||
@ -460,7 +461,7 @@ void qTabAdvanced::SetRxrZMQIP() {
|
|||||||
std::string s = dispRxrZMQIP->text().toAscii().constData();
|
std::string s = dispRxrZMQIP->text().toAscii().constData();
|
||||||
FILE_LOG(logINFO) << "Setting Receiver ZMQ IP:" << s;
|
FILE_LOG(logINFO) << "Setting Receiver ZMQ IP:" << s;
|
||||||
try {
|
try {
|
||||||
det->setRxZmqIP(s, {comboDetector->currentIndex()});
|
det->setRxZmqIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||||
} CATCH_HANDLE ("Could not set Receiver ZMQ IP.",
|
} CATCH_HANDLE ("Could not set Receiver ZMQ IP.",
|
||||||
"qTabAdvanced::SetRxrZMQIP", this,
|
"qTabAdvanced::SetRxrZMQIP", this,
|
||||||
&qTabAdvanced::GetRxrZMQIP)
|
&qTabAdvanced::GetRxrZMQIP)
|
||||||
|
@ -113,6 +113,26 @@ void qTabDeveloper::SetupWidgetWindow() {
|
|||||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vtrim: ", getSLSIndex(detType, tempid++)));
|
dacWidgets.push_back(new qDacWidget(this, det, true, "vtrim: ", getSLSIndex(detType, tempid++)));
|
||||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vdcsh: ", getSLSIndex(detType, tempid++)));
|
dacWidgets.push_back(new qDacWidget(this, det, true, "vdcsh: ", getSLSIndex(detType, tempid++)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case slsDetectorDefs::GOTTHARD2:
|
||||||
|
lblSpinHV->show();
|
||||||
|
spinHV->show();
|
||||||
|
hvmin = 0;
|
||||||
|
dacWidgets.push_back(new qDacWidget(this, det, true, "vref_h_adc: ", getSLSIndex(detType, tempid++)));
|
||||||
|
dacWidgets.push_back(new qDacWidget(this, det, true, "vb_comp_fe: ", getSLSIndex(detType, tempid++)));
|
||||||
|
dacWidgets.push_back(new qDacWidget(this, det, true, "vb_comp_adc: ", getSLSIndex(detType, tempid++)));
|
||||||
|
dacWidgets.push_back(new qDacWidget(this, det, true, "vcom_cds: ", getSLSIndex(detType, tempid++)));
|
||||||
|
dacWidgets.push_back(new qDacWidget(this, det, true, "vref_rstore: ", getSLSIndex(detType, tempid++)));
|
||||||
|
dacWidgets.push_back(new qDacWidget(this, det, true, "vb_opa_1st: ", getSLSIndex(detType, tempid++)));
|
||||||
|
dacWidgets.push_back(new qDacWidget(this, det, true, "vref_comp_fe: ", getSLSIndex(detType, tempid++)));
|
||||||
|
dacWidgets.push_back(new qDacWidget(this, det, true, "vcom_adc1: ", getSLSIndex(detType, tempid++)));
|
||||||
|
dacWidgets.push_back(new qDacWidget(this, det, true, "vref_prech: ", getSLSIndex(detType, tempid++)));
|
||||||
|
dacWidgets.push_back(new qDacWidget(this, det, true, "vref_l_adc: ", getSLSIndex(detType, tempid++)));
|
||||||
|
dacWidgets.push_back(new qDacWidget(this, det, true, "vref_cds: ", getSLSIndex(detType, tempid++)));
|
||||||
|
dacWidgets.push_back(new qDacWidget(this, det, true, "vb_cs: ", getSLSIndex(detType, tempid++)));
|
||||||
|
dacWidgets.push_back(new qDacWidget(this, det, true, "vb_opa_fd: ", getSLSIndex(detType, tempid++)));
|
||||||
|
dacWidgets.push_back(new qDacWidget(this, det, true, "vcom_adc2: ", getSLSIndex(detType, tempid++)));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -367,6 +387,41 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorTy
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case slsDetectorDefs::GOTTHARD2:
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
return slsDetectorDefs::VREF_H_ADC;
|
||||||
|
case 1:
|
||||||
|
return slsDetectorDefs::VB_COMP_FE;
|
||||||
|
case 2:
|
||||||
|
return slsDetectorDefs::VB_COMP_ADC;
|
||||||
|
case 3:
|
||||||
|
return slsDetectorDefs::VCOM_CDS;
|
||||||
|
case 4:
|
||||||
|
return slsDetectorDefs::VREF_RSTORE;
|
||||||
|
case 5:
|
||||||
|
return slsDetectorDefs::VB_OPA_1ST;
|
||||||
|
case 6:
|
||||||
|
return slsDetectorDefs::VREF_COMP_FE;
|
||||||
|
case 7:
|
||||||
|
return slsDetectorDefs::VCOM_ADC1;
|
||||||
|
case 8:
|
||||||
|
return slsDetectorDefs::VREF_PRECH;
|
||||||
|
case 9:
|
||||||
|
return slsDetectorDefs::VREF_L_ADC;
|
||||||
|
case 10:
|
||||||
|
return slsDetectorDefs::VREF_CDS;
|
||||||
|
case 11:
|
||||||
|
return slsDetectorDefs::VB_CS;
|
||||||
|
case 12:
|
||||||
|
return slsDetectorDefs::VB_OPA_FD;
|
||||||
|
case 13:
|
||||||
|
return slsDetectorDefs::VCOM_ADC2;
|
||||||
|
default:
|
||||||
|
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw sls::RuntimeError(std::string("Unknown detector type"));
|
throw sls::RuntimeError(std::string("Unknown detector type"));
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,7 @@ void qTabPlot::SetupWidgetWindow() {
|
|||||||
switch(det->getDetectorType().squash()) {
|
switch(det->getDetectorType().squash()) {
|
||||||
case slsDetectorDefs::GOTTHARD:
|
case slsDetectorDefs::GOTTHARD:
|
||||||
case slsDetectorDefs::MYTHEN3:
|
case slsDetectorDefs::MYTHEN3:
|
||||||
|
case slsDetectorDefs::GOTTHARD2:
|
||||||
is1d = true;
|
is1d = true;
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::EIGER:
|
case slsDetectorDefs::EIGER:
|
||||||
|
@ -83,6 +83,11 @@ void qTabSettings::SetupDetectorSettings() {
|
|||||||
item[(int)FORCESWITCHG1]->setEnabled(true);
|
item[(int)FORCESWITCHG1]->setEnabled(true);
|
||||||
item[(int)FORCESWITCHG2]->setEnabled(true);
|
item[(int)FORCESWITCHG2]->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
|
case slsDetectorDefs::GOTTHARD2:
|
||||||
|
item[(int)DYNAMICGAIN]->setEnabled(true);
|
||||||
|
item[(int)FIXGAIN1]->setEnabled(true);
|
||||||
|
item[(int)FIXGAIN2]->setEnabled(true);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
FILE_LOG(logDEBUG) << "Unknown detector type. Exiting GUI.";
|
FILE_LOG(logDEBUG) << "Unknown detector type. Exiting GUI.";
|
||||||
qDefs::Message(qDefs::CRITICAL,
|
qDefs::Message(qDefs::CRITICAL,
|
||||||
|
@ -15,7 +15,7 @@ add_executable(ctbDetectorServer_virtual
|
|||||||
../slsDetectorServer/src/INA226.c
|
../slsDetectorServer/src/INA226.c
|
||||||
../slsDetectorServer/src/LTC2620.c
|
../slsDetectorServer/src/LTC2620.c
|
||||||
../slsDetectorServer/src/MAX1932.c
|
../slsDetectorServer/src/MAX1932.c
|
||||||
../slsDetectorServer/src/programfpga.c
|
../slsDetectorServer/src/programFpgaBlackfin.c
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
@ -12,7 +12,7 @@ DESTDIR ?= bin
|
|||||||
INSTMODE = 0777
|
INSTMODE = 0777
|
||||||
|
|
||||||
SRCS = slsDetectorFunctionList.c
|
SRCS = slsDetectorFunctionList.c
|
||||||
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)communication_funcs_UDP.c $(main_src)UDPPacketHeaderGenerator.c $(main_src)AD7689.c $(main_src)AD9257.c $(main_src)ALTERA_PLL.c $(main_src)I2C.c $(main_src)INA226.c $(main_src)LTC2620.c $(main_src)MAX1932.c $(main_src)programfpga.c
|
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)communication_funcs_UDP.c $(main_src)UDPPacketHeaderGenerator.c $(main_src)AD7689.c $(main_src)AD9257.c $(main_src)ALTERA_PLL.c $(main_src)I2C.c $(main_src)INA226.c $(main_src)LTC2620.c $(main_src)MAX1932.c $(main_src)programFpgaBlackfin.c
|
||||||
|
|
||||||
OBJS = $(SRCS:.c=.o)
|
OBJS = $(SRCS:.c=.o)
|
||||||
|
|
||||||
|
Binary file not shown.
@ -12,9 +12,6 @@
|
|||||||
#include "INA226.h" // i2c
|
#include "INA226.h" // i2c
|
||||||
#include "ALTERA_PLL.h" // pll
|
#include "ALTERA_PLL.h" // pll
|
||||||
#include "blackfin.h"
|
#include "blackfin.h"
|
||||||
#ifndef VIRTUAL
|
|
||||||
#include "programfpga.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h> // usleep
|
#include <unistd.h> // usleep
|
||||||
@ -56,9 +53,9 @@ uint32_t adcEnableMask_1g = 0;
|
|||||||
uint8_t adcEnableMask_10g = 0;
|
uint8_t adcEnableMask_10g = 0;
|
||||||
|
|
||||||
|
|
||||||
int32_t clkPhase[NUM_CLOCKS] = {0, 0, 0, 0};
|
int32_t clkPhase[NUM_CLOCKS] = {};
|
||||||
uint32_t clkFrequency[NUM_CLOCKS] = {40, 20, 20, 200};
|
uint32_t clkFrequency[NUM_CLOCKS] = {40, 20, 20, 200};
|
||||||
int dacValues[NDAC] = {0};
|
int dacValues[NDAC] = {};
|
||||||
// software limit that depends on the current chip on the ctb
|
// software limit that depends on the current chip on the ctb
|
||||||
int vLimit = 0;
|
int vLimit = 0;
|
||||||
int highvoltage = 0;
|
int highvoltage = 0;
|
||||||
@ -1418,22 +1415,18 @@ int setHighVoltage(int val){
|
|||||||
|
|
||||||
|
|
||||||
void setTiming( enum timingMode arg){
|
void setTiming( enum timingMode arg){
|
||||||
|
switch(arg){
|
||||||
if(arg != GET_TIMING_MODE){
|
case AUTO_TIMING:
|
||||||
switch((int)arg){
|
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
||||||
case AUTO_TIMING:
|
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SIGNAL_MSK);
|
||||||
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
break;
|
||||||
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SIGNAL_MSK);
|
case TRIGGER_EXPOSURE:
|
||||||
break;
|
FILE_LOG(logINFO, ("Set Timing: Trigger\n"));
|
||||||
case TRIGGER_EXPOSURE:
|
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) | EXT_SIGNAL_MSK);
|
||||||
FILE_LOG(logINFO, ("Set Timing: Trigger\n"));
|
break;
|
||||||
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) | EXT_SIGNAL_MSK);
|
default:
|
||||||
break;
|
FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
||||||
default:
|
}
|
||||||
FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2559,7 +2552,7 @@ int calculateDataBytes(){
|
|||||||
return dataBytes;
|
return dataBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerChip() * (int)getNumberOfChips());}
|
int getTotalNumberOfChannels() {return (getNumberOfChannelsPerChip() * getNumberOfChips());}
|
||||||
int getNumberOfChips(){return NCHIP;}
|
int getNumberOfChips(){return NCHIP;}
|
||||||
int getNumberOfDACs(){return NDAC;}
|
int getNumberOfDACs(){return NDAC;}
|
||||||
int getNumberOfChannelsPerChip(){return NCHAN;}
|
int getNumberOfChannelsPerChip(){return NCHAN;}
|
||||||
|
Binary file not shown.
@ -1106,36 +1106,46 @@ int setHighVoltage(int val) {
|
|||||||
/* parameters - timing, extsig */
|
/* parameters - timing, extsig */
|
||||||
|
|
||||||
void setTiming( enum timingMode arg) {
|
void setTiming( enum timingMode arg) {
|
||||||
enum timingMode ret=GET_TIMING_MODE;
|
int ret = 0;
|
||||||
if (arg != GET_TIMING_MODE) {
|
switch(arg) {
|
||||||
switch((int)arg) {
|
case AUTO_TIMING:
|
||||||
case AUTO_TIMING: ret = 0; break;
|
ret = 0;
|
||||||
case TRIGGER_EXPOSURE: ret = 2; break;
|
break;
|
||||||
case BURST_TRIGGER: ret = 1; break;
|
case TRIGGER_EXPOSURE:
|
||||||
case GATED: ret = 3; break;
|
ret = 2;
|
||||||
}
|
break;
|
||||||
FILE_LOG(logDEBUG1, ("Setting Triggering Mode: %d\n", (int)ret));
|
case BURST_TRIGGER:
|
||||||
#ifndef VIRTUAL
|
ret = 1;
|
||||||
if (Feb_Control_SetTriggerMode(ret,1))
|
break;
|
||||||
#endif
|
case GATED:
|
||||||
eiger_triggermode = ret;
|
ret = 3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
FILE_LOG(logDEBUG1, ("Setting Triggering Mode: %d\n", (int)ret));
|
||||||
|
#ifndef VIRTUAL
|
||||||
|
if (Feb_Control_SetTriggerMode(ret,1))
|
||||||
|
#endif
|
||||||
|
eiger_triggermode = ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
enum timingMode getTiming() {
|
enum timingMode getTiming() {
|
||||||
enum timingMode ret = GET_TIMING_MODE;
|
switch(eiger_triggermode) {
|
||||||
ret = eiger_triggermode;
|
case 0:
|
||||||
switch((int)ret) {
|
return AUTO_TIMING;
|
||||||
case 0: ret = AUTO_TIMING; break;
|
case 2:
|
||||||
case 2: ret = TRIGGER_EXPOSURE; break;
|
return TRIGGER_EXPOSURE;
|
||||||
case 1: ret = BURST_TRIGGER; break;
|
case 1:
|
||||||
case 3: ret = GATED; break;
|
return BURST_TRIGGER;
|
||||||
|
case 3:
|
||||||
|
return GATED;
|
||||||
default:
|
default:
|
||||||
FILE_LOG(logERROR, ("Unknown trigger mode found %d\n", ret));
|
FILE_LOG(logERROR, ("Unknown trigger mode found %d\n", eiger_triggermode));
|
||||||
ret = 0;
|
return GET_TIMING_MODE;
|
||||||
}
|
}
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2041,7 +2051,7 @@ int calculateDataBytes() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int getTotalNumberOfChannels() {return ((int)getNumberOfChannelsPerChip() * (int)getNumberOfChips());}
|
int getTotalNumberOfChannels() {return (getNumberOfChannelsPerChip() * getNumberOfChips());}
|
||||||
int getNumberOfChips() {return NCHIP;}
|
int getNumberOfChips() {return NCHIP;}
|
||||||
int getNumberOfDACs() {return NDAC;}
|
int getNumberOfDACs() {return NDAC;}
|
||||||
int getNumberOfChannelsPerChip() {return NCHAN;}
|
int getNumberOfChannelsPerChip() {return NCHAN;}
|
||||||
|
@ -19,7 +19,7 @@ enum DACINDEX {E_SVP,E_VTR,E_VRF,E_VRS,E_SVN,E_VTGSTV,E_VCMP_LL,E_VCMP_L
|
|||||||
2556, /* Vtgstv */ \
|
2556, /* Vtgstv */ \
|
||||||
1000, /* Vcmp_ll */ \
|
1000, /* Vcmp_ll */ \
|
||||||
1000, /* Vcmp_lr */ \
|
1000, /* Vcmp_lr */ \
|
||||||
4000, /* cal */ \
|
0, /* cal */ \
|
||||||
1000, /* Vcmp_rl */ \
|
1000, /* Vcmp_rl */ \
|
||||||
1100, /* rxb_rb */ \
|
1100, /* rxb_rb */ \
|
||||||
1100, /* rxb_lb */ \
|
1100, /* rxb_lb */ \
|
||||||
|
@ -10,6 +10,7 @@ add_executable(gotthard2DetectorServer_virtual
|
|||||||
../slsDetectorServer/src/LTC2620_Driver.c
|
../slsDetectorServer/src/LTC2620_Driver.c
|
||||||
../slsDetectorServer/src/ALTERA_PLL_CYCLONE10.c
|
../slsDetectorServer/src/ALTERA_PLL_CYCLONE10.c
|
||||||
../slsDetectorServer/src/ASIC_Driver.c
|
../slsDetectorServer/src/ASIC_Driver.c
|
||||||
|
../slsDetectorServer/src/programFpgaNios.c
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
@ -22,7 +23,7 @@ target_include_directories(gotthard2DetectorServer_virtual
|
|||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(gotthard2DetectorServer_virtual
|
target_compile_definitions(gotthard2DetectorServer_virtual
|
||||||
PUBLIC GOTTHARD2D VIRTUAL STOP_SERVER
|
PUBLIC GOTTHARD2D VIRTUAL STOP_SERVER DEBUG1
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(gotthard2DetectorServer_virtual
|
target_link_libraries(gotthard2DetectorServer_virtual
|
||||||
|
@ -12,7 +12,7 @@ DESTDIR ?= bin
|
|||||||
INSTMODE = 0777
|
INSTMODE = 0777
|
||||||
|
|
||||||
SRCS = slsDetectorFunctionList.c
|
SRCS = slsDetectorFunctionList.c
|
||||||
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)nios.c $(main_src)common.c $(main_src)DAC6571.c $(main_src)LTC2620_Driver.c $(main_src)ALTERA_PLL_CYCLONE10.c $(main_src)ASIC_Driver.c
|
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)nios.c $(main_src)common.c $(main_src)DAC6571.c $(main_src)LTC2620_Driver.c $(main_src)ALTERA_PLL_CYCLONE10.c $(main_src)ASIC_Driver.c $(main_src)/programFpgaNios.c
|
||||||
|
|
||||||
OBJS = $(SRCS:.c=.o)
|
OBJS = $(SRCS:.c=.o)
|
||||||
|
|
||||||
|
@ -14,13 +14,33 @@
|
|||||||
|
|
||||||
/* Base addresses 0x1806 0000 ---------------------------------------------*/
|
/* Base addresses 0x1806 0000 ---------------------------------------------*/
|
||||||
/* General purpose control and status registers */
|
/* General purpose control and status registers */
|
||||||
#define BASE_CONTROL (0x0000)
|
#define BASE_CONTROL (0x0000) // 0x1806_0000 - 0x1806_00FF
|
||||||
/* Acquisition? TODO */
|
// https://git.psi.ch/sls_detectors_firmware/gotthard_II_mcb/blob/master/code/hdl/ctrl/ctrl.vhd
|
||||||
#define BASE_ACQUISITION (0x0200)
|
|
||||||
|
/* ASIC Control */
|
||||||
|
#define BASE_ASIC (0x0100) // 0x1806_0100 - 0x1806_011F
|
||||||
|
// https://git.psi.ch/sls_detectors_firmware/gotthard_II_mcb/blob/master/code/hdl/asic/asic_ctrl.vhd
|
||||||
|
|
||||||
|
/* ASIC Digital Interface. Data recovery core */
|
||||||
|
#define BASE_ADIF (0x0120) // 0x1806_0120 - 0x1806_012F
|
||||||
|
// https://git.psi.ch/sls_detectors_firmware/gotthard_II_mcb/blob/master/code/hdl/adif/adif_ctrl.vhd
|
||||||
|
|
||||||
|
/* Formatting of data core */
|
||||||
|
#define BASE_FMT (0x0130) // 0x1806_0130 - 0x1806_013F
|
||||||
|
|
||||||
|
/* Packetizer */
|
||||||
|
#define BASE_PKT (0x0140) // 0x1806_0140 - 0x1806_014F
|
||||||
|
// https://git.psi.ch/sls_detectors_firmware/gotthard_II_mcb/blob/master/code/hdl/pkt/pkt_ctrl.vhd
|
||||||
|
|
||||||
|
/* Flow control and status registers */
|
||||||
|
#define BASE_FLOW_CONTROL (0x00200) // 0x1806_0200 - 0x1806_02FF
|
||||||
|
// https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/f37608230b4721661f29aacc20124555705ee705/flow/flow_ctrl.vhd
|
||||||
|
|
||||||
/* UDP datagram generator */
|
/* UDP datagram generator */
|
||||||
#define BASE_UDP_RAM (0x01000) // 0x1806_1000 - 0x1806_1FFF
|
#define BASE_UDP_RAM (0x01000) // 0x1806_1000 - 0x1806_1FFF
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Clock Generation registers ------------------------------------------------------*/
|
/* Clock Generation registers ------------------------------------------------------*/
|
||||||
#define PLL_RESET_REG (0x00 * REG_OFFSET + BASE_CLK_GENERATION)
|
#define PLL_RESET_REG (0x00 * REG_OFFSET + BASE_CLK_GENERATION)
|
||||||
|
|
||||||
@ -30,6 +50,7 @@
|
|||||||
#define PLL_RESET_SYSTEM_MSK (0x00000001 << PLL_RESET_SYSTEM_OFST)
|
#define PLL_RESET_SYSTEM_MSK (0x00000001 << PLL_RESET_SYSTEM_OFST)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Control registers --------------------------------------------------*/
|
/* Control registers --------------------------------------------------*/
|
||||||
|
|
||||||
/* Module Control Board Serial Number register */
|
/* Module Control Board Serial Number register */
|
||||||
@ -61,11 +82,6 @@
|
|||||||
/* Status register */
|
/* Status register */
|
||||||
#define STATUS_REG (0x04 * REG_OFFSET + BASE_CONTROL)
|
#define STATUS_REG (0x04 * REG_OFFSET + BASE_CONTROL)
|
||||||
|
|
||||||
#ifdef VIRTUAL
|
|
||||||
#define RUN_BUSY_OFST (0)
|
|
||||||
#define RUN_BUSY_MSK (0x00000001 << RUN_BUSY_OFST)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Look at me read only register */
|
/* Look at me read only register */
|
||||||
#define LOOK_AT_ME_REG (0x05 * REG_OFFSET + BASE_CONTROL)
|
#define LOOK_AT_ME_REG (0x05 * REG_OFFSET + BASE_CONTROL)
|
||||||
|
|
||||||
@ -88,43 +104,144 @@
|
|||||||
#define CONTROL_PRPHRL_RST_MSK (0x00000001 << CONTROL_PRPHRL_RST_OFST)
|
#define CONTROL_PRPHRL_RST_MSK (0x00000001 << CONTROL_PRPHRL_RST_OFST)
|
||||||
#define CONTROL_CLR_ACQSTN_FIFO_OFST (15)
|
#define CONTROL_CLR_ACQSTN_FIFO_OFST (15)
|
||||||
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
|
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
|
||||||
|
#define CONTROL_PWR_CHIP_OFST (31)
|
||||||
/* Pattern IO Control 64 bit register */
|
#define CONTROL_PWR_CHIP_MSK (0x00000001 << CONTROL_PWR_CHIP_OFST)
|
||||||
#define PATTERN_IO_CTRL_LSB_REG (0x22 * REG_OFFSET + BASE_CONTROL)
|
|
||||||
#define PATTERN_IO_CTRL_MSB_REG (0x23 * REG_OFFSET + BASE_CONTROL)
|
|
||||||
|
|
||||||
/** DTA Offset Register */
|
/** DTA Offset Register */
|
||||||
#define DTA_OFFSET_REG (0x24 * REG_OFFSET + BASE_CONTROL)
|
#define DTA_OFFSET_REG (0x24 * REG_OFFSET + BASE_CONTROL)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ASIC registers --------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ASIC Config register */
|
||||||
|
#define ASIC_CONFIG_REG (0x00 * REG_OFFSET + BASE_ASIC)
|
||||||
|
|
||||||
|
#define ASIC_CONFIG_RUN_MODE_OFST (0)
|
||||||
|
#define ASIC_CONFIG_RUN_MODE_MSK (0x00000003 << ASIC_CONFIG_RUN_MODE_OFST)
|
||||||
|
#define ASIC_CONFIG_RUN_MODE_INT_BURST_VAL ((0x1 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
||||||
|
#define ASIC_CONFIG_RUN_MODE_CONT_VAL ((0x2 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
||||||
|
#define ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL ((0x3 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
||||||
|
#define ASIC_CONFIG_GAIN_OFST (4)
|
||||||
|
#define ASIC_CONFIG_GAIN_MSK (0x00000003 << ASIC_CONFIG_GAIN_OFST)
|
||||||
|
#define ASIC_CONFIG_DYNAMIC_GAIN_VAL ((0x0 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||||
|
#define ASIC_CONFIG_FIX_GAIN_1_VAL ((0x1 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||||
|
#define ASIC_CONFIG_FIX_GAIN_2_VAL ((0x2 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||||
|
#define ASIC_CONFIG_RESERVED_VAL ((0x3 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||||
|
#define ASIC_CONFIG_RST_DAC_OFST (15)
|
||||||
|
#define ASIC_CONFIG_RST_DAC_MSK (0x00000001 << ASIC_CONFIG_RST_DAC_OFST)
|
||||||
|
#define ASIC_CONFIG_DONE_OFST (31)
|
||||||
|
#define ASIC_CONFIG_DONE_MSK (0x00000001 << ASIC_CONFIG_DONE_OFST)
|
||||||
|
|
||||||
|
/* ASIC Internal Frames Register */
|
||||||
|
#define ASIC_INT_FRAMES_REG (0x01 * REG_OFFSET + BASE_ASIC)
|
||||||
|
|
||||||
|
#define ASIC_INT_FRAMES_OFST (0)
|
||||||
|
#define ASIC_INT_FRAMES_MSK (0x00000FFF << ASIC_INT_FRAMES_OFST)
|
||||||
|
|
||||||
|
/* ASIC Period 64bit Register */
|
||||||
|
#define ASIC_INT_PERIOD_LSB_REG (0x02 * REG_OFFSET + BASE_ASIC)
|
||||||
|
#define ASIC_INT_PERIOD_MSB_REG (0x03 * REG_OFFSET + BASE_ASIC)
|
||||||
|
|
||||||
|
/* ASIC Exptime 64bit Register */
|
||||||
|
#define ASIC_INT_EXPTIME_LSB_REG (0x04 * REG_OFFSET + BASE_ASIC)
|
||||||
|
#define ASIC_INT_EXPTIME_MSB_REG (0x05 * REG_OFFSET + BASE_ASIC)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Packetizer -------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Packetizer Config Register */
|
||||||
|
#define PKT_CONFIG_REG (0x00 * REG_OFFSET + BASE_PKT)
|
||||||
|
|
||||||
|
#define PKT_CONFIG_NRXR_MAX_OFST (0)
|
||||||
|
#define PKT_CONFIG_NRXR_MAX_MSK (0x0000003F << PKT_CONFIG_NRXR_MAX_OFST)
|
||||||
|
#define PKT_CONFIG_RXR_START_ID_OFST (8)
|
||||||
|
#define PKT_CONFIG_RXR_START_ID_MSK (0x0000003F << PKT_CONFIG_RXR_START_ID_OFST)
|
||||||
|
|
||||||
|
/* Module Coordinates Register */
|
||||||
|
#define COORD_0_REG (0x02 * REG_OFFSET + BASE_PKT)
|
||||||
|
#define COORD_ROW_OFST (0)
|
||||||
|
#define COORD_ROW_MSK (0x0000FFFF << COORD_ROW_OFST)
|
||||||
|
#define COORD_COL_OFST (16)
|
||||||
|
#define COORD_COL_MSK (0x0000FFFF << COORD_COL_OFST)
|
||||||
|
|
||||||
|
/* Module ID Register */
|
||||||
|
#define COORD_1_REG (0x03 * REG_OFFSET + BASE_PKT)
|
||||||
|
#define COORD_RESERVED_OFST (0)
|
||||||
|
#define COORD_RESERVED_MSK (0x0000FFFF << COORD_RESERVED_OFST)
|
||||||
|
#define COORD_ID_OFST (16) // Not connected in firmware TODO
|
||||||
|
#define COORD_ID_MSK (0x0000FFFF << COORD_ID_OFST) // Not connected in firmware TODO
|
||||||
|
|
||||||
|
|
||||||
|
/* Flow control registers --------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Flow status Register*/
|
||||||
|
#define FLOW_STATUS_REG (0x00 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
|
#define FLOW_STATUS_RUN_BUSY_OFST (0)
|
||||||
|
#define FLOW_STATUS_RUN_BUSY_MSK (0x00000001 << FLOW_STATUS_RUN_BUSY_OFST)
|
||||||
|
#define FLOW_STATUS_WAIT_FOR_TRGGR_OFST (3)
|
||||||
|
#define FLOW_STATUS_WAIT_FOR_TRGGR_MSK (0x00000001 << FLOW_STATUS_WAIT_FOR_TRGGR_OFST)
|
||||||
|
#define FLOW_STATUS_DLY_BFRE_TRGGR_OFST (4)
|
||||||
|
#define FLOW_STATUS_DLY_BFRE_TRGGR_MSK (0x00000001 << FLOW_STATUS_DLY_BFRE_TRGGR_OFST)
|
||||||
|
#define FLOW_STATUS_FIFO_FULL_OFST (5)
|
||||||
|
#define FLOW_STATUS_FIFO_FULL_MSK (0x00000001 << FLOW_STATUS_FIFO_FULL_OFST)
|
||||||
|
#define FLOW_STATUS_DLY_AFTR_TRGGR_OFST (15)
|
||||||
|
#define FLOW_STATUS_DLY_AFTR_TRGGR_MSK (0x00000001 << FLOW_STATUS_DLY_AFTR_TRGGR_OFST)
|
||||||
|
#define FLOW_STATUS_CSM_BUSY_OFST (17)
|
||||||
|
#define FLOW_STATUS_CSM_BUSY_MSK (0x00000001 << FLOW_STATUS_CSM_BUSY_OFST)
|
||||||
|
|
||||||
|
/* Delay left 64bit Register */
|
||||||
|
#define GET_DELAY_LSB_REG (0x02 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
#define GET_DELAY_MSB_REG (0x03 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
/* Acquisition registers --------------------------------------------------*/
|
|
||||||
//TODO
|
|
||||||
/* Triggers left 64bit Register */
|
/* Triggers left 64bit Register */
|
||||||
#define GET_CYCLES_LSB_REG (0x10 + BASE_ACQUISITION)
|
#define GET_CYCLES_LSB_REG (0x04 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
#define GET_CYCLES_MSB_REG (0x14 + BASE_ACQUISITION)
|
#define GET_CYCLES_MSB_REG (0x05 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
/* Frames left 64bit Register */
|
/* Frames left 64bit Register */
|
||||||
#define GET_FRAMES_LSB_REG (0x18 + BASE_ACQUISITION)
|
#define GET_FRAMES_LSB_REG (0x06 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
#define GET_FRAMES_MSB_REG (0x1C + BASE_ACQUISITION)
|
#define GET_FRAMES_MSB_REG (0x07 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
|
/* Period left 64bit Register */
|
||||||
|
#define GET_PERIOD_LSB_REG (0x08 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
#define GET_PERIOD_MSB_REG (0x09 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
|
/* Time from Start 64 bit register */
|
||||||
|
#define TIME_FROM_START_LSB_REG (0x0A * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
#define TIME_FROM_START_MSB_REG (0x0B * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
|
/* Get Frames from Start 64 bit register (frames from last reset using CONTROL_CRST) */
|
||||||
|
#define FRAMES_FROM_START_LSB_REG (0x0C * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
#define FRAMES_FROM_START_MSB_REG (0x0D * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
|
/* Measurement Time 64 bit register (timestamp at a frame start until reset)*/
|
||||||
|
#define START_FRAME_TIME_LSB_REG (0x0E * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
#define START_FRAME_TIME_MSB_REG (0x0F * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
/* Delay 64bit Write-register */
|
/* Delay 64bit Write-register */
|
||||||
#define SET_DELAY_LSB_REG (0x88 + BASE_ACQUISITION)
|
#define SET_DELAY_LSB_REG (0x22 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
#define SET_DELAY_MSB_REG (0x8C + BASE_ACQUISITION)
|
#define SET_DELAY_MSB_REG (0x23 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
/* Cylces 64bit Write-register */
|
/* Cylces 64bit Write-register */
|
||||||
#define SET_CYCLES_LSB_REG (0x90 + BASE_ACQUISITION)
|
#define SET_CYCLES_LSB_REG (0x24 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
#define SET_CYCLES_MSB_REG (0x94 + BASE_ACQUISITION)
|
#define SET_CYCLES_MSB_REG (0x25 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
/* Frames 64bit Write-register */
|
/* Frames 64bit Write-register */
|
||||||
#define SET_FRAMES_LSB_REG (0x98 + BASE_ACQUISITION)
|
#define SET_FRAMES_LSB_REG (0x26 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
#define SET_FRAMES_MSB_REG (0x9C + BASE_ACQUISITION)
|
#define SET_FRAMES_MSB_REG (0x27 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
/* Period 64bit Write-register */
|
/* Period 64bit Write-register */
|
||||||
#define SET_PERIOD_LSB_REG (0xA0 + BASE_ACQUISITION)
|
#define SET_PERIOD_LSB_REG (0x28 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
#define SET_PERIOD_MSB_REG (0xA4 + BASE_ACQUISITION)
|
#define SET_PERIOD_MSB_REG (0x29 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
/* Exptime 64bit Write-register */
|
/* External Signal register */
|
||||||
#define SET_EXPTIME_LSB_REG (0xA8 + BASE_ACQUISITION)
|
#define EXT_SIGNAL_REG (0x30 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
#define SET_EXPTIME_MSB_REG (0xBC + BASE_ACQUISITION)
|
|
||||||
|
#define EXT_SIGNAL_OFST (0)
|
||||||
|
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
|
||||||
|
|
||||||
|
/* Trigger Delay 64 bit register */
|
||||||
|
#define SET_TRIGGER_DELAY_LSB_REG (0x32 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
#define SET_TRIGGER_DELAY_MSB_REG (0x33 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
Binary file not shown.
@ -11,7 +11,7 @@ vref_h_adc 2099
|
|||||||
vb_comp_fe 0
|
vb_comp_fe 0
|
||||||
vb_comp_adc 0
|
vb_comp_adc 0
|
||||||
vcom_cds 1400
|
vcom_cds 1400
|
||||||
vref_restore 640
|
vref_rstore 640
|
||||||
vb_opa_1st 0
|
vb_opa_1st 0
|
||||||
vref_comp_fe 0
|
vref_comp_fe 0
|
||||||
vcom_adc1 1400
|
vcom_adc1 1400
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -17,22 +17,29 @@
|
|||||||
#define HV_DRIVER_FILE_NAME ("/etc/devlinks/hvdac")
|
#define HV_DRIVER_FILE_NAME ("/etc/devlinks/hvdac")
|
||||||
#define DAC_DRIVER_FILE_NAME ("/etc/devlinks/dac")
|
#define DAC_DRIVER_FILE_NAME ("/etc/devlinks/dac")
|
||||||
#define ONCHIP_DAC_DRIVER_FILE_NAME ("/etc/devlinks/chipdac")
|
#define ONCHIP_DAC_DRIVER_FILE_NAME ("/etc/devlinks/chipdac")
|
||||||
|
#define TYPE_FILE_NAME ("/etc/devlinks/type")
|
||||||
#define CONFIG_FILE ("config.txt")
|
#define CONFIG_FILE ("config.txt")
|
||||||
#define DAC_MAX_MV (2048)
|
#define DAC_MAX_MV (2048)
|
||||||
#define ONCHIP_DAC_MAX_VAL (0x3FF)
|
#define ONCHIP_DAC_MAX_VAL (0x3FF)
|
||||||
#define ADU_MAX_VAL (0xFFF)
|
#define ADU_MAX_VAL (0xFFF)
|
||||||
#define ADU_MAX_BITS (12)
|
#define ADU_MAX_BITS (12)
|
||||||
#define MAX_FRAMES_IN_BURST_MODE (2720)
|
#define MAX_FRAMES_IN_BURST_MODE (2720)
|
||||||
|
#define TYPE_GOTTHARD2_MODULE_VAL (512)
|
||||||
|
#define TYPE_TOLERANCE (10)
|
||||||
|
#define TYPE_NO_MODULE_STARTING_VAL (800)
|
||||||
|
|
||||||
/** Default Parameters */
|
/** Default Parameters */
|
||||||
|
#define DEFAULT_BURST_MODE (BURST_INTERNAL)
|
||||||
#define DEFAULT_NUM_FRAMES (1)
|
#define DEFAULT_NUM_FRAMES (1)
|
||||||
#define DEFAULT_NUM_CYCLES (1)
|
#define DEFAULT_NUM_CYCLES (1)
|
||||||
#define DEFAULT_EXPTIME (1 * 1000 * 1000) // 1 ms
|
#define DEFAULT_EXPTIME (0) // 0 ms (220ns in firmware)
|
||||||
#define DEFAULT_PERIOD (1 * 1000 * 1000 * 1000) // 1 s
|
#define DEFAULT_PERIOD (1 * 1000) // 1 ms
|
||||||
|
#define DEFAULT_DELAY_AFTER_TRIGGER (0)
|
||||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||||
|
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||||
|
#define DEFAULT_SETTINGS (DYNAMICGAIN)
|
||||||
#define DEFAULT_READOUT_C0 (144444448) // rdo_clk, 144 MHz
|
#define DEFAULT_READOUT_C0 (144444448) // rdo_clk, 144 MHz
|
||||||
#define DEFAULT_READOUT_C1 (288888896) // rdo_x2_clk, 288 MHz
|
#define DEFAULT_READOUT_C1 (144444448) // rdo_x2_clk, 144 MHz
|
||||||
#define DEFAULT_SYSTEM_C0 (144444448) // run_clk, 144 MHz
|
#define DEFAULT_SYSTEM_C0 (144444448) // run_clk, 144 MHz
|
||||||
#define DEFAULT_SYSTEM_C1 (72222224) // chip_clk, 72 MHz
|
#define DEFAULT_SYSTEM_C1 (72222224) // chip_clk, 72 MHz
|
||||||
#define DEFAULT_SYSTEM_C2 (18055556) // sync_clk, 18 MHz
|
#define DEFAULT_SYSTEM_C2 (18055556) // sync_clk, 18 MHz
|
||||||
@ -40,6 +47,7 @@
|
|||||||
|
|
||||||
/* Firmware Definitions */
|
/* Firmware Definitions */
|
||||||
#define IP_HEADER_SIZE (20)
|
#define IP_HEADER_SIZE (20)
|
||||||
|
#define FIXED_PLL_FREQUENCY (020000000) // 20MHz
|
||||||
#define READOUT_PLL_VCO_FREQ_HZ (866666688) // Hz
|
#define READOUT_PLL_VCO_FREQ_HZ (866666688) // Hz
|
||||||
#define SYSTEM_PLL_VCO_FREQ_HZ (722222240) // Hz
|
#define SYSTEM_PLL_VCO_FREQ_HZ (722222240) // Hz
|
||||||
|
|
||||||
@ -52,7 +60,7 @@ enum DACINDEX {G2_VREF_H_ADC, /* 0 */ \
|
|||||||
G2_VB_COMP_FE, /* 2 */ \
|
G2_VB_COMP_FE, /* 2 */ \
|
||||||
G2_VB_COMP_ADC, /* 3 */ \
|
G2_VB_COMP_ADC, /* 3 */ \
|
||||||
G2_VCOM_CDS, /* 4 */ \
|
G2_VCOM_CDS, /* 4 */ \
|
||||||
G2_VREF_RESTORE,/* 5 */ \
|
G2_VREF_RSTORE,/* 5 */ \
|
||||||
G2_VB_OPA_1ST, /* 6 */ \
|
G2_VB_OPA_1ST, /* 6 */ \
|
||||||
G2_VREF_COMP_FE,/* 7 */ \
|
G2_VREF_COMP_FE,/* 7 */ \
|
||||||
G2_VCOM_ADC1, /* 8 */ \
|
G2_VCOM_ADC1, /* 8 */ \
|
||||||
@ -64,7 +72,7 @@ enum DACINDEX {G2_VREF_H_ADC, /* 0 */ \
|
|||||||
G2_DAC_UNUSED2, /* 14 */ \
|
G2_DAC_UNUSED2, /* 14 */ \
|
||||||
G2_VCOM_ADC2 /* 15*/ \
|
G2_VCOM_ADC2 /* 15*/ \
|
||||||
};
|
};
|
||||||
#define DAC_NAMES "vref_h_adc", "dac_unused", "vb_comp_fe", "vb_comp_adc", "vcom_cds", "vref_restore", "vb_opa_1st", "vref_comp_fe", "vcom_adc1", "vref_prech", "vref_l_adc", "vref_cds", "vb_cs", "vb_opa_fd", "dac_unused2", "vcom_adc2"
|
#define DAC_NAMES "vref_h_adc", "dac_unused", "vb_comp_fe", "vb_comp_adc", "vcom_cds", "vref_rstore", "vb_opa_1st", "vref_comp_fe", "vcom_adc1", "vref_prech", "vref_l_adc", "vref_cds", "vb_cs", "vb_opa_fd", "dac_unused2", "vcom_adc2"
|
||||||
|
|
||||||
enum ONCHIP_DACINDEX {G2_VCHIP_COMP_FE, /* 0 */ \
|
enum ONCHIP_DACINDEX {G2_VCHIP_COMP_FE, /* 0 */ \
|
||||||
G2_VCHIP_OPA_1ST, /* 1 */ \
|
G2_VCHIP_OPA_1ST, /* 1 */ \
|
||||||
|
Binary file not shown.
@ -30,10 +30,10 @@ int virtual_status = 0;
|
|||||||
int virtual_stop = 0;
|
int virtual_stop = 0;
|
||||||
int highvoltage = 0;
|
int highvoltage = 0;
|
||||||
#endif
|
#endif
|
||||||
int detPos[2] = {0, 0};
|
int detPos[2] = {};
|
||||||
|
|
||||||
int detectorFirstServer = 1;
|
int detectorFirstServer = 1;
|
||||||
int dacValues[NDAC] = {0};
|
int dacValues[NDAC] = {};
|
||||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||||
enum externalSignalFlag signalMode = 0;
|
enum externalSignalFlag signalMode = 0;
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ int checkType() {
|
|||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
volatile u_int32_t type = ((bus_r(BOARD_REVISION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST);
|
u_int32_t type = ((bus_r(BOARD_REVISION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST);
|
||||||
if (type == DETECTOR_TYPE_MOENCH_VAL){
|
if (type == DETECTOR_TYPE_MOENCH_VAL){
|
||||||
FILE_LOG(logERROR, ("This is not a Gotthard Server (read %d, expected ?)\n", type));
|
FILE_LOG(logERROR, ("This is not a Gotthard Server (read %d, expected ?)\n", type));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -1178,27 +1178,23 @@ int setHighVoltage(int val){
|
|||||||
|
|
||||||
void setTiming( enum timingMode arg){
|
void setTiming( enum timingMode arg){
|
||||||
u_int32_t addr = EXT_SIGNAL_REG;
|
u_int32_t addr = EXT_SIGNAL_REG;
|
||||||
|
switch(arg) {
|
||||||
if (arg != GET_TIMING_MODE){
|
case AUTO_TIMING:
|
||||||
switch((int)arg){
|
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
||||||
case AUTO_TIMING:
|
bus_w(addr, EXT_SIGNAL_OFF_VAL);
|
||||||
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
break;
|
||||||
bus_w(addr, EXT_SIGNAL_OFF_VAL);
|
case TRIGGER_EXPOSURE:
|
||||||
break;
|
if (signalMode == TRIGGER_IN_FALLING_EDGE) {
|
||||||
case TRIGGER_EXPOSURE:
|
FILE_LOG(logINFO, ("Set Timing: Trigger (Falling Edge)\n"));
|
||||||
if (signalMode == TRIGGER_IN_FALLING_EDGE) {
|
bus_w(addr, EXT_SIGNAL_TRGGR_IN_FLLNG_VAL);
|
||||||
FILE_LOG(logINFO, ("Set Timing: Trigger (Falling Edge)\n"));
|
} else {
|
||||||
bus_w(addr, EXT_SIGNAL_TRGGR_IN_FLLNG_VAL);
|
FILE_LOG(logINFO, ("Set Timing: Trigger (Rising Edge)\n"));
|
||||||
} else {
|
bus_w(addr, EXT_SIGNAL_TRGGR_IN_RSNG_VAL);
|
||||||
FILE_LOG(logINFO, ("Set Timing: Trigger (Rising Edge)\n"));
|
}
|
||||||
bus_w(addr, EXT_SIGNAL_TRGGR_IN_RSNG_VAL);
|
break;
|
||||||
}
|
default:
|
||||||
break;
|
FILE_LOG(logERROR, ("Unknown timing mode %d for this detector\n", (int)arg));
|
||||||
default:
|
}
|
||||||
FILE_LOG(logERROR, ("Unknown timing mode %d for this detector\n", (int)arg));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum timingMode getTiming() {
|
enum timingMode getTiming() {
|
||||||
@ -1680,7 +1676,7 @@ int calculateDataBytes(){
|
|||||||
return DATA_BYTES;
|
return DATA_BYTES;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerChip() * (int)getNumberOfChips());}
|
int getTotalNumberOfChannels() {return (getNumberOfChannelsPerChip() * getNumberOfChips());}
|
||||||
int getNumberOfChips(){return NCHIP;}
|
int getNumberOfChips(){return NCHIP;}
|
||||||
int getNumberOfDACs(){return NDAC;}
|
int getNumberOfDACs(){return NDAC;}
|
||||||
int getNumberOfChannelsPerChip(){return NCHAN;}
|
int getNumberOfChannelsPerChip(){return NCHAN;}
|
||||||
|
@ -10,7 +10,7 @@ add_executable(jungfrauDetectorServer_virtual
|
|||||||
../slsDetectorServer/src/ALTERA_PLL.c
|
../slsDetectorServer/src/ALTERA_PLL.c
|
||||||
../slsDetectorServer/src/LTC2620.c
|
../slsDetectorServer/src/LTC2620.c
|
||||||
../slsDetectorServer/src/MAX1932.c
|
../slsDetectorServer/src/MAX1932.c
|
||||||
../slsDetectorServer/src/programfpga.c
|
../slsDetectorServer/src/programFpgaBlackfin.c
|
||||||
../slsDetectorServer/src/communication_funcs_UDP.c
|
../slsDetectorServer/src/communication_funcs_UDP.c
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ target_compile_definitions(jungfrauDetectorServer_virtual
|
|||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(jungfrauDetectorServer_virtual
|
target_link_libraries(jungfrauDetectorServer_virtual
|
||||||
PUBLIC pthread rt
|
PUBLIC pthread rt slsProjectOptions slsProjectWarnings
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(jungfrauDetectorServer_virtual PROPERTIES
|
set_target_properties(jungfrauDetectorServer_virtual PROPERTIES
|
||||||
|
@ -12,7 +12,7 @@ DESTDIR ?= bin
|
|||||||
INSTMODE = 0777
|
INSTMODE = 0777
|
||||||
|
|
||||||
SRCS = slsDetectorFunctionList.c
|
SRCS = slsDetectorFunctionList.c
|
||||||
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)AD9257.c $(main_src)ALTERA_PLL.c $(main_src)LTC2620.c $(main_src)MAX1932.c $(main_src)programfpga.c
|
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)AD9257.c $(main_src)ALTERA_PLL.c $(main_src)LTC2620.c $(main_src)MAX1932.c $(main_src)programFpgaBlackfin.c
|
||||||
|
|
||||||
OBJS = $(SRCS:.c=.o)
|
OBJS = $(SRCS:.c=.o)
|
||||||
|
|
||||||
|
Binary file not shown.
@ -8,9 +8,7 @@
|
|||||||
#include "ALTERA_PLL.h" // pll
|
#include "ALTERA_PLL.h" // pll
|
||||||
#include "blackfin.h"
|
#include "blackfin.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#ifndef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
#include "programfpga.h"
|
|
||||||
#else
|
|
||||||
#include "communication_funcs_UDP.h"
|
#include "communication_funcs_UDP.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -24,6 +22,7 @@
|
|||||||
// Global variable from slsDetectorServer_funcs
|
// Global variable from slsDetectorServer_funcs
|
||||||
extern int debugflag;
|
extern int debugflag;
|
||||||
extern udpStruct udpDetails;
|
extern udpStruct udpDetails;
|
||||||
|
extern const enum detectorType myDetectorType;
|
||||||
|
|
||||||
int initError = OK;
|
int initError = OK;
|
||||||
int initCheckDone = 0;
|
int initCheckDone = 0;
|
||||||
@ -37,9 +36,9 @@ int virtual_stop = 0;
|
|||||||
|
|
||||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||||
int highvoltage = 0;
|
int highvoltage = 0;
|
||||||
int dacValues[NDAC] = {0};
|
int dacValues[NDAC] = {};
|
||||||
int adcPhase = 0;
|
int adcPhase = 0;
|
||||||
int detPos[4] = {0, 0, 0, 0};
|
int detPos[4] = {};
|
||||||
int numUDPInterfaces = 1;
|
int numUDPInterfaces = 1;
|
||||||
|
|
||||||
|
|
||||||
@ -66,7 +65,6 @@ void basictests() {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
defineGPIOpins();
|
defineGPIOpins();
|
||||||
resetFPGA();
|
resetFPGA();
|
||||||
if (mapCSP0() == FAIL) {
|
if (mapCSP0() == FAIL) {
|
||||||
@ -170,7 +168,7 @@ int checkType() {
|
|||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
volatile u_int32_t type = ((bus_r(FPGA_VERSION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST);
|
u_int32_t type = ((bus_r(FPGA_VERSION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST);
|
||||||
if (type != JUNGFRAU){
|
if (type != JUNGFRAU){
|
||||||
FILE_LOG(logERROR, ("This is not a Jungfrau Server (read %d, expected %d)\n", type, JUNGFRAU));
|
FILE_LOG(logERROR, ("This is not a Jungfrau Server (read %d, expected %d)\n", type, JUNGFRAU));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -918,22 +916,18 @@ int setHighVoltage(int val){
|
|||||||
|
|
||||||
|
|
||||||
void setTiming( enum timingMode arg){
|
void setTiming( enum timingMode arg){
|
||||||
|
switch(arg){
|
||||||
if(arg != GET_TIMING_MODE){
|
case AUTO_TIMING:
|
||||||
switch((int)arg){
|
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
||||||
case AUTO_TIMING:
|
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SIGNAL_MSK);
|
||||||
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
break;
|
||||||
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SIGNAL_MSK);
|
case TRIGGER_EXPOSURE:
|
||||||
break;
|
FILE_LOG(logINFO, ("Set Timing: Trigger\n"));
|
||||||
case TRIGGER_EXPOSURE:
|
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) | EXT_SIGNAL_MSK);
|
||||||
FILE_LOG(logINFO, ("Set Timing: Trigger\n"));
|
break;
|
||||||
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) | EXT_SIGNAL_MSK);
|
default:
|
||||||
break;
|
FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
||||||
default:
|
}
|
||||||
FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1667,7 +1661,7 @@ void* start_timer(void* arg) {
|
|||||||
|
|
||||||
usleep(exp_us);
|
usleep(exp_us);
|
||||||
|
|
||||||
const int size = datasize + 112;
|
const int size = datasize + sizeof(sls_detector_header);
|
||||||
char packetData[size];
|
char packetData[size];
|
||||||
memset(packetData, 0, sizeof(sls_detector_header));
|
memset(packetData, 0, sizeof(sls_detector_header));
|
||||||
|
|
||||||
@ -1679,6 +1673,11 @@ void* start_timer(void* arg) {
|
|||||||
sls_detector_header* header = (sls_detector_header*)(packetData);
|
sls_detector_header* header = (sls_detector_header*)(packetData);
|
||||||
header->frameNumber = frameNr;
|
header->frameNumber = frameNr;
|
||||||
header->packetNumber = i;
|
header->packetNumber = i;
|
||||||
|
header->modId = 0;
|
||||||
|
header->row = detPos[X];
|
||||||
|
header->column = detPos[Y];
|
||||||
|
header->detType = (uint16_t)myDetectorType;
|
||||||
|
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||||
// fill data
|
// fill data
|
||||||
memcpy(packetData + sizeof(sls_detector_header), imageData + srcOffset, datasize);
|
memcpy(packetData + sizeof(sls_detector_header), imageData + srcOffset, datasize);
|
||||||
srcOffset += datasize;
|
srcOffset += datasize;
|
||||||
@ -1782,11 +1781,11 @@ enum runStatus getRunStatus(){
|
|||||||
|
|
||||||
|
|
||||||
void readFrame(int *ret, char *mess){
|
void readFrame(int *ret, char *mess){
|
||||||
#ifdef VIRTUAL
|
|
||||||
// wait for status to be done
|
// wait for status to be done
|
||||||
while(runBusy()){
|
while(runBusy()){
|
||||||
usleep(500);
|
usleep(500);
|
||||||
}
|
}
|
||||||
|
#ifdef VIRTUAL
|
||||||
FILE_LOG(logINFOGREEN, ("acquisition successfully finished\n"));
|
FILE_LOG(logINFOGREEN, ("acquisition successfully finished\n"));
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
@ -1826,7 +1825,7 @@ int calculateDataBytes(){
|
|||||||
return DATA_BYTES;
|
return DATA_BYTES;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerChip() * (int)getNumberOfChips());}
|
int getTotalNumberOfChannels() {return (getNumberOfChannelsPerChip() * getNumberOfChips());}
|
||||||
int getNumberOfChips(){return NCHIP;}
|
int getNumberOfChips(){return NCHIP;}
|
||||||
int getNumberOfDACs(){return NDAC;}
|
int getNumberOfDACs(){return NDAC;}
|
||||||
int getNumberOfChannelsPerChip(){return NCHAN;}
|
int getNumberOfChannelsPerChip(){return NCHAN;}
|
||||||
|
@ -12,7 +12,7 @@ add_executable(moenchDetectorServer_virtual
|
|||||||
../slsDetectorServer/src/ALTERA_PLL.c
|
../slsDetectorServer/src/ALTERA_PLL.c
|
||||||
../slsDetectorServer/src/LTC2620.c
|
../slsDetectorServer/src/LTC2620.c
|
||||||
../slsDetectorServer/src/MAX1932.c
|
../slsDetectorServer/src/MAX1932.c
|
||||||
../slsDetectorServer/src/programfpga.c
|
../slsDetectorServer/src/programFpgaBlackfin.c
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
@ -12,7 +12,7 @@ DESTDIR ?= bin
|
|||||||
INSTMODE = 0777
|
INSTMODE = 0777
|
||||||
|
|
||||||
SRCS = slsDetectorFunctionList.c
|
SRCS = slsDetectorFunctionList.c
|
||||||
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)communication_funcs_UDP.c $(main_src)UDPPacketHeaderGenerator.c $(main_src)AD9257.c $(main_src)ALTERA_PLL.c $(main_src)LTC2620.c $(main_src)MAX1932.c $(main_src)programfpga.c
|
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)communication_funcs_UDP.c $(main_src)UDPPacketHeaderGenerator.c $(main_src)AD9257.c $(main_src)ALTERA_PLL.c $(main_src)LTC2620.c $(main_src)MAX1932.c $(main_src)programFpgaBlackfin.c
|
||||||
|
|
||||||
OBJS = $(SRCS:.c=.o)
|
OBJS = $(SRCS:.c=.o)
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "ALTERA_PLL.h" // pll
|
#include "ALTERA_PLL.h" // pll
|
||||||
#include "blackfin.h"
|
#include "blackfin.h"
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
#include "programfpga.h"
|
#include "programFpgaBlackfin.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -9,6 +9,7 @@ add_executable(mythen3DetectorServer_virtual
|
|||||||
../slsDetectorServer/src/common.c
|
../slsDetectorServer/src/common.c
|
||||||
../slsDetectorServer/src/LTC2620_Driver.c
|
../slsDetectorServer/src/LTC2620_Driver.c
|
||||||
../slsDetectorServer/src/ALTERA_PLL_CYCLONE10.c
|
../slsDetectorServer/src/ALTERA_PLL_CYCLONE10.c
|
||||||
|
../slsDetectorServer/src/programFpgaNios.c
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
@ -12,7 +12,7 @@ DESTDIR ?= bin
|
|||||||
INSTMODE = 0777
|
INSTMODE = 0777
|
||||||
|
|
||||||
SRCS = slsDetectorFunctionList.c
|
SRCS = slsDetectorFunctionList.c
|
||||||
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)nios.c $(main_src)DAC6571.c $(main_src)common.c $(main_src)LTC2620_Driver.c $(main_src)ALTERA_PLL_CYCLONE10.c
|
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)nios.c $(main_src)DAC6571.c $(main_src)common.c $(main_src)LTC2620_Driver.c $(main_src)ALTERA_PLL_CYCLONE10.c $(main_src)/programFpgaNios.c
|
||||||
|
|
||||||
OBJS = $(SRCS:.c=.o)
|
OBJS = $(SRCS:.c=.o)
|
||||||
|
|
||||||
|
@ -4,29 +4,42 @@
|
|||||||
#define REG_OFFSET (4)
|
#define REG_OFFSET (4)
|
||||||
|
|
||||||
/* Base addresses 0x1804 0000 ---------------------------------------------*/
|
/* Base addresses 0x1804 0000 ---------------------------------------------*/
|
||||||
|
|
||||||
/* Reconfiguration core for readout pll */
|
/* Reconfiguration core for readout pll */
|
||||||
#define BASE_READOUT_PLL (0x0000) // 0x1804_0000 - 0x1804_07FF
|
#define BASE_READOUT_PLL (0x0000) // 0x1804_0000 - 0x1804_07FF
|
||||||
|
|
||||||
/* Reconfiguration core for system pll */
|
/* Reconfiguration core for system pll */
|
||||||
#define BASE_SYSTEM_PLL (0x0800) // 0x1804_0800 - 0x1804_0FFF
|
#define BASE_SYSTEM_PLL (0x0800) // 0x1804_0800 - 0x1804_0FFF
|
||||||
|
|
||||||
/* Clock Generation */
|
/* Clock Generation */
|
||||||
#define BASE_CLK_GENERATION (0x1000) // 0x1804_1000 - 0x1804_XXXX //TODO
|
#define BASE_CLK_GENERATION (0x1000) // 0x1804_1000 - 0x1804_XXXX //TODO
|
||||||
|
|
||||||
/* Base addresses 0x1806 0000 ---------------------------------------------*/
|
/* Base addresses 0x1806 0000 ---------------------------------------------*/
|
||||||
/* General purpose control and status registers */
|
/* General purpose control and status registers */
|
||||||
#define BASE_CONTROL (0x0000) // 0x1806_0000 - 0x1806_00FF https://git.psi.ch/sls_detectors_firmware/mythen_III_mcb/blob/master/code/hdl/ctrl/ctrl.vhd
|
#define BASE_CONTROL (0x0000) // 0x1806_0000 - 0x1806_00FF
|
||||||
|
// https://git.psi.ch/sls_detectors_firmware/mythen_III_mcb/blob/master/code/hdl/ctrl/ctrl.vhd
|
||||||
|
|
||||||
/* ASIC Control */
|
/* ASIC Control */
|
||||||
#define BASE_ASIC (0x0100) // 0x1806_0100 - 0x1806_010F
|
#define BASE_ASIC (0x0100) // 0x1806_0100 - 0x1806_010F
|
||||||
|
|
||||||
/* ASIC Digital Interface. Data recovery core */
|
/* ASIC Digital Interface. Data recovery core */
|
||||||
#define BASE_ADIF (0x0110) // 0x1806_0110 - 0x1806_011F https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/2e81ccbdbc5cb81813ba190fbdba43e8d6884eb9/adif/adif_ctrl.vhd
|
#define BASE_ADIF (0x0110) // 0x1806_0110 - 0x1806_011F
|
||||||
|
// https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/2e81ccbdbc5cb81813ba190fbdba43e8d6884eb9/adif/adif_ctrl.vhd
|
||||||
|
|
||||||
/* Formatting of data core */
|
/* Formatting of data core */
|
||||||
#define BASE_FMT (0x0120) // 0x1806_0120 - 0x1806_012F
|
#define BASE_FMT (0x0120) // 0x1806_0120 - 0x1806_012F
|
||||||
|
|
||||||
|
/* Packetizer */
|
||||||
|
#define BASE_PKT (0x0140) // 0x1806_0140 - 0x1806_014F
|
||||||
|
// https://git.psi.ch/sls_detectors_firmware/mythen_III_mcb/blob/master/code/hdl/pkt/pkt_ctrl.vhd
|
||||||
|
|
||||||
/* Pattern control and status registers */
|
/* Pattern control and status registers */
|
||||||
#define BASE_PATTERN_CONTROL (0x00200) // 0x1806_0200 - 0x1806_02FF https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/2e81ccbdbc5cb81813ba190fbdba43e8d6884eb9/pattern_flow/pattern_flow_ctrl.vhd
|
#define BASE_PATTERN_CONTROL (0x00200) // 0x1806_0200 - 0x1806_02FF
|
||||||
|
// https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/2e81ccbdbc5cb81813ba190fbdba43e8d6884eb9/pattern_flow/pattern_flow_ctrl.vhd
|
||||||
|
|
||||||
/* UDP datagram generator */
|
/* UDP datagram generator */
|
||||||
#define BASE_UDP_RAM (0x01000) // 0x1806_1000 - 0x1806_1FFF
|
#define BASE_UDP_RAM (0x01000) // 0x1806_1000 - 0x1806_1FFF
|
||||||
|
|
||||||
/* Pattern RAM. Pattern table */
|
/* Pattern RAM. Pattern table */
|
||||||
#define BASE_PATTERN_RAM (0x10000) // 0x1807_0000 - 0x1807_FFFF
|
#define BASE_PATTERN_RAM (0x10000) // 0x1807_0000 - 0x1807_FFFF
|
||||||
|
|
||||||
@ -119,6 +132,30 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Packetizer -------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Packetizer Config Register */
|
||||||
|
#define PKT_CONFIG_REG (0x00 * REG_OFFSET + BASE_PKT)
|
||||||
|
|
||||||
|
#define PKT_CONFIG_NRXR_MAX_OFST (0)
|
||||||
|
#define PKT_CONFIG_NRXR_MAX_MSK (0x0000003F << PKT_CONFIG_NRXR_MAX_OFST)
|
||||||
|
#define PKT_CONFIG_RXR_START_ID_OFST (8)
|
||||||
|
#define PKT_CONFIG_RXR_START_ID_MSK (0x0000003F << PKT_CONFIG_RXR_START_ID_OFST)
|
||||||
|
|
||||||
|
/* Module Coordinates Register */
|
||||||
|
#define COORD_0_REG (0x02 * REG_OFFSET + BASE_PKT)
|
||||||
|
#define COORD_ROW_OFST (0)
|
||||||
|
#define COORD_ROW_MSK (0x0000FFFF << COORD_ROW_OFST)
|
||||||
|
#define COORD_COL_OFST (16)
|
||||||
|
#define COORD_COL_MSK (0x0000FFFF << COORD_COL_OFST)
|
||||||
|
|
||||||
|
/* Module ID Register */
|
||||||
|
#define COORD_1_REG (0x03 * REG_OFFSET + BASE_PKT)
|
||||||
|
#define COORD_RESERVED_OFST (0)
|
||||||
|
#define COORD_RESERVED_MSK (0x0000FFFF << COORD_RESERVED_OFST)
|
||||||
|
#define COORD_ID_OFST (16) // Not connected in firmware TODO
|
||||||
|
#define COORD_ID_MSK (0x0000FFFF << COORD_ID_OFST) // Not connected in firmware TODO
|
||||||
|
|
||||||
|
|
||||||
/* Pattern Control registers --------------------------------------------------*/
|
/* Pattern Control registers --------------------------------------------------*/
|
||||||
|
|
||||||
@ -126,15 +163,15 @@
|
|||||||
#define PAT_STATUS_REG (0x00 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
#define PAT_STATUS_REG (0x00 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||||
#define PAT_STATUS_RUN_BUSY_OFST (0)
|
#define PAT_STATUS_RUN_BUSY_OFST (0)
|
||||||
#define PAT_STATUS_RUN_BUSY_MSK (0x00000001 << PAT_STATUS_RUN_BUSY_OFST)
|
#define PAT_STATUS_RUN_BUSY_MSK (0x00000001 << PAT_STATUS_RUN_BUSY_OFST)
|
||||||
#define PAT_STATUS_WAIT_FOR_TRGGR_OFST (0)
|
#define PAT_STATUS_WAIT_FOR_TRGGR_OFST (3)
|
||||||
#define PAT_STATUS_WAIT_FOR_TRGGR_MSK (0x00000001 << PAT_STATUS_WAIT_FOR_TRGGR_OFST)
|
#define PAT_STATUS_WAIT_FOR_TRGGR_MSK (0x00000001 << PAT_STATUS_WAIT_FOR_TRGGR_OFST)
|
||||||
#define PAT_STATUS_DLY_BFRE_TRGGR_OFST (0)
|
#define PAT_STATUS_DLY_BFRE_TRGGR_OFST (4)
|
||||||
#define PAT_STATUS_DLY_BFRE_TRGGR_MSK (0x00000001 << PAT_STATUS_DLY_BFRE_TRGGR_OFST)
|
#define PAT_STATUS_DLY_BFRE_TRGGR_MSK (0x00000001 << PAT_STATUS_DLY_BFRE_TRGGR_OFST)
|
||||||
#define PAT_STATUS_FIFO_FULL_OFST (0)
|
#define PAT_STATUS_FIFO_FULL_OFST (5)
|
||||||
#define PAT_STATUS_FIFO_FULL_MSK (0x00000001 << PAT_STATUS_FIFO_FULL_OFST)
|
#define PAT_STATUS_FIFO_FULL_MSK (0x00000001 << PAT_STATUS_FIFO_FULL_OFST)
|
||||||
#define PAT_STATUS_DLY_AFTR_TRGGR_OFST (0)
|
#define PAT_STATUS_DLY_AFTR_TRGGR_OFST (15)
|
||||||
#define PAT_STATUS_DLY_AFTR_TRGGR_MSK (0x00000001 << PAT_STATUS_DLY_AFTR_TRGGR_OFST)
|
#define PAT_STATUS_DLY_AFTR_TRGGR_MSK (0x00000001 << PAT_STATUS_DLY_AFTR_TRGGR_OFST)
|
||||||
#define PAT_STATUS_CSM_BUSY_OFST (0)
|
#define PAT_STATUS_CSM_BUSY_OFST (17)
|
||||||
#define PAT_STATUS_CSM_BUSY_MSK (0x00000001 << PAT_STATUS_CSM_BUSY_OFST)
|
#define PAT_STATUS_CSM_BUSY_MSK (0x00000001 << PAT_STATUS_CSM_BUSY_OFST)
|
||||||
|
|
||||||
/* Delay left 64bit Register */
|
/* Delay left 64bit Register */
|
||||||
@ -184,6 +221,9 @@
|
|||||||
/* External Signal register */
|
/* External Signal register */
|
||||||
#define EXT_SIGNAL_REG (0x30 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
#define EXT_SIGNAL_REG (0x30 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||||
|
|
||||||
|
#define EXT_SIGNAL_OFST (0)
|
||||||
|
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
|
||||||
|
|
||||||
/* Trigger Delay 64 bit register */
|
/* Trigger Delay 64 bit register */
|
||||||
#define SET_TRIGGER_DELAY_LSB_REG (0x32 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
#define SET_TRIGGER_DELAY_LSB_REG (0x32 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||||
#define SET_TRIGGER_DELAY_MSB_REG (0x33 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
#define SET_TRIGGER_DELAY_MSB_REG (0x33 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||||
|
Binary file not shown.
@ -21,6 +21,7 @@
|
|||||||
// Global variable from slsDetectorServer_funcs
|
// Global variable from slsDetectorServer_funcs
|
||||||
extern int debugflag;
|
extern int debugflag;
|
||||||
extern udpStruct udpDetails;
|
extern udpStruct udpDetails;
|
||||||
|
extern const enum detectorType myDetectorType;
|
||||||
|
|
||||||
int initError = OK;
|
int initError = OK;
|
||||||
int initCheckDone = 0;
|
int initCheckDone = 0;
|
||||||
@ -32,12 +33,12 @@ int virtual_status = 0;
|
|||||||
int virtual_stop = 0;
|
int virtual_stop = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int32_t clkPhase[NUM_CLOCKS] = {0, 0, 0, 0, 0};
|
int32_t clkPhase[NUM_CLOCKS] = {};
|
||||||
uint32_t clkFrequency[NUM_CLOCKS] = {0, 0, 0, 0, 0};
|
uint32_t clkFrequency[NUM_CLOCKS] = {};
|
||||||
|
|
||||||
int highvoltage = 0;
|
int highvoltage = 0;
|
||||||
int dacValues[NDAC] = {0};
|
int dacValues[NDAC] = {0};
|
||||||
int detPos[2] = {0, 0};
|
int detPos[2] = {};
|
||||||
uint32_t countermask = 0; // will be removed later when in firmware converted to mask
|
uint32_t countermask = 0; // will be removed later when in firmware converted to mask
|
||||||
|
|
||||||
int isInitCheckDone() {
|
int isInitCheckDone() {
|
||||||
@ -84,13 +85,10 @@ void basictests() {
|
|||||||
uint64_t macadd = getDetectorMAC();
|
uint64_t macadd = getDetectorMAC();
|
||||||
int64_t fwversion = getFirmwareVersion();
|
int64_t fwversion = getFirmwareVersion();
|
||||||
int64_t swversion = getServerVersion();
|
int64_t swversion = getServerVersion();
|
||||||
int64_t sw_fw_apiversion = 0;
|
int64_t sw_fw_apiversion = getFirmwareAPIVersion();;
|
||||||
int64_t client_sw_apiversion = getClientServerAPIVersion();
|
int64_t client_sw_apiversion = getClientServerAPIVersion();
|
||||||
uint32_t requiredFirmwareVersion = REQRD_FRMWRE_VRSN;
|
uint32_t requiredFirmwareVersion = REQRD_FRMWRE_VRSN;
|
||||||
|
|
||||||
|
|
||||||
if (fwversion >= MIN_REQRD_VRSN_T_RD_API)
|
|
||||||
sw_fw_apiversion = getFirmwareAPIVersion();
|
|
||||||
FILE_LOG(logINFOBLUE, ("*************************************************\n"
|
FILE_LOG(logINFOBLUE, ("*************************************************\n"
|
||||||
"Hardware Version:\t\t 0x%x\n"
|
"Hardware Version:\t\t 0x%x\n"
|
||||||
|
|
||||||
@ -161,7 +159,7 @@ int checkType() {
|
|||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
volatile u_int32_t type = ((bus_r(FPGA_VERSION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST);
|
u_int32_t type = ((bus_r(FPGA_VERSION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST);
|
||||||
if (type != MYTHEN3){
|
if (type != MYTHEN3){
|
||||||
FILE_LOG(logERROR, ("This is not a Mythen3 Server (read %d, expected %d)\n", type, MYTHEN3));
|
FILE_LOG(logERROR, ("This is not a Mythen3 Server (read %d, expected %d)\n", type, MYTHEN3));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -251,7 +249,7 @@ u_int32_t getDetectorNumber(){
|
|||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
return bus_r(MCB_SERIAL_NO_REG);
|
return ((bus_r(MCB_SERIAL_NO_REG) & MCB_SERIAL_NO_VRSN_MSK) >> MCB_SERIAL_NO_VRSN_OFST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -305,10 +303,14 @@ u_int32_t getDetectorIP(){
|
|||||||
/* initialization */
|
/* initialization */
|
||||||
|
|
||||||
void initControlServer(){
|
void initControlServer(){
|
||||||
|
CreateNotificationForCriticalTasks();
|
||||||
if (initError == OK) {
|
if (initError == OK) {
|
||||||
setupDetector();
|
setupDetector();
|
||||||
}
|
}
|
||||||
initCheckDone = 1;
|
initCheckDone = 1;
|
||||||
|
if (initError == OK) {
|
||||||
|
NotifyServerStartSuccess();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void initStopServer() {
|
void initStopServer() {
|
||||||
@ -609,7 +611,6 @@ int setDelayAfterTrigger(int64_t val) {
|
|||||||
|
|
||||||
int64_t getDelayAfterTrigger() {
|
int64_t getDelayAfterTrigger() {
|
||||||
return get64BitReg(SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG) / (1E-9 * FIXED_PLL_FREQUENCY);
|
return get64BitReg(SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG) / (1E-9 * FIXED_PLL_FREQUENCY);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t getNumFramesLeft() {
|
int64_t getNumFramesLeft() {
|
||||||
@ -706,10 +707,25 @@ int setHighVoltage(int val){
|
|||||||
|
|
||||||
/* parameters - timing */
|
/* parameters - timing */
|
||||||
void setTiming( enum timingMode arg){
|
void setTiming( enum timingMode arg){
|
||||||
// to be implemented
|
if(arg != GET_TIMING_MODE){
|
||||||
|
switch (arg) {
|
||||||
|
case AUTO_TIMING:
|
||||||
|
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
||||||
|
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SIGNAL_MSK);
|
||||||
|
break;
|
||||||
|
case TRIGGER_EXPOSURE:
|
||||||
|
FILE_LOG(logINFO, ("Set Timing: Trigger\n"));
|
||||||
|
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) | EXT_SIGNAL_MSK);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum timingMode getTiming() {
|
enum timingMode getTiming() {
|
||||||
|
if (bus_r(EXT_SIGNAL_REG) == EXT_SIGNAL_MSK)
|
||||||
|
return TRIGGER_EXPOSURE;
|
||||||
return AUTO_TIMING;
|
return AUTO_TIMING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -835,6 +851,43 @@ void calcChecksum(udp_header* udp) {
|
|||||||
udp->ip_checksum = checksum;
|
udp->ip_checksum = checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int setDetectorPosition(int pos[]) {
|
||||||
|
memcpy(detPos, pos, sizeof(detPos));
|
||||||
|
|
||||||
|
uint32_t addr = COORD_0_REG;
|
||||||
|
int value = 0;
|
||||||
|
int valueRead = 0;
|
||||||
|
int ret = OK;
|
||||||
|
|
||||||
|
// row
|
||||||
|
value = detPos[X];
|
||||||
|
bus_w(addr, (bus_r(addr) &~COORD_ROW_MSK) | ((value << COORD_ROW_OFST) & COORD_ROW_MSK));
|
||||||
|
valueRead = ((bus_r(addr) & COORD_ROW_MSK) >> COORD_ROW_OFST);
|
||||||
|
if (valueRead != value) {
|
||||||
|
FILE_LOG(logERROR, ("Could not set row. Set %d, read %d\n", value, valueRead));
|
||||||
|
ret = FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// col
|
||||||
|
value = detPos[Y];
|
||||||
|
bus_w(addr, (bus_r(addr) &~COORD_COL_MSK) | ((value << COORD_COL_OFST) & COORD_COL_MSK));
|
||||||
|
valueRead = ((bus_r(addr) & COORD_COL_MSK) >> COORD_COL_OFST);
|
||||||
|
if (valueRead != value) {
|
||||||
|
FILE_LOG(logERROR, ("Could not set column. Set %d, read %d\n", value, valueRead));
|
||||||
|
ret = FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret == OK) {
|
||||||
|
FILE_LOG(logINFO, ("\tPosition set to [%d, %d]\n", detPos[X], detPos[Y]));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int* getDetectorPosition() {
|
||||||
|
return detPos;
|
||||||
|
}
|
||||||
|
|
||||||
/* pattern */
|
/* pattern */
|
||||||
|
|
||||||
uint64_t readPatternWord(int addr) {
|
uint64_t readPatternWord(int addr) {
|
||||||
@ -1052,6 +1105,22 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setPatternMask(uint64_t mask) {
|
||||||
|
set64BitReg(mask, PATTERN_MASK_LSB_REG, PATTERN_MASK_MSB_REG);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t getPatternMask() {
|
||||||
|
return get64BitReg(PATTERN_MASK_LSB_REG, PATTERN_MASK_MSB_REG);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPatternBitMask(uint64_t mask) {
|
||||||
|
set64BitReg(mask, PATTERN_SET_LSB_REG, PATTERN_SET_MSB_REG);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t getPatternBitMask() {
|
||||||
|
return get64BitReg(PATTERN_SET_LSB_REG, PATTERN_SET_MSB_REG);
|
||||||
|
}
|
||||||
|
|
||||||
int checkDetectorType() {
|
int checkDetectorType() {
|
||||||
FILE_LOG(logINFO, ("Checking type of module\n"));
|
FILE_LOG(logINFO, ("Checking type of module\n"));
|
||||||
FILE* fd = fopen(TYPE_FILE_NAME, "r");
|
FILE* fd = fopen(TYPE_FILE_NAME, "r");
|
||||||
@ -1067,13 +1136,13 @@ int checkDetectorType() {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
int type = atoi(buffer);
|
int type = atoi(buffer);
|
||||||
if (type > TYPE_TOLERANCE) {
|
if (type > TYPE_NO_MODULE_STARTING_VAL) {
|
||||||
FILE_LOG(logERROR, ("No Module attached! Expected %d for Mythen, got %d\n", TYPE_MYTHEN3_MODULE_VAL, type));
|
FILE_LOG(logERROR, ("No Module attached! Expected %d for Mythen, got %d\n", TYPE_MYTHEN3_MODULE_VAL, type));
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (abs(type - TYPE_MYTHEN3_MODULE_VAL) > TYPE_TOLERANCE) {
|
if (abs(type - TYPE_MYTHEN3_MODULE_VAL) > TYPE_TOLERANCE) {
|
||||||
FILE_LOG(logERROR, ("Wrong Module attached! Expected %d for Mythen, got %d\n", TYPE_MYTHEN3_MODULE_VAL, type));
|
FILE_LOG(logERROR, ("Wrong Module attached! Expected %d for Mythen3, got %d\n", TYPE_MYTHEN3_MODULE_VAL, type));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
@ -1134,8 +1203,8 @@ int setPhase(enum CLKINDEX ind, int val, int degrees) {
|
|||||||
relativePhase *= -1;
|
relativePhase *= -1;
|
||||||
direction = 0;
|
direction = 0;
|
||||||
}
|
}
|
||||||
int pllIndex = ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL;
|
int pllIndex = (int)(ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL);
|
||||||
int clkIndex = ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind;
|
int clkIndex = (int)(ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind);
|
||||||
ALTERA_PLL_C10_SetPhaseShift(pllIndex, clkIndex, relativePhase, direction);
|
ALTERA_PLL_C10_SetPhaseShift(pllIndex, clkIndex, relativePhase, direction);
|
||||||
|
|
||||||
clkPhase[ind] = valShift;
|
clkPhase[ind] = valShift;
|
||||||
@ -1207,7 +1276,7 @@ int getVCOFrequency(enum CLKINDEX ind) {
|
|||||||
FILE_LOG(logERROR, ("Unknown clock index %d to get vco frequency\n", ind));
|
FILE_LOG(logERROR, ("Unknown clock index %d to get vco frequency\n", ind));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
int pllIndex = ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL;
|
int pllIndex = (int)(ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL);
|
||||||
return ALTERA_PLL_C10_GetVCOFrequency(pllIndex);
|
return ALTERA_PLL_C10_GetVCOFrequency(pllIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1225,7 +1294,7 @@ int setClockDivider(enum CLKINDEX ind, int val) {
|
|||||||
}
|
}
|
||||||
char* clock_names[] = {CLK_NAMES};
|
char* clock_names[] = {CLK_NAMES};
|
||||||
int vcofreq = getVCOFrequency(ind);
|
int vcofreq = getVCOFrequency(ind);
|
||||||
int currentdiv = vcofreq / clkFrequency[ind];
|
int currentdiv = vcofreq / (int)clkFrequency[ind];
|
||||||
int newfreq = vcofreq / val;
|
int newfreq = vcofreq / val;
|
||||||
|
|
||||||
FILE_LOG(logINFO, ("\tSetting %s clock (%d) divider from %d (%d Hz) to %d (%d Hz). \n\t(Vcofreq: %d Hz)\n", clock_names[ind], ind, currentdiv, clkFrequency[ind], val, newfreq, vcofreq));
|
FILE_LOG(logINFO, ("\tSetting %s clock (%d) divider from %d (%d Hz) to %d (%d Hz). \n\t(Vcofreq: %d Hz)\n", clock_names[ind], ind, currentdiv, clkFrequency[ind], val, newfreq, vcofreq));
|
||||||
@ -1240,8 +1309,8 @@ int setClockDivider(enum CLKINDEX ind, int val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate and set output frequency
|
// Calculate and set output frequency
|
||||||
int pllIndex = ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL;
|
int pllIndex = (int)(ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL);
|
||||||
int clkIndex = ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind;
|
int clkIndex = (int)(ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind);
|
||||||
ALTERA_PLL_C10_SetOuputFrequency (pllIndex, clkIndex, newfreq);
|
ALTERA_PLL_C10_SetOuputFrequency (pllIndex, clkIndex, newfreq);
|
||||||
clkFrequency[ind] = newfreq;
|
clkFrequency[ind] = newfreq;
|
||||||
FILE_LOG(logINFO, ("\t%s clock (%d) divider set to %d (%d Hz)\n", clock_names[ind], ind, val, clkFrequency[ind]));
|
FILE_LOG(logINFO, ("\t%s clock (%d) divider set to %d (%d Hz)\n", clock_names[ind], ind, val, clkFrequency[ind]));
|
||||||
@ -1275,20 +1344,11 @@ int getClockDivider(enum CLKINDEX ind) {
|
|||||||
FILE_LOG(logERROR, ("Unknown clock index %d to get clock divider\n", ind));
|
FILE_LOG(logERROR, ("Unknown clock index %d to get clock divider\n", ind));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return (getVCOFrequency(ind) / clkFrequency[ind]);
|
return (getVCOFrequency(ind) / (int)clkFrequency[ind]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* aquisition */
|
/* aquisition */
|
||||||
|
|
||||||
int setDetectorPosition(int pos[]) {
|
|
||||||
memcpy(detPos, pos, sizeof(detPos));
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int* getDetectorPosition() {
|
|
||||||
return detPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
int startStateMachine(){
|
int startStateMachine(){
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
// create udp socket
|
// create udp socket
|
||||||
@ -1327,22 +1387,64 @@ void* start_timer(void* arg) {
|
|||||||
getNumTriggers() );
|
getNumTriggers() );
|
||||||
int64_t exp_ns = getExpTime();
|
int64_t exp_ns = getExpTime();
|
||||||
|
|
||||||
|
int imagesize = calculateDataBytes();
|
||||||
|
int datasize = imagesize / PACKETS_PER_FRAME;
|
||||||
|
int packetsize = datasize + sizeof(sls_detector_header);
|
||||||
|
|
||||||
int frameNr = 0;
|
// Generate data
|
||||||
|
char imageData[imagesize];
|
||||||
|
memset(imageData, 0, imagesize);
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
for (i = 0; i < imagesize; i += sizeof(uint8_t)) {
|
||||||
|
*((uint8_t*)(imageData + i)) = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int frameNr = 1;
|
||||||
// loop over number of frames
|
// loop over number of frames
|
||||||
for(frameNr=0; frameNr!= numFrames; ++frameNr ) {
|
for (frameNr = 0; frameNr != numFrames; ++frameNr) {
|
||||||
|
|
||||||
//check if virtual_stop is high
|
//check if virtual_stop is high
|
||||||
if(virtual_stop == 1){
|
if(virtual_stop == 1){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int srcOffset = 0;
|
||||||
|
|
||||||
// sleep for exposure time
|
// sleep for exposure time
|
||||||
struct timespec begin, end;
|
struct timespec begin, end;
|
||||||
clock_gettime(CLOCK_REALTIME, &begin);
|
clock_gettime(CLOCK_REALTIME, &begin);
|
||||||
usleep(exp_ns / 1000);
|
usleep(exp_ns / 1000);
|
||||||
clock_gettime(CLOCK_REALTIME, &end);
|
|
||||||
|
// loop packet
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
for(i = 0; i!=PACKETS_PER_FRAME; ++i) {
|
||||||
|
char packetData[packetsize];
|
||||||
|
memset(packetData, 0, packetsize);
|
||||||
|
|
||||||
|
// set header
|
||||||
|
sls_detector_header* header = (sls_detector_header*)(packetData);
|
||||||
|
header->frameNumber = frameNr + 1;
|
||||||
|
header->packetNumber = i;
|
||||||
|
header->modId = 0;
|
||||||
|
header->row = detPos[X];
|
||||||
|
header->column = detPos[Y];
|
||||||
|
header->detType = (uint16_t)myDetectorType;
|
||||||
|
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||||
|
|
||||||
|
// fill data
|
||||||
|
memcpy(packetData + sizeof(sls_detector_header), imageData + srcOffset, datasize);
|
||||||
|
srcOffset += datasize;
|
||||||
|
|
||||||
|
sendUDPPacket(0, packetData, packetsize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FILE_LOG(logINFO, ("Sent frame: %d\n", frameNr));
|
||||||
|
|
||||||
// calculate time left in period
|
// calculate time left in period
|
||||||
|
clock_gettime(CLOCK_REALTIME, &end);
|
||||||
int64_t time_ns = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
int64_t time_ns = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
||||||
(end.tv_nsec - begin.tv_nsec));
|
(end.tv_nsec - begin.tv_nsec));
|
||||||
|
|
||||||
@ -1373,7 +1475,7 @@ int stopStateMachine(){
|
|||||||
#endif
|
#endif
|
||||||
//stop state machine
|
//stop state machine
|
||||||
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STP_ACQSTN_MSK);
|
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STP_ACQSTN_MSK);
|
||||||
FILE_LOG(logINFO, ("Status Register: %08x\n",bus_r(STATUS_REG)));
|
FILE_LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG)));
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1430,7 +1532,7 @@ enum runStatus getRunStatus(){
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void readFrame(int *ret, char *mess){
|
void readFrame(int *ret, char *mess) {
|
||||||
// wait for status to be done
|
// wait for status to be done
|
||||||
while(runBusy()){
|
while(runBusy()){
|
||||||
usleep(500);
|
usleep(500);
|
||||||
@ -1450,7 +1552,6 @@ void readFrame(int *ret, char *mess){
|
|||||||
} else {
|
} else {
|
||||||
FILE_LOG(logINFOGREEN, ("Acquisition successfully finished\n"));
|
FILE_LOG(logINFOGREEN, ("Acquisition successfully finished\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int32_t runBusy() {
|
u_int32_t runBusy() {
|
||||||
@ -1458,17 +1559,25 @@ u_int32_t runBusy() {
|
|||||||
return virtual_status;
|
return virtual_status;
|
||||||
#endif
|
#endif
|
||||||
u_int32_t s = (bus_r(PAT_STATUS_REG) & PAT_STATUS_RUN_BUSY_MSK);
|
u_int32_t s = (bus_r(PAT_STATUS_REG) & PAT_STATUS_RUN_BUSY_MSK);
|
||||||
FILE_LOG(logDEBUG1, ("Status Register: %08x\n", s));
|
//FILE_LOG(logDEBUG1, ("Status Register: %08x\n", s));
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* common */
|
/* common */
|
||||||
|
|
||||||
int calculateDataBytes(){
|
int calculateDataBytes() {
|
||||||
return 0;
|
int numCounters = __builtin_popcount(getCounterMask());
|
||||||
|
int dr = setDynamicRange(-1);
|
||||||
|
int databytes = NCHAN_1_COUNTER * NCHIP * numCounters *
|
||||||
|
((dr > 16) ? 4 : // 32 bit
|
||||||
|
((dr > 8) ? 2 : // 16 bit
|
||||||
|
((dr > 4) ? 0.5 : // 4 bit
|
||||||
|
0.125))); // 1 bit
|
||||||
|
|
||||||
|
return databytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerChip() * (int)getNumberOfChips());}
|
int getTotalNumberOfChannels() {return (getNumberOfChannelsPerChip() * getNumberOfChips());}
|
||||||
int getNumberOfChips(){return NCHIP;}
|
int getNumberOfChips() {return NCHIP;}
|
||||||
int getNumberOfDACs(){return NDAC;}
|
int getNumberOfDACs() {return NDAC;}
|
||||||
int getNumberOfChannelsPerChip(){return NCHAN;}
|
int getNumberOfChannelsPerChip() {return NCHAN;}
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
|
|
||||||
#define REQRD_FRMWRE_VRSN 0x190000
|
#define REQRD_FRMWRE_VRSN 0x190000
|
||||||
#define MIN_REQRD_VRSN_T_RD_API 0x190000
|
|
||||||
|
|
||||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||||
|
|
||||||
/* Hardware Definitions */
|
/* Hardware Definitions */
|
||||||
#define NCOUNTERS (3)
|
#define NCOUNTERS (3)
|
||||||
#define MAX_COUNTER_MSK (0x7)
|
#define MAX_COUNTER_MSK (0x7)
|
||||||
|
#define NCHAN_1_COUNTER (128)
|
||||||
#define NCHAN (128 * NCOUNTERS)
|
#define NCHAN (128 * NCOUNTERS)
|
||||||
#define NCHIP (10)
|
#define NCHIP (10)
|
||||||
#define NDAC (16)
|
#define NDAC (16)
|
||||||
@ -45,7 +45,6 @@
|
|||||||
#define READOUT_PLL_VCO_FREQ_HZ (1250000000) // 1.25GHz
|
#define READOUT_PLL_VCO_FREQ_HZ (1250000000) // 1.25GHz
|
||||||
#define SYSTEM_PLL_VCO_FREQ_HZ (1250000000) // 1.25GHz
|
#define SYSTEM_PLL_VCO_FREQ_HZ (1250000000) // 1.25GHz
|
||||||
#define MAX_PATTERN_LENGTH (0x2000) // maximum number of words (64bit)
|
#define MAX_PATTERN_LENGTH (0x2000) // maximum number of words (64bit)
|
||||||
#define WAIT_TIME_US_STP_ACQ (100)
|
|
||||||
|
|
||||||
/** Other Definitions */
|
/** Other Definitions */
|
||||||
#define BIT16_MASK (0xFFFF)
|
#define BIT16_MASK (0xFFFF)
|
||||||
@ -98,3 +97,4 @@ typedef struct udp_header_struct {
|
|||||||
uint16_t udp_destport;
|
uint16_t udp_destport;
|
||||||
} udp_header;
|
} udp_header;
|
||||||
#define UDP_IP_HEADER_LENGTH_BYTES (28)
|
#define UDP_IP_HEADER_LENGTH_BYTES (28)
|
||||||
|
#define PACKETS_PER_FRAME (2)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define GPIO pins if not defined
|
* Define GPIO pins if not defined
|
||||||
@ -49,4 +50,4 @@ void stopWritingFPGAprogram(FILE* filefp);
|
|||||||
* @param filefp pointer to flash
|
* @param filefp pointer to flash
|
||||||
* @return 0 for success, 1 for fail (cannot write)
|
* @return 0 for success, 1 for fail (cannot write)
|
||||||
*/
|
*/
|
||||||
int writeFPGAProgram(char* fpgasrc, size_t fsize, FILE* filefp);
|
int writeFPGAProgram(char* fpgasrc, uint64_t fsize, FILE* filefp);
|
48
slsDetectorServers/slsDetectorServer/include/programFpgaNios.h
Executable file
48
slsDetectorServers/slsDetectorServer/include/programFpgaNios.h
Executable file
@ -0,0 +1,48 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define NIOS_MAX_APP_IMAGE_SIZE (0x00580000)
|
||||||
|
|
||||||
|
/** Notify microcontroller of successful server start up */
|
||||||
|
void NotifyServerStartSuccess();
|
||||||
|
|
||||||
|
/** create notification file to notify watchdog of critical tasks (to not shutdown) */
|
||||||
|
void CreateNotificationForCriticalTasks();
|
||||||
|
|
||||||
|
/** write 1 to notification file to postpone shut down process if requested*/
|
||||||
|
void NotifyCriticalTask();
|
||||||
|
|
||||||
|
/** write 0 to notification file to allow shut down process if requested */
|
||||||
|
void NotifyCriticalTaskDone();
|
||||||
|
|
||||||
|
/** reset fpga and controller(only implemented for >= v1.1 boards) */
|
||||||
|
void rebootControllerAndFPGA();
|
||||||
|
|
||||||
|
/** finds the right mtd drive
|
||||||
|
* @param mess error message
|
||||||
|
* @returns ok or fail
|
||||||
|
*/
|
||||||
|
int findFlash(char* mess);
|
||||||
|
|
||||||
|
/** erase flash */
|
||||||
|
void eraseFlash();
|
||||||
|
|
||||||
|
/** erase and write flash
|
||||||
|
* @param mess error message
|
||||||
|
* @param fpgasrc program source
|
||||||
|
* @param fsize file size
|
||||||
|
* @returns ok or fail
|
||||||
|
*/
|
||||||
|
int eraseAndWriteToFlash(char* mess, char* fpgasrc, uint64_t fsize);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write FPGA Program to flash
|
||||||
|
* @param mess error message
|
||||||
|
* @param fpgasrc source program
|
||||||
|
* @param fsize size of program
|
||||||
|
* @param filefp pointer to flash
|
||||||
|
* @return ok or fail
|
||||||
|
*/
|
||||||
|
int writeFPGAProgram(char* mess, char* fpgasrc, uint64_t fsize, FILE* filefp);
|
@ -84,11 +84,10 @@ int updateDatabytesandAllocateRAM();
|
|||||||
void updateDataBytes();
|
void updateDataBytes();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(MYTHEN3D) || GOTTHARD2D
|
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(MYTHEN3D)
|
||||||
int setDefaultDacs();
|
int setDefaultDacs();
|
||||||
#endif
|
#endif
|
||||||
#ifdef GOTTHARD2D
|
#ifdef GOTTHARD2D
|
||||||
int setDefaultOnChipDacs();
|
|
||||||
int readConfigFile();
|
int readConfigFile();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -101,13 +100,13 @@ int readRegister(uint32_t offset, uint32_t* retval);
|
|||||||
uint32_t writeRegister16And32(uint32_t offset, uint32_t data); //FIXME its not there in ctb or moench?
|
uint32_t writeRegister16And32(uint32_t offset, uint32_t data); //FIXME its not there in ctb or moench?
|
||||||
uint32_t readRegister16And32(uint32_t offset);
|
uint32_t readRegister16And32(uint32_t offset);
|
||||||
#else
|
#else
|
||||||
extern u_int32_t writeRegister(u_int32_t offset, u_int32_t data); // blackfin.h
|
extern u_int32_t writeRegister(u_int32_t offset, u_int32_t data); // blackfin.h or nios.h
|
||||||
extern u_int32_t readRegister(u_int32_t offset); // blackfin.h
|
extern u_int32_t readRegister(u_int32_t offset); // blackfin.h or nios.h
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// firmware functions (resets)
|
// firmware functions (resets)
|
||||||
#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D)
|
#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
void cleanFifos();
|
void cleanFifos();
|
||||||
void resetCore();
|
void resetCore();
|
||||||
void resetPeripheral();
|
void resetPeripheral();
|
||||||
@ -178,6 +177,20 @@ int setExpTime(int64_t val);
|
|||||||
int64_t getExpTime();
|
int64_t getExpTime();
|
||||||
int setPeriod(int64_t val);
|
int setPeriod(int64_t val);
|
||||||
int64_t getPeriod();
|
int64_t getPeriod();
|
||||||
|
#ifdef GOTTHARD2D
|
||||||
|
void setNumFramesBurst(int64_t val);
|
||||||
|
int64_t getNumFramesBurst();
|
||||||
|
void setNumFramesCont(int64_t val);
|
||||||
|
int64_t getNumFramesCont();
|
||||||
|
int setExptimeBurst(int64_t val);
|
||||||
|
int setExptimeCont(int64_t val);
|
||||||
|
int setExptimeBoth(int64_t val);
|
||||||
|
int64_t getExptimeBoth();
|
||||||
|
int setPeriodBurst(int64_t val);
|
||||||
|
int64_t getPeriodBurst();
|
||||||
|
int setPeriodCont(int64_t val);
|
||||||
|
int64_t getPeriodCont();
|
||||||
|
#endif
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
int setSubExpTime(int64_t val);
|
int setSubExpTime(int64_t val);
|
||||||
int64_t getSubExpTime();
|
int64_t getSubExpTime();
|
||||||
@ -203,22 +216,18 @@ void setCounterMask(uint32_t arg);
|
|||||||
uint32_t getCounterMask();
|
uint32_t getCounterMask();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D)
|
#if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
int setDelayAfterTrigger(int64_t val);
|
int setDelayAfterTrigger(int64_t val);
|
||||||
int64_t getDelayAfterTrigger();
|
int64_t getDelayAfterTrigger();
|
||||||
#endif
|
|
||||||
#if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
|
||||||
int64_t getNumFramesLeft();
|
int64_t getNumFramesLeft();
|
||||||
int64_t getNumTriggersLeft();
|
int64_t getNumTriggersLeft();
|
||||||
#endif
|
|
||||||
#if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D)
|
|
||||||
int64_t getDelayAfterTriggerLeft();
|
int64_t getDelayAfterTriggerLeft();
|
||||||
int64_t getPeriodLeft();
|
int64_t getPeriodLeft();
|
||||||
#endif
|
#endif
|
||||||
#ifdef GOTTHARDD
|
#ifdef GOTTHARDD
|
||||||
int64_t getExpTimeLeft();
|
int64_t getExpTimeLeft();
|
||||||
#endif
|
#endif
|
||||||
#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D)
|
#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
int64_t getFramesFromStart();
|
int64_t getFramesFromStart();
|
||||||
int64_t getActualTime();
|
int64_t getActualTime();
|
||||||
int64_t getMeasurementTime();
|
int64_t getMeasurementTime();
|
||||||
@ -230,9 +239,11 @@ int64_t getMeasurementTime();
|
|||||||
#if (!defined(CHIPTESTBOARDD)) && (!defined(MOENCHD)) && (!defined(MYTHEN3D)) && (!defined(GOTTHARD2D))
|
#if (!defined(CHIPTESTBOARDD)) && (!defined(MOENCHD)) && (!defined(MYTHEN3D)) && (!defined(GOTTHARD2D))
|
||||||
int setModule(sls_detector_module myMod, char* mess);
|
int setModule(sls_detector_module myMod, char* mess);
|
||||||
int getModule(sls_detector_module *myMod);
|
int getModule(sls_detector_module *myMod);
|
||||||
|
#endif
|
||||||
|
#if (!defined(CHIPTESTBOARDD)) && (!defined(MOENCHD)) && (!defined(MYTHEN3D))
|
||||||
enum detectorSettings setSettings(enum detectorSettings sett);
|
enum detectorSettings setSettings(enum detectorSettings sett);
|
||||||
#endif
|
#endif
|
||||||
#if !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
#if !defined(MYTHEN3D)
|
||||||
enum detectorSettings getSettings();
|
enum detectorSettings getSettings();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -293,10 +304,8 @@ int setHighVoltage(int val);
|
|||||||
|
|
||||||
|
|
||||||
// parameters - timing, extsig
|
// parameters - timing, extsig
|
||||||
#if !defined(GOTTHARD2D)
|
|
||||||
void setTiming( enum timingMode arg);
|
void setTiming( enum timingMode arg);
|
||||||
enum timingMode getTiming();
|
enum timingMode getTiming();
|
||||||
#endif
|
|
||||||
#ifdef GOTTHARDD
|
#ifdef GOTTHARDD
|
||||||
void setExtSignal(enum externalSignalFlag mode);
|
void setExtSignal(enum externalSignalFlag mode);
|
||||||
int getExtSignal();
|
int getExtSignal();
|
||||||
@ -324,7 +333,6 @@ int getAdcConfigured();
|
|||||||
int configureMAC();
|
int configureMAC();
|
||||||
int setDetectorPosition(int pos[]);
|
int setDetectorPosition(int pos[]);
|
||||||
int* getDetectorPosition();
|
int* getDetectorPosition();
|
||||||
int isConfigurable();
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
@ -358,10 +366,10 @@ int getFrequency(enum CLKINDEX ind);
|
|||||||
void configureSyncFrequency(enum CLKINDEX ind);
|
void configureSyncFrequency(enum CLKINDEX ind);
|
||||||
void setPipeline(enum CLKINDEX ind, int val);
|
void setPipeline(enum CLKINDEX ind, int val);
|
||||||
int getPipeline(enum CLKINDEX ind);
|
int getPipeline(enum CLKINDEX ind);
|
||||||
extern void eraseFlash(); // programfpga.h
|
extern void eraseFlash(); // programFpgaBlackfin.h
|
||||||
extern int startWritingFPGAprogram(FILE** filefp); // programfpga.h
|
extern int startWritingFPGAprogram(FILE** filefp); // programFpgaBlackfin.h
|
||||||
extern void stopWritingFPGAprogram(FILE* filefp); // programfpga.h
|
extern void stopWritingFPGAprogram(FILE* filefp); // programFpgaBlackfin.h
|
||||||
extern int writeFPGAProgram(char* fpgasrc, size_t fsize, FILE* filefp); // programfpga.h
|
extern int writeFPGAProgram(char* fpgasrc, uint64_t fsize, FILE* filefp); // programFpgaBlackfin.h
|
||||||
// patterns
|
// patterns
|
||||||
uint64_t writePatternIOControl(uint64_t word);
|
uint64_t writePatternIOControl(uint64_t word);
|
||||||
uint64_t writePatternClkControl(uint64_t word);
|
uint64_t writePatternClkControl(uint64_t word);
|
||||||
@ -393,10 +401,10 @@ int validatePhaseinDegrees(enum CLKINDEX ind, int val, int retval);
|
|||||||
int setThresholdTemperature(int val);
|
int setThresholdTemperature(int val);
|
||||||
int setTemperatureControl(int val);
|
int setTemperatureControl(int val);
|
||||||
int setTemperatureEvent(int val);
|
int setTemperatureEvent(int val);
|
||||||
extern void eraseFlash(); // programfpga.h
|
extern void eraseFlash(); // programFpgaBlackfin.h
|
||||||
extern int startWritingFPGAprogram(FILE** filefp); // programfpga.h
|
extern int startWritingFPGAprogram(FILE** filefp); // programFpgaBlackfin.h
|
||||||
extern void stopWritingFPGAprogram(FILE* filefp); // programfpga.h
|
extern void stopWritingFPGAprogram(FILE* filefp); // programFpgaBlackfin.h
|
||||||
extern int writeFPGAProgram(char* fpgasrc, size_t fsize, FILE* filefp); // programfpga.h
|
extern int writeFPGAProgram(char* fpgasrc, uint64_t fsize, FILE* filefp); // programFpgaBlackfin.h
|
||||||
void alignDeserializer();
|
void alignDeserializer();
|
||||||
|
|
||||||
// eiger specific - iodelay, pulse, rate, temp, activate, delay nw parameter
|
// eiger specific - iodelay, pulse, rate, temp, activate, delay nw parameter
|
||||||
@ -429,6 +437,10 @@ uint64_t writePatternWord(int addr, uint64_t word);
|
|||||||
int setPatternWaitAddress(int level, int addr);
|
int setPatternWaitAddress(int level, int addr);
|
||||||
uint64_t setPatternWaitTime(int level, uint64_t t);
|
uint64_t setPatternWaitTime(int level, uint64_t t);
|
||||||
void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop);
|
void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop);
|
||||||
|
void setPatternMask(uint64_t mask);
|
||||||
|
uint64_t getPatternMask();
|
||||||
|
void setPatternBitMask(uint64_t mask);
|
||||||
|
uint64_t getPatternBitMask();
|
||||||
int checkDetectorType();
|
int checkDetectorType();
|
||||||
int powerChip (int on);
|
int powerChip (int on);
|
||||||
int setPhase(enum CLKINDEX ind, int val, int degrees);
|
int setPhase(enum CLKINDEX ind, int val, int degrees);
|
||||||
@ -443,6 +455,8 @@ int setClockDivider(enum CLKINDEX ind, int val);
|
|||||||
int getClockDivider(enum CLKINDEX ind);
|
int getClockDivider(enum CLKINDEX ind);
|
||||||
|
|
||||||
#elif GOTTHARD2D
|
#elif GOTTHARD2D
|
||||||
|
int checkDetectorType();
|
||||||
|
int powerChip (int on);
|
||||||
int setPhase(enum CLKINDEX ind, int val, int degrees);
|
int setPhase(enum CLKINDEX ind, int val, int degrees);
|
||||||
int getPhase(enum CLKINDEX ind, int degrees);
|
int getPhase(enum CLKINDEX ind, int degrees);
|
||||||
int getMaxPhase(enum CLKINDEX ind);
|
int getMaxPhase(enum CLKINDEX ind);
|
||||||
@ -460,12 +474,21 @@ int setVetoPhoton(int chipIndex, int gainIndex, int* values);
|
|||||||
int getVetoPhoton(int chipIndex, int* retvals);
|
int getVetoPhoton(int chipIndex, int* retvals);
|
||||||
int configureSingleADCDriver(int chipIndex);
|
int configureSingleADCDriver(int chipIndex);
|
||||||
int configureADC();
|
int configureADC();
|
||||||
int setBurstMode(int burst);
|
int setBurstModeinFPGA(enum burstMode value);
|
||||||
int getBurstMode();
|
int setBurstMode(enum burstMode burst);
|
||||||
|
enum burstMode getBurstMode();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
|
extern void NotifyServerStartSuccess();
|
||||||
|
extern void CreateNotificationForCriticalTasks();
|
||||||
|
extern void rebootControllerAndFPGA(); // programFpgaNios.h
|
||||||
|
extern int findFlash(char* mess); // programFpgaNios.h
|
||||||
|
extern void eraseFlash(); // programFpgaNios.h
|
||||||
|
extern int eraseAndWriteToFlash(char* mess, char* fpgasrc, uint64_t fsize); // programFpgaNios.h
|
||||||
|
extern int writeFPGAProgram(char* mess, char* fpgasrc, uint64_t fsize, FILE* filefp); // programFpgaNios.h
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(JUNGFRAUD) || defined(EIGERD)
|
#if defined(JUNGFRAUD) || defined(EIGERD)
|
||||||
@ -485,6 +508,9 @@ int setTransmissionDelayRight(int value);
|
|||||||
|
|
||||||
|
|
||||||
// aquisition
|
// aquisition
|
||||||
|
#ifdef GOTTHARD2D
|
||||||
|
int updateAcquisitionRegisters(char* mess);
|
||||||
|
#endif
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
int prepareAcquisition();
|
int prepareAcquisition();
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,7 +19,9 @@ void validate(int arg, int retval, char* modename, enum numberMode nummode);
|
|||||||
void validate64(int64_t arg, int64_t retval, char* modename, enum numberMode nummode);
|
void validate64(int64_t arg, int64_t retval, char* modename, enum numberMode nummode);
|
||||||
int executeCommand(char* command, char* result, enum TLogLevel level);
|
int executeCommand(char* command, char* result, enum TLogLevel level);
|
||||||
int M_nofunc(int);
|
int M_nofunc(int);
|
||||||
int M_nofuncMode(int);
|
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
|
extern void rebootControllerAndFPGA();
|
||||||
|
#endif
|
||||||
|
|
||||||
// functions called by client
|
// functions called by client
|
||||||
int exec_command(int);
|
int exec_command(int);
|
||||||
@ -199,7 +201,7 @@ int set_inject_channel(int);
|
|||||||
int get_inject_channel(int);
|
int get_inject_channel(int);
|
||||||
int set_veto_photon(int);
|
int set_veto_photon(int);
|
||||||
int get_veto_photon(int);
|
int get_veto_photon(int);
|
||||||
int set_veto_refernce(int);
|
int set_veto_reference(int);
|
||||||
int get_burst_mode(int);
|
int get_burst_mode(int);
|
||||||
int set_burst_mode(int);
|
int set_burst_mode(int);
|
||||||
int set_adc_enable_mask_10g(int);
|
int set_adc_enable_mask_10g(int);
|
||||||
|
@ -87,13 +87,9 @@ void ALTERA_PLL_C10_Reconfigure(int pllIndex) {
|
|||||||
void ALTERA_PLL_C10_ResetPLL (int pllIndex) {
|
void ALTERA_PLL_C10_ResetPLL (int pllIndex) {
|
||||||
uint32_t resetreg = ALTERA_PLL_C10_Reset_Reg[pllIndex];
|
uint32_t resetreg = ALTERA_PLL_C10_Reset_Reg[pllIndex];
|
||||||
uint32_t resetmsk = ALTERA_PLL_C10_Reset_Msk[pllIndex];
|
uint32_t resetmsk = ALTERA_PLL_C10_Reset_Msk[pllIndex];
|
||||||
|
|
||||||
#ifdef MYTHEN3D
|
|
||||||
FILE_LOG(logINFO, ("Resetting PLL %d\n", pllIndex));
|
FILE_LOG(logINFO, ("Resetting PLL %d\n", pllIndex));
|
||||||
bus_w_csp1(resetreg, bus_r_csp1(resetreg) | resetmsk);
|
bus_w_csp1(resetreg, bus_r_csp1(resetreg) | resetmsk);
|
||||||
#else
|
|
||||||
FILE_LOG(logWARNING, ("Resetting PLL %d not implemented!\n", pllIndex));
|
|
||||||
#endif
|
|
||||||
usleep(ALTERA_PLL_C10_WAIT_TIME_US);
|
usleep(ALTERA_PLL_C10_WAIT_TIME_US);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,16 +28,19 @@ void ASIC_Driver_SetDefines(char* driverfname) {
|
|||||||
int ASIC_Driver_Set (int index, int length, char* buffer) {
|
int ASIC_Driver_Set (int index, int length, char* buffer) {
|
||||||
char fname[MAX_STR_LENGTH];
|
char fname[MAX_STR_LENGTH];
|
||||||
sprintf(fname, "%s%d", ASIC_Driver_DriverFileName, index + 1);
|
sprintf(fname, "%s%d", ASIC_Driver_DriverFileName, index + 1);
|
||||||
FILE_LOG(logDEBUG1, ("\t[chip index: %d, length: %d, fname: %s]\n", index, length, fname));
|
FILE_LOG(logDEBUG2, ("\t[chip index: %d, length: %d, fname: %s]\n", index, length, fname));
|
||||||
{
|
{
|
||||||
FILE_LOG(logDEBUG1, ("\t[values: \n"));
|
FILE_LOG(logDEBUG2, ("\t[values: \n"));
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < length; ++i) {
|
for (i = 0; i < length; ++i) {
|
||||||
FILE_LOG(logDEBUG1, ("\t%d: 0x%02hhx\n", i, buffer[i]));
|
FILE_LOG(logDEBUG2, ("\t%d: 0x%02hhx\n", i, buffer[i]));
|
||||||
}
|
}
|
||||||
FILE_LOG(logDEBUG1, ("\t]\n"));
|
FILE_LOG(logDEBUG2, ("\t]\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return OK;
|
||||||
|
#endif
|
||||||
int fd=open(fname, O_RDWR);
|
int fd=open(fname, O_RDWR);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
FILE_LOG(logERROR, ("Could not open file %s for writing to control ASIC (%d)\n", fname, index));
|
FILE_LOG(logERROR, ("Could not open file %s for writing to control ASIC (%d)\n", fname, index));
|
||||||
|
@ -252,8 +252,9 @@ void closeConnection(int file_des) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void exitServer(int socketDescriptor) {
|
void exitServer(int socketDescriptor) {
|
||||||
if (socketDescriptor >= 0)
|
if (socketDescriptor >= 0) {
|
||||||
close(socketDescriptor);
|
close(socketDescriptor);
|
||||||
|
}
|
||||||
FILE_LOG(logINFO, ("Closing %s server\n", (isControlServer ? "control":"stop")));
|
FILE_LOG(logINFO, ("Closing %s server\n", (isControlServer ? "control":"stop")));
|
||||||
FD_CLR(socketDescriptor, &readset);
|
FD_CLR(socketDescriptor, &readset);
|
||||||
isock--;
|
isock--;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "programfpga.h"
|
#include "programFpgaBlackfin.h"
|
||||||
#include "ansi.h"
|
#include "ansi.h"
|
||||||
#include "clogger.h"
|
#include "clogger.h"
|
||||||
#include "slsDetectorServer_defs.h"
|
#include "slsDetectorServer_defs.h"
|
||||||
@ -57,6 +57,12 @@ int startWritingFPGAprogram(FILE** filefp){
|
|||||||
FILE_LOG(logDEBUG1, ("Start Writing of FPGA program\n"));
|
FILE_LOG(logDEBUG1, ("Start Writing of FPGA program\n"));
|
||||||
|
|
||||||
//getting the drive
|
//getting the drive
|
||||||
|
//root:/> cat /proc/mtd
|
||||||
|
//dev: size erasesize name
|
||||||
|
//mtd0: 00040000 00020000 "bootloader(nor)"
|
||||||
|
//mtd1: 00100000 00020000 "linux kernel(nor)"
|
||||||
|
//mtd2: 002c0000 00020000 "file system(nor)"
|
||||||
|
//mtd3: 01000000 00010000 "bitfile(spi)"
|
||||||
char output[255];
|
char output[255];
|
||||||
memset(output, 0, 255);
|
memset(output, 0, 255);
|
||||||
FILE* fp = popen("awk \'$4== \"\\\"bitfile(spi)\\\"\" {print $1}\' /proc/mtd", "r");
|
FILE* fp = popen("awk \'$4== \"\\\"bitfile(spi)\\\"\" {print $1}\' /proc/mtd", "r");
|
||||||
@ -120,14 +126,14 @@ void stopWritingFPGAprogram(FILE* filefp){
|
|||||||
FILE_LOG(logINFO, ("FPGA has picked up the program from flash\n"));
|
FILE_LOG(logINFO, ("FPGA has picked up the program from flash\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
int writeFPGAProgram(char* fpgasrc, size_t fsize, FILE* filefp){
|
int writeFPGAProgram(char* fpgasrc, uint64_t fsize, FILE* filefp){
|
||||||
FILE_LOG(logDEBUG1, ("Writing of FPGA Program\n"
|
FILE_LOG(logDEBUG1, ("Writing of FPGA Program\n"
|
||||||
"\taddress of fpgasrc:%p\n"
|
"\taddress of fpgasrc:%p\n"
|
||||||
"\tfsize:%lu\n\tpointer:%p\n",
|
"\tfsize:%llu\n\tpointer:%p\n",
|
||||||
(void *)fpgasrc, fsize, (void*)filefp));
|
(void *)fpgasrc, (long long unsigned int)fsize, (void*)filefp));
|
||||||
|
|
||||||
if(fwrite((void*)fpgasrc , sizeof(char) , fsize , filefp )!= fsize){
|
if(fwrite((void*)fpgasrc , sizeof(char) , fsize , filefp )!= fsize){
|
||||||
FILE_LOG(logERROR, ("Could not write FPGA source to flash (size:%lu)\n", fsize));
|
FILE_LOG(logERROR, ("Could not write FPGA source to flash (size:%llu)\n", (long long unsigned int)fsize));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
FILE_LOG(logDEBUG1, ("program written to flash\n"));
|
FILE_LOG(logDEBUG1, ("program written to flash\n"));
|
152
slsDetectorServers/slsDetectorServer/src/programFpgaNios.c
Executable file
152
slsDetectorServers/slsDetectorServer/src/programFpgaNios.c
Executable file
@ -0,0 +1,152 @@
|
|||||||
|
#include "programFpgaNios.h"
|
||||||
|
#include "ansi.h"
|
||||||
|
#include "clogger.h"
|
||||||
|
#include "slsDetectorServer_defs.h"
|
||||||
|
|
||||||
|
#include <unistd.h> // usleep
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* global variables */
|
||||||
|
#define MTDSIZE 10
|
||||||
|
char mtdvalue[MTDSIZE] = {0};
|
||||||
|
#define NOTIFICATION_FILE "/tmp/block_shutdown"
|
||||||
|
#define MICROCONTROLLER_FILE "/dev/ttyAL0"
|
||||||
|
|
||||||
|
void NotifyServerStartSuccess() {
|
||||||
|
FILE_LOG(logINFOBLUE, ("Server started successfully\n"));
|
||||||
|
char command[255];
|
||||||
|
memset(command, 0, 255);
|
||||||
|
sprintf(command,"echo r > %s",MICROCONTROLLER_FILE);
|
||||||
|
system(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreateNotificationForCriticalTasks() {
|
||||||
|
FILE* fd = fopen(NOTIFICATION_FILE, "r");
|
||||||
|
if (fd == NULL) {
|
||||||
|
fd = fopen(NOTIFICATION_FILE, "w");
|
||||||
|
if (fd == NULL) {
|
||||||
|
FILE_LOG(logERROR, ("Could not create notication file: %s\n", NOTIFICATION_FILE));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FILE_LOG(logINFOBLUE, ("Created notification file: %s\n", NOTIFICATION_FILE));
|
||||||
|
}
|
||||||
|
fclose(fd);
|
||||||
|
NotifyCriticalTaskDone();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NotifyCriticalTask() {
|
||||||
|
FILE_LOG(logINFO, ("\tNotifying Critical Task Ongoing\n"));
|
||||||
|
char command[255];
|
||||||
|
memset(command, 0, 255);
|
||||||
|
sprintf(command,"echo 1 > %s",NOTIFICATION_FILE);
|
||||||
|
system(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NotifyCriticalTaskDone() {
|
||||||
|
FILE_LOG(logINFO, ("\tNotifying Critical Task Done\n"));
|
||||||
|
char command[255];
|
||||||
|
memset(command, 0, 255);
|
||||||
|
sprintf(command,"echo 0 > %s",NOTIFICATION_FILE);
|
||||||
|
system(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rebootControllerAndFPGA() {
|
||||||
|
FILE_LOG(logDEBUG1, ("Reseting FPGA...\n"));
|
||||||
|
char command[255];
|
||||||
|
memset(command, 0, 255);
|
||||||
|
sprintf(command,"echo z > %s",MICROCONTROLLER_FILE);
|
||||||
|
system(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
int findFlash(char* mess) {
|
||||||
|
FILE_LOG(logDEBUG1, ("Finding flash drive...\n"));
|
||||||
|
//getting the drive
|
||||||
|
// # cat /proc/mtd
|
||||||
|
// dev: size erasesize name
|
||||||
|
// mtd0: 00580000 00010000 "qspi BootInfo + Factory Image"
|
||||||
|
// mtd1: 00580000 00010000 "qspi Application Image"
|
||||||
|
// mtd2: 00800000 00010000 "qspi Linux Kernel with initramfs"
|
||||||
|
// mtd3: 00800000 00010000 "qspi Linux Kernel with initramfs Backup"
|
||||||
|
// mtd4: 02500000 00010000 "qspi ubi filesystem"
|
||||||
|
// mtd5: 04000000 00010000 "qspi Complete Flash"
|
||||||
|
char output[255];
|
||||||
|
memset(output, 0, 255);
|
||||||
|
FILE* fp = popen("awk \'$5== \"Application\" {print $1}\' /proc/mtd", "r");
|
||||||
|
if (fp == NULL) {
|
||||||
|
strcpy(mess, "popen returned NULL. Need that to get mtd drive.\n");
|
||||||
|
FILE_LOG(logERROR, (mess));
|
||||||
|
return RO_TRIGGER_IN_FALLING_EDGE;
|
||||||
|
}
|
||||||
|
if (fgets(output, sizeof(output), fp) == NULL) {
|
||||||
|
strcpy(mess, "fgets returned NULL. Need that to get mtd drive.\n");
|
||||||
|
FILE_LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
pclose(fp);
|
||||||
|
memset(mtdvalue, 0, MTDSIZE);
|
||||||
|
strcpy(mtdvalue, "/dev/");
|
||||||
|
char* pch = strtok(output, ":");
|
||||||
|
if (pch == NULL){
|
||||||
|
strcpy (mess, "Could not get mtd value\n");
|
||||||
|
FILE_LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
strcat(mtdvalue, pch);
|
||||||
|
FILE_LOG(logINFO, ("\tFlash drive found: %s\n", mtdvalue));
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void eraseFlash() {
|
||||||
|
FILE_LOG(logDEBUG1, ("Erasing Flash...\n"));
|
||||||
|
char command[255];
|
||||||
|
memset(command, 0, 255);
|
||||||
|
sprintf(command,"flash_erase %s 0 0",mtdvalue);
|
||||||
|
system(command);
|
||||||
|
FILE_LOG(logINFO, ("\tFlash erased\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
int eraseAndWriteToFlash(char* mess, char* fpgasrc, uint64_t fsize) {
|
||||||
|
if (findFlash(mess) == FAIL) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
NotifyCriticalTask();
|
||||||
|
eraseFlash();
|
||||||
|
|
||||||
|
// open file pointer to flash
|
||||||
|
FILE *filefp = fopen(mtdvalue, "w");
|
||||||
|
if(filefp == NULL){
|
||||||
|
NotifyCriticalTaskDone();
|
||||||
|
sprintf (mess, "Unable to open %s in write mode\n", mtdvalue);
|
||||||
|
FILE_LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
FILE_LOG(logINFO, ("\tFlash ready for writing\n"));
|
||||||
|
|
||||||
|
// write to flash
|
||||||
|
if (writeFPGAProgram(mess, fpgasrc, fsize, filefp) == FAIL) {
|
||||||
|
NotifyCriticalTaskDone();
|
||||||
|
fclose(filefp);
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(filefp);
|
||||||
|
NotifyCriticalTaskDone();
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int writeFPGAProgram(char* mess, char* fpgasrc, uint64_t fsize, FILE* filefp) {
|
||||||
|
FILE_LOG(logDEBUG1, ("Writing to flash...\n"
|
||||||
|
"\taddress of fpgasrc:%p\n"
|
||||||
|
"\tfsize:%lu\n\tpointer:%p\n",
|
||||||
|
(void *)fpgasrc, fsize, (void*)filefp));
|
||||||
|
|
||||||
|
uint64_t retval = fwrite((void*)fpgasrc , sizeof(char) , fsize , filefp);
|
||||||
|
if (retval != fsize) {
|
||||||
|
sprintf (mess, "Could not write FPGA source to flash (size:%llu), write %llu\n", (long long unsigned int) fsize, (long long unsigned int)retval);
|
||||||
|
FILE_LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
FILE_LOG(logINFO, ("\tProgram written to flash\n"));
|
||||||
|
return OK;
|
||||||
|
}
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
// Global variables from communication_funcs
|
// Global variables from communication_funcs
|
||||||
extern int isControlServer;
|
extern int isControlServer;
|
||||||
@ -19,6 +19,8 @@ extern int ret;
|
|||||||
// Global variables from slsDetectorServer_funcs
|
// Global variables from slsDetectorServer_funcs
|
||||||
extern int sockfd;
|
extern int sockfd;
|
||||||
extern int debugflag;
|
extern int debugflag;
|
||||||
|
extern int checkModuleFlag;
|
||||||
|
|
||||||
|
|
||||||
// Global variables from slsDetectorFunctionList
|
// Global variables from slsDetectorFunctionList
|
||||||
#ifdef GOTTHARDD
|
#ifdef GOTTHARDD
|
||||||
@ -67,7 +69,11 @@ int main(int argc, char *argv[]){
|
|||||||
FILE_LOG(logINFO, ("Detected developer mode\n"));
|
FILE_LOG(logINFO, ("Detected developer mode\n"));
|
||||||
debugflag = 1;
|
debugflag = 1;
|
||||||
}
|
}
|
||||||
else if(!strcasecmp(argv[i],"--port")){
|
else if(!strcasecmp(argv[i],"-nomodule")){
|
||||||
|
FILE_LOG(logINFO, ("Detected No Module mode\n"));
|
||||||
|
checkModuleFlag = 0;
|
||||||
|
}
|
||||||
|
else if(!strcasecmp(argv[i],"-port")){
|
||||||
if ((i + 1) >= argc) {
|
if ((i + 1) >= argc) {
|
||||||
FILE_LOG(logERROR, ("no port value given. Exiting.\n"));
|
FILE_LOG(logERROR, ("no port value given. Exiting.\n"));
|
||||||
return -1;
|
return -1;
|
||||||
@ -105,7 +111,7 @@ int main(int argc, char *argv[]){
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < argc; ++i)
|
for (i = 0; i < argc; ++i)
|
||||||
sprintf(cmd, "%s %s", cmd, argv[i]);
|
sprintf(cmd, "%s %s", cmd, argv[i]);
|
||||||
sprintf(cmd,"%s -stopserver --port %d &", cmd, portno + 1);
|
sprintf(cmd,"%s -stopserver -port %d &", cmd, portno + 1);
|
||||||
FILE_LOG(logDEBUG1, ("Command to start stop server:%s\n", cmd));
|
FILE_LOG(logDEBUG1, ("Command to start stop server:%s\n", cmd));
|
||||||
system(cmd);
|
system(cmd);
|
||||||
}
|
}
|
||||||
@ -143,9 +149,13 @@ int main(int argc, char *argv[]){
|
|||||||
exitServer(sockfd);
|
exitServer(sockfd);
|
||||||
|
|
||||||
if (retval == REBOOT) {
|
if (retval == REBOOT) {
|
||||||
FILE_LOG(logINFOBLUE,("Rebooting!\n"));
|
FILE_LOG(logINFORED,("Rebooting!\n"));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
|
rebootControllerAndFPGA();
|
||||||
|
#else
|
||||||
system("reboot");
|
system("reboot");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
FILE_LOG(logINFO,("Goodbye!\n"));
|
FILE_LOG(logINFO,("Goodbye!\n"));
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2,6 +2,13 @@
|
|||||||
#include "slsDetectorFunctionList.h"
|
#include "slsDetectorFunctionList.h"
|
||||||
#include "communication_funcs.h"
|
#include "communication_funcs.h"
|
||||||
#include "clogger.h"
|
#include "clogger.h"
|
||||||
|
#ifndef VIRTUAL
|
||||||
|
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
|
#include "programFpgaNios.h"
|
||||||
|
#elif defined(CHIPTESTBOARDD) || defined(JUNGFRAUD) || defined(MOENCHD)
|
||||||
|
#include "programFpgaBlackfin.h"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
@ -39,6 +46,7 @@ extern char mess[MAX_STR_LENGTH];
|
|||||||
// Variables that will be exported
|
// Variables that will be exported
|
||||||
int sockfd = 0;
|
int sockfd = 0;
|
||||||
int debugflag = 0;
|
int debugflag = 0;
|
||||||
|
int checkModuleFlag = 1;
|
||||||
udpStruct udpDetails = {32410, 32411, 50001, 50002, 0, 0, 0, 0, 0, 0, 0, 0};
|
udpStruct udpDetails = {32410, 32411, 50001, 50002, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
int configured = FAIL;
|
int configured = FAIL;
|
||||||
char configureMessage[MAX_STR_LENGTH]="udp parameters not configured yet";
|
char configureMessage[MAX_STR_LENGTH]="udp parameters not configured yet";
|
||||||
@ -484,7 +492,7 @@ void function_table() {
|
|||||||
flist[F_GET_INJECT_CHANNEL] = &get_inject_channel;
|
flist[F_GET_INJECT_CHANNEL] = &get_inject_channel;
|
||||||
flist[F_SET_VETO_PHOTON] = &set_veto_photon;
|
flist[F_SET_VETO_PHOTON] = &set_veto_photon;
|
||||||
flist[F_GET_VETO_PHOTON] = &get_veto_photon;
|
flist[F_GET_VETO_PHOTON] = &get_veto_photon;
|
||||||
flist[F_SET_VETO_REFERENCE] = &set_veto_refernce;
|
flist[F_SET_VETO_REFERENCE] = &set_veto_reference;
|
||||||
flist[F_GET_BURST_MODE] = &get_burst_mode;
|
flist[F_GET_BURST_MODE] = &get_burst_mode;
|
||||||
flist[F_SET_BURST_MODE] = &set_burst_mode;
|
flist[F_SET_BURST_MODE] = &set_burst_mode;
|
||||||
flist[F_SET_ADC_ENABLE_MASK_10G] = &set_adc_enable_mask_10g;
|
flist[F_SET_ADC_ENABLE_MASK_10G] = &set_adc_enable_mask_10g;
|
||||||
@ -593,27 +601,6 @@ int M_nofunc(int file_des) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Jungfrau program mode
|
|
||||||
int M_nofuncMode(int file_des) {
|
|
||||||
ret = FAIL;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
|
|
||||||
// to receive any arguments
|
|
||||||
int n = 1;
|
|
||||||
while (n > 0)
|
|
||||||
n = receiveData(file_des,mess,MAX_STR_LENGTH,OTHER);
|
|
||||||
|
|
||||||
sprintf(mess,"This Function %s cannot be executed as the "
|
|
||||||
"On-board detector server in update mode.\n"
|
|
||||||
"Restart detector server in normal mode (without any arguments) to continue.\n",
|
|
||||||
getFunctionName((enum detFuncs)fnum));
|
|
||||||
FILE_LOG(logERROR, (mess));
|
|
||||||
return Server_SendResult(file_des, OTHER, NO_UPDATE, NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int exec_command(int file_des) {
|
int exec_command(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
@ -685,10 +672,6 @@ int set_timing_mode(int file_des) {
|
|||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
FILE_LOG(logDEBUG1, ("Setting external communication mode to %d\n", arg));
|
FILE_LOG(logDEBUG1, ("Setting external communication mode to %d\n", arg));
|
||||||
|
|
||||||
#ifdef GOTTHARD2D
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
|
|
||||||
// set
|
// set
|
||||||
if ((arg != GET_TIMING_MODE) && (Server_VerifyLock() == OK)) {
|
if ((arg != GET_TIMING_MODE) && (Server_VerifyLock() == OK)) {
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
@ -709,7 +692,6 @@ int set_timing_mode(int file_des) {
|
|||||||
retval = getTiming();
|
retval = getTiming();
|
||||||
validate((int)arg, (int)retval, "set timing mode", DEC);
|
validate((int)arg, (int)retval, "set timing mode", DEC);
|
||||||
FILE_LOG(logDEBUG1, ("Timing Mode: %d\n",retval));
|
FILE_LOG(logDEBUG1, ("Timing Mode: %d\n",retval));
|
||||||
#endif
|
|
||||||
|
|
||||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||||
}
|
}
|
||||||
@ -1000,8 +982,8 @@ int set_dac(int file_des) {
|
|||||||
case VCOM_CDS:
|
case VCOM_CDS:
|
||||||
serverDacIndex = G2_VCOM_CDS;
|
serverDacIndex = G2_VCOM_CDS;
|
||||||
break;
|
break;
|
||||||
case VREF_RESTORE:
|
case VREF_RSTORE:
|
||||||
serverDacIndex = G2_VREF_RESTORE;
|
serverDacIndex = G2_VREF_RSTORE;
|
||||||
break;
|
break;
|
||||||
case VB_OPA_1ST:
|
case VB_OPA_1ST:
|
||||||
serverDacIndex = G2_VB_OPA_1ST;
|
serverDacIndex = G2_VB_OPA_1ST;
|
||||||
@ -1658,7 +1640,7 @@ int set_settings(int file_des) {
|
|||||||
if (receiveData(file_des, &isett, sizeof(isett), INT32) < 0)
|
if (receiveData(file_des, &isett, sizeof(isett), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
|
|
||||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
FILE_LOG(logDEBUG1, ("Setting settings %d\n", isett));
|
FILE_LOG(logDEBUG1, ("Setting settings %d\n", isett));
|
||||||
@ -1682,12 +1664,16 @@ int set_settings(int file_des) {
|
|||||||
case LOWGAIN:
|
case LOWGAIN:
|
||||||
case MEDIUMGAIN:
|
case MEDIUMGAIN:
|
||||||
case VERYHIGHGAIN:
|
case VERYHIGHGAIN:
|
||||||
|
#elif GOTTHARD2D
|
||||||
|
case DYNAMICGAIN:
|
||||||
|
case FIXGAIN1:
|
||||||
|
case FIXGAIN2:
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (myDetectorType == EIGER) {
|
if (myDetectorType == EIGER) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess, "Cannot set settings via SET_SETTINGS, use SET_MODULE\n");
|
sprintf(mess, "Cannot set settings via SET_SETTINGS, use SET_MODULE (set threshold)\n");
|
||||||
FILE_LOG(logERROR,(mess));
|
FILE_LOG(logERROR,(mess));
|
||||||
} else
|
} else
|
||||||
modeNotImplemented("Settings Index", (int)isett);
|
modeNotImplemented("Settings Index", (int)isett);
|
||||||
@ -1700,6 +1686,7 @@ int set_settings(int file_des) {
|
|||||||
FILE_LOG(logDEBUG1, ("Settings: %d\n", retval));
|
FILE_LOG(logDEBUG1, ("Settings: %d\n", retval));
|
||||||
validate((int)isett, (int)retval, "set settings", DEC);
|
validate((int)isett, (int)retval, "set settings", DEC);
|
||||||
#if defined(JUNGFRAUD) || defined (GOTTHARDD)
|
#if defined(JUNGFRAUD) || defined (GOTTHARDD)
|
||||||
|
// gotthard2 does not set default dacs
|
||||||
if (ret == OK && isett >= 0) {
|
if (ret == OK && isett >= 0) {
|
||||||
ret = setDefaultDacs();
|
ret = setDefaultDacs();
|
||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
@ -1782,6 +1769,12 @@ int start_acquisition(int file_des) {
|
|||||||
FILE_LOG(logERROR,(mess));
|
FILE_LOG(logERROR,(mess));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
#ifdef GOTTHARD2D
|
||||||
|
if (updateAcquisitionRegisters(mess) == FAIL) {
|
||||||
|
ret = FAIL;
|
||||||
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
if (configured == FAIL) {
|
if (configured == FAIL) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
@ -1792,12 +1785,8 @@ int start_acquisition(int file_des) {
|
|||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(VIRTUAL)
|
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(VIRTUAL)
|
||||||
sprintf(mess, "Could not start acquisition. Could not create udp socket in server. Check udp_dstip & udp_dstport.\n");
|
sprintf(mess, "Could not start acquisition. Could not create udp socket in server. Check udp_dstip & udp_dstport.\n");
|
||||||
#else
|
|
||||||
#if defined(GOTTHARD2D)
|
|
||||||
sprintf(mess, "Could not start acquisition due to #frames > %d in burst mode\n", MAX_FRAMES_IN_BURST_MODE);
|
|
||||||
#else
|
#else
|
||||||
sprintf(mess, "Could not start acquisition\n");
|
sprintf(mess, "Could not start acquisition\n");
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
FILE_LOG(logERROR,(mess));
|
FILE_LOG(logERROR,(mess));
|
||||||
}
|
}
|
||||||
@ -1916,6 +1905,12 @@ int start_and_read_all(int file_des) {
|
|||||||
FILE_LOG(logERROR,(mess));
|
FILE_LOG(logERROR,(mess));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
#ifdef GOTTHARD2D
|
||||||
|
if (updateAcquisitionRegisters(mess) == FAIL) {
|
||||||
|
ret = FAIL;
|
||||||
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
if (configured == FAIL) {
|
if (configured == FAIL) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
@ -1926,12 +1921,8 @@ int start_and_read_all(int file_des) {
|
|||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
#if defined(VIRTUAL) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
#if defined(VIRTUAL) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||||
sprintf(mess, "Could not start acquisition. Could not create udp socket in server. Check udp_dstip & udp_dstport.\n");
|
sprintf(mess, "Could not start acquisition. Could not create udp socket in server. Check udp_dstip & udp_dstport.\n");
|
||||||
#else
|
|
||||||
#if defined(GOTTHARD2D)
|
|
||||||
sprintf(mess, "Could not start acquisition due to #frames > %d in burst mode\n", MAX_FRAMES_IN_BURST_MODE);
|
|
||||||
#else
|
#else
|
||||||
sprintf(mess, "Could not start acquisition\n");
|
sprintf(mess, "Could not start acquisition\n");
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
FILE_LOG(logERROR,(mess));
|
FILE_LOG(logERROR,(mess));
|
||||||
}
|
}
|
||||||
@ -2225,7 +2216,7 @@ int get_delay_after_trigger(int file_des) {
|
|||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int64_t retval = -1;
|
int64_t retval = -1;
|
||||||
|
|
||||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D)
|
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// get only
|
// get only
|
||||||
@ -2244,7 +2235,7 @@ int set_delay_after_trigger(int file_des) {
|
|||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
FILE_LOG(logDEBUG1, ("Setting delay after trigger %lld ns\n", (long long int)arg));
|
FILE_LOG(logDEBUG1, ("Setting delay after trigger %lld ns\n", (long long int)arg));
|
||||||
|
|
||||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D)
|
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
@ -2458,7 +2449,7 @@ int get_period_left(int file_des) {
|
|||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int64_t retval = -1;
|
int64_t retval = -1;
|
||||||
|
|
||||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D)
|
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// get only
|
// get only
|
||||||
@ -2473,7 +2464,7 @@ int get_delay_after_trigger_left(int file_des) {
|
|||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int64_t retval = -1;
|
int64_t retval = -1;
|
||||||
|
|
||||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D)
|
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// get only
|
// get only
|
||||||
@ -2518,7 +2509,7 @@ int get_frames_from_start(int file_des) {
|
|||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int64_t retval = -1;
|
int64_t retval = -1;
|
||||||
|
|
||||||
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D)
|
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// get only
|
// get only
|
||||||
@ -2533,7 +2524,7 @@ int get_actual_time(int file_des) {
|
|||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int64_t retval = -1;
|
int64_t retval = -1;
|
||||||
|
|
||||||
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D)
|
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// get only
|
// get only
|
||||||
@ -2548,7 +2539,7 @@ int get_measurement_time(int file_des) {
|
|||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int64_t retval = -1;
|
int64_t retval = -1;
|
||||||
|
|
||||||
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D)
|
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// get only
|
// get only
|
||||||
@ -2582,7 +2573,7 @@ int set_dynamic_range(int file_des) {
|
|||||||
#elif EIGERD
|
#elif EIGERD
|
||||||
case 4: case 8: case 16: case 32:
|
case 4: case 8: case 16: case 32:
|
||||||
#endif
|
#endif
|
||||||
#if defined(GOTTHARD) || defined(JUNGFRAU) || defined(CHIPTESTBOARD) || defined(MOENCH) || defined(GOTTHARD2)
|
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(GOTTHARD2D)
|
||||||
case 16:
|
case 16:
|
||||||
#endif
|
#endif
|
||||||
retval = setDynamicRange(dr);
|
retval = setDynamicRange(dr);
|
||||||
@ -3190,7 +3181,7 @@ int set_pattern_mask(int file_des) {
|
|||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
FILE_LOG(logDEBUG1, ("Set Pattern Mask to %d\n", arg));
|
FILE_LOG(logDEBUG1, ("Set Pattern Mask to %d\n", arg));
|
||||||
|
|
||||||
#if (!defined(MOENCHD)) && (!defined(CHIPTESTBOARDD))
|
#if !defined(MOENCHD) && !defined(CHIPTESTBOARDD) && !defined(MYTHEN3D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
@ -3211,7 +3202,7 @@ int get_pattern_mask(int file_des) {
|
|||||||
|
|
||||||
FILE_LOG(logDEBUG1, ("Get Pattern Mask\n"));
|
FILE_LOG(logDEBUG1, ("Get Pattern Mask\n"));
|
||||||
|
|
||||||
#if (!defined(MOENCHD)) && (!defined(CHIPTESTBOARDD))
|
#if !defined(MOENCHD) && !defined(CHIPTESTBOARDD) && !defined(MYTHEN3D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only get
|
// only get
|
||||||
@ -3231,7 +3222,7 @@ int set_pattern_bit_mask(int file_des) {
|
|||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
FILE_LOG(logDEBUG1, ("Set Pattern Bit Mask to %d\n", arg));
|
FILE_LOG(logDEBUG1, ("Set Pattern Bit Mask to %d\n", arg));
|
||||||
|
|
||||||
#if (!defined(MOENCHD)) && (!defined(CHIPTESTBOARDD))
|
#if !defined(MOENCHD) && !defined(CHIPTESTBOARDD) && !defined(MYTHEN3D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
@ -3252,7 +3243,7 @@ int get_pattern_bit_mask(int file_des){
|
|||||||
|
|
||||||
FILE_LOG(logDEBUG1, ("Get Pattern Bit Mask\n"));
|
FILE_LOG(logDEBUG1, ("Get Pattern Bit Mask\n"));
|
||||||
|
|
||||||
#if (!defined(MOENCHD)) && (!defined(CHIPTESTBOARDD))
|
#if !defined(MOENCHD) && !defined(CHIPTESTBOARDD) && !defined(MYTHEN3D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only get
|
// only get
|
||||||
@ -3705,7 +3696,7 @@ int program_fpga(int file_des) {
|
|||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
|
|
||||||
#if defined(EIGERD) || defined(GOTTHARDD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
#if defined(EIGERD) || defined(GOTTHARDD)
|
||||||
//to receive any arguments
|
//to receive any arguments
|
||||||
int n = 1;
|
int n = 1;
|
||||||
while (n > 0)
|
while (n > 0)
|
||||||
@ -3718,9 +3709,38 @@ int program_fpga(int file_des) {
|
|||||||
|
|
||||||
FILE_LOG(logINFOBLUE, ("Programming FPGA...\n"));
|
FILE_LOG(logINFOBLUE, ("Programming FPGA...\n"));
|
||||||
|
|
||||||
size_t filesize = 0;
|
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
size_t totalsize = 0;
|
uint64_t filesize = 0;
|
||||||
size_t unitprogramsize = 0;
|
// filesize
|
||||||
|
if (receiveData(file_des,&filesize,sizeof(filesize),INT64) < 0)
|
||||||
|
return printSocketReadError();
|
||||||
|
FILE_LOG(logDEBUG1, ("Total program size is: %llx\n", (long long unsigned int)filesize));
|
||||||
|
if (filesize > NIOS_MAX_APP_IMAGE_SIZE) {
|
||||||
|
ret = FAIL;
|
||||||
|
sprintf(mess,"Could not start programming FPGA. File size 0x%llx exceeds max size 0x%llx. Forgot Compression?\n", (long long unsigned int) filesize, (long long unsigned int)NIOS_MAX_APP_IMAGE_SIZE);
|
||||||
|
FILE_LOG(logERROR,(mess));
|
||||||
|
}
|
||||||
|
Server_SendResult(file_des, INT32, NO_UPDATE, NULL, 0);
|
||||||
|
|
||||||
|
// receive program
|
||||||
|
if (ret == OK) {
|
||||||
|
char* fpgasrc = (char*)malloc(filesize);
|
||||||
|
if (receiveData(file_des, fpgasrc, filesize, OTHER) < 0)
|
||||||
|
return printSocketReadError();
|
||||||
|
|
||||||
|
ret = eraseAndWriteToFlash(mess, fpgasrc, filesize);
|
||||||
|
Server_SendResult(file_des, INT32, NO_UPDATE, NULL, 0);
|
||||||
|
|
||||||
|
//free resources
|
||||||
|
if (fpgasrc != NULL)
|
||||||
|
free(fpgasrc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#else // jungfrau, ctb, moench
|
||||||
|
uint64_t filesize = 0;
|
||||||
|
uint64_t totalsize = 0;
|
||||||
|
uint64_t unitprogramsize = 0;
|
||||||
char* fpgasrc = NULL;
|
char* fpgasrc = NULL;
|
||||||
FILE* fp = NULL;
|
FILE* fp = NULL;
|
||||||
|
|
||||||
@ -3728,7 +3748,7 @@ int program_fpga(int file_des) {
|
|||||||
if (receiveData(file_des,&filesize,sizeof(filesize),INT32) < 0)
|
if (receiveData(file_des,&filesize,sizeof(filesize),INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
totalsize = filesize;
|
totalsize = filesize;
|
||||||
FILE_LOG(logDEBUG1, ("Total program size is: %d\n", totalsize));
|
FILE_LOG(logDEBUG1, ("Total program size is: %lld\n", (long long unsigned int)totalsize));
|
||||||
|
|
||||||
|
|
||||||
// opening file pointer to flash and telling FPGA to not touch flash
|
// opening file pointer to flash and telling FPGA to not touch flash
|
||||||
@ -3753,7 +3773,7 @@ int program_fpga(int file_des) {
|
|||||||
unitprogramsize = MAX_FPGAPROGRAMSIZE; //2mb
|
unitprogramsize = MAX_FPGAPROGRAMSIZE; //2mb
|
||||||
if (unitprogramsize > filesize) //less than 2mb
|
if (unitprogramsize > filesize) //less than 2mb
|
||||||
unitprogramsize = filesize;
|
unitprogramsize = filesize;
|
||||||
FILE_LOG(logDEBUG1, ("unit size to receive is:%d\nfilesize:%d\n", unitprogramsize, filesize));
|
FILE_LOG(logDEBUG1, ("unit size to receive is:%lld\nfilesize:%lld\n", (long long unsigned int)unitprogramsize, (long long unsigned int)filesize));
|
||||||
|
|
||||||
//receive part of program
|
//receive part of program
|
||||||
if (receiveData(file_des,fpgasrc,unitprogramsize,OTHER) < 0)
|
if (receiveData(file_des,fpgasrc,unitprogramsize,OTHER) < 0)
|
||||||
@ -3778,7 +3798,6 @@ int program_fpga(int file_des) {
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\n");
|
|
||||||
if (ret == OK) {
|
if (ret == OK) {
|
||||||
FILE_LOG(logINFO, ("Done copying program\n"));
|
FILE_LOG(logINFO, ("Done copying program\n"));
|
||||||
}
|
}
|
||||||
@ -3792,7 +3811,12 @@ int program_fpga(int file_des) {
|
|||||||
if (fp != NULL)
|
if (fp != NULL)
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
FILE_LOG(logINFO, ("Completed program fpga command with %s\n", (ret == OK ? "success" : "fail")));
|
#endif // end of Blackfin programming
|
||||||
|
if (ret == FAIL) {
|
||||||
|
FILE_LOG(logERROR, ("Program FPGA FAIL!\n"));
|
||||||
|
} else {
|
||||||
|
FILE_LOG(logINFOGREEN, ("Programming FPGA completed successfully\n"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -3836,27 +3860,31 @@ int power_chip(int file_des) {
|
|||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
FILE_LOG(logDEBUG1, ("Powering chip to %d\n", arg));
|
FILE_LOG(logDEBUG1, ("Powering chip to %d\n", arg));
|
||||||
|
|
||||||
#if (!defined(JUNGFRAUD)) && (!defined(MOENCHD)) && (!defined(MYTHEN3D))
|
#if !defined(JUNGFRAUD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// set & get
|
// set & get
|
||||||
if ((arg == -1) || (Server_VerifyLock() == OK)) {
|
if ((arg == -1) || (Server_VerifyLock() == OK)) {
|
||||||
#ifdef MYTHEN3D
|
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
// check only when powering on
|
// check only when powering on
|
||||||
if (arg != -1 && arg != 0) {
|
if (arg != -1 && arg != 0) {
|
||||||
int type_ret = checkDetectorType();
|
if (checkModuleFlag) {
|
||||||
if (type_ret == -1) {
|
int type_ret = checkDetectorType();
|
||||||
ret = FAIL;
|
if (type_ret == -1) {
|
||||||
sprintf(mess, "Could not power on chip. Could not open file to get type of module attached.\n");
|
ret = FAIL;
|
||||||
FILE_LOG(logERROR,(mess));
|
sprintf(mess, "Could not power on chip. Could not open file to get type of module attached.\n");
|
||||||
} else if (type_ret == -2) {
|
FILE_LOG(logERROR,(mess));
|
||||||
ret = FAIL;
|
} else if (type_ret == -2) {
|
||||||
sprintf(mess, "Could not power on chip. No module attached!\n");
|
ret = FAIL;
|
||||||
FILE_LOG(logERROR,(mess));
|
sprintf(mess, "Could not power on chip. No module attached!\n");
|
||||||
} else if (type_ret == FAIL) {
|
FILE_LOG(logERROR,(mess));
|
||||||
ret = FAIL;
|
} else if (type_ret == FAIL) {
|
||||||
sprintf(mess, "Could not power on chip. Wrong module attached!\n");
|
ret = FAIL;
|
||||||
FILE_LOG(logERROR,(mess));
|
sprintf(mess, "Could not power on chip. Wrong module attached!\n");
|
||||||
|
FILE_LOG(logERROR,(mess));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
FILE_LOG(logINFOBLUE, ("In No-Module mode: Ignoring module type. Continuing.\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -4292,13 +4320,22 @@ int copy_detector_server(int file_des) {
|
|||||||
int reboot_controller(int file_des) {
|
int reboot_controller(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
#ifdef EIGERD
|
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
|
if (getHardwareVersionNumber() == 0) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess, "Old board version, reboot by yourself please!\n");
|
||||||
|
FILE_LOG(logINFORED, (mess));
|
||||||
|
Server_SendResult(file_des, INT32, NO_UPDATE, NULL, 0);
|
||||||
|
return GOODBYE;
|
||||||
|
}
|
||||||
|
ret = REBOOT;
|
||||||
|
#elif EIGERD
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
return ret;
|
|
||||||
#else
|
#else
|
||||||
FILE_LOG(logINFORED, ("Rebooting controller\n"));
|
ret = REBOOT;
|
||||||
return REBOOT;
|
|
||||||
#endif
|
#endif
|
||||||
|
Server_SendResult(file_des, INT32, NO_UPDATE, NULL, 0);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -6446,7 +6483,7 @@ int get_veto_photon(int file_des) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int set_veto_refernce(int file_des) {
|
int set_veto_reference(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int args[2] = {-1, -1};
|
int args[2] = {-1, -1};
|
||||||
@ -6486,22 +6523,35 @@ int set_veto_refernce(int file_des) {
|
|||||||
int set_burst_mode(int file_des) {
|
int set_burst_mode(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int arg = -1;
|
enum burstMode arg = BURST_OFF;
|
||||||
|
|
||||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
FILE_LOG(logINFO, ("Setting burst mode: %d\n", arg));
|
FILE_LOG(logDEBUG1, ("Setting burst mode: %d\n", arg));
|
||||||
|
|
||||||
#ifndef GOTTHARD2D
|
#ifndef GOTTHARD2D
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
arg = arg == 0 ? 0 : 1;
|
switch (arg) {
|
||||||
ret = setBurstMode(arg);
|
case BURST_OFF:
|
||||||
if (ret == FAIL) {
|
case BURST_INTERNAL:
|
||||||
sprintf(mess, "Could not set burst mode to %d\n", arg);
|
case BURST_EXTERNAL:
|
||||||
FILE_LOG(logERROR, (mess));
|
break;
|
||||||
|
default:
|
||||||
|
modeNotImplemented("Burst mode", (int)arg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ret == OK) {
|
||||||
|
setBurstMode(arg);
|
||||||
|
enum burstMode retval = getBurstMode();
|
||||||
|
FILE_LOG(logDEBUG, ("burst mode retval: %d\n", retval));
|
||||||
|
if (retval != arg) {
|
||||||
|
ret = FAIL;
|
||||||
|
sprintf(mess, "Could not set burst type. Set %d, got %d\n", arg, retval);
|
||||||
|
FILE_LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -6512,7 +6562,7 @@ int set_burst_mode(int file_des) {
|
|||||||
int get_burst_mode(int file_des) {
|
int get_burst_mode(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int retval = -1;
|
enum burstMode retval = BURST_OFF;
|
||||||
|
|
||||||
FILE_LOG(logDEBUG1, ("Getting burst mode\n"));
|
FILE_LOG(logDEBUG1, ("Getting burst mode\n"));
|
||||||
|
|
||||||
@ -6521,7 +6571,7 @@ int get_burst_mode(int file_des) {
|
|||||||
#else
|
#else
|
||||||
// get only
|
// get only
|
||||||
retval = getBurstMode();
|
retval = getBurstMode();
|
||||||
FILE_LOG(logDEBUG1, ("Get burst mode:%d\n", retval));
|
FILE_LOG(logDEBUG1, ("Get burst mode retval:%d\n", retval));
|
||||||
#endif
|
#endif
|
||||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
set(SOURCES
|
set(SOURCES
|
||||||
src/multiSlsDetector.cpp
|
src/DetectorImpl.cpp
|
||||||
src/slsDetectorUsers.cpp
|
src/slsDetectorUsers.cpp
|
||||||
src/slsDetector.cpp
|
src/slsDetector.cpp
|
||||||
src/Detector.cpp
|
src/Detector.cpp
|
||||||
@ -32,7 +32,9 @@ target_link_libraries(slsDetectorShared PUBLIC
|
|||||||
slsProjectOptions
|
slsProjectOptions
|
||||||
slsProjectWarnings
|
slsProjectWarnings
|
||||||
slsSupportLib
|
slsSupportLib
|
||||||
${ZeroMQ_LIBRARIES}
|
${ZeroMQ_LIBRARIES}
|
||||||
|
pthread
|
||||||
|
rt
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PUBLICHEADERS
|
set(PUBLICHEADERS
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class multiSlsDetector;
|
class DetectorImpl;
|
||||||
class detectorData;
|
class detectorData;
|
||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
@ -23,7 +23,7 @@ void freeSharedMemory(int multiId, int detPos = -1);
|
|||||||
* \class Detector
|
* \class Detector
|
||||||
*/
|
*/
|
||||||
class Detector {
|
class Detector {
|
||||||
std::unique_ptr<multiSlsDetector> pimpl;
|
std::unique_ptr<DetectorImpl> pimpl;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -95,10 +95,13 @@ class Detector {
|
|||||||
*/
|
*/
|
||||||
void setDetectorSize(const defs::xy value);
|
void setDetectorSize(const defs::xy value);
|
||||||
|
|
||||||
/** [Jungfrau][Gotthard] */
|
/** [Jungfrau][Gotthard][Gotthard2] */
|
||||||
Result<defs::detectorSettings> getSettings(Positions pos = {}) const;
|
Result<defs::detectorSettings> getSettings(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Jungfrau][Gotthard] */
|
/** [Jungfrau] Options:DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2
|
||||||
|
* [Gotthard] Options: DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN
|
||||||
|
* [Gotthard2] Options: DYNAMICGAIN, FIXGAIN1, FIXGAIN2
|
||||||
|
*/
|
||||||
void setSettings(defs::detectorSettings value, Positions pos = {});
|
void setSettings(defs::detectorSettings value, Positions pos = {});
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
@ -152,23 +155,37 @@ class Detector {
|
|||||||
|
|
||||||
void setPeriod(ns t, Positions pos = {});
|
void setPeriod(ns t, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB][Mythen3] */
|
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
Result<ns> getDelayAfterTrigger(Positions pos = {}) const;
|
Result<ns> getDelayAfterTrigger(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB][Mythen3] */
|
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
void setDelayAfterTrigger(ns value, Positions pos = {});
|
void setDelayAfterTrigger(ns value, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
|
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
Result<int64_t> getNumberOfFramesLeft(Positions pos = {}) const;
|
Result<int64_t> getNumberOfFramesLeft(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
|
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
Result<int64_t> getNumberOfTriggersLeft(Positions pos = {}) const;
|
Result<int64_t> getNumberOfTriggersLeft(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB] */
|
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
|
Result<ns> getPeriodLeft(Positions pos = {}) const;
|
||||||
|
|
||||||
|
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
Result<ns> getDelayAfterTriggerLeft(Positions pos = {}) const;
|
Result<ns> getDelayAfterTriggerLeft(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB] */
|
Result<defs::timingMode> getTimingMode(Positions pos = {}) const;
|
||||||
Result<ns> getPeriodLeft(Positions pos = {}) const;
|
|
||||||
|
/**
|
||||||
|
* [Gotthard][Jungfrau][CTB] Options: AUTO_TIMING, TRIGGER_EXPOSURE
|
||||||
|
* [Eiger] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER
|
||||||
|
*/
|
||||||
|
void setTimingMode(defs::timingMode value, Positions pos = {});
|
||||||
|
|
||||||
/** [Eiger][Jungfrau] */
|
/** [Eiger][Jungfrau] */
|
||||||
Result<defs::speedLevel> getSpeed(Positions pos = {}) const;
|
Result<defs::speedLevel> getSpeed(Positions pos = {}) const;
|
||||||
@ -192,39 +209,45 @@ class Detector {
|
|||||||
/** [Gotthard][Jungfrau][CTB] */
|
/** [Gotthard][Jungfrau][CTB] */
|
||||||
void setADCPhaseInDegrees(int value, Positions pos = {});
|
void setADCPhaseInDegrees(int value, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] Hz */
|
/** [Mythen3][Gotthard2] Hz */
|
||||||
Result<int> getClockFrequency(int clkIndex, Positions pos = {});
|
Result<int> getClockFrequency(int clkIndex, Positions pos = {});
|
||||||
|
|
||||||
/** [not implemented] Hz */
|
/** [not implemented] Hz */
|
||||||
void setClockFrequency(int clkIndex, int value, Positions pos = {});
|
void setClockFrequency(int clkIndex, int value, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
Result<int> getClockPhase(int clkIndex, Positions pos = {});
|
Result<int> getClockPhase(int clkIndex, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
void setClockPhase(int clkIndex, int value, Positions pos = {});
|
void setClockPhase(int clkIndex, int value, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
Result<int> getMaxClockPhaseShift(int clkIndex, Positions pos = {});
|
Result<int> getMaxClockPhaseShift(int clkIndex, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
Result<int> getClockPhaseinDegrees(int clkIndex, Positions pos = {});
|
Result<int> getClockPhaseinDegrees(int clkIndex, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
void setClockPhaseinDegrees(int clkIndex, int value, Positions pos = {});
|
void setClockPhaseinDegrees(int clkIndex, int value, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
Result<int> getClockDivider(int clkIndex, Positions pos = {});
|
Result<int> getClockDivider(int clkIndex, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
void setClockDivider(int clkIndex, int value, Positions pos = {});
|
void setClockDivider(int clkIndex, int value, Positions pos = {});
|
||||||
|
|
||||||
Result<int> getHighVoltage(Positions pos = {}) const;
|
Result<int> getHighVoltage(Positions pos = {}) const;
|
||||||
|
|
||||||
|
/** [Jungfrau][Mythen3][Gotthard2] */
|
||||||
|
Result<bool> getPowerChip(Positions pos = {}) const;
|
||||||
|
|
||||||
|
/** [Jungfrau][Mythen3][Gotthard2] */
|
||||||
|
void setPowerChip(bool on, Positions pos = {});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [Gotthard Options: 0, 90, 110, 120, 150, 180, 200]
|
* [Gotthard] Options: 0, 90, 110, 120, 150, 180, 200
|
||||||
* [Jungfrau, CTB Options: 0, 60 - 200]
|
* [Jungfrau], CTB Options: 0, 60 - 200
|
||||||
* [Eiger Options: 0 - 200]
|
* [Eiger][Mythen3][Gotthard2] Options: 0 - 200
|
||||||
*/
|
*/
|
||||||
void setHighVoltage(int value, Positions pos = {});
|
void setHighVoltage(int value, Positions pos = {});
|
||||||
|
|
||||||
@ -249,14 +272,6 @@ class Detector {
|
|||||||
/* [Gotthard2] */
|
/* [Gotthard2] */
|
||||||
void setOnChipDAC(defs::dacIndex index, int chipIndex, int value, Positions pos = {});
|
void setOnChipDAC(defs::dacIndex index, int chipIndex, int value, Positions pos = {});
|
||||||
|
|
||||||
Result<defs::timingMode> getTimingMode(Positions pos = {}) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [Gotthard, Jungfrau, CTB Options: AUTO_TIMING, TRIGGER_EXPOSURE]
|
|
||||||
* [Eiger Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER]
|
|
||||||
*/
|
|
||||||
void setTimingMode(defs::timingMode value, Positions pos = {});
|
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
* Acquisition *
|
* Acquisition *
|
||||||
@ -807,12 +822,6 @@ class Detector {
|
|||||||
/** [Jungfrau] */
|
/** [Jungfrau] */
|
||||||
void resetTemperatureEvent(Positions pos = {});
|
void resetTemperatureEvent(Positions pos = {});
|
||||||
|
|
||||||
/** [Jungfrau] */
|
|
||||||
Result<bool> getPowerChip(Positions pos = {}) const;
|
|
||||||
|
|
||||||
/** [Jungfrau] */
|
|
||||||
void setPowerChip(bool on, Positions pos = {});
|
|
||||||
|
|
||||||
/** [Jungfrau] */
|
/** [Jungfrau] */
|
||||||
Result<bool> getAutoCompDisable(Positions pos = {}) const;
|
Result<bool> getAutoCompDisable(Positions pos = {}) const;
|
||||||
|
|
||||||
@ -906,11 +915,11 @@ class Detector {
|
|||||||
/** [Gotthard2] */
|
/** [Gotthard2] */
|
||||||
void setVetoReference(const int gainIndex, const int value, Positions pos = {});
|
void setVetoReference(const int gainIndex, const int value, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] burst mode or continuous mode */
|
|
||||||
void setBurstMode(bool enable, Positions pos = {});
|
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Gotthard2] */
|
||||||
Result<bool> getBurstMode(Positions pos = {});
|
Result<defs::burstMode> getBurstMode(Positions pos = {});
|
||||||
|
|
||||||
|
/** [Gotthard2] BURST_OFF, BURST_INTERNAL (default), BURST_EXTERNAL */
|
||||||
|
void setBurstMode(defs::burstMode value, Positions pos = {});
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
@ -1100,52 +1109,54 @@ class Detector {
|
|||||||
/** [CTB] */
|
/** [CTB] */
|
||||||
void setPatternClockControl(uint64_t word, Positions pos = {});
|
void setPatternClockControl(uint64_t word, Positions pos = {});
|
||||||
|
|
||||||
/** [CTB] same as executing */
|
/** [CTB] same as executing
|
||||||
|
* [Mythen3] */
|
||||||
Result<uint64_t> getPatternWord(int addr, Positions pos = {});
|
Result<uint64_t> getPatternWord(int addr, Positions pos = {});
|
||||||
|
|
||||||
/** [CTB] Caution: If word is -1 reads the addr (same as
|
/** [CTB] Caution: If word is -1 reads the addr (same as
|
||||||
* executing the pattern) */
|
* executing the pattern)
|
||||||
|
* [Mythen3] */
|
||||||
void setPatternWord(int addr, uint64_t word, Positions pos = {});
|
void setPatternWord(int addr, uint64_t word, Positions pos = {});
|
||||||
|
|
||||||
/**[CTB] Options: level: -1 (complete pattern) and 0-2 levels
|
/**[CTB][Mythen3] Options: level: -1 (complete pattern) and 0-2 levels
|
||||||
* @returns array of start address and stop address
|
* @returns array of start address and stop address
|
||||||
*/
|
*/
|
||||||
Result<std::array<int, 2>> getPatternLoopAddresses(int level,
|
Result<std::array<int, 2>> getPatternLoopAddresses(int level,
|
||||||
Positions pos = {}) const;
|
Positions pos = {}) const;
|
||||||
|
|
||||||
/** [CTB] Options: level: -1 (complete pattern) and 0-2 levels */
|
/** [CTB][Mythen3] Options: level: -1 (complete pattern) and 0-2 levels */
|
||||||
void setPatternLoopAddresses(int level, int start, int stop, Positions pos = {});
|
void setPatternLoopAddresses(int level, int start, int stop, Positions pos = {});
|
||||||
|
|
||||||
/**[CTB] Options: level: -1 (complete pattern) and 0-2 levels
|
/**[CTB][Mythen3] Options: level: -1 (complete pattern) and 0-2 levels
|
||||||
* @returns number of loops
|
* @returns number of loops
|
||||||
*/
|
*/
|
||||||
Result<int> getPatternLoopCycles(int level, Positions pos = {}) const;
|
Result<int> getPatternLoopCycles(int level, Positions pos = {}) const;
|
||||||
|
|
||||||
/** [CTB] n: 0-2, level: -1 (complete pattern) and 0-2 levels */
|
/** [CTB][Mythen3] n: 0-2, level: -1 (complete pattern) and 0-2 levels */
|
||||||
void setPatternLoopCycles(int level, int n, Positions pos = {});
|
void setPatternLoopCycles(int level, int n, Positions pos = {});
|
||||||
|
|
||||||
/* [CTB] */
|
/* [CTB][Mythen3] */
|
||||||
Result<int> getPatternWaitAddr(int level, Positions pos = {}) const;
|
Result<int> getPatternWaitAddr(int level, Positions pos = {}) const;
|
||||||
|
|
||||||
/** [CTB] Options: level 0-2 */
|
/** [CTB][Mythen3] Options: level 0-2 */
|
||||||
void setPatternWaitAddr(int level, int addr, Positions pos = {});
|
void setPatternWaitAddr(int level, int addr, Positions pos = {});
|
||||||
|
|
||||||
/** [CTB] */
|
/** [CTB][Mythen3] */
|
||||||
Result<uint64_t> getPatternWaitTime(int level, Positions pos = {}) const;
|
Result<uint64_t> getPatternWaitTime(int level, Positions pos = {}) const;
|
||||||
|
|
||||||
/** [CTB] Options: level 0-2 */
|
/** [CTB][Mythen3] Options: level 0-2 */
|
||||||
void setPatternWaitTime(int level, uint64_t t, Positions pos = {});
|
void setPatternWaitTime(int level, uint64_t t, Positions pos = {});
|
||||||
|
|
||||||
/** [CTB] */
|
/** [CTB][Mythen3] */
|
||||||
Result<uint64_t> getPatternMask(Positions pos = {});
|
Result<uint64_t> getPatternMask(Positions pos = {});
|
||||||
|
|
||||||
/** [CTB] Sets the mask applied to every pattern to the selected bit mask */
|
/** [CTB][Mythen3] Sets the mask applied to every pattern to the selected bit mask */
|
||||||
void setPatternMask(uint64_t mask, Positions pos = {});
|
void setPatternMask(uint64_t mask, Positions pos = {});
|
||||||
|
|
||||||
/** [CTB] */
|
/** [CTB][Mythen3] */
|
||||||
Result<uint64_t> getPatternBitMask(Positions pos = {}) const;
|
Result<uint64_t> getPatternBitMask(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [CTB] Sets the bitmask that the mask will be applied to for every
|
/** [CTB][Mythen3] Sets the bitmask that the mask will be applied to for every
|
||||||
* pattern
|
* pattern
|
||||||
*/
|
*/
|
||||||
void setPatternBitMask(uint64_t mask, Positions pos = {});
|
void setPatternBitMask(uint64_t mask, Positions pos = {});
|
||||||
@ -1205,7 +1216,9 @@ class Detector {
|
|||||||
* *
|
* *
|
||||||
* ************************************************/
|
* ************************************************/
|
||||||
|
|
||||||
/** [Jungfrau][CTB] */
|
/** [Jungfrau][CTB] fname is a pof file
|
||||||
|
* [Mythen3][Gotthard2] fname is an rbf file
|
||||||
|
*/
|
||||||
void programFPGA(const std::string &fname, Positions pos = {});
|
void programFPGA(const std::string &fname, Positions pos = {});
|
||||||
|
|
||||||
/** [Jungfrau][CTB] */
|
/** [Jungfrau][CTB] */
|
||||||
@ -1218,7 +1231,7 @@ class Detector {
|
|||||||
void copyDetectorServer(const std::string &fname,
|
void copyDetectorServer(const std::string &fname,
|
||||||
const std::string &hostname, Positions pos = {});
|
const std::string &hostname, Positions pos = {});
|
||||||
|
|
||||||
/** [Jungfrau][Gotthard][CTB] */
|
/** [Jungfrau][Gotthard][CTB][Mythen3][Gotthard2] */
|
||||||
void rebootController(Positions pos = {});
|
void rebootController(Positions pos = {});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1243,15 +1256,21 @@ class Detector {
|
|||||||
|
|
||||||
void clearBit(uint32_t addr, int bitnr, Positions pos = {});
|
void clearBit(uint32_t addr, int bitnr, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB] */
|
/** [Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] */
|
||||||
void executeFirmwareTest(Positions pos = {});
|
void executeFirmwareTest(Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB] */
|
/** [Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] */
|
||||||
void executeBusTest(Positions pos = {});
|
void executeBusTest(Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB] not possible to read back*/
|
/** [Gotthard][Jungfrau][CTB] not possible to read back*/
|
||||||
void writeAdcRegister(uint32_t addr, uint32_t value, Positions pos = {});
|
void writeAdcRegister(uint32_t addr, uint32_t value, Positions pos = {});
|
||||||
|
|
||||||
|
bool getInitialChecks() const;
|
||||||
|
|
||||||
|
/** initial compaibility and other server start up checks
|
||||||
|
* default enabled */
|
||||||
|
void setInitialChecks(const bool value);
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
* Insignificant *
|
* Insignificant *
|
||||||
@ -1280,13 +1299,16 @@ class Detector {
|
|||||||
/** Execute a command on the detector server console */
|
/** Execute a command on the detector server console */
|
||||||
void executeCommand(const std::string &value, Positions pos = {});
|
void executeCommand(const std::string &value, Positions pos = {});
|
||||||
|
|
||||||
/** [Jungfrau][CTB] */
|
/** [Jungfrau][Mythen3][CTB]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
Result<int64_t> getNumberOfFramesFromStart(Positions pos = {}) const;
|
Result<int64_t> getNumberOfFramesFromStart(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Jungfrau][CTB] Get time from detector start */
|
/** [Jungfrau][Mythen3][CTB] Get time from detector start
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
Result<ns> getActualTime(Positions pos = {}) const;
|
Result<ns> getActualTime(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Jungfrau][CTB] Get timestamp at a frame start */
|
/** [Jungfrau][Mythen3][CTB] Get timestamp at a frame start
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
Result<ns> getMeasurementTime(Positions pos = {}) const;
|
Result<ns> getMeasurementTime(Positions pos = {}) const;
|
||||||
|
|
||||||
std::string getUserDetails() const;
|
std::string getUserDetails() const;
|
||||||
|
@ -45,9 +45,7 @@ void CmdParser::Parse(const std::string &s) {
|
|||||||
auto old_size = arguments_.size();
|
auto old_size = arguments_.size();
|
||||||
arguments_.erase(std::remove_if(begin(arguments_), end(arguments_),
|
arguments_.erase(std::remove_if(begin(arguments_), end(arguments_),
|
||||||
[](const std::string &item) {
|
[](const std::string &item) {
|
||||||
if (item == "-h" || item == "--help")
|
return (item == "-h" || item == "--help");
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}),
|
}),
|
||||||
end(arguments_));
|
end(arguments_));
|
||||||
if (old_size - arguments_.size() > 0)
|
if (old_size - arguments_.size() > 0)
|
||||||
|
@ -581,6 +581,7 @@ std::string CmdProxy::ClockDivider(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** temperature */
|
||||||
/* dacs */
|
/* dacs */
|
||||||
std::string CmdProxy::Dac(int action) {
|
std::string CmdProxy::Dac(int action) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
@ -696,7 +697,7 @@ std::vector<std::string> CmdProxy::DacCommands() {
|
|||||||
case defs::GOTTHARD2:
|
case defs::GOTTHARD2:
|
||||||
return std::vector<std::string>{
|
return std::vector<std::string>{
|
||||||
"vref_h_adc", "vb_comp_fe", "vb_comp_adc", "vcom_cds",
|
"vref_h_adc", "vb_comp_fe", "vb_comp_adc", "vcom_cds",
|
||||||
"vref_restore", "vb_opa_1st", "vref_comp_fe", "vcom_adc1",
|
"vref_rstore", "vb_opa_1st", "vref_comp_fe", "vcom_adc1",
|
||||||
"vref_prech", "vref_l_adc", "vref_cds", "vb_cs",
|
"vref_prech", "vref_l_adc", "vref_cds", "vb_cs",
|
||||||
"vb_opa_fd", "vcom_adc2"};
|
"vb_opa_fd", "vcom_adc2"};
|
||||||
break;
|
break;
|
||||||
@ -757,11 +758,8 @@ std::string CmdProxy::Threshold(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[eV] [(optinal settings) standard, fast, highgain, dynamicgain, "
|
os << "[eV] [(optinal settings) standard, lowgain, veryhighgain, verylowgain]"
|
||||||
"lowgain, mediumgain, veryhighgain, dynamichg0, fixgain1, "
|
"\n\t[Eiger] Threshold in eV" << '\n';
|
||||||
"fixgain2, forceswitchg1, forceswitchg2]\n\t[Eiger] Threshold in "
|
|
||||||
"eV"
|
|
||||||
<< '\n';
|
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
if (!args.empty()) {
|
if (!args.empty()) {
|
||||||
WrongNumberOfParameters(0);
|
WrongNumberOfParameters(0);
|
||||||
@ -792,10 +790,8 @@ std::string CmdProxy::ThresholdNoTb(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[eV] [(optional settings) standard, fast, highgain, "
|
os << "[eV] [(optional settings) standard, lowgain, veryhighgain, verylowgain]"
|
||||||
"dynamicgain, lowgain, mediumgain, veryhighgain, dynamichg0, "
|
"\n\t[Eiger] Threshold in eV set without setting trimbits"
|
||||||
"fixgain1, fixgain2, forceswitchg1, forceswitchg2]\n\t[Eiger] "
|
|
||||||
"Threshold in eV set without setting trimbits"
|
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
throw sls::RuntimeError("cannot get");
|
throw sls::RuntimeError("cannot get");
|
||||||
@ -1229,6 +1225,51 @@ std::string CmdProxy::VetoReference(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CmdProxy::BurstMode(int action) {
|
||||||
|
std::ostringstream os;
|
||||||
|
os << cmd << ' ';
|
||||||
|
if (action == defs::HELP_ACTION) {
|
||||||
|
os << "[off or 0, internal or 1, external or 2]\n\t[Gotthard2] Default is burst internal type"
|
||||||
|
<< '\n';
|
||||||
|
} else {
|
||||||
|
if (action == defs::GET_ACTION) {
|
||||||
|
if (!args.empty()) {
|
||||||
|
WrongNumberOfParameters(0);
|
||||||
|
}
|
||||||
|
auto t = det->getBurstMode({det_id});
|
||||||
|
os << OutString(t) << '\n';
|
||||||
|
} else if (action == defs::PUT_ACTION) {
|
||||||
|
if (args.size() != 1) {
|
||||||
|
WrongNumberOfParameters(1);
|
||||||
|
}
|
||||||
|
defs::burstMode t;
|
||||||
|
try {
|
||||||
|
int ival = std::stoi(args[0]);
|
||||||
|
switch (ival) {
|
||||||
|
case 0:
|
||||||
|
t = defs::BURST_OFF;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
t = defs::BURST_INTERNAL;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
t = defs::BURST_EXTERNAL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw sls::RuntimeError("Unknown burst mode " + args[0]);
|
||||||
|
}
|
||||||
|
} catch (...) {
|
||||||
|
t = sls::StringTo<defs::burstMode>(args[0]);
|
||||||
|
}
|
||||||
|
det->setBurstMode(t, {det_id});
|
||||||
|
os << sls::ToString(t) << '\n'; // no args to convert 0,1,2 as well
|
||||||
|
} else {
|
||||||
|
throw sls::RuntimeError("Unknown action");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return os.str();
|
||||||
|
}
|
||||||
|
|
||||||
/* Mythen3 Specific */
|
/* Mythen3 Specific */
|
||||||
|
|
||||||
std::string CmdProxy::Counters(int action) {
|
std::string CmdProxy::Counters(int action) {
|
||||||
@ -1247,7 +1288,7 @@ std::string CmdProxy::Counters(int action) {
|
|||||||
std::vector <int> result;
|
std::vector <int> result;
|
||||||
for (size_t i = 0; i < 32; ++i) {
|
for (size_t i = 0; i < 32; ++i) {
|
||||||
if (mask & (1 << i)) {
|
if (mask & (1 << i)) {
|
||||||
result.push_back((int)i);
|
result.push_back(static_cast<int>(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
os << sls::ToString(result) << '\n';
|
os << sls::ToString(result) << '\n';
|
||||||
@ -1454,7 +1495,7 @@ std::string CmdProxy::Pattern(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[fname]\n\t[Ctb] Loads binary pattern file with only pattern "
|
os << "[fname]\n\t[Mythen3][Ctb] Loads binary pattern file with only pattern "
|
||||||
"words"
|
"words"
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
@ -1475,7 +1516,7 @@ std::string CmdProxy::PatternWord(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[step or address] [64 bit mask]\n\t[Ctb] 64 bit pattern at "
|
os << "[step or address] [64 bit mask]\n\t[Ctb][Mythen3] 64 bit pattern at "
|
||||||
"address of pattern memory."
|
"address of pattern memory."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
@ -1501,17 +1542,17 @@ std::string CmdProxy::PatternLoopAddresses(int action) {
|
|||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
if (cmd == "patlimits") {
|
if (cmd == "patlimits") {
|
||||||
os << "[start addr] [stop addr] \n\t[Ctb] Limits of complete "
|
os << "[start addr] [stop addr] \n\t[Ctb][Mythen3] Limits of complete "
|
||||||
"pattern."
|
"pattern."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (cmd == "patloop0") {
|
} else if (cmd == "patloop0") {
|
||||||
os << "[start addr] [stop addr] \n\t[Ctb] Limits of loop 0."
|
os << "[start addr] [stop addr] \n\t[Ctb][Mythen3] Limits of loop 0."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (cmd == "patloop1") {
|
} else if (cmd == "patloop1") {
|
||||||
os << "[start addr] [stop addr] \n\t[Ctb] Limits of loop 1."
|
os << "[start addr] [stop addr] \n\t[Ctb][Mythen3] Limits of loop 1."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (cmd == "patloop2") {
|
} else if (cmd == "patloop2") {
|
||||||
os << "[start addr] [stop addr] \n\t[Ctb] Limits of loop 2."
|
os << "[start addr] [stop addr] \n\t[Ctb][Mythen3] Limits of loop 2."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError(
|
throw sls::RuntimeError(
|
||||||
@ -1556,11 +1597,11 @@ std::string CmdProxy::PatternLoopCycles(int action) {
|
|||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
if (cmd == "patnloop0") {
|
if (cmd == "patnloop0") {
|
||||||
os << "[n_cycles] \n\t[Ctb] Number of cycles of loop 0." << '\n';
|
os << "[n_cycles] \n\t[Ctb][Mythen3] Number of cycles of loop 0." << '\n';
|
||||||
} else if (cmd == "patnloop1") {
|
} else if (cmd == "patnloop1") {
|
||||||
os << "[n_cycles] \n\t[Ctb] Number of cycles of loop 1." << '\n';
|
os << "[n_cycles] \n\t[Ctb][Mythen3] Number of cycles of loop 1." << '\n';
|
||||||
} else if (cmd == "patnloop2") {
|
} else if (cmd == "patnloop2") {
|
||||||
os << "[n_cycles] \n\t[Ctb] Number of cycles of loop 2." << '\n';
|
os << "[n_cycles] \n\t[Ctb][Mythen3] Number of cycles of loop 2." << '\n';
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError(
|
throw sls::RuntimeError(
|
||||||
"Unknown command, use list to list all commands");
|
"Unknown command, use list to list all commands");
|
||||||
@ -1601,11 +1642,11 @@ std::string CmdProxy::PatternWaitAddress(int action) {
|
|||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
if (cmd == "patwait0") {
|
if (cmd == "patwait0") {
|
||||||
os << "[addr] \n\t[Ctb] Wait 0 address." << '\n';
|
os << "[addr] \n\t[Ctb][Mythen3] Wait 0 address." << '\n';
|
||||||
} else if (cmd == "patwait1") {
|
} else if (cmd == "patwait1") {
|
||||||
os << "[addr] \n\t[Ctb] Wait 1 address." << '\n';
|
os << "[addr] \n\t[Ctb][Mythen3] Wait 1 address." << '\n';
|
||||||
} else if (cmd == "patwait2") {
|
} else if (cmd == "patwait2") {
|
||||||
os << "[addr] \n\t[Ctb] Wait 2 address." << '\n';
|
os << "[addr] \n\t[Ctb][Mythen3] Wait 2 address." << '\n';
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError(
|
throw sls::RuntimeError(
|
||||||
"Unknown command, use list to list all commands");
|
"Unknown command, use list to list all commands");
|
||||||
@ -1646,11 +1687,11 @@ std::string CmdProxy::PatternWaitTime(int action) {
|
|||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
if (cmd == "patwaittime0") {
|
if (cmd == "patwaittime0") {
|
||||||
os << "[n_clk] \n\t[Ctb] Wait 0 time in clock cycles." << '\n';
|
os << "[n_clk] \n\t[Ctb][Mythen3] Wait 0 time in clock cycles." << '\n';
|
||||||
} else if (cmd == "patwaittime1") {
|
} else if (cmd == "patwaittime1") {
|
||||||
os << "[n_clk] \n\t[Ctb] Wait 1 time in clock cycles." << '\n';
|
os << "[n_clk] \n\t[Ctb][Mythen3] Wait 1 time in clock cycles." << '\n';
|
||||||
} else if (cmd == "patwaittime2") {
|
} else if (cmd == "patwaittime2") {
|
||||||
os << "[n_clk] \n\t[Ctb] Wait 2 time in clock cycles." << '\n';
|
os << "[n_clk] \n\t[Ctb][Mythen3] Wait 2 time in clock cycles." << '\n';
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError(
|
throw sls::RuntimeError(
|
||||||
"Unknown command, use list to list all commands");
|
"Unknown command, use list to list all commands");
|
||||||
@ -1766,7 +1807,8 @@ std::string CmdProxy::ProgramFpga(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[fname.pof]\n\t[Jungfrau][Ctb] Programs FPGA from pof file."
|
os << "[fname.pof | fname.rbf]\n\t[Jungfrau][Ctb] Programs FPGA from pof file."
|
||||||
|
<< "\n\t[Mythen3][Gotthard2] Programs FPGA from rbf file."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
throw sls::RuntimeError("Cannot get");
|
throw sls::RuntimeError("Cannot get");
|
||||||
@ -1774,9 +1816,6 @@ std::string CmdProxy::ProgramFpga(int action) {
|
|||||||
if (args.size() != 1) {
|
if (args.size() != 1) {
|
||||||
WrongNumberOfParameters(1);
|
WrongNumberOfParameters(1);
|
||||||
}
|
}
|
||||||
if (args[0].find(".pof") == std::string::npos) {
|
|
||||||
throw sls::RuntimeError("Programming file must be a pof file.");
|
|
||||||
}
|
|
||||||
det->programFPGA(args[0], {det_id});
|
det->programFPGA(args[0], {det_id});
|
||||||
os << "successful\n";
|
os << "successful\n";
|
||||||
} else {
|
} else {
|
||||||
@ -1939,6 +1978,39 @@ std::string CmdProxy::BitOperations(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CmdProxy::InitialChecks(int action) {
|
||||||
|
std::ostringstream os;
|
||||||
|
os << cmd << ' ';
|
||||||
|
if (action == defs::HELP_ACTION) {
|
||||||
|
os << "[0, 1]\n\tEnable or disable intial compatibility and other checks at detector start up. It is enabled by default. Must come before 'hostname' command to take effect. Can be used to reprogram fpga when current firmware is incompatible."
|
||||||
|
<< '\n';
|
||||||
|
} else if (action == defs::GET_ACTION) {
|
||||||
|
if (det_id != -1) {
|
||||||
|
throw sls::RuntimeError(
|
||||||
|
"Cannot enable/disable initial checks at module level");
|
||||||
|
}
|
||||||
|
if (!args.empty()) {
|
||||||
|
WrongNumberOfParameters(0);
|
||||||
|
}
|
||||||
|
auto t = det->getInitialChecks();
|
||||||
|
os << t << '\n';
|
||||||
|
} else if (action == defs::PUT_ACTION) {
|
||||||
|
if (det_id != -1) {
|
||||||
|
throw sls::RuntimeError(
|
||||||
|
"Cannot get initial checks enable at module level");
|
||||||
|
}
|
||||||
|
if (args.size() != 1) {
|
||||||
|
WrongNumberOfParameters(1);
|
||||||
|
}
|
||||||
|
det->setInitialChecks(std::stoi(args[0]));
|
||||||
|
os << args.front() << '\n';
|
||||||
|
} else {
|
||||||
|
throw sls::RuntimeError("Unknown action");
|
||||||
|
}
|
||||||
|
return os.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Insignificant */
|
/* Insignificant */
|
||||||
|
|
||||||
std::string CmdProxy::ExecuteCommand(int action) {
|
std::string CmdProxy::ExecuteCommand(int action) {
|
||||||
|
@ -478,6 +478,7 @@ class CmdProxy {
|
|||||||
{"cyclesl", "triggersl"},
|
{"cyclesl", "triggersl"},
|
||||||
{"clkdivider", "speed"},
|
{"clkdivider", "speed"},
|
||||||
|
|
||||||
|
/** temperature */
|
||||||
/** dacs */
|
/** dacs */
|
||||||
{"vcall", "vcal"},
|
{"vcall", "vcal"},
|
||||||
|
|
||||||
@ -578,6 +579,7 @@ class CmdProxy {
|
|||||||
{"triggersl", &CmdProxy::triggersl},
|
{"triggersl", &CmdProxy::triggersl},
|
||||||
{"delayl", &CmdProxy::delayl},
|
{"delayl", &CmdProxy::delayl},
|
||||||
{"periodl", &CmdProxy::periodl},
|
{"periodl", &CmdProxy::periodl},
|
||||||
|
{"timing", &CmdProxy::timing},
|
||||||
{"speed", &CmdProxy::Speed},
|
{"speed", &CmdProxy::Speed},
|
||||||
{"adcphase", &CmdProxy::Adcphase},
|
{"adcphase", &CmdProxy::Adcphase},
|
||||||
{"maxadcphaseshift", &CmdProxy::maxadcphaseshift},
|
{"maxadcphaseshift", &CmdProxy::maxadcphaseshift},
|
||||||
@ -586,6 +588,9 @@ class CmdProxy {
|
|||||||
{"maxclkphaseshift", &CmdProxy::MaxClockPhaseShift},
|
{"maxclkphaseshift", &CmdProxy::MaxClockPhaseShift},
|
||||||
{"clkdiv", &CmdProxy::ClockDivider},
|
{"clkdiv", &CmdProxy::ClockDivider},
|
||||||
{"vhighvoltage", &CmdProxy::vhighvoltage},
|
{"vhighvoltage", &CmdProxy::vhighvoltage},
|
||||||
|
{"powerchip", &CmdProxy::powerchip},
|
||||||
|
|
||||||
|
/** temperature */
|
||||||
{"temp_adc", &CmdProxy::temp_adc},
|
{"temp_adc", &CmdProxy::temp_adc},
|
||||||
{"temp_fpga", &CmdProxy::temp_fpga},
|
{"temp_fpga", &CmdProxy::temp_fpga},
|
||||||
{"temp_fpgaext", &CmdProxy::temp_fpgaext},
|
{"temp_fpgaext", &CmdProxy::temp_fpgaext},
|
||||||
@ -595,7 +600,6 @@ class CmdProxy {
|
|||||||
{"temp_sodr", &CmdProxy::temp_sodr},
|
{"temp_sodr", &CmdProxy::temp_sodr},
|
||||||
{"temp_fpgafl", &CmdProxy::temp_fpgafl},
|
{"temp_fpgafl", &CmdProxy::temp_fpgafl},
|
||||||
{"temp_fpgafr", &CmdProxy::temp_fpgafr},
|
{"temp_fpgafr", &CmdProxy::temp_fpgafr},
|
||||||
{"timing", &CmdProxy::timing},
|
|
||||||
|
|
||||||
/* dacs */
|
/* dacs */
|
||||||
{"vthreshold", &CmdProxy::vthreshold},
|
{"vthreshold", &CmdProxy::vthreshold},
|
||||||
@ -644,7 +648,7 @@ class CmdProxy {
|
|||||||
{"vb_comp_fe", &CmdProxy::vb_comp_fe},
|
{"vb_comp_fe", &CmdProxy::vb_comp_fe},
|
||||||
{"vb_comp_adc", &CmdProxy::vb_comp_adc},
|
{"vb_comp_adc", &CmdProxy::vb_comp_adc},
|
||||||
{"vcom_cds", &CmdProxy::vcom_cds},
|
{"vcom_cds", &CmdProxy::vcom_cds},
|
||||||
{"vref_restore", &CmdProxy::vref_restore},
|
{"vref_rstore", &CmdProxy::vref_rstore},
|
||||||
{"vb_opa_1st", &CmdProxy::vb_opa_1st},
|
{"vb_opa_1st", &CmdProxy::vb_opa_1st},
|
||||||
{"vref_comp_fe", &CmdProxy::vref_comp_fe},
|
{"vref_comp_fe", &CmdProxy::vref_comp_fe},
|
||||||
{"vcom_adc1", &CmdProxy::vcom_adc1},
|
{"vcom_adc1", &CmdProxy::vcom_adc1},
|
||||||
@ -767,7 +771,6 @@ class CmdProxy {
|
|||||||
{"temp_threshold", &CmdProxy::temp_threshold},
|
{"temp_threshold", &CmdProxy::temp_threshold},
|
||||||
{"temp_control", &CmdProxy::temp_control},
|
{"temp_control", &CmdProxy::temp_control},
|
||||||
{"temp_event", &CmdProxy::TemperatureEvent},
|
{"temp_event", &CmdProxy::TemperatureEvent},
|
||||||
{"powerchip", &CmdProxy::powerchip},
|
|
||||||
{"auto_comp_disable", &CmdProxy::auto_comp_disable},
|
{"auto_comp_disable", &CmdProxy::auto_comp_disable},
|
||||||
{"storagecells", &CmdProxy::storagecells},
|
{"storagecells", &CmdProxy::storagecells},
|
||||||
{"storagecell_start", &CmdProxy::storagecell_start},
|
{"storagecell_start", &CmdProxy::storagecell_start},
|
||||||
@ -784,7 +787,7 @@ class CmdProxy {
|
|||||||
{"inj_ch", &CmdProxy::InjectChannel},
|
{"inj_ch", &CmdProxy::InjectChannel},
|
||||||
{"vetophoton", &CmdProxy::VetoPhoton},
|
{"vetophoton", &CmdProxy::VetoPhoton},
|
||||||
{"vetoref", &CmdProxy::VetoReference},
|
{"vetoref", &CmdProxy::VetoReference},
|
||||||
{"burstmode", &CmdProxy::burstmode},
|
{"burstmode", &CmdProxy::BurstMode},
|
||||||
|
|
||||||
/* Mythen3 Specific */
|
/* Mythen3 Specific */
|
||||||
{"counters", &CmdProxy::Counters},
|
{"counters", &CmdProxy::Counters},
|
||||||
@ -873,6 +876,7 @@ class CmdProxy {
|
|||||||
{"getbit", &CmdProxy::BitOperations},
|
{"getbit", &CmdProxy::BitOperations},
|
||||||
{"firmwaretest", &CmdProxy::firmwaretest},
|
{"firmwaretest", &CmdProxy::firmwaretest},
|
||||||
{"bustest", &CmdProxy::bustest},
|
{"bustest", &CmdProxy::bustest},
|
||||||
|
{"initialchecks", &CmdProxy::InitialChecks},
|
||||||
|
|
||||||
/* Insignificant */
|
/* Insignificant */
|
||||||
{"port", &CmdProxy::port},
|
{"port", &CmdProxy::port},
|
||||||
@ -911,6 +915,7 @@ class CmdProxy {
|
|||||||
std::string ClockPhase(int action);
|
std::string ClockPhase(int action);
|
||||||
std::string MaxClockPhaseShift(int action);
|
std::string MaxClockPhaseShift(int action);
|
||||||
std::string ClockDivider(int action);
|
std::string ClockDivider(int action);
|
||||||
|
/** temperature */
|
||||||
/* dacs */
|
/* dacs */
|
||||||
std::string Dac(int action);
|
std::string Dac(int action);
|
||||||
std::string DacList(int action);
|
std::string DacList(int action);
|
||||||
@ -943,6 +948,7 @@ class CmdProxy {
|
|||||||
std::string InjectChannel(int action);
|
std::string InjectChannel(int action);
|
||||||
std::string VetoPhoton(int action);
|
std::string VetoPhoton(int action);
|
||||||
std::string VetoReference(int action);
|
std::string VetoReference(int action);
|
||||||
|
std::string BurstMode(int action);
|
||||||
/* Mythen3 Specific */
|
/* Mythen3 Specific */
|
||||||
std::string Counters(int action);
|
std::string Counters(int action);
|
||||||
/* CTB Specific */
|
/* CTB Specific */
|
||||||
@ -968,6 +974,7 @@ class CmdProxy {
|
|||||||
std::string Register(int action);
|
std::string Register(int action);
|
||||||
std::string AdcRegister(int action);
|
std::string AdcRegister(int action);
|
||||||
std::string BitOperations(int action);
|
std::string BitOperations(int action);
|
||||||
|
std::string InitialChecks(int action);
|
||||||
/* Insignificant */
|
/* Insignificant */
|
||||||
std::string ExecuteCommand(int action);
|
std::string ExecuteCommand(int action);
|
||||||
std::string UserDetails(int action);
|
std::string UserDetails(int action);
|
||||||
@ -993,44 +1000,71 @@ class CmdProxy {
|
|||||||
"\n\tSerial number or MAC of detector (hex).");
|
"\n\tSerial number or MAC of detector (hex).");
|
||||||
|
|
||||||
INTEGER_COMMAND(settings, getSettings, setSettings, sls::StringTo<slsDetectorDefs::detectorSettings>,
|
INTEGER_COMMAND(settings, getSettings, setSettings, sls::StringTo<slsDetectorDefs::detectorSettings>,
|
||||||
"[standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, dynamichg0, fixgain1, fixgain2, forceswitchg1, forceswitchg2]\n\t[Jungfrau][Gotthard] Detector Settings.\n\t[Eiger] Use threshold or thresholdnotb.");
|
"[standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, dynamichg0, fixgain1, fixgain2, forceswitchg1, forceswitchg2, verylowgain]"
|
||||||
|
"\n\t[Jungfrau] - Detector Settings [dynamicgain | dynamichg0 | fixgain1 | fixgain2 | forceswitchg1 | forceswitchg2]"
|
||||||
|
"\n\t[Gotthard] - Detector Settings [dynamicgain | highgain | lowgain | mediumgain | veryhighgain]"
|
||||||
|
"\n\t[Gotthard2] - Detector Settings [dynamicgain | fixgain1 | fixgain2]"
|
||||||
|
"\n\t[Eiger] Use threshold or thresholdnotb.");
|
||||||
|
|
||||||
/* acquisition parameters */
|
/* acquisition parameters */
|
||||||
|
|
||||||
INTEGER_COMMAND_NOID(frames, getNumberOfFrames, setNumberOfFrames,
|
INTEGER_COMMAND_NOID(frames, getNumberOfFrames, setNumberOfFrames,
|
||||||
std::stol,
|
std::stol,
|
||||||
"[n_frames]\n\tNumber of frames per aquire. In trigger mode, number of frames per trigger.");
|
"[n_frames]\n\tNumber of frames per aquire. In trigger mode, number of frames per trigger."
|
||||||
|
"\n\t[Gotthard2] Burst mode has a maximum of 2720 frames. Frames number for both modes are uploaded to detector just before acquisition starts");
|
||||||
|
|
||||||
INTEGER_COMMAND_NOID(triggers, getNumberOfTriggers, setNumberOfTriggers,
|
INTEGER_COMMAND_NOID(triggers, getNumberOfTriggers, setNumberOfTriggers,
|
||||||
std::stol,
|
std::stol,
|
||||||
"[n_triggers]\n\tNumber of triggers per aquire. Use timing command to set timing mode.");
|
"[n_triggers]\n\tNumber of triggers per aquire. Use timing command to set timing mode.");
|
||||||
|
|
||||||
TIME_COMMAND(exptime, getExptime, setExptime,
|
TIME_COMMAND(exptime, getExptime, setExptime,
|
||||||
"[duration] [(optional unit) ns|us|ms|s]\n\tExposure time");
|
"[duration] [(optional unit) ns|us|ms|s]\n\tExposure time"
|
||||||
|
"\n\t[Gotthard2] Uploaded to detector just before acquisition starts");
|
||||||
|
|
||||||
TIME_COMMAND(period, getPeriod, setPeriod,
|
TIME_COMMAND(period, getPeriod, setPeriod,
|
||||||
"[duration] [(optional unit) ns|us|ms|s]\n\tPeriod between frames");
|
"[duration] [(optional unit) ns|us|ms|s]\n\tPeriod between frames"
|
||||||
|
"\n\t[Gotthard2] Uploaded to detector just before acquisition starts");
|
||||||
|
|
||||||
TIME_COMMAND(delay, getDelayAfterTrigger, setDelayAfterTrigger,
|
TIME_COMMAND(delay, getDelayAfterTrigger, setDelayAfterTrigger,
|
||||||
"[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau][Gotthard][Ctb][Mythen3] Delay after trigger");
|
"[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb] Delay after trigger"
|
||||||
|
"\n\t[Gotthard2] only in continuous mode.");
|
||||||
|
|
||||||
GET_COMMAND(framesl, getNumberOfFramesLeft,
|
GET_COMMAND(framesl, getNumberOfFramesLeft,
|
||||||
"\n\t[Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] Number of frames left in acquisition.");
|
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] Number of frames left in acquisition."
|
||||||
|
"\n\t[Gotthard2] only in continuous mode.");
|
||||||
|
|
||||||
GET_COMMAND(triggersl, getNumberOfTriggersLeft,
|
GET_COMMAND(triggersl, getNumberOfTriggersLeft,
|
||||||
"\n\t[Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] Number of triggers left in acquisition.");
|
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] Number of triggers left in acquisition."
|
||||||
|
"\n\t[Gotthard2] only in continuous mode.");
|
||||||
|
|
||||||
TIME_GET_COMMAND(delayl, getDelayAfterTriggerLeft,
|
TIME_GET_COMMAND(delayl, getDelayAfterTriggerLeft,
|
||||||
"\n\t[Gotthard][Jungfrau][CTB] DelayLeft Delay Left in Acquisition.");
|
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] DelayLeft Delay Left in Acquisition."
|
||||||
|
"\n\t[Gotthard2] only in continuous mode.");
|
||||||
|
|
||||||
TIME_GET_COMMAND(periodl, getPeriodLeft,
|
TIME_GET_COMMAND(periodl, getPeriodLeft,
|
||||||
"\n\t[Gotthard][Jungfrau][CTB] Period left for current frame.");
|
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] Period left for current frame."
|
||||||
|
"\n\t[Gotthard2] only in continuous mode.");
|
||||||
|
|
||||||
|
INTEGER_COMMAND(timing, getTimingMode, setTimingMode, sls::StringTo<slsDetectorDefs::timingMode>,
|
||||||
|
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of detector.\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb] [auto|trigger]\n\t[Eiger] [auto|trigger|gating|burst_trigger]");
|
||||||
|
|
||||||
GET_COMMAND(maxadcphaseshift, getMaxADCPhaseShift,
|
GET_COMMAND(maxadcphaseshift, getMaxADCPhaseShift,
|
||||||
"\n\t[Jungfrau][CTB] Absolute maximum Phase shift of ADC clock.");
|
"\n\t[Jungfrau][CTB] Absolute maximum Phase shift of ADC clock.");
|
||||||
|
|
||||||
INTEGER_COMMAND(vhighvoltage, getHighVoltage, setHighVoltage, std::stoi,
|
INTEGER_COMMAND(vhighvoltage, getHighVoltage, setHighVoltage, std::stoi,
|
||||||
"[n_value]\n\tHigh voltage to the sensor in Voltage.\n\t[Gotthard] [0|90|110|120|150|180|200]\n\t[Eiger] 0-200\n\t[Jungfrau][Ctb] [0|60-200]");
|
"[n_value]\n\tHigh voltage to the sensor in Voltage."
|
||||||
|
"\n\t[Gotthard] [0|90|110|120|150|180|200]"
|
||||||
|
"\n\t[Eiger][Mythen3][Gotthard2] 0-200"
|
||||||
|
"\n\t[Jungfrau][Ctb] [0|60-200]");
|
||||||
|
|
||||||
|
INTEGER_COMMAND(powerchip, getPowerChip, setPowerChip, std::stoi,
|
||||||
|
"[0, 1]\n\t[Jungfrau][Mythen3][Gotthard2] Power the chip. Default 0."
|
||||||
|
"\n\t[Jungfrau] Get will return power status."
|
||||||
|
"Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled."
|
||||||
|
"\n\t[Mythen3] If module not connected or wrong module, 1 will fail. By default, not powered on"
|
||||||
|
"\n\t[Gotthard2] If module not connected or wrong module, 1 will fail. By default, powered on at server start up.");
|
||||||
|
|
||||||
|
/** temperature */
|
||||||
|
|
||||||
GET_IND_COMMAND(temp_adc, getTemperature, slsDetectorDefs::TEMPERATURE_ADC, " °C",
|
GET_IND_COMMAND(temp_adc, getTemperature, slsDetectorDefs::TEMPERATURE_ADC, " °C",
|
||||||
"[n_value]\n\t[Jungfrau][Gotthard] ADC Temperature");
|
"[n_value]\n\t[Jungfrau][Gotthard] ADC Temperature");
|
||||||
@ -1059,9 +1093,6 @@ class CmdProxy {
|
|||||||
GET_IND_COMMAND(temp_fpgafr, getTemperature, slsDetectorDefs::TEMPERATURE_FPGA3, " °C",
|
GET_IND_COMMAND(temp_fpgafr, getTemperature, slsDetectorDefs::TEMPERATURE_FPGA3, " °C",
|
||||||
"[n_value]\n\t[Eiger]Temperature of the left front end board fpga");
|
"[n_value]\n\t[Eiger]Temperature of the left front end board fpga");
|
||||||
|
|
||||||
INTEGER_COMMAND(timing, getTimingMode, setTimingMode, sls::StringTo<slsDetectorDefs::timingMode>,
|
|
||||||
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of detector.\n\t[Jungfrau][Gotthard][Ctb] [auto|trigger]\n\t[Eiger] [auto|trigger|gating|burst_trigger]");
|
|
||||||
|
|
||||||
/* dacs */
|
/* dacs */
|
||||||
|
|
||||||
DAC_COMMAND(vthreshold, getDAC, setDAC, defs::THRESHOLD,
|
DAC_COMMAND(vthreshold, getDAC, setDAC, defs::THRESHOLD,
|
||||||
@ -1202,7 +1233,7 @@ class CmdProxy {
|
|||||||
DAC_COMMAND(vcom_cds, getDAC, setDAC, defs::VCOM_CDS,
|
DAC_COMMAND(vcom_cds, getDAC, setDAC, defs::VCOM_CDS,
|
||||||
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for common mode voltage of CDS stage.");
|
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for common mode voltage of CDS stage.");
|
||||||
|
|
||||||
DAC_COMMAND(vref_restore, getDAC, setDAC, defs::VREF_RESTORE,
|
DAC_COMMAND(vref_rstore, getDAC, setDAC, defs::VREF_RSTORE,
|
||||||
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for reference charging voltage of temparory storage cell in high gain.");
|
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for reference charging voltage of temparory storage cell in high gain.");
|
||||||
|
|
||||||
DAC_COMMAND(vb_opa_1st, getDAC, setDAC, defs::VB_OPA_1ST,
|
DAC_COMMAND(vb_opa_1st, getDAC, setDAC, defs::VB_OPA_1ST,
|
||||||
@ -1373,8 +1404,7 @@ class CmdProxy {
|
|||||||
INTEGER_COMMAND(rx_tcpport, getRxPort, setRxPort, std::stoi,
|
INTEGER_COMMAND(rx_tcpport, getRxPort, setRxPort, std::stoi,
|
||||||
"[port]\n\tTCP port for client-receiver communication. Default is 1954. Must be different if multiple receivers on same pc. Must be first command to set a receiver parameter. Multi command will automatically increment for individual modules.");
|
"[port]\n\tTCP port for client-receiver communication. Default is 1954. Must be different if multiple receivers on same pc. Must be first command to set a receiver parameter. Multi command will automatically increment for individual modules.");
|
||||||
|
|
||||||
INTEGER_COMMAND(
|
INTEGER_COMMAND(rx_fifodepth, getRxFifoDepth, setRxFifoDepth, std::stoi,
|
||||||
rx_fifodepth, getRxFifoDepth, setRxFifoDepth, std::stoi,
|
|
||||||
"[n_frames]\n\tSet the number of frames in the receiver fifo (buffer between listener and writer threads).");
|
"[n_frames]\n\tSet the number of frames in the receiver fifo (buffer between listener and writer threads).");
|
||||||
|
|
||||||
INTEGER_COMMAND(rx_silent, getRxSilentMode, setRxSilentMode, std::stoi,
|
INTEGER_COMMAND(rx_silent, getRxSilentMode, setRxSilentMode, std::stoi,
|
||||||
@ -1502,9 +1532,6 @@ class CmdProxy {
|
|||||||
INTEGER_COMMAND(temp_control, getTemperatureControl, setTemperatureControl, std::stoi,
|
INTEGER_COMMAND(temp_control, getTemperatureControl, setTemperatureControl, std::stoi,
|
||||||
"[0, 1]\n\t[Jungfrau] Temperature control enable. Default is 0 (disabled). If temperature crosses threshold temperature and temperature control is enabled, power to chip will be switched off and temperature event occurs. To power on chip again, temperature has to be less than threshold temperature and temperature event has to be cleared.");
|
"[0, 1]\n\t[Jungfrau] Temperature control enable. Default is 0 (disabled). If temperature crosses threshold temperature and temperature control is enabled, power to chip will be switched off and temperature event occurs. To power on chip again, temperature has to be less than threshold temperature and temperature event has to be cleared.");
|
||||||
|
|
||||||
INTEGER_COMMAND(powerchip, getPowerChip, setPowerChip, std::stoi,
|
|
||||||
"[0, 1]\n\t[Jungfrau][Mythen3] Power the chip. Default 0. \n\t[Jungfrau] Get will return power status. Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled.");
|
|
||||||
|
|
||||||
INTEGER_COMMAND(auto_comp_disable, getAutoCompDisable, setAutoCompDisable, std::stoi,
|
INTEGER_COMMAND(auto_comp_disable, getAutoCompDisable, setAutoCompDisable, std::stoi,
|
||||||
"[0, 1]\n\t[Jungfrau] Auto comparator disable mode. Default 0 or this mode disabled(comparator enabled throughout). 1 enables mode. 0 disables mode. This mode disables the on-chip gain switching comparator automatically after 93.75% of exposure time (only for longer than 100us).");
|
"[0, 1]\n\t[Jungfrau] Auto comparator disable mode. Default 0 or this mode disabled(comparator enabled throughout). 1 enables mode. 0 disables mode. This mode disables the on-chip gain switching comparator automatically after 93.75% of exposure time (only for longer than 100us).");
|
||||||
|
|
||||||
@ -1529,9 +1556,6 @@ class CmdProxy {
|
|||||||
"[0, 1]\n\t[Gotthard] 1 adds channel intensity with precalculated values when taking an acquisition. Default is 0.");
|
"[0, 1]\n\t[Gotthard] 1 adds channel intensity with precalculated values when taking an acquisition. Default is 0.");
|
||||||
|
|
||||||
/* Gotthard2 Specific */
|
/* Gotthard2 Specific */
|
||||||
INTEGER_COMMAND(burstmode, getBurstMode, setBurstMode, std::stoi,
|
|
||||||
"[0, 1]\n\t[Gotthard2] 1 sets to burst mode. 0 sets to continuous mode. Default is burst mode.");
|
|
||||||
|
|
||||||
/* Mythen3 Specific */
|
/* Mythen3 Specific */
|
||||||
|
|
||||||
/* CTB Specific */
|
/* CTB Specific */
|
||||||
@ -1651,10 +1675,10 @@ class CmdProxy {
|
|||||||
"[64 bit mask]\n\t[Ctb] 64 bit mask defining output clock enable.");
|
"[64 bit mask]\n\t[Ctb] 64 bit mask defining output clock enable.");
|
||||||
|
|
||||||
INTEGER_COMMAND_HEX(patmask, getPatternMask, setPatternMask, stoulHex,
|
INTEGER_COMMAND_HEX(patmask, getPatternMask, setPatternMask, stoulHex,
|
||||||
"[64 bit mask]\n\t[Ctb] 64 bit mask applied to every pattern. Only these bits for each pattern will be masked against.");
|
"[64 bit mask]\n\t[Ctb][Mythen3] 64 bit mask applied to every pattern. Only these bits for each pattern will be masked against.");
|
||||||
|
|
||||||
INTEGER_COMMAND_HEX(patsetbit, getPatternBitMask, setPatternBitMask, stoulHex,
|
INTEGER_COMMAND_HEX(patsetbit, getPatternBitMask, setPatternBitMask, stoulHex,
|
||||||
"[64 bit mask]\n\t[Ctb] 64 bit values applied to the selected patmask for every pattern.");
|
"[64 bit mask]\n\t[Ctb][Mythen3] 64 bit values applied to the selected patmask for every pattern.");
|
||||||
|
|
||||||
/* Moench */
|
/* Moench */
|
||||||
|
|
||||||
@ -1674,13 +1698,13 @@ class CmdProxy {
|
|||||||
"\n\t[Jungfrau][Ctb] Reset FPGA.");
|
"\n\t[Jungfrau][Ctb] Reset FPGA.");
|
||||||
|
|
||||||
EXECUTE_SET_COMMAND(rebootcontroller, rebootController,
|
EXECUTE_SET_COMMAND(rebootcontroller, rebootController,
|
||||||
"\n\t[Jungfrau][Ctb] Reboot controler (blackfin) of detector.");
|
"\n\t[Jungfrau][Ctb][Gotthard][Mythen3][Gotthard2] Reboot controler (blackfin) of detector.");
|
||||||
|
|
||||||
EXECUTE_SET_COMMAND(firmwaretest, executeFirmwareTest,
|
EXECUTE_SET_COMMAND(firmwaretest, executeFirmwareTest,
|
||||||
"\n\t[Jungfrau][Ctb][Gotthard] Firmware test, ie. reads a read fixed pattern from a register.");
|
"\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb] Firmware test, ie. reads a read fixed pattern from a register.");
|
||||||
|
|
||||||
EXECUTE_SET_COMMAND(bustest, executeBusTest,
|
EXECUTE_SET_COMMAND(bustest, executeBusTest,
|
||||||
"\n\t[Jungfrau][Ctb][Gotthard] Bus test, ie. keeps writing and reading back different values in R/W register.");
|
"\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb] Bus test, ie. keeps writing and reading back different values in R/W register.");
|
||||||
|
|
||||||
|
|
||||||
/* Insignificant */
|
/* Insignificant */
|
||||||
@ -1698,13 +1722,16 @@ class CmdProxy {
|
|||||||
"\n\tClient IP Address that last communicated with the detector.");
|
"\n\tClient IP Address that last communicated with the detector.");
|
||||||
|
|
||||||
GET_COMMAND(nframes, getNumberOfFramesFromStart,
|
GET_COMMAND(nframes, getNumberOfFramesFromStart,
|
||||||
"\n\t[Jungfrau][CTB] Number of frames from start run control.");
|
"\n\t[Jungfrau][Mythen3][Gotthard2][Moench][CTB] Number of frames from start run control."
|
||||||
|
"\n\t[Gotthard2] only in continuous mode.");
|
||||||
|
|
||||||
TIME_GET_COMMAND(now, getActualTime,
|
TIME_GET_COMMAND(now, getActualTime,
|
||||||
"[(optional unit) ns|us|ms|s]\n\t[Jungfrau][CTB] Time from detector start up.");
|
"[(optional unit) ns|us|ms|s]\n\t[Jungfrau][Mythen3][Gotthard2][Moench][CTB] Time from detector start up."
|
||||||
|
"\n\t[Gotthard2] only in continuous mode.");
|
||||||
|
|
||||||
TIME_GET_COMMAND(timestamp, getMeasurementTime,
|
TIME_GET_COMMAND(timestamp, getMeasurementTime,
|
||||||
"[(optional unit) ns|us|ms|s]\n\t[Jungfrau][CTB] Timestamp at a frame start.");
|
"[(optional unit) ns|us|ms|s]\n\t[Jungfrau][Mythen3][Gotthard2][Moench][CTB] Timestamp at a frame start."
|
||||||
|
"\n\t[Gotthard2] only in continuous mode.");
|
||||||
|
|
||||||
GET_COMMAND(rx_frameindex, getRxCurrentFrameIndex,
|
GET_COMMAND(rx_frameindex, getRxCurrentFrameIndex,
|
||||||
"\n\tCurrent frame index received in receiver.");
|
"\n\tCurrent frame index received in receiver.");
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user