Compare commits

..

31 Commits

Author SHA1 Message Date
92be88ee19 zmq fixed WIP 2020-04-27 18:43:41 +02:00
56bc9c4e08 fix for segfault WIP 2020-04-27 14:00:00 +02:00
edbd70e91a free fix WIP 2020-04-27 13:53:13 +02:00
4f712fcd70 WIP 2020-04-24 15:28:41 +02:00
bb32b2f653 rxr done WIP 2020-04-24 15:13:37 +02:00
085cbbf0d6 WIP, separated rxr from module 2020-04-23 16:09:40 +02:00
45a770cf38 WIP 2020-04-23 15:16:14 +02:00
990008c9d9 WIP 2020-04-23 12:20:04 +02:00
5339e16101 port sequences and client zmq implementation needs revisit, WIP 2020-04-22 17:55:02 +02:00
c976c63fb5 WIP udp 2020-04-22 14:05:20 +02:00
9ee2d389fb WIP 2020-04-22 13:43:10 +02:00
8d0146949c WIP 2020-04-22 12:54:55 +02:00
6de68eacc2 WIP 2020-04-21 18:48:04 +02:00
94103a05b1 parallel3 fix, software version check 2020-04-21 18:27:52 +02:00
1185f1ea17 WIP, a in shm name 2020-04-21 18:02:27 +02:00
d3f420ffd4 WIP, indexstring 2020-04-21 17:14:09 +02:00
6b5511c9e5 WIP, moved bool primaryinterface to an int interface_id 2020-04-21 14:34:48 +02:00
d8aa1ab08e json para and header added 2020-04-21 14:10:07 +02:00
b4c31327d6 WIP, temp fix 2020-04-21 12:35:08 +02:00
c408f9807a Merge branch 'developer' into separateRxr 2020-04-21 11:30:23 +02:00
9df128fced WIP, cant compile squash for rxParameters 2020-04-20 18:35:30 +02:00
e39ec65d19 Merge branch 'developer' into separateRxr 2020-04-20 18:33:37 +02:00
601be462af WIP, rxhostname 2020-04-20 18:33:14 +02:00
1d31695cc1 WIP 2020-04-17 12:15:16 +02:00
df63a6dffe rx_statusL unknown, but others good WIP 2020-04-17 12:09:23 +02:00
cfa9049ed3 WIP: none to remove receivers 2020-04-17 10:34:10 +02:00
9a208caca8 WIP: first connect to rxr 2020-04-16 18:20:04 +02:00
78fb8080ce WIP: some bug fixes and reducing redundant code 2020-04-16 18:07:11 +02:00
cd45f9d45b WIP, parallel 2020-04-16 16:18:50 +02:00
d536ad2b5b WIP, rxr constr done 2020-04-16 13:58:59 +02:00
2921cbfac8 WIP 2020-04-14 12:44:43 +02:00
321 changed files with 44668 additions and 47822 deletions

View File

@ -3,5 +3,4 @@ IndentWidth: 4
UseTab: Never
ColumnLimit: 80
AlignConsecutiveAssignments: false
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: false

View File

@ -45,23 +45,6 @@ option(SLS_USE_CTBGUI "ctb GUI" OFF)
option(SLS_BUILD_DOCS "docs" OFF)
option(SLS_BUILD_EXAMPLES "examples" OFF)
option(SLS_TUNE_LOCAL "tune to local machine" OFF)
option(SLS_DEVEL_HEADERS "install headers for devel" OFF)
option(SLS_USE_MOENCH "compile zmq and post processing for Moench" OFF)
# set(ClangFormat_BIN_NAME clang-format)
set(ClangFormat_EXCLUDE_PATTERNS "build/"
"libs/"
"slsDetectorCalibration/"
"ctbGui/"
"manual/"
"python/"
"sample/"
${CMAKE_BINARY_DIR})
find_package(ClangFormat)
#Enable LTO if available
check_ipo_supported(RESULT SLS_LTO_AVAILABLE)
# Use ld.gold if it is available and isn't disabled explicitly
option(SLS_USE_LD_GOLD "Use GNU gold linker" ON)
@ -230,11 +213,6 @@ if(SLS_BUILD_DOCS)
add_subdirectory(docs)
endif(SLS_BUILD_DOCS)
if(SLS_USE_MOENCH)
add_subdirectory(slsDetectorCalibration/moenchExecutables)
endif(SLS_USE_MOENCH)
if(SLS_MASTER_PROJECT)
# Set install dir CMake packages
set(CMAKE_INSTALL_DIR "share/cmake/${PROJECT_NAME}")

View File

@ -1,39 +0,0 @@
# Find Clang format
if(NOT ClangFormat_BIN_NAME)
set(ClangFormat_BIN_NAME clang-format)
endif()
# if custom path check there first
if(ClangFormat_ROOT_DIR)
find_program(ClangFormat_BIN
NAMES
${ClangFormat_BIN_NAME}
PATHS
"${ClangFormat_ROOT_DIR}"
NO_DEFAULT_PATH)
endif()
find_program(ClangFormat_BIN NAMES ${ClangFormat_BIN_NAME})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
ClangFormat
DEFAULT_MSG
ClangFormat_BIN)
mark_as_advanced(
ClangFormat_BIN)
if(ClangFormat_FOUND)
exec_program(${ClangFormat_BIN} ${CMAKE_CURRENT_SOURCE_DIR} ARGS --version OUTPUT_VARIABLE CLANG_VERSION_TEXT)
string(REGEX MATCH "([0-9]+)\\.[0-9]+\\.[0-9]+" CLANG_VERSION ${CLANG_VERSION_TEXT})
if((${CLANG_VERSION} GREATER "9") OR (${CLANG_VERSION} EQUAL "9"))
# A CMake script to find all source files and setup clang-format targets for them
message(STATUS "found clang-format \"${CLANG_VERSION}\" adding formatting targets")
include(clang-format)
else()
message(STATUS "clang-format version \"${CLANG_VERSION}\" found but need at least 9. Not setting up format targets")
endif()
else()
message(STATUS "clang-format not found. Not setting up format targets")
endif()

View File

@ -1,47 +0,0 @@
# A CMake script to find all source files and setup clang-format targets for them
# Find all source files
set(ClangFormat_CXX_FILE_EXTENSIONS ${ClangFormat_CXX_FILE_EXTENSIONS} *.cpp *.h *.cxx *.hxx *.hpp *.cc *.ipp *.c)
file(GLOB_RECURSE ALL_SOURCE_FILES ${ClangFormat_CXX_FILE_EXTENSIONS})
# Don't include some common build folders
set(ClangFormat_EXCLUDE_PATTERNS ${ClangFormat_EXCLUDE_PATTERNS} "/CMakeFiles/" "cmake")
# get all project files file
foreach (SOURCE_FILE ${ALL_SOURCE_FILES})
foreach (EXCLUDE_PATTERN ${ClangFormat_EXCLUDE_PATTERNS})
string(FIND ${SOURCE_FILE} ${EXCLUDE_PATTERN} EXCLUDE_FOUND)
if (NOT ${EXCLUDE_FOUND} EQUAL -1)
list(REMOVE_ITEM ALL_SOURCE_FILES ${SOURCE_FILE})
endif ()
endforeach ()
endforeach ()
#target for formatting soruce files
add_custom_target(format
COMMENT "Running clang-format to change files"
COMMAND ${ClangFormat_BIN}
-style=file
-i
${ALL_SOURCE_FILES}
)
#target to check format on source files
add_custom_target(format-check
COMMENT "Checking clang-format changes"
# Use ! to negate the result for correct output
COMMAND !
${ClangFormat_BIN}
-style=file
-output-replacements-xml
${ALL_SOURCE_FILES}
| grep -q "replacement offset"
)
# debug to check which file will be formatted
add_custom_target(
listformatfiles
COMMAND
echo ${ALL_SOURCE_FILES}
)

29
cmk.sh
View File

@ -12,7 +12,6 @@ TESTS=0
SIMULATOR=0
CTBGUI=0
MANUALS=0
MOENCHZMQ=0
CLEAN=0
@ -21,7 +20,7 @@ CMAKE_PRE=""
CMAKE_POST=""
usage() { echo -e "
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [m] [-h] [z] [-d <HDF5 directory>] [-j] <Number of threads>
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [m] [-h] [-d <HDF5 directory>] [-j] <Number of threads>
-[no option]: only make
-c: Clean
-b: Builds/Rebuilds CMake files normal mode
@ -37,7 +36,6 @@ Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [m] [-h] [z] [-d <HDF5 dire
-e: Debug mode
-i: Builds tests
-m: Manuals
-z: Moench zmq processor
Rebuild when you switch to a new build and compile in parallel:
./cmk.sh -bj5
@ -73,7 +71,7 @@ For rebuilding only certain sections
" ; exit 1; }
while getopts ":bpchd:j:trgeisumz" opt ; do
while getopts ":bpchd:j:trgeisum" opt ; do
case $opt in
b)
echo "Building of CMake files Required"
@ -132,10 +130,6 @@ while getopts ":bpchd:j:trgeisumz" opt ; do
echo "Compiling Manuals"
MANUALS=1
;;
z)
echo "Compiling Moench Zmq Processor"
MOENCHZMQ=1
;;
u)
echo "Compiling Options: Chip Test Gui"
CTBGUI=1
@ -216,12 +210,6 @@ if [ $MANUALS -eq 1 ]; then
echo "Manuals Option enabled"
fi
#Moench zmq processor
if [ $MOENCHZMQ -eq 1 ]; then
CMAKE_POST+=" -DSLS_USE_MOENCH=ON "
echo "Moench Zmq Processor Option enabled"
fi
#Chip Test Gui
if [ $CTBGUI -eq 1 ]; then
CMAKE_POST+=" -DSLS_USE_CTBGUI=ON "
@ -271,20 +259,13 @@ if [ $COMPILERTHREADS -gt 0 ]; then
BUILDCOMMAND="make -j$COMPILERTHREADS"
echo $BUILDCOMMAND
eval $BUILDCOMMAND
if [ $MANUALS -eq 1 ]; then
BUILDCOMMAND="make docs -j$COMPILERTHREADS"
echo $BUILDCOMMAND
eval $BUILDCOMMAND
fi
else
echo "make"
make
if [ $MANUALS -eq 1 ]; then
echo "make docs"
make docs
fi
fi
if [ $MANUALS -eq 1 ]; then
make docs
fi

View File

@ -21,7 +21,6 @@ if [ -f "$infile" ]
then
gcc -DINFILE="\"$infile\"" -DOUTFILE="\"$outfile\"" -DOUTFILEBIN="\"$outfilebin\"" -o $exe generator.c ;
echo compiling
echo gcc -DINFILE="\"$infile\"" -DOUTFILE="\"$outfile\"" -DOUTFILEBIN="\"$outfilebin\"" -o $exe generator.c ;
$exe ;
echo cleaning
rm $exe

View File

@ -66,10 +66,4 @@ add_custom_target(docs
${SPHINX_BUILD}/html
COMMENT "Generating documentation with Sphinx")
add_custom_target(rst
COMMAND ${SPHINX_EXECUTABLE} -a -b html
-Dbreathe_projects.slsDetectorPackage=${CMAKE_CURRENT_BINARY_DIR}/xml
-c "${SPHINX_BUILD}"
${SPHINX_BUILD}/src
${SPHINX_BUILD}/html
COMMENT "Generating documentation with Sphinx")

View File

@ -21,7 +21,7 @@ print(sys.path)
# -- Project information -----------------------------------------------------
project = 'slsDetectorPackage'
copyright = '2020, PSD Detector Group'
copyright = '2019, PSD Detector Group'
author = 'PSD Detector Group'
version = '@PROJECT_VERSION@'

View File

@ -1,7 +1,7 @@
/**
* Utility program to generate input files for the command line
/**
* Utility program to generate input files for the command line
* documentation. Uses the string returned from sls_detector_help cmd
*
*
*/
#include <fstream>
#include <iostream>
@ -9,6 +9,7 @@
#include <string>
#include <vector>
#include "CmdProxy.h"
#include "Detector.h"
#include "sls_detector_defs.h"
@ -51,4 +52,5 @@ int main() {
auto help = replace_all(tmp, "\n\t", "\n\t\t");
fs << '\t' << cmd << usage << help << "\n";
}
}

View File

@ -4,7 +4,7 @@ Enums
These enums are defined in slsDetectorDefs in the C++ package and
exposed to Python through pybind11.
.. py:currentmodule:: slsdet
.. py:currentmodule:: sls_detector
.. autoclass:: runStatus
:members:

View File

@ -74,7 +74,7 @@ But lets start looking at the at the manual way:
::
import time
from slsdet import Eiger
from sls_detector import Eiger
d = Eiger()
n = 10
@ -114,7 +114,7 @@ hang around until the main process exits.
import time
from multiprocessing import Process
from slsdet import Eiger
from sls_detector import Eiger
def acquire():
"""

View File

@ -1,29 +0,0 @@
hostname strip3
udp_srcip 10.1.1.184
udp_dstip 10.1.1.107
udp_dstport2 50084
udp_srcip2 10.1.1.185
udp_dstip2 10.1.1.107
rx_hostname pc12365:1954
#udp_dstmac 3c:fd:fe:d2:a4:25
fpath /tmp
fname run
fwrite 0
bursts 10
frames 2700
burstperiod 100ms
numinterfaces 2
veto 1
#fixing data looks
# Sampling pipeline 1 clk
reg 0x120 0x00000010
clkphase 1 135 deg

View File

@ -1,5 +1,5 @@
#include "DetectorImpl.h"
#include "catch.hpp"
#include "DetectorImpl.h"
#include "string_utils.h"
#include "tests/globals.h"
#include <iostream>

52
integrationTests/test-integrationDectector.cpp Normal file → Executable file
View File

@ -2,9 +2,9 @@
#include "catch.hpp"
#include "ClientSocket.h"
#include "logger.h"
#include "DetectorImpl.h"
#include "Module.h"
#include "logger.h"
#include "sls_detector_defs.h"
#include "Timer.h"
@ -79,6 +79,7 @@ TEST_CASE("Set control port then create a new object with this control port",
d.freeSharedMemory();
}
TEST_CASE("single EIGER detector no receiver basic set and get",
"[.integration][eiger]") {
// TODO! this test should take command line arguments for config
@ -129,6 +130,8 @@ TEST_CASE("single EIGER detector no receiver basic set and get",
d.freeSharedMemory();
}
TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") {
Module d(test::type);
d.setHostname(test::hostname);
@ -151,12 +154,13 @@ TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") {
d.freeSharedMemory();
}
TEST_CASE("Set settings", "[.integration][.single]") {
TEST_CASE("Set settings", "[.integration][.single]"){
Module d(test::type);
d.setHostname(test::hostname);
CHECK(d.setSettings(defs::STANDARD) == defs::STANDARD);
}
TEST_CASE("Timer functions", "[.integration][cli]") {
// FRAME_NUMBER, /**< number of real time frames: total number of
// acquisitions is number or frames*number of triggers */ ACQUISITION_TIME,
@ -200,7 +204,8 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
if (test::type != dt::EIGER) {
auto delay = 10000;
d.setDelayAfterTrigger(delay);
CHECK(d.getDelayAfterTrigger() == delay);
CHECK(d.getDelayAfterTrigger() ==
delay);
}
auto triggers = 2;
@ -213,9 +218,10 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
CHECK(d.getSubExptime() == subtime);
}
// for (int i =0; i!=frames; ++i)
d.startAndReadAll();
d.startAndReadAll();
d.freeSharedMemory();
}
// TEST_CASE("Aquire", "[.integration][eiger]"){
@ -376,8 +382,8 @@ TEST_CASE("Chiptestboard Loading Patterns", "[.ctbintegration]") {
}
}
TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert",
"[.ctbintegration][dbit]") {
TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert", "[.ctbintegration][dbit]") {
SingleDetectorConfig c;
// pick up multi detector from shm id 0
@ -397,27 +403,27 @@ TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert",
// dbit list
std::vector<int> list = m.getReceiverDbitList();
std::vector <int> list = m.getReceiverDbitList();
list.clear();
for (int i = 0; i < 10; ++i)
list.push_back(i);
m.setReceiverDbitList(list);
CHECK(m.getReceiverDbitList().size() == 10);
list.push_back(64);
CHECK_THROWS_AS(m.setReceiverDbitList(list), sls::RuntimeError);
CHECK_THROWS_WITH(m.setReceiverDbitList(list),
Catch::Matchers::Contains("be between 0 and 63"));
CHECK_THROWS_WITH(m.setReceiverDbitList(list),
Catch::Matchers::Contains("be between 0 and 63"));
list.clear();
for (int i = 0; i < 65; ++i)
list.push_back(i);
CHECK(list.size() == 65);
CHECK_THROWS_WITH(m.setReceiverDbitList(list),
Catch::Matchers::Contains("be greater than 64"));
CHECK_THROWS_WITH(m.setReceiverDbitList(list),
Catch::Matchers::Contains("be greater than 64"));
list.clear();
list.clear();
m.setReceiverDbitList(list);
CHECK(m.getReceiverDbitList().empty());
@ -435,8 +441,8 @@ TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert",
m.setExternalSamplingSource(62);
CHECK(m.getExternalSamplingSource() == 62);
CHECK_THROWS_WITH(m.setExternalSamplingSource(64),
Catch::Matchers::Contains("be 0-63"));
CHECK(m.getExternalSamplingSource() == 62);
Catch::Matchers::Contains("be 0-63"));
CHECK(m.getExternalSamplingSource() == 62);
m.setExternalSampling(1);
CHECK(m.getExternalSampling() == 1);
m.setExternalSampling(0);
@ -444,23 +450,20 @@ TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert",
m.setExternalSampling(1);
CHECK(m.getExternalSampling() == 1);
CHECK(m.readRegister(0x7b) == 0x1003E);
}
TEST_CASE("Eiger or Jungfrau startingfnum",
"[.eigerintegration][.jungfrauintegration][startingfnum]") {
TEST_CASE("Eiger or Jungfrau startingfnum", "[.eigerintegration][.jungfrauintegration][startingfnum]") {
SingleDetectorConfig c;
// pick up multi detector from shm id 0
DetectorImpl m(0);
// ensure ctb detector type, hostname and online
REQUIRE(
((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER) ||
(m.getDetectorTypeAsEnum() ==
slsDetectorDefs::detectorType::JUNGFRAU)));
REQUIRE(((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER) || (m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::JUNGFRAU)));
REQUIRE(m.getHostname() == c.hostname);
CHECK(m.setNumberOfFrames(1) == 1);
CHECK(m.setNumberOfFrames(1) == 1);
// starting fnum
uint64_t val = 8;
@ -495,8 +498,7 @@ TEST_CASE("Eiger readnlines", "[.eigerintegration][readnlines]") {
DetectorImpl m(0);
// ensure detector type, hostname
REQUIRE(
(m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER));
REQUIRE((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER));
REQUIRE(m.getHostname() == c.hostname);
m.setDynamicRange(16);
@ -505,7 +507,7 @@ TEST_CASE("Eiger readnlines", "[.eigerintegration][readnlines]") {
CHECK(m.getReadNLines() == 256);
m.setReadNLines(1);
CHECK(m.getReadNLines() == 1);
m.setDynamicRange(8);
m.setReadNLines(256);
CHECK(m.getReadNLines() == 256);

6
integrationTests/test-integrationMulti.cpp Normal file → Executable file
View File

@ -1,5 +1,5 @@
#include "DetectorImpl.h"
#include "catch.hpp"
#include "DetectorImpl.h"
#include "string_utils.h"
#include "tests/globals.h"
#include <iostream>
@ -24,6 +24,8 @@ TEST_CASE("Initialize a multi detector", "[.integration][.multi]") {
d.freeSharedMemory();
}
TEST_CASE("Set and read timers", "[.integration][.multi]") {
DetectorImpl d(0, true, true);
@ -55,6 +57,7 @@ TEST_CASE("Set and read timers", "[.integration][.multi]") {
// PROGRESS, /**< fraction of measurement elapsed - only get! */
// MEASUREMENTS_NUMBER,
// FRAMES_FROM_START,
// FRAMES_FROM_START_PG,
// SAMPLES,
@ -75,6 +78,7 @@ TEST_CASE("Set and read timers", "[.integration][.multi]") {
CHECK(d.setSubFrameExposureDeadTime(-1) == Approx(subframe_deadtime));
}
if (test::type == dt::EIGER) {
// 32bit is needed for subframe exposure
d.setDynamicRange(32);

View File

@ -360,16 +360,16 @@ In the case of REAL CONTINUOUS readout, i.e. continuous acquire and readout from
\hline
1 & 32 & \textbf{128} & 7820 & \\
\hline
10 & 4 & \textbf{7813} & 98 & 105/128\\
10 & 4 & \textbf{10240} & 98 & 105/128\\
\hline
10 & 8 & \textbf{4000} & 196 & 210/250\\
10 & 8 & \textbf{5120} & 196 & 210/250\\
\hline
10 & 16 & \textbf{2000} & 391 & 420/490\\
10 & 16 & \textbf{2560} & 391 & 420/490\\
\hline
10 & 32 & \textbf{1023} & 782 & 840/977\\
10 & 32 & \textbf{1280} & 782 & 840/977\\
\hline
\end{tabular}
\caption{Frame rate limits for the CONTINUOS streaming out of images, i.e. the data rate out is just below 1Gb/s or 10Gb/s. 1023~Hz for 32-bit, 10GbE is obtained from the 10GbE limitation. The maximum achievable frame rate is 977~Hz.}
\caption{Frame rate limits for the CONTINUOS streaming out of images, i.e. the data rate out is just below 1Gb/s or 10Gb/s. 1280~Hz for 32-bit, 10GbE is obtained from the 10GbE limitation. The maximum achievable frame rate is 977~Hz.}
\label{tcont}\end{table}
Note that in the {\tt{continuous}} flag mode, some buffering is still done on the memories, so a higher frame rate than the proper real continuous one can be achieved. Still, this extra buffering is possible till the memories are not saturated. The number of images that can be stored on the DDR2 on board memories are listed in table~\ref{timgs}.
\begin{table}

View File

@ -12,7 +12,6 @@ target_link_libraries(_slsdet PUBLIC
slsDetectorShared
slsReceiverShared
slsSupportLib
${ZeroMQ_LIBRARIES}
)

View File

@ -1,82 +0,0 @@
import pytest
import datetime as dt
from slsdet import Detector, timingMode, detectorType
not_eiger = pytest.mark.skipif(
Detector().type == detectorType.EIGER, reason="Does not work for eiger"
)
@pytest.fixture
def det():
from slsdet import Detector
return Detector()
def test_frames(det):
for n in [1, 100, 3245, 10000]:
det.frames = n
assert det.frames == n
det.frames = 1
def test_triggers(det):
for n in [1, 100, 3245, 10000]:
det.triggers = n
assert det.triggers == n
det.triggers = 1
def test_exptime(det):
det.exptime = 1
assert det.exptime == 1
det.exptime = dt.timedelta(milliseconds=10)
assert det.exptime == 0.01
det.exptime = 1
def test_period(det):
det.period = 3.2
assert det.period == 3.2
p = dt.timedelta(microseconds=1020)
det.period = p
assert det.period == 0.001020
r = det.getPeriod()
assert r[0] == p
det.period = 0
assert det.period == 0
def test_lock(det):
for l in [True, False]:
det.lock = l
assert det.lock == l
def test_timing(det):
# auto and trigger is available for all det
for m in [timingMode.TRIGGER_EXPOSURE, timingMode.AUTO_TIMING]:
det.timing = m
assert det.timing == m
@not_eiger
def test_delay(det):
det.delay = 1
assert det.delay == 1
t = dt.timedelta(microseconds=1)
det.delay = t
assert det.delay == t.total_seconds()
r = det.getDelayAfterTrigger()[0]
assert r == t
det.delay = 0
assert det.delay == 0
@not_eiger
def test_delayl(det):
assert det.delayl == 0

View File

@ -1,89 +0,0 @@
import pytest
import datetime as dt
from slsdet import Detector, detectorType
"""
These tests are designed to work the API and catch
any changes in behavior or naming. Tests are expected
to pass with a virtual detector or a real one
"""
@pytest.fixture
def jf():
from slsdet import Jungfrau
return Jungfrau()
jungfrautest = pytest.mark.skipif(
Detector().type != detectorType.JUNGFRAU, reason="Only valid for Jungfrau"
)
@jungfrautest
def test_storagecells(jf):
for i in range(16):
jf.storagecells = i
assert jf.storagecells == i
jf.storagecells = 0 # default
@jungfrautest
def test_storagecell_start(jf):
for i in range(16):
jf.storagecell_start = i
assert jf.storagecell_start == i
jf.storagecells = 15 # default
@jungfrautest
def test_storagecell_delay(jf):
for t in [0.001, 0.0002, 0.0013]:
jf.storagecell_delay = t
assert jf.storagecell_delay == t
jf.storagecell_delay = 0 # default
@jungfrautest
def test_temp_event(jf):
# hard to test with virtual server
assert jf.temp_event == 0
@jungfrautest
def test_temp_threshold(jf):
for th in [0, 10, 43, 72]:
jf.temp_threshold = th
assert jf.temp_threshold == th
jf.temp_threshold = 0
@jungfrautest
def test_auto_comp_disable(jf):
for v in [True, False]:
jf.auto_comp_disable = v
assert jf.auto_comp_disable == v
@jungfrautest
def test_numinterfaces(jf):
for n in [2, 1]:
jf.numinterfaces = n
assert jf.numinterfaces == n
@jungfrautest
def test_dr(jf):
assert jf.dr == 16
@jungfrautest
def test_temp_control(jf):
for v in [True, False]:
jf.temp_control = v
assert jf.temp_control == v
@jungfrautest
def test_startingfnum(jf):
for n in [10, 127, 43321, 1]:
jf.startingfnum = n
assert jf.startingfnum == n
@jungfrautest
def test_selinterface(jf):
for i in [1, 0]:
jf.selinterface = i
assert jf.selinterface == i

View File

@ -15,7 +15,7 @@ pycmd += ['vrf', 'vtr', 'vrs', 'vtgstv', 'vsvn', 'vtrim',
'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', 'daclist', 'dacvalues', 'vcal', 'vcas']
, 'vcmp_rl', 'vcmp_rr']
missing = []
for c in cmd:

View File

@ -11,10 +11,6 @@ import subprocess
from parse import remove_comments
def single_line_enum(line):
sub = line[line.find('{')+1:line.find('}')]
return sub.strip().split(',')
def extract_enums(lines):
line_iter = iter(lines)
enums = {}
@ -22,26 +18,19 @@ def extract_enums(lines):
m = re.search("(?<=enum )\w+(?= {)", line)
if m:
enum_name = m.group()
print(enum_name)
# print(line)
# print(enum_name)
fields = []
while True:
l = next(line_iter)
if '};' in l:
break
m = re.search("\w+", l)
try:
# print('\t', m.group())
fields.append(m.group())
#deal with single line enums
if '};' in line:
fields = single_line_enum(line)
else:
#deal with multi line enums
while True:
l = next(line_iter)
if '};' in l:
break
m = re.search("\w+", l)
try:
# print('\t', m.group())
fields.append(m.group())
except:
pass
except:
pass
enums[enum_name] = fields
return enums

View File

@ -47,8 +47,6 @@ lines = []
ag2 = []
cn = []
def get_arguments(node):
args = [a.type.spelling for a in node.get_arguments()]
args = [
@ -68,12 +66,8 @@ def get_fdec(node):
else:
return_type = 'void'
if node.is_const_method():
const = 'const'
else:
const = ''
args = ", ".join(args)
args = f'({return_type}(Detector::*)({args}){const})'
args = f'({return_type}(Detector::*)({args}))'
return args
@ -91,7 +85,6 @@ def visit(node):
lines.append(
f'.def("{child.spelling}",{fs} &Detector::{child.spelling}{args})'
)
cn.append(child)
for child in node.get_children():
visit(child)

View File

@ -1,5 +1,5 @@
"""
Setup file for slsdet
Setup file for sls_detector
Build upon the pybind11 example found here: https://github.com/pybind/python_example
"""
from setuptools import setup, Extension, find_packages

View File

@ -3,14 +3,11 @@ from _slsdet import slsDetectorDefs
from _slsdet import IpAddr, MacAddr
runStatus = slsDetectorDefs.runStatus
timingMode = slsDetectorDefs.timingMode
speedLevel = slsDetectorDefs.speedLevel
dacIndex = slsDetectorDefs.dacIndex
detectorType = slsDetectorDefs.detectorType
from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask
from .utils import Geometry, to_geo, element, reduce_time, is_iterable
from . import utils as ut
from .utils import Geometry, to_geo, element
from .registers import Register, Adc_register
import datetime as dt
@ -18,7 +15,6 @@ from functools import wraps
from collections import namedtuple
import socket
def freeze(cls):
cls._frozen = False
@ -63,12 +59,15 @@ class Detector(CppDetectorApi):
self._register = Register(self)
self._adc_register = Adc_register(self)
# CONFIGURATION
def __len__(self):
return self.size()
def __repr__(self):
return "{}(id = {})".format(self.__class__.__name__, self.getShmId())
return '{}(id = {})'.format(self.__class__.__name__,
self.getShmId())
def free(self):
self.freeSharedMemory()
@ -91,6 +90,7 @@ class Detector(CppDetectorApi):
@property
def hostname(self):
print('getting host!')
return self.getHostname()
@hostname.setter
@ -108,7 +108,7 @@ class Detector(CppDetectorApi):
@property
def server_version(self):
# TODO! handle hex print
#TODO! handle hex print
return element_if_equal(self.getDetectorServerVersion())
@property
@ -129,7 +129,7 @@ class Detector(CppDetectorApi):
@dr.setter
def dr(self, dr):
self.setDynamicRange(dr)
self.setDynamicRange(dr)
@property
def module_geometry(self):
@ -160,54 +160,65 @@ class Detector(CppDetectorApi):
def frames(self, n_frames):
self.setNumberOfFrames(n_frames)
@property
def triggers(self):
return element_if_equal(self.getNumberOfTriggers())
@triggers.setter
def triggers(self, n_triggers):
self.setNumberOfTriggers(n_triggers)
@property
def exptime(self):
if self.type == detectorType.MYTHEN3:
res = self.getExptimeForAllGates()
else:
res = self.getExptime()
return reduce_time(res)
res = self.getExptime()
return element_if_equal([it.total_seconds() for it in res])
@exptime.setter
def exptime(self, t):
self.setExptime(t)
if isinstance(t, dt.timedelta):
self.setExptime(t)
else:
self.setExptime(dt.timedelta(seconds=t))
@property
def subexptime(self):
res = self.getSubExptime()
return element_if_equal([it.total_seconds() for it in res])
@subexptime.setter
def subexptime(self, t):
if isinstance(t, dt.timedelta):
self.setSubExptime(t)
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):
res = self.getPeriod()
return reduce_time(res)
return element_if_equal([it.total_seconds() for it in res])
@period.setter
def period(self, t):
self.setPeriod(t)
if isinstance(t, dt.timedelta):
self.setPeriod(t)
else:
self.setPeriod(dt.timedelta(seconds=t))
@property
@element
def delay(self):
return ut.reduce_time(self.getDelayAfterTrigger())
@delay.setter
def delay(self, t):
self.setDelayAfterTrigger(t)
@property
@element
def delayl(self):
return ut.reduce_time(self.getDelayAfterTriggerLeft())
# Time
@property
def rx_framescaught(self):
return element_if_equal(self.getFramesCaught())
@property
def startingfnum(self):
@ -216,7 +227,10 @@ class Detector(CppDetectorApi):
@startingfnum.setter
def startingfnum(self, value):
self.setStartingFrameNumber(value)
# TODO! add txdelay
#TODO! add txdelay
@property
def use_receiver(self):
@ -282,21 +296,14 @@ class Detector(CppDetectorApi):
@property
def rx_lastclient(self):
return element_if_equal(self.getRxLastClientIP())
# FILE
@property
@element
def numinterfaces(self):
return self.getNumberofUDPInterfaces()
@numinterfaces.setter
def numinterfaces(self, value):
self.setNumberofUDPInterfaces(value)
#FILE
@property
def fformat(self):
return element_if_equal(self.getFileFormat())
@fformat.setter
def fformat(self, format):
self.setFileFormat(format)
@ -407,13 +414,14 @@ class Detector(CppDetectorApi):
def zmqip(self, ip):
self.setClientZmqIp(ip)
@property
def udp_dstip(self):
return element_if_equal(self.getDestinationUDPIP())
@udp_dstip.setter
def udp_dstip(self, ip):
if ip == "auto":
if ip == 'auto':
ip = socket.gethostbyname(self.rx_hostname)
self.setDestinationUDPIP(IpAddr(ip))
@ -423,7 +431,7 @@ class Detector(CppDetectorApi):
@udp_dstip2.setter
def udp_dstip2(self, ip):
if ip == "auto":
if ip == 'auto':
ip = socket.gethostbyname(self.rx_hostname)
self.setDestinationUDPIP2(IpAddr(ip))
@ -443,6 +451,7 @@ class Detector(CppDetectorApi):
def udp_dstmac2(self, mac):
self.setDestinationUDPMAC2(MacAddr(mac))
@property
def udp_srcip(self):
return element_if_equal(self.getSourceUDPIP())
@ -499,6 +508,7 @@ class Detector(CppDetectorApi):
def src_udpip(self, ip):
self.setSourceUDPIP(IpAddr(ip))
@property
def src_udpmac2(self):
return element_if_equal(self.getSourceUDPMAC2())
@ -535,6 +545,8 @@ class Detector(CppDetectorApi):
def rx_status(self):
return element_if_equal(self.getReceiverStatus())
@property
def rx_udpsocksize(self):
return element_if_equal(self.getRxUDPSocketBufferSize())
@ -549,7 +561,7 @@ class Detector(CppDetectorApi):
@property
def trimbits(self):
return NotImplementedError("trimbits are set only")
return NotImplementedError('trimbits are set only')
@trimbits.setter
def trimbits(self, fname):
@ -583,6 +595,7 @@ class Detector(CppDetectorApi):
def adcreg(self):
return self._adc_register
@property
def led(self):
return element_if_equal(self.getLEDEnable())
@ -623,11 +636,11 @@ class Detector(CppDetectorApi):
@property
def timing(self):
return element_if_equal(self.getTimingMode())
return element_if_equal(self.getTimingMode())
@timing.setter
def timing(self, mode):
self.setTimingMode(mode)
self.setTimingMode(mode)
@property
def trimen(self):
@ -639,7 +652,9 @@ class Detector(CppDetectorApi):
@property
def vthreshold(self):
return element_if_equal(self.getDAC(dacIndex.VTHRESHOLD, False))
return element_if_equal(self.getDAC(dacIndex.THRESHOLD))
@property
def type(self):
@ -653,27 +668,10 @@ class Detector(CppDetectorApi):
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 subexptime(self):
res = self.getSubExptime()
return reduce_time(res)
@subexptime.setter
def subexptime(self, t):
self.setSubExptime(t)
@property
def subdeadtime(self):
res = self.getSubDeadTime()
reduce_time(res)
@subdeadtime.setter
def subdeadtime(self, t):
self.setSubDeadTime(t)
@property
def partialreset(self):
return element_if_equal(self.getPartialReset())
@ -685,7 +683,7 @@ class Detector(CppDetectorApi):
@property
def tengiga(self):
return element_if_equal(self.getTenGiga())
@tengiga.setter
def tengiga(self, value):
self.setTenGiga(value)
@ -733,116 +731,19 @@ class Detector(CppDetectorApi):
return element_if_equal([it.total_seconds() for it in res])
"""
Jungfrau specific
"""
@property
@element
def auto_comp_disable(self):
return self.getAutoCompDisable()
def storeinram(self):
return element_if_equal(self.getStoreInRamMode())
@auto_comp_disable.setter
def auto_comp_disable(self, value):
self.setAutoCompDisable(value)
@property
@element
def storagecells(self):
return self.getNumberOfAdditionalStorageCells()
@storagecells.setter
def storagecells(self, n_cells):
self.setNumberOfAdditionalStorageCells(n_cells)
@property
@element
def storagecell_start(self):
return self.getStorageCellStart()
@storagecell_start.setter
def storagecell_start(self, value):
self.setStorageCellStart(value)
@property
@element
def storagecell_delay(self):
return ut.reduce_time(self.getStorageCellDelay())
@storagecell_delay.setter
def storagecell_delay(self, t):
self.setStorageCellDelay(t)
@property
@element
def temp_threshold(self):
return self.getThresholdTemperature()
@temp_threshold.setter
def temp_threshold(self, value):
self.setThresholdTemperature(value)
@property
@element
def temp_event(self):
return self.getTemperatureEvent()
@temp_event.setter
def temp_event(self, value):
if value != 0:
raise ValueError("Value needs to be 0 for reset. Setting not allowed")
self.resetTemperatureEvent()
@property
@element
def temp_control(self):
return self.getTemperatureControl()
@temp_control.setter
def temp_control(self, value):
self.setTemperatureControl(value)
@property
@element
def selinterface(self):
return self.getSelectedUDPInterface()
@selinterface.setter
def selinterface(self, i):
self.selectUDPInterface(i)
"""
Gotthard2
"""
@property
@element
def veto(self):
return self.getVeto()
@veto.setter
def veto(self, value):
self.setVeto(value)
@storeinram.setter
def storeinram(self, value):
self.setStoreInRamMode(value)
"""
Mythen3 specific
"""
@property
def gatedelay(self):
return reduce_time(self.getGateDelayForAllGates())
@gatedelay.setter
def gatedelay(self, value):
if is_iterable(value):
if len(value) == 3:
for i, v in enumerate(value):
self.setGateDelay(i, v)
else:
self.setGateDelay(-1, value)
@property
def counters(self):
mask = self.getCounterMask()
@ -852,10 +753,11 @@ class Detector(CppDetectorApi):
else:
return [get_set_bits(m) for m in mask]
@counters.setter
def counters(self, values):
self.setCounterMask(list_to_bitmask(values))
"""
CTB stuff
"""
@ -903,7 +805,7 @@ class Detector(CppDetectorApi):
@property
def dbitclk(self):
return element_if_equal(self.getDBITClock())
@dbitclk.setter
def dbitclk(self, value):
self.setDBITClock(value)
@ -943,7 +845,7 @@ class Detector(CppDetectorApi):
@property
def adcphase(self):
return element_if_equal(self.getADCPhase())
@adcphase.setter
def adcphase(self, value):
self.setADCPhase(value)
@ -967,13 +869,21 @@ class Detector(CppDetectorApi):
@property
def syncclk(self):
return element_if_equal(self.getSYNCClock())
@property
def pattern(self):
# TODO! Clean fix
#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):
@ -1051,6 +961,7 @@ class Detector(CppDetectorApi):
def patwaittime2(self, nclk):
self.setPatternWaitTime(2, nclk)
@property
def patloop0(self):
return element_if_equal(self.getPatternLoopAddresses(0))
@ -1099,6 +1010,7 @@ class Detector(CppDetectorApi):
def patnloop2(self, n):
self.setPatternLoopCycles(2, n)
@property
@element
def v_a(self):
@ -1176,4 +1088,4 @@ class Detector(CppDetectorApi):
@property
@element
def im_io(self):
return self.getMeasuredCurrent(dacIndex.I_POWER_IO)
return self.getMeasuredCurrent(dacIndex.I_POWER_IO)

View File

@ -60,23 +60,23 @@ class EigerDacs(DetectorDacs):
"""
Eiger specific dacs
"""
_dacs = [('vsvp', dacIndex.VSVP,0, 4000, 0),
('vtrim', dacIndex.VTRIM,0, 4000, 2500),
('vrpreamp', dacIndex.VRPREAMP,0, 4000, 3300),
('vrshaper', dacIndex.VRSHAPER,0, 4000, 1400),
('vsvn', dacIndex.VSVN,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),
('vcal', dacIndex.VCAL,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),
('vishaper', dacIndex.VISHAPER,0, 4000, 1550),
('iodelay', dacIndex.IO_DELAY,0, 4000, 660)]
_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

View File

@ -13,32 +13,49 @@ 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.VCASSH, 0, 4000, 1220),
_dacs = [('vcassh', dacIndex.CASSH, 0, 4000, 1220),
('vth2', dacIndex.VTH2, 0, 4000, 2800),
('vrshaper', dacIndex.VRSHAPER, 0, 4000, 1280),
('vrshaper_n', dacIndex.VRSHAPER_N, 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.VTH1, 0, 4000, 2800),
('vth1', dacIndex.THRESHOLD, 0, 4000, 2800),
('vicin', dacIndex.VICIN, 0, 4000, 1708),
('vcas', dacIndex.VCAS, 0, 4000, 1800),
('vrpreamp', dacIndex.VRPREAMP, 0, 4000, 1100),
('vcal_n', dacIndex.VCAL_N, 0, 4000, 1100),
('vcas', dacIndex.CAS, 0, 4000, 1800),
('vpreamp', dacIndex.PREAMP, 0, 4000, 1100),
('vpl', dacIndex.VPL, 0, 4000, 1100),
('vipre', dacIndex.VIPRE, 0, 4000, 2624),
('vishaper', dacIndex.VISHAPER, 0, 4000, 1708),
('vcal_p', dacIndex.VCAL_P, 0, 4000, 1712),
('vtrim', dacIndex.VTRIM, 0, 4000, 2800),
('vdcsh', dacIndex.VDCSH, 0, 4000, 800),
('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]
#vthreshold??
@freeze

View File

@ -7,17 +7,10 @@ but not directly used in controlling the detector
from collections import namedtuple
import _slsdet #C++ lib
import functools
import datetime as dt
Geometry = namedtuple('Geometry', ['x', 'y'])
def is_iterable(item):
try:
iter(item)
except TypeError:
return False
return True
def get_set_bits(mask):
"""
Return a list of the set bits in a python integer
@ -48,9 +41,6 @@ def all_equal(mylist):
def element_if_equal(mylist):
"""If all elements are equal return only one element"""
if not is_iterable(mylist):
return mylist
if all_equal(mylist):
if len(mylist) == 0:
return None
@ -59,15 +49,6 @@ def element_if_equal(mylist):
else:
return mylist
def reduce_time(mylist):
res = element_if_equal(element_if_equal(mylist))
if isinstance(res, dt.timedelta):
return res.total_seconds()
elif isinstance(res[0], list):
return [[item.total_seconds() for item in subl] for subl in res]
else:
return [r.total_seconds() for r in res]
def element(func):
"""
Wrapper to return either list or element
@ -88,8 +69,3 @@ def eiger_register_to_time(register):
exponent = register & 0b111
return clocks*10**exponent / 100e6
def make_timedelta(t):
if isinstance(t, dt.timedelta):
return t
else:
return dt.timedelta(seconds=t)

20
python/sphinx/Makefile Executable file
View File

@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = sls_detector_tools
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

134
python/sphinx/code_quality.rst Executable file
View File

@ -0,0 +1,134 @@
Code quality
=============================
For usability and reliability of the software the code needs to be high quality. For this
project it means meeting the four criteria described below. Any addition should pass all of
them.
--------------------------------
Look, read and feel like Python
--------------------------------
When using classes and functions from the
package it should feel like you are using Python tools and be forces
to write C++ style code with Python syntax.
::
with xray_box.shutter_open():
for th in threshold:
d.vthreshold = th
d.acq()
should be preferred over
::
N = len(threshold)
xray_box.open_shutter()
for i in range(N):
d.dacs.set_dac('vthreshold', threshold[i])
d.acq()
xray_box.close_shutter()
even if the difference might seem small.
--------------------
Have documentation
--------------------
Classes and functions should be documented with doc-strings
in the source code. Preferably with examples. The syntax to be used
is numpy-sphinx.
::
def function(arg):
"""
This is a function that does something
Parameters
----------
arg: int
An argument
Returns
--------
value: double
Returns a value
"""
return np.sin(arg+np.pi)
---------------------------------
Pass static analysis with pylint
---------------------------------
Yes, anything less than 9/10 just means that you are lazy. If
there is a good reason why to diverge, then we can always
add an exception.
Currently the following additions are made:
* good-names: x, y, ax, im etc.
* function arguments 10
* Whitelist: numpy, _sls
-----------------------
Tested code
-----------------------
Last but not least... *actually last just because of the long list included.*
All code that goes in should have adequate tests. If a new function does not
have a minimum of one test it does not get added.
**Unit-tests with pytest and mocker**
::
----------- coverage: platform linux, python 3.6.4-final-0 -----------
Name Stmts Miss Cover
------------------------------------------------
sls_detector/__init__.py 4 0 100%
sls_detector/decorators.py 14 3 79%
sls_detector/detector.py 461 115 75%
sls_detector/eiger.py 150 64 57%
sls_detector/errors.py 7 0 100%
sls_detector/jungfrau.py 59 26 56%
------------------------------------------------
TOTAL 695 208 70%
========= 78 passed in 0.60 seconds =========
**Simple integration tests**
These tests require a detector connected. Performs simple tasks like setting
exposure time and reading back to double check the value
::
----------- coverage: platform linux, python 3.6.4-final-0 -----------
Name Stmts Miss Cover
------------------------------------------------
sls_detector/__init__.py 4 0 100%
sls_detector/decorators.py 14 0 100%
sls_detector/detector.py 461 103 78%
sls_detector/eiger.py 150 20 87%
sls_detector/errors.py 7 0 100%
sls_detector/jungfrau.py 59 26 56%
------------------------------------------------
TOTAL 695 149 79%
========= 67 passed, 1 skipped in 16.66 seconds =========
**Complex integration test**
Typical measurements. Might require X-rays. Tests are usually evaluated from
plots

370
python/sphinx/command_line.rst Executable file
View File

@ -0,0 +1,370 @@
Command line to Python
=========================
If you are already familiar with the command line interface to the
slsDetectorSoftware here is a quick reference translating to Python commands
.. note ::
Commands labeled Mythen only or Gotthard only are currently not implemented in the
Python class. If you need this functionallity please contact the SLS Detector Group
.. py:currentmodule:: sls_detector
.. |ro| replace:: *(read only)*
.. |free| replace:: :py:func:`Detector.free_shared_memory`
.. |sub| replace:: :py:attr:`Detector.sub_exposure_time`
.. |mg| replace:: Mythen and Gotthard only
.. |g| replace:: Gotthard only
.. |m| replace:: Mythen only
.. |msp| replace:: :py:attr:`Detector.measured_subperiod`
.. |new_chiptest| replace:: New chip test board only
.. |chiptest| replace:: Chip test board only
.. |dr| replace:: :py:attr:`Detector.dynamic_range`
.. |j| replace:: Jungfrau only
.. |te| replace:: :py:attr:`Detector.trimmed_energies`
.. |temp_fpgaext| replace:: :py:attr:`Detector.temp`.fpgaext
.. |epa| replace:: :py:func:`Eiger.pulse_all_pixels`
.. |rfc| replace:: :py:func:`Detector.reset_frames_caught`
.. |rfi| replace:: :py:attr:`Detector.receiver_frame_index`
.. |ron| replace:: :py:attr:`Detector.receiver_online`
.. |flipy| replace:: :py:attr:`Detector.flipped_data_y`
.. |flipx| replace:: :py:attr:`Detector.flipped_data_x`
.. |adcr| replace:: :py:func:`DetectorApi.writeAdcRegister`
.. |sb| replace:: :py:func:`DetectorApi.setBitInRegister`
.. |cb| replace:: :py:func:`DetectorApi.clearBitInRegister`
.. |tempth| replace:: :py:attr:`Jungfrau.temperature_threshold`
.. |tempev| replace:: :py:attr:`Jungfrau.temperature_event`
.. |tempco| replace:: :py:attr:`Jungfrau.temperature_control`
.. |depr| replace:: *Deprecated/Internal*
.. |nimp| replace:: *Not implemented*
.. |rudp| replace:: :py:attr:`Detector.rx_realudpsocksize`
.. |lci| replace:: :py:attr:`Detector.last_client_ip`
.. |rlci| replace:: :py:attr:`Detector.receiver_last_client_ip`
.. |fdp| replace:: :py:attr:`Detector.frame_discard_policy`
.. |apic| replace:: :py:attr:`Detector.api_compatibility`
------------------------
Commands
------------------------
===================== ===================================== ================== =========
Command Python Implementation Tests
===================== ===================================== ================== =========
sls_detector_acquire :py:func:`Detector.acq` OK OK
test |depr| \- \-
help help(Detector.acq) \- \-
exitserver |depr| \- \-
exitreceiver |depr| \- \-
flippeddatay |flipy| OK \-
digitest |depr| \- \-
bustest |depr| \- \-
digibittest Which detector? \- \-
reg :py:attr:`Detector.register` OK \-
adcreg |adcr| OK \-
setbit |sb| OK \-
clearbit |cb| OK \-
getbit |nimp| \- \-
r_compression Not implemented in receiver \- \-
acquire :py:func:`Detector.acq` OK \-
busy :py:attr:`Detector.busy` OK Partial
status :py:attr:`Detector.status` OK |ro| \-
status start :py:func:`Detector.start_detector` OK \-
status stop :py:func:`Detector.stop_detector` OK \-
data |depr| \- \-
frame |depr| \- \-
readctr |g| \- \-
resetctr |g| \- \-
resmat :py:attr:`Eiger.eiger_matrix_reset` OK OK
free |free| OK \-
hostname :py:attr:`Detector.hostname` OK OK
add |nimp| \- \-
replace |nimp| \- \-
user |nimp| \- \-
master |nimp| \- \-
sync Which detector? \- \-
online :py:attr:`Detector.online` OK \-
checkonline |nimp| \- \-
activate :py:attr:`Eiger.active` \- \-
nmod :py:attr:`Detector.n_modules` OK \-
maxmod |depr| \- \-
dr |dr| OK OK
roi |g| \- \-
detsizechan :py:attr:`Detector.image_size` OK \-
roimask |nimp| \- \-
flippeddatax |flipx| OK \-
tengiga :py:attr:`Eiger.tengiga` OK \-
gappixels :py:attr:`Eiger.add_gappixels` OK \-
flags :py:attr:`Detector.flags` OK \-
extsig |mg| \- \-
programfpga |j| \- \-
resetfpga |j| \- \-
powerchip :py:attr:`Jungfrau.powerchip` \- \-
led |nimp| \- \-
auto_comp_disable |j| \- \-
pulse Used in |epa| OK \-
pulsenmove Used in |epa| OK \-
pulsechip :py:func:`Eiger.pulse_chip` OK \-
checkdetversion |apic| \- \-
checkrecversion |apic| \- \-
moduleversion |m| \- \-
detectornumber :py:attr:`Detector.detector_number` OK \-
modulenumber |m| \- \-
detectorversion :py:attr:`Detector.firmware_version` OK OK
softwareversion :py:attr:`Detector.server_version` \- \-
thisversion :py:attr:`Detector.client_version` Reads date \-
receiverversion :py:attr:`Detector.receiver_version` Reads date \-
timing :py:attr:`Detector.timing_mode` OK \-
exptime :py:attr:`Detector.exposure_time` OK OK
subexptime |sub| OK OK
period :py:attr:`Detector.period` OK OK
subdeadtime :py:attr:`Eiger.sub_deadtime` OK OK
delay :py:attr:`Jungfrau.delay` OK \-
gates :py:attr:`Jungfrau.n_gates` OK \-
frames :py:attr:`Detector.n_frames` OK OK
cycles :py:attr:`Detector.n_cycles` OK \-
probes :py:attr:`Jungfrau.n_probes` OK \-
measurements :py:attr:`Detector.n_measurements` OK \-
samples Chip test board only (new?) \- \-
storagecells :py:attr:`Jungfrau.n_storagecells` OK \-
storagecell_start :py:attr:`Jungfrau.storagecell_start` OK \-
exptimel |mg| \- \-
periodl |mg| \- \-
delayl |mg| \- \-
gatesl |mg| \- \-
framesl |mg| \- \-
cyclesl |mg| \- \-
probesl |mg| \- \-
now |nimp| \- \-
timestamp |m| \- \-
nframes |nimp| \- \-
measuredperiod :py:attr:`Detector.measured_period` OK \-
measuredsubperiod |msp| \- \-
clkdivider :py:attr:`Detector.readout_clock` OK OK
setlength |m| \- \-
waitstates |m| \- \-
totdivider |m| \- \-
totdutycycle |m| \- \-
phasestep |g| \- \-
oversampling |new_chiptest| \- \-
adcclk |new_chiptest| \- \-
adcphase |new_chiptest| \- \-
adcpipeline |new_chiptest| \- \-
dbitclk |new_chiptest| \- \-
dbitphase |new_chiptest| \- \-
dbitpipeline |new_chiptest| \- \-
config :py:func:`Detector.load_config` OK \-
rx_printconfig |nimp| \- \-
parameters :py:func:`Detector.load_parameters` OK \-
setup |nimp| \- \-
flatfield |nimp| \- \-
ffdir |nimp| \- \-
ratecorr :py:attr:`Detector.rate_correction` OK \-
badchannels |nimp| \- \-
angconv |m| \- \-
globaloff |nimp| \- \-
fineoff |nimp| \- \-
binsize |nimp| \- \-
angdir |nimp| \- \-
moveflag |nimp| \- \-
samplex |nimp| \- \-
sampley |nimp| \- \-
threaded :py:attr:`Detector.threaded` OK \-
darkimage |nimp| \- \-
gainimage |nimp| \- \-
settingsdir :py:attr:`Detector.settings_path` OK \-
trimdir |nimp| \- \-
caldir |nimp| \- \-
trimen :py:attr:`Detector.trimmed_energies` OK \-
settings :py:attr:`Detector.settings` OK \-
threshold :py:attr:`Detector.threshold` OK \-
thresholdnotb |nimp| \- \-
trimbits :py:func:`Detector.load_trimbits` OK \-
trim |nimp| \- \-
trimval :py:attr:`Detector.trimbits` OK OK
pedestal |nimp| \- \-
vthreshold :py:attr:`Detector.vthreshold` OK \-
vcalibration |nimp| \- \-
vtrimbit |nimp| \- \-
vpreamp |nimp| \- \-
vshaper1 |nimp| \- \-
vshaper2 |nimp| \- \-
vhighvoltage :py:attr:`Detector.high_voltage` OK \-
vapower |nimp| \- \-
vddpower |nimp| \- \-
vshpower |nimp| \- \-
viopower |nimp| \- \-
vref_ds :py:attr:`Jungfrau.dacs.vref_ds` OK \-
vcascn_pb |nimp| \- \-
vcascp_pb |nimp| \- \-
vout_cm |nimp| \- \-
vcasc_out |nimp| \- \-
vin_cm |nimp| \- \-
vref_comp |nimp| \- \-
ib_test_c |nimp| \- \-
dac0 |nimp| \- \-
dac1 |nimp| \- \-
dac2 |nimp| \- \-
dac3 |nimp| \- \-
dac4 |nimp| \- \-
dac5 |nimp| \- \-
dac6 |nimp| \- \-
dac7 |nimp| \- \-
vsvp :py:attr:`Eiger.dacs.vsvp` OK \-
vsvn :py:attr:`Eiger.dacs.vsvn` OK \-
vtr :py:attr:`Eiger.dacs.vtr` OK \-
vrf :py:attr:`Eiger.dacs.vrf` OK \-
vrs :py:attr:`Eiger.dacs.vrs` OK \-
vtgstv :py:attr:`Eiger.dacs.vtgstv` OK \-
vcmp_ll :py:attr:`Eiger.dacs.vcmp_ll` OK \-
vcmp_ll :py:attr:`Eiger.dacs.vcmp_ll` OK \-
vcall :py:attr:`Eiger.dacs.vcall` OK \-
vcmp_rl :py:attr:`Eiger.dacs.vcmp_rl` OK \-
vcmp_rr :py:attr:`Eiger.dacs.vcmp_rr` OK \-
rxb_rb :py:attr:`Eiger.dacs.rxb_rb` OK \-
rxb_lb :py:attr:`Eiger.dacs.rxb_lb` OK \-
vcp :py:attr:`Eiger.dacs.vcp` OK \-
vcn :py:attr:`Eiger.dacs.vcn` OK \-
vis :py:attr:`Eiger.dacs.vis` OK \-
iodelay :py:attr:`Eiger.dacs.iodelay` OK \-
dac |nimp| \- \-
adcvpp |nimp| \- \-
v_a |nimp| \- \-
v_b |nimp| \- \-
v_c |nimp| \- \-
v_d |nimp| \- \-
v_io |nimp| \- \-
v_chip |nimp| \- \-
v_limit |nimp| \- \-
vIpre |nimp| \- \-
VcdSh |nimp| \- \-
Vth1 |nimp| \- \-
Vth2 |nimp| \- \-
Vth3 |nimp| \- \-
VPL |nimp| \- \-
Vtrim |nimp| \- \-
vIbias |nimp| \- \-
vIinSh |nimp| \- \-
cas |nimp| \- \-
casSh |nimp| \- \-
vIbiasSh |nimp| \- \-
vIcin |nimp| \- \-
vIpreOut |nimp| \- \-
temp_adc |nimp| \- \-
temp_fpga :py:attr:`Detector.temp`.fpga OK \-
temp_fpgaext |temp_fpgaext| OK \-
temp_10ge :py:attr:`Detector.temp`.t10ge OK \-
temp_dcdc :py:attr:`Detector.temp`.dcdc OK \-
temp_sodl :py:attr:`Detector.temp`.sodl OK \-
temp_sodr :py:attr:`Detector.temp`.sodr OK \-
adc |nimp| \- \-
temp_fpgafl :py:attr:`Detector.temp`.fpgafl OK \-
temp_fpgafr :py:attr:`Detector.temp`.fpgafr OK \-
i_a |nimp| \- \-
i_b |nimp| \- \-
i_c |nimp| \- \-
i_d |nimp| \- \-
i_io |nimp| \- \-
vm_a |nimp| \- \-
vm_b |nimp| \- \-
vm_c |nimp| \- \-
vm_d |nimp| \- \-
vm_io |nimp| \- \-
temp_threshold |tempth| \- \-
temp_control |tempco| \- \-
temp_event |tempev| \- \-
outdir :py:attr:`Detector.file_path` OK OK
fname :py:attr:`Detector.file_name` OK OK
index :py:attr:`Detector.file_index` OK OK
enablefwrite :py:attr:`Detector.file_write` OK OK
overwrite :py:attr:`Detector.file_overwrite` OK \-
currentfname |nimp| \- \-
fileformat :py:attr:`Detector.file_format` OK \-
positions |depr| \- \-
startscript |depr| \- \-
startscriptpar |depr| \- \-
stopscript |depr| \- \-
stopscriptpar |depr| \- \-
scriptbefore |depr| \- \-
scriptbeforepar |depr| \- \-
scriptafter |depr| \- \-
scriptafterpar |depr| \- \-
headerafter |depr| \- \-
headerbefore |depr| \- \-
headerbeforepar |depr| \- \-
headerafterpar |depr| \- \-
encallog |depr| \- \-
angcallog |depr| \- \-
scan0script |depr| \- \-
scan0par |depr| \- \-
scan0prec |depr| \- \-
scan0steps |depr| \- \-
scan0range |depr| \- \-
scan1script |depr| \- \-
scan1par |depr| \- \-
scan1prec |depr| \- \-
scan1steps |depr| \- \-
scan1range |depr| \- \-
rx_hostname :py:attr:`Detector.rx_hostname` OK \-
rx_udpip :py:attr:`Detector.rx_udpip` OK \-
rx_udpmac :py:attr:`Detector.rx_udpmac` OK \-
rx_udpport :py:attr:`Detector.rx_udpport` OK \-
rx_udpport2 :py:attr:`Detector.rx_udpport` OK \-
rx_udpsocksize :py:attr:`Detector.rx_udpsocksize` OK \-
rx_realudpsocksize |rudp| OK
detectormac :py:attr:`Detector.detector_mac` OK \-
detectorip :py:attr:`Detector.detector_ip` OK \-
txndelay_left :py:attr:`Eiger.delay`.left OK \-
txndelay_right :py:attr:`Eiger.delay`.right OK \-
txndelay_frame :py:attr:`Eiger.delay`.frame OK \-
flowcontrol_10g :py:attr:`Eiger.flowcontrol_10g` OK \-
zmqport :py:attr:`Detector.client_zmqport` Read \-
rx_zmqport :py:attr:`Detector.rx_zmqport` Read \-
rx_datastream :py:attr:`Detector.rx_datastream` OK \-
zmqip :py:attr:`Detector.client_zmqip` OK \-
rx_zmqip :py:attr:`Detector.rx_zmqip` Read \-
rx_jsonaddheader :py:attr:`Detector.rx_jsonaddheader` OK \-
configuremac :py:attr:`Detector.config_network` OK \-
rx_tcpport :py:attr:`Detector.rx_tcpport`
port |nimp| \- \-
stopport |nimp| \- \-
lock :py:attr:`Detector.lock` OK \-
lastclient :py:attr:`Detector.last_client_ip` OK \-
receiver start :py:func:`Detector.start_receiver` OK \-
receiver stop :py:func:`Detector.stop_receiver` \- \-
r_online |ron| OK \-
r_checkonline |nimp| \- \-
framescaught :py:attr:`Detector.frames_caught` OK \-
resetframescaught |rfc| OK \-
frameindex |rfi| OK \-
r_lock :py:attr:`Detector.lock_receiver` OK \-
r_lastclient |rlci| OK \-
r_readfreq |nimp| \- \-
rx_fifodepth :py:attr:`Detector.rx_fifodepth` OK \-
r_silent |nimp| \- \-
r_framesperfile :py:attr:`Detector.n_frames_per_file` OK \-
r_discardpolicy |fdp| OK \-
r_padding :py:attr:`Detector.file_padding` OK \-
adcinvert |chiptest| \- \-
adcdisable |chiptest| \- \-
pattern |chiptest| \- \-
patword |chiptest| \- \-
patioctrl |chiptest| \- \-
patclkctrl |chiptest| \- \-
patlimits |chiptest| \- \-
patloop0 |chiptest| \- \-
patnloop0 |chiptest| \- \-
patwait0 |chiptest| \- \-
patwaittime0 |chiptest| \- \-
patloop1 |chiptest| \- \-
patnloop1 |chiptest| \- \-
patwait1 |chiptest| \- \-
patwaittime1 |chiptest| \- \-
patloop2 |chiptest| \- \-
patnloop2 |chiptest| \- \-
patwait2 |chiptest| \- \-
patwaittime2 |chiptest| \- \-
dut_clk |chiptest| \- \-
===================== ===================================== ================== =========

178
python/sphinx/conf.py Executable file
View File

@ -0,0 +1,178 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# sls_detector_tools documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 1 10:17:29 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx.ext.autosummary']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'sls_detector'
copyright = '2019, Sls Detector Group'
author = 'Erik Frojdh'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '4.0.1'
# The full version, including alpha/beta/rc tags.
release = '4.0.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
'donate.html',
]
}
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'sls_detector_doc'
napoleon_use_ivar = True
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'sls_detector.tex', 'sls_detector Documentation',
'Erik Frojdh', 'manual'),
]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'sls_detector_tools', 'sls_detector_tools Documentation',
[author], 1)
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'py_sls', 'py_sls Documentation',
author, 'py_sls', 'One line description of project.',
'Miscellaneous'),
]

12
python/sphinx/cpp_api.rst Executable file
View File

@ -0,0 +1,12 @@
C++ API
=====================================================
.. py:currentmodule:: _slsdet
.. autoclass:: DetectorApi
:members:
:undoc-members:

View File

@ -0,0 +1,67 @@
Error handling
=========================
Check input in Python
----------------------
As far as possible we try to check the input on the Python side
before calling the slsDeteectorsSoftware. Errors should not pass
silently but raise an exception
::
#Trimbit range for Eiger is 0-63
detector.trimbits = 98
(...)
ValueError: Trimbit setting 98 is outside of range:0-63
Errors in slsDetectorsSoftware
-------------------------------
The slsDetectorsSoftware uses a mask to record errors from the different
detectors. If an error is found we raise a RuntimeError at the end of the
call using the error message from slsDetectorsSoftware
.. todo ::
Implement this for all functions
::
detector.settings = 'bananas'
(...)
RuntimeError: Detector 0:
Could not set settings.
Detector 1:
Could not set settings.
Detector 2:
Could not set settings.
Using decorators
-------------------
Using decorators we can reset the error mask before the command and then
check it after the command
.. code-block:: python
#add decorator to check the error mask
@error_handling
def some_function():
a = 1+1
return a
Communication with the detector is usually the biggest overhead so
this does not impact performance.
::
%timeit d.exposure_time
>> 1.52 ms ± 5.42 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
%timeit d.decorated_exposure_time
>> 1.53 ms ± 3.18 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

122
python/sphinx/getting_started.rst Executable file
View File

@ -0,0 +1,122 @@
Getting started
================
------------------------
Setting up the detector
------------------------
All configuration of the detector can either be done from the Python
API (including loading config file) or externally. The detector setup is
discovered from the shared memory when launching a new script. Because the
detector usually should remain online longer than a specific script it is
recommended to run the receivers seperate.
---------------------------------
Setting and getting attributes
---------------------------------
Most of the detector and software setting are implemented as attributes
in the Detector class. When something is assigned it is also set
in the detector and when the attribute is called using dot notation it
it looked up from the detector.
::
#Currently Eiger and Jungfrau but Detector should work for all
from sls_detector import Eiger()
d = Eiger()
d.file_write = True
d.vthreshold = 1500
d.frame_index
>> 12
d.file_name
>> 'run'
---------------------------------
Working with DACs
---------------------------------
The following examples assumes an Eiger500k detector. But the same syntax
works for other detector sizes and models.
::
d.dacs
>>
========== DACS =========
vsvp : 0, 0
vtr : 4000, 4000
vrf : 2000, 2300
vrs : 1400, 1400
vsvn : 4000, 4000
vtgstv : 2556, 2556
vcmp_ll : 1500, 1500
vcmp_lr : 1500, 1500
vcall : 3500, 3600
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
#Read dac values to a variable
vrf = d.dacs.vrf[:]
#Set a dac in a module
d.dacs.vrf[0] = 1500
d.dacs.vrf[0]
>> 1500
#Set vrf to the same value in all moduels
d.dacs.vrf = 1500
#Set a dac using an iterable
d.dacs.vrf = [1500, 1600]
d.dacs.vrf
>> vrf : 1500, 1600
#Set dacs iterating on index and values
d.dacs.vrf[0,1] = 1300,1400
---------------------------------
Operating multiple detectors
---------------------------------
Operating multiple detectors is supported by assigning an id when creating the object. If no id is
set it defaults to 0.
::
d0 = Eiger() #id is now 0
d1 = Jungfrau(1)
#Or explicitly
d1 = Jungfrau(id = 0)
The detectors now operate independently of each other but can be synchronized using a hardware trigger.
::
from sls_detector import Eiger
d0 = Eiger(0)
d1 = Eiger(1)
d0.load_config('/some/path/T45.config')
d1.load_config('/some/path/T62.config')
d0.n_frames = 1
d0.exposure_time = 1
d0.timing_mode = 'trigger'
d1.n_frames = 5
d1.exposure_time = 0.2
d1.timing_mode = 'trigger'

30
python/sphinx/index.rst Executable file
View File

@ -0,0 +1,30 @@
sls_detector - Python interface for the slsDetectorsPackage
==============================================================
sls_detector provide Python bindings to the slsDetectorsPackage using mainly the
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.
.. toctree::
:maxdepth: 3
:caption: Contents:
installation
getting_started
code_quality
command_line
examples
error-handling
sls_detector
cpp_api
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

90
python/sphinx/installation.rst Executable file
View File

@ -0,0 +1,90 @@
Installation
=========================
The easiest way to install the Python API and the slsDetectorPackage is using conda. But other
methods are also available.
---------------------
Install using conda
---------------------
If you don't have it installed get the latest version of `Miniconda`_
.. _Miniconda: https://conda.io/miniconda.html
::
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
sh Miniconda3-latest-Linux-x86_64.sh
Install sls_detector and sls_detector_lib using:
::
#Add conda channels
conda config --add channels conda-forge
conda config --add channels slsdetectorgroup
#Install latest version
conda install sls_detector
#Install specific version
conda install sls_detector=3.0.1
------------------------------
Local build using conda-build
------------------------------
Needs the `sls_detector_lib`_ installed in order to automatically find headers
and shared libraries. Make sure that the branch of sls_detector matches the lib
version installed.
.. _sls_detector_lib: https://github.com/slsdetectorgroup/sls_detector_lib
::
#Clone source code
git clone https://github.com/slsdetectorgroup/sls_detector.git
#Checkout the branch needed
git checkout 3.0.1
#Build and install the local version
conda-build sls_detector
conda install --use-local sls_detector
-----------------------
Developer build
-----------------------
IF you if you are developing and are making constant changes to the code it's a bit cumbersome
to build with conda and install. Then an easier way is to build the C/C++ parts in the package
directory and temporary add this to the path
::
#in path/to/sls_detector
python setup.py build_ext --inplace
Then in your Python script
::
import sys
sys.path.append('/path/to/sls_detector')
from sls_detector import Detector
--------------
Prerequisites
--------------
All dependencies are manged trough conda but for a stand alone build you would need
* gcc 4.8+
* Qwt 6
* Qt 4.8
* numpy
* slsDetectorPackage

6
python/sphinx/makedocs.sh Executable file
View File

@ -0,0 +1,6 @@
make clean
make html
rm -rf ../docs/
mv _build/html/ ../docs/
touch ../docs/.nojekyll
rm -rf _build

8
python/sphinx/modules.rst Executable file
View File

@ -0,0 +1,8 @@
sls_detector
==================
.. toctree::
:maxdepth: 4
sls_detector

33
python/sphinx/sls_detector.rst Executable file
View File

@ -0,0 +1,33 @@
Python classes
=====================================================
.. py:currentmodule:: sls_detector
Detector
----------
.. autoclass:: Detector
:members:
:undoc-members:
:show-inheritance:
Eiger
-------
.. autoclass:: Eiger
:members:
:undoc-members:
:show-inheritance:
Jungfrau
----------
.. autoclass:: Jungfrau
:members:
:undoc-members:
:show-inheritance:

File diff suppressed because it is too large Load Diff

View File

@ -8,17 +8,12 @@
#include "network_utils.h"
#include "sls_detector_defs.h"
#include "typecaster.h"
#include "TimeHelper.h"
#include <array>
#include <chrono>
namespace py = pybind11;
void init_det(py::module &m) {
using sls::Detector;
using sls::Positions;
using sls::Result;
using sls::defs;
using sls::ns;
py::class_<Detector> CppDetectorApi(m, "CppDetectorApi");
CppDetectorApi

View File

@ -17,6 +17,8 @@ void init_enums(py::module &m) {
xy.def_readwrite("y", &slsDetectorDefs::xy::y);
py::enum_<slsDetectorDefs::detectorType>(Defs, "detectorType")
.value("GET_DETECTOR_TYPE",
slsDetectorDefs::detectorType::GET_DETECTOR_TYPE)
.value("GENERIC", slsDetectorDefs::detectorType::GENERIC)
.value("EIGER", slsDetectorDefs::detectorType::EIGER)
.value("GOTTHARD", slsDetectorDefs::detectorType::GOTTHARD)
@ -38,6 +40,8 @@ void init_enums(py::module &m) {
.export_values();
py::enum_<slsDetectorDefs::frameDiscardPolicy>(Defs, "frameDiscardPolicy")
.value("GET_FRAME_DISCARD_POLICY",
slsDetectorDefs::frameDiscardPolicy::GET_FRAME_DISCARD_POLICY)
.value("NO_DISCARD", slsDetectorDefs::frameDiscardPolicy::NO_DISCARD)
.value("DISCARD_EMPTY_FRAMES",
slsDetectorDefs::frameDiscardPolicy::DISCARD_EMPTY_FRAMES)
@ -48,76 +52,72 @@ void init_enums(py::module &m) {
.export_values();
py::enum_<slsDetectorDefs::fileFormat>(Defs, "fileFormat")
.value("GET_FILE_FORMAT", slsDetectorDefs::fileFormat::GET_FILE_FORMAT)
.value("BINARY", slsDetectorDefs::fileFormat::BINARY)
.value(" HDF5", slsDetectorDefs::fileFormat::HDF5)
.value(" NUM_FILE_FORMATS",
.value("HDF5", slsDetectorDefs::fileFormat::HDF5)
.value("NUM_FILE_FORMATS",
slsDetectorDefs::fileFormat::NUM_FILE_FORMATS)
.export_values();
py::enum_<slsDetectorDefs::dimension>(Defs, "dimension")
.value("X", slsDetectorDefs::dimension::X)
.value(" Y", slsDetectorDefs::dimension::Y)
.value("Y", slsDetectorDefs::dimension::Y)
.export_values();
py::enum_<slsDetectorDefs::externalSignalFlag>(Defs, "externalSignalFlag")
.value("GET_EXTERNAL_SIGNAL_FLAG",
slsDetectorDefs::externalSignalFlag::GET_EXTERNAL_SIGNAL_FLAG)
.value("SIGNAL_OFF", slsDetectorDefs::externalSignalFlag::SIGNAL_OFF)
.value("GATE_IN_ACTIVE_HIGH",
slsDetectorDefs::externalSignalFlag::GATE_IN_ACTIVE_HIGH)
.value("GATE_IN_ACTIVE_LOW",
slsDetectorDefs::externalSignalFlag::GATE_IN_ACTIVE_LOW)
.value("TRIGGER_IN_RISING_EDGE",
slsDetectorDefs::externalSignalFlag::TRIGGER_IN_RISING_EDGE)
.value("TRIGGER_IN_FALLING_EDGE",
slsDetectorDefs::externalSignalFlag::TRIGGER_IN_FALLING_EDGE)
.value("INVERSION_ON",
slsDetectorDefs::externalSignalFlag::INVERSION_ON)
.value("INVERSION_OFF",
slsDetectorDefs::externalSignalFlag::INVERSION_OFF)
.value("RO_TRIGGER_IN_RISING_EDGE",
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_IN_RISING_EDGE)
.value("RO_TRIGGER_IN_FALLING_EDGE",
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_IN_FALLING_EDGE)
.value("GATE_OUT_ACTIVE_HIGH",
slsDetectorDefs::externalSignalFlag::GATE_OUT_ACTIVE_HIGH)
.value("GATE_OUT_ACTIVE_LOW",
slsDetectorDefs::externalSignalFlag::GATE_OUT_ACTIVE_LOW)
.value("TRIGGER_OUT_RISING_EDGE",
slsDetectorDefs::externalSignalFlag::TRIGGER_OUT_RISING_EDGE)
.value("TRIGGER_OUT_FALLING_EDGE",
slsDetectorDefs::externalSignalFlag::TRIGGER_OUT_FALLING_EDGE)
.value("RO_TRIGGER_OUT_RISING_EDGE",
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_OUT_RISING_EDGE)
.value("RO_TRIGGER_OUT_FALLING_EDGE",
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_OUT_FALLING_EDGE)
.value("OUTPUT_LOW", slsDetectorDefs::externalSignalFlag::OUTPUT_LOW)
.value("OUTPUT_HIGH", slsDetectorDefs::externalSignalFlag::OUTPUT_HIGH)
.value(
"MASTER_SLAVE_SYNCHRONIZATION",
slsDetectorDefs::externalSignalFlag::MASTER_SLAVE_SYNCHRONIZATION)
.export_values();
py::enum_<slsDetectorDefs::timingMode>(Defs, "timingMode")
.value("GET_TIMING_MODE", slsDetectorDefs::timingMode::GET_TIMING_MODE)
.value("AUTO_TIMING", slsDetectorDefs::timingMode::AUTO_TIMING)
.value("TRIGGER_EXPOSURE",
slsDetectorDefs::timingMode::TRIGGER_EXPOSURE)
.value("GATED", slsDetectorDefs::timingMode::GATED)
.value("BURST_TRIGGER", slsDetectorDefs::timingMode::BURST_TRIGGER)
.value("TRIGGER_GATED", slsDetectorDefs::timingMode::TRIGGER_GATED)
.value("NUM_TIMING_MODES",
slsDetectorDefs::timingMode::NUM_TIMING_MODES)
.export_values();
py::enum_<slsDetectorDefs::dacIndex>(Defs, "dacIndex")
.value("DAC_0", slsDetectorDefs::dacIndex::DAC_0)
.value("DAC_1", slsDetectorDefs::dacIndex::DAC_1)
.value("DAC_2", slsDetectorDefs::dacIndex::DAC_2)
.value("DAC_3", slsDetectorDefs::dacIndex::DAC_3)
.value("DAC_4", slsDetectorDefs::dacIndex::DAC_4)
.value("DAC_5", slsDetectorDefs::dacIndex::DAC_5)
.value("DAC_6", slsDetectorDefs::dacIndex::DAC_6)
.value("DAC_7", slsDetectorDefs::dacIndex::DAC_7)
.value("DAC_8", slsDetectorDefs::dacIndex::DAC_8)
.value("DAC_9", slsDetectorDefs::dacIndex::DAC_9)
.value("DAC_10", slsDetectorDefs::dacIndex::DAC_10)
.value("DAC_11", slsDetectorDefs::dacIndex::DAC_11)
.value("DAC_12", slsDetectorDefs::dacIndex::DAC_12)
.value("DAC_13", slsDetectorDefs::dacIndex::DAC_13)
.value("DAC_14", slsDetectorDefs::dacIndex::DAC_14)
.value("DAC_15", slsDetectorDefs::dacIndex::DAC_15)
.value("DAC_16", slsDetectorDefs::dacIndex::DAC_16)
.value("DAC_17", slsDetectorDefs::dacIndex::DAC_17)
.value("VSVP", slsDetectorDefs::dacIndex::VSVP)
.value("VTRIM", slsDetectorDefs::dacIndex::VTRIM)
.value("VRPREAMP", slsDetectorDefs::dacIndex::VRPREAMP)
.value("VRSHAPER", slsDetectorDefs::dacIndex::VRSHAPER)
.value("VSVN", slsDetectorDefs::dacIndex::VSVN)
.value("VTGSTV", slsDetectorDefs::dacIndex::VTGSTV)
.value("VCMP_LL", slsDetectorDefs::dacIndex::VCMP_LL)
.value("VCMP_LR", slsDetectorDefs::dacIndex::VCMP_LR)
.value("VCAL", slsDetectorDefs::dacIndex::VCAL)
.value("VCMP_RL", slsDetectorDefs::dacIndex::VCMP_RL)
.value("RXB_RB", slsDetectorDefs::dacIndex::RXB_RB)
.value("RXB_LB", slsDetectorDefs::dacIndex::RXB_LB)
.value("VCMP_RR", slsDetectorDefs::dacIndex::VCMP_RR)
.value("VCP", slsDetectorDefs::dacIndex::VCP)
.value("VCN", slsDetectorDefs::dacIndex::VCN)
.value("VISHAPER", slsDetectorDefs::dacIndex::VISHAPER)
.value("VTHRESHOLD", slsDetectorDefs::dacIndex::VTHRESHOLD)
.value("IO_DELAY", slsDetectorDefs::dacIndex::IO_DELAY)
.value("THRESHOLD", slsDetectorDefs::dacIndex::THRESHOLD)
.value("CALIBRATION_PULSE",
slsDetectorDefs::dacIndex::CALIBRATION_PULSE)
.value("TRIMBIT_SIZE", slsDetectorDefs::dacIndex::TRIMBIT_SIZE)
.value("PREAMP", slsDetectorDefs::dacIndex::PREAMP)
.value("SHAPER1", slsDetectorDefs::dacIndex::SHAPER1)
.value("SHAPER2", slsDetectorDefs::dacIndex::SHAPER2)
.value("TEMPERATURE_ADC", slsDetectorDefs::dacIndex::TEMPERATURE_ADC)
.value("TEMPERATURE_FPGA", slsDetectorDefs::dacIndex::TEMPERATURE_FPGA)
.value("VREF_DS", slsDetectorDefs::dacIndex::VREF_DS)
.value("VCASCN_PB", slsDetectorDefs::dacIndex::VCASCN_PB)
.value("VCASCP_PB", slsDetectorDefs::dacIndex::VCASCP_PB)
@ -126,46 +126,25 @@ void init_enums(py::module &m) {
.value("VIN_CM", slsDetectorDefs::dacIndex::VIN_CM)
.value("VREF_COMP", slsDetectorDefs::dacIndex::VREF_COMP)
.value("IB_TESTC", slsDetectorDefs::dacIndex::IB_TESTC)
.value("VB_COMP", slsDetectorDefs::dacIndex::VB_COMP)
.value("VDD_PROT", slsDetectorDefs::dacIndex::VDD_PROT)
.value("VIN_COM", slsDetectorDefs::dacIndex::VIN_COM)
.value("VREF_PRECH", slsDetectorDefs::dacIndex::VREF_PRECH)
.value("VB_PIXBUF", slsDetectorDefs::dacIndex::VB_PIXBUF)
.value("VB_DS", slsDetectorDefs::dacIndex::VB_DS)
.value("VREF_H_ADC", slsDetectorDefs::dacIndex::VREF_H_ADC)
.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_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)
.value("VREF_L_ADC", slsDetectorDefs::dacIndex::VREF_L_ADC)
.value("VREF_CDS", slsDetectorDefs::dacIndex::VREF_CDS)
.value("VB_CS", slsDetectorDefs::dacIndex::VB_CS)
.value("VB_OPA_FD", slsDetectorDefs::dacIndex::VB_OPA_FD)
.value("VCOM_ADC2", slsDetectorDefs::dacIndex::VCOM_ADC2)
.value("VCASSH", slsDetectorDefs::dacIndex::VCASSH)
.value("VTH2", slsDetectorDefs::dacIndex::VTH2)
.value("VRSHAPER_N", slsDetectorDefs::dacIndex::VRSHAPER_N)
.value("VIPRE_OUT", slsDetectorDefs::dacIndex::VIPRE_OUT)
.value("VTH3", slsDetectorDefs::dacIndex::VTH3)
.value("VTH1", slsDetectorDefs::dacIndex::VTH1)
.value("VICIN", slsDetectorDefs::dacIndex::VICIN)
.value("VCAS", slsDetectorDefs::dacIndex::VCAS)
.value("VCAL_N", slsDetectorDefs::dacIndex::VCAL_N)
.value("VIPRE", slsDetectorDefs::dacIndex::VIPRE)
.value("VCAL_P", slsDetectorDefs::dacIndex::VCAL_P)
.value("VDCSH", slsDetectorDefs::dacIndex::VDCSH)
.value("VBP_COLBUF", slsDetectorDefs::dacIndex::VBP_COLBUF)
.value("VB_SDA", slsDetectorDefs::dacIndex::VB_SDA)
.value("VCASC_SFP", slsDetectorDefs::dacIndex::VCASC_SFP)
.value("VIPRE_CDS", slsDetectorDefs::dacIndex::VIPRE_CDS)
.value("IBIAS_SFP", slsDetectorDefs::dacIndex::IBIAS_SFP)
.value("SVP", slsDetectorDefs::dacIndex::SVP)
.value("SVN", slsDetectorDefs::dacIndex::SVN)
.value("VTR", slsDetectorDefs::dacIndex::VTR)
.value("VRF", slsDetectorDefs::dacIndex::VRF)
.value("VRS", slsDetectorDefs::dacIndex::VRS)
.value("VTGSTV", slsDetectorDefs::dacIndex::VTGSTV)
.value("VCMP_LL", slsDetectorDefs::dacIndex::VCMP_LL)
.value("VCMP_LR", slsDetectorDefs::dacIndex::VCMP_LR)
.value("CAL", slsDetectorDefs::dacIndex::CAL)
.value("VCMP_RL", slsDetectorDefs::dacIndex::VCMP_RL)
.value("VCMP_RR", slsDetectorDefs::dacIndex::VCMP_RR)
.value("RXB_RB", slsDetectorDefs::dacIndex::RXB_RB)
.value("RXB_LB", slsDetectorDefs::dacIndex::RXB_LB)
.value("VCP", slsDetectorDefs::dacIndex::VCP)
.value("VCN", slsDetectorDefs::dacIndex::VCN)
.value("VIS", slsDetectorDefs::dacIndex::VIS)
.value("IO_DELAY", slsDetectorDefs::dacIndex::IO_DELAY)
.value("ADC_VPP", slsDetectorDefs::dacIndex::ADC_VPP)
.value("HIGH_VOLTAGE", slsDetectorDefs::dacIndex::HIGH_VOLTAGE)
.value("TEMPERATURE_ADC", slsDetectorDefs::dacIndex::TEMPERATURE_ADC)
.value("TEMPERATURE_FPGA", slsDetectorDefs::dacIndex::TEMPERATURE_FPGA)
.value("TEMPERATURE_FPGAEXT",
slsDetectorDefs::dacIndex::TEMPERATURE_FPGAEXT)
.value("TEMPERATURE_10GE", slsDetectorDefs::dacIndex::TEMPERATURE_10GE)
@ -176,6 +155,40 @@ void init_enums(py::module &m) {
slsDetectorDefs::dacIndex::TEMPERATURE_FPGA2)
.value("TEMPERATURE_FPGA3",
slsDetectorDefs::dacIndex::TEMPERATURE_FPGA3)
.value("VIPRE", slsDetectorDefs::dacIndex::VIPRE)
.value("VIINSH", slsDetectorDefs::dacIndex::VIINSH)
.value("VDCSH", slsDetectorDefs::dacIndex::VDCSH)
.value("VTH2", slsDetectorDefs::dacIndex::VTH2)
.value("VPL", slsDetectorDefs::dacIndex::VPL)
.value("VTH3", slsDetectorDefs::dacIndex::VTH3)
.value("CASSH", slsDetectorDefs::dacIndex::CASSH)
.value("CAS", slsDetectorDefs::dacIndex::CAS)
.value("VICIN", slsDetectorDefs::dacIndex::VICIN)
.value("VIPRE_OUT", slsDetectorDefs::dacIndex::VIPRE_OUT)
.value("VREF_H_ADC", slsDetectorDefs::dacIndex::VREF_H_ADC)
.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_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)
.value("VREF_PRECH", slsDetectorDefs::dacIndex::VREF_PRECH)
.value("VREF_L_ADC", slsDetectorDefs::dacIndex::VREF_L_ADC)
.value("VREF_CDS", slsDetectorDefs::dacIndex::VREF_CDS)
.value("VB_CS", slsDetectorDefs::dacIndex::VB_CS)
.value("VB_OPA_FD", slsDetectorDefs::dacIndex::VB_OPA_FD)
.value("VCOM_ADC2", slsDetectorDefs::dacIndex::VCOM_ADC2)
.value("VB_DS", slsDetectorDefs::dacIndex::VB_DS)
.value("VB_COMP", slsDetectorDefs::dacIndex::VB_COMP)
.value("VB_PIXBUF", slsDetectorDefs::dacIndex::VB_PIXBUF)
.value("VIN_COM", slsDetectorDefs::dacIndex::VIN_COM)
.value("VDD_PROT", slsDetectorDefs::dacIndex::VDD_PROT)
.value("VBP_COLBUF", slsDetectorDefs::dacIndex::VBP_COLBUF)
.value("VB_SDA", slsDetectorDefs::dacIndex::VB_SDA)
.value("VCASC_SFP", slsDetectorDefs::dacIndex::VCASC_SFP)
.value("VIPRE_CDS", slsDetectorDefs::dacIndex::VIPRE_CDS)
.value("IBIAS_SFP", slsDetectorDefs::dacIndex::IBIAS_SFP)
.value("V_POWER_A", slsDetectorDefs::dacIndex::V_POWER_A)
.value("V_POWER_B", slsDetectorDefs::dacIndex::V_POWER_B)
.value("V_POWER_C", slsDetectorDefs::dacIndex::V_POWER_C)
@ -200,6 +213,7 @@ void init_enums(py::module &m) {
.export_values();
py::enum_<slsDetectorDefs::detectorSettings>(Defs, "detectorSettings")
.value("GET_SETTINGS", slsDetectorDefs::detectorSettings::GET_SETTINGS)
.value("STANDARD", slsDetectorDefs::detectorSettings::STANDARD)
.value("FAST", slsDetectorDefs::detectorSettings::FAST)
.value("HIGHGAIN", slsDetectorDefs::detectorSettings::HIGHGAIN)
@ -234,55 +248,64 @@ void init_enums(py::module &m) {
py::enum_<slsDetectorDefs::clockIndex>(Defs, "clockIndex")
.value("ADC_CLOCK", slsDetectorDefs::clockIndex::ADC_CLOCK)
.value(" DBIT_CLOCK", slsDetectorDefs::clockIndex::DBIT_CLOCK)
.value(" RUN_CLOCK", slsDetectorDefs::clockIndex::RUN_CLOCK)
.value(" SYNC_CLOCK", slsDetectorDefs::clockIndex::SYNC_CLOCK)
.value("DBIT_CLOCK", slsDetectorDefs::clockIndex::DBIT_CLOCK)
.value("RUN_CLOCK", slsDetectorDefs::clockIndex::RUN_CLOCK)
.value("SYNC_CLOCK", slsDetectorDefs::clockIndex::SYNC_CLOCK)
.export_values();
py::enum_<slsDetectorDefs::readoutMode>(Defs, "readoutMode")
.value("ANALOG_ONLY", slsDetectorDefs::readoutMode::ANALOG_ONLY)
.value(" DIGITAL_ONLY", slsDetectorDefs::readoutMode::DIGITAL_ONLY)
.value(" ANALOG_AND_DIGITAL",
.value("DIGITAL_ONLY", slsDetectorDefs::readoutMode::DIGITAL_ONLY)
.value("ANALOG_AND_DIGITAL",
slsDetectorDefs::readoutMode::ANALOG_AND_DIGITAL)
.export_values();
py::enum_<slsDetectorDefs::speedLevel>(Defs, "speedLevel")
.value("FULL_SPEED", slsDetectorDefs::speedLevel::FULL_SPEED)
.value(" HALF_SPEED", slsDetectorDefs::speedLevel::HALF_SPEED)
.value(" QUARTER_SPEED", slsDetectorDefs::speedLevel::QUARTER_SPEED)
.value("HALF_SPEED", slsDetectorDefs::speedLevel::HALF_SPEED)
.value("QUARTER_SPEED", slsDetectorDefs::speedLevel::QUARTER_SPEED)
.export_values();
py::enum_<slsDetectorDefs::portType>(Defs, "portType")
.value("CONTROL_PORT", slsDetectorDefs::portType::CONTROL_PORT)
.value("STOP_PORT", slsDetectorDefs::portType::STOP_PORT)
.value("DATA_PORT", slsDetectorDefs::portType::DATA_PORT)
.export_values();
py::enum_<slsDetectorDefs::masterFlags>(Defs, "masterFlags")
.value("GET_MASTER", slsDetectorDefs::masterFlags::GET_MASTER)
.value("NO_MASTER", slsDetectorDefs::masterFlags::NO_MASTER)
.value(" IS_MASTER", slsDetectorDefs::masterFlags::IS_MASTER)
.value(" IS_SLAVE", slsDetectorDefs::masterFlags::IS_SLAVE)
.value("IS_MASTER", slsDetectorDefs::masterFlags::IS_MASTER)
.value("IS_SLAVE", slsDetectorDefs::masterFlags::IS_SLAVE)
.export_values();
py::enum_<slsDetectorDefs::frameModeType>(Defs, "frameModeType")
.value("GET_FRAME_MODE", slsDetectorDefs::frameModeType::GET_FRAME_MODE)
.value("PEDESTAL", slsDetectorDefs::frameModeType::PEDESTAL)
.value(" NEW_PEDESTAL", slsDetectorDefs::frameModeType::NEW_PEDESTAL)
.value(" FLATFIELD", slsDetectorDefs::frameModeType::FLATFIELD)
.value(" NEW_FLATFIELD", slsDetectorDefs::frameModeType::NEW_FLATFIELD)
.value("NEW_PEDESTAL", slsDetectorDefs::frameModeType::NEW_PEDESTAL)
.value("FLATFIELD", slsDetectorDefs::frameModeType::FLATFIELD)
.value("NEW_FLATFIELD", slsDetectorDefs::frameModeType::NEW_FLATFIELD)
.export_values();
py::enum_<slsDetectorDefs::detectorModeType>(Defs, "detectorModeType")
.value("GET_DETECTOR_MODE",
slsDetectorDefs::detectorModeType::GET_DETECTOR_MODE)
.value("COUNTING", slsDetectorDefs::detectorModeType::COUNTING)
.value(" INTERPOLATING",
.value("INTERPOLATING",
slsDetectorDefs::detectorModeType::INTERPOLATING)
.value(" ANALOG", slsDetectorDefs::detectorModeType::ANALOG)
.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)
.value("NUM_BURST_MODES", slsDetectorDefs::burstMode::NUM_BURST_MODES)
.export_values();
py::enum_<slsDetectorDefs::timingSourceType>(Defs, "timingSourceType")
.value("TIMING_INTERNAL",
slsDetectorDefs::timingSourceType::TIMING_INTERNAL)
.value(" TIMING_EXTERNAL",
.value("TIMING_EXTERNAL",
slsDetectorDefs::timingSourceType::TIMING_EXTERNAL)
.export_values();
}

View File

@ -5,28 +5,7 @@ Testing functions from utils.py
"""
import pytest
from slsdet.utils import *
import datetime as dt
def test_iterable():
assert is_iterable(5) == False
assert is_iterable('abc') == True
assert is_iterable([]) == True
assert is_iterable(5.9) == False
def test_reduce_time_to_single_value_from_list():
t = 3*[dt.timedelta(seconds = 1)]
assert reduce_time(t) == 1
def test_reduce_time_to_single_value_from_list_of_lists():
t = 3*[dt.timedelta(seconds = 3.3)]
tt = 5*t
assert reduce_time(tt) == 3.3
def test_reduce_time_when_sublist_is_different():
t = [dt.timedelta(seconds = 1), dt.timedelta(seconds = 2), dt.timedelta(seconds = 1)]
tt = [t for i in range(4)]
assert reduce_time(tt) == [1,2,1]
from sls_detector.utils import *
def test_convert_zero():
@ -80,17 +59,4 @@ def test_list_to_mask():
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)
def test_make_timedelta_from_double():
t = 1.7
r = make_timedelta(t)
assert t == r.total_seconds()
assert r == dt.timedelta(seconds=t)
def test_make_timedelta_from_timedelta():
t = dt.timedelta(minutes=1)
r = make_timedelta(t)
assert 60 == r.total_seconds()
assert r == dt.timedelta(minutes=1)
assert(list_to_bitmask([1,1,1]) == 2)

View File

@ -156,7 +156,7 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
if (dSamples>isample) {
ptr=data+32*(isample+1)+8*isample;
sample=*((uint64_t*)ptr);
// cout << isc << " " << ibit[isc] << " " << isample << hex << sample << dec << endl;
cout << isc << " " << ibit[isc] << " " << isample << hex << sample << dec << endl;
if (sample & (1<<ibit[isc]))
return 1;
else

View File

@ -120,7 +120,7 @@ class moench04CtbZmqData : public slsDetectorData<uint16_t> {
if (dSamples>isample) {
ptr=data+aoff+8*isample;
sample=*((uint64_t*)ptr);
// cout << isc << " " << ibit[isc] << " " << isample << hex << sample << dec << endl;
cout << isc << " " << ibit[isc] << " " << isample << hex << sample << dec << endl;
if (sample & (1<<ibit[isc]))
return 1;
else

View File

@ -1,39 +0,0 @@
#Moench ZMQ
add_executable(moenchZmqProcess moenchZmqProcess.cpp ../tiffIO.cpp)
add_compile_definitions(moenchZmqProcess NEWZMQ INTERP)
#Moench04 ZMQ
add_executable(moench04ZmqProcess moenchZmqProcess.cpp ../tiffIO.cpp)
add_compile_definitions(moenchZmqProcess NEWZMQ INTERP MOENCH04)
#Both executables should have the same includes and output dirs
set(MOENCH_EXECUTABLES "moenchZmqProcess" "moench04ZmqProcess")
foreach(exe ${MOENCH_EXECUTABLES})
#TODO! At a later stage clean up include dirs and have a proper lib
target_include_directories(${exe} PRIVATE
../
../dataStructures
../interpolations
../../slsReceiverSoftware/include/
)
target_link_libraries(${exe}
PUBLIC
slsSupportLib
${ZeroMQ_LIBRARIES}
pthread
tiff
PRIVATE
slsProjectWarnings
)
set_target_properties(${exe} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
endforeach(exe ${MOENCH_EXECUTABLES})

View File

@ -5,15 +5,12 @@ LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -O3
#DESTDIR?=../bin
all: moenchZmqProcess moenchZmq04Process
all: moenchZmqProcess
#moenchZmqProcessCtbGui
moenchZmqProcess: moenchZmqProcess.cpp clean
g++ -o moenchZmqProcess moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP
moenchZmq04Process: moenchZmqProcess.cpp clean
g++ -o moench04ZmqProcess moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP -DMOENCH04
#moenchZmqProcessCtbGui: moenchZmqProcess.cpp clean
# g++ -o moenchZmqProcessCtbGui moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP -DCTBGUI

View File

@ -8,13 +8,7 @@
#include "sls_detector_defs.h"
#include "ZmqSocket.h"
#ifndef RECT
#ifndef MOENCH04
#include "moench03T1ZmqDataNew.h"
#endif
#ifdef MOENCH04
#include "moench04CtbZmq10GbData.h"
#endif
#endif
#ifdef RECT
#include "moench03T1ZmqDataNewRect.h"
@ -79,10 +73,6 @@ int main(int argc, char *argv[]) {
char* socketip2 = 0;
uint32_t portnum2 = 0;
zmqHeader zHeader, outHeader;
zHeader.jsonversion = SLS_DETECTOR_JSON_HEADER_VERSION;
outHeader.jsonversion = SLS_DETECTOR_JSON_HEADER_VERSION;
uint32_t nSigma=5;
int ok;
@ -134,12 +124,7 @@ int main(int argc, char *argv[]) {
}
//slsDetectorData *det=new moench03T1ZmqDataNew();
#ifndef MOENCH04
moench03T1ZmqDataNew *det=new moench03T1ZmqDataNew();
#endif
#ifdef MOENCH04
moench04CtbZmq10GbData *det=new moench04CtbZmq10GbData();
#endif
cout << endl << " det" <<endl;
int npx, npy;
det->getDetectorSize(npx, npy);
@ -155,15 +140,13 @@ int main(int argc, char *argv[]) {
char dummybuff[size];
int ncol_cm=CM_ROWS;
double xt_ghost=C_GHOST;
moench03CommonMode *cm=NULL;
moench03GhostSummation *gs=NULL;
#ifdef CORR
//int ncol_cm=CM_ROWS;
//double xt_ghost=C_GHOST;
cm=new moench03CommonMode(CM_ROWS);
gs=new moench03GhostSummation(det, C_GHOST);
cm=new moench03CommonMode(ncol_cm);
gs=new moench03GhostSummation(det, xt_ghost);
#endif
double *gainmap=NULL;
float *gm;
@ -245,7 +228,7 @@ int main(int argc, char *argv[]) {
delete zmqsocket;
return EXIT_FAILURE;
} else
printf("Zmq Client at %s\n", zmqsocket->GetZmqServerAddress().c_str());
printf("Zmq Client at %s\n", zmqsocket->GetZmqServerAddress());
// send socket
ZmqSocket* zmqsocket2 = 0;
@ -325,10 +308,9 @@ int main(int argc, char *argv[]) {
uint64_t bunchId = 0;
uint64_t timestamp = 0;
int16_t modId = 0;
uint32_t expLength=0;
uint16_t xCoord = 0;
uint16_t yCoord = 0;
//uint16_t zCoord = 0;
uint16_t zCoord = 0;
uint32_t debug = 0;
//uint32_t dr = 16;
//int16_t *dout;//=new int16_t [nnx*nny];
@ -359,7 +341,6 @@ int main(int argc, char *argv[]) {
filter->getImageSize(nnx, nny,nnsx, nnsy);
std::map<std::string, std::string> addJsonHeader;
@ -369,13 +350,16 @@ int main(int argc, char *argv[]) {
// cout << "+++++++++++++++++++++++++++++++LOOP" << endl;
// get header, (if dummy, fail is on parse error or end of acquisition)
#ifndef NEWZMQ
if (!zmqsocket->ReceiveHeader(0, acqIndex, frameIndex, subframeIndex, filename, fileindex)){
#endif
// rapidjson::Document doc;
if (!zmqsocket->ReceiveHeader(0, zHeader, SLS_DETECTOR_JSON_HEADER_VERSION)) {
#ifdef NEWZMQ
rapidjson::Document doc;
if (!zmqsocket->ReceiveHeader(0, doc, SLS_DETECTOR_JSON_HEADER_VERSION)) {
/* zmqsocket->CloseHeaderMessage();*/
#endif
// if (!zmqsocket->ReceiveHeader(0, acqIndex, frameIndex, subframeIndex, filename, fileindex)) {
cprintf(RED, "Got Dummy\n");
// t1=high_resolution_clock::now();
@ -394,11 +378,7 @@ int main(int argc, char *argv[]) {
if (newFrame>0) {
cprintf(RED,"DIDn't receive any data!\n");
if (send) {
//zHeader.data = false;
outHeader.data=false;
// zmqsocket2->SendHeaderData(0, true, SLS_DETECTOR_JSON_HEADER_VERSION);
zmqsocket2->SendHeader(0,outHeader);
zmqsocket2->SendHeaderData(0, true, SLS_DETECTOR_JSON_HEADER_VERSION);
cprintf(RED, "Sent Dummy\n");
}
} else {
@ -530,39 +510,14 @@ int main(int argc, char *argv[]) {
if(send_something) {
// zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 1,1,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,&additionalJsonHeader);
zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 1,1,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,&additionalJsonHeader);
outHeader.data=true;
outHeader.dynamicRange=dr;
outHeader.fileIndex=fileindex;
outHeader.ndetx=1;
outHeader.ndety=1;
outHeader.npixelsx=nnx;
outHeader.npixelsy=nny;
outHeader.imageSize=nnx*nny*dr/8;
outHeader.acqIndex=acqIndex;
outHeader.frameIndex=frameIndex;
outHeader.fname=fname;
outHeader.frameNumber=acqIndex;
outHeader.expLength=expLength;
outHeader.packetNumber=packetNumber;
outHeader.bunchId=bunchId;
outHeader.timestamp=timestamp;
outHeader.modId=modId;
outHeader.row=xCoord;
outHeader.column=yCoord;
outHeader.debug=debug;
outHeader.roundRNumber=roundRNumber;
outHeader.detType=detType;
outHeader.version=version;
zmqsocket2->SendHeader(0,outHeader);
zmqsocket2->SendData((char*)dout,nnx*nny*dr/8);
cprintf(GREEN, "Sent Data\n");
}
outHeader.data=false;
zmqsocket2->SendHeader(0,outHeader);
// zmqsocket2->SendHeaderData(0, true, SLS_DETECTOR_JSON_HEADER_VERSION);
zmqsocket2->SendHeaderData(0, true, SLS_DETECTOR_JSON_HEADER_VERSION);
cprintf(RED, "Sent Dummy\n");
if (dout)
delete [] dout;
@ -589,84 +544,33 @@ int main(int argc, char *argv[]) {
}
//#ifdef NEWZMQ
#ifdef NEWZMQ
if (newFrame) {
begin = std::chrono::steady_clock::now();
size = zHeader.imageSize;//doc["size"].GetUint();
// dynamicRange = zheader.dynamicRange; //doc["bitmode"].GetUint();
// nPixelsX = zHeader.npixelsx; //doc["shape"][0].GetUint();
// nPixelsY = zHeader.npixelsy;// doc["shape"][1].GetUint();
filename = zHeader.fname;//doc["fname"].GetString();
acqIndex = zHeader.acqIndex; //doc["acqIndex"].GetUint64();
// frameIndex = zHeader.frameIndex;//doc["fIndex"].GetUint64();
fileindex = zHeader.fileIndex;//doc["fileIndex"].GetUint64();
expLength = zHeader.expLength;//doc["expLength"].GetUint();
packetNumber=zHeader.packetNumber;//doc["packetNumber"].GetUint();
bunchId=zHeader.bunchId;//doc["bunchId"].GetUint();
timestamp=zHeader.timestamp;//doc["timestamp"].GetUint();
modId=zHeader.modId;//doc["modId"].GetUint();
debug=zHeader.debug;//doc["debug"].GetUint();
// roundRNumber=r.roundRNumber;//doc["roundRNumber"].GetUint();
detType=zHeader.detType;//doc["detType"].GetUint();
version=zHeader.version;//doc["version"].GetUint();
/*document["bitmode"].GetUint(); zHeader.dynamicRange
begin = std::chrono::steady_clock::now();
//time(&begin);
// t0 = high_resolution_clock::now();
//cout <<"new frame" << endl;
document["fileIndex"].GetUint64(); zHeader.fileIndex
// acqIndex, frameIndex, subframeIndex, filename, fileindex
size = doc["size"].GetUint();
// multisize = size;// * zmqsocket->size();
// dynamicRange = doc["bitmode"].GetUint();
// nPixelsX = doc["shape"][0].GetUint();
// nPixelsY = doc["shape"][1].GetUint();
filename = doc["fname"].GetString();
//acqIndex = doc["acqIndex"].GetUint64();
//frameIndex = doc["fIndex"].GetUint64();
fileindex = doc["fileIndex"].GetUint64();
//subFrameIndex = doc["expLength"].GetUint();
//packetNumber=doc["packetNumber"].GetUint();
//bunchId=doc["bunchId"].GetUint();
//timestamp=doc["timestamp"].GetUint();
//modId=doc["modId"].GetUint();
//debug=doc["debug"].GetUint();
//roundRNumber=doc["roundRNumber"].GetUint();
//detType=doc["detType"].GetUint();
//version=doc["version"].GetUint();
document["detshape"][0].GetUint();
zHeader.ndetx
document["detshape"][1].GetUint();
zHeader.ndety
document["shape"][0].GetUint();
zHeader.npixelsx
document["shape"][1].GetUint();
zHeader.npixelsy
document["size"].GetUint(); zHeader.imageSize
document["acqIndex"].GetUint64(); zHeader.acqIndex
document["frameIndex"].GetUint64(); zHeader.frameIndex
document["fname"].GetString(); zHeader.fname
document["frameNumber"].GetUint64(); zHeader.frameNumber
document["expLength"].GetUint(); zHeader.expLength
document["packetNumber"].GetUint(); zHeader.packetNumber
document["bunchId"].GetUint64(); zHeader.bunchId
document["timestamp"].GetUint64(); zHeader.timestamp
document["modId"].GetUint(); zHeader.modId
document["row"].GetUint(); zHeader.row
document["column"].GetUint(); zHeader.column
document["reserved"].GetUint(); zHeader.reserved
document["debug"].GetUint(); zHeader.debug
document["roundRNumber"].GetUint(); zHeader.roundRNumber
document["detType"].GetUint(); zHeader.detType
document["version"].GetUint(); zHeader.version
document["flippedDataX"].GetUint(); zHeader.flippedDataX
document["quad"].GetUint(); zHeader.quad
document["completeImage"].GetUint(); zHeader.completeImage
*/
//dataSize=size;
//strcpy(fname,filename.c_str());
@ -700,8 +604,6 @@ document["completeImage"].GetUint(); zHeader.completeImage
// xCoord, yCoord,zCoord,
// flippedDataX, packetNumber, bunchId, timestamp, modId, debug, roundRNumber, detType, version);
addJsonHeader=zHeader.addJsonHeader;
/* Analog detector commands */
//isPedestal=0;
//isFlat=0;
@ -709,10 +611,9 @@ document["completeImage"].GetUint(); zHeader.completeImage
fMode=eFrame;
frameMode_s="frame";
cprintf(MAGENTA, "Frame mode: ");
// if (doc.HasMember("frameMode")) {
if (addJsonHeader.find("frameMode")!= addJsonHeader.end()) {
// if (doc["frameMode"].IsString()) {
frameMode_s=addJsonHeader.at("frameMode");//doc["frameMode"].GetString();
if (doc.HasMember("frameMode")) {
if (doc["frameMode"].IsString()) {
frameMode_s=doc["frameMode"].GetString();
if (frameMode_s == "pedestal"){
fMode=ePedestal;
//isPedestal=1;
@ -738,7 +639,7 @@ document["completeImage"].GetUint(); zHeader.completeImage
cprintf(MAGENTA, "Resetting flatfield\n");
fMode=eFlat;
}
//#endif
#endif
else {
fMode=eFrame;
//isPedestal=0;
@ -746,23 +647,19 @@ document["completeImage"].GetUint(); zHeader.completeImage
fMode=eFrame;
frameMode_s="frame";
}
//}
}
}
cprintf(MAGENTA, "%s\n" , frameMode_s.c_str());
mt->setFrameMode(fMode);
// threshold=0;
cprintf(MAGENTA, "Threshold: ");
if (addJsonHeader.find("threshold")!= addJsonHeader.end()) {
istringstream(addJsonHeader.at("threshold")) >>threshold;
// threshold=atoi(addJsonHeader.at("threshold").c_str());//doc["frameMode"].GetString();
}
//if (doc.HasMember("threshold")) {
//if (doc["threshold"].IsInt()) {
// threshold=doc["threshold"].GetInt();
mt->setThreshold(threshold);
// }
// }
cprintf(MAGENTA, "Threshold: ");
if (doc.HasMember("threshold")) {
if (doc["threshold"].IsInt()) {
threshold=doc["threshold"].GetInt();
mt->setThreshold(threshold);
}
}
cprintf(MAGENTA, "%d\n", threshold);
xmin=0;
@ -770,47 +667,40 @@ document["completeImage"].GetUint(); zHeader.completeImage
ymin=0;
ymax=npy;
cprintf(MAGENTA, "ROI: ");
if (addJsonHeader.find("roi")!= addJsonHeader.end()) {
istringstream(addJsonHeader.at("roi")) >> xmin >> xmax >> ymin >> ymax ;
// if (doc.HasMember("roi")) {
//if (doc["roi"].IsArray()) {
// if (doc["roi"].Size() > 0 )
// if (doc["roi"][0].IsInt())
// xmin=doc["roi"][0].GetInt();
if (doc.HasMember("roi")) {
if (doc["roi"].IsArray()) {
if (doc["roi"].Size() > 0 )
if (doc["roi"][0].IsInt())
xmin=doc["roi"][0].GetInt();
// if (doc["roi"].Size() > 1 )
// if (doc["roi"][1].IsInt())
// xmax=doc["roi"][1].GetInt();
if (doc["roi"].Size() > 1 )
if (doc["roi"][1].IsInt())
xmax=doc["roi"][1].GetInt();
// if (doc["roi"].Size() > 2 )
// if (doc["roi"][2].IsInt())
// ymin=doc["roi"][2].GetInt();
if (doc["roi"].Size() > 2 )
if (doc["roi"][2].IsInt())
ymin=doc["roi"][2].GetInt();
// if (doc["roi"].Size() > 3 )
// if (doc["roi"][3].IsInt())
// ymax=doc["roi"][3].GetInt();
// }
if (doc["roi"].Size() > 3 )
if (doc["roi"][3].IsInt())
ymax=doc["roi"][3].GetInt();
}
}
cprintf(MAGENTA, "%d %d %d %d\n", xmin, xmax, ymin, ymax);
mt->setROI(xmin, xmax, ymin, ymax);
if (addJsonHeader.find("dynamicRange")!= addJsonHeader.end()) {
istringstream(addJsonHeader.at("dynamicRange")) >> dr ;
if (doc.HasMember("dynamicRange")) {
dr=doc["dynamicRange"].GetUint();
dr=32;
}
// if (doc.HasMember("dynamicRange")) {
// dr=doc["dynamicRange"].GetUint();
// dr=32;
// }
dMode=eAnalog;
detectorMode_s="analog";
cprintf(MAGENTA, "Detector mode: ");
if (addJsonHeader.find("detectorMode")!= addJsonHeader.end()) {;
//if (doc.HasMember("detectorMode")) {
//if (doc["detectorMode"].IsString()) {
detectorMode_s=addJsonHeader.at("detectorMode");//=doc["detectorMode"].GetString();
cprintf(MAGENTA, "Detector mode: ");
if (doc.HasMember("detectorMode")) {
if (doc["detectorMode"].IsString()) {
detectorMode_s=doc["detectorMode"].GetString();
#ifdef INTERP
if (detectorMode_s == "interpolating"){
dMode=eInterpolating;
@ -828,7 +718,7 @@ document["completeImage"].GetUint(); zHeader.completeImage
mt->setInterpolation(NULL);
#endif
}
// }
}
}
@ -877,19 +767,19 @@ document["completeImage"].GetUint(); zHeader.completeImage
// }
// threshold=0;
// cprintf(MAGENTA, "Subframes: ");
// subframes=0;
// //isubframe=0;
// insubframe=0;
// subnorm=1;
// f0=0;
// nnsubframe=0;
// if (doc.HasMember("subframes")) {
// if (doc["subframes"].IsInt()) {
// subframes=doc["subframes"].GetInt();
// }
// }
// cprintf(MAGENTA, "%ld\n", subframes);
cprintf(MAGENTA, "Subframes: ");
subframes=0;
//isubframe=0;
insubframe=0;
subnorm=1;
f0=0;
nnsubframe=0;
if (doc.HasMember("subframes")) {
if (doc["subframes"].IsInt()) {
subframes=doc["subframes"].GetInt();
}
}
cprintf(MAGENTA, "%ld\n", subframes);
newFrame=0;
@ -921,13 +811,13 @@ document["completeImage"].GetUint(); zHeader.completeImage
// get data
// acqIndex = doc["acqIndex"].GetUint64();
frameIndex = zHeader.frameIndex;////doc["fIndex"].GetUint64();
frameIndex = doc["fIndex"].GetUint64();
// subFrameIndex = doc["expLength"].GetUint();
// bunchId=doc["bunchId"].GetUint();
// timestamp=doc["timestamp"].GetUint();
packetNumber=zHeader.packetNumber; //doc["packetNumber"].GetUint();
packetNumber=doc["packetNumber"].GetUint();
// cout << acqIndex << " " << frameIndex << " " << subFrameIndex << " "<< bunchId << " " << timestamp << " " << packetNumber << endl;
//cprintf(GREEN, "frame\n");
if (packetNumber>=40) {
@ -976,9 +866,8 @@ document["completeImage"].GetUint(); zHeader.completeImage
// zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 1,1,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,&additionalJsonHeader);
zHeader.data = true;
zmqsocket2->SendHeader(0,zHeader);
zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 1,1,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,&additionalJsonHeader);
zmqsocket2->SendData((char*)dout,nnx*nny*dr/8);
cprintf(GREEN, "Sent subdata\n");

View File

@ -490,7 +490,7 @@ int *getClusters(char *data, int *ph=NULL) {
// (clusters+nph)->ped=getPedestal(ix,iy,0);
for (ir=-(clusterSizeY/2); ir<(clusterSizeY/2)+1; ir++) {
for (ic=-(clusterSize/2); ic<(clusterSize/2)+1; ic++) {
if ((iy+ir)>=0 && (iy+ir)<ny && (ix+ic)>=0 && (ix+ic)<nx)
if ((iy+ir)>=iy && (iy+ir)<ny && (ix+ic)>=ix && (ix+ic)<nx)
(clusters+nph)->set_data(val[iy+ir][ix+ic],ic,ir);
}
}

View File

@ -36,17 +36,19 @@ class single_photon_hit {
\param myFile file descriptor
*/
size_t write(FILE *myFile) {
//fwrite((void*)this, 1, 3*sizeof(int)+4*sizeof(double)+sizeof(quad), myFile); // if (fwrite((void*)this, 1, sizeof(int)+2*sizeof(int16_t), myFile))
//fwrite((void*)this, 1, 3*sizeof(int)+4*sizeof(double)+sizeof(quad), myFile);
// if (fwrite((void*)this, 1, sizeof(int)+2*sizeof(int16_t), myFile))
#ifdef OLDFORMAT
if (fwrite((void*)&iframe, 1, sizeof(int), myFile)) {};
#endif
#ifndef WRITE_QUAD
//printf("no quad ");
if (fwrite((void*)&x, sizeof(int16_t), 2, myFile))
return fwrite((void*)data, sizeof(int), dx*dy, myFile);
//if (fwrite((void*)&x, 2, sizeof(int16_t), myFile))
return fwrite((void*)&x, 1, dx*dy*sizeof(int)+2*sizeof(int16_t), myFile);
#endif
#ifdef WRITE_QUAD
// printf("quad ");
// printf("quad ");
int qq[4];
switch(quad) {
case TOP_LEFT:
@ -89,8 +91,8 @@ class single_photon_hit {
default:
;
}
if (fwrite((void*)&x, sizeof(int16_t), 2, myFile))
return fwrite((void*)qq, sizeof(int), 4, myFile);
if (fwrite((void*)&x, 2, sizeof(int16_t), myFile))
return fwrite((void*)qq, 1, 4*sizeof(int), myFile);
#endif
return 0;
};
@ -107,14 +109,14 @@ class single_photon_hit {
#endif
#ifndef WRITE_QUAD
// printf( "no quad \n");
if (fread((void*)&x, sizeof(int16_t),2, myFile))
return fread((void*)data, sizeof(int), dx*dy,myFile);
if (fread((void*)&x, 2, sizeof(int16_t), myFile))
return fread((void*)data, 1, dx*dy*sizeof(int), myFile);
#endif
#ifdef WRITE_QUAD
int qq[4];
printf( "quad \n");
if (fread((void*)&x, sizeof(int16_t), 2, myFile))
if (fread((void*)qq, sizeof(int), 4, myFile)) {
// printf( "quad \n");
if (fread((void*)&x, 2, sizeof(int16_t), myFile))
if (fread((void*)qq, 1, 4*sizeof(int), myFile)) {
quad=TOP_RIGHT;
/* int mm=qq[0]; */
@ -214,6 +216,7 @@ class single_photon_hit {
for (int iy=0; iy<dy; iy++) {
for (int ix=0; ix<dx; ix++) {
printf("%d \t",data[ix+iy*dx]);
}
printf("\n");
}

View File

@ -88,7 +88,6 @@ target_include_directories(slsDetectorGui PUBLIC
)
target_link_libraries(slsDetectorGui PUBLIC
slsProjectWarnings
slsDetectorShared
${QT_QTCORE_LIBRARIES}
${QT_QTGUI_LIBRARIES}

View File

@ -1066,6 +1066,239 @@
<string>Acquisition</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_6">
<item row="1" column="4">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblNumStoragecells">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #triggers * (#storagecells+1) &lt;/p&gt;&lt;p&gt; #storagecells#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Number of Storage cells:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2" colspan="2">
<widget class="QSpinBox" name="spinNumStoragecells">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #triggers * (#storagecells+1) &lt;/p&gt;&lt;p&gt; #storagecells#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>15</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="spinSubExpTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Exposure Time of a sub frame. Only for Eiger in 32 bit mode
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subexptime#
&lt;/nobr&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="decimals">
<number>9</number>
</property>
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblSubDeadTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Dead time between sub frames. Only for Eiger in 32 bit mode.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
Default value is 0. A value less than the required minimum is ignored.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subdeadtime#
&lt;/nobr&gt;</string>
</property>
<property name="text">
<string>Sub Frame Dead Time:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QDoubleSpinBox" name="spinSubDeadTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Period between sub frames. Only for Eiger in 32 bit mode.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
Default value is 0. A value less than the required minimum is ignored.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subperiod#
&lt;/nobr&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="decimals">
<number>9</number>
</property>
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblSubExpTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Exposure Time of a sub frame. Only for Eiger in 32 bit mode
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subexptime#
&lt;/nobr&gt;</string>
</property>
<property name="text">
<string>Sub Frame Exposure Time:</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QComboBox" name="comboSubDeadTimeUnit">
<property name="enabled">
@ -1192,98 +1425,6 @@ Exposure Time of a sub frame. Only for Eiger in 32 bit mode
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblNumStoragecells">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #triggers * (#storagecells+1) &lt;/p&gt;&lt;p&gt; #storagecells#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Number of Storage cells:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2">
<widget class="QDoubleSpinBox" name="spinSubDeadTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Period between sub frames. Only for Eiger in 32 bit mode.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
Default value is 0. A value less than the required minimum is ignored.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subperiod#
&lt;/nobr&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="decimals">
<number>9</number>
</property>
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblSubExpTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Exposure Time of a sub frame. Only for Eiger in 32 bit mode
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subexptime#
&lt;/nobr&gt;</string>
</property>
<property name="text">
<string>Sub Frame Exposure Time:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lblDiscardBits">
<property name="enabled">
@ -1349,428 +1490,6 @@ Default value is 0. A value less than the required minimum is ignored.
</property>
</widget>
</item>
<item row="1" column="4">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2" colspan="2">
<widget class="QSpinBox" name="spinNumStoragecells">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #triggers * (#storagecells+1) &lt;/p&gt;&lt;p&gt; #storagecells#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>15</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="spinSubExpTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Exposure Time of a sub frame. Only for Eiger in 32 bit mode
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subexptime#
&lt;/nobr&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="decimals">
<number>9</number>
</property>
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblSubDeadTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Dead time between sub frames. Only for Eiger in 32 bit mode.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
Default value is 0. A value less than the required minimum is ignored.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subdeadtime#
&lt;/nobr&gt;</string>
</property>
<property name="text">
<string>Sub Frame Dead Time:</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QComboBox" name="comboExpTimeUnit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Exposure Time of a corresonding gate signal index. &lt;br/&gt;#exptime1# &lt;/p&gt;&lt;p&gt;#exptime2#&lt;/p&gt;&lt;p&gt;#exptime3#  &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="currentIndex">
<number>2</number>
</property>
<item>
<property name="text">
<string>hr</string>
</property>
</item>
<item>
<property name="text">
<string>min</string>
</property>
</item>
<item>
<property name="text">
<string>s</string>
</property>
</item>
<item>
<property name="text">
<string>ms</string>
</property>
</item>
<item>
<property name="text">
<string>us</string>
</property>
</item>
<item>
<property name="text">
<string>ns</string>
</property>
</item>
</widget>
</item>
<item row="5" column="2">
<widget class="QDoubleSpinBox" name="spinExpTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Exposure Time of a corresonding gate signal index. &lt;br/&gt;#exptime1# &lt;/p&gt;&lt;p&gt;#exptime2#&lt;/p&gt;&lt;p&gt;#exptime3# &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="decimals">
<number>9</number>
</property>
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QSpinBox" name="spinGateIndex">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Gate index. It will get exposure time and gate delay for corresponding gate signal.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>3</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="lblGateDelay">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #triggers * (#storagecells+1) &lt;/p&gt;&lt;p&gt; #storagecells#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Gate Delay:</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QDoubleSpinBox" name="spinGateDelay">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Gate Delay of a corresonding gate signal index. &lt;br/&gt;#gatedelay1# &lt;/p&gt;&lt;p&gt;#gatedelay2#&lt;/p&gt;&lt;p&gt;#gatedelay3#  &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="decimals">
<number>9</number>
</property>
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QComboBox" name="comboGateDelayUnit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Gate Delay of a corresonding gate signal index. &lt;br/&gt;#gatedelay1# &lt;/p&gt;&lt;p&gt;#gatedelay2#&lt;/p&gt;&lt;p&gt;#gatedelay3#  &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="currentIndex">
<number>2</number>
</property>
<item>
<property name="text">
<string>hr</string>
</property>
</item>
<item>
<property name="text">
<string>min</string>
</property>
</item>
<item>
<property name="text">
<string>s</string>
</property>
</item>
<item>
<property name="text">
<string>ms</string>
</property>
</item>
<item>
<property name="text">
<string>us</string>
</property>
</item>
<item>
<property name="text">
<string>ns</string>
</property>
</item>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="lblExpTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #triggers * (#storagecells+1) &lt;/p&gt;&lt;p&gt; #storagecells#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Expososure Time:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="lblGateIndex">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #triggers * (#storagecells+1) &lt;/p&gt;&lt;p&gt; #storagecells#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Gate Index:</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>

View File

@ -409,7 +409,7 @@
<widget class="QFrame" name="frameTimeResolved">
<property name="minimumSize">
<size>
<width>410</width>
<width>400</width>
<height>0</height>
</size>
</property>
@ -432,77 +432,6 @@
<property name="verticalSpacing">
<number>4</number>
</property>
<item row="5" column="0">
<widget class="QStackedWidget" name="stackedLblTriggerBurst">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>171</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>171</width>
<height>32</height>
</size>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="pageLblTrigger">
<layout class="QGridLayout" name="gridLblTrigger">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lblNumTriggers">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of Triggers to be expected.&lt;/p&gt;&lt;p&gt; #triggers#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Number of Triggers:</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="pageLblBurst">
<layout class="QGridLayout" name="gridLblBurst">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lblNumBursts">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of Triggers to be expected.&lt;/p&gt;&lt;p&gt; #triggers#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Number of Bursts:</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="4" column="3">
<widget class="QComboBox" name="comboPeriodUnit">
<property name="enabled">
@ -572,6 +501,53 @@ Frame period between exposures.
</property>
</widget>
</item>
<item row="7" column="2" colspan="2">
<widget class="QSpinBox" name="spinNumSamples">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>Number of Triggers to be expected.
#triggers#</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>2000000000</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="1" column="2" colspan="2">
<widget class="QSpinBox" name="spinNumMeasurements">
<property name="sizePolicy">
@ -618,17 +594,25 @@ Frame period between exposures.
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="minimumSize">
<size>
<width>175</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Number of Measurements:</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="lblNumSamples">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Number of Triggers to be expected.
#triggers#</string>
</property>
<property name="text">
<string>Number of Samples:</string>
</property>
</widget>
</item>
<item row="0" column="2" colspan="2">
<widget class="QComboBox" name="comboTimingMode">
<property name="sizePolicy">
@ -667,11 +651,6 @@ Frame period between exposures.
<string>Burst Trigger</string>
</property>
</item>
<item>
<property name="text">
<string>Trigger Gated</string>
</property>
</item>
</widget>
</item>
<item row="3" column="2">
@ -931,6 +910,77 @@ Frame period between exposures.
</property>
</spacer>
</item>
<item row="5" column="0">
<widget class="QStackedWidget" name="stackedLblTriggerBurst">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>171</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>171</width>
<height>32</height>
</size>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="pageLblTrigger">
<layout class="QGridLayout" name="gridLblTrigger">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lblNumTriggers">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of Triggers to be expected.&lt;/p&gt;&lt;p&gt; #triggers#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Number of Triggers:</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="pageLblBurst">
<layout class="QGridLayout" name="gridLblBurst">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lblNumBursts">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of Triggers to be expected.&lt;/p&gt;&lt;p&gt; #triggers#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Number of Bursts:</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="5" column="2">
<widget class="QStackedWidget" name="stackedSpinTriggerBurst">
<property name="sizePolicy">
@ -1431,214 +1481,6 @@ Frame period between exposures.
</widget>
</widget>
</item>
<item row="7" column="0">
<widget class="QStackedWidget" name="stackedLblSamplesGates">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>171</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>171</width>
<height>32</height>
</size>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="pageLblSamples">
<layout class="QGridLayout" name="gridLblTrigger_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lblNumSamples">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of analog samples.&lt;/p&gt;&lt;p&gt;#asamples#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Number of Samples:</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="pageLblGates">
<layout class="QGridLayout" name="gridLblBurst_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lblNumGates">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of external gates.&lt;/p&gt;&lt;p&gt;#gates#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Number of Gates:</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="7" column="2">
<widget class="QStackedWidget" name="stackedSpinSamplesGates">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>208</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>208</width>
<height>32</height>
</size>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="pageSpinSamples">
<layout class="QGridLayout" name="gridSpinTrigger_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QSpinBox" name="spinNumSamples">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of analog samples.&lt;/p&gt;&lt;p&gt;#asamples#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>2000000000</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="pageSpinGates">
<layout class="QGridLayout" name="gridSpinBurst_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QSpinBox" name="spinNumGates">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of external gates.&lt;/p&gt;&lt;p&gt;#gates#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>2000000000</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
@ -1671,6 +1513,7 @@ Frame period between exposures.
<tabstop>comboExpUnit</tabstop>
<tabstop>spinPeriod</tabstop>
<tabstop>comboPeriodUnit</tabstop>
<tabstop>spinNumSamples</tabstop>
</tabstops>
<resources>
<include location="../include/icons.qrc"/>

View File

@ -14,8 +14,7 @@ class qCloneWidget : public QMainWindow, private Ui::ClonePlotObject {
qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2,
SlsQt1DPlot *gp1, SlsQt2DPlot *gp, QString title,
QString filePath, QString fileName, int64_t aIndex,
bool displayStats, QString min, QString max, QString sum,
bool completeImage);
bool displayStats, QString min, QString max, QString sum, bool completeImage);
~qCloneWidget();

View File

@ -1,7 +1,7 @@
#pragma once
#include "ui_form_dac.h"
#include "Detector.h"
#include "sls_detector_defs.h"
#include "ui_form_dac.h"
#include <string>
class qDacWidget : public QWidget, private Ui::WidgetDacObject {

View File

@ -1,15 +1,14 @@
#pragma once
#include "logger.h"
#include "sls_detector_defs.h"
#include <QAbstractButton>
#include <QMessageBox>
#include <chrono>
#include <cstdint>
#include <iostream>
#include <ostream>
#include <cstdint>
#include <string>
using std::chrono::duration;

View File

@ -1,7 +1,7 @@
#pragma once
#include "Detector.h"
#include "qDefs.h"
#include "ui_form_detectormain.h"
#include "qDefs.h"
#include "Detector.h"
#include <QTabWidget>
class qDrawPlot;
@ -29,7 +29,7 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
Q_OBJECT
public:
qDetectorMain(int multiId, const std::string &fname, bool isDevel);
qDetectorMain(int multiId, const std::string& fname, bool isDevel);
~qDetectorMain();
private slots:
@ -51,9 +51,9 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
private:
void SetUpWidgetWindow();
void SetUpDetector(const std::string &config_file, int multiID);
void SetUpDetector(const std::string& config_file, int multiID);
void Initialization();
void LoadConfigFile(const std::string &config_file);
void LoadConfigFile(const std::string& config_file);
/** enumeration of the tabs */
enum {
@ -70,7 +70,7 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
slsDetectorDefs::detectorType detType;
std::unique_ptr<sls::Detector> det;
qDrawPlot *plot;
MyTabWidget *tabs;
MyTabWidget* tabs;
std::unique_ptr<QScrollArea> scroll[NumberOfTabs];
qTabMeasurement *tabMeasurement;
qTabDataOutput *tabDataOutput;

View File

@ -1,7 +1,7 @@
#pragma once
#include "Detector.h"
#include "qDefs.h"
#include "ui_form_plot.h"
#include "qDefs.h"
#include "Detector.h"
#include <mutex>
class SlsQt1DPlot;

View File

@ -1,6 +1,6 @@
#pragma once
#include "Detector.h"
#include "ui_form_tab_advanced.h"
#include "Detector.h"
class qDrawPlot;
@ -36,9 +36,6 @@ class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
void SetNumStoragecells(int value);
void SetSubExposureTime();
void SetSubDeadTime();
void SetGateIndex(int value);
void SetExposureTime();
void SetGateDelay();
private:
void SetupWidgetWindow();
@ -62,8 +59,6 @@ class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
void GetNumStoragecells();
void GetSubExposureTime();
void GetSubDeadTime();
void GetExposureTime();
void GetGateDelay();
sls::Detector *det;
qDrawPlot *plot;

View File

@ -1,6 +1,6 @@
#pragma once
#include "Detector.h"
#include "ui_form_tab_dataoutput.h"
#include "Detector.h"
class qTabDataOutput : public QWidget, private Ui::TabDataOutputObject {
Q_OBJECT

View File

@ -1,6 +1,6 @@
#pragma once
#include "Detector.h"
#include "ui_form_tab_debugging.h"
#include "Detector.h"
class QTreeWidget;
class QTreeWidgetItem;

View File

@ -1,7 +1,7 @@
#pragma once
#include "ui_form_tab_developer.h"
#include "Detector.h"
#include "sls_detector_defs.h"
#include "ui_form_tab_developer.h"
#include <vector>
class qDacWidget;

View File

@ -1,6 +1,6 @@
#pragma once
#include "Detector.h"
#include "ui_form_tab_measurement.h"
#include "Detector.h"
class qDrawPlot;
class QStandardItemModel;
@ -25,7 +25,6 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
void SetNumTriggers(int val);
void SetNumBursts(int val);
void SetNumSamples(int val);
void SetNumGates(int val);
void SetExposureTime();
void SetAcquisitionPeriod();
void SetDelay();
@ -46,7 +45,6 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
* show bursts and burst period
*/
void ShowTriggerDelay();
void ShowGates();
void SetupTimingMode();
void EnableWidgetsforTimingMode();
@ -55,7 +53,6 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
void GetNumTriggers();
void GetNumBursts();
void GetNumSamples();
void GetNumGates();
void GetExposureTime();
void GetAcquisitionPeriod();
void CheckAcqPeriodGreaterThanExp();
@ -79,7 +76,7 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
sls::Detector *det;
qDrawPlot *plot;
// enum for the timing mode
enum { AUTO, TRIGGER, GATED, BURST_TRIGGER, TRIGGER_GATED, NUMTIMINGMODES };
enum { AUTO, TRIGGER, GATED, BURST_TRIGGER, NUMTIMINGMODES };
QTimer *progressTimer;
// tool tip variables
QString acqPeriodTip;
@ -87,7 +84,6 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
QPalette red;
bool delayImplemented;
bool sampleImplemented;
bool gateImplemented;
bool startingFnumImplemented;
bool isAcquisitionStopped{false};
int numMeasurements{1};

View File

@ -1,6 +1,6 @@
#pragma once
#include "Detector.h"
#include "ui_form_tab_plot.h"
#include "Detector.h"
class qDrawPlot;
class QButtonGroup;

View File

@ -1,6 +1,6 @@
#pragma once
#include "Detector.h"
#include "ui_form_tab_settings.h"
#include "Detector.h"
class qTabSettings : public QWidget, private Ui::TabSettingsObject {
Q_OBJECT

View File

@ -1,8 +1,8 @@
#ifndef SLSQT1DPLOT_H
#define SLSQT1DPLOT_H
#include "SlsQt1DZoomer.h"
#include "ansi.h"
#include "SlsQt1DZoomer.h"
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_marker.h>

View File

@ -1,9 +1,9 @@
#ifndef SLSQT2DZOOMER_H
#define SLSQT2DZOOMER_H
#include "SlsQt2DHist.h"
#include <cstdio>
#include <qwt_plot_panner.h>
#include <qwt_plot_zoomer.h>
#include <cstdio>
class SlsQt2DZoomer : public QwtPlotZoomer {
private:

View File

@ -1,7 +1,7 @@
/* TODO! short description */
#include "SlsQt1DPlot.h"
#include <iostream>
#include <qwt_symbol.h>
#include <qwt_legend.h>
#include <qwt_math.h>
#include <qwt_painter.h>
@ -10,8 +10,8 @@
#include <qwt_scale_draw.h>
#include <qwt_scale_engine.h>
#include <qwt_scale_widget.h>
#include <qwt_symbol.h>
#include <stdlib.h>
#include <iostream>
#define QwtLog10ScaleEngine QwtLogScaleEngine // hmm
@ -314,8 +314,7 @@ void SlsQtH1DList::Remove(SlsQtH1D *hist) {
hl = hl->the_next;
else { // match
if (!hl->the_next)
hl->the_hist =
nullptr; // first the_hist is zero when there's no next
hl->the_hist = nullptr; // first the_hist is zero when there's no next
else {
SlsQtH1DList *t = hl->the_next;
hl->the_hist = t->the_hist;

View File

@ -1,9 +1,9 @@
/* TODO! short description */
#include "SlsQt1DZoomer.h"
#include "SlsQt1DPlot.h"
#include <iostream>
#include <qwt_plot.h>
#include <qwt_scale_div.h>
#include <iostream>
void SlsQt1DZoomer::ResetZoomBase() {
SetZoomBase(x0, y0, x1 - x0,

View File

@ -216,7 +216,7 @@ QwtLinearColorMap *SlsQt2DPlot::myColourMap(QVector<double> colourStops) {
}
QwtLinearColorMap *SlsQt2DPlot::myColourMap(int log) {
QVector<double> cs{0.0, 0.34, 0.61, 0.84, 1.0};
QVector<double> cs{0.0, 0.34, 0.61 ,0.84, 1.0};
if (log) {
for (int i = 0; i < cs.size(); ++i)
cs[i] = (pow(10, 2 * cs[i]) - 1) / 99.0;
@ -224,6 +224,7 @@ QwtLinearColorMap *SlsQt2DPlot::myColourMap(int log) {
return myColourMap(cs);
}
void SlsQt2DPlot::Update() {
if (isLog)
hist->SetMinimumToFirstGreaterThanZero();

View File

@ -1,6 +1,7 @@
#include "qDacWidget.h"
#include "qDefs.h"
qDacWidget::qDacWidget(QWidget *parent, sls::Detector *detector, bool d,
std::string n, slsDetectorDefs::dacIndex i)
: QWidget(parent), det(detector), isDac(d), index(i) {
@ -45,9 +46,7 @@ void qDacWidget::GetDac() {
spinDac->setValue(retval);
// mv
retval = det->getDAC(index, 1, {detectorIndex}).squash(-1);
// -6 is the minimum amt of space it occupies, if more needed, its
// padded with ' ', negative value for left aligned text
lblDacmV->setText(QString("%1mV").arg(retval, -6));
lblDacmV->setText(QString("%1mV").arg(retval - 10));
}
CATCH_DISPLAY(std::string("Could not get dac ") + std::to_string(index),
"qDacWidget::GetDac")
@ -57,8 +56,8 @@ void qDacWidget::GetDac() {
void qDacWidget::SetDac() {
int val = (int)spinDac->value();
LOG(logINFO) << "Setting dac:" << lblDac->text().toAscii().data() << " : "
<< val;
LOG(logINFO) << "Setting dac:" << lblDac->text().toAscii().data()
<< " : " << val;
try {
det->setDAC(index, val, 0, {detectorIndex});

View File

@ -19,8 +19,8 @@
#include <QScrollArea>
#include <QSizePolicy>
#include <getopt.h>
#include <string>
#include <getopt.h>
#include <sys/stat.h>
int main(int argc, char **argv) {
@ -57,7 +57,8 @@ int main(int argc, char **argv) {
case 'f':
fname = optarg;
LOG(logDEBUG) << long_options[option_index].name << " " << optarg;
LOG(logDEBUG)
<< long_options[option_index].name << " " << optarg;
break;
case 'd':
@ -71,7 +72,7 @@ int main(int argc, char **argv) {
case 'v':
tempval = APIGUI;
LOG(logINFO) << "SLS Detector GUI " << GITBRANCH << " (0x"
<< std::hex << tempval << ")";
<< std::hex << tempval << ")";
return 0;
case 'h':
@ -92,7 +93,7 @@ int main(int argc, char **argv) {
}
QApplication app(argc, argv);
app.setStyle(new QPlastiqueStyle); // style is deleted by QApplication
app.setStyle(new QPlastiqueStyle); //style is deleted by QApplication
try {
qDetectorMain det(multiId, fname, isDeveloper);
det.show();
@ -104,18 +105,18 @@ int main(int argc, char **argv) {
return 0;
}
qDetectorMain::qDetectorMain(int multiId, const std::string &fname,
bool isDevel)
: QMainWindow(nullptr), detType(slsDetectorDefs::GENERIC),
isDeveloper(isDevel), heightPlotWindow(0), heightCentralWidget(0) {
qDetectorMain::qDetectorMain(int multiId, const std::string& fname, bool isDevel)
: QMainWindow(nullptr), detType(slsDetectorDefs::GENERIC), isDeveloper(isDevel),
heightPlotWindow(0), heightCentralWidget(0) {
setupUi(this);
SetUpDetector(fname, multiId);
SetUpWidgetWindow();
}
qDetectorMain::~qDetectorMain() {
disconnect(tabs, SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));
qDetectorMain::~qDetectorMain(){
disconnect(tabs, SIGNAL(currentChanged(int)), this,
SLOT(Refresh(int)));
}
void qDetectorMain::SetUpWidgetWindow() {
@ -131,7 +132,8 @@ void qDetectorMain::SetUpWidgetWindow() {
layoutTabs->addWidget(tabs);
// creating all the other tab widgets
tabMeasurement = new qTabMeasurement(this, det.get(), plot);
tabMeasurement =
new qTabMeasurement(this, det.get(), plot);
tabDataOutput = new qTabDataOutput(this, det.get());
tabPlot = new qTabPlot(this, det.get(), plot);
tabSettings = new qTabSettings(this, det.get());
@ -204,7 +206,7 @@ void qDetectorMain::SetUpWidgetWindow() {
Initialization();
}
void qDetectorMain::SetUpDetector(const std::string &config_file, int multiID) {
void qDetectorMain::SetUpDetector(const std::string& config_file, int multiID) {
// instantiate detector and set window title
det = sls::make_unique<sls::Detector>(multiID);
@ -258,8 +260,8 @@ void qDetectorMain::Initialization() {
// Measurement tab
connect(tabMeasurement, SIGNAL(EnableTabsSignal(bool)), this,
SLOT(EnableTabs(bool)));
connect(tabMeasurement, SIGNAL(FileNameChangedSignal(QString)), plot,
SLOT(SetSaveFileName(QString)));
connect(tabMeasurement, SIGNAL(FileNameChangedSignal(QString)),
plot, SLOT(SetSaveFileName(QString)));
// Plot tab
connect(tabPlot, SIGNAL(DisableZoomSignal(bool)), this,
SLOT(SetZoomToolTip(bool)));
@ -267,7 +269,8 @@ void qDetectorMain::Initialization() {
// Plotting
connect(plot, SIGNAL(AcquireFinishedSignal()), tabMeasurement,
SLOT(AcquireFinished()));
connect(plot, SIGNAL(AbortSignal()), tabMeasurement, SLOT(AbortAcquire()));
connect(plot, SIGNAL(AbortSignal()), tabMeasurement,
SLOT(AbortAcquire()));
// menubar
// Modes Menu
@ -281,7 +284,7 @@ void qDetectorMain::Initialization() {
SLOT(ExecuteHelp(QAction *)));
}
void qDetectorMain::LoadConfigFile(const std::string &config_file) {
void qDetectorMain::LoadConfigFile(const std::string& config_file) {
LOG(logINFO) << "Loading config file at start up:" << config_file;
@ -369,7 +372,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
"The Configuration Parameters have been "
"configured successfully.",
"qDetectorMain::ExecuteUtilities");
LOG(logINFO) << "Configuration Parameters loaded successfully";
LOG(logINFO)
<< "Configuration Parameters loaded successfully";
}
}
@ -434,7 +438,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
void qDetectorMain::ExecuteHelp(QAction *action) {
if (action == actionAbout) {
LOG(logINFO) << "About Common GUI for Jungfrau, Eiger, Mythen3, "
"Gotthard, Gotthard2 and Moench detectors";
"Gotthard, Gotthard2 and Moench detectors";
std::string guiVersion = std::to_string(APIGUI);
std::string clientVersion = "unknown";

View File

@ -51,16 +51,16 @@ void qDrawPlot::SetupWidgetWindow() {
gainMask = (3 << 14);
gainOffset = 14;
LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask
<< ", Gain Mask:" << gainMask
<< ", Gain Offset:" << std::dec << gainOffset;
<< ", Gain Mask:" << gainMask
<< ", Gain Offset:" << std::dec << gainOffset;
break;
case slsDetectorDefs::GOTTHARD2:
pixelMask = ((1 << 12) - 1);
gainMask = (3 << 12);
gainOffset = 12;
LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask
<< ", Gain Mask:" << gainMask
<< ", Gain Offset:" << std::dec << gainOffset;
<< ", Gain Mask:" << gainMask
<< ", Gain Offset:" << std::dec << gainOffset;
break;
default:
break;
@ -277,7 +277,8 @@ void qDrawPlot::SetPlotTitlePrefix(QString title) {
}
void qDrawPlot::SetXAxisTitle(QString title) {
LOG(logINFO) << "Setting X Axis Title to " << title.toAscii().constData();
LOG(logINFO) << "Setting X Axis Title to "
<< title.toAscii().constData();
if (is1d) {
xTitle1d = title;
} else {
@ -286,7 +287,8 @@ void qDrawPlot::SetXAxisTitle(QString title) {
}
void qDrawPlot::SetYAxisTitle(QString title) {
LOG(logINFO) << "Setting Y Axis Title to " << title.toAscii().constData();
LOG(logINFO) << "Setting Y Axis Title to "
<< title.toAscii().constData();
if (is1d) {
yTitle1d = title;
} else {
@ -295,7 +297,8 @@ void qDrawPlot::SetYAxisTitle(QString title) {
}
void qDrawPlot::SetZAxisTitle(QString title) {
LOG(logINFO) << "Setting Z Axis Title to " << title.toAscii().constData();
LOG(logINFO) << "Setting Z Axis Title to "
<< title.toAscii().constData();
zTitle2d = title;
}
@ -306,8 +309,8 @@ void qDrawPlot::SetXYRangeChanged(bool disable, double *xy, bool *isXY) {
std::copy(xy, xy + 4, xyRange);
std::copy(isXY, isXY + 4, isXYRange);
LOG(logDEBUG) << "Setting Disable zoom to " << std::boolalpha << disable
<< std::noboolalpha;
LOG(logDEBUG) << "Setting Disable zoom to " << std::boolalpha
<< disable << std::noboolalpha;
disableZoom = disable;
}
@ -345,8 +348,8 @@ double qDrawPlot::GetYMaximum() {
}
void qDrawPlot::SetDataCallBack(bool enable) {
LOG(logINFO) << "Setting data call back to " << std::boolalpha << enable
<< std::noboolalpha;
LOG(logINFO) << "Setting data call back to " << std::boolalpha
<< enable << std::noboolalpha;
try {
if (enable) {
isPlot = true;
@ -357,14 +360,13 @@ void qDrawPlot::SetDataCallBack(bool enable) {
det->registerDataCallback(nullptr, this);
det->setRxZmqDataStream(false);
}
}
CATCH_DISPLAY("Could not get set rxr data streaming enable.",
} CATCH_DISPLAY("Could not get set rxr data streaming enable.",
"qDrawPlot::SetDataCallBack")
}
void qDrawPlot::SetBinary(bool enable, int from, int to) {
LOG(logINFO) << (enable ? "Enabling" : "Disabling")
<< " Binary output from " << from << " to " << to;
<< " Binary output from " << from << " to " << to;
binaryFrom = from;
binaryTo = to;
isBinary = enable;
@ -378,7 +380,7 @@ void qDrawPlot::SetPersistency(int val) {
void qDrawPlot::SetLines(bool enable) {
std::lock_guard<std::mutex> lock(mPlots);
LOG(logINFO) << "Setting Lines to " << std::boolalpha << enable
<< std::noboolalpha;
<< std::noboolalpha;
isLines = enable;
for (int i = 0; i < nHists; ++i) {
SlsQtH1D *h = hists1d.at(i);
@ -389,7 +391,7 @@ void qDrawPlot::SetLines(bool enable) {
void qDrawPlot::SetMarkers(bool enable) {
std::lock_guard<std::mutex> lock(mPlots);
LOG(logINFO) << "Setting Markers to " << std::boolalpha << enable
<< std::noboolalpha;
<< std::noboolalpha;
isMarkers = enable;
for (int i = 0; i < nHists; ++i) {
SlsQtH1D *h = hists1d.at(i);
@ -400,28 +402,28 @@ void qDrawPlot::SetMarkers(bool enable) {
void qDrawPlot::Set1dLogY(bool enable) {
std::lock_guard<std::mutex> lock(mPlots);
LOG(logINFO) << "Setting Log Y to " << std::boolalpha << enable
<< std::noboolalpha;
<< std::noboolalpha;
plot1d->SetLogY(enable);
}
void qDrawPlot::SetInterpolate(bool enable) {
std::lock_guard<std::mutex> lock(mPlots);
LOG(logINFO) << "Setting Interpolate to " << std::boolalpha << enable
<< std::noboolalpha;
<< std::noboolalpha;
plot2d->SetInterpolate(enable);
}
void qDrawPlot::SetContour(bool enable) {
std::lock_guard<std::mutex> lock(mPlots);
LOG(logINFO) << "Setting Countour to " << std::boolalpha << enable
<< std::noboolalpha;
<< std::noboolalpha;
plot2d->SetContour(enable);
}
void qDrawPlot::SetLogz(bool enable) {
std::lock_guard<std::mutex> lock(mPlots);
LOG(logINFO) << "Setting Log Z to " << std::boolalpha << enable
<< std::noboolalpha;
<< std::noboolalpha;
plot2d->SetLogz(enable, isZRange[0], isZRange[1], zRange[0], zRange[1]);
}
@ -453,7 +455,7 @@ void qDrawPlot::ResetAccumulate() {
void qDrawPlot::DisplayStatistics(bool enable) {
LOG(logINFO) << (enable ? "Enabling" : "Disabling")
<< " Statistics Display";
<< " Statistics Display";
displayStatistics = enable;
}
@ -469,7 +471,7 @@ void qDrawPlot::EnableGainPlot(bool enable) {
void qDrawPlot::SetSaveFileName(QString val) {
LOG(logDEBUG) << "Setting Clone/Save File Name to "
<< val.toAscii().constData();
<< val.toAscii().constData();
fileSaveName = val;
}
@ -568,8 +570,8 @@ void qDrawPlot::ClonePlot() {
new qCloneWidget(this, cloneplot1D, cloneplot2D, clonegainplot1D,
clonegainplot2D, boxPlot->title(), fileSavePath,
fileSaveName, currentAcqIndex, displayStatistics,
lblMinDisp->text(), lblMaxDisp->text(), lblSumDisp->text(),
completeImage);
lblMinDisp->text(), lblMaxDisp->text(),
lblSumDisp->text(), completeImage);
}
void qDrawPlot::SavePlot() {
@ -671,7 +673,8 @@ void qDrawPlot::AcquireThread() {
// exception in acquire will not call acquisition finished call back, so
// handle it
if (!mess.empty()) {
LOG(logERROR) << "Acquisition Finished with an exception: " << mess;
LOG(logERROR) << "Acquisition Finished with an exception: "
<< mess;
qDefs::ExceptionMessage("Acquire unsuccessful.", mess,
"qDrawPlot::AcquireFinished");
try {
@ -717,7 +720,7 @@ void qDrawPlot::AcquisitionFinished(double currentProgress,
LOG(logERROR) << "Acquisition finished [Status: ERROR]";
} else {
LOG(logINFO) << "Acquisition finished [ Status:" << status
<< ", Progress: " << currentProgress << " ]";
<< ", Progress: " << currentProgress << " ]";
}
emit AcquireFinishedSignal();
}
@ -726,26 +729,27 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex,
uint32_t subFrameIndex) {
std::lock_guard<std::mutex> lock(mPlots);
LOG(logDEBUG) << "* GetData Callback *" << std::endl
<< " frame index: " << frameIndex << std::endl
<< " sub frame index: "
<< (((int)subFrameIndex == -1) ? (int)-1 : subFrameIndex)
<< std::endl
<< " Data [" << std::endl
<< " \t progress: " << data->progressIndex << std::endl
<< " \t file name: " << data->fileName << std::endl
<< " \t nx: " << data->nx << std::endl
<< " \t ny: " << data->ny << std::endl
<< " \t data bytes: " << data->databytes << std::endl
<< " \t dynamic range: " << data->dynamicRange << std::endl
<< " \t file index: " << data->fileIndex << std::endl
<< " \t complete image: " << data->completeImage << std::endl
<< " ]";
<< " frame index: " << frameIndex << std::endl
<< " sub frame index: "
<< (((int)subFrameIndex == -1) ? (int)-1 : subFrameIndex)
<< std::endl
<< " Data [" << std::endl
<< " \t progress: " << data->progressIndex << std::endl
<< " \t file name: " << data->fileName << std::endl
<< " \t nx: " << data->nx << std::endl
<< " \t ny: " << data->ny << std::endl
<< " \t data bytes: " << data->databytes << std::endl
<< " \t dynamic range: " << data->dynamicRange
<< std::endl
<< " \t file index: " << data->fileIndex << std::endl
<< " \t complete image: " << data->completeImage << std::endl
<< " ]";
progress = (int)data->progressIndex;
currentAcqIndex = data->fileIndex;
currentFrame = frameIndex;
LOG(logDEBUG) << "[ Progress:" << progress << ", Frame:" << currentFrame
<< " ]";
LOG(logDEBUG) << "[ Progress:" << progress
<< ", Frame:" << currentFrame << " ]";
// 2d (only image, not gain data, not pedestalvals),
// check if npixelsX and npixelsY is the same (quad is different)
@ -753,8 +757,8 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex,
static_cast<int>(nPixelsY) != data->ny)) {
nPixelsX = data->nx;
nPixelsY = data->ny;
LOG(logINFO) << "Change in Detector Shape:\n\tnPixelsX:" << nPixelsX
<< " nPixelsY:" << nPixelsY;
LOG(logINFO) << "Change in Detector Shape:\n\tnPixelsX:"
<< nPixelsX << " nPixelsY:" << nPixelsY;
delete[] data2d;
data2d = new double[nPixelsY * nPixelsX];
@ -811,8 +815,8 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex,
}
// calculate the pedestal value
if (pedestalCount == NUM_PEDESTAL_FRAMES) {
LOG(logINFO) << "Pedestal Calculated after " << NUM_PEDESTAL_FRAMES
<< " frames";
LOG(logINFO) << "Pedestal Calculated after "
<< NUM_PEDESTAL_FRAMES << " frames";
for (unsigned int px = 0; px < nPixels; ++px)
tempPedestalVals[px] =
tempPedestalVals[px] / (double)NUM_PEDESTAL_FRAMES;
@ -1111,7 +1115,7 @@ void qDrawPlot::UpdatePlot() {
// notify of incomplete images
lblCompleteImage->hide();
lblInCompleteImage->hide();
if (completeImage) {
if(completeImage) {
lblCompleteImage->show();
} else {
lblInCompleteImage->show();

View File

@ -29,21 +29,9 @@ void qTabAdvanced::SetupWidgetWindow() {
tab_roi->setEnabled(true);
break;
case slsDetectorDefs::MYTHEN3:
lblDiscardBits->setEnabled(true);
spinDiscardBits->setEnabled(true);
lblGateIndex->setEnabled(true);
spinGateIndex->setEnabled(true);
lblExpTime->setEnabled(true);
spinExpTime->setEnabled(true);
comboExpTimeUnit->setEnabled(true);
lblGateDelay->setEnabled(true);
spinGateDelay->setEnabled(true);
comboGateDelayUnit->setEnabled(true);
break;
case slsDetectorDefs::GOTTHARD2:
lblDiscardBits->setEnabled(true);
spinDiscardBits->setEnabled(true);
break;
default:
break;
}
@ -128,28 +116,6 @@ void qTabAdvanced::Initialization() {
connect(spinDiscardBits, SIGNAL(valueChanged(int)), plot,
SLOT(SetNumDiscardBits(int)));
}
// gate index
if (lblGateIndex->isEnabled()) {
connect(spinGateIndex, SIGNAL(valueChanged(int)), this,
SLOT(SetGateIndex(int)));
}
// exptime1, exptime2, exptme3
if (lblExpTime->isEnabled()) {
connect(spinExpTime, SIGNAL(valueChanged(double)), this,
SLOT(SetExposureTime()));
connect(comboExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetExposureTime()));
}
// gatedelay1, gatedelay2, gatedelay3
if (lblGateDelay->isEnabled()) {
connect(spinGateDelay, SIGNAL(valueChanged(double)), this,
SLOT(SetGateDelay()));
connect(comboGateDelayUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetGateDelay()));
}
}
void qTabAdvanced::PopulateDetectors() {
@ -384,7 +350,7 @@ void qTabAdvanced::GetRxrZMQIP() {
void qTabAdvanced::SetDetector() {
LOG(logDEBUG) << "Set Detector: "
<< comboDetector->currentText().toAscii().data();
<< comboDetector->currentText().toAscii().data();
GetControlPort();
GetStopPort();
@ -565,7 +531,8 @@ void qTabAdvanced::SetROI() {
roi.xmax = spinXmax->value();
// set roi
LOG(logINFO) << "Setting ROI: [" << roi.xmin << ", " << roi.xmax << "]";
LOG(logINFO) << "Setting ROI: [" << roi.xmin << ", " << roi.xmax
<< "]";
try {
det->setROI(roi, {comboReadout->currentIndex()});
}
@ -619,7 +586,8 @@ void qTabAdvanced::GetNumStoragecells() {
}
void qTabAdvanced::SetNumStoragecells(int value) {
LOG(logINFO) << "Setting number of additional stoarge cells: " << value;
LOG(logINFO) << "Setting number of additional stoarge cells: "
<< value;
try {
det->setNumberOfAdditionalStorageCells(value);
}
@ -653,11 +621,11 @@ void qTabAdvanced::SetSubExposureTime() {
auto timeNS = qDefs::getNSTime(std::make_pair(
spinSubExpTime->value(),
static_cast<qDefs::timeUnit>(comboSubExpTimeUnit->currentIndex())));
LOG(logINFO) << "Setting sub frame acquisition time to " << timeNS.count()
<< " ns"
<< "/" << spinSubExpTime->value()
<< qDefs::getUnitString(
(qDefs::timeUnit)comboSubExpTimeUnit->currentIndex());
LOG(logINFO)
<< "Setting sub frame acquisition time to " << timeNS.count() << " ns"
<< "/" << spinSubExpTime->value()
<< qDefs::getUnitString(
(qDefs::timeUnit)comboSubExpTimeUnit->currentIndex());
try {
det->setSubExptime(timeNS);
}
@ -693,10 +661,11 @@ void qTabAdvanced::SetSubDeadTime() {
spinSubDeadTime->value(),
static_cast<qDefs::timeUnit>(comboSubDeadTimeUnit->currentIndex())));
LOG(logINFO) << "Setting sub frame dead time to " << timeNS.count() << " ns"
<< "/" << spinSubDeadTime->value()
<< qDefs::getUnitString(
(qDefs::timeUnit)comboSubDeadTimeUnit->currentIndex());
LOG(logINFO)
<< "Setting sub frame dead time to " << timeNS.count() << " ns"
<< "/" << spinSubDeadTime->value()
<< qDefs::getUnitString(
(qDefs::timeUnit)comboSubDeadTimeUnit->currentIndex());
try {
det->setSubDeadTime(timeNS);
}
@ -705,92 +674,6 @@ void qTabAdvanced::SetSubDeadTime() {
GetSubDeadTime();
}
void qTabAdvanced::SetGateIndex(int value) {
LOG(logINFO) << "Getting exptime and gate delay for gate index: " << value;
GetExposureTime();
GetGateDelay();
}
void qTabAdvanced::GetExposureTime() {
int gateIndex = spinGateIndex->value();
LOG(logDEBUG) << "Getting exposure time" << gateIndex;
disconnect(spinExpTime, SIGNAL(valueChanged(double)), this,
SLOT(SetExposureTime()));
disconnect(comboExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetExposureTime()));
try {
auto retval = det->getExptime(gateIndex).tsquash(
"Exptime is inconsistent for all detectors.");
auto time = qDefs::getUserFriendlyTime(retval);
spinExpTime->setValue(time.first);
comboExpTimeUnit->setCurrentIndex(static_cast<int>(time.second));
}
CATCH_DISPLAY("Could not get exposure time.",
"qTabSettings::GetExposureTime")
connect(spinExpTime, SIGNAL(valueChanged(double)), this,
SLOT(SetExposureTime()));
connect(comboExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetExposureTime()));
}
void qTabAdvanced::SetExposureTime() {
int gateIndex = spinGateIndex->value();
auto timeNS = qDefs::getNSTime(std::make_pair(
spinExpTime->value(),
static_cast<qDefs::timeUnit>(comboExpTimeUnit->currentIndex())));
LOG(logINFO) << "Setting exptime" << gateIndex << " to " << timeNS.count()
<< " ns"
<< "/" << spinExpTime->value()
<< qDefs::getUnitString(
(qDefs::timeUnit)comboExpTimeUnit->currentIndex());
try {
det->setExptime(gateIndex, timeNS);
}
CATCH_DISPLAY("Could not set exposure time.",
"qTabAdvanced::SetExposureTime")
GetExposureTime();
}
void qTabAdvanced::GetGateDelay() {
int gateIndex = spinGateIndex->value();
LOG(logDEBUG) << "Getting gate delay" << gateIndex;
disconnect(spinGateDelay, SIGNAL(valueChanged(double)), this,
SLOT(SetGateDelay()));
disconnect(comboGateDelayUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetGateDelay()));
try {
auto retval = det->getGateDelay(gateIndex).tsquash(
"GateDelay is inconsistent for all detectors.");
auto time = qDefs::getUserFriendlyTime(retval);
spinGateDelay->setValue(time.first);
comboGateDelayUnit->setCurrentIndex(static_cast<int>(time.second));
}
CATCH_DISPLAY("Could not get gate delay.", "qTabSettings::GetGateDelay")
connect(spinGateDelay, SIGNAL(valueChanged(double)), this,
SLOT(SetGateDelay()));
connect(comboGateDelayUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetGateDelay()));
}
void qTabAdvanced::SetGateDelay() {
int gateIndex = spinGateIndex->value();
auto timeNS = qDefs::getNSTime(std::make_pair(
spinGateDelay->value(),
static_cast<qDefs::timeUnit>(comboGateDelayUnit->currentIndex())));
LOG(logINFO) << "Setting gatedelay" << gateIndex << " to " << timeNS.count()
<< " ns"
<< "/" << spinGateDelay->value()
<< qDefs::getUnitString(
(qDefs::timeUnit)comboGateDelayUnit->currentIndex());
try {
det->setGateDelay(gateIndex, timeNS);
}
CATCH_DISPLAY("Could not set gate delay.", "qTabAdvanced::SetGateDelay")
GetGateDelay();
}
void qTabAdvanced::Refresh() {
LOG(logDEBUG) << "**Updating Advanced Tab";
@ -818,14 +701,5 @@ void qTabAdvanced::Refresh() {
GetSubDeadTime();
}
// exptime1, exptime2, exptme3
if (lblExpTime->isEnabled()) {
GetExposureTime();
}
// gatedelay1, gatedelay2, gatedelay3
if (lblGateDelay->isEnabled()) {
GetGateDelay();
}
LOG(logDEBUG) << "**Updated Advanced Tab";
}

View File

@ -172,7 +172,7 @@ void qTabDataOutput::BrowseOutputDir() {
void qTabDataOutput::SetOutputDir() {
QString path = dispOutputDir->text();
LOG(logDEBUG) << "Setting output directory to "
<< path.toAscii().constData();
<< path.toAscii().constData();
// empty
if (path.isEmpty()) {
@ -222,7 +222,7 @@ void qTabDataOutput::GetFileFormat() {
void qTabDataOutput::SetFileFormat(int format) {
LOG(logINFO) << "Setting File Format to "
<< comboFileFormat->currentText().toAscii().data();
<< comboFileFormat->currentText().toAscii().data();
try {
det->setFileFormat(static_cast<slsDetectorDefs::fileFormat>(
comboFileFormat->currentIndex()));
@ -334,13 +334,15 @@ void qTabDataOutput::SetRateCorrection() {
// custom dead time
if (radioCustomDeadtime->isChecked()) {
int64_t deadtime = spinCustomDeadTime->value();
LOG(logINFO) << "Setting Rate Correction with custom dead time: "
<< deadtime;
LOG(logINFO)
<< "Setting Rate Correction with custom dead time: "
<< deadtime;
det->setRateCorrection(sls::ns(deadtime));
}
// default dead time
else {
LOG(logINFO) << "Setting Rate Correction with default dead time";
LOG(logINFO)
<< "Setting Rate Correction with default dead time";
det->setDefaultRateCorrection();
}
}
@ -365,7 +367,7 @@ void qTabDataOutput::GetSpeed() {
void qTabDataOutput::SetSpeed(int speed) {
LOG(logINFO) << "Setting Speed to "
<< comboEigerClkDivider->currentText().toAscii().data();
<< comboEigerClkDivider->currentText().toAscii().data();
;
try {
det->setSpeed(static_cast<slsDetectorDefs::speedLevel>(speed));
@ -396,8 +398,9 @@ void qTabDataOutput::SetFlags() {
auto mode =
comboEigerParallelFlag->currentIndex() == PARALLEL ? true : false;
try {
LOG(logINFO) << "Setting Readout Flags to "
<< comboEigerParallelFlag->currentText().toAscii().data();
LOG(logINFO)
<< "Setting Readout Flags to "
<< comboEigerParallelFlag->currentText().toAscii().data();
det->setParallelMode(mode);
}
CATCH_HANDLE("Could not set readout flags.", "qTabDataOutput::SetFlags",

View File

@ -1,6 +1,6 @@
#include "qTabDebugging.h"
#include "ToString.h"
#include "qDefs.h"
#include "ToString.h"
#include <QDesktopWidget>
#include <QGridLayout>
#include <QTreeWidget>
@ -105,9 +105,8 @@ void qTabDebugging::GetInfo() {
treeDet->setHeaderLabel("Eiger Detector");
// get num modules
for (int i = 0; i < comboDetector->count() / 2; ++i)
items.append(
new QTreeWidgetItem((QTreeWidget *)nullptr,
QStringList(QString("Module %1").arg(i))));
items.append(new QTreeWidgetItem(
(QTreeWidget *)nullptr, QStringList(QString("Module %1").arg(i))));
treeDet->insertTopLevelItems(0, items);
// gets det names
for (int i = 0; i < comboDetector->count(); ++i) {

View File

@ -25,40 +25,44 @@ void qTabDeveloper::SetupWidgetWindow() {
switch (detType) {
case slsDetectorDefs::EIGER:
dacWidgets.push_back(new qDacWidget(
this, det, true, "vsvp: ", getSLSIndex(detType, tempid++)));
this, det, true, "v SvP: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vsvn ", getSLSIndex(detType, tempid++)));
this, det, true, "v SvN ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vrpreamp: ", getSLSIndex(detType, tempid++)));
this, det, true, "v Vrf: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vrshaper: ", getSLSIndex(detType, tempid++)));
this, det, true, "v Vrs: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vtrim: ", getSLSIndex(detType, tempid++)));
this, det, true, "v Vtr: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vtgstv: ", getSLSIndex(detType, tempid++)));
this, det, true, "v Vtgstv: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vcal: ", getSLSIndex(detType, tempid++)));
this, det, true, "v cal: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vcp ", getSLSIndex(detType, tempid++)));
this, det, true, "v Vcp ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vcn: ", getSLSIndex(detType, tempid++)));
this, det, true, "v Vcn: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vishaper: ", getSLSIndex(detType, tempid++)));
this, det, true, "v Vis: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "rxb_lb: ", getSLSIndex(detType, tempid++)));
this, det, true, "v rxb_lb: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "rxb_rb: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vcmp_ll: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vcmp_lr: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vcmp_rl: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vcmp_rr: ", getSLSIndex(detType, tempid++)));
this, det, true, "v rxb_rb: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"vthreshold: ", getSLSIndex(detType, tempid++)));
"v Vcmp_ll: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"v Vcmp_lr: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"v Vcmp_rl: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"v Vcmp_rr: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true,
"v threshold: ", getSLSIndex(detType, tempid++)));
adcWidgets.push_back(new qDacWidget(
this, det, false,
"Temperature FPGA Ext: ", getSLSIndex(detType, tempid++)));
@ -179,10 +183,10 @@ void qTabDeveloper::SetupWidgetWindow() {
dacWidgets.push_back(new qDacWidget(
this, det, true, "vth2: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vrshaper: ", getSLSIndex(detType, tempid++)));
this, det, true, "vshaper: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"vrshaper_n: ", getSLSIndex(detType, tempid++)));
"vshaperneg: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"vipre_out: ", getSLSIndex(detType, tempid++)));
@ -195,22 +199,19 @@ void qTabDeveloper::SetupWidgetWindow() {
dacWidgets.push_back(new qDacWidget(
this, det, true, "vcas: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vrpreamp: ", getSLSIndex(detType, tempid++)));
this, det, true, "vpreamp: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vcal_p: ", getSLSIndex(detType, tempid++)));
this, det, true, "vph: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vipre: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vishaper: ", getSLSIndex(detType, tempid++)));
this, det, true, "viinsh: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vcal_n: ", getSLSIndex(detType, tempid++)));
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++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"vthreshold: ", getSLSIndex(detType, tempid++)));
break;
case slsDetectorDefs::GOTTHARD2:
@ -383,25 +384,25 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
case slsDetectorDefs::EIGER:
switch (index) {
case 0:
return slsDetectorDefs::VSVP;
return slsDetectorDefs::SVP;
case 1:
return slsDetectorDefs::VSVN;
return slsDetectorDefs::SVN;
case 2:
return slsDetectorDefs::VRPREAMP;
return slsDetectorDefs::VRF;
case 3:
return slsDetectorDefs::VRSHAPER;
return slsDetectorDefs::VRS;
case 4:
return slsDetectorDefs::VTRIM;
return slsDetectorDefs::VTR;
case 5:
return slsDetectorDefs::VTGSTV;
case 6:
return slsDetectorDefs::VCAL;
return slsDetectorDefs::CAL;
case 7:
return slsDetectorDefs::VCP;
case 8:
return slsDetectorDefs::VCN;
case 9:
return slsDetectorDefs::VISHAPER;
return slsDetectorDefs::VIS;
case 10:
return slsDetectorDefs::RXB_LB;
case 11:
@ -415,7 +416,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
case 15:
return slsDetectorDefs::VCMP_RR;
case 16:
return slsDetectorDefs::VTHRESHOLD;
return slsDetectorDefs::THRESHOLD;
case 17:
return slsDetectorDefs::TEMPERATURE_FPGAEXT;
case 18:
@ -514,39 +515,37 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
case slsDetectorDefs::MYTHEN3:
switch (index) {
case 0:
return slsDetectorDefs::VCASSH;
return slsDetectorDefs::CASSH;
case 1:
return slsDetectorDefs::VTH2;
case 2:
return slsDetectorDefs::VRSHAPER;
return slsDetectorDefs::SHAPER1;
case 3:
return slsDetectorDefs::VRSHAPER_N;
return slsDetectorDefs::SHAPER2;
case 4:
return slsDetectorDefs::VIPRE_OUT;
case 5:
return slsDetectorDefs::VTH3;
case 6:
return slsDetectorDefs::VTH1;
return slsDetectorDefs::THRESHOLD;
case 7:
return slsDetectorDefs::VICIN;
case 8:
return slsDetectorDefs::VCAS;
return slsDetectorDefs::CAS;
case 9:
return slsDetectorDefs::VRPREAMP;
return slsDetectorDefs::PREAMP;
case 10:
return slsDetectorDefs::VCAL_P;
return slsDetectorDefs::CALIBRATION_PULSE;
case 11:
return slsDetectorDefs::VIPRE;
case 12:
return slsDetectorDefs::VISHAPER;
return slsDetectorDefs::VIINSH;
case 13:
return slsDetectorDefs::VCAL_N;
return slsDetectorDefs::VPL;
case 14:
return slsDetectorDefs::VTRIM;
return slsDetectorDefs::TRIMBIT_SIZE;
case 15:
return slsDetectorDefs::VDCSH;
case 16:
return slsDetectorDefs::VTHRESHOLD;
default:
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
std::to_string(index));

View File

@ -31,7 +31,6 @@ void qTabMeasurement::SetupWidgetWindow() {
progressTimer = new QTimer(this);
sampleImplemented = false;
gateImplemented = false;
delayImplemented = true;
startingFnumImplemented = false;
// by default, delay and starting fnum is disabled in form
@ -42,8 +41,6 @@ void qTabMeasurement::SetupWidgetWindow() {
// default is triggers and delay (not #bursts and burst period for gotthard2
// in auto mode)
ShowTriggerDelay();
// default is to show samples, mythen3, show gates
ShowGates();
// enabling according to det type
switch (det->getDetectorType().squash()) {
@ -70,9 +67,6 @@ void qTabMeasurement::SetupWidgetWindow() {
spinBurstPeriod->setEnabled(true);
comboBurstPeriodUnit->setEnabled(true);
break;
case slsDetectorDefs::MYTHEN3:
gateImplemented = true;
break;
default:
break;
}
@ -103,10 +97,6 @@ void qTabMeasurement::Initialization() {
connect(spinNumSamples, SIGNAL(valueChanged(int)), this,
SLOT(SetNumSamples(int)));
}
if (gateImplemented) {
connect(spinNumGates, SIGNAL(valueChanged(int)), this,
SLOT(SetNumGates(int)));
}
connect(spinExpTime, SIGNAL(valueChanged(double)), this,
SLOT(SetExposureTime()));
connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this,
@ -171,16 +161,6 @@ void qTabMeasurement::ShowTriggerDelay() {
}
}
void qTabMeasurement::ShowGates() {
if (det->getDetectorType().squash() == slsDetectorDefs::MYTHEN3) {
stackedLblSamplesGates->setCurrentWidget(pageLblGates);
stackedSpinSamplesGates->setCurrentWidget(pageSpinGates);
} else {
stackedLblSamplesGates->setCurrentWidget(pageLblSamples);
stackedSpinSamplesGates->setCurrentWidget(pageSpinSamples);
}
}
void qTabMeasurement::SetupTimingMode() {
QStandardItemModel *model =
qobject_cast<QStandardItemModel *>(comboTimingMode->model());
@ -193,20 +173,9 @@ void qTabMeasurement::SetupTimingMode() {
item[i] = model->itemFromIndex(index[i]);
}
item[(int)GATED]->setEnabled(false);
item[(int)BURST_TRIGGER]->setEnabled(false);
item[(int)TRIGGER_GATED]->setEnabled(false);
switch (det->getDetectorType().squash()) {
case slsDetectorDefs::EIGER:
item[(int)GATED]->setEnabled(true);
item[(int)BURST_TRIGGER]->setEnabled(true);
break;
case slsDetectorDefs::MYTHEN3:
item[(int)GATED]->setEnabled(true);
item[(int)TRIGGER_GATED]->setEnabled(true);
break;
default:
break;
if (det->getDetectorType().squash() != slsDetectorDefs::EIGER) {
item[(int)GATED]->setEnabled(false);
item[(int)BURST_TRIGGER]->setEnabled(false);
}
}
}
@ -228,8 +197,6 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
lblDelay->setEnabled(false);
spinDelay->setEnabled(false);
comboDelayUnit->setEnabled(false);
lblNumGates->setEnabled(false);
spinNumGates->setEnabled(false);
switch (comboTimingMode->currentIndex()) {
case AUTO:
@ -256,7 +223,6 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
lblExpTime->setEnabled(true);
spinExpTime->setEnabled(true);
comboExpUnit->setEnabled(true);
// not implemented in FW to have multiple frames for eiger
if (det->getDetectorType().squash() == slsDetectorDefs::EIGER) {
spinNumFrames->setValue(1);
} else {
@ -275,12 +241,8 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
}
break;
case GATED:
// #frames, #gates(mythen3)
// #frames
spinNumTriggers->setValue(1);
if (det->getDetectorType().squash() == slsDetectorDefs::MYTHEN3) {
lblNumGates->setEnabled(true);
spinNumGates->setEnabled(true);
}
lblNumFrames->setEnabled(true);
spinNumFrames->setEnabled(true);
break;
@ -296,18 +258,6 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
spinPeriod->setEnabled(true);
comboPeriodUnit->setEnabled(true);
break;
case TRIGGER_GATED:
// #triggers, delay, #frames, #gates
lblNumTriggers->setEnabled(true);
spinNumTriggers->setEnabled(true);
lblDelay->setEnabled(true);
spinDelay->setEnabled(true);
comboDelayUnit->setEnabled(true);
lblNumFrames->setEnabled(true);
spinNumFrames->setEnabled(true);
lblNumGates->setEnabled(true);
spinNumGates->setEnabled(true);
break;
default:
break;
}
@ -328,7 +278,6 @@ void qTabMeasurement::GetTimingMode() {
case slsDetectorDefs::TRIGGER_EXPOSURE:
case slsDetectorDefs::GATED:
case slsDetectorDefs::BURST_TRIGGER:
case slsDetectorDefs::TRIGGER_GATED:
comboTimingMode->setCurrentIndex((int)retval);
// update widget enable only if different
if (oldMode != comboTimingMode->currentIndex()) {
@ -348,7 +297,7 @@ void qTabMeasurement::GetTimingMode() {
void qTabMeasurement::SetTimingMode(int val) {
LOG(logINFO) << "Setting timing mode:"
<< comboTimingMode->currentText().toAscii().data();
<< comboTimingMode->currentText().toAscii().data();
try {
det->setTimingMode(static_cast<slsDetectorDefs::timingMode>(val));
EnableWidgetsforTimingMode();
@ -462,31 +411,6 @@ void qTabMeasurement::SetNumSamples(int val) {
&qTabMeasurement::GetNumSamples)
}
void qTabMeasurement::GetNumGates() {
LOG(logDEBUG) << "Getting number of gates";
disconnect(spinNumGates, SIGNAL(valueChanged(int)), this,
SLOT(SetNumGates(int)));
try {
auto retval = det->getNumberOfGates().tsquash(
"Inconsistent number of gates for all detectors.");
spinNumGates->setValue(retval);
}
CATCH_DISPLAY("Could not get number of gates.",
"qTabMeasurement::GetNumGates")
connect(spinNumGates, SIGNAL(valueChanged(int)), this,
SLOT(SetNumGates(int)));
}
void qTabMeasurement::SetNumGates(int val) {
LOG(logINFO) << "Setting number of external gates to " << val;
try {
det->setNumberOfGates(val);
}
CATCH_HANDLE("Could not set number of gates.",
"qTabMeasurement::SetNumGates", this,
&qTabMeasurement::GetNumGates)
}
void qTabMeasurement::GetExposureTime() {
LOG(logDEBUG) << "Getting exposure time";
disconnect(spinExpTime, SIGNAL(valueChanged(double)), this,
@ -495,30 +419,12 @@ void qTabMeasurement::GetExposureTime() {
SLOT(SetExposureTime()));
try {
spinExpTime->setValue(-1);
bool inconsistentGateValues = false;
std::chrono::nanoseconds retval;
if (det->getDetectorType().squash() == slsDetectorDefs::MYTHEN3) {
auto retvals = det->getExptimeForAllGates().tsquash(
"Inconsistent exposure time for all detectors.");
// all gates have same value
if (retvals[0] == retvals[1] && retvals[1] == retvals[2]) {
retval = retvals[0];
} else {
// dont throw, just leave it as -1
inconsistentGateValues = true;
}
} else {
retval = det->getExptime().tsquash(
"Inconsistent exposure time for all detectors.");
}
if (!inconsistentGateValues) {
auto time = qDefs::getUserFriendlyTime(retval);
spinExpTime->setValue(time.first);
comboExpUnit->setCurrentIndex(static_cast<int>(time.second));
CheckAcqPeriodGreaterThanExp();
}
auto retval = det->getExptime().tsquash(
"Inconsistent exposure time for all detectors.");
auto time = qDefs::getUserFriendlyTime(retval);
spinExpTime->setValue(time.first);
comboExpUnit->setCurrentIndex(static_cast<int>(time.second));
CheckAcqPeriodGreaterThanExp();
}
CATCH_DISPLAY("Could not get exposure time.",
"qTabMeasurement::GetExposureTime")
@ -532,7 +438,7 @@ void qTabMeasurement::SetExposureTime() {
auto val = spinExpTime->value();
auto unit = static_cast<qDefs::timeUnit>(comboExpUnit->currentIndex());
LOG(logINFO) << "Setting exposure time to " << val << " "
<< qDefs::getUnitString(unit);
<< qDefs::getUnitString(unit);
try {
auto timeNS = qDefs::getNSTime(std::make_pair(val, unit));
det->setExptime(timeNS);
@ -570,7 +476,7 @@ void qTabMeasurement::SetAcquisitionPeriod() {
auto val = spinPeriod->value();
auto unit = static_cast<qDefs::timeUnit>(comboPeriodUnit->currentIndex());
LOG(logINFO) << "Setting acquisition period to " << val << " "
<< qDefs::getUnitString(unit);
<< qDefs::getUnitString(unit);
try {
auto timeNS = qDefs::getNSTime(std::make_pair(val, unit));
det->setPeriod(timeNS);
@ -631,7 +537,7 @@ void qTabMeasurement::SetDelay() {
auto val = spinDelay->value();
auto unit = static_cast<qDefs::timeUnit>(comboDelayUnit->currentIndex());
LOG(logINFO) << "Setting delay to " << val << " "
<< qDefs::getUnitString(unit);
<< qDefs::getUnitString(unit);
try {
auto timeNS = qDefs::getNSTime(std::make_pair(val, unit));
det->setDelayAfterTrigger(timeNS);
@ -667,7 +573,7 @@ void qTabMeasurement::SetBurstPeriod() {
auto unit =
static_cast<qDefs::timeUnit>(comboBurstPeriodUnit->currentIndex());
LOG(logINFO) << "Setting burst period to " << val << " "
<< qDefs::getUnitString(unit);
<< qDefs::getUnitString(unit);
try {
auto timeNS = qDefs::getNSTime(std::make_pair(val, unit));
det->setBurstPeriod(timeNS);
@ -865,7 +771,8 @@ void qTabMeasurement::AcquireFinished() {
if (startingFnumImplemented) {
GetStartingFrameNumber();
}
LOG(logDEBUG) << "Measurement " << currentMeasurement << " finished";
LOG(logDEBUG) << "Measurement " << currentMeasurement
<< " finished";
// next measurement if acq is not stopped
if (!isAcquisitionStopped &&
((currentMeasurement + 1) < numMeasurements)) {
@ -894,9 +801,8 @@ void qTabMeasurement::Enable(bool enable) {
frameNotTimeResolved->setEnabled(enable);
// shortcut each time, else it doesnt work a second time
btnStart->setShortcut(QApplication::translate("TabMeasurementObject",
"Shift+Space", nullptr,
QApplication::UnicodeUTF8));
btnStart->setShortcut(QApplication::translate(
"TabMeasurementObject", "Shift+Space", nullptr, QApplication::UnicodeUTF8));
}
void qTabMeasurement::Refresh() {
@ -920,9 +826,6 @@ void qTabMeasurement::Refresh() {
if (sampleImplemented) {
GetNumSamples();
}
if (gateImplemented) {
GetNumGates();
}
GetFileWrite();
GetFileName();
GetRunIndex();

View File

@ -75,8 +75,8 @@ void qTabMessages::ExecuteCommand() {
QString command = param.at(0);
param.removeFirst();
LOG(logINFO) << "Executing Command:[" << command.toAscii().constData()
<< "] with Arguments:["
<< param.join(" ").toAscii().constData() << "]";
<< "] with Arguments:["
<< param.join(" ").toAscii().constData() << "]";
process->setProcessChannelMode(QProcess::MergedChannels);
process->start(command, param);
@ -121,7 +121,7 @@ void qTabMessages::SaveLog() {
LOG(logINFO) << mess;
} else {
LOG(logWARNING) << "Attempt to save log file failed: "
<< fName.toAscii().constData();
<< fName.toAscii().constData();
qDefs::Message(qDefs::WARNING, "Attempt to save log file failed.",
"qTabMessages::SaveLog");
}

View File

@ -6,6 +6,7 @@
#include <QStackedLayout>
#include <QStandardItemModel>
QString qTabPlot::defaultPlotTitle("");
QString qTabPlot::defaultHistXAxisTitle("Channel Number");
QString qTabPlot::defaultHistYAxisTitle("Counts");
@ -289,14 +290,16 @@ void qTabPlot::SetBinary() {
bool binary1D = chkBinary->isChecked();
bool binary2D = chkBinary_2->isChecked();
if (is1d) {
LOG(logINFO) << "Binary Plot " << (binary1D ? "enabled" : "disabled");
LOG(logINFO) << "Binary Plot "
<< (binary1D ? "enabled" : "disabled");
lblFrom->setEnabled(binary1D);
lblTo->setEnabled(binary1D);
spinFrom->setEnabled(binary1D);
spinTo->setEnabled(binary1D);
plot->SetBinary(binary1D, spinFrom->value(), spinTo->value());
} else {
LOG(logINFO) << "Binary Plot " << (binary2D ? "enabled" : "disabled");
LOG(logINFO) << "Binary Plot "
<< (binary2D ? "enabled" : "disabled");
lblFrom_2->setEnabled(binary2D);
lblTo_2->setEnabled(binary2D);
spinFrom_2->setEnabled(binary2D);
@ -431,10 +434,10 @@ void qTabPlot::SetXYRange() {
for (int i = 0; i < 4; ++i) {
if (chkVal[i] && !dispVal[i].isEmpty()) {
double val = dispVal[i].toDouble();
LOG(logDEBUG) << "Setting "
<< qDefs::getRangeAsString(
static_cast<qDefs::range>(i))
<< " to " << val;
LOG(logDEBUG)
<< "Setting "
<< qDefs::getRangeAsString(static_cast<qDefs::range>(i))
<< " to " << val;
xyRange[i] = val;
isRange[i] = true;
disablezoom = true;
@ -479,10 +482,10 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
ranges[qDefs::YMAX] = plot->GetYMaximum();
double idealAspectratio = (ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) /
(ranges[qDefs::YMAX] - ranges[qDefs::YMIN]);
LOG(logDEBUG) << "Ideal Aspect ratio: " << idealAspectratio << " for x("
<< ranges[qDefs::XMIN] << " - " << ranges[qDefs::XMAX]
<< "), y(" << ranges[qDefs::YMIN] << " - "
<< ranges[qDefs::YMAX] << ")";
LOG(logDEBUG) << "Ideal Aspect ratio: " << idealAspectratio
<< " for x(" << ranges[qDefs::XMIN] << " - "
<< ranges[qDefs::XMAX] << "), y(" << ranges[qDefs::YMIN]
<< " - " << ranges[qDefs::YMAX] << ")";
// calculate current aspect ratio
ranges[qDefs::XMIN] = dispXMin->text().toDouble();
@ -491,10 +494,10 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
ranges[qDefs::YMAX] = dispYMax->text().toDouble();
double currentAspectRatio = (ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) /
(ranges[qDefs::YMAX] - ranges[qDefs::YMIN]);
LOG(logDEBUG) << "Current Aspect ratio: " << currentAspectRatio << " for x("
<< ranges[qDefs::XMIN] << " - " << ranges[qDefs::XMAX]
<< "), y(" << ranges[qDefs::YMIN] << " - "
<< ranges[qDefs::YMAX] << ")";
LOG(logDEBUG) << "Current Aspect ratio: " << currentAspectRatio
<< " for x(" << ranges[qDefs::XMIN] << " - "
<< ranges[qDefs::XMAX] << "), y(" << ranges[qDefs::YMIN]
<< " - " << ranges[qDefs::YMAX] << ")";
if (currentAspectRatio != idealAspectratio) {
// dimension: 1(x changed: y adjusted), 0(y changed: x adjusted),
@ -640,7 +643,7 @@ void qTabPlot::SetStreamingFrequency() {
det->setRxZmqFrequency(freqVal);
} else {
LOG(logINFO) << "Setting Streaming Timer to " << timeVal << " "
<< qDefs::getUnitString(timeUnit);
<< qDefs::getUnitString(timeUnit);
auto timeMS = qDefs::getMSTime(std::make_pair(timeVal, timeUnit));
det->setRxZmqTimer(timeMS.count());
}

View File

@ -1,6 +1,6 @@
#include "qTabSettings.h"
#include "ToString.h"
#include "qDefs.h"
#include "ToString.h"
#include <QStandardItemModel>
qTabSettings::qTabSettings(QWidget *parent, sls::Detector *detector)
@ -15,31 +15,19 @@ qTabSettings::~qTabSettings() {}
void qTabSettings::SetupWidgetWindow() {
// enabling according to det type
slsDetectorDefs::detectorType detType = det->getDetectorType().squash();
if (detType == slsDetectorDefs::MYTHEN3) {
switch (det->getDetectorType().squash()) {
case slsDetectorDefs::MYTHEN3:
lblSettings->setEnabled(false);
comboSettings->setEnabled(false);
lblDynamicRange->setEnabled(true);
comboDynamicRange->setEnabled(true);
// disable dr
QStandardItemModel *model =
qobject_cast<QStandardItemModel *>(comboDynamicRange->model());
if (model) {
QModelIndex index;
QStandardItem *item;
index =
model->index(DYNAMICRANGE_4, comboDynamicRange->modelColumn(),
comboDynamicRange->rootModelIndex());
item = model->itemFromIndex(index);
item->setEnabled(false);
}
} else if (detType == slsDetectorDefs::EIGER) {
break;
case slsDetectorDefs::EIGER:
lblDynamicRange->setEnabled(true);
comboDynamicRange->setEnabled(true);
lblThreshold->setEnabled(true);
spinThreshold->setEnabled(true);
break;
default:
break;
}
// default settings for the disabled
@ -208,7 +196,7 @@ void qTabSettings::GetDynamicRange() {
void qTabSettings::SetDynamicRange(int index) {
LOG(logINFO) << "Setting dynamic range to "
<< comboDynamicRange->currentText().toAscii().data();
<< comboDynamicRange->currentText().toAscii().data();
try {
switch (index) {
case DYNAMICRANGE_32:

View File

@ -1,7 +1,6 @@
add_library(slsProjectCSettings INTERFACE)
target_compile_features(slsProjectCSettings INTERFACE c_std_99)
target_compile_options(slsProjectCSettings INTERFACE
add_library(slsProjectCWarnings INTERFACE)
target_compile_options(slsProjectCWarnings INTERFACE
-Wall
-Wextra
-Wno-unused-parameter #Needs to be slowly mitigated
@ -14,7 +13,7 @@ target_compile_options(slsProjectCSettings INTERFACE
)
# Install fake the library
install(TARGETS slsProjectCSettings
install(TARGETS slsProjectCWarnings
EXPORT "${TARGETS_EXPORT_NAME}"
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}

View File

@ -8,6 +8,7 @@ if [ $# -eq 0 ]; then
)
else
declare -a det=("${1}")
echo "got something"
fi
declare -a deterror=("OK" "OK" "OK" "OK" "OK" "OK")

View File

@ -16,7 +16,7 @@ add_executable(ctbDetectorServer_virtual
../slsDetectorServer/src/LTC2620.c
../slsDetectorServer/src/MAX1932.c
../slsDetectorServer/src/programFpgaBlackfin.c
../slsDetectorServer/src/sharedMemory.c
../slsDetectorServer/src/communication_virtual.c
)
include_directories(
@ -33,7 +33,7 @@ target_compile_definitions(ctbDetectorServer_virtual
)
target_link_libraries(ctbDetectorServer_virtual
PUBLIC pthread rt slsProjectCSettings
PUBLIC pthread rt slsProjectCWarnings
m
)

View File

@ -5,14 +5,14 @@ support_lib = ../../slsSupportLib/include/
CROSS = bfin-uclinux-
CC = $(CROSS)gcc
CFLAGS += -Wall -std=gnu99 -DCHIPTESTBOARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
LDLIBS += -lm -lrt -pthread
CFLAGS += -Wall -DCHIPTESTBOARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
LDLIBS += -lm
PROGS = ctbDetectorServer
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)programFpgaBlackfin.c $(main_src)/sharedMemory.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)

730
slsDetectorServers/ctbDetectorServer/RegisterDefs.h Normal file → Executable file
View File

@ -4,580 +4,552 @@
#define MEM_MAP_SHIFT 1
/* FPGA Version RO register */
#define FPGA_VERSION_REG (0x00 << MEM_MAP_SHIFT)
#define FPGA_VERSION_REG (0x00 << MEM_MAP_SHIFT)
#define FPGA_VERSION_BRD_RVSN_OFST (0)
#define FPGA_VERSION_BRD_RVSN_MSK (0x00FFFFFF << FPGA_VERSION_BRD_RVSN_OFST)
#define FPGA_VERSION_DTCTR_TYP_OFST (24)
#define FPGA_VERSION_DTCTR_TYP_MSK (0x000000FF << FPGA_VERSION_DTCTR_TYP_OFST)
#define FPGA_VERSION_DTCTR_TYP_CTB_VAL \
((0x4 << FPGA_VERSION_DTCTR_TYP_OFST) & FPGA_VERSION_DTCTR_TYP_MSK)
#define FPGA_VERSION_BRD_RVSN_OFST (0)
#define FPGA_VERSION_BRD_RVSN_MSK (0x00FFFFFF << FPGA_VERSION_BRD_RVSN_OFST)
#define FPGA_VERSION_DTCTR_TYP_OFST (24)
#define FPGA_VERSION_DTCTR_TYP_MSK (0x000000FF << FPGA_VERSION_DTCTR_TYP_OFST)
#define FPGA_VERSION_DTCTR_TYP_CTB_VAL ((0x4 << FPGA_VERSION_DTCTR_TYP_OFST) & FPGA_VERSION_DTCTR_TYP_MSK)
/* Fix pattern RO register */
#define FIX_PATT_REG (0x01 << MEM_MAP_SHIFT)
#define FIX_PATT_REG (0x01 << MEM_MAP_SHIFT)
#define FIX_PATT_VAL (0xACDC2016)
#define FIX_PATT_VAL (0xACDC2016)
/* Status RO register */
#define STATUS_REG (0x02 << MEM_MAP_SHIFT)
#define STATUS_REG (0x02 << MEM_MAP_SHIFT)
#define STATUS_RN_BSY_OFST (0)
#define STATUS_RN_BSY_MSK (0x00000001 << STATUS_RN_BSY_OFST)
#define STATUS_RDT_BSY_OFST (1)
#define STATUS_RDT_BSY_MSK (0x00000001 << STATUS_RDT_BSY_OFST)
#define STATUS_ANY_FF_FLL_OFST (2)
#define STATUS_ANY_FF_FLL_MSK (0x00000001 << STATUS_ANY_FF_FLL_OFST)
#define STATUS_WTNG_FR_TRGGR_OFST (3)
#define STATUS_WTNG_FR_TRGGR_MSK (0x00000001 << STATUS_WTNG_FR_TRGGR_OFST)
#define STATUS_DLY_BFR_OFST (4)
#define STATUS_DLY_BFR_MSK (0x00000001 << STATUS_DLY_BFR_OFST)
#define STATUS_DLY_AFTR_OFST (5)
#define STATUS_DLY_AFTR_MSK (0x00000001 << STATUS_DLY_AFTR_OFST)
#define STATUS_EXPSNG_OFST (6)
#define STATUS_EXPSNG_MSK (0x00000001 << STATUS_EXPSNG_OFST)
#define STATUS_CNT_ENBL_OFST (7)
#define STATUS_CNT_ENBL_MSK (0x00000001 << STATUS_CNT_ENBL_OFST)
#define STATUS_SM_FF_FLL_OFST (11)
#define STATUS_SM_FF_FLL_MSK (0x00000001 << STATUS_SM_FF_FLL_OFST)
#define STATUS_STPPD_OFST (15)
#define STATUS_STPPD_MSK (0x00000001 << STATUS_STPPD_OFST)
#define STATUS_ALL_FF_EMPTY_OFST (16)
#define STATUS_ALL_FF_EMPTY_MSK (0x00000001 << STATUS_ALL_FF_EMPTY_OFST)
#define STATUS_CYCL_RN_BSY_OFST (17)
#define STATUS_CYCL_RN_BSY_MSK (0x00000001 << STATUS_CYCL_RN_BSY_OFST)
#define STATUS_FRM_RN_BSY_OFST (18)
#define STATUS_FRM_RN_BSY_MSK (0x00000001 << STATUS_FRM_RN_BSY_OFST)
#define STATUS_ADC_DESERON_OFST (19)
#define STATUS_ADC_DESERON_MSK (0x00000001 << STATUS_ADC_DESERON_OFST)
#define STATUS_PLL_RCNFG_BSY_OFST (20)
#define STATUS_PLL_RCNFG_BSY_MSK (0x00000001 << STATUS_PLL_RCNFG_BSY_OFST)
#define STATUS_DT_STRMNG_BSY_OFST (21)
#define STATUS_DT_STRMNG_BSY_MSK (0x00000001 << STATUS_DT_STRMNG_BSY_OFST)
#define STATUS_FRM_PCKR_BSY_OFST (22)
#define STATUS_FRM_PCKR_BSY_MSK (0x00000001 << STATUS_FRM_PCKR_BSY_OFST)
#define STATUS_PLL_PHS_DN_OFST (23)
#define STATUS_PLL_PHS_DN_MSK (0x00000001 << STATUS_PLL_PHS_DN_OFST)
#define STATUS_PT_CNTRL_STTS_OFF_OFST (24)
#define STATUS_PT_CNTRL_STTS_OFF_MSK \
(0x000000FF << STATUS_PT_CNTRL_STTS_OFF_OFST)
#define STATUS_IDLE_MSK (0x677FF)
#define STATUS_RN_BSY_OFST (0)
#define STATUS_RN_BSY_MSK (0x00000001 << STATUS_RN_BSY_OFST)
#define STATUS_RDT_BSY_OFST (1)
#define STATUS_RDT_BSY_MSK (0x00000001 << STATUS_RDT_BSY_OFST)
#define STATUS_ANY_FF_FLL_OFST (2)
#define STATUS_ANY_FF_FLL_MSK (0x00000001 << STATUS_ANY_FF_FLL_OFST)
#define STATUS_WTNG_FR_TRGGR_OFST (3)
#define STATUS_WTNG_FR_TRGGR_MSK (0x00000001 << STATUS_WTNG_FR_TRGGR_OFST)
#define STATUS_DLY_BFR_OFST (4)
#define STATUS_DLY_BFR_MSK (0x00000001 << STATUS_DLY_BFR_OFST)
#define STATUS_DLY_AFTR_OFST (5)
#define STATUS_DLY_AFTR_MSK (0x00000001 << STATUS_DLY_AFTR_OFST)
#define STATUS_EXPSNG_OFST (6)
#define STATUS_EXPSNG_MSK (0x00000001 << STATUS_EXPSNG_OFST)
#define STATUS_CNT_ENBL_OFST (7)
#define STATUS_CNT_ENBL_MSK (0x00000001 << STATUS_CNT_ENBL_OFST)
#define STATUS_SM_FF_FLL_OFST (11)
#define STATUS_SM_FF_FLL_MSK (0x00000001 << STATUS_SM_FF_FLL_OFST)
#define STATUS_STPPD_OFST (15)
#define STATUS_STPPD_MSK (0x00000001 << STATUS_STPPD_OFST)
#define STATUS_ALL_FF_EMPTY_OFST (16)
#define STATUS_ALL_FF_EMPTY_MSK (0x00000001 << STATUS_ALL_FF_EMPTY_OFST)
#define STATUS_CYCL_RN_BSY_OFST (17)
#define STATUS_CYCL_RN_BSY_MSK (0x00000001 << STATUS_CYCL_RN_BSY_OFST)
#define STATUS_FRM_RN_BSY_OFST (18)
#define STATUS_FRM_RN_BSY_MSK (0x00000001 << STATUS_FRM_RN_BSY_OFST)
#define STATUS_ADC_DESERON_OFST (19)
#define STATUS_ADC_DESERON_MSK (0x00000001 << STATUS_ADC_DESERON_OFST)
#define STATUS_PLL_RCNFG_BSY_OFST (20)
#define STATUS_PLL_RCNFG_BSY_MSK (0x00000001 << STATUS_PLL_RCNFG_BSY_OFST)
#define STATUS_DT_STRMNG_BSY_OFST (21)
#define STATUS_DT_STRMNG_BSY_MSK (0x00000001 << STATUS_DT_STRMNG_BSY_OFST)
#define STATUS_FRM_PCKR_BSY_OFST (22)
#define STATUS_FRM_PCKR_BSY_MSK (0x00000001 << STATUS_FRM_PCKR_BSY_OFST)
#define STATUS_PLL_PHS_DN_OFST (23)
#define STATUS_PLL_PHS_DN_MSK (0x00000001 << STATUS_PLL_PHS_DN_OFST)
#define STATUS_PT_CNTRL_STTS_OFF_OFST (24)
#define STATUS_PT_CNTRL_STTS_OFF_MSK (0x000000FF << STATUS_PT_CNTRL_STTS_OFF_OFST)
#define STATUS_IDLE_MSK (0x677FF)
/* Look at me RO register TODO */
#define LOOK_AT_ME_REG (0x03 << MEM_MAP_SHIFT)
#define LOOK_AT_ME_REG (0x03 << MEM_MAP_SHIFT)
/* System Status RO register */
#define SYSTEM_STATUS_REG (0x04 << MEM_MAP_SHIFT)
#define SYSTEM_STATUS_REG (0x04 << MEM_MAP_SHIFT)
#define SYSTEM_STATUS_DDR3_CLBRTN_OK_OFST (0)
#define SYSTEM_STATUS_DDR3_CLBRTN_OK_MSK \
(0x00000001 << SYSTEM_STATUS_DDR3_CLBRTN_OK_OFST)
#define SYSTEM_STATUS_DDR3_CLBRTN_FL_OFST (1)
#define SYSTEM_STATUS_DDR3_CLBRTN_FL_MSK \
(0x00000001 << SYSTEM_STATUS_DDR3_CLBRTN_FL_OFST)
#define SYSTEM_STATUS_DDR3_INT_DN_OFST (2)
#define SYSTEM_STATUS_DDR3_INT_DN_MSK \
(0x00000001 << SYSTEM_STATUS_DDR3_INT_DN_OFST)
#define SYSTEM_STATUS_RCNFG_PLL_LCK_OFST (3)
#define SYSTEM_STATUS_RCNFG_PLL_LCK_MSK \
(0x00000001 << SYSTEM_STATUS_RCNFG_PLL_LCK_OFST)
#define SYSTEM_STATUS_PLL_A_LCK_OFST (4)
#define SYSTEM_STATUS_PLL_A_LCK_MSK (0x00000001 << SYSTEM_STATUS_PLL_A_LCK_OFST)
#define SYSTEM_STATUS_DDR3_CLBRTN_OK_OFST (0)
#define SYSTEM_STATUS_DDR3_CLBRTN_OK_MSK (0x00000001 << SYSTEM_STATUS_DDR3_CLBRTN_OK_OFST)
#define SYSTEM_STATUS_DDR3_CLBRTN_FL_OFST (1)
#define SYSTEM_STATUS_DDR3_CLBRTN_FL_MSK (0x00000001 << SYSTEM_STATUS_DDR3_CLBRTN_FL_OFST)
#define SYSTEM_STATUS_DDR3_INT_DN_OFST (2)
#define SYSTEM_STATUS_DDR3_INT_DN_MSK (0x00000001 << SYSTEM_STATUS_DDR3_INT_DN_OFST)
#define SYSTEM_STATUS_RCNFG_PLL_LCK_OFST (3)
#define SYSTEM_STATUS_RCNFG_PLL_LCK_MSK (0x00000001 << SYSTEM_STATUS_RCNFG_PLL_LCK_OFST)
#define SYSTEM_STATUS_PLL_A_LCK_OFST (4)
#define SYSTEM_STATUS_PLL_A_LCK_MSK (0x00000001 << SYSTEM_STATUS_PLL_A_LCK_OFST)
/* PLL Param (Reconfiguratble PLL Parameter) RO register TODO FIXME: Same as
* PLL_PARAM_REG 0x50 */
/* PLL Param (Reconfiguratble PLL Parameter) RO register TODO FIXME: Same as PLL_PARAM_REG 0x50 */
//#define PLL_PARAM_REG (0x05 << MEM_MAP_SHIFT)
/* FIFO Data RO register TODO */
#define FIFO_DATA_REG (0x06 << MEM_MAP_SHIFT)
#define FIFO_DATA_REG (0x06 << MEM_MAP_SHIFT)
#define FIFO_DATA_HRDWR_SRL_NMBR_OFST (0)
#define FIFO_DATA_HRDWR_SRL_NMBR_MSK \
(0x0000FFFF << FIFO_DATA_HRDWR_SRL_NMBR_OFST)
#define FIFO_DATA_HRDWR_SRL_NMBR_OFST (0)
#define FIFO_DATA_HRDWR_SRL_NMBR_MSK (0x0000FFFF << FIFO_DATA_HRDWR_SRL_NMBR_OFST)
//#define FIFO_DATA_WRD_OFST (16)
//#define FIFO_DATA_WRD_MSK (0x0000FFFF << FIFO_DATA_WRD_OFST)
/* FIFO Status RO register TODO */
#define FIFO_STATUS_REG (0x07 << MEM_MAP_SHIFT)
#define FIFO_STATUS_REG (0x07 << MEM_MAP_SHIFT)
/* FIFO Empty RO register TODO */
#define FIFO_EMPTY_REG (0x08 << MEM_MAP_SHIFT)
#define FIFO_EMPTY_ALL_EMPTY_MSK (0xFFFFFFFF)
#define FIFO_EMPTY_REG (0x08 << MEM_MAP_SHIFT)
#define FIFO_EMPTY_ALL_EMPTY_MSK (0xFFFFFFFF)
/* FIFO Full RO register TODO */
#define FIFO_FULL_REG (0x09 << MEM_MAP_SHIFT)
#define FIFO_FULL_REG (0x09 << MEM_MAP_SHIFT)
/* MCB Serial Number RO register */
#define MOD_SERIAL_NUMBER_REG (0x0A << MEM_MAP_SHIFT)
#define MOD_SERIAL_NUMBER_REG (0x0A << MEM_MAP_SHIFT)
#define MOD_SERIAL_NUMBER_OFST (0)
#define MOD_SERIAL_NUMBER_MSK (0x000000FF << MOD_SERIAL_NUMBER_OFST)
#define MOD_SERIAL_NUMBER_VRSN_OFST (16)
#define MOD_SERIAL_NUMBER_VRSN_MSK (0x0000003F << MOD_SERIAL_NUMBER_VRSN_OFST)
#define MOD_SERIAL_NUMBER_OFST (0)
#define MOD_SERIAL_NUMBER_MSK (0x000000FF << MOD_SERIAL_NUMBER_OFST)
#define MOD_SERIAL_NUMBER_VRSN_OFST (16)
#define MOD_SERIAL_NUMBER_VRSN_MSK (0x0000003F << MOD_SERIAL_NUMBER_VRSN_OFST)
/* API Version RO register */
#define API_VERSION_REG (0x0F << MEM_MAP_SHIFT)
#define API_VERSION_REG (0x0F << MEM_MAP_SHIFT)
#define API_VERSION_OFST (0)
#define API_VERSION_MSK (0x00FFFFFF << API_VERSION_OFST)
#define API_VERSION_DTCTR_TYP_OFST (24)
#define API_VERSION_DTCTR_TYP_MSK (0x000000FF << API_VERSION_DTCTR_TYP_OFST)
#define API_VERSION_OFST (0)
#define API_VERSION_MSK (0x00FFFFFF << API_VERSION_OFST)
#define API_VERSION_DTCTR_TYP_OFST (24)
#define API_VERSION_DTCTR_TYP_MSK (0x000000FF << API_VERSION_DTCTR_TYP_OFST)
/* Time from Start 64 bit RO register. t = GCLK x 50 ns. Reset using
* CONTROL_CRST. TODO */
#define TIME_FROM_START_LSB_REG (0x10 << MEM_MAP_SHIFT)
#define TIME_FROM_START_MSB_REG (0x11 << MEM_MAP_SHIFT)
/* Time from Start 64 bit RO register. t = GCLK x 50 ns. Reset using CONTROL_CRST. TODO */
#define TIME_FROM_START_LSB_REG (0x10 << MEM_MAP_SHIFT)
#define TIME_FROM_START_MSB_REG (0x11 << MEM_MAP_SHIFT)
/* Delay Left 64 bit RO register. t = DLY x 50 ns. TODO */
#define DELAY_LEFT_LSB_REG (0x12 << MEM_MAP_SHIFT)
#define DELAY_LEFT_MSB_REG (0x13 << MEM_MAP_SHIFT)
#define DELAY_LEFT_LSB_REG (0x12 << MEM_MAP_SHIFT)
#define DELAY_LEFT_MSB_REG (0x13 << MEM_MAP_SHIFT)
/* Triggers Left 64 bit RO register TODO */
#define CYCLES_LEFT_LSB_REG (0x14 << MEM_MAP_SHIFT)
#define CYCLES_LEFT_MSB_REG (0x15 << MEM_MAP_SHIFT)
#define CYCLES_LEFT_LSB_REG (0x14 << MEM_MAP_SHIFT)
#define CYCLES_LEFT_MSB_REG (0x15 << MEM_MAP_SHIFT)
/* Frames Left 64 bit RO register TODO */
#define FRAMES_LEFT_LSB_REG (0x16 << MEM_MAP_SHIFT)
#define FRAMES_LEFT_MSB_REG (0x17 << MEM_MAP_SHIFT)
#define FRAMES_LEFT_LSB_REG (0x16 << MEM_MAP_SHIFT)
#define FRAMES_LEFT_MSB_REG (0x17 << MEM_MAP_SHIFT)
/* Period Left 64 bit RO register. t = T x 50 ns. TODO */
#define PERIOD_LEFT_LSB_REG (0x18 << MEM_MAP_SHIFT)
#define PERIOD_LEFT_MSB_REG (0x19 << MEM_MAP_SHIFT)
#define PERIOD_LEFT_LSB_REG (0x18 << MEM_MAP_SHIFT)
#define PERIOD_LEFT_MSB_REG (0x19 << MEM_MAP_SHIFT)
/* Exposure Time Left 64 bit RO register */
//#define EXPTIME_LEFT_LSB_REG (0x1A << MEM_MAP_SHIFT) // Not
// used in FW #define EXPTIME_LEFT_MSB_REG (0x1B <<
// MEM_MAP_SHIFT)
//// Not used in FW
//#define EXPTIME_LEFT_LSB_REG (0x1A << MEM_MAP_SHIFT) // Not used in FW
//#define EXPTIME_LEFT_MSB_REG (0x1B << MEM_MAP_SHIFT) // Not used in FW
/* Gates Left 64 bit RO register */
//#define GATES_LEFT_LSB_REG (0x1C << MEM_MAP_SHIFT) // Not
// used in FW #define GATES_LEFT_MSB_REG (0x1D <<
// MEM_MAP_SHIFT)
//// Not used in FW
//#define GATES_LEFT_LSB_REG (0x1C << MEM_MAP_SHIFT) // Not used in FW
//#define GATES_LEFT_MSB_REG (0x1D << MEM_MAP_SHIFT) // Not used in FW
/* Data In 64 bit RO register TODO */
#define DATA_IN_LSB_REG (0x1E << MEM_MAP_SHIFT)
#define DATA_IN_MSB_REG (0x1F << MEM_MAP_SHIFT)
#define DATA_IN_LSB_REG (0x1E << MEM_MAP_SHIFT)
#define DATA_IN_MSB_REG (0x1F << MEM_MAP_SHIFT)
/* Pattern Out 64 bit RO register */
#define PATTERN_OUT_LSB_REG (0x20 << MEM_MAP_SHIFT)
#define PATTERN_OUT_MSB_REG (0x21 << MEM_MAP_SHIFT)
#define PATTERN_OUT_LSB_REG (0x20 << MEM_MAP_SHIFT)
#define PATTERN_OUT_MSB_REG (0x21 << MEM_MAP_SHIFT)
/* Frames From Start 64 bit RO register TODO */
//#define FRAMES_FROM_START_LSB_REG (0x22 << MEM_MAP_SHIFT) // Not
// used in FW #define FRAMES_FROM_START_MSB_REG (0x23 <<
// MEM_MAP_SHIFT)
//// Not used in FW
//#define FRAMES_FROM_START_LSB_REG (0x22 << MEM_MAP_SHIFT) // Not used in FW
//#define FRAMES_FROM_START_MSB_REG (0x23 << MEM_MAP_SHIFT) // Not used in FW
/* Frames From Start PG 64 bit RO register. Reset using CONTROL_CRST. TODO */
#define FRAMES_FROM_START_PG_LSB_REG (0x24 << MEM_MAP_SHIFT)
#define FRAMES_FROM_START_PG_MSB_REG (0x25 << MEM_MAP_SHIFT)
#define FRAMES_FROM_START_PG_LSB_REG (0x24 << MEM_MAP_SHIFT)
#define FRAMES_FROM_START_PG_MSB_REG (0x25 << MEM_MAP_SHIFT)
/* Start Frame Time (Measurement Time) 64 bit register (timestamp at a frame
* start until reset) TODO */
#define START_FRAME_TIME_LSB_REG (0x26 << MEM_MAP_SHIFT)
#define START_FRAME_TIME_MSB_REG (0x27 << MEM_MAP_SHIFT)
/* Start Frame Time (Measurement Time) 64 bit register (timestamp at a frame start until reset) TODO */
#define START_FRAME_TIME_LSB_REG (0x26 << MEM_MAP_SHIFT)
#define START_FRAME_TIME_MSB_REG (0x27 << MEM_MAP_SHIFT)
/* Power Status RO register */
#define POWER_STATUS_REG (0x29 << MEM_MAP_SHIFT)
#define POWER_STATUS_REG (0x29 << MEM_MAP_SHIFT)
#define POWER_STATUS_ALRT_OFST (27)
#define POWER_STATUS_ALRT_MSK (0x0000001F << POWER_STATUS_ALRT_OFST)
#define POWER_STATUS_ALRT_OFST (27)
#define POWER_STATUS_ALRT_MSK (0x0000001F << POWER_STATUS_ALRT_OFST)
/* DAC Value Out RO register */
//#define DAC_VAL_OUT_REG (0x2A << MEM_MAP_SHIFT)
/* Slow ADC SPI Value RO register */
#define ADC_SPI_SLOW_VAL_REG (0x2B << MEM_MAP_SHIFT)
#define ADC_SPI_SLOW_VAL_REG (0x2B << MEM_MAP_SHIFT)
/* FIFO Digital In Status RO register */
#define FIFO_DIN_STATUS_REG (0x3B << MEM_MAP_SHIFT)
#define FIFO_DIN_STATUS_FIFO_FULL_OFST (30)
#define FIFO_DIN_STATUS_FIFO_FULL_MSK \
(0x00000001 << FIFO_DIN_STATUS_FIFO_FULL_OFST)
#define FIFO_DIN_STATUS_FIFO_EMPTY_OFST (31)
#define FIFO_DIN_STATUS_FIFO_EMPTY_MSK \
(0x00000001 << FIFO_DIN_STATUS_FIFO_EMPTY_OFST)
#define FIFO_DIN_STATUS_REG (0x3B << MEM_MAP_SHIFT)
#define FIFO_DIN_STATUS_FIFO_FULL_OFST (30)
#define FIFO_DIN_STATUS_FIFO_FULL_MSK (0x00000001 << FIFO_DIN_STATUS_FIFO_FULL_OFST)
#define FIFO_DIN_STATUS_FIFO_EMPTY_OFST (31)
#define FIFO_DIN_STATUS_FIFO_EMPTY_MSK (0x00000001 << FIFO_DIN_STATUS_FIFO_EMPTY_OFST)
/* FIFO Digital In 64 bit RO register */
#define FIFO_DIN_LSB_REG (0x3C << MEM_MAP_SHIFT)
#define FIFO_DIN_MSB_REG (0x3D << MEM_MAP_SHIFT)
#define FIFO_DIN_LSB_REG (0x3C << MEM_MAP_SHIFT)
#define FIFO_DIN_MSB_REG (0x3D << MEM_MAP_SHIFT)
/* SPI (Serial Peripheral Interface) DAC, HV RW register */
#define SPI_REG (0x40 << MEM_MAP_SHIFT)
#define SPI_REG (0x40 << MEM_MAP_SHIFT)
#define SPI_DAC_SRL_DGTL_OTPT_OFST (0)
#define SPI_DAC_SRL_DGTL_OTPT_MSK (0x00000001 << SPI_DAC_SRL_DGTL_OTPT_OFST)
#define SPI_DAC_SRL_CLK_OTPT_OFST (1)
#define SPI_DAC_SRL_CLK_OTPT_MSK (0x00000001 << SPI_DAC_SRL_CLK_OTPT_OFST)
#define SPI_DAC_SRL_CS_OTPT_OFST (2)
#define SPI_DAC_SRL_CS_OTPT_MSK (0x00000001 << SPI_DAC_SRL_CS_OTPT_OFST)
#define SPI_HV_SRL_DGTL_OTPT_OFST (8)
#define SPI_HV_SRL_DGTL_OTPT_MSK (0x00000001 << SPI_HV_SRL_DGTL_OTPT_OFST)
#define SPI_HV_SRL_CLK_OTPT_OFST (9)
#define SPI_HV_SRL_CLK_OTPT_MSK (0x00000001 << SPI_HV_SRL_CLK_OTPT_OFST)
#define SPI_HV_SRL_CS_OTPT_OFST (10)
#define SPI_HV_SRL_CS_OTPT_MSK (0x00000001 << SPI_HV_SRL_CS_OTPT_OFST)
#define SPI_DAC_SRL_DGTL_OTPT_OFST (0)
#define SPI_DAC_SRL_DGTL_OTPT_MSK (0x00000001 << SPI_DAC_SRL_DGTL_OTPT_OFST)
#define SPI_DAC_SRL_CLK_OTPT_OFST (1)
#define SPI_DAC_SRL_CLK_OTPT_MSK (0x00000001 << SPI_DAC_SRL_CLK_OTPT_OFST)
#define SPI_DAC_SRL_CS_OTPT_OFST (2)
#define SPI_DAC_SRL_CS_OTPT_MSK (0x00000001 << SPI_DAC_SRL_CS_OTPT_OFST)
#define SPI_HV_SRL_DGTL_OTPT_OFST (8)
#define SPI_HV_SRL_DGTL_OTPT_MSK (0x00000001 << SPI_HV_SRL_DGTL_OTPT_OFST)
#define SPI_HV_SRL_CLK_OTPT_OFST (9)
#define SPI_HV_SRL_CLK_OTPT_MSK (0x00000001 << SPI_HV_SRL_CLK_OTPT_OFST)
#define SPI_HV_SRL_CS_OTPT_OFST (10)
#define SPI_HV_SRL_CS_OTPT_MSK (0x00000001 << SPI_HV_SRL_CS_OTPT_OFST)
/* ADC SPI (Serial Peripheral Interface) RW register */
#define ADC_SPI_REG (0x41 << MEM_MAP_SHIFT)
#define ADC_SPI_REG (0x41 << MEM_MAP_SHIFT)
#define ADC_SPI_SRL_CLK_OTPT_OFST (0)
#define ADC_SPI_SRL_CLK_OTPT_MSK (0x00000001 << ADC_SPI_SRL_CLK_OTPT_OFST)
#define ADC_SPI_SRL_DT_OTPT_OFST (1)
#define ADC_SPI_SRL_DT_OTPT_MSK (0x00000001 << ADC_SPI_SRL_DT_OTPT_OFST)
#define ADC_SPI_SRL_CS_OTPT_OFST (2)
#define ADC_SPI_SRL_CS_OTPT_MSK (0x0000000F << ADC_SPI_SRL_CS_OTPT_OFST)
#define ADC_SPI_SLOW_SRL_DT_OFST (8)
#define ADC_SPI_SLOW_SRL_DT_MSK (0x00000001 << ADC_SPI_SLOW_SRL_DT_OFST)
#define ADC_SPI_SLOW_SRL_CLK_OFST (9)
#define ADC_SPI_SLOW_SRL_CLK_MSK (0x00000001 << ADC_SPI_SLOW_SRL_CLK_OFST)
#define ADC_SPI_SLOW_SRL_CNV_OFST (10)
#define ADC_SPI_SLOW_SRL_CNV_MSK (0x00000001 << ADC_SPI_SLOW_SRL_CNV_OFST)
#define ADC_SPI_SRL_CLK_OTPT_OFST (0)
#define ADC_SPI_SRL_CLK_OTPT_MSK (0x00000001 << ADC_SPI_SRL_CLK_OTPT_OFST)
#define ADC_SPI_SRL_DT_OTPT_OFST (1)
#define ADC_SPI_SRL_DT_OTPT_MSK (0x00000001 << ADC_SPI_SRL_DT_OTPT_OFST)
#define ADC_SPI_SRL_CS_OTPT_OFST (2)
#define ADC_SPI_SRL_CS_OTPT_MSK (0x0000000F << ADC_SPI_SRL_CS_OTPT_OFST)
#define ADC_SPI_SLOW_SRL_DT_OFST (8)
#define ADC_SPI_SLOW_SRL_DT_MSK (0x00000001 << ADC_SPI_SLOW_SRL_DT_OFST)
#define ADC_SPI_SLOW_SRL_CLK_OFST (9)
#define ADC_SPI_SLOW_SRL_CLK_MSK (0x00000001 << ADC_SPI_SLOW_SRL_CLK_OFST)
#define ADC_SPI_SLOW_SRL_CNV_OFST (10)
#define ADC_SPI_SLOW_SRL_CNV_MSK (0x00000001 << ADC_SPI_SLOW_SRL_CNV_OFST)
/* ADC Offset RW register */
#define ADC_OFFSET_REG (0x42 << MEM_MAP_SHIFT)
#define ADC_OFFSET_REG (0x42 << MEM_MAP_SHIFT)
#define ADC_OFFSET_ADC_PPLN_OFST (0)
#define ADC_OFFSET_ADC_PPLN_MSK (0x000000FF << ADC_OFFSET_ADC_PPLN_OFST)
#define ADC_OFFSET_DBT_PPLN_OFST (16)
#define ADC_OFFSET_DBT_PPLN_MSK (0x000000FF << ADC_OFFSET_DBT_PPLN_OFST)
#define ADC_OFFSET_ADC_PPLN_OFST (0)
#define ADC_OFFSET_ADC_PPLN_MSK (0x000000FF << ADC_OFFSET_ADC_PPLN_OFST)
#define ADC_OFFSET_DBT_PPLN_OFST (16)
#define ADC_OFFSET_DBT_PPLN_MSK (0x000000FF << ADC_OFFSET_DBT_PPLN_OFST)
/* ADC Port Invert RW register */
#define ADC_PORT_INVERT_REG (0x43 << MEM_MAP_SHIFT)
#define ADC_PORT_INVERT_REG (0x43 << MEM_MAP_SHIFT)
#define ADC_PORT_INVERT_0_INPT_OFST (0)
#define ADC_PORT_INVERT_0_INPT_MSK (0x000000FF << ADC_PORT_INVERT_0_INPT_OFST)
#define ADC_PORT_INVERT_1_INPT_OFST (8)
#define ADC_PORT_INVERT_1_INPT_MSK (0x000000FF << ADC_PORT_INVERT_1_INPT_OFST)
#define ADC_PORT_INVERT_2_INPT_OFST (16)
#define ADC_PORT_INVERT_2_INPT_MSK (0x000000FF << ADC_PORT_INVERT_2_INPT_OFST)
#define ADC_PORT_INVERT_3_INPT_OFST (24)
#define ADC_PORT_INVERT_3_INPT_MSK (0x000000FF << ADC_PORT_INVERT_3_INPT_OFST)
#define ADC_PORT_INVERT_0_INPT_OFST (0)
#define ADC_PORT_INVERT_0_INPT_MSK (0x000000FF << ADC_PORT_INVERT_0_INPT_OFST)
#define ADC_PORT_INVERT_1_INPT_OFST (8)
#define ADC_PORT_INVERT_1_INPT_MSK (0x000000FF << ADC_PORT_INVERT_1_INPT_OFST)
#define ADC_PORT_INVERT_2_INPT_OFST (16)
#define ADC_PORT_INVERT_2_INPT_MSK (0x000000FF << ADC_PORT_INVERT_2_INPT_OFST)
#define ADC_PORT_INVERT_3_INPT_OFST (24)
#define ADC_PORT_INVERT_3_INPT_MSK (0x000000FF << ADC_PORT_INVERT_3_INPT_OFST)
/* Dummy RW register */
#define DUMMY_REG (0x44 << MEM_MAP_SHIFT)
#define DUMMY_REG (0x44 << MEM_MAP_SHIFT)
#define DUMMY_FIFO_CHNNL_SLCT_OFST (0)
#define DUMMY_FIFO_CHNNL_SLCT_MSK (0x0000003F << DUMMY_FIFO_CHNNL_SLCT_OFST)
#define DUMMY_ANLG_FIFO_RD_STRBE_OFST (8)
#define DUMMY_ANLG_FIFO_RD_STRBE_MSK \
(0x00000001 << DUMMY_ANLG_FIFO_RD_STRBE_OFST)
#define DUMMY_DGTL_FIFO_RD_STRBE_OFST (9)
#define DUMMY_DGTL_FIFO_RD_STRBE_MSK \
(0x00000001 << DUMMY_DGTL_FIFO_RD_STRBE_OFST)
#define DUMMY_FIFO_CHNNL_SLCT_OFST (0)
#define DUMMY_FIFO_CHNNL_SLCT_MSK (0x0000003F << DUMMY_FIFO_CHNNL_SLCT_OFST)
#define DUMMY_ANLG_FIFO_RD_STRBE_OFST (8)
#define DUMMY_ANLG_FIFO_RD_STRBE_MSK (0x00000001 << DUMMY_ANLG_FIFO_RD_STRBE_OFST)
#define DUMMY_DGTL_FIFO_RD_STRBE_OFST (9)
#define DUMMY_DGTL_FIFO_RD_STRBE_MSK (0x00000001 << DUMMY_DGTL_FIFO_RD_STRBE_OFST)
/* Receiver IP Address RW register */
#define RX_IP_REG (0x45 << MEM_MAP_SHIFT)
#define RX_IP_REG (0x45 << MEM_MAP_SHIFT)
/* UDP Port RW register */
#define UDP_PORT_REG (0x46 << MEM_MAP_SHIFT)
#define UDP_PORT_REG (0x46 << MEM_MAP_SHIFT)
#define UDP_PORT_RX_OFST (0)
#define UDP_PORT_RX_MSK (0x0000FFFF << UDP_PORT_RX_OFST)
#define UDP_PORT_TX_OFST (16)
#define UDP_PORT_TX_MSK (0x0000FFFF << UDP_PORT_TX_OFST)
#define UDP_PORT_RX_OFST (0)
#define UDP_PORT_RX_MSK (0x0000FFFF << UDP_PORT_RX_OFST)
#define UDP_PORT_TX_OFST (16)
#define UDP_PORT_TX_MSK (0x0000FFFF << UDP_PORT_TX_OFST)
/* Receiver Mac Address 64 bit RW register */
#define RX_MAC_LSB_REG (0x47 << MEM_MAP_SHIFT)
#define RX_MAC_MSB_REG (0x48 << MEM_MAP_SHIFT)
#define RX_MAC_LSB_REG (0x47 << MEM_MAP_SHIFT)
#define RX_MAC_MSB_REG (0x48 << MEM_MAP_SHIFT)
#define RX_MAC_LSB_OFST (0)
#define RX_MAC_LSB_MSK (0xFFFFFFFF << RX_MAC_LSB_OFST)
#define RX_MAC_MSB_OFST (0)
#define RX_MAC_MSB_MSK (0x0000FFFF << RX_MAC_MSB_OFST)
#define RX_MAC_LSB_OFST (0)
#define RX_MAC_LSB_MSK (0xFFFFFFFF << RX_MAC_LSB_OFST)
#define RX_MAC_MSB_OFST (0)
#define RX_MAC_MSB_MSK (0x0000FFFF << RX_MAC_MSB_OFST)
/* Detector/ Transmitter Mac Address 64 bit RW register */
#define TX_MAC_LSB_REG (0x49 << MEM_MAP_SHIFT)
#define TX_MAC_MSB_REG (0x4A << MEM_MAP_SHIFT)
#define TX_MAC_LSB_REG (0x49 << MEM_MAP_SHIFT)
#define TX_MAC_MSB_REG (0x4A << MEM_MAP_SHIFT)
#define TX_MAC_LSB_OFST (0)
#define TX_MAC_LSB_MSK (0xFFFFFFFF << TX_MAC_LSB_OFST)
#define TX_MAC_MSB_OFST (0)
#define TX_MAC_MSB_MSK (0x0000FFFF << TX_MAC_MSB_OFST)
#define TX_MAC_LSB_OFST (0)
#define TX_MAC_LSB_MSK (0xFFFFFFFF << TX_MAC_LSB_OFST)
#define TX_MAC_MSB_OFST (0)
#define TX_MAC_MSB_MSK (0x0000FFFF << TX_MAC_MSB_OFST)
/* Detector/ Transmitter IP Address RW register */
#define TX_IP_REG (0x4B << MEM_MAP_SHIFT)
#define TX_IP_REG (0x4B << MEM_MAP_SHIFT)
/* Detector/ Transmitter IP Checksum RW register */
#define TX_IP_CHECKSUM_REG (0x4C << MEM_MAP_SHIFT)
#define TX_IP_CHECKSUM_REG (0x4C << MEM_MAP_SHIFT)
#define TX_IP_CHECKSUM_OFST (0)
#define TX_IP_CHECKSUM_MSK (0x0000FFFF << TX_IP_CHECKSUM_OFST)
#define TX_IP_CHECKSUM_OFST (0)
#define TX_IP_CHECKSUM_MSK (0x0000FFFF << TX_IP_CHECKSUM_OFST)
/* Configuration RW register */
#define CONFIG_REG (0x4D << MEM_MAP_SHIFT)
#define CONFIG_REG (0x4D << MEM_MAP_SHIFT)
#define CONFIG_LED_DSBL_OFST (0)
#define CONFIG_LED_DSBL_MSK (0x00000001 << CONFIG_LED_DSBL_OFST)
#define CONFIG_DSBL_ANLG_OTPT_OFST (8)
#define CONFIG_DSBL_ANLG_OTPT_MSK (0x00000001 << CONFIG_DSBL_ANLG_OTPT_OFST)
#define CONFIG_ENBLE_DGTL_OTPT_OFST (9)
#define CONFIG_ENBLE_DGTL_OTPT_MSK (0x00000001 << CONFIG_ENBLE_DGTL_OTPT_OFST)
#define CONFIG_GB10_SND_UDP_OFST (12)
#define CONFIG_GB10_SND_UDP_MSK (0x00000001 << CONFIG_GB10_SND_UDP_OFST)
#define CONFIG_LED_DSBL_OFST (0)
#define CONFIG_LED_DSBL_MSK (0x00000001 << CONFIG_LED_DSBL_OFST)
#define CONFIG_DSBL_ANLG_OTPT_OFST (8)
#define CONFIG_DSBL_ANLG_OTPT_MSK (0x00000001 << CONFIG_DSBL_ANLG_OTPT_OFST)
#define CONFIG_ENBLE_DGTL_OTPT_OFST (9)
#define CONFIG_ENBLE_DGTL_OTPT_MSK (0x00000001 << CONFIG_ENBLE_DGTL_OTPT_OFST)
#define CONFIG_GB10_SND_UDP_OFST (12)
#define CONFIG_GB10_SND_UDP_MSK (0x00000001 << CONFIG_GB10_SND_UDP_OFST)
/* External Signal RW register */
#define EXT_SIGNAL_REG (0x4E << MEM_MAP_SHIFT)
#define EXT_SIGNAL_REG (0x4E << MEM_MAP_SHIFT)
#define EXT_SIGNAL_OFST (0)
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
#define EXT_SIGNAL_AUTO_VAL ((0x0 << EXT_SIGNAL_OFST) & EXT_SIGNAL_MSK)
#define EXT_SIGNAL_TRGGR_VAL ((0x1 << EXT_SIGNAL_OFST) & EXT_SIGNAL_MSK)
#define EXT_SIGNAL_OFST (0)
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
#define EXT_SIGNAL_AUTO_VAL ((0x0 << EXT_SIGNAL_OFST) & EXT_SIGNAL_MSK)
#define EXT_SIGNAL_TRGGR_VAL ((0x1 << EXT_SIGNAL_OFST) & EXT_SIGNAL_MSK)
/* Control RW register */
#define CONTROL_REG (0x4F << MEM_MAP_SHIFT)
#define CONTROL_REG (0x4F << MEM_MAP_SHIFT)
#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_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_STRT_FF_TST_OFST (2)
//#define CONTROL_STRT_FF_TST_MSK (0x00000001 <<
// CONTROL_STRT_FF_TST_OFST) #define CONTROL_STP_FF_TST_OFST (3)
//#define CONTROL_STP_FF_TST_MSK (0x00000001 <<
// CONTROL_STP_FF_TST_OFST) #define CONTROL_STRT_RDT_OFST (4)
//#define CONTROL_STRT_RDT_MSK (0x00000001 <<
// CONTROL_STRT_RDT_OFST) #define CONTROL_STP_RDT_OFST (5)
// #define CONTROL_STP_RDT_MSK (0x00000001 <<
// CONTROL_STP_RDT_OFST)
#define CONTROL_STRT_EXPSR_OFST (6)
#define CONTROL_STRT_EXPSR_MSK (0x00000001 << CONTROL_STRT_EXPSR_OFST)
//#define CONTROL_STRT_FF_TST_MSK (0x00000001 << CONTROL_STRT_FF_TST_OFST)
//#define CONTROL_STP_FF_TST_OFST (3)
//#define CONTROL_STP_FF_TST_MSK (0x00000001 << CONTROL_STP_FF_TST_OFST)
//#define CONTROL_STRT_RDT_OFST (4)
//#define CONTROL_STRT_RDT_MSK (0x00000001 << CONTROL_STRT_RDT_OFST)
//#define CONTROL_STP_RDT_OFST (5)
//#define CONTROL_STP_RDT_MSK (0x00000001 << CONTROL_STP_RDT_OFST)
#define CONTROL_STRT_EXPSR_OFST (6)
#define CONTROL_STRT_EXPSR_MSK (0x00000001 << CONTROL_STRT_EXPSR_OFST)
//#define CONTROL_STP_EXPSR_OFST (7)
//#define CONTROL_STP_EXPSR_MSK (0x00000001 <<
// CONTROL_STP_RDT_OFST) #define CONTROL_STRT_TRN_OFST (8) #define
// CONTROL_STRT_TRN_MSK (0x00000001 << CONTROL_STRT_RDT_OFST)
//#define CONTROL_STP_EXPSR_MSK (0x00000001 << CONTROL_STP_RDT_OFST)
//#define CONTROL_STRT_TRN_OFST (8)
//#define CONTROL_STRT_TRN_MSK (0x00000001 << CONTROL_STRT_RDT_OFST)
//#define CONTROL_STP_TRN_OFST (9)
//#define CONTROL_STP_TRN_MSK (0x00000001 <<
// CONTROL_STP_RDT_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?
#define CONTROL_PRPHRL_RST_MSK (0x00000001 << CONTROL_PRPHRL_RST_OFST)
#define CONTROL_MMRY_RST_OFST (12)
#define CONTROL_MMRY_RST_MSK (0x00000001 << CONTROL_MMRY_RST_OFST)
//#define CONTROL_STP_TRN_MSK (0x00000001 << CONTROL_STP_RDT_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?
#define CONTROL_PRPHRL_RST_MSK (0x00000001 << CONTROL_PRPHRL_RST_OFST)
#define CONTROL_MMRY_RST_OFST (12)
#define CONTROL_MMRY_RST_MSK (0x00000001 << CONTROL_MMRY_RST_OFST)
//#define CONTROL_PLL_RCNFG_WR_OFST (13)
//#define CONTROL_PLL_RCNFG_WR_MSK (0x00000001 <<
// CONTROL_PLL_RCNFG_WR_OFST)
#define CONTROL_SND_10GB_PCKT_OFST (14)
#define CONTROL_SND_10GB_PCKT_MSK (0x00000001 << CONTROL_SND_10GB_PCKT_OFST)
#define CONTROL_CLR_ACQSTN_FIFO_OFST (15)
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
//#define CONTROL_PLL_RCNFG_WR_MSK (0x00000001 << CONTROL_PLL_RCNFG_WR_OFST)
#define CONTROL_SND_10GB_PCKT_OFST (14)
#define CONTROL_SND_10GB_PCKT_MSK (0x00000001 << CONTROL_SND_10GB_PCKT_OFST)
#define CONTROL_CLR_ACQSTN_FIFO_OFST (15)
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
/* Reconfiguratble PLL Paramater RW register */
#define PLL_PARAM_REG (0x50 << MEM_MAP_SHIFT)
#define PLL_PARAM_REG (0x50 << MEM_MAP_SHIFT)
/* Reconfiguratble PLL Control RW regiser */
#define PLL_CNTRL_REG (0x51 << MEM_MAP_SHIFT)
#define PLL_CNTRL_REG (0x51 << MEM_MAP_SHIFT)
#define PLL_CNTRL_RCNFG_PRMTR_RST_OFST (0)
#define PLL_CNTRL_RCNFG_PRMTR_RST_MSK \
(0x00000001 << PLL_CNTRL_RCNFG_PRMTR_RST_OFST)
#define PLL_CNTRL_WR_PRMTR_OFST (2)
#define PLL_CNTRL_WR_PRMTR_MSK (0x00000001 << PLL_CNTRL_WR_PRMTR_OFST)
#define PLL_CNTRL_PLL_RST_OFST (3)
#define PLL_CNTRL_PLL_RST_MSK (0x00000001 << PLL_CNTRL_PLL_RST_OFST)
#define PLL_CNTRL_ADDR_OFST (16)
#define PLL_CNTRL_ADDR_MSK (0x0000003F << PLL_CNTRL_ADDR_OFST)
#define PLL_CNTRL_RCNFG_PRMTR_RST_OFST (0)
#define PLL_CNTRL_RCNFG_PRMTR_RST_MSK (0x00000001 << PLL_CNTRL_RCNFG_PRMTR_RST_OFST)
#define PLL_CNTRL_WR_PRMTR_OFST (2)
#define PLL_CNTRL_WR_PRMTR_MSK (0x00000001 << PLL_CNTRL_WR_PRMTR_OFST)
#define PLL_CNTRL_PLL_RST_OFST (3)
#define PLL_CNTRL_PLL_RST_MSK (0x00000001 << PLL_CNTRL_PLL_RST_OFST)
#define PLL_CNTRL_ADDR_OFST (16)
#define PLL_CNTRL_ADDR_MSK (0x0000003F << PLL_CNTRL_ADDR_OFST)
/* Pattern Control RW register */
#define PATTERN_CNTRL_REG (0x52 << MEM_MAP_SHIFT)
#define PATTERN_CNTRL_REG (0x52 << MEM_MAP_SHIFT)
#define PATTERN_CNTRL_WR_OFST (0)
#define PATTERN_CNTRL_WR_MSK (0x00000001 << PATTERN_CNTRL_WR_OFST)
#define PATTERN_CNTRL_RD_OFST (1)
#define PATTERN_CNTRL_RD_MSK (0x00000001 << PATTERN_CNTRL_RD_OFST)
#define PATTERN_CNTRL_ADDR_OFST (16)
#define PATTERN_CNTRL_ADDR_MSK (0x00001FFF << PATTERN_CNTRL_ADDR_OFST)
#define PATTERN_CNTRL_WR_OFST (0)
#define PATTERN_CNTRL_WR_MSK (0x00000001 << PATTERN_CNTRL_WR_OFST)
#define PATTERN_CNTRL_RD_OFST (1)
#define PATTERN_CNTRL_RD_MSK (0x00000001 << PATTERN_CNTRL_RD_OFST)
#define PATTERN_CNTRL_ADDR_OFST (16)
#define PATTERN_CNTRL_ADDR_MSK (0x00001FFF << PATTERN_CNTRL_ADDR_OFST)
/* Pattern Limit RW regiser */
#define PATTERN_LIMIT_REG (0x53 << MEM_MAP_SHIFT)
#define PATTERN_LIMIT_REG (0x53 << MEM_MAP_SHIFT)
#define PATTERN_LIMIT_STRT_OFST (0)
#define PATTERN_LIMIT_STRT_MSK (0x00001FFF << PATTERN_LIMIT_STRT_OFST)
#define PATTERN_LIMIT_STP_OFST (16)
#define PATTERN_LIMIT_STP_MSK (0x00001FFF << PATTERN_LIMIT_STP_OFST)
#define PATTERN_LIMIT_STRT_OFST (0)
#define PATTERN_LIMIT_STRT_MSK (0x00001FFF << PATTERN_LIMIT_STRT_OFST)
#define PATTERN_LIMIT_STP_OFST (16)
#define PATTERN_LIMIT_STP_MSK (0x00001FFF << PATTERN_LIMIT_STP_OFST)
/* Pattern Loop 0 Address RW regiser */
#define PATTERN_LOOP_0_ADDR_REG (0x54 << MEM_MAP_SHIFT)
#define PATTERN_LOOP_0_ADDR_REG (0x54 << MEM_MAP_SHIFT)
#define PATTERN_LOOP_0_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_0_ADDR_STRT_MSK \
(0x00001FFF << PATTERN_LOOP_0_ADDR_STRT_OFST)
#define PATTERN_LOOP_0_ADDR_STP_OFST (16)
#define PATTERN_LOOP_0_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_0_ADDR_STP_OFST)
#define PATTERN_LOOP_0_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_0_ADDR_STRT_MSK (0x00001FFF << PATTERN_LOOP_0_ADDR_STRT_OFST)
#define PATTERN_LOOP_0_ADDR_STP_OFST (16)
#define PATTERN_LOOP_0_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_0_ADDR_STP_OFST)
/* Pattern Loop 0 Iteration RW regiser */
#define PATTERN_LOOP_0_ITERATION_REG (0x55 << MEM_MAP_SHIFT)
#define PATTERN_LOOP_0_ITERATION_REG (0x55 << MEM_MAP_SHIFT)
/* Pattern Loop 1 Address RW regiser */
#define PATTERN_LOOP_1_ADDR_REG (0x56 << MEM_MAP_SHIFT)
#define PATTERN_LOOP_1_ADDR_REG (0x56 << MEM_MAP_SHIFT)
#define PATTERN_LOOP_1_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_1_ADDR_STRT_MSK \
(0x00001FFF << PATTERN_LOOP_1_ADDR_STRT_OFST)
#define PATTERN_LOOP_1_ADDR_STP_OFST (16)
#define PATTERN_LOOP_1_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_1_ADDR_STP_OFST)
#define PATTERN_LOOP_1_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_1_ADDR_STRT_MSK (0x00001FFF << PATTERN_LOOP_1_ADDR_STRT_OFST)
#define PATTERN_LOOP_1_ADDR_STP_OFST (16)
#define PATTERN_LOOP_1_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_1_ADDR_STP_OFST)
/* Pattern Loop 1 Iteration RW regiser */
#define PATTERN_LOOP_1_ITERATION_REG (0x57 << MEM_MAP_SHIFT)
#define PATTERN_LOOP_1_ITERATION_REG (0x57 << MEM_MAP_SHIFT)
/* Pattern Loop 2 Address RW regiser */
#define PATTERN_LOOP_2_ADDR_REG (0x58 << MEM_MAP_SHIFT)
#define PATTERN_LOOP_2_ADDR_REG (0x58 << MEM_MAP_SHIFT)
#define PATTERN_LOOP_2_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_2_ADDR_STRT_MSK \
(0x00001FFF << PATTERN_LOOP_2_ADDR_STRT_OFST)
#define PATTERN_LOOP_2_ADDR_STP_OFST (16)
#define PATTERN_LOOP_2_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_2_ADDR_STP_OFST)
#define PATTERN_LOOP_2_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_2_ADDR_STRT_MSK (0x00001FFF << PATTERN_LOOP_2_ADDR_STRT_OFST)
#define PATTERN_LOOP_2_ADDR_STP_OFST (16)
#define PATTERN_LOOP_2_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_2_ADDR_STP_OFST)
/* Pattern Loop 2 Iteration RW regiser */
#define PATTERN_LOOP_2_ITERATION_REG (0x59 << MEM_MAP_SHIFT)
#define PATTERN_LOOP_2_ITERATION_REG (0x59 << MEM_MAP_SHIFT)
/* Pattern Wait 0 RW regiser */
#define PATTERN_WAIT_0_ADDR_REG (0x5A << MEM_MAP_SHIFT)
#define PATTERN_WAIT_0_ADDR_REG (0x5A << MEM_MAP_SHIFT)
#define PATTERN_WAIT_0_ADDR_OFST (0)
#define PATTERN_WAIT_0_ADDR_MSK (0x00001FFF << PATTERN_WAIT_0_ADDR_OFST)
// FIXME: is mask 3FF
#define PATTERN_WAIT_0_ADDR_OFST (0)
#define PATTERN_WAIT_0_ADDR_MSK (0x00001FFF << PATTERN_WAIT_0_ADDR_OFST)
//FIXME: is mask 3FF
/* Pattern Wait 1 RW regiser */
#define PATTERN_WAIT_1_ADDR_REG (0x5B << MEM_MAP_SHIFT)
#define PATTERN_WAIT_1_ADDR_REG (0x5B << MEM_MAP_SHIFT)
#define PATTERN_WAIT_1_ADDR_OFST (0)
#define PATTERN_WAIT_1_ADDR_MSK (0x00001FFF << PATTERN_WAIT_1_ADDR_OFST)
#define PATTERN_WAIT_1_ADDR_OFST (0)
#define PATTERN_WAIT_1_ADDR_MSK (0x00001FFF << PATTERN_WAIT_1_ADDR_OFST)
/* Pattern Wait 2 RW regiser */
#define PATTERN_WAIT_2_ADDR_REG (0x5C << MEM_MAP_SHIFT)
#define PATTERN_WAIT_2_ADDR_REG (0x5C << MEM_MAP_SHIFT)
#define PATTERN_WAIT_2_ADDR_OFST (0)
#define PATTERN_WAIT_2_ADDR_MSK (0x00001FFF << PATTERN_WAIT_2_ADDR_OFST)
#define PATTERN_WAIT_2_ADDR_OFST (0)
#define PATTERN_WAIT_2_ADDR_MSK (0x00001FFF << PATTERN_WAIT_2_ADDR_OFST)
/* Samples RW register */
#define SAMPLES_REG (0x5D << MEM_MAP_SHIFT)
#define SAMPLES_REG (0x5D << MEM_MAP_SHIFT)
#define SAMPLES_DIGITAL_OFST (0)
#define SAMPLES_DIGITAL_MSK (0x0000FFFF << SAMPLES_DIGITAL_OFST)
#define SAMPLES_ANALOG_OFST (16)
#define SAMPLES_ANALOG_MSK (0x0000FFFF << SAMPLES_ANALOG_OFST)
#define SAMPLES_DIGITAL_OFST (0)
#define SAMPLES_DIGITAL_MSK (0x0000FFFF << SAMPLES_DIGITAL_OFST)
#define SAMPLES_ANALOG_OFST (16)
#define SAMPLES_ANALOG_MSK (0x0000FFFF << SAMPLES_ANALOG_OFST)
/** Power RW register */
#define POWER_REG (0x5E << MEM_MAP_SHIFT)
#define POWER_REG (0x5E << MEM_MAP_SHIFT)
#define POWER_ENBL_VLTG_RGLTR_OFST (16)
#define POWER_ENBL_VLTG_RGLTR_MSK (0x0000001F << POWER_ENBL_VLTG_RGLTR_OFST)
#define POWER_HV_INTERNAL_SLCT_OFST (31)
#define POWER_HV_INTERNAL_SLCT_MSK (0x00000001 << POWER_HV_INTERNAL_SLCT_OFST)
#define POWER_ENBL_VLTG_RGLTR_OFST (16)
#define POWER_ENBL_VLTG_RGLTR_MSK (0x0000001F << POWER_ENBL_VLTG_RGLTR_OFST)
#define POWER_HV_INTERNAL_SLCT_OFST (31)
#define POWER_HV_INTERNAL_SLCT_MSK (0x00000001 << POWER_HV_INTERNAL_SLCT_OFST)
/* Number of Words RW register TODO */
#define NUMBER_OF_WORDS_REG (0x5F << MEM_MAP_SHIFT)
#define NUMBER_OF_WORDS_REG (0x5F << MEM_MAP_SHIFT)
/* Delay 64 bit RW register. t = DLY x 50 ns. */
#define DELAY_LSB_REG (0x60 << MEM_MAP_SHIFT)
#define DELAY_MSB_REG (0x61 << MEM_MAP_SHIFT)
#define DELAY_LSB_REG (0x60 << MEM_MAP_SHIFT)
#define DELAY_MSB_REG (0x61 << MEM_MAP_SHIFT)
/* Triggers 64 bit RW register */
#define CYCLES_LSB_REG (0x62 << MEM_MAP_SHIFT)
#define CYCLES_MSB_REG (0x63 << MEM_MAP_SHIFT)
#define CYCLES_LSB_REG (0x62 << MEM_MAP_SHIFT)
#define CYCLES_MSB_REG (0x63 << MEM_MAP_SHIFT)
/* Frames 64 bit RW register */
#define FRAMES_LSB_REG (0x64 << MEM_MAP_SHIFT)
#define FRAMES_MSB_REG (0x65 << MEM_MAP_SHIFT)
#define FRAMES_LSB_REG (0x64 << MEM_MAP_SHIFT)
#define FRAMES_MSB_REG (0x65 << MEM_MAP_SHIFT)
/* Period 64 bit RW register */
#define PERIOD_LSB_REG (0x66 << MEM_MAP_SHIFT)
#define PERIOD_MSB_REG (0x67 << MEM_MAP_SHIFT)
#define PERIOD_LSB_REG (0x66 << MEM_MAP_SHIFT)
#define PERIOD_MSB_REG (0x67 << MEM_MAP_SHIFT)
/* Period 64 bit RW register */
//#define EXPTIME_LSB_REG (0x68 << MEM_MAP_SHIFT) //
// Not used in FW #define EXPTIME_MSB_REG (0x69 <<
// MEM_MAP_SHIFT) // Not used in FW
//#define EXPTIME_LSB_REG (0x68 << MEM_MAP_SHIFT) // Not used in FW
//#define EXPTIME_MSB_REG (0x69 << MEM_MAP_SHIFT) // Not used in FW
/* Gates 64 bit RW register */
//#define GATES_LSB_REG (0x6A << MEM_MAP_SHIFT) // Not used
// in FW #define GATES_MSB_REG (0x6B << MEM_MAP_SHIFT) //
// Not used in FW
//#define GATES_LSB_REG (0x6A << MEM_MAP_SHIFT) // Not used in FW
//#define GATES_MSB_REG (0x6B << MEM_MAP_SHIFT) // Not used in FW
/* Pattern IO Control 64 bit RW regiser
* Each bit configured as output(1)/ input(0) */
#define PATTERN_IO_CNTRL_LSB_REG (0x6C << MEM_MAP_SHIFT)
#define PATTERN_IO_CNTRL_MSB_REG (0x6D << MEM_MAP_SHIFT)
#define PATTERN_IO_CNTRL_LSB_REG (0x6C << MEM_MAP_SHIFT)
#define PATTERN_IO_CNTRL_MSB_REG (0x6D << MEM_MAP_SHIFT)
/* Pattern IO Clock Control 64 bit RW regiser
* When bit n enabled (1), clocked output for DIO[n] (T run clock)
* When bit n disabled (0), Dio[n] driven by its pattern output */
#define PATTERN_IO_CLK_CNTRL_LSB_REG (0x6E << MEM_MAP_SHIFT)
#define PATTERN_IO_CLK_CNTRL_MSB_REG (0x6F << MEM_MAP_SHIFT)
#define PATTERN_IO_CLK_CNTRL_LSB_REG (0x6E << MEM_MAP_SHIFT)
#define PATTERN_IO_CLK_CNTRL_MSB_REG (0x6F << MEM_MAP_SHIFT)
/* Pattern In 64 bit RW register */
#define PATTERN_IN_LSB_REG (0x70 << MEM_MAP_SHIFT)
#define PATTERN_IN_MSB_REG (0x71 << MEM_MAP_SHIFT)
#define PATTERN_IN_LSB_REG (0x70 << MEM_MAP_SHIFT)
#define PATTERN_IN_MSB_REG (0x71 << MEM_MAP_SHIFT)
/* Pattern Wait Timer 0 64 bit RW register. t = PWT1 x T run clock */
#define PATTERN_WAIT_TIMER_0_LSB_REG (0x72 << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_0_MSB_REG (0x73 << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_0_LSB_REG (0x72 << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_0_MSB_REG (0x73 << MEM_MAP_SHIFT)
/* Pattern Wait Timer 1 64 bit RW register. t = PWT2 x T run clock */
#define PATTERN_WAIT_TIMER_1_LSB_REG (0x74 << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_1_MSB_REG (0x75 << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_1_LSB_REG (0x74 << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_1_MSB_REG (0x75 << MEM_MAP_SHIFT)
/* Pattern Wait Timer 2 64 bit RW register. t = PWT3 x T run clock */
#define PATTERN_WAIT_TIMER_2_LSB_REG (0x76 << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_2_MSB_REG (0x77 << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_2_LSB_REG (0x76 << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_2_MSB_REG (0x77 << MEM_MAP_SHIFT)
/* Readout enable RW register */
#define READOUT_10G_ENABLE_REG (0x79 << MEM_MAP_SHIFT)
#define READOUT_10G_ENABLE_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)
#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)
/* Digital Bit External Trigger RW register */
#define DBIT_EXT_TRG_REG (0x7B << MEM_MAP_SHIFT)
#define DBIT_EXT_TRG_REG (0x7B << MEM_MAP_SHIFT)
#define DBIT_EXT_TRG_SRC_OFST (0)
#define DBIT_EXT_TRG_SRC_MSK (0x0000003F << DBIT_EXT_TRG_SRC_OFST)
#define DBIT_EXT_TRG_OPRTN_MD_OFST (16)
#define DBIT_EXT_TRG_OPRTN_MD_MSK (0x00000001 << DBIT_EXT_TRG_OPRTN_MD_OFST)
#define DBIT_EXT_TRG_SRC_OFST (0)
#define DBIT_EXT_TRG_SRC_MSK (0x0000003F << DBIT_EXT_TRG_SRC_OFST)
#define DBIT_EXT_TRG_OPRTN_MD_OFST (16)
#define DBIT_EXT_TRG_OPRTN_MD_MSK (0x00000001 << DBIT_EXT_TRG_OPRTN_MD_OFST)
/* Pin Delay 0 RW register */
#define OUTPUT_DELAY_0_REG (0x7C << MEM_MAP_SHIFT)
#define OUTPUT_DELAY_0_OTPT_STTNG_STEPS (25)
#define OUTPUT_DELAY_0_OTPT_STTNG_OFST \
(0) // t = OTPT_STTNG * 25 ps, max for Cyclone V = 775 ps
#define OUTPUT_DELAY_0_OTPT_STTNG_MSK \
(0x0000001F << OUTPUT_DELAY_0_OTPT_STTNG_OFST)
// 1: load dynamic output settings, 0: trigger start of dynamic output delay
// configuration pn falling edge of ODT (output delay trigger) bit
#define OUTPUT_DELAY_0_OTPT_TRGGR_OFST (31)
#define OUTPUT_DELAY_0_OTPT_TRGGR_MSK \
(0x00000001 << OUTPUT_DELAY_0_OTPT_TRGGR_OFST)
#define OUTPUT_DELAY_0_OTPT_TRGGR_LD_VAL (1)
#define OUTPUT_DELAY_0_OTPT_TRGGR_STRT_VAL (0)
#define OUTPUT_DELAY_0_REG (0x7C << MEM_MAP_SHIFT)
#define OUTPUT_DELAY_0_OTPT_STTNG_STEPS (25)
#define OUTPUT_DELAY_0_OTPT_STTNG_OFST (0) //t = OTPT_STTNG * 25 ps, max for Cyclone V = 775 ps
#define OUTPUT_DELAY_0_OTPT_STTNG_MSK (0x0000001F << OUTPUT_DELAY_0_OTPT_STTNG_OFST)
// 1: load dynamic output settings, 0: trigger start of dynamic output delay configuration pn falling edge of ODT (output delay trigger) bit
#define OUTPUT_DELAY_0_OTPT_TRGGR_OFST (31)
#define OUTPUT_DELAY_0_OTPT_TRGGR_MSK (0x00000001 << OUTPUT_DELAY_0_OTPT_TRGGR_OFST)
#define OUTPUT_DELAY_0_OTPT_TRGGR_LD_VAL (1)
#define OUTPUT_DELAY_0_OTPT_TRGGR_STRT_VAL (0)
/* Pin Delay 1 RW register
* Each bit configured as enable for dynamic output delay configuration */
#define PIN_DELAY_1_REG (0x7D << MEM_MAP_SHIFT)
#define PIN_DELAY_1_REG (0x7D << MEM_MAP_SHIFT)
/** Pattern Mask 64 bit RW regiser */
#define PATTERN_MASK_LSB_REG (0x80 << MEM_MAP_SHIFT)
#define PATTERN_MASK_MSB_REG (0x81 << MEM_MAP_SHIFT)
#define PATTERN_MASK_LSB_REG (0x80 << MEM_MAP_SHIFT)
#define PATTERN_MASK_MSB_REG (0x81 << MEM_MAP_SHIFT)
/** Pattern Set 64 bit RW regiser */
#define PATTERN_SET_LSB_REG (0x82 << MEM_MAP_SHIFT)
#define PATTERN_SET_MSB_REG (0x83 << MEM_MAP_SHIFT)
#define PATTERN_SET_LSB_REG (0x82 << MEM_MAP_SHIFT)
#define PATTERN_SET_MSB_REG (0x83 << MEM_MAP_SHIFT)
/** I2C Control register */
#define I2C_TRANSFER_COMMAND_FIFO_REG (0x100 << MEM_MAP_SHIFT)
#define I2C_RX_DATA_FIFO_REG (0x101 << MEM_MAP_SHIFT)
#define I2C_CONTROL_REG (0x102 << MEM_MAP_SHIFT)
#define I2C_STATUS_REG (0x105 << MEM_MAP_SHIFT)
#define I2C_RX_DATA_FIFO_LEVEL_REG (0x107 << MEM_MAP_SHIFT)
#define I2C_SCL_LOW_COUNT_REG (0x108 << MEM_MAP_SHIFT)
#define I2C_SCL_HIGH_COUNT_REG (0x109 << MEM_MAP_SHIFT)
#define I2C_SDA_HOLD_REG (0x10A << MEM_MAP_SHIFT)
// fixme: upto 0x10f
#define I2C_TRANSFER_COMMAND_FIFO_REG (0x100 << MEM_MAP_SHIFT)
#define I2C_RX_DATA_FIFO_REG (0x101 << MEM_MAP_SHIFT)
#define I2C_CONTROL_REG (0x102 << MEM_MAP_SHIFT)
#define I2C_STATUS_REG (0x105 << MEM_MAP_SHIFT)
#define I2C_RX_DATA_FIFO_LEVEL_REG (0x107 << MEM_MAP_SHIFT)
#define I2C_SCL_LOW_COUNT_REG (0x108 << MEM_MAP_SHIFT)
#define I2C_SCL_HIGH_COUNT_REG (0x109 << MEM_MAP_SHIFT)
#define I2C_SDA_HOLD_REG (0x10A << MEM_MAP_SHIFT)
//fixme: upto 0x10f
/* Round Robin */
#define RXR_ENDPOINT_START_REG (0x1000 << MEM_MAP_SHIFT)
#define RXR_ENDPOINT_START_REG (0x1000 << MEM_MAP_SHIFT)

File diff suppressed because it is too large Load Diff

View File

@ -1,157 +1,112 @@
#pragma once
#include "RegisterDefs.h"
#include "sls_detector_defs.h"
#include "RegisterDefs.h"
#define MIN_REQRD_VRSN_T_RD_API 0x181130
#define REQRD_FRMWR_VRSN 0x191127
#define CTRL_SRVR_INIT_TIME_US (2 * 1000 * 1000)
#define MIN_REQRD_VRSN_T_RD_API 0x181130
#define REQRD_FRMWR_VRSN 0x191127
#define CTRL_SRVR_INIT_TIME_US (2 * 1000 * 1000)
/* Struct Definitions */
typedef struct udp_header_struct {
uint32_t udp_destmac_msb;
uint16_t udp_srcmac_msb;
uint16_t udp_destmac_lsb;
uint32_t udp_srcmac_lsb;
uint8_t ip_tos;
uint8_t ip_ihl : 4, ip_ver : 4;
uint16_t udp_ethertype;
uint16_t ip_identification;
uint16_t ip_totallength;
uint8_t ip_protocol;
uint8_t ip_ttl;
uint16_t ip_fragmentoffset : 13, ip_flags : 3;
uint16_t ip_srcip_msb;
uint16_t ip_checksum;
uint16_t ip_destip_msb;
uint16_t ip_srcip_lsb;
uint16_t udp_srcport;
uint16_t ip_destip_lsb;
uint16_t udp_checksum;
uint16_t udp_destport;
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)
#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,
S_ADC0,
S_ADC1,
S_ADC2,
S_ADC3,
S_ADC4,
S_ADC5,
S_ADC6,
S_ADC7,
S_TMP
};
enum DACINDEX {
D0,
D1,
D2,
D3,
D4,
D5,
D6,
D7,
D8,
D9,
D10,
D11,
D12,
D13,
D14,
D15,
D16,
D17,
D_PWR_D,
D_PWR_CHIP,
D_PWR_C,
D_PWR_B,
D_PWR_A,
D_PWR_IO
};
enum CLKINDEX { RUN_CLK, ADC_CLK, SYNC_CLK, DBIT_CLK, NUM_CLOCKS };
#define CLK_NAMES "run", "adc", "sync", "dbit"
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, S_ADC0, S_ADC1, S_ADC2, S_ADC3, S_ADC4, S_ADC5, S_ADC6, S_ADC7, S_TMP};
enum DACINDEX {D0, D1, D2, D3, D4, D5, D6, D7, D8, D9,
D10, D11, D12, D13, D14, D15, D16, D17,
D_PWR_D, D_PWR_CHIP, D_PWR_C, D_PWR_B, D_PWR_A, D_PWR_IO};
enum CLKINDEX {RUN_CLK, ADC_CLK, SYNC_CLK, DBIT_CLK, NUM_CLOCKS};
#define CLK_NAMES "run", "adc", "sync", "dbit"
/* Hardware Definitions */
#define NCHAN (36)
#define NCHAN_ANALOG (32)
#define NCHAN_DIGITAL (64)
#define NCHIP (1)
#define NDAC (24)
#define NPWR (6)
#define NDAC_ONLY (NDAC - NPWR)
#define DYNAMIC_RANGE (16)
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8)
#define CLK_FREQ (156.25) /* MHz */
#define I2C_POWER_VIO_DEVICE_ID (0x40)
#define I2C_POWER_VA_DEVICE_ID (0x41)
#define I2C_POWER_VB_DEVICE_ID (0x42)
#define I2C_POWER_VC_DEVICE_ID (0x43)
#define I2C_POWER_VD_DEVICE_ID (0x44)
#define I2C_SHUNT_RESISTER_OHMS (0.005)
#define NCHAN (36)
#define NCHAN_ANALOG (32)
#define NCHAN_DIGITAL (64)
#define NCHIP (1)
#define NDAC (24)
#define NPWR (6)
#define NDAC_ONLY (NDAC - NPWR)
#define DYNAMIC_RANGE (16)
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8)
#define CLK_FREQ (156.25) /* MHz */
#define I2C_POWER_VIO_DEVICE_ID (0x40)
#define I2C_POWER_VA_DEVICE_ID (0x41)
#define I2C_POWER_VB_DEVICE_ID (0x42)
#define I2C_POWER_VC_DEVICE_ID (0x43)
#define I2C_POWER_VD_DEVICE_ID (0x44)
#define I2C_SHUNT_RESISTER_OHMS (0.005)
/** Default Parameters */
#define DEFAULT_DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL)
#define DEFAULT_NUM_SAMPLES (1)
#define DEFAULT_NUM_FRAMES (1)
#define DEFAULT_EXPTIME (0)
#define DEFAULT_NUM_CYCLES (1)
#define DEFAULT_PERIOD (1 * 1000 * 1000) // ns
#define DEFAULT_DELAY (0)
#define DEFAULT_HIGH_VOLTAGE (0)
#define DEFAULT_VLIMIT (-100)
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
#define DEFAULT_TX_UDP_PORT (0x7e9a)
#define DEFAULT_RUN_CLK (200) // 40
#define DEFAULT_ADC_CLK (40) // 20
#define DEFAULT_SYNC_CLK (40) // 20
#define DEFAULT_DBIT_CLK (200)
#define DEFAULT_DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL)
#define DEFAULT_NUM_SAMPLES (1)
#define DEFAULT_NUM_FRAMES (1)
#define DEFAULT_EXPTIME (0)
#define DEFAULT_NUM_CYCLES (1)
#define DEFAULT_PERIOD (1 * 1000 * 1000) //ns
#define DEFAULT_DELAY (0)
#define DEFAULT_HIGH_VOLTAGE (0)
#define DEFAULT_VLIMIT (-100)
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
#define DEFAULT_TX_UDP_PORT (0x7e9a)
#define DEFAULT_RUN_CLK (200) // 40
#define DEFAULT_ADC_CLK (40) // 20
#define DEFAULT_SYNC_CLK (40) // 20
#define DEFAULT_DBIT_CLK (200)
#define HIGHVOLTAGE_MIN (60)
#define HIGHVOLTAGE_MAX (200) // min dac val
#define DAC_MIN_MV (0)
#define DAC_MAX_MV (2500)
#define VCHIP_MIN_MV (1673)
#define VCHIP_MAX_MV (2668) // min dac val
#define POWER_RGLTR_MIN (636)
#define POWER_RGLTR_MAX \
(2638) // min dac val (not vchip-max) because of dac conversions
#define VCHIP_POWER_INCRMNT (200)
#define VIO_MIN_MV (1200) // for fpga to function
#define HIGHVOLTAGE_MIN (60)
#define HIGHVOLTAGE_MAX (200) // min dac val
#define DAC_MIN_MV (0)
#define DAC_MAX_MV (2500)
#define VCHIP_MIN_MV (1673)
#define VCHIP_MAX_MV (2668) // min dac val
#define POWER_RGLTR_MIN (636)
#define POWER_RGLTR_MAX (2638) // min dac val (not vchip-max) because of dac conversions
#define VCHIP_POWER_INCRMNT (200)
#define VIO_MIN_MV (1200) // for fpga to function
/* Defines in the Firmware */
#define DIGITAL_IO_DELAY_MAXIMUM_PS \
((OUTPUT_DELAY_0_OTPT_STTNG_MSK >> OUTPUT_DELAY_0_OTPT_STTNG_OFST) * \
OUTPUT_DELAY_0_OTPT_STTNG_STEPS)
#define MAX_PHASE_SHIFTS_STEPS (8)
#define MAX_PATTERN_LENGTH (0x2000)
#define DIGITAL_IO_DELAY_MAXIMUM_PS ((OUTPUT_DELAY_0_OTPT_STTNG_MSK >> OUTPUT_DELAY_0_OTPT_STTNG_OFST) * OUTPUT_DELAY_0_OTPT_STTNG_STEPS)
#define MAX_PHASE_SHIFTS_STEPS (8)
#define WAIT_TME_US_FR_ACQDONE_REG \
(100) // wait time in us after acquisition done to ensure there is no data
// in fifo
#define WAIT_TIME_US_PLL (10 * 1000)
#define WAIT_TIME_US_STP_ACQ (100)
#define WAIT_TIME_CONFIGURE_MAC (2 * 1000 * 1000)
#define WAIT_TIME_PATTERN_READ (10)
#define WAIT_TIME_1US_FOR_LOOP_CNT (50) // around 30 is 1 us in blackfin
#define WAIT_TME_US_FR_ACQDONE_REG (100) // wait time in us after acquisition done to ensure there is no data in fifo
#define WAIT_TIME_US_PLL (10 * 1000)
#define WAIT_TIME_US_STP_ACQ (100)
#define WAIT_TIME_CONFIGURE_MAC (2 * 1000 * 1000)
#define WAIT_TIME_PATTERN_READ (10)
#define WAIT_TIME_1US_FOR_LOOP_CNT (50) // around 30 is 1 us in blackfin
/* MSB & LSB DEFINES */
#define MSB_OF_64_BIT_REG_OFST (32)
#define LSB_OF_64_BIT_REG_OFST (0)
#define BIT32_MSK (0xFFFFFFFF)
#define BIT16_MASK (0xFFFF)
#define MSB_OF_64_BIT_REG_OFST (32)
#define LSB_OF_64_BIT_REG_OFST (0)
#define BIT32_MSK (0xFFFFFFFF)
#define BIT16_MASK (0xFFFF)
#define MAXIMUM_ADC_CLK (65)
#define PLL_VCO_FREQ_MHZ (800)
#define MAXIMUM_ADC_CLK (65)
#define PLL_VCO_FREQ_MHZ (800)

339
slsDetectorServers/eigerDetectorServer/9mhvserial_bf.c Normal file → Executable file
View File

@ -1,197 +1,202 @@
#include "ansi.h"
#include <errno.h>
#include <fcntl.h> // File control definitions
#include <linux/i2c-dev.h> // I2C_SLAVE, __u8 reg
#include <termios.h> /* POSIX terminal control definitions */
#include <stdio.h>
#include <stdlib.h> // atoi
#include <string.h> // memset
#include <sys/ioctl.h> // ioctl
#include <termios.h> /* POSIX terminal control definitions */
#include <unistd.h> // read, close
#include <stdlib.h> // atoi
#include <fcntl.h> // File control definitions
#include <sys/ioctl.h> // ioctl
#include <unistd.h> // read, close
#include <string.h> // memset
#include <linux/i2c-dev.h> // I2C_SLAVE, __u8 reg
#include <errno.h>
#define PORTNAME "/dev/ttyBF1"
#define GOODBYE 200
#define BUFFERSIZE 16
#define I2C_DEVICE_FILE "/dev/i2c-0"
#define I2C_DEVICE_ADDRESS 0x4C
#define PORTNAME "/dev/ttyBF1"
#define GOODBYE 200
#define BUFFERSIZE 16
#define I2C_DEVICE_FILE "/dev/i2c-0"
#define I2C_DEVICE_ADDRESS 0x4C
//#define I2C_DEVICE_ADDRESS 0x48
#define I2C_REGISTER_ADDRESS 0x40
#define I2C_REGISTER_ADDRESS 0x40
int i2c_open(const char *file, unsigned int addr) {
// device file
int fd = open(file, O_RDWR);
if (fd < 0) {
LOG(logERROR, ("Warning: Unable to open file %s\n", file));
return -1;
}
// device address
if (ioctl(fd, I2C_SLAVE, addr & 0x7F) < 0) {
LOG(logERROR, ("Warning: Unable to set slave address:0x%x \n", addr));
return -2;
}
return fd;
int i2c_open(const char* file,unsigned int addr){
//device file
int fd = open( file, O_RDWR );
if (fd < 0) {
LOG(logERROR, ("Warning: Unable to open file %s\n",file));
return -1;
}
//device address
if( ioctl( fd, I2C_SLAVE, addr&0x7F ) < 0 ) {
LOG(logERROR, ("Warning: Unable to set slave address:0x%x \n",addr));
return -2;
}
return fd;
}
int i2c_read() {
int fd = i2c_open(I2C_DEVICE_FILE, I2C_DEVICE_ADDRESS);
__u8 reg = I2C_REGISTER_ADDRESS & 0xff;
int i2c_read(){
unsigned char buf = reg;
if (write(fd, &buf, 1) != 1) {
LOG(logERROR,
("Warning: Unable to write read request to register %d\n", reg));
return -1;
}
// read and update value (but old value read out)
if (read(fd, &buf, 1) != 1) {
LOG(logERROR, ("Warning: Unable to read register %d\n", reg));
return -2;
}
// read again to read the updated value
if (read(fd, &buf, 1) != 1) {
LOG(logERROR, ("Warning: Unable to read register %d\n", reg));
return -2;
}
close(fd);
return buf;
int fd = i2c_open(I2C_DEVICE_FILE, I2C_DEVICE_ADDRESS);
__u8 reg = I2C_REGISTER_ADDRESS & 0xff;
unsigned char buf = reg;
if (write(fd, &buf, 1)!= 1){
LOG(logERROR, ("Warning: Unable to write read request to register %d\n", reg));
return -1;
}
//read and update value (but old value read out)
if(read(fd, &buf, 1) != 1){
LOG(logERROR, ("Warning: Unable to read register %d\n", reg));
return -2;
}
//read again to read the updated value
if(read(fd, &buf, 1) != 1){
LOG(logERROR, ("Warning: Unable to read register %d\n", reg));
return -2;
}
close(fd);
return buf;
}
int i2c_write(unsigned int value) {
__u8 val = value & 0xff;
int i2c_write(unsigned int value){
int fd = i2c_open(I2C_DEVICE_FILE, I2C_DEVICE_ADDRESS);
if (fd < 0)
return fd;
__u8 val = value & 0xff;
__u8 reg = I2C_REGISTER_ADDRESS & 0xff;
char buf[3];
buf[0] = reg;
buf[1] = val;
if (write(fd, buf, 2) != 2) {
LOG(logERROR,
("Warning: Unable to write %d to register %d\n", val, reg));
return -1;
}
int fd = i2c_open(I2C_DEVICE_FILE, I2C_DEVICE_ADDRESS);
if(fd < 0)
return fd;
close(fd);
return 0;
__u8 reg = I2C_REGISTER_ADDRESS & 0xff;
char buf[3];
buf[0] = reg;
buf[1] = val;
if (write(fd, buf, 2) != 2) {
LOG(logERROR, ("Warning: Unable to write %d to register %d\n",val, reg));
return -1;
}
close(fd);
return 0;
}
int main(int argc, char *argv[]) {
int fd = open(PORTNAME, O_RDWR | O_NOCTTY | O_SYNC);
if (fd < 0) {
LOG(logERROR, ("Warning: Unable to open port %s\n", PORTNAME));
return -1;
}
LOG(logINFO, ("opened port at %s\n", PORTNAME));
struct termios serial_conf;
// reset structure
memset(&serial_conf, 0, sizeof(serial_conf));
// control options
serial_conf.c_cflag = B2400 | CS8 | CREAD | CLOCAL;
// input options
serial_conf.c_iflag = IGNPAR;
// output options
serial_conf.c_oflag = 0;
// line options
serial_conf.c_lflag = ICANON;
// flush input
if (tcflush(fd, TCIOFLUSH) < 0) {
LOG(logERROR, ("Warning: error form tcflush %d\n", errno));
return 0;
}
// set new options for the port, TCSANOW:changes occur immediately without
// waiting for data to complete
if (tcsetattr(fd, TCSANOW, &serial_conf) < 0) {
LOG(logERROR, ("Warning: error form tcsetattr %d\n", errno));
return 0;
}
if (tcsetattr(fd, TCSAFLUSH, &serial_conf) < 0) {
LOG(logERROR, ("Warning: error form tcsetattr %d\n", errno));
return 0;
}
int ret = 0;
int n = 0;
int ival = 0;
char buffer[BUFFERSIZE];
memset(buffer, 0, BUFFERSIZE);
buffer[BUFFERSIZE - 1] = '\n';
LOG(logINFO, ("Ready...\n"));
int main(int argc, char* argv[]) {
while (ret != GOODBYE) {
memset(buffer, 0, BUFFERSIZE);
n = read(fd, buffer, BUFFERSIZE);
LOG(logDEBUG1, ("Received %d Bytes\n", n));
LOG(logINFO, ("Got message: '%s'\n", buffer));
int fd = open(PORTNAME, O_RDWR | O_NOCTTY | O_SYNC);
if(fd < 0){
LOG(logERROR, ("Warning: Unable to open port %s\n", PORTNAME));
return -1;
}
LOG(logINFO, ("opened port at %s\n",PORTNAME));
switch (buffer[0]) {
case '\0':
LOG(logINFO, ("Got Start (Detector restart)\n"));
break;
case 's':
LOG(logINFO, ("Got Start \n"));
break;
case 'p':
if (!sscanf(&buffer[1], "%d", &ival)) {
LOG(logERROR, ("Warning: cannot scan voltage value\n"));
break;
}
// ok/ fail
memset(buffer, 0, BUFFERSIZE);
buffer[BUFFERSIZE - 1] = '\n';
if (i2c_write(ival) < 0)
strcpy(buffer, "fail ");
else
strcpy(buffer, "success ");
LOG(logINFO, ("Sending: '%s'\n", buffer));
n = write(fd, buffer, BUFFERSIZE);
LOG(logDEBUG1, ("Sent %d Bytes\n", n));
break;
struct termios serial_conf;
// reset structure
memset(&serial_conf,0,sizeof(serial_conf));
// control options
serial_conf.c_cflag = B2400 | CS8 | CREAD | CLOCAL;
// input options
serial_conf.c_iflag = IGNPAR;
// output options
serial_conf.c_oflag = 0;
// line options
serial_conf.c_lflag = ICANON;
// flush input
if(tcflush(fd, TCIOFLUSH) < 0){
LOG(logERROR, ("Warning: error form tcflush %d\n", errno));
return 0;
}
// set new options for the port, TCSANOW:changes occur immediately without waiting for data to complete
if(tcsetattr(fd, TCSANOW, &serial_conf) < 0){
LOG(logERROR, ("Warning: error form tcsetattr %d\n", errno));
return 0;
}
case 'g':
ival = i2c_read();
// ok/ fail
memset(buffer, 0, BUFFERSIZE);
buffer[BUFFERSIZE - 1] = '\n';
if (ival < 0)
strcpy(buffer, "fail ");
else
strcpy(buffer, "success ");
n = write(fd, buffer, BUFFERSIZE);
LOG(logINFO, ("Sending: '%s'\n", buffer));
LOG(logDEBUG1, ("Sent %d Bytes\n", n));
// value
memset(buffer, 0, BUFFERSIZE);
buffer[BUFFERSIZE - 1] = '\n';
if (ival >= 0) {
LOG(logINFO, ("Sending: '%d'\n", ival));
sprintf(buffer, "%d ", ival);
n = write(fd, buffer, BUFFERSIZE);
LOG(logINFO, ("Sent %d Bytes\n", n));
} else
LOG(logERROR, ("%s\n", buffer));
break;
if(tcsetattr(fd, TCSAFLUSH, &serial_conf) < 0){
LOG(logERROR, ("Warning: error form tcsetattr %d\n", errno));
return 0;
}
case 'e':
printf("Exiting Program\n");
ret = GOODBYE;
break;
default:
LOG(logERROR, ("Unknown Command. buffer:'%s'\n", buffer));
break;
}
}
int ret = 0;
int n = 0;
int ival= 0;
char buffer[BUFFERSIZE];
memset(buffer,0,BUFFERSIZE);
buffer[BUFFERSIZE-1] = '\n';
LOG(logINFO, ("Ready...\n"));
close(fd);
printf("Goodbye Serial Communication for HV(9M)\n");
return 0;
while(ret != GOODBYE){
memset(buffer,0,BUFFERSIZE);
n = read(fd,buffer,BUFFERSIZE);
LOG(logDEBUG1, ("Received %d Bytes\n", n));
LOG(logINFO, ("Got message: '%s'\n",buffer));
switch(buffer[0]){
case '\0':
LOG(logINFO, ("Got Start (Detector restart)\n"));
break;
case 's':
LOG(logINFO, ("Got Start \n"));
break;
case 'p':
if (!sscanf(&buffer[1],"%d",&ival)){
LOG(logERROR, ("Warning: cannot scan voltage value\n"));
break;
}
// ok/ fail
memset(buffer,0,BUFFERSIZE);
buffer[BUFFERSIZE-1] = '\n';
if(i2c_write(ival)<0)
strcpy(buffer,"fail ");
else
strcpy(buffer,"success ");
LOG(logINFO, ("Sending: '%s'\n",buffer));
n = write(fd, buffer, BUFFERSIZE);
LOG(logDEBUG1, ("Sent %d Bytes\n", n));
break;
case 'g':
ival = i2c_read();
//ok/ fail
memset(buffer,0,BUFFERSIZE);
buffer[BUFFERSIZE-1] = '\n';
if(ival < 0)
strcpy(buffer,"fail ");
else
strcpy(buffer,"success ");
n = write(fd, buffer, BUFFERSIZE);
LOG(logINFO, ("Sending: '%s'\n",buffer));
LOG(logDEBUG1, ("Sent %d Bytes\n", n));
//value
memset(buffer,0,BUFFERSIZE);
buffer[BUFFERSIZE-1] = '\n';
if(ival >= 0){
LOG(logINFO, ("Sending: '%d'\n",ival));
sprintf(buffer,"%d ",ival);
n = write(fd, buffer, BUFFERSIZE);
LOG(logINFO, ("Sent %d Bytes\n", n));
}else LOG(logERROR, ("%s\n",buffer));
break;
case 'e':
printf("Exiting Program\n");
ret = GOODBYE;
break;
default:
LOG(logERROR, ("Unknown Command. buffer:'%s'\n",buffer));
break;
}
}
close(fd);
printf("Goodbye Serial Communication for HV(9M)\n");
return 0;
}

2552
slsDetectorServers/eigerDetectorServer/Beb.c Normal file → Executable file

File diff suppressed because it is too large Load Diff

114
slsDetectorServers/eigerDetectorServer/Beb.h Normal file → Executable file
View File

@ -1,46 +1,45 @@
#pragma once
#include "LocalLinkInterface.h"
#include "slsDetectorServer_defs.h"
#include <stdlib.h>
struct BebInfo {
unsigned int beb_number;
unsigned int serial_address;
char src_mac_1GbE[50];
char src_mac_10GbE[50];
char src_ip_1GbE[50];
char src_ip_10GbE[50];
unsigned int src_port_1GbE;
unsigned int src_port_10GbE;
struct BebInfo{
unsigned int beb_number;
unsigned int serial_address;
char src_mac_1GbE[50];
char src_mac_10GbE[50];
char src_ip_1GbE[50];
char src_ip_10GbE[50];
unsigned int src_port_1GbE;
unsigned int src_port_10GbE;
};
void BebInfo_BebInfo(struct BebInfo *bebInfo, unsigned int beb_num);
void BebInfo_BebDstInfo(struct BebInfo *bebInfo, unsigned int beb_num);
int BebInfo_SetSerialAddress(struct BebInfo *bebInfo, unsigned int add);
int BebInfo_SetHeaderInfo(
struct BebInfo *bebInfo, int ten_gig, char *src_mac, char *src_ip,
unsigned int
src_port); // src_port fixed 42000+beb_number or 52000 + beb_number);
unsigned int BebInfo_GetBebNumber(struct BebInfo *bebInfo);
unsigned int BebInfo_GetSerialAddress(struct BebInfo *bebInfo);
char *BebInfo_GetSrcMAC(struct BebInfo *bebInfo, int ten_gig);
char *BebInfo_GetSrcIP(struct BebInfo *bebInfo, int ten_gig);
unsigned int BebInfo_GetSrcPort(struct BebInfo *bebInfo, int ten_gig);
void BebInfo_Print(struct BebInfo *bebInfo);
void BebInfo_BebInfo(struct BebInfo* bebInfo, unsigned int beb_num);
void BebInfo_BebDstInfo(struct BebInfo* bebInfo, unsigned int beb_num);
int BebInfo_SetSerialAddress(struct BebInfo* bebInfo, unsigned int add);
int BebInfo_SetHeaderInfo(struct BebInfo* bebInfo, int ten_gig, char* src_mac, char* src_ip, unsigned int src_port);//src_port fixed 42000+beb_number or 52000 + beb_number);
unsigned int BebInfo_GetBebNumber(struct BebInfo* bebInfo);
unsigned int BebInfo_GetSerialAddress(struct BebInfo* bebInfo);
char* BebInfo_GetSrcMAC(struct BebInfo* bebInfo, int ten_gig);
char* BebInfo_GetSrcIP(struct BebInfo* bebInfo, int ten_gig);
unsigned int BebInfo_GetSrcPort(struct BebInfo* bebInfo, int ten_gig);
void BebInfo_Print(struct BebInfo* bebInfo);
void Beb_ClearBebInfos();
int Beb_InitBebInfos();
int Beb_CheckSourceStuffBebInfo();
unsigned int Beb_GetBebInfoIndex(unsigned int beb_numb);
void Beb_GetModuleConfiguration(int *master, int *top, int *normal);
int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay);
void Beb_SetTopVariable(int val);
int Beb_SetTop(enum TOPINDEX ind);
int Beb_SetMaster(enum MASTERINDEX ind);
int Beb_SetActivate(int enable);
int Beb_GetActivate(int *retval);
void Beb_GetModuleConfiguration(int* master, int* top, int* normal);
int Beb_IsTransmitting(int* retval, int tengiga, int waitForDelay);
int Beb_SetMasterViaSoftware();
int Beb_SetSlaveViaSoftware();
int Beb_Activate(int enable);
int Beb_GetActivate();
int Beb_Set32bitOverflow(int val);
int Beb_GetTenGigaFlowControl();
@ -52,47 +51,32 @@ int Beb_SetTransmissionDelayLeft(int value);
int Beb_GetTransmissionDelayRight();
int Beb_SetTransmissionDelayRight(int value);
int Beb_ResetToHardwareSettings();
u_int32_t Beb_GetFirmwareRevision();
u_int32_t Beb_GetFirmwareSoftwareAPIVersion();
void Beb_ResetFrameNumber();
int Beb_WriteTo(unsigned int index);
int Beb_SetMAC(char *mac, uint8_t *dst_ptr);
int Beb_SetIP(char *ip, uint8_t *dst_ptr);
int Beb_SetPortNumber(unsigned int port_number, uint8_t *dst_ptr);
int Beb_SetMAC(char* mac, uint8_t* dst_ptr);
int Beb_SetIP(char* ip, uint8_t* dst_ptr);
int Beb_SetPortNumber(unsigned int port_number, uint8_t* dst_ptr);
void Beb_AdjustIPChecksum(struct udp_header_type *ip);
int Beb_SetHeaderData(unsigned int beb_number, int ten_gig, char *dst_mac,
char *dst_ip, unsigned int dst_port);
int Beb_SetHeaderData1(char *src_mac, char *src_ip, unsigned int src_port,
char *dst_mac, char *dst_ip, unsigned int dst_port);
int Beb_SetHeaderData(unsigned int beb_number, int ten_gig, char* dst_mac, char* dst_ip, unsigned int dst_port);
int Beb_SetHeaderData1(char* src_mac, char* src_ip, unsigned int src_port, char* dst_mac, char* dst_ip, unsigned int dst_port);
void Beb_SwapDataFun(int little_endian, unsigned int n, unsigned int *d);
int Beb_SetByteOrder();
void Beb_Beb();
int Beb_SetBebSrcHeaderInfos(unsigned int beb_number, int ten_gig,
char *src_mac, char *src_ip,
unsigned int src_port);
int Beb_SetUpUDPHeader(unsigned int beb_number, int ten_gig,
unsigned int header_number, char *dst_mac, char *dst_ip,
unsigned int dst_port);
int Beb_SetBebSrcHeaderInfos(unsigned int beb_number, int ten_gig, char* src_mac, char* src_ip, unsigned int src_port);
int Beb_SetUpUDPHeader(unsigned int beb_number, int ten_gig, unsigned int header_number, char* dst_mac, char* dst_ip, unsigned int dst_port);
/*int Beb_SendMultiReadRequest(unsigned int beb_number, unsigned int
* left_right, int ten_gig, unsigned int dst_number, unsigned int npackets,
* unsigned int packet_size, int stop_read_when_fifo_empty=1);*/
int Beb_SendMultiReadRequest(unsigned int beb_number, unsigned int left_right,
int ten_gig, unsigned int dst_number,
unsigned int npackets, unsigned int packet_size,
int stop_read_when_fifo_empty);
/*int Beb_SendMultiReadRequest(unsigned int beb_number, unsigned int left_right, int ten_gig, unsigned int dst_number, unsigned int npackets, unsigned int packet_size, int stop_read_when_fifo_empty=1);*/
int Beb_SendMultiReadRequest(unsigned int beb_number, unsigned int left_right, int ten_gig, unsigned int dst_number, unsigned int npackets, unsigned int packet_size, int stop_read_when_fifo_empty);
int Beb_StopAcquisition();
int Beb_SetUpTransferParameters(short the_bit_mode);
/*int Beb_RequestNImages(unsigned int beb_number, unsigned int left_right, int
* ten_gig, unsigned int dst_number, unsigned int nimages, int
* test_just_send_out_packets_no_wait=0); //all images go to the same
* destination!*/
int Beb_RequestNImages(unsigned int beb_number, int ten_gig,
unsigned int dst_number, unsigned int nimages,
int test_just_send_out_packets_no_wait);
/*int Beb_RequestNImages(unsigned int beb_number, unsigned int left_right, int ten_gig, unsigned int dst_number, unsigned int nimages, int test_just_send_out_packets_no_wait=0); //all images go to the same destination!*/
int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_number, unsigned int nimages, int test_just_send_out_packets_no_wait);
int Beb_Test(unsigned int beb_number);
@ -101,15 +85,17 @@ int Beb_GetBebFPGATemp();
void Beb_SetDetectorNumber(uint32_t detid);
int Beb_SetQuad(int value);
int Beb_GetQuad();
int *Beb_GetDetectorPosition();
int* Beb_GetDetectorPosition();
int Beb_SetDetectorPosition(int pos[]);
int Beb_SetStartingFrameNumber(uint64_t value);
int Beb_GetStartingFrameNumber(uint64_t *retval, int tengigaEnable);
int Beb_GetStartingFrameNumber(uint64_t* retval, int tengigaEnable);
void Beb_SetReadNLines(int value);
uint16_t Beb_swap_uint16(uint16_t val);
int Beb_open(u_int32_t **csp0base, u_int32_t offset);
u_int32_t Beb_Read32(u_int32_t *baseaddr, u_int32_t offset);
u_int32_t Beb_Write32(u_int32_t *baseaddr, u_int32_t offset, u_int32_t data);
void Beb_close(int fd, u_int32_t *csp0base);
uint16_t Beb_swap_uint16( uint16_t val);
int Beb_open(u_int32_t** csp0base, u_int32_t offset);
u_int32_t Beb_Read32 (u_int32_t* baseaddr, u_int32_t offset);
u_int32_t Beb_Write32 (u_int32_t* baseaddr, u_int32_t offset, u_int32_t data);
void Beb_close(int fd,u_int32_t* csp0base);

View File

@ -5,7 +5,7 @@ set(src
../slsDetectorServer/src/communication_funcs.c
../slsDetectorServer/src/communication_funcs_UDP.c
../slsDetectorServer/src/common.c
../slsDetectorServer/src/sharedMemory.c
../slsDetectorServer/src/communication_virtual.c
)
include_directories(
@ -28,7 +28,7 @@ target_compile_definitions(eigerDetectorServerMaster_virtual
)
target_link_libraries(eigerDetectorServerMaster_virtual
PUBLIC pthread rt slsProjectCSettings
PUBLIC pthread rt slsProjectCWarnings
)
set_target_properties(eigerDetectorServerMaster_virtual PROPERTIES
@ -58,7 +58,7 @@ target_compile_definitions(eigerDetectorServerSlaveTop_virtual
)
target_link_libraries(eigerDetectorServerSlaveTop_virtual
PUBLIC pthread rt slsProjectCSettings
PUBLIC pthread rt
)
set_target_properties(eigerDetectorServerSlaveTop_virtual PROPERTIES
@ -86,7 +86,7 @@ target_compile_definitions(eigerDetectorServerSlaveBottom_virtual
)
target_link_libraries(eigerDetectorServerSlaveBottom_virtual
PUBLIC pthread rt slsProjectCSettings
PUBLIC pthread rt
)
set_target_properties(eigerDetectorServerSlaveBottom_virtual PROPERTIES
@ -96,7 +96,3 @@ set_target_properties(eigerDetectorServerSlaveBottom_virtual PROPERTIES
install(TARGETS eigerDetectorServerSlaveBottom_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
configure_file(config_eiger.txt ${CMAKE_BINARY_DIR}/bin/config_eiger.txt COPYONLY)

3723
slsDetectorServers/eigerDetectorServer/FebControl.c Normal file → Executable file

File diff suppressed because it is too large Load Diff

181
slsDetectorServers/eigerDetectorServer/FebControl.h Normal file → Executable file
View File

@ -1,103 +1,141 @@
#pragma once
#include "FebInterface.h"
#include "slsDetectorServer_defs.h"
#include <netinet/in.h>
// setup
struct Module{
unsigned int module_number;
int top_address_valid;
unsigned int top_left_address;
unsigned int top_right_address;
int bottom_address_valid;
unsigned int bottom_left_address;
unsigned int bottom_right_address;
unsigned int idelay_top[4]; //ll,lr,rl,ll
unsigned int idelay_bottom[4]; //ll,lr,rl,ll
float high_voltage;
int* top_dac;
int* bottom_dac;
};
void Module_Module(struct Module* mod,unsigned int number, unsigned int address_top);
void Module_ModuleBottom(struct Module* mod,unsigned int number, unsigned int address_bottom);
void Module_Module1(struct Module* mod,unsigned int number, unsigned int address_top, unsigned int address_bottom);
unsigned int Module_GetModuleNumber(struct Module* mod);
int Module_TopAddressIsValid(struct Module* mod);
unsigned int Module_GetTopBaseAddress(struct Module* mod);
unsigned int Module_GetTopLeftAddress(struct Module* mod) ;
unsigned int Module_GetTopRightAddress(struct Module* mod);
unsigned int Module_GetBottomBaseAddress(struct Module* mod);
int Module_BottomAddressIsValid(struct Module* mod);
unsigned int Module_GetBottomLeftAddress(struct Module* mod);
unsigned int Module_GetBottomRightAddress(struct Module* mod);
unsigned int Module_SetTopIDelay(struct Module* mod,unsigned int chip,unsigned int value);
unsigned int Module_GetTopIDelay(struct Module* mod,unsigned int chip) ;
unsigned int Module_SetBottomIDelay(struct Module* mod,unsigned int chip,unsigned int value);
unsigned int Module_GetBottomIDelay(struct Module* mod,unsigned int chip);
float Module_SetHighVoltage(struct Module* mod,float value);
float Module_GetHighVoltage(struct Module* mod);
int Module_SetTopDACValue(struct Module* mod,unsigned int i, int value);
int Module_GetTopDACValue(struct Module* mod,unsigned int i);
int Module_SetBottomDACValue(struct Module* mod,unsigned int i, int value);
int Module_GetBottomDACValue(struct Module* mod,unsigned int i);
void Feb_Control_activate(int activate);
int Feb_Control_IsBottomModule();
int Feb_Control_GetModuleNumber();
void Feb_Control_PrintModuleList();
int Feb_Control_GetModuleIndex(unsigned int module_number, unsigned int* module_index);
int Feb_Control_CheckModuleAddresses(struct Module* m);
int Feb_Control_AddModule(unsigned int module_number, unsigned int top_address);
int Feb_Control_AddModule1(unsigned int module_number, int top_enable, unsigned int top_address, unsigned int bottom_address, int half_module);
int Feb_Control_GetDACNumber(char* s, unsigned int* n);
int Feb_Control_SendDACValue(unsigned int dst_num, unsigned int ch, unsigned int* value);
int Feb_Control_VoltageToDAC(float value, unsigned int* digital, unsigned int nsteps, float vmin, float vmax);
float Feb_Control_DACToVoltage(unsigned int digital,unsigned int nsteps,float vmin,float vmax);
int Feb_Control_SendIDelays(unsigned int dst_num, int chip_lr, unsigned int channels, unsigned int ndelay_units);
int Feb_Control_SetStaticBits();
int Feb_Control_SetStaticBits1(unsigned int the_static_bits);
int Feb_Control_SendBitModeToBebServer();
unsigned int Feb_Control_ConvertTimeToRegister(float time_in_sec);
unsigned int Feb_Control_AddressToAll();
int Feb_Control_SetCommandRegister(unsigned int cmd);
int Feb_Control_GetDAQStatusRegister(unsigned int dst_address, unsigned int* ret_status);
int Feb_Control_StartDAQOnlyNWaitForFinish(int sleep_time_us);
int Feb_Control_ResetChipCompletely();
int Feb_Control_ResetChipPartially();
void Feb_Control_FebControl();
int Feb_Control_Init(int master, int normal, int module_num);
int Feb_Control_Init(int master, int top, int normal, int module_num);
int Feb_Control_OpenSerialCommunication();
void Feb_Control_CloseSerialCommunication();
int Feb_Control_CheckSetup();
unsigned int Feb_Control_AddressToAll();
int Feb_Control_SetCommandRegister(unsigned int cmd);
int Feb_Control_SetStaticBits();
int Feb_Control_SetStaticBits1(unsigned int the_static_bits);
int Feb_Control_SetInTestModeVariable(int on);
int Feb_Control_GetTestModeVariable();
// idelays
int Feb_Control_SetIDelays(unsigned int ndelay_units);
int Feb_Control_SetIDelays1(unsigned int chip_pos, unsigned int ndelay_units);
int Feb_Control_SendIDelays(unsigned int dst_num, int chip_lr,
unsigned int channels, unsigned int ndelay_units);
// high voltage
unsigned int Feb_Control_GetNModules();
unsigned int Feb_Control_GetNHalfModules();
int Feb_Control_SetHighVoltage(int value);
int Feb_Control_GetHighVoltage(int *value);
int Feb_Control_GetHighVoltage(int* value);
int Feb_Control_SendHighVoltage(int dacvalue);
int Feb_Control_ReceiveHighVoltage(unsigned int *value);
// dacs
int Feb_Control_VoltageToDAC(float value, unsigned int *digital,
unsigned int nsteps, float vmin, float vmax);
float Feb_Control_DACToVoltage(unsigned int digital, unsigned int nsteps,
float vmin, float vmax);
int Feb_Control_SetDAC(unsigned int ch, int value);
int Feb_Control_ReceiveHighVoltage(unsigned int* value);
// trimbits
int Feb_Control_SetTrimbits(unsigned int *trimbits, int top);
int Feb_Control_SetIDelays(unsigned int module_num, unsigned int ndelay_units);
int Feb_Control_SetIDelays1(unsigned int module_num, unsigned int chip_pos, unsigned int ndelay_units);
int Feb_Control_DecodeDACString(char* dac_str, unsigned int* module_index, int* top, int* bottom, unsigned int* dac_ch);
int Feb_Control_SetDAC(char* s, int value, int is_a_voltage_mv);
int Feb_Control_GetDAC(char* s, int* ret_value, int voltage_mv);
int Feb_Control_GetDACName(unsigned int dac_num,char* s);
int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int* trimbits, int top);
unsigned int* Feb_Control_GetTrimbits();
int Feb_Control_SaveAllTrimbitsTo(int value, int top);
unsigned int *Feb_Control_GetTrimbits();
// acquisition
int Feb_Control_AcquisitionInProgress();
int Feb_Control_AcquisitionStartedBit();
int Feb_Control_WaitForStartedFlag(int sleep_time_us, int prev_flag);
int Feb_Control_WaitForFinishedFlag(int sleep_time_us);
int Feb_Control_GetDAQStatusRegister(unsigned int dst_address,
unsigned int *ret_status);
int Feb_Control_StartDAQOnlyNWaitForFinish(int sleep_time_us);
int Feb_Control_Reset();
int Feb_Control_ResetChipCompletely();
int Feb_Control_ResetChipPartially();
int Feb_Control_SendBitModeToBebServer();
unsigned int Feb_Control_ConvertTimeToRegister(float time_in_sec);
int Feb_Control_PrepareForAcquisition();
void Feb_Control_PrintAcquisitionSetup();
int Feb_Control_StartAcquisition();
int Feb_Control_StopAcquisition();
int Feb_Control_SoftwareTrigger();
// parameters
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
unsigned int Feb_Control_GetDynamicRange();
int Feb_Control_SetReadoutSpeed(unsigned int readout_speed);
int Feb_Control_SetReadoutMode(unsigned int readout_mode);
int Feb_Control_SetTriggerMode(unsigned int trigger_mode);
int Feb_Control_SetExternalEnableMode(int use_external_enable, int polarity);
int Feb_Control_AcquisitionInProgress();
int Feb_Control_AcquisitionStartedBit();
int Feb_Control_WaitForFinishedFlag(int sleep_time_us);
int Feb_Control_WaitForStartedFlag(int sleep_time_us, int prev_flag);
void Feb_Control_PrintAcquisitionSetup();
int Feb_Control_SetNExposures(unsigned int n_images);
unsigned int Feb_Control_GetNExposures();
int Feb_Control_SetExposureTime(double the_exposure_time_in_sec);
double Feb_Control_GetExposureTime();
int64_t Feb_Control_GetExposureTime_in_nsec();
int Feb_Control_SetSubFrameExposureTime(
int64_t the_subframe_exposure_time_in_10nsec);
int Feb_Control_SetSubFrameExposureTime(int64_t the_subframe_exposure_time_in_10nsec);
int64_t Feb_Control_GetSubFrameExposureTime();
int Feb_Control_SetSubFramePeriod(int64_t the_subframe_period_in_10nsec);
int64_t Feb_Control_GetSubFramePeriod();
int Feb_Control_SetExposurePeriod(double the_exposure_period_in_sec);
double Feb_Control_GetExposurePeriod();
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
unsigned int Feb_Control_GetDynamicRange();
int Feb_Control_SetReadoutSpeed(unsigned int readout_speed); //0 was default, 0->full,1->half,2->quarter or 3->super_slow
int Feb_Control_SetReadoutMode(unsigned int readout_mode); ///0 was default,0->parallel,1->non-parallel,2-> safe_mode
int Feb_Control_SetTriggerMode(unsigned int trigger_mode, int polarity);//0 and 1 was default,
int Feb_Control_SetExternalEnableMode(int use_external_enable, int polarity);//0 and 1 was default,
int Feb_Control_SetInTestModeVariable(int on);
int Feb_Control_GetTestModeVariable();
void Feb_Control_Set_Counter_Bit(int value);
int Feb_Control_Get_Counter_Bit();
int Feb_Control_SetInterruptSubframe(int val);
int Feb_Control_GetInterruptSubframe();
int Feb_Control_SetTop(enum TOPINDEX ind, int left, int right);
void Feb_Control_SetMasterVariable(int val);
int Feb_Control_SetMaster(enum MASTERINDEX ind);
int Feb_Control_SetQuad(int val);
int Feb_Control_SetReadNLines(int value);
int Feb_Control_GetReadNLines();
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval);
// pulsing
int Feb_Control_Pulse_Pixel(int npulses, int x, int y);
int Feb_Control_Pulse_Pixel(int npulses,int x, int y);
int Feb_Control_PulsePixelNMove(int npulses, int inc_x_pos, int inc_y_pos);
int Feb_Control_Shift32InSerialIn(unsigned int value_to_shift_in);
int Feb_Control_SendTokenIn();
int Feb_Control_ClockRowClock(unsigned int ntimes);
int Feb_Control_PulseChip(int npulses);
// rate correction
int64_t Feb_Control_Get_RateTable_Tau_in_nsec();
int64_t Feb_Control_Get_RateTable_Period_in_nsec();
int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec);
@ -106,8 +144,19 @@ int Feb_Control_GetRateCorrectionVariable();
void Feb_Control_SetRateCorrectionVariable(int activate_rate_correction);
int Feb_Control_PrintCorrectedValues();
// adcs
int Feb_Control_GetLeftFPGATemp();
int Feb_Control_GetRightFPGATemp();
int64_t Feb_Control_GetMeasuredPeriod();
int64_t Feb_Control_GetSubMeasuredPeriod();
int Feb_Control_SoftwareTrigger();
int Feb_Control_SetInterruptSubframe(int val);
int Feb_Control_GetInterruptSubframe();
int Feb_Control_SetQuad(int val);
int Feb_Control_SetReadNLines(int value);
int Feb_Control_GetReadNLines();
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
int Feb_Control_ReadRegister(uint32_t offset, uint32_t* retval);

312
slsDetectorServers/eigerDetectorServer/FebInterface.c Normal file → Executable file
View File

@ -1,231 +1,195 @@
#include "FebInterface.h"
#include "LocalLinkInterface.h"
#include "clogger.h"
#include "xparameters.h"
#include "clogger.h"
#include <unistd.h>
struct LocalLinkInterface ll_local, *ll;
unsigned int Feb_Interface_nfebs;
unsigned int *Feb_Interface_feb_numb;
int Feb_Interface_send_ndata;
unsigned int Feb_Interface_send_buffer_size;
unsigned int *Feb_Interface_send_data_raw;
unsigned int *Feb_Interface_send_data;
struct LocalLinkInterface ll_local,* ll;
unsigned int Feb_Interface_nfebs;
unsigned int* Feb_Interface_feb_numb;
int Feb_Interface_send_ndata;
unsigned int Feb_Interface_send_buffer_size;
unsigned int* Feb_Interface_send_data_raw;
unsigned int* Feb_Interface_send_data;
int Feb_Interface_recv_ndata;
unsigned int Feb_Interface_recv_buffer_size;
unsigned int* Feb_Interface_recv_data_raw;
unsigned int* Feb_Interface_recv_data;
int Feb_Interface_recv_ndata;
unsigned int Feb_Interface_recv_buffer_size;
unsigned int *Feb_Interface_recv_data_raw;
unsigned int *Feb_Interface_recv_data;
void Feb_Interface_FebInterface() {
ll = &ll_local;
Feb_Interface_nfebs = 0;
Feb_Interface_feb_numb = 0;
ll = &ll_local;
Feb_Interface_nfebs = 0;
Feb_Interface_feb_numb = 0;
Feb_Interface_send_ndata = 0;
Feb_Interface_send_buffer_size = 1026;
Feb_Interface_send_data_raw =
malloc((Feb_Interface_send_buffer_size + 1) * sizeof(unsigned int));
Feb_Interface_send_data = &Feb_Interface_send_data_raw[1];
Feb_Interface_send_ndata = 0;
Feb_Interface_send_buffer_size = 1026;
Feb_Interface_send_data_raw = malloc((Feb_Interface_send_buffer_size+1) * sizeof(unsigned int));
Feb_Interface_send_data = &Feb_Interface_send_data_raw[1];
Feb_Interface_recv_ndata = 0;
Feb_Interface_recv_buffer_size = 1026;
Feb_Interface_recv_data_raw =
malloc((Feb_Interface_recv_buffer_size + 1) * sizeof(unsigned int));
Feb_Interface_recv_data = &Feb_Interface_recv_data_raw[1];
Feb_Interface_recv_ndata = 0;
Feb_Interface_recv_buffer_size = 1026;
Feb_Interface_recv_data_raw = malloc((Feb_Interface_recv_buffer_size+1) * sizeof(unsigned int));
Feb_Interface_recv_data = &Feb_Interface_recv_data_raw[1];
Local_LocalLinkInterface1(ll,XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT_BASEADDR);
Local_LocalLinkInterface1(
ll, XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT_BASEADDR);
}
void Feb_Interface_SetAddress(unsigned int leftAddr, unsigned int rightAddr) {
if (Feb_Interface_feb_numb)
free(Feb_Interface_feb_numb);
Feb_Interface_nfebs = 2;
Feb_Interface_feb_numb = malloc(2 * sizeof(unsigned int));
Feb_Interface_feb_numb[0] = leftAddr;
Feb_Interface_feb_numb[1] = rightAddr;
void Feb_Interface_SendCompleteList(unsigned int n,unsigned int* list) {
unsigned int i;
if (Feb_Interface_feb_numb) free(Feb_Interface_feb_numb);
Feb_Interface_nfebs = n;
Feb_Interface_feb_numb = malloc(n * sizeof(unsigned int));
for(i=0;i<n;i++) Feb_Interface_feb_numb[i] = list[i];
}
int Feb_Interface_WriteTo(unsigned int ch) {
if (ch > 0xfff)
return 0;
if (ch>0xfff) return 0;
LOG(logDEBUG1, ("FIW ch %d\n", ch));
LOG(logDEBUG1, ("FIW ch %d\n", ch));
Feb_Interface_send_data_raw[0] = 0x8fff0000;
if (Local_Write(ll, 4, Feb_Interface_send_data_raw) != 4)
return 0;
Feb_Interface_send_data_raw[0] = 0x8fff0000;
if (Local_Write(ll,4,Feb_Interface_send_data_raw)!=4) return 0;
Feb_Interface_send_data_raw[0] = 0x90000000 | (ch << 16);
if (Local_Write(ll, 4, Feb_Interface_send_data_raw) != 4)
return 0;
Feb_Interface_send_data_raw[0] = 0x90000000 | (ch<<16);
if (Local_Write(ll,4,Feb_Interface_send_data_raw)!=4) return 0;
Feb_Interface_send_data_raw[0] = 0xc0000000;
return ((Feb_Interface_send_ndata + 1) * 4 ==
Local_Write(ll, (Feb_Interface_send_ndata + 1) * 4,
Feb_Interface_send_data_raw));
Feb_Interface_send_data_raw[0] = 0xc0000000;
return ((Feb_Interface_send_ndata+1)*4==Local_Write(ll,(Feb_Interface_send_ndata+1)*4,Feb_Interface_send_data_raw));
}
int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys) {
if (ch >= 0xfff)
return 0;
unsigned int t;
if (ch>=0xfff) return 0;
Feb_Interface_recv_data_raw[0] = 0xa0000000 | (ch << 16);
Local_Write(ll, 4, Feb_Interface_recv_data_raw);
usleep(20);
Feb_Interface_recv_data_raw[0] = 0xa0000000 | (ch<<16);
Local_Write(ll,4,Feb_Interface_recv_data_raw);
usleep(20);
Feb_Interface_recv_ndata = -1;
for (unsigned int t = 0; t < ntrys; t++) {
if ((Feb_Interface_recv_ndata =
Local_Read(ll, Feb_Interface_recv_buffer_size * 4,
Feb_Interface_recv_data_raw) /
4) > 0) {
Feb_Interface_recv_ndata--;
break;
}
usleep(1000);
}
Feb_Interface_recv_ndata=-1;
for(t=0;t<ntrys;t++) {
if ((Feb_Interface_recv_ndata=Local_Read(ll,Feb_Interface_recv_buffer_size*4,Feb_Interface_recv_data_raw)/4)>0) {
Feb_Interface_recv_ndata--;
break;
}
usleep(1000);
}
return (Feb_Interface_recv_ndata >= 0);
return (Feb_Interface_recv_ndata>=0);
}
int Feb_Interface_SetByteOrder() {
Feb_Interface_send_data_raw[0] = 0x8fff0000;
if (Local_Write(ll, 4, Feb_Interface_send_data_raw) != 4)
return 0;
Feb_Interface_send_ndata = 2;
Feb_Interface_send_data[0] = 0;
Feb_Interface_send_data[1] = 0;
unsigned int dst = 0xff;
for (unsigned int i = 0; i < Feb_Interface_nfebs; i++)
dst = (dst | Feb_Interface_feb_numb[i]);
int passed = Feb_Interface_WriteTo(dst);
if (!passed) {
LOG(logERROR, ("Could not set byte order in Feb Interface\n"));
}
return passed;
Feb_Interface_send_data_raw[0] = 0x8fff0000;
if (Local_Write(ll,4,Feb_Interface_send_data_raw)!=4) return 0;
Feb_Interface_send_ndata = 2;
Feb_Interface_send_data[0] = 0;
Feb_Interface_send_data[1] = 0;
unsigned int i;
unsigned int dst = 0xff;
for(i=0;i<Feb_Interface_nfebs;i++) dst = (dst | Feb_Interface_feb_numb[i]);
int passed = Feb_Interface_WriteTo(dst);
return passed;
}
int Feb_Interface_ReadRegister(unsigned int sub_num, unsigned int reg_num,
unsigned int *value_read) {
return Feb_Interface_ReadRegisters(sub_num, 1, &reg_num, value_read);
int Feb_Interface_ReadRegister(unsigned int sub_num, unsigned int reg_num,unsigned int* value_read) {
return Feb_Interface_ReadRegisters(sub_num,1,&reg_num,value_read);
}
int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads,
unsigned int *reg_nums,
unsigned int *values_read) {
nreads &= 0x3ff;
if (!nreads || nreads > Feb_Interface_send_buffer_size - 2)
return 0;
Feb_Interface_send_ndata = nreads + 2;
Feb_Interface_send_data[0] = 0x20000000 | nreads << 14;
int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads, unsigned int* reg_nums,unsigned int* values_read) {
//here cout<<"Reading Register ...."<<endl;
unsigned int i;
nreads &= 0x3ff;
if (!nreads||nreads>Feb_Interface_send_buffer_size-2) return 0;
for (unsigned int i = 0; i < nreads; i++)
Feb_Interface_send_data[i + 1] = reg_nums[i];
Feb_Interface_send_data[nreads + 1] = 0;
Feb_Interface_send_ndata = nreads+2;
Feb_Interface_send_data[0] = 0x20000000 | nreads << 14;
if (!Feb_Interface_WriteTo(sub_num) ||
!Feb_Interface_ReadFrom(sub_num, 20) ||
Feb_Interface_recv_ndata != (int)(nreads + 2))
return 0;
for(i=0;i<nreads;i++) Feb_Interface_send_data[i+1]=reg_nums[i];
Feb_Interface_send_data[nreads+1] = 0;
for (unsigned int i = 0; i < nreads; i++)
values_read[i] = Feb_Interface_recv_data[i + 1];
if (!Feb_Interface_WriteTo(sub_num)||!Feb_Interface_ReadFrom(sub_num,20)||Feb_Interface_recv_ndata!=(int)(nreads+2)) return 0;
return 1;
for(i=0;i<nreads;i++) values_read[i] = Feb_Interface_recv_data[i+1];
return 1;
}
int Feb_Interface_WriteRegister(unsigned int sub_num, unsigned int reg_num,
unsigned int value, int wait_on,
unsigned int wait_on_address) {
return Feb_Interface_WriteRegisters(sub_num, 1, &reg_num, &value, &wait_on,
&wait_on_address);
int Feb_Interface_WriteRegister(unsigned int sub_num, unsigned int reg_num,unsigned int value, int wait_on, unsigned int wait_on_address) {
return Feb_Interface_WriteRegisters(sub_num,1,&reg_num,&value,&wait_on,&wait_on_address);
}
int Feb_Interface_WriteRegisters(unsigned int sub_num, unsigned int nwrites,
unsigned int *reg_nums, unsigned int *values,
int *wait_ons,
unsigned int *wait_on_addresses) {
nwrites &= 0x3ff; // 10 bits
if (!nwrites || 2 * nwrites > Feb_Interface_send_buffer_size - 2)
return 0;
int Feb_Interface_WriteRegisters(unsigned int sub_num, unsigned int nwrites, unsigned int* reg_nums, unsigned int* values, int* wait_ons, unsigned int* wait_on_addresses) {
unsigned int i;
nwrites &= 0x3ff; //10 bits
if (!nwrites||2*nwrites>Feb_Interface_send_buffer_size-2) return 0;
// cout<<"Write register : "<<this<<" "<<s_num<<" "<<nwrites<<"
// "<<reg_nums<<" "<<values<<" "<<wait_ons<<" "<<wait_on_addresses<<endl;
Feb_Interface_send_ndata = 2 * nwrites + 2;
Feb_Interface_send_data[0] = 0x80000000 | nwrites << 14;
Feb_Interface_send_data[2 * nwrites + 1] = 0;
//cout<<"Write register : "<<this<<" "<<s_num<<" "<<nwrites<<" "<<reg_nums<<" "<<values<<" "<<wait_ons<<" "<<wait_on_addresses<<endl;
Feb_Interface_send_ndata = 2*nwrites+2;
Feb_Interface_send_data[0] = 0x80000000 | nwrites << 14;
Feb_Interface_send_data[2*nwrites+1] = 0;
for (unsigned int i = 0; i < nwrites; i++)
Feb_Interface_send_data[2 * i + 1] = 0x3fff & reg_nums[i];
for (unsigned int i = 0; i < nwrites; i++)
Feb_Interface_send_data[2 * i + 2] = values[i];
// wait on busy data(28), address of busy flag data(27 downto 14)
if (wait_ons && wait_on_addresses)
for (unsigned int i = 0; i < nwrites; i++)
Feb_Interface_send_data[2 * i + 1] |=
(wait_ons[i] << 28 | (0x3fff & wait_on_addresses[i]) << 14);
for(i=0;i<nwrites;i++) Feb_Interface_send_data[2*i+1] = 0x3fff&reg_nums[i];
for(i=0;i<nwrites;i++) Feb_Interface_send_data[2*i+2] = values[i];
// wait on busy data(28), address of busy flag data(27 downto 14)
if (wait_ons&&wait_on_addresses) for(i=0;i<nwrites;i++) Feb_Interface_send_data[2*i+1] |= (wait_ons[i]<<28 | (0x3fff&wait_on_addresses[i])<<14);
if (!Feb_Interface_WriteTo(sub_num))
return 0;
if (!Feb_Interface_WriteTo(sub_num)) return 0;
return 1;
return 1;
}
int Feb_Interface_WriteMemoryInLoops(unsigned int sub_num, unsigned int mem_num,
unsigned int start_address,
unsigned int nwrites,
unsigned int *values) {
unsigned int max_single_packet_size = 352;
int passed = 1;
unsigned int n_to_send = max_single_packet_size;
unsigned int ndata_sent = 0;
unsigned int ndata_countdown = nwrites;
while (ndata_countdown > 0) {
n_to_send = ndata_countdown < max_single_packet_size
? ndata_countdown
: max_single_packet_size;
if (!Feb_Interface_WriteMemory(sub_num, mem_num, start_address,
n_to_send, &(values[ndata_sent]))) {
passed = 0;
break;
}
ndata_countdown -= n_to_send;
ndata_sent += n_to_send;
start_address += n_to_send;
usleep(500); // 500 works
}
return passed;
int Feb_Interface_WriteMemoryInLoops(unsigned int sub_num, unsigned int mem_num, unsigned int start_address, unsigned int nwrites, unsigned int *values) {
unsigned int max_single_packet_size = 352;
int passed=1;
unsigned int n_to_send = max_single_packet_size;
unsigned int ndata_sent = 0;
unsigned int ndata_countdown = nwrites;
while(ndata_countdown>0) {
n_to_send = ndata_countdown<max_single_packet_size ? ndata_countdown:max_single_packet_size;
if (!Feb_Interface_WriteMemory(sub_num,mem_num,start_address,n_to_send,&(values[ndata_sent]))) {passed=0; break;}
ndata_countdown-=n_to_send;
ndata_sent +=n_to_send;
start_address +=n_to_send;
usleep(500);//500 works
}
return passed;
}
int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num,
unsigned int start_address, unsigned int nwrites,
unsigned int *values) {
// -1 means write to all
mem_num &= 0x3f;
start_address &= 0x3fff;
nwrites &= 0x3ff;
if (!nwrites || nwrites > Feb_Interface_send_buffer_size - 2) {
LOG(logERROR, ("invalid nwrites:%d\n", nwrites));
return 0;
} //*d-1026
int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num, unsigned int start_address, unsigned int nwrites, unsigned int *values) {
// -1 means write to all
unsigned int i;
mem_num &= 0x3f;
start_address &= 0x3fff;
nwrites &= 0x3ff;
if (!nwrites||nwrites>Feb_Interface_send_buffer_size-2) {
LOG(logERROR, ("invalid nwrites:%d\n",nwrites));
return 0;
}//*d-1026
Feb_Interface_send_ndata = nwrites + 2; //*d-1026
Feb_Interface_send_data[0] =
0xc0000000 | mem_num << 24 | nwrites << 14 |
start_address; // cmd -> write to memory, nwrites, mem number, start
// address
Feb_Interface_send_data[nwrites + 1] = 0;
for (unsigned int i = 0; i < nwrites; i++)
Feb_Interface_send_data[i + 1] = values[i];
Feb_Interface_send_ndata = nwrites+2;//*d-1026
Feb_Interface_send_data[0] = 0xc0000000 | mem_num << 24 | nwrites << 14 | start_address; //cmd -> write to memory, nwrites, mem number, start address
Feb_Interface_send_data[nwrites+1] = 0;
for(i=0;i<nwrites;i++) Feb_Interface_send_data[i+1] = values[i];
if (!Feb_Interface_WriteTo(sub_num))
return 0;
return 1;
if (!Feb_Interface_WriteTo(sub_num)) return 0;
return 1;
}

28
slsDetectorServers/eigerDetectorServer/FebInterface.h Normal file → Executable file
View File

@ -3,24 +3,12 @@
int Feb_Interface_WriteTo(unsigned int ch);
int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys);
void Feb_Interface_FebInterface();
void Feb_Interface_SetAddress(unsigned int leftAddr, unsigned int rightAddr);
void Feb_Interface_SendCompleteList(unsigned int n,unsigned int* list);
int Feb_Interface_SetByteOrder();
int Feb_Interface_ReadRegister(unsigned int sub_num, unsigned int reg_num,
unsigned int *value_read);
int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads,
unsigned int *reg_nums,
unsigned int *values_read);
int Feb_Interface_WriteRegister(unsigned int sub_num, unsigned int reg_num,
unsigned int value, int wait_on,
unsigned int wait_on_address);
int Feb_Interface_WriteRegisters(unsigned int sub_num, unsigned int nwrites,
unsigned int *reg_nums, unsigned int *values,
int *wait_ons,
unsigned int *wait_on_addresses);
int Feb_Interface_WriteMemoryInLoops(unsigned int sub_num, unsigned int mem_num,
unsigned int start_address,
unsigned int nwrites,
unsigned int *values);
int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num,
unsigned int start_address, unsigned int nwrites,
unsigned int *values);
int Feb_Interface_ReadRegister(unsigned int sub_num, unsigned int reg_num,unsigned int* value_read);
int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads, unsigned int* reg_nums,unsigned int* values_read);
int Feb_Interface_WriteRegister(unsigned int sub_num, unsigned int reg_num,unsigned int value, int wait_on, unsigned int wait_on_address);
int Feb_Interface_WriteRegisters(unsigned int sub_num, unsigned int nwrites, unsigned int* reg_nums, unsigned int* values, int* wait_ons, unsigned int* wait_on_addresses);
int Feb_Interface_WriteMemoryInLoops(unsigned int sub_num, unsigned int mem_num, unsigned int start_address, unsigned int nwrites, unsigned int *values);
int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num, unsigned int start_address, unsigned int nwrites, unsigned int *values);

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