mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 21:37:13 +02:00
Compare commits
178 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 | |||
a0c222b3c6 | |||
65d95480bd | |||
6cfd0f8962 | |||
6e47f0b7f7 | |||
3c891495db | |||
66b837eb59 | |||
6170c42618 | |||
95030bc55f | |||
69dd5f3b5e | |||
c1fac7cdb7 | |||
de57146e1b | |||
fb75986c55 | |||
e8bdf5a505 | |||
f3598c1f39 | |||
9ac08ad5c9 | |||
bcb4942793 | |||
4b69ac5cfc | |||
7a00732fa8 | |||
30a4a1740f | |||
39ec29c0e6 | |||
b6d9015ed0 | |||
de53747ddd | |||
70c54f4315 | |||
a709384fbb | |||
a1abd7587c | |||
8c8d213b56 | |||
7b31fbc002 | |||
db9aa7589a | |||
28f8a76dcc | |||
dac5ecd123 | |||
71b0ed271e | |||
c223f00511 | |||
639ed52d65 | |||
6943763e3d | |||
4b3b518401 | |||
7379b1e2ef | |||
ed2a69744b | |||
086cbacd84 | |||
af9b25fd67 | |||
504fc2d095 | |||
5cf1502287 | |||
8881542156 | |||
d9ae9a8cc6 | |||
6765eb0c94 | |||
be3d82b7b4 | |||
4e0d1fa711 | |||
619106e05f | |||
9bc60518d8 | |||
12d168a6ef | |||
1a8337540a | |||
16bec25b0c | |||
f178b0da39 | |||
2ece6b945e | |||
1d6be74ee5 | |||
07455bb11e | |||
f4cdd759b0 | |||
796890d1c8 | |||
3486137de3 | |||
d53082c615 | |||
c94f6a2bf2 | |||
2364364697 | |||
ad0fb44573 | |||
9455a5fba1 | |||
a28fa66e54 | |||
e996068328 | |||
1bbd77536c | |||
ace105a268 |
@ -16,7 +16,8 @@ Checks: '*,
|
||||
-hicpp-braces-around-statements,
|
||||
-google-runtime-references,
|
||||
-google-readability-todo,
|
||||
-google-readability-braces-around-statements'
|
||||
-google-readability-braces-around-statements,
|
||||
-modernize-use-trailing-return-type'
|
||||
|
||||
HeaderFilterRegex: \.h
|
||||
AnalyzeTemporaryDtors: false
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,6 +7,7 @@ bin/
|
||||
*.out
|
||||
*.toc
|
||||
*.o
|
||||
*.so
|
||||
.*
|
||||
build
|
||||
RELEASE.txt
|
||||
|
31
.travis.yml
31
.travis.yml
@ -4,38 +4,31 @@ language: cpp
|
||||
|
||||
os: linux
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- CONDA_PY=3.6
|
||||
- CONDA_PY=3.7
|
||||
# env:
|
||||
# matrix:
|
||||
# - CONDA_PY="3.7"
|
||||
|
||||
|
||||
dist: trusty
|
||||
|
||||
dist: bionic
|
||||
|
||||
install:
|
||||
- sudo apt-get update
|
||||
- ldd --version
|
||||
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
|
||||
- bash miniconda.sh -b -p $HOME/miniconda
|
||||
- export PATH="$HOME/miniconda/bin:$PATH"
|
||||
- source "$HOME/miniconda/etc/profile.d/conda.sh"
|
||||
- rm -f miniconda.sh
|
||||
- hash -r
|
||||
- conda config --set always_yes yes --set changeps1 no
|
||||
- conda config --add channels conda-forge
|
||||
- conda config --add channels slsdetectorgroup
|
||||
- conda update conda
|
||||
- conda update --all
|
||||
- conda install conda-build=3.17
|
||||
- conda install anaconda-client
|
||||
- conda install conda-verify
|
||||
|
||||
# Useful for debugging any issues with conda
|
||||
- conda update -q conda
|
||||
- conda info -a
|
||||
|
||||
|
||||
# Replace dep1 dep2 ... with your dependencies
|
||||
- conda create -q -n test-environment python=$CONDA_PY
|
||||
- source activate test-environment
|
||||
# Useful for debugging any issues with conda
|
||||
- conda create -q -n testenv conda-build anaconda-client conda-verify
|
||||
- conda activate testenv
|
||||
- conda-build .
|
||||
|
||||
script:
|
||||
@ -44,7 +37,7 @@ script:
|
||||
|
||||
deploy:
|
||||
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:
|
||||
branch: developer
|
||||
branch: udp
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
project(slsDetectorPackage)
|
||||
set(PROJECT_VERSION 5.0.0)
|
||||
|
||||
include(CheckIPOSupported)
|
||||
|
||||
|
||||
@ -106,10 +105,10 @@ endif()
|
||||
|
||||
|
||||
if(SLS_USE_SANITIZER)
|
||||
# target_compile_options(slsProjectOptions INTERFACE -fsanitize=address,undefined -fno-omit-frame-pointer)
|
||||
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=address,undefined)
|
||||
target_compile_options(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||
target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||
target_compile_options(slsProjectOptions INTERFACE -fsanitize=address,undefined -fno-omit-frame-pointer)
|
||||
target_link_libraries(slsProjectOptions INTERFACE -fsanitize=address,undefined)
|
||||
# target_compile_options(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||
endif()
|
||||
|
||||
#rapidjson
|
||||
@ -127,7 +126,7 @@ install(TARGETS slsProjectOptions slsProjectWarnings rapidjson
|
||||
)
|
||||
|
||||
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 FALSE)
|
||||
|
||||
@ -175,6 +174,7 @@ if (SLS_USE_INTEGRATION_TESTS)
|
||||
endif (SLS_USE_INTEGRATION_TESTS)
|
||||
|
||||
if (SLS_USE_PYTHON)
|
||||
set(PYBIND11_CPP_STANDARD -std=c++11)
|
||||
add_subdirectory(libs/pybind11)
|
||||
add_subdirectory(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 install
|
||||
cd build
|
||||
@ -6,7 +7,7 @@ cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX=install \
|
||||
-DSLS_USE_TEXTCLIENT=ON \
|
||||
-DSLS_USE_RECEIVER=ON \
|
||||
-DSLS_USE_GUI=OFF \
|
||||
-DSLS_USE_GUI=ON \
|
||||
-DSLS_USE_TESTS=ON \
|
||||
-DSLS_USE_PYTHON=OFF \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
|
@ -1,14 +1,4 @@
|
||||
|
||||
# mkdir $PREFIX/lib
|
||||
# mkdir $PREFIX/include
|
||||
|
||||
|
||||
# #Shared and static libraries
|
||||
# cp build/bin/_sls_detector* $PREFIX/lib/.
|
||||
|
||||
|
||||
# #Binaries
|
||||
# cp -r build/bin/sls_detector $PREFIX/lib/.
|
||||
|
||||
echo "|<-------- starting python build"
|
||||
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 @@
|
||||
|
||||
mkdir $PREFIX/lib
|
||||
#Copy the GUI
|
||||
mkdir $PREFIX/bin
|
||||
mkdir $PREFIX/include
|
||||
|
||||
#No libs for gui?
|
||||
|
||||
#Binaries
|
||||
cp build/bin/gui_client $PREFIX/bin/.
|
||||
cp build/bin/slsDetectorGui $PREFIX/bin/.
|
||||
|
||||
|
||||
#Which headers do we need for development??
|
||||
|
||||
# cp include/some_lib.h $PREFIX/include/.
|
@ -1,13 +1,14 @@
|
||||
|
||||
package:
|
||||
name: sls_detector_software
|
||||
version: "developer"
|
||||
version: "udp"
|
||||
|
||||
source:
|
||||
- path: ..
|
||||
|
||||
build:
|
||||
number: 1
|
||||
binary_relocation: True
|
||||
rpaths:
|
||||
- lib/
|
||||
|
||||
@ -16,10 +17,9 @@ requirements:
|
||||
- {{ compiler('c') }}
|
||||
- {{compiler('cxx')}}
|
||||
- cmake
|
||||
# - qwt 6.* #require qt5 investigate befor activating gui
|
||||
# - qt=4.8.7=7
|
||||
- zeromq=4.2.5=hfc679d8_5
|
||||
- pyzmq
|
||||
- qwt 6.*
|
||||
- qt 4.8.*
|
||||
- zeromq
|
||||
- xorg-libx11
|
||||
- xorg-libice
|
||||
- xorg-libxext
|
||||
@ -51,70 +51,46 @@ requirements:
|
||||
|
||||
|
||||
outputs:
|
||||
- name: sls_detector_lib
|
||||
- name: slsdetlib
|
||||
script: copy_lib.sh
|
||||
|
||||
- name: sls_detector
|
||||
requirements:
|
||||
run:
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
- zeromq
|
||||
|
||||
- name: slsdet
|
||||
|
||||
script: build_pylib.sh
|
||||
|
||||
requirements:
|
||||
build:
|
||||
- python
|
||||
- {{ compiler('c') }}
|
||||
- {{compiler('cxx')}}
|
||||
- python {{ python }}
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||
- setuptools
|
||||
- sls_detector_lib
|
||||
- pyzmq
|
||||
- pybind11 2.2
|
||||
|
||||
host:
|
||||
- python
|
||||
- pybind11 2.2
|
||||
- pyzmq
|
||||
- sls_detector_lib
|
||||
|
||||
run:
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
run:
|
||||
- python
|
||||
- numpy
|
||||
- sls_detector_lib=developer
|
||||
- pyzmq
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||
|
||||
|
||||
test:
|
||||
imports:
|
||||
- sls_detector
|
||||
- slsdet
|
||||
|
||||
# requirements:
|
||||
# build:
|
||||
# - {{ compiler('c') }}
|
||||
# - {{compiler('cxx')}}
|
||||
|
||||
# - name: sls_detector_gui
|
||||
# version: "refactor"
|
||||
# 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
|
||||
- name: slsdetgui
|
||||
script: copy_gui.sh
|
||||
requirements:
|
||||
run:
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||
- qwt 6.*
|
||||
- qt 4.8.*
|
||||
|
@ -71,6 +71,11 @@ target_link_libraries(ctbRootLib PUBLIC
|
||||
${ROOT_EXE_LINKER_FLAGS}
|
||||
)
|
||||
|
||||
set_target_properties(
|
||||
ctbRootLib PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
|
||||
target_link_libraries(ctbGui PUBLIC
|
||||
slsDetectorShared
|
||||
slsSupportLib
|
||||
@ -80,4 +85,5 @@ target_link_libraries(ctbGui PUBLIC
|
||||
|
||||
set_target_properties(ctbGui PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
|
||||
)
|
@ -12,7 +12,7 @@ file writing etc.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from sls_detector import Eiger
|
||||
from slsdet import Eiger
|
||||
|
||||
d = Eiger()
|
||||
threshold = range(0, 2000, 200)
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include "catch.hpp"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "DetectorImpl.h"
|
||||
#include "string_utils.h"
|
||||
#include "tests/globals.h"
|
||||
#include <iostream>
|
||||
|
||||
class MultiDetectorFixture {
|
||||
protected:
|
||||
multiSlsDetector d;
|
||||
DetectorImpl d;
|
||||
|
||||
public:
|
||||
MultiDetectorFixture() : d(0, true, true) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "ClientSocket.h"
|
||||
#include "logger.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "DetectorImpl.h"
|
||||
#include "slsDetector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
@ -252,7 +252,7 @@ TEST_CASE(
|
||||
int ratecorr = 125;
|
||||
|
||||
// pick up multi detector from shm id 0
|
||||
multiSlsDetector m(0);
|
||||
DetectorImpl m(0);
|
||||
|
||||
// ensure eiger detector type, hostname and online
|
||||
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
|
||||
@ -302,7 +302,7 @@ TEST_CASE("Chiptestboard Loading Patterns", "[.ctbintegration]") {
|
||||
SingleDetectorConfig c;
|
||||
|
||||
// pick up multi detector from shm id 0
|
||||
multiSlsDetector m(0);
|
||||
DetectorImpl m(0);
|
||||
|
||||
// ensure ctb detector type, hostname and online
|
||||
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
|
||||
@ -387,7 +387,7 @@ TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert", "[.ctbintegrat
|
||||
SingleDetectorConfig c;
|
||||
|
||||
// pick up multi detector from shm id 0
|
||||
multiSlsDetector m(0);
|
||||
DetectorImpl m(0);
|
||||
|
||||
// ensure ctb detector type, hostname and online
|
||||
REQUIRE(m.getDetectorTypeAsEnum() == c.type_enum);
|
||||
@ -457,7 +457,7 @@ TEST_CASE("Eiger or Jungfrau startingfnum", "[.eigerintegration][.jungfrauintegr
|
||||
SingleDetectorConfig c;
|
||||
|
||||
// pick up multi detector from shm id 0
|
||||
multiSlsDetector m(0);
|
||||
DetectorImpl m(0);
|
||||
|
||||
// ensure ctb detector type, hostname and online
|
||||
REQUIRE(((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER) || (m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::JUNGFRAU)));
|
||||
@ -495,7 +495,7 @@ TEST_CASE("Eiger readnlines", "[.eigerintegration][readnlines]") {
|
||||
SingleDetectorConfig c;
|
||||
|
||||
// pick up multi detector from shm id 0
|
||||
multiSlsDetector m(0);
|
||||
DetectorImpl m(0);
|
||||
|
||||
// ensure detector type, hostname
|
||||
REQUIRE((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER));
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "catch.hpp"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "DetectorImpl.h"
|
||||
#include "string_utils.h"
|
||||
#include "tests/globals.h"
|
||||
#include <iostream>
|
||||
@ -9,7 +9,7 @@ using namespace Catch::literals;
|
||||
TEST_CASE("Initialize a multi detector", "[.integration][.multi]") {
|
||||
auto hostnames = sls::split(test::hostname, '+');
|
||||
|
||||
multiSlsDetector d(0, true, true);
|
||||
DetectorImpl d(0, true, true);
|
||||
d.setHostname(test::hostname.c_str());
|
||||
|
||||
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]") {
|
||||
|
||||
multiSlsDetector d(0, true, true);
|
||||
DetectorImpl d(0, true, true);
|
||||
d.setHostname(test::hostname.c_str());
|
||||
|
||||
// FRAME_NUMBER
|
||||
|
Submodule libs/pybind11 updated: a23996fce3...4f72ef846f
@ -17,13 +17,13 @@
|
||||
|
||||
/*! \file document.h */
|
||||
|
||||
#include "reader.h"
|
||||
#include "encodedstream.h"
|
||||
#include "internal/meta.h"
|
||||
#include "internal/strfunc.h"
|
||||
#include "memorystream.h"
|
||||
#include "encodedstream.h"
|
||||
#include <new> // placement new
|
||||
#include "reader.h"
|
||||
#include <limits>
|
||||
#include <new> // placement new
|
||||
|
||||
RAPIDJSON_DIAG_PUSH
|
||||
#ifdef _MSC_VER
|
||||
|
@ -15,8 +15,8 @@
|
||||
#ifndef RAPIDJSON_ENCODEDSTREAM_H_
|
||||
#define RAPIDJSON_ENCODEDSTREAM_H_
|
||||
|
||||
#include "stream.h"
|
||||
#include "memorystream.h"
|
||||
#include "stream.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
RAPIDJSON_DIAG_PUSH
|
||||
|
@ -15,9 +15,9 @@
|
||||
#ifndef RAPIDJSON_STRTOD_
|
||||
#define RAPIDJSON_STRTOD_
|
||||
|
||||
#include "ieee754.h"
|
||||
#include "biginteger.h"
|
||||
#include "diyfp.h"
|
||||
#include "ieee754.h"
|
||||
#include "pow10.h"
|
||||
|
||||
RAPIDJSON_NAMESPACE_BEGIN
|
||||
|
@ -164,8 +164,8 @@
|
||||
#include "msinttypes/inttypes.h"
|
||||
#else
|
||||
// Other compilers should have this.
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
//!@endcond
|
||||
#ifdef RAPIDJSON_DOXYGEN_RUNNING
|
||||
|
@ -18,11 +18,11 @@
|
||||
/*! \file reader.h */
|
||||
|
||||
#include "allocators.h"
|
||||
#include "stream.h"
|
||||
#include "encodedstream.h"
|
||||
#include "internal/meta.h"
|
||||
#include "internal/stack.h"
|
||||
#include "internal/strtod.h"
|
||||
#include "stream.h"
|
||||
#include <limits>
|
||||
|
||||
#if defined(RAPIDJSON_SIMD) && defined(_MSC_VER)
|
||||
|
@ -1,19 +1,22 @@
|
||||
|
||||
pybind11_add_module(_sls_detector
|
||||
# find_package (Python COMPONENTS Interpreter Development)
|
||||
|
||||
pybind11_add_module(_slsdet
|
||||
src/main.cpp
|
||||
src/enums.cpp
|
||||
src/experimental.cpp
|
||||
src/detector.cpp
|
||||
src/network.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(_sls_detector PUBLIC
|
||||
target_link_libraries(_slsdet PUBLIC
|
||||
slsDetectorShared
|
||||
slsReceiverShared
|
||||
slsSupportLib
|
||||
zmq )
|
||||
)
|
||||
|
||||
|
||||
|
||||
set_target_properties(_sls_detector PROPERTIES
|
||||
set_target_properties(_slsdet PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
|
||||
@ -24,20 +27,21 @@ set( PYTHON_FILES
|
||||
dacs.py
|
||||
decorators.py
|
||||
detector_property.py
|
||||
# detector.py
|
||||
# eiger.py
|
||||
detector.py
|
||||
eiger.py
|
||||
errors.py
|
||||
experimental.py
|
||||
# jungfrau_ctb.py
|
||||
# jungfrau.py
|
||||
ctb.py
|
||||
jungfrau.py
|
||||
mythen3.py
|
||||
registers.py
|
||||
lookup.py
|
||||
utils.py
|
||||
|
||||
)
|
||||
|
||||
foreach(FILE ${PYTHON_FILES})
|
||||
configure_file( sls_detector/${FILE}
|
||||
${CMAKE_BINARY_DIR}/bin/sls_detector/${FILE} )
|
||||
configure_file( slsdet/${FILE}
|
||||
${CMAKE_BINARY_DIR}/bin/slsdet/${FILE} )
|
||||
|
||||
endforeach(FILE ${PYTHON_FILES})
|
||||
|
||||
|
@ -2,9 +2,14 @@ import os
|
||||
import sys
|
||||
import numpy as np
|
||||
sys.path.append(os.path.join(os.getcwd(), 'bin'))
|
||||
# from sls_detector import Eiger, Jungfrau, Detector, defs
|
||||
from sls_detector import Detector
|
||||
from sls_detector import dacIndex
|
||||
|
||||
from sls_detector import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb
|
||||
from sls_detector import dacIndex, readoutMode
|
||||
from sls_detector.lookup import view, find
|
||||
|
||||
d = Detector()
|
||||
|
||||
# e = Eiger()
|
||||
c = Ctb()
|
||||
# j = Jungfrau()
|
||||
# m = Mythen3()
|
||||
|
||||
|
25
python/scripts/cmd_python.py
Normal file
25
python/scripts/cmd_python.py
Normal file
@ -0,0 +1,25 @@
|
||||
import subprocess
|
||||
import locale
|
||||
out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
|
||||
cmd = out.stdout.splitlines()
|
||||
cmd.pop(0)
|
||||
|
||||
from sls_detector import Detector, Eiger, Ctb
|
||||
|
||||
pycmd = dir(Detector)+dir(Eiger)+dir(Ctb)
|
||||
|
||||
pycmd += ['vrf', 'vtr', 'vrs', 'vtgstv', 'vsvn', 'vtrim',
|
||||
'vsvp', 'vth1', 'vth2', 'vth3', 'vshaper', 'vshaperneg', 'rxb_rb',
|
||||
'rxb_lb', 'vref_prech', 'vref_rstore', 'vref_cds',
|
||||
'vpreamp', 'vref_comp', 'vref_comp_fe vref_ds', 'vref_h_adc',
|
||||
'vref_l_adc', 'iodelay', 'list', 'vref_ds', 'vis', 'vpl',
|
||||
'vref_comp_fe', 'vph', 'vout_cm', 'vcp', 'vcn', 'vcmp_ll', 'vcmp_lr'
|
||||
, 'vcmp_rl', 'vcmp_rr']
|
||||
|
||||
missing = []
|
||||
for c in cmd:
|
||||
if c not in pycmd:
|
||||
print(c)
|
||||
missing.append(c)
|
||||
|
||||
print(f'Missing: {len(missing)} commands')
|
@ -9,19 +9,7 @@ enums.cpp
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
|
||||
# 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)
|
||||
from parse import remove_comments
|
||||
|
||||
def extract_enums(lines):
|
||||
line_iter = iter(lines)
|
||||
|
84
python/scripts/generate_functions.py
Normal file
84
python/scripts/generate_functions.py
Normal file
@ -0,0 +1,84 @@
|
||||
"""
|
||||
This file is used to auto generate Python bindings for the
|
||||
sls::Detector class. The tool needs the libclang bindings
|
||||
to be installed.
|
||||
|
||||
When the Detector API is updated this file should be run
|
||||
manually
|
||||
"""
|
||||
from clang import cindex
|
||||
import subprocess
|
||||
import argparse
|
||||
|
||||
|
||||
from parse import system_include_paths
|
||||
|
||||
default_build_path = "/home/l_frojdh/sls/build/"
|
||||
fpath = "../../slsDetectorSoftware/src/Detector.cpp"
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-p", "--build_path", help="Path to the build database", type = str, default=default_build_path)
|
||||
cargs = parser.parse_args()
|
||||
|
||||
db = cindex.CompilationDatabase.fromDirectory(cargs.build_path)
|
||||
index = cindex.Index.create()
|
||||
args = db.getCompileCommands(fpath)
|
||||
args = list(iter(args).__next__().arguments)[0:-1]
|
||||
args = args + "-x c++ --std=c++11".split()
|
||||
syspath = system_include_paths('clang++')
|
||||
incargs = ["-I" + inc for inc in syspath]
|
||||
args = args + incargs
|
||||
|
||||
|
||||
tu = index.parse(fpath, args=args)
|
||||
|
||||
|
||||
m = []
|
||||
ag = []
|
||||
|
||||
lines = []
|
||||
|
||||
|
||||
def get_arguments(node):
|
||||
args = [a.type.spelling for a in node.get_arguments()]
|
||||
args = [
|
||||
"py::arg() = Positions{}" if item == "sls::Positions" else "py::arg()"
|
||||
for item in args
|
||||
]
|
||||
args = ', '.join(args)
|
||||
if args:
|
||||
args = f', {args}'
|
||||
return args
|
||||
|
||||
|
||||
def visit(node):
|
||||
if node.kind == cindex.CursorKind.CLASS_DECL:
|
||||
if node.displayname == "Detector":
|
||||
for child in node.get_children():
|
||||
if (
|
||||
child.kind == cindex.CursorKind.CXX_METHOD
|
||||
and child.access_specifier == cindex.AccessSpecifier.PUBLIC
|
||||
):
|
||||
m.append(child)
|
||||
args = get_arguments(child)
|
||||
lines.append(f'.def(\"{child.spelling}\", &Detector::{child.spelling}{args})')
|
||||
for child in node.get_children():
|
||||
visit(child)
|
||||
|
||||
|
||||
visit(tu.cursor)
|
||||
|
||||
|
||||
with open('../src/detector_in.cpp') as f:
|
||||
data = f.read()
|
||||
s = ''.join(lines)
|
||||
s += ';'
|
||||
text = data.replace('[[FUNCTIONS]]', s)
|
||||
warning = '/* WARINING This file is auto generated any edits might be overwritten without warning */\n\n'
|
||||
with open('../src/detector.cpp', 'w') as f:
|
||||
f.write(warning)
|
||||
f.write(text)
|
||||
|
||||
# run clang format on the output
|
||||
subprocess.run(['clang-format', '../src/detector.cpp', '-i'])
|
@ -1,4 +1,9 @@
|
||||
import re
|
||||
import subprocess
|
||||
from subprocess import PIPE
|
||||
import os
|
||||
|
||||
|
||||
def remove_comments(text):
|
||||
def replacer(match):
|
||||
s = match.group(0)
|
||||
@ -10,4 +15,42 @@ def remove_comments(text):
|
||||
r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',
|
||||
re.DOTALL | re.MULTILINE
|
||||
)
|
||||
return re.sub(pattern, replacer, text)
|
||||
return re.sub(pattern, replacer, text)
|
||||
|
||||
|
||||
|
||||
|
||||
#based on ccsyspath: https://github.com/AndrewWalker/ccsyspath
|
||||
|
||||
def compiler_preprocessor_verbose(compiler, extraflags):
|
||||
"""Capture the compiler preprocessor stage in verbose mode
|
||||
"""
|
||||
lines = []
|
||||
with open(os.devnull, 'r', encoding='utf-8') as devnull:
|
||||
cmd = [compiler, '-E']
|
||||
cmd += extraflags
|
||||
cmd += ['-', '-v']
|
||||
p = subprocess.Popen(cmd, stdin=devnull, stdout=PIPE, stderr=PIPE)
|
||||
p.wait()
|
||||
lines = p.stderr.read()
|
||||
lines = lines.splitlines()
|
||||
return lines
|
||||
|
||||
def system_include_paths(compiler, cpp=True):
|
||||
extraflags = []
|
||||
if cpp:
|
||||
extraflags = b'-x c++'.split()
|
||||
lines = compiler_preprocessor_verbose(compiler, extraflags)
|
||||
lines = [ line.strip() for line in lines ]
|
||||
|
||||
start = lines.index(b'#include <...> search starts here:')
|
||||
end = lines.index(b'End of search list.')
|
||||
|
||||
lines = lines[start+1:end]
|
||||
paths = []
|
||||
for line in lines:
|
||||
line = line.replace(b'(framework directory)', b'')
|
||||
line = line.strip()
|
||||
paths.append(line)
|
||||
paths = [p.decode('utf-8') for p in paths]
|
||||
return paths
|
@ -8,7 +8,7 @@ import sys
|
||||
import setuptools
|
||||
import os
|
||||
|
||||
__version__ = 'refactor'
|
||||
__version__ = 'udp'
|
||||
|
||||
|
||||
def get_conda_path():
|
||||
@ -19,30 +19,32 @@ def get_conda_path():
|
||||
return os.environ['CONDA_PREFIX']
|
||||
|
||||
|
||||
class get_pybind_include(object):
|
||||
"""Helper class to determine the pybind11 include path
|
||||
The purpose of this class is to postpone importing pybind11
|
||||
until it is actually installed, so that the ``get_include()``
|
||||
method can be invoked. """
|
||||
# class get_pybind_include(object):
|
||||
# """Helper class to determine the pybind11 include path
|
||||
# The purpose of this class is to postpone importing pybind11
|
||||
# until it is actually installed, so that the ``get_include()``
|
||||
# method can be invoked. """
|
||||
|
||||
def __init__(self, user=False):
|
||||
self.user = user
|
||||
# def __init__(self, user=False):
|
||||
# self.user = user
|
||||
|
||||
def __str__(self):
|
||||
import pybind11
|
||||
return pybind11.get_include(self.user)
|
||||
# def __str__(self):
|
||||
# import pybind11
|
||||
# return pybind11.get_include(self.user)
|
||||
|
||||
|
||||
ext_modules = [
|
||||
Extension(
|
||||
'_sls_detector',
|
||||
'_slsdet',
|
||||
['src/main.cpp',
|
||||
'src/enums.cpp',
|
||||
'src/experimental.cpp'],
|
||||
'src/detector.cpp',
|
||||
'src/network.cpp'],
|
||||
include_dirs=[
|
||||
# Path to pybind11 headers
|
||||
get_pybind_include(),
|
||||
get_pybind_include(user=True),
|
||||
# get_pybind_include(),
|
||||
# get_pybind_include(user=True),
|
||||
os.path.join('../libs/pybind11/include'),
|
||||
os.path.join(get_conda_path(), 'include/slsDetectorPackage'),
|
||||
|
||||
],
|
||||
@ -108,20 +110,28 @@ class BuildExt(build_ext):
|
||||
opts.append('/DVERSION_INFO=\\"%s\\"' % self.distribution.get_version())
|
||||
for ext in self.extensions:
|
||||
ext.extra_compile_args = opts
|
||||
build_ext.build_extensions(self)
|
||||
|
||||
print('**************************************************')
|
||||
print(ct)
|
||||
print(opts)
|
||||
print('**************************************************')
|
||||
build_ext.build_extensions(self)
|
||||
|
||||
|
||||
|
||||
def get_shared_lib():
|
||||
return [f for f in os.listdir('.') if '_slsdet' in f]
|
||||
|
||||
setup(
|
||||
name='sls_detector',
|
||||
name='slsdet',
|
||||
version=__version__,
|
||||
author='Erik Frojdh',
|
||||
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',
|
||||
long_description='',
|
||||
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
|
||||
ext_modules=ext_modules,
|
||||
install_requires=['pybind11>=2.2'],
|
||||
cmdclass={'build_ext': BuildExt},
|
||||
zip_safe=False,
|
||||
)
|
||||
|
@ -1,17 +0,0 @@
|
||||
# from .detector import Detector, DetectorError, free_shared_memory
|
||||
# from .eiger import Eiger
|
||||
from .experimental import Detector
|
||||
|
||||
# from .jungfrau import Jungfrau
|
||||
# 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
|
@ -1,596 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Wed Dec 6 11:51:18 2017
|
||||
|
||||
@author: l_frojdh
|
||||
"""
|
||||
|
||||
import socket
|
||||
from collections.abc import Iterable
|
||||
from collections import namedtuple
|
||||
from functools import partial
|
||||
|
||||
from .adcs import Adc, DetectorAdcs
|
||||
from .dacs import DetectorDacs
|
||||
from .detector import Detector
|
||||
from .detector_property import DetectorProperty
|
||||
from .utils import element_if_equal
|
||||
from sls_detector.errors import DetectorValueError, DetectorError
|
||||
|
||||
class EigerVcmp:
|
||||
"""
|
||||
Convenience class to be able to loop over vcmp for Eiger
|
||||
|
||||
|
||||
.. todo::
|
||||
|
||||
Support single assignment and perhaps unify with Dac class
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, detector):
|
||||
_names = ['vcmp_ll',
|
||||
'vcmp_lr',
|
||||
'vcmp_rl',
|
||||
'vcmp_rr']
|
||||
self.set = []
|
||||
self.get = []
|
||||
for i in range(detector.n_modules):
|
||||
if i % 2 == 0:
|
||||
name = _names
|
||||
else:
|
||||
name = _names[::-1]
|
||||
for n in name:
|
||||
self.set.append(partial(detector._api.setDac, n, i))
|
||||
self.get.append(partial(detector._api.getDac, n, i))
|
||||
|
||||
def __getitem__(self, key):
|
||||
if key == slice(None, None, None):
|
||||
return [_d() for _d in self.get]
|
||||
return self.get[key]()
|
||||
|
||||
def __setitem__(self, i, value):
|
||||
self.set[i](value)
|
||||
|
||||
def __repr__(self):
|
||||
return 'vcmp: '+ str(self[:])
|
||||
|
||||
|
||||
class EigerDacs(DetectorDacs):
|
||||
_dacs = [('vsvp', 0, 4000, 0),
|
||||
('vtr', 0, 4000, 2500),
|
||||
('vrf', 0, 4000, 3300),
|
||||
('vrs', 0, 4000, 1400),
|
||||
('vsvn', 0, 4000, 4000),
|
||||
('vtgstv', 0, 4000, 2556),
|
||||
('vcmp_ll', 0, 4000, 1500),
|
||||
('vcmp_lr', 0, 4000, 1500),
|
||||
('vcall', 0, 4000, 4000),
|
||||
('vcmp_rl', 0, 4000, 1500),
|
||||
('rxb_rb', 0, 4000, 1100),
|
||||
('rxb_lb', 0, 4000, 1100),
|
||||
('vcmp_rr', 0, 4000, 1500),
|
||||
('vcp', 0, 4000, 200),
|
||||
('vcn', 0, 4000, 2000),
|
||||
('vis', 0, 4000, 1550),
|
||||
('iodelay', 0, 4000, 660)]
|
||||
_dacnames = [_d[0] for _d in _dacs]
|
||||
|
||||
|
||||
# noinspection PyProtectedMember
|
||||
class DetectorDelays:
|
||||
_delaynames = ['frame', 'left', 'right']
|
||||
|
||||
def __init__(self, detector):
|
||||
# We need to at least initially know which detector we are connected to
|
||||
self._detector = detector
|
||||
|
||||
setattr(self, '_frame', DetectorProperty(detector._api.getDelayFrame,
|
||||
detector._api.setDelayFrame,
|
||||
detector._api.getNumberOfDetectors,
|
||||
'frame'))
|
||||
|
||||
setattr(self, '_left', DetectorProperty(detector._api.getDelayLeft,
|
||||
detector._api.setDelayLeft,
|
||||
detector._api.getNumberOfDetectors,
|
||||
'left'))
|
||||
|
||||
setattr(self, '_right', DetectorProperty(detector._api.getDelayRight,
|
||||
detector._api.setDelayRight,
|
||||
detector._api.getNumberOfDetectors,
|
||||
'right'))
|
||||
# Index to support iteration
|
||||
self._current = 0
|
||||
|
||||
def __getattr__(self, name):
|
||||
return self.__getattribute__('_' + name)
|
||||
|
||||
def __setattr__(self, name, value):
|
||||
if name in self._delaynames:
|
||||
return self.__getattribute__('_' + name).__setitem__(slice(None, None, None), value)
|
||||
else:
|
||||
super().__setattr__(name, value)
|
||||
|
||||
def __next__(self):
|
||||
if self._current >= len(self._delaynames):
|
||||
self._current = 0
|
||||
raise StopIteration
|
||||
else:
|
||||
self._current += 1
|
||||
return self.__getattr__(self._delaynames[self._current-1])
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def __repr__(self):
|
||||
hn = self._detector.hostname
|
||||
r_str = ['Transmission delay [ns]\n'
|
||||
'{:11s}{:>8s}{:>8s}{:>8s}'.format('', 'left', 'right', 'frame')]
|
||||
for i in range(self._detector.n_modules):
|
||||
r_str.append('{:2d}:{:8s}{:>8d}{:>8d}{:>8d}'.format(i, hn[i], self.left[i], self.right[i], self.frame[i]))
|
||||
return '\n'.join(r_str)
|
||||
|
||||
|
||||
class Eiger(Detector):
|
||||
"""
|
||||
Subclassing Detector to set up correct dacs and detector specific
|
||||
functions.
|
||||
"""
|
||||
_detector_dynamic_range = [4, 8, 16, 32]
|
||||
|
||||
|
||||
_settings = ['standard', 'highgain', 'lowgain', 'veryhighgain', 'verylowgain']
|
||||
"""available settings for Eiger, note almost always standard"""
|
||||
|
||||
def __init__(self, id=0):
|
||||
super().__init__(id)
|
||||
|
||||
self._active = DetectorProperty(self._api.getActive,
|
||||
self._api.setActive,
|
||||
self._api.getNumberOfDetectors,
|
||||
'active')
|
||||
|
||||
self._vcmp = EigerVcmp(self)
|
||||
self._dacs = EigerDacs(self)
|
||||
self._trimbit_limits = namedtuple('trimbit_limits', ['min', 'max'])(0, 63)
|
||||
self._delay = DetectorDelays(self)
|
||||
|
||||
# Eiger specific adcs
|
||||
self._temp = DetectorAdcs()
|
||||
self._temp.fpga = Adc('temp_fpga', self)
|
||||
self._temp.fpgaext = Adc('temp_fpgaext', self)
|
||||
self._temp.t10ge = Adc('temp_10ge', self)
|
||||
self._temp.dcdc = Adc('temp_dcdc', self)
|
||||
self._temp.sodl = Adc('temp_sodl', self)
|
||||
self._temp.sodr = Adc('temp_sodr', self)
|
||||
self._temp.fpgafl = Adc('temp_fpgafl', self)
|
||||
self._temp.fpgafr = Adc('temp_fpgafr', self)
|
||||
|
||||
@property
|
||||
def active(self):
|
||||
"""
|
||||
Is the detector active? Can be used to enable or disable a detector
|
||||
module
|
||||
|
||||
Examples
|
||||
----------
|
||||
|
||||
::
|
||||
|
||||
d.active
|
||||
>> active: [True, True]
|
||||
|
||||
d.active[1] = False
|
||||
>> active: [True, False]
|
||||
"""
|
||||
return self._active
|
||||
|
||||
@active.setter
|
||||
def active(self, value):
|
||||
self._active[:] = value
|
||||
|
||||
@property
|
||||
def measured_period(self):
|
||||
return self._api.getMeasuredPeriod()
|
||||
|
||||
@property
|
||||
def measured_subperiod(self):
|
||||
return self._api.getMeasuredSubPeriod()
|
||||
|
||||
@property
|
||||
def add_gappixels(self):
|
||||
"""Enable or disable the (virual) pixels between ASICs
|
||||
|
||||
Examples
|
||||
----------
|
||||
|
||||
::
|
||||
|
||||
d.add_gappixels = True
|
||||
|
||||
d.add_gappixels
|
||||
>> True
|
||||
|
||||
"""
|
||||
return self._api.getGapPixels()
|
||||
|
||||
@add_gappixels.setter
|
||||
def add_gappixels(self, value):
|
||||
self._api.setGapPixels(value)
|
||||
|
||||
@property
|
||||
def dacs(self):
|
||||
"""
|
||||
|
||||
An instance of DetectorDacs used for accessing the dacs of a single
|
||||
or multi detector.
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
d = Eiger()
|
||||
|
||||
#Set all vrf to 1500
|
||||
d.dacs.vrf = 1500
|
||||
|
||||
#Check vrf
|
||||
d.dacs.vrf
|
||||
>> vrf : 1500, 1500
|
||||
|
||||
#Set a single vtr
|
||||
d.dacs.vtr[0] = 1800
|
||||
|
||||
#Set vrf with multiple values
|
||||
d.dacs.vrf = [3500,3700]
|
||||
d.dacs.vrf
|
||||
>> vrf : 3500, 3700
|
||||
|
||||
#read into a variable
|
||||
var = d.dacs.vrf[:]
|
||||
|
||||
#set multiple with multiple values, mostly used for large systems
|
||||
d.dacs.vcall[0,1] = [3500,3600]
|
||||
d.dacs.vcall
|
||||
>> vcall : 3500, 3600
|
||||
|
||||
d.dacs
|
||||
>>
|
||||
========== DACS =========
|
||||
vsvp : 0, 0
|
||||
vtr : 4000, 4000
|
||||
vrf : 1900, 1900
|
||||
vrs : 1400, 1400
|
||||
vsvn : 4000, 4000
|
||||
vtgstv : 2556, 2556
|
||||
vcmp_ll : 1500, 1500
|
||||
vcmp_lr : 1500, 1500
|
||||
vcall : 4000, 4000
|
||||
vcmp_rl : 1500, 1500
|
||||
rxb_rb : 1100, 1100
|
||||
rxb_lb : 1100, 1100
|
||||
vcmp_rr : 1500, 1500
|
||||
vcp : 1500, 1500
|
||||
vcn : 2000, 2000
|
||||
vis : 1550, 1550
|
||||
iodelay : 660, 660
|
||||
|
||||
"""
|
||||
return self._dacs
|
||||
|
||||
@property
|
||||
def tx_delay(self):
|
||||
"""
|
||||
Transmission delay of the modules to allow running the detector
|
||||
in a network not supporting the full speed of the detector.
|
||||
|
||||
|
||||
::
|
||||
|
||||
d.tx_delay
|
||||
>>
|
||||
Transmission delay [ns]
|
||||
left right frame
|
||||
0:beb048 0 15000 0
|
||||
1:beb049 100 190000 100
|
||||
|
||||
d.tx_delay.left = [2000,5000]
|
||||
"""
|
||||
return self._delay
|
||||
|
||||
def default_settings(self):
|
||||
"""
|
||||
reset the detector to some type of standard settings
|
||||
mostly used when testing
|
||||
"""
|
||||
self.n_frames = 1
|
||||
self.exposure_time = 1
|
||||
self.period = 0
|
||||
self.n_cycles = 1
|
||||
self.n_measurements = 1
|
||||
self.dynamic_range = 16
|
||||
|
||||
@property
|
||||
def eiger_matrix_reset(self):
|
||||
"""
|
||||
Matrix reset bit for Eiger.
|
||||
|
||||
:py:obj:`True` : Normal operation, the matrix is reset before each acq.
|
||||
:py:obj:`False` : Matrix reset disabled. Used to not reset before
|
||||
reading out analog test pulses.
|
||||
"""
|
||||
return self._api.getCounterBit()
|
||||
|
||||
@eiger_matrix_reset.setter
|
||||
def eiger_matrix_reset(self, value):
|
||||
self._api.setCounterBit(value)
|
||||
|
||||
@property
|
||||
def flowcontrol_10g(self):
|
||||
"""
|
||||
:py:obj:`True` - Flow control enabled :py:obj:`False` flow control disabled.
|
||||
Sets for all moduels, if for some reason access to a single module is needed
|
||||
this can be done trough the C++ API.
|
||||
|
||||
"""
|
||||
fc = self._api.getNetworkParameter('flow_control_10g')
|
||||
return element_if_equal([bool(int(e)) for e in fc])
|
||||
|
||||
@flowcontrol_10g.setter
|
||||
def flowcontrol_10g(self, value):
|
||||
if value is True:
|
||||
v = '1'
|
||||
else:
|
||||
v = '0'
|
||||
self._api.setNetworkParameter('flow_control_10g', v, -1)
|
||||
|
||||
def pulse_all_pixels(self, n):
|
||||
"""
|
||||
Pulse each pixel of the chip **n** times using the analog test pulses.
|
||||
The pulse height is set using d.dacs.vcall with 4000 being 0 and 0 being
|
||||
the highest pulse.
|
||||
|
||||
::
|
||||
|
||||
#Pulse all pixels ten times
|
||||
d.pulse_all_pixels(10)
|
||||
|
||||
#Avoid resetting before acq
|
||||
d.eiger_matrix_reset = False
|
||||
|
||||
d.acq() #take frame
|
||||
|
||||
#Restore normal behaviour
|
||||
d.eiger_matrix_reset = True
|
||||
|
||||
|
||||
"""
|
||||
self._api.pulseAllPixels(n)
|
||||
|
||||
|
||||
def pulse_diagonal(self, n):
|
||||
"""
|
||||
Pulse pixels in super colums in a diagonal fashion. Used for calibration
|
||||
of vcall. Saves time compared to pulsing all pixels.
|
||||
"""
|
||||
self._api.pulseDiagonal(n)
|
||||
|
||||
|
||||
def pulse_chip(self, n):
|
||||
"""
|
||||
Advance the counter by toggling enable. Gives 2*n+2 int the counter
|
||||
|
||||
"""
|
||||
n = int(n)
|
||||
if n >= -1:
|
||||
self._api.pulseChip(n)
|
||||
else:
|
||||
raise ValueError('n must be equal or larger than -1')
|
||||
|
||||
@property
|
||||
def vcmp(self):
|
||||
"""
|
||||
Convenience function to get and set the individual vcmp of chips
|
||||
Used mainly in the calibration code.
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
#Reading
|
||||
d.vcmp[:]
|
||||
>> [500, 500, 500, 500, 500, 500, 500, 500]
|
||||
|
||||
#Setting
|
||||
d.vcmp = [500, 500, 500, 500, 500, 500, 500, 500]
|
||||
|
||||
|
||||
"""
|
||||
|
||||
return self._vcmp
|
||||
|
||||
@vcmp.setter
|
||||
def vcmp(self, values):
|
||||
if len(values) == len(self._vcmp.set):
|
||||
for i, v in enumerate(values):
|
||||
self._vcmp.set[i](v)
|
||||
else:
|
||||
raise ValueError('vcmp only compatible with setting all')
|
||||
|
||||
@property
|
||||
def rx_udpport(self):
|
||||
"""
|
||||
UDP port for the receiver. Each module has two ports referred to
|
||||
as rx_udpport and rx_udpport2 in the command line interface
|
||||
here they are grouped for each detector
|
||||
|
||||
::
|
||||
|
||||
[0:rx_udpport, 0:rx_udpport2, 1:rx_udpport ...]
|
||||
|
||||
Examples
|
||||
-----------
|
||||
|
||||
::
|
||||
|
||||
d.rx_udpport
|
||||
>> [50010, 50011, 50004, 50005]
|
||||
|
||||
d.rx_udpport = [50010, 50011, 50012, 50013]
|
||||
|
||||
"""
|
||||
p0 = self._api.getReceiverUDPPort()
|
||||
p1 = self._api.getReceiverUDPPort2()
|
||||
return [int(val) for pair in zip(p0, p1) for val in pair]
|
||||
|
||||
@rx_udpport.setter
|
||||
def rx_udpport(self, ports):
|
||||
"""Requires iterating over elements two and two for setting ports"""
|
||||
a = iter(ports)
|
||||
for i, p in enumerate(zip(a, a)):
|
||||
self._api.setReceiverUDPPort(p[0], i)
|
||||
self._api.setReceiverUDPPort2(p[1], i)
|
||||
|
||||
@property
|
||||
def rx_zmqport(self):
|
||||
"""
|
||||
Return the receiver zmq ports. Note that Eiger has two ports per receiver!
|
||||
|
||||
::
|
||||
|
||||
detector.rx_zmqport
|
||||
>> [30001, 30002, 30003, 30004]
|
||||
|
||||
|
||||
"""
|
||||
_s = self._api.getReceiverStreamingPort()
|
||||
if _s == '':
|
||||
return []
|
||||
else:
|
||||
return [int(_p) + i for _p in _s for i in range(2)]
|
||||
|
||||
@rx_zmqport.setter
|
||||
def rx_zmqport(self, port):
|
||||
if isinstance(port, Iterable):
|
||||
for i, p in enumerate(port):
|
||||
self._api.setReceiverStreamingPort(p, i)
|
||||
else:
|
||||
self._api.setReceiverStreamingPort(port, -1)
|
||||
|
||||
|
||||
@property
|
||||
def sub_exposure_time(self):
|
||||
"""
|
||||
Sub frame exposure time in *seconds* for Eiger in 32bit autosumming mode
|
||||
|
||||
::
|
||||
|
||||
d.sub_exposure_time
|
||||
>> 0.0023
|
||||
|
||||
d.sub_exposure_time = 0.002
|
||||
|
||||
"""
|
||||
return self._api.getSubExposureTime() / 1e9
|
||||
|
||||
|
||||
@sub_exposure_time.setter
|
||||
def sub_exposure_time(self, t):
|
||||
#TODO! checking here or in the detector?
|
||||
ns_time = int(t * 1e9)
|
||||
if ns_time > 0:
|
||||
self._api.setSubExposureTime(ns_time)
|
||||
else:
|
||||
raise DetectorValueError('Sub exposure time must be larger than 0')
|
||||
|
||||
@property
|
||||
def sub_deadtime(self):
|
||||
"""
|
||||
Deadtime between subexposures. Used to mimize noise by delaying the start of the next
|
||||
subexposure.
|
||||
"""
|
||||
return self._api.getSubExposureDeadTime() / 1e9
|
||||
|
||||
|
||||
@sub_deadtime.setter
|
||||
def sub_deadtime(self, t):
|
||||
ns_time = int(t * 1e9)
|
||||
if ns_time >= 0:
|
||||
self._api.setSubExposureDeadTime(ns_time)
|
||||
else:
|
||||
raise ValueError('Sub deadtime time must be larger or equal to 0')
|
||||
|
||||
@property
|
||||
def temp(self):
|
||||
"""
|
||||
An instance of DetectorAdcs used to read the temperature
|
||||
of different components
|
||||
|
||||
Examples
|
||||
-----------
|
||||
|
||||
::
|
||||
|
||||
detector.temp
|
||||
>>
|
||||
temp_fpga : 36.90°C, 45.60°C
|
||||
temp_fpgaext : 31.50°C, 32.50°C
|
||||
temp_10ge : 0.00°C, 0.00°C
|
||||
temp_dcdc : 36.00°C, 36.00°C
|
||||
temp_sodl : 33.00°C, 34.50°C
|
||||
temp_sodr : 33.50°C, 34.00°C
|
||||
temp_fpgafl : 33.81°C, 30.93°C
|
||||
temp_fpgafr : 27.88°C, 29.15°C
|
||||
|
||||
a = detector.temp.fpga[:]
|
||||
a
|
||||
>> [36.568, 45.542]
|
||||
|
||||
|
||||
"""
|
||||
return self._temp
|
||||
|
||||
@property
|
||||
def tengiga(self):
|
||||
"""Enable 10Gbit/s data output
|
||||
|
||||
Examples
|
||||
----------
|
||||
|
||||
::
|
||||
|
||||
d.tengiga
|
||||
>> False
|
||||
|
||||
d.tengiga = True
|
||||
|
||||
"""
|
||||
return self._api.getTenGigabitEthernet()
|
||||
|
||||
@tengiga.setter
|
||||
def tengiga(self, value):
|
||||
self._api.setTenGigabitEthernet(value)
|
||||
|
||||
def set_delays(self, delta):
|
||||
self.tx_delay.left = [delta*(i*2) for i in range(self.n_modules)]
|
||||
self.tx_delay.right = [delta*(i*2+1) for i in range(self.n_modules)]
|
||||
|
||||
|
||||
def setup500k(self, hostnames):
|
||||
"""
|
||||
Setup the Eiger detector to run on the local machine
|
||||
"""
|
||||
|
||||
self.hostname = hostnames
|
||||
self.file_write = False
|
||||
self.image_size = (512, 1024)
|
||||
self.rx_tcpport = [1954, 1955]
|
||||
self.rx_udpport = [50010, 50011, 50004, 50005]
|
||||
self.rx_hostname = socket.gethostname().split('.')[0]
|
||||
self.rx_datastream = False
|
||||
self.file_write = False
|
||||
self.online = True
|
||||
self.receiver_online = True
|
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,7 +1,9 @@
|
||||
from .detector_property import DetectorProperty
|
||||
from functools import partial
|
||||
import numpy as np
|
||||
|
||||
import _slsdet
|
||||
from .detector import freeze
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
class Dac(DetectorProperty):
|
||||
"""
|
||||
This class represents a dac on the detector. One instance handles all
|
||||
@ -14,11 +16,11 @@ class Dac(DetectorProperty):
|
||||
|
||||
|
||||
"""
|
||||
def __init__(self, name, low, high, default, detector):
|
||||
def __init__(self, name, enum, low, high, default, detector):
|
||||
|
||||
super().__init__(partial(detector._api.getDac, name),
|
||||
partial(detector._api.setDac, name),
|
||||
detector._api.getNumberOfDetectors,
|
||||
super().__init__(partial(detector.getDAC, enum, False),
|
||||
lambda x, y : detector.setDAC(enum, x, False, y),
|
||||
detector.size,
|
||||
name)
|
||||
|
||||
self.min_value = low
|
||||
@ -29,30 +31,16 @@ class Dac(DetectorProperty):
|
||||
|
||||
def __repr__(self):
|
||||
"""String representation for a single dac in all modules"""
|
||||
r_str = ['{:10s}: '.format(self.__name__)]
|
||||
r_str += ['{:5d}, '.format(self.get(i)) for i in range(self.get_nmod())]
|
||||
return ''.join(r_str).strip(', ')
|
||||
|
||||
dacstr = ''.join([f'{item:5d}' for item in self.get()])
|
||||
return f'{self.__name__:10s}:{dacstr}'
|
||||
|
||||
# a = Dac('vrf', dacIndex.VRF, 0, 4000, 2500, d )
|
||||
# @freeze
|
||||
class DetectorDacs:
|
||||
_dacs = [('vsvp', 0, 4000, 0),
|
||||
('vtr', 0, 4000, 2500),
|
||||
('vrf', 0, 4000, 3300),
|
||||
('vrs', 0, 4000, 1400),
|
||||
('vsvn', 0, 4000, 4000),
|
||||
('vtgstv', 0, 4000, 2556),
|
||||
('vcmp_ll', 0, 4000, 1500),
|
||||
('vcmp_lr', 0, 4000, 1500),
|
||||
('vcall', 0, 4000, 4000),
|
||||
('vcmp_rl', 0, 4000, 1500),
|
||||
('rxb_rb', 0, 4000, 1100),
|
||||
('rxb_lb', 0, 4000, 1100),
|
||||
('vcmp_rr', 0, 4000, 1500),
|
||||
('vcp', 0, 4000, 200),
|
||||
('vcn', 0, 4000, 2000),
|
||||
('vis', 0, 4000, 1550),
|
||||
('iodelay', 0, 4000, 660)]
|
||||
_dacs = []
|
||||
_dacnames = [_d[0] for _d in _dacs]
|
||||
_allowed_attr = ['_detector', '_current']
|
||||
_frozen = False
|
||||
|
||||
def __init__(self, detector):
|
||||
# We need to at least initially know which detector we are connected to
|
||||
@ -65,6 +53,8 @@ class DetectorDacs:
|
||||
for _d in self._dacs:
|
||||
setattr(self, '_'+_d[0], Dac(*_d, detector))
|
||||
|
||||
self._frozen = True
|
||||
|
||||
def __getattr__(self, name):
|
||||
return self.__getattribute__('_' + name)
|
||||
|
||||
@ -73,8 +63,11 @@ class DetectorDacs:
|
||||
if name in self._dacnames:
|
||||
return self.__getattribute__('_' + name).__setitem__(slice(None, None, None), value)
|
||||
else:
|
||||
if self._frozen == True and name not in self._allowed_attr:
|
||||
raise AttributeError(f'Dac not found: {name}')
|
||||
super().__setattr__(name, value)
|
||||
|
||||
|
||||
def __next__(self):
|
||||
if self._current >= len(self._dacs):
|
||||
self._current = 0
|
||||
@ -95,7 +88,7 @@ class DetectorDacs:
|
||||
"""
|
||||
Read the dacs into a numpy array with dimensions [ndacs, nmodules]
|
||||
"""
|
||||
dac_array = np.zeros((len(self._dacs), self._detector.n_modules))
|
||||
dac_array = np.zeros((len(self._dacs), len(self._detector)))
|
||||
for i, _d in enumerate(self):
|
||||
dac_array[i,:] = _d[:]
|
||||
return dac_array
|
||||
@ -115,11 +108,3 @@ class DetectorDacs:
|
||||
for _d in self:
|
||||
_d[:] = _d.default
|
||||
|
||||
def update_nmod(self):
|
||||
"""
|
||||
Update the cached value of nmod, needs to be run after adding or
|
||||
removing detectors
|
||||
"""
|
||||
for _d in self:
|
||||
_d._n_modules = self._detector.n_modules
|
||||
|
@ -1,37 +1,23 @@
|
||||
from _sls_detector import CppDetectorApi
|
||||
from _sls_detector import slsDetectorDefs
|
||||
from _slsdet import CppDetectorApi
|
||||
from _slsdet import slsDetectorDefs
|
||||
|
||||
runStatus = slsDetectorDefs.runStatus
|
||||
speedLevel = slsDetectorDefs.speedLevel
|
||||
dacIndex = slsDetectorDefs.dacIndex
|
||||
|
||||
from .utils import element_if_equal, all_equal
|
||||
from .utils import Geometry, to_geo
|
||||
from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask
|
||||
from .utils import Geometry, to_geo, element
|
||||
from .registers import Register, Adc_register
|
||||
import datetime as dt
|
||||
|
||||
from functools import wraps
|
||||
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):
|
||||
cls.__frozen = False
|
||||
cls._frozen = False
|
||||
|
||||
def frozensetattr(self, key, value):
|
||||
if self.__frozen and not hasattr(self, key):
|
||||
if self._frozen and not hasattr(self, key):
|
||||
raise AttributeError(
|
||||
"Class {} is frozen. Cannot set {} = {}".format(
|
||||
cls.__name__, key, value
|
||||
@ -44,7 +30,7 @@ def freeze(cls):
|
||||
@wraps(func)
|
||||
def wrapper(self, *args, **kwargs):
|
||||
func(self, *args, **kwargs)
|
||||
self.__frozen = True
|
||||
self._frozen = True
|
||||
|
||||
return wrapper
|
||||
|
||||
@ -69,6 +55,9 @@ class Detector(CppDetectorApi):
|
||||
"""
|
||||
super().__init__(multi_id)
|
||||
self._register = Register(self)
|
||||
self._adc_register = Adc_register(self)
|
||||
|
||||
|
||||
|
||||
# CONFIGURATION
|
||||
def __len__(self):
|
||||
@ -197,6 +186,18 @@ class Detector(CppDetectorApi):
|
||||
else:
|
||||
self.setSubExptime(dt.timedelta(seconds=t))
|
||||
|
||||
@property
|
||||
def subdeadtime(self):
|
||||
res = self.getSubDeadTime()
|
||||
return element_if_equal([it.total_seconds() for it in res])
|
||||
|
||||
@subdeadtime.setter
|
||||
def subdeadtime(self, t):
|
||||
if isinstance(t, dt.timedelta):
|
||||
self.setSubDeadTime(t)
|
||||
else:
|
||||
self.setSubDeadTime(dt.timedelta(seconds=t))
|
||||
|
||||
|
||||
@property
|
||||
def period(self):
|
||||
@ -215,12 +216,8 @@ class Detector(CppDetectorApi):
|
||||
|
||||
|
||||
# Time
|
||||
|
||||
|
||||
|
||||
#TODO! Rename to rx_framescaught
|
||||
@property
|
||||
def framescaught(self):
|
||||
def rx_framescaught(self):
|
||||
return element_if_equal(self.getFramesCaught())
|
||||
|
||||
|
||||
@ -232,14 +229,7 @@ class Detector(CppDetectorApi):
|
||||
def startingfnum(self, value):
|
||||
self.setStartingFrameNumber(value)
|
||||
|
||||
#TODO! testing switches on automatically?
|
||||
@property
|
||||
def flowcontrol_10g(self):
|
||||
return element_if_equal(self.getTenGigaFlowControl())
|
||||
|
||||
@flowcontrol_10g.setter
|
||||
def flowcontrol_10g(self, enable):
|
||||
self.setTenGigaFlowControl(enable)
|
||||
|
||||
#TODO! add txdelay
|
||||
|
||||
@ -459,6 +449,22 @@ class Detector(CppDetectorApi):
|
||||
self.getDestinationUDPMAC2(mac)
|
||||
|
||||
|
||||
@property
|
||||
def udp_srcip(self):
|
||||
return element_if_equal(self.getSourceUDPIP())
|
||||
|
||||
@udp_srcip.setter
|
||||
def udp_srcip(self, ip):
|
||||
self.setSourceUDPIP(ip)
|
||||
|
||||
@property
|
||||
def udp_srcip2(self):
|
||||
return element_if_equal(self.getSourceUDPIP2())
|
||||
|
||||
@udp_srcip2.setter
|
||||
def udp_srcip2(self, ip):
|
||||
self.setSourceUDPIP2(ip)
|
||||
|
||||
@property
|
||||
def udp_dstport(self):
|
||||
return element_if_equal(self.getDestinationUDPPort())
|
||||
@ -582,6 +588,19 @@ class Detector(CppDetectorApi):
|
||||
def reg(self):
|
||||
return self._register
|
||||
|
||||
@property
|
||||
def adcreg(self):
|
||||
return self._adc_register
|
||||
|
||||
|
||||
@property
|
||||
def led(self):
|
||||
return element_if_equal(self.getLEDEnable())
|
||||
|
||||
@led.setter
|
||||
def led(self, value):
|
||||
self.setLEDEnable(value)
|
||||
|
||||
@property
|
||||
def ratecorr(self):
|
||||
""" tau in ns """
|
||||
@ -631,3 +650,439 @@ class Detector(CppDetectorApi):
|
||||
@property
|
||||
def vthreshold(self):
|
||||
return element_if_equal(self.getDAC(dacIndex.THRESHOLD))
|
||||
|
||||
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
return element_if_equal(self.getDetectorType())
|
||||
|
||||
@property
|
||||
def rx_frameindex(self):
|
||||
return element_if_equal(self.getRxCurrentFrameIndex())
|
||||
|
||||
@property
|
||||
def rx_missingpackets(self):
|
||||
return element_if_equal(self.getNumMissingPackets())
|
||||
|
||||
|
||||
"""
|
||||
Some Eiger stuff, does this have to be here or can we move it to subclass?
|
||||
"""
|
||||
@property
|
||||
def partialreset(self):
|
||||
return element_if_equal(self.getPartialReset())
|
||||
|
||||
@partialreset.setter
|
||||
def partialreset(self, value):
|
||||
self.setPartialReset(value)
|
||||
|
||||
@property
|
||||
def tengiga(self):
|
||||
return element_if_equal(self.getTenGiga())
|
||||
|
||||
@tengiga.setter
|
||||
def tengiga(self, value):
|
||||
self.setTenGiga(value)
|
||||
|
||||
@property
|
||||
def overflow(self):
|
||||
return element_if_equal(self.getOverFlowMode())
|
||||
|
||||
@overflow.setter
|
||||
def overflow(self, value):
|
||||
self.setOverFlowMode(value)
|
||||
|
||||
@property
|
||||
def flowcontrol10g(self):
|
||||
return element_if_equal(self.getTenGigaFlowControl())
|
||||
|
||||
@flowcontrol10g.setter
|
||||
def flowcontrol10g(self, enable):
|
||||
self.setTenGigaFlowControl(enable)
|
||||
|
||||
@property
|
||||
def interruptsubframe(self):
|
||||
return element_if_equal(self.getInterruptSubframe())
|
||||
|
||||
@interruptsubframe.setter
|
||||
def interruptsubframe(self, value):
|
||||
self.setInterruptSubframe(value)
|
||||
|
||||
@property
|
||||
def gappixels(self):
|
||||
return element_if_equal(self.getRxAddGapPixels())
|
||||
|
||||
@gappixels.setter
|
||||
def gappixels(self, value):
|
||||
self.setRxAddGapPixels(value)
|
||||
|
||||
@property
|
||||
def measuredperiod(self):
|
||||
res = self.getMeasuredPeriod()
|
||||
return element_if_equal([it.total_seconds() for it in res])
|
||||
|
||||
@property
|
||||
def measuredsubperiod(self):
|
||||
res = self.getMeasuredSubFramePeriod()
|
||||
return element_if_equal([it.total_seconds() for it in res])
|
||||
|
||||
|
||||
@property
|
||||
def storeinram(self):
|
||||
return element_if_equal(self.getStoreInRamMode())
|
||||
|
||||
@storeinram.setter
|
||||
def storeinram(self, value):
|
||||
self.setStoreInRamMode(value)
|
||||
|
||||
|
||||
"""
|
||||
Mythen3 specific
|
||||
"""
|
||||
|
||||
@property
|
||||
def counters(self):
|
||||
mask = self.getCounterMask()
|
||||
mask = element_if_equal(mask)
|
||||
if type(mask) == int:
|
||||
return get_set_bits(mask)
|
||||
else:
|
||||
return [get_set_bits(m) for m in mask]
|
||||
|
||||
|
||||
@counters.setter
|
||||
def counters(self, values):
|
||||
self.setCounterMask(list_to_bitmask(values))
|
||||
|
||||
"""
|
||||
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
|
||||
def asamples(self):
|
||||
return element_if_equal(self.getNumberOfAnalogSamples())
|
||||
|
||||
@asamples.setter
|
||||
def asamples(self, N):
|
||||
self.setNumberOfAnalogSamples(N)
|
||||
|
||||
@property
|
||||
def dsamples(self):
|
||||
return element_if_equal(self.getNumberOfDigitalSamples())
|
||||
|
||||
@dsamples.setter
|
||||
def dsamples(self, N):
|
||||
self.setNumberOfDigitalSamples(N)
|
||||
|
||||
@property
|
||||
def dbitphase(self):
|
||||
return element_if_equal(self.getDBITPhase())
|
||||
|
||||
@dbitphase.setter
|
||||
def dbitphase(self, value):
|
||||
self.setDBITPhase(value)
|
||||
|
||||
@property
|
||||
def dbitclk(self):
|
||||
return element_if_equal(self.getDBITClock())
|
||||
|
||||
@dbitclk.setter
|
||||
def dbitclk(self, value):
|
||||
self.setDBITClock(value)
|
||||
|
||||
@property
|
||||
def dbitpipeline(self):
|
||||
return element_if_equal(self.getDBITPipeline())
|
||||
|
||||
@dbitpipeline.setter
|
||||
def dbitpipeline(self, value):
|
||||
self.setDBITPipeline(value)
|
||||
|
||||
@property
|
||||
def maxdbitphaseshift(self):
|
||||
return element_if_equal(self.getMaxDBITPhaseShift())
|
||||
|
||||
@property
|
||||
def rx_dbitlist(self):
|
||||
return element_if_equal(self.getRxDbitList())
|
||||
|
||||
@rx_dbitlist.setter
|
||||
def rx_dbitlist(self, value):
|
||||
self.setRxDbitList(value)
|
||||
|
||||
@property
|
||||
def rx_dbitoffset(self):
|
||||
return element_if_equal(self.getRxDbitOffset())
|
||||
|
||||
@rx_dbitoffset.setter
|
||||
def rx_dbitoffset(self, value):
|
||||
self.setRxDbitOffset(value)
|
||||
|
||||
@property
|
||||
def maxadcphaseshift(self):
|
||||
return element_if_equal(self.getMaxADCPhaseShift())
|
||||
|
||||
@property
|
||||
def adcphase(self):
|
||||
return element_if_equal(self.getADCPhase())
|
||||
|
||||
@adcphase.setter
|
||||
def adcphase(self, value):
|
||||
self.setADCPhase(value)
|
||||
|
||||
@property
|
||||
def adcpipeline(self):
|
||||
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)
|
@ -14,21 +14,20 @@ class DetectorProperty:
|
||||
|
||||
def __getitem__(self, key):
|
||||
if key == slice(None, None, None):
|
||||
return [self.get(i) for i in range(self.get_nmod())]
|
||||
return self.get()
|
||||
elif isinstance(key, Iterable):
|
||||
return [self.get(k) for k in key]
|
||||
return self.get(list(key))
|
||||
else:
|
||||
return self.get(key)
|
||||
return self.get([key])[0] #No list for single value
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
#operate on all values
|
||||
if key == slice(None, None, None):
|
||||
if isinstance(value, (np.integer, int)):
|
||||
for i in range(self.get_nmod()):
|
||||
self.set(i, value)
|
||||
self.set(value, [])
|
||||
elif isinstance(value, Iterable):
|
||||
for i in range(self.get_nmod()):
|
||||
self.set(i, value[i])
|
||||
self.set(value[i], [i])
|
||||
else:
|
||||
raise ValueError('Value should be int or np.integer not', type(value))
|
||||
|
||||
@ -36,15 +35,14 @@ class DetectorProperty:
|
||||
elif isinstance(key, Iterable):
|
||||
if isinstance(value, Iterable):
|
||||
for k,v in zip(key, value):
|
||||
self.set(k,v)
|
||||
self.set(v, [k])
|
||||
|
||||
elif isinstance(value, int):
|
||||
for k in key:
|
||||
self.set(k, value)
|
||||
self.set(value, list(key))
|
||||
|
||||
#Set single value
|
||||
elif isinstance(key, int):
|
||||
self.set(key, value)
|
||||
self.set(value, [key])
|
||||
|
||||
def __repr__(self):
|
||||
s = ', '.join(str(v) for v in self[:])
|
476
python/slsdet/eiger.py
Executable file
476
python/slsdet/eiger.py
Executable file
@ -0,0 +1,476 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Wed Dec 6 11:51:18 2017
|
||||
|
||||
@author: l_frojdh
|
||||
"""
|
||||
|
||||
|
||||
from .detector import Detector
|
||||
|
||||
# from .adcs import Adc, DetectorAdcs
|
||||
from .dacs import DetectorDacs
|
||||
import _slsdet
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
from .detector_property import DetectorProperty
|
||||
# from .utils import element_if_equal
|
||||
# from sls_detector.errors import DetectorValueError, DetectorError
|
||||
|
||||
class EigerVcmp:
|
||||
"""
|
||||
Convenience class to be able to loop over vcmp for Eiger
|
||||
|
||||
|
||||
.. todo::
|
||||
|
||||
Support single assignment and perhaps unify with Dac class
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, detector):
|
||||
_dacs = [ dacIndex.VCMP_LL,
|
||||
dacIndex.VCMP_LR,
|
||||
dacIndex.VCMP_RL,
|
||||
dacIndex.VCMP_RR]
|
||||
self.set = []
|
||||
self.get = []
|
||||
for i in range(detector.size()):
|
||||
if i % 2 == 0:
|
||||
dacs = _dacs
|
||||
else:
|
||||
dacs = _dacs[::-1]
|
||||
for d in dacs:
|
||||
self.set.append(lambda x, d=d, i=i : detector.setDAC(d, x, False, [i]))
|
||||
self.get.append(lambda d=d, i=i : detector.getDAC(d, False, [i])[0])
|
||||
|
||||
def __getitem__(self, key):
|
||||
if key == slice(None, None, None):
|
||||
return [_d() for _d in self.get]
|
||||
return self.get[key]()
|
||||
|
||||
def __setitem__(self, i, value):
|
||||
self.set[i](value)
|
||||
|
||||
def __repr__(self):
|
||||
return 'vcmp: '+ str(self[:])
|
||||
|
||||
|
||||
class EigerDacs(DetectorDacs):
|
||||
"""
|
||||
Eiger specific dacs
|
||||
"""
|
||||
_dacs = [('vsvp', dacIndex.SVP,0, 4000, 0),
|
||||
('vtr', dacIndex.VTR,0, 4000, 2500),
|
||||
('vrf', dacIndex.VRF,0, 4000, 3300),
|
||||
('vrs', dacIndex.VRS,0, 4000, 1400),
|
||||
('vsvn', dacIndex.SVN,0, 4000, 4000),
|
||||
('vtgstv', dacIndex.VTGSTV,0, 4000, 2556),
|
||||
('vcmp_ll', dacIndex.VCMP_LL,0, 4000, 1500),
|
||||
('vcmp_lr', dacIndex.VCMP_LR,0, 4000, 1500),
|
||||
('vcall', dacIndex.CAL,0, 4000, 4000),
|
||||
('vcmp_rl', dacIndex.VCMP_RL,0, 4000, 1500),
|
||||
('rxb_rb', dacIndex.RXB_RB,0, 4000, 1100),
|
||||
('rxb_lb', dacIndex.RXB_LB,0, 4000, 1100),
|
||||
('vcmp_rr', dacIndex.VCMP_RR,0, 4000, 1500),
|
||||
('vcp', dacIndex.VCP,0, 4000, 200),
|
||||
('vcn', dacIndex.VCN,0, 4000, 2000),
|
||||
('vis', dacIndex.VIS,0, 4000, 1550),
|
||||
('iodelay', dacIndex.IO_DELAY,0, 4000, 660)]
|
||||
_dacnames = [_d[0] for _d in _dacs]
|
||||
|
||||
# # noinspection PyProtectedMember
|
||||
# class DetectorDelays:
|
||||
# _delaynames = ['frame', 'left', 'right']
|
||||
|
||||
# def __init__(self, detector):
|
||||
# # We need to at least initially know which detector we are connected to
|
||||
# self._detector = detector
|
||||
|
||||
# setattr(self, '_frame', DetectorProperty(detector._api.getDelayFrame,
|
||||
# detector._api.setDelayFrame,
|
||||
# detector._api.getNumberOfDetectors,
|
||||
# 'frame'))
|
||||
|
||||
# setattr(self, '_left', DetectorProperty(detector._api.getDelayLeft,
|
||||
# detector._api.setDelayLeft,
|
||||
# detector._api.getNumberOfDetectors,
|
||||
# 'left'))
|
||||
|
||||
# setattr(self, '_right', DetectorProperty(detector._api.getDelayRight,
|
||||
# detector._api.setDelayRight,
|
||||
# detector._api.getNumberOfDetectors,
|
||||
# 'right'))
|
||||
# # Index to support iteration
|
||||
# self._current = 0
|
||||
|
||||
# def __getattr__(self, name):
|
||||
# return self.__getattribute__('_' + name)
|
||||
|
||||
# def __setattr__(self, name, value):
|
||||
# if name in self._delaynames:
|
||||
# return self.__getattribute__('_' + name).__setitem__(slice(None, None, None), value)
|
||||
# else:
|
||||
# super().__setattr__(name, value)
|
||||
|
||||
# def __next__(self):
|
||||
# if self._current >= len(self._delaynames):
|
||||
# self._current = 0
|
||||
# raise StopIteration
|
||||
# else:
|
||||
# self._current += 1
|
||||
# return self.__getattr__(self._delaynames[self._current-1])
|
||||
|
||||
# def __iter__(self):
|
||||
# return self
|
||||
|
||||
# def __repr__(self):
|
||||
# hn = self._detector.hostname
|
||||
# r_str = ['Transmission delay [ns]\n'
|
||||
# '{:11s}{:>8s}{:>8s}{:>8s}'.format('', 'left', 'right', 'frame')]
|
||||
# for i in range(self._detector.n_modules):
|
||||
# r_str.append('{:2d}:{:8s}{:>8d}{:>8d}{:>8d}'.format(i, hn[i], self.left[i], self.right[i], self.frame[i]))
|
||||
# return '\n'.join(r_str)
|
||||
|
||||
from .detector import freeze
|
||||
|
||||
@freeze
|
||||
class Eiger(Detector):
|
||||
"""
|
||||
Subclassing Detector to set up correct dacs and detector specific
|
||||
functions.
|
||||
"""
|
||||
_detector_dynamic_range = [4, 8, 16, 32]
|
||||
|
||||
|
||||
_settings = ['standard', 'highgain', 'lowgain', 'veryhighgain', 'verylowgain']
|
||||
"""available settings for Eiger, note almost always standard"""
|
||||
|
||||
def __init__(self, id=0):
|
||||
super().__init__(id)
|
||||
self._frozen = False
|
||||
self._dacs = EigerDacs(self)
|
||||
self._vcmp = EigerVcmp(self)
|
||||
|
||||
# self._active = DetectorProperty(self.getActive,
|
||||
# self.setActive,
|
||||
# self.size,
|
||||
# 'active')
|
||||
|
||||
# self._trimbit_limits = namedtuple('trimbit_limits', ['min', 'max'])(0, 63)
|
||||
# self._delay = DetectorDelays(self)
|
||||
|
||||
# # Eiger specific adcs
|
||||
# self._temp = DetectorAdcs()
|
||||
# self._temp.fpga = Adc('temp_fpga', self)
|
||||
# self._temp.fpgaext = Adc('temp_fpgaext', self)
|
||||
# self._temp.t10ge = Adc('temp_10ge', self)
|
||||
# self._temp.dcdc = Adc('temp_dcdc', self)
|
||||
# self._temp.sodl = Adc('temp_sodl', self)
|
||||
# self._temp.sodr = Adc('temp_sodr', self)
|
||||
# self._temp.fpgafl = Adc('temp_fpgafl', self)
|
||||
# self._temp.fpgafr = Adc('temp_fpgafr', self)
|
||||
|
||||
# @property
|
||||
# def active(self):
|
||||
# """
|
||||
# Is the detector active? Can be used to enable or disable a detector
|
||||
# module
|
||||
|
||||
# Examples
|
||||
# ----------
|
||||
|
||||
# ::
|
||||
|
||||
# d.active
|
||||
# >> active: [True, True]
|
||||
|
||||
# d.active[1] = False
|
||||
# >> active: [True, False]
|
||||
# """
|
||||
# return self._active
|
||||
|
||||
# @active.setter
|
||||
# def active(self, value):
|
||||
# self._active[:] = value
|
||||
|
||||
# @property
|
||||
# def measured_period(self):
|
||||
# return self._api.getMeasuredPeriod()
|
||||
|
||||
# @property
|
||||
# def measured_subperiod(self):
|
||||
# return self._api.getMeasuredSubPeriod()
|
||||
|
||||
# @property
|
||||
# def add_gappixels(self):
|
||||
# """Enable or disable the (virual) pixels between ASICs
|
||||
|
||||
# Examples
|
||||
# ----------
|
||||
|
||||
# ::
|
||||
|
||||
# d.add_gappixels = True
|
||||
|
||||
# d.add_gappixels
|
||||
# >> True
|
||||
|
||||
# """
|
||||
# return self._api.getGapPixels()
|
||||
|
||||
# @add_gappixels.setter
|
||||
# def add_gappixels(self, value):
|
||||
# self._api.setGapPixels(value)
|
||||
|
||||
@property
|
||||
def dacs(self):
|
||||
"""
|
||||
|
||||
An instance of DetectorDacs used for accessing the dacs of a single
|
||||
or multi detector.
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
d = Eiger()
|
||||
|
||||
#Set all vrf to 1500
|
||||
d.dacs.vrf = 1500
|
||||
|
||||
#Check vrf
|
||||
d.dacs.vrf
|
||||
>> vrf : 1500, 1500
|
||||
|
||||
#Set a single vtr
|
||||
d.dacs.vtr[0] = 1800
|
||||
|
||||
#Set vrf with multiple values
|
||||
d.dacs.vrf = [3500,3700]
|
||||
d.dacs.vrf
|
||||
>> vrf : 3500, 3700
|
||||
|
||||
#read into a variable
|
||||
var = d.dacs.vrf[:]
|
||||
|
||||
#set multiple with multiple values, mostly used for large systems
|
||||
d.dacs.vcall[0,1] = [3500,3600]
|
||||
d.dacs.vcall
|
||||
>> vcall : 3500, 3600
|
||||
|
||||
d.dacs
|
||||
>>
|
||||
========== DACS =========
|
||||
vsvp : 0, 0
|
||||
vtr : 4000, 4000
|
||||
vrf : 1900, 1900
|
||||
vrs : 1400, 1400
|
||||
vsvn : 4000, 4000
|
||||
vtgstv : 2556, 2556
|
||||
vcmp_ll : 1500, 1500
|
||||
vcmp_lr : 1500, 1500
|
||||
vcall : 4000, 4000
|
||||
vcmp_rl : 1500, 1500
|
||||
rxb_rb : 1100, 1100
|
||||
rxb_lb : 1100, 1100
|
||||
vcmp_rr : 1500, 1500
|
||||
vcp : 1500, 1500
|
||||
vcn : 2000, 2000
|
||||
vis : 1550, 1550
|
||||
iodelay : 660, 660
|
||||
|
||||
"""
|
||||
return self._dacs
|
||||
|
||||
# @property
|
||||
# def tx_delay(self):
|
||||
# """
|
||||
# Transmission delay of the modules to allow running the detector
|
||||
# in a network not supporting the full speed of the detector.
|
||||
|
||||
|
||||
# ::
|
||||
|
||||
# d.tx_delay
|
||||
# >>
|
||||
# Transmission delay [ns]
|
||||
# left right frame
|
||||
# 0:beb048 0 15000 0
|
||||
# 1:beb049 100 190000 100
|
||||
|
||||
# d.tx_delay.left = [2000,5000]
|
||||
# """
|
||||
# return self._delay
|
||||
|
||||
# def pulse_all_pixels(self, n):
|
||||
# """
|
||||
# Pulse each pixel of the chip **n** times using the analog test pulses.
|
||||
# The pulse height is set using d.dacs.vcall with 4000 being 0 and 0 being
|
||||
# the highest pulse.
|
||||
|
||||
# ::
|
||||
|
||||
# #Pulse all pixels ten times
|
||||
# d.pulse_all_pixels(10)
|
||||
|
||||
# #Avoid resetting before acq
|
||||
# d.eiger_matrix_reset = False
|
||||
|
||||
# d.acq() #take frame
|
||||
|
||||
# #Restore normal behaviour
|
||||
# d.eiger_matrix_reset = True
|
||||
|
||||
|
||||
# """
|
||||
# self._api.pulseAllPixels(n)
|
||||
|
||||
|
||||
# def pulse_diagonal(self, n):
|
||||
# """
|
||||
# Pulse pixels in super colums in a diagonal fashion. Used for calibration
|
||||
# of vcall. Saves time compared to pulsing all pixels.
|
||||
# """
|
||||
# self._api.pulseDiagonal(n)
|
||||
|
||||
|
||||
# def pulse_chip(self, n):
|
||||
# """
|
||||
# Advance the counter by toggling enable. Gives 2*n+2 int the counter
|
||||
|
||||
# """
|
||||
# n = int(n)
|
||||
# if n >= -1:
|
||||
# self._api.pulseChip(n)
|
||||
# else:
|
||||
# raise ValueError('n must be equal or larger than -1')
|
||||
|
||||
@property
|
||||
def vcmp(self):
|
||||
"""
|
||||
Convenience function to get and set the individual vcmp of chips
|
||||
Used mainly in the calibration code.
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
#Reading
|
||||
d.vcmp[:]
|
||||
>> [500, 500, 500, 500, 500, 500, 500, 500]
|
||||
|
||||
#Setting
|
||||
d.vcmp = [500, 500, 500, 500, 500, 500, 500, 500]
|
||||
|
||||
|
||||
"""
|
||||
|
||||
return self._vcmp
|
||||
|
||||
@vcmp.setter
|
||||
def vcmp(self, values):
|
||||
if len(values) == len(self._vcmp.set):
|
||||
for i, v in enumerate(values):
|
||||
self._vcmp.set[i](v)
|
||||
else:
|
||||
raise ValueError('vcmp only compatible with setting all')
|
||||
|
||||
# @property
|
||||
# def rx_udpport(self):
|
||||
# """
|
||||
# UDP port for the receiver. Each module has two ports referred to
|
||||
# as rx_udpport and rx_udpport2 in the command line interface
|
||||
# here they are grouped for each detector
|
||||
|
||||
# ::
|
||||
|
||||
# [0:rx_udpport, 0:rx_udpport2, 1:rx_udpport ...]
|
||||
|
||||
# Examples
|
||||
# -----------
|
||||
|
||||
# ::
|
||||
|
||||
# d.rx_udpport
|
||||
# >> [50010, 50011, 50004, 50005]
|
||||
|
||||
# d.rx_udpport = [50010, 50011, 50012, 50013]
|
||||
|
||||
# """
|
||||
# p0 = self._api.getReceiverUDPPort()
|
||||
# p1 = self._api.getReceiverUDPPort2()
|
||||
# return [int(val) for pair in zip(p0, p1) for val in pair]
|
||||
|
||||
# @rx_udpport.setter
|
||||
# def rx_udpport(self, ports):
|
||||
# """Requires iterating over elements two and two for setting ports"""
|
||||
# a = iter(ports)
|
||||
# for i, p in enumerate(zip(a, a)):
|
||||
# self._api.setReceiverUDPPort(p[0], i)
|
||||
# self._api.setReceiverUDPPort2(p[1], i)
|
||||
|
||||
@property
|
||||
def rx_zmqport(self):
|
||||
"""
|
||||
Return the receiver zmq ports. Note that Eiger has two ports per receiver!
|
||||
This functions therefore differ from the base class.
|
||||
|
||||
::
|
||||
|
||||
e.rx_zmqport
|
||||
>> [30001, 30002, 30003, 30004]
|
||||
|
||||
|
||||
"""
|
||||
ports = self.getRxZmqPort()
|
||||
return [p + i for p in ports for i in range(2)]
|
||||
|
||||
|
||||
# @rx_zmqport.setter
|
||||
# def rx_zmqport(self, port):
|
||||
# if isinstance(port, Iterable):
|
||||
# for i, p in enumerate(port):
|
||||
# self._api.setReceiverStreamingPort(p, i)
|
||||
# else:
|
||||
# self._api.setReceiverStreamingPort(port, -1)
|
||||
|
||||
# @property
|
||||
# def temp(self):
|
||||
# """
|
||||
# An instance of DetectorAdcs used to read the temperature
|
||||
# of different components
|
||||
|
||||
# Examples
|
||||
# -----------
|
||||
|
||||
# ::
|
||||
|
||||
# detector.temp
|
||||
# >>
|
||||
# temp_fpga : 36.90°C, 45.60°C
|
||||
# temp_fpgaext : 31.50°C, 32.50°C
|
||||
# temp_10ge : 0.00°C, 0.00°C
|
||||
# temp_dcdc : 36.00°C, 36.00°C
|
||||
# temp_sodl : 33.00°C, 34.50°C
|
||||
# temp_sodr : 33.50°C, 34.00°C
|
||||
# temp_fpgafl : 33.81°C, 30.93°C
|
||||
# temp_fpgafr : 27.88°C, 29.15°C
|
||||
|
||||
# a = detector.temp.fpga[:]
|
||||
# a
|
||||
# >> [36.568, 45.542]
|
||||
|
||||
|
||||
# """
|
||||
# return self._temp
|
||||
|
||||
|
||||
|
||||
# def set_delays(self, delta):
|
||||
# self.tx_delay.left = [delta*(i*2) for i in range(self.n_modules)]
|
||||
# self.tx_delay.right = [delta*(i*2+1) for i in range(self.n_modules)]
|
||||
|
||||
|
54
python/slsdet/jungfrau.py
Normal file
54
python/slsdet/jungfrau.py
Normal file
@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
This file contains the specialization for the Jungfrau detector
|
||||
"""
|
||||
|
||||
|
||||
from .detector import Detector, freeze
|
||||
|
||||
# from .adcs import Adc, DetectorAdcs
|
||||
from .dacs import DetectorDacs
|
||||
import _slsdet
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
from .detector_property import DetectorProperty
|
||||
|
||||
# @freeze
|
||||
class JungfrauDacs(DetectorDacs):
|
||||
"""
|
||||
Jungfrau specific DACs
|
||||
"""
|
||||
_dacs = [('vb_comp', dacIndex.VB_COMP, 0, 4000, 1220),
|
||||
('vdd_prot', dacIndex.VDD_PROT, 0, 4000, 3000),
|
||||
('vin_com', dacIndex.VIN_COM, 0, 4000, 1053),
|
||||
('vref_prech', dacIndex.VREF_PRECH, 0, 4000, 1450),
|
||||
('vb_pixbuff', dacIndex.VB_PIXBUF, 0, 4000, 750),
|
||||
('vb_ds', dacIndex.VB_DS, 0, 4000, 1000),
|
||||
('vref_ds', dacIndex.VREF_DS, 0, 4000, 480),
|
||||
('vref_comp', dacIndex.VREF_COMP, 0, 4000, 420),
|
||||
]
|
||||
_dacnames = [_d[0] for _d in _dacs]
|
||||
|
||||
|
||||
|
||||
|
||||
@freeze
|
||||
class Jungfrau(Detector):
|
||||
"""
|
||||
Subclassing Detector to set up correct dacs and detector specific
|
||||
functions.
|
||||
"""
|
||||
_detector_dynamic_range = [4, 8, 16, 32]
|
||||
|
||||
|
||||
_settings = ['standard', 'highgain', 'lowgain', 'veryhighgain', 'verylowgain']
|
||||
"""available settings for Eiger, note almost always standard"""
|
||||
|
||||
def __init__(self, id=0):
|
||||
super().__init__(id)
|
||||
self._frozen = False
|
||||
self._dacs = JungfrauDacs(self)
|
||||
|
||||
@property
|
||||
def dacs(self):
|
||||
return self._dacs
|
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]
|
80
python/slsdet/mythen3.py
Normal file
80
python/slsdet/mythen3.py
Normal file
@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
This file contains the specialization for the Jungfrau detector
|
||||
"""
|
||||
|
||||
|
||||
from .detector import Detector, freeze
|
||||
|
||||
# from .adcs import Adc, DetectorAdcs
|
||||
from .dacs import DetectorDacs
|
||||
import _slsdet
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
from .detector_property import DetectorProperty
|
||||
|
||||
# vcassh 1200,
|
||||
# vth2 2800,
|
||||
# vshaper 1280,
|
||||
# vshaperneg 2800,
|
||||
# vipre_out 1220,
|
||||
# vth3 2800,
|
||||
# vth1 2800,
|
||||
# vicin 1708,
|
||||
# vcas 1800,
|
||||
# vpreamp 1100,
|
||||
# vpl 1100,
|
||||
# vipre 2624,
|
||||
# viinsh 1708,
|
||||
# vph 1712,
|
||||
# vtrim 2800,
|
||||
# vdcsh 800
|
||||
|
||||
|
||||
# @freeze
|
||||
class Mythen3Dacs(DetectorDacs):
|
||||
"""
|
||||
Jungfrau specific DACs
|
||||
"""
|
||||
_dacs = [('vcassh', dacIndex.CASSH, 0, 4000, 1220),
|
||||
('vth2', dacIndex.VTH2, 0, 4000, 2800),
|
||||
('vshaper', dacIndex.SHAPER1, 0, 4000, 1280),
|
||||
('vshaperneg', dacIndex.SHAPER2, 0, 4000, 2800),
|
||||
('vipre_out', dacIndex.VIPRE_OUT, 0, 4000, 1220),
|
||||
('vth3', dacIndex.VTH3, 0, 4000, 2800),
|
||||
('vth1', dacIndex.THRESHOLD, 0, 4000, 2800),
|
||||
('vicin', dacIndex.VICIN, 0, 4000, 1708),
|
||||
('vcas', dacIndex.CAS, 0, 4000, 1800),
|
||||
('vpreamp', dacIndex.PREAMP, 0, 4000, 1100),
|
||||
('vpl', dacIndex.VPL, 0, 4000, 1100),
|
||||
('vipre', dacIndex.VIPRE, 0, 4000, 2624),
|
||||
('viinsh', dacIndex.VIINSH, 0, 4000, 1708),
|
||||
('vph', dacIndex.CALIBRATION_PULSE, 0, 4000, 1712),
|
||||
('vtrim', dacIndex.TRIMBIT_SIZE, 0, 4000, 2800),
|
||||
('vdcsh', dacIndex.VDCSH, 0, 4000, 800),
|
||||
]
|
||||
_dacnames = [_d[0] for _d in _dacs]
|
||||
|
||||
|
||||
|
||||
|
||||
@freeze
|
||||
class Mythen3(Detector):
|
||||
"""
|
||||
Subclassing Detector to set up correct dacs and detector specific
|
||||
functions.
|
||||
"""
|
||||
_detector_dynamic_range = [4, 8, 16, 32]
|
||||
|
||||
|
||||
_settings = ['standard', 'highgain', 'lowgain', 'veryhighgain', 'verylowgain']
|
||||
"""available settings for Eiger, note almost always standard"""
|
||||
|
||||
def __init__(self, id=0):
|
||||
super().__init__(id)
|
||||
self._frozen = False
|
||||
self._dacs = Mythen3Dacs(self)
|
||||
|
||||
@property
|
||||
def dacs(self):
|
||||
return self._dacs
|
@ -3,14 +3,17 @@ class Register:
|
||||
self._detector = detector
|
||||
|
||||
def __getitem__(self, key):
|
||||
return self._detector._api.readRegister(key)
|
||||
return self._detector.readRegister(key)
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
self._detector._api.writeRegister(key, value)
|
||||
self._detector.writeRegister(key, value)
|
||||
|
||||
class Adc_register:
|
||||
def __init__(self, detector):
|
||||
self._detector = detector
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
self._detector._api.writeAdcRegister(key, value)
|
||||
self._detector.writeAdcRegister(key, value)
|
||||
|
||||
def __getitem__(self, key):
|
||||
raise ValueError('Adc registers cannot be read back')
|
@ -2,13 +2,34 @@
|
||||
Utility functions that are useful for testing and troubleshooting
|
||||
but not directly used in controlling the detector
|
||||
"""
|
||||
|
||||
|
||||
from collections import namedtuple
|
||||
import _sls_detector #C++ lib
|
||||
import _slsdet #C++ lib
|
||||
import functools
|
||||
|
||||
|
||||
Geometry = namedtuple('Geometry', ['x', 'y'])
|
||||
|
||||
def get_set_bits(mask):
|
||||
"""
|
||||
Return a list of the set bits in a python integer
|
||||
"""
|
||||
return [i for i in range(mask.bit_length()) if (mask>>i)&1]
|
||||
|
||||
def list_to_bitmask(values):
|
||||
"""
|
||||
Convert a list of integers to a bitmask with set bits
|
||||
where the list indicates
|
||||
"""
|
||||
mask = int(0)
|
||||
values = list(set(values)) #Remove duplicates
|
||||
for v in values:
|
||||
mask += 1 << v
|
||||
return mask
|
||||
|
||||
def to_geo(value):
|
||||
if isinstance(value, _sls_detector.xy):
|
||||
if isinstance(value, _slsdet.xy):
|
||||
return Geometry(x = value.x, y = value.y)
|
||||
else:
|
||||
raise ValueError("Can only convert sls_detector.xy")
|
||||
@ -28,6 +49,14 @@ def element_if_equal(mylist):
|
||||
else:
|
||||
return mylist
|
||||
|
||||
def element(func):
|
||||
"""
|
||||
Wrapper to return either list or element
|
||||
"""
|
||||
@functools.wraps(func)
|
||||
def wrapper(self, *args, **kwargs):
|
||||
return element_if_equal(func(self, *args, **kwargs))
|
||||
return wrapper
|
||||
|
||||
def eiger_register_to_time(register):
|
||||
"""
|
||||
@ -39,3 +68,4 @@ def eiger_register_to_time(register):
|
||||
clocks = register >> 3
|
||||
exponent = register & 0b111
|
||||
return clocks*10**exponent / 100e6
|
||||
|
@ -2,7 +2,7 @@ C++ API
|
||||
=====================================================
|
||||
|
||||
|
||||
.. py:currentmodule:: _sls_detector
|
||||
.. py:currentmodule:: _slsdet
|
||||
|
||||
.. autoclass:: DetectorApi
|
||||
:members:
|
||||
|
@ -2,7 +2,7 @@ sls_detector - Python interface for the slsDetectorsPackage
|
||||
==============================================================
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
/* WARINING This file is auto generated any edits might be overwritten without
|
||||
* warning */
|
||||
|
||||
#include <pybind11/chrono.h>
|
||||
#include <pybind11/operators.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
@ -9,55 +12,60 @@
|
||||
#include "sls_detector_defs.h"
|
||||
#include "typecaster.h"
|
||||
namespace py = pybind11;
|
||||
void init_experimental(py::module &m) {
|
||||
void init_det(py::module &m) {
|
||||
using sls::Detector;
|
||||
using sls::Positions;
|
||||
using defs = slsDetectorDefs;
|
||||
|
||||
py::class_<Detector> CppDetectorApi(m, "CppDetectorApi");
|
||||
CppDetectorApi
|
||||
.def(py::init<int>())
|
||||
|
||||
// Configuration
|
||||
.def("freeSharedMemory", (void (Detector::*)()) &Detector::freeSharedMemory)
|
||||
.def("loadConfig", &Detector::loadConfig)
|
||||
.def("loadParameters", &Detector::loadParameters)
|
||||
.def("setHostname", &Detector::setHostname)
|
||||
.def("freeSharedMemory", &Detector::freeSharedMemory)
|
||||
.def("loadConfig", &Detector::loadConfig, py::arg())
|
||||
.def("loadParameters", &Detector::loadParameters, py::arg())
|
||||
.def("getHostname", &Detector::getHostname, py::arg() = Positions{})
|
||||
.def("setHostname", &Detector::setHostname, py::arg())
|
||||
.def("setVirtualDetectorServers", &Detector::setVirtualDetectorServers,
|
||||
py::arg(), py::arg())
|
||||
.def("getShmId", &Detector::getShmId)
|
||||
.def("getPackageVersion", &Detector::getPackageVersion)
|
||||
.def("getClientVersion", &Detector::getClientVersion)
|
||||
.def("getFirmwareVersion", &Detector::getFirmwareVersion,
|
||||
py::arg() = Positions{})
|
||||
.def("getDetectorServerVersion", &Detector::getDetectorServerVersion,
|
||||
py::arg() = Positions{})
|
||||
.def("getSerialNumber", &Detector::getSerialNumber,
|
||||
py::arg() = Positions{})
|
||||
.def("getClientVersion", &Detector::getClientVersion)
|
||||
.def("getReceiverVersion", &Detector::getReceiverVersion,
|
||||
py::arg() = Positions{})
|
||||
.def("getDetectorType", &Detector::getDetectorType,
|
||||
py::arg() = Positions{})
|
||||
.def("size", &Detector::size)
|
||||
.def("empty", &Detector::empty)
|
||||
.def("getModuleGeometry", &Detector::getModuleGeometry)
|
||||
.def("getModuleSize", &Detector::getModuleSize, py::arg() = Positions{})
|
||||
.def("getDetectorSize", &Detector::getDetectorSize)
|
||||
.def("setDetectorSize", &Detector::setDetectorSize)
|
||||
.def("setDetectorSize", &Detector::setDetectorSize, py::arg())
|
||||
.def("getSettings", &Detector::getSettings, py::arg() = Positions{})
|
||||
.def("setSettings", &Detector::setSettings, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
// TODO! Python funcs for callbacks?
|
||||
|
||||
// Acquisition Parameters
|
||||
.def("getNumberOfFrames", &Detector::getNumberOfFrames)
|
||||
.def("setNumberOfFrames", &Detector::setNumberOfFrames)
|
||||
.def("getNumberOfTriggers", &Detector::getNumberOfTriggers)
|
||||
.def("setNumberOfTriggers", &Detector::setNumberOfTriggers)
|
||||
.def("registerAcquisitionFinishedCallback",
|
||||
&Detector::registerAcquisitionFinishedCallback, py::arg(),
|
||||
py::arg())
|
||||
.def("registerDataCallback", &Detector::registerDataCallback, py::arg(),
|
||||
py::arg())
|
||||
.def("getNumberOfFrames", &Detector::getNumberOfFrames,
|
||||
py::arg() = Positions{})
|
||||
.def("setNumberOfFrames", &Detector::setNumberOfFrames, py::arg())
|
||||
.def("getNumberOfTriggers", &Detector::getNumberOfTriggers,
|
||||
py::arg() = Positions{})
|
||||
.def("setNumberOfTriggers", &Detector::setNumberOfTriggers, py::arg())
|
||||
.def("getExptime", &Detector::getExptime, py::arg() = Positions{})
|
||||
.def("setExptime", &Detector::setExptime, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getExptime", &Detector::getExptime, py::arg() = Positions{})
|
||||
.def("getPeriod", &Detector::getPeriod, py::arg() = Positions{})
|
||||
.def("setPeriod", &Detector::setPeriod, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getPeriod", &Detector::getPeriod, py::arg() = Positions{})
|
||||
.def("getDelayAfterTrigger", &Detector::getDelayAfterTrigger,
|
||||
py::arg() = Positions{})
|
||||
.def("setDelayAfterTrigger", &Detector::setDelayAfterTrigger, py::arg(),
|
||||
@ -66,198 +74,129 @@ void init_experimental(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("getNumberOfTriggersLeft", &Detector::getNumberOfTriggersLeft,
|
||||
py::arg() = Positions{})
|
||||
.def("getPeriodLeft", &Detector::getPeriodLeft, py::arg() = Positions{})
|
||||
.def("getDelayAfterTriggerLeft", &Detector::getDelayAfterTriggerLeft,
|
||||
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("setSpeed", &Detector::setSpeed, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getADCPhase", &Detector::getADCPhase, py::arg() = Positions{})
|
||||
|
||||
.def("setADCPhase", &Detector::setADCPhase, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getMaxADCPhaseShift", &Detector::getMaxADCPhaseShift,
|
||||
py::arg() = Positions{})
|
||||
.def("getADCPhaseInDegrees", &Detector::getADCPhaseInDegrees,
|
||||
py::arg() = Positions{})
|
||||
.def("setADCPhaseInDegrees", &Detector::setADCPhaseInDegrees, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getClockFrequency", &Detector::getClockFrequency, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setClockFrequency", &Detector::setClockFrequency, py::arg(),
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getClockPhase", &Detector::getClockPhase, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setClockPhase", &Detector::setClockPhase, py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getMaxClockPhaseShift", &Detector::getMaxClockPhaseShift,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getClockPhaseinDegrees", &Detector::getClockPhaseinDegrees,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("setClockPhaseinDegrees", &Detector::setClockPhaseinDegrees,
|
||||
py::arg(), py::arg(), py::arg() = Positions{})
|
||||
.def("getClockDivider", &Detector::getClockDivider, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setClockDivider", &Detector::setClockDivider, py::arg(),
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getHighVoltage", &Detector::getHighVoltage,
|
||||
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(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getTemperature", &Detector::getTemperature, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getDAC", &Detector::getDAC, py::arg(), py::arg() = false,
|
||||
.def("getDAC", &Detector::getDAC, py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setDAC", &Detector::setDAC, py::arg(), py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getTimingMode", &Detector::getTimingMode, py::arg() = Positions{})
|
||||
|
||||
.def("setTimingMode", &Detector::setTimingMode, py::arg(),
|
||||
.def("getOnChipDAC", &Detector::getOnChipDAC, py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
// ACQUISITION
|
||||
.def("setOnChipDAC", &Detector::setOnChipDAC, py::arg(), py::arg(),
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("acquire", &Detector::acquire)
|
||||
.def("startDetector", &Detector::startDetector)
|
||||
.def("stopDetector", &Detector::stopDetector)
|
||||
.def("clearAcquiringFlag", &Detector::clearAcquiringFlag)
|
||||
.def("startReceiver", &Detector::startReceiver)
|
||||
.def("stopReceiver", &Detector::stopReceiver)
|
||||
.def("clearAcquiringFlag", &Detector::clearAcquiringFlag)
|
||||
.def("startDetector", &Detector::startDetector)
|
||||
.def("stopDetector", &Detector::stopDetector)
|
||||
.def("getDetectorStatus", &Detector::getDetectorStatus,
|
||||
py::arg() = Positions{})
|
||||
.def("getReceiverStatus", &Detector::getReceiverStatus,
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getFramesCaught", &Detector::getFramesCaught,
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getNumMissingPackets", &Detector::getNumMissingPackets,
|
||||
py::arg() = Positions{})
|
||||
.def("getStartingFrameNumber", &Detector::getStartingFrameNumber,
|
||||
py::arg() = Positions{})
|
||||
.def("setStartingFrameNumber", &Detector::setStartingFrameNumber,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
.def("sendSoftwareTrigger", &Detector::sendSoftwareTrigger,
|
||||
py::arg() = Positions{})
|
||||
|
||||
// Network Configuration (Detector<->Receiver)
|
||||
.def("getNumberofUDPInterfaces", &Detector::getNumberofUDPInterfaces,
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("setNumberofUDPInterfaces", &Detector::setNumberofUDPInterfaces,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getSelectedUDPInterface", &Detector::getSelectedUDPInterface,
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("selectUDPInterface", &Detector::selectUDPInterface, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
// Using lambda to allow for conversion from IpAddr
|
||||
.def("getSourceUDPIP",
|
||||
[](const Detector &d, Positions pos) {
|
||||
std::vector<std::string> res;
|
||||
for (const auto &s : d.getSourceUDPIP(pos))
|
||||
res.push_back(s.str());
|
||||
return res;
|
||||
},
|
||||
.def("getSourceUDPIP", &Detector::getSourceUDPIP,
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("setSourceUDPIP",
|
||||
[](Detector &d, std::string ip, Positions pos) {
|
||||
d.setSourceUDPIP(sls::IpAddr(ip), pos);
|
||||
},
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getSourceUDPIP2",
|
||||
[](const Detector &d, Positions pos) {
|
||||
std::vector<std::string> res;
|
||||
for (const auto &s : d.getSourceUDPIP2(pos))
|
||||
res.push_back(s.str());
|
||||
return res;
|
||||
},
|
||||
.def("setSourceUDPIP", &Detector::setSourceUDPIP, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setSourceUDPIP2",
|
||||
[](Detector &d, std::string ip, Positions pos) {
|
||||
d.setSourceUDPIP2(sls::IpAddr(ip), pos);
|
||||
},
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getSourceUDPMAC",
|
||||
[](const Detector &d, Positions pos) {
|
||||
std::vector<std::string> res;
|
||||
for (const auto &s : d.getSourceUDPMAC(pos))
|
||||
res.push_back(s.str());
|
||||
return res;
|
||||
},
|
||||
.def("getSourceUDPIP2", &Detector::getSourceUDPIP2,
|
||||
py::arg() = Positions{})
|
||||
.def("setSourceUDPMAC",
|
||||
[](Detector &d, std::string mac, Positions pos) {
|
||||
d.setSourceUDPMAC(sls::MacAddr(mac), pos);
|
||||
},
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
.def("getSourceUDPMAC2",
|
||||
[](const Detector &d, Positions pos) {
|
||||
std::vector<std::string> res;
|
||||
for (const auto &s : d.getSourceUDPMAC2(pos))
|
||||
res.push_back(s.str());
|
||||
return res;
|
||||
},
|
||||
.def("setSourceUDPIP2", &Detector::setSourceUDPIP2, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setSourceUDPMAC2",
|
||||
[](Detector &d, std::string mac, Positions pos) {
|
||||
d.setSourceUDPMAC2(sls::MacAddr(mac), pos);
|
||||
},
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
.def("getDestinationUDPIP",
|
||||
[](const Detector &d, Positions pos) {
|
||||
std::vector<std::string> res;
|
||||
for (const auto &s : d.getDestinationUDPIP(pos))
|
||||
res.push_back(s.str());
|
||||
return res;
|
||||
},
|
||||
.def("getSourceUDPMAC", &Detector::getSourceUDPMAC,
|
||||
py::arg() = Positions{})
|
||||
.def("setDestinationUDPIP",
|
||||
[](Detector &d, std::string ip, Positions pos) {
|
||||
d.setDestinationUDPIP(sls::IpAddr(ip), pos);
|
||||
},
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
.def("getDestinationUDPIP2",
|
||||
[](const Detector &d, Positions pos) {
|
||||
std::vector<std::string> res;
|
||||
for (const auto &s : d.getDestinationUDPIP2(pos))
|
||||
res.push_back(s.str());
|
||||
return res;
|
||||
},
|
||||
.def("setSourceUDPMAC", &Detector::setSourceUDPMAC, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setDestinationUDPIP2",
|
||||
[](Detector &d, std::string ip, Positions pos) {
|
||||
d.setDestinationUDPIP2(sls::IpAddr(ip), pos);
|
||||
},
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
.def("getDestinationUDPMAC",
|
||||
[](const Detector &d, Positions pos) {
|
||||
std::vector<std::string> res;
|
||||
for (const auto &s : d.getDestinationUDPMAC(pos))
|
||||
res.push_back(s.str());
|
||||
return res;
|
||||
},
|
||||
.def("getSourceUDPMAC2", &Detector::getSourceUDPMAC2,
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("setDestinationUDPMAC",
|
||||
[](Detector &d, std::string mac, Positions pos) {
|
||||
d.setDestinationUDPMAC(sls::MacAddr(mac), pos);
|
||||
},
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
.def("getDestinationUDPMAC2",
|
||||
[](const Detector &d, Positions pos) {
|
||||
std::vector<std::string> res;
|
||||
for (const auto &s : d.getDestinationUDPMAC2(pos))
|
||||
res.push_back(s.str());
|
||||
return res;
|
||||
},
|
||||
.def("setSourceUDPMAC2", &Detector::setSourceUDPMAC2, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("setDestinationUDPMAC2",
|
||||
[](Detector &d, std::string mac, Positions pos) {
|
||||
d.setDestinationUDPMAC2(sls::MacAddr(mac), pos);
|
||||
},
|
||||
.def("getDestinationUDPIP", &Detector::getDestinationUDPIP,
|
||||
py::arg() = Positions{})
|
||||
.def("setDestinationUDPIP", &Detector::setDestinationUDPIP, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getDestinationUDPIP2", &Detector::getDestinationUDPIP2,
|
||||
py::arg() = Positions{})
|
||||
.def("setDestinationUDPIP2", &Detector::setDestinationUDPIP2, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getDestinationUDPMAC", &Detector::getDestinationUDPMAC,
|
||||
py::arg() = Positions{})
|
||||
.def("setDestinationUDPMAC", &Detector::setDestinationUDPMAC, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getDestinationUDPMAC2", &Detector::getDestinationUDPMAC2,
|
||||
py::arg() = Positions{})
|
||||
.def("setDestinationUDPMAC2", &Detector::setDestinationUDPMAC2,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
.def("getDestinationUDPPort", &Detector::getDestinationUDPPort,
|
||||
py::arg() = Positions{})
|
||||
.def("setDestinationUDPPort", &Detector::setDestinationUDPPort,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
py::arg(), py::arg())
|
||||
.def("getDestinationUDPPort2", &Detector::getDestinationUDPPort2,
|
||||
py::arg() = Positions{})
|
||||
.def("setDestinationUDPPort2", &Detector::setDestinationUDPPort2,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
py::arg(), py::arg())
|
||||
.def("printRxConfiguration", &Detector::printRxConfiguration,
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getTenGiga", &Detector::getTenGiga, py::arg() = Positions{})
|
||||
.def("setTenGiga", &Detector::setTenGiga, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
@ -269,7 +208,6 @@ void init_experimental(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("setTransmissionDelayFrame", &Detector::setTransmissionDelayFrame,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
.def("getTransmissionDelayLeft", &Detector::getTransmissionDelayLeft,
|
||||
py::arg() = Positions{})
|
||||
.def("setTransmissionDelayLeft", &Detector::setTransmissionDelayLeft,
|
||||
@ -278,21 +216,13 @@ void init_experimental(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("setTransmissionDelayRight", &Detector::setTransmissionDelayRight,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* RECEIVER CONFIG *
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
.def("getUseReceiverFlag", &Detector::getUseReceiverFlag,
|
||||
py::arg() = Positions{})
|
||||
.def("getRxHostname", &Detector::getRxHostname, py::arg() = Positions{})
|
||||
.def("setRxHostname", &Detector::setRxHostname, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRxPort", &Detector::getRxPort, py::arg() = Positions{})
|
||||
.def("setRxPort", &Detector::setRxPort, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setRxPort", &Detector::setRxPort, py::arg(), py::arg())
|
||||
.def("getRxFifoDepth", &Detector::getRxFifoDepth,
|
||||
py::arg() = Positions{})
|
||||
.def("setRxFifoDepth", &Detector::setRxFifoDepth, py::arg(),
|
||||
@ -320,12 +250,6 @@ void init_experimental(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("getRxLastClientIP", &Detector::getRxLastClientIP,
|
||||
py::arg() = Positions{})
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* FILE *
|
||||
* *
|
||||
* ************************************************/
|
||||
.def("getFileFormat", &Detector::getFileFormat, py::arg() = Positions{})
|
||||
.def("setFileFormat", &Detector::setFileFormat, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
@ -336,36 +260,25 @@ void init_experimental(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("setFileNamePrefix", &Detector::setFileNamePrefix, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getFilePath", &Detector::getFilePath)
|
||||
.def("setFilePath", &Detector::setFilePath, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getAcquisitionIndex", &Detector::getAcquisitionIndex,
|
||||
py::arg() = Positions{})
|
||||
.def("setAcquisitionIndex", &Detector::setAcquisitionIndex, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setFileWrite", &Detector::setFileWrite, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getFileWrite", &Detector::getFileWrite, py::arg() = Positions{})
|
||||
.def("setFileOverWrite", &Detector::setFileOverWrite, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getFileOverWrite", &Detector::getFileOverWrite,
|
||||
py::arg() = Positions{})
|
||||
.def("setMasterFileWrite", &Detector::setMasterFileWrite, py::arg(),
|
||||
.def("setFileWrite", &Detector::setFileWrite, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getMasterFileWrite", &Detector::getMasterFileWrite,
|
||||
py::arg() = Positions{})
|
||||
.def("setFramesPerFile", &Detector::setFramesPerFile, py::arg(),
|
||||
.def("setMasterFileWrite", &Detector::setMasterFileWrite, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getFileOverWrite", &Detector::getFileOverWrite,
|
||||
py::arg() = Positions{})
|
||||
.def("setFileOverWrite", &Detector::setFileOverWrite, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getFramesPerFile", &Detector::getFramesPerFile,
|
||||
py::arg() = Positions{})
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* ZMQ Streaming Parameters (Receiver<->Client)*
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
.def("setFramesPerFile", &Detector::setFramesPerFile, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRxZmqDataStream", &Detector::getRxZmqDataStream,
|
||||
py::arg() = Positions{})
|
||||
.def("setRxZmqDataStream", &Detector::setRxZmqDataStream, py::arg(),
|
||||
@ -378,29 +291,21 @@ void init_experimental(py::module &m) {
|
||||
.def("setRxZmqTimer", &Detector::setRxZmqTimer, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRxZmqPort", &Detector::getRxZmqPort, py::arg() = Positions{})
|
||||
.def("setRxZmqPort", &Detector::setRxZmqPort, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setRxZmqPort", &Detector::setRxZmqPort, py::arg(), py::arg())
|
||||
.def("getRxZmqIP", &Detector::getRxZmqIP, py::arg() = Positions{})
|
||||
.def("setRxZmqIP", &Detector::setRxZmqIP, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getClientZmqPort", &Detector::getClientZmqPort,
|
||||
py::arg() = Positions{})
|
||||
.def("setClientZmqPort", &Detector::setClientZmqPort, py::arg(),
|
||||
py::arg() = -1)
|
||||
py::arg())
|
||||
.def("getClientZmqIp", &Detector::getClientZmqIp,
|
||||
py::arg() = Positions{})
|
||||
.def("setClientZmqIp", &Detector::setClientZmqIp, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Eiger Specific *
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
.def("getDynamicRange", &Detector::getDynamicRange,
|
||||
py::arg() = Positions{})
|
||||
.def("setDynamicRange", &Detector::setDynamicRange)
|
||||
.def("setDynamicRange", &Detector::setDynamicRange, py::arg())
|
||||
.def("getSubExptime", &Detector::getSubExptime, py::arg() = Positions{})
|
||||
.def("setSubExptime", &Detector::setSubExptime, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
@ -408,12 +313,10 @@ void init_experimental(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("setSubDeadTime", &Detector::setSubDeadTime, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getThresholdEnergy", &Detector::getThresholdEnergy,
|
||||
py::arg() = Positions{})
|
||||
.def("setThresholdEnergy", &Detector::setThresholdEnergy, py::arg(),
|
||||
py::arg() = defs::STANDARD, py::arg() = true,
|
||||
py::arg() = Positions{})
|
||||
py::arg(), py::arg(), py::arg() = Positions{})
|
||||
.def("getSettingsPath", &Detector::getSettingsPath,
|
||||
py::arg() = Positions{})
|
||||
.def("setSettingsPath", &Detector::setSettingsPath, py::arg(),
|
||||
@ -422,7 +325,7 @@ void init_experimental(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("getRxAddGapPixels", &Detector::getRxAddGapPixels,
|
||||
py::arg() = Positions{})
|
||||
.def("setRxAddGapPixels", &Detector::setRxAddGapPixels)
|
||||
.def("setRxAddGapPixels", &Detector::setRxAddGapPixels, py::arg())
|
||||
.def("getParallelMode", &Detector::getParallelMode,
|
||||
py::arg() = Positions{})
|
||||
.def("setParallelMode", &Detector::setParallelMode, py::arg(),
|
||||
@ -448,10 +351,10 @@ void init_experimental(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("getRateCorrection", &Detector::getRateCorrection,
|
||||
py::arg() = Positions{})
|
||||
.def("setRateCorrection", &Detector::setRateCorrection, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setDefaultRateCorrection", &Detector::setDefaultRateCorrection,
|
||||
py::arg() = Positions{})
|
||||
.def("setRateCorrection", &Detector::setRateCorrection, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getPartialReadout", &Detector::getPartialReadout,
|
||||
py::arg() = Positions{})
|
||||
.def("setPartialReadout", &Detector::setPartialReadout, py::arg(),
|
||||
@ -460,7 +363,6 @@ void init_experimental(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("setInterruptSubframe", &Detector::setInterruptSubframe, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getMeasuredPeriod", &Detector::getMeasuredPeriod,
|
||||
py::arg() = Positions{})
|
||||
.def("getMeasuredSubFramePeriod", &Detector::getMeasuredSubFramePeriod,
|
||||
@ -476,7 +378,6 @@ void init_experimental(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("setPartialReset", &Detector::setPartialReset, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("pulsePixel", &Detector::pulsePixel, py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("pulsePixelNMove", &Detector::pulsePixelNMove, py::arg(),
|
||||
@ -484,13 +385,7 @@ void init_experimental(py::module &m) {
|
||||
.def("pulseChip", &Detector::pulseChip, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getQuad", &Detector::getQuad, py::arg() = Positions{})
|
||||
.def("setQuad", &Detector::setQuad)
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Jungfrau Specific *
|
||||
* *
|
||||
* ************************************************/
|
||||
.def("setQuad", &Detector::setQuad, py::arg())
|
||||
.def("getThresholdTemperature", &Detector::getThresholdTemperature,
|
||||
py::arg() = Positions{})
|
||||
.def("setThresholdTemperature", &Detector::setThresholdTemperature,
|
||||
@ -503,78 +398,53 @@ void init_experimental(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("resetTemperatureEvent", &Detector::resetTemperatureEvent,
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getPowerChip", &Detector::getPowerChip, py::arg() = Positions{})
|
||||
.def("setPowerChip", &Detector::setPowerChip, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getAutoCompDisable", &Detector::getAutoCompDisable,
|
||||
py::arg() = Positions{})
|
||||
.def("setAutoCompDisable", &Detector::setAutoCompDisable, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getNumberOfAdditionalStorageCells",
|
||||
&Detector::getNumberOfAdditionalStorageCells)
|
||||
&Detector::getNumberOfAdditionalStorageCells,
|
||||
py::arg() = Positions{})
|
||||
.def("setNumberOfAdditionalStorageCells",
|
||||
&Detector::setNumberOfAdditionalStorageCells)
|
||||
&Detector::setNumberOfAdditionalStorageCells, py::arg())
|
||||
.def("getStorageCellStart", &Detector::getStorageCellStart,
|
||||
py::arg() = Positions{})
|
||||
.def("setStoragecellStart", &Detector::setStoragecellStart, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getStorageCellDelay", &Detector::getStorageCellDelay,
|
||||
py::arg() = Positions{})
|
||||
.def("setStorageCellDelay", &Detector::setStorageCellDelay, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
// Bits and registers
|
||||
.def("setBit", &Detector::setBit, py::arg(), py::arg(),
|
||||
.def("getROI", &Detector::getROI, py::arg() = Positions{})
|
||||
.def("setROI", &Detector::setROI, py::arg(), py::arg())
|
||||
.def("clearROI", &Detector::clearROI, py::arg() = Positions{})
|
||||
.def("getExptimeLeft", &Detector::getExptimeLeft,
|
||||
py::arg() = Positions{})
|
||||
.def("clearBit", &Detector::clearBit, py::arg(), py::arg(),
|
||||
.def("getExternalSignalFlags", &Detector::getExternalSignalFlags,
|
||||
py::arg() = Positions{})
|
||||
.def("readRegister", &Detector::readRegister, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("writeRegister", &Detector::writeRegister, py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getStartingFrameNumber", &Detector::getStartingFrameNumber,
|
||||
py::arg() = Positions{})
|
||||
.def("setStartingFrameNumber", &Detector::setStartingFrameNumber,
|
||||
.def("setExternalSignalFlags", &Detector::setExternalSignalFlags,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Insignificant *
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
.def("getControlPort", &Detector::getControlPort,
|
||||
.def("getImageTestMode", &Detector::getImageTestMode,
|
||||
py::arg() = Positions{})
|
||||
.def("setControlPort", &Detector::setControlPort, py::arg(),
|
||||
.def("setImageTestMode", &Detector::setImageTestMode, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getStopPort", &Detector::getStopPort, py::arg() = Positions{})
|
||||
.def("setStopPort", &Detector::setStopPort, py::arg(),
|
||||
.def("getInjectChannel", &Detector::getInjectChannel,
|
||||
py::arg() = Positions{})
|
||||
.def("getDetectorLock", &Detector::getDetectorLock,
|
||||
.def("setInjectChannel", &Detector::setInjectChannel, py::arg(),
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getVetoPhoton", &Detector::getVetoPhoton, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setDetectorLock", &Detector::setDetectorLock, py::arg(),
|
||||
.def("setVetoPhoton", &Detector::setVetoPhoton, py::arg(), py::arg(),
|
||||
py::arg(), py::arg(), py::arg() = Positions{})
|
||||
.def("setVetoReference", &Detector::setVetoReference, py::arg(),
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getBurstMode", &Detector::getBurstMode, py::arg() = Positions{})
|
||||
.def("setBurstMode", &Detector::setBurstMode, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getLastClientIP", &Detector::getLastClientIP,
|
||||
.def("getCounterMask", &Detector::getCounterMask,
|
||||
py::arg() = Positions{})
|
||||
.def("executeCommand", &Detector::executeCommand, py::arg(),
|
||||
.def("setCounterMask", &Detector::setCounterMask, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getNumberOfFramesFromStart",
|
||||
&Detector::getNumberOfFramesFromStart, py::arg() = Positions{})
|
||||
.def("getActualTime", &Detector::getActualTime, py::arg() = Positions{})
|
||||
.def("getMeasurementTime", &Detector::getMeasurementTime,
|
||||
py::arg() = Positions{})
|
||||
.def("getUserDetails", &Detector::getUserDetails)
|
||||
.def("getRxCurrentFrameIndex", &Detector::getRxCurrentFrameIndex,
|
||||
py::arg() = Positions{})
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* CTB Specific *
|
||||
* *
|
||||
* ************************************************/
|
||||
.def("getNumberOfAnalogSamples", &Detector::getNumberOfAnalogSamples,
|
||||
py::arg() = Positions{})
|
||||
.def("setNumberOfAnalogSamples", &Detector::setNumberOfAnalogSamples,
|
||||
@ -606,11 +476,163 @@ void init_experimental(py::module &m) {
|
||||
.def("setRUNClock", &Detector::setRUNClock, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getSYNCClock", &Detector::getSYNCClock, py::arg() = Positions{})
|
||||
|
||||
// Time
|
||||
|
||||
.def("setSubExptime", &Detector::setSubExptime, py::arg(),
|
||||
.def("getADCPipeline", &Detector::getADCPipeline,
|
||||
py::arg() = Positions{})
|
||||
.def("getSubExptime", &Detector::getSubExptime,
|
||||
.def("setADCPipeline", &Detector::setADCPipeline, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getDBITPipeline", &Detector::getDBITPipeline,
|
||||
py::arg() = Positions{})
|
||||
.def("setDBITPipeline", &Detector::setDBITPipeline, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getVoltage", &Detector::getVoltage, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setVoltage", &Detector::setVoltage, py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getMeasuredVoltage", &Detector::getMeasuredVoltage, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getMeasuredCurrent", &Detector::getMeasuredCurrent, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getSlowADC", &Detector::getSlowADC, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getADCEnableMask", &Detector::getADCEnableMask,
|
||||
py::arg() = Positions{})
|
||||
.def("setADCEnableMask", &Detector::setADCEnableMask, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getTenGigaADCEnableMask", &Detector::getTenGigaADCEnableMask,
|
||||
py::arg() = Positions{})
|
||||
.def("setTenGigaADCEnableMask", &Detector::setTenGigaADCEnableMask,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getADCInvert", &Detector::getADCInvert, py::arg() = Positions{})
|
||||
.def("setADCInvert", &Detector::setADCInvert, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getExternalSamplingSource", &Detector::getExternalSamplingSource,
|
||||
py::arg() = Positions{})
|
||||
.def("setExternalSamplingSource", &Detector::setExternalSamplingSource,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getExternalSampling", &Detector::getExternalSampling,
|
||||
py::arg() = Positions{})
|
||||
.def("setExternalSampling", &Detector::setExternalSampling, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRxDbitList", &Detector::getRxDbitList, py::arg() = Positions{})
|
||||
.def("setRxDbitList", &Detector::setRxDbitList, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRxDbitOffset", &Detector::getRxDbitOffset,
|
||||
py::arg() = Positions{})
|
||||
.def("setRxDbitOffset", &Detector::setRxDbitOffset, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setDigitalIODelay", &Detector::setDigitalIODelay, py::arg(),
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getLEDEnable", &Detector::getLEDEnable, py::arg() = Positions{})
|
||||
.def("setLEDEnable", &Detector::setLEDEnable, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setPattern", &Detector::setPattern, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("savePattern", &Detector::savePattern, py::arg())
|
||||
.def("getPatternIOControl", &Detector::getPatternIOControl,
|
||||
py::arg() = Positions{})
|
||||
.def("setPatternIOControl", &Detector::setPatternIOControl, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getPatternClockControl", &Detector::getPatternClockControl,
|
||||
py::arg() = Positions{})
|
||||
.def("setPatternClockControl", &Detector::setPatternClockControl,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getPatternWord", &Detector::getPatternWord, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setPatternWord", &Detector::setPatternWord, py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getPatternLoopAddresses", &Detector::getPatternLoopAddresses,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("setPatternLoopAddresses", &Detector::setPatternLoopAddresses,
|
||||
py::arg(), py::arg(), py::arg(), py::arg() = Positions{})
|
||||
.def("getPatternLoopCycles", &Detector::getPatternLoopCycles, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setPatternLoopCycles", &Detector::setPatternLoopCycles, py::arg(),
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getPatternWaitAddr", &Detector::getPatternWaitAddr, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setPatternWaitAddr", &Detector::setPatternWaitAddr, py::arg(),
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getPatternWaitTime", &Detector::getPatternWaitTime, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setPatternWaitTime", &Detector::setPatternWaitTime, py::arg(),
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getPatternMask", &Detector::getPatternMask,
|
||||
py::arg() = Positions{})
|
||||
.def("setPatternMask", &Detector::setPatternMask, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getPatternBitMask", &Detector::getPatternBitMask,
|
||||
py::arg() = Positions{})
|
||||
.def("setPatternBitMask", &Detector::setPatternBitMask, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getAdditionalJsonHeader", &Detector::getAdditionalJsonHeader,
|
||||
py::arg() = Positions{})
|
||||
.def("setAdditionalJsonHeader", &Detector::setAdditionalJsonHeader,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getAdditionalJsonParameter",
|
||||
&Detector::getAdditionalJsonParameter, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setAdditionalJsonParameter",
|
||||
&Detector::setAdditionalJsonParameter, py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getDetectorMinMaxEnergyThreshold",
|
||||
&Detector::getDetectorMinMaxEnergyThreshold, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setDetectorMinMaxEnergyThreshold",
|
||||
&Detector::setDetectorMinMaxEnergyThreshold, py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getFrameMode", &Detector::getFrameMode, py::arg() = Positions{})
|
||||
.def("setFrameMode", &Detector::setFrameMode, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getDetectorMode", &Detector::getDetectorMode,
|
||||
py::arg() = Positions{})
|
||||
.def("setDetectorMode", &Detector::setDetectorMode, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("programFPGA", &Detector::programFPGA, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("resetFPGA", &Detector::resetFPGA, py::arg() = Positions{})
|
||||
.def("copyDetectorServer", &Detector::copyDetectorServer, py::arg(),
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("rebootController", &Detector::rebootController,
|
||||
py::arg() = Positions{})
|
||||
.def("updateFirmwareAndServer", &Detector::updateFirmwareAndServer,
|
||||
py::arg(), py::arg(), py::arg(), py::arg() = Positions{})
|
||||
.def("readRegister", &Detector::readRegister, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("writeRegister", &Detector::writeRegister, py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setBit", &Detector::setBit, py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("clearBit", &Detector::clearBit, py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("executeFirmwareTest", &Detector::executeFirmwareTest,
|
||||
py::arg() = Positions{})
|
||||
.def("executeBusTest", &Detector::executeBusTest,
|
||||
py::arg() = Positions{})
|
||||
.def("writeAdcRegister", &Detector::writeAdcRegister, py::arg(),
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getInitialChecks", &Detector::getInitialChecks)
|
||||
.def("setInitialChecks", &Detector::setInitialChecks, py::arg())
|
||||
.def("getControlPort", &Detector::getControlPort,
|
||||
py::arg() = Positions{})
|
||||
.def("setControlPort", &Detector::setControlPort, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getStopPort", &Detector::getStopPort, py::arg() = Positions{})
|
||||
.def("setStopPort", &Detector::setStopPort, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getDetectorLock", &Detector::getDetectorLock,
|
||||
py::arg() = Positions{})
|
||||
.def("setDetectorLock", &Detector::setDetectorLock, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getLastClientIP", &Detector::getLastClientIP,
|
||||
py::arg() = Positions{})
|
||||
.def("executeCommand", &Detector::executeCommand, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getNumberOfFramesFromStart",
|
||||
&Detector::getNumberOfFramesFromStart, py::arg() = Positions{})
|
||||
.def("getActualTime", &Detector::getActualTime, py::arg() = Positions{})
|
||||
.def("getMeasurementTime", &Detector::getMeasurementTime,
|
||||
py::arg() = Positions{})
|
||||
.def("getUserDetails", &Detector::getUserDetails)
|
||||
.def("getRxCurrentFrameIndex", &Detector::getRxCurrentFrameIndex,
|
||||
py::arg() = Positions{});
|
||||
}
|
21
python/src/detector_in.cpp
Normal file
21
python/src/detector_in.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include <pybind11/chrono.h>
|
||||
#include <pybind11/operators.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/stl.h>
|
||||
|
||||
#include "Detector.h"
|
||||
#include "ToString.h"
|
||||
#include "network_utils.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include "typecaster.h"
|
||||
namespace py = pybind11;
|
||||
void init_det(py::module &m) {
|
||||
using sls::Detector;
|
||||
using sls::Positions;
|
||||
|
||||
py::class_<Detector> CppDetectorApi(m, "CppDetectorApi");
|
||||
CppDetectorApi
|
||||
.def(py::init<int>())
|
||||
|
||||
[[FUNCTIONS]]
|
||||
}
|
@ -169,7 +169,7 @@ void init_enums(py::module &m) {
|
||||
.value("VB_COMP_FE", slsDetectorDefs::dacIndex::VB_COMP_FE)
|
||||
.value("VB_COMP_ADC", slsDetectorDefs::dacIndex::VB_COMP_ADC)
|
||||
.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("VREF_COMP_FE", slsDetectorDefs::dacIndex::VREF_COMP_FE)
|
||||
.value("VCOM_ADC1", slsDetectorDefs::dacIndex::VCOM_ADC1)
|
||||
@ -278,4 +278,10 @@ void init_enums(py::module &m) {
|
||||
slsDetectorDefs::detectorModeType::INTERPOLATING)
|
||||
.value("ANALOG", slsDetectorDefs::detectorModeType::ANALOG)
|
||||
.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();
|
||||
}
|
||||
|
@ -17,7 +17,9 @@ using ds = std::chrono::duration<double>;
|
||||
namespace py = pybind11;
|
||||
void init_enums(py::module &);
|
||||
void init_experimental(py::module &);
|
||||
PYBIND11_MODULE(_sls_detector, m) {
|
||||
void init_det(py::module &);
|
||||
void init_network(py::module &);
|
||||
PYBIND11_MODULE(_slsdet, m) {
|
||||
m.doc() = R"pbdoc(
|
||||
C/C++ API
|
||||
-----------------------
|
||||
@ -29,7 +31,9 @@ PYBIND11_MODULE(_sls_detector, m) {
|
||||
)pbdoc";
|
||||
|
||||
init_enums(m);
|
||||
init_experimental(m);
|
||||
init_det(m);
|
||||
init_network(m);
|
||||
// init_experimental(m);
|
||||
|
||||
|
||||
py::module io = m.def_submodule("io", "Submodule for io");
|
||||
|
39
python/src/network.cpp
Normal file
39
python/src/network.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
This file contains Python bindings for the IpAddr and MacAddr
|
||||
classes.
|
||||
*/
|
||||
|
||||
|
||||
#include <pybind11/chrono.h>
|
||||
#include <pybind11/operators.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/stl.h>
|
||||
|
||||
#include "network_utils.h"
|
||||
namespace py = pybind11;
|
||||
using sls::IpAddr;
|
||||
using sls::MacAddr;
|
||||
void init_network(py::module &m) {
|
||||
|
||||
py::class_ <IpAddr> IpAddr(m, "IpAddr");
|
||||
IpAddr.def(py::init())
|
||||
.def(py::init<const std::string&>())
|
||||
.def(py::init<uint32_t>())
|
||||
.def("hex", &IpAddr::hex)
|
||||
.def("uint32", &IpAddr::uint32)
|
||||
.def(py::self == py::self)
|
||||
.def("__repr__", &IpAddr::str)
|
||||
.def("str", &IpAddr::str);
|
||||
|
||||
|
||||
py::class_ <MacAddr> MacAddr(m, "MacAddr");
|
||||
MacAddr.def(py::init())
|
||||
.def(py::init<const std::string&>())
|
||||
.def(py::init<uint64_t>())
|
||||
.def("hex", &MacAddr::hex)
|
||||
.def(py::self == py::self)
|
||||
.def("uint64", &MacAddr::uint64)
|
||||
.def("__repr__", &MacAddr::str)
|
||||
.def("str", &MacAddr::str);
|
||||
|
||||
}
|
@ -16,12 +16,12 @@ def d():
|
||||
|
||||
|
||||
def test_acq_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.acq')
|
||||
m = mocker.patch('_slsdet.DetectorApi.acq')
|
||||
d.acq()
|
||||
m.assert_called_once_with()
|
||||
|
||||
def test_busy_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getAcquiringFlag')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getAcquiringFlag')
|
||||
m.return_value = False
|
||||
assert d.busy == False
|
||||
|
||||
@ -31,103 +31,103 @@ def test_assign_to_detector_type(d):
|
||||
d.detector_type = 'Eiger'
|
||||
|
||||
def test_det_type(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getDetectorType')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getDetectorType')
|
||||
m.return_value = 'Eiger'
|
||||
assert d.detector_type == 'Eiger'
|
||||
|
||||
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
|
||||
m.assert_called_with(4)
|
||||
|
||||
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
|
||||
m.assert_called_with(8)
|
||||
|
||||
|
||||
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
|
||||
m.assert_called_with(16)
|
||||
|
||||
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
|
||||
m.assert_called_with(32)
|
||||
|
||||
def test_set_dynamic_range_raises_exception(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setDynamicRange')
|
||||
mocker.patch('_slsdet.DetectorApi.setDynamicRange')
|
||||
with pytest.raises(ValueError):
|
||||
d.dynamic_range = 17
|
||||
|
||||
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
|
||||
dr = d.dynamic_range
|
||||
assert dr == 32
|
||||
|
||||
def test_eiger_matrix_reset(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getCounterBit')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getCounterBit')
|
||||
m.return_value = True
|
||||
assert d.eiger_matrix_reset == True
|
||||
|
||||
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
|
||||
m.assert_called_once_with(True)
|
||||
|
||||
|
||||
def test_get_exposure_time(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getExposureTime')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getExposureTime')
|
||||
m.return_value = 100000000
|
||||
assert d.exposure_time == 0.1
|
||||
|
||||
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
|
||||
m.assert_called_once_with(1500000000)
|
||||
|
||||
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):
|
||||
d.exposure_time = -7
|
||||
|
||||
|
||||
def test_get_file_index(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getFileIndex')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getFileIndex')
|
||||
m.return_value = 8
|
||||
assert d.file_index == 8
|
||||
|
||||
def test_set_file_index(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setFileIndex')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setFileIndex')
|
||||
d.file_index = 9
|
||||
m.assert_called_with(9)
|
||||
|
||||
|
||||
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):
|
||||
d.file_index = -9
|
||||
|
||||
|
||||
def test_get_file_name(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getFileName')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getFileName')
|
||||
d.file_name
|
||||
m.assert_called_once_with()
|
||||
|
||||
def test_set_file_name(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setFileName')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setFileName')
|
||||
d.file_name = 'hej'
|
||||
m.assert_called_once_with('hej')
|
||||
|
||||
def test_get_file_path(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getFilePath')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getFilePath')
|
||||
d.file_path
|
||||
m.assert_called_once_with()
|
||||
|
||||
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
|
||||
mock_os = mocker.patch('os.path.exists')
|
||||
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/')
|
||||
|
||||
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.return_value = False
|
||||
with pytest.raises(FileNotFoundError):
|
||||
d.file_path = '/path/to/something/'
|
||||
|
||||
def test_get_file_write(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getFileWrite')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getFileWrite')
|
||||
m.return_value = False
|
||||
assert d.file_write == False
|
||||
|
||||
def test_set_file_write(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setFileWrite')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setFileWrite')
|
||||
d.file_write = True
|
||||
m.assert_called_once_with(True)
|
||||
|
||||
|
||||
def test_get_firmware_version(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getFirmwareVersion')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getFirmwareVersion')
|
||||
m.return_value = 20
|
||||
assert d.firmware_version == 20
|
||||
|
||||
@ -162,38 +162,38 @@ def test_cannot_set_fw_version(d):
|
||||
d.firmware_version = 20
|
||||
|
||||
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
|
||||
m.assert_called_once_with('vhighvoltage', -1)
|
||||
|
||||
def test_get_high_voltage(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getDac')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||
m.return_value = 80
|
||||
assert d.high_voltage == 80
|
||||
|
||||
#self._api.setDac('vhighvoltage', -1, voltage)
|
||||
def test_set_high_voltage(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setDac')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setDac')
|
||||
d.high_voltage = 80
|
||||
m.assert_called_once_with('vhighvoltage', -1, 80)
|
||||
|
||||
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+'
|
||||
assert d.hostname == ['beb059', 'beb048']
|
||||
|
||||
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+'
|
||||
assert d.hostname == ['beb059', 'beb048', 'beb120', 'beb153']
|
||||
|
||||
def test_decode_hostname_blank(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getHostname')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getHostname')
|
||||
m.return_value = ''
|
||||
assert d.hostname == []
|
||||
|
||||
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)
|
||||
im_size = d.image_size
|
||||
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):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.readConfigurationFile')
|
||||
m = mocker.patch('_slsdet.DetectorApi.readConfigurationFile')
|
||||
#To avoid raising an exception because path is not there
|
||||
mock_os = mocker.patch('os.path.isfile')
|
||||
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')
|
||||
|
||||
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.return_value = False
|
||||
with pytest.raises(FileNotFoundError):
|
||||
d.load_config('/path/to/my/file.config')
|
||||
|
||||
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
|
||||
mock_os = mocker.patch('os.path.isfile')
|
||||
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')
|
||||
|
||||
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.return_value = False
|
||||
with pytest.raises(FileNotFoundError):
|
||||
@ -233,14 +233,14 @@ def test_load_parameters_raises_when_file_is_not_found(d, mocker):
|
||||
|
||||
#getDetectorGeometry
|
||||
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)
|
||||
g = d.module_geometry
|
||||
assert g.vertical == 7
|
||||
assert g.horizontal == 13
|
||||
|
||||
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)
|
||||
assert d.module_geometry[0] == 12
|
||||
assert d.module_geometry[1] == 3
|
||||
@ -248,237 +248,237 @@ def test_get_module_geometry_access(d, mocker):
|
||||
assert d.module_geometry.horizontal == 12
|
||||
|
||||
def test_get_n_frames(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getNumberOfFrames')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getNumberOfFrames')
|
||||
m.return_value = 3
|
||||
assert d.n_frames == 3
|
||||
|
||||
def test_set_n_frames(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
|
||||
d.n_frames = 9
|
||||
m.assert_called_once_with(9)
|
||||
|
||||
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):
|
||||
d.n_frames = -1
|
||||
|
||||
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):
|
||||
d.n_frames = 0
|
||||
|
||||
def test_get_n_modules(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
|
||||
m.return_value = 12
|
||||
assert d.n_modules == 12
|
||||
|
||||
def test_get_period_time(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getPeriod')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getPeriod')
|
||||
m.return_value = 130000000
|
||||
assert d.period == 0.13
|
||||
|
||||
def test_set_period_time(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setPeriod')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setPeriod')
|
||||
d.period = 1.953
|
||||
m.assert_called_once_with(1953000000)
|
||||
|
||||
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):
|
||||
d.period = -7
|
||||
|
||||
def test_pulse_chip_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.pulseChip')
|
||||
m = mocker.patch('_slsdet.DetectorApi.pulseChip')
|
||||
d.pulse_chip(15)
|
||||
m.assert_called_once_with(15)
|
||||
|
||||
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)
|
||||
m.assert_called_once_with(-1)
|
||||
|
||||
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):
|
||||
d.pulse_chip(-3)
|
||||
#--------------------------------------------------------------------subexptime
|
||||
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
|
||||
assert d.sub_exposure_time == 0.00237
|
||||
|
||||
|
||||
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
|
||||
m.assert_called_once_with(2000000)
|
||||
|
||||
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):
|
||||
d.sub_exposure_time = 0
|
||||
|
||||
#-------------------------------------------------------------Rate correction
|
||||
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]
|
||||
assert d.rate_correction == [132,129]
|
||||
|
||||
def test_set_rate_correction(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setRateCorrection')
|
||||
mock_n = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setRateCorrection')
|
||||
mock_n = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
|
||||
mock_n.return_value = 3
|
||||
d.rate_correction = [123,90,50]
|
||||
m.assert_called_once_with([123,90,50])
|
||||
|
||||
def test_set_rate_correction_raises_on_wrong_number_of_values(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setRateCorrection')
|
||||
mock_n = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
|
||||
mocker.patch('_slsdet.DetectorApi.setRateCorrection')
|
||||
mock_n = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
|
||||
mock_n.return_value = 4
|
||||
with pytest.raises(ValueError):
|
||||
d.rate_correction = [123,90,50]
|
||||
|
||||
#----------------------------------------------------------------Readout clock
|
||||
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
|
||||
assert d.readout_clock == 'Full Speed'
|
||||
|
||||
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
|
||||
assert d.readout_clock == 'Half Speed'
|
||||
|
||||
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
|
||||
assert d.readout_clock == 'Quarter Speed'
|
||||
|
||||
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
|
||||
assert d.readout_clock == 'Super Slow Speed'
|
||||
|
||||
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'
|
||||
m.assert_called_once_with(0)
|
||||
|
||||
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'
|
||||
m.assert_called_once_with(1)
|
||||
|
||||
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'
|
||||
m.assert_called_once_with(2)
|
||||
|
||||
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'
|
||||
m.assert_called_once_with(3)
|
||||
|
||||
#----------------------------------------------------------------rx_datastream
|
||||
def test_get_rx_datastream(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getRxDataStreamStatus')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getRxDataStreamStatus')
|
||||
m.return_value = False
|
||||
assert d.rx_datastream == False
|
||||
|
||||
def test_set_rx_datastream(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setRxDataStreamStatus')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setRxDataStreamStatus')
|
||||
d.rx_datastream = True
|
||||
m.assert_called_once_with(True)
|
||||
|
||||
def test_get_rx_zmqip(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||
d.rx_zmqip
|
||||
m.assert_called_once_with('rx_zmqip')
|
||||
|
||||
def test_get_rx_zmqport_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||
d.rx_zmqport
|
||||
m.assert_called_once_with('rx_zmqport')
|
||||
|
||||
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+'
|
||||
assert d.rx_zmqport == [30001, 30002, 30003, 30004]
|
||||
|
||||
def test_get_rx_zmqport_empty(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||
m.return_value = ''
|
||||
assert d.rx_zmqport == []
|
||||
|
||||
|
||||
#--------------------------------------------------------------------status
|
||||
def test_status_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getRunStatus')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getRunStatus')
|
||||
d.status
|
||||
m.assert_called_once_with()
|
||||
|
||||
def test_start_acq_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.startAcquisition')
|
||||
m = mocker.patch('_slsdet.DetectorApi.startAcquisition')
|
||||
d.start_acq()
|
||||
m.assert_called_once_with()
|
||||
|
||||
def test_stop_acq_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.stopAcquisition')
|
||||
m = mocker.patch('_slsdet.DetectorApi.stopAcquisition')
|
||||
d.stop_acq()
|
||||
m.assert_called_once_with()
|
||||
|
||||
#--------------------------------------------------------------------subexptime
|
||||
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
|
||||
assert d.sub_exposure_time == 0.00237
|
||||
|
||||
|
||||
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
|
||||
m.assert_called_once_with(2000000)
|
||||
|
||||
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):
|
||||
d.sub_exposure_time = 0
|
||||
|
||||
#------------------------------------------------------------------timing mode
|
||||
def test_get_timing_mode(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getTimingMode')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getTimingMode')
|
||||
d.timing_mode
|
||||
m.assert_called_once_with()
|
||||
|
||||
def test_set_timing_mode(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setTimingMode')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setTimingMode')
|
||||
d.timing_mode = 'auto'
|
||||
m.assert_called_once_with('auto')
|
||||
|
||||
#----------------------------------------------------------------vthreshold
|
||||
def test_get_vthreshold(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getDac')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||
d.vthreshold
|
||||
m.assert_called_once_with('vthreshold', -1)
|
||||
|
||||
def test_set_vthreshold(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setDac')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setDac')
|
||||
d.vthreshold = 1675
|
||||
m.assert_called_once_with('vthreshold', -1, 1675)
|
||||
|
||||
#----------------------------------------------------------------trimbits
|
||||
def test_get_trimbits(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getAllTrimbits')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getAllTrimbits')
|
||||
d.trimbits
|
||||
m.assert_called_once_with()
|
||||
|
||||
def test_set_trimbits(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setAllTrimbits')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setAllTrimbits')
|
||||
d.trimbits = 15
|
||||
m.assert_called_once_with(15)
|
||||
|
||||
def test_set_trimbits_raises_outside_range(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setAllTrimbits')
|
||||
mocker.patch('_slsdet.DetectorApi.setAllTrimbits')
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
d.trimbits = 69
|
||||
|
@ -1,8 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Testing parameters and methods of the Detector class using mocks
|
||||
Testing the Detector python class by mocking calls.
|
||||
Should only be used when there is functionality in
|
||||
the detector.py file.
|
||||
|
||||
An example is converting a mask to a list of set bits.
|
||||
"""
|
||||
|
||||
from unittest.mock import Mock
|
||||
import pytest
|
||||
from pytest_mock import mocker
|
||||
@ -10,462 +15,474 @@ from pytest_mock import mocker
|
||||
import sys
|
||||
sys.path.append('/home/l_frojdh/slsdetectorgrup/sls_detector')
|
||||
|
||||
import _sls_detector
|
||||
import _slsdet
|
||||
from sls_detector.errors import DetectorValueError, DetectorError
|
||||
from sls_detector.utils import all_equal, element_if_equal
|
||||
|
||||
@pytest.fixture
|
||||
def d():
|
||||
from sls_detector import Detector
|
||||
return Detector()
|
||||
|
||||
def test_length(d, mocker):
|
||||
m = mocker.patch('sls_detector.Detector.size')
|
||||
m.return_value = 5
|
||||
assert(len(d) == 5)
|
||||
|
||||
def test_length_zero(d):
|
||||
assert len(d) == 0
|
||||
def test_counters_single(d, mocker):
|
||||
m = mocker.patch('sls_detector.Detector.getCounterMask')
|
||||
m.return_value = [7]
|
||||
assert(d.counters == [0,1,2])
|
||||
|
||||
def test_acq_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.acq')
|
||||
d.acq()
|
||||
m.assert_called_once_with()
|
||||
|
||||
|
||||
|
||||
def test_busy_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getAcquiringFlag')
|
||||
m.return_value = False
|
||||
assert d.busy == False
|
||||
|
||||
def test_set_busy(d):
|
||||
d.busy = True
|
||||
assert d.busy == True
|
||||
assert d._api.getAcquiringFlag() == True
|
||||
d.busy = False
|
||||
assert d.busy == False
|
||||
assert d._api.getAcquiringFlag() == False
|
||||
|
||||
def test_error_mask(d):
|
||||
d._api.setErrorMask(1)
|
||||
assert d.error_mask == 1
|
||||
d.clear_errors()
|
||||
|
||||
def test_error_handling(d):
|
||||
with pytest.raises(DetectorError):
|
||||
d._provoke_error()
|
||||
|
||||
def test_assign_to_detector_type(d):
|
||||
with pytest.raises(AttributeError):
|
||||
d.detector_type = 'Eiger'
|
||||
|
||||
def test_det_type(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getDetectorType')
|
||||
m.return_value = 'Eiger'
|
||||
assert d.detector_type == 'Eiger'
|
||||
|
||||
|
||||
def test_get_exposure_time(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getExposureTime')
|
||||
m.return_value = 100000000
|
||||
assert d.exposure_time == 0.1
|
||||
|
||||
def test_set_exposure_time(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setExposureTime')
|
||||
d.exposure_time = 1.5
|
||||
m.assert_called_once_with(1500000000)
|
||||
|
||||
def test_set_exposure_time_less_than_zero(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setExposureTime')
|
||||
with pytest.raises(DetectorValueError):
|
||||
d.exposure_time = -7
|
||||
|
||||
|
||||
def test_get_file_index(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getFileIndex')
|
||||
m.return_value = 8
|
||||
assert d.file_index == 8
|
||||
|
||||
def test_set_file_index(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setFileIndex')
|
||||
d.file_index = 9
|
||||
m.assert_called_with(9)
|
||||
|
||||
|
||||
def file_index_with_no_detector(d):
|
||||
assert d.file_index == -100
|
||||
|
||||
def dr_with_no_detector(d):
|
||||
assert d.dynamic_range == -100
|
||||
|
||||
def test_set_file_index_raises_on_neg(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setFileIndex')
|
||||
with pytest.raises(ValueError):
|
||||
d.file_index = -9
|
||||
|
||||
|
||||
def test_get_file_name(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getFileName')
|
||||
d.file_name
|
||||
m.assert_called_once_with()
|
||||
|
||||
def test_set_file_name(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setFileName')
|
||||
d.file_name = 'hej'
|
||||
m.assert_called_once_with('hej')
|
||||
|
||||
def test_get_file_path(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getFilePath')
|
||||
d.file_path
|
||||
m.assert_called_once_with()
|
||||
|
||||
def test_set_file_path_when_path_exists(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setFilePath')
|
||||
#To avoid raising an exception because path is not there
|
||||
mock_os = mocker.patch('os.path.exists')
|
||||
mock_os.return_value = True
|
||||
d.file_path = '/path/to/something/'
|
||||
m.assert_called_once_with('/path/to/something/')
|
||||
|
||||
def test_set_file_path_raises_when_not_exists(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setFilePath')
|
||||
mock_os = mocker.patch('os.path.exists')
|
||||
mock_os.return_value = False
|
||||
with pytest.raises(FileNotFoundError):
|
||||
d.file_path = '/path/to/something/'
|
||||
|
||||
def test_get_file_write(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getFileWrite')
|
||||
m.return_value = False
|
||||
assert d.file_write == False
|
||||
|
||||
def test_set_file_write(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setFileWrite')
|
||||
d.file_write = True
|
||||
m.assert_called_once_with(True)
|
||||
|
||||
|
||||
def test_get_firmware_version(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getFirmwareVersion')
|
||||
m.return_value = 20
|
||||
assert d.firmware_version == 20
|
||||
|
||||
def test_cannot_set_fw_version(d):
|
||||
with pytest.raises(AttributeError):
|
||||
d.firmware_version = 20
|
||||
|
||||
def test_get_high_voltage_call_signature(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getDac')
|
||||
d.high_voltage
|
||||
m.assert_called_once_with('vhighvoltage', -1)
|
||||
|
||||
def test_get_high_voltage(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getDac')
|
||||
m.return_value = 80
|
||||
assert d.high_voltage == 80
|
||||
|
||||
#self._api.setDac('vhighvoltage', -1, voltage)
|
||||
def test_set_high_voltage(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setDac')
|
||||
d.high_voltage = 80
|
||||
m.assert_called_once_with('vhighvoltage', -1, 80)
|
||||
|
||||
def test_decode_hostname_two_names(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getHostname')
|
||||
m.return_value = 'beb059+beb048+'
|
||||
assert d.hostname == ['beb059', 'beb048']
|
||||
|
||||
def test_decode_hostname_four_names(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getHostname')
|
||||
m.return_value = 'beb059+beb048+beb120+beb153+'
|
||||
assert d.hostname == ['beb059', 'beb048', 'beb120', 'beb153']
|
||||
|
||||
def test_decode_hostname_blank(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getHostname')
|
||||
m.return_value = ''
|
||||
assert d.hostname == []
|
||||
|
||||
def test_get_image_size_gives_correct_size(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getImageSize')
|
||||
m.return_value = (512,1024)
|
||||
im_size = d.image_size
|
||||
assert im_size.rows == 512
|
||||
assert im_size.cols == 1024
|
||||
|
||||
|
||||
|
||||
def test_load_config(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.readConfigurationFile')
|
||||
#To avoid raising an exception because path is not there
|
||||
mock_os = mocker.patch('os.path.isfile')
|
||||
mock_os.return_value = True
|
||||
d.load_config('/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):
|
||||
mocker.patch('_sls_detector.DetectorApi.readConfigurationFile')
|
||||
mock_os = mocker.patch('os.path.isfile')
|
||||
mock_os.return_value = False
|
||||
with pytest.raises(FileNotFoundError):
|
||||
d.load_config('/path/to/my/file.config')
|
||||
|
||||
def test_load_parameters(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.readParametersFile')
|
||||
#To avoid raising an exception because path is not there
|
||||
mock_os = mocker.patch('os.path.isfile')
|
||||
mock_os.return_value = True
|
||||
d.load_parameters('/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):
|
||||
mocker.patch('_sls_detector.DetectorApi.readParametersFile')
|
||||
mock_os = mocker.patch('os.path.isfile')
|
||||
mock_os.return_value = False
|
||||
with pytest.raises(FileNotFoundError):
|
||||
d.load_parameters('/path/to/my/file.par')
|
||||
|
||||
#getDetectorGeometry
|
||||
def test_get_module_geometry_gives_correct_size(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getDetectorGeometry')
|
||||
m.return_value = (13,7)
|
||||
g = d.module_geometry
|
||||
assert g.vertical == 7
|
||||
assert g.horizontal == 13
|
||||
|
||||
def test_get_module_geometry_access(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getDetectorGeometry')
|
||||
m.return_value = (12,3)
|
||||
assert d.module_geometry[0] == 12
|
||||
assert d.module_geometry[1] == 3
|
||||
assert d.module_geometry.vertical == 3
|
||||
assert d.module_geometry.horizontal == 12
|
||||
|
||||
def test_module_geometry_without_detectors(d):
|
||||
t = d.module_geometry
|
||||
assert t.horizontal == 0
|
||||
assert t.vertical == 0
|
||||
|
||||
def test_get_n_frames(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getNumberOfFrames')
|
||||
m.return_value = 3
|
||||
assert d.n_frames == 3
|
||||
|
||||
def test_set_n_frames(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
|
||||
d.n_frames = 9
|
||||
m.assert_called_once_with(9)
|
||||
|
||||
def test_nframes_without_detector(d):
|
||||
assert d.n_frames == -100
|
||||
|
||||
def test_set_n_frames_raises_on_neg(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
|
||||
with pytest.raises(DetectorValueError):
|
||||
d.n_frames = -1
|
||||
|
||||
def test_set_n_frames_raises_on_zero(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
|
||||
with pytest.raises(DetectorValueError):
|
||||
d.n_frames = 0
|
||||
|
||||
def test_n_cycles_without_detector(d):
|
||||
assert d.n_cycles == -100
|
||||
|
||||
def test_set_n_cycles_raises_on_zero(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setCycles')
|
||||
with pytest.raises(DetectorValueError):
|
||||
d.n_cycles = 0
|
||||
|
||||
def test_set_n_cycles(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setCycles')
|
||||
d.n_cycles = 56
|
||||
m.assert_called_once_with(56)
|
||||
|
||||
|
||||
|
||||
def test_n_measurements_without_detector(d):
|
||||
assert d.n_measurements == -100
|
||||
|
||||
def test_set_n_measurements_raises_on_zero(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setNumberOfMeasurements')
|
||||
with pytest.raises(DetectorValueError):
|
||||
d.n_measurements = 0
|
||||
|
||||
def test_set_n_measurements(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setNumberOfMeasurements')
|
||||
d.n_measurements = 560
|
||||
m.assert_called_once_with(560)
|
||||
|
||||
def test_get_n_modules_no_detector(d):
|
||||
assert d.n_modules == 0
|
||||
|
||||
def test_get_n_modules(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
|
||||
m.return_value = 12
|
||||
assert d.n_modules == 12
|
||||
|
||||
def test_get_period_time(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getPeriod')
|
||||
m.return_value = 130000000
|
||||
assert d.period == 0.13
|
||||
|
||||
def test_set_period_time(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setPeriod')
|
||||
d.period = 1.953
|
||||
m.assert_called_once_with(1953000000)
|
||||
|
||||
def test_set_period_time_less_than_zero(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setPeriod')
|
||||
with pytest.raises(ValueError):
|
||||
d.period = -7
|
||||
|
||||
|
||||
def test_get_online(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getOnline')
|
||||
d.online
|
||||
m.assert_called_once_with()
|
||||
|
||||
def test_set_online(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setOnline')
|
||||
d.online = True
|
||||
m.assert_called_once_with(True)
|
||||
|
||||
def test_last_client_ip_no_detector(d):
|
||||
assert d.last_client_ip == ''
|
||||
|
||||
def test_last_cliten_ip_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getLastClientIP')
|
||||
d.last_client_ip
|
||||
m.assert_called_once_with()
|
||||
|
||||
#-------------------------------------------------------------Rate correction
|
||||
def test_get_rate_correction(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getRateCorrection')
|
||||
m.return_value = [132,129]
|
||||
assert d.rate_correction == [132,129]
|
||||
|
||||
def test_set_rate_correction(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setRateCorrection')
|
||||
mock_n = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
|
||||
mock_n.return_value = 3
|
||||
d.rate_correction = [123,90,50]
|
||||
m.assert_called_once_with([123,90,50])
|
||||
|
||||
def test_set_rate_correction_raises_on_wrong_number_of_values(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setRateCorrection')
|
||||
mock_n = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
|
||||
mock_n.return_value = 4
|
||||
with pytest.raises(ValueError):
|
||||
d.rate_correction = [123,90,50]
|
||||
|
||||
#----------------------------------------------------------------Readout clock
|
||||
def test_get_readout_clock_0(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
||||
m.return_value = 0
|
||||
assert d.readout_clock == 'Full Speed'
|
||||
|
||||
def test_get_readout_clock_1(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
||||
m.return_value = 1
|
||||
assert d.readout_clock == 'Half Speed'
|
||||
|
||||
def test_get_readout_clock_2(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
||||
m.return_value = 2
|
||||
assert d.readout_clock == 'Quarter Speed'
|
||||
|
||||
def test_get_readout_clock_3(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
||||
m.return_value = 3
|
||||
assert d.readout_clock == 'Super Slow Speed'
|
||||
|
||||
def test_set_readout_clock_0(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
||||
d.readout_clock = 'Full Speed'
|
||||
m.assert_called_once_with(0)
|
||||
|
||||
def test_set_readout_clock_1(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
||||
d.readout_clock = 'Half Speed'
|
||||
m.assert_called_once_with(1)
|
||||
|
||||
def test_set_readout_clock_2(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
||||
d.readout_clock = 'Quarter Speed'
|
||||
m.assert_called_once_with(2)
|
||||
|
||||
def test_set_readout_clock_3(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
||||
d.readout_clock = 'Super Slow Speed'
|
||||
m.assert_called_once_with(3)
|
||||
|
||||
#----------------------------------------------------------------rx_datastream
|
||||
def test_get_rx_datastream(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getRxDataStreamStatus')
|
||||
m.return_value = False
|
||||
assert d.rx_datastream == False
|
||||
|
||||
def test_set_rx_datastream(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setRxDataStreamStatus')
|
||||
d.rx_datastream = True
|
||||
m.assert_called_once_with(True)
|
||||
|
||||
def test_get_rx_zmqip(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
||||
d.rx_zmqip
|
||||
m.assert_called_once_with('rx_zmqip')
|
||||
|
||||
def test_get_rx_zmqport_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
||||
d.rx_zmqport
|
||||
m.assert_called_once_with('rx_zmqport')
|
||||
|
||||
def test_get_rx_zmqport_decode(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
||||
m.return_value = ['30001', '30003']
|
||||
assert d.rx_zmqport == [30001, 30003]
|
||||
|
||||
def test_get_rx_zmqport_empty(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
||||
m.return_value = ''
|
||||
assert d.rx_zmqport == []
|
||||
|
||||
|
||||
#--------------------------------------------------------------------status
|
||||
def test_status_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getRunStatus')
|
||||
d.status
|
||||
m.assert_called_once_with()
|
||||
|
||||
def test_start_detecor(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.startAcquisition')
|
||||
d.start_detector()
|
||||
m.assert_called_once_with()
|
||||
|
||||
def test_stop_acq_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.stopAcquisition')
|
||||
d.stop_detector()
|
||||
m.assert_called_once_with()
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------------timing mode
|
||||
def test_get_timing_mode(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getTimingMode')
|
||||
d.timing_mode
|
||||
m.assert_called_once_with()
|
||||
|
||||
def test_set_timing_mode(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setTimingMode')
|
||||
d.timing_mode = 'auto'
|
||||
m.assert_called_once_with('auto')
|
||||
|
||||
#----------------------------------------------------------------vthreshold
|
||||
def test_get_vthreshold(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getDac')
|
||||
d.vthreshold
|
||||
m.assert_called_once_with('vthreshold', -1)
|
||||
|
||||
def test_set_vthreshold(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setDac')
|
||||
d.vthreshold = 1675
|
||||
m.assert_called_once_with('vthreshold', -1, 1675)
|
||||
def test_counters_multi(d, mocker):
|
||||
m = mocker.patch('sls_detector.Detector.getCounterMask')
|
||||
m.return_value = [7, 9]
|
||||
assert(d.counters == [[0,1,2],[0,3]])
|
||||
|
||||
def test_set_counters_single(d, mocker):
|
||||
m = mocker.patch('sls_detector.Detector.setCounterMask')
|
||||
d.counters = [0,2]
|
||||
m.assert_called_once_with(5)
|
||||
|
||||
|
||||
|
||||
# def test_busy_call(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getAcquiringFlag')
|
||||
# m.return_value = False
|
||||
# assert d.busy == False
|
||||
|
||||
# def test_set_busy(d):
|
||||
# d.busy = True
|
||||
# assert d.busy == True
|
||||
# assert d._api.getAcquiringFlag() == True
|
||||
# d.busy = False
|
||||
# assert d.busy == False
|
||||
# assert d._api.getAcquiringFlag() == False
|
||||
|
||||
# def test_error_mask(d):
|
||||
# d._api.setErrorMask(1)
|
||||
# assert d.error_mask == 1
|
||||
# d.clear_errors()
|
||||
|
||||
# def test_error_handling(d):
|
||||
# with pytest.raises(DetectorError):
|
||||
# d._provoke_error()
|
||||
|
||||
# def test_assign_to_detector_type(d):
|
||||
# with pytest.raises(AttributeError):
|
||||
# d.detector_type = 'Eiger'
|
||||
|
||||
# def test_det_type(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getDetectorType')
|
||||
# m.return_value = 'Eiger'
|
||||
# assert d.detector_type == 'Eiger'
|
||||
|
||||
|
||||
# def test_get_exposure_time(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getExposureTime')
|
||||
# m.return_value = 100000000
|
||||
# assert d.exposure_time == 0.1
|
||||
|
||||
# def test_set_exposure_time(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setExposureTime')
|
||||
# d.exposure_time = 1.5
|
||||
# m.assert_called_once_with(1500000000)
|
||||
|
||||
# def test_set_exposure_time_less_than_zero(d, mocker):
|
||||
# mocker.patch('_slsdet.DetectorApi.setExposureTime')
|
||||
# with pytest.raises(DetectorValueError):
|
||||
# d.exposure_time = -7
|
||||
|
||||
|
||||
# def test_get_file_index(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getFileIndex')
|
||||
# m.return_value = 8
|
||||
# assert d.file_index == 8
|
||||
|
||||
# def test_set_file_index(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setFileIndex')
|
||||
# d.file_index = 9
|
||||
# m.assert_called_with(9)
|
||||
|
||||
|
||||
# def file_index_with_no_detector(d):
|
||||
# assert d.file_index == -100
|
||||
|
||||
# def dr_with_no_detector(d):
|
||||
# assert d.dynamic_range == -100
|
||||
|
||||
# def test_set_file_index_raises_on_neg(d, mocker):
|
||||
# mocker.patch('_slsdet.DetectorApi.setFileIndex')
|
||||
# with pytest.raises(ValueError):
|
||||
# d.file_index = -9
|
||||
|
||||
|
||||
# def test_get_file_name(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getFileName')
|
||||
# d.file_name
|
||||
# m.assert_called_once_with()
|
||||
|
||||
# def test_set_file_name(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setFileName')
|
||||
# d.file_name = 'hej'
|
||||
# m.assert_called_once_with('hej')
|
||||
|
||||
# def test_get_file_path(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getFilePath')
|
||||
# d.file_path
|
||||
# m.assert_called_once_with()
|
||||
|
||||
# def test_set_file_path_when_path_exists(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setFilePath')
|
||||
# #To avoid raising an exception because path is not there
|
||||
# mock_os = mocker.patch('os.path.exists')
|
||||
# mock_os.return_value = True
|
||||
# d.file_path = '/path/to/something/'
|
||||
# m.assert_called_once_with('/path/to/something/')
|
||||
|
||||
# def test_set_file_path_raises_when_not_exists(d, mocker):
|
||||
# mocker.patch('_slsdet.DetectorApi.setFilePath')
|
||||
# mock_os = mocker.patch('os.path.exists')
|
||||
# mock_os.return_value = False
|
||||
# with pytest.raises(FileNotFoundError):
|
||||
# d.file_path = '/path/to/something/'
|
||||
|
||||
# def test_get_file_write(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getFileWrite')
|
||||
# m.return_value = False
|
||||
# assert d.file_write == False
|
||||
|
||||
# def test_set_file_write(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setFileWrite')
|
||||
# d.file_write = True
|
||||
# m.assert_called_once_with(True)
|
||||
|
||||
|
||||
# def test_get_firmware_version(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getFirmwareVersion')
|
||||
# m.return_value = 20
|
||||
# assert d.firmware_version == 20
|
||||
|
||||
# def test_cannot_set_fw_version(d):
|
||||
# with pytest.raises(AttributeError):
|
||||
# d.firmware_version = 20
|
||||
|
||||
# def test_get_high_voltage_call_signature(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||
# d.high_voltage
|
||||
# m.assert_called_once_with('vhighvoltage', -1)
|
||||
|
||||
# def test_get_high_voltage(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||
# m.return_value = 80
|
||||
# assert d.high_voltage == 80
|
||||
|
||||
# #self._api.setDac('vhighvoltage', -1, voltage)
|
||||
# def test_set_high_voltage(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setDac')
|
||||
# d.high_voltage = 80
|
||||
# m.assert_called_once_with('vhighvoltage', -1, 80)
|
||||
|
||||
# def test_decode_hostname_two_names(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getHostname')
|
||||
# m.return_value = 'beb059+beb048+'
|
||||
# assert d.hostname == ['beb059', 'beb048']
|
||||
|
||||
# def test_decode_hostname_four_names(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getHostname')
|
||||
# m.return_value = 'beb059+beb048+beb120+beb153+'
|
||||
# assert d.hostname == ['beb059', 'beb048', 'beb120', 'beb153']
|
||||
|
||||
# def test_decode_hostname_blank(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getHostname')
|
||||
# m.return_value = ''
|
||||
# assert d.hostname == []
|
||||
|
||||
# def test_get_image_size_gives_correct_size(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getImageSize')
|
||||
# m.return_value = (512,1024)
|
||||
# im_size = d.image_size
|
||||
# assert im_size.rows == 512
|
||||
# assert im_size.cols == 1024
|
||||
|
||||
|
||||
|
||||
# def test_load_config(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.readConfigurationFile')
|
||||
# #To avoid raising an exception because path is not there
|
||||
# mock_os = mocker.patch('os.path.isfile')
|
||||
# mock_os.return_value = True
|
||||
# d.load_config('/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):
|
||||
# mocker.patch('_slsdet.DetectorApi.readConfigurationFile')
|
||||
# mock_os = mocker.patch('os.path.isfile')
|
||||
# mock_os.return_value = False
|
||||
# with pytest.raises(FileNotFoundError):
|
||||
# d.load_config('/path/to/my/file.config')
|
||||
|
||||
# def test_load_parameters(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.readParametersFile')
|
||||
# #To avoid raising an exception because path is not there
|
||||
# mock_os = mocker.patch('os.path.isfile')
|
||||
# mock_os.return_value = True
|
||||
# d.load_parameters('/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):
|
||||
# mocker.patch('_slsdet.DetectorApi.readParametersFile')
|
||||
# mock_os = mocker.patch('os.path.isfile')
|
||||
# mock_os.return_value = False
|
||||
# with pytest.raises(FileNotFoundError):
|
||||
# d.load_parameters('/path/to/my/file.par')
|
||||
|
||||
# #getDetectorGeometry
|
||||
# def test_get_module_geometry_gives_correct_size(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getDetectorGeometry')
|
||||
# m.return_value = (13,7)
|
||||
# g = d.module_geometry
|
||||
# assert g.vertical == 7
|
||||
# assert g.horizontal == 13
|
||||
|
||||
# def test_get_module_geometry_access(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getDetectorGeometry')
|
||||
# m.return_value = (12,3)
|
||||
# assert d.module_geometry[0] == 12
|
||||
# assert d.module_geometry[1] == 3
|
||||
# assert d.module_geometry.vertical == 3
|
||||
# assert d.module_geometry.horizontal == 12
|
||||
|
||||
# def test_module_geometry_without_detectors(d):
|
||||
# t = d.module_geometry
|
||||
# assert t.horizontal == 0
|
||||
# assert t.vertical == 0
|
||||
|
||||
# def test_get_n_frames(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getNumberOfFrames')
|
||||
# m.return_value = 3
|
||||
# assert d.n_frames == 3
|
||||
|
||||
# def test_set_n_frames(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
|
||||
# d.n_frames = 9
|
||||
# m.assert_called_once_with(9)
|
||||
|
||||
# def test_nframes_without_detector(d):
|
||||
# assert d.n_frames == -100
|
||||
|
||||
# def test_set_n_frames_raises_on_neg(d, mocker):
|
||||
# mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
|
||||
# with pytest.raises(DetectorValueError):
|
||||
# d.n_frames = -1
|
||||
|
||||
# def test_set_n_frames_raises_on_zero(d, mocker):
|
||||
# mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
|
||||
# with pytest.raises(DetectorValueError):
|
||||
# d.n_frames = 0
|
||||
|
||||
# def test_n_cycles_without_detector(d):
|
||||
# assert d.n_cycles == -100
|
||||
|
||||
# def test_set_n_cycles_raises_on_zero(d, mocker):
|
||||
# mocker.patch('_slsdet.DetectorApi.setCycles')
|
||||
# with pytest.raises(DetectorValueError):
|
||||
# d.n_cycles = 0
|
||||
|
||||
# def test_set_n_cycles(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setCycles')
|
||||
# d.n_cycles = 56
|
||||
# m.assert_called_once_with(56)
|
||||
|
||||
|
||||
|
||||
# def test_n_measurements_without_detector(d):
|
||||
# assert d.n_measurements == -100
|
||||
|
||||
# def test_set_n_measurements_raises_on_zero(d, mocker):
|
||||
# mocker.patch('_slsdet.DetectorApi.setNumberOfMeasurements')
|
||||
# with pytest.raises(DetectorValueError):
|
||||
# d.n_measurements = 0
|
||||
|
||||
# def test_set_n_measurements(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setNumberOfMeasurements')
|
||||
# d.n_measurements = 560
|
||||
# m.assert_called_once_with(560)
|
||||
|
||||
# def test_get_n_modules_no_detector(d):
|
||||
# assert d.n_modules == 0
|
||||
|
||||
# def test_get_n_modules(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
|
||||
# m.return_value = 12
|
||||
# assert d.n_modules == 12
|
||||
|
||||
# def test_get_period_time(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getPeriod')
|
||||
# m.return_value = 130000000
|
||||
# assert d.period == 0.13
|
||||
|
||||
# def test_set_period_time(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setPeriod')
|
||||
# d.period = 1.953
|
||||
# m.assert_called_once_with(1953000000)
|
||||
|
||||
# def test_set_period_time_less_than_zero(d, mocker):
|
||||
# mocker.patch('_slsdet.DetectorApi.setPeriod')
|
||||
# with pytest.raises(ValueError):
|
||||
# d.period = -7
|
||||
|
||||
|
||||
# def test_get_online(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getOnline')
|
||||
# d.online
|
||||
# m.assert_called_once_with()
|
||||
|
||||
# def test_set_online(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setOnline')
|
||||
# d.online = True
|
||||
# m.assert_called_once_with(True)
|
||||
|
||||
# def test_last_client_ip_no_detector(d):
|
||||
# assert d.last_client_ip == ''
|
||||
|
||||
# def test_last_cliten_ip_call(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getLastClientIP')
|
||||
# d.last_client_ip
|
||||
# m.assert_called_once_with()
|
||||
|
||||
# #-------------------------------------------------------------Rate correction
|
||||
# def test_get_rate_correction(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getRateCorrection')
|
||||
# m.return_value = [132,129]
|
||||
# assert d.rate_correction == [132,129]
|
||||
|
||||
# def test_set_rate_correction(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setRateCorrection')
|
||||
# mock_n = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
|
||||
# mock_n.return_value = 3
|
||||
# d.rate_correction = [123,90,50]
|
||||
# m.assert_called_once_with([123,90,50])
|
||||
|
||||
# def test_set_rate_correction_raises_on_wrong_number_of_values(d, mocker):
|
||||
# mocker.patch('_slsdet.DetectorApi.setRateCorrection')
|
||||
# mock_n = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
|
||||
# mock_n.return_value = 4
|
||||
# with pytest.raises(ValueError):
|
||||
# d.rate_correction = [123,90,50]
|
||||
|
||||
# #----------------------------------------------------------------Readout clock
|
||||
# def test_get_readout_clock_0(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||
# m.return_value = 0
|
||||
# assert d.readout_clock == 'Full Speed'
|
||||
|
||||
# def test_get_readout_clock_1(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||
# m.return_value = 1
|
||||
# assert d.readout_clock == 'Half Speed'
|
||||
|
||||
# def test_get_readout_clock_2(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||
# m.return_value = 2
|
||||
# assert d.readout_clock == 'Quarter Speed'
|
||||
|
||||
# def test_get_readout_clock_3(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||
# m.return_value = 3
|
||||
# assert d.readout_clock == 'Super Slow Speed'
|
||||
|
||||
# def test_set_readout_clock_0(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||
# d.readout_clock = 'Full Speed'
|
||||
# m.assert_called_once_with(0)
|
||||
|
||||
# def test_set_readout_clock_1(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||
# d.readout_clock = 'Half Speed'
|
||||
# m.assert_called_once_with(1)
|
||||
|
||||
# def test_set_readout_clock_2(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||
# d.readout_clock = 'Quarter Speed'
|
||||
# m.assert_called_once_with(2)
|
||||
|
||||
# def test_set_readout_clock_3(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||
# d.readout_clock = 'Super Slow Speed'
|
||||
# m.assert_called_once_with(3)
|
||||
|
||||
# #----------------------------------------------------------------rx_datastream
|
||||
# def test_get_rx_datastream(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getRxDataStreamStatus')
|
||||
# m.return_value = False
|
||||
# assert d.rx_datastream == False
|
||||
|
||||
# def test_set_rx_datastream(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setRxDataStreamStatus')
|
||||
# d.rx_datastream = True
|
||||
# m.assert_called_once_with(True)
|
||||
|
||||
# def test_get_rx_zmqip(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||
# d.rx_zmqip
|
||||
# m.assert_called_once_with('rx_zmqip')
|
||||
|
||||
# def test_get_rx_zmqport_call(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||
# d.rx_zmqport
|
||||
# m.assert_called_once_with('rx_zmqport')
|
||||
|
||||
# def test_get_rx_zmqport_decode(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||
# m.return_value = ['30001', '30003']
|
||||
# assert d.rx_zmqport == [30001, 30003]
|
||||
|
||||
# def test_get_rx_zmqport_empty(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||
# m.return_value = ''
|
||||
# assert d.rx_zmqport == []
|
||||
|
||||
|
||||
# #--------------------------------------------------------------------status
|
||||
# def test_status_call(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getRunStatus')
|
||||
# d.status
|
||||
# m.assert_called_once_with()
|
||||
|
||||
# def test_start_detecor(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.startAcquisition')
|
||||
# d.start_detector()
|
||||
# m.assert_called_once_with()
|
||||
|
||||
# def test_stop_acq_call(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.stopAcquisition')
|
||||
# d.stop_detector()
|
||||
# m.assert_called_once_with()
|
||||
|
||||
|
||||
|
||||
# #------------------------------------------------------------------timing mode
|
||||
# def test_get_timing_mode(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getTimingMode')
|
||||
# d.timing_mode
|
||||
# m.assert_called_once_with()
|
||||
|
||||
# def test_set_timing_mode(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setTimingMode')
|
||||
# d.timing_mode = 'auto'
|
||||
# m.assert_called_once_with('auto')
|
||||
|
||||
# #----------------------------------------------------------------vthreshold
|
||||
# def test_get_vthreshold(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||
# d.vthreshold
|
||||
# m.assert_called_once_with('vthreshold', -1)
|
||||
|
||||
# def test_set_vthreshold(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setDac')
|
||||
# d.vthreshold = 1675
|
||||
# m.assert_called_once_with('vthreshold', -1, 1675)
|
||||
|
||||
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Testing parameters and methods of the Detector class using mocks
|
||||
Testing functions from utils.py
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from sls_detector.utils import eiger_register_to_time
|
||||
from sls_detector.utils import all_equal, element_if_equal
|
||||
from sls_detector.utils import *
|
||||
|
||||
|
||||
def test_convert_zero():
|
||||
assert eiger_register_to_time(0) == 0
|
||||
@ -47,4 +47,16 @@ def test_element_if_equal_str():
|
||||
assert element_if_equal('hhh') == 'h'
|
||||
|
||||
def test_element_if_equal_int_fails():
|
||||
assert element_if_equal([5, 6, 7]) == [5, 6, 7]
|
||||
assert element_if_equal([5, 6, 7]) == [5, 6, 7]
|
||||
|
||||
def test_get_set_bits():
|
||||
assert(get_set_bits(0) == [])
|
||||
assert get_set_bits(7) == [0, 1, 2]
|
||||
|
||||
def test_list_to_mask():
|
||||
assert(list_to_bitmask([0,1,2]) == 7)
|
||||
assert(list_to_bitmask([]) == 0)
|
||||
assert(list_to_bitmask([0]) == 1)
|
||||
assert(list_to_bitmask([1]) == 2)
|
||||
assert(list_to_bitmask([3]) == 8)
|
||||
assert(list_to_bitmask([1,1,1]) == 2)
|
@ -18,4 +18,19 @@ target_link_libraries(result
|
||||
|
||||
set_target_properties(result PROPERTIES
|
||||
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 "analogDetector.h"
|
||||
#include "circularFifo.h"
|
||||
#include "CircularFifo.h"
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -1,5 +1,8 @@
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
find_package(PNG REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
set(SOURCES
|
||||
slsDetectorPlotting/src/SlsQt1DPlot.cxx
|
||||
slsDetectorPlotting/src/SlsQt1DZoomer.cxx
|
||||
@ -89,8 +92,8 @@ target_link_libraries(slsDetectorGui PUBLIC
|
||||
${QT_QTCORE_LIBRARIES}
|
||||
${QT_QTGUI_LIBRARIES}
|
||||
${QWT_LIBRARIES}
|
||||
png
|
||||
z
|
||||
PNG::PNG
|
||||
ZLIB::ZLIB
|
||||
Qt4::QtOpenGL
|
||||
Qt4::QtSvg
|
||||
)
|
||||
|
@ -160,4 +160,5 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
unsigned int nPixelsY{0};
|
||||
const static int npixelsx_jctb = 400;
|
||||
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::MOENCH:
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
break;
|
||||
default:
|
||||
std::ostringstream os;
|
||||
@ -446,7 +447,7 @@ void qDetectorMain::ExecuteHelp(QAction *action) {
|
||||
clientVersion +
|
||||
"<br><br>"
|
||||
"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 "
|
||||
"line interface:<br>"
|
||||
"sls_detector_put,<br>sls_detector_get,<br>sls_"
|
||||
|
@ -52,6 +52,19 @@ qDrawPlot::~qDrawPlot() {
|
||||
|
||||
void qDrawPlot::SetupWidgetWindow() {
|
||||
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
|
||||
try {
|
||||
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;
|
||||
if (enable) {
|
||||
isPlot = true;
|
||||
det->setRxZmqDataStream(true);
|
||||
det->registerDataCallback(&(GetDataCallBack), this);
|
||||
} else {
|
||||
isPlot = false;
|
||||
det->setRxZmqDataStream(false);
|
||||
det->registerDataCallback(nullptr, this);
|
||||
}
|
||||
|
||||
@ -879,7 +894,7 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int data
|
||||
int halfbyte = 0;
|
||||
char cbyte = '\0';
|
||||
|
||||
// mythen 3 debugging
|
||||
// mythen3 / gotthard2 debugging
|
||||
int discardBits = numDiscardBits;
|
||||
|
||||
switch (dr) {
|
||||
@ -903,14 +918,15 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int data
|
||||
|
||||
case 16:
|
||||
if (detType == slsDetectorDefs::JUNGFRAU ||
|
||||
detType == slsDetectorDefs::MOENCH) {
|
||||
detType == slsDetectorDefs::MOENCH ||
|
||||
detType == slsDetectorDefs::GOTTHARD2) {
|
||||
|
||||
// show gain plot
|
||||
if (gaindest != NULL) {
|
||||
for (ichan = 0; ichan < size; ++ichan) {
|
||||
uint16_t temp = (*((u_int16_t *)source));
|
||||
gaindest[ichan] = ((temp & 0xC000) >> 14);
|
||||
dest[ichan] = (temp & 0x3FFF);
|
||||
dest[ichan] = (temp & pixelMask);
|
||||
source += 2;
|
||||
}
|
||||
}
|
||||
@ -918,7 +934,7 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int data
|
||||
// only data plot
|
||||
else {
|
||||
for (ichan = 0; ichan < size; ++ichan) {
|
||||
dest[ichan] = ((*((u_int16_t *)source)) & 0x3FFF);
|
||||
dest[ichan] = ((*((u_int16_t *)source)) & pixelMask);
|
||||
source += 2;
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ void qTabAdvanced::SetupWidgetWindow() {
|
||||
tab_roi->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
lblDiscardBits->setEnabled(true);
|
||||
spinDiscardBits->setEnabled(true);
|
||||
default:
|
||||
@ -361,7 +362,7 @@ void qTabAdvanced::SetDetectorUDPIP() {
|
||||
std::string s = dispDetectorUDPIP->text().toAscii().constData();
|
||||
FILE_LOG(logINFO) << "Setting Detector UDP IP:" << s;
|
||||
try {
|
||||
det->setSourceUDPIP(s, {comboDetector->currentIndex()});
|
||||
det->setSourceUDPIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Detector UDP IP.",
|
||||
"qTabAdvanced::SetDetectorUDPIP", this,
|
||||
&qTabAdvanced::GetDetectorUDPIP)
|
||||
@ -371,7 +372,7 @@ void qTabAdvanced::SetDetectorUDPMAC() {
|
||||
std::string s = dispDetectorUDPMAC->text().toAscii().constData();
|
||||
FILE_LOG(logINFO) << "Setting Detector UDP MAC:" << s;
|
||||
try {
|
||||
det->setSourceUDPMAC(s, {comboDetector->currentIndex()});
|
||||
det->setSourceUDPMAC(sls::MacAddr{s}, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Detector UDP MAC.",
|
||||
"qTabAdvanced::SetDetectorUDPMAC", this,
|
||||
&qTabAdvanced::GetDetectorUDPMAC)
|
||||
@ -390,7 +391,7 @@ void qTabAdvanced::SetCltZMQIP() {
|
||||
std::string s = dispZMQIP->text().toAscii().constData();
|
||||
FILE_LOG(logINFO) << "Setting Client ZMQ IP:" << s;
|
||||
try {
|
||||
det->setClientZmqIp(s, {comboDetector->currentIndex()});
|
||||
det->setClientZmqIp(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Client ZMQ IP.",
|
||||
"qTabAdvanced::SetCltZMQIP", this,
|
||||
&qTabAdvanced::GetCltZMQIP)
|
||||
@ -431,7 +432,7 @@ void qTabAdvanced::SetRxrUDPIP() {
|
||||
std::string s = dispRxrUDPIP->text().toAscii().constData();
|
||||
FILE_LOG(logINFO) << "Setting Receiver UDP IP:" << s;
|
||||
try {
|
||||
det->setDestinationUDPIP(s, {comboDetector->currentIndex()});
|
||||
det->setDestinationUDPIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Receiver UDP IP.",
|
||||
"qTabAdvanced::SetRxrUDPIP", this,
|
||||
&qTabAdvanced::GetRxrUDPIP)
|
||||
@ -441,7 +442,7 @@ void qTabAdvanced::SetRxrUDPMAC() {
|
||||
std::string s = dispRxrUDPMAC->text().toAscii().constData();
|
||||
FILE_LOG(logINFO) << "Setting Receiver UDP MAC:" << s;
|
||||
try {
|
||||
det->setDestinationUDPMAC(s, {comboDetector->currentIndex()});
|
||||
det->setDestinationUDPMAC(sls::MacAddr{s}, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Receiver UDP MAC.",
|
||||
"qTabAdvanced::SetRxrUDPMAC", this,
|
||||
&qTabAdvanced::GetRxrUDPMAC)
|
||||
@ -460,7 +461,7 @@ void qTabAdvanced::SetRxrZMQIP() {
|
||||
std::string s = dispRxrZMQIP->text().toAscii().constData();
|
||||
FILE_LOG(logINFO) << "Setting Receiver ZMQ IP:" << s;
|
||||
try {
|
||||
det->setRxZmqIP(s, {comboDetector->currentIndex()});
|
||||
det->setRxZmqIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Receiver ZMQ IP.",
|
||||
"qTabAdvanced::SetRxrZMQIP", this,
|
||||
&qTabAdvanced::GetRxrZMQIP)
|
||||
|
@ -112,7 +112,27 @@ void qTabDeveloper::SetupWidgetWindow() {
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vpl: ", 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++)));
|
||||
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:
|
||||
break;
|
||||
}
|
||||
@ -367,6 +387,41 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorTy
|
||||
}
|
||||
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:
|
||||
throw sls::RuntimeError(std::string("Unknown detector type"));
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ void qTabPlot::SetupWidgetWindow() {
|
||||
switch(det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
is1d = true;
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
|
@ -83,6 +83,11 @@ void qTabSettings::SetupDetectorSettings() {
|
||||
item[(int)FORCESWITCHG1]->setEnabled(true);
|
||||
item[(int)FORCESWITCHG2]->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
item[(int)DYNAMICGAIN]->setEnabled(true);
|
||||
item[(int)FIXGAIN1]->setEnabled(true);
|
||||
item[(int)FIXGAIN2]->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
FILE_LOG(logDEBUG) << "Unknown detector type. Exiting GUI.";
|
||||
qDefs::Message(qDefs::CRITICAL,
|
||||
|
@ -15,7 +15,7 @@ add_executable(ctbDetectorServer_virtual
|
||||
../slsDetectorServer/src/INA226.c
|
||||
../slsDetectorServer/src/LTC2620.c
|
||||
../slsDetectorServer/src/MAX1932.c
|
||||
../slsDetectorServer/src/programfpga.c
|
||||
../slsDetectorServer/src/programFpgaBlackfin.c
|
||||
)
|
||||
|
||||
include_directories(
|
||||
|
@ -12,7 +12,7 @@ DESTDIR ?= bin
|
||||
INSTMODE = 0777
|
||||
|
||||
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)
|
||||
|
||||
|
@ -497,14 +497,14 @@
|
||||
#define PATTERN_WAIT_TIMER_2_LSB_REG (0x76 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_WAIT_TIMER_2_MSB_REG (0x77 << MEM_MAP_SHIFT)
|
||||
|
||||
/* ADC Disable RW register TODO */
|
||||
#define ADC_DISABLE_REG (0x78 << MEM_MAP_SHIFT)
|
||||
/* Readout enable RW register */
|
||||
#define READOUT_10G_ENABLE_REG (0x79 << MEM_MAP_SHIFT)
|
||||
|
||||
/* DAC Value RW register TODO */
|
||||
//#define DAC_VALUE_REG (0x79 << MEM_MAP_SHIFT)
|
||||
#define READOUT_10G_ENABLE_ANLG_OFST (0)
|
||||
#define READOUT_10G_ENABLE_ANLG_MSK (0x000000FF << READOUT_10G_ENABLE_ANLG_OFST)
|
||||
#define READOUT_10G_ENABLE_DGTL_OFST (8)
|
||||
#define READOUT_10G_ENABLE_DGTL_MSK (0x00000001 << READOUT_10G_ENABLE_DGTL_OFST)
|
||||
|
||||
/* DAC Number RW register TODO */
|
||||
//#define DAC_NUMBER_REG (0x7A << MEM_MAP_SHIFT)
|
||||
|
||||
/* Digital Bit External Trigger RW register */
|
||||
#define DBIT_EXT_TRG_REG (0x7B << MEM_MAP_SHIFT)
|
||||
@ -548,9 +548,8 @@
|
||||
#define I2C_SDA_HOLD_REG (0x10A << MEM_MAP_SHIFT)
|
||||
//fixme: upto 0x10f
|
||||
|
||||
|
||||
|
||||
|
||||
/* Round Robin */
|
||||
#define RXR_ENDPOINT_START_REG (0x1000 << MEM_MAP_SHIFT)
|
||||
|
||||
|
||||
|
||||
|
Binary file not shown.
@ -12,9 +12,6 @@
|
||||
#include "INA226.h" // i2c
|
||||
#include "ALTERA_PLL.h" // pll
|
||||
#include "blackfin.h"
|
||||
#ifndef VIRTUAL
|
||||
#include "programfpga.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h> // usleep
|
||||
@ -41,6 +38,7 @@ int virtual_status = 0;
|
||||
int virtual_stop = 0;
|
||||
#endif
|
||||
|
||||
// 1g readout
|
||||
int dataBytes = 0;
|
||||
int analogDataBytes = 0;
|
||||
int digitalDataBytes = 0;
|
||||
@ -48,18 +46,19 @@ char* analogData = 0;
|
||||
char* digitalData = 0;
|
||||
char volatile *analogDataPtr = 0;
|
||||
char volatile *digitalDataPtr = 0;
|
||||
|
||||
char udpPacketData[UDP_PACKET_DATA_BYTES + sizeof(sls_detector_header)];
|
||||
uint32_t adcEnableMask_1g = 0;
|
||||
|
||||
int32_t clkPhase[NUM_CLOCKS] = {0, 0, 0, 0};
|
||||
// 10g readout
|
||||
uint8_t adcEnableMask_10g = 0;
|
||||
|
||||
|
||||
int32_t clkPhase[NUM_CLOCKS] = {};
|
||||
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
|
||||
int vLimit = 0;
|
||||
|
||||
int highvoltage = 0;
|
||||
uint32_t adcEnableMask = 0;
|
||||
int analogEnable = 1;
|
||||
int digitalEnable = 0;
|
||||
int naSamples = 1;
|
||||
@ -459,7 +458,8 @@ void setupDetector() {
|
||||
}
|
||||
vLimit = DEFAULT_VLIMIT;
|
||||
highvoltage = 0;
|
||||
adcEnableMask = BIT_32_MSK;
|
||||
adcEnableMask_1g = 0;
|
||||
adcEnableMask_10g = 0;
|
||||
analogEnable = 1;
|
||||
digitalEnable = 0;
|
||||
naSamples = 1;
|
||||
@ -533,22 +533,22 @@ void setupDetector() {
|
||||
setPeriod(DEFAULT_PERIOD);
|
||||
setDelayAfterTrigger(DEFAULT_DELAY);
|
||||
setTiming(DEFAULT_TIMING_MODE);
|
||||
setReadoutMode(ANALOG_ONLY);
|
||||
|
||||
// enable all ADC channels
|
||||
setADCEnableMask(BIT_32_MSK);
|
||||
setADCEnableMask(BIT32_MSK);
|
||||
setADCEnableMask_10G(BIT32_MSK);
|
||||
if (setReadoutMode(ANALOG_ONLY) == FAIL) {
|
||||
strcpy(initErrorMessage,
|
||||
"Could not set readout mode to analog only.\n");
|
||||
FILE_LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
initError = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
int allocateRAM() {
|
||||
int updateDatabytesandAllocateRAM() {
|
||||
|
||||
int oldAnalogDataBytes = analogDataBytes;
|
||||
int oldDigitalDataBytes = digitalDataBytes;
|
||||
updateDataBytes();
|
||||
|
||||
// only allcoate RAM for 1 giga udp (if 10G, return)
|
||||
if (enableTenGigabitEthernet(-1))
|
||||
return OK;
|
||||
|
||||
|
||||
// update only if change in databytes
|
||||
if (analogDataBytes == oldAnalogDataBytes && digitalDataBytes == oldDigitalDataBytes) {
|
||||
FILE_LOG(logDEBUG1, ("RAM size (Analog:%d, Digital:%d) already allocated. Nothing to be done.\n",
|
||||
@ -602,12 +602,12 @@ void updateDataBytes() {
|
||||
|
||||
// analog
|
||||
if (analogEnable) {
|
||||
if (adcEnableMask == BIT_32_MSK)
|
||||
if (adcEnableMask_1g == BIT32_MSK)
|
||||
nachans = 32;
|
||||
else {
|
||||
int ichan = 0;
|
||||
for (ichan = 0; ichan < NCHAN_ANALOG; ++ichan) {
|
||||
if (adcEnableMask & (1 << ichan))
|
||||
if (adcEnableMask_1g & (1 << ichan))
|
||||
++nachans;
|
||||
}
|
||||
}
|
||||
@ -666,23 +666,72 @@ int setDynamicRange(int dr){
|
||||
}
|
||||
|
||||
int setADCEnableMask(uint32_t mask) {
|
||||
FILE_LOG(logINFO, ("Setting adcEnableMask to 0x%08x\n", mask));
|
||||
adcEnableMask = mask;
|
||||
|
||||
// get disable mask
|
||||
mask ^= BIT_32_MSK;
|
||||
bus_w(ADC_DISABLE_REG, mask);
|
||||
|
||||
// update databytes and allocate ram
|
||||
return allocateRAM();
|
||||
if (mask == 0u) {
|
||||
FILE_LOG(logERROR, ("Cannot set 1gb adc mask to 0\n"));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting adcEnableMask 1G to 0x%08x\n", mask));
|
||||
adcEnableMask_1g = mask;
|
||||
// 1Gb enabled
|
||||
if (!enableTenGigabitEthernet(-1)) {
|
||||
if (updateDatabytesandAllocateRAM() == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
uint32_t getADCEnableMask() {
|
||||
uint32_t retval = bus_r(ADC_DISABLE_REG);
|
||||
return adcEnableMask_1g;
|
||||
}
|
||||
|
||||
// get enable mask
|
||||
retval ^= BIT_32_MSK;
|
||||
adcEnableMask = retval;
|
||||
void setADCEnableMask_10G(uint32_t mask) {
|
||||
if (mask == 0u) {
|
||||
FILE_LOG(logERROR, ("Cannot set 10gb adc mask to 0\n"));
|
||||
return;
|
||||
}
|
||||
// convert 32 bit mask to 8 bit mask
|
||||
uint8_t actualMask = 0;
|
||||
if (mask != 0) {
|
||||
int ival = 0;
|
||||
int ich = 0;
|
||||
for (ich = 0; ich < NCHAN_ANALOG; ich = ich + 4) {
|
||||
if ((1 << ich) & mask) {
|
||||
actualMask |= (1 << ival);
|
||||
}
|
||||
++ival;
|
||||
}
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO, ("Setting adcEnableMask 10G to 0x%x (from 0x%08x)\n", actualMask, mask));
|
||||
adcEnableMask_10g = actualMask;
|
||||
if (analogEnable) {
|
||||
uint32_t addr = READOUT_10G_ENABLE_REG;
|
||||
bus_w(addr, bus_r(addr) & (~READOUT_10G_ENABLE_ANLG_MSK));
|
||||
bus_w(addr, bus_r(addr) | ((adcEnableMask_10g << READOUT_10G_ENABLE_ANLG_OFST) & READOUT_10G_ENABLE_ANLG_MSK));
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t getADCEnableMask_10G() {
|
||||
if (analogEnable) {
|
||||
adcEnableMask_10g = ((bus_r(READOUT_10G_ENABLE_REG) & READOUT_10G_ENABLE_ANLG_MSK) >> READOUT_10G_ENABLE_ANLG_OFST);
|
||||
}
|
||||
|
||||
// convert 8 bit mask to 32 bit mask
|
||||
uint32_t retval = 0;
|
||||
if (adcEnableMask_10g) {
|
||||
int ival = 0;
|
||||
int iloop = 0;
|
||||
for (ival = 0; ival < 8; ++ival) {
|
||||
// if bit in 8 bit mask set
|
||||
if ((1 << ival) & adcEnableMask_10g) {
|
||||
// set it for 4 bits in 32 bit mask
|
||||
for (iloop = 0; iloop < 4; ++iloop) {
|
||||
retval |= (1 << (ival * 4 + iloop));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -722,31 +771,61 @@ int setExternalSampling(int val) {
|
||||
/* parameters - readout */
|
||||
|
||||
int setReadoutMode(enum readoutMode mode) {
|
||||
uint32_t addr = CONFIG_REG;
|
||||
analogEnable = 0;
|
||||
digitalEnable = 0;
|
||||
switch(mode) {
|
||||
case ANALOG_ONLY:
|
||||
FILE_LOG(logINFO, ("Setting Analog Only Readout\n"));
|
||||
bus_w(addr, bus_r(addr) & (~CONFIG_DSBL_ANLG_OTPT_MSK) & (~CONFIG_ENBLE_DGTL_OTPT_MSK));
|
||||
analogEnable = 1;
|
||||
break;
|
||||
case DIGITAL_ONLY:
|
||||
FILE_LOG(logINFO, ("Setting Digital Only Readout\n"));
|
||||
bus_w(addr, bus_r(addr) | CONFIG_DSBL_ANLG_OTPT_MSK | CONFIG_ENBLE_DGTL_OTPT_MSK);
|
||||
digitalEnable = 1;
|
||||
break;
|
||||
case ANALOG_AND_DIGITAL:
|
||||
FILE_LOG(logINFO, ("Setting Analog & Digital Readout\n"));
|
||||
bus_w(addr, (bus_r(addr) & (~CONFIG_DSBL_ANLG_OTPT_MSK)) | CONFIG_ENBLE_DGTL_OTPT_MSK);
|
||||
analogEnable = 1;
|
||||
digitalEnable = 1;
|
||||
break;
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Cannot set unknown readout flag. 0x%x\n", mode));
|
||||
return FAIL;
|
||||
}
|
||||
uint32_t regval = bus_r(addr);
|
||||
analogEnable = (((regval & CONFIG_DSBL_ANLG_OTPT_MSK) >> CONFIG_DSBL_ANLG_OTPT_OFST) ? 0 : 1);
|
||||
digitalEnable = ((regval & CONFIG_ENBLE_DGTL_OTPT_MSK) >> CONFIG_ENBLE_DGTL_OTPT_OFST);
|
||||
|
||||
// update databytes and allocate ram
|
||||
if (allocateRAM() == FAIL) {
|
||||
return FAIL;
|
||||
|
||||
uint32_t addr = CONFIG_REG;
|
||||
uint32_t addr_readout_10g = READOUT_10G_ENABLE_REG;
|
||||
// default: analog only
|
||||
bus_w(addr, bus_r(addr) & (~CONFIG_DSBL_ANLG_OTPT_MSK) & (~CONFIG_ENBLE_DGTL_OTPT_MSK));
|
||||
bus_w(addr_readout_10g, bus_r(addr_readout_10g) & (~READOUT_10G_ENABLE_ANLG_MSK) & ~(READOUT_10G_ENABLE_DGTL_MSK));
|
||||
bus_w(addr_readout_10g, bus_r(addr_readout_10g) | ((adcEnableMask_10g << READOUT_10G_ENABLE_ANLG_OFST) & READOUT_10G_ENABLE_ANLG_MSK));
|
||||
|
||||
// disable analog (digital only)
|
||||
if (!analogEnable) {
|
||||
bus_w(addr, bus_r(addr) | CONFIG_DSBL_ANLG_OTPT_MSK);
|
||||
bus_w(addr_readout_10g, bus_r(addr_readout_10g) & (~READOUT_10G_ENABLE_ANLG_MSK));
|
||||
}
|
||||
// enable digital (analog and digital)
|
||||
if (digitalEnable) {
|
||||
bus_w(addr, bus_r(addr) | CONFIG_ENBLE_DGTL_OTPT_MSK);
|
||||
bus_w(addr_readout_10g, bus_r(addr_readout_10g) | READOUT_10G_ENABLE_DGTL_MSK);
|
||||
}
|
||||
|
||||
|
||||
// 1Gb
|
||||
if (!enableTenGigabitEthernet(-1)) {
|
||||
if (updateDatabytesandAllocateRAM() == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
// 10Gb
|
||||
else {
|
||||
// validate adcenablemask for 10g
|
||||
if (analogEnable && adcEnableMask_10g != ((bus_r(READOUT_10G_ENABLE_REG) & READOUT_10G_ENABLE_ANLG_MSK) >> READOUT_10G_ENABLE_ANLG_OFST)) {
|
||||
FILE_LOG(logERROR, ("Setting readout mode failed. Could not set 10g adc enable mask to 0x%x\n.", adcEnableMask_10g));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
@ -800,8 +879,12 @@ int setNumAnalogSamples(int val) {
|
||||
naSamples = val;
|
||||
bus_w(SAMPLES_REG, bus_r(SAMPLES_REG) &~ SAMPLES_ANALOG_MSK);
|
||||
bus_w(SAMPLES_REG, bus_r(SAMPLES_REG) | ((val << SAMPLES_ANALOG_OFST) & SAMPLES_ANALOG_MSK));
|
||||
if (allocateRAM() == FAIL) {
|
||||
return FAIL;
|
||||
|
||||
// 1Gb
|
||||
if (!enableTenGigabitEthernet(-1)) {
|
||||
if (updateDatabytesandAllocateRAM() == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
@ -819,8 +902,11 @@ int setNumDigitalSamples(int val) {
|
||||
ndSamples = val;
|
||||
bus_w(SAMPLES_REG, bus_r(SAMPLES_REG) &~ SAMPLES_DIGITAL_MSK);
|
||||
bus_w(SAMPLES_REG, bus_r(SAMPLES_REG) | ((val << SAMPLES_DIGITAL_OFST) & SAMPLES_DIGITAL_MSK));
|
||||
if (allocateRAM() == FAIL) {
|
||||
return FAIL;
|
||||
// 1Gb
|
||||
if (!enableTenGigabitEthernet(-1)) {
|
||||
if (updateDatabytesandAllocateRAM() == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
@ -1329,22 +1415,18 @@ int setHighVoltage(int val){
|
||||
|
||||
|
||||
void setTiming( enum timingMode arg){
|
||||
|
||||
if(arg != GET_TIMING_MODE){
|
||||
switch((int)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));
|
||||
return;
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1359,42 +1441,39 @@ enum timingMode getTiming() {
|
||||
/* configure mac */
|
||||
|
||||
|
||||
long int calcChecksum(int sourceip, int destip) {
|
||||
ip_header ip;
|
||||
ip.ip_ver = 0x4;
|
||||
ip.ip_ihl = 0x5;
|
||||
ip.ip_tos = 0x0;
|
||||
ip.ip_len = IP_PACKETSIZE;
|
||||
ip.ip_ident = 0x0000;
|
||||
ip.ip_flag = 0x2; //not nibble aligned (flag& offset
|
||||
ip.ip_offset = 0x000;
|
||||
ip.ip_ttl = 0x40;
|
||||
ip.ip_protocol = 0x11;
|
||||
ip.ip_chksum = 0x0000 ; // pseudo
|
||||
ip.ip_sourceip = sourceip;
|
||||
ip.ip_destip = destip;
|
||||
|
||||
int count = sizeof(ip);
|
||||
|
||||
unsigned short *addr;
|
||||
addr = (unsigned short*) &(ip); /* warning: assignment from incompatible pointer type */
|
||||
|
||||
void calcChecksum(udp_header* udp) {
|
||||
int count = IP_HEADER_SIZE;
|
||||
long int sum = 0;
|
||||
while( count > 1 ) {
|
||||
|
||||
// start at ip_tos as the memory is not continous for ip header
|
||||
uint16_t *addr = (uint16_t*) (&(udp->ip_tos));
|
||||
|
||||
sum += *addr++;
|
||||
count -= 2;
|
||||
|
||||
// ignore ethertype (from udp header)
|
||||
addr++;
|
||||
|
||||
// from identification to srcip_lsb
|
||||
while( count > 2 ) {
|
||||
sum += *addr++;
|
||||
count -= 2;
|
||||
}
|
||||
|
||||
// ignore src udp port (from udp header)
|
||||
addr++;
|
||||
|
||||
if (count > 0)
|
||||
sum += *addr; // Add left-over byte, if any
|
||||
while (sum>>16)
|
||||
while (sum >> 16)
|
||||
sum = (sum & 0xffff) + (sum >> 16);// Fold 32-bit sum to 16 bits
|
||||
long int checksum = (~sum) & 0xffff;
|
||||
FILE_LOG(logINFO, ("IP checksum is 0x%lx\n",checksum));
|
||||
return checksum;
|
||||
long int checksum = sum & 0xffff;
|
||||
checksum += UDP_IP_HEADER_LENGTH_BYTES;
|
||||
FILE_LOG(logINFO, ("\tIP checksum is 0x%lx\n",checksum));
|
||||
udp->ip_checksum = checksum;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int configureMAC(){
|
||||
uint32_t sourceip = udpDetails.srcip;
|
||||
uint32_t destip = udpDetails.dstip;
|
||||
@ -1409,8 +1488,7 @@ int configureMAC(){
|
||||
// 1 giga udp
|
||||
if (!enableTenGigabitEthernet(-1)) {
|
||||
FILE_LOG(logINFOBLUE, ("Configuring 1G MAC\n"));
|
||||
// if it was in 10G mode, it was not allocating RAM
|
||||
if (allocateRAM() == FAIL)
|
||||
if (updateDatabytesandAllocateRAM() == FAIL)
|
||||
return -1;
|
||||
char cDestIp[MAX_STR_LENGTH];
|
||||
memset(cDestIp, 0, MAX_STR_LENGTH);
|
||||
@ -1450,35 +1528,40 @@ int configureMAC(){
|
||||
(long long unsigned int)destmac));
|
||||
FILE_LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n",destport, destport));
|
||||
|
||||
long int checksum=calcChecksum(sourceip, destip);
|
||||
bus_w(TX_IP_REG, sourceip);
|
||||
bus_w(RX_IP_REG, destip);
|
||||
// start addr
|
||||
uint32_t addr = RXR_ENDPOINT_START_REG;
|
||||
// get struct memory
|
||||
udp_header *udp = (udp_header*) (Blackfin_getBaseAddress() + addr / 2);
|
||||
memset(udp, 0, sizeof(udp_header));
|
||||
|
||||
uint32_t val = 0;
|
||||
// mac addresses
|
||||
// msb (32) + lsb (16)
|
||||
udp->udp_destmac_msb = ((destmac >> 16) & BIT32_MASK);
|
||||
udp->udp_destmac_lsb = ((destmac >> 0) & BIT16_MASK);
|
||||
// msb (16) + lsb (32)
|
||||
udp->udp_srcmac_msb = ((sourcemac >> 32) & BIT16_MASK);
|
||||
udp->udp_srcmac_lsb = ((sourcemac >> 0) & BIT32_MASK);
|
||||
|
||||
val = ((sourcemac >> LSB_OF_64_BIT_REG_OFST) & BIT_32_MSK);
|
||||
bus_w(TX_MAC_LSB_REG, val);
|
||||
FILE_LOG(logDEBUG1, ("Read from TX_MAC_LSB_REG: 0x%08x\n", bus_r(TX_MAC_LSB_REG)));
|
||||
// ip addresses
|
||||
udp->ip_srcip_msb = ((sourceip >> 16) & BIT16_MASK);
|
||||
udp->ip_srcip_lsb = ((sourceip >> 0) & BIT16_MASK);
|
||||
udp->ip_destip_msb = ((destip >> 16) & BIT16_MASK);
|
||||
udp->ip_destip_lsb = ((destip >> 0) & BIT16_MASK);
|
||||
|
||||
val = ((sourcemac >> MSB_OF_64_BIT_REG_OFST) & BIT_32_MSK);
|
||||
bus_w(TX_MAC_MSB_REG,val);
|
||||
FILE_LOG(logDEBUG1, ("Read from TX_MAC_MSB_REG: 0x%08x\n", bus_r(TX_MAC_MSB_REG)));
|
||||
// source port
|
||||
udp->udp_srcport = sourceport;
|
||||
udp->udp_destport = destport;
|
||||
|
||||
val = ((destmac >> LSB_OF_64_BIT_REG_OFST) & BIT_32_MSK);
|
||||
bus_w(RX_MAC_LSB_REG, val);
|
||||
FILE_LOG(logDEBUG1, ("Read from RX_MAC_LSB_REG: 0x%08x\n", bus_r(RX_MAC_LSB_REG)));
|
||||
// other defines
|
||||
udp->udp_ethertype = 0x800;
|
||||
udp->ip_ver = 0x4;
|
||||
udp->ip_ihl = 0x5;
|
||||
udp->ip_flags = 0x2; //FIXME
|
||||
udp->ip_ttl = 0x40;
|
||||
udp->ip_protocol = 0x11;
|
||||
// total length is redefined in firmware
|
||||
|
||||
val = ((destmac >> MSB_OF_64_BIT_REG_OFST) & BIT_32_MSK);
|
||||
bus_w(RX_MAC_MSB_REG, val);
|
||||
FILE_LOG(logDEBUG1, ("Read from RX_MAC_MSB_REG: 0x%08x\n", bus_r(RX_MAC_MSB_REG)));
|
||||
|
||||
val = (((sourceport << UDP_PORT_TX_OFST) & UDP_PORT_TX_MSK) |
|
||||
((destport << UDP_PORT_RX_OFST) & UDP_PORT_RX_MSK));
|
||||
bus_w(UDP_PORT_REG, val);
|
||||
FILE_LOG(logDEBUG1, ("Read from UDP_PORT_REG: 0x%08x\n", bus_r(UDP_PORT_REG)));
|
||||
|
||||
bus_w(TX_IP_CHECKSUM_REG,(checksum << TX_IP_CHECKSUM_OFST) & TX_IP_CHECKSUM_MSK);
|
||||
FILE_LOG(logDEBUG1, ("Read from TX_IP_CHECKSUM_REG: 0x%08x\n", bus_r(TX_IP_CHECKSUM_REG)));
|
||||
calcChecksum(udp);
|
||||
|
||||
cleanFifos();//FIXME: resetPerpheral() for ctb?
|
||||
resetPeripheral();
|
||||
@ -2327,7 +2410,7 @@ void readSample(int ns) {
|
||||
for (ich = 0; ich < NCHAN_ANALOG; ++ich) {
|
||||
|
||||
// if channel is in enable mask
|
||||
if ((1 << ich) & (adcEnableMask)) {
|
||||
if ((1 << ich) & (adcEnableMask_1g)) {
|
||||
|
||||
// unselect channel
|
||||
bus_w(addr, bus_r(addr) & ~(DUMMY_FIFO_CHNNL_SLCT_MSK));
|
||||
@ -2469,7 +2552,7 @@ int calculateDataBytes(){
|
||||
return dataBytes;
|
||||
}
|
||||
|
||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerChip() * (int)getNumberOfChips());}
|
||||
int getTotalNumberOfChannels() {return (getNumberOfChannelsPerChip() * getNumberOfChips());}
|
||||
int getNumberOfChips(){return NCHIP;}
|
||||
int getNumberOfDACs(){return NDAC;}
|
||||
int getNumberOfChannelsPerChip(){return NCHAN;}
|
||||
|
@ -4,23 +4,36 @@
|
||||
|
||||
|
||||
#define MIN_REQRD_VRSN_T_RD_API 0x181130
|
||||
#define REQRD_FRMWR_VRSN 0x190821
|
||||
#define REQRD_FRMWR_VRSN 0x191127
|
||||
|
||||
#define CTRL_SRVR_INIT_TIME_US (2 * 1000 * 1000)
|
||||
|
||||
/* Struct Definitions */
|
||||
typedef struct ip_header_struct {
|
||||
uint16_t ip_len;
|
||||
uint8_t ip_tos;
|
||||
uint8_t ip_ihl:4 ,ip_ver:4;
|
||||
uint16_t ip_offset:13,ip_flag:3;
|
||||
uint16_t ip_ident;
|
||||
uint16_t ip_chksum;
|
||||
uint8_t ip_protocol;
|
||||
uint8_t ip_ttl;
|
||||
uint32_t ip_sourceip;
|
||||
uint32_t ip_destip;
|
||||
} ip_header;
|
||||
typedef struct udp_header_struct {
|
||||
uint32_t udp_destmac_msb;
|
||||
uint16_t udp_srcmac_msb;
|
||||
uint16_t udp_destmac_lsb;
|
||||
uint32_t udp_srcmac_lsb;
|
||||
uint8_t ip_tos;
|
||||
uint8_t ip_ihl: 4, ip_ver: 4;
|
||||
uint16_t udp_ethertype;
|
||||
uint16_t ip_identification;
|
||||
uint16_t ip_totallength;
|
||||
uint8_t ip_protocol;
|
||||
uint8_t ip_ttl;
|
||||
uint16_t ip_fragmentoffset: 13, ip_flags: 3;
|
||||
uint16_t ip_srcip_msb;
|
||||
uint16_t ip_checksum;
|
||||
uint16_t ip_destip_msb;
|
||||
uint16_t ip_srcip_lsb;
|
||||
uint16_t udp_srcport;
|
||||
uint16_t ip_destip_lsb;
|
||||
uint16_t udp_checksum;
|
||||
uint16_t udp_destport;
|
||||
} udp_header;
|
||||
|
||||
#define IP_HEADER_SIZE (20)
|
||||
#define UDP_IP_HEADER_LENGTH_BYTES (28)
|
||||
|
||||
/* Enums */
|
||||
enum ADCINDEX {V_PWR_IO, V_PWR_A, V_PWR_B, V_PWR_C, V_PWR_D, I_PWR_IO, I_PWR_A, I_PWR_B, I_PWR_C, I_PWR_D};
|
||||
@ -91,9 +104,9 @@ enum CLKINDEX {RUN_CLK, ADC_CLK, SYNC_CLK, DBIT_CLK, NUM_CLOCKS};
|
||||
/* MSB & LSB DEFINES */
|
||||
#define MSB_OF_64_BIT_REG_OFST (32)
|
||||
#define LSB_OF_64_BIT_REG_OFST (0)
|
||||
#define BIT_32_MSK (0xFFFFFFFF)
|
||||
#define BIT32_MSK (0xFFFFFFFF)
|
||||
#define BIT16_MASK (0xFFFF)
|
||||
|
||||
#define IP_PACKETSIZE (0x2032)
|
||||
#define ADC_PORT_INVERT_VAL (0x453b2593)
|
||||
#define MAXIMUM_ADC_CLK (65)
|
||||
#define PLL_VCO_FREQ_MHZ (800)
|
||||
|
Binary file not shown.
@ -674,7 +674,7 @@ int setSubExpTime(int64_t val) {
|
||||
int64_t subdeadtime = eiger_virtual_subperiod * 10 -
|
||||
eiger_virtual_subexptime * 10;
|
||||
eiger_virtual_subexptime = (val / (10));
|
||||
eiger_virtual_subperiod = (val + subdeadtime/10);
|
||||
eiger_virtual_subperiod = (val + subdeadtime) /10;
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
@ -1106,36 +1106,46 @@ int setHighVoltage(int val) {
|
||||
/* parameters - timing, extsig */
|
||||
|
||||
void setTiming( enum timingMode arg) {
|
||||
enum timingMode ret=GET_TIMING_MODE;
|
||||
if (arg != GET_TIMING_MODE) {
|
||||
switch((int)arg) {
|
||||
case AUTO_TIMING: ret = 0; break;
|
||||
case TRIGGER_EXPOSURE: ret = 2; break;
|
||||
case BURST_TRIGGER: ret = 1; break;
|
||||
case GATED: ret = 3; break;
|
||||
}
|
||||
FILE_LOG(logDEBUG1, ("Setting Triggering Mode: %d\n", (int)ret));
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetTriggerMode(ret,1))
|
||||
#endif
|
||||
eiger_triggermode = ret;
|
||||
int ret = 0;
|
||||
switch(arg) {
|
||||
case AUTO_TIMING:
|
||||
ret = 0;
|
||||
break;
|
||||
case TRIGGER_EXPOSURE:
|
||||
ret = 2;
|
||||
break;
|
||||
case BURST_TRIGGER:
|
||||
ret = 1;
|
||||
break;
|
||||
case GATED:
|
||||
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 ret = GET_TIMING_MODE;
|
||||
ret = eiger_triggermode;
|
||||
switch((int)ret) {
|
||||
case 0: ret = AUTO_TIMING; break;
|
||||
case 2: ret = TRIGGER_EXPOSURE; break;
|
||||
case 1: ret = BURST_TRIGGER; break;
|
||||
case 3: ret = GATED; break;
|
||||
switch(eiger_triggermode) {
|
||||
case 0:
|
||||
return AUTO_TIMING;
|
||||
case 2:
|
||||
return TRIGGER_EXPOSURE;
|
||||
case 1:
|
||||
return BURST_TRIGGER;
|
||||
case 3:
|
||||
return GATED;
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Unknown trigger mode found %d\n", ret));
|
||||
ret = 0;
|
||||
FILE_LOG(logERROR, ("Unknown trigger mode found %d\n", eiger_triggermode));
|
||||
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 getNumberOfDACs() {return NDAC;}
|
||||
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 */ \
|
||||
1000, /* Vcmp_ll */ \
|
||||
1000, /* Vcmp_lr */ \
|
||||
4000, /* cal */ \
|
||||
0, /* cal */ \
|
||||
1000, /* Vcmp_rl */ \
|
||||
1100, /* rxb_rb */ \
|
||||
1100, /* rxb_lb */ \
|
||||
|
@ -10,6 +10,7 @@ add_executable(gotthard2DetectorServer_virtual
|
||||
../slsDetectorServer/src/LTC2620_Driver.c
|
||||
../slsDetectorServer/src/ALTERA_PLL_CYCLONE10.c
|
||||
../slsDetectorServer/src/ASIC_Driver.c
|
||||
../slsDetectorServer/src/programFpgaNios.c
|
||||
)
|
||||
|
||||
include_directories(
|
||||
@ -22,7 +23,7 @@ target_include_directories(gotthard2DetectorServer_virtual
|
||||
)
|
||||
|
||||
target_compile_definitions(gotthard2DetectorServer_virtual
|
||||
PUBLIC GOTTHARD2D VIRTUAL STOP_SERVER
|
||||
PUBLIC GOTTHARD2D VIRTUAL STOP_SERVER DEBUG1
|
||||
)
|
||||
|
||||
target_link_libraries(gotthard2DetectorServer_virtual
|
||||
|
@ -12,7 +12,7 @@ DESTDIR ?= bin
|
||||
INSTMODE = 0777
|
||||
|
||||
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)
|
||||
|
||||
|
@ -14,13 +14,33 @@
|
||||
|
||||
/* Base addresses 0x1806 0000 ---------------------------------------------*/
|
||||
/* General purpose control and status registers */
|
||||
#define BASE_CONTROL (0x0000)
|
||||
/* Acquisition? TODO */
|
||||
#define BASE_ACQUISITION (0x0200)
|
||||
#define BASE_CONTROL (0x0000) // 0x1806_0000 - 0x1806_00FF
|
||||
// https://git.psi.ch/sls_detectors_firmware/gotthard_II_mcb/blob/master/code/hdl/ctrl/ctrl.vhd
|
||||
|
||||
/* 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 */
|
||||
#define BASE_UDP_RAM (0x01000) // 0x1806_1000 - 0x1806_1FFF
|
||||
|
||||
|
||||
|
||||
/* Clock Generation registers ------------------------------------------------------*/
|
||||
#define PLL_RESET_REG (0x00 * REG_OFFSET + BASE_CLK_GENERATION)
|
||||
|
||||
@ -30,6 +50,7 @@
|
||||
#define PLL_RESET_SYSTEM_MSK (0x00000001 << PLL_RESET_SYSTEM_OFST)
|
||||
|
||||
|
||||
|
||||
/* Control registers --------------------------------------------------*/
|
||||
|
||||
/* Module Control Board Serial Number register */
|
||||
@ -61,11 +82,6 @@
|
||||
/* Status register */
|
||||
#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 */
|
||||
#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_CLR_ACQSTN_FIFO_OFST (15)
|
||||
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
|
||||
|
||||
/* Pattern IO Control 64 bit register */
|
||||
#define PATTERN_IO_CTRL_LSB_REG (0x22 * REG_OFFSET + BASE_CONTROL)
|
||||
#define PATTERN_IO_CTRL_MSB_REG (0x23 * REG_OFFSET + BASE_CONTROL)
|
||||
#define CONTROL_PWR_CHIP_OFST (31)
|
||||
#define CONTROL_PWR_CHIP_MSK (0x00000001 << CONTROL_PWR_CHIP_OFST)
|
||||
|
||||
/** DTA Offset Register */
|
||||
#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 */
|
||||
#define GET_CYCLES_LSB_REG (0x10 + BASE_ACQUISITION)
|
||||
#define GET_CYCLES_MSB_REG (0x14 + BASE_ACQUISITION)
|
||||
#define GET_CYCLES_LSB_REG (0x04 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define GET_CYCLES_MSB_REG (0x05 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
/* Frames left 64bit Register */
|
||||
#define GET_FRAMES_LSB_REG (0x18 + BASE_ACQUISITION)
|
||||
#define GET_FRAMES_MSB_REG (0x1C + BASE_ACQUISITION)
|
||||
#define GET_FRAMES_LSB_REG (0x06 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#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 */
|
||||
#define SET_DELAY_LSB_REG (0x88 + BASE_ACQUISITION)
|
||||
#define SET_DELAY_MSB_REG (0x8C + BASE_ACQUISITION)
|
||||
#define SET_DELAY_LSB_REG (0x22 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define SET_DELAY_MSB_REG (0x23 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
/* Cylces 64bit Write-register */
|
||||
#define SET_CYCLES_LSB_REG (0x90 + BASE_ACQUISITION)
|
||||
#define SET_CYCLES_MSB_REG (0x94 + BASE_ACQUISITION)
|
||||
#define SET_CYCLES_LSB_REG (0x24 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define SET_CYCLES_MSB_REG (0x25 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
/* Frames 64bit Write-register */
|
||||
#define SET_FRAMES_LSB_REG (0x98 + BASE_ACQUISITION)
|
||||
#define SET_FRAMES_MSB_REG (0x9C + BASE_ACQUISITION)
|
||||
#define SET_FRAMES_LSB_REG (0x26 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define SET_FRAMES_MSB_REG (0x27 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
/* Period 64bit Write-register */
|
||||
#define SET_PERIOD_LSB_REG (0xA0 + BASE_ACQUISITION)
|
||||
#define SET_PERIOD_MSB_REG (0xA4 + BASE_ACQUISITION)
|
||||
#define SET_PERIOD_LSB_REG (0x28 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define SET_PERIOD_MSB_REG (0x29 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
/* Exptime 64bit Write-register */
|
||||
#define SET_EXPTIME_LSB_REG (0xA8 + BASE_ACQUISITION)
|
||||
#define SET_EXPTIME_MSB_REG (0xBC + BASE_ACQUISITION)
|
||||
/* External Signal register */
|
||||
#define EXT_SIGNAL_REG (0x30 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
#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_adc 0
|
||||
vcom_cds 1400
|
||||
vref_restore 640
|
||||
vref_rstore 640
|
||||
vb_opa_1st 0
|
||||
vref_comp_fe 0
|
||||
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 DAC_DRIVER_FILE_NAME ("/etc/devlinks/dac")
|
||||
#define ONCHIP_DAC_DRIVER_FILE_NAME ("/etc/devlinks/chipdac")
|
||||
#define TYPE_FILE_NAME ("/etc/devlinks/type")
|
||||
#define CONFIG_FILE ("config.txt")
|
||||
#define DAC_MAX_MV (2048)
|
||||
#define ONCHIP_DAC_MAX_VAL (0x3FF)
|
||||
#define ADU_MAX_VAL (0xFFF)
|
||||
#define ADU_MAX_BITS (12)
|
||||
#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 */
|
||||
#define DEFAULT_BURST_MODE (BURST_INTERNAL)
|
||||
#define DEFAULT_NUM_FRAMES (1)
|
||||
#define DEFAULT_NUM_CYCLES (1)
|
||||
#define DEFAULT_EXPTIME (1 * 1000 * 1000) // 1 ms
|
||||
#define DEFAULT_PERIOD (1 * 1000 * 1000 * 1000) // 1 s
|
||||
#define DEFAULT_EXPTIME (0) // 0 ms (220ns in firmware)
|
||||
#define DEFAULT_PERIOD (1 * 1000) // 1 ms
|
||||
#define DEFAULT_DELAY_AFTER_TRIGGER (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_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_C1 (72222224) // chip_clk, 72 MHz
|
||||
#define DEFAULT_SYSTEM_C2 (18055556) // sync_clk, 18 MHz
|
||||
@ -40,6 +47,7 @@
|
||||
|
||||
/* Firmware Definitions */
|
||||
#define IP_HEADER_SIZE (20)
|
||||
#define FIXED_PLL_FREQUENCY (020000000) // 20MHz
|
||||
#define READOUT_PLL_VCO_FREQ_HZ (866666688) // 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_ADC, /* 3 */ \
|
||||
G2_VCOM_CDS, /* 4 */ \
|
||||
G2_VREF_RESTORE,/* 5 */ \
|
||||
G2_VREF_RSTORE,/* 5 */ \
|
||||
G2_VB_OPA_1ST, /* 6 */ \
|
||||
G2_VREF_COMP_FE,/* 7 */ \
|
||||
G2_VCOM_ADC1, /* 8 */ \
|
||||
@ -64,7 +72,7 @@ enum DACINDEX {G2_VREF_H_ADC, /* 0 */ \
|
||||
G2_DAC_UNUSED2, /* 14 */ \
|
||||
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 */ \
|
||||
G2_VCHIP_OPA_1ST, /* 1 */ \
|
||||
|
Binary file not shown.
@ -30,10 +30,10 @@ int virtual_status = 0;
|
||||
int virtual_stop = 0;
|
||||
int highvoltage = 0;
|
||||
#endif
|
||||
int detPos[2] = {0, 0};
|
||||
int detPos[2] = {};
|
||||
|
||||
int detectorFirstServer = 1;
|
||||
int dacValues[NDAC] = {0};
|
||||
int dacValues[NDAC] = {};
|
||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||
enum externalSignalFlag signalMode = 0;
|
||||
|
||||
@ -128,7 +128,7 @@ int checkType() {
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
#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){
|
||||
FILE_LOG(logERROR, ("This is not a Gotthard Server (read %d, expected ?)\n", type));
|
||||
return FAIL;
|
||||
@ -1178,27 +1178,23 @@ int setHighVoltage(int val){
|
||||
|
||||
void setTiming( enum timingMode arg){
|
||||
u_int32_t addr = EXT_SIGNAL_REG;
|
||||
|
||||
if (arg != GET_TIMING_MODE){
|
||||
switch((int)arg){
|
||||
case AUTO_TIMING:
|
||||
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
||||
bus_w(addr, EXT_SIGNAL_OFF_VAL);
|
||||
break;
|
||||
case TRIGGER_EXPOSURE:
|
||||
if (signalMode == TRIGGER_IN_FALLING_EDGE) {
|
||||
FILE_LOG(logINFO, ("Set Timing: Trigger (Falling Edge)\n"));
|
||||
bus_w(addr, EXT_SIGNAL_TRGGR_IN_FLLNG_VAL);
|
||||
} else {
|
||||
FILE_LOG(logINFO, ("Set Timing: Trigger (Rising Edge)\n"));
|
||||
bus_w(addr, EXT_SIGNAL_TRGGR_IN_RSNG_VAL);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Unknown timing mode %d for this detector\n", (int)arg));
|
||||
return;
|
||||
}
|
||||
}
|
||||
switch(arg) {
|
||||
case AUTO_TIMING:
|
||||
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
||||
bus_w(addr, EXT_SIGNAL_OFF_VAL);
|
||||
break;
|
||||
case TRIGGER_EXPOSURE:
|
||||
if (signalMode == TRIGGER_IN_FALLING_EDGE) {
|
||||
FILE_LOG(logINFO, ("Set Timing: Trigger (Falling Edge)\n"));
|
||||
bus_w(addr, EXT_SIGNAL_TRGGR_IN_FLLNG_VAL);
|
||||
} else {
|
||||
FILE_LOG(logINFO, ("Set Timing: Trigger (Rising Edge)\n"));
|
||||
bus_w(addr, EXT_SIGNAL_TRGGR_IN_RSNG_VAL);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Unknown timing mode %d for this detector\n", (int)arg));
|
||||
}
|
||||
}
|
||||
|
||||
enum timingMode getTiming() {
|
||||
@ -1326,7 +1322,7 @@ int configureMAC() {
|
||||
FILE_LOG(logDEBUG1, ("\tWrite back released. MultiPurpose reg: 0x%x\n", bus_r(addr)));
|
||||
|
||||
FILE_LOG(logDEBUG1, ("\tConfiguring MAC CONF\n"));
|
||||
mac_conf *mac_conf_regs = (mac_conf*)(Blackfin_getBaseAddress() + ENET_CONF_REG * 2); // direct write
|
||||
mac_conf *mac_conf_regs = (mac_conf*)(Blackfin_getBaseAddress() + ENET_CONF_REG / 2); // direct write
|
||||
mac_conf_regs->mac.mac_dest_mac1 = ((destmac >> (8 * 5)) & 0xFF);
|
||||
mac_conf_regs->mac.mac_dest_mac2 = ((destmac >> (8 * 4)) & 0xFF);
|
||||
mac_conf_regs->mac.mac_dest_mac3 = ((destmac >> (8 * 3)) & 0xFF);
|
||||
@ -1364,7 +1360,7 @@ int configureMAC() {
|
||||
mac_conf_regs->udp.udp_chksum = 0x0000;
|
||||
|
||||
FILE_LOG(logDEBUG1, ("\tConfiguring TSE\n"));
|
||||
tse_conf *tse_conf_regs = (tse_conf*)(Blackfin_getBaseAddress() + TSE_CONF_REG * 2); // direct write
|
||||
tse_conf *tse_conf_regs = (tse_conf*)(Blackfin_getBaseAddress() + TSE_CONF_REG / 2); // direct write
|
||||
tse_conf_regs->rev = 0xA00;
|
||||
tse_conf_regs->scratch = 0xCCCCCCCC;
|
||||
tse_conf_regs->command_config = 0xB;
|
||||
@ -1680,7 +1676,7 @@ int calculateDataBytes(){
|
||||
return DATA_BYTES;
|
||||
}
|
||||
|
||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerChip() * (int)getNumberOfChips());}
|
||||
int getTotalNumberOfChannels() {return (getNumberOfChannelsPerChip() * getNumberOfChips());}
|
||||
int getNumberOfChips(){return NCHIP;}
|
||||
int getNumberOfDACs(){return NDAC;}
|
||||
int getNumberOfChannelsPerChip(){return NCHAN;}
|
||||
|
@ -10,7 +10,7 @@ add_executable(jungfrauDetectorServer_virtual
|
||||
../slsDetectorServer/src/ALTERA_PLL.c
|
||||
../slsDetectorServer/src/LTC2620.c
|
||||
../slsDetectorServer/src/MAX1932.c
|
||||
../slsDetectorServer/src/programfpga.c
|
||||
../slsDetectorServer/src/programFpgaBlackfin.c
|
||||
../slsDetectorServer/src/communication_funcs_UDP.c
|
||||
)
|
||||
|
||||
@ -28,7 +28,7 @@ target_compile_definitions(jungfrauDetectorServer_virtual
|
||||
)
|
||||
|
||||
target_link_libraries(jungfrauDetectorServer_virtual
|
||||
PUBLIC pthread rt
|
||||
PUBLIC pthread rt slsProjectOptions slsProjectWarnings
|
||||
)
|
||||
|
||||
set_target_properties(jungfrauDetectorServer_virtual PROPERTIES
|
||||
|
@ -12,7 +12,7 @@ DESTDIR ?= bin
|
||||
INSTMODE = 0777
|
||||
|
||||
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)
|
||||
|
||||
|
Binary file not shown.
@ -8,9 +8,7 @@
|
||||
#include "ALTERA_PLL.h" // pll
|
||||
#include "blackfin.h"
|
||||
#include "common.h"
|
||||
#ifndef VIRTUAL
|
||||
#include "programfpga.h"
|
||||
#else
|
||||
#ifdef VIRTUAL
|
||||
#include "communication_funcs_UDP.h"
|
||||
#endif
|
||||
|
||||
@ -24,6 +22,7 @@
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern udpStruct udpDetails;
|
||||
extern const enum detectorType myDetectorType;
|
||||
|
||||
int initError = OK;
|
||||
int initCheckDone = 0;
|
||||
@ -37,9 +36,9 @@ int virtual_stop = 0;
|
||||
|
||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||
int highvoltage = 0;
|
||||
int dacValues[NDAC] = {0};
|
||||
int dacValues[NDAC] = {};
|
||||
int adcPhase = 0;
|
||||
int detPos[4] = {0, 0, 0, 0};
|
||||
int detPos[4] = {};
|
||||
int numUDPInterfaces = 1;
|
||||
|
||||
|
||||
@ -66,7 +65,6 @@ void basictests() {
|
||||
}
|
||||
return;
|
||||
#else
|
||||
|
||||
defineGPIOpins();
|
||||
resetFPGA();
|
||||
if (mapCSP0() == FAIL) {
|
||||
@ -170,7 +168,7 @@ int checkType() {
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
#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){
|
||||
FILE_LOG(logERROR, ("This is not a Jungfrau Server (read %d, expected %d)\n", type, JUNGFRAU));
|
||||
return FAIL;
|
||||
@ -918,22 +916,18 @@ int setHighVoltage(int val){
|
||||
|
||||
|
||||
void setTiming( enum timingMode arg){
|
||||
|
||||
if(arg != GET_TIMING_MODE){
|
||||
switch((int)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));
|
||||
return;
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -994,7 +988,7 @@ void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip, uint64_
|
||||
// calculate rxr endpoint offset
|
||||
addr += (iRxEntry * RXR_ENDPOINT_OFST);
|
||||
// get struct memory
|
||||
udp_header *udp = (udp_header*) (Blackfin_getBaseAddress() + addr * 2);
|
||||
udp_header *udp = (udp_header*) (Blackfin_getBaseAddress() + addr / 2);
|
||||
memset(udp, 0, sizeof(udp_header));
|
||||
|
||||
// mac addresses
|
||||
@ -1667,7 +1661,7 @@ void* start_timer(void* arg) {
|
||||
|
||||
usleep(exp_us);
|
||||
|
||||
const int size = datasize + 112;
|
||||
const int size = datasize + sizeof(sls_detector_header);
|
||||
char packetData[size];
|
||||
memset(packetData, 0, sizeof(sls_detector_header));
|
||||
|
||||
@ -1679,6 +1673,11 @@ void* start_timer(void* arg) {
|
||||
sls_detector_header* header = (sls_detector_header*)(packetData);
|
||||
header->frameNumber = frameNr;
|
||||
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;
|
||||
@ -1782,11 +1781,11 @@ enum runStatus getRunStatus(){
|
||||
|
||||
|
||||
void readFrame(int *ret, char *mess){
|
||||
#ifdef VIRTUAL
|
||||
// wait for status to be done
|
||||
while(runBusy()){
|
||||
usleep(500);
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
FILE_LOG(logINFOGREEN, ("acquisition successfully finished\n"));
|
||||
return;
|
||||
#endif
|
||||
@ -1826,7 +1825,7 @@ int calculateDataBytes(){
|
||||
return DATA_BYTES;
|
||||
}
|
||||
|
||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerChip() * (int)getNumberOfChips());}
|
||||
int getTotalNumberOfChannels() {return (getNumberOfChannelsPerChip() * getNumberOfChips());}
|
||||
int getNumberOfChips(){return NCHIP;}
|
||||
int getNumberOfDACs(){return NDAC;}
|
||||
int getNumberOfChannelsPerChip(){return NCHAN;}
|
||||
|
@ -33,7 +33,8 @@ typedef struct udp_header_struct {
|
||||
uint16_t udp_destport;
|
||||
} udp_header;
|
||||
|
||||
#define IP_HEADER_SIZE 20
|
||||
#define IP_HEADER_SIZE (20)
|
||||
#define UDP_IP_HEADER_LENGTH_BYTES (28)
|
||||
|
||||
|
||||
/* Enums */
|
||||
@ -93,7 +94,6 @@ enum CLKINDEX {RUN_CLK, ADC_CLK, NUM_CLOCKS};
|
||||
|
||||
#define MAX_PHASE_SHIFTS (160)
|
||||
#define BIT16_MASK (0xFFFF)
|
||||
#define UDP_IP_HEADER_LENGTH_BYTES (28)
|
||||
|
||||
|
||||
|
||||
|
@ -12,7 +12,7 @@ add_executable(moenchDetectorServer_virtual
|
||||
../slsDetectorServer/src/ALTERA_PLL.c
|
||||
../slsDetectorServer/src/LTC2620.c
|
||||
../slsDetectorServer/src/MAX1932.c
|
||||
../slsDetectorServer/src/programfpga.c
|
||||
../slsDetectorServer/src/programFpgaBlackfin.c
|
||||
)
|
||||
|
||||
include_directories(
|
||||
|
@ -12,7 +12,7 @@ DESTDIR ?= bin
|
||||
INSTMODE = 0777
|
||||
|
||||
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)
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "ALTERA_PLL.h" // pll
|
||||
#include "blackfin.h"
|
||||
#ifndef VIRTUAL
|
||||
#include "programfpga.h"
|
||||
#include "programFpgaBlackfin.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
@ -9,6 +9,7 @@ add_executable(mythen3DetectorServer_virtual
|
||||
../slsDetectorServer/src/common.c
|
||||
../slsDetectorServer/src/LTC2620_Driver.c
|
||||
../slsDetectorServer/src/ALTERA_PLL_CYCLONE10.c
|
||||
../slsDetectorServer/src/programFpgaNios.c
|
||||
)
|
||||
|
||||
include_directories(
|
||||
|
@ -12,7 +12,7 @@ DESTDIR ?= bin
|
||||
INSTMODE = 0777
|
||||
|
||||
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)
|
||||
|
||||
|
@ -4,29 +4,42 @@
|
||||
#define REG_OFFSET (4)
|
||||
|
||||
/* Base addresses 0x1804 0000 ---------------------------------------------*/
|
||||
|
||||
/* Reconfiguration core for readout pll */
|
||||
#define BASE_READOUT_PLL (0x0000) // 0x1804_0000 - 0x1804_07FF
|
||||
|
||||
/* Reconfiguration core for system pll */
|
||||
#define BASE_SYSTEM_PLL (0x0800) // 0x1804_0800 - 0x1804_0FFF
|
||||
|
||||
/* Clock Generation */
|
||||
#define BASE_CLK_GENERATION (0x1000) // 0x1804_1000 - 0x1804_XXXX //TODO
|
||||
|
||||
/* Base addresses 0x1806 0000 ---------------------------------------------*/
|
||||
/* 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 */
|
||||
#define BASE_ASIC (0x0100) // 0x1806_0100 - 0x1806_010F
|
||||
|
||||
/* 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 */
|
||||
#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 */
|
||||
#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 */
|
||||
#define BASE_UDP_RAM (0x01000) // 0x1806_1000 - 0x1806_1FFF
|
||||
|
||||
/* Pattern RAM. Pattern table */
|
||||
#define BASE_PATTERN_RAM (0x10000) // 0x1807_0000 - 0x1807_FFFF
|
||||
|
||||
@ -82,7 +95,6 @@
|
||||
|
||||
/* Config RW regiseter */
|
||||
#define CONFIG_REG (0x20 * REG_OFFSET + BASE_CONTROL)
|
||||
|
||||
#define CONFIG_COUNTER_ENA_OFST (0)
|
||||
#define CONFIG_COUNTER_ENA_MSK (0x00000003 << CONFIG_COUNTER_ENA_OFST)
|
||||
#define CONFIG_COUNTER_ENA_DEFAULT_VAL ((0x0 << CONFIG_COUNTER_ENA_OFST) & CONFIG_COUNTER_ENA_MSK)
|
||||
@ -96,15 +108,13 @@
|
||||
#define CONFIG_DYNAMIC_RANGE_16_VAL ((0x2 << CONFIG_DYNAMIC_RANGE_OFST) & CONFIG_DYNAMIC_RANGE_MSK)
|
||||
#define CONFIG_DYNAMIC_RANGE_24_VAL ((0x3 << CONFIG_DYNAMIC_RANGE_OFST) & CONFIG_DYNAMIC_RANGE_MSK)
|
||||
|
||||
/* Control RW register */ // assumed for MY3
|
||||
/* Control RW register */
|
||||
#define CONTROL_REG (0x21 * REG_OFFSET + BASE_CONTROL)
|
||||
|
||||
#define CONTROL_STRT_ACQSTN_OFST (0)
|
||||
#define CONTROL_STRT_ACQSTN_MSK (0x00000001 << CONTROL_STRT_ACQSTN_OFST)
|
||||
#define CONTROL_STP_ACQSTN_OFST (1)
|
||||
#define CONTROL_STP_ACQSTN_MSK (0x00000001 << CONTROL_STP_ACQSTN_OFST)
|
||||
//#define CONTROL_RN_BSY_OFST (2) // assumed for MY3 TODO
|
||||
//#define CONTROL_RN_BSY_MSK (0x00000001 << CONTROL_RN_BSY_OFST)
|
||||
#define CONTROL_CRE_RST_OFST (10)
|
||||
#define CONTROL_CRE_RST_MSK (0x00000001 << CONTROL_CRE_RST_OFST)
|
||||
#define CONTROL_PRPHRL_RST_OFST (11) // Only GBE10?
|
||||
@ -121,10 +131,48 @@
|
||||
#define DTA_OFFSET_REG (0x24 * REG_OFFSET + BASE_CONTROL)
|
||||
|
||||
|
||||
|
||||
/* 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 status Register*/
|
||||
#define PAT_STATUS_REG (0x00 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PAT_STATUS_RUN_BUSY_OFST (0)
|
||||
#define PAT_STATUS_RUN_BUSY_MSK (0x00000001 << PAT_STATUS_RUN_BUSY_OFST)
|
||||
#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_DLY_BFRE_TRGGR_OFST (4)
|
||||
#define PAT_STATUS_DLY_BFRE_TRGGR_MSK (0x00000001 << PAT_STATUS_DLY_BFRE_TRGGR_OFST)
|
||||
#define PAT_STATUS_FIFO_FULL_OFST (5)
|
||||
#define PAT_STATUS_FIFO_FULL_MSK (0x00000001 << PAT_STATUS_FIFO_FULL_OFST)
|
||||
#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_CSM_BUSY_OFST (17)
|
||||
#define PAT_STATUS_CSM_BUSY_MSK (0x00000001 << PAT_STATUS_CSM_BUSY_OFST)
|
||||
|
||||
/* Delay left 64bit Register */
|
||||
#define GET_DELAY_LSB_REG (0x02 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
@ -173,6 +221,9 @@
|
||||
/* External Signal register */
|
||||
#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 */
|
||||
#define SET_TRIGGER_DELAY_LSB_REG (0x32 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define SET_TRIGGER_DELAY_MSB_REG (0x33 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
Binary file not shown.
@ -17,14 +17,11 @@
|
||||
#include <pthread.h>
|
||||
#include <time.h>
|
||||
#endif
|
||||
// ------------------------------------------
|
||||
#include <time.h>
|
||||
// ------------------------------------------
|
||||
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern udpStruct udpDetails;
|
||||
extern const enum detectorType myDetectorType;
|
||||
|
||||
int initError = OK;
|
||||
int initCheckDone = 0;
|
||||
@ -35,16 +32,14 @@ pthread_t pthread_virtual_tid;
|
||||
int virtual_status = 0;
|
||||
int virtual_stop = 0;
|
||||
#endif
|
||||
// ------------------------------------------
|
||||
int temp_status = 0;
|
||||
// ------------------------------------------
|
||||
|
||||
int32_t clkPhase[NUM_CLOCKS] = {0, 0, 0, 0, 0};
|
||||
uint32_t clkFrequency[NUM_CLOCKS] = {0, 0, 0, 0, 0};
|
||||
int32_t clkPhase[NUM_CLOCKS] = {};
|
||||
uint32_t clkFrequency[NUM_CLOCKS] = {};
|
||||
|
||||
int highvoltage = 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
|
||||
|
||||
int isInitCheckDone() {
|
||||
return initCheckDone;
|
||||
@ -69,7 +64,7 @@ void basictests() {
|
||||
}
|
||||
return;
|
||||
#else
|
||||
FILE_LOG(logINFOBLUE, ("******** Mythen3 Server: do the checks *****************\n"));
|
||||
FILE_LOG(logINFOBLUE, ("************ Mythen3 Server *********************\n"));
|
||||
if (mapCSP0() == FAIL) {
|
||||
strcpy(initErrorMessage,
|
||||
"Could not map to memory. Dangerous to continue.\n");
|
||||
@ -90,14 +85,11 @@ void basictests() {
|
||||
uint64_t macadd = getDetectorMAC();
|
||||
int64_t fwversion = getFirmwareVersion();
|
||||
int64_t swversion = getServerVersion();
|
||||
int64_t sw_fw_apiversion = 0;
|
||||
int64_t sw_fw_apiversion = getFirmwareAPIVersion();;
|
||||
int64_t client_sw_apiversion = getClientServerAPIVersion();
|
||||
uint32_t requiredFirmwareVersion = REQRD_FRMWRE_VRSN;
|
||||
|
||||
|
||||
if (fwversion >= MIN_REQRD_VRSN_T_RD_API)
|
||||
sw_fw_apiversion = getFirmwareAPIVersion();
|
||||
FILE_LOG(logINFOBLUE, ("************ Mythen3 Server *********************\n"
|
||||
FILE_LOG(logINFOBLUE, ("*************************************************\n"
|
||||
"Hardware Version:\t\t 0x%x\n"
|
||||
|
||||
"Detector IP Addr:\t\t 0x%x\n"
|
||||
@ -167,7 +159,7 @@ int checkType() {
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
#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){
|
||||
FILE_LOG(logERROR, ("This is not a Mythen3 Server (read %d, expected %d)\n", type, MYTHEN3));
|
||||
return FAIL;
|
||||
@ -257,7 +249,7 @@ u_int32_t getDetectorNumber(){
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
#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);
|
||||
}
|
||||
|
||||
|
||||
@ -311,10 +303,14 @@ u_int32_t getDetectorIP(){
|
||||
/* initialization */
|
||||
|
||||
void initControlServer(){
|
||||
CreateNotificationForCriticalTasks();
|
||||
if (initError == OK) {
|
||||
setupDetector();
|
||||
}
|
||||
initCheckDone = 1;
|
||||
if (initError == OK) {
|
||||
NotifyServerStartSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
void initStopServer() {
|
||||
@ -371,8 +367,7 @@ void setupDetector() {
|
||||
// dynamic range
|
||||
setDynamicRange(DEFAULT_DYNAMIC_RANGE);
|
||||
// enable all counters
|
||||
bus_w(CONFIG_REG, bus_r(CONFIG_REG) & ~CONFIG_COUNTER_ENA_MSK);
|
||||
bus_w(CONFIG_REG, bus_r(CONFIG_REG) | CONFIG_COUNTER_ENA_ALL_VAL);
|
||||
setCounterMask(MAX_COUNTER_MSK);
|
||||
|
||||
|
||||
// Initialization of acquistion parameters
|
||||
@ -536,6 +531,66 @@ int64_t getPeriod() {
|
||||
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG)/ (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
}
|
||||
|
||||
void setCounterMask(uint32_t arg) {
|
||||
if (arg == 0 || arg > MAX_COUNTER_MSK) {
|
||||
return;
|
||||
}
|
||||
countermask = arg;
|
||||
// convert mask into number of counters (until firmware converts to mask)
|
||||
int ncounters = __builtin_popcount(countermask);
|
||||
FILE_LOG(logINFO, ("Setting number of counters to %d\n", ncounters));
|
||||
uint32_t val = 0;
|
||||
switch (ncounters) {
|
||||
case 1:
|
||||
val = CONFIG_COUNTER_ENA_1_VAL;
|
||||
break;
|
||||
case 2:
|
||||
val = CONFIG_COUNTER_ENA_2_VAL;
|
||||
break;
|
||||
default:
|
||||
val = CONFIG_COUNTER_ENA_ALL_VAL;
|
||||
break;
|
||||
}
|
||||
uint32_t addr = CONFIG_REG;
|
||||
bus_w(addr, bus_r(addr) &~ CONFIG_COUNTER_ENA_MSK);
|
||||
bus_w(addr, bus_r(addr) | val);
|
||||
FILE_LOG(logDEBUG, ("Config Reg: 0x%x\n", bus_r(addr)));
|
||||
}
|
||||
|
||||
uint32_t getCounterMask() {
|
||||
uint32_t addr = CONFIG_REG;
|
||||
uint32_t regval = (bus_r(addr) & CONFIG_COUNTER_ENA_MSK);
|
||||
int ncounters = 0;
|
||||
switch (regval) {
|
||||
case CONFIG_COUNTER_ENA_1_VAL:
|
||||
ncounters = 1;
|
||||
break;
|
||||
case CONFIG_COUNTER_ENA_2_VAL:
|
||||
ncounters = 2;
|
||||
break;
|
||||
default:
|
||||
ncounters = 3;
|
||||
break;
|
||||
}
|
||||
// confirm ncounters work with mask saved in server (until firmware converts to mask)
|
||||
int nc = __builtin_popcount(countermask);
|
||||
// if not equal, make a mask of what is in register (will change once firmware changes)
|
||||
if (nc != ncounters) {
|
||||
switch (ncounters) {
|
||||
case 1:
|
||||
countermask = 0x1;
|
||||
break;
|
||||
case 2:
|
||||
countermask = 0x3;
|
||||
break;
|
||||
default:
|
||||
countermask = 0x7;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return countermask;
|
||||
}
|
||||
|
||||
int setDelayAfterTrigger(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val));
|
||||
@ -556,7 +611,6 @@ int setDelayAfterTrigger(int64_t val) {
|
||||
|
||||
int64_t getDelayAfterTrigger() {
|
||||
return get64BitReg(SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG) / (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
|
||||
}
|
||||
|
||||
int64_t getNumFramesLeft() {
|
||||
@ -653,10 +707,25 @@ int setHighVoltage(int val){
|
||||
|
||||
/* parameters - timing */
|
||||
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() {
|
||||
if (bus_r(EXT_SIGNAL_REG) == EXT_SIGNAL_MSK)
|
||||
return TRIGGER_EXPOSURE;
|
||||
return AUTO_TIMING;
|
||||
}
|
||||
|
||||
@ -782,6 +851,43 @@ void calcChecksum(udp_header* udp) {
|
||||
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 */
|
||||
|
||||
uint64_t readPatternWord(int addr) {
|
||||
@ -999,6 +1105,49 @@ 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() {
|
||||
FILE_LOG(logINFO, ("Checking type of module\n"));
|
||||
FILE* fd = fopen(TYPE_FILE_NAME, "r");
|
||||
if (fd == NULL) {
|
||||
FILE_LOG(logERROR, ("Could not open file %s to get type of the module attached\n", TYPE_FILE_NAME));
|
||||
return -1;
|
||||
}
|
||||
char buffer[MAX_STR_LENGTH];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
fread (buffer, MAX_STR_LENGTH, sizeof(char), fd);
|
||||
if (strlen(buffer) == 0) {
|
||||
FILE_LOG(logERROR, ("Could not read file %s to get type of the module attached\n", TYPE_FILE_NAME));
|
||||
return -1;
|
||||
}
|
||||
int type = atoi(buffer);
|
||||
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));
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (abs(type - TYPE_MYTHEN3_MODULE_VAL) > TYPE_TOLERANCE) {
|
||||
FILE_LOG(logERROR, ("Wrong Module attached! Expected %d for Mythen3, got %d\n", TYPE_MYTHEN3_MODULE_VAL, type));
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int powerChip (int on){
|
||||
if(on != -1){
|
||||
if(on){
|
||||
@ -1054,8 +1203,8 @@ int setPhase(enum CLKINDEX ind, int val, int degrees) {
|
||||
relativePhase *= -1;
|
||||
direction = 0;
|
||||
}
|
||||
int pllIndex = ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL;
|
||||
int clkIndex = ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind;
|
||||
int pllIndex = (int)(ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL);
|
||||
int clkIndex = (int)(ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind);
|
||||
ALTERA_PLL_C10_SetPhaseShift(pllIndex, clkIndex, relativePhase, direction);
|
||||
|
||||
clkPhase[ind] = valShift;
|
||||
@ -1127,7 +1276,7 @@ int getVCOFrequency(enum CLKINDEX ind) {
|
||||
FILE_LOG(logERROR, ("Unknown clock index %d to get vco frequency\n", ind));
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1145,7 +1294,7 @@ int setClockDivider(enum CLKINDEX ind, int val) {
|
||||
}
|
||||
char* clock_names[] = {CLK_NAMES};
|
||||
int vcofreq = getVCOFrequency(ind);
|
||||
int currentdiv = vcofreq / clkFrequency[ind];
|
||||
int currentdiv = vcofreq / (int)clkFrequency[ind];
|
||||
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));
|
||||
@ -1160,8 +1309,8 @@ int setClockDivider(enum CLKINDEX ind, int val) {
|
||||
}
|
||||
|
||||
// Calculate and set output frequency
|
||||
int pllIndex = ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL;
|
||||
int clkIndex = ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind;
|
||||
int pllIndex = (int)(ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL);
|
||||
int clkIndex = (int)(ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind);
|
||||
ALTERA_PLL_C10_SetOuputFrequency (pllIndex, clkIndex, 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]));
|
||||
@ -1195,20 +1344,11 @@ int getClockDivider(enum CLKINDEX ind) {
|
||||
FILE_LOG(logERROR, ("Unknown clock index %d to get clock divider\n", ind));
|
||||
return -1;
|
||||
}
|
||||
return (getVCOFrequency(ind) / clkFrequency[ind]);
|
||||
return (getVCOFrequency(ind) / (int)clkFrequency[ind]);
|
||||
}
|
||||
|
||||
/* aquisition */
|
||||
|
||||
int setDetectorPosition(int pos[]) {
|
||||
memcpy(detPos, pos, sizeof(detPos));
|
||||
return OK;
|
||||
}
|
||||
|
||||
int* getDetectorPosition() {
|
||||
return detPos;
|
||||
}
|
||||
|
||||
int startStateMachine(){
|
||||
#ifdef VIRTUAL
|
||||
// create udp socket
|
||||
@ -1230,9 +1370,6 @@ int startStateMachine(){
|
||||
FILE_LOG(logINFOBLUE, ("Starting State Machine\n"));
|
||||
cleanFifos();
|
||||
|
||||
// ------------------------------------------
|
||||
temp_status = 1;
|
||||
// ------------------------------------------
|
||||
//start state machine
|
||||
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STRT_ACQSTN_MSK);
|
||||
|
||||
@ -1250,22 +1387,64 @@ void* start_timer(void* arg) {
|
||||
getNumTriggers() );
|
||||
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
|
||||
for(frameNr=0; frameNr!= numFrames; ++frameNr ) {
|
||||
for (frameNr = 0; frameNr != numFrames; ++frameNr) {
|
||||
|
||||
//check if virtual_stop is high
|
||||
if(virtual_stop == 1){
|
||||
break;
|
||||
}
|
||||
|
||||
int srcOffset = 0;
|
||||
|
||||
// sleep for exposure time
|
||||
struct timespec begin, end;
|
||||
clock_gettime(CLOCK_REALTIME, &begin);
|
||||
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
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
int64_t time_ns = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
||||
(end.tv_nsec - begin.tv_nsec));
|
||||
|
||||
@ -1296,7 +1475,7 @@ int stopStateMachine(){
|
||||
#endif
|
||||
//stop state machine
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1311,45 +1490,53 @@ enum runStatus getRunStatus(){
|
||||
}
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1, ("Getting status\n"));
|
||||
uint32_t retval = bus_r(PAT_STATUS_REG);
|
||||
FILE_LOG(logINFO, ("Status Register: %08x\n",retval));
|
||||
|
||||
// ------------------------------------------
|
||||
//uint32_t retval = bus_r(STATUS_REG);
|
||||
//FILE_LOG(logINFO, ("Status Register: %08x\n",retval));
|
||||
|
||||
// running
|
||||
if (temp_status) {
|
||||
//if(retval & CONTROL_RN_BSY_MSK) {
|
||||
// ------------------------------------------
|
||||
FILE_LOG(logINFOBLUE, ("Status: Running\n"));
|
||||
return RUNNING;
|
||||
enum runStatus s;
|
||||
|
||||
//running
|
||||
if (retval & PAT_STATUS_RUN_BUSY_MSK) {
|
||||
if (retval & PAT_STATUS_WAIT_FOR_TRGGR_MSK) {
|
||||
FILE_LOG(logINFOBLUE, ("Status: WAITING\n"));
|
||||
s = WAITING;
|
||||
} else {
|
||||
if (retval & PAT_STATUS_DLY_BFRE_TRGGR_MSK) {
|
||||
FILE_LOG(logINFO, ("Status: Delay before Trigger\n"));
|
||||
} else if (retval & PAT_STATUS_DLY_AFTR_TRGGR_MSK) {
|
||||
FILE_LOG(logINFO, ("Status: Delay after Trigger\n"));
|
||||
}
|
||||
FILE_LOG(logINFOBLUE, ("Status: RUNNING\n"));
|
||||
s = RUNNING;
|
||||
}
|
||||
}
|
||||
return IDLE;
|
||||
|
||||
//not running
|
||||
else {
|
||||
// stopped or error
|
||||
if (retval & PAT_STATUS_FIFO_FULL_MSK) {
|
||||
FILE_LOG(logINFOBLUE, ("Status: STOPPED\n")); //FIFO FULL??
|
||||
s = STOPPED;
|
||||
} else if (retval & PAT_STATUS_CSM_BUSY_MSK) {
|
||||
FILE_LOG(logINFOBLUE, ("Status: READ MACHINE BUSY\n"));
|
||||
s = TRANSMITTING;
|
||||
} else if (!retval) {
|
||||
FILE_LOG(logINFOBLUE, ("Status: IDLE\n"));
|
||||
s = IDLE;
|
||||
} else {
|
||||
FILE_LOG(logERROR, ("Status: Unknown status %08x\n", retval));
|
||||
s = ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
void readFrame(int *ret, char *mess){
|
||||
void readFrame(int *ret, char *mess) {
|
||||
// wait for status to be done
|
||||
|
||||
// ------------------------------------------
|
||||
//while(runBusy()){
|
||||
// usleep(500);
|
||||
//}
|
||||
|
||||
int64_t periodns = getPeriod();
|
||||
int numFrames = getNumFrames();
|
||||
int frameNr = 0;
|
||||
// loop over number of frames
|
||||
for(frameNr=0; frameNr!= numFrames; ++frameNr ) {
|
||||
// sleep for exposure time
|
||||
struct timespec begin, end;
|
||||
clock_gettime(CLOCK_REALTIME, &begin);
|
||||
usleep(periodns / 1000);
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
}
|
||||
usleep(1 * 1000 * 1000);
|
||||
temp_status = 0;
|
||||
// ------------------------------------------
|
||||
|
||||
while(runBusy()){
|
||||
usleep(500);
|
||||
}
|
||||
|
||||
#ifdef VIRTUAL
|
||||
FILE_LOG(logINFOGREEN, ("acquisition successfully finished\n"));
|
||||
@ -1365,29 +1552,32 @@ void readFrame(int *ret, char *mess){
|
||||
} else {
|
||||
FILE_LOG(logINFOGREEN, ("Acquisition successfully finished\n"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
u_int32_t runBusy() {
|
||||
#ifdef VIRTUAL
|
||||
return virtual_status;
|
||||
#endif
|
||||
|
||||
// ------------------------------------------
|
||||
return temp_status;
|
||||
//u_int32_t s = (bus_r(CONTROL_REG) & CONTROL_RN_BSY_OFST);
|
||||
u_int32_t s = (bus_r(PAT_STATUS_REG) & PAT_STATUS_RUN_BUSY_MSK);
|
||||
//FILE_LOG(logDEBUG1, ("Status Register: %08x\n", s));
|
||||
//return s;
|
||||
// ------------------------------------------
|
||||
return s;
|
||||
}
|
||||
|
||||
/* common */
|
||||
|
||||
int calculateDataBytes(){
|
||||
return 0;
|
||||
int calculateDataBytes() {
|
||||
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 getNumberOfChips(){return NCHIP;}
|
||||
int getNumberOfDACs(){return NDAC;}
|
||||
int getNumberOfChannelsPerChip(){return NCHAN;}
|
||||
int getTotalNumberOfChannels() {return (getNumberOfChannelsPerChip() * getNumberOfChips());}
|
||||
int getNumberOfChips() {return NCHIP;}
|
||||
int getNumberOfDACs() {return NDAC;}
|
||||
int getNumberOfChannelsPerChip() {return NCHAN;}
|
||||
|
@ -2,19 +2,26 @@
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#define REQRD_FRMWRE_VRSN 0x190000
|
||||
#define MIN_REQRD_VRSN_T_RD_API 0x190000
|
||||
|
||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||
|
||||
/* Hardware Definitions */
|
||||
#define NCHAN (128 * 3)
|
||||
#define NCOUNTERS (3)
|
||||
#define MAX_COUNTER_MSK (0x7)
|
||||
#define NCHAN_1_COUNTER (128)
|
||||
#define NCHAN (128 * NCOUNTERS)
|
||||
#define NCHIP (10)
|
||||
#define NDAC (16)
|
||||
#define HV_SOFT_MAX_VOLTAGE (200)
|
||||
#define HV_HARD_MAX_VOLTAGE (530)
|
||||
#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 TYPE_FILE_NAME ("/etc/devlinks/type")
|
||||
#define DAC_MAX_MV (2048)
|
||||
#define TYPE_MYTHEN3_MODULE_VAL (93)
|
||||
#define TYPE_TOLERANCE (10)
|
||||
#define TYPE_NO_MODULE_STARTING_VAL (800)
|
||||
|
||||
|
||||
/** Default Parameters */
|
||||
#define DEFAULT_DYNAMIC_RANGE (24)
|
||||
@ -38,7 +45,6 @@
|
||||
#define READOUT_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 WAIT_TIME_US_STP_ACQ (100)
|
||||
|
||||
/** Other Definitions */
|
||||
#define BIT16_MASK (0xFFFF)
|
||||
@ -90,4 +96,5 @@ typedef struct udp_header_struct {
|
||||
uint16_t udp_checksum;
|
||||
uint16_t udp_destport;
|
||||
} udp_header;
|
||||
#define UDP_IP_HEADER_LENGTH_BYTES (28)
|
||||
#define UDP_IP_HEADER_LENGTH_BYTES (28)
|
||||
#define PACKETS_PER_FRAME (2)
|
||||
|
@ -98,7 +98,7 @@ u_int32_t writeRegister16(u_int32_t offset, u_int32_t data);
|
||||
/**
|
||||
* Get base address for memory copy
|
||||
*/
|
||||
uint64_t Blackfin_getBaseAddress();
|
||||
uint32_t* Blackfin_getBaseAddress();
|
||||
/**
|
||||
* Map FPGA
|
||||
*/
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* Define GPIO pins if not defined
|
||||
@ -49,4 +50,4 @@ void stopWritingFPGAprogram(FILE* filefp);
|
||||
* @param filefp pointer to flash
|
||||
* @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);
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user