mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-18 07:47:12 +02:00
Compare commits
325 Commits
2020.06.08
...
2020.08.10
Author | SHA1 | Date | |
---|---|---|---|
27b2a607c8 | |||
8e2bd17704 | |||
0e011a77b5 | |||
d56b2134ef | |||
8af1183220 | |||
78fdf5b60a | |||
132043a70d | |||
b51290d0fe | |||
0369413201 | |||
04d6644753 | |||
949c6a81ce | |||
aa0c36713c | |||
4aee113dda | |||
6c3f0d18ec | |||
7b6f4d0b5b | |||
6db5954d21 | |||
69d9680034 | |||
bbf8ab4b88 | |||
79f010a438 | |||
ab05da4d0e | |||
6e67ff9f90 | |||
321ed13659 | |||
de39310a9c | |||
e1de2f72ba | |||
f6172f9b9e | |||
5616d4aeeb | |||
857aa47ee7 | |||
bb3951c201 | |||
380b062216 | |||
a70d4e1e5d | |||
3301a80d99 | |||
ce25b3018c | |||
d25f9093d5 | |||
d24edd52e1 | |||
7b1ede32b1 | |||
4174d193b4 | |||
0514f00552 | |||
8631f5e2b0 | |||
540a203139 | |||
57c3cb0849 | |||
e82bcafb76 | |||
3cdf98b230 | |||
acc43842eb | |||
63a5b4d61f | |||
3083260b28 | |||
6e4b7f5bd7 | |||
ddd562f8b5 | |||
e2f1fd076a | |||
6a084e99b4 | |||
885b22eca8 | |||
bea4ba131a | |||
09fa8a3ba5 | |||
874092a9d0 | |||
5c4d355d57 | |||
4702a76235 | |||
fd503e84af | |||
1211d02428 | |||
ec27d35d6d | |||
ea2e7839d0 | |||
d5b893e452 | |||
68c0f76bd9 | |||
4eaa9588ba | |||
459a715b9c | |||
40d0430f2e | |||
0cb38a9c51 | |||
caef8c111c | |||
02d5cf14e4 | |||
bd221fefe5 | |||
c683f62452 | |||
1177e54602 | |||
85c958facf | |||
87c33c8e81 | |||
7492f7dbfa | |||
c2b586a333 | |||
d31839e80e | |||
b47f751d66 | |||
aa52028690 | |||
6f5635a402 | |||
5b9c7c4105 | |||
98ffe350f3 | |||
7dfeb987db | |||
7899c5faef | |||
17fb497774 | |||
e9c03c6eaf | |||
f497177022 | |||
984b43545e | |||
327218cb2b | |||
cdfd3934ee | |||
4cebefbc55 | |||
24c4cd8d84 | |||
f358492e09 | |||
86d3fc7e55 | |||
89da671ae2 | |||
24e44d56fe | |||
b13d04dd89 | |||
d19530b3d4 | |||
5ba3a414d6 | |||
54ad92a2bf | |||
74a7ca9b71 | |||
6846939f92 | |||
99ec7f0046 | |||
df3ae7f409 | |||
410f38c804 | |||
91652df5b1 | |||
02bda7c533 | |||
9204a56ff7 | |||
3ec637601d | |||
dc33f1a5da | |||
879b2c8864 | |||
b1a4723028 | |||
bad7fd3906 | |||
21c8b77e2c | |||
097acf8086 | |||
799f540d71 | |||
a412b465c6 | |||
bb2f70beb5 | |||
096e94562a | |||
9063a8d4ed | |||
b1d3cbb25e | |||
1fefc001f9 | |||
e8556abbe7 | |||
f8da057735 | |||
df0b52604f | |||
f792d59682 | |||
98d061a032 | |||
2bb9629f14 | |||
cf2e1c1dfc | |||
cb54bf6225 | |||
3b0f68c3c4 | |||
5faf3c7336 | |||
3ddb264875 | |||
1fb19aeae2 | |||
ad297e9c51 | |||
beb6afe101 | |||
78a6896ae9 | |||
9ea8882c05 | |||
4cf5e81971 | |||
2fa5e7d00c | |||
af17fb9f61 | |||
07869134d6 | |||
8b9a69e1f1 | |||
023924c4cc | |||
01d00164e5 | |||
e6c8ba0e88 | |||
37fc69b297 | |||
e1e265bd49 | |||
b46809e1c0 | |||
396d82bd62 | |||
e7ff96fe8d | |||
07a292af95 | |||
e4433a99a5 | |||
28fb1023fa | |||
c4374e623e | |||
da2f12072f | |||
918da2402f | |||
94e9591974 | |||
a76ed6d8db | |||
b7cb341ee3 | |||
546bef5e5a | |||
97ddfed819 | |||
2d68b61f00 | |||
3bdf02a23c | |||
f70d28b175 | |||
d076fda59a | |||
a3062a5e00 | |||
c6921bf954 | |||
ae9499047b | |||
8dd9bb6ea3 | |||
9a284f75c3 | |||
3e87cfa5c1 | |||
6136eabee2 | |||
67bb0dff1a | |||
ca298580f3 | |||
d7f490701b | |||
7752b86d97 | |||
35dbc3813d | |||
a096434864 | |||
ab4d89aa70 | |||
c67b7aab4d | |||
293fda0c7a | |||
bef35eb3d6 | |||
eea013d492 | |||
890a641304 | |||
1e0160d655 | |||
42b7f6fa7c | |||
4a1943216b | |||
a23504c9c4 | |||
4db3473e32 | |||
8c1c696f64 | |||
39bbc5c688 | |||
28b3fb4101 | |||
05059c1176 | |||
95089b5faa | |||
7c48ef8931 | |||
0dc062e6d3 | |||
9b1b878f95 | |||
e23a8e7da2 | |||
a228ae0773 | |||
9787c6a385 | |||
4d1fad04c3 | |||
c5a9ff3024 | |||
25ec47dfff | |||
93c5505285 | |||
a656668d73 | |||
3156e6f50e | |||
f224b7dadf | |||
ccf54f29b6 | |||
ef564e382c | |||
e571f7bb3e | |||
aacc61b058 | |||
7d128585e1 | |||
279986d77c | |||
ff729fb43f | |||
488e0230ba | |||
c04793a9d7 | |||
f1cbf49449 | |||
285ef30439 | |||
75e9d63341 | |||
21a79752e2 | |||
5780cabe8d | |||
cec26f81e1 | |||
0c045f0faa | |||
19e40cf0e6 | |||
902366fede | |||
ee67c28711 | |||
cfe9a431f9 | |||
524c86de49 | |||
05ef55b258 | |||
bcd217b6fe | |||
4ca46e4123 | |||
7333909f6b | |||
ba7f54744b | |||
cd677e4d97 | |||
4240ea57d4 | |||
692ade6c17 | |||
4cbe354396 | |||
39d5a7db26 | |||
ae88af2a72 | |||
f592d21570 | |||
35f95e603e | |||
5c42792580 | |||
301073e60b | |||
159b0a0367 | |||
f6911c4238 | |||
1d53dc65cd | |||
9d3bbc0a68 | |||
801f2c4559 | |||
da2ce03e1d | |||
f366e9ae6f | |||
5bf6b7a338 | |||
991acc7c07 | |||
b40e481da9 | |||
12b40a44a2 | |||
f14c2d06a5 | |||
0cc547c2de | |||
489fccb25c | |||
7c23f1e42c | |||
f66345d128 | |||
e7da4ae862 | |||
8adddfb083 | |||
7cc05ead89 | |||
ebc164aaa6 | |||
a57f7943ee | |||
db8616fcb3 | |||
55af974c4e | |||
1f3fd010a7 | |||
cf9ec3de0d | |||
b5781e1f9b | |||
e09fc8cd2b | |||
48b8116849 | |||
f5759921d2 | |||
b5b50a2061 | |||
a7d2a89c50 | |||
e80bc905d6 | |||
c6b664b25b | |||
f078e6147d | |||
7609a2bda4 | |||
d5ae9a22f4 | |||
ffb1a59df0 | |||
889e926479 | |||
19bd39eece | |||
f28b41b130 | |||
9a80975929 | |||
efc247f46f | |||
c0e8e44b41 | |||
82a6383466 | |||
0289f22a0d | |||
6a919ece02 | |||
d0baa4c7b9 | |||
6dccf48759 | |||
b128837538 | |||
3c46204b14 | |||
807a588c4b | |||
fb5b2133f5 | |||
6f2413fd5d | |||
5412569e77 | |||
0375e80b42 | |||
569d0464e7 | |||
cc8549e6cb | |||
bcb5b8047b | |||
8c9341836b | |||
ad36ee2ba2 | |||
afa71895e7 | |||
62449b81ad | |||
6794d58db1 | |||
3775ff302e | |||
e76da84c9f | |||
24af0ee578 | |||
e0b86799ae | |||
5a7451e29e | |||
e0c056be09 | |||
cf0681a23c | |||
24168d5e32 | |||
7c2949f372 | |||
5a7eeb3d76 | |||
64a94b962a | |||
ab72d342c9 | |||
200186ddde | |||
7388bb4aa7 | |||
9c26cd5552 | |||
5f91198328 | |||
265e96d675 | |||
f5160b0978 | |||
2a2bb5f63a | |||
e306c39e1d |
60
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
60
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
---
|
||||
name: Bug Report
|
||||
about: Create a report to help us improve
|
||||
title: New Bug Report
|
||||
labels: action - Bug, priority - Unclassified, status - Pending
|
||||
template: bug_report.md
|
||||
---
|
||||
|
||||
<!-- Check an option by - [x], Uncheck an option by - [ ] -->
|
||||
<!-- Please preview to see your option has been selected -->
|
||||
|
||||
<!-- Please fill out everything with an *, as this report will be discarded otherwise -->
|
||||
|
||||
##### *Distribution:
|
||||
- [x] RHEL7
|
||||
- [ ] RHEL6
|
||||
- [ ] Fedora
|
||||
- [ ] Other
|
||||
|
||||
##### *Detector type:
|
||||
- [x] Not applicable
|
||||
- [ ] Eiger
|
||||
- [ ] Jungfrau
|
||||
- [ ] Mythen3
|
||||
- [ ] Gotthard2
|
||||
- [ ] Gotthard
|
||||
- [ ] Moench
|
||||
- [ ] ChipTestBoard
|
||||
|
||||
##### *Software Package Version:
|
||||
- [ ] developer
|
||||
- [ ] 4.2.0
|
||||
- [ ] 4.1.1
|
||||
<!-- If others, please describe -->
|
||||
|
||||
##### Priority:
|
||||
- [ ] Super Low
|
||||
- [ ] Low
|
||||
- [ ] Medium
|
||||
- [ ] High
|
||||
- [ ] Super High
|
||||
|
||||
##### *Describe the bug
|
||||
<!-- A clear and concise description of what the bug is -->
|
||||
|
||||
##### Expected behavior
|
||||
<!-- A clear and concise description of what you expected to happen. -->
|
||||
|
||||
##### To Reproduce
|
||||
<!-- Steps to reproduce the behavior: -->
|
||||
<!-- 1. Go to '...' -->
|
||||
<!-- 2. Click on '....' -->
|
||||
<!-- 3. Scroll down to '....' -->
|
||||
<!-- 4. See error -->
|
||||
|
||||
##### Screenshots
|
||||
<!-- If applicable, add screenshots to help explain your problem. -->
|
||||
|
||||
##### Additional context
|
||||
<!-- Add any other context about the problem here. -->
|
44
.github/ISSUE_TEMPLATE/change_request.md
vendored
Normal file
44
.github/ISSUE_TEMPLATE/change_request.md
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
---
|
||||
name: Change Request
|
||||
about: Suggest a change to an existing feature
|
||||
title: New Change Request
|
||||
labels: action - Change, priority - Unclassified, status - Pending
|
||||
template: change_request.md
|
||||
---
|
||||
|
||||
<!-- Check an option by - [x], Uncheck an option by - [ ] -->
|
||||
<!-- Please preview to see your option has been selected -->
|
||||
|
||||
<!-- Please fill out everything with an *, as this report will be discarded otherwise -->
|
||||
|
||||
##### *Detector type:
|
||||
- [x] Not applicable
|
||||
- [ ] Eiger
|
||||
- [ ] Jungfrau
|
||||
- [ ] Mythen3
|
||||
- [ ] Gotthard2
|
||||
- [ ] Gotthard
|
||||
- [ ] Moench
|
||||
- [ ] ChipTestBoard
|
||||
|
||||
##### *Software Package Version:
|
||||
- [ ] developer
|
||||
- [ ] 4.2.0
|
||||
- [ ] 4.1.1
|
||||
<!-- If others, please describe -->
|
||||
|
||||
##### Priority:
|
||||
- [ ] Super Low
|
||||
- [ ] Low
|
||||
- [ ] Medium
|
||||
- [ ] High
|
||||
- [ ] Super High
|
||||
|
||||
##### *State the change request:
|
||||
<!-- A clear and concise description of what the change is to an existing feature -->
|
||||
|
||||
##### Is your change request related to a problem. Please describe:
|
||||
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
|
||||
|
||||
##### Additional context:
|
||||
<!-- Add any other context about the feature here -->
|
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1 @@
|
||||
blank_issues_enabled: false
|
50
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
50
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
---
|
||||
name: Feature Request
|
||||
about: Suggest a feature
|
||||
title: New Feature Request
|
||||
labels: action - Enhancement, priority - Unclassified, status - Pending
|
||||
template: feature_request.md
|
||||
---
|
||||
|
||||
<!-- Check an option by - [x], Uncheck an option by - [ ] -->
|
||||
<!-- Please preview to see your option has been selected -->
|
||||
|
||||
<!-- Please fill out everything with an *, as this report will be discarded otherwise -->
|
||||
|
||||
##### *Detector type:
|
||||
- [x] Not applicable
|
||||
- [ ] Eiger
|
||||
- [ ] Jungfrau
|
||||
- [ ] Mythen3
|
||||
- [ ] Gotthard2
|
||||
- [ ] Gotthard
|
||||
- [ ] Moench
|
||||
- [ ] ChipTestBoard
|
||||
|
||||
##### *Software Package Version:
|
||||
- [ ] developer
|
||||
- [ ] 4.2.0
|
||||
- [ ] 4.1.1
|
||||
<!-- If others, please describe -->
|
||||
|
||||
##### Priority:
|
||||
- [ ] Super Low
|
||||
- [ ] Low
|
||||
- [ ] Medium
|
||||
- [ ] High
|
||||
- [ ] Super High
|
||||
|
||||
##### *State the feature:
|
||||
<!-- A clear and concise description of what the feature is -->
|
||||
|
||||
##### Is your feature request related to a problem. Please describe:
|
||||
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
|
||||
|
||||
##### Describe the solution you'd like:
|
||||
<!-- A clear and concise description of what you want to happen -->
|
||||
|
||||
##### Describe alternatives you've considered:
|
||||
<!-- A clear and concise description of any alternative solutions or features you've considered -->
|
||||
|
||||
##### Additional context:
|
||||
<!-- Add any other context about the feature here -->
|
@ -46,6 +46,7 @@ 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/"
|
||||
@ -96,6 +97,7 @@ target_compile_options(slsProjectWarnings INTERFACE
|
||||
-Wformat=2
|
||||
-Wredundant-decls
|
||||
# -Wconversion
|
||||
-Wvla
|
||||
-Wdouble-promotion
|
||||
-Werror=return-type
|
||||
|
||||
@ -229,6 +231,11 @@ 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}")
|
||||
|
29
cmk.sh
29
cmk.sh
@ -12,6 +12,7 @@ TESTS=0
|
||||
SIMULATOR=0
|
||||
CTBGUI=0
|
||||
MANUALS=0
|
||||
MOENCHZMQ=0
|
||||
|
||||
|
||||
CLEAN=0
|
||||
@ -20,7 +21,7 @@ CMAKE_PRE=""
|
||||
CMAKE_POST=""
|
||||
|
||||
usage() { echo -e "
|
||||
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [m] [-h] [-d <HDF5 directory>] [-j] <Number of threads>
|
||||
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [m] [-h] [z] [-d <HDF5 directory>] [-j] <Number of threads>
|
||||
-[no option]: only make
|
||||
-c: Clean
|
||||
-b: Builds/Rebuilds CMake files normal mode
|
||||
@ -36,6 +37,7 @@ Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [m] [-h] [-d <HDF5 director
|
||||
-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
|
||||
@ -71,7 +73,7 @@ For rebuilding only certain sections
|
||||
|
||||
" ; exit 1; }
|
||||
|
||||
while getopts ":bpchd:j:trgeisum" opt ; do
|
||||
while getopts ":bpchd:j:trgeisumz" opt ; do
|
||||
case $opt in
|
||||
b)
|
||||
echo "Building of CMake files Required"
|
||||
@ -130,6 +132,10 @@ while getopts ":bpchd:j:trgeisum" opt ; do
|
||||
echo "Compiling Manuals"
|
||||
MANUALS=1
|
||||
;;
|
||||
z)
|
||||
echo "Compiling Moench Zmq Processor"
|
||||
MOENCHZMQ=1
|
||||
;;
|
||||
u)
|
||||
echo "Compiling Options: Chip Test Gui"
|
||||
CTBGUI=1
|
||||
@ -210,6 +216,12 @@ 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 "
|
||||
@ -259,13 +271,20 @@ 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
|
||||
|
||||
|
||||
|
||||
|
@ -66,4 +66,10 @@ 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")
|
||||
|
@ -21,7 +21,7 @@ print(sys.path)
|
||||
# -- Project information -----------------------------------------------------
|
||||
|
||||
project = 'slsDetectorPackage'
|
||||
copyright = '2019, PSD Detector Group'
|
||||
copyright = '2020, PSD Detector Group'
|
||||
author = 'PSD Detector Group'
|
||||
version = '@PROJECT_VERSION@'
|
||||
|
||||
|
@ -42,7 +42,7 @@ The documentation that you are reading now is built with
|
||||
|
||||
* Doxygen (to extract C++ classes etc.)
|
||||
* Breathe (Sphinx plugin to handle doxygen xml)
|
||||
* Sphinx
|
||||
* Sphinx with sphinx_rtd_theme
|
||||
|
||||
-----------------------
|
||||
Packaged in libs/
|
||||
|
@ -1,9 +1,5 @@
|
||||
|
||||
Installation
|
||||
==============================================
|
||||
|
||||
Build from source using CMake
|
||||
---------------------------------
|
||||
|
||||
.. note ::
|
||||
|
||||
@ -13,17 +9,54 @@ Build from source using CMake
|
||||
without being communicated. If absolute stability of the API is needed please
|
||||
use one of the release versions.
|
||||
|
||||
.. warning ::
|
||||
|
||||
Before building from source make sure that you have the
|
||||
:doc:`dependencies <../dependencies>` installed. If installing using conda, conda will
|
||||
manage the dependencies.
|
||||
|
||||
|
||||
|
||||
Installation
|
||||
==============================================
|
||||
|
||||
Build from source using CMake
|
||||
---------------------------------
|
||||
|
||||
Note that on some systems, for example RH7, cmake v3+ is available under the cmake3 alias.
|
||||
It is also required to clone with the option --recursive to get the git submodules used
|
||||
in the package.
|
||||
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
git clone https://github.com/slsdetectorgroup/slsDetectorPackage.git
|
||||
git clone --recursive https://github.com/slsdetectorgroup/slsDetectorPackage.git
|
||||
mkdir build && cd build
|
||||
cmake ../slsDetectorPackage -DCMAKE_INSTALL_PREFIX=/your/install/path
|
||||
make -j12
|
||||
make -j12 #or whatever number of cores you are using to build
|
||||
make install
|
||||
|
||||
The easiest way to configure options is to use the ccmake utility.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
#from the build directory
|
||||
ccmake .
|
||||
|
||||
|
||||
Install binaries using conda
|
||||
--------------------------------
|
||||
|
||||
Conda is not only useful to manage python environments but can also
|
||||
be used as a user space package manager.
|
||||
|
||||
We have three different packages available:
|
||||
|
||||
* **slsdetlib**, shared libraries and command line utilities
|
||||
* **slsdetgui**, GUI
|
||||
* **slsdet**, Python bindings
|
||||
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
#Add channels for dependencies and our library
|
||||
@ -32,14 +65,19 @@ Install binaries using conda
|
||||
conda config --set channel_priority strict
|
||||
|
||||
#cerate an environment with our library, then activate
|
||||
conda create -n myenv slsdetlib=2020.03.18.dev2
|
||||
codna activate myenv
|
||||
conda create -n myenv slsdetlib=2020.07.23.dev0
|
||||
conda activate myenv
|
||||
|
||||
#ready to use
|
||||
sls_detector_get exptime
|
||||
etc ...
|
||||
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
#List available versions
|
||||
conda search slsdet
|
||||
|
||||
|
||||
Build from source on old distributions
|
||||
-----------------------------------------
|
||||
@ -66,4 +104,11 @@ is to use conda
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
conda create -n myenv python sphinx sphinx_rtd_theme
|
||||
conda create -n myenv python sphinx sphinx_rtd_theme
|
||||
|
||||
Then enable the option SLS_BUILD_DOCS to create the targets
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
make docs # generate API docs and build Sphinx RST
|
||||
make rst # rst only, saves time in case the API did not change
|
@ -4,9 +4,55 @@ Enums
|
||||
These enums are defined in slsDetectorDefs in the C++ package and
|
||||
exposed to Python through pybind11.
|
||||
|
||||
.. py:currentmodule:: sls_detector
|
||||
.. py:currentmodule:: slsdet
|
||||
|
||||
.. autoclass:: runStatus
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
.. autoclass:: detectorType
|
||||
:undoc-members:
|
||||
|
||||
.. autoclass:: frameDiscardPolicy
|
||||
:undoc-members:
|
||||
|
||||
.. autoclass:: fileFormat
|
||||
:undoc-members:
|
||||
|
||||
.. autoclass:: dimension
|
||||
:undoc-members:
|
||||
|
||||
.. autoclass:: externalSignalFlag
|
||||
:undoc-members:
|
||||
|
||||
.. autoclass:: timingMode
|
||||
:undoc-members:
|
||||
|
||||
.. autoclass:: dacIndex
|
||||
:undoc-members:
|
||||
|
||||
.. autoclass:: detectorSettings
|
||||
:undoc-members:
|
||||
|
||||
.. autoclass:: clockIndex
|
||||
:undoc-members:
|
||||
|
||||
.. autoclass:: speedLevel
|
||||
:undoc-members:
|
||||
|
||||
.. autoclass:: readoutMode
|
||||
:undoc-members:
|
||||
|
||||
.. autoclass:: masterFlags
|
||||
:undoc-members:
|
||||
|
||||
.. autoclass:: frameModeType
|
||||
:undoc-members:
|
||||
|
||||
.. autoclass:: detectorModeType
|
||||
:undoc-members:
|
||||
|
||||
.. autoclass:: burstMode
|
||||
:undoc-members:
|
||||
|
||||
.. autoclass:: timingSourceType
|
||||
:undoc-members:
|
@ -74,7 +74,7 @@ But lets start looking at the at the manual way:
|
||||
::
|
||||
|
||||
import time
|
||||
from sls_detector import Eiger
|
||||
from slsdet import Eiger
|
||||
d = Eiger()
|
||||
|
||||
n = 10
|
||||
@ -114,7 +114,7 @@ hang around until the main process exits.
|
||||
|
||||
import time
|
||||
from multiprocessing import Process
|
||||
from sls_detector import Eiger
|
||||
from slsdet import Eiger
|
||||
|
||||
def acquire():
|
||||
"""
|
||||
|
@ -1,6 +1,6 @@
|
||||
Receiver
|
||||
==============================================
|
||||
|
||||
.. doxygenclass:: slsReceiver
|
||||
.. doxygenclass:: Receiver
|
||||
:members:
|
||||
.. :undoc-members:
|
@ -12,7 +12,7 @@ hostname bchip007
|
||||
0:rx_udpip 129.129.202.98
|
||||
0:rx_hostname pc6898
|
||||
0:outdir /bigRAID/datadir_gotthard/rec_test_data
|
||||
0:vhighvoltage 120
|
||||
0:highvoltage 120
|
||||
master -1
|
||||
sync none
|
||||
outdir /bigRAID/datadir_gotthard/rec_test_data
|
||||
|
129
examples/gotthard2_veto_file.txt
Normal file
129
examples/gotthard2_veto_file.txt
Normal file
@ -0,0 +1,129 @@
|
||||
#Gain index ADU value (12 bit)
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
||||
1 3655
|
@ -1,132 +1,129 @@
|
||||
#G1 Energy #G2 Energy
|
||||
300 7000
|
||||
|
||||
#G0 pedestal G1 pedestal G2 pedestal G0 gain G1 gain G2 gain (for every channel) ADU
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
#G0 pedestal G1 pedestal G2 pedestal G0 gain G1 gain G2 gain #G1 Energy #G2 Energy
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
100 100 100 10 1 0.1 300 7000
|
||||
|
@ -6,12 +6,12 @@ hostname bchip074+bchip075+
|
||||
0:extsig:0 trigger_in_rising_edge
|
||||
0:rx_tcpport 1954
|
||||
0:rx_udpport 50001
|
||||
0:vhighvoltage 0
|
||||
0:highvoltage 0
|
||||
|
||||
1:extsig:0 trigger_in_rising_edge
|
||||
1:rx_tcpport 1955
|
||||
1:rx_udpport 50002
|
||||
1:vhighvoltage 0
|
||||
1:highvoltage 0
|
||||
|
||||
##############################################################################
|
||||
#########
|
||||
@ -53,5 +53,5 @@ settings veryhighgain
|
||||
exptime 0.000005
|
||||
period 0.0001
|
||||
|
||||
vhighvoltage 90
|
||||
highvoltage 90
|
||||
|
||||
|
@ -498,4 +498,4 @@ rx_jsonpara detectorMode analog
|
||||
|
||||
reg 0x5e 0x00010000
|
||||
#powerchip 1
|
||||
vhighvoltage 90
|
||||
highvoltage 90
|
||||
|
@ -6,7 +6,7 @@ hostname localhost
|
||||
rx_hostname localhost
|
||||
|
||||
#powerchip 1
|
||||
#vhighvoltage 200
|
||||
#highvoltage 200
|
||||
|
||||
#extsig:0 trigger_in_rising_edge
|
||||
#timing trigger
|
||||
|
@ -17,7 +17,7 @@ hostname bchip048+bchip052+
|
||||
rx_hostname pcmoench01
|
||||
|
||||
powerchip 1
|
||||
vhighvoltage 200
|
||||
highvoltage 200
|
||||
#extsig:0 trigger_in_rising_edge
|
||||
#timing trigger
|
||||
|
||||
|
@ -56,7 +56,7 @@ rx_discardpolicy discardpartial
|
||||
adcpipeline 15
|
||||
|
||||
powerchip 1
|
||||
vhighvoltage 90
|
||||
highvoltage 90
|
||||
|
||||
#adcreg 0x14 0x40
|
||||
|
||||
|
@ -19,7 +19,7 @@ hostname bchip007+bchip009+
|
||||
0:rx_udpip 10.1.1.1
|
||||
0:rx_hostname 129.129.202.134
|
||||
0:outdir /data/speedt
|
||||
0:vhighvoltage 120
|
||||
0:highvoltage 120
|
||||
|
||||
|
||||
#1:hostname bchip009
|
||||
@ -37,7 +37,7 @@ hostname bchip007+bchip009+
|
||||
1:rx_udpip 10.1.2.1
|
||||
1:rx_hostname 129.129.202.134
|
||||
1:outdir /data/speedt
|
||||
1:vhighvoltage 120
|
||||
1:highvoltage 120
|
||||
|
||||
|
||||
master -1
|
||||
|
@ -99,7 +99,7 @@ If one desires to set the zmqport manually, he offset has to be taken into accou
|
||||
|
||||
{\tt{slsMultiReceiver}} uses two or more receivers in one single terminal: {\tt{./slsMultiReceiver startTCPPort numReceivers withCallback}}, where startTCPPort assumes the other ports are consecutively increased.
|
||||
|
||||
The command {\tt{r\_framesperfile}} sets the number of frames written in the same file. By default now it is 10000. It can be changes. It needs to be lowered particularly if one wants to parallelize the following conversion of the files.
|
||||
The command {\tt{r\_framesperfile}} (\tt{\textcolor{red}{rx\_framesperfile}}) sets the number of frames written in the same file. By default now it is 10000. It can be changes. It needs to be lowered particularly if one wants to parallelize the following conversion of the files.
|
||||
|
||||
|
||||
\subsection{Mandatory setup - Client}
|
||||
@ -122,7 +122,23 @@ To do that:
|
||||
sls_detector_put 0-config mydetector.config
|
||||
\end{verbatim}
|
||||
|
||||
In the config file, if client, receiver and detector are using \textbf{1GbE} the following lines are mandatory (see slsDetectorsPackage/examples/eiger\_1Gb.config):
|
||||
In the config file, if client, receiver and detector are using \textbf{1GbE} the following lines are mandatory (see slsDetectorsPackage/examples/eiger\_1Gb.config). It has been adapted to the the new 5.0 major release change:
|
||||
\begin{verbatim}
|
||||
detsize 1024 512 #detector geometry, long side of the module first
|
||||
hostname beb059+beb058+ #1Gb detector hostname for controls
|
||||
#1Gb receiver pc hostname to be inserted immediately and tcp\_ports to be stated immediately
|
||||
rx_hostname x12sa-vcons:1991+pc1875:1992+
|
||||
0:udp_dstport 50011 #udp port first quadrant, first halfmodule
|
||||
0:udp_dstport2 50012 #udp port second quadrant, first halfmodule
|
||||
1:udp_dstport 50013 #udp port first quadrant, second halfmodule
|
||||
1:udp_dstport2 50014 #udp port second quadrant, second halfmodule
|
||||
0:udp_srcip 129.129.202.237
|
||||
0:udp_dstip auto
|
||||
1:udp_srcip 129.129.202.236
|
||||
1:udp_dstip auto
|
||||
fpath /sls/X12SA/data/x12saop/Data10/Eiger0.5M
|
||||
\end{verbatim}
|
||||
In the old 3.x and 4.x release it was:
|
||||
\begin{verbatim}
|
||||
detsizechan 1024 512 #detector geometry, long side of the module first
|
||||
hostname beb059+beb058+ #1Gb detector hostname for controls
|
||||
@ -172,24 +188,25 @@ configuremac 0
|
||||
rx_udpmac xx:xx:...
|
||||
\end{verbatim}
|
||||
|
||||
Now we will give general communication commands. Commands with a diffent name in the \textcolor{red}{5.x} realease will be highlighted in \textcolor{red}{red}.
|
||||
|
||||
One can configure all the detector settings in a parameter file {\tt{setup.det}}, which is loaded by doing:
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-parameters setup.det
|
||||
\end{verbatim}
|
||||
Note that the parameter file for any realease before 4.1.1 has not the possibility to understand parameters to be set differently for different half modules, i.e. {\tt{0:txndelay\_left xxxxx},\tt{1:txndelay\_left yyyyy}}.
|
||||
|
||||
In the case of \E, the proper bias voltage of the sensor has to be setup, i.e. the {\tt{setup.det}} file needs to contain the line {\tt{vhighvoltage 150}}. Other detector functionality, which are rarely changed can be setup here.
|
||||
In the case of \E, the proper bias voltage of the sensor has to be setup, i.e. the {\tt{setup.det}} file needs to contain the line {\tt{highvoltage 150}}. Other detector functionality, which are rarely changed can be setup here.
|
||||
Other important settings that are configured in the {\tt{setup.det}} file are:
|
||||
\begin{itemize}
|
||||
\item {\tt{tengiga 0/1}}, which sets whether the detector is enabled to send data through the 1~or the 10~Gb Ethernet.
|
||||
\item {\tt{flags parallel/nonparallel}}, which sets whether the detector is set in parallel acquisition and readout or in sequential mode. This changes the readout time of the chip and affects the frame rate capability (faster is {\tt{parallel}}, with higher noise but needed when the frame rate is $>2$~kHz.
|
||||
\item {\tt{flags parallel/nonparallel}} or {\tt{\textcolor{red}{parallel 1/0}}}, which sets whether the detector is set in parallel acquisition and readout or in sequential mode. This changes the readout time of the chip and affects the frame rate capability (faster is {\tt{parallel}}).
|
||||
\item {\tt{dr 32/16/8/4}} sets the detector in autosumming mode (32 bit counter or not autosumming, 12 bit out of the chip). This is strictly connected to what is required for the readout clock of chip. See next point.
|
||||
\item {\tt{clkdivider 0/1/2}}. Changes the readout clock: 200, 100, 50~MHz (also referred to as full, half, quarter speed). Note that autosumming mode ({\tt{dr 32}} only works at {clkdivider 2}=quarter speed). By selecting Refer to readout timing specifications in~section\ref{timing} for how to set the detector.
|
||||
\item {\tt{clkdivider 0/1/2}} or {\tt{\textcolor{red}{speed full\_speed/half\_speed/quart\_speed}}}. Changes the readout clock: 200, 100, 50~MHz (also referred to as full, half, quarter speed). Note that autosumming mode ({\tt{dr 32}} only works at \tt{clkdivider 2}=\tt{quart\_speed}). By selecting Refer to readout timing specifications in~section\ref{timing} for how to set the detector.
|
||||
\item {\tt{flags continuous/storeinram}}. Allows to take frame continuously or storing them on memory. Users should use the {\tt{continuous}} flags. Enabling the {\tt{stroreinram}} flag makes the data to be sent out all at the end of the acquisition. Refer to readout timing specifications in section~\ref{timing} for how to set the detector. Examples will be given in section~\ref{}.
|
||||
\end{itemize}
|
||||
|
||||
One should notice that, by default, by choosing the option {\tt{dr 32}}, then the software automatically sets the detector to {\tt{clkdivider 2}}. By choosing the option {\tt{dr 16}}, the software automatically sets the detector to {\tt{clkdivider 1}}. One needs to choose {\tt{clkdivider 0}} after setting the {\tt{dr 16}} option to have the fastest frame rate.
|
||||
We would recommend expert users (beamline people) to write their parameters file for the users.
|
||||
One should notice that, by default, by choosing the option {\tt{dr 32}}, then the software automatically sets the detector to {\tt{clkdivider 2}} ({\tt{\textcolor{red}{quart\_speed}}}). By choosing the option {\tt{dr 16}}, the software automatically sets the detector to {\tt{clkdivider 1}} ({\tt{\textcolor{red}{speed quart\_speed}}}). From release 5.x,
|
||||
|
||||
\section{API versioning} \label{api}
|
||||
The eigerDetectorServer running on the boards has a versioning API scheme that will make it crash if used with a wrong firmware.
|
||||
@ -210,10 +227,18 @@ Killing and starting the server on the boards allows you to check the firmware v
|
||||
|
||||
\section{Setting up the threshold}
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-settingsdir /path
|
||||
sls_detector_put 0-trimen N xxxx yyyy zzzz
|
||||
sls_detector_put 0-settings standard
|
||||
sls_detector_put 0-threshold energy_in_eV standard
|
||||
\end{verbatim}
|
||||
or in \textcolor{red}{5.x}:
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-settingspath /path}
|
||||
sls_detector_put 0-trimen N xxxx yyyy zzzz}
|
||||
sls_detector_put 0-threshold energy_in_eV standard
|
||||
\end{verbatim}
|
||||
|
||||
The first line requires to specify how many ({\tt{N}}) and at which energies in eV {\{tt{xxxx}}, {\tt{yyyy}}, {\tt{zzzz}} and so on) trimmed files were generated (to allow for an interpolation). This line should normally be included into the {\tt{mydetector.config}} file and should be set for you by one of the detector group.
|
||||
NORMALLY, in this new calibration scheme, only {\tt{settings standard}} will be provided to you, unless specific cases to be discussed.
|
||||
The threshold at 6000 eV , for example would be set as:{\tt{sls\_detector\_put 0-threshold 6000 standard}}.
|
||||
@ -267,12 +292,13 @@ sls_detector_get receiver
|
||||
|
||||
There is a more complex way of performing an acquisition, that is useful for debugging and in case one wants a non blocking behavior:
|
||||
|
||||
You can then reset to zero the number of frames caught, then start the receiver and the detector:
|
||||
You can then reset to zero the number of frames caught (in releases<5.0), then start the receiver and the detector:
|
||||
\begin{enumerate}
|
||||
\item {\tt{sls\_detector\_put 0-resetframescaught 0}}
|
||||
\item {\tt{sls\_detector\_put 0-receiver start}}
|
||||
\item {\tt{sls\_detector\_put 0-status start}}
|
||||
\end{enumerate}
|
||||
In release \textcolor{red}{5.0} it is not needed to reset the frames caughts.
|
||||
|
||||
You can poll the detector status using:
|
||||
\begin{verbatim}
|
||||
@ -347,8 +373,11 @@ col : 257 pixels
|
||||
\end{verbatim}
|
||||
|
||||
\section{Readout timing- maximum frame rate}\label{timing}
|
||||
IMPORTANT: to have faster readout and smaller dead time, one can configure {\tt{clkdivider}}, i.e. the speed at which the data are read, i.e. 200/100/50~MHz for {\tt{clkdivider 0/1/2}} and the dead time between frames through {\tt{flags parallel}}, i.e. acquire and read at the same time or acquire and then read out.
|
||||
The configuration of this timing variables allows to achieve different frame rates. NOTE THAT IN EIGER, WHATEVER YOU DO, THE FRAME RATE LIMITATIONS COME FROM THE NETWORK BOTTLENECK AS THE HARDWARE GOES FASTER THAN THE DATA OUT.
|
||||
IMPORTANT: to have faster readout and smaller dead time, one can configure {\tt{clkdivider}}, i.e. the {\tt{textcolor}{red}{speed} at which the data are read, i.e. 200/100/50~MHz for {\tt{clkdivider 0/1/2}} ({\tt{
|
||||
\textcolor{red}{speed full\_speed/half\_speed/quart\_speed}}) and the dead time between frames through {\tt{flags parallel}} or {\tt{\textcolor{red}{parallel 1}}}, i.e. acquire and read at the same time or acquire and then read out.
|
||||
The configuration of this timing variables allows to achieve different frame rates. NOTE THAT IN EIGER, WHATEVER YOU DO, THE FRAME RATE LIMITATIONS COME FROM THE NETWORK BOTTLENECK AS THE HARDWARE GOES FASTER THAN THE DATA OUT. WE recconmmend using the detector in \tt{dr 4/8/16}, \tt{\textcolor{red}{speed full\_speed}}, \tt{parallel 1} or \tt{dr 32}, \tt{\textcolor{red}{speed quart\_speed}}, \tt{parallel 1. All those options are now the defaults options starting from version 5.x.
|
||||
|
||||
|
||||
|
||||
In the case of REAL CONTINUOUS readout, i.e. continuous acquire and readout from the boards (independent on how the chip is set), the continuous frame rates are listed in table~\ref{tcont}. The time to send out the frame out of the board
|
||||
\begin{table}
|
||||
@ -360,16 +389,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{10240} & 98 & 105/128\\
|
||||
10 & 4 & \textbf{7813} & 98 & 105/128\\
|
||||
\hline
|
||||
10 & 8 & \textbf{5120} & 196 & 210/250\\
|
||||
10 & 8 & \textbf{4000} & 196 & 210/250\\
|
||||
\hline
|
||||
10 & 16 & \textbf{2560} & 391 & 420/490\\
|
||||
10 & 16 & \textbf{2000} & 391 & 420/490\\
|
||||
\hline
|
||||
10 & 32 & \textbf{1280} & 782 & 840/977\\
|
||||
10 & 32 & \textbf{1023} & 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. 1280~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. 1023~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}
|
||||
@ -384,11 +413,11 @@ dynamic range & images\\
|
||||
16 & 7600\\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\caption{Amount of images that can be stored on board. As while we store them, we start to send them out, the effective number of images could be larger than this, but it will depend on the network setup (how fats you stream out images).}
|
||||
\caption{Amount of images that can be stored on board. As while we store them, we start to send them out, the effective number of images could be larger than this, but it will depend on the network setup (how fast you stream out images).}
|
||||
\label{timgs}
|
||||
\end{table}
|
||||
|
||||
The maximum frame rate achievable with 10~GbE, {\tt{dr 16}}, {\tt{flags continuous}}, {\tt{flags parallel}},{\tt{clkdivider 0}}, \textbf{6.1~kHz}. This is currently limited by the connection between the Front End Board and the Backend board. We expect the 32 bit mode limit, internally, to be \textbf{2~kHz} ({\tt{clkdivider 2}}).
|
||||
The maximum frame rate achievable with 10~GbE, {\tt{dr 16}}, {\tt{flags continuous}}, {\tt{flags parallel}} ({\tt{\textcolor{red}{parallel 1}}}),{\tt{clkdivider 0}} ({\tt{\textcolor{red}{speed full\_speed}}}), \textbf{6.1~kHz}. This is currently limited by the connection between the Front End Board and the Backend board. We expect the 32 bit mode limit, internally, to be \textbf{2~kHz} ({\tt{clkdivider 2}}).
|
||||
In dynamic range {\tt{dr 8}} the frame rate is \textbf{11~kHz} and for{\tt{dr 4}} is \textbf{22~kHz}. For 4 and 8 bit mode the frame rate are directly limited by the speed of the detector chip and not by the readout boards.
|
||||
|
||||
\subsection{Minimum time between frames and Maximum frame rate}
|
||||
@ -459,6 +488,23 @@ where the 'minimum time between frames' and the minimum period will be discussed
|
||||
|
||||
\textbf{From software version 4.0.0, there is a very useful function {\tt{sls\_detector\_get measuredperiod}} which return the measured period AFTER the acquisition. This is important to check that the settings to obtain the targeted frame rate was correct.}
|
||||
|
||||
In release \textcolor{red}{5.0} in 4-bit modes one can set a sort of ROI in the detector such to read half of the module (the central part) or a quarter of it with almost double or four times the frame rate. By default the \tt{\textcolor{red}{readnlines}} is set to \tt{256} meaning the whole chip. With \tt{\textcolor{red}{readnlines 128}} or \tt{\textcolor{red}{readnlines 64}} one sets to read half/quarter rows from the chip. In table~\ref{table:hfrpartial} the maximum frame rates, exposure time and period for the partial readout.\\
|
||||
|
||||
|
||||
\begin{tabular}{|c|c|c|c|c|c|c|}
|
||||
\hline
|
||||
readnlines & \# pixels & Active area (cm$^2$) & Max frame rate (kHz) & Period ($\mu$s) & Dead time ($\mu$s) & \# buffered images\\
|
||||
\hline
|
||||
256 &1024 $\times$ 512 & 8 $\times$ 3.8 & 22.7 & 44.0 &4.1 & 30k\\
|
||||
\hline
|
||||
128 &1024 $\times$ 256 & 8 $\times$ 1.9 & 42.1 & 23.7 &4.2 & 60k\\
|
||||
\hline
|
||||
64 & 1024 $\times$ 128 & 8 $\times$ 0.95 & 73.5 & 13.6 &4.2 & 120k\\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\label{table:hfrpartial}
|
||||
|
||||
|
||||
\textbf{If you run too fast, the detector could become noisier (see problem shooting), it is important to match the detector settings to your frame rate. This can be done having more parameters files and load the one suitable with your experiment.} We experienced that with low energy settings could not reach 6~kHz and no noise.
|
||||
In 16 bit mode, it could make sense, in case of noise and low threshold to either reduce the frame rate:
|
||||
\begin{equation}
|
||||
@ -579,10 +625,10 @@ The number of subframes composing a single 32bit acquisition can be calculated a
|
||||
\end{equation}
|
||||
This also means that {\tt{exptime}}$<${\tt{subexptime}} will be rounded to{\tt{subexptime}}. If you want shorter acquisitions, either reduce the {\tt{subexptime}} or switch two 16-bit mode (you can always sum offline if needed).
|
||||
|
||||
From release 4.0.0, an extra {\tt{flag overflow/nooverflow}} is added, with {\tt{nooverflow}} default:
|
||||
From release 4.0.0, an extra {\tt{flag overflow/nooverflow}} is added (\tt{\textcolor{red}{overflow 0/1}}), with {\tt{nooverflow}} (\tt{\textcolor{red}{overflow 0}}) default:
|
||||
\begin{itemize}
|
||||
\item {\tt{nooverflow}}: the internal 12-bit result is summed, even if there was saturation of the 12-bit counter (4095) in any of the subframes. Note that if there is saturation for every subframe, you might get as a result a value of the counter equal to (4095$\times$~number~of~subframes), which you need to correctly identify. On the other hand if the saturation occurred only one time, you will get something "close'' to the real number.
|
||||
\item {\tt{overflow}}: In this case, even if a pixel saturate only 1 time in a subframe, you will be returned as a value of the counter for that pixel: $2^{32}-1$, i.e. 4294967295.
|
||||
\item {\tt{nooverflow}} (\tt{\textcolor{red}{overflow 0}}): the internal 12-bit result is summed, even if there was saturation of the 12-bit counter (4095) in any of the subframes. Note that if there is saturation for every subframe, you might get as a result a value of the counter equal to (4095$\times$~number~of~subframes), which you need to correctly identify. On the other hand if the saturation occurred only one time, you will get something "close'' to the real number.
|
||||
\item {\tt{overflow}} (\tt{\textcolor{red}{overflow 1}})): In this case, even if a pixel saturate only 1 time in a subframe, you will be returned as a value of the counter for that pixel: $2^{32}-1$, i.e. 4294967295.
|
||||
\end{itemize}
|
||||
|
||||
The UDP header will contain, after you receive the data, the effective number of subframe per image (see section~\ref{UDP}) as "SubFrame Num or Exp Time", i.e. the number of subframes recorded (32 bit eiger).
|
||||
@ -610,17 +656,17 @@ The detector can be setup such to receive external triggers. Connect a LEMO sign
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-timing [auto/trigger/burst_trigger/gating]
|
||||
sls_detector_put 0-frames x
|
||||
sls_detector_put 0-cycles y
|
||||
sls_detector_put 0-cycles y (\textcolor{red}{triggers})
|
||||
sls_detector_acquire 0-
|
||||
\end{verbatim}
|
||||
No timeout is expected between the start of the acquisition and the arrival of the first trigger.
|
||||
|
||||
Here are the implemented options so far:
|
||||
\begin{itemize}
|
||||
\item {\tt{auto}} is the software controlled acquisition (does not use triggers), where {\tt{exptime}} and {\tt{period}} have to be set. Set number of cycles (i.e. triggers) to 1 using {\tt{cycles}}. Set number of frames using {\tt{frames}}.
|
||||
\item {\tt{trigger}} 1 frame taken for 1 trigger. Your {\tt{frames}} needs to be 1 always, {\tt{cycles}} can be changed and defines how many triggers are considered. {\tt{exptime}} needs to be set. In the GUI this is called trigger exposure series.
|
||||
\item {\tt{burst\_trigger}} gets only 1 trigger, but allows to take many frames. With {\tt{frames}} one can change the number of frames. {\tt{cycles}} needs to be 1. {\tt{exptime}} and {\tt{period}} have to be set. In the gui it is called trigger readout.
|
||||
\item{\tt{gating}} allows to get a frame only when the trigger pulse is gating. Note that in this case the exp time and period only depend on the gating signal. {\tt{cycles}} allows to select how many gates to consider. Set number of frames to 1 using {\tt{frames}}. IMPORTANT: Up to firmware 23, the last subframe is oblige to finish being taken, despite the gate signal going down. This will be configurable from later fw and software version. Also, in gating mode, due to timimg of the state machine, you need to leave 500~$\mu$s deadtime between the end on an acquisition and the next. This is as the state machine is unable to check for changes in the status in the first 500~$\mu$s. ATTENTION: if you are in 16 bit mode and you are applying online rate corrections, as now the exptime is generated by the trigger, you might not have correct rate corrections. If you know what the exposure time is in the gating signal, then you can set the {\tt{exptime}} once and the rate corrections will be correct. In 32 bit mode, it does not matter as the rate corrections depends on the {\tt{subexptime}} which is software set independently from the gate exptime.
|
||||
\item {\tt{auto}} is the software controlled acquisition (does not use triggers), where {\tt{exptime}} and {\tt{period}} have to be set. Set number of {\tt{cycles}} (\textcolor{red}{triggers}) to 1. Set number of frames using {\tt{frames}}.
|
||||
\item {\tt{trigger}} 1 frame taken for 1 trigger. Your {\tt{frames}} needs to be 1 always, {\tt{cycles}} ({\tt{\textcolor{red}{triggers}}}) can be changed and defines how many triggers are considered. {\tt{exptime}} needs to be set. In the GUI this is called trigger exposure series.
|
||||
\item {\tt{burst\_trigger}} gets only 1 trigger, but allows to take many frames. With {\tt{frames}} one can change the number of frames. {\tt{cycles}} ({\tt{\textcolor{red}{triggers}}}) needs to be 1. {\tt{exptime}} and {\tt{period}} have to be set. In the gui it is called trigger readout.
|
||||
\item{\tt{gating}} allows to get a frame only when the trigger pulse is gating. Note that in this case the exp time and period only depend on the gating signal. {\tt{cycles}} (\tt{\textcolor{red}{triggers}}) allows to select how many gates to consider. Set number of frames to 1 using {\tt{frames}}. IMPORTANT: Up to firmware 23, the last subframe is oblige to finish being taken, despite the gate signal going down. This will be configurable from later fw and software version. Also, in gating mode, due to timimg of the state machine, you need to leave 500~$\mu$s deadtime between the end on an acquisition and the next. This is as the state machine is unable to check for changes in the status in the first 500~$\mu$s. ATTENTION: if you are in 16 bit mode and you are applying online rate corrections, as now the exptime is generated by the trigger, you might not have correct rate corrections. If you know what the exposure time is in the gating signal, then you can set the {\tt{exptime}} once and the rate corrections will be correct. In 32 bit mode, it does not matter as the rate corrections depends on the {\tt{subexptime}} which is software set independently from the gate exptime.
|
||||
|
||||
ATTENTION: From release 4.1.1 with the {\tt{trigger}} option it is possible to have software triggers as a debugging tool (instead of the hardware trigger signal. One should start the acquisition (with the blocking {\tt{sls\_detector\_acquire}} if wanted and with another client one can send the softare trigger {\tt{sls\_detector\_put status trigger}}. This option allows for example to perform a motor scan (moving a motor in between single images) and still writing all images to the same file.
|
||||
When using 32-bit mode, by default the acquisition ends the last complete subframe that was started when still the acquisition time was valid. This has been chosen as many people wants to know the exact acquisition time for when the detector was taking data and also, if {\tt{ratecorr}} are active, the last subframe will be correctly corrected, while otherwise it will be corrected with a wrong subdeadtime.
|
||||
@ -630,13 +676,13 @@ However, from 4.1.0, in gating mode, an option to immediately terminate the subf
|
||||
|
||||
Hardware-wise, the ENABLE OUT signal outputs when the chips are really acquiring. This means that the single subframes will be output in 32 bit mode. The TRIGGER OUT outputs the sum-up-signal at the moment (which is useless). This will be changed in the future to output the envelop of the enable signal.
|
||||
|
||||
We are planning to change some functionality, i.e. unify the {\tt{trigger}} and {\tt{burst\_trigger}} trigger modes and make both {\tt{frames}} and {\tt{cycles}} configurable at the same time.
|
||||
We are planning to change some functionality, i.e. unify the {\tt{trigger}} and {\tt{burst\_trigger}} trigger modes and make both {\tt{frames}} and {\tt{cycles}} (\tt{\textcolor{red}{triggers}}) configurable at the same time.
|
||||
|
||||
There is the possibility to use {\tt{timing trigger/burst\_trigger}} and send software single commands to fake the trigger. This is done with:
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-timing [trigger/burst_trigger]
|
||||
sls_detector_put 0-frames x
|
||||
sls_detector_put 0-cycles y
|
||||
sls_detector_put 0-cycles y (\textcolor{red}{triggers})
|
||||
sls_detector_status trigger
|
||||
\end{verbatim}
|
||||
Note that this functionality is very (!) useful if you need to do something between and acquisition and the next. This can be used to do a fast threshold scan for example. See section~\ref{sec:fastthresholdscan}.
|
||||
@ -716,8 +762,8 @@ If \textbf{dr} is 32 and \textbf{clkdivider} is not 2, whatever the detector get
|
||||
|
||||
Here is a list of parameters that should be reset:
|
||||
\begin{enumerate}
|
||||
\item \textbf{resetframescaught} should be reset to zero after every acquisition taken with {\tt{receiver start}},{\tt{status start}},{\tt{receiver stop}}. If the acquisition is taken with {\tt{sls\_detector\_acquire}}, there is no need to reset this.
|
||||
\item After changing the {\tt{timing}} mode of the detector, one should reset to '1' the unused value, in that specific timing mode, between \textbf{frames} and \textbf{cycles}. See section~\ref{triggering} for how to use the timing. At the present moment the detector will acquire more frames than planned if the variable not used between \textbf{frames} and \textbf{cycles} is not reset. In future releases, the unused variable will be ignored. Still resetting is a good practice.
|
||||
\item \textbf{resetframescaught} (only for releases < 5.x) should be reset to zero after every acquisition taken with {\tt{receiver start}},{\tt{status start}},{\tt{receiver stop}}. If the acquisition is taken with {\tt{sls\_detector\_acquire}}, there is no need to reset this.
|
||||
\item After changing the {\tt{timing}} mode of the detector, one should reset to '1' the unused value, in that specific timing mode, between \textbf{frames} and \textbf{cycles} (\tt{\textcolor{red}{triggers}}). See section~\ref{triggering} for how to use the timing. At the present moment the detector will acquire more frames than planned if the variable not used between \textbf{frames} and \textbf{cycles} (\tt{\textcolor{red}{trigger}}) is not reset. In future releases, the unused variable will be ignored. Still resetting is a good practice.
|
||||
|
||||
\end{enumerate}
|
||||
|
||||
@ -1128,10 +1174,10 @@ In 500k--2M pixel systems there is a hardware temperature safety switch, which w
|
||||
|
||||
The HV can also be set and read through the software:
|
||||
\begin{verbatim}
|
||||
./sls_detector_put vhighvoltage 150
|
||||
./sls_detector_get vhighvoltage
|
||||
./sls_detector_put highvoltage 150
|
||||
./sls_detector_get highvoltage
|
||||
\end{verbatim}
|
||||
Note that the get {\tt{vhighvoltage}} would return the measured HV from the master module only. If getting the vhighvoltage for individual halfmodules, only the master will have a value different from -999.
|
||||
Note that the get {\tt{highvoltage}} would return the measured HV from the master module only. If getting the highvoltage for individual halfmodules, only the master will have a value different from -999.
|
||||
|
||||
\appendix
|
||||
|
||||
@ -1213,13 +1259,21 @@ do the same for the other boards. You can program in parallel many boards, but y
|
||||
There are two ways to pulse the detector:
|
||||
\begin{itemize}
|
||||
\item \textbf{Pulse digitally:} when you are interested to the output readout and do not care about the analog response from the pixels:
|
||||
\begin{verbatim}
|
||||
\begin{verbatim}
|
||||
sls_detector_put vthreshold 4000
|
||||
sls_detector_put vtr 4000
|
||||
sls_detector_put pulsechip N #to pulse N
|
||||
sls_detector_put pulsechip -1 #to get out of testing mode
|
||||
\end{verbatim}
|
||||
Note that the answer will be $2 \cdot \textrm{{\tt{N}}} +2$ in this case.
|
||||
Or in \textcolor{red}{5.x}:
|
||||
\begin{verbatim}
|
||||
sls_detector_put vthreshold 4000
|
||||
sls_detector_put vtrim 4000
|
||||
sls_detector_put pulsechip N #to pulse N
|
||||
sls_detector_put pulsechip -1 #to get out of testing mode
|
||||
\end{verbatim}
|
||||
Note that the answer will be $2 \cdot \textrm{{\tt{N}}} +4$ in this case.
|
||||
|
||||
\item \textbf{Pulse analogically:} You want to really check the analogical part of the detector, not just the readout.
|
||||
|
||||
@ -1238,8 +1292,25 @@ sls_detector_put resmat 0
|
||||
sls_detector_acquire
|
||||
\end{verbatim}
|
||||
You read {\tt{N}} in every pixel if you are setup correctly.
|
||||
or in realese \textcolor{red}{5.x}:
|
||||
\begin{verbatim}
|
||||
sls_detector_put vcal 3600
|
||||
sls_detector_put vthreshold 1700
|
||||
sls_detector_put vrpreamp 3100
|
||||
for i in $(seq 0 7) ;
|
||||
do px=$((-255+i));
|
||||
sls_detector_put pulse 0 $px 0;
|
||||
for j in $(seq 0 255) ; do
|
||||
sls_detector_put pulsenmove 100 0 1;
|
||||
done;
|
||||
done;
|
||||
sls_detector_put partialreset 1
|
||||
\end{verbatim}
|
||||
\end{itemize}
|
||||
|
||||
|
||||
|
||||
|
||||
\section{Load a noise pattern with shape}
|
||||
For debug purposes, we have created a noise pattern with a shape. If you reconstruct correctly your image, you should be able to read ".EIGER'' in the same direction for both the top and bottom in normal human readable orientation.
|
||||
To load the special noise file look at {\tt{settingsdir/eiger/standard/eigernoise.sn0xx}} in the package.
|
||||
@ -1265,7 +1336,7 @@ We have also been requested if we could speed up the threshold scan. At the mome
|
||||
./sls_detector_put enablefwrite 0
|
||||
./sls_detector_put resetframescaught 0
|
||||
./sls_detector_put index 0
|
||||
./sls_detector_put cycles 21
|
||||
./sls_detector_put cycles 21 (\textcolor{red}{triggers})
|
||||
./sls_detector_put receiver start
|
||||
./sls_detector_put status start
|
||||
for i in $(seq 0 20);
|
||||
@ -1383,7 +1454,7 @@ Environment variable SLSDETNAME can be set for using 2 different detectors from
|
||||
\subsection{Measure the HV}
|
||||
For every system:
|
||||
\begin{itemize}
|
||||
\item Software-wise measure it (now the software returns the measured value), with {\tt{sls\_detector\_get vhighvoltage}}. The returned value is the HV (for proper Eiger setting is approximately 150~V) if it is correctly set. If two master modules are presents (multi systems), the average is returned (still to be tested). If one asks for the individual $n$ half module bias voltage through {\tt{sls\_detector\_get n:vhighvoltage}}, if the $n$ module is a master, the actual voltage will be returned. If it is a slave, -999 will be returned.
|
||||
\item Software-wise measure it (now the software returns the measured value), with {\tt{sls\_detector\_get highvoltage}}. The returned value is the HV (for proper Eiger setting is approximately 150~V) if it is correctly set. If two master modules are presents (multi systems), the average is returned (still to be tested). If one asks for the individual $n$ half module bias voltage through {\tt{sls\_detector\_get n:highvoltage}}, if the $n$ module is a master, the actual voltage will be returned. If it is a slave, -999 will be returned.
|
||||
\item Hardware-wise (opening the detector) measure value of HV on C14 on the power distribution board. Check also that the small HV connector cable is really connected.
|
||||
\end{itemize}
|
||||
|
||||
@ -1434,7 +1505,7 @@ Scroll up in the terminal till you find:\\
|
||||
There is also an easier way, that is that only the master module will return the real value of the HV. If you have more than 1 detector system, then you will have more than 1 physical master, as the HV needs to be applied to all the systems.
|
||||
|
||||
\begin{verbatim}
|
||||
for i in $(seq 0 36); do sls_detector_put $i:vhighvoltage; done
|
||||
for i in $(seq 0 36); do sls_detector_put $i:highvoltage; done
|
||||
\end{verbatim}
|
||||
Only the master will return to you a sensible number (150 normally). the others will return -999.
|
||||
|
||||
@ -1595,10 +1666,10 @@ ratecorr number
|
||||
where {\tt{number}} is a string that should be interpreted as a float in s. 0.000000 means correction off. Values above zero are the value of $\tau$ in ns.
|
||||
|
||||
\item \begin{verbatim}
|
||||
sls_detector_get vhighvoltage
|
||||
vhighvoltage number
|
||||
sls_detector_get highvoltage
|
||||
highvoltage number
|
||||
\end{verbatim}
|
||||
where {\tt{number}} is a string that should be interpreted as an int and for proper Eiger setting is approximately 150~V if it is correctly set. If two master modules are presents (multi systems), the average is returned (still to be tested). If one asks for the individual $n$ half module bias voltage through {\tt{sls\_detector\_get n:vhighvoltage}}, if the $n$ module is a master, the actual voltage will be returned. If it is a slave, -999 will be returned.
|
||||
where {\tt{number}} is a string that should be interpreted as an int and for proper Eiger setting is approximately 150~V if it is correctly set. If two master modules are presents (multi systems), the average is returned (still to be tested). If one asks for the individual $n$ half module bias voltage through {\tt{sls\_detector\_get n:highvoltage}}, if the $n$ module is a master, the actual voltage will be returned. If it is a slave, -999 will be returned.
|
||||
|
||||
\item \begin{verbatim}
|
||||
sls_detector_get busy
|
||||
|
@ -142,7 +142,7 @@
|
||||
"vpreamp"; // sets/get vpreamp value (advanced! Mythen)
|
||||
"vshaper1"; // sets/get vshaper1 value (advanced! Mythen)
|
||||
"vshaper2"; // sets/get vshaper2 value (advanced! Mythen)
|
||||
"vhighvoltage"; // sets/get vhighvoltage value (advanced! Chiptest board and Eiger)
|
||||
"highvoltage"; // sets/get highvoltage value (advanced! Chiptest board and Eiger)
|
||||
"vapower"; // sets/get vapower value (advanced! Chiptest board)
|
||||
"vddpower"; // sets/get vddpower value (advanced! Chiptest board)
|
||||
"vshpower"; // sets/get vshpower value (advanced! Chiptest board)
|
||||
|
@ -335,7 +335,7 @@ Advanced settings changing the analog or digital performance of the acquisition.
|
||||
\item[vpreamp n] Sets the DAC value of the preamp feedback to n.
|
||||
\item[vshaper1 n] Sets the DAC value of the shaper1 feedback to n.
|
||||
\item[vshaper2 n] Sets the DAC value of the shaper2 feedback to n.
|
||||
\item[vhighvoltage n] Sets the DAC value of the high voltage to n (in V).
|
||||
\item[highvoltage n] Sets the DAC value of the high voltage to n (in V).
|
||||
\item[vapower n] CHIPTEST BOARD ONLY - Sets the DAC value of the analog voltage to n.
|
||||
\item[vddpower n] CHIPTEST BOARD ONLY - Sets the DAC value of the analog voltage to n.
|
||||
\item[vshpower n] CHIPTEST BOARD ONLY - Sets the comparator power supply in dac units (0-1024).
|
||||
@ -648,7 +648,7 @@ Advanced settings changing the analog or digital performance of the acquisition.
|
||||
\item[vpreamp] Returns the DAC value of the preamp feedback to n.
|
||||
\item[vshaper1] Returns the DAC value of the shaper1 feedback to n.
|
||||
\item[vshaper2] Returns the DAC value of the shaper2 feedback to n.
|
||||
\item[vhighvoltage] Returns the DAC value of the high voltage to n.
|
||||
\item[highvoltage] Returns the DAC value of the high voltage to n.
|
||||
\item[vapower] CHIPTEST BOARD ONLY - Returns the DAC value of the analog voltage to n.
|
||||
\item[vddpower] CHIPTEST BOARD ONLY - Returns the DAC value of the analog voltage to n.
|
||||
\item[vshpower] CHIPTEST BOARD ONLY - Returns the comparator power supply in dac units (0-1024).
|
||||
@ -714,7 +714,7 @@ One can configure all the detector settings in a parameter file {\tt{setup.det}}
|
||||
sls_detector_put parameters setup.det
|
||||
\end{verbatim}
|
||||
|
||||
In the case of \E, the parameter file ({\tt{setup.det}} needs to setup the proper bias voltage of the sensor, i.e. needs to contain the line {\tt{vhighvoltage 150}}.
|
||||
In the case of \E, the parameter file ({\tt{setup.det}} needs to setup the proper bias voltage of the sensor, i.e. needs to contain the line {\tt{highvoltage 150}}.
|
||||
|
||||
\subsection{Standard acquisition}
|
||||
|
||||
|
@ -322,7 +322,7 @@ Advanced settings changing the analog or digital performance of the acquisition.
|
||||
\item[vpreamp n] Sets the DAC value of the preamp feedback to n.
|
||||
\item[vshaper1 n] Sets the DAC value of the shaper1 feedback to n.
|
||||
\item[vshaper2 n] Sets the DAC value of the shaper2 feedback to n.
|
||||
\item[vhighvoltage n] CHIPTEST BOARD ONLY - Sets the DAC value of the high voltage to n.
|
||||
\item[highvoltage n] CHIPTEST BOARD ONLY - Sets the DAC value of the high voltage to n.
|
||||
\item[vapower n] CHIPTEST BOARD ONLY - Sets the DAC value of the analog voltage to n.
|
||||
\item[vddpower n] CHIPTEST BOARD ONLY - Sets the DAC value of the analog voltage to n.
|
||||
\item[vshpower n] CHIPTEST BOARD ONLY - Sets the comparator power supply in dac units (0-1024).
|
||||
@ -594,7 +594,7 @@ Advanced settings changing the analog or digital performance of the acquisition.
|
||||
\item[vpreamp] Returns the DAC value of the preamp feedback to n.
|
||||
\item[vshaper1] Returns the DAC value of the shaper1 feedback to n.
|
||||
\item[vshaper2] Returns the DAC value of the shaper2 feedback to n.
|
||||
\item[vhighvoltage] CHIPTEST BOARD ONLY - Returns the DAC value of the high voltage to n.
|
||||
\item[highvoltage] CHIPTEST BOARD ONLY - Returns the DAC value of the high voltage to n.
|
||||
\item[vapower] CHIPTEST BOARD ONLY - Returns the DAC value of the analog voltage to n.
|
||||
\item[vddpower] CHIPTEST BOARD ONLY - Returns the DAC value of the analog voltage to n.
|
||||
\item[vshpower] CHIPTEST BOARD ONLY - Returns the comparator power supply in dac units (0-1024).
|
||||
|
@ -12,6 +12,7 @@ target_link_libraries(_slsdet PUBLIC
|
||||
slsDetectorShared
|
||||
slsReceiverShared
|
||||
slsSupportLib
|
||||
${ZeroMQ_LIBRARIES}
|
||||
)
|
||||
|
||||
|
||||
|
@ -42,6 +42,7 @@ def extract_enums(lines):
|
||||
|
||||
except:
|
||||
pass
|
||||
fields = [f.strip() for f in fields]
|
||||
enums[enum_name] = fields
|
||||
return enums
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""
|
||||
Setup file for sls_detector
|
||||
Setup file for slsdet
|
||||
Build upon the pybind11 example found here: https://github.com/pybind/python_example
|
||||
"""
|
||||
from setuptools import setup, Extension, find_packages
|
||||
|
@ -27,7 +27,7 @@ dr 32
|
||||
|
||||
threaded 1
|
||||
tengiga 0
|
||||
vhighvoltage 150
|
||||
highvoltage 150
|
||||
iodelay 660
|
||||
|
||||
#gappixels 1
|
||||
|
@ -1 +1 @@
|
||||
vhighvoltage 200
|
||||
highvoltage 200
|
@ -13,11 +13,25 @@ import _slsdet
|
||||
defs = _slsdet.slsDetectorDefs
|
||||
runStatus = _slsdet.slsDetectorDefs.runStatus
|
||||
speedLevel = _slsdet.slsDetectorDefs.speedLevel
|
||||
|
||||
|
||||
detectorType = _slsdet.slsDetectorDefs.detectorType
|
||||
frameDiscardPolicy = _slsdet.slsDetectorDefs.frameDiscardPolicy
|
||||
fileFormat = _slsdet.slsDetectorDefs.fileFormat
|
||||
dimension = _slsdet.slsDetectorDefs.dimension
|
||||
externalSignalFlag = _slsdet.slsDetectorDefs.externalSignalFlag
|
||||
timingMode = _slsdet.slsDetectorDefs.timingMode
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
detectorType = _slsdet.slsDetectorDefs.detectorType
|
||||
detectorSettings = _slsdet.slsDetectorDefs.detectorSettings
|
||||
clockIndex = _slsdet.slsDetectorDefs.clockIndex
|
||||
readoutMode = _slsdet.slsDetectorDefs.readoutMode
|
||||
masterFlags = _slsdet.slsDetectorDefs.masterFlags
|
||||
|
||||
frameModeType = _slsdet.slsDetectorDefs.frameModeType
|
||||
detectorModeType = _slsdet.slsDetectorDefs.detectorModeType
|
||||
burstMode = _slsdet.slsDetectorDefs.burstMode
|
||||
timingSourceType = _slsdet.slsDetectorDefs.timingSourceType
|
||||
|
||||
|
||||
IpAddr = _slsdet.IpAddr
|
||||
MacAddr = _slsdet.MacAddr
|
||||
|
@ -178,7 +178,7 @@ class Detector(CppDetectorApi):
|
||||
|
||||
@exptime.setter
|
||||
def exptime(self, t):
|
||||
self.setExptime(ut.make_timedelta(t))
|
||||
self.setExptime(t)
|
||||
|
||||
@property
|
||||
def period(self):
|
||||
@ -187,7 +187,7 @@ class Detector(CppDetectorApi):
|
||||
|
||||
@period.setter
|
||||
def period(self, t):
|
||||
self.setPeriod(ut.make_timedelta(t))
|
||||
self.setPeriod(t)
|
||||
|
||||
@property
|
||||
@element
|
||||
@ -196,7 +196,7 @@ class Detector(CppDetectorApi):
|
||||
|
||||
@delay.setter
|
||||
def delay(self, t):
|
||||
self.setDelayAfterTrigger(ut.make_timedelta(t))
|
||||
self.setDelayAfterTrigger(t)
|
||||
|
||||
@property
|
||||
@element
|
||||
@ -508,11 +508,11 @@ class Detector(CppDetectorApi):
|
||||
self.setSourceUDPMAC2(MacAddr(mac))
|
||||
|
||||
@property
|
||||
def vhighvoltage(self):
|
||||
def highvoltage(self):
|
||||
return element_if_equal(self.getHighVoltage())
|
||||
|
||||
@vhighvoltage.setter
|
||||
def vhighvoltage(self, v):
|
||||
@highvoltage.setter
|
||||
def highvoltage(self, v):
|
||||
self.setHighVoltage(v)
|
||||
|
||||
@property
|
||||
@ -601,13 +601,12 @@ class Detector(CppDetectorApi):
|
||||
self.setRateCorrection(tau)
|
||||
|
||||
@property
|
||||
def clkdivider(self):
|
||||
res = [int(value) for value in self.getSpeed()]
|
||||
return element_if_equal(res)
|
||||
def speed(self):
|
||||
return element_if_equal(self.getSpeed())
|
||||
|
||||
@clkdivider.setter
|
||||
def clkdivider(self, value):
|
||||
self.setSpeed(speedLevel(value))
|
||||
@speed.setter
|
||||
def speed(self, value):
|
||||
self.setSpeed(value)
|
||||
|
||||
@property
|
||||
def frameindex(self):
|
||||
@ -639,7 +638,7 @@ class Detector(CppDetectorApi):
|
||||
|
||||
@property
|
||||
def vthreshold(self):
|
||||
return element_if_equal(self.getDAC(dacIndex.THRESHOLD))
|
||||
return element_if_equal(self.getDAC(dacIndex.VTHRESHOLD, False))
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
@ -663,7 +662,7 @@ class Detector(CppDetectorApi):
|
||||
|
||||
@subexptime.setter
|
||||
def subexptime(self, t):
|
||||
self.setSubExptime(ut.make_timedelta(t))
|
||||
self.setSubExptime(t)
|
||||
|
||||
@property
|
||||
def subdeadtime(self):
|
||||
@ -672,7 +671,7 @@ class Detector(CppDetectorApi):
|
||||
|
||||
@subdeadtime.setter
|
||||
def subdeadtime(self, t):
|
||||
self.setSubDeadTime(ut.make_timedelta(t))
|
||||
self.setSubDeadTime(t)
|
||||
|
||||
@property
|
||||
def partialreset(self):
|
||||
@ -732,13 +731,6 @@ class Detector(CppDetectorApi):
|
||||
res = self.getMeasuredSubFramePeriod()
|
||||
return element_if_equal([it.total_seconds() for it in res])
|
||||
|
||||
@property
|
||||
def storeinram(self):
|
||||
return element_if_equal(self.getStoreInRamMode())
|
||||
|
||||
@storeinram.setter
|
||||
def storeinram(self, value):
|
||||
self.setStoreInRamMode(value)
|
||||
|
||||
"""
|
||||
Jungfrau specific
|
||||
@ -778,7 +770,7 @@ class Detector(CppDetectorApi):
|
||||
|
||||
@storagecell_delay.setter
|
||||
def storagecell_delay(self, t):
|
||||
self.setStorageCellDelay(ut.make_timedelta(t))
|
||||
self.setStorageCellDelay(t)
|
||||
|
||||
@property
|
||||
@element
|
||||
@ -846,9 +838,9 @@ class Detector(CppDetectorApi):
|
||||
if is_iterable(value):
|
||||
if len(value) == 3:
|
||||
for i, v in enumerate(value):
|
||||
self.setGateDelay(i, ut.make_timedelta(v))
|
||||
self.setGateDelay(i, v)
|
||||
else:
|
||||
self.setGateDelay(-1, ut.make_timedelta(value))
|
||||
self.setGateDelay(-1, value)
|
||||
|
||||
@property
|
||||
def counters(self):
|
||||
@ -981,14 +973,6 @@ class Detector(CppDetectorApi):
|
||||
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):
|
||||
|
@ -60,23 +60,23 @@ class EigerDacs(DetectorDacs):
|
||||
"""
|
||||
Eiger specific dacs
|
||||
"""
|
||||
_dacs = [('vsvp', dacIndex.SVP,0, 4000, 0),
|
||||
('vtr', dacIndex.VTR,0, 4000, 2500),
|
||||
('vrf', dacIndex.VRF,0, 4000, 3300),
|
||||
('vrs', dacIndex.VRS,0, 4000, 1400),
|
||||
('vsvn', dacIndex.SVN,0, 4000, 4000),
|
||||
('vtgstv', dacIndex.VTGSTV,0, 4000, 2556),
|
||||
('vcmp_ll', dacIndex.VCMP_LL,0, 4000, 1500),
|
||||
('vcmp_lr', dacIndex.VCMP_LR,0, 4000, 1500),
|
||||
('vcall', dacIndex.CAL,0, 4000, 4000),
|
||||
('vcmp_rl', dacIndex.VCMP_RL,0, 4000, 1500),
|
||||
('rxb_rb', dacIndex.RXB_RB,0, 4000, 1100),
|
||||
('rxb_lb', dacIndex.RXB_LB,0, 4000, 1100),
|
||||
('vcmp_rr', dacIndex.VCMP_RR,0, 4000, 1500),
|
||||
('vcp', dacIndex.VCP,0, 4000, 200),
|
||||
('vcn', dacIndex.VCN,0, 4000, 2000),
|
||||
('vis', dacIndex.VIS,0, 4000, 1550),
|
||||
('iodelay', dacIndex.IO_DELAY,0, 4000, 660)]
|
||||
_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)]
|
||||
_dacnames = [_d[0] for _d in _dacs]
|
||||
|
||||
# # noinspection PyProtectedMember
|
||||
|
@ -13,49 +13,32 @@ import _slsdet
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
from .detector_property import DetectorProperty
|
||||
|
||||
# vcassh 1200,
|
||||
# vth2 2800,
|
||||
# vshaper 1280,
|
||||
# vshaperneg 2800,
|
||||
# vipre_out 1220,
|
||||
# vth3 2800,
|
||||
# vth1 2800,
|
||||
# vicin 1708,
|
||||
# vcas 1800,
|
||||
# vpreamp 1100,
|
||||
# vpl 1100,
|
||||
# vipre 2624,
|
||||
# viinsh 1708,
|
||||
# vph 1712,
|
||||
# vtrim 2800,
|
||||
# vdcsh 800
|
||||
|
||||
|
||||
# @freeze
|
||||
class Mythen3Dacs(DetectorDacs):
|
||||
"""
|
||||
Jungfrau specific DACs
|
||||
"""
|
||||
_dacs = [('vcassh', dacIndex.CASSH, 0, 4000, 1220),
|
||||
_dacs = [('vcassh', dacIndex.VCASSH, 0, 4000, 1220),
|
||||
('vth2', dacIndex.VTH2, 0, 4000, 2800),
|
||||
('vshaper', dacIndex.SHAPER1, 0, 4000, 1280),
|
||||
('vshaperneg', dacIndex.SHAPER2, 0, 4000, 2800),
|
||||
('vrshaper', dacIndex.VRSHAPER, 0, 4000, 1280),
|
||||
('vrshaper_n', dacIndex.VRSHAPER_N, 0, 4000, 2800),
|
||||
('vipre_out', dacIndex.VIPRE_OUT, 0, 4000, 1220),
|
||||
('vth3', dacIndex.VTH3, 0, 4000, 2800),
|
||||
('vth1', dacIndex.THRESHOLD, 0, 4000, 2800),
|
||||
('vth1', dacIndex.VTH1, 0, 4000, 2800),
|
||||
('vicin', dacIndex.VICIN, 0, 4000, 1708),
|
||||
('vcas', dacIndex.CAS, 0, 4000, 1800),
|
||||
('vpreamp', dacIndex.PREAMP, 0, 4000, 1100),
|
||||
('vpl', dacIndex.VPL, 0, 4000, 1100),
|
||||
('vcas', dacIndex.VCAS, 0, 4000, 1800),
|
||||
('vrpreamp', dacIndex.VRPREAMP, 0, 4000, 1100),
|
||||
('vcal_n', dacIndex.VCAL_N, 0, 4000, 1100),
|
||||
('vipre', dacIndex.VIPRE, 0, 4000, 2624),
|
||||
('viinsh', dacIndex.VIINSH, 0, 4000, 1708),
|
||||
('vph', dacIndex.CALIBRATION_PULSE, 0, 4000, 1712),
|
||||
('vtrim', dacIndex.TRIMBIT_SIZE, 0, 4000, 2800),
|
||||
('vdcsh', dacIndex.VDCSH, 0, 4000, 800),
|
||||
('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),
|
||||
]
|
||||
_dacnames = [_d[0] for _d in _dacs]
|
||||
|
||||
|
||||
#vthreshold??
|
||||
|
||||
|
||||
@freeze
|
||||
|
@ -1,20 +0,0 @@
|
||||
# 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.
Before Width: | Height: | Size: 44 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.9 MiB |
@ -1,134 +0,0 @@
|
||||
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
|
@ -1,370 +0,0 @@
|
||||
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| \- \-
|
||||
===================== ===================================== ================== =========
|
@ -1,178 +0,0 @@
|
||||
#!/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'),
|
||||
]
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
C++ API
|
||||
=====================================================
|
||||
|
||||
|
||||
.. py:currentmodule:: _slsdet
|
||||
|
||||
.. autoclass:: DetectorApi
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
|
||||
|
@ -1,67 +0,0 @@
|
||||
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)
|
||||
|
||||
|
@ -1,122 +0,0 @@
|
||||
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'
|
@ -1,30 +0,0 @@
|
||||
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`
|
@ -1,90 +0,0 @@
|
||||
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
|
@ -1,6 +0,0 @@
|
||||
make clean
|
||||
make html
|
||||
rm -rf ../docs/
|
||||
mv _build/html/ ../docs/
|
||||
touch ../docs/.nojekyll
|
||||
rm -rf _build
|
@ -1,8 +0,0 @@
|
||||
sls_detector
|
||||
==================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 4
|
||||
|
||||
sls_detector
|
||||
|
@ -1,33 +0,0 @@
|
||||
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:
|
@ -86,6 +86,9 @@ void init_det(py::module &m) {
|
||||
.def("setDetectorSize",
|
||||
(void (Detector::*)(const defs::xy)) & Detector::setDetectorSize,
|
||||
py::arg())
|
||||
.def("getSettingsList",
|
||||
(std::vector<defs::detectorSettings>(Detector::*)() const) &
|
||||
Detector::getSettingsList)
|
||||
.def("getSettings",
|
||||
(Result<defs::detectorSettings>(Detector::*)(sls::Positions)
|
||||
const) &
|
||||
@ -107,6 +110,12 @@ void init_det(py::module &m) {
|
||||
(void (Detector::*)(int, sls::Positions)) &
|
||||
Detector::setAllTrimbits,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getGapPixelsinCallback",
|
||||
(bool (Detector::*)() const) & Detector::getGapPixelsinCallback)
|
||||
.def("setGapPixelsinCallback",
|
||||
(void (Detector::*)(const bool)) &
|
||||
Detector::setGapPixelsinCallback,
|
||||
py::arg())
|
||||
.def("registerAcquisitionFinishedCallback",
|
||||
(void (Detector::*)(void (*)(double, int, void *), void *)) &
|
||||
Detector::registerAcquisitionFinishedCallback,
|
||||
@ -117,12 +126,6 @@ void init_det(py::module &m) {
|
||||
void (*)(detectorData *, uint64_t, uint32_t, void *), void *)) &
|
||||
Detector::registerDataCallback,
|
||||
py::arg(), py::arg())
|
||||
.def("getGapPixelsinCallback",
|
||||
(bool (Detector::*)() const) & Detector::getGapPixelsinCallback)
|
||||
.def("setGapPixelsinCallback",
|
||||
(void (Detector::*)(const bool)) &
|
||||
Detector::setGapPixelsinCallback,
|
||||
py::arg())
|
||||
.def("getNumberOfFrames",
|
||||
(Result<int64_t>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getNumberOfFrames,
|
||||
@ -295,6 +298,8 @@ void init_det(py::module &m) {
|
||||
(Result<int>(Detector::*)(defs::dacIndex, sls::Positions) const) &
|
||||
Detector::getTemperature,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getDacList", (std::vector<defs::dacIndex>(Detector::*)() const) &
|
||||
Detector::getDacList)
|
||||
.def("getDAC",
|
||||
(Result<int>(Detector::*)(defs::dacIndex, bool, sls::Positions)
|
||||
const) &
|
||||
@ -313,6 +318,16 @@ void init_det(py::module &m) {
|
||||
(void (Detector::*)(defs::dacIndex, int, int, sls::Positions)) &
|
||||
Detector::setOnChipDAC,
|
||||
py::arg(), py::arg(), py::arg(), py::arg() = Positions{})
|
||||
.def("getExternalSignalFlags",
|
||||
(Result<defs::externalSignalFlag>(Detector::*)(int, sls::Positions)
|
||||
const) &
|
||||
Detector::getExternalSignalFlags,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("setExternalSignalFlags",
|
||||
(void (Detector::*)(int, defs::externalSignalFlag,
|
||||
sls::Positions)) &
|
||||
Detector::setExternalSignalFlags,
|
||||
py::arg(), py::arg(), py::arg() = Positions{})
|
||||
.def("acquire", (void (Detector::*)()) & Detector::acquire)
|
||||
.def("clearAcquiringFlag",
|
||||
(void (Detector::*)()) & Detector::clearAcquiringFlag)
|
||||
@ -563,6 +578,10 @@ void init_det(py::module &m) {
|
||||
(Result<sls::IpAddr>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getRxLastClientIP,
|
||||
py::arg() = Positions{})
|
||||
.def("getRxThreadIds",
|
||||
(Result<std::array<pid_t, 8>>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getRxThreadIds,
|
||||
py::arg() = Positions{})
|
||||
.def("getFileFormat",
|
||||
(Result<defs::fileFormat>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getFileFormat,
|
||||
@ -736,14 +755,6 @@ void init_det(py::module &m) {
|
||||
(void (Detector::*)(bool, sls::Positions)) &
|
||||
Detector::setOverFlowMode,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getStoreInRamMode",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getStoreInRamMode,
|
||||
py::arg() = Positions{})
|
||||
.def("setStoreInRamMode",
|
||||
(void (Detector::*)(bool, sls::Positions)) &
|
||||
Detector::setStoreInRamMode,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getBottom",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getBottom,
|
||||
@ -905,16 +916,6 @@ void init_det(py::module &m) {
|
||||
(Result<sls::ns>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getExptimeLeft,
|
||||
py::arg() = Positions{})
|
||||
.def("getExternalSignalFlags",
|
||||
(Result<defs::externalSignalFlag>(Detector::*)(int, sls::Positions)
|
||||
const) &
|
||||
Detector::getExternalSignalFlags,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("setExternalSignalFlags",
|
||||
(void (Detector::*)(int, defs::externalSignalFlag,
|
||||
sls::Positions)) &
|
||||
Detector::setExternalSignalFlags,
|
||||
py::arg(), py::arg(), py::arg() = Positions{})
|
||||
.def("getNumberOfBursts",
|
||||
(Result<int64_t>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getNumberOfBursts,
|
||||
@ -1136,7 +1137,7 @@ void init_det(py::module &m) {
|
||||
Detector::setExternalSamplingSource,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getExternalSampling",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getExternalSampling,
|
||||
py::arg() = Positions{})
|
||||
.def("setExternalSampling",
|
||||
@ -1186,14 +1187,6 @@ void init_det(py::module &m) {
|
||||
(void (Detector::*)(uint64_t, sls::Positions)) &
|
||||
Detector::setPatternIOControl,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getPatternClockControl",
|
||||
(Result<uint64_t>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getPatternClockControl,
|
||||
py::arg() = Positions{})
|
||||
.def("setPatternClockControl",
|
||||
(void (Detector::*)(uint64_t, sls::Positions)) &
|
||||
Detector::setPatternClockControl,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getPatternWord",
|
||||
(Result<uint64_t>(Detector::*)(int, sls::Positions)) &
|
||||
Detector::getPatternWord,
|
||||
@ -1387,7 +1380,8 @@ void init_det(py::module &m) {
|
||||
Detector::getLastClientIP,
|
||||
py::arg() = Positions{})
|
||||
.def("executeCommand",
|
||||
(void (Detector::*)(const std::string &, sls::Positions)) &
|
||||
(Result<std::string>(Detector::*)(const std::string &,
|
||||
sls::Positions)) &
|
||||
Detector::executeCommand,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getNumberOfFramesFromStart",
|
||||
|
@ -17,8 +17,6 @@ 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)
|
||||
@ -40,8 +38,6 @@ 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)
|
||||
@ -52,7 +48,6 @@ 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",
|
||||
@ -76,7 +71,6 @@ void init_enums(py::module &m) {
|
||||
.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)
|
||||
@ -88,15 +82,42 @@ void init_enums(py::module &m) {
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::dacIndex>(Defs, "dacIndex")
|
||||
.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("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("VREF_DS", slsDetectorDefs::dacIndex::VREF_DS)
|
||||
.value("VCASCN_PB", slsDetectorDefs::dacIndex::VCASCN_PB)
|
||||
.value("VCASCP_PB", slsDetectorDefs::dacIndex::VCASCP_PB)
|
||||
@ -105,25 +126,46 @@ 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("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("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("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)
|
||||
@ -134,40 +176,7 @@ 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("TRIMBIT_SCAN", slsDetectorDefs::dacIndex::TRIMBIT_SCAN)
|
||||
.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)
|
||||
@ -192,7 +201,6 @@ 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)
|
||||
@ -227,39 +235,31 @@ 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)
|
||||
.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)
|
||||
.value("HALF_SPEED", slsDetectorDefs::speedLevel::HALF_SPEED)
|
||||
.value("QUARTER_SPEED", slsDetectorDefs::speedLevel::QUARTER_SPEED)
|
||||
.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)
|
||||
.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)
|
||||
@ -267,8 +267,6 @@ void init_enums(py::module &m) {
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::detectorModeType>(Defs, "detectorModeType")
|
||||
.value("GET_DETECTOR_MODE",
|
||||
slsDetectorDefs::detectorModeType::GET_DETECTOR_MODE)
|
||||
.value("COUNTING", slsDetectorDefs::detectorModeType::COUNTING)
|
||||
.value("INTERPOLATING",
|
||||
slsDetectorDefs::detectorModeType::INTERPOLATING)
|
||||
@ -285,7 +283,7 @@ void init_enums(py::module &m) {
|
||||
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();
|
||||
}
|
||||
|
@ -164,18 +164,18 @@ def test_cannot_set_fw_version(d):
|
||||
def test_get_high_voltage_call_signature(d, mocker):
|
||||
m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||
d.high_voltage
|
||||
m.assert_called_once_with('vhighvoltage', -1)
|
||||
m.assert_called_once_with('highvoltage', -1)
|
||||
|
||||
def test_get_high_voltage(d, mocker):
|
||||
m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||
m.return_value = 80
|
||||
assert d.high_voltage == 80
|
||||
|
||||
#self._api.setDac('vhighvoltage', -1, voltage)
|
||||
#self._api.setDac('highvoltage', -1, voltage)
|
||||
def test_set_high_voltage(d, mocker):
|
||||
m = mocker.patch('_slsdet.DetectorApi.setDac')
|
||||
d.high_voltage = 80
|
||||
m.assert_called_once_with('vhighvoltage', -1, 80)
|
||||
m.assert_called_once_with('highvoltage', -1, 80)
|
||||
|
||||
def test_decode_hostname_two_names(d, mocker):
|
||||
m = mocker.patch('_slsdet.DetectorApi.getHostname')
|
||||
|
@ -170,18 +170,18 @@ def test_set_counters_single(d, mocker):
|
||||
# def test_get_high_voltage_call_signature(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||
# d.high_voltage
|
||||
# m.assert_called_once_with('vhighvoltage', -1)
|
||||
# m.assert_called_once_with('highvoltage', -1)
|
||||
|
||||
# def test_get_high_voltage(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||
# m.return_value = 80
|
||||
# assert d.high_voltage == 80
|
||||
|
||||
# #self._api.setDac('vhighvoltage', -1, voltage)
|
||||
# #self._api.setDac('highvoltage', -1, voltage)
|
||||
# def test_set_high_voltage(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setDac')
|
||||
# d.high_voltage = 80
|
||||
# m.assert_called_once_with('vhighvoltage', -1, 80)
|
||||
# m.assert_called_once_with('highvoltage', -1, 80)
|
||||
|
||||
# def test_decode_hostname_two_names(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getHostname')
|
||||
|
@ -10,5 +10,5 @@ sls_detector_put exptime 0.000005
|
||||
sls_detector_put period 0.01
|
||||
|
||||
|
||||
sls_detector_put vhighvoltage 90
|
||||
sls_detector_put highvoltage 90
|
||||
|
||||
|
39
slsDetectorCalibration/moenchExecutables/CMakeLists.txt
Normal file
39
slsDetectorCalibration/moenchExecutables/CMakeLists.txt
Normal file
@ -0,0 +1,39 @@
|
||||
|
||||
|
||||
#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})
|
@ -245,7 +245,7 @@ int main(int argc, char *argv[]) {
|
||||
delete zmqsocket;
|
||||
return EXIT_FAILURE;
|
||||
} else
|
||||
printf("Zmq Client at %s\n", zmqsocket->GetZmqServerAddress());
|
||||
printf("Zmq Client at %s\n", zmqsocket->GetZmqServerAddress().c_str());
|
||||
|
||||
// send socket
|
||||
ZmqSocket* zmqsocket2 = 0;
|
||||
|
@ -86,7 +86,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>High Voltage</p><p> #vhighvoltage#</p></body></html></string>
|
||||
<string><html><head/><body><p>High Voltage</p><p> #highvoltage#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>High Voltage: </string>
|
||||
@ -108,7 +108,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>High Voltage</p><p> #vhighvoltage#</p></body></html></string>
|
||||
<string><html><head/><body><p>High Voltage</p><p> #highvoltage#</p></body></html></string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
@ -156,7 +156,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.</p><p>-1 corresponds to different values from detectors.</p><p>#vhighvoltage#</p></body></html></string>
|
||||
<string><html><head/><body><p>High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.</p><p>-1 corresponds to different values from detectors.</p><p>#highvoltage#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>High Voltage: </string>
|
||||
@ -178,7 +178,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.</p><p>-1 corresponds to different values from detectors.</p><p>#vhighvoltage#</p></body></html></string>
|
||||
<string><html><head/><body><p>High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.</p><p>-1 corresponds to different values from detectors.</p><p>#highvoltage#</p></body></html></string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
|
@ -45,7 +45,9 @@ void qDacWidget::GetDac() {
|
||||
spinDac->setValue(retval);
|
||||
// mv
|
||||
retval = det->getDAC(index, 1, {detectorIndex}).squash(-1);
|
||||
lblDacmV->setText(QString("%1mV").arg(retval - 10));
|
||||
// -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));
|
||||
}
|
||||
CATCH_DISPLAY(std::string("Could not get dac ") + std::to_string(index),
|
||||
"qDacWidget::GetDac")
|
||||
|
@ -747,6 +747,35 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex,
|
||||
LOG(logDEBUG) << "[ Progress:" << progress << ", Frame:" << currentFrame
|
||||
<< " ]";
|
||||
|
||||
// 1d check if npixelX has changed (m3 for different counters enabled)
|
||||
if (is1d && static_cast<int>(nPixelsX) != data->nx) {
|
||||
nPixelsX = data->nx;
|
||||
LOG(logINFO) << "Change in Detector Shape:\n\tnPixelsX:" << nPixelsX;
|
||||
|
||||
delete[] datax1d;
|
||||
datax1d = new double[nPixelsX];
|
||||
for (unsigned int px = 0; px < nPixelsX; ++px) {
|
||||
datax1d[px] = px;
|
||||
}
|
||||
if (datay1d.size()) {
|
||||
for (auto &it : datay1d) {
|
||||
delete[] it;
|
||||
}
|
||||
datay1d.clear();
|
||||
}
|
||||
datay1d.push_back(new double[nPixelsX]);
|
||||
for (unsigned int px = 0; px < nPixelsX; ++px) {
|
||||
datax1d[px] = px;
|
||||
datay1d[0][px] = 0;
|
||||
}
|
||||
currentPersistency = 0;
|
||||
if (gainDatay1d) {
|
||||
delete[] gainDatay1d;
|
||||
gainDatay1d = new double[nPixelsX];
|
||||
std::fill(gainDatay1d, gainDatay1d + nPixelsX, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// 2d (only image, not gain data, not pedestalvals),
|
||||
// check if npixelsX and npixelsY is the same (quad is different)
|
||||
if (!is1d && (static_cast<int>(nPixelsX) != data->nx ||
|
||||
@ -784,7 +813,7 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex,
|
||||
plotTitlePrefix + QString(data->fileName.c_str()).section('/', -1);
|
||||
indexTitle = QString("%1").arg(frameIndex);
|
||||
if ((int)subFrameIndex != -1) {
|
||||
indexTitle = QString("%1 %2").arg(frameIndex, subFrameIndex);
|
||||
indexTitle = QString("%1 %2").arg(frameIndex).arg(subFrameIndex);
|
||||
}
|
||||
completeImage = data->completeImage;
|
||||
|
||||
|
@ -560,9 +560,7 @@ void qTabAdvanced::ClearROI() {
|
||||
|
||||
void qTabAdvanced::SetROI() {
|
||||
|
||||
slsDetectorDefs::ROI roi;
|
||||
roi.xmin = spinXmin->value();
|
||||
roi.xmax = spinXmax->value();
|
||||
slsDetectorDefs::ROI roi(spinXmin->value(), spinXmax->value());
|
||||
|
||||
// set roi
|
||||
LOG(logINFO) << "Setting ROI: [" << roi.xmin << ", " << roi.xmax << "]";
|
||||
|
@ -25,44 +25,40 @@ void qTabDeveloper::SetupWidgetWindow() {
|
||||
switch (detType) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v SvP: ", getSLSIndex(detType, tempid++)));
|
||||
this, det, true, "vsvp: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v SvN ", getSLSIndex(detType, tempid++)));
|
||||
this, det, true, "vsvn ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v Vrf: ", getSLSIndex(detType, tempid++)));
|
||||
this, det, true, "vrpreamp: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v Vrs: ", getSLSIndex(detType, tempid++)));
|
||||
this, det, true, "vrshaper: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v Vtr: ", getSLSIndex(detType, tempid++)));
|
||||
this, det, true, "vtrim: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v Vtgstv: ", getSLSIndex(detType, tempid++)));
|
||||
this, det, true, "vtgstv: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v cal: ", getSLSIndex(detType, tempid++)));
|
||||
this, det, true, "vcal: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v Vcp ", getSLSIndex(detType, tempid++)));
|
||||
this, det, true, "vcp ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v Vcn: ", getSLSIndex(detType, tempid++)));
|
||||
this, det, true, "vcn: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v Vis: ", getSLSIndex(detType, tempid++)));
|
||||
this, det, true, "vishaper: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v rxb_lb: ", getSLSIndex(detType, tempid++)));
|
||||
this, det, true, "rxb_lb: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v rxb_rb: ", getSLSIndex(detType, tempid++)));
|
||||
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++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"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++)));
|
||||
"vthreshold: ", getSLSIndex(detType, tempid++)));
|
||||
adcWidgets.push_back(new qDacWidget(
|
||||
this, det, false,
|
||||
"Temperature FPGA Ext: ", getSLSIndex(detType, tempid++)));
|
||||
@ -183,10 +179,10 @@ void qTabDeveloper::SetupWidgetWindow() {
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vth2: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vshaper: ", getSLSIndex(detType, tempid++)));
|
||||
this, det, true, "vrshaper: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"vshaperneg: ", getSLSIndex(detType, tempid++)));
|
||||
"vrshaper_n: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"vipre_out: ", getSLSIndex(detType, tempid++)));
|
||||
@ -199,19 +195,22 @@ void qTabDeveloper::SetupWidgetWindow() {
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vcas: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vpreamp: ", getSLSIndex(detType, tempid++)));
|
||||
this, det, true, "vrpreamp: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vph: ", getSLSIndex(detType, tempid++)));
|
||||
this, det, true, "vcal_p: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vipre: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "viinsh: ", getSLSIndex(detType, tempid++)));
|
||||
this, det, true, "vishaper: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vpl: ", getSLSIndex(detType, tempid++)));
|
||||
this, det, true, "vcal_n: ", 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:
|
||||
@ -384,25 +383,25 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
switch (index) {
|
||||
case 0:
|
||||
return slsDetectorDefs::SVP;
|
||||
return slsDetectorDefs::VSVP;
|
||||
case 1:
|
||||
return slsDetectorDefs::SVN;
|
||||
return slsDetectorDefs::VSVN;
|
||||
case 2:
|
||||
return slsDetectorDefs::VRF;
|
||||
return slsDetectorDefs::VRPREAMP;
|
||||
case 3:
|
||||
return slsDetectorDefs::VRS;
|
||||
return slsDetectorDefs::VRSHAPER;
|
||||
case 4:
|
||||
return slsDetectorDefs::VTR;
|
||||
return slsDetectorDefs::VTRIM;
|
||||
case 5:
|
||||
return slsDetectorDefs::VTGSTV;
|
||||
case 6:
|
||||
return slsDetectorDefs::CAL;
|
||||
return slsDetectorDefs::VCAL;
|
||||
case 7:
|
||||
return slsDetectorDefs::VCP;
|
||||
case 8:
|
||||
return slsDetectorDefs::VCN;
|
||||
case 9:
|
||||
return slsDetectorDefs::VIS;
|
||||
return slsDetectorDefs::VISHAPER;
|
||||
case 10:
|
||||
return slsDetectorDefs::RXB_LB;
|
||||
case 11:
|
||||
@ -416,7 +415,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
||||
case 15:
|
||||
return slsDetectorDefs::VCMP_RR;
|
||||
case 16:
|
||||
return slsDetectorDefs::THRESHOLD;
|
||||
return slsDetectorDefs::VTHRESHOLD;
|
||||
case 17:
|
||||
return slsDetectorDefs::TEMPERATURE_FPGAEXT;
|
||||
case 18:
|
||||
@ -515,37 +514,39 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
switch (index) {
|
||||
case 0:
|
||||
return slsDetectorDefs::CASSH;
|
||||
return slsDetectorDefs::VCASSH;
|
||||
case 1:
|
||||
return slsDetectorDefs::VTH2;
|
||||
case 2:
|
||||
return slsDetectorDefs::SHAPER1;
|
||||
return slsDetectorDefs::VRSHAPER;
|
||||
case 3:
|
||||
return slsDetectorDefs::SHAPER2;
|
||||
return slsDetectorDefs::VRSHAPER_N;
|
||||
case 4:
|
||||
return slsDetectorDefs::VIPRE_OUT;
|
||||
case 5:
|
||||
return slsDetectorDefs::VTH3;
|
||||
case 6:
|
||||
return slsDetectorDefs::THRESHOLD;
|
||||
return slsDetectorDefs::VTH1;
|
||||
case 7:
|
||||
return slsDetectorDefs::VICIN;
|
||||
case 8:
|
||||
return slsDetectorDefs::CAS;
|
||||
return slsDetectorDefs::VCAS;
|
||||
case 9:
|
||||
return slsDetectorDefs::PREAMP;
|
||||
return slsDetectorDefs::VRPREAMP;
|
||||
case 10:
|
||||
return slsDetectorDefs::CALIBRATION_PULSE;
|
||||
return slsDetectorDefs::VCAL_P;
|
||||
case 11:
|
||||
return slsDetectorDefs::VIPRE;
|
||||
case 12:
|
||||
return slsDetectorDefs::VIINSH;
|
||||
return slsDetectorDefs::VISHAPER;
|
||||
case 13:
|
||||
return slsDetectorDefs::VPL;
|
||||
return slsDetectorDefs::VCAL_N;
|
||||
case 14:
|
||||
return slsDetectorDefs::TRIMBIT_SIZE;
|
||||
return slsDetectorDefs::VTRIM;
|
||||
case 15:
|
||||
return slsDetectorDefs::VDCSH;
|
||||
case 16:
|
||||
return slsDetectorDefs::VTHRESHOLD;
|
||||
default:
|
||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
|
||||
std::to_string(index));
|
||||
|
@ -15,19 +15,31 @@ qTabSettings::~qTabSettings() {}
|
||||
void qTabSettings::SetupWidgetWindow() {
|
||||
|
||||
// enabling according to det type
|
||||
switch (det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
slsDetectorDefs::detectorType detType = det->getDetectorType().squash();
|
||||
if (detType == slsDetectorDefs::MYTHEN3) {
|
||||
lblSettings->setEnabled(false);
|
||||
comboSettings->setEnabled(false);
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
|
||||
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) {
|
||||
lblDynamicRange->setEnabled(true);
|
||||
comboDynamicRange->setEnabled(true);
|
||||
lblThreshold->setEnabled(true);
|
||||
spinThreshold->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// default settings for the disabled
|
||||
|
@ -8,7 +8,6 @@ if [ $# -eq 0 ]; then
|
||||
)
|
||||
else
|
||||
declare -a det=("${1}")
|
||||
echo "got something"
|
||||
fi
|
||||
|
||||
declare -a deterror=("OK" "OK" "OK" "OK" "OK" "OK")
|
||||
|
@ -16,7 +16,7 @@ add_executable(ctbDetectorServer_virtual
|
||||
../slsDetectorServer/src/LTC2620.c
|
||||
../slsDetectorServer/src/MAX1932.c
|
||||
../slsDetectorServer/src/programFpgaBlackfin.c
|
||||
../slsDetectorServer/src/communication_virtual.c
|
||||
../slsDetectorServer/src/sharedMemory.c
|
||||
)
|
||||
|
||||
include_directories(
|
||||
|
@ -5,14 +5,14 @@ support_lib = ../../slsSupportLib/include/
|
||||
|
||||
CROSS = bfin-uclinux-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -DCHIPTESTBOARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm
|
||||
CFLAGS += -Wall -std=gnu99 -DCHIPTESTBOARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm -lrt -pthread
|
||||
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
|
||||
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
|
||||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
|
Binary file not shown.
@ -1,5 +1,6 @@
|
||||
#include "slsDetectorFunctionList.h"
|
||||
#include "clogger.h"
|
||||
#include "sharedMemory.h"
|
||||
#include "versionAPI.h"
|
||||
|
||||
#include "AD7689.h" // slow adcs
|
||||
@ -10,9 +11,6 @@
|
||||
#include "UDPPacketHeaderGenerator.h"
|
||||
#include "common.h"
|
||||
#include "communication_funcs_UDP.h"
|
||||
#ifdef VIRTUAL
|
||||
#include "communication_virtual.h"
|
||||
#endif
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <string.h>
|
||||
@ -43,8 +41,8 @@ char initErrorMessage[MAX_STR_LENGTH];
|
||||
|
||||
#ifdef VIRTUAL
|
||||
pthread_t pthread_virtual_tid;
|
||||
int virtual_status = 0;
|
||||
int virtual_stop = 0;
|
||||
uint64_t virtual_pattern[MAX_PATTERN_LENGTH];
|
||||
int64_t virtual_currentFrameNumber = 2;
|
||||
#endif
|
||||
|
||||
// 1g readout
|
||||
@ -237,8 +235,7 @@ int testFpga() {
|
||||
|
||||
volatile uint32_t val = 0, readval = 0;
|
||||
int times = 1000 * 1000;
|
||||
int i = 0;
|
||||
for (i = 0; i < times; ++i) {
|
||||
for (int i = 0; i < times; ++i) {
|
||||
val = 0x5A5A5A5A - i;
|
||||
bus_w(addr, val);
|
||||
readval = bus_r(addr);
|
||||
@ -302,9 +299,8 @@ int testBus() {
|
||||
|
||||
volatile uint32_t val = 0, readval = 0;
|
||||
int times = 1000 * 1000;
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
for (int i = 0; i < times; ++i) {
|
||||
val += 0xbbbbb;
|
||||
bus_w(addr, val);
|
||||
readval = bus_r(addr);
|
||||
@ -436,10 +432,7 @@ void initStopServer() {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
virtual_stop = 0;
|
||||
if (!isControlServer) {
|
||||
ComVirtual_setStop(virtual_stop);
|
||||
}
|
||||
sharedMemory_setStop(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -463,15 +456,14 @@ void setupDetector() {
|
||||
analogDataPtr = 0;
|
||||
digitalDataPtr = 0;
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < NUM_CLOCKS; ++i) {
|
||||
for (int i = 0; i < NUM_CLOCKS; ++i) {
|
||||
clkPhase[i] = 0;
|
||||
}
|
||||
clkFrequency[RUN_CLK] = DEFAULT_RUN_CLK;
|
||||
clkFrequency[ADC_CLK] = DEFAULT_ADC_CLK;
|
||||
clkFrequency[SYNC_CLK] = DEFAULT_SYNC_CLK;
|
||||
clkFrequency[DBIT_CLK] = DEFAULT_DBIT_CLK;
|
||||
for (i = 0; i < NDAC; ++i)
|
||||
for (int i = 0; i < NDAC; ++i)
|
||||
dacValues[i] = -1;
|
||||
}
|
||||
vLimit = DEFAULT_VLIMIT;
|
||||
@ -483,10 +475,8 @@ void setupDetector() {
|
||||
naSamples = 1;
|
||||
ndSamples = 1;
|
||||
#ifdef VIRTUAL
|
||||
virtual_status = 0;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
}
|
||||
sharedMemory_setStatus(IDLE);
|
||||
memset(virtual_pattern, 0, sizeof(virtual_pattern));
|
||||
#endif
|
||||
|
||||
ALTERA_PLL_ResetPLLAndReconfiguration();
|
||||
@ -528,12 +518,9 @@ void setupDetector() {
|
||||
// switch off dacs (power regulators most likely only sets to minimum (if
|
||||
// power enable on))
|
||||
LOG(logINFOBLUE, ("Powering down all dacs\n"));
|
||||
{
|
||||
int idac = 0;
|
||||
for (idac = 0; idac < NDAC; ++idac) {
|
||||
setDAC(idac, LTC2620_GetPowerDownValue(),
|
||||
0); // has to be before setvchip
|
||||
}
|
||||
for (int idac = 0; idac < NDAC; ++idac) {
|
||||
setDAC(idac, LTC2620_GetPowerDownValue(),
|
||||
0); // has to be before setvchip
|
||||
}
|
||||
|
||||
// power regulators
|
||||
@ -649,8 +636,7 @@ void updateDataBytes() {
|
||||
if (adcEnableMask_1g == BIT32_MSK)
|
||||
nachans = 32;
|
||||
else {
|
||||
int ichan = 0;
|
||||
for (ichan = 0; ichan < NCHAN_ANALOG; ++ichan) {
|
||||
for (int ichan = 0; ichan < NCHAN_ANALOG; ++ichan) {
|
||||
if (adcEnableMask_1g & (1 << ichan))
|
||||
++nachans;
|
||||
}
|
||||
@ -735,8 +721,7 @@ void setADCEnableMask_10G(uint32_t mask) {
|
||||
uint8_t actualMask = 0;
|
||||
if (mask != 0) {
|
||||
int ival = 0;
|
||||
int ich = 0;
|
||||
for (ich = 0; ich < NCHAN_ANALOG; ich = ich + 4) {
|
||||
for (int ich = 0; ich < NCHAN_ANALOG; ich = ich + 4) {
|
||||
if ((1 << ich) & mask) {
|
||||
actualMask |= (1 << ival);
|
||||
}
|
||||
@ -766,13 +751,11 @@ uint32_t getADCEnableMask_10G() {
|
||||
// convert 8 bit mask to 32 bit mask
|
||||
uint32_t retval = 0;
|
||||
if (adcEnableMask_10g) {
|
||||
int ival = 0;
|
||||
int iloop = 0;
|
||||
for (ival = 0; ival < 8; ++ival) {
|
||||
for (int ival = 0; ival < 8; ++ival) {
|
||||
// if bit in 8 bit mask set
|
||||
if ((1 << ival) & adcEnableMask_10g) {
|
||||
// set it for 4 bits in 32 bit mask
|
||||
for (iloop = 0; iloop < 4; ++iloop) {
|
||||
for (int iloop = 0; iloop < 4; ++iloop) {
|
||||
retval |= (1 << (ival * 4 + iloop));
|
||||
}
|
||||
}
|
||||
@ -1196,9 +1179,8 @@ int getVChipToSet(enum DACINDEX ind, int val) {
|
||||
// get maximum value of the adc values (minimum is 0)
|
||||
int max = 0;
|
||||
|
||||
int ipwr = 0;
|
||||
// loop through the adcs
|
||||
for (ipwr = 0; ipwr < NPWR - 1; ++ipwr) {
|
||||
for (int ipwr = 0; ipwr < NPWR - 1; ++ipwr) {
|
||||
|
||||
// get the dac values for each adc
|
||||
int dacmV = getPower(getDACIndexFromADCIndex(ipwr));
|
||||
@ -1632,7 +1614,6 @@ int enableTenGigabitEthernet(int val) {
|
||||
} else {
|
||||
bus_w(addr, bus_r(addr) & (~CONFIG_GB10_SND_UDP_MSK));
|
||||
}
|
||||
// configuremac called from client
|
||||
}
|
||||
return ((bus_r(addr) & CONFIG_GB10_SND_UDP_MSK) >>
|
||||
CONFIG_GB10_SND_UDP_OFST);
|
||||
@ -1911,19 +1892,6 @@ uint64_t writePatternIOControl(uint64_t word) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
uint64_t writePatternClkControl(uint64_t word) {
|
||||
if ((int64_t)word != -1) {
|
||||
LOG(logINFO,
|
||||
("Setting Pattern Clock Control: 0x%llx\n", (long long int)word));
|
||||
set64BitReg(word, PATTERN_IO_CLK_CNTRL_LSB_REG,
|
||||
PATTERN_IO_CLK_CNTRL_MSB_REG);
|
||||
}
|
||||
uint64_t retval =
|
||||
get64BitReg(PATTERN_IO_CLK_CNTRL_LSB_REG, PATTERN_IO_CLK_CNTRL_MSB_REG);
|
||||
LOG(logDEBUG1, (" Clock Control retval: 0x%llx\n", (long long int)retval));
|
||||
return retval;
|
||||
}
|
||||
|
||||
uint64_t readPatternWord(int addr) {
|
||||
// error (handled in tcp)
|
||||
if (addr < 0 || addr >= MAX_PATTERN_LENGTH) {
|
||||
@ -1950,7 +1918,9 @@ uint64_t readPatternWord(int addr) {
|
||||
uint64_t retval = get64BitReg(PATTERN_OUT_LSB_REG, PATTERN_OUT_MSB_REG);
|
||||
LOG(logDEBUG1,
|
||||
(" Word(addr:0x%x) retval: 0x%llx\n", addr, (long long int)retval));
|
||||
|
||||
#ifdef VIRTUAL
|
||||
retval = virtual_pattern[addr];
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -1967,8 +1937,8 @@ uint64_t writePatternWord(int addr, uint64_t word) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
LOG(logINFO, ("Setting Pattern Word (addr:0x%x, word:0x%llx)\n", addr,
|
||||
(long long int)word));
|
||||
LOG(logDEBUG1, ("Setting Pattern Word (addr:0x%x, word:0x%llx)\n", addr,
|
||||
(long long int)word));
|
||||
uint32_t reg = PATTERN_CNTRL_REG;
|
||||
|
||||
// write word
|
||||
@ -1984,6 +1954,9 @@ uint64_t writePatternWord(int addr, uint64_t word) {
|
||||
|
||||
// unset write strobe
|
||||
bus_w(reg, bus_r(reg) & (~PATTERN_CNTRL_WR_MSK));
|
||||
#ifdef VIRTUAL
|
||||
virtual_pattern[addr] = word;
|
||||
#endif
|
||||
|
||||
return word;
|
||||
// return readPatternWord(addr); // will start executing the pattern
|
||||
@ -2161,18 +2134,15 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) {
|
||||
LOG(logDEBUG1, ("Addr:0x%x, val:0x%x\n", addr, bus_r(addr)));
|
||||
}
|
||||
|
||||
// get
|
||||
else {
|
||||
*startAddr = ((bus_r(addr) & startMask) >> startOffset);
|
||||
LOG(logDEBUG1, ("Getting Pattern Loop Start Address (level:%d, Read "
|
||||
"startAddr:0x%x)\n",
|
||||
level, *startAddr));
|
||||
*startAddr = ((bus_r(addr) & startMask) >> startOffset);
|
||||
LOG(logDEBUG1, ("Getting Pattern Loop Start Address (level:%d, Read "
|
||||
"startAddr:0x%x)\n",
|
||||
level, *startAddr));
|
||||
|
||||
*stopAddr = ((bus_r(addr) & stopMask) >> stopOffset);
|
||||
LOG(logDEBUG1, ("Getting Pattern Loop Stop Address (level:%d, Read "
|
||||
"stopAddr:0x%x)\n",
|
||||
level, *stopAddr));
|
||||
}
|
||||
*stopAddr = ((bus_r(addr) & stopMask) >> stopOffset);
|
||||
LOG(logDEBUG1, ("Getting Pattern Loop Stop Address (level:%d, Read "
|
||||
"stopAddr:0x%x)\n",
|
||||
level, *stopAddr));
|
||||
}
|
||||
|
||||
int setLEDEnable(int enable) {
|
||||
@ -2242,22 +2212,15 @@ int startStateMachine() {
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFOBLUE, ("Starting State Machine\n"));
|
||||
virtual_status = 1;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
virtual_stop = ComVirtual_getStop();
|
||||
if (virtual_stop != 0) {
|
||||
LOG(logERROR, ("Cant start acquisition. "
|
||||
"Stop server has not updated stop status to 0\n"));
|
||||
return FAIL;
|
||||
}
|
||||
if (sharedMemory_getStop() != 0) {
|
||||
LOG(logERROR, ("Cant start acquisition. "
|
||||
"Stop server has not updated stop status to 0\n"));
|
||||
return FAIL;
|
||||
}
|
||||
sharedMemory_setStatus(RUNNING);
|
||||
if (pthread_create(&pthread_virtual_tid, NULL, &start_timer, NULL)) {
|
||||
LOG(logERROR, ("Could not start Virtual acquisition thread\n"));
|
||||
virtual_status = 0;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
}
|
||||
sharedMemory_setStatus(IDLE);
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFOGREEN, ("Virtual Acquisition started\n"));
|
||||
@ -2310,78 +2273,65 @@ void *start_timer(void *arg) {
|
||||
// Generate Data
|
||||
char imageData[imageSize];
|
||||
memset(imageData, 0, imageSize);
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < imageSize; i += sizeof(uint16_t)) {
|
||||
*((uint16_t *)(imageData + i)) = i;
|
||||
}
|
||||
for (int i = 0; i < imageSize; i += sizeof(uint16_t)) {
|
||||
*((uint16_t *)(imageData + i)) = i;
|
||||
}
|
||||
|
||||
// Send data
|
||||
{
|
||||
int frameNr = 0;
|
||||
// loop over number of frames
|
||||
for (frameNr = 0; frameNr != numFrames; ++frameNr) {
|
||||
// loop over number of frames
|
||||
for (int frameNr = 0; frameNr != numFrames; ++frameNr) {
|
||||
|
||||
// update the virtual stop from stop server
|
||||
virtual_stop = ComVirtual_getStop();
|
||||
// check if virtual_stop is high
|
||||
if (virtual_stop == 1) {
|
||||
break;
|
||||
}
|
||||
// check if manual stop
|
||||
if (sharedMemory_getStop() == 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
// sleep for exposure time
|
||||
struct timespec begin, end;
|
||||
clock_gettime(CLOCK_REALTIME, &begin);
|
||||
usleep(expUs);
|
||||
// sleep for exposure time
|
||||
struct timespec begin, end;
|
||||
clock_gettime(CLOCK_REALTIME, &begin);
|
||||
usleep(expUs);
|
||||
|
||||
int srcOffset = 0;
|
||||
// loop packet
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i != packetsPerFrame; ++i) {
|
||||
int srcOffset = 0;
|
||||
// loop packet
|
||||
for (int i = 0; i != packetsPerFrame; ++i) {
|
||||
|
||||
char packetData[packetSize];
|
||||
memset(packetData, 0, packetSize);
|
||||
// set header
|
||||
sls_detector_header *header =
|
||||
(sls_detector_header *)(packetData);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||
header->frameNumber = frameNr;
|
||||
header->packetNumber = i;
|
||||
header->modId = 0;
|
||||
header->row = detPos[X];
|
||||
header->column = detPos[Y];
|
||||
char packetData[packetSize];
|
||||
memset(packetData, 0, packetSize);
|
||||
// set header
|
||||
sls_detector_header *header = (sls_detector_header *)(packetData);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||
header->frameNumber = virtual_currentFrameNumber;
|
||||
header->packetNumber = i;
|
||||
header->modId = 0;
|
||||
header->row = detPos[X];
|
||||
header->column = detPos[Y];
|
||||
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header),
|
||||
imageData + srcOffset, dataSize);
|
||||
srcOffset += dataSize;
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header),
|
||||
imageData + srcOffset, dataSize);
|
||||
srcOffset += dataSize;
|
||||
|
||||
sendUDPPacket(0, packetData, packetSize);
|
||||
}
|
||||
}
|
||||
LOG(logINFO, ("Sent frame: %d\n", frameNr));
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
||||
(end.tv_nsec - begin.tv_nsec));
|
||||
sendUDPPacket(0, packetData, packetSize);
|
||||
}
|
||||
LOG(logINFO, ("Sent frame: %d [%lld]\n", frameNr,
|
||||
(long long unsigned int)virtual_currentFrameNumber));
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
int64_t timeNs =
|
||||
((end.tv_sec - begin.tv_sec) * 1E9 + (end.tv_nsec - begin.tv_nsec));
|
||||
|
||||
// sleep for (period - exptime)
|
||||
if (frameNr < numFrames) { // if there is a next frame
|
||||
if (periodNs > timeNs) {
|
||||
usleep((periodNs - timeNs) / 1000);
|
||||
}
|
||||
// sleep for (period - exptime)
|
||||
if (frameNr < numFrames) { // if there is a next frame
|
||||
if (periodNs > timeNs) {
|
||||
usleep((periodNs - timeNs) / 1000);
|
||||
}
|
||||
}
|
||||
++virtual_currentFrameNumber;
|
||||
}
|
||||
|
||||
closeUDPSocket(0);
|
||||
|
||||
virtual_status = 0;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
}
|
||||
sharedMemory_setStatus(IDLE);
|
||||
LOG(logINFOBLUE, ("Finished Acquiring\n"));
|
||||
return NULL;
|
||||
}
|
||||
@ -2389,46 +2339,47 @@ void *start_timer(void *arg) {
|
||||
|
||||
int stopStateMachine() {
|
||||
LOG(logINFORED, ("Stopping State Machine\n"));
|
||||
#ifdef VIRTUAL
|
||||
if (!isControlServer) {
|
||||
virtual_stop = 1;
|
||||
ComVirtual_setStop(virtual_stop);
|
||||
// read till status is idle
|
||||
int tempStatus = 1;
|
||||
while (tempStatus == 1) {
|
||||
tempStatus = ComVirtual_getStatus();
|
||||
}
|
||||
virtual_stop = 0;
|
||||
ComVirtual_setStop(virtual_stop);
|
||||
LOG(logINFO, ("Stopped State Machine\n"));
|
||||
// if scan active, stop scan first
|
||||
if (sharedMemory_getScanStatus() == RUNNING) {
|
||||
sharedMemory_setScanStop(1);
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
sharedMemory_setStop(1);
|
||||
// read till status is idle
|
||||
while (sharedMemory_getStatus() == RUNNING)
|
||||
;
|
||||
sharedMemory_setStop(0);
|
||||
LOG(logINFO, ("Stopped State Machine\n"));
|
||||
return OK;
|
||||
#endif
|
||||
// stop state machine
|
||||
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STP_ACQSTN_MSK);
|
||||
usleep(WAIT_TIME_US_STP_ACQ);
|
||||
bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_STP_ACQSTN_MSK);
|
||||
|
||||
LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG)));
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
enum runStatus getRunStatus() {
|
||||
#ifdef VIRTUAL
|
||||
if (!isControlServer) {
|
||||
virtual_status = ComVirtual_getStatus();
|
||||
LOG(logDEBUG1, ("Getting status\n"));
|
||||
// scan error or running
|
||||
if (sharedMemory_getScanStatus() == ERROR) {
|
||||
LOG(logINFOBLUE, ("Status: scan ERROR\n"));
|
||||
return ERROR;
|
||||
}
|
||||
if (virtual_status == 0) {
|
||||
LOG(logINFOBLUE, ("Status: IDLE\n"));
|
||||
return IDLE;
|
||||
} else {
|
||||
if (sharedMemory_getScanStatus() == RUNNING) {
|
||||
LOG(logINFOBLUE, ("Status: scan RUNNING\n"));
|
||||
return RUNNING;
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
if (sharedMemory_getStatus() == RUNNING) {
|
||||
LOG(logINFOBLUE, ("Status: RUNNING\n"));
|
||||
return RUNNING;
|
||||
}
|
||||
LOG(logINFOBLUE, ("Status: IDLE\n"));
|
||||
return IDLE;
|
||||
#endif
|
||||
LOG(logDEBUG1, ("Getting status\n"));
|
||||
|
||||
uint32_t retval = bus_r(STATUS_REG);
|
||||
LOG(logINFO, ("Status Register: %08x\n", retval));
|
||||
|
||||
@ -2555,11 +2506,8 @@ void readSample(int ns) {
|
||||
bus_w(addr, bus_r(addr) & (~DUMMY_ANLG_FIFO_RD_STRBE_MSK));
|
||||
|
||||
// wait for 1 us to latch different clocks of read and read strobe
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < WAIT_TIME_1US_FOR_LOOP_CNT; ++i)
|
||||
;
|
||||
}
|
||||
for (int i = 0; i < WAIT_TIME_1US_FOR_LOOP_CNT; ++i)
|
||||
;
|
||||
|
||||
if (!(ns % 1000)) {
|
||||
LOG(logDEBUG1, ("Reading sample ns:%d of %d AEmtpy:0x%x AFull:0x%x "
|
||||
@ -2569,8 +2517,7 @@ void readSample(int ns) {
|
||||
}
|
||||
|
||||
// loop through all channels
|
||||
int ich = 0;
|
||||
for (ich = 0; ich < NCHAN_ANALOG; ++ich) {
|
||||
for (int ich = 0; ich < NCHAN_ANALOG; ++ich) {
|
||||
|
||||
// if channel is in enable mask
|
||||
if ((1 << ich) & (adcEnableMask_1g)) {
|
||||
@ -2604,11 +2551,8 @@ void readSample(int ns) {
|
||||
bus_w(addr, bus_r(addr) & (~DUMMY_DGTL_FIFO_RD_STRBE_MSK));
|
||||
|
||||
// wait for 1 us to latch different clocks of read and read strobe
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < WAIT_TIME_1US_FOR_LOOP_CNT; ++i)
|
||||
;
|
||||
}
|
||||
for (int i = 0; i < WAIT_TIME_1US_FOR_LOOP_CNT; ++i)
|
||||
;
|
||||
|
||||
// wait as it is connected directly to fifo running on a different clock
|
||||
if (!(ns % 1000)) {
|
||||
@ -2706,10 +2650,7 @@ int readFrameFromFifo() {
|
||||
|
||||
uint32_t runBusy() {
|
||||
#ifdef VIRTUAL
|
||||
if (!isControlServer) {
|
||||
virtual_status = ComVirtual_getStatus();
|
||||
}
|
||||
return virtual_status;
|
||||
return ((sharedMemory_getStatus() == RUNNING) ? 1 : 0);
|
||||
#endif
|
||||
uint32_t s = (bus_r(STATUS_REG) & STATUS_RN_BSY_MSK);
|
||||
// LOG(logDEBUG1, ("Status Register: %08x\n", s));
|
||||
@ -2735,8 +2676,7 @@ void getNumberOfChannels(int *nchanx, int *nchany) {
|
||||
if (mask == BIT32_MASK) {
|
||||
nachans = NCHAN_ANALOG;
|
||||
} else {
|
||||
int ich = 0;
|
||||
for (ich = 0; ich < NCHAN_ANALOG; ++ich) {
|
||||
for (int ich = 0; ich < NCHAN_ANALOG; ++ich) {
|
||||
if ((mask & (1 << ich)) != 0U)
|
||||
++nachans;
|
||||
}
|
||||
|
@ -133,7 +133,6 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, SYNC_CLK, DBIT_CLK, NUM_CLOCKS };
|
||||
#define VIO_MIN_MV (1200) // for fpga to function
|
||||
|
||||
/* Defines in the Firmware */
|
||||
#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)
|
||||
|
@ -141,8 +141,7 @@ void Beb_Beb(int id) {
|
||||
exit(1);
|
||||
|
||||
LOG(logDEBUG1, ("Printing Beb infos:\n"));
|
||||
unsigned int i;
|
||||
for (i = 1; i < bebInfoSize; i++)
|
||||
for (unsigned int i = 1; i < bebInfoSize; i++)
|
||||
BebInfo_Print(&beb_infos[i]);
|
||||
|
||||
Beb_bit_mode = 4;
|
||||
@ -749,11 +748,7 @@ void Beb_ResetFrameNumber() {
|
||||
}
|
||||
}
|
||||
|
||||
void Beb_ClearBebInfos() {
|
||||
// unsigned int i;
|
||||
// for(i=0;i<bebInfoSize;i++) free(beb_infos[i]);
|
||||
bebInfoSize = 0;
|
||||
}
|
||||
void Beb_ClearBebInfos() { bebInfoSize = 0; }
|
||||
|
||||
int Beb_InitBebInfos() { // file name at some point
|
||||
Beb_ClearBebInfos();
|
||||
@ -817,8 +812,8 @@ int Beb_SetBebSrcHeaderInfos(unsigned int beb_number, int ten_gig,
|
||||
}
|
||||
|
||||
int Beb_CheckSourceStuffBebInfo() {
|
||||
unsigned int i;
|
||||
for (i = 1; i < bebInfoSize; i++) { // header stuff always starts from 1
|
||||
for (unsigned int i = 1; i < bebInfoSize;
|
||||
i++) { // header stuff always starts from 1
|
||||
if (!Beb_SetHeaderData(BebInfo_GetBebNumber(&beb_infos[i]), 0,
|
||||
"00:00:00:00:00:00", "10.0.0.1", 20000) ||
|
||||
!Beb_SetHeaderData(BebInfo_GetBebNumber(&beb_infos[i]), 1,
|
||||
@ -833,10 +828,7 @@ int Beb_CheckSourceStuffBebInfo() {
|
||||
}
|
||||
|
||||
unsigned int Beb_GetBebInfoIndex(unsigned int beb_numb) {
|
||||
/******************** if (!beb_numb) return
|
||||
* 0;******************************/
|
||||
unsigned int i;
|
||||
for (i = 1; i < bebInfoSize; i++)
|
||||
for (unsigned int i = 1; i < bebInfoSize; i++)
|
||||
if (beb_numb == BebInfo_GetBebNumber(&beb_infos[i])) {
|
||||
LOG(logDEBUG1,
|
||||
("*****found beb index:%d, for beb number:%d\n", i, beb_numb));
|
||||
@ -870,14 +862,13 @@ int Beb_WriteTo(unsigned int index) {
|
||||
}
|
||||
|
||||
void Beb_SwapDataFun(int little_endian, unsigned int n, unsigned int *d) {
|
||||
unsigned int i;
|
||||
if (little_endian)
|
||||
for (i = 0; i < n; i++)
|
||||
for (unsigned int i = 0; i < n; i++)
|
||||
d[i] = (((d[i] & 0xff) << 24) | ((d[i] & 0xff00) << 8) |
|
||||
((d[i] & 0xff0000) >> 8) |
|
||||
((d[i] & 0xff000000) >> 24)); // little_endian
|
||||
else
|
||||
for (i = 0; i < n; i++)
|
||||
for (unsigned int i = 0; i < n; i++)
|
||||
d[i] = (((d[i] & 0xffff) << 16) | ((d[i] & 0xffff0000) >> 16));
|
||||
}
|
||||
|
||||
@ -976,13 +967,9 @@ udp_header_type udp_header = {
|
||||
|
||||
unsigned int *base_ptr = (unsigned int *)&udp_header;
|
||||
unsigned int num_words = (sizeof(struct udp_header_type) + 3) / 4;
|
||||
// for(unsigned int i=0; i<num_words; i++) word_ptr[i] = base_ptr[i];
|
||||
// for(unsigned int i=num_words; i<16; i++) word_ptr[i] = 0;
|
||||
// return word_ptr;
|
||||
unsigned int i;
|
||||
for (i = 0; i < num_words; i++)
|
||||
for (unsigned int i = 0; i < num_words; i++)
|
||||
Beb_send_data[i + 2] = base_ptr[i];
|
||||
for (i = num_words; i < 16; i++)
|
||||
for (unsigned int i = num_words; i < 16; i++)
|
||||
Beb_send_data[i + 2] = 0;
|
||||
|
||||
return 1;
|
||||
@ -1046,8 +1033,7 @@ void Beb_AdjustIPChecksum(struct udp_header_type *ip) {
|
||||
|
||||
// calc ip checksum
|
||||
unsigned int ip_checksum = 0;
|
||||
unsigned int i;
|
||||
for (i = 0; i < 10; i++) {
|
||||
for (unsigned int i = 0; i < 10; i++) {
|
||||
ip_checksum += ((cptr[2 * i] << 8) + (cptr[2 * i + 1]));
|
||||
if (ip_checksum & 0x00010000)
|
||||
ip_checksum = (ip_checksum + 1) & 0x0000ffff;
|
||||
@ -1190,11 +1176,9 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig,
|
||||
LOG(logERROR, ("Beb Request N Images FAIL\n"));
|
||||
return 0;
|
||||
} else {
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 10; i++)
|
||||
LOG(logDEBUG1,
|
||||
("%X\n", Beb_Read32(csp0base, (LEFT_OFFSET + i * 4))));
|
||||
for (int i = 0; i < 10; i++) {
|
||||
LOG(logDEBUG1,
|
||||
("%X\n", Beb_Read32(csp0base, (LEFT_OFFSET + i * 4))));
|
||||
}
|
||||
// Generating commands
|
||||
u_int32_t send_header_command =
|
||||
@ -1203,13 +1187,11 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig,
|
||||
u_int32_t send_frame_command =
|
||||
0x62000000 | (!test_just_send_out_packets_no_wait) << 27 |
|
||||
(ten_gig == 1) << 24 | packet_size << 14 | (npackets - 1);
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 10; i++)
|
||||
LOG(logDEBUG1,
|
||||
("%X\n", Beb_Read32(csp0base, (LEFT_OFFSET + i * 4))));
|
||||
LOG(logDEBUG1, ("%d\n", in_two_requests));
|
||||
for (int i = 0; i < 10; i++) {
|
||||
LOG(logDEBUG1,
|
||||
("%X\n", Beb_Read32(csp0base, (LEFT_OFFSET + i * 4))));
|
||||
}
|
||||
LOG(logDEBUG1, ("%d\n", in_two_requests));
|
||||
//"0x20 << 8" is dst_number (0x00 for left, 0x20 for right)
|
||||
// Left
|
||||
Beb_Write32(csp0base, (LEFT_OFFSET + FIRST_CMD_PART1_OFFSET), 0);
|
||||
@ -1246,14 +1228,12 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig,
|
||||
nimages * (2 + in_two_requests));
|
||||
Beb_Write32(csp0base, (RIGHT_OFFSET + COMMAND_COUNTER_OFFSET),
|
||||
nimages * (2 + in_two_requests));
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 10; i++)
|
||||
LOG(logDEBUG1,
|
||||
("%X\n", Beb_Read32(csp0base,
|
||||
(LEFT_OFFSET + i * 4)))); //*(ptrl+i));
|
||||
LOG(logDEBUG1, ("%d\n", in_two_requests));
|
||||
for (int i = 0; i < 10; i++) {
|
||||
LOG(logDEBUG1,
|
||||
("%X\n", Beb_Read32(csp0base,
|
||||
(LEFT_OFFSET + i * 4)))); //*(ptrl+i));
|
||||
}
|
||||
LOG(logDEBUG1, ("%d\n", in_two_requests));
|
||||
Beb_close(fd, csp0base);
|
||||
|
||||
LOG(logDEBUG1, ("----Beb_RequestNImages----\n"));
|
||||
@ -1275,8 +1255,7 @@ int Beb_Test(unsigned int beb_number) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int i;
|
||||
for (i = 0; i < 64; i++) {
|
||||
for (unsigned int i = 0; i < 64; i++) {
|
||||
if (!Beb_SetUpUDPHeader(beb_number, 0, i, "60:fb:42:f4:e3:d2",
|
||||
"129.129.205.186", 22000 + i)) {
|
||||
LOG(logERROR, ("Error setting up header table....\n"));
|
||||
@ -1288,7 +1267,7 @@ int Beb_Test(unsigned int beb_number) {
|
||||
// left_right, int ten_gig, unsigned int dst_number, unsigned int
|
||||
// npackets, unsigned int packet_size, int
|
||||
// stop_read_when_fifo_empty=1);
|
||||
for (i = 0; i < 64; i++) {
|
||||
for (unsigned int i = 0; i < 64; i++) {
|
||||
if (!Beb_SendMultiReadRequest(beb_number, i % 3 + 1, 0, i, 1, 0, 1)) {
|
||||
LOG(logERROR, ("Error requesting data....\n"));
|
||||
return 0;
|
||||
|
@ -5,7 +5,7 @@ set(src
|
||||
../slsDetectorServer/src/communication_funcs.c
|
||||
../slsDetectorServer/src/communication_funcs_UDP.c
|
||||
../slsDetectorServer/src/common.c
|
||||
../slsDetectorServer/src/communication_virtual.c
|
||||
../slsDetectorServer/src/sharedMemory.c
|
||||
)
|
||||
|
||||
include_directories(
|
||||
@ -58,7 +58,7 @@ target_compile_definitions(eigerDetectorServerSlaveTop_virtual
|
||||
)
|
||||
|
||||
target_link_libraries(eigerDetectorServerSlaveTop_virtual
|
||||
PUBLIC pthread rt
|
||||
PUBLIC pthread rt slsProjectCSettings
|
||||
)
|
||||
|
||||
set_target_properties(eigerDetectorServerSlaveTop_virtual PROPERTIES
|
||||
@ -86,7 +86,7 @@ target_compile_definitions(eigerDetectorServerSlaveBottom_virtual
|
||||
)
|
||||
|
||||
target_link_libraries(eigerDetectorServerSlaveBottom_virtual
|
||||
PUBLIC pthread rt
|
||||
PUBLIC pthread rt slsProjectCSettings
|
||||
)
|
||||
|
||||
set_target_properties(eigerDetectorServerSlaveBottom_virtual PROPERTIES
|
||||
@ -96,3 +96,7 @@ 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)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,123 +3,67 @@
|
||||
#include "slsDetectorServer_defs.h"
|
||||
#include <netinet/in.h>
|
||||
|
||||
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);
|
||||
|
||||
// setup
|
||||
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);
|
||||
void Feb_Control_FebControl();
|
||||
int Feb_Control_Init(int master, 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
|
||||
int Feb_Control_SetHighVoltage(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_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_SetDAC(unsigned int ch, int value);
|
||||
|
||||
// trimbits
|
||||
int Feb_Control_SetTrimbits(unsigned int *trimbits, int top);
|
||||
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();
|
||||
void Feb_Control_FebControl();
|
||||
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_GetNModules();
|
||||
unsigned int Feb_Control_GetNHalfModules();
|
||||
|
||||
int Feb_Control_SetHighVoltage(int value);
|
||||
int Feb_Control_GetHighVoltage(int *value);
|
||||
|
||||
int Feb_Control_SendHighVoltage(int dacvalue);
|
||||
int Feb_Control_ReceiveHighVoltage(unsigned int *value);
|
||||
|
||||
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);
|
||||
int Feb_Control_Reset();
|
||||
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_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_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_SetNExposures(unsigned int n_images);
|
||||
unsigned int Feb_Control_GetNExposures();
|
||||
int Feb_Control_SetExposureTime(double the_exposure_time_in_sec);
|
||||
@ -132,25 +76,20 @@ 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_PulsePixelNMove(int npulses, int inc_x_pos, int inc_y_pos);
|
||||
int Feb_Control_Shift32InSerialIn(unsigned int value_to_shift_in);
|
||||
@ -158,6 +97,7 @@ 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);
|
||||
@ -166,22 +106,8 @@ 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_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);
|
||||
|
@ -41,14 +41,13 @@ void Feb_Interface_FebInterface() {
|
||||
ll, XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT_BASEADDR);
|
||||
}
|
||||
|
||||
void Feb_Interface_SendCompleteList(unsigned int n, unsigned int *list) {
|
||||
unsigned int i;
|
||||
void Feb_Interface_SetAddress(unsigned int leftAddr, unsigned int rightAddr) {
|
||||
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];
|
||||
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;
|
||||
}
|
||||
|
||||
int Feb_Interface_WriteTo(unsigned int ch) {
|
||||
@ -72,7 +71,6 @@ int Feb_Interface_WriteTo(unsigned int ch) {
|
||||
}
|
||||
|
||||
int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys) {
|
||||
unsigned int t;
|
||||
if (ch >= 0xfff)
|
||||
return 0;
|
||||
|
||||
@ -81,7 +79,7 @@ int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys) {
|
||||
usleep(20);
|
||||
|
||||
Feb_Interface_recv_ndata = -1;
|
||||
for (t = 0; t < ntrys; t++) {
|
||||
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) /
|
||||
@ -102,12 +100,13 @@ int Feb_Interface_SetByteOrder() {
|
||||
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++)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -119,8 +118,6 @@ int Feb_Interface_ReadRegister(unsigned int sub_num, unsigned int reg_num,
|
||||
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;
|
||||
@ -128,7 +125,7 @@ int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads,
|
||||
Feb_Interface_send_ndata = nreads + 2;
|
||||
Feb_Interface_send_data[0] = 0x20000000 | nreads << 14;
|
||||
|
||||
for (i = 0; i < nreads; i++)
|
||||
for (unsigned int i = 0; i < nreads; i++)
|
||||
Feb_Interface_send_data[i + 1] = reg_nums[i];
|
||||
Feb_Interface_send_data[nreads + 1] = 0;
|
||||
|
||||
@ -137,7 +134,7 @@ int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads,
|
||||
Feb_Interface_recv_ndata != (int)(nreads + 2))
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < nreads; i++)
|
||||
for (unsigned int i = 0; i < nreads; i++)
|
||||
values_read[i] = Feb_Interface_recv_data[i + 1];
|
||||
|
||||
return 1;
|
||||
@ -154,7 +151,6 @@ 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;
|
||||
@ -165,13 +161,13 @@ int Feb_Interface_WriteRegisters(unsigned int sub_num, unsigned int nwrites,
|
||||
Feb_Interface_send_data[0] = 0x80000000 | nwrites << 14;
|
||||
Feb_Interface_send_data[2 * nwrites + 1] = 0;
|
||||
|
||||
for (i = 0; i < nwrites; i++)
|
||||
for (unsigned int i = 0; i < nwrites; i++)
|
||||
Feb_Interface_send_data[2 * i + 1] = 0x3fff & reg_nums[i];
|
||||
for (i = 0; i < nwrites; 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 (i = 0; i < nwrites; i++)
|
||||
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);
|
||||
|
||||
@ -211,7 +207,6 @@ 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;
|
||||
@ -226,7 +221,7 @@ int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num,
|
||||
start_address; // cmd -> write to memory, nwrites, mem number, start
|
||||
// address
|
||||
Feb_Interface_send_data[nwrites + 1] = 0;
|
||||
for (i = 0; i < nwrites; i++)
|
||||
for (unsigned int i = 0; i < nwrites; i++)
|
||||
Feb_Interface_send_data[i + 1] = values[i];
|
||||
|
||||
if (!Feb_Interface_WriteTo(sub_num))
|
||||
|
@ -3,7 +3,7 @@
|
||||
int Feb_Interface_WriteTo(unsigned int ch);
|
||||
int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys);
|
||||
void Feb_Interface_FebInterface();
|
||||
void Feb_Interface_SendCompleteList(unsigned int n, unsigned int *list);
|
||||
void Feb_Interface_SetAddress(unsigned int leftAddr, unsigned int rightAddr);
|
||||
int Feb_Interface_SetByteOrder();
|
||||
int Feb_Interface_ReadRegister(unsigned int sub_num, unsigned int reg_num,
|
||||
unsigned int *value_read);
|
||||
|
@ -81,7 +81,6 @@ int Local_Write(struct LocalLinkInterface *ll, unsigned int buffer_len,
|
||||
// note: buffer must be word (4 byte) aligned
|
||||
// frame_len in byte
|
||||
int vacancy = 0;
|
||||
int i;
|
||||
int words_send = 0;
|
||||
int last_word;
|
||||
unsigned int *word_ptr;
|
||||
@ -96,7 +95,7 @@ int Local_Write(struct LocalLinkInterface *ll, unsigned int buffer_len,
|
||||
|
||||
LOG(logDEBUG1, ("LL Write - Len: %2d - If: %X - Data: ", buffer_len,
|
||||
ll->ll_fifo_base));
|
||||
for (i = 0; i < buffer_len / 4; i++)
|
||||
for (int i = 0; i < buffer_len / 4; i++)
|
||||
LOG(logDEBUG1, ("%.8X ", *(((unsigned *)buffer) + i)));
|
||||
|
||||
while (words_send <= last_word) {
|
||||
@ -112,8 +111,8 @@ int Local_Write(struct LocalLinkInterface *ll, unsigned int buffer_len,
|
||||
}
|
||||
|
||||
// Just to know: #define PLB_LL_FIFO_ALMOST_FULL_THRESHOLD_WORDS 100
|
||||
for (i = 0; ((i < PLB_LL_FIFO_ALMOST_FULL_THRESHOLD_WORDS) &&
|
||||
(words_send <= last_word));
|
||||
for (int i = 0; ((i < PLB_LL_FIFO_ALMOST_FULL_THRESHOLD_WORDS) &&
|
||||
(words_send <= last_word));
|
||||
i++) {
|
||||
fifo_ctrl = 0;
|
||||
if (words_send == 0) {
|
||||
|
@ -6,14 +6,14 @@ support_lib = ../../slsSupportLib/include/
|
||||
BLACKFIN_CC = bfin-uclinux-gcc
|
||||
CROSS = powerpc-4xx-softfloat-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -DEIGERD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm
|
||||
CFLAGS += -Wall -std=gnu99 -DEIGERD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm -lrt -pthread
|
||||
PROGS = eigerDetectorServer
|
||||
DESTDIR = bin
|
||||
INSTMODE = 0777
|
||||
|
||||
SRCS = slsDetectorFunctionList.c HardwareIO.c LocalLinkInterface.c FebInterface.c FebControl.c Beb.c
|
||||
SRCS += $(main_src)communication_funcs.c $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs_UDP.c $(main_src)common.c
|
||||
SRCS += $(main_src)communication_funcs.c $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs_UDP.c $(main_src)common.c $(main_src)/sharedMemory.c
|
||||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
@ -33,6 +33,7 @@ $(PROGS): $(OBJS)
|
||||
mkdir -p $(DESTDIR)
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
|
||||
mv $(PROGS) $(DESTDIR)
|
||||
cp config_eiger.txt $(DESTDIR)
|
||||
|
||||
|
||||
hv9m_blackfin_server:9mhvserial_bf.c
|
||||
|
Binary file not shown.
0
slsDetectorServers/eigerDetectorServer/config.txt → slsDetectorServers/eigerDetectorServer/config_eiger.txt
Normal file → Executable file
0
slsDetectorServers/eigerDetectorServer/config.txt → slsDetectorServers/eigerDetectorServer/config_eiger.txt
Normal file → Executable file
@ -1,13 +1,12 @@
|
||||
#include "slsDetectorFunctionList.h"
|
||||
#include "clogger.h"
|
||||
#include "common.h"
|
||||
#include "sharedMemory.h"
|
||||
#include "versionAPI.h"
|
||||
|
||||
#ifndef VIRTUAL
|
||||
#include "Beb.h"
|
||||
#include "FebControl.h"
|
||||
#else
|
||||
#include "communication_virtual.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
@ -33,10 +32,6 @@ int initError = OK;
|
||||
int initCheckDone = 0;
|
||||
char initErrorMessage[MAX_STR_LENGTH];
|
||||
|
||||
const char *dac_names[16] = {"SvP", "Vtr", "Vrf", "Vrs",
|
||||
"SvN", "Vtgstv", "Vcmp_ll", "Vcmp_lr",
|
||||
"cal", "Vcmp_rl", "rxb_rb", "rxb_lb",
|
||||
"Vcmp_rr", "Vcp", "Vcn", "Vis"};
|
||||
int default_tau_from_file = -1;
|
||||
enum detectorSettings thisSettings;
|
||||
sls_detector_module *detectorModules = NULL;
|
||||
@ -64,7 +59,6 @@ int eiger_iodelay = 0;
|
||||
int eiger_photonenergy = 0;
|
||||
int eiger_dynamicrange = 0;
|
||||
int eiger_parallelmode = 0;
|
||||
int eiger_storeinmem = 0;
|
||||
int eiger_overflow32 = 0;
|
||||
int eiger_readoutspeed = 0;
|
||||
int eiger_triggermode = 0;
|
||||
@ -76,8 +70,6 @@ int eiger_tau_ns = 0;
|
||||
|
||||
#ifdef VIRTUAL
|
||||
pthread_t virtual_tid;
|
||||
int virtual_status = 0;
|
||||
int virtual_stop = 0;
|
||||
// values for virtual server
|
||||
int64_t eiger_virtual_exptime = 0;
|
||||
int64_t eiger_virtual_subexptime = 0;
|
||||
@ -256,9 +248,10 @@ u_int64_t getDetectorMAC() {
|
||||
// execute and get address
|
||||
char output[255];
|
||||
#ifdef VIRTUAL
|
||||
FILE *sysFile = popen("cat /sys/class/net/$(ip route show default | awk "
|
||||
"'/default/ {print $5}')/address",
|
||||
"r");
|
||||
FILE *sysFile =
|
||||
popen("cat /sys/class/net/$(ip route show default | grep -v vpn | awk "
|
||||
"'/default/ {print $5}')/address",
|
||||
"r");
|
||||
#else
|
||||
FILE *sysFile = popen("more /sys/class/net/eth0/address", "r");
|
||||
#endif
|
||||
@ -293,9 +286,10 @@ u_int32_t getDetectorIP() {
|
||||
// execute and get address
|
||||
char output[255];
|
||||
#ifdef VIRTUAL
|
||||
FILE *sysFile = popen("ifconfig $(ip route show default | awk '/default/ "
|
||||
"{print $5}') | grep 'inet ' | cut -d ' ' -f10",
|
||||
"r");
|
||||
FILE *sysFile =
|
||||
popen("ifconfig $(ip route show default | grep -v vpn | awk '/default/ "
|
||||
"{print $5}') | grep 'inet ' | cut -d ' ' -f10",
|
||||
"r");
|
||||
#else
|
||||
FILE *sysFile = popen(
|
||||
"ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2",
|
||||
@ -333,11 +327,24 @@ void initControlServer() {
|
||||
Feb_Interface_FebInterface();
|
||||
Feb_Control_FebControl();
|
||||
// same addresses for top and bottom
|
||||
Feb_Control_Init(master, 1, normal, getDetectorNumber());
|
||||
if (!Feb_Control_Init(master, normal, getDetectorNumber())) {
|
||||
initError = FAIL;
|
||||
sprintf(initErrorMessage, "Could not intitalize feb control\n");
|
||||
LOG(logERROR, (initErrorMessage));
|
||||
initCheckDone = 1;
|
||||
return;
|
||||
}
|
||||
// master of 9M, check high voltage serial communication to blackfin
|
||||
if (master && !normal) {
|
||||
if (Feb_Control_OpenSerialCommunication())
|
||||
; // Feb_Control_CloseSerialCommunication();
|
||||
if (!Feb_Control_OpenSerialCommunication()) {
|
||||
initError = FAIL;
|
||||
sprintf(
|
||||
initErrorMessage,
|
||||
"Could not intitalize feb control serial communication\n");
|
||||
LOG(logERROR, (initErrorMessage));
|
||||
initCheckDone = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
LOG(logDEBUG1, ("Control server: FEB Initialization done\n"));
|
||||
Beb_SetTopVariable(top);
|
||||
@ -355,10 +362,7 @@ void initStopServer() {
|
||||
#ifdef VIRTUAL
|
||||
LOG(logINFOBLUE, ("Configuring Stop server\n"));
|
||||
getModuleConfiguration();
|
||||
virtual_stop = 0;
|
||||
if (!isControlServer) {
|
||||
ComVirtual_setStop(virtual_stop);
|
||||
}
|
||||
sharedMemory_setStop(0);
|
||||
// get top/master in virtual
|
||||
readConfigFile();
|
||||
#else
|
||||
@ -372,7 +376,7 @@ void initStopServer() {
|
||||
Feb_Interface_FebInterface();
|
||||
Feb_Control_FebControl();
|
||||
// same addresses for top and bottom
|
||||
Feb_Control_Init(master, 1, normal, getDetectorNumber());
|
||||
Feb_Control_Init(master, normal, getDetectorNumber());
|
||||
LOG(logDEBUG1, ("Stop server: FEB Initialization done\n"));
|
||||
#endif
|
||||
// client first connect (from shm) will activate
|
||||
@ -421,7 +425,14 @@ int readConfigFile() {
|
||||
}
|
||||
master = -1;
|
||||
top = -1;
|
||||
FILE *fd = fopen(CONFIG_FILE, "r");
|
||||
|
||||
char fname[128];
|
||||
if (getAbsPath(fname, 128, CONFIG_FILE) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// open config file
|
||||
FILE *fd = fopen(fname, "r");
|
||||
if (fd == NULL) {
|
||||
LOG(logINFO, ("No config file found. Resetting to hardware settings "
|
||||
"(Top/Master)\n"));
|
||||
@ -639,8 +650,7 @@ void allocateDetectorStructureMemory() {
|
||||
thisSettings = UNINITIALIZED;
|
||||
|
||||
// if trimval requested, should return -1 to acknowledge unknown
|
||||
int ichan = 0;
|
||||
for (ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||
*((detectorModules->chanregs) + ichan) = -1;
|
||||
}
|
||||
}
|
||||
@ -651,9 +661,8 @@ void setupDetector() {
|
||||
// set dacs
|
||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||
{
|
||||
int i = 0;
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
for (i = 0; i < NDAC; ++i) {
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
||||
if ((detectorModules)->dacs[i] != defaultvals[i]) {
|
||||
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
||||
@ -662,10 +671,7 @@ void setupDetector() {
|
||||
}
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
virtual_status = 0;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
}
|
||||
sharedMemory_setStatus(IDLE);
|
||||
#endif
|
||||
|
||||
LOG(logINFOBLUE, ("Setting Default Parameters\n"));
|
||||
@ -680,8 +686,7 @@ void setupDetector() {
|
||||
setDynamicRange(DEFAULT_DYNAMIC_RANGE);
|
||||
eiger_photonenergy = DEFAULT_PHOTON_ENERGY;
|
||||
setParallelMode(DEFAULT_PARALLEL_MODE);
|
||||
setOverFlowMode(DEFAULT_READOUT_STOREINRAM_MODE);
|
||||
setStoreInRamMode(DEFAULT_READOUT_OVERFLOW32_MODE);
|
||||
setOverFlowMode(DEFAULT_READOUT_OVERFLOW32_MODE);
|
||||
setClockDivider(RUN_CLK, DEFAULT_CLK_SPEED); // clk_devider,half speed
|
||||
setIODelay(DEFAULT_IO_DELAY);
|
||||
setTiming(DEFAULT_TIMING_MODE);
|
||||
@ -697,7 +702,12 @@ void setupDetector() {
|
||||
#endif
|
||||
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
||||
#ifndef VIRTUAL
|
||||
Feb_Control_CheckSetup();
|
||||
if (!Feb_Control_CheckSetup()) {
|
||||
initError = FAIL;
|
||||
sprintf(initErrorMessage, "Could not pass feb control setup checks\n");
|
||||
LOG(logERROR, (initErrorMessage));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
// force top or master if in config file
|
||||
if (readConfigFile() == FAIL) {
|
||||
@ -748,8 +758,7 @@ int setDynamicRange(int dr) {
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetDynamicRange(dr)) {
|
||||
on_dst = 0;
|
||||
int i;
|
||||
for (i = 0; i < 32; i++)
|
||||
for (int i = 0; i < 32; ++i)
|
||||
dst_requested[i] = 0; // clear dst requested
|
||||
if (!Beb_SetUpTransferParameters(dr)) {
|
||||
LOG(logERROR, ("Could not set bit mode in the back end\n"));
|
||||
@ -794,14 +803,6 @@ int setOverFlowMode(int mode) {
|
||||
|
||||
int getOverFlowMode() { return eiger_overflow32; }
|
||||
|
||||
void setStoreInRamMode(int mode) {
|
||||
mode = (mode == 0 ? 0 : 1);
|
||||
LOG(logINFO, ("Setting Store in Ram mode to %d\n", mode));
|
||||
eiger_storeinmem = mode;
|
||||
}
|
||||
|
||||
int getStoreInRamMode() { return eiger_storeinmem; }
|
||||
|
||||
/* parameters - timer */
|
||||
|
||||
int setStartingFrameNumber(uint64_t value) {
|
||||
@ -829,8 +830,7 @@ void setNumFrames(int64_t val) {
|
||||
if (Feb_Control_SetNExposures((unsigned int)val * eiger_ntriggers)) {
|
||||
eiger_nexposures = val;
|
||||
on_dst = 0;
|
||||
int i;
|
||||
for (i = 0; i < 32; i++)
|
||||
for (int i = 0; i < 32; ++i)
|
||||
dst_requested[i] = 0; // clear dst requested
|
||||
ndsts_in_use = 1;
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
@ -851,8 +851,7 @@ void setNumTriggers(int64_t val) {
|
||||
if (Feb_Control_SetNExposures((unsigned int)val * eiger_nexposures)) {
|
||||
eiger_ntriggers = val;
|
||||
on_dst = 0;
|
||||
int i;
|
||||
for (i = 0; i < 32; i++)
|
||||
for (int i = 0; i < 32; ++i)
|
||||
dst_requested[i] = 0; // clear dst requested
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
}
|
||||
@ -1021,18 +1020,14 @@ int setModule(sls_detector_module myMod, char *mess) {
|
||||
}
|
||||
|
||||
// dacs
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < NDAC; ++i) {
|
||||
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
|
||||
if (myMod.dacs[i] != (detectorModules)->dacs[i]) {
|
||||
sprintf(mess, "Could not set module. Could not set dac %d\n",
|
||||
i);
|
||||
LOG(logERROR, (mess));
|
||||
setSettings(UNDEFINED);
|
||||
LOG(logERROR, ("Settings has been changed to undefined\n"));
|
||||
return FAIL;
|
||||
}
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
|
||||
if (myMod.dacs[i] != (detectorModules)->dacs[i]) {
|
||||
sprintf(mess, "Could not set module. Could not set dac %d\n", i);
|
||||
LOG(logERROR, (mess));
|
||||
setSettings(UNDEFINED);
|
||||
LOG(logERROR, ("Settings has been changed to undefined\n"));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1044,10 +1039,10 @@ int setModule(sls_detector_module myMod, char *mess) {
|
||||
LOG(logINFO, ("Setting module with trimbits\n"));
|
||||
// includ gap pixels
|
||||
unsigned int tt[263680];
|
||||
int iy, ichip, ix, ip = 0, ich = 0;
|
||||
for (iy = 0; iy < 256; ++iy) {
|
||||
for (ichip = 0; ichip < 4; ++ichip) {
|
||||
for (ix = 0; ix < 256; ++ix) {
|
||||
int ip = 0, ich = 0;
|
||||
for (int iy = 0; iy < 256; ++iy) {
|
||||
for (int ichip = 0; ichip < 4; ++ichip) {
|
||||
for (int ix = 0; ix < 256; ++ix) {
|
||||
tt[ip++] = myMod.chanregs[ich++];
|
||||
}
|
||||
if (ichip < 3) {
|
||||
@ -1058,7 +1053,7 @@ int setModule(sls_detector_module myMod, char *mess) {
|
||||
}
|
||||
|
||||
// set trimbits
|
||||
if (!Feb_Control_SetTrimbits(Feb_Control_GetModuleNumber(), tt, top)) {
|
||||
if (!Feb_Control_SetTrimbits(tt, top)) {
|
||||
sprintf(mess, "Could not set module. Could not set trimbits\n");
|
||||
LOG(logERROR, (mess));
|
||||
setSettings(UNDEFINED);
|
||||
@ -1113,43 +1108,11 @@ int setModule(sls_detector_module myMod, char *mess) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int getModule(sls_detector_module *myMod) {
|
||||
|
||||
#ifndef VIRTUAL
|
||||
// trimbits
|
||||
unsigned int *tt;
|
||||
tt = Feb_Control_GetTrimbits();
|
||||
|
||||
// exclude gap pixels
|
||||
int iy, ichip, ix, ip = 0, ich = 0;
|
||||
for (iy = 0; iy < 256; ++iy) {
|
||||
for (ichip = 0; ichip < 4; ++ichip) {
|
||||
for (ix = 0; ix < 256; ++iy) {
|
||||
myMod->chanregs[ich++] = tt[ip++];
|
||||
}
|
||||
if (ichip < 3) {
|
||||
ip++;
|
||||
ip++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// copy local module to myMod
|
||||
if (detectorModules) {
|
||||
if (copyModule(myMod, detectorModules) == FAIL)
|
||||
return FAIL;
|
||||
} else
|
||||
return FAIL;
|
||||
return OK;
|
||||
}
|
||||
|
||||
enum detectorSettings setSettings(enum detectorSettings sett) {
|
||||
if (sett == UNINITIALIZED) {
|
||||
return thisSettings;
|
||||
}
|
||||
if (sett != GET_SETTINGS)
|
||||
thisSettings = sett;
|
||||
thisSettings = sett;
|
||||
LOG(logINFO, ("Settings: %d\n", thisSettings));
|
||||
return thisSettings;
|
||||
}
|
||||
@ -1196,6 +1159,10 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
||||
return;
|
||||
}
|
||||
|
||||
char *dac_names[] = {DAC_NAMES};
|
||||
LOG(logINFO, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind],
|
||||
val, (mV ? "mV" : "dac units")));
|
||||
|
||||
#ifdef VIRTUAL
|
||||
int dacval = 0;
|
||||
if (!mV) {
|
||||
@ -1207,11 +1174,17 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
||||
(detectorModules)->dacs[ind] = dacval;
|
||||
}
|
||||
#else
|
||||
char iname[10];
|
||||
strcpy(iname, dac_names[(int)ind]);
|
||||
if (Feb_Control_SetDAC(iname, val, mV)) {
|
||||
int dacval = 0;
|
||||
Feb_Control_GetDAC(iname, &dacval, 0);
|
||||
int dacval = val;
|
||||
if (mV) {
|
||||
// convert to dac units
|
||||
if (ConvertToDifferentRange(DAC_MIN_MV, DAC_MAX_MV, LTC2620_MIN_VAL,
|
||||
LTC2620_MAX_VAL, val, &dacval) == FAIL) {
|
||||
LOG(logERROR,
|
||||
("Could not convert %d mV for dac to dac units\n", val));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Feb_Control_SetDAC(ind, dacval)) {
|
||||
(detectorModules)->dacs[ind] = dacval;
|
||||
}
|
||||
#endif
|
||||
@ -1301,6 +1274,7 @@ int setHighVoltage(int val) {
|
||||
if (master) {
|
||||
// set
|
||||
if (val != -1) {
|
||||
LOG(logINFO, ("Setting High voltage: %d V\n", val));
|
||||
eiger_theo_highvoltage = val;
|
||||
}
|
||||
return eiger_theo_highvoltage;
|
||||
@ -1364,7 +1338,7 @@ void setTiming(enum timingMode arg) {
|
||||
}
|
||||
LOG(logDEBUG1, ("Setting Triggering Mode: %d\n", (int)ret));
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetTriggerMode(ret, 1))
|
||||
if (Feb_Control_SetTriggerMode(ret))
|
||||
#endif
|
||||
eiger_triggermode = ret;
|
||||
}
|
||||
@ -1381,7 +1355,7 @@ enum timingMode getTiming() {
|
||||
return GATED;
|
||||
default:
|
||||
LOG(logERROR, ("Unknown trigger mode found %d\n", eiger_triggermode));
|
||||
return GET_TIMING_MODE;
|
||||
return GET_FLAG;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1432,37 +1406,32 @@ int configureMAC() {
|
||||
if (!top)
|
||||
dst_port = dstport2;
|
||||
|
||||
int i = 0;
|
||||
/* for(i=0;i<32;i++) { modified for Aldo*/
|
||||
if (Beb_SetBebSrcHeaderInfos(beb_num, send_to_ten_gig, src_mac, src_ip,
|
||||
srcport) &&
|
||||
Beb_SetUpUDPHeader(beb_num, send_to_ten_gig, header_number + i, dst_mac,
|
||||
Beb_SetUpUDPHeader(beb_num, send_to_ten_gig, header_number, dst_mac,
|
||||
dst_ip, dst_port)) {
|
||||
LOG(logDEBUG1, ("\tset up left ok\n"));
|
||||
} else {
|
||||
return FAIL;
|
||||
}
|
||||
/*}*/
|
||||
|
||||
header_number = 32;
|
||||
dst_port = dstport2;
|
||||
if (!top)
|
||||
dst_port = dstport;
|
||||
|
||||
/*for(i=0;i<32;i++) {*/ /** modified for Aldo*/
|
||||
if (Beb_SetBebSrcHeaderInfos(beb_num, send_to_ten_gig, src_mac, src_ip,
|
||||
srcport) &&
|
||||
Beb_SetUpUDPHeader(beb_num, send_to_ten_gig, header_number + i, dst_mac,
|
||||
Beb_SetUpUDPHeader(beb_num, send_to_ten_gig, header_number, dst_mac,
|
||||
dst_ip, dst_port)) {
|
||||
LOG(logDEBUG1, (" set up right ok\n"));
|
||||
} else {
|
||||
return FAIL;
|
||||
}
|
||||
/*}*/
|
||||
|
||||
on_dst = 0;
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
for (int i = 0; i < 32; ++i)
|
||||
dst_requested[i] = 0; // clear dst requested
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
#endif
|
||||
@ -1490,6 +1459,11 @@ int setQuad(int value) {
|
||||
if (value < 0) {
|
||||
return OK;
|
||||
}
|
||||
// only top can be set to quad
|
||||
if (!top && value > 0) {
|
||||
LOG(logERROR, ("Only a top can be set to quad\n"));
|
||||
return FAIL;
|
||||
}
|
||||
#ifndef VIRTUAL
|
||||
if (Beb_SetQuad(value) == FAIL) {
|
||||
return FAIL;
|
||||
@ -1561,7 +1535,6 @@ int enableTenGigabitEthernet(int val) {
|
||||
send_to_ten_gig = 1;
|
||||
else
|
||||
send_to_ten_gig = 0;
|
||||
// configuremac called from client
|
||||
}
|
||||
return send_to_ten_gig;
|
||||
}
|
||||
@ -1594,7 +1567,7 @@ int setIODelay(int val) {
|
||||
if (val != -1) {
|
||||
LOG(logDEBUG1, ("Setting IO Delay: %d\n", val));
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetIDelays(Feb_Control_GetModuleNumber(), val))
|
||||
if (Feb_Control_SetIDelays(val))
|
||||
#endif
|
||||
eiger_iodelay = val;
|
||||
}
|
||||
@ -1827,6 +1800,8 @@ int64_t getCurrentTau() {
|
||||
}
|
||||
|
||||
void setExternalGating(int enable[]) {
|
||||
// not configured from client
|
||||
// default: disable gating with positive polarity
|
||||
if (enable[0] >= 0 && enable[1] >= 0) {
|
||||
#ifndef VIRTUAL
|
||||
Feb_Control_SetExternalEnableMode(
|
||||
@ -1849,8 +1824,7 @@ int setAllTrimbits(int val) {
|
||||
}
|
||||
#endif
|
||||
if (detectorModules) {
|
||||
int ichan;
|
||||
for (ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||
*((detectorModules->chanregs) + ichan) = val;
|
||||
}
|
||||
}
|
||||
@ -1860,10 +1834,9 @@ int setAllTrimbits(int val) {
|
||||
}
|
||||
|
||||
int getAllTrimbits() {
|
||||
int ichan = 0;
|
||||
int value = *((detectorModules->chanregs));
|
||||
if (detectorModules) {
|
||||
for (ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||
if (*((detectorModules->chanregs) + ichan) != value) {
|
||||
value = -1;
|
||||
break;
|
||||
@ -2013,39 +1986,30 @@ int startStateMachine() {
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFOBLUE, ("Starting State Machine\n"));
|
||||
virtual_status = 1;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
virtual_stop = ComVirtual_getStop();
|
||||
if (virtual_stop != 0) {
|
||||
LOG(logERROR, ("Cant start acquisition. "
|
||||
"Stop server has not updated stop status to 0\n"));
|
||||
return FAIL;
|
||||
}
|
||||
if (sharedMemory_getStop() != 0) {
|
||||
LOG(logERROR, ("Cant start acquisition. "
|
||||
"Stop server has not updated stop status to 0\n"));
|
||||
return FAIL;
|
||||
}
|
||||
sharedMemory_setStatus(RUNNING);
|
||||
if (pthread_create(&virtual_tid, NULL, &start_timer, NULL)) {
|
||||
LOG(logERROR, ("Could not start Virtual acquisition thread\n"));
|
||||
virtual_status = 0;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
}
|
||||
sharedMemory_setStatus(IDLE);
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFO, ("Virtual Acquisition started\n"));
|
||||
return OK;
|
||||
#else
|
||||
LOG(logINFOBLUE, ("Starting State Machine\n"));
|
||||
LOG(logINFO, ("Acquisition started bit toggled\n"));
|
||||
int ret = OK, prev_flag;
|
||||
// get the DAQ toggle bit
|
||||
prev_flag = Feb_Control_AcquisitionStartedBit();
|
||||
|
||||
LOG(logINFO, ("Going to start acquisition\n"));
|
||||
LOG(logINFOBLUE, ("Starting State Machine\n"));
|
||||
Feb_Control_StartAcquisition();
|
||||
|
||||
if (!eiger_storeinmem) {
|
||||
LOG(logINFO, ("requesting images right after start\n"));
|
||||
ret = startReadOut();
|
||||
}
|
||||
LOG(logINFO, ("requesting images right after start\n"));
|
||||
ret = startReadOut();
|
||||
|
||||
// wait for acquisition start
|
||||
if (ret == OK) {
|
||||
@ -2084,7 +2048,7 @@ void *start_timer(void *arg) {
|
||||
int colRight = top ? eiger_virtual_detPos[1] + 1 : eiger_virtual_detPos[1];
|
||||
int ntotpixels = 256 * 256 * 4;
|
||||
|
||||
LOG(logINFO, (" dr:%d\n bytesperpixel:%f\n tgenable:%d\n datasize:%d\n "
|
||||
LOG(logDEBUG1, (" dr:%d\n bytesperpixel:%f\n tgenable:%d\n datasize:%d\n "
|
||||
"packetsize:%d\n numpackes:%d\n npixelsx:%d\n databytes:%d\n "
|
||||
"ntotpixels:%d\n",
|
||||
dr, bytesPerPixel, tgEnable, datasize, packetsize,
|
||||
@ -2094,10 +2058,9 @@ void *start_timer(void *arg) {
|
||||
char imageData[databytes * 2];
|
||||
memset(imageData, 0, databytes * 2);
|
||||
{
|
||||
int i = 0;
|
||||
switch (dr) {
|
||||
case 4:
|
||||
for (i = 0; i < ntotpixels / 2; ++i) {
|
||||
for (int i = 0; i < ntotpixels / 2; ++i) {
|
||||
*((uint8_t *)(imageData + i)) =
|
||||
eiger_virtual_test_mode
|
||||
? 0xEE
|
||||
@ -2105,19 +2068,19 @@ void *start_timer(void *arg) {
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
for (i = 0; i < ntotpixels; ++i) {
|
||||
for (int i = 0; i < ntotpixels; ++i) {
|
||||
*((uint8_t *)(imageData + i)) =
|
||||
eiger_virtual_test_mode ? 0xFE : (uint8_t)i;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
for (i = 0; i < ntotpixels; ++i) {
|
||||
for (int i = 0; i < ntotpixels; ++i) {
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||
eiger_virtual_test_mode ? 0xFFE : (uint16_t)i;
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
for (i = 0; i < ntotpixels; ++i) {
|
||||
for (int i = 0; i < ntotpixels; ++i) {
|
||||
*((uint32_t *)(imageData + i * sizeof(uint32_t))) =
|
||||
eiger_virtual_test_mode ? 0xFFFFFE : (uint32_t)i;
|
||||
}
|
||||
@ -2132,15 +2095,12 @@ void *start_timer(void *arg) {
|
||||
uint64_t frameNr = 0;
|
||||
getStartingFrameNumber(&frameNr);
|
||||
// loop over number of frames
|
||||
int iframes = 0;
|
||||
for (iframes = 0; iframes != numFrames; ++iframes) {
|
||||
for (int iframes = 0; iframes != numFrames; ++iframes) {
|
||||
|
||||
usleep(eiger_virtual_transmission_delay_frame);
|
||||
|
||||
// update the virtual stop from stop server
|
||||
virtual_stop = ComVirtual_getStop();
|
||||
// check if virtual_stop is high
|
||||
if (virtual_stop == 1) {
|
||||
// check if manual stop
|
||||
if (sharedMemory_getStop() == 1) {
|
||||
setStartingFrameNumber(frameNr + iframes + 1);
|
||||
break;
|
||||
}
|
||||
@ -2154,78 +2114,74 @@ void *start_timer(void *arg) {
|
||||
int srcOffset2 = npixelsx;
|
||||
|
||||
// loop packet
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i != numPacketsPerFrame; ++i) {
|
||||
// set header
|
||||
char packetData[packetsize];
|
||||
memset(packetData, 0, packetsize);
|
||||
sls_detector_header *header =
|
||||
(sls_detector_header *)(packetData);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION;
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = i;
|
||||
header->row = row;
|
||||
header->column = colLeft;
|
||||
for (int i = 0; i != numPacketsPerFrame; ++i) {
|
||||
// set header
|
||||
char packetData[packetsize];
|
||||
memset(packetData, 0, packetsize);
|
||||
sls_detector_header *header =
|
||||
(sls_detector_header *)(packetData);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION;
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = i;
|
||||
header->row = row;
|
||||
header->column = colLeft;
|
||||
|
||||
char packetData2[packetsize];
|
||||
memset(packetData2, 0, packetsize);
|
||||
header = (sls_detector_header *)(packetData2);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION;
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = i;
|
||||
header->row = row;
|
||||
header->column = colRight;
|
||||
if (eiger_virtual_quad_mode) {
|
||||
header->row = 1; // right is next row
|
||||
header->column = 0; // right same first column
|
||||
}
|
||||
char packetData2[packetsize];
|
||||
memset(packetData2, 0, packetsize);
|
||||
header = (sls_detector_header *)(packetData2);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION;
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = i;
|
||||
header->row = row;
|
||||
header->column = colRight;
|
||||
if (eiger_virtual_quad_mode) {
|
||||
header->row = 1; // right is next row
|
||||
header->column = 0; // right same first column
|
||||
}
|
||||
|
||||
// fill data
|
||||
int dstOffset = sizeof(sls_detector_header);
|
||||
int dstOffset2 = sizeof(sls_detector_header);
|
||||
{
|
||||
int psize = 0;
|
||||
for (psize = 0; psize < datasize; psize += npixelsx) {
|
||||
// fill data
|
||||
int dstOffset = sizeof(sls_detector_header);
|
||||
int dstOffset2 = sizeof(sls_detector_header);
|
||||
{
|
||||
for (int psize = 0; psize < datasize; psize += npixelsx) {
|
||||
|
||||
if (dr == 32 && tgEnable == 0) {
|
||||
memcpy(packetData + dstOffset,
|
||||
imageData + srcOffset, npixelsx / 2);
|
||||
memcpy(packetData2 + dstOffset2,
|
||||
imageData + srcOffset2, npixelsx / 2);
|
||||
if (srcOffset % npixelsx == 0) {
|
||||
srcOffset += npixelsx / 2;
|
||||
srcOffset2 += npixelsx / 2;
|
||||
}
|
||||
// skip the other half (2 packets in 1 line for
|
||||
// 32 bit)
|
||||
else {
|
||||
srcOffset += npixelsx;
|
||||
srcOffset2 += npixelsx;
|
||||
}
|
||||
dstOffset += npixelsx / 2;
|
||||
dstOffset2 += npixelsx / 2;
|
||||
} else {
|
||||
memcpy(packetData + dstOffset,
|
||||
imageData + srcOffset, npixelsx);
|
||||
memcpy(packetData2 + dstOffset2,
|
||||
imageData + srcOffset2, npixelsx);
|
||||
srcOffset += 2 * npixelsx;
|
||||
srcOffset2 += 2 * npixelsx;
|
||||
dstOffset += npixelsx;
|
||||
dstOffset2 += npixelsx;
|
||||
if (dr == 32 && tgEnable == 0) {
|
||||
memcpy(packetData + dstOffset,
|
||||
imageData + srcOffset, npixelsx / 2);
|
||||
memcpy(packetData2 + dstOffset2,
|
||||
imageData + srcOffset2, npixelsx / 2);
|
||||
if (srcOffset % npixelsx == 0) {
|
||||
srcOffset += npixelsx / 2;
|
||||
srcOffset2 += npixelsx / 2;
|
||||
}
|
||||
// skip the other half (2 packets in 1 line for
|
||||
// 32 bit)
|
||||
else {
|
||||
srcOffset += npixelsx;
|
||||
srcOffset2 += npixelsx;
|
||||
}
|
||||
dstOffset += npixelsx / 2;
|
||||
dstOffset2 += npixelsx / 2;
|
||||
} else {
|
||||
memcpy(packetData + dstOffset,
|
||||
imageData + srcOffset, npixelsx);
|
||||
memcpy(packetData2 + dstOffset2,
|
||||
imageData + srcOffset2, npixelsx);
|
||||
srcOffset += 2 * npixelsx;
|
||||
srcOffset2 += 2 * npixelsx;
|
||||
dstOffset += npixelsx;
|
||||
dstOffset2 += npixelsx;
|
||||
}
|
||||
}
|
||||
usleep(eiger_virtual_transmission_delay_left);
|
||||
sendUDPPacket(0, packetData, packetsize);
|
||||
usleep(eiger_virtual_transmission_delay_right);
|
||||
sendUDPPacket(1, packetData2, packetsize);
|
||||
}
|
||||
usleep(eiger_virtual_transmission_delay_left);
|
||||
sendUDPPacket(0, packetData, packetsize);
|
||||
usleep(eiger_virtual_transmission_delay_right);
|
||||
sendUDPPacket(1, packetData2, packetsize);
|
||||
}
|
||||
LOG(logINFO, ("Sent frame: %d\n", iframes));
|
||||
LOG(logINFO, ("Sent frame: %d[%lld]\n", iframes, (long long unsigned int)(frameNr + iframes)));
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
||||
(end.tv_nsec - begin.tv_nsec));
|
||||
@ -2243,30 +2199,25 @@ void *start_timer(void *arg) {
|
||||
closeUDPSocket(0);
|
||||
closeUDPSocket(1);
|
||||
|
||||
virtual_status = 0;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
}
|
||||
sharedMemory_setStatus(IDLE);
|
||||
LOG(logINFOBLUE, ("Finished Acquiring\n"));
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
int stopStateMachine() {
|
||||
LOG(logINFORED, ("Going to stop acquisition\n"));
|
||||
#ifdef VIRTUAL
|
||||
if (!isControlServer) {
|
||||
virtual_stop = 1;
|
||||
ComVirtual_setStop(virtual_stop);
|
||||
// read till status is idle
|
||||
int tempStatus = 1;
|
||||
while (tempStatus == 1) {
|
||||
tempStatus = ComVirtual_getStatus();
|
||||
}
|
||||
virtual_stop = 0;
|
||||
ComVirtual_setStop(virtual_stop);
|
||||
LOG(logINFO, ("Stopped State Machine\n"));
|
||||
LOG(logINFORED, ("Stopping state machine\n"));
|
||||
// if scan active, stop scan
|
||||
if (sharedMemory_getScanStatus() == RUNNING) {
|
||||
sharedMemory_setScanStop(1);
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
sharedMemory_setStop(1);
|
||||
// read till status is idle
|
||||
while (sharedMemory_getStatus() == RUNNING)
|
||||
;
|
||||
sharedMemory_setStop(0);
|
||||
LOG(logINFO, ("Stopped State Machine\n"));
|
||||
return OK;
|
||||
#else
|
||||
if ((Feb_Control_StopAcquisition() != STATUS_IDLE) ||
|
||||
@ -2309,10 +2260,6 @@ int startReadOut() {
|
||||
if ((ret_val = (!Beb_RequestNImages(beb_num, send_to_ten_gig, on_dst,
|
||||
nimages_per_request, 0))))
|
||||
break;
|
||||
// for(i=0;i<nimages_per_request;i++)
|
||||
// if ((ret_val =
|
||||
//(!Beb_RequestNImages(beb_num,send_to_ten_gig,on_dst,1,0))))
|
||||
// break;
|
||||
|
||||
dst_requested[on_dst++] = 0;
|
||||
on_dst %= ndsts_in_use;
|
||||
@ -2326,19 +2273,24 @@ int startReadOut() {
|
||||
}
|
||||
|
||||
enum runStatus getRunStatus() {
|
||||
#ifdef VIRTUAL
|
||||
if (!isControlServer) {
|
||||
virtual_status = ComVirtual_getStatus();
|
||||
LOG(logDEBUG1, ("Getting status\n"));
|
||||
// scan error or running
|
||||
if (sharedMemory_getScanStatus() == ERROR) {
|
||||
LOG(logINFOBLUE, ("Status: scan ERROR\n"));
|
||||
return ERROR;
|
||||
}
|
||||
if (virtual_status == 0) {
|
||||
LOG(logINFO, ("Status: IDLE\n"));
|
||||
return IDLE;
|
||||
} else {
|
||||
LOG(logINFO, ("Status: RUNNING...\n"));
|
||||
if (sharedMemory_getScanStatus() == RUNNING) {
|
||||
LOG(logINFOBLUE, ("Status: scan RUNNING\n"));
|
||||
return RUNNING;
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
if (sharedMemory_getStatus() == RUNNING) {
|
||||
LOG(logINFOBLUE, ("Status: RUNNING\n"));
|
||||
return RUNNING;
|
||||
}
|
||||
LOG(logINFOBLUE, ("Status: IDLE\n"));
|
||||
return IDLE;
|
||||
#else
|
||||
|
||||
int i = Feb_Control_AcquisitionInProgress();
|
||||
if (i == STATUS_ERROR) {
|
||||
LOG(logERROR, ("Status: ERROR reading status register\n"));
|
||||
@ -2363,7 +2315,7 @@ enum runStatus getRunStatus() {
|
||||
void readFrame(int *ret, char *mess) {
|
||||
#ifdef VIRTUAL
|
||||
// wait for status to be done
|
||||
while (virtual_status == 1) {
|
||||
while (sharedMemory_getStatus() == RUNNING) {
|
||||
usleep(500);
|
||||
}
|
||||
LOG(logINFOGREEN, ("acquisition successfully finished\n"));
|
||||
@ -2377,16 +2329,6 @@ void readFrame(int *ret, char *mess) {
|
||||
}
|
||||
LOG(logINFOGREEN, ("Acquisition finished\n"));
|
||||
|
||||
if (eiger_storeinmem) {
|
||||
LOG(logINFO, ("requesting images after storing in memory\n"));
|
||||
if (startReadOut() == FAIL) {
|
||||
strcpy(mess, "Could not execute read image requests\n");
|
||||
LOG(logERROR, (mess));
|
||||
*ret = (int)FAIL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// wait for detector to send
|
||||
int isTransmitting = 1;
|
||||
while (isTransmitting) {
|
||||
@ -2407,10 +2349,6 @@ void readFrame(int *ret, char *mess) {
|
||||
/* common */
|
||||
|
||||
int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
||||
|
||||
int idac, ichan;
|
||||
int ret = OK;
|
||||
|
||||
LOG(logDEBUG1, ("Copying module\n"));
|
||||
|
||||
if (srcMod->serialnumber >= 0) {
|
||||
@ -2445,19 +2383,19 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
||||
LOG(logDEBUG1, ("Copying register %x (%x)\n", destMod->reg, srcMod->reg));
|
||||
|
||||
if (destMod->nchan != 0) {
|
||||
for (ichan = 0; ichan < (srcMod->nchan); ichan++) {
|
||||
for (int ichan = 0; ichan < (srcMod->nchan); ichan++) {
|
||||
if (*((srcMod->chanregs) + ichan) >= 0)
|
||||
*((destMod->chanregs) + ichan) = *((srcMod->chanregs) + ichan);
|
||||
}
|
||||
} else
|
||||
LOG(logINFO, ("Not Copying trimbits\n"));
|
||||
|
||||
for (idac = 0; idac < (srcMod->ndac); idac++) {
|
||||
for (int idac = 0; idac < (srcMod->ndac); idac++) {
|
||||
if (*((srcMod->dacs) + idac) >= 0) {
|
||||
*((destMod->dacs) + idac) = *((srcMod->dacs) + idac);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
return OK;
|
||||
}
|
||||
|
||||
int calculateDataBytes() {
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#define REQUIRED_FIRMWARE_VERSION (26)
|
||||
#define IDFILECOMMAND "more /home/root/executables/detid.txt"
|
||||
#define CONFIG_FILE ("config.txt")
|
||||
#define CONFIG_FILE ("config_eiger.txt")
|
||||
#define WAIT_STOP_SERVER_START (1 * 1000 * 1000)
|
||||
|
||||
#define STATUS_IDLE 0
|
||||
@ -12,42 +12,46 @@
|
||||
|
||||
/* Enums */
|
||||
enum DACINDEX {
|
||||
E_SVP,
|
||||
E_VTR,
|
||||
E_VRF,
|
||||
E_VRS,
|
||||
E_SVN,
|
||||
E_VSVP,
|
||||
E_VTRIM,
|
||||
E_VRPREAMP,
|
||||
E_VRSHAPER,
|
||||
E_VSVN,
|
||||
E_VTGSTV,
|
||||
E_VCMP_LL,
|
||||
E_VCMP_LR,
|
||||
E_CAL,
|
||||
E_VCAL,
|
||||
E_VCMP_RL,
|
||||
E_RXB_RB,
|
||||
E_RXB_LB,
|
||||
E_VCMP_RR,
|
||||
E_VCP,
|
||||
E_VCN,
|
||||
E_VIS,
|
||||
E_VISHAPER,
|
||||
E_VTHRESHOLD
|
||||
};
|
||||
#define DAC_NAMES \
|
||||
"VSvP", "Vtrim", "Vrpreamp", "Vrshaper", "VSvN", "Vtgstv", "Vcmp_ll", \
|
||||
"Vcmp_lr", "Vcal", "Vcmp_rl", "rxb_rb", "rxb_lb", "Vcmp_rr", "Vcp", \
|
||||
"Vcn", "Vishaper"
|
||||
#define DEFAULT_DAC_VALS \
|
||||
{ \
|
||||
0, /* SvP */ \
|
||||
2480, /* Vtr */ \
|
||||
3300, /* Vrf */ \
|
||||
1400, /* Vrs */ \
|
||||
4000, /* SvN */ \
|
||||
0, /* VSvP */ \
|
||||
2480, /* Vtrim */ \
|
||||
3300, /* Vrpreamp */ \
|
||||
1400, /* Vrshaper */ \
|
||||
4000, /* VSvN */ \
|
||||
2556, /* Vtgstv */ \
|
||||
1000, /* Vcmp_ll */ \
|
||||
1000, /* Vcmp_lr */ \
|
||||
0, /* cal */ \
|
||||
0, /* Vcal */ \
|
||||
1000, /* Vcmp_rl */ \
|
||||
1100, /* rxb_rb */ \
|
||||
1100, /* rxb_lb */ \
|
||||
1000, /* Vcmp_rr */ \
|
||||
1000, /* Vcp */ \
|
||||
2000, /* Vcn */ \
|
||||
1550 /* Vis */ \
|
||||
1550 /* Vishaper */ \
|
||||
};
|
||||
enum ADCINDEX {
|
||||
TEMP_FPGAEXT,
|
||||
@ -99,7 +103,6 @@ enum MASTERINDEX { MASTER_HARDWARE, OW_MASTER, OW_SLAVE };
|
||||
#define DEFAULT_DYNAMIC_RANGE (16)
|
||||
|
||||
#define DEFAULT_PARALLEL_MODE (1)
|
||||
#define DEFAULT_READOUT_STOREINRAM_MODE (0)
|
||||
#define DEFAULT_READOUT_OVERFLOW32_MODE (0)
|
||||
#define DEFAULT_CLK_SPEED (FULL_SPEED)
|
||||
#define DEFAULT_IO_DELAY (650)
|
||||
|
@ -11,7 +11,7 @@ add_executable(gotthard2DetectorServer_virtual
|
||||
../slsDetectorServer/src/ALTERA_PLL_CYCLONE10.c
|
||||
../slsDetectorServer/src/ASIC_Driver.c
|
||||
../slsDetectorServer/src/programFpgaNios.c
|
||||
../slsDetectorServer/src/communication_virtual.c
|
||||
../slsDetectorServer/src/sharedMemory.c
|
||||
)
|
||||
|
||||
include_directories(
|
||||
@ -38,3 +38,5 @@ set_target_properties(gotthard2DetectorServer_virtual PROPERTIES
|
||||
install(TARGETS gotthard2DetectorServer_virtual
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
|
||||
configure_file(config_gotthard2.txt ${CMAKE_BINARY_DIR}/bin/config_gotthard2.txt COPYONLY)
|
||||
|
@ -5,14 +5,14 @@ support_lib = ../../slsSupportLib/include/
|
||||
|
||||
CROSS = nios2-buildroot-linux-gnu-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -DGOTTHARD2D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm
|
||||
CFLAGS += -Wall -std=gnu99 -DGOTTHARD2D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm -lrt -pthread
|
||||
PROGS = gotthard2DetectorServer
|
||||
DESTDIR ?= bin
|
||||
INSTMODE = 0777
|
||||
|
||||
SRCS = slsDetectorFunctionList.c
|
||||
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)nios.c $(main_src)common.c $(main_src)DAC6571.c $(main_src)LTC2620_Driver.c $(main_src)ALTERA_PLL_CYCLONE10.c $(main_src)ASIC_Driver.c $(main_src)/programFpgaNios.c
|
||||
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)nios.c $(main_src)common.c $(main_src)DAC6571.c $(main_src)LTC2620_Driver.c $(main_src)ALTERA_PLL_CYCLONE10.c $(main_src)ASIC_Driver.c $(main_src)/programFpgaNios.c $(main_src)/sharedMemory.c
|
||||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
@ -32,6 +32,7 @@ $(PROGS): $(OBJS)
|
||||
mkdir -p $(DESTDIR)
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
|
||||
mv $(PROGS) $(DESTDIR)
|
||||
cp config_gotthard2.txt $(DESTDIR)
|
||||
rm $(main_src)*.o
|
||||
|
||||
clean:
|
||||
|
@ -78,14 +78,11 @@
|
||||
/* Status register */
|
||||
#define STATUS_REG (0x04 * REG_OFFSET + BASE_CONTROL)
|
||||
|
||||
/* Look at me read only register */
|
||||
#define LOOK_AT_ME_REG (0x05 * REG_OFFSET + BASE_CONTROL)
|
||||
|
||||
/* System status register */
|
||||
#define SYSTEM_STATUS_REG (0x06 * REG_OFFSET + BASE_CONTROL)
|
||||
#define SYSTEM_STATUS_REG (0x05 * REG_OFFSET + BASE_CONTROL)
|
||||
|
||||
/* Config RW regiseter */
|
||||
#define CONFIG_REG (0x20 * REG_OFFSET + BASE_CONTROL)
|
||||
#define CONFIG_REG (0x08 * REG_OFFSET + BASE_CONTROL)
|
||||
|
||||
#define CONFIG_VETO_ENBL_OFST (0)
|
||||
#define CONFIG_VETO_ENBL_MSK (0x00000001 << CONFIG_VETO_ENBL_OFST)
|
||||
@ -93,7 +90,7 @@
|
||||
#define CONFIG_VETO_CH_10GB_ENBL_MSK (0x00000001 << CONFIG_VETO_CH_10GB_ENBL_OFST)
|
||||
|
||||
/* Control RW register */
|
||||
#define CONTROL_REG (0x21 * REG_OFFSET + BASE_CONTROL)
|
||||
#define CONTROL_REG (0x09 * REG_OFFSET + BASE_CONTROL)
|
||||
|
||||
#define CONTROL_STRT_ACQSTN_OFST (0)
|
||||
#define CONTROL_STRT_ACQSTN_MSK (0x00000001 << CONTROL_STRT_ACQSTN_OFST)
|
||||
@ -111,12 +108,16 @@
|
||||
#define CONTROL_PWR_CHIP_MSK (0x00000001 << CONTROL_PWR_CHIP_OFST)
|
||||
|
||||
/** DTA Offset Register */
|
||||
#define DTA_OFFSET_REG (0x24 * REG_OFFSET + BASE_CONTROL)
|
||||
#define DTA_OFFSET_REG (0x0A * REG_OFFSET + BASE_CONTROL)
|
||||
|
||||
/** Mask Strip Registers (40) */
|
||||
#define MASK_STRIP_START_REG (0x18 * REG_OFFSET + BASE_CONTROL)
|
||||
#define MASK_STRIP_NUM_REGS (40)
|
||||
|
||||
/* ASIC registers --------------------------------------------------*/
|
||||
|
||||
/* ASIC Config register */
|
||||
#define ASIC_CONFIG_REG (0x00 * REG_OFFSET + BASE_ASIC)
|
||||
#define ASIC_CONFIG_REG (0x00 * REG_OFFSET + BASE_ASIC)
|
||||
|
||||
#define ASIC_CONFIG_RUN_MODE_OFST (0)
|
||||
#define ASIC_CONFIG_RUN_MODE_MSK (0x00000003 << ASIC_CONFIG_RUN_MODE_OFST)
|
||||
|
Binary file not shown.
@ -7,23 +7,23 @@ vchip_ref_comp_fe -1 0x100
|
||||
vchip_cs -1 0x0D0
|
||||
|
||||
#dacs value (max 4096)
|
||||
vref_h_adc 2099
|
||||
vref_h_adc 2116
|
||||
vb_comp_fe 0
|
||||
vb_comp_adc 0
|
||||
vcom_cds 1400
|
||||
vref_rstore 640
|
||||
vcom_cds 705
|
||||
vref_rstore 205
|
||||
vb_opa_1st 0
|
||||
vref_comp_fe 0
|
||||
vcom_adc1 1400
|
||||
vref_prech 1720
|
||||
vcom_adc1 705
|
||||
vref_prech 900
|
||||
vref_l_adc 700
|
||||
vref_cds 1200
|
||||
vref_cds 600
|
||||
vb_cs 2799
|
||||
vb_opa_fd 0
|
||||
vcom_adc2 1400
|
||||
vcom_adc2 704
|
||||
|
||||
#configure adc chip index adc index value(max 0x7F)
|
||||
confadc -1 -1 0x22
|
||||
|
||||
#vetoreference gain index value(max 0x3ff)
|
||||
vetoref 1 0x0
|
||||
#vetoreference gain index value(max 1023)
|
||||
vetoref 1 0
|
@ -6,10 +6,10 @@
|
||||
#include "RegisterDefs.h"
|
||||
#include "clogger.h"
|
||||
#include "common.h"
|
||||
#include "sharedMemory.h"
|
||||
#include "versionAPI.h"
|
||||
#ifdef VIRTUAL
|
||||
#include "communication_funcs_UDP.h"
|
||||
#include "communication_virtual.h"
|
||||
#endif
|
||||
|
||||
#include <netinet/in.h>
|
||||
@ -37,8 +37,7 @@ char initErrorMessage[MAX_STR_LENGTH];
|
||||
|
||||
#ifdef VIRTUAL
|
||||
pthread_t pthread_virtual_tid;
|
||||
int virtual_status = 0;
|
||||
int virtual_stop = 0;
|
||||
int64_t virtual_currentFrameNumber = 2;
|
||||
#endif
|
||||
|
||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||
@ -51,12 +50,15 @@ int onChipdacValues[ONCHIP_NDAC][NCHIP] = {};
|
||||
int injectedChannelsOffset = 0;
|
||||
int injectedChannelsIncrement = 0;
|
||||
int vetoReference[NCHIP][NCHAN];
|
||||
int vetoGainIndices[NCHIP][NCHAN];
|
||||
uint8_t adcConfiguration[NCHIP][NADC];
|
||||
int burstMode = BURST_INTERNAL;
|
||||
int64_t numTriggersReg = 1;
|
||||
int64_t delayReg = 0;
|
||||
int64_t numBurstsReg = 1;
|
||||
int64_t burstPeriodReg = 0;
|
||||
int filter = 0;
|
||||
int cdsGain = 0;
|
||||
int detPos[2] = {};
|
||||
|
||||
int isInitCheckDone() { return initCheckDone; }
|
||||
@ -342,10 +344,7 @@ void initStopServer() {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
virtual_stop = 0;
|
||||
if (!isControlServer) {
|
||||
ComVirtual_setStop(virtual_stop);
|
||||
}
|
||||
sharedMemory_setStop(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -373,30 +372,20 @@ void setupDetector() {
|
||||
delayReg = 0;
|
||||
numBurstsReg = 1;
|
||||
burstPeriodReg = 0;
|
||||
for (int i = 0; i < NUM_CLOCKS; ++i) {
|
||||
clkPhase[i] = 0;
|
||||
}
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
dacValues[i] = 0;
|
||||
}
|
||||
filter = 0;
|
||||
cdsGain = 0;
|
||||
memset(clkPhase, 0, sizeof(clkPhase));
|
||||
memset(dacValues, 0, sizeof(dacValues));
|
||||
for (int i = 0; i < ONCHIP_NDAC; ++i) {
|
||||
for (int j = 0; j < NCHIP; ++j) {
|
||||
onChipdacValues[i][j] = -1;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < NCHIP; ++i) {
|
||||
for (int j = 0; j < NCHAN; ++j) {
|
||||
vetoReference[i][j] = 0;
|
||||
}
|
||||
for (int j = 0; j < NADC; ++j) {
|
||||
adcConfiguration[i][j] = 0;
|
||||
}
|
||||
}
|
||||
memset(vetoReference, 0, sizeof(vetoReference));
|
||||
memset(vetoGainIndices, 0, sizeof(vetoGainIndices));
|
||||
memset(adcConfiguration, 0, sizeof(adcConfiguration));
|
||||
#ifdef VIRTUAL
|
||||
virtual_status = 0;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
}
|
||||
sharedMemory_setStatus(IDLE);
|
||||
#endif
|
||||
|
||||
// pll defines
|
||||
@ -457,6 +446,8 @@ void setupDetector() {
|
||||
return;
|
||||
}
|
||||
setBurstMode(DEFAULT_BURST_MODE);
|
||||
setFilter(DEFAULT_FILTER);
|
||||
setCDSGain(DEFAILT_CDS_GAIN);
|
||||
setSettings(DEFAULT_SETTINGS);
|
||||
|
||||
// Initialization of acquistion parameters
|
||||
@ -486,7 +477,13 @@ int readConfigFile() {
|
||||
|
||||
usleep(INITIAL_STARTUP_WAIT);
|
||||
|
||||
FILE *fd = fopen(CONFIG_FILE, "r");
|
||||
char fname[128];
|
||||
if (getAbsPath(fname, 128, CONFIG_FILE) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// open config file
|
||||
FILE *fd = fopen(fname, "r");
|
||||
if (fd == NULL) {
|
||||
sprintf(initErrorMessage,
|
||||
"Could not open on-board detector server config file [%s].\n",
|
||||
@ -504,7 +501,7 @@ int readConfigFile() {
|
||||
memset(line, 0, LZ);
|
||||
char command[LZ];
|
||||
|
||||
int nadcRead = 0;
|
||||
int nAdcTotal = 0;
|
||||
|
||||
// keep reading a line
|
||||
while (fgets(line, LZ, fd)) {
|
||||
@ -555,7 +552,7 @@ int readConfigFile() {
|
||||
int value = 0;
|
||||
|
||||
// cannot scan values
|
||||
if (sscanf(line, "%s %d 0x%x", command, &igain, &value) != 3) {
|
||||
if (sscanf(line, "%s %d %d", command, &igain, &value) != 3) {
|
||||
sprintf(initErrorMessage,
|
||||
"Could not scan vetoref commands from on-board server "
|
||||
"config file. Line:[%s].\n",
|
||||
@ -618,7 +615,7 @@ int readConfigFile() {
|
||||
break;
|
||||
}
|
||||
// validations
|
||||
if (value > ASIC_ADC_MAX_VAL) {
|
||||
if (value < 0 || value > ASIC_ADC_MAX_VAL) {
|
||||
sprintf(initErrorMessage,
|
||||
"Could not configure adc from on-board server config "
|
||||
"file. Invalid value (max 0x%x). Line:[%s].\n",
|
||||
@ -626,28 +623,23 @@ int readConfigFile() {
|
||||
break;
|
||||
}
|
||||
|
||||
int chipmin = 0;
|
||||
int chipmax = NCHIP;
|
||||
int adcmin = 0;
|
||||
int adcmax = NADC;
|
||||
|
||||
// specific chip
|
||||
if (ichip != -1) {
|
||||
chipmin = ichip;
|
||||
chipmax = ichip + 1;
|
||||
}
|
||||
// specific adc
|
||||
if (iadc != -1) {
|
||||
adcmin = iadc;
|
||||
adcmax = iadc + 1;
|
||||
if (setADCConfiguration(ichip, iadc, value) == FAIL) {
|
||||
sprintf(initErrorMessage,
|
||||
"Could not configure adc from on-board server "
|
||||
"config file. Line:[%s].\n",
|
||||
line);
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = chipmin; i < chipmax; ++i) {
|
||||
for (int j = adcmin; j < adcmax; ++j) {
|
||||
adcConfiguration[i][j] = (uint8_t)value;
|
||||
++nadcRead;
|
||||
}
|
||||
// to ensure all adcs are configured at start up
|
||||
int nadc = 1;
|
||||
if (iadc == -1) {
|
||||
nadc = NADC;
|
||||
}
|
||||
if (ichip == -1) {
|
||||
nadc *= NCHIP;
|
||||
}
|
||||
nAdcTotal += nadc;
|
||||
}
|
||||
|
||||
// vchip command
|
||||
@ -763,17 +755,11 @@ int readConfigFile() {
|
||||
fclose(fd);
|
||||
|
||||
if (!strlen(initErrorMessage)) {
|
||||
if (nadcRead != NADC * NCHIP) {
|
||||
if (nAdcTotal != NADC * NCHIP) {
|
||||
sprintf(initErrorMessage,
|
||||
"Could not configure adc from on-board server config file. "
|
||||
"Insufficient adcconf commands. Read %d, expected %d\n",
|
||||
nadcRead, NADC * NCHIP);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < NCHIP; ++i) {
|
||||
for (int j = 0; j < NADC; ++j) {
|
||||
LOG(logDEBUG2,
|
||||
("adc read %d %d: 0x%02hhx\n", i, j, adcConfiguration[i][j]));
|
||||
nAdcTotal, NADC * NCHIP);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1044,34 +1030,31 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
||||
// set settings
|
||||
uint32_t addr = ASIC_CONFIG_REG;
|
||||
uint32_t mask = ASIC_CONFIG_GAIN_MSK;
|
||||
if (sett != GET_SETTINGS) {
|
||||
switch (sett) {
|
||||
case DYNAMICGAIN:
|
||||
bus_w(addr, bus_r(addr) & ~mask);
|
||||
bus_w(addr, bus_r(addr) | ASIC_CONFIG_DYNAMIC_GAIN_VAL);
|
||||
LOG(logINFO, ("Set settings - Dyanmic Gain, val: 0x%x\n",
|
||||
bus_r(addr) & mask));
|
||||
break;
|
||||
case FIXGAIN1:
|
||||
bus_w(addr, bus_r(addr) & ~mask);
|
||||
bus_w(addr, bus_r(addr) | ASIC_CONFIG_FIX_GAIN_1_VAL);
|
||||
LOG(logINFO,
|
||||
("Set settings - Fix Gain 1, val: 0x%x\n", bus_r(addr) & mask));
|
||||
break;
|
||||
case FIXGAIN2:
|
||||
bus_w(addr, bus_r(addr) & ~mask);
|
||||
bus_w(addr, bus_r(addr) | ASIC_CONFIG_FIX_GAIN_2_VAL);
|
||||
LOG(logINFO,
|
||||
("Set settings - Fix Gain 2, val: 0x%x\n", bus_r(addr) & mask));
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR,
|
||||
("This settings is not defined for this detector %d\n",
|
||||
(int)sett));
|
||||
return -1;
|
||||
}
|
||||
thisSettings = sett;
|
||||
switch (sett) {
|
||||
case DYNAMICGAIN:
|
||||
bus_w(addr, bus_r(addr) & ~mask);
|
||||
bus_w(addr, bus_r(addr) | ASIC_CONFIG_DYNAMIC_GAIN_VAL);
|
||||
LOG(logINFO,
|
||||
("Set settings - Dyanmic Gain, val: 0x%x\n", bus_r(addr) & mask));
|
||||
break;
|
||||
case FIXGAIN1:
|
||||
bus_w(addr, bus_r(addr) & ~mask);
|
||||
bus_w(addr, bus_r(addr) | ASIC_CONFIG_FIX_GAIN_1_VAL);
|
||||
LOG(logINFO,
|
||||
("Set settings - Fix Gain 1, val: 0x%x\n", bus_r(addr) & mask));
|
||||
break;
|
||||
case FIXGAIN2:
|
||||
bus_w(addr, bus_r(addr) & ~mask);
|
||||
bus_w(addr, bus_r(addr) | ASIC_CONFIG_FIX_GAIN_2_VAL);
|
||||
LOG(logINFO,
|
||||
("Set settings - Fix Gain 2, val: 0x%x\n", bus_r(addr) & mask));
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR,
|
||||
("This settings is not defined for this detector %d\n", (int)sett));
|
||||
return -1;
|
||||
}
|
||||
thisSettings = sett;
|
||||
|
||||
return getSettings();
|
||||
}
|
||||
@ -1208,17 +1191,11 @@ int setHighVoltage(int val) {
|
||||
val = HV_SOFT_MAX_VOLTAGE;
|
||||
}
|
||||
|
||||
#ifdef VIRTUAL
|
||||
if (val >= 0)
|
||||
highvoltage = val;
|
||||
return highvoltage;
|
||||
#endif
|
||||
|
||||
// setting hv
|
||||
if (val >= 0) {
|
||||
LOG(logINFO, ("Setting High voltage: %d V\n", val));
|
||||
DAC6571_Set(val);
|
||||
highvoltage = val;
|
||||
if (DAC6571_Set(val) == OK)
|
||||
highvoltage = val;
|
||||
}
|
||||
return highvoltage;
|
||||
}
|
||||
@ -1726,7 +1703,7 @@ int setClockDivider(enum CLKINDEX ind, int val) {
|
||||
}
|
||||
|
||||
// phase is reset by pll (when setting output frequency)
|
||||
if (ind >= READOUT_C0) {
|
||||
if (ind < SYSTEM_C0) {
|
||||
clkPhase[READOUT_C0] = 0;
|
||||
clkPhase[READOUT_C1] = 0;
|
||||
} else {
|
||||
@ -1772,8 +1749,9 @@ int setInjectChannel(int offset, int increment) {
|
||||
char buffer[17];
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
int startCh = 4; // 4 due to padding
|
||||
for (int ich = startCh + offset; ich < startCh + NCHAN;
|
||||
ich = ich + increment) {
|
||||
// reversing the channels sent (offset 0 is 127, 50 is 77 etc..)
|
||||
for (int ich = startCh + NCHAN - 1 - offset; ich >= startCh;
|
||||
ich -= increment) {
|
||||
int byteIndex = ich / 8;
|
||||
int bitIndex = ich % 8;
|
||||
buffer[byteIndex] |= (1 << (8 - 1 - bitIndex));
|
||||
@ -1798,24 +1776,34 @@ void getInjectedChannels(int *offset, int *increment) {
|
||||
}
|
||||
|
||||
int setVetoReference(int gainIndex, int value) {
|
||||
LOG(logINFO, ("Setting veto reference [chip:-1, G%d, value:0x%x]\n",
|
||||
LOG(logINFO, ("Setting veto reference [chip:-1, G%d, value:%d]\n",
|
||||
gainIndex, value));
|
||||
int vals[NCHAN];
|
||||
memset(vals, 0, sizeof(vals));
|
||||
int values[NCHAN];
|
||||
int gainIndices[NCHAN];
|
||||
for (int ich = 0; ich < NCHAN; ++ich) {
|
||||
vals[ich] = value;
|
||||
values[ich] = value;
|
||||
gainIndices[ich] = gainIndex;
|
||||
}
|
||||
return setVetoPhoton(-1, gainIndex, vals);
|
||||
return configureASICVetoReference(-1, gainIndices, values);
|
||||
}
|
||||
|
||||
int setVetoPhoton(int chipIndex, int gainIndex, int *values) {
|
||||
LOG(logINFO,
|
||||
("Setting veto photon [chip:%d, G%d]\n", chipIndex, gainIndex));
|
||||
int setVetoPhoton(int chipIndex, int *gainIndices, int *values) {
|
||||
return configureASICVetoReference(chipIndex, gainIndices, values);
|
||||
}
|
||||
|
||||
// add gain bits
|
||||
{
|
||||
int configureASICVetoReference(int chipIndex, int *gainIndices, int *values) {
|
||||
LOG(logINFO, ("Setting veto photon/file/reference [chip:%d]\n", chipIndex));
|
||||
|
||||
// reversing the values sent to the chip
|
||||
int revValues[NCHAN] = {};
|
||||
for (int i = 0; i < NCHAN; ++i) {
|
||||
revValues[i] = values[NCHAN - 1 - i];
|
||||
}
|
||||
|
||||
// correct gain bits and integrate into revValues
|
||||
for (int i = 0; i < NCHAN; ++i) {
|
||||
int gainValue = 0;
|
||||
switch (gainIndex) {
|
||||
switch (gainIndices[i]) {
|
||||
case 0:
|
||||
gainValue = ASIC_G0_VAL;
|
||||
break;
|
||||
@ -1826,14 +1814,12 @@ int setVetoPhoton(int chipIndex, int gainIndex, int *values) {
|
||||
gainValue = ASIC_G2_VAL;
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR, ("Unknown gain index %d\n", gainIndex));
|
||||
LOG(logERROR,
|
||||
("Unknown gain index %d for channel %d\n", gainIndices[i], i));
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logDEBUG2, ("Adding gain bits\n"));
|
||||
for (int i = 0; i < NCHAN; ++i) {
|
||||
values[i] |= gainValue;
|
||||
LOG(logDEBUG2, ("Value %d: 0x%x\n", i, values[i]));
|
||||
}
|
||||
revValues[NCHAN - 1 - i] |= gainValue; // reversed list, so NCHAN - 1 - i
|
||||
LOG(logDEBUG2, ("Values[%d]: 0x%x\n", i, revValues[i]));
|
||||
}
|
||||
|
||||
const int lenDataBitsPerchannel = ASIC_GAIN_MAX_BITS + ADU_MAX_BITS; // 14
|
||||
@ -1848,10 +1834,9 @@ int setVetoPhoton(int chipIndex, int gainIndex, int *values) {
|
||||
int offset = padding; // bit offset for commandbytes
|
||||
for (int ich = 0; ich < NCHAN; ++ich) {
|
||||
// loop through all bits in a value
|
||||
int iBit = 0;
|
||||
for (iBit = 0; iBit < lenDataBitsPerchannel; ++iBit) {
|
||||
for (int iBit = 0; iBit < lenDataBitsPerchannel; ++iBit) {
|
||||
commandBytes[offset++] =
|
||||
((values[ich] >> (lenDataBitsPerchannel - 1 - iBit)) & 0x1);
|
||||
((revValues[ich] >> (lenDataBitsPerchannel - 1 - iBit)) & 0x1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1875,11 +1860,12 @@ int setVetoPhoton(int chipIndex, int gainIndex, int *values) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// all chips
|
||||
// all chips (saving unreversed values)
|
||||
if (chipIndex == -1) {
|
||||
for (int ichan = 0; ichan < NCHAN; ++ichan) {
|
||||
for (int ichip = 0; ichip < NCHIP; ++ichip) {
|
||||
vetoReference[ichip][ichan] = values[ichan];
|
||||
vetoGainIndices[ichip][ichan] = gainIndices[ichan];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1887,17 +1873,19 @@ int setVetoPhoton(int chipIndex, int gainIndex, int *values) {
|
||||
// specific chip
|
||||
else {
|
||||
for (int ichan = 0; ichan < NCHAN; ++ichan) {
|
||||
vetoReference[chipIndex][chipIndex] = values[ichan];
|
||||
;
|
||||
vetoReference[chipIndex][ichan] = values[ichan];
|
||||
vetoGainIndices[chipIndex][ichan] = gainIndices[ichan];
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int getVetoPhoton(int chipIndex, int *retvals) {
|
||||
int getVetoPhoton(int chipIndex, int *retvals, int *gainRetvals) {
|
||||
if (chipIndex == -1) {
|
||||
// if chipindex is -1, check that all values and gain indices are same
|
||||
for (int i = 0; i < NCHAN; ++i) {
|
||||
int val = vetoReference[0][i];
|
||||
int gval = vetoGainIndices[0][i];
|
||||
for (int j = 1; j < NCHIP; ++j) {
|
||||
if (vetoReference[j][i] != val) {
|
||||
LOG(logERROR,
|
||||
@ -1907,6 +1895,14 @@ int getVetoPhoton(int chipIndex, int *retvals) {
|
||||
chipIndex, j, i, vetoReference[j][i], i, val));
|
||||
return FAIL;
|
||||
}
|
||||
if (vetoGainIndices[j][i] != gval) {
|
||||
LOG(logERROR,
|
||||
("Get vet photon fail for chipIndex:%d. Different "
|
||||
"gain indices between [nchip:%d, nchan:%d, gain "
|
||||
"index:%d] and [nchip:0, nchan:%d, gain index:%d]\n",
|
||||
chipIndex, j, i, vetoGainIndices[j][i], i, gval));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
chipIndex = 0;
|
||||
@ -1914,27 +1910,58 @@ int getVetoPhoton(int chipIndex, int *retvals) {
|
||||
memcpy((char *)retvals,
|
||||
((char *)vetoReference) + NCHAN * chipIndex * sizeof(int),
|
||||
sizeof(int) * NCHAN);
|
||||
memcpy((char *)gainRetvals,
|
||||
((char *)vetoGainIndices) + NCHAN * chipIndex * sizeof(int),
|
||||
sizeof(int) * NCHAN);
|
||||
return OK;
|
||||
}
|
||||
|
||||
int configureSingleADCDriver(int chipIndex) {
|
||||
LOG(logINFO, ("Configuring ADC for %s chips [chipIndex:%d Burst Mode:%d]\n",
|
||||
chipIndex == -1 ? "All" : "Single", chipIndex, burstMode));
|
||||
int setADCConfiguration(int chipIndex, int adcIndex, int value) {
|
||||
LOG(logINFO, ("Configuring ADC [chipIndex:%d, adcIndex:%d, value:0x%x]\n",
|
||||
chipIndex, adcIndex, value));
|
||||
|
||||
// validations
|
||||
if (chipIndex < -1 || chipIndex >= NCHIP) {
|
||||
LOG(logERROR, ("Invalid chip index %d\n", chipIndex));
|
||||
return FAIL;
|
||||
}
|
||||
if (adcIndex < -1 || adcIndex >= NADC) {
|
||||
LOG(logERROR, ("Invalid adc index %d\n", adcIndex));
|
||||
return FAIL;
|
||||
}
|
||||
// validations
|
||||
if (value < 0 || value > ASIC_ADC_MAX_VAL) {
|
||||
LOG(logERROR, ("Invalid value 0x%x\n", value));
|
||||
return FAIL;
|
||||
}
|
||||
int chipmin = 0;
|
||||
int chipmax = NCHIP;
|
||||
int adcmin = 0;
|
||||
int adcmax = NADC;
|
||||
// specific chip
|
||||
if (chipIndex != -1) {
|
||||
chipmin = chipIndex;
|
||||
chipmax = chipIndex + 1;
|
||||
}
|
||||
// specific adc (reversing adc when sending to chip)
|
||||
if (adcIndex != -1) {
|
||||
adcmin = NADC - 1 - adcIndex;
|
||||
adcmax = NADC - adcIndex;
|
||||
}
|
||||
// update values
|
||||
for (int i = chipmin; i < chipmax; ++i) {
|
||||
for (int j = adcmin; j < adcmax; ++j) {
|
||||
adcConfiguration[i][j] = (uint8_t)value;
|
||||
LOG(logDEBUG1,
|
||||
("Value [%d][%d]: 0x%02hhx\n", i, j, adcConfiguration[i][j]));
|
||||
}
|
||||
}
|
||||
// single chip configuration
|
||||
int ind = chipIndex;
|
||||
// all chips, take the first one as all equal
|
||||
if (ind == -1) {
|
||||
ind = 0;
|
||||
}
|
||||
uint8_t values[NADC];
|
||||
memcpy(values, adcConfiguration + ind * NADC, NADC);
|
||||
|
||||
// change adc values if continuous mode
|
||||
for (int i = 0; i < NADC; ++i) {
|
||||
if (burstMode == BURST_OFF) {
|
||||
values[i] |= ASIC_CONTINUOUS_MODE_MSK;
|
||||
}
|
||||
LOG(logDEBUG2, ("Value %d: 0x%02hhx\n", i, values[i]));
|
||||
}
|
||||
|
||||
const int lenDataBitsPerADC = ASIC_ADC_MAX_BITS; // 7
|
||||
const int lenBits = lenDataBitsPerADC * NADC; // 224
|
||||
@ -1949,8 +1976,9 @@ int configureSingleADCDriver(int chipIndex) {
|
||||
for (int ich = 0; ich < NADC; ++ich) {
|
||||
// loop through all bits in a value
|
||||
for (int iBit = 0; iBit < lenDataBitsPerADC; ++iBit) {
|
||||
commandBytes[offset++] =
|
||||
((values[ich] >> (lenDataBitsPerADC - 1 - iBit)) & 0x1);
|
||||
commandBytes[offset++] = ((adcConfiguration[ind][ich] >>
|
||||
(lenDataBitsPerADC - 1 - iBit)) &
|
||||
0x1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1977,29 +2005,46 @@ int configureSingleADCDriver(int chipIndex) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int configureADC() {
|
||||
LOG(logINFO, ("Configuring ADC \n"));
|
||||
int getADCConfiguration(int chipIndex, int adcIndex) {
|
||||
// already validated at tcp interface
|
||||
if (chipIndex < -1 || chipIndex >= NCHIP) {
|
||||
LOG(logERROR, ("Invalid chip index %d\n", chipIndex));
|
||||
return -1;
|
||||
}
|
||||
if (adcIndex < -1 || adcIndex >= NADC) {
|
||||
LOG(logERROR, ("Invalid adc index %d\n", adcIndex));
|
||||
return -1;
|
||||
}
|
||||
int chipmin = 0;
|
||||
int chipmax = NCHIP;
|
||||
int adcmin = 0;
|
||||
int adcmax = NADC;
|
||||
// specific chip
|
||||
if (chipIndex != -1) {
|
||||
chipmin = chipIndex;
|
||||
chipmax = chipIndex + 1;
|
||||
}
|
||||
// specific adc (reversing adc when sending to chip)
|
||||
if (adcIndex != -1) {
|
||||
adcmin = NADC - 1 - adcIndex;
|
||||
adcmax = NADC - adcIndex;
|
||||
}
|
||||
int val = adcConfiguration[chipmin][adcmin];
|
||||
|
||||
int equal = 1;
|
||||
for (int i = 0; i < NADC; ++i) {
|
||||
int val = adcConfiguration[0][i];
|
||||
for (int j = 1; j < NCHIP; ++j) {
|
||||
if (adcConfiguration[j][i] != val) {
|
||||
equal = 0;
|
||||
break;
|
||||
// ensure same values for chip and adc in question
|
||||
for (int i = chipmin; i < chipmax; ++i) {
|
||||
for (int j = adcmin; j < adcmax; ++j) {
|
||||
if (adcConfiguration[i][j] != val) {
|
||||
LOG(logINFO,
|
||||
("\tADC configuration 0x%x at [%d][%d] differs from 0x%x "
|
||||
"at "
|
||||
"[%d][%d], returning -1\n",
|
||||
adcConfiguration[i][j], i, j, val, chipmin, adcmin));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (equal) {
|
||||
return configureSingleADCDriver(-1);
|
||||
} else {
|
||||
for (int i = 0; i < NCHIP; ++i) {
|
||||
if (configureSingleADCDriver(i) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
return val;
|
||||
}
|
||||
|
||||
int setBurstModeinFPGA(enum burstMode value) {
|
||||
@ -2104,10 +2149,25 @@ int setBurstMode(enum burstMode burst) {
|
||||
}
|
||||
}
|
||||
LOG(logINFO, ("\tDone Updating registers\n"))
|
||||
return configureASICGlobalSettings();
|
||||
}
|
||||
|
||||
LOG(logINFO, ("\tSetting %s Mode in Chip\n",
|
||||
burstMode == BURST_OFF ? "Continuous" : "Burst"));
|
||||
int value = burstMode ? ASIC_GLOBAL_BURST_VALUE : ASIC_GLOBAL_CONT_VALUE;
|
||||
int configureASICGlobalSettings() {
|
||||
int value = ((filter << ASIC_FILTER_OFST) & ASIC_FILTER_MSK) |
|
||||
((cdsGain << ASIC_CDS_GAIN_OFST) & ASIC_CDS_GAIN_MSK);
|
||||
switch (burstMode) {
|
||||
case BURST_OFF:
|
||||
value |= (ASIC_CONT_MODE_MSK | ASIC_EXT_TIMING_MSK);
|
||||
break;
|
||||
case BURST_INTERNAL:
|
||||
break;
|
||||
case BURST_EXTERNAL:
|
||||
value |= ASIC_EXT_TIMING_MSK;
|
||||
break;
|
||||
}
|
||||
LOG(logINFO, ("\tSending Global Chip settings:0x%x (filter:%d, "
|
||||
"cdsgain:%d)\n",
|
||||
value, filter, cdsGain));
|
||||
|
||||
const int padding = 6; // due to address (4) to make it byte aligned
|
||||
const int lenTotalBits = padding + ASIC_GLOBAL_SETT_MAX_BITS +
|
||||
@ -2145,7 +2205,7 @@ int setBurstMode(enum burstMode burst) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
return configureADC();
|
||||
return OK;
|
||||
}
|
||||
|
||||
enum burstMode getBurstMode() {
|
||||
@ -2168,6 +2228,30 @@ enum burstMode getBurstMode() {
|
||||
return burstMode;
|
||||
}
|
||||
|
||||
int setCDSGain(int enable) {
|
||||
if (enable >= 0) {
|
||||
cdsGain = (enable == 0 ? 0 : 1);
|
||||
LOG(logINFO,
|
||||
("%s CDS Gain\n", (cdsGain == 0 ? "Disabling" : "Enabling")));
|
||||
return configureASICGlobalSettings();
|
||||
}
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
int getCDSGain() { return cdsGain; }
|
||||
|
||||
int setFilter(int value) {
|
||||
if (value < 0 || value > ASIC_FILTER_MAX_VALUE) {
|
||||
LOG(logERROR, ("Invalid filter value %d\n", value));
|
||||
return FAIL;
|
||||
}
|
||||
filter = value;
|
||||
LOG(logINFO, ("Setting Filter to %d\n", filter));
|
||||
return configureASICGlobalSettings();
|
||||
}
|
||||
|
||||
int getFilter() { return filter; }
|
||||
|
||||
void setCurrentSource(int value) {
|
||||
uint32_t addr = ASIC_CONFIG_REG;
|
||||
if (value > 0) {
|
||||
@ -2230,6 +2314,72 @@ int getVeto() {
|
||||
CONFIG_VETO_ENBL_OFST);
|
||||
}
|
||||
|
||||
void setBadChannels(int nch, int *channels) {
|
||||
LOG(logINFO, ("Setting %d bad channels\n", nch));
|
||||
|
||||
int numAddr = MASK_STRIP_NUM_REGS;
|
||||
int startAddr = MASK_STRIP_START_REG;
|
||||
|
||||
// resetting all mask registers first
|
||||
for (int iaddr = 0; iaddr < numAddr; ++iaddr) {
|
||||
uint32_t addr = startAddr + iaddr * REG_OFFSET;
|
||||
bus_w(addr, 0);
|
||||
}
|
||||
|
||||
// setting badchannels, loop through list
|
||||
for (int i = 0; i < nch; ++i) {
|
||||
LOG(logINFO, ("\t[%d]: %d\n", i, channels[i]));
|
||||
int iaddr = channels[i] / 32;
|
||||
int iBit = channels[i] % 32;
|
||||
uint32_t addr = startAddr + iaddr * REG_OFFSET;
|
||||
LOG(logDEBUG1,
|
||||
("val:%d iaddr:%d iBit:%d, addr:0x%x old:0x%x val:0x%x\n",
|
||||
channels[i], iaddr, iBit, addr, bus_r(addr), (1 << iBit)));
|
||||
bus_w(addr, bus_r(addr) | (1 << iBit));
|
||||
}
|
||||
}
|
||||
|
||||
int *getBadChannels(int *nch) {
|
||||
int *retvals = NULL;
|
||||
// count number of bad channels
|
||||
*nch = 0;
|
||||
for (int i = 0; i < MASK_STRIP_NUM_REGS; ++i) {
|
||||
uint32_t addr = MASK_STRIP_START_REG + i * REG_OFFSET;
|
||||
*nch += __builtin_popcount(bus_r(addr));
|
||||
}
|
||||
if (*nch > 0) {
|
||||
// get list of bad channels
|
||||
retvals = malloc(*nch * sizeof(int));
|
||||
if (retvals == NULL) {
|
||||
*nch = -1;
|
||||
return NULL;
|
||||
}
|
||||
int chIndex = 0;
|
||||
int numAddr = MASK_STRIP_NUM_REGS;
|
||||
// loop through registers
|
||||
for (int iaddr = 0; iaddr < numAddr; ++iaddr) {
|
||||
// calculate address and get value
|
||||
uint32_t addr = MASK_STRIP_START_REG + iaddr * REG_OFFSET;
|
||||
uint32_t val = bus_r(addr);
|
||||
// loop through 32 bits
|
||||
for (int iBit = 0; iBit < 32; ++iBit) {
|
||||
// masked, add to list
|
||||
if ((val >> iBit) & 0x1) {
|
||||
LOG(logDEBUG1, ("iaddr:%d iBit:%d val:0x%x, ch:%d\n", iaddr,
|
||||
iBit, val, iaddr * 32 + iBit));
|
||||
retvals[chIndex++] = iaddr * 32 + iBit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// debugging
|
||||
LOG(logDEBUG1, ("Reading Bad channel list\n"));
|
||||
for (int i = 0; i < (*nch); ++i) {
|
||||
LOG(logDEBUG1, ("[%d]: %d\n", i, retvals[i]));
|
||||
}
|
||||
return retvals;
|
||||
}
|
||||
|
||||
/* aquisition */
|
||||
|
||||
int startStateMachine() {
|
||||
@ -2244,22 +2394,15 @@ int startStateMachine() {
|
||||
}
|
||||
LOG(logINFOBLUE, ("Starting State Machine\n"));
|
||||
// set status to running
|
||||
virtual_status = 1;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
virtual_stop = ComVirtual_getStop();
|
||||
if (virtual_stop != 0) {
|
||||
LOG(logERROR, ("Cant start acquisition. "
|
||||
"Stop server has not updated stop status to 0\n"));
|
||||
return FAIL;
|
||||
}
|
||||
if (sharedMemory_getStop() != 0) {
|
||||
LOG(logERROR, ("Cant start acquisition. "
|
||||
"Stop server has not updated stop status to 0\n"));
|
||||
return FAIL;
|
||||
}
|
||||
sharedMemory_setStatus(RUNNING);
|
||||
if (pthread_create(&pthread_virtual_tid, NULL, &start_timer, NULL)) {
|
||||
LOG(logERROR, ("Could not start Virtual acquisition thread\n"));
|
||||
virtual_status = 0;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
}
|
||||
sharedMemory_setStatus(IDLE);
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFOGREEN, ("Virtual Acquisition started\n"));
|
||||
@ -2314,86 +2457,80 @@ void *start_timer(void *arg) {
|
||||
*((uint16_t *)(vetoData + i)) = i;
|
||||
}
|
||||
|
||||
{
|
||||
int frameHeaderNr = 0;
|
||||
// loop over number of repeats
|
||||
for (int repeatNr = 0; repeatNr != numRepeats; ++repeatNr) {
|
||||
// loop over number of repeats
|
||||
for (int repeatNr = 0; repeatNr != numRepeats; ++repeatNr) {
|
||||
|
||||
struct timespec rbegin, rend;
|
||||
clock_gettime(CLOCK_REALTIME, &rbegin);
|
||||
struct timespec rbegin, rend;
|
||||
clock_gettime(CLOCK_REALTIME, &rbegin);
|
||||
|
||||
// loop over number of frames
|
||||
for (int frameNr = 0; frameNr != numFrames; ++frameNr) {
|
||||
// loop over number of frames
|
||||
for (int frameNr = 0; frameNr != numFrames; ++frameNr) {
|
||||
|
||||
// update the virtual stop from stop server
|
||||
virtual_stop = ComVirtual_getStop();
|
||||
// check if virtual_stop is high
|
||||
if (virtual_stop == 1) {
|
||||
break;
|
||||
}
|
||||
// check if manual stop
|
||||
if (sharedMemory_getStop() == 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
// sleep for exposure time
|
||||
struct timespec begin, end;
|
||||
clock_gettime(CLOCK_REALTIME, &begin);
|
||||
usleep(expUs);
|
||||
// sleep for exposure time
|
||||
struct timespec begin, end;
|
||||
clock_gettime(CLOCK_REALTIME, &begin);
|
||||
usleep(expUs);
|
||||
|
||||
// first interface
|
||||
char packetData[packetsize];
|
||||
memset(packetData, 0, packetsize);
|
||||
// first interface
|
||||
char packetData[packetsize];
|
||||
memset(packetData, 0, packetsize);
|
||||
// set header
|
||||
sls_detector_header *header = (sls_detector_header *)(packetData);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||
header->frameNumber = virtual_currentFrameNumber;
|
||||
header->packetNumber = 0;
|
||||
header->modId = 0;
|
||||
header->row = detPos[X];
|
||||
header->column = detPos[Y];
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header), imageData,
|
||||
datasize);
|
||||
// send 1 packet = 1 frame
|
||||
sendUDPPacket(0, packetData, packetsize);
|
||||
|
||||
// second interface (veto)
|
||||
char packetData2[vetopacketsize];
|
||||
memset(packetData2, 0, vetopacketsize);
|
||||
if (vetoEnabled && numInterfaces == 2) {
|
||||
// set header
|
||||
sls_detector_header *header =
|
||||
(sls_detector_header *)(packetData);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||
header->frameNumber = frameHeaderNr;
|
||||
header->packetNumber = 0;
|
||||
header->modId = 0;
|
||||
header->row = detPos[X];
|
||||
header->column = detPos[Y];
|
||||
veto_header *header = (veto_header *)(packetData2);
|
||||
header->frameNumber = virtual_currentFrameNumber;
|
||||
header->bunchId = 0;
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header), imageData,
|
||||
datasize);
|
||||
memcpy(packetData2 + sizeof(veto_header), vetoData,
|
||||
vetodatasize);
|
||||
// send 1 packet = 1 frame
|
||||
sendUDPPacket(0, packetData, packetsize);
|
||||
sendUDPPacket(1, packetData2, vetopacketsize);
|
||||
}
|
||||
LOG(logINFO,
|
||||
("Sent frame: %d (bursts: %d) [%lld]\n", frameNr, repeatNr,
|
||||
(long long unsigned int)virtual_currentFrameNumber));
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
||||
(end.tv_nsec - begin.tv_nsec));
|
||||
|
||||
// second interface (veto)
|
||||
char packetData2[vetopacketsize];
|
||||
memset(packetData2, 0, vetopacketsize);
|
||||
if (vetoEnabled && numInterfaces == 2) {
|
||||
// set header
|
||||
veto_header *header = (veto_header *)(packetData2);
|
||||
header->frameNumber = frameHeaderNr;
|
||||
header->bunchId = 0;
|
||||
// fill data
|
||||
memcpy(packetData2 + sizeof(veto_header), vetoData,
|
||||
vetodatasize);
|
||||
// send 1 packet = 1 frame
|
||||
sendUDPPacket(1, packetData2, vetopacketsize);
|
||||
}
|
||||
++frameHeaderNr;
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
LOG(logINFO,
|
||||
("Sent frame: %d (bursts: %d)\n", frameNr, repeatNr));
|
||||
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
||||
(end.tv_nsec - begin.tv_nsec));
|
||||
|
||||
// sleep for (period - exptime)
|
||||
if (frameNr < numFrames) { // if there is a next frame
|
||||
if (periodNs > timeNs) {
|
||||
usleep((periodNs - timeNs) / 1000);
|
||||
}
|
||||
// sleep for (period - exptime)
|
||||
if (frameNr < numFrames) { // if there is a next frame
|
||||
if (periodNs > timeNs) {
|
||||
usleep((periodNs - timeNs) / 1000);
|
||||
}
|
||||
}
|
||||
clock_gettime(CLOCK_REALTIME, &rend);
|
||||
int64_t timeNs = ((rend.tv_sec - rbegin.tv_sec) * 1E9 +
|
||||
(rend.tv_nsec - rbegin.tv_nsec));
|
||||
++virtual_currentFrameNumber;
|
||||
}
|
||||
clock_gettime(CLOCK_REALTIME, &rend);
|
||||
int64_t timeNs = ((rend.tv_sec - rbegin.tv_sec) * 1E9 +
|
||||
(rend.tv_nsec - rbegin.tv_nsec));
|
||||
|
||||
// sleep for (repeatPeriodNs - time remaining)
|
||||
if (repeatNr < numRepeats) { // if there is a next repeat
|
||||
if (repeatPeriodNs > timeNs) {
|
||||
usleep((repeatPeriodNs - timeNs) / 1000);
|
||||
}
|
||||
// sleep for (repeatPeriodNs - time remaining)
|
||||
if (repeatNr < numRepeats) { // if there is a next repeat
|
||||
if (repeatPeriodNs > timeNs) {
|
||||
usleep((repeatPeriodNs - timeNs) / 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2403,10 +2540,7 @@ void *start_timer(void *arg) {
|
||||
closeUDPSocket(1);
|
||||
}
|
||||
|
||||
virtual_status = 0;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
}
|
||||
sharedMemory_setStatus(IDLE);
|
||||
LOG(logINFOBLUE, ("Finished Acquiring\n"));
|
||||
return NULL;
|
||||
}
|
||||
@ -2414,19 +2548,16 @@ void *start_timer(void *arg) {
|
||||
|
||||
int stopStateMachine() {
|
||||
LOG(logINFORED, ("Stopping State Machine\n"));
|
||||
#ifdef VIRTUAL
|
||||
if (!isControlServer) {
|
||||
virtual_stop = 1;
|
||||
ComVirtual_setStop(virtual_stop);
|
||||
// read till status is idle
|
||||
int tempStatus = 1;
|
||||
while (tempStatus == 1) {
|
||||
tempStatus = ComVirtual_getStatus();
|
||||
}
|
||||
virtual_stop = 0;
|
||||
ComVirtual_setStop(virtual_stop);
|
||||
LOG(logINFO, ("Stopped State Machine\n"));
|
||||
// if scan active, stop scan
|
||||
if (sharedMemory_getScanStatus() == RUNNING) {
|
||||
sharedMemory_setScanStop(1);
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
sharedMemory_setStop(1);
|
||||
while (sharedMemory_getStatus() == RUNNING)
|
||||
;
|
||||
sharedMemory_setStop(0);
|
||||
LOG(logINFO, ("Stopped State Machine\n"));
|
||||
return OK;
|
||||
#endif
|
||||
// stop state machine
|
||||
@ -2436,19 +2567,24 @@ int stopStateMachine() {
|
||||
}
|
||||
|
||||
enum runStatus getRunStatus() {
|
||||
#ifdef VIRTUAL
|
||||
if (!isControlServer) {
|
||||
virtual_status = ComVirtual_getStatus();
|
||||
LOG(logDEBUG1, ("Getting status\n"));
|
||||
// scan error or running
|
||||
if (sharedMemory_getScanStatus() == ERROR) {
|
||||
LOG(logINFOBLUE, ("Status: scan ERROR\n"));
|
||||
return ERROR;
|
||||
}
|
||||
if (virtual_status == 0) {
|
||||
LOG(logINFOBLUE, ("Status: IDLE\n"));
|
||||
return IDLE;
|
||||
} else {
|
||||
if (sharedMemory_getScanStatus() == RUNNING) {
|
||||
LOG(logINFOBLUE, ("Status: scan RUNNING\n"));
|
||||
return RUNNING;
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
if (sharedMemory_getStatus() == RUNNING) {
|
||||
LOG(logINFOBLUE, ("Status: RUNNING\n"));
|
||||
return RUNNING;
|
||||
}
|
||||
LOG(logINFOBLUE, ("Status: IDLE\n"));
|
||||
return IDLE;
|
||||
#endif
|
||||
LOG(logDEBUG1, ("Getting status\n"));
|
||||
uint32_t retval = bus_r(FLOW_STATUS_REG);
|
||||
LOG(logINFO, ("Status Register: %08x\n", retval));
|
||||
|
||||
@ -2515,10 +2651,7 @@ void readFrame(int *ret, char *mess) {
|
||||
|
||||
u_int32_t runBusy() {
|
||||
#ifdef VIRTUAL
|
||||
if (!isControlServer) {
|
||||
virtual_status = ComVirtual_getStatus();
|
||||
}
|
||||
return virtual_status;
|
||||
return ((sharedMemory_getStatus() == RUNNING) ? 1 : 0);
|
||||
#endif
|
||||
u_int32_t s = (bus_r(FLOW_STATUS_REG) & FLOW_STATUS_RUN_BUSY_MSK);
|
||||
// LOG(logDEBUG1, ("Status Register: %08x\n", s));
|
||||
@ -2534,4 +2667,4 @@ int getTotalNumberOfChannels() {
|
||||
}
|
||||
int getNumberOfChips() { return NCHIP; }
|
||||
int getNumberOfDACs() { return NDAC; }
|
||||
int getNumberOfChannelsPerChip() { return NCHAN; }
|
||||
int getNumberOfChannelsPerChip() { return NCHAN; }
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#define REQRD_FRMWRE_VRSN (0x190000)
|
||||
#define REQRD_FRMWRE_VRSN (0x200707)
|
||||
|
||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||
|
||||
@ -18,19 +18,21 @@
|
||||
#define DAC_DRIVER_FILE_NAME ("/etc/devlinks/dac")
|
||||
#define ONCHIP_DAC_DRIVER_FILE_NAME ("/etc/devlinks/chipdac")
|
||||
#define TYPE_FILE_NAME ("/etc/devlinks/type")
|
||||
#define CONFIG_FILE ("config.txt")
|
||||
#define CONFIG_FILE ("config_gotthard2.txt")
|
||||
#define DAC_MAX_MV (2048)
|
||||
#define ONCHIP_DAC_MAX_VAL (0x3FF)
|
||||
#define ADU_MAX_VAL (0xFFF)
|
||||
#define ADU_MAX_BITS (12)
|
||||
#define MAX_FRAMES_IN_BURST_MODE (2720)
|
||||
#define TYPE_GOTTHARD2_MODULE_VAL (512)
|
||||
#define TYPE_GOTTHARD2_MODULE_VAL (536)
|
||||
#define TYPE_TOLERANCE (10)
|
||||
#define TYPE_NO_MODULE_STARTING_VAL (800)
|
||||
#define INITIAL_STARTUP_WAIT (1 * 1000 * 1000)
|
||||
|
||||
/** Default Parameters */
|
||||
#define DEFAULT_BURST_MODE (BURST_INTERNAL)
|
||||
#define DEFAULT_FILTER (0)
|
||||
#define DEFAILT_CDS_GAIN (0)
|
||||
#define DEFAULT_NUM_FRAMES (1)
|
||||
#define DEFAULT_NUM_CYCLES (1)
|
||||
#define DEFAULT_NUM_BURSTS (1)
|
||||
@ -134,8 +136,18 @@ enum PLLINDEX { READOUT_PLL, SYSTEM_PLL };
|
||||
#define ASIC_ADC_MAX_BITS (7)
|
||||
#define ASIC_ADC_MAX_VAL (0x7F)
|
||||
#define ASIC_GLOBAL_SETT_MAX_BITS (6)
|
||||
#define ASIC_GLOBAL_BURST_VALUE (0x0)
|
||||
#define ASIC_GLOBAL_CONT_VALUE (0x1E)
|
||||
|
||||
#define ASIC_EXT_MEMCTRL_OFST (0)
|
||||
#define ASIC_EXT_MEMCTRL_MSK (0x1 << ASIC_EXT_MEMCTRL_OFST)
|
||||
#define ASIC_EXT_TIMING_OFST (1)
|
||||
#define ASIC_EXT_TIMING_MSK (0x1 << ASIC_EXT_TIMING_OFST)
|
||||
#define ASIC_CONT_MODE_OFST (2)
|
||||
#define ASIC_CONT_MODE_MSK (0x1 << ASIC_CONT_MODE_OFST)
|
||||
#define ASIC_FILTER_OFST (3)
|
||||
#define ASIC_FILTER_MSK (0x3 << ASIC_FILTER_OFST)
|
||||
#define ASIC_FILTER_MAX_VALUE (3)
|
||||
#define ASIC_CDS_GAIN_OFST (5)
|
||||
#define ASIC_CDS_GAIN_MSK (0x1 << ASIC_CDS_GAIN_OFST)
|
||||
|
||||
/* Struct Definitions */
|
||||
typedef struct udp_header_struct {
|
||||
@ -161,4 +173,4 @@ typedef struct udp_header_struct {
|
||||
uint16_t udp_destport;
|
||||
} udp_header;
|
||||
#define IP_HEADER_SIZE (20)
|
||||
#define UDP_IP_HEADER_LENGTH_BYTES (28)
|
||||
#define UDP_IP_HEADER_LENGTH_BYTES (28)
|
||||
|
@ -10,7 +10,7 @@ add_executable(gotthardDetectorServer_virtual
|
||||
../slsDetectorServer/src/common.c
|
||||
../slsDetectorServer/src/commonServerFunctions.c
|
||||
../slsDetectorServer/src/communication_funcs_UDP.c
|
||||
../slsDetectorServer/src/communication_virtual.c
|
||||
../slsDetectorServer/src/sharedMemory.c
|
||||
)
|
||||
|
||||
include_directories(
|
||||
@ -37,3 +37,5 @@ set_target_properties(gotthardDetectorServer_virtual PROPERTIES
|
||||
install(TARGETS gotthardDetectorServer_virtual
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
|
||||
configure_file(config_gotthard.txt ${CMAKE_BINARY_DIR}/bin/config_gotthard.txt COPYONLY)
|
@ -5,14 +5,14 @@ support_lib = ../../slsSupportLib/include/
|
||||
|
||||
CROSS = bfin-uclinux-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -DGOTTHARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm
|
||||
CFLAGS += -Wall -std=gnu99 -DGOTTHARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm -lrt -pthread
|
||||
PROGS = gotthardDetectorServer
|
||||
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)AD9252.c $(main_src)AD9257.c $(main_src)LTC2620.c $(main_src)common.c $(main_src)commonServerFunctions.c
|
||||
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)AD9252.c $(main_src)AD9257.c $(main_src)LTC2620.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)/sharedMemory.c
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
all: clean $(PROGS)
|
||||
@ -31,6 +31,7 @@ $(PROGS): $(OBJS)
|
||||
mkdir -p $(DESTDIR)
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
|
||||
mv $(PROGS) $(DESTDIR)
|
||||
cp config_gotthard.txt $(DESTDIR)
|
||||
rm *.gdb
|
||||
rm $(main_src)*.o
|
||||
|
||||
|
Binary file not shown.
@ -1,12 +1,13 @@
|
||||
#include "slsDetectorFunctionList.h"
|
||||
#include "RegisterDefs.h"
|
||||
#include "clogger.h"
|
||||
#include "common.h"
|
||||
#include "sharedMemory.h"
|
||||
#include "versionAPI.h"
|
||||
|
||||
#include "LTC2620.h" // dacs
|
||||
#ifdef VIRTUAL
|
||||
#include "communication_funcs_UDP.h"
|
||||
#include "communication_virtual.h"
|
||||
#endif
|
||||
|
||||
#include "string.h"
|
||||
@ -34,9 +35,8 @@ char initErrorMessage[MAX_STR_LENGTH];
|
||||
|
||||
#ifdef VIRTUAL
|
||||
pthread_t pthread_virtual_tid;
|
||||
int virtual_status = 0;
|
||||
int virtual_stop = 0;
|
||||
int highvoltage = 0;
|
||||
int64_t virtual_currentFrameNumber = 2;
|
||||
#endif
|
||||
int detPos[2] = {};
|
||||
|
||||
@ -167,8 +167,7 @@ int testFpga() {
|
||||
u_int32_t addr = DUMMY_REG;
|
||||
volatile u_int32_t val = 0, readval = 0;
|
||||
int times = 1000 * 1000;
|
||||
int i = 0;
|
||||
for (i = 0; i < times; ++i) {
|
||||
for (int i = 0; i < times; ++i) {
|
||||
val = 0x5A5A5A5A - i;
|
||||
bus_w(addr, val);
|
||||
readval = bus_r(addr);
|
||||
@ -226,9 +225,8 @@ int testBus() {
|
||||
u_int32_t addr = DUMMY_REG;
|
||||
volatile u_int32_t val = 0, readval = 0;
|
||||
int times = 1000 * 1000;
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
for (int i = 0; i < times; ++i) {
|
||||
val += 0xbbbbb;
|
||||
bus_w(addr, val);
|
||||
readval = bus_r(addr);
|
||||
@ -358,10 +356,7 @@ void initStopServer() {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
virtual_stop = 0;
|
||||
if (!isControlServer) {
|
||||
ComVirtual_setStop(virtual_stop);
|
||||
}
|
||||
sharedMemory_setStop(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -371,10 +366,7 @@ void setupDetector() {
|
||||
LOG(logINFO, ("This Server is for 1 Gotthard module (1280 channels)\n"));
|
||||
|
||||
#ifdef VIRTUAL
|
||||
virtual_status = 0;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
}
|
||||
sharedMemory_setStatus(IDLE);
|
||||
#endif
|
||||
|
||||
// Initialization
|
||||
@ -436,14 +428,11 @@ void setupDetector() {
|
||||
int setDefaultDacs() {
|
||||
int ret = OK;
|
||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||
{
|
||||
int i = 0;
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
for (i = 0; i < NDAC; ++i) {
|
||||
// if not already default, set it to default
|
||||
if (dacValues[i] != defaultvals[i]) {
|
||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
||||
}
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
// if not already default, set it to default
|
||||
if (dacValues[i] != defaultvals[i]) {
|
||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -477,8 +466,7 @@ void setPhaseShiftOnce() {
|
||||
detectorFirstServer = 1;
|
||||
LOG(logINFO,
|
||||
("Implementing the first phase shift of %d\n", phaseShift));
|
||||
int times = 0;
|
||||
for (times = 1; times < phaseShift; ++times) {
|
||||
for (int times = 1; times < phaseShift; ++times) {
|
||||
bus_w(addr, (INT_RSTN_MSK | ENT_RSTN_MSK | SW1_MSK |
|
||||
PHS_STP_MSK)); // 0x1821
|
||||
bus_w(addr, (INT_RSTN_MSK | ENT_RSTN_MSK |
|
||||
@ -495,8 +483,7 @@ void setPhaseShift(int numphaseshift) {
|
||||
|
||||
volatile u_int32_t val = bus_r(addr);
|
||||
LOG(logDEBUG1, ("Multipurpose reg: 0x%x\n", val));
|
||||
int times = 0;
|
||||
for (times = 1; times < numphaseshift; ++times) {
|
||||
for (int times = 1; times < numphaseshift; ++times) {
|
||||
bus_w(addr, val | PHS_STP_MSK);
|
||||
bus_w(addr, val & (~PHS_STP_MSK));
|
||||
}
|
||||
@ -591,10 +578,15 @@ void setGbitReadout() {
|
||||
}
|
||||
|
||||
int readConfigFile() {
|
||||
char fname[128];
|
||||
if (getAbsPath(fname, 128, CONFIG_FILE) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// open config file
|
||||
FILE *fd = fopen(CONFIG_FILE, "r");
|
||||
FILE *fd = fopen(fname, "r");
|
||||
if (fd == NULL) {
|
||||
LOG(logWARNING, ("\tCould not find config file %s\n", CONFIG_FILE));
|
||||
LOG(logWARNING, ("Could not find config file %s\n", CONFIG_FILE));
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFO, ("\tConfig file %s opened\n", CONFIG_FILE));
|
||||
@ -947,75 +939,51 @@ int setModule(sls_detector_module myMod, char *mess) {
|
||||
setSettings((enum detectorSettings)myMod.reg);
|
||||
|
||||
// set dac values
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < NDAC; ++i)
|
||||
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
|
||||
}
|
||||
for (int i = 0; i < NDAC; ++i)
|
||||
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
|
||||
return OK;
|
||||
}
|
||||
|
||||
int getModule(sls_detector_module *myMod) {
|
||||
int idac = 0;
|
||||
for (idac = 0; idac < NDAC; ++idac) {
|
||||
if (dacValues[idac] >= 0)
|
||||
*((myMod->dacs) + idac) = dacValues[idac];
|
||||
}
|
||||
// check if all of them are not initialized
|
||||
int initialized = 0;
|
||||
for (idac = 0; idac < NDAC; ++idac) {
|
||||
if (dacValues[idac] >= 0)
|
||||
initialized = 1;
|
||||
}
|
||||
if (initialized) {
|
||||
return OK;
|
||||
}
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
enum detectorSettings setSettings(enum detectorSettings sett) {
|
||||
if (sett == UNINITIALIZED)
|
||||
return thisSettings;
|
||||
|
||||
// set settings
|
||||
if (sett != GET_SETTINGS) {
|
||||
u_int32_t addr = GAIN_REG;
|
||||
u_int32_t addr = GAIN_REG;
|
||||
|
||||
// find conf gain value
|
||||
uint32_t confgain = 0x0;
|
||||
switch (sett) {
|
||||
case DYNAMICGAIN:
|
||||
LOG(logINFO, ("Set settings - Dyanmic Gain\n"));
|
||||
confgain = GAIN_CONFGAIN_DYNMC_GAIN_VAL;
|
||||
break;
|
||||
case HIGHGAIN:
|
||||
LOG(logINFO, ("Set settings - High Gain\n"));
|
||||
confgain = GAIN_CONFGAIN_HGH_GAIN_VAL;
|
||||
break;
|
||||
case LOWGAIN:
|
||||
LOG(logINFO, ("Set settings - Low Gain\n"));
|
||||
confgain = GAIN_CONFGAIN_LW_GAIN_VAL;
|
||||
break;
|
||||
case MEDIUMGAIN:
|
||||
LOG(logINFO, ("Set settings - Medium Gain\n"));
|
||||
confgain = GAIN_CONFGAIN_MDM_GAIN_VAL;
|
||||
break;
|
||||
case VERYHIGHGAIN:
|
||||
LOG(logINFO, ("Set settings - Very High Gain\n"));
|
||||
confgain = GAIN_CONFGAIN_VRY_HGH_GAIN_VAL;
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR,
|
||||
("This settings is not defined for this detector %d\n",
|
||||
(int)sett));
|
||||
return -1;
|
||||
}
|
||||
// set conf gain
|
||||
bus_w(addr, bus_r(addr) & ~GAIN_CONFGAIN_MSK);
|
||||
bus_w(addr, bus_r(addr) | confgain);
|
||||
LOG(logINFO, ("\tGain Reg: 0x%x\n", bus_r(addr)));
|
||||
thisSettings = sett;
|
||||
// find conf gain value
|
||||
uint32_t confgain = 0x0;
|
||||
switch (sett) {
|
||||
case DYNAMICGAIN:
|
||||
LOG(logINFO, ("Set settings - Dyanmic Gain\n"));
|
||||
confgain = GAIN_CONFGAIN_DYNMC_GAIN_VAL;
|
||||
break;
|
||||
case HIGHGAIN:
|
||||
LOG(logINFO, ("Set settings - High Gain\n"));
|
||||
confgain = GAIN_CONFGAIN_HGH_GAIN_VAL;
|
||||
break;
|
||||
case LOWGAIN:
|
||||
LOG(logINFO, ("Set settings - Low Gain\n"));
|
||||
confgain = GAIN_CONFGAIN_LW_GAIN_VAL;
|
||||
break;
|
||||
case MEDIUMGAIN:
|
||||
LOG(logINFO, ("Set settings - Medium Gain\n"));
|
||||
confgain = GAIN_CONFGAIN_MDM_GAIN_VAL;
|
||||
break;
|
||||
case VERYHIGHGAIN:
|
||||
LOG(logINFO, ("Set settings - Very High Gain\n"));
|
||||
confgain = GAIN_CONFGAIN_VRY_HGH_GAIN_VAL;
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR,
|
||||
("This settings is not defined for this detector %d\n", (int)sett));
|
||||
return -1;
|
||||
}
|
||||
// set conf gain
|
||||
bus_w(addr, bus_r(addr) & ~GAIN_CONFGAIN_MSK);
|
||||
bus_w(addr, bus_r(addr) | confgain);
|
||||
LOG(logINFO, ("\tGain Reg: 0x%x\n", bus_r(addr)));
|
||||
thisSettings = sett;
|
||||
|
||||
return getSettings();
|
||||
}
|
||||
@ -1112,27 +1080,23 @@ int getADC(enum ADCINDEX ind) {
|
||||
// high clk low cs
|
||||
bus_w(addr, (TEMP_SPI_IN_T1_CLK_MSK | TEMP_SPI_IN_T2_CLK_MSK));
|
||||
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < reads; ++i) {
|
||||
for (int i = 0; i < reads; ++i) {
|
||||
|
||||
int j = 0;
|
||||
// low clk low cs
|
||||
for (j = 0; j < repeats; ++j)
|
||||
bus_w(addr, 0x0);
|
||||
// high clk low cs
|
||||
for (j = 0; j < repeats; ++j)
|
||||
bus_w(addr, (TEMP_SPI_IN_T1_CLK_MSK | TEMP_SPI_IN_T2_CLK_MSK));
|
||||
// low clk low cs
|
||||
for (int j = 0; j < repeats; ++j)
|
||||
bus_w(addr, 0x0);
|
||||
// high clk low cs
|
||||
for (int j = 0; j < repeats; ++j)
|
||||
bus_w(addr, (TEMP_SPI_IN_T1_CLK_MSK | TEMP_SPI_IN_T2_CLK_MSK));
|
||||
|
||||
// only the first time
|
||||
if (i <= 10) {
|
||||
if (ind == TEMP_ADC)
|
||||
value = (value << 1) +
|
||||
(bus_r(addrout) & TEMP_SPI_OUT_T1_DT_MSK);
|
||||
else
|
||||
value = (value << 1) +
|
||||
(bus_r(addrout) & TEMP_SPI_OUT_T2_DT_MSK);
|
||||
}
|
||||
// only the first time
|
||||
if (i <= 10) {
|
||||
if (ind == TEMP_ADC)
|
||||
value =
|
||||
(value << 1) + (bus_r(addrout) & TEMP_SPI_OUT_T1_DT_MSK);
|
||||
else
|
||||
value =
|
||||
(value << 1) + (bus_r(addrout) & TEMP_SPI_OUT_T2_DT_MSK);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1551,22 +1515,15 @@ int startStateMachine() {
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFOBLUE, ("Starting State Machine\n"));
|
||||
virtual_status = 1;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
virtual_stop = ComVirtual_getStop();
|
||||
if (virtual_stop != 0) {
|
||||
LOG(logERROR, ("Cant start acquisition. "
|
||||
"Stop server has not updated stop status to 0\n"));
|
||||
return FAIL;
|
||||
}
|
||||
if (sharedMemory_getStop() != 0) {
|
||||
LOG(logERROR, ("Cant start acquisition. "
|
||||
"Stop server has not updated stop status to 0\n"));
|
||||
return FAIL;
|
||||
}
|
||||
sharedMemory_setStatus(RUNNING);
|
||||
if (pthread_create(&pthread_virtual_tid, NULL, &start_timer, NULL)) {
|
||||
LOG(logERROR, ("Could not start Virtual acquisition thread\n"));
|
||||
virtual_status = 0;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
}
|
||||
sharedMemory_setStatus(IDLE);
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFOGREEN, ("Virtual Acquisition started\n"));
|
||||
@ -1603,74 +1560,60 @@ void *start_timer(void *arg) {
|
||||
// Generate Data
|
||||
char imageData[imageSize];
|
||||
memset(imageData, 0, imageSize);
|
||||
{
|
||||
int i = 0;
|
||||
if (adcConfigured == -1) {
|
||||
*((uint32_t *)(imageData)) = 0xCACACACA;
|
||||
}
|
||||
for (i = sizeof(uint32_t); i < imageSize; i += sizeof(uint16_t)) {
|
||||
*((uint16_t *)(imageData + i)) = (uint16_t)i;
|
||||
}
|
||||
if (adcConfigured == -1) {
|
||||
*((uint32_t *)(imageData)) = 0xCACACACA;
|
||||
}
|
||||
for (int i = sizeof(uint32_t); i < imageSize; i += sizeof(uint16_t)) {
|
||||
*((uint16_t *)(imageData + i)) = (uint16_t)i;
|
||||
}
|
||||
|
||||
// Send data
|
||||
{
|
||||
int frameNr = 0;
|
||||
uint16_t frameHeaderNr = 2;
|
||||
// loop over number of frames
|
||||
for (frameNr = 0; frameNr != numFrames; ++frameNr) {
|
||||
// loop over number of frames
|
||||
for (int frameNr = 0; frameNr != numFrames; ++frameNr) {
|
||||
|
||||
// update the virtual stop from stop server
|
||||
virtual_stop = ComVirtual_getStop();
|
||||
// check if virtual_stop is high
|
||||
if (virtual_stop == 1) {
|
||||
break;
|
||||
}
|
||||
// check if manual stop
|
||||
if (sharedMemory_getStop() == 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
// sleep for exposure time
|
||||
struct timespec begin, end;
|
||||
clock_gettime(CLOCK_REALTIME, &begin);
|
||||
usleep(expUs);
|
||||
// sleep for exposure time
|
||||
struct timespec begin, end;
|
||||
clock_gettime(CLOCK_REALTIME, &begin);
|
||||
usleep(expUs);
|
||||
|
||||
int srcOffset = 0;
|
||||
// loop packet
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i != packetsPerFrame; ++i) {
|
||||
int srcOffset = 0;
|
||||
// loop packet
|
||||
for (int i = 0; i != packetsPerFrame; ++i) {
|
||||
|
||||
char packetData[packetSize];
|
||||
memset(packetData, 0, packetSize);
|
||||
// set header
|
||||
*((uint16_t *)(packetData)) = frameHeaderNr;
|
||||
++frameHeaderNr;
|
||||
char packetData[packetSize];
|
||||
memset(packetData, 0, packetSize);
|
||||
// set header
|
||||
*((uint16_t *)(packetData)) = virtual_currentFrameNumber;
|
||||
++virtual_currentFrameNumber;
|
||||
|
||||
// fill data
|
||||
memcpy(packetData + 4, imageData + srcOffset, dataSize);
|
||||
srcOffset += dataSize;
|
||||
// fill data
|
||||
memcpy(packetData + 4, imageData + srcOffset, dataSize);
|
||||
srcOffset += dataSize;
|
||||
|
||||
sendUDPPacket(0, packetData, packetSize);
|
||||
}
|
||||
}
|
||||
LOG(logINFO, ("Sent frame: %d\n", frameNr));
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
||||
(end.tv_nsec - begin.tv_nsec));
|
||||
sendUDPPacket(0, packetData, packetSize);
|
||||
}
|
||||
LOG(logINFO,
|
||||
("Sent frame: %d [%d]\n", frameNr, virtual_currentFrameNumber));
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
int64_t timeNs =
|
||||
((end.tv_sec - begin.tv_sec) * 1E9 + (end.tv_nsec - begin.tv_nsec));
|
||||
|
||||
// sleep for (period - exptime)
|
||||
if (frameNr < numFrames) { // if there is a next frame
|
||||
if (periodNs > timeNs) {
|
||||
usleep((periodNs - timeNs) / 1000);
|
||||
}
|
||||
// sleep for (period - exptime)
|
||||
if (frameNr < numFrames) { // if there is a next frame
|
||||
if (periodNs > timeNs) {
|
||||
usleep((periodNs - timeNs) / 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closeUDPSocket(0);
|
||||
|
||||
virtual_status = 0;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
}
|
||||
sharedMemory_setStatus(IDLE);
|
||||
LOG(logINFOBLUE, ("Finished Acquiring\n"));
|
||||
return NULL;
|
||||
}
|
||||
@ -1678,17 +1621,17 @@ void *start_timer(void *arg) {
|
||||
|
||||
int stopStateMachine() {
|
||||
LOG(logINFORED, ("Stopping State Machine\n"));
|
||||
// if scan active, stop scan
|
||||
if (sharedMemory_getScanStatus() == RUNNING) {
|
||||
sharedMemory_setScanStop(1);
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
if (!isControlServer) {
|
||||
virtual_stop = 1;
|
||||
ComVirtual_setStop(virtual_stop);
|
||||
sharedMemory_setStop(1);
|
||||
// read till status is idle
|
||||
int tempStatus = 1;
|
||||
while (tempStatus == 1) {
|
||||
tempStatus = ComVirtual_getStatus();
|
||||
}
|
||||
virtual_stop = 0;
|
||||
ComVirtual_setStop(virtual_stop);
|
||||
while (sharedMemory_getStatus() == RUNNING)
|
||||
;
|
||||
sharedMemory_setStop(0);
|
||||
LOG(logINFO, ("Stopped State Machine\n"));
|
||||
}
|
||||
return OK;
|
||||
@ -1711,19 +1654,24 @@ int stopStateMachine() {
|
||||
}
|
||||
|
||||
enum runStatus getRunStatus() {
|
||||
#ifdef VIRTUAL
|
||||
if (!isControlServer) {
|
||||
virtual_status = ComVirtual_getStatus();
|
||||
LOG(logDEBUG1, ("Getting status\n"));
|
||||
// scan error or running
|
||||
if (sharedMemory_getScanStatus() == ERROR) {
|
||||
LOG(logINFOBLUE, ("Status: scan ERROR\n"));
|
||||
return ERROR;
|
||||
}
|
||||
if (virtual_status == 0) {
|
||||
LOG(logINFOBLUE, ("Status: IDLE\n"));
|
||||
return IDLE;
|
||||
} else {
|
||||
if (sharedMemory_getScanStatus() == RUNNING) {
|
||||
LOG(logINFOBLUE, ("Status: scan RUNNING\n"));
|
||||
return RUNNING;
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
if (sharedMemory_getStatus() == RUNNING) {
|
||||
LOG(logINFOBLUE, ("Status: RUNNING\n"));
|
||||
return RUNNING;
|
||||
}
|
||||
LOG(logINFOBLUE, ("Status: IDLE\n"));
|
||||
return IDLE;
|
||||
#endif
|
||||
LOG(logDEBUG1, ("Getting status\n"));
|
||||
|
||||
enum runStatus s = IDLE;
|
||||
u_int32_t retval = runState(logINFO);
|
||||
@ -1768,8 +1716,7 @@ enum runStatus getRunStatus() {
|
||||
} else {
|
||||
LOG(logINFORED,
|
||||
("Status: Unknown Status: 0x%x. Trying again.\n", retval));
|
||||
int iloop = 0;
|
||||
for (iloop = 0; iloop < 10; ++iloop) {
|
||||
for (int iloop = 0; iloop < 10; ++iloop) {
|
||||
usleep(1000 * 1000);
|
||||
if (runState(logDEBUG1) != retval)
|
||||
return getRunStatus();
|
||||
@ -1794,7 +1741,7 @@ enum runStatus getRunStatus() {
|
||||
|
||||
void readFrame(int *ret, char *mess) {
|
||||
#ifdef VIRTUAL
|
||||
while (virtual_status) {
|
||||
while (sharedMemory_getStatus() == RUNNING) {
|
||||
// LOG(logERROR, ("Waiting for finished flag\n");
|
||||
usleep(5000);
|
||||
}
|
||||
@ -1818,17 +1765,14 @@ void readFrame(int *ret, char *mess) {
|
||||
|
||||
u_int32_t runBusy() {
|
||||
#ifdef VIRTUAL
|
||||
if (!isControlServer) {
|
||||
virtual_status = ComVirtual_getStatus();
|
||||
}
|
||||
return virtual_status;
|
||||
return ((sharedMemory_getStatus() == RUNNING) ? 1 : 0);
|
||||
#endif
|
||||
return runState(logDEBUG1) & STATUS_RN_BSY_MSK;
|
||||
}
|
||||
|
||||
u_int32_t runState(enum TLogLevel lev) {
|
||||
#ifdef VIRTUAL
|
||||
return virtual_status;
|
||||
return (int)sharedMemory_getStatus();
|
||||
#endif
|
||||
u_int32_t s = bus_r(STATUS_REG);
|
||||
LOG(lev, ("Status Register: 0x%08x\n", s));
|
||||
|
@ -30,7 +30,7 @@ enum CLKINDEX { ADC_CLK, NUM_CLOCKS };
|
||||
};
|
||||
|
||||
/* for 25 um */
|
||||
#define CONFIG_FILE "config.txt"
|
||||
#define CONFIG_FILE "config_gotthard.txt"
|
||||
|
||||
/* Hardware Definitions */
|
||||
#define NCHAN (128)
|
||||
|
@ -12,7 +12,7 @@ add_executable(jungfrauDetectorServer_virtual
|
||||
../slsDetectorServer/src/MAX1932.c
|
||||
../slsDetectorServer/src/programFpgaBlackfin.c
|
||||
../slsDetectorServer/src/communication_funcs_UDP.c
|
||||
../slsDetectorServer/src/communication_virtual.c
|
||||
../slsDetectorServer/src/sharedMemory.c
|
||||
)
|
||||
|
||||
target_include_directories(jungfrauDetectorServer_virtual
|
||||
|
@ -5,14 +5,14 @@ support_lib = ../../slsSupportLib/include/
|
||||
|
||||
CROSS = bfin-uclinux-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -DJUNGFRAUD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm
|
||||
CFLAGS += -Wall -std=gnu99 -DJUNGFRAUD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm -lrt -pthread
|
||||
PROGS = jungfrauDetectorServer
|
||||
DESTDIR ?= bin
|
||||
INSTMODE = 0777
|
||||
|
||||
SRCS = slsDetectorFunctionList.c
|
||||
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)AD9257.c $(main_src)ALTERA_PLL.c $(main_src)LTC2620.c $(main_src)MAX1932.c $(main_src)programFpgaBlackfin.c
|
||||
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)AD9257.c $(main_src)ALTERA_PLL.c $(main_src)LTC2620.c $(main_src)MAX1932.c $(main_src)programFpgaBlackfin.c $(main_src)/sharedMemory.c
|
||||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
|
Binary file not shown.
@ -1,5 +1,6 @@
|
||||
#include "slsDetectorFunctionList.h"
|
||||
#include "clogger.h"
|
||||
#include "sharedMemory.h"
|
||||
#include "versionAPI.h"
|
||||
|
||||
#include "ALTERA_PLL.h" // pll
|
||||
@ -8,7 +9,6 @@
|
||||
#include "common.h"
|
||||
#ifdef VIRTUAL
|
||||
#include "communication_funcs_UDP.h"
|
||||
#include "communication_virtual.h"
|
||||
#endif
|
||||
|
||||
#include <netinet/in.h>
|
||||
@ -36,8 +36,6 @@ char initErrorMessage[MAX_STR_LENGTH];
|
||||
|
||||
#ifdef VIRTUAL
|
||||
pthread_t pthread_virtual_tid;
|
||||
int virtual_status = 0;
|
||||
int virtual_stop = 0;
|
||||
int virtual_image_test_mode = 0;
|
||||
#endif
|
||||
|
||||
@ -210,9 +208,8 @@ int testBus() {
|
||||
int ret = OK;
|
||||
u_int32_t addr = SET_TRIGGER_DELAY_LSB_REG;
|
||||
u_int32_t times = 1000 * 1000;
|
||||
u_int32_t i = 0;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
for (u_int32_t i = 0; i < times; ++i) {
|
||||
bus_w(addr, i * 100);
|
||||
if (i * 100 != bus_r(addr)) {
|
||||
LOG(logERROR,
|
||||
@ -282,6 +279,7 @@ u_int16_t getHardwareSerialNumber() {
|
||||
HARDWARE_SERIAL_NUM_OFST);
|
||||
}
|
||||
|
||||
// is board 1.0?, with value 2 (resistor network)
|
||||
int isHardwareVersion2() {
|
||||
return (((bus_r(MOD_SERIAL_NUM_REG) & HARDWARE_VERSION_NUM_MSK) ==
|
||||
HARDWARE_VERSION_2_VAL)
|
||||
@ -364,10 +362,10 @@ void initStopServer() {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
virtual_stop = 0;
|
||||
if (!isControlServer) {
|
||||
ComVirtual_setStop(virtual_stop);
|
||||
}
|
||||
sharedMemory_setStop(0);
|
||||
// temp threshold and reset event (read by stop server)
|
||||
setThresholdTemperature(DEFAULT_TMP_THRSHLD);
|
||||
setTemperatureEvent(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -376,17 +374,11 @@ void initStopServer() {
|
||||
void setupDetector() {
|
||||
LOG(logINFO, ("This Server is for 1 Jungfrau module (500k)\n"));
|
||||
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < NUM_CLOCKS; ++i) {
|
||||
clkPhase[i] = 0;
|
||||
}
|
||||
for (int i = 0; i < NUM_CLOCKS; ++i) {
|
||||
clkPhase[i] = 0;
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
virtual_status = 0;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
}
|
||||
sharedMemory_setStatus(IDLE);
|
||||
#endif
|
||||
|
||||
ALTERA_PLL_ResetPLL();
|
||||
@ -462,14 +454,11 @@ void setupDetector() {
|
||||
int setDefaultDacs() {
|
||||
int ret = OK;
|
||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||
{
|
||||
int i = 0;
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
for (i = 0; i < NDAC; ++i) {
|
||||
// if not already default, set it to default
|
||||
if (dacValues[i] != defaultvals[i]) {
|
||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
||||
}
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
// if not already default, set it to default
|
||||
if (dacValues[i] != defaultvals[i]) {
|
||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -747,84 +736,60 @@ int setModule(sls_detector_module myMod, char *mess) {
|
||||
setSettings((enum detectorSettings)myMod.reg);
|
||||
|
||||
// set dac values
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < NDAC; ++i)
|
||||
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
|
||||
}
|
||||
for (int i = 0; i < NDAC; ++i)
|
||||
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
|
||||
return OK;
|
||||
}
|
||||
|
||||
int getModule(sls_detector_module *myMod) {
|
||||
int idac = 0;
|
||||
for (idac = 0; idac < NDAC; ++idac) {
|
||||
if (dacValues[idac] >= 0)
|
||||
*((myMod->dacs) + idac) = dacValues[idac];
|
||||
}
|
||||
// check if all of them are not initialized
|
||||
int initialized = 0;
|
||||
for (idac = 0; idac < NDAC; ++idac) {
|
||||
if (dacValues[idac] >= 0)
|
||||
initialized = 1;
|
||||
}
|
||||
if (initialized) {
|
||||
return OK;
|
||||
}
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
enum detectorSettings setSettings(enum detectorSettings sett) {
|
||||
if (sett == UNINITIALIZED)
|
||||
return thisSettings;
|
||||
|
||||
// set settings
|
||||
if (sett != GET_SETTINGS) {
|
||||
switch (sett) {
|
||||
case DYNAMICGAIN:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||
LOG(logINFO, ("Set settings - Dyanmic Gain, DAQ Reg: 0x%x\n",
|
||||
bus_r(DAQ_REG)));
|
||||
break;
|
||||
case DYNAMICHG0:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_HIGHGAIN_VAL);
|
||||
LOG(logINFO, ("Set settings - Dyanmic High Gain 0, DAQ Reg: 0x%x\n",
|
||||
bus_r(DAQ_REG)));
|
||||
break;
|
||||
case FIXGAIN1:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_STG_1_VAL);
|
||||
LOG(logINFO,
|
||||
("Set settings - Fix Gain 1, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
|
||||
break;
|
||||
case FIXGAIN2:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_STG_2_VAL);
|
||||
LOG(logINFO,
|
||||
("Set settings - Fix Gain 2, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
|
||||
break;
|
||||
case FORCESWITCHG1:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FRCE_GAIN_STG_1_VAL);
|
||||
LOG(logINFO, ("Set settings - Force Switch Gain 1, DAQ Reg: 0x%x\n",
|
||||
bus_r(DAQ_REG)));
|
||||
break;
|
||||
case FORCESWITCHG2:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FRCE_GAIN_STG_2_VAL);
|
||||
LOG(logINFO, ("Set settings - Force Switch Gain 2, DAQ Reg: 0x%x\n",
|
||||
bus_r(DAQ_REG)));
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR,
|
||||
("This settings is not defined for this detector %d\n",
|
||||
(int)sett));
|
||||
return -1;
|
||||
}
|
||||
|
||||
thisSettings = sett;
|
||||
switch (sett) {
|
||||
case DYNAMICGAIN:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||
LOG(logINFO,
|
||||
("Set settings - Dyanmic Gain, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
|
||||
break;
|
||||
case DYNAMICHG0:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_HIGHGAIN_VAL);
|
||||
LOG(logINFO, ("Set settings - Dyanmic High Gain 0, DAQ Reg: 0x%x\n",
|
||||
bus_r(DAQ_REG)));
|
||||
break;
|
||||
case FIXGAIN1:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_STG_1_VAL);
|
||||
LOG(logINFO,
|
||||
("Set settings - Fix Gain 1, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
|
||||
break;
|
||||
case FIXGAIN2:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_STG_2_VAL);
|
||||
LOG(logINFO,
|
||||
("Set settings - Fix Gain 2, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
|
||||
break;
|
||||
case FORCESWITCHG1:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FRCE_GAIN_STG_1_VAL);
|
||||
LOG(logINFO, ("Set settings - Force Switch Gain 1, DAQ Reg: 0x%x\n",
|
||||
bus_r(DAQ_REG)));
|
||||
break;
|
||||
case FORCESWITCHG2:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FRCE_GAIN_STG_2_VAL);
|
||||
LOG(logINFO, ("Set settings - Force Switch Gain 2, DAQ Reg: 0x%x\n",
|
||||
bus_r(DAQ_REG)));
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR,
|
||||
("This settings is not defined for this detector %d\n", (int)sett));
|
||||
return -1;
|
||||
}
|
||||
|
||||
thisSettings = sett;
|
||||
|
||||
return getSettings();
|
||||
}
|
||||
|
||||
@ -1700,22 +1665,15 @@ int startStateMachine() {
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFOBLUE, ("starting state machine\n"));
|
||||
virtual_status = 1;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
virtual_stop = ComVirtual_getStop();
|
||||
if (virtual_stop != 0) {
|
||||
LOG(logERROR, ("Cant start acquisition. "
|
||||
"Stop server has not updated stop status to 0\n"));
|
||||
return FAIL;
|
||||
}
|
||||
if (sharedMemory_getStop() != 0) {
|
||||
LOG(logERROR, ("Cant start acquisition. "
|
||||
"Stop server has not updated stop status to 0\n"));
|
||||
return FAIL;
|
||||
}
|
||||
sharedMemory_setStatus(RUNNING);
|
||||
if (pthread_create(&pthread_virtual_tid, NULL, &start_timer, NULL)) {
|
||||
LOG(logERROR, ("Could not start Virtual acquisition thread\n"));
|
||||
virtual_status = 0;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
}
|
||||
sharedMemory_setStatus(IDLE);
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFOGREEN, ("Virtual Acquisition started\n"));
|
||||
@ -1753,29 +1711,23 @@ void *start_timer(void *arg) {
|
||||
// Generate data
|
||||
char imageData[DATA_BYTES];
|
||||
memset(imageData, 0, DATA_BYTES);
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < npixels; ++i) {
|
||||
// avoiding gain also being divided when gappixels enabled in call
|
||||
// back
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||
virtual_image_test_mode ? 0x0FFE : (uint16_t)i;
|
||||
}
|
||||
for (int i = 0; i < npixels; ++i) {
|
||||
// avoiding gain also being divided when gappixels enabled in call
|
||||
// back
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||
virtual_image_test_mode ? 0x0FFE : (uint16_t)i;
|
||||
}
|
||||
|
||||
// Send data
|
||||
{
|
||||
uint64_t frameNr = 0;
|
||||
getStartingFrameNumber(&frameNr);
|
||||
int iframes = 0;
|
||||
for (iframes = 0; iframes != numFrames; ++iframes) {
|
||||
for (int iframes = 0; iframes != numFrames; ++iframes) {
|
||||
|
||||
usleep(transmissionDelayUs);
|
||||
|
||||
// update the virtual stop from stop server
|
||||
virtual_stop = ComVirtual_getStop();
|
||||
// check if virtual_stop is high
|
||||
if (virtual_stop == 1) {
|
||||
// check if manual stop
|
||||
if (sharedMemory_getStop() == 1) {
|
||||
setStartingFrameNumber(frameNr + iframes + 1);
|
||||
break;
|
||||
}
|
||||
@ -1788,49 +1740,46 @@ void *start_timer(void *arg) {
|
||||
int srcOffset = 0;
|
||||
int srcOffset2 = DATA_BYTES / 2;
|
||||
// loop packet
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i != packetsPerFrame; ++i) {
|
||||
// set header
|
||||
char packetData[packetsize];
|
||||
memset(packetData, 0, packetsize);
|
||||
sls_detector_header *header =
|
||||
(sls_detector_header *)(packetData);
|
||||
for (int i = 0; i != packetsPerFrame; ++i) {
|
||||
// set header
|
||||
char packetData[packetsize];
|
||||
memset(packetData, 0, packetsize);
|
||||
sls_detector_header *header =
|
||||
(sls_detector_header *)(packetData);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = i;
|
||||
header->modId = 0;
|
||||
header->row = detPos[2];
|
||||
header->column = detPos[3];
|
||||
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header),
|
||||
imageData + srcOffset, dataSize);
|
||||
srcOffset += dataSize;
|
||||
|
||||
sendUDPPacket(0, packetData, packetsize);
|
||||
|
||||
// second interface
|
||||
char packetData2[packetsize];
|
||||
memset(packetData2, 0, packetsize);
|
||||
if (numInterfaces == 2) {
|
||||
header = (sls_detector_header *)(packetData2);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = i;
|
||||
header->modId = 0;
|
||||
header->row = detPos[2];
|
||||
header->column = detPos[3];
|
||||
header->row = detPos[0];
|
||||
header->column = detPos[1];
|
||||
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header),
|
||||
imageData + srcOffset, dataSize);
|
||||
srcOffset += dataSize;
|
||||
memcpy(packetData2 + sizeof(sls_detector_header),
|
||||
imageData + srcOffset2, dataSize);
|
||||
srcOffset2 += dataSize;
|
||||
|
||||
sendUDPPacket(0, packetData, packetsize);
|
||||
|
||||
// second interface
|
||||
char packetData2[packetsize];
|
||||
memset(packetData2, 0, packetsize);
|
||||
if (numInterfaces == 2) {
|
||||
header = (sls_detector_header *)(packetData2);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = i;
|
||||
header->modId = 0;
|
||||
header->row = detPos[0];
|
||||
header->column = detPos[1];
|
||||
|
||||
// fill data
|
||||
memcpy(packetData2 + sizeof(sls_detector_header),
|
||||
imageData + srcOffset2, dataSize);
|
||||
srcOffset2 += dataSize;
|
||||
|
||||
sendUDPPacket(1, packetData2, packetsize);
|
||||
}
|
||||
sendUDPPacket(1, packetData2, packetsize);
|
||||
}
|
||||
}
|
||||
LOG(logINFO, ("Sent frame: %d\n", iframes));
|
||||
@ -1853,10 +1802,7 @@ void *start_timer(void *arg) {
|
||||
closeUDPSocket(1);
|
||||
}
|
||||
|
||||
virtual_status = 0;
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
}
|
||||
sharedMemory_setStatus(IDLE);
|
||||
LOG(logINFOBLUE, ("Finished Acquiring\n"));
|
||||
return NULL;
|
||||
}
|
||||
@ -1864,19 +1810,17 @@ void *start_timer(void *arg) {
|
||||
|
||||
int stopStateMachine() {
|
||||
LOG(logINFORED, ("Stopping State Machine\n"));
|
||||
#ifdef VIRTUAL
|
||||
if (!isControlServer) {
|
||||
virtual_stop = 1;
|
||||
ComVirtual_setStop(virtual_stop);
|
||||
// read till status is idle
|
||||
int tempStatus = 1;
|
||||
while (tempStatus == 1) {
|
||||
tempStatus = ComVirtual_getStatus();
|
||||
}
|
||||
virtual_stop = 0;
|
||||
ComVirtual_setStop(virtual_stop);
|
||||
LOG(logINFO, ("Stopped State Machine\n"));
|
||||
// if scan active, stop scan
|
||||
if (sharedMemory_getScanStatus() == RUNNING) {
|
||||
sharedMemory_setScanStop(1);
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
sharedMemory_setStop(1);
|
||||
// read till status is idle
|
||||
while (sharedMemory_getStatus() == RUNNING)
|
||||
;
|
||||
sharedMemory_setStop(0);
|
||||
LOG(logINFO, ("Stopped State Machine\n"));
|
||||
return OK;
|
||||
#endif
|
||||
// stop state machine
|
||||
@ -1889,19 +1833,24 @@ int stopStateMachine() {
|
||||
}
|
||||
|
||||
enum runStatus getRunStatus() {
|
||||
#ifdef VIRTUAL
|
||||
if (!isControlServer) {
|
||||
virtual_status = ComVirtual_getStatus();
|
||||
LOG(logDEBUG1, ("Getting status\n"));
|
||||
// scan error or running
|
||||
if (sharedMemory_getScanStatus() == ERROR) {
|
||||
LOG(logINFOBLUE, ("Status: scan ERROR\n"));
|
||||
return ERROR;
|
||||
}
|
||||
if (virtual_status == 0) {
|
||||
LOG(logINFOBLUE, ("Status: IDLE\n"));
|
||||
return IDLE;
|
||||
} else {
|
||||
if (sharedMemory_getScanStatus() == RUNNING) {
|
||||
LOG(logINFOBLUE, ("Status: scan RUNNING\n"));
|
||||
return RUNNING;
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
if (sharedMemory_getStatus() == RUNNING) {
|
||||
LOG(logINFOBLUE, ("Status: RUNNING\n"));
|
||||
return RUNNING;
|
||||
}
|
||||
LOG(logINFOBLUE, ("Status: IDLE\n"));
|
||||
return IDLE;
|
||||
#endif
|
||||
LOG(logDEBUG1, ("Getting status\n"));
|
||||
|
||||
enum runStatus s;
|
||||
u_int32_t retval = bus_r(STATUS_REG);
|
||||
@ -1963,10 +1912,7 @@ void readFrame(int *ret, char *mess) {
|
||||
|
||||
u_int32_t runBusy() {
|
||||
#ifdef VIRTUAL
|
||||
if (!isControlServer) {
|
||||
virtual_status = ComVirtual_getStatus();
|
||||
}
|
||||
return virtual_status;
|
||||
return ((sharedMemory_getStatus() == RUNNING) ? 1 : 0);
|
||||
#endif
|
||||
u_int32_t s = (bus_r(STATUS_REG) & RUN_BUSY_MSK);
|
||||
LOG(logDEBUG1, ("Status Register: %08x\n", s));
|
||||
|
@ -3,8 +3,8 @@
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#define MIN_REQRD_VRSN_T_RD_API 0x171220
|
||||
#define REQRD_FRMWRE_VRSN_BOARD2 0x190716 // old
|
||||
#define REQRD_FRMWRE_VRSN 0x200305 // new
|
||||
#define REQRD_FRMWRE_VRSN_BOARD2 0x200724 // 1.0 pcb
|
||||
#define REQRD_FRMWRE_VRSN 0x200721 // 2.0 pcb
|
||||
|
||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||
|
||||
@ -66,7 +66,6 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
||||
#define NCHAN (256 * 256)
|
||||
#define NCHIP (8)
|
||||
#define NDAC (8)
|
||||
#define NDAC_OLDBOARD (16)
|
||||
#define DYNAMIC_RANGE (16)
|
||||
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8)
|
||||
#define DATA_BYTES (NCHIP * NCHAN * NUM_BYTES_PER_PIXEL)
|
||||
@ -103,42 +102,45 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
||||
#define MAX_STORAGE_CELL_DLY_NS_VAL (ASIC_CTRL_EXPSRE_TMR_MAX_VAL)
|
||||
#define ACQ_TIME_MIN_CLOCK (2)
|
||||
|
||||
#define MAX_PHASE_SHIFTS (160)
|
||||
#define MAX_PHASE_SHIFTS (240)
|
||||
#define BIT16_MASK (0xFFFF)
|
||||
|
||||
#define ADC_OFST_FULL_SPEED_VAL (0xf)
|
||||
#define ADC_OFST_HALF_SPEED_VAL (0xb)
|
||||
#define ADC_OFST_QUARTER_SPEED_VAL (0x7)
|
||||
#define ADC_OFST_HALF_SPEED_BOARD2_VAL (0x13)
|
||||
#define ADC_OFST_QUARTER_SPEED_BOARD2_VAL (0x0b)
|
||||
// pipeline
|
||||
#define ADC_OFST_FULL_SPEED_VAL (0x10) // 2.0 pcb
|
||||
#define ADC_OFST_HALF_SPEED_VAL (0x08) // 2.0 pcb
|
||||
#define ADC_OFST_QUARTER_SPEED_VAL (0x04) // 2.0 pcb
|
||||
#define ADC_OFST_HALF_SPEED_BOARD2_VAL (0x13) // 1.0 pcb (2 resistor network)
|
||||
#define ADC_OFST_QUARTER_SPEED_BOARD2_VAL (0x0b) // 1.0 pcb (2 resistor network)
|
||||
|
||||
#define ADC_PORT_INVERT_VAL (0x5A5A5A5A)
|
||||
#define ADC_PORT_INVERT_BOARD2_VAL (0x453b2a9c)
|
||||
|
||||
// 2.0 pcb
|
||||
#define SAMPLE_ADC_FULL_SPEED \
|
||||
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_0_VAL + \
|
||||
SAMPLE_DGTL_SAMPLE_2_VAL + SAMPLE_DECMT_FACTOR_FULL_VAL) // 0x200
|
||||
SAMPLE_DGTL_SAMPLE_1_VAL + SAMPLE_DECMT_FACTOR_FULL_VAL) // 0x100
|
||||
#define SAMPLE_ADC_HALF_SPEED \
|
||||
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_1_VAL + \
|
||||
SAMPLE_DGTL_SAMPLE_3_VAL + SAMPLE_DECMT_FACTOR_HALF_VAL) // 0x1310
|
||||
#define SAMPLE_ADC_QUARTER_SPEED \
|
||||
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_3_VAL + \
|
||||
SAMPLE_DGTL_SAMPLE_6_VAL + SAMPLE_DECMT_FACTOR_QUARTER_VAL) // 0x2630
|
||||
// 1.0 pcb (2 resistor network)
|
||||
#define SAMPLE_ADC_HALF_SPEED_BOARD2 \
|
||||
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_0_VAL + \
|
||||
SAMPLE_DGTL_SAMPLE_6_VAL + SAMPLE_DECMT_FACTOR_HALF_VAL) // 0x1600
|
||||
SAMPLE_DGTL_SAMPLE_3_VAL + SAMPLE_DECMT_FACTOR_HALF_VAL) // 0x1300
|
||||
#define SAMPLE_ADC_QUARTER_SPEED_BOARD2 \
|
||||
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_1_VAL + \
|
||||
SAMPLE_DGTL_SAMPLE_11_VAL + SAMPLE_DECMT_FACTOR_QUARTER_VAL) // 0x2b10
|
||||
SAMPLE_DGTL_SAMPLE_6_VAL + SAMPLE_DECMT_FACTOR_QUARTER_VAL) // 0x2610
|
||||
|
||||
#define ADC_PHASE_FULL_SPEED (28)
|
||||
#define ADC_PHASE_HALF_SPEED (35)
|
||||
#define ADC_PHASE_QUARTER_SPEED (35)
|
||||
#define ADC_PHASE_HALF_SPEED_BOARD2 (0x1E) // 30
|
||||
#define ADC_PHASE_QUARTER_SPEED_BOARD2 (0x1E) // 30
|
||||
#define ADC_PHASE_FULL_SPEED (150) // 2.0 pcb
|
||||
#define ADC_PHASE_HALF_SPEED (200) // 2.0 pcb
|
||||
#define ADC_PHASE_QUARTER_SPEED (200) // 2.0 pcb
|
||||
#define ADC_PHASE_HALF_SPEED_BOARD2 (75) // 1.0 pcb (2 resistor network)
|
||||
#define ADC_PHASE_QUARTER_SPEED_BOARD2 (75) // 1.0 pcb (2 resistor network)
|
||||
|
||||
#define DBIT_PHASE_FULL_SPEED (37)
|
||||
#define DBIT_PHASE_HALF_SPEED (37)
|
||||
#define DBIT_PHASE_QUARTER_SPEED (37)
|
||||
#define DBIT_PHASE_HALF_SPEED_BOARD2 (37)
|
||||
#define DBIT_PHASE_QUARTER_SPEED_BOARD2 (37)
|
||||
#define DBIT_PHASE_FULL_SPEED (85) // 2.0 pcb
|
||||
#define DBIT_PHASE_HALF_SPEED (150) // 2.0 pcb
|
||||
#define DBIT_PHASE_QUARTER_SPEED (150) // 2.0 pcb
|
||||
#define DBIT_PHASE_HALF_SPEED_BOARD2 (150) // 1.0 pcb (2 resistor network)
|
||||
#define DBIT_PHASE_QUARTER_SPEED_BOARD2 (150) // 1.0 pcb (2 resistor network)
|
||||
|
@ -14,7 +14,7 @@ add_executable(moenchDetectorServer_virtual
|
||||
../slsDetectorServer/src/MAX1932.c
|
||||
../slsDetectorServer/src/programFpgaBlackfin.c
|
||||
../slsDetectorServer/src/readDefaultPattern.c
|
||||
../slsDetectorServer/src/communication_virtual.c
|
||||
../slsDetectorServer/src/sharedMemory.c
|
||||
)
|
||||
|
||||
include_directories(
|
||||
@ -42,3 +42,5 @@ set_target_properties(moenchDetectorServer_virtual PROPERTIES
|
||||
install(TARGETS moenchDetectorServer_virtual
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
|
||||
configure_file(DefaultPattern_moench.txt ${CMAKE_BINARY_DIR}/bin/DefaultPattern_moench.txt COPYONLY)
|
@ -273,7 +273,6 @@ patword 0x010f 0x0008599f0008503a
|
||||
patword 0x0110 0x0008599f0008503a
|
||||
patword 0x0111 0x0008599f0008503a
|
||||
patioctrl 0x8f0effff6dbffdbf
|
||||
patclkctrl 0x0000000000000000
|
||||
patlimits 0x0000 0x0110
|
||||
patloop0 0x00be 0x00ef
|
||||
patnloop0 199
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user