mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-12-17 18:11:18 +01:00
Compare commits
194 Commits
dev/includ
...
1001/pytho
| Author | SHA1 | Date | |
|---|---|---|---|
| 228d7a5720 | |||
| 465a9d9ebc | |||
| 706fc919c7 | |||
| c8d82909fc | |||
| 2eca0cf117 | |||
| a0bd26fa7c | |||
| e4f47cedf7 | |||
| e92fafbb4b | |||
| 4730236170 | |||
| 85edf98133 | |||
| ea07eb36d0 | |||
| 7d1809642e | |||
| c5357a4d73 | |||
| e6c6b8f4c5 | |||
| 6474029c42 | |||
| f2ee88ba68 | |||
| f1736b5e7f | |||
| e471b81b84 | |||
| 54e4c46f02 | |||
| c10bc5e530 | |||
| 0d1642c56e | |||
| 9bb25445f5 | |||
| 376514606f | |||
| 8707196f58 | |||
|
|
9f9b1d496c | ||
| b2dd964907 | |||
| 348d820265 | |||
| d414c7459b | |||
| 8eb2134d9f | |||
| b8b067d74b | |||
|
|
3619a032ac | ||
| 2ee7e36fb3 | |||
| d739453f2b | |||
| 3bfa3bfba3 | |||
| 894c227723 | |||
| f3e5804d02 | |||
| 2c4cd80748 | |||
| 674865120b | |||
| c0ae090be0 | |||
| a85ad6cd84 | |||
| 5f6dea2d6d | |||
| f5bf509525 | |||
| 03eded30f9 | |||
| 684f511bf8 | |||
| 2c93d40e81 | |||
| 9889a31f81 | |||
| b00a37bc16 | |||
| 15030ab732 | |||
| 0ecc6030c6 | |||
| 6c604e2340 | |||
| 0f4d10912b | |||
| af386a736e | |||
| a43f2c946f | |||
| 8d21fd364b | |||
| 9aceb07d80 | |||
| 7b3accf372 | |||
| cfde194834 | |||
| 8ac9cd6b15 | |||
| 3e38de5092 | |||
| 70e7879dd9 | |||
| 37b2efb1ed | |||
| 7ac18fbad9 | |||
| 6839315a7c | |||
| 527915a2ca | |||
| 64aad1e196 | |||
| d3f847100e | |||
| e1224936ca | |||
| f29ef9e345 | |||
| 00e3b196f6 | |||
| 0109973e68 | |||
| ad995b381a | |||
| 53b84b17a6 | |||
| 16d404c21b | |||
| 34ce96ffa0 | |||
| d5fa26ef9a | |||
| 77f20b4e97 | |||
| a295208c12 | |||
|
|
36a6087e1d | ||
| fb406a7c6c | |||
| 6e4380db43 | |||
| 903652bb72 | |||
| 1609706093 | |||
| 14d2d171bb | |||
| dd8452b365 | |||
| 15a9fb86da | |||
| 222d2b3fad | |||
| a57531312f | |||
| 85a03a1d72 | |||
| fc197ed002 | |||
| a5d242876b | |||
| 76ce5de89e | |||
| dbb0dbcbcd | |||
| 87d40d418e | |||
| c82712b587 | |||
| 9dd1509714 | |||
| c8290598db | |||
| ff6a2655a2 | |||
| 7b2e6ae4ab | |||
| 706f3a103c | |||
| 5de98b3db0 | |||
| 7494e41862 | |||
| 7607fdc9a7 | |||
| 1bfffb842d | |||
| 7c48ae9a49 | |||
| bf82aeee8d | |||
| 84e83bf551 | |||
| 60ce31bb17 | |||
| 2947b65e02 | |||
| 1b41e39ad1 | |||
| 64fea22c2b | |||
| 9beaed7813 | |||
| 0aeb7e4417 | |||
| 4880f87791 | |||
| 97f0c1fe46 | |||
| a86fd00e59 | |||
| 24894667b7 | |||
| 4b414bfddb | |||
| 15d357d9ab | |||
| f95de054f9 | |||
| 0aef8113dd | |||
| 9785a41048 | |||
| 417e1a88a5 | |||
| 9c0dd0385d | |||
|
|
5ab64efe3e | ||
|
|
8f77e4d4fe | ||
| 41c5b75b10 | |||
| bfe53c6693 | |||
| f7997dd09a | |||
| c64e87a2b6 | |||
| 5eeb8e29c1 | |||
| 09697fa325 | |||
| 90b4daef39 | |||
| 2082f1eee7 | |||
| d3a636b563 | |||
| 50b9b6ca39 | |||
| e86b57cdfc | |||
| 14e11e8b5b | |||
| beafe86554 | |||
| af3dc1e7f4 | |||
| 573177203b | |||
| a3ca9ebce5 | |||
| 8174fc9691 | |||
| d6eac6da71 | |||
| 56c7ae4852 | |||
| 9b9b09ceaf | |||
| cfebaee2a5 | |||
| 4613c54f57 | |||
| 51f9d6f011 | |||
| 58ac7ac280 | |||
|
|
82edfa75d3 | ||
| 35ed926047 | |||
| 4023ed0775 | |||
| b6ef3bc39e | |||
| 2035666792 | |||
| 1ff4d806e7 | |||
| 3861379653 | |||
| 91140bbb71 | |||
| a5632fcbea | |||
| d44329117d | |||
| 4a454aa698 | |||
| 0e43072db8 | |||
| 6c67025ea8 | |||
| e5ee27dbfa | |||
| 601249cc71 | |||
| ff60b8c379 | |||
| 37ce3d6f59 | |||
| bf26533fd8 | |||
| 7106273521 | |||
| 1484d038de | |||
| fb0090c79e | |||
| adc68cd519 | |||
| 1566eef247 | |||
|
|
e7cd90db78 | ||
| 45414149fe | |||
| 48759f440e | |||
|
|
b367b7e431 | ||
| f0b2a6f6f9 | |||
| f761046bfc | |||
| 1a859b83db | |||
| 70bfc875a6 | |||
| c0755308a4 | |||
| ab5509e10c | |||
| 004cb26646 | |||
| a4f47a5945 | |||
| 312f3f473d | |||
| 5871086cd6 | |||
| 6a0fe823b3 | |||
| 5912aae53e | |||
| 8833ccf5cc | |||
| 77c558a7be | |||
| 378fc301b8 | |||
|
|
87d6e16090 | ||
|
|
2ef021041c | ||
|
|
574127b5ac |
@@ -21,9 +21,9 @@ jobs:
|
||||
- name: Build library
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake .. -DSLS_USE_PYTHON=ON -DSLS_USE_TESTS=ON -DSLS_USE_SIMULATOR=ON
|
||||
cmake .. -DSLS_USE_PYTHON=ON -DSLS_USE_TESTS=ON
|
||||
make -j 2
|
||||
|
||||
- name: C++ unit tests
|
||||
working-directory: ${{gitea.workspace}}/build
|
||||
run: ctest -j1 --rerun-failed --output-on-failure
|
||||
run: ctest
|
||||
@@ -19,9 +19,9 @@ jobs:
|
||||
- name: Build library
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake .. -DSLS_USE_PYTHON=ON -DSLS_USE_TESTS=ON -DSLS_USE_SIMULATOR=ON
|
||||
cmake .. -DSLS_USE_PYTHON=ON -DSLS_USE_TESTS=ON
|
||||
make -j 2
|
||||
|
||||
- name: C++ unit tests
|
||||
working-directory: ${{gitea.workspace}}/build
|
||||
run: ctest -j1 --rerun-failed --output-on-failure
|
||||
run: ctest
|
||||
4
.github/workflows/cmake.yaml
vendored
4
.github/workflows/cmake.yaml
vendored
@@ -19,7 +19,7 @@ jobs:
|
||||
with:
|
||||
python-version: 3.12
|
||||
cache: 'pip'
|
||||
- run: pip install pytest numpy
|
||||
- run: pip install pytest numpy colorama
|
||||
|
||||
- uses: awalsh128/cache-apt-pkgs-action@latest
|
||||
with:
|
||||
@@ -37,7 +37,7 @@ jobs:
|
||||
|
||||
- name: C++ unit tests
|
||||
working-directory: ${{github.workspace}}/build
|
||||
run: ctest -C ${{env.BUILD_TYPE}} -j1 --rerun-failed --output-on-failure
|
||||
run: ctest -C ${{env.BUILD_TYPE}} -j1
|
||||
|
||||
- name: Python unit tests
|
||||
working-directory: ${{github.workspace}}/build/bin
|
||||
|
||||
47
.github/workflows/conda_deploy_library.yaml
vendored
47
.github/workflows/conda_deploy_library.yaml
vendored
@@ -1,47 +0,0 @@
|
||||
name: Build and deploy slsdetlib
|
||||
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [ubuntu-latest, ] # macos-12, windows-2019]
|
||||
python-version: ["3.12",]
|
||||
|
||||
runs-on: ${{ matrix.platform }}
|
||||
|
||||
# The setup-miniconda action needs this to activate miniconda
|
||||
defaults:
|
||||
run:
|
||||
shell: "bash -l {0}"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Get conda
|
||||
uses: conda-incubator/setup-miniconda@v3.0.4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
channels: conda-forge
|
||||
|
||||
- name: Prepare
|
||||
run: conda install conda-build conda-verify pytest anaconda-client
|
||||
|
||||
- name: Enable upload
|
||||
run: conda config --set anaconda_upload yes
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
CONDA_TOKEN: ${{ secrets.CONDA_TOKEN }}
|
||||
run: conda build conda-recipes/main-library --user slsdetectorgroup --token ${CONDA_TOKEN} --output-folder build_output
|
||||
|
||||
- name: Upload all Conda to github as artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: conda-packages
|
||||
path: build_output/** # Uploads all packages
|
||||
47
.github/workflows/conda_deploy_slsdet.yaml
vendored
47
.github/workflows/conda_deploy_slsdet.yaml
vendored
@@ -1,47 +0,0 @@
|
||||
name: deploy slsdet
|
||||
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [ubuntu-latest, ] # macos-12, windows-2019]
|
||||
python-version: ["3.12",]
|
||||
|
||||
runs-on: ${{ matrix.platform }}
|
||||
|
||||
# The setup-miniconda action needs this to activate miniconda
|
||||
defaults:
|
||||
run:
|
||||
shell: "bash -l {0}"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Get conda
|
||||
uses: conda-incubator/setup-miniconda@v3.0.4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
channels: conda-forge
|
||||
|
||||
- name: Prepare
|
||||
run: conda install conda-build conda-verify pytest anaconda-client
|
||||
|
||||
- name: Enable upload
|
||||
run: conda config --set anaconda_upload yes
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
CONDA_TOKEN: ${{ secrets.CONDA_TOKEN }}
|
||||
run: conda build conda-recipes/python-client --user slsdetectorgroup --token ${CONDA_TOKEN} --output-folder build_output
|
||||
|
||||
- name: Upload all Conda packages
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: conda-packages
|
||||
path: build_output/** # Uploads all packages
|
||||
159
CMakeLists.txt
159
CMakeLists.txt
@@ -24,16 +24,6 @@ include(cmake/SlsAddFlag.cmake)
|
||||
include(cmake/helpers.cmake)
|
||||
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
# POSIX threads are required for the moment but we use CMake to find them
|
||||
# Once migrated to std::thread this can be removed
|
||||
if(NOT CMAKE_USE_PTHREADS_INIT)
|
||||
message(FATAL_ERROR "A POSIX threads (pthread) implementation is required, but was not found.")
|
||||
endif()
|
||||
|
||||
|
||||
option(SLS_USE_SYSTEM_ZMQ "Use system installed libzmq" OFF)
|
||||
|
||||
# Using FetchContent to get libzmq
|
||||
include(FetchContent)
|
||||
@@ -60,111 +50,51 @@ if(NOT PATCH_EXECUTABLE)
|
||||
message(FATAL_ERROR "The 'patch' tool is required for patching lib zeromq. Please install it.")
|
||||
endif()
|
||||
|
||||
if(SLS_USE_SYSTEM_ZMQ)
|
||||
# find_package(ZeroMQ REQUIRED)
|
||||
# 1) Try a CMake package config if available (vcpkg, Homebrew, source builds)
|
||||
# Many installs export either ZeroMQ::libzmq or libzmq.
|
||||
find_package(ZeroMQ QUIET CONFIG)
|
||||
|
||||
set(ZEROMQ_TARGET "")
|
||||
|
||||
if (TARGET ZeroMQ::libzmq)
|
||||
set(ZEROMQ_TARGET ZeroMQ::libzmq)
|
||||
message(STATUS "Found target: ${ZEROMQ_TARGET} version: ${ZeroMQ_VERSION}")
|
||||
elseif (TARGET libzmq)
|
||||
set(ZEROMQ_TARGET libzmq)
|
||||
message(STATUS "Found target: ${ZEROMQ_TARGET} version: ${ZeroMQ_VERSION}")
|
||||
elseif (TARGET ZeroMQ::ZeroMQ) # rare older naming
|
||||
set(ZEROMQ_TARGET ZeroMQ::ZeroMQ)
|
||||
message(STATUS "Found target: ${ZEROMQ_TARGET} version: ${ZeroMQ_VERSION}")
|
||||
endif()
|
||||
|
||||
# 2) Fallback: use pkg-config hints + manual find_* to create an imported target
|
||||
if (NOT ZEROMQ_TARGET)
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PkgConfig_FOUND)
|
||||
pkg_check_modules(PC_ZeroMQ QUIET libzmq)
|
||||
endif()
|
||||
|
||||
find_path(ZEROMQ_INCLUDE_DIR
|
||||
NAMES zmq.h
|
||||
HINTS ${PC_ZeroMQ_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
find_library(ZEROMQ_LIBRARY
|
||||
NAMES zmq libzmq
|
||||
HINTS ${PC_ZeroMQ_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
if (ZEROMQ_INCLUDE_DIR AND ZEROMQ_LIBRARY)
|
||||
add_library(libzmq UNKNOWN IMPORTED)
|
||||
set_target_properties(libzmq PROPERTIES
|
||||
IMPORTED_LOCATION "${ZEROMQ_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${ZEROMQ_INCLUDE_DIR}"
|
||||
)
|
||||
set(ZEROMQ_TARGET libzmq)
|
||||
endif()
|
||||
message(STATUS "ZeroMQ version (pkg-config): ${PC_ZeroMQ_VERSION}")
|
||||
|
||||
endif()
|
||||
|
||||
# 3) Error out if still not found, with a helpful message
|
||||
if (NOT ZEROMQ_TARGET)
|
||||
message(FATAL_ERROR "ZeroMQ (libzmq) not found. Please install ZeroMQ development files.")
|
||||
endif()
|
||||
|
||||
# Use it
|
||||
# target_link_libraries(your_target PRIVATE ${ZEROMQ_TARGET})
|
||||
|
||||
message(STATUS "Using system installed libzmq: ${ZeroMQ_LIBRARIES}")
|
||||
message(STATUS "ZeroMQ target: ${ZEROMQ_TARGET}")
|
||||
message(STATUS "ZeroMQ include dirs: ${ZeroMQ_INCLUDE_DIRS}")
|
||||
if(SLS_FETCH_ZMQ_FROM_GITHUB)
|
||||
# Opt in to pull down a zmq version from github instead of
|
||||
# using the bundled version
|
||||
FetchContent_Declare(
|
||||
libzmq
|
||||
GIT_REPOSITORY https://github.com/zeromq/libzmq.git
|
||||
GIT_TAG v${SLS_LIBZMQ_VERSION}
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/libs/libzmq/libzmq_cmake_version.patch
|
||||
UPDATE_DISCONNECTED 1
|
||||
)
|
||||
else()
|
||||
if(SLS_FETCH_ZMQ_FROM_GITHUB)
|
||||
# Opt in to pull down a zmq version from github instead of
|
||||
# using the bundled version
|
||||
FetchContent_Declare(
|
||||
libzmq
|
||||
GIT_REPOSITORY https://github.com/zeromq/libzmq.git
|
||||
GIT_TAG v${SLS_LIBZMQ_VERSION}
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/libs/libzmq/libzmq_cmake_version.patch
|
||||
UPDATE_DISCONNECTED 1
|
||||
)
|
||||
else()
|
||||
# Standard behaviour use libzmq included in this repo (libs/libzmq)
|
||||
FetchContent_Declare(
|
||||
libzmq
|
||||
URL ${CMAKE_CURRENT_SOURCE_DIR}/libs/libzmq/libzmq-${SLS_LIBZMQ_VERSION}.tar.gz
|
||||
URL_HASH MD5=cc20b769ac10afa352e5ed2769bb23b3
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/libs/libzmq/libzmq_cmake_version.patch
|
||||
UPDATE_DISCONNECTED 1
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
# Disable unwanted options from libzmq
|
||||
set(BUILD_TESTS OFF CACHE BOOL "Switch off libzmq test build")
|
||||
set(BUILD_SHARED OFF CACHE BOOL "Switch off libzmq shared libs")
|
||||
set(WITH_PERF_TOOL OFF CACHE BOOL "")
|
||||
set(ENABLE_CPACK OFF CACHE BOOL "")
|
||||
set(ENABLE_CLANG OFF CACHE BOOL "")
|
||||
set(ENABLE_CURVE OFF CACHE BOOL "")
|
||||
set(ENABLE_DRAFTS OFF CACHE BOOL "")
|
||||
set(ENABLE_PRECOMPILED OFF CACHE BOOL "")
|
||||
set(WITH_DOC OFF CACHE BOOL "")
|
||||
set(WITH_DOCS OFF CACHE BOOL "")
|
||||
|
||||
|
||||
# Using GetProperties and Populate to be able to exclude zmq
|
||||
# from install (not possible with FetchContent_MakeAvailable(libzmq))
|
||||
FetchContent_GetProperties(libzmq)
|
||||
if(NOT libzmq_POPULATED)
|
||||
FetchContent_Populate(libzmq)
|
||||
add_subdirectory(${libzmq_SOURCE_DIR} ${libzmq_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
# Standard behaviour use libzmq included in this repo (libs/libzmq)
|
||||
FetchContent_Declare(
|
||||
libzmq
|
||||
URL ${CMAKE_CURRENT_SOURCE_DIR}/libs/libzmq/libzmq-${SLS_LIBZMQ_VERSION}.tar.gz
|
||||
URL_HASH MD5=cc20b769ac10afa352e5ed2769bb23b3
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/libs/libzmq/libzmq_cmake_version.patch
|
||||
UPDATE_DISCONNECTED 1
|
||||
)
|
||||
endif()
|
||||
|
||||
# Disable unwanted options from libzmq
|
||||
set(BUILD_TESTS OFF CACHE BOOL "Switch off libzmq test build")
|
||||
set(BUILD_SHARED OFF CACHE BOOL "Switch off libzmq shared libs")
|
||||
set(WITH_PERF_TOOL OFF CACHE BOOL "")
|
||||
set(ENABLE_CPACK OFF CACHE BOOL "")
|
||||
set(ENABLE_CLANG OFF CACHE BOOL "")
|
||||
set(ENABLE_CURVE OFF CACHE BOOL "")
|
||||
set(ENABLE_DRAFTS OFF CACHE BOOL "")
|
||||
set(ENABLE_PRECOMPILED OFF CACHE BOOL "")
|
||||
set(WITH_DOC OFF CACHE BOOL "")
|
||||
set(WITH_DOCS OFF CACHE BOOL "")
|
||||
|
||||
|
||||
|
||||
# Using GetProperties and Populate to be able to exclude zmq
|
||||
# from install (not possible with FetchContent_MakeAvailable(libzmq))
|
||||
FetchContent_GetProperties(libzmq)
|
||||
if(NOT libzmq_POPULATED)
|
||||
FetchContent_Populate(libzmq)
|
||||
add_subdirectory(${libzmq_SOURCE_DIR} ${libzmq_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# If conda build, always set lib dir to 'lib'
|
||||
@@ -192,7 +122,7 @@ endif()
|
||||
|
||||
|
||||
option(SLS_USE_HDF5 "HDF5 File format" OFF)
|
||||
option(SLS_BUILD_SHARED_LIBRARIES "Build shared libaries" OFF)
|
||||
option(SLS_BUILD_SHARED_LIBRARIES "Build shared libaries" ON)
|
||||
option(SLS_USE_TEXTCLIENT "Text Client" ON)
|
||||
option(SLS_USE_DETECTOR "Detector libs" ON)
|
||||
option(SLS_USE_RECEIVER "Receiver" ON)
|
||||
@@ -341,9 +271,6 @@ if (NOT TARGET slsProjectCSettings)
|
||||
-Wno-format-truncation
|
||||
)
|
||||
sls_disable_c_warning("-Wstringop-truncation")
|
||||
target_link_libraries(slsProjectCSettings INTERFACE
|
||||
Threads::Threads
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
@@ -1,39 +1,55 @@
|
||||
SLS Detector Package Major Release x.x.x released on xx.xx.202x
|
||||
===============================================================
|
||||
SLS Detector Package Minor Release 10.0.1 released on ?
|
||||
================================================================
|
||||
|
||||
This document describes the differences between vx.x.x and vx.0.2
|
||||
This document describes the differences between v10.0.1 and v10.0.0
|
||||
|
||||
|
||||
|
||||
CONTENTS
|
||||
--------
|
||||
1 New, Changed or Resolved Features
|
||||
1.1 Compilation
|
||||
1.2 Callback
|
||||
1.3 Python
|
||||
1.4 Client
|
||||
1.5 Detector Server
|
||||
1.6 Simulator
|
||||
1.7 Receiver
|
||||
1.8 Gui
|
||||
2 On-board Detector Server Compatibility
|
||||
3 Firmware Requirements
|
||||
4 Kernel Requirements
|
||||
5 Download, Documentation & Support
|
||||
1 Changes
|
||||
1.1 Compilation Changes
|
||||
1.2 New or Changed Features
|
||||
1.2.1 Breaking API
|
||||
1.2.2 Resolved or Changed Features
|
||||
1.2.3 New Features
|
||||
3 On-board Detector Server Compatibility
|
||||
4 Firmware Requirements
|
||||
5 Kernel Requirements
|
||||
6 Download, Documentation & Support
|
||||
|
||||
|
||||
|
||||
1 New, Changed or Resolved Features
|
||||
=====================================
|
||||
1 Changes
|
||||
==========
|
||||
|
||||
Building shared libraries is disabled by default. If you need to link
|
||||
against any of the libSls*.so libraries, you can enable this by passing
|
||||
-DSLS_BUILD_SHARED_LIBRARIES=ON to CMake.
|
||||
|
||||
Added SLS_USE_SYSTEM_ZMQ option (default OFF) to use the libzmq of the host
|
||||
instead of the one included in our repo.
|
||||
|
||||
Experimental support for building the detector client (including python bindings) on macOS
|
||||
1.1 Compilation Changes
|
||||
========================
|
||||
|
||||
|
||||
1.2 New or Changed Features
|
||||
============================
|
||||
|
||||
Python
|
||||
-------
|
||||
|
||||
* receiver ROI can be set from Python using command ``rx_roi``(it supports any sequence of four or two (for mythen3 and gotthard) ints e.g. a tuple (xmin, xmax, ymin, ymax) or a sequence of such for multiple ROIS)
|
||||
* one can clear all ROI's from Python using command ``rx_clearroi``
|
||||
|
||||
|
||||
1.2.1 Breaking API
|
||||
===================
|
||||
|
||||
|
||||
1.2.2 Resolved or Changed Features
|
||||
===================================
|
||||
|
||||
|
||||
|
||||
1.2.3 New Features
|
||||
===================
|
||||
|
||||
|
||||
2 On-board Detector Server Compatibility
|
||||
==========================================
|
||||
@@ -19,7 +19,6 @@ cmake .. -G Ninja \
|
||||
-DSLS_USE_PYTHON=OFF \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DSLS_USE_HDF5=OFF \
|
||||
-DSLS_USE_SYSTEM_ZMQ=ON \
|
||||
|
||||
NCORES=$(getconf _NPROCESSORS_ONLN)
|
||||
echo "Building using: ${NCORES} cores"
|
||||
|
||||
@@ -29,7 +29,6 @@ requirements:
|
||||
- libtiff
|
||||
- zlib
|
||||
- expat
|
||||
- zeromq
|
||||
|
||||
run:
|
||||
- libstdcxx-ng
|
||||
|
||||
@@ -20,7 +20,7 @@ print(sys.path)
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
|
||||
project = 'slsDetectorPackage @PROJECT_VERSION@'
|
||||
project = 'slsDetectorPackage'
|
||||
copyright = '2020, PSD Detector Group'
|
||||
author = 'PSD Detector Group'
|
||||
version = '@PROJECT_VERSION@'
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
slsDetectorPackage
|
||||
Welcome to slsDetectorPackage's documentation!
|
||||
==============================================
|
||||
|
||||
.. note ::
|
||||
|
||||
This is the documentation for the latest development version of slsDetectorPackage.
|
||||
For further detector specific documentation, visit `this page <https://www.psi.ch/en/detectors/documentation>`__.
|
||||
For further documentation, visit the official page: https://www.psi.ch/en/detectors/documentation
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 3
|
||||
|
||||
@@ -28,7 +28,7 @@ This instructs the firmware to execute the commands from address 0 to 4 (includi
|
||||
.. code-block::
|
||||
|
||||
start [Ctb, Xilinx_Ctb]
|
||||
patternstart [Mythen3, Ctb, Xilinx_Ctb]
|
||||
patternstart [Mythen3]
|
||||
|
||||
The maximal number of patword addresses is 8192. However, it is possible to extend the length of the pattern sequence using loops and wait commands. Loops can be configured with the following commands:
|
||||
|
||||
@@ -70,11 +70,11 @@ The mappings of bit positions in the pattern word to signals/pads of the FPGA ar
|
||||
|
||||
.. table::
|
||||
|
||||
+----+---+------+----+----------+----------+----------------+
|
||||
| 63 | 62| 61-57| 56 | 55-48 | 47-32 | 31-0 |
|
||||
+----+---+------+----+----------+----------+----------------+
|
||||
| A | D| --- | T | EXTIO | DO | DIO |
|
||||
+----+---+------+----+----------+----------+----------------+
|
||||
+----+---+------+----+----------+-------------------+----------------+
|
||||
| 63 | 62| 61-57| 56 | 55-48 | 47-32 | 31-0 |
|
||||
+----+---+------+----+----------+-------------------+----------------+
|
||||
| A | D| --- | T | EXTIO | DO, stream source | DIO |
|
||||
+----+---+------+----+----------+-------------------+----------------+
|
||||
|
||||
DIO: Driving the 32 FPGA pins corresponding to the lowest 32 bits of the patioctrl command. If bits in patioctrl are 0, the same bit positions in DIO will switch to input pins and connect to dbit sampling. Additionally, some of these 32 bits have an automatic override by detector-specific statemachines which is active whenever one of these statemachines is running (currently bits 7,8,11,14 and 20).
|
||||
|
||||
@@ -119,12 +119,4 @@ DIO: Driving the 32 FPGA pins corresponding to the lowest 32 bits of the patioct
|
||||
| SR_MODE | clk | EN | PULSE | RD | CHSIN | ANAMode | TBLOAD |
|
||||
+---------+-----+-------+-------+----+-------+---------+--------+
|
||||
|
||||
For Mythen3 the pattern word only connects to output pins of the FPGA when the pattern is running. Afterwards the signals will switch back to other logic in the FPGA. Both CTB's hold the last executed pattern word until a new pattern is started.
|
||||
|
||||
**Relation of received data to pattern execution**
|
||||
|
||||
In the default configuration the Ctb will send out udp packets to the sls_receiver for every end of a pattern execution. This behavior can be changed using STREAMING_CTRL_REG, where one can configure a bit position in the 64-bit pattern word to trigger udp packets. This allows to send more than one packet per pattern or also no packets at all.
|
||||
|
||||
The "patternstart" command on the ctb exectues the pattern. As long as streaming_ctrl_reg is disabeld, every pattern execution using this command will not send UDP packets.
|
||||
|
||||
For Mythen3 the sending of udp packets is not connected to pattern execution.
|
||||
For Mythen3 the pattern word only connects to output pins of the FPGA when the pattern is running. Afterwards the signals will switch back to other logic in the FPGA. Both CTB's hold the last executed pattern word until a new pattern is started.
|
||||
@@ -154,8 +154,6 @@ class AdcTab(QtWidgets.QWidget):
|
||||
self.mainWindow.analogPlots[i].setData(waveform)
|
||||
plotName = getattr(self.view, f"labelADC{i}").text()
|
||||
waveforms[plotName] = waveform
|
||||
elif checkBoxEn.isChecked():
|
||||
idx += 1
|
||||
return waveforms
|
||||
|
||||
@recordOrApplyPedestal
|
||||
|
||||
@@ -50,20 +50,20 @@ class AcquisitionTab(QtWidgets.QWidget):
|
||||
self.plotTab = self.mainWindow.plotTab
|
||||
self.toggleStartButton(False)
|
||||
if self.det.type == detectorType.XILINX_CHIPTESTBOARD:
|
||||
self.view.labelRunF.setDisabled(True)
|
||||
self.view.labelADCF.setDisabled(True)
|
||||
self.view.labelADCPhase.setDisabled(True)
|
||||
self.view.labelADCPipeline.setDisabled(True)
|
||||
self.view.labelDBITF.setDisabled(True)
|
||||
self.view.labelDBITPhase.setDisabled(True)
|
||||
self.view.labelDBITPipeline.setDisabled(True)
|
||||
self.view.spinBoxRunF.setDisabled(True)
|
||||
self.view.spinBoxADCF.setDisabled(True)
|
||||
self.view.spinBoxADCPhase.setDisabled(True)
|
||||
self.view.spinBoxADCPipeline.setDisabled(True)
|
||||
self.view.spinBoxDBITF.setDisabled(True)
|
||||
self.view.spinBoxDBITPhase.setDisabled(True)
|
||||
self.view.spinBoxDBITPipeline.setDisabled(True)
|
||||
self.view.labelRunF.setText("Run Clock Frequency (kHz):")
|
||||
self.view.labelDBITF.setText("DBIT Clock Frequency (kHz):")
|
||||
self.view.labelADCF.setText("ADC Clock Frequency (kHz):")
|
||||
self.view.spinBoxRunF.setMaximum(250000)
|
||||
self.view.spinBoxDBITF.setMaximum(250000)
|
||||
self.view.spinBoxADCF.setMaximum(250000)
|
||||
|
||||
def connect_ui(self):
|
||||
# For Acquistions Tab
|
||||
@@ -72,13 +72,12 @@ class AcquisitionTab(QtWidgets.QWidget):
|
||||
self.view.spinBoxAnalog.editingFinished.connect(self.setAnalog)
|
||||
self.view.spinBoxDigital.editingFinished.connect(self.setDigital)
|
||||
|
||||
if self.det.type in [detectorType.CHIPTESTBOARD, detectorType.XILINX_CHIPTESTBOARD]:
|
||||
if self.det.type == detectorType.CHIPTESTBOARD:
|
||||
self.view.spinBoxRunF.editingFinished.connect(self.setRunFrequency)
|
||||
self.view.spinBoxADCF.editingFinished.connect(self.setADCFrequency)
|
||||
self.view.spinBoxDBITF.editingFinished.connect(self.setDBITFrequency)
|
||||
if self.det.type == detectorType.CHIPTESTBOARD:
|
||||
self.view.spinBoxADCPhase.editingFinished.connect(self.setADCPhase)
|
||||
self.view.spinBoxADCPipeline.editingFinished.connect(self.setADCPipeline)
|
||||
self.view.spinBoxDBITF.editingFinished.connect(self.setDBITFrequency)
|
||||
self.view.spinBoxDBITPhase.editingFinished.connect(self.setDBITPhase)
|
||||
self.view.spinBoxDBITPipeline.editingFinished.connect(self.setDBITPipeline)
|
||||
|
||||
@@ -99,13 +98,12 @@ class AcquisitionTab(QtWidgets.QWidget):
|
||||
self.getAnalog()
|
||||
self.getDigital()
|
||||
|
||||
if self.det.type in [detectorType.CHIPTESTBOARD, detectorType.XILINX_CHIPTESTBOARD]:
|
||||
if self.det.type == detectorType.CHIPTESTBOARD:
|
||||
self.getRunFrequency()
|
||||
self.getADCFrequency()
|
||||
self.getDBITFrequency()
|
||||
if self.det.type == detectorType.CHIPTESTBOARD:
|
||||
self.getADCPhase()
|
||||
self.getADCPipeline()
|
||||
self.getDBITFrequency()
|
||||
self.getDBITPhase()
|
||||
self.getDBITPipeline()
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import datetime as dt
|
||||
|
||||
from functools import wraps
|
||||
from collections import namedtuple
|
||||
from collections.abc import Sequence
|
||||
import socket
|
||||
import numpy as np
|
||||
|
||||
@@ -147,33 +148,6 @@ class Detector(CppDetectorApi):
|
||||
value = ut.make_string_path(value)
|
||||
self.loadParameters(value)
|
||||
|
||||
|
||||
@property
|
||||
def include(self):
|
||||
"""Sets detector measurement parameters to those contained in fname.
|
||||
Set up per measurement.
|
||||
|
||||
Note
|
||||
-----
|
||||
Equivalent to config, but does not free shared memory. Same as parameters command.
|
||||
|
||||
:getter: Not implemented
|
||||
:setter: loads parameters file
|
||||
|
||||
Example
|
||||
---------
|
||||
|
||||
>>> d.include = 'path/to/file.par'
|
||||
|
||||
"""
|
||||
return NotImplementedError("include is set only")
|
||||
|
||||
@include.setter
|
||||
def include(self, value):
|
||||
if isinstance(value, str):
|
||||
value = ut.make_string_path(value)
|
||||
self.loadParameters(value)
|
||||
|
||||
@property
|
||||
def hostname(self):
|
||||
"""Frees shared memory and sets hostname (or IP address) of all modules concatenated by +
|
||||
@@ -328,6 +302,46 @@ class Detector(CppDetectorApi):
|
||||
def rx_arping(self, value):
|
||||
ut.set_using_dict(self.setRxArping, value)
|
||||
|
||||
@property
|
||||
def rx_roi(self):
|
||||
"""Gets the list of ROIs configured in the receiver.
|
||||
|
||||
Note
|
||||
-----
|
||||
Each ROI is represented as a tuple of (x_start, y_start, x_end, y_end). \n
|
||||
If no ROIs are configured, returns [[-1,-1,-1,-1]].
|
||||
"""
|
||||
return self.getRxROI() #vector of Roi structs how represented?
|
||||
|
||||
@rx_roi.setter
|
||||
def rx_roi(self, rois):
|
||||
"""
|
||||
Sets the list of ROIs in the receiver.
|
||||
Can only set multiple ROIs at multi module level without gap pixels. If more than 1 ROI per
|
||||
UDP port, it will throw. Setting number of udp interfaces will clear the
|
||||
roi. Cannot be set for CTB or Xilinx CTB.
|
||||
|
||||
Note
|
||||
-----
|
||||
Each ROI should be represented as a sequence of 4 ints (x_start, y_start, x_end, y_end). \n
|
||||
For mythen3 or gotthard2 pass a sequence of 2 ints (x_start, x_end) \n
|
||||
For multiple ROI's pass a sequence of sequence \n
|
||||
Example: [[0, 100, 50, 100], [260, 270, 50,100]] \n
|
||||
"""
|
||||
# TODO: maybe better to accept py::object in setRxROI and handle there?
|
||||
if not isinstance(rois, Sequence):
|
||||
raise TypeError(
|
||||
"setRxROI failed: expected a tuple/list of ints x_min, x_max, y_min, y_max "
|
||||
"or a sequence of such."
|
||||
)
|
||||
if(not isinstance(rois[0], Sequence)):
|
||||
self.setRxROI([rois])
|
||||
else:
|
||||
self.setRxROI(rois)
|
||||
|
||||
def rx_clearroi(self):
|
||||
"""Clears all the ROIs configured in the receiver."""
|
||||
self.clearRxROI()
|
||||
|
||||
@property
|
||||
@element
|
||||
@@ -3332,11 +3346,7 @@ class Detector(CppDetectorApi):
|
||||
@property
|
||||
@element
|
||||
def runclk(self):
|
||||
"""
|
||||
[Ctb] Sets Run clock frequency in MHz. \n
|
||||
[Xilinx Ctb] Sets Run clock frequency in kHz.
|
||||
"""
|
||||
|
||||
"""[Ctb] Run clock in MHz."""
|
||||
return self.getRUNClock()
|
||||
|
||||
@runclk.setter
|
||||
@@ -3417,11 +3427,7 @@ class Detector(CppDetectorApi):
|
||||
@property
|
||||
@element
|
||||
def dbitclk(self):
|
||||
"""
|
||||
[Ctb] Sets clock for latching the digital bits in MHz. \n
|
||||
[Xilinx Ctb] clock for latching the digital bits in kHz.
|
||||
"""
|
||||
|
||||
"""[Ctb] Clock for latching the digital bits in MHz."""
|
||||
return self.getDBITClock()
|
||||
|
||||
@dbitclk.setter
|
||||
@@ -3548,11 +3554,7 @@ class Detector(CppDetectorApi):
|
||||
@property
|
||||
@element
|
||||
def adcclk(self):
|
||||
"""
|
||||
[Ctb] Sets ADC clock frequency in MHz. \n
|
||||
[Xilinx Ctb] Sets ADC clock frequency in kHz.
|
||||
"""
|
||||
|
||||
"""[Ctb] Sets ADC clock frequency in MHz. """
|
||||
return self.getADCClock()
|
||||
|
||||
@adcclk.setter
|
||||
|
||||
@@ -942,6 +942,7 @@ void init_det(py::module &m) {
|
||||
(void (Detector::*)(const std::vector<defs::ROI> &)) &
|
||||
Detector::setRxROI,
|
||||
py::arg());
|
||||
|
||||
CppDetectorApi.def("clearRxROI",
|
||||
(void (Detector::*)()) & Detector::clearRxROI);
|
||||
CppDetectorApi.def(
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#pragma once
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <datetime.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
|
||||
#include "sls/Result.h"
|
||||
#include "DurationWrapper.h"
|
||||
#include "sls/Result.h"
|
||||
#include "sls/sls_detector_defs.h"
|
||||
|
||||
namespace py = pybind11;
|
||||
namespace pybind11 {
|
||||
@@ -14,84 +15,130 @@ template <typename Type, typename Alloc>
|
||||
struct type_caster<sls::Result<Type, Alloc>>
|
||||
: list_caster<sls::Result<Type, Alloc>, Type> {};
|
||||
|
||||
|
||||
// Based on the typecaster in pybind11/chrono.h
|
||||
template <> struct type_caster<std::chrono::nanoseconds> {
|
||||
public:
|
||||
PYBIND11_TYPE_CASTER(std::chrono::nanoseconds, const_name("DurationWrapper"));
|
||||
public:
|
||||
PYBIND11_TYPE_CASTER(std::chrono::nanoseconds,
|
||||
const_name("DurationWrapper"));
|
||||
|
||||
// signed 25 bits required by the standard.
|
||||
using days = std::chrono::duration<int_least32_t, std::ratio<86400>>;
|
||||
// signed 25 bits required by the standard.
|
||||
using days = std::chrono::duration<int_least32_t, std::ratio<86400>>;
|
||||
|
||||
/**
|
||||
* Conversion part 1 (Python->C++): convert a PyObject into std::chrono::nanoseconds
|
||||
* try datetime.timedelta, floats and our DurationWrapper wrapper
|
||||
*/
|
||||
/**
|
||||
* Conversion part 1 (Python->C++): convert a PyObject into
|
||||
* std::chrono::nanoseconds try datetime.timedelta, floats and our
|
||||
* DurationWrapper wrapper
|
||||
*/
|
||||
|
||||
bool load(handle src, bool) {
|
||||
using namespace std::chrono;
|
||||
bool load(handle src, bool) {
|
||||
using namespace std::chrono;
|
||||
|
||||
// Lazy initialise the PyDateTime import
|
||||
if (!PyDateTimeAPI) {
|
||||
PyDateTime_IMPORT;
|
||||
}
|
||||
// Lazy initialise the PyDateTime import
|
||||
if (!PyDateTimeAPI) {
|
||||
PyDateTime_IMPORT;
|
||||
}
|
||||
|
||||
if (!src) {
|
||||
if (!src) {
|
||||
return false;
|
||||
}
|
||||
// If invoked with datetime.delta object, same as in chrono.h
|
||||
if (PyDelta_Check(src.ptr())) {
|
||||
value = duration_cast<nanoseconds>(
|
||||
days(PyDateTime_DELTA_GET_DAYS(src.ptr())) +
|
||||
seconds(PyDateTime_DELTA_GET_SECONDS(src.ptr())) +
|
||||
microseconds(PyDateTime_DELTA_GET_MICROSECONDS(src.ptr()))
|
||||
|
||||
);
|
||||
return true;
|
||||
}
|
||||
// If invoked with a float we assume it is seconds and convert, same as
|
||||
// in chrono.h
|
||||
if (PyFloat_Check(src.ptr())) {
|
||||
value = duration_cast<nanoseconds>(
|
||||
duration<double>(PyFloat_AsDouble(src.ptr())));
|
||||
return true;
|
||||
}
|
||||
// If invoked with an int we assume it is nanoseconds and convert, same
|
||||
// as in chrono.h
|
||||
if (PyLong_Check(src.ptr())) {
|
||||
value = duration_cast<nanoseconds>(
|
||||
duration<int64_t>(PyLong_AsLongLong(src.ptr())));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Lastly if we were actually called with a DurationWrapper object we
|
||||
// get the number of nanoseconds and create a std::chrono::nanoseconds
|
||||
// from it
|
||||
py::object py_cls =
|
||||
py::module::import("slsdet._slsdet").attr("DurationWrapper");
|
||||
if (py::isinstance(src, py_cls)) {
|
||||
sls::DurationWrapper *cls = src.cast<sls::DurationWrapper *>();
|
||||
value = nanoseconds(cls->count());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion part 2 (C++ -> Python)
|
||||
* import the module to get a handle to the wrapped class
|
||||
* Default construct an object of (wrapped) DurationWrapper
|
||||
* set the count from chrono::nanoseconds and return
|
||||
*/
|
||||
static handle cast(std::chrono::nanoseconds src,
|
||||
return_value_policy /* policy */, handle /* parent */) {
|
||||
py::object py_cls =
|
||||
py::module::import("slsdet._slsdet").attr("DurationWrapper");
|
||||
py::object *obj = new py::object;
|
||||
*obj = py_cls();
|
||||
sls::DurationWrapper *dur = obj->cast<sls::DurationWrapper *>();
|
||||
dur->set_count(src.count());
|
||||
return *obj;
|
||||
}
|
||||
};
|
||||
|
||||
// Type caster for sls::defs::ROI from tuple
|
||||
template <> struct type_caster<sls::defs::ROI> {
|
||||
PYBIND11_TYPE_CASTER(sls::defs::ROI, _("Sequence[int, int, int, int] or "
|
||||
"Sequence[int, int]"));
|
||||
|
||||
// convert c++ ROI to python tuple
|
||||
static handle cast(const sls::defs::ROI &roi, return_value_policy, handle) {
|
||||
return py::make_tuple(roi.xmin, roi.xmax, roi.ymin, roi.ymax).release();
|
||||
}
|
||||
|
||||
// convert from python to c++ ROI
|
||||
bool load(handle roi, bool /*allow implicit conversion*/) {
|
||||
|
||||
// accept tuple, list, numpy array any sequence
|
||||
py::sequence seq;
|
||||
try {
|
||||
seq = py::reinterpret_borrow<py::sequence>(roi);
|
||||
} catch (...) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (seq.size() != 4 && seq.size() != 2)
|
||||
return false;
|
||||
// Check if each element is an int
|
||||
for (auto item : seq) {
|
||||
if (!py::isinstance<py::int_>(item)) {
|
||||
return false;
|
||||
}
|
||||
// If invoked with datetime.delta object, same as in chrono.h
|
||||
if (PyDelta_Check(src.ptr())) {
|
||||
value = duration_cast<nanoseconds>(
|
||||
days(PyDateTime_DELTA_GET_DAYS(src.ptr())) +
|
||||
seconds(PyDateTime_DELTA_GET_SECONDS(src.ptr())) +
|
||||
microseconds(PyDateTime_DELTA_GET_MICROSECONDS(src.ptr()))
|
||||
|
||||
);
|
||||
return true;
|
||||
}
|
||||
// If invoked with a float we assume it is seconds and convert, same as in chrono.h
|
||||
if (PyFloat_Check(src.ptr())) {
|
||||
value = duration_cast<nanoseconds>(duration<double>(PyFloat_AsDouble(src.ptr())));
|
||||
return true;
|
||||
}
|
||||
// If invoked with an int we assume it is nanoseconds and convert, same as in chrono.h
|
||||
if (PyLong_Check(src.ptr())) {
|
||||
value = duration_cast<nanoseconds>(duration<int64_t>(PyLong_AsLongLong(src.ptr())));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Lastly if we were actually called with a DurationWrapper object we get
|
||||
// the number of nanoseconds and create a std::chrono::nanoseconds from it
|
||||
py::object py_cls = py::module::import("slsdet._slsdet").attr("DurationWrapper");
|
||||
if (py::isinstance(src, py_cls)){
|
||||
sls::DurationWrapper *cls = src.cast<sls::DurationWrapper *>();
|
||||
value = nanoseconds(cls->count());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion part 2 (C++ -> Python)
|
||||
* import the module to get a handle to the wrapped class
|
||||
* Default construct an object of (wrapped) DurationWrapper
|
||||
* set the count from chrono::nanoseconds and return
|
||||
*/
|
||||
static handle cast(std::chrono::nanoseconds src, return_value_policy /* policy */, handle /* parent */) {
|
||||
py::object py_cls = py::module::import("slsdet._slsdet").attr("DurationWrapper");
|
||||
py::object* obj = new py::object;
|
||||
*obj = py_cls();
|
||||
sls::DurationWrapper *dur = obj->cast<sls::DurationWrapper *>();
|
||||
dur->set_count(src.count());
|
||||
return *obj;
|
||||
value.xmin = seq[0].cast<int>();
|
||||
value.xmax = seq[1].cast<int>();
|
||||
|
||||
if (seq.size() == 4) {
|
||||
value.ymin = seq[2].cast<int>();
|
||||
value.ymax = seq[3].cast<int>();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace pybind11
|
||||
85
python/tests/conftest.py
Normal file
85
python/tests/conftest.py
Normal file
@@ -0,0 +1,85 @@
|
||||
import pytest
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
current_dir = Path(__file__).resolve().parents[2]
|
||||
|
||||
scripts_dir = current_dir / "tests" / "scripts"
|
||||
|
||||
sys.path.append(str(scripts_dir))
|
||||
|
||||
print(sys.path)
|
||||
|
||||
from utils_for_test import (
|
||||
Log,
|
||||
LogLevel,
|
||||
cleanup,
|
||||
startReceiver,
|
||||
startDetectorVirtualServer,
|
||||
loadConfig,
|
||||
loadBasicSettings,
|
||||
)
|
||||
|
||||
def pytest_addoption(parser):
|
||||
parser.addoption(
|
||||
"--with-detector-simulators", action="store_true", default=False, help="Run tests that require detector simulators"
|
||||
)
|
||||
|
||||
def pytest_configure(config):
|
||||
config.addinivalue_line("markers", "withdetectorsimulators: mark test as needing detector simulators to run")
|
||||
|
||||
def pytest_collection_modifyitems(config, items):
|
||||
if config.getoption("--with-detector-simulators"):
|
||||
return
|
||||
skip = pytest.mark.skip(reason="need --with-detector-simulators option to run")
|
||||
for item in items:
|
||||
if "withdetectorsimulators" in item.keywords:
|
||||
item.add_marker(skip)
|
||||
|
||||
#helper fixture for servers
|
||||
@pytest.fixture
|
||||
def servers(request):
|
||||
try:
|
||||
return request.param # comes from @pytest.mark.parametrize(..., indirect=True)
|
||||
except AttributeError:
|
||||
# fallback default if the test did not parametrize
|
||||
return ['eiger', 'jungfrau', 'mythen3', 'gotthard2', 'ctb', 'moench', 'xilinx_ctb']
|
||||
return request.param
|
||||
|
||||
@pytest.fixture
|
||||
def test_with_simulators(servers):
|
||||
""" Fixture to automatically setup virtual detector servers for testing. """
|
||||
|
||||
LOG_PREFIX_FNAME = '/tmp/slsDetectorPackage_virtual_PythonAPI_test'
|
||||
MAIN_LOG_FNAME = LOG_PREFIX_FNAME + '_log.txt'
|
||||
|
||||
with open(MAIN_LOG_FNAME, 'w') as fp:
|
||||
try:
|
||||
nmods = 2
|
||||
for server in servers:
|
||||
for ninterfaces in range(1,2):
|
||||
if ninterfaces == 2 and server != 'jungfrau' and server != 'moench':
|
||||
continue
|
||||
|
||||
msg = f'Starting Python API Tests for {server}'
|
||||
|
||||
if server == 'jungfrau' or server == 'moench':
|
||||
msg += f' with {ninterfaces} interfaces'
|
||||
|
||||
Log(LogLevel.INFOBLUE, msg, fp)
|
||||
cleanup(fp)
|
||||
startDetectorVirtualServer(server, nmods, fp)
|
||||
startReceiver(nmods, fp)
|
||||
d = loadConfig(name=server, log_file_fp=fp, num_mods=nmods, num_frames=1, num_interfaces=ninterfaces)
|
||||
loadBasicSettings(name=server, d=d, fp=fp)
|
||||
yield # run test
|
||||
cleanup(fp) # teardown
|
||||
except Exception as e:
|
||||
with open(MAIN_LOG_FNAME, 'a') as fp_error:
|
||||
traceback.print_exc(file=fp_error)
|
||||
Log(LogLevel.ERROR, f'Tests Failed.', fp)
|
||||
cleanup(fp)
|
||||
|
||||
|
||||
48
python/tests/test_pythonAPI.py
Normal file
48
python/tests/test_pythonAPI.py
Normal file
@@ -0,0 +1,48 @@
|
||||
import pytest
|
||||
import sys
|
||||
|
||||
from conftest import test_with_simulators
|
||||
|
||||
from slsdet import Detector
|
||||
|
||||
@pytest.mark.withdetectorsimulators
|
||||
@pytest.mark.parametrize("servers", [["moench"]], indirect=True)
|
||||
def test_rx_ROI_moench(test_with_simulators, servers):
|
||||
""" Test setting and getting rx_ROI property of Detector class for moench. """
|
||||
|
||||
d = Detector()
|
||||
d.rx_roi = (0, 10, 10, 20)
|
||||
roi = d.rx_roi
|
||||
assert roi == [(0, 10, 10, 20)]
|
||||
|
||||
d.rx_roi = [5,15,15,25]
|
||||
|
||||
assert d.rx_roi == [(5,15,15,25)]
|
||||
|
||||
d.rx_roi = [[0,10,0,20], [5,20,410,420]]
|
||||
|
||||
roi = d.rx_roi
|
||||
assert roi == [(0,10,0,20), (5,20,410,420)]
|
||||
|
||||
d.rx_clearroi()
|
||||
roi = d.rx_roi
|
||||
assert roi == [(-1,-1,-1,-1)]
|
||||
|
||||
@pytest.mark.withdetectorsimulators
|
||||
@pytest.mark.parametrize("servers", [["mythen3"]], indirect=True)
|
||||
def test_rx_ROI_mythen(test_with_simulators, servers):
|
||||
""" Test setting and getting rx_ROI property of Detector class for mythen. """
|
||||
|
||||
d = Detector()
|
||||
d.rx_roi = (0, 10)
|
||||
roi = d.rx_roi
|
||||
assert roi == [(0, 10, -1, -1)]
|
||||
|
||||
#d.rx_roi = [[5,15, 0, 1]] # not allowed for mythen3
|
||||
|
||||
d.rx_roi = [0,10, -1, -1]
|
||||
|
||||
assert d.rx_roi == [(0,10,-1,-1)]
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
add_executable(using_logger using_logger.cpp)
|
||||
target_link_libraries(using_logger
|
||||
slsSupportShared
|
||||
pthread
|
||||
rt
|
||||
)
|
||||
|
||||
set_target_properties(using_logger PROPERTIES
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -76,8 +76,11 @@ foreach(exe ${JUNGFRAU_EXECUTABLES})
|
||||
target_link_libraries(${exe}
|
||||
PUBLIC
|
||||
slsSupportStatic
|
||||
pthread
|
||||
tiffio
|
||||
fmt::fmt
|
||||
#-L/usr/lib64/
|
||||
#-lm -lstdc++ -lrt
|
||||
|
||||
PRIVATE
|
||||
slsProjectWarnings
|
||||
|
||||
@@ -69,6 +69,7 @@ foreach(exe ${MOENCH_EXECUTABLES})
|
||||
PUBLIC
|
||||
slsSupportStatic
|
||||
${ZeroMQ_LIBRARIES}
|
||||
pthread
|
||||
tiffio
|
||||
|
||||
PRIVATE
|
||||
|
||||
@@ -37,9 +37,7 @@ target_compile_definitions(ctbDetectorServer_virtual
|
||||
)
|
||||
|
||||
target_link_libraries(ctbDetectorServer_virtual
|
||||
PUBLIC
|
||||
m
|
||||
slsProjectCSettings
|
||||
PUBLIC pthread rt m slsProjectCSettings
|
||||
)
|
||||
|
||||
set_target_properties(ctbDetectorServer_virtual PROPERTIES
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
/* Definitions for FPGA */
|
||||
#define MEM_MAP_SHIFT 1
|
||||
#define REG_OFFSET (2)
|
||||
|
||||
/* FPGA Version RO register */
|
||||
#define FPGA_VERSION_REG (0x00 << MEM_MAP_SHIFT)
|
||||
@@ -66,8 +65,8 @@
|
||||
(0x000000FF << STATUS_PT_CNTRL_STTS_OFF_OFST)
|
||||
#define STATUS_IDLE_MSK (0x677FF)
|
||||
|
||||
/* Register containing the git hash of the FPGA firmware */
|
||||
#define FIRMWARE_GIT_HASH_REG (0x03 << MEM_MAP_SHIFT)
|
||||
/* Look at me RO register TODO */
|
||||
#define LOOK_AT_ME_REG (0x03 << MEM_MAP_SHIFT)
|
||||
|
||||
/* System Status RO register */
|
||||
#define SYSTEM_STATUS_REG (0x04 << MEM_MAP_SHIFT)
|
||||
@@ -120,7 +119,7 @@
|
||||
#define MOD_SERIAL_NUMBER_VRSN_MSK (0x0000003F << MOD_SERIAL_NUMBER_VRSN_OFST)
|
||||
|
||||
/* API Version RO register */
|
||||
#define API_VERSION_REG (0x0B << MEM_MAP_SHIFT)
|
||||
#define API_VERSION_REG (0x0F << MEM_MAP_SHIFT)
|
||||
|
||||
#define API_VERSION_OFST (0)
|
||||
#define API_VERSION_MSK (0x00FFFFFF << API_VERSION_OFST)
|
||||
@@ -129,24 +128,24 @@
|
||||
|
||||
/* Time from Start 64 bit RO register. t = GCLK x 50 ns. Reset using
|
||||
* CONTROL_CRST. TODO */
|
||||
#define TIME_FROM_START_LSB_REG (0x97 << MEM_MAP_SHIFT)
|
||||
#define TIME_FROM_START_MSB_REG (0x98 << MEM_MAP_SHIFT)
|
||||
#define TIME_FROM_START_LSB_REG (0x10 << MEM_MAP_SHIFT)
|
||||
#define TIME_FROM_START_MSB_REG (0x11 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Delay Left 64 bit RO register. t = DLY x 50 ns. TODO */
|
||||
#define DELAY_LEFT_LSB_REG (0x8D << MEM_MAP_SHIFT)
|
||||
#define DELAY_LEFT_MSB_REG (0x8E << MEM_MAP_SHIFT)
|
||||
#define DELAY_LEFT_LSB_REG (0x12 << MEM_MAP_SHIFT)
|
||||
#define DELAY_LEFT_MSB_REG (0x13 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Triggers Left 64 bit RO register TODO */
|
||||
#define CYCLES_LEFT_LSB_REG (0x8F << MEM_MAP_SHIFT)
|
||||
#define CYCLES_LEFT_MSB_REG (0x90 << MEM_MAP_SHIFT)
|
||||
#define CYCLES_LEFT_LSB_REG (0x14 << MEM_MAP_SHIFT)
|
||||
#define CYCLES_LEFT_MSB_REG (0x15 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Frames Left 64 bit RO register TODO */
|
||||
#define FRAMES_LEFT_LSB_REG (0x91 << MEM_MAP_SHIFT)
|
||||
#define FRAMES_LEFT_MSB_REG (0x92 << MEM_MAP_SHIFT)
|
||||
#define FRAMES_LEFT_LSB_REG (0x16 << MEM_MAP_SHIFT)
|
||||
#define FRAMES_LEFT_MSB_REG (0x17 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Period Left 64 bit RO register. t = T x 50 ns. TODO */
|
||||
#define PERIOD_LEFT_LSB_REG (0x93 << MEM_MAP_SHIFT)
|
||||
#define PERIOD_LEFT_MSB_REG (0x94 << MEM_MAP_SHIFT)
|
||||
#define PERIOD_LEFT_LSB_REG (0x18 << MEM_MAP_SHIFT)
|
||||
#define PERIOD_LEFT_MSB_REG (0x19 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Exposure Time Left 64 bit RO register */
|
||||
// #define EXPTIME_LEFT_LSB_REG (0x1A << MEM_MAP_SHIFT) // Not
|
||||
@@ -161,34 +160,34 @@
|
||||
//// Not used in FW
|
||||
|
||||
/* Data In 64 bit RO register TODO */
|
||||
#define DATA_IN_LSB_REG (0x10 << MEM_MAP_SHIFT)
|
||||
#define DATA_IN_MSB_REG (0x11 << MEM_MAP_SHIFT)
|
||||
#define DATA_IN_LSB_REG (0x1E << MEM_MAP_SHIFT)
|
||||
#define DATA_IN_MSB_REG (0x1F << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Out 64 bit RO register */
|
||||
#define PATTERN_OUT_LSB_REG (0x80 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_OUT_MSB_REG (0x81 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_OUT_LSB_REG (0x20 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_OUT_MSB_REG (0x21 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Frame number of next acquisition register (64 bit register) */
|
||||
#define NEXT_FRAME_NUMB_LOCAL_LSB_REG (0x12 << MEM_MAP_SHIFT)
|
||||
#define NEXT_FRAME_NUMB_LOCAL_MSB_REG (0x13 << MEM_MAP_SHIFT)
|
||||
#define NEXT_FRAME_NUMB_LOCAL_LSB_REG (0x22 << MEM_MAP_SHIFT)
|
||||
#define NEXT_FRAME_NUMB_LOCAL_MSB_REG (0x23 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Frames From Start PG 64 bit RO register. Reset using CONTROL_CRST. TODO */
|
||||
#define FRAMES_FROM_START_PG_LSB_REG (0x99 << MEM_MAP_SHIFT)
|
||||
#define FRAMES_FROM_START_PG_MSB_REG (0x9A << MEM_MAP_SHIFT)
|
||||
#define FRAMES_FROM_START_PG_LSB_REG (0x24 << MEM_MAP_SHIFT)
|
||||
#define FRAMES_FROM_START_PG_MSB_REG (0x25 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Start Frame Time (Measurement Time) 64 bit register (timestamp at a frame
|
||||
* start until reset) TODO */
|
||||
#define START_FRAME_TIME_LSB_REG (0x9B << MEM_MAP_SHIFT)
|
||||
#define START_FRAME_TIME_MSB_REG (0x9C << MEM_MAP_SHIFT)
|
||||
#define START_FRAME_TIME_LSB_REG (0x26 << MEM_MAP_SHIFT)
|
||||
#define START_FRAME_TIME_MSB_REG (0x27 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Power Status RO register */
|
||||
#define POWER_STATUS_REG (0x18 << MEM_MAP_SHIFT)
|
||||
#define POWER_STATUS_REG (0x29 << MEM_MAP_SHIFT)
|
||||
|
||||
#define POWER_STATUS_ALRT_OFST (27)
|
||||
#define POWER_STATUS_ALRT_MSK (0x0000001F << POWER_STATUS_ALRT_OFST)
|
||||
|
||||
/* FIFO Transceiver In Status RO register */
|
||||
#define FIFO_TIN_STATUS_REG (0x1A << MEM_MAP_SHIFT)
|
||||
#define FIFO_TIN_STATUS_REG (0x30 << MEM_MAP_SHIFT)
|
||||
#define FIFO_TIN_STATUS_FIFO_EMPTY_1_OFST (4)
|
||||
#define FIFO_TIN_STATUS_FIFO_EMPTY_1_MSK (0x00000001 << FIFO_TIN_STATUS_FIFO_EMPTY_1_OFST)
|
||||
#define FIFO_TIN_STATUS_FIFO_EMPTY_2_OFST (5)
|
||||
@@ -199,54 +198,23 @@
|
||||
#define FIFO_TIN_STATUS_FIFO_EMPTY_4_MSK (0x00000001 << FIFO_TIN_STATUS_FIFO_EMPTY_4_OFST)
|
||||
#define FIFO_TIN_STATUS_FIFO_EMPTY_ALL_MSK (0x0000000F << FIFO_TIN_STATUS_FIFO_EMPTY_1_OFST)
|
||||
|
||||
/* FIFO Transceiver Fill level RO register */
|
||||
#define FIFO_TIN_FILL_REG (0x25 << MEM_MAP_SHIFT)
|
||||
#define FIFO_TIN_FILL_FIFO_1_OFST (0)
|
||||
#define FIFO_TIN_FILL_FIFO_1_MSK (0x00003FFF << FIFO_TIN_FILL_FIFO__1_OFST)
|
||||
#define FIFO_TIN_FILL_FIFO_2_OFST (16)
|
||||
#define FIFO_TIN_FILL_FIFO_2_MSK (0x00003FFF << FIFO_TIN_FILL_FIFO__2_OFST)
|
||||
|
||||
/* FIFO ADC Fill level RO register */
|
||||
#define FIFO_ADC_FILL_REG (0x26 << MEM_MAP_SHIFT)
|
||||
#define FIFO_ADC_FILL_FIFO_OFST (0)
|
||||
#define FIFO_ADC_FILL_FIFO_MSK (0x00003FFF << FIFO_ADC_FILL_FIFO_OFST)
|
||||
|
||||
/* Enable continuos readout register */
|
||||
#define CONTINUOUS_RO_ENABLE_REG (0x27 << MEM_MAP_SHIFT)
|
||||
#define CONTINUOUS_RO_ADC_ENABLE_OFST (0)
|
||||
#define CONTINUOUS_RO_TIN_ENABLE_OFST (1)
|
||||
#define CONTINUOUS_RO_DBIT_ENABLE_OFST (2)
|
||||
#define CONTINUOUS_RO_ADC_ENABLE_MSK (0x00000001 << CONTINUOUS_RO_ADC_ENABLE_OFST)
|
||||
#define CONTINUOUS_RO_TIN_ENABLE_MSK (0x00000001 << CONTINUOUS_RO_TIN_ENABLE_OFST)
|
||||
#define CONTINUOUS_RO_DBIT_ENABLE_MSK (0x00000001 << CONTINUOUS_RO_DBIT_ENABLE_OFST)
|
||||
#define DBIT_INJECT_COUNTER_ENA_OFST (3) // continuously injects fake-data into the dbit fifo when enabled.
|
||||
#define DBIT_INJECT_COUNTER_ENA_MSK (0x00000001 << DBIT_INJECT_COUNTER_ENA_OFST)
|
||||
#define DBIT_INJECT_COUNTER_CLKDIV_OFST (8) // Additional clock divider for fake-data injection
|
||||
#define DBIT_INJECT_COUNTER_CLKDIV_MSK (0x000000FF << DBIT_INJECT_COUNTER_CLKDIV_OFST)
|
||||
|
||||
/* 64-bit FPGA chip ID. Unique for every device. read-only */
|
||||
#define FPGA_chipID_0_REG (0x28 << MEM_MAP_SHIFT)
|
||||
#define FPGA_chipID_1_REG (0x29 << MEM_MAP_SHIFT)
|
||||
|
||||
/* FIFO Transceiver In 64 bit RO register */
|
||||
#define FIFO_TIN_LSB_REG (0x1B << MEM_MAP_SHIFT)
|
||||
#define FIFO_TIN_MSB_REG (0x1C << MEM_MAP_SHIFT)
|
||||
#define FIFO_TIN_LSB_REG (0x31 << MEM_MAP_SHIFT)
|
||||
#define FIFO_TIN_MSB_REG (0x32 << MEM_MAP_SHIFT)
|
||||
|
||||
/* FIFO Digital In Status RO register */
|
||||
#define FIFO_DIN_STATUS_REG (0x1D << MEM_MAP_SHIFT)
|
||||
#define FIFO_DIN_STATUS_FIFO_FILL_OFST (0)
|
||||
#define FIFO_DIN_STATUS_FIFO_FILL_MSK (0x00003FFF)
|
||||
#define FIFO_DIN_STATUS_REG (0x3B << MEM_MAP_SHIFT)
|
||||
#define FIFO_DIN_STATUS_FIFO_FULL_OFST (30)
|
||||
#define FIFO_DIN_STATUS_FIFO_FULL_MSK (0x00000001 << FIFO_DIN_STATUS_FIFO_FULL_OFST)
|
||||
#define FIFO_DIN_STATUS_FIFO_EMPTY_OFST (31)
|
||||
#define FIFO_DIN_STATUS_FIFO_EMPTY_MSK (0x00000001 << FIFO_DIN_STATUS_FIFO_EMPTY_OFST)
|
||||
|
||||
/* FIFO Digital In 64 bit RO register */
|
||||
#define FIFO_DIN_LSB_REG (0x1E << MEM_MAP_SHIFT)
|
||||
#define FIFO_DIN_MSB_REG (0x1F << MEM_MAP_SHIFT)
|
||||
#define FIFO_DIN_LSB_REG (0x3C << MEM_MAP_SHIFT)
|
||||
#define FIFO_DIN_MSB_REG (0x3D << MEM_MAP_SHIFT)
|
||||
|
||||
/* SPI (Serial Peripheral Interface) DAC, HV RW register */
|
||||
#define SPI_REG (0x20 << MEM_MAP_SHIFT)
|
||||
#define SPI_REG (0x40 << MEM_MAP_SHIFT)
|
||||
|
||||
#define SPI_DAC_SRL_DGTL_OTPT_OFST (0)
|
||||
#define SPI_DAC_SRL_DGTL_OTPT_MSK (0x00000001 << SPI_DAC_SRL_DGTL_OTPT_OFST)
|
||||
@@ -262,7 +230,7 @@
|
||||
#define SPI_HV_SRL_CS_OTPT_MSK (0x00000001 << SPI_HV_SRL_CS_OTPT_OFST)
|
||||
|
||||
/* ADC SPI (Serial Peripheral Interface) RW register */
|
||||
#define ADC_SPI_REG (0x21 << MEM_MAP_SHIFT)
|
||||
#define ADC_SPI_REG (0x41 << MEM_MAP_SHIFT)
|
||||
|
||||
#define ADC_SPI_SRL_CLK_OTPT_OFST (0)
|
||||
#define ADC_SPI_SRL_CLK_OTPT_MSK (0x00000001 << ADC_SPI_SRL_CLK_OTPT_OFST)
|
||||
@@ -272,7 +240,7 @@
|
||||
#define ADC_SPI_SRL_CS_OTPT_MSK (0x0000000F << ADC_SPI_SRL_CS_OTPT_OFST)
|
||||
|
||||
/* ADC Offset RW register */
|
||||
#define ADC_OFFSET_REG (0x22 << MEM_MAP_SHIFT)
|
||||
#define ADC_OFFSET_REG (0x42 << MEM_MAP_SHIFT)
|
||||
|
||||
#define ADC_OFFSET_ADC_PPLN_OFST (0)
|
||||
#define ADC_OFFSET_ADC_PPLN_MSK (0x000000FF << ADC_OFFSET_ADC_PPLN_OFST)
|
||||
@@ -280,7 +248,7 @@
|
||||
#define ADC_OFFSET_DBT_PPLN_MSK (0x000000FF << ADC_OFFSET_DBT_PPLN_OFST)
|
||||
|
||||
/* ADC Port Invert RW register */
|
||||
#define ADC_PORT_INVERT_REG (0x23 << MEM_MAP_SHIFT)
|
||||
#define ADC_PORT_INVERT_REG (0x43 << MEM_MAP_SHIFT)
|
||||
|
||||
#define ADC_PORT_INVERT_0_INPT_OFST (0)
|
||||
#define ADC_PORT_INVERT_0_INPT_MSK (0x000000FF << ADC_PORT_INVERT_0_INPT_OFST)
|
||||
@@ -292,7 +260,7 @@
|
||||
#define ADC_PORT_INVERT_3_INPT_MSK (0x000000FF << ADC_PORT_INVERT_3_INPT_OFST)
|
||||
|
||||
/* Dummy RW register */
|
||||
#define DUMMY_REG (0x24 << MEM_MAP_SHIFT)
|
||||
#define DUMMY_REG (0x44 << MEM_MAP_SHIFT)
|
||||
|
||||
#define DUMMY_FIFO_CHNNL_SLCT_OFST (0)
|
||||
#define DUMMY_FIFO_CHNNL_SLCT_MSK (0x0000003F << DUMMY_FIFO_CHNNL_SLCT_OFST)
|
||||
@@ -305,8 +273,46 @@
|
||||
#define DUMMY_TRNSCVR_FIFO_RD_STRBE_OFST (14)
|
||||
#define DUMMY_TRNSCVR_FIFO_RD_STRBE_MSK (0x00000001 << DUMMY_TRNSCVR_FIFO_RD_STRBE_OFST)
|
||||
|
||||
/* Receiver IP Address RW register */
|
||||
#define RX_IP_REG (0x45 << MEM_MAP_SHIFT)
|
||||
|
||||
/* UDP Port RW register */
|
||||
#define UDP_PORT_REG (0x46 << MEM_MAP_SHIFT)
|
||||
|
||||
#define UDP_PORT_RX_OFST (0)
|
||||
#define UDP_PORT_RX_MSK (0x0000FFFF << UDP_PORT_RX_OFST)
|
||||
#define UDP_PORT_TX_OFST (16)
|
||||
#define UDP_PORT_TX_MSK (0x0000FFFF << UDP_PORT_TX_OFST)
|
||||
|
||||
/* Receiver Mac Address 64 bit RW register */
|
||||
#define RX_MAC_LSB_REG (0x47 << MEM_MAP_SHIFT)
|
||||
#define RX_MAC_MSB_REG (0x48 << MEM_MAP_SHIFT)
|
||||
|
||||
#define RX_MAC_LSB_OFST (0)
|
||||
#define RX_MAC_LSB_MSK (0xFFFFFFFF << RX_MAC_LSB_OFST)
|
||||
#define RX_MAC_MSB_OFST (0)
|
||||
#define RX_MAC_MSB_MSK (0x0000FFFF << RX_MAC_MSB_OFST)
|
||||
|
||||
/* Detector/ Transmitter Mac Address 64 bit RW register */
|
||||
#define TX_MAC_LSB_REG (0x49 << MEM_MAP_SHIFT)
|
||||
#define TX_MAC_MSB_REG (0x4A << MEM_MAP_SHIFT)
|
||||
|
||||
#define TX_MAC_LSB_OFST (0)
|
||||
#define TX_MAC_LSB_MSK (0xFFFFFFFF << TX_MAC_LSB_OFST)
|
||||
#define TX_MAC_MSB_OFST (0)
|
||||
#define TX_MAC_MSB_MSK (0x0000FFFF << TX_MAC_MSB_OFST)
|
||||
|
||||
/* Detector/ Transmitter IP Address RW register */
|
||||
#define TX_IP_REG (0x4B << MEM_MAP_SHIFT)
|
||||
|
||||
/* Detector/ Transmitter IP Checksum RW register */
|
||||
#define TX_IP_CHECKSUM_REG (0x4C << MEM_MAP_SHIFT)
|
||||
|
||||
#define TX_IP_CHECKSUM_OFST (0)
|
||||
#define TX_IP_CHECKSUM_MSK (0x0000FFFF << TX_IP_CHECKSUM_OFST)
|
||||
|
||||
/* Configuration RW register */
|
||||
#define CONFIG_REG (0x2D << MEM_MAP_SHIFT)
|
||||
#define CONFIG_REG (0x4D << MEM_MAP_SHIFT)
|
||||
|
||||
#define CONFIG_LED_DSBL_OFST (0)
|
||||
#define CONFIG_LED_DSBL_MSK (0x00000001 << CONFIG_LED_DSBL_OFST)
|
||||
@@ -321,7 +327,7 @@
|
||||
#define CONFIG_GB10_SND_UDP_MSK (0x00000001 << CONFIG_GB10_SND_UDP_OFST)
|
||||
|
||||
/* External Signal RW register */
|
||||
#define EXT_SIGNAL_REG (0x2E << MEM_MAP_SHIFT)
|
||||
#define EXT_SIGNAL_REG (0x4E << MEM_MAP_SHIFT)
|
||||
|
||||
#define EXT_SIGNAL_OFST (0)
|
||||
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
|
||||
@@ -329,7 +335,7 @@
|
||||
#define EXT_SIGNAL_TRGGR_VAL ((0x1 << EXT_SIGNAL_OFST) & EXT_SIGNAL_MSK)
|
||||
|
||||
/* Control RW register */
|
||||
#define CONTROL_REG (0x2F << MEM_MAP_SHIFT)
|
||||
#define CONTROL_REG (0x4F << MEM_MAP_SHIFT)
|
||||
|
||||
#define CONTROL_STRT_ACQSTN_OFST (0)
|
||||
#define CONTROL_STRT_ACQSTN_MSK (0x00000001 << CONTROL_STRT_ACQSTN_OFST)
|
||||
@@ -369,10 +375,10 @@
|
||||
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
|
||||
|
||||
/* Reconfiguratble PLL Paramater RW register */
|
||||
#define PLL_PARAM_REG (0x30 << MEM_MAP_SHIFT)
|
||||
#define PLL_PARAM_REG (0x50 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Reconfiguratble PLL Control RW regiser */
|
||||
#define PLL_CNTRL_REG (0x31 << MEM_MAP_SHIFT)
|
||||
#define PLL_CNTRL_REG (0x51 << MEM_MAP_SHIFT)
|
||||
|
||||
#define PLL_CNTRL_RCNFG_PRMTR_RST_OFST (0)
|
||||
#define PLL_CNTRL_RCNFG_PRMTR_RST_MSK \
|
||||
@@ -384,15 +390,8 @@
|
||||
#define PLL_CNTRL_ADDR_OFST (16)
|
||||
#define PLL_CNTRL_ADDR_MSK (0x0000003F << PLL_CNTRL_ADDR_OFST)
|
||||
|
||||
/* Streaming Control RW regiser */
|
||||
#define STREAMING_CTRL_REG (0x3D << MEM_MAP_SHIFT)
|
||||
#define STREAMING_CTRL_ENA_OFST (15)
|
||||
#define STREAMING_CTRL_ENA_MSK (0x00000001 << STREAMING_CTRL_ENA_OFST)
|
||||
#define STREAMING_CTRL_SELECT_OFST (0)
|
||||
#define STREAMING_CTRL_SELECT_MSK (0x0000003F << STREAMING_CTRL_SELECT_OFST)
|
||||
|
||||
/* Pattern Control RW register */
|
||||
#define PATTERN_CNTRL_REG (0x88 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_CNTRL_REG (0x52 << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_CNTRL_WR_OFST (0)
|
||||
#define PATTERN_CNTRL_WR_MSK (0x00000001 << PATTERN_CNTRL_WR_OFST)
|
||||
@@ -402,31 +401,70 @@
|
||||
#define PATTERN_CNTRL_ADDR_MSK (0x00001FFF << PATTERN_CNTRL_ADDR_OFST)
|
||||
|
||||
/* Pattern Limit RW regiser */
|
||||
#define PATTERN_LIMIT_REG (0x89 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_LIMIT_REG (0x53 << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_LIMIT_STRT_OFST (0)
|
||||
#define PATTERN_LIMIT_STRT_MSK (0x00001FFF << PATTERN_LIMIT_STRT_OFST)
|
||||
#define PATTERN_LIMIT_STP_OFST (16)
|
||||
#define PATTERN_LIMIT_STP_MSK (0x00001FFF << PATTERN_LIMIT_STP_OFST)
|
||||
|
||||
/** Pattern Loop and Wait Definitions, 5 regs each */
|
||||
#define PATTERN_LOOPDEF_BASE (0xA0 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_LOOP_ADDR_WORD_OFST (0)
|
||||
#define PATTERN_LOOP_ITERATION_WORD_OFST (1)
|
||||
#define PATTERN_WAIT_ADDR_WORD_OFST (2)
|
||||
#define PATTERN_WAIT_TIMER_LSB_WORD_OFST (3)
|
||||
#define PATTERN_WAIT_TIMER_MSB_WORD_OFST (4)
|
||||
#define PATTERN_LOOPDEF_NWORDS_OFST (5)
|
||||
/* Pattern Loop 0 Address RW regiser */
|
||||
#define PATTERN_LOOP_0_ADDR_REG (0x54 << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_WAIT_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_ADDR_MSK (0x00001FFF << PATTERN_WAIT_ADDR_OFST)
|
||||
#define PATTERN_LOOP_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_ADDR_STRT_MSK (0x00001FFF << PATTERN_LOOP_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_ADDR_STP_OFST)
|
||||
#define PATTERN_LOOP_0_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_0_ADDR_STRT_MSK \
|
||||
(0x00001FFF << PATTERN_LOOP_0_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_0_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_0_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_0_ADDR_STP_OFST)
|
||||
|
||||
/* Pattern Loop 0 Iteration RW regiser */
|
||||
#define PATTERN_LOOP_0_ITERATION_REG (0x55 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Loop 1 Address RW regiser */
|
||||
#define PATTERN_LOOP_1_ADDR_REG (0x56 << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_LOOP_1_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_1_ADDR_STRT_MSK \
|
||||
(0x00001FFF << PATTERN_LOOP_1_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_1_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_1_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_1_ADDR_STP_OFST)
|
||||
|
||||
/* Pattern Loop 1 Iteration RW regiser */
|
||||
#define PATTERN_LOOP_1_ITERATION_REG (0x57 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Loop 2 Address RW regiser */
|
||||
#define PATTERN_LOOP_2_ADDR_REG (0x58 << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_LOOP_2_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_2_ADDR_STRT_MSK \
|
||||
(0x00001FFF << PATTERN_LOOP_2_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_2_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_2_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_2_ADDR_STP_OFST)
|
||||
|
||||
/* Pattern Loop 2 Iteration RW regiser */
|
||||
#define PATTERN_LOOP_2_ITERATION_REG (0x59 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Wait 0 RW regiser */
|
||||
#define PATTERN_WAIT_0_ADDR_REG (0x5A << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_WAIT_0_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_0_ADDR_MSK (0x00001FFF << PATTERN_WAIT_0_ADDR_OFST)
|
||||
// FIXME: is mask 3FF
|
||||
|
||||
/* Pattern Wait 1 RW regiser */
|
||||
#define PATTERN_WAIT_1_ADDR_REG (0x5B << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_WAIT_1_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_1_ADDR_MSK (0x00001FFF << PATTERN_WAIT_1_ADDR_OFST)
|
||||
|
||||
/* Pattern Wait 2 RW regiser */
|
||||
#define PATTERN_WAIT_2_ADDR_REG (0x5C << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_WAIT_2_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_2_ADDR_MSK (0x00001FFF << PATTERN_WAIT_2_ADDR_OFST)
|
||||
|
||||
/* Samples RW register */
|
||||
#define SAMPLES_REG (0x32 << MEM_MAP_SHIFT)
|
||||
#define SAMPLES_REG (0x5D << MEM_MAP_SHIFT)
|
||||
|
||||
#define SAMPLES_DIGITAL_OFST (0)
|
||||
#define SAMPLES_DIGITAL_MSK (0x0000FFFF << SAMPLES_DIGITAL_OFST)
|
||||
@@ -434,7 +472,7 @@
|
||||
#define SAMPLES_ANALOG_MSK (0x0000FFFF << SAMPLES_ANALOG_OFST)
|
||||
|
||||
/** Power RW register */
|
||||
#define POWER_REG (0x33 << MEM_MAP_SHIFT)
|
||||
#define POWER_REG (0x5E << MEM_MAP_SHIFT)
|
||||
|
||||
#define POWER_ENBL_VLTG_RGLTR_OFST (16)
|
||||
#define POWER_ENBL_VLTG_RGLTR_MSK (0x0000001F << POWER_ENBL_VLTG_RGLTR_OFST)
|
||||
@@ -442,25 +480,25 @@
|
||||
#define POWER_HV_INTERNAL_SLCT_MSK (0x00000001 << POWER_HV_INTERNAL_SLCT_OFST)
|
||||
|
||||
/* Number of samples from transceiver RW register */
|
||||
#define SAMPLES_TRANSCEIVER_REG (0x34 << MEM_MAP_SHIFT)
|
||||
#define SAMPLES_TRANSCEIVER_REG (0x5F << MEM_MAP_SHIFT)
|
||||
#define SAMPLES_TRANSCEIVER_OFST (0)
|
||||
#define SAMPLES_TRANSCEIVER_MSK (0x0000FFFF << SAMPLES_TRANSCEIVER_OFST)
|
||||
|
||||
/* Delay 64 bit RW register. t = DLY x 50 ns. */
|
||||
#define DELAY_LSB_REG (0x8D << MEM_MAP_SHIFT)
|
||||
#define DELAY_MSB_REG (0x8E << MEM_MAP_SHIFT)
|
||||
#define DELAY_LSB_REG (0x60 << MEM_MAP_SHIFT)
|
||||
#define DELAY_MSB_REG (0x61 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Triggers 64 bit RW register */
|
||||
#define CYCLES_LSB_REG (0x8F << MEM_MAP_SHIFT)
|
||||
#define CYCLES_MSB_REG (0x90 << MEM_MAP_SHIFT)
|
||||
#define CYCLES_LSB_REG (0x62 << MEM_MAP_SHIFT)
|
||||
#define CYCLES_MSB_REG (0x63 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Frames 64 bit RW register */
|
||||
#define FRAMES_LSB_REG (0x91 << MEM_MAP_SHIFT)
|
||||
#define FRAMES_MSB_REG (0x92 << MEM_MAP_SHIFT)
|
||||
#define FRAMES_LSB_REG (0x64 << MEM_MAP_SHIFT)
|
||||
#define FRAMES_MSB_REG (0x65 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Period 64 bit RW register */
|
||||
#define PERIOD_LSB_REG (0x93 << MEM_MAP_SHIFT)
|
||||
#define PERIOD_MSB_REG (0x94 << MEM_MAP_SHIFT)
|
||||
#define PERIOD_LSB_REG (0x66 << MEM_MAP_SHIFT)
|
||||
#define PERIOD_MSB_REG (0x67 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Period 64 bit RW register */
|
||||
// #define EXPTIME_LSB_REG (0x68 << MEM_MAP_SHIFT) //
|
||||
@@ -475,15 +513,33 @@
|
||||
|
||||
/* Pattern IO Control 64 bit RW regiser
|
||||
* Each bit configured as output(1)/ input(0) */
|
||||
#define PATTERN_IO_CNTRL_LSB_REG (0x8A << MEM_MAP_SHIFT)
|
||||
#define PATTERN_IO_CNTRL_MSB_REG (0x8B << MEM_MAP_SHIFT)
|
||||
#define PATTERN_IO_CNTRL_LSB_REG (0x6C << MEM_MAP_SHIFT)
|
||||
#define PATTERN_IO_CNTRL_MSB_REG (0x6D << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern IO Clock Control 64 bit RW regiser
|
||||
* When bit n enabled (1), clocked output for DIO[n] (T run clock)
|
||||
* When bit n disabled (0), Dio[n] driven by its pattern output */
|
||||
#define PATTERN_IO_CLK_CNTRL_LSB_REG (0x6E << MEM_MAP_SHIFT)
|
||||
#define PATTERN_IO_CLK_CNTRL_MSB_REG (0x6F << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern In 64 bit RW register */
|
||||
#define PATTERN_IN_LSB_REG (0x82 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_IN_MSB_REG (0x83 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_IN_LSB_REG (0x70 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_IN_MSB_REG (0x71 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Wait Timer 0 64 bit RW register. t = PWT1 x T run clock */
|
||||
#define PATTERN_WAIT_TIMER_0_LSB_REG (0x72 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_WAIT_TIMER_0_MSB_REG (0x73 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Wait Timer 1 64 bit RW register. t = PWT2 x T run clock */
|
||||
#define PATTERN_WAIT_TIMER_1_LSB_REG (0x74 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_WAIT_TIMER_1_MSB_REG (0x75 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Wait Timer 2 64 bit RW register. t = PWT3 x T run clock */
|
||||
#define PATTERN_WAIT_TIMER_2_LSB_REG (0x76 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_WAIT_TIMER_2_MSB_REG (0x77 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Readout enable RW register */
|
||||
#define READOUT_10G_ENABLE_REG (0x3C << MEM_MAP_SHIFT)
|
||||
#define READOUT_10G_ENABLE_REG (0x79 << MEM_MAP_SHIFT)
|
||||
|
||||
#define READOUT_10G_ENABLE_ANLG_OFST (0)
|
||||
#define READOUT_10G_ENABLE_ANLG_MSK (0x000000FF << READOUT_10G_ENABLE_ANLG_OFST)
|
||||
@@ -494,7 +550,7 @@
|
||||
(0x0000000F << READOUT_10G_ENABLE_TRNSCVR_OFST)
|
||||
|
||||
/* Digital Bit External Trigger RW register */
|
||||
#define DBIT_EXT_TRG_REG (0x3E << MEM_MAP_SHIFT)
|
||||
#define DBIT_EXT_TRG_REG (0x7B << MEM_MAP_SHIFT)
|
||||
|
||||
#define DBIT_EXT_TRG_SRC_OFST (0)
|
||||
#define DBIT_EXT_TRG_SRC_MSK (0x0000003F << DBIT_EXT_TRG_SRC_OFST)
|
||||
@@ -502,7 +558,7 @@
|
||||
#define DBIT_EXT_TRG_OPRTN_MD_MSK (0x00000001 << DBIT_EXT_TRG_OPRTN_MD_OFST)
|
||||
|
||||
/* Pin Delay 0 RW register */
|
||||
#define OUTPUT_DELAY_0_REG (0x3F << MEM_MAP_SHIFT)
|
||||
#define OUTPUT_DELAY_0_REG (0x7C << MEM_MAP_SHIFT)
|
||||
#define OUTPUT_DELAY_0_OTPT_STTNG_STEPS (25)
|
||||
#define OUTPUT_DELAY_0_OTPT_STTNG_OFST \
|
||||
(0) // t = OTPT_STTNG * 25 ps, max for Cyclone V = 775 ps
|
||||
@@ -518,21 +574,87 @@
|
||||
|
||||
/* Pin Delay 1 RW register
|
||||
* Each bit configured as enable for dynamic output delay configuration */
|
||||
#define PIN_DELAY_1_REG (0x40 << MEM_MAP_SHIFT)
|
||||
#define PIN_DELAY_1_REG (0x7D << MEM_MAP_SHIFT)
|
||||
|
||||
/** Pattern Mask 64 bit RW regiser */
|
||||
#define PATTERN_MASK_LSB_REG (0x84 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_MASK_MSB_REG (0x85 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_MASK_LSB_REG (0x80 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_MASK_MSB_REG (0x81 << MEM_MAP_SHIFT)
|
||||
|
||||
/** Pattern Set 64 bit RW regiser */
|
||||
#define PATTERN_SET_LSB_REG (0x86 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_SET_MSB_REG (0x87 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_SET_LSB_REG (0x82 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_SET_MSB_REG (0x83 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Loop 3 Address RW regiser */
|
||||
#define PATTERN_LOOP_3_ADDR_REG (0x84 << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_LOOP_3_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_3_ADDR_STRT_MSK \
|
||||
(0x00001FFF << PATTERN_LOOP_3_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_3_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_3_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_3_ADDR_STP_OFST)
|
||||
|
||||
/* Pattern Loop 3 Iteration RW regiser */
|
||||
#define PATTERN_LOOP_3_ITERATION_REG (0x85 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Loop 4 Address RW regiser */
|
||||
#define PATTERN_LOOP_4_ADDR_REG (0x86 << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_LOOP_4_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_4_ADDR_STRT_MSK \
|
||||
(0x00001FFF << PATTERN_LOOP_4_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_4_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_4_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_4_ADDR_STP_OFST)
|
||||
|
||||
/* Pattern Loop 4 Iteration RW regiser */
|
||||
#define PATTERN_LOOP_4_ITERATION_REG (0x87 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Loop 5 Address RW regiser */
|
||||
#define PATTERN_LOOP_5_ADDR_REG (0x88 << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_LOOP_5_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_5_ADDR_STRT_MSK \
|
||||
(0x00001FFF << PATTERN_LOOP_5_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_5_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_5_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_5_ADDR_STP_OFST)
|
||||
|
||||
/* Pattern Loop 5 Iteration RW regiser */
|
||||
#define PATTERN_LOOP_5_ITERATION_REG (0x89 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Wait 3 RW regiser */
|
||||
#define PATTERN_WAIT_3_ADDR_REG (0x8A << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_WAIT_3_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_3_ADDR_MSK (0x00001FFF << PATTERN_WAIT_3_ADDR_OFST)
|
||||
|
||||
/* Pattern Wait 4 RW regiser */
|
||||
#define PATTERN_WAIT_4_ADDR_REG (0x8B << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_WAIT_4_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_4_ADDR_MSK (0x00001FFF << PATTERN_WAIT_4_ADDR_OFST)
|
||||
|
||||
/* Pattern Wait 5 RW regiser */
|
||||
#define PATTERN_WAIT_5_ADDR_REG (0x8C << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_WAIT_5_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_5_ADDR_MSK (0x00001FFF << PATTERN_WAIT_5_ADDR_OFST)
|
||||
|
||||
/* Pattern Wait Timer 3 64 bit RW register. t = PWT1 x T run clock */
|
||||
#define PATTERN_WAIT_TIMER_3_LSB_REG (0x8D << MEM_MAP_SHIFT)
|
||||
#define PATTERN_WAIT_TIMER_3_MSB_REG (0x8E << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Wait Timer 4 64 bit RW register. t = PWT1 x T run clock */
|
||||
#define PATTERN_WAIT_TIMER_4_LSB_REG (0x8F << MEM_MAP_SHIFT)
|
||||
#define PATTERN_WAIT_TIMER_4_MSB_REG (0x90 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Wait Timer 5 64 bit RW register. t = PWT1 x T run clock */
|
||||
#define PATTERN_WAIT_TIMER_5_LSB_REG (0x91 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_WAIT_TIMER_5_MSB_REG (0x92 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Slow ADC SPI Value RO register */
|
||||
#define ADC_SLOW_DATA_REG (0x41 << MEM_MAP_SHIFT)
|
||||
#define ADC_SLOW_DATA_REG (0x93 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Slow ADC SPI Value Config register */
|
||||
#define ADC_SLOW_CFG_REG (0x42 << MEM_MAP_SHIFT)
|
||||
#define ADC_SLOW_CFG_REG (0x94 << MEM_MAP_SHIFT)
|
||||
/** Read back CFG Register */
|
||||
#define ADC_SLOW_CFG_RB_OFST (2)
|
||||
#define ADC_SLOW_CFG_RB_MSK (0x00000001 << ADC_SLOW_CFG_RB_OFST)
|
||||
@@ -611,7 +733,7 @@
|
||||
((0x1 << ADC_SLOW_CFG_CFG_OFST) & ADC_SLOW_CFG_CFG_MSK)
|
||||
|
||||
/* Slow ADC SPI Value Control register */
|
||||
#define ADC_SLOW_CTRL_REG (0x43 << MEM_MAP_SHIFT)
|
||||
#define ADC_SLOW_CTRL_REG (0x95 << MEM_MAP_SHIFT)
|
||||
|
||||
#define ADC_SLOW_CTRL_STRT_OFST (0)
|
||||
#define ADC_SLOW_CTRL_STRT_MSK (0x00000001 << ADC_SLOW_CTRL_STRT_OFST)
|
||||
|
||||
Binary file not shown.
@@ -54,7 +54,6 @@
|
||||
#define DEFAULT_ADC_CLK (40) // 20
|
||||
#define DEFAULT_SYNC_CLK (40) // 20
|
||||
#define DEFAULT_DBIT_CLK (200)
|
||||
#define NS_TO_CLK_CYCLE (1E-3) // ns to MHz
|
||||
#define DEFAULT_TRANSCEIVER_MASK (0x3)
|
||||
|
||||
#define MAX_TRANSCEIVER_MASK (0xF)
|
||||
|
||||
@@ -30,8 +30,7 @@ target_compile_definitions(eigerDetectorServer_virtual
|
||||
)
|
||||
|
||||
target_link_libraries(eigerDetectorServer_virtual
|
||||
PUBLIC
|
||||
slsProjectCSettings
|
||||
PUBLIC pthread rt slsProjectCSettings
|
||||
)
|
||||
|
||||
set_target_properties(eigerDetectorServer_virtual PROPERTIES
|
||||
|
||||
BIN
slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServerv10.0.0
Executable file
BIN
slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServerv10.0.0
Executable file
Binary file not shown.
@@ -31,8 +31,7 @@ target_compile_definitions(gotthard2DetectorServer_virtual
|
||||
)
|
||||
|
||||
target_link_libraries(gotthard2DetectorServer_virtual
|
||||
PUBLIC
|
||||
slsProjectCSettings
|
||||
PUBLIC pthread rt slsProjectCSettings
|
||||
)
|
||||
|
||||
set_target_properties(gotthard2DetectorServer_virtual PROPERTIES
|
||||
|
||||
BIN
slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv10.0.0
Executable file
BIN
slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv10.0.0
Executable file
Binary file not shown.
@@ -29,8 +29,7 @@ target_compile_definitions(jungfrauDetectorServer_virtual
|
||||
)
|
||||
|
||||
target_link_libraries(jungfrauDetectorServer_virtual
|
||||
PUBLIC
|
||||
slsProjectCSettings
|
||||
PUBLIC pthread rt slsProjectCSettings
|
||||
)
|
||||
|
||||
set_target_properties(jungfrauDetectorServer_virtual PROPERTIES
|
||||
|
||||
BIN
slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv10.0.0
Executable file
BIN
slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv10.0.0
Executable file
Binary file not shown.
@@ -29,8 +29,7 @@ target_compile_definitions(moenchDetectorServer_virtual
|
||||
)
|
||||
|
||||
target_link_libraries(moenchDetectorServer_virtual
|
||||
PUBLIC
|
||||
slsProjectCSettings
|
||||
PUBLIC pthread rt slsProjectCSettings
|
||||
)
|
||||
|
||||
set_target_properties(moenchDetectorServer_virtual PROPERTIES
|
||||
|
||||
BIN
slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv10.0.0
Executable file
BIN
slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv10.0.0
Executable file
Binary file not shown.
@@ -33,8 +33,7 @@ target_compile_definitions(mythen3DetectorServer_virtual
|
||||
)
|
||||
|
||||
target_link_libraries(mythen3DetectorServer_virtual
|
||||
PUBLIC
|
||||
slsProjectCSettings
|
||||
PUBLIC pthread rt slsProjectCSettings
|
||||
)
|
||||
|
||||
set_target_properties(mythen3DetectorServer_virtual PROPERTIES
|
||||
|
||||
@@ -348,21 +348,68 @@
|
||||
#define PATTERN_SET_LSB_REG (0x44 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_SET_MSB_REG (0x45 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/** Pattern Loop and Wait Definitions, 5 regs each */
|
||||
#define PATTERN_LOOPDEF_BASE (0x60 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_LOOPDEF_NWORDS_OFST (5)
|
||||
#define PATTERN_WAIT_TIMER_LSB_WORD_OFST (0)
|
||||
#define PATTERN_WAIT_TIMER_MSB_WORD_OFST (1)
|
||||
#define PATTERN_WAIT_ADDR_WORD_OFST (2)
|
||||
#define PATTERN_LOOP_ITERATION_WORD_OFST (3)
|
||||
#define PATTERN_LOOP_ADDR_WORD_OFST (4)
|
||||
/* Pattern Wait Timer 0 64bit RW Register */
|
||||
#define PATTERN_WAIT_TIMER_0_LSB_REG (0x60 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_WAIT_TIMER_0_MSB_REG (0x61 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
#define PATTERN_WAIT_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_ADDR_MSK (0x00001FFF << PATTERN_WAIT_ADDR_OFST)
|
||||
#define PATTERN_LOOP_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_ADDR_STRT_MSK (0x00001FFF << PATTERN_LOOP_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_ADDR_STP_OFST)
|
||||
/* Pattern Wait 0 RW Register*/
|
||||
#define PATTERN_WAIT_0_ADDR_REG (0x62 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
#define PATTERN_WAIT_0_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_0_ADDR_MSK (0x00001FFF << PATTERN_WAIT_0_ADDR_OFST)
|
||||
|
||||
/* Pattern Loop 0 Iteration RW Register */
|
||||
#define PATTERN_LOOP_0_ITERATION_REG (0x63 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Pattern Loop 0 Address RW Register */
|
||||
#define PATTERN_LOOP_0_ADDR_REG (0x64 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
#define PATTERN_LOOP_0_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_0_ADDR_STRT_MSK (0x00001FFF << PATTERN_LOOP_0_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_0_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_0_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_0_ADDR_STP_OFST)
|
||||
|
||||
/* Pattern Wait Timer 1 64bit RW Register */
|
||||
#define PATTERN_WAIT_TIMER_1_LSB_REG (0x65 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_WAIT_TIMER_1_MSB_REG (0x66 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Pattern Wait 1 RW Register*/
|
||||
#define PATTERN_WAIT_1_ADDR_REG (0x67 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
#define PATTERN_WAIT_1_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_1_ADDR_MSK (0x00001FFF << PATTERN_WAIT_1_ADDR_OFST)
|
||||
|
||||
/* Pattern Loop 1 Iteration RW Register */
|
||||
#define PATTERN_LOOP_1_ITERATION_REG (0x68 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Pattern Loop 1 Address RW Register */
|
||||
#define PATTERN_LOOP_1_ADDR_REG (0x69 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
#define PATTERN_LOOP_1_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_1_ADDR_STRT_MSK (0x00001FFF << PATTERN_LOOP_1_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_1_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_1_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_1_ADDR_STP_OFST)
|
||||
|
||||
/* Pattern Wait Timer 2 64bit RW Register */
|
||||
#define PATTERN_WAIT_TIMER_2_LSB_REG (0x6A * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_WAIT_TIMER_2_MSB_REG (0x6B * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Pattern Wait 2 RW Register*/
|
||||
#define PATTERN_WAIT_2_ADDR_REG (0x6C * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
#define PATTERN_WAIT_2_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_2_ADDR_MSK (0x00001FFF << PATTERN_WAIT_2_ADDR_OFST)
|
||||
|
||||
/* Pattern Loop 2 Iteration RW Register */
|
||||
#define PATTERN_LOOP_2_ITERATION_REG (0x6D * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Pattern Loop 0 Address RW Register */
|
||||
#define PATTERN_LOOP_2_ADDR_REG (0x6E * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
#define PATTERN_LOOP_2_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_2_ADDR_STRT_MSK (0x00001FFF << PATTERN_LOOP_2_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_2_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_2_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_2_ADDR_STP_OFST)
|
||||
|
||||
/* Pattern RAM registers --------------------------------------------------*/
|
||||
|
||||
|
||||
BIN
slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv10.0.0
Executable file
BIN
slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv10.0.0
Executable file
Binary file not shown.
@@ -63,7 +63,6 @@
|
||||
#define DEFAULT_SYSTEM_C1 (6) //(166666666) // str_clk, 166 MHz const
|
||||
#define DEFAULT_SYSTEM_C2 (5) //(200000000) // smp_clk, 200 MHz const
|
||||
#define DEFAULT_TRIMMING_RUN_CLKDIV (40) // (25000000) // 25 MHz
|
||||
#define NS_TO_CLK_CYCLE (1E-3) // ns to MHz
|
||||
|
||||
#define FULL_SPEED_CLKDIV (10) //(100000000) 100 MHz
|
||||
#define HALF_SPEED_CLKDIV (20) //( 50000000) 50 MHz
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
int XILINX_PLL_setFrequency(uint32_t clk_index, uint32_t freq);
|
||||
uint32_t XILINX_PLL_getFrequency(uint32_t clkIDX);
|
||||
bool XILINX_PLL_isLocked();
|
||||
void XILINX_PLL_reset();
|
||||
void XILINX_PLL_waitForLock();
|
||||
void XILINX_PLL_load();
|
||||
@@ -6,9 +6,7 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
void bus_w(u_int32_t offset, u_int32_t data);
|
||||
void bus_w_csp2(u_int32_t offset, u_int32_t data);
|
||||
u_int32_t bus_r(u_int32_t offset);
|
||||
u_int32_t bus_r_csp2(u_int32_t offset);
|
||||
uint64_t getU64BitReg(int aLSB, int aMSB);
|
||||
void setU64BitReg(uint64_t value, int aLSB, int aMSB);
|
||||
u_int32_t readRegister(u_int32_t offset);
|
||||
|
||||
@@ -58,8 +58,7 @@ uint64_t getPatternMask();
|
||||
void setPatternBitMask(uint64_t mask);
|
||||
uint64_t getPatternBitMask();
|
||||
|
||||
#if defined(MYTHEN3D) || defined(XILINX_CHIPTESTBOARDD) || \
|
||||
defined(CHIPTESTBOARDD)
|
||||
#ifdef MYTHEN3D
|
||||
void startPattern();
|
||||
#endif
|
||||
char *getPatternFileName();
|
||||
|
||||
@@ -398,8 +398,8 @@ int getPower();
|
||||
void setPower(enum DACINDEX ind, int val);
|
||||
void powerOff();
|
||||
#elif XILINX_CHIPTESTBOARDD
|
||||
int getBitOffsetFromDACIndex(enum DACINDEX ind);
|
||||
int isPowerValid(enum DACINDEX ind, int val);
|
||||
|
||||
int getPower();
|
||||
void setPower(enum DACINDEX ind, int val);
|
||||
#endif
|
||||
@@ -518,6 +518,8 @@ int setPhase(enum CLKINDEX ind, int val, int degrees);
|
||||
int getPhase(enum CLKINDEX ind, int degrees);
|
||||
int getMaxPhase(enum CLKINDEX ind);
|
||||
int validatePhaseinDegrees(enum CLKINDEX ind, int val, int retval);
|
||||
int setFrequency(enum CLKINDEX ind, int val);
|
||||
int getFrequency(enum CLKINDEX ind);
|
||||
void configureSyncFrequency(enum CLKINDEX ind);
|
||||
void setADCPipeline(int val);
|
||||
int getADCPipeline();
|
||||
@@ -527,11 +529,6 @@ int setLEDEnable(int enable);
|
||||
void setDigitalIODelay(uint64_t pinMask, int delay);
|
||||
#endif
|
||||
|
||||
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
|
||||
int setFrequency(enum CLKINDEX ind, int val);
|
||||
int getFrequency(enum CLKINDEX ind);
|
||||
#endif
|
||||
|
||||
// jungfrau/moench specific - powerchip, autocompdisable, clockdiv, asictimer,
|
||||
// clock, pll, flashing firmware
|
||||
#if defined(MOENCHD)
|
||||
|
||||
@@ -1,201 +0,0 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "XILINX_PLL.h"
|
||||
#include "arm64.h"
|
||||
#include "clogger.h"
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
|
||||
// https://docs.amd.com/r/en-US/pg065-clk-wiz/Register-Space (simplified, we
|
||||
// leave some things away)
|
||||
|
||||
// clang-format off
|
||||
#define XILINX_PLL_INPUT_FREQ (100000) // 100 MHz
|
||||
#define XILINX_PLL_MIN_FREQ (10000)
|
||||
#define XILINX_PLL_MAX_FREQ (250000)
|
||||
#define XILINX_PLL_MAX_CLK_DIV (256)
|
||||
#define XILINX_PLL_NUM_CLKS (7)
|
||||
#define XILINX_PLL_MAX_NUM_CLKS_FOR_GET (3)
|
||||
#define XILINX_PLL_STEP_SIZE (125)
|
||||
#define XILINX_PLL_HALF_STEP_SIZE (62)
|
||||
|
||||
#define XILINX_PLL_BASE_ADDR (0x0)
|
||||
#define XILINX_PLL_MEASURE_BASE_ADDR0 (0x1000) // added externally, not part of CLKWIZ core for clks 0 and 1
|
||||
#define XILINX_PLL_MEASURE_BASE_ADDR0_MAX_CLKS (2)
|
||||
#define XILINX_PLL_MEASURE_BASE_ADDR1 (0x2000) // for clks 2 to 6
|
||||
#define XILINX_PLL_MEASURE_WIDTH (8) // per clock
|
||||
|
||||
#define XILINX_PLL_RESET_REG (0x000)
|
||||
#define XILINX_PLL_RESET_VAL (0xA)
|
||||
|
||||
#define XILINX_PLL_STATUS_REG (0x004)
|
||||
#define XILINX_PLL_STATUS_LOCKED_OFST (0)
|
||||
#define XILINX_PLL_STATUS_LOCKED_MSK (0x00000001 << XILINX_PLL_STATUS_LOCKED_OFST)
|
||||
|
||||
#define XILINX_PLL_CLKCONFIG_REG (XILINX_PLL_BASE_ADDR + 0x200)
|
||||
#define XILINX_PLL_DIVCLK_DIVIDE_OFST (0)
|
||||
#define XILINX_PLL_DIVCLK_DIVIDE_MSK (0x000000FF << XILINX_PLL_DIVCLK_DIVIDE_OFST)
|
||||
#define XILINX_PLL_CLKFBOUT_MULT_OFST (8)
|
||||
#define XILINX_PLL_CLKFBOUT_MULT_MSK (0x000000FF << XILINX_PLL_CLKFBOUT_MULT_OFST)
|
||||
#define XILINX_PLL_CLKFBOUT_FRAC_OFST (16)
|
||||
#define XILINX_PLL_CLKFBOUT_FRAC_MSK (0x000003FF << XILINX_PLL_CLKFBOUT_FRAC_OFST)
|
||||
// The value from 0 to 875 representing the fractional multiplied by 1000
|
||||
#define XILINX_PLL_CLKFBOUT_FRAC_MAX_VAL (875)
|
||||
|
||||
|
||||
#define XILINX_PLL_CLKCONFIG_BASE_ADDR (XILINX_PLL_BASE_ADDR + 0x208)
|
||||
#define XILINX_PLL_CLKCONFIG_WIDTH (3 * 4) // per clock (7 clocks)
|
||||
|
||||
#define XILINX_PLL_CLK_DIV_REG_OFST (0)
|
||||
#define XILINX_PLL_CLK_DIV_DIVIDE_OFST (0)
|
||||
#define XILINX_PLL_CLK_DIV_DIVIDE_MSK (0x000000FF << XILINX_PLL_CLK_DIV_DIVIDE_OFST)
|
||||
#define XILINX_PLL_CLK_DIV_FRAC_OFST (8) // works on IDX 0 only
|
||||
#define XILINX_PLL_CLK_DIV_FRAC_MSK (0x000003FF << XILINX_PLL_CLK_DIV_FRAC_OFST)
|
||||
|
||||
#define XILINX_PLL_CLK_PHASE_REG_OFST (4) // signed num for +/- phase
|
||||
#define XILINX_PLL_CLK_PHASE_OFST (0)
|
||||
#define XILINX_PLL_CLK_PHASE_MSK (0x0000FFFF << XILINX_PLL_CLK_PHASE_OFST)
|
||||
|
||||
#define XILINX_PLL_CLK_DUTY_REG_OFST (8) // (in %) * 1000
|
||||
#define XILINX_PLL_CLK_DUTY_OFST (0)
|
||||
#define XILINX_PLL_CLK_DUTY_MSK (0x0000FFFF << XILINX_PLL_CLK_DUTY_OFST)
|
||||
|
||||
|
||||
|
||||
#define XILINX_PLL_LOAD_REG (0x25C)
|
||||
#define XILINX_PLL_LOAD_RECONFIGURE_OFST (0) // load and reconfigure state machine
|
||||
#define XILINX_PLL_LOAD_RECONFIGURE_MSK (0x00000001 << XILINX_PLL_LOAD_RECONFIGURE_OFST)
|
||||
#define XILINX_PLL_LOAD_FROM_REGS_OFST (1) // 0 for default values as compiled into firmware
|
||||
#define XILINX_PLL_LOAD_FROM_REGS_MSK (0x00000001 << XILINX_PLL_LOAD_FROM_REGS_OFST)
|
||||
|
||||
// clang-format on
|
||||
|
||||
// freq in kHz !!
|
||||
int XILINX_PLL_setFrequency(uint32_t clk_index, uint32_t freq) {
|
||||
if (clk_index >= XILINX_PLL_NUM_CLKS) {
|
||||
LOG(logERROR, ("XILINX_PLL: Invalid clock index %d\n", clk_index));
|
||||
return 1;
|
||||
}
|
||||
if (freq < XILINX_PLL_MIN_FREQ || freq > XILINX_PLL_MAX_FREQ) {
|
||||
LOG(logERROR, ("XILINX_PLL: Frequency %d kHz is out of range\n", freq));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// calculate base clock frequency
|
||||
uint32_t global_reg = bus_r_csp2(XILINX_PLL_CLKCONFIG_REG);
|
||||
#ifdef VIRTUAL
|
||||
global_reg = 3073;
|
||||
#endif
|
||||
uint32_t clkfbout_mult = ((global_reg & XILINX_PLL_CLKFBOUT_MULT_MSK) >>
|
||||
XILINX_PLL_CLKFBOUT_MULT_OFST);
|
||||
uint32_t clkfbout_frac = ((global_reg & XILINX_PLL_CLKFBOUT_FRAC_MSK) >>
|
||||
XILINX_PLL_CLKFBOUT_FRAC_OFST);
|
||||
uint32_t divclk_divide = ((global_reg & XILINX_PLL_DIVCLK_DIVIDE_MSK) >>
|
||||
XILINX_PLL_DIVCLK_DIVIDE_OFST);
|
||||
uint32_t base_clk_freq = clkfbout_mult * XILINX_PLL_INPUT_FREQ;
|
||||
base_clk_freq += (clkfbout_frac * XILINX_PLL_INPUT_FREQ /
|
||||
XILINX_PLL_CLKFBOUT_FRAC_MAX_VAL);
|
||||
base_clk_freq /= divclk_divide;
|
||||
|
||||
// calcualte clock divider
|
||||
uint32_t clk_div = base_clk_freq / freq;
|
||||
if (clk_div < 1 || clk_div > XILINX_PLL_MAX_CLK_DIV) {
|
||||
LOG(logERROR,
|
||||
("XILINX_PLL: Invalid clock divider, need to change base clock\n"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint32_t clk_div_frac = 0;
|
||||
// the first clock supports fractional division, increase the precision for
|
||||
// that one fractional divide is not allowed in fixed or dynamic phase shift
|
||||
// mode !!!!
|
||||
if (clk_index == 0) {
|
||||
float clk_div_frac_f =
|
||||
(float)base_clk_freq / freq - clk_div; // eg. 2.333 => 0.333
|
||||
clk_div_frac = (uint32_t)round(clk_div_frac_f * 1000); // 0.333 => 333
|
||||
clk_div_frac = ((clk_div_frac + XILINX_PLL_HALF_STEP_SIZE) /
|
||||
XILINX_PLL_STEP_SIZE) *
|
||||
XILINX_PLL_STEP_SIZE; // round to multiples of step size,
|
||||
// 333 = > 375
|
||||
if (clk_div_frac == 1000) {
|
||||
clk_div_frac = 0;
|
||||
clk_div++;
|
||||
}
|
||||
}
|
||||
|
||||
LOG(logINFOBLUE, ("XILINX_PLL: Setting clock divider to %u.%u\n", clk_div,
|
||||
clk_div_frac));
|
||||
uint32_t clk_addr = XILINX_PLL_CLKCONFIG_BASE_ADDR +
|
||||
clk_index * XILINX_PLL_CLKCONFIG_WIDTH +
|
||||
XILINX_PLL_CLK_DIV_REG_OFST;
|
||||
uint32_t clk_config_val = ((clk_div << XILINX_PLL_CLK_DIV_DIVIDE_OFST) &
|
||||
XILINX_PLL_CLK_DIV_DIVIDE_MSK) |
|
||||
((clk_div_frac << XILINX_PLL_CLK_DIV_FRAC_OFST) &
|
||||
XILINX_PLL_CLK_DIV_FRAC_MSK);
|
||||
|
||||
bus_w_csp2(clk_addr, clk_config_val);
|
||||
XILINX_PLL_load();
|
||||
XILINX_PLL_waitForLock();
|
||||
|
||||
// wait for firmware to measure the actual frequency
|
||||
usleep(2 * 1000 * 1000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t XILINX_PLL_getFrequency(uint32_t clk_index) {
|
||||
if (clk_index >= XILINX_PLL_NUM_CLKS) {
|
||||
LOG(logERROR, ("XILINX_PLL: Invalid clock index %d\n", clk_index));
|
||||
return -1;
|
||||
}
|
||||
if (clk_index > XILINX_PLL_MAX_NUM_CLKS_FOR_GET) {
|
||||
LOG(logERROR,
|
||||
("XILINX_PLL: get frequency not implemented for this clock %d\n",
|
||||
clk_index));
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t base_addr = XILINX_PLL_MEASURE_BASE_ADDR0;
|
||||
if (clk_index >= XILINX_PLL_MEASURE_BASE_ADDR0_MAX_CLKS) {
|
||||
clk_index -= XILINX_PLL_MEASURE_BASE_ADDR0_MAX_CLKS;
|
||||
base_addr = XILINX_PLL_MEASURE_BASE_ADDR1;
|
||||
}
|
||||
uint32_t addr = base_addr + clk_index * XILINX_PLL_MEASURE_WIDTH;
|
||||
uint32_t counter_val = bus_r_csp2(addr);
|
||||
// Hz => round to nearest kHz
|
||||
uint32_t freq_kHz = (counter_val + 500) / 1000; // round to nearest kHz
|
||||
return freq_kHz;
|
||||
}
|
||||
|
||||
bool XILINX_PLL_isLocked() {
|
||||
uint32_t status = bus_r_csp2(XILINX_PLL_BASE_ADDR + XILINX_PLL_STATUS_REG);
|
||||
return ((status & XILINX_PLL_STATUS_LOCKED_MSK) >>
|
||||
XILINX_PLL_STATUS_LOCKED_OFST);
|
||||
}
|
||||
|
||||
void XILINX_PLL_reset() {
|
||||
bus_w_csp2(XILINX_PLL_BASE_ADDR + XILINX_PLL_RESET_REG,
|
||||
XILINX_PLL_RESET_VAL);
|
||||
}
|
||||
|
||||
void XILINX_PLL_load() {
|
||||
bus_w_csp2(
|
||||
XILINX_PLL_BASE_ADDR + XILINX_PLL_LOAD_REG,
|
||||
(XILINX_PLL_LOAD_RECONFIGURE_MSK | XILINX_PLL_LOAD_FROM_REGS_MSK));
|
||||
}
|
||||
|
||||
void XILINX_PLL_waitForLock() {
|
||||
#ifdef VIRTUAL
|
||||
return;
|
||||
#endif
|
||||
int timeout_us = 10 * 1000;
|
||||
int count = 500;
|
||||
while (count > 0) {
|
||||
usleep(timeout_us);
|
||||
if (XILINX_PLL_isLocked())
|
||||
return;
|
||||
count--;
|
||||
}
|
||||
LOG(logERROR, ("XILINX_PLL: Timeout waiting for PLL to lock (%d ms)\n",
|
||||
(count * timeout_us) / 1000));
|
||||
}
|
||||
@@ -13,14 +13,11 @@
|
||||
/* global variables */
|
||||
#define CSP0 (0xB0080000)
|
||||
#define CSP1 (0xB0050000) // udp
|
||||
#define CSP2 (0xA0000000)
|
||||
#define MEM_SIZE_CSP0 (0x20000)
|
||||
#define MEM_SIZE_CSP0 (0x10000)
|
||||
#define MEM_SIZE_CSP1 (0x2000) // smaller size for udp
|
||||
#define MEM_SIZE_CSP2 (0x4000)
|
||||
|
||||
u_int32_t *csp0base = 0;
|
||||
u_int32_t *csp1base = 0;
|
||||
u_int32_t *csp2base = 0;
|
||||
|
||||
void bus_w(u_int32_t offset, u_int32_t data) {
|
||||
volatile u_int32_t *ptr1;
|
||||
@@ -34,18 +31,6 @@ u_int32_t bus_r(u_int32_t offset) {
|
||||
return *ptr1;
|
||||
}
|
||||
|
||||
void bus_w_csp2(u_int32_t offset, u_int32_t data) {
|
||||
volatile u_int32_t *ptr1;
|
||||
ptr1 = (u_int32_t *)(csp2base + offset / (sizeof(u_int32_t)));
|
||||
*ptr1 = data;
|
||||
}
|
||||
|
||||
u_int32_t bus_r_csp2(u_int32_t offset) {
|
||||
volatile u_int32_t *ptr1;
|
||||
ptr1 = (u_int32_t *)(csp2base + offset / (sizeof(u_int32_t)));
|
||||
return *ptr1;
|
||||
}
|
||||
|
||||
uint64_t getU64BitReg(int aLSB, int aMSB) {
|
||||
uint64_t retval = bus_r(aMSB);
|
||||
retval = (retval << 32) | bus_r(aLSB);
|
||||
@@ -66,12 +51,12 @@ u_int32_t writeRegister(u_int32_t offset, u_int32_t data) {
|
||||
|
||||
int mapCSP0(void) {
|
||||
LOG(logINFO, ("Mapping memory\n"));
|
||||
u_int32_t csps[3] = {CSP0, CSP1, CSP2};
|
||||
u_int32_t **cspbases[3] = {&csp0base, &csp1base, &csp2base};
|
||||
u_int32_t memsize[3] = {MEM_SIZE_CSP0, MEM_SIZE_CSP1, MEM_SIZE_CSP2};
|
||||
char names[3][10] = {"csp0base", "csp1base", "csp2base"};
|
||||
u_int32_t csps[2] = {CSP0, CSP1};
|
||||
u_int32_t **cspbases[2] = {&csp0base, &csp1base};
|
||||
u_int32_t memsize[2] = {MEM_SIZE_CSP0, MEM_SIZE_CSP1};
|
||||
char names[2][10] = {"csp0base", "csp1base"};
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
// if not mapped
|
||||
if (*cspbases[i] == 0) {
|
||||
LOG(logINFO, ("\tMapping memory for %s\n", names[i]));
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
extern enum TLogLevel trimmingPrint;
|
||||
extern uint32_t clkDivider[];
|
||||
#endif
|
||||
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
|
||||
#ifdef CHIPTESTBOARDD
|
||||
extern uint32_t clkFrequency[];
|
||||
#endif
|
||||
|
||||
@@ -54,12 +54,27 @@ void initializePatternWord() {
|
||||
memset(virtual_pattern, 0, sizeof(virtual_pattern));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
|
||||
uint64_t validate_readPatternIOControl() {
|
||||
#if defined(CHIPTESTBOARDD)
|
||||
return getU64BitReg(PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG);
|
||||
#elif defined(XILINX_CHIPTESTBOARDD)
|
||||
return (uint64_t)(bus_r(PINIOCTRLREG));
|
||||
#endif
|
||||
}
|
||||
|
||||
int validate_writePatternIOControl(char *message, uint64_t arg) {
|
||||
// validate input
|
||||
#ifdef XILINX_CHIPTESTBOARDD
|
||||
if (arg > BIT32_MSK) {
|
||||
strcpy(message, "Could not set pattern IO Control. Must be 32 bit for "
|
||||
"this detector\n");
|
||||
LOG(logERROR, (message));
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
|
||||
writePatternIOControl(arg);
|
||||
|
||||
@@ -80,9 +95,15 @@ int validate_writePatternIOControl(char *message, uint64_t arg) {
|
||||
}
|
||||
|
||||
void writePatternIOControl(uint64_t word) {
|
||||
#ifdef CHIPTESTBOARDD
|
||||
LOG(logINFO,
|
||||
("Setting Pattern I/O Control: 0x%llx\n", (long long int)word));
|
||||
setU64BitReg(word, PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG);
|
||||
#elif defined(XILINX_CHIPTESTBOARDD)
|
||||
uint32_t val = (uint32_t)word;
|
||||
LOG(logINFO, ("Setting Pattern I/O Control: 0x%x\n", val));
|
||||
bus_w(PINIOCTRLREG, val);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -101,7 +122,7 @@ int validate_readPatternWord(char *message, int addr, uint64_t *word) {
|
||||
}
|
||||
|
||||
uint64_t readPatternWord(int addr) {
|
||||
#if defined(MYTHEN3D) || defined(XILINX_CHIPTESTBOARDD)
|
||||
#ifdef MYTHEN3D
|
||||
LOG(logDEBUG1, (" Reading Pattern Word (addr:0x%x)\n", addr));
|
||||
// the first word in RAM as base plus the offset of the word to write (addr)
|
||||
uint32_t reg_lsb = PATTERN_STEP0_LSB_REG + addr * REG_OFFSET * 2;
|
||||
@@ -161,7 +182,7 @@ void writePatternWord(int addr, uint64_t word) {
|
||||
LOG(logDEBUG1, ("Setting Pattern Word (addr:0x%x, word:0x%llx)\n", addr,
|
||||
(long long int)word));
|
||||
|
||||
#ifdef CHIPTESTBOARDD
|
||||
#ifndef MYTHEN3D
|
||||
uint32_t reg = PATTERN_CNTRL_REG;
|
||||
|
||||
// write word
|
||||
@@ -178,6 +199,7 @@ void writePatternWord(int addr, uint64_t word) {
|
||||
#ifdef VIRTUAL
|
||||
virtual_pattern[addr] = word;
|
||||
#endif
|
||||
// mythen
|
||||
#else
|
||||
// the first word in RAM as base plus the offset of the word to write (addr)
|
||||
uint32_t reg_lsb = PATTERN_STEP0_LSB_REG + addr * REG_OFFSET * 2;
|
||||
@@ -201,15 +223,29 @@ int validate_getPatternWaitAddresses(char *message, int level, int *addr) {
|
||||
}
|
||||
|
||||
int getPatternWaitAddress(int level) {
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
switch (level) {
|
||||
case 0:
|
||||
return ((bus_r(PATTERN_WAIT_0_ADDR_REG) & PATTERN_WAIT_0_ADDR_MSK) >>
|
||||
PATTERN_WAIT_0_ADDR_OFST);
|
||||
case 1:
|
||||
return ((bus_r(PATTERN_WAIT_1_ADDR_REG) & PATTERN_WAIT_1_ADDR_MSK) >>
|
||||
PATTERN_WAIT_1_ADDR_OFST);
|
||||
case 2:
|
||||
return ((bus_r(PATTERN_WAIT_2_ADDR_REG) & PATTERN_WAIT_2_ADDR_MSK) >>
|
||||
PATTERN_WAIT_2_ADDR_OFST);
|
||||
#ifndef MYTHEN3D
|
||||
case 3:
|
||||
return ((bus_r(PATTERN_WAIT_3_ADDR_REG) & PATTERN_WAIT_3_ADDR_MSK) >>
|
||||
PATTERN_WAIT_3_ADDR_OFST);
|
||||
case 4:
|
||||
return ((bus_r(PATTERN_WAIT_4_ADDR_REG) & PATTERN_WAIT_4_ADDR_MSK) >>
|
||||
PATTERN_WAIT_4_ADDR_OFST);
|
||||
case 5:
|
||||
return ((bus_r(PATTERN_WAIT_5_ADDR_REG) & PATTERN_WAIT_5_ADDR_MSK) >>
|
||||
PATTERN_WAIT_5_ADDR_OFST);
|
||||
#endif
|
||||
default:
|
||||
return -1;
|
||||
} else {
|
||||
return ((bus_r(PATTERN_LOOPDEF_BASE +
|
||||
(PATTERN_WAIT_ADDR_WORD_OFST +
|
||||
level * PATTERN_LOOPDEF_NWORDS_OFST) *
|
||||
REG_OFFSET) &
|
||||
PATTERN_WAIT_ADDR_MSK) >>
|
||||
PATTERN_WAIT_ADDR_OFST);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,13 +289,35 @@ void setPatternWaitAddress(int level, int addr) {
|
||||
LOG(logINFO,
|
||||
#endif
|
||||
("Setting Pattern Wait Address (level:%d, addr:0x%x)\n", level, addr));
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
switch (level) {
|
||||
case 0:
|
||||
bus_w(PATTERN_WAIT_0_ADDR_REG,
|
||||
((addr << PATTERN_WAIT_0_ADDR_OFST) & PATTERN_WAIT_0_ADDR_MSK));
|
||||
break;
|
||||
case 1:
|
||||
bus_w(PATTERN_WAIT_1_ADDR_REG,
|
||||
((addr << PATTERN_WAIT_1_ADDR_OFST) & PATTERN_WAIT_1_ADDR_MSK));
|
||||
break;
|
||||
case 2:
|
||||
bus_w(PATTERN_WAIT_2_ADDR_REG,
|
||||
((addr << PATTERN_WAIT_2_ADDR_OFST) & PATTERN_WAIT_2_ADDR_MSK));
|
||||
break;
|
||||
#ifndef MYTHEN3D
|
||||
case 3:
|
||||
bus_w(PATTERN_WAIT_3_ADDR_REG,
|
||||
((addr << PATTERN_WAIT_3_ADDR_OFST) & PATTERN_WAIT_3_ADDR_MSK));
|
||||
break;
|
||||
case 4:
|
||||
bus_w(PATTERN_WAIT_4_ADDR_REG,
|
||||
((addr << PATTERN_WAIT_4_ADDR_OFST) & PATTERN_WAIT_4_ADDR_MSK));
|
||||
break;
|
||||
case 5:
|
||||
bus_w(PATTERN_WAIT_5_ADDR_REG,
|
||||
((addr << PATTERN_WAIT_5_ADDR_OFST) & PATTERN_WAIT_5_ADDR_MSK));
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return;
|
||||
} else {
|
||||
bus_w(PATTERN_LOOPDEF_BASE + (PATTERN_WAIT_ADDR_WORD_OFST +
|
||||
level * PATTERN_LOOPDEF_NWORDS_OFST) *
|
||||
REG_OFFSET,
|
||||
((addr << PATTERN_WAIT_ADDR_OFST) & PATTERN_WAIT_ADDR_MSK));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,24 +340,39 @@ int validate_getPatternWaitClocksAndInterval(char *message, int level,
|
||||
}
|
||||
|
||||
uint64_t getPatternWaitClocks(int level) {
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
switch (level) {
|
||||
case 0:
|
||||
return getU64BitReg(PATTERN_WAIT_TIMER_0_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_0_MSB_REG);
|
||||
case 1:
|
||||
return getU64BitReg(PATTERN_WAIT_TIMER_1_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_1_MSB_REG);
|
||||
case 2:
|
||||
return getU64BitReg(PATTERN_WAIT_TIMER_2_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_2_MSB_REG);
|
||||
#ifndef MYTHEN3D
|
||||
case 3:
|
||||
return getU64BitReg(PATTERN_WAIT_TIMER_3_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_3_MSB_REG);
|
||||
case 4:
|
||||
return getU64BitReg(PATTERN_WAIT_TIMER_4_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_4_MSB_REG);
|
||||
case 5:
|
||||
return getU64BitReg(PATTERN_WAIT_TIMER_5_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_5_MSB_REG);
|
||||
#endif
|
||||
default:
|
||||
return -1;
|
||||
} else {
|
||||
return getU64BitReg(
|
||||
PATTERN_LOOPDEF_BASE + (PATTERN_WAIT_TIMER_LSB_WORD_OFST +
|
||||
level * PATTERN_LOOPDEF_NWORDS_OFST) *
|
||||
REG_OFFSET,
|
||||
PATTERN_LOOPDEF_BASE + (PATTERN_WAIT_TIMER_MSB_WORD_OFST +
|
||||
level * PATTERN_LOOPDEF_NWORDS_OFST) *
|
||||
REG_OFFSET);
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t getPatternWaitInterval(int level) {
|
||||
uint64_t numClocks = getPatternWaitClocks(level);
|
||||
int runclk = 0;
|
||||
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
|
||||
#ifdef CHIPTESTBOARDD
|
||||
runclk = clkFrequency[RUN_CLK];
|
||||
#elif XILINX_CHIPTESTBOARDD
|
||||
runclk = RUN_CLK;
|
||||
#elif MYTHEN3D
|
||||
runclk = clkDivider[SYSTEM_C0];
|
||||
#endif
|
||||
@@ -307,7 +380,7 @@ uint64_t getPatternWaitInterval(int level) {
|
||||
LOG(logERROR, ("runclk is 0. Cannot divide by 0. Returning -1.\n"));
|
||||
return -1;
|
||||
}
|
||||
return numClocks / (NS_TO_CLK_CYCLE * runclk);
|
||||
return numClocks / (1E-3 * runclk);
|
||||
}
|
||||
|
||||
int validate_setPatternWaitClocksAndInterval(char *message, int level,
|
||||
@@ -352,18 +425,35 @@ void setPatternWaitClocks(int level, uint64_t t) {
|
||||
#endif
|
||||
("Setting Pattern Wait Time in clocks (level:%d) :%lld\n", level,
|
||||
(long long int)t));
|
||||
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
switch (level) {
|
||||
case 0:
|
||||
setU64BitReg(t, PATTERN_WAIT_TIMER_0_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_0_MSB_REG);
|
||||
break;
|
||||
case 1:
|
||||
setU64BitReg(t, PATTERN_WAIT_TIMER_1_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_1_MSB_REG);
|
||||
break;
|
||||
case 2:
|
||||
setU64BitReg(t, PATTERN_WAIT_TIMER_2_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_2_MSB_REG);
|
||||
break;
|
||||
#ifndef MYTHEN3D
|
||||
case 3:
|
||||
setU64BitReg(t, PATTERN_WAIT_TIMER_3_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_3_MSB_REG);
|
||||
break;
|
||||
case 4:
|
||||
setU64BitReg(t, PATTERN_WAIT_TIMER_4_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_4_MSB_REG);
|
||||
break;
|
||||
case 5:
|
||||
setU64BitReg(t, PATTERN_WAIT_TIMER_5_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_5_MSB_REG);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return;
|
||||
} else {
|
||||
return setU64BitReg(
|
||||
t,
|
||||
PATTERN_LOOPDEF_BASE + (PATTERN_WAIT_TIMER_LSB_WORD_OFST +
|
||||
level * PATTERN_LOOPDEF_NWORDS_OFST) *
|
||||
REG_OFFSET,
|
||||
PATTERN_LOOPDEF_BASE + (PATTERN_WAIT_TIMER_MSB_WORD_OFST +
|
||||
level * PATTERN_LOOPDEF_NWORDS_OFST) *
|
||||
REG_OFFSET);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -376,12 +466,14 @@ void setPatternWaitInterval(int level, uint64_t t) {
|
||||
("Setting Pattern Wait Time (level:%d) :%lld ns\n", level,
|
||||
(long long int)t));
|
||||
int runclk = 0;
|
||||
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
|
||||
#ifdef CHIPTESTBOARDD
|
||||
runclk = clkFrequency[RUN_CLK];
|
||||
#elif XILINX_CHIPTESTBOARDD
|
||||
runclk = RUN_CLK;
|
||||
#elif MYTHEN3D
|
||||
runclk = clkDivider[SYSTEM_C0];
|
||||
runclk = clkDivider[SYSTEM_C0];
|
||||
#endif
|
||||
uint64_t numClocks = t * (NS_TO_CLK_CYCLE * runclk);
|
||||
uint64_t numClocks = t * (1E-3 * runclk);
|
||||
setPatternWaitClocks(level, numClocks);
|
||||
}
|
||||
|
||||
@@ -399,13 +491,23 @@ int validate_getPatternLoopCycles(char *message, int level, int *numLoops) {
|
||||
}
|
||||
|
||||
int getPatternLoopCycles(int level) {
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
switch (level) {
|
||||
case 0:
|
||||
return bus_r(PATTERN_LOOP_0_ITERATION_REG);
|
||||
case 1:
|
||||
return bus_r(PATTERN_LOOP_1_ITERATION_REG);
|
||||
case 2:
|
||||
return bus_r(PATTERN_LOOP_2_ITERATION_REG);
|
||||
#ifndef MYTHEN3D
|
||||
case 3:
|
||||
return bus_r(PATTERN_LOOP_3_ITERATION_REG);
|
||||
case 4:
|
||||
return bus_r(PATTERN_LOOP_4_ITERATION_REG);
|
||||
case 5:
|
||||
return bus_r(PATTERN_LOOP_5_ITERATION_REG);
|
||||
#endif
|
||||
default:
|
||||
return -1;
|
||||
} else {
|
||||
return bus_r(PATTERN_LOOPDEF_BASE +
|
||||
(PATTERN_LOOP_ITERATION_WORD_OFST +
|
||||
level * PATTERN_LOOPDEF_NWORDS_OFST) *
|
||||
REG_OFFSET);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,13 +546,29 @@ void setPatternLoopCycles(int level, int nLoop) {
|
||||
LOG(logINFO,
|
||||
#endif
|
||||
("Setting Pattern Loop Cycles(level:%d, nLoop:%d)\n", level, nLoop));
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
switch (level) {
|
||||
case 0:
|
||||
bus_w(PATTERN_LOOP_0_ITERATION_REG, nLoop);
|
||||
break;
|
||||
case 1:
|
||||
bus_w(PATTERN_LOOP_1_ITERATION_REG, nLoop);
|
||||
break;
|
||||
case 2:
|
||||
bus_w(PATTERN_LOOP_2_ITERATION_REG, nLoop);
|
||||
break;
|
||||
#ifndef MYTHEN3D
|
||||
case 3:
|
||||
bus_w(PATTERN_LOOP_3_ITERATION_REG, nLoop);
|
||||
break;
|
||||
case 4:
|
||||
bus_w(PATTERN_LOOP_4_ITERATION_REG, nLoop);
|
||||
break;
|
||||
case 5:
|
||||
bus_w(PATTERN_LOOP_5_ITERATION_REG, nLoop);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return;
|
||||
} else {
|
||||
bus_w(PATTERN_LOOPDEF_BASE + (PATTERN_LOOP_ITERATION_WORD_OFST +
|
||||
level * PATTERN_LOOPDEF_NWORDS_OFST) *
|
||||
REG_OFFSET,
|
||||
nLoop);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,22 +639,59 @@ int validate_getPatternLoopAddresses(char *message, int level, int *startAddr,
|
||||
}
|
||||
|
||||
void getPatternLoopAddresses(int level, int *startAddr, int *stopAddr) {
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
*startAddr = -1;
|
||||
*stopAddr = -1;
|
||||
} else {
|
||||
*startAddr = ((bus_r(PATTERN_LOOPDEF_BASE +
|
||||
(PATTERN_LOOP_ADDR_WORD_OFST +
|
||||
level * PATTERN_LOOPDEF_NWORDS_OFST) *
|
||||
REG_OFFSET) &
|
||||
PATTERN_LOOP_ADDR_STRT_MSK) >>
|
||||
PATTERN_LOOP_ADDR_STRT_OFST);
|
||||
*stopAddr = ((bus_r(PATTERN_LOOPDEF_BASE +
|
||||
(PATTERN_LOOP_ADDR_WORD_OFST +
|
||||
level * PATTERN_LOOPDEF_NWORDS_OFST) *
|
||||
REG_OFFSET) &
|
||||
PATTERN_LOOP_ADDR_STP_MSK) >>
|
||||
PATTERN_LOOP_ADDR_STP_OFST);
|
||||
switch (level) {
|
||||
case 0:
|
||||
*startAddr =
|
||||
((bus_r(PATTERN_LOOP_0_ADDR_REG) & PATTERN_LOOP_0_ADDR_STRT_MSK) >>
|
||||
PATTERN_LOOP_0_ADDR_STRT_OFST);
|
||||
*stopAddr =
|
||||
((bus_r(PATTERN_LOOP_0_ADDR_REG) & PATTERN_LOOP_0_ADDR_STP_MSK) >>
|
||||
PATTERN_LOOP_0_ADDR_STP_OFST);
|
||||
break;
|
||||
case 1:
|
||||
*startAddr =
|
||||
((bus_r(PATTERN_LOOP_1_ADDR_REG) & PATTERN_LOOP_1_ADDR_STRT_MSK) >>
|
||||
PATTERN_LOOP_1_ADDR_STRT_OFST);
|
||||
*stopAddr =
|
||||
((bus_r(PATTERN_LOOP_1_ADDR_REG) & PATTERN_LOOP_1_ADDR_STP_MSK) >>
|
||||
PATTERN_LOOP_1_ADDR_STP_OFST);
|
||||
break;
|
||||
case 2:
|
||||
*startAddr =
|
||||
((bus_r(PATTERN_LOOP_2_ADDR_REG) & PATTERN_LOOP_2_ADDR_STRT_MSK) >>
|
||||
PATTERN_LOOP_2_ADDR_STRT_OFST);
|
||||
*stopAddr =
|
||||
((bus_r(PATTERN_LOOP_2_ADDR_REG) & PATTERN_LOOP_2_ADDR_STP_MSK) >>
|
||||
PATTERN_LOOP_2_ADDR_STP_OFST);
|
||||
break;
|
||||
#ifndef MYTHEN3D
|
||||
case 3:
|
||||
*startAddr =
|
||||
((bus_r(PATTERN_LOOP_3_ADDR_REG) & PATTERN_LOOP_3_ADDR_STRT_MSK) >>
|
||||
PATTERN_LOOP_3_ADDR_STRT_OFST);
|
||||
*stopAddr =
|
||||
((bus_r(PATTERN_LOOP_3_ADDR_REG) & PATTERN_LOOP_3_ADDR_STP_MSK) >>
|
||||
PATTERN_LOOP_3_ADDR_STP_OFST);
|
||||
break;
|
||||
case 4:
|
||||
*startAddr =
|
||||
((bus_r(PATTERN_LOOP_4_ADDR_REG) & PATTERN_LOOP_4_ADDR_STRT_MSK) >>
|
||||
PATTERN_LOOP_4_ADDR_STRT_OFST);
|
||||
*stopAddr =
|
||||
((bus_r(PATTERN_LOOP_4_ADDR_REG) & PATTERN_LOOP_4_ADDR_STP_MSK) >>
|
||||
PATTERN_LOOP_4_ADDR_STP_OFST);
|
||||
break;
|
||||
case 5:
|
||||
*startAddr =
|
||||
((bus_r(PATTERN_LOOP_5_ADDR_REG) & PATTERN_LOOP_5_ADDR_STRT_MSK) >>
|
||||
PATTERN_LOOP_5_ADDR_STRT_OFST);
|
||||
*stopAddr =
|
||||
((bus_r(PATTERN_LOOP_5_ADDR_REG) & PATTERN_LOOP_5_ADDR_STP_MSK) >>
|
||||
PATTERN_LOOP_5_ADDR_STP_OFST);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -592,16 +747,53 @@ void setPatternLoopAddresses(int level, int startAddr, int stopAddr) {
|
||||
("Setting Pattern Loop Address (level:%d, startaddr:0x%x, "
|
||||
"stopaddr:0x%x)\n",
|
||||
level, startAddr, stopAddr));
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
switch (level) {
|
||||
case 0:
|
||||
bus_w(PATTERN_LOOP_0_ADDR_REG,
|
||||
((startAddr << PATTERN_LOOP_0_ADDR_STRT_OFST) &
|
||||
PATTERN_LOOP_0_ADDR_STRT_MSK) |
|
||||
((stopAddr << PATTERN_LOOP_0_ADDR_STP_OFST) &
|
||||
PATTERN_LOOP_0_ADDR_STP_MSK));
|
||||
break;
|
||||
case 1:
|
||||
bus_w(PATTERN_LOOP_1_ADDR_REG,
|
||||
((startAddr << PATTERN_LOOP_1_ADDR_STRT_OFST) &
|
||||
PATTERN_LOOP_1_ADDR_STRT_MSK) |
|
||||
((stopAddr << PATTERN_LOOP_1_ADDR_STP_OFST) &
|
||||
PATTERN_LOOP_1_ADDR_STP_MSK));
|
||||
break;
|
||||
case 2:
|
||||
bus_w(PATTERN_LOOP_2_ADDR_REG,
|
||||
((startAddr << PATTERN_LOOP_2_ADDR_STRT_OFST) &
|
||||
PATTERN_LOOP_2_ADDR_STRT_MSK) |
|
||||
((stopAddr << PATTERN_LOOP_2_ADDR_STP_OFST) &
|
||||
PATTERN_LOOP_2_ADDR_STP_MSK));
|
||||
break;
|
||||
#ifndef MYTHEN3D
|
||||
case 3:
|
||||
bus_w(PATTERN_LOOP_3_ADDR_REG,
|
||||
((startAddr << PATTERN_LOOP_3_ADDR_STRT_OFST) &
|
||||
PATTERN_LOOP_3_ADDR_STRT_MSK) |
|
||||
((stopAddr << PATTERN_LOOP_3_ADDR_STP_OFST) &
|
||||
PATTERN_LOOP_3_ADDR_STP_MSK));
|
||||
break;
|
||||
case 4:
|
||||
bus_w(PATTERN_LOOP_4_ADDR_REG,
|
||||
((startAddr << PATTERN_LOOP_4_ADDR_STRT_OFST) &
|
||||
PATTERN_LOOP_4_ADDR_STRT_MSK) |
|
||||
((stopAddr << PATTERN_LOOP_4_ADDR_STP_OFST) &
|
||||
PATTERN_LOOP_4_ADDR_STP_MSK));
|
||||
break;
|
||||
case 5:
|
||||
bus_w(PATTERN_LOOP_5_ADDR_REG,
|
||||
((startAddr << PATTERN_LOOP_5_ADDR_STRT_OFST) &
|
||||
PATTERN_LOOP_5_ADDR_STRT_MSK) |
|
||||
((stopAddr << PATTERN_LOOP_5_ADDR_STP_OFST) &
|
||||
PATTERN_LOOP_5_ADDR_STP_MSK));
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return;
|
||||
} else {
|
||||
bus_w(PATTERN_LOOPDEF_BASE + (PATTERN_LOOP_ADDR_WORD_OFST +
|
||||
level * PATTERN_LOOPDEF_NWORDS_OFST) *
|
||||
REG_OFFSET,
|
||||
((startAddr << PATTERN_LOOP_ADDR_STRT_OFST) &
|
||||
PATTERN_LOOP_ADDR_STRT_MSK) |
|
||||
((stopAddr << PATTERN_LOOP_ADDR_STP_OFST) &
|
||||
PATTERN_LOOP_ADDR_STP_MSK));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -623,43 +815,17 @@ uint64_t getPatternBitMask() {
|
||||
return getU64BitReg(PATTERN_SET_LSB_REG, PATTERN_SET_MSB_REG);
|
||||
}
|
||||
|
||||
#ifdef MYTHEN3D
|
||||
void startPattern() {
|
||||
LOG(logINFOBLUE, ("Starting Pattern\n"));
|
||||
#ifdef MYTHEN3D
|
||||
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STRT_PATTERN_MSK);
|
||||
usleep(1);
|
||||
while (bus_r(PAT_STATUS_REG) & PAT_STATUS_RUN_BUSY_MSK) {
|
||||
usleep(1);
|
||||
}
|
||||
#elif CHIPTESTBOARDD
|
||||
// we only want to run the pattern here. No acquisition, no UDP packets
|
||||
|
||||
// disable 10G UDP temporarily
|
||||
// except if the pattern explicitly contains udp trigger points
|
||||
uint32_t conf_reg_tmp = bus_r(CONFIG_REG);
|
||||
if ((bus_r(STREAMING_CTRL_REG) & STREAMING_CTRL_ENA_MSK) == 0) {
|
||||
bus_w(CONFIG_REG, conf_reg_tmp & ~CONFIG_GB10_SND_UDP_MSK);
|
||||
}
|
||||
|
||||
// run the pattern, wait till done
|
||||
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STRT_ACQSTN_MSK);
|
||||
bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_STRT_ACQSTN_MSK);
|
||||
usleep(1);
|
||||
while (bus_r(STATUS_REG) & STATUS_RN_BSY_MSK) {
|
||||
usleep(1);
|
||||
}
|
||||
|
||||
// go back to original config
|
||||
bus_w(CONFIG_REG, conf_reg_tmp);
|
||||
#elif XILINX_CHIPTESTBOARDD
|
||||
bus_w(FLOW_CONTROL_REG, bus_r(FLOW_CONTROL_REG) | START_F_MSK);
|
||||
usleep(1);
|
||||
while (bus_r(FLOW_CONTROL_REG) & RSM_BUSY_MSK) {
|
||||
usleep(1);
|
||||
}
|
||||
#endif
|
||||
LOG(logINFOBLUE, ("Pattern done\n"));
|
||||
}
|
||||
#endif
|
||||
|
||||
char *getPatternFileName() { return clientPatternfile; }
|
||||
|
||||
|
||||
@@ -5798,7 +5798,7 @@ int set_clock_frequency(int file_des) {
|
||||
return printSocketReadError();
|
||||
LOG(logDEBUG1, ("Setting clock (%d) frequency : %u\n", args[0], args[1]));
|
||||
|
||||
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD)
|
||||
#if !defined(CHIPTESTBOARDD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
|
||||
@@ -5811,7 +5811,7 @@ int set_clock_frequency(int file_des) {
|
||||
case ADC_CLOCK:
|
||||
c = ADC_CLK;
|
||||
break;
|
||||
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
|
||||
#ifdef CHIPTESTBOARDD
|
||||
case DBIT_CLOCK:
|
||||
c = DBIT_CLK;
|
||||
break;
|
||||
@@ -5839,24 +5839,11 @@ int set_clock_frequency(int file_des) {
|
||||
LOG(logINFO, ("Same %s: %d %s\n", modeName, val,
|
||||
myDetectorType == GOTTHARD2 ? "Hz" : "MHz"));
|
||||
} else {
|
||||
int ret = setFrequency(c, val);
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess, "Could not set %s to %d %s\n", modeName, val,
|
||||
myDetectorType == XILINX_CHIPTESTBOARD ? "kHz"
|
||||
: "MHz");
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
int retval = getFrequency(c);
|
||||
LOG(logDEBUG1,
|
||||
("retval %s: %d %s\n", modeName, retval,
|
||||
myDetectorType == XILINX_CHIPTESTBOARD ? "kHz"
|
||||
: "MHz"));
|
||||
#if !defined(XILINX_CHIPTESTBOARDD)
|
||||
// XCTB will give the actual frequency, which is not
|
||||
// 100% identical to the set frequency
|
||||
validate(&ret, mess, val, retval, modeName, DEC);
|
||||
#endif
|
||||
}
|
||||
setFrequency(c, val);
|
||||
int retval = getFrequency(c);
|
||||
LOG(logDEBUG1, ("retval %s: %d %s\n", modeName, retval,
|
||||
myDetectorType == GOTTHARD2 ? "Hz" : "MHz"));
|
||||
validate(&ret, mess, val, retval, modeName, DEC);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5874,14 +5861,13 @@ int get_clock_frequency(int file_des) {
|
||||
return printSocketReadError();
|
||||
LOG(logDEBUG1, ("Getting clock (%d) frequency\n", arg));
|
||||
|
||||
#if !defined(CHIPTESTBOARDD) && !defined(GOTTHARD2D) && !defined(MYTHEN3D) && \
|
||||
!defined(XILINX_CHIPTESTBOARDD)
|
||||
#if !defined(CHIPTESTBOARDD) && !defined(GOTTHARD2D) && !defined(MYTHEN3D)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
enum CLKINDEX c = 0;
|
||||
switch (arg) {
|
||||
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
|
||||
#if defined(CHIPTESTBOARDD)
|
||||
case ADC_CLOCK:
|
||||
c = ADC_CLK;
|
||||
break;
|
||||
@@ -5911,11 +5897,8 @@ int get_clock_frequency(int file_des) {
|
||||
LOG(logDEBUG1,
|
||||
("retval %s clock (%d) frequency: %d %s\n", clock_names[c], (int)c,
|
||||
retval,
|
||||
myDetectorType == XILINX_CHIPTESTBOARD
|
||||
? "kHz"
|
||||
: (myDetectorType == GOTTHARD2 || myDetectorType == MYTHEN3
|
||||
? "Hz"
|
||||
: "MHz")));
|
||||
myDetectorType == GOTTHARD2 || myDetectorType == MYTHEN3 ? "Hz"
|
||||
: "MHz"));
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
@@ -7480,8 +7463,7 @@ int start_pattern(int file_des) {
|
||||
memset(mess, 0, sizeof(mess));
|
||||
|
||||
LOG(logDEBUG1, ("Starting Pattern\n"));
|
||||
#if !defined(MYTHEN3D) && !defined(XILINX_CHIPTESTBOARDD) && \
|
||||
!defined(CHIPTESTBOARDD)
|
||||
#ifndef MYTHEN3D
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
|
||||
@@ -6,7 +6,6 @@ add_executable(xilinx_ctbDetectorServer_virtual
|
||||
../slsDetectorServer/src/slsDetectorServer_funcs.c
|
||||
../slsDetectorServer/src/communication_funcs.c
|
||||
../slsDetectorServer/src/arm64.c
|
||||
../slsDetectorServer/src/XILINX_PLL.c
|
||||
../slsDetectorServer/src/common.c
|
||||
../slsDetectorServer/src/sharedMemory.c
|
||||
../slsDetectorServer/src/loadPattern.c
|
||||
@@ -31,9 +30,7 @@ target_compile_definitions(xilinx_ctbDetectorServer_virtual
|
||||
)
|
||||
|
||||
target_link_libraries(xilinx_ctbDetectorServer_virtual
|
||||
PUBLIC
|
||||
m
|
||||
slsProjectCSettings
|
||||
PUBLIC pthread rt m slsProjectCSettings
|
||||
)
|
||||
|
||||
set_target_properties(xilinx_ctbDetectorServer_virtual PROPERTIES
|
||||
|
||||
@@ -23,7 +23,7 @@ DESTDIR ?= bin
|
||||
INSTMODE = 0777
|
||||
|
||||
SRCS = slsDetectorFunctionList.c
|
||||
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)arm64.c $(main_src)XILINX_PLL.c $(main_src)common.c $(main_src)/sharedMemory.c $(main_src)/loadPattern.c $(md5_dir)md5.c $(main_src)programViaArm.c $(main_src)LTC2620_Driver.c
|
||||
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)arm64.c $(main_src)common.c $(main_src)/sharedMemory.c $(main_src)/loadPattern.c $(md5_dir)md5.c $(main_src)programViaArm.c $(main_src)LTC2620_Driver.c
|
||||
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
|
||||
@@ -2,16 +2,10 @@
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#pragma once
|
||||
|
||||
// clang-format off
|
||||
|
||||
#define REG_OFFSET (4)
|
||||
#define PATTERN_STEP0_MSB_REG (0x10004)
|
||||
#define PATTERN_STEP0_LSB_REG (0x10000)
|
||||
|
||||
#define CTRL_REG (0x8000)
|
||||
|
||||
#define POWER_VIO_OFST (0)
|
||||
#define POWER_VIO_MSK (0x00000001 << POWER_VIO_OFST)
|
||||
#define POWER_VIO_OFST (0)
|
||||
#define POWER_VIO_MSK (0x00000001 << POWER_VIO_OFST)
|
||||
#define POWER_VCC_A_OFST (1)
|
||||
#define POWER_VCC_A_MSK (0x00000001 << POWER_VCC_A_OFST)
|
||||
#define POWER_VCC_B_OFST (2)
|
||||
@@ -23,20 +17,20 @@
|
||||
|
||||
#define STATUS_REG (0x8004)
|
||||
|
||||
#define PATTERN_RUNNING_OFST (0)
|
||||
#define PATTERN_RUNNING_MSK (0x00000001 << PATTERN_RUNNING_OFST)
|
||||
#define RX_BUSY_OFST (1)
|
||||
#define RX_BUSY_MSK (0x00000001 << RX_BUSY_OFST)
|
||||
#define PROCESSING_BUSY_OFST (2)
|
||||
#define PROCESSING_BUSY_MSK (0x00000001 << PROCESSING_BUSY_OFST)
|
||||
#define UDP_GEN_BUSY_OFST (3)
|
||||
#define UDP_GEN_BUSY_MSK (0x00000001 << UDP_GEN_BUSY_OFST)
|
||||
#define NETWORK_BUSY_OFST (4)
|
||||
#define NETWORK_BUSY_MSK (0x00000001 << NETWORK_BUSY_OFST)
|
||||
#define PATTERN_RUNNING_OFST (0)
|
||||
#define PATTERN_RUNNING_MSK (0x00000001 << PATTERN_RUNNING_OFST)
|
||||
#define RX_BUSY_OFST (1)
|
||||
#define RX_BUSY_MSK (0x00000001 << RX_BUSY_OFST)
|
||||
#define PROCESSING_BUSY_OFST (2)
|
||||
#define PROCESSING_BUSY_MSK (0x00000001 << PROCESSING_BUSY_OFST)
|
||||
#define UDP_GEN_BUSY_OFST (3)
|
||||
#define UDP_GEN_BUSY_MSK (0x00000001 << UDP_GEN_BUSY_OFST)
|
||||
#define NETWORK_BUSY_OFST (4)
|
||||
#define NETWORK_BUSY_MSK (0x00000001 << NETWORK_BUSY_OFST)
|
||||
#define WAIT_FOR_TRIGGER_OFST (5)
|
||||
#define WAIT_FOR_TRIGGER_MSK (0x00000001 << WAIT_FOR_TRIGGER_OFST)
|
||||
#define RX_NOT_GOOD_OFST (6)
|
||||
#define RX_NOT_GOOD_MSK (0x00000001 << RX_NOT_GOOD_OFST)
|
||||
#define RX_NOT_GOOD_OFST (6)
|
||||
#define RX_NOT_GOOD_MSK (0x00000001 << RX_NOT_GOOD_OFST)
|
||||
|
||||
#define STATUS_REG2 (0x8008)
|
||||
|
||||
@@ -44,8 +38,8 @@
|
||||
|
||||
#define FPGACOMPDATE_OFST (0)
|
||||
#define FPGACOMPDATE_MSK (0x00ffffff << FPGACOMPDATE_OFST)
|
||||
#define FPGADETTYPE_OFST (24)
|
||||
#define FPGADETTYPE_MSK (0x000000ff << FPGADETTYPE_OFST)
|
||||
#define FPGADETTYPE_OFST (24)
|
||||
#define FPGADETTYPE_MSK (0x000000ff << FPGADETTYPE_OFST)
|
||||
|
||||
#define FPGA_GIT_HEAD (0x8010)
|
||||
|
||||
@@ -56,8 +50,8 @@
|
||||
|
||||
#define APICOMPDATE_OFST (0)
|
||||
#define APICOMPDATE_MSK (0x00ffffff << APICOMPDATE_OFST)
|
||||
#define APIDETTYPE_OFST (24)
|
||||
#define APIDETTYPE_MSK (0x000000ff << APIDETTYPE_OFST)
|
||||
#define APIDETTYPE_OFST (24)
|
||||
#define APIDETTYPE_MSK (0x000000ff << APIDETTYPE_OFST)
|
||||
|
||||
#define A_FIFO_OVERFLOW_STATUS_REG (0x9000)
|
||||
|
||||
@@ -109,22 +103,23 @@
|
||||
|
||||
#define FIFO_TO_GB_CONTROL_REG (0xA000)
|
||||
|
||||
#define ENABLED_CHANNELS_ADC_OFST (0)
|
||||
#define ENABLED_CHANNELS_ADC_MSK (0x000000ff << ENABLED_CHANNELS_ADC_OFST)
|
||||
#define ENABLED_CHANNELS_D_OFST (8)
|
||||
#define ENABLED_CHANNELS_D_MSK (0x00000001 << ENABLED_CHANNELS_D_OFST)
|
||||
#define ENABLED_CHANNELS_X_OFST (9)
|
||||
#define ENABLED_CHANNELS_X_MSK (0x0000000f << ENABLED_CHANNELS_X_OFST)
|
||||
#define RO_MODE_ADC_OFST (13)
|
||||
#define RO_MODE_ADC_MSK (0x00000001 << RO_MODE_ADC_OFST)
|
||||
#define RO_MODE_D_OFST (14)
|
||||
#define RO_MODE_D_MSK (0x00000001 << RO_MODE_D_OFST)
|
||||
#define RO_MODE_X_OFST (15)
|
||||
#define RO_MODE_X_MSK (0x00000001 << RO_MODE_X_OFST)
|
||||
#define ENABLED_CHANNELS_ADC_OFST (0)
|
||||
#define ENABLED_CHANNELS_ADC_MSK (0x000000ff << ENABLED_CHANNELS_ADC_OFST)
|
||||
#define ENABLED_CHANNELS_D_OFST (8)
|
||||
#define ENABLED_CHANNELS_D_MSK (0x00000001 << ENABLED_CHANNELS_D_OFST)
|
||||
#define ENABLED_CHANNELS_X_OFST (9)
|
||||
#define ENABLED_CHANNELS_X_MSK (0x0000000f << ENABLED_CHANNELS_X_OFST)
|
||||
#define RO_MODE_ADC_OFST (13)
|
||||
#define RO_MODE_ADC_MSK (0x00000001 << RO_MODE_ADC_OFST)
|
||||
#define RO_MODE_D_OFST (14)
|
||||
#define RO_MODE_D_MSK (0x00000001 << RO_MODE_D_OFST)
|
||||
#define RO_MODE_X_OFST (15)
|
||||
#define RO_MODE_X_MSK (0x00000001 << RO_MODE_X_OFST)
|
||||
#define COUNT_FRAMES_FROM_UPDATE_OFST (16)
|
||||
#define COUNT_FRAMES_FROM_UPDATE_MSK (0x00000001 << COUNT_FRAMES_FROM_UPDATE_OFST)
|
||||
#define START_STREAMING_P_OFST (17)
|
||||
#define START_STREAMING_P_MSK (0x00000001 << START_STREAMING_P_OFST)
|
||||
#define COUNT_FRAMES_FROM_UPDATE_MSK \
|
||||
(0x00000001 << COUNT_FRAMES_FROM_UPDATE_OFST)
|
||||
#define START_STREAMING_P_OFST (17)
|
||||
#define START_STREAMING_P_MSK (0x00000001 << START_STREAMING_P_OFST)
|
||||
#define STREAM_BUFFER_CLEAR_OFST (18)
|
||||
#define STREAM_BUFFER_CLEAR_MSK (0x00000001 << STREAM_BUFFER_CLEAR_OFST)
|
||||
|
||||
@@ -153,26 +148,26 @@
|
||||
|
||||
#define PKTPACKETLENGTHREG (0xA020)
|
||||
|
||||
#define PACKETLENGTH1G_OFST (0)
|
||||
#define PACKETLENGTH1G_MSK (0x0000ffff << PACKETLENGTH1G_OFST)
|
||||
#define PACKETLENGTH1G_OFST (0)
|
||||
#define PACKETLENGTH1G_MSK (0x0000ffff << PACKETLENGTH1G_OFST)
|
||||
#define PACKETLENGTH10G_OFST (16)
|
||||
#define PACKETLENGTH10G_MSK (0x0000ffff << PACKETLENGTH10G_OFST)
|
||||
|
||||
#define PKTNOPACKETSREG (0xA024)
|
||||
|
||||
#define NOPACKETS1G_OFST (0)
|
||||
#define NOPACKETS1G_MSK (0x0000003f << NOPACKETS1G_OFST)
|
||||
#define NOPACKETS1G_OFST (0)
|
||||
#define NOPACKETS1G_MSK (0x0000003f << NOPACKETS1G_OFST)
|
||||
#define NOPACKETS10G_OFST (16)
|
||||
#define NOPACKETS10G_MSK (0x0000003f << NOPACKETS10G_OFST)
|
||||
|
||||
#define PKTCTRLREG (0xA028)
|
||||
|
||||
#define NOSERVERS_OFST (0)
|
||||
#define NOSERVERS_MSK (0x0000003f << NOSERVERS_OFST)
|
||||
#define NOSERVERS_OFST (0)
|
||||
#define NOSERVERS_MSK (0x0000003f << NOSERVERS_OFST)
|
||||
#define SERVERSTART_OFST (8)
|
||||
#define SERVERSTART_MSK (0x0000001f << SERVERSTART_OFST)
|
||||
#define ETHINTERF_OFST (16)
|
||||
#define ETHINTERF_MSK (0x00000001 << ETHINTERF_OFST)
|
||||
#define ETHINTERF_OFST (16)
|
||||
#define ETHINTERF_MSK (0x00000001 << ETHINTERF_OFST)
|
||||
|
||||
#define PKTCOORDREG1 (0xA02C)
|
||||
|
||||
@@ -186,282 +181,363 @@
|
||||
#define COORDZ_OFST (0)
|
||||
#define COORDZ_MSK (0x0000ffff << COORDZ_OFST)
|
||||
|
||||
#define PATTERN_OUT_LSB_REG (0xB000)
|
||||
#define FLOW_STATUS_REG (0xB000)
|
||||
|
||||
#define PATTERN_OUT_MSB_REG (0xB004)
|
||||
#define RSM_BUSY_OFST (0)
|
||||
#define RSM_BUSY_MSK (0x00000001 << RSM_BUSY_OFST)
|
||||
#define RSM_TRG_WAIT_OFST (3)
|
||||
#define RSM_TRG_WAIT_MSK (0x00000001 << RSM_TRG_WAIT_OFST)
|
||||
#define CSM_BUSY_OFST (17)
|
||||
#define CSM_BUSY_MSK (0x00000001 << CSM_BUSY_OFST)
|
||||
|
||||
#define PATTERN_IN_LSB_REG (0xB008)
|
||||
#define FLOW_CONTROL_REG (0xB004)
|
||||
|
||||
#define PATTERN_IN_MSB_REG (0xB00C)
|
||||
#define START_F_OFST (0)
|
||||
#define START_F_MSK (0x00000001 << START_F_OFST)
|
||||
#define STOP_F_OFST (1)
|
||||
#define STOP_F_MSK (0x00000001 << STOP_F_OFST)
|
||||
#define RST_F_OFST (2)
|
||||
#define RST_F_MSK (0x00000001 << RST_F_OFST)
|
||||
#define SW_TRIGGER_F_OFST (3)
|
||||
#define SW_TRIGGER_F_MSK (0x00000001 << SW_TRIGGER_F_OFST)
|
||||
#define TRIGGER_ENABLE_OFST (4)
|
||||
#define TRIGGER_ENABLE_MSK (0x00000001 << TRIGGER_ENABLE_OFST)
|
||||
|
||||
#define PATTERN_MASK_LSB_REG (0xB010)
|
||||
#define TIME_FROM_START_OUT_REG_1 (0xB008)
|
||||
|
||||
#define PATTERN_MASK_MSB_REG (0xB014)
|
||||
#define TIME_FROM_START_OUT_REG_2 (0xB00C)
|
||||
|
||||
#define PATTERN_SET_LSB_REG (0xB018)
|
||||
#define FRAMES_FROM_START_OUT_REG_1 (0xB010)
|
||||
|
||||
#define PATTERN_SET_MSB_REG (0xB01C)
|
||||
#define FRAMES_FROM_START_OUT_REG_2 (0xB014)
|
||||
|
||||
#define PATTERN_CNTRL_REG (0xB020)
|
||||
#define FRAME_TIME_OUT_REG_1 (0xB018)
|
||||
|
||||
#define PATTERN_CNTRL_WR_OFST (0)
|
||||
#define PATTERN_CNTRL_WR_MSK (0x00000001 << PATTERN_CNTRL_WR_OFST)
|
||||
#define PATTERN_CNTRL_RD_OFST (1)
|
||||
#define PATTERN_CNTRL_RD_MSK (0x00000001 << PATTERN_CNTRL_RD_OFST)
|
||||
#define FRAME_TIME_OUT_REG_2 (0xB01C)
|
||||
|
||||
#define DELAY_OUT_REG_1 (0xB020)
|
||||
|
||||
#define DELAY_OUT_REG_2 (0xB024)
|
||||
|
||||
#define CYCLES_OUT_REG_1 (0xB028)
|
||||
|
||||
#define CYCLES_OUT_REG_2 (0xB02C)
|
||||
|
||||
#define FRAMES_OUT_REG_1 (0xB030)
|
||||
|
||||
#define FRAMES_OUT_REG_2 (0xB034)
|
||||
|
||||
#define PERIOD_OUT_REG_1 (0xB038)
|
||||
|
||||
#define PERIOD_OUT_REG_2 (0xB03C)
|
||||
|
||||
#define DELAY_IN_REG_1 (0xB040)
|
||||
|
||||
#define DELAY_IN_REG_2 (0xB044)
|
||||
|
||||
#define CYCLES_IN_REG_1 (0xB048)
|
||||
|
||||
#define CYCLES_IN_REG_2 (0xB04C)
|
||||
|
||||
#define FRAMES_IN_REG_1 (0xB050)
|
||||
|
||||
#define FRAMES_IN_REG_2 (0xB054)
|
||||
|
||||
#define PERIOD_IN_REG_1 (0xB058)
|
||||
|
||||
#define PERIOD_IN_REG_2 (0xB05C)
|
||||
|
||||
#define PATTERN_OUT_LSB_REG (0xB100)
|
||||
|
||||
#define PATTERN_OUT_MSB_REG (0xB104)
|
||||
|
||||
#define PATTERN_IN_LSB_REG (0xB108)
|
||||
|
||||
#define PATTERN_IN_MSB_REG (0xB10C)
|
||||
|
||||
#define PATTERN_MASK_LSB_REG (0xB110)
|
||||
|
||||
#define PATTERN_MASK_MSB_REG (0xB114)
|
||||
|
||||
#define PATTERN_SET_LSB_REG (0xB118)
|
||||
|
||||
#define PATTERN_SET_MSB_REG (0xB11C)
|
||||
|
||||
#define PATTERN_CNTRL_REG (0xB120)
|
||||
|
||||
#define PATTERN_CNTRL_WR_OFST (0)
|
||||
#define PATTERN_CNTRL_WR_MSK (0x00000001 << PATTERN_CNTRL_WR_OFST)
|
||||
#define PATTERN_CNTRL_RD_OFST (1)
|
||||
#define PATTERN_CNTRL_RD_MSK (0x00000001 << PATTERN_CNTRL_RD_OFST)
|
||||
#define PATTERN_CNTRL_ADDR_OFST (16)
|
||||
#define PATTERN_CNTRL_ADDR_MSK (0x00001fff << PATTERN_CNTRL_ADDR_OFST)
|
||||
|
||||
#define PATTERN_LIMIT_REG (0xB024)
|
||||
#define PATTERN_LIMIT_REG (0xB124)
|
||||
|
||||
#define PATTERN_LIMIT_STRT_OFST (0)
|
||||
#define PATTERN_LIMIT_STRT_MSK (0x00001fff << PATTERN_LIMIT_STRT_OFST)
|
||||
#define PATTERN_LIMIT_STP_OFST (16)
|
||||
#define PATTERN_LIMIT_STP_MSK (0x00001fff << PATTERN_LIMIT_STP_OFST)
|
||||
#define PATTERN_LIMIT_STP_OFST (16)
|
||||
#define PATTERN_LIMIT_STP_MSK (0x00001fff << PATTERN_LIMIT_STP_OFST)
|
||||
|
||||
#define PATTERN_IO_CNTRL_LSB_REG (0xB028)
|
||||
#define PATTERN_LOOP_0_ADDR_REG (0xB128)
|
||||
|
||||
#define PATTERN_IO_CNTRL_MSB_REG (0xB02C)
|
||||
#define PATTERN_LOOP_0_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_0_ADDR_STRT_MSK \
|
||||
(0x00001fff << PATTERN_LOOP_0_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_0_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_0_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_0_ADDR_STP_OFST)
|
||||
|
||||
#define FLOW_CONTROL_REG (0xB030)
|
||||
#define PATTERN_LOOP_0_ITERATION_REG (0xB12C)
|
||||
|
||||
#define START_F_OFST (0)
|
||||
#define START_F_MSK (0x00000001 << START_F_OFST)
|
||||
#define STOP_F_OFST (1)
|
||||
#define STOP_F_MSK (0x00000001 << STOP_F_OFST)
|
||||
#define RST_F_OFST (2)
|
||||
#define RST_F_MSK (0x00000001 << RST_F_OFST)
|
||||
#define SW_TRIGGER_F_OFST (3)
|
||||
#define SW_TRIGGER_F_MSK (0x00000001 << SW_TRIGGER_F_OFST)
|
||||
#define TRIGGER_ENABLE_OFST (4)
|
||||
#define TRIGGER_ENABLE_MSK (0x00000001 << TRIGGER_ENABLE_OFST)
|
||||
#define RSM_BUSY_OFST (5)
|
||||
#define RSM_BUSY_MSK (0x00000001 << RSM_BUSY_OFST)
|
||||
#define RSM_TRG_WAIT_OFST (6)
|
||||
#define RSM_TRG_WAIT_MSK (0x00000001 << RSM_TRG_WAIT_OFST)
|
||||
#define CSM_BUSY_OFST (7)
|
||||
#define CSM_BUSY_MSK (0x00000001 << CSM_BUSY_OFST)
|
||||
#define PATTERN_WAIT_0_ADDR_REG (0xB130)
|
||||
|
||||
#define DELAY_IN_REG_1 (0xB034)
|
||||
#define PATTERN_WAIT_0_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_0_ADDR_MSK (0x00001fff << PATTERN_WAIT_0_ADDR_OFST)
|
||||
|
||||
#define DELAY_IN_REG_2 (0xB038)
|
||||
#define PATTERN_WAIT_TIMER_0_LSB_REG (0xB134)
|
||||
|
||||
#define CYCLES_IN_REG_1 (0xB03C)
|
||||
#define PATTERN_WAIT_TIMER_0_MSB_REG (0xB138)
|
||||
|
||||
#define CYCLES_IN_REG_2 (0xB040)
|
||||
#define PATTERN_LOOP_1_ADDR_REG (0xB13C)
|
||||
|
||||
#define FRAMES_IN_REG_1 (0xB044)
|
||||
#define PATTERN_LOOP_1_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_1_ADDR_STRT_MSK \
|
||||
(0x00001fff << PATTERN_LOOP_1_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_1_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_1_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_1_ADDR_STP_OFST)
|
||||
|
||||
#define FRAMES_IN_REG_2 (0xB048)
|
||||
#define PATTERN_LOOP_1_ITERATION_REG (0xB140)
|
||||
|
||||
#define PERIOD_IN_REG_1 (0xB04C)
|
||||
#define PATTERN_WAIT_1_ADDR_REG (0xB144)
|
||||
|
||||
#define PERIOD_IN_REG_2 (0xB050)
|
||||
#define PATTERN_WAIT_1_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_1_ADDR_MSK (0x00001fff << PATTERN_WAIT_1_ADDR_OFST)
|
||||
|
||||
#define PATTERN_TEST_REG (0xB054)
|
||||
#define PATTERN_WAIT_TIMER_1_LSB_REG (0xB148)
|
||||
|
||||
#define PATTERN_FIRMWARE_REG (0xB058)
|
||||
#define PATTERN_WAIT_TIMER_1_MSB_REG (0xB14C)
|
||||
|
||||
#define PATTERN_WIDTH_OFST (0)
|
||||
#define PATTERN_WIDTH_MSK (0x000000ff << PATTERN_WIDTH_OFST)
|
||||
#define PATTERN_ADDR_WIDTH_OFST (8)
|
||||
#define PATTERN_ADDR_WIDTH_MSK (0x000000ff << PATTERN_ADDR_WIDTH_OFST)
|
||||
#define PATTERN_NLOOPS_NWAITS_OFST (16)
|
||||
#define PATTERN_NLOOPS_NWAITS_MSK (0x000000ff << PATTERN_NLOOPS_NWAITS_OFST)
|
||||
#define DIRECT_PATTERN_RAM_OFST (24)
|
||||
#define DIRECT_PATTERN_RAM_MSK (0x00000001 << DIRECT_PATTERN_RAM_OFST)
|
||||
#define PATTERN_LOOP_2_ADDR_REG (0xB150)
|
||||
|
||||
#define TIME_FROM_START_OUT_REG_1 (0xB05C)
|
||||
#define PATTERN_LOOP_2_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_2_ADDR_STRT_MSK \
|
||||
(0x00001fff << PATTERN_LOOP_2_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_2_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_2_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_2_ADDR_STP_OFST)
|
||||
|
||||
#define TIME_FROM_START_OUT_REG_2 (0xB060)
|
||||
#define PATTERN_LOOP_2_ITERATION_REG (0xB154)
|
||||
|
||||
#define FRAMES_FROM_START_OUT_REG_1 (0xB064)
|
||||
#define PATTERN_WAIT_2_ADDR_REG (0xB158)
|
||||
|
||||
#define FRAMES_FROM_START_OUT_REG_2 (0xB068)
|
||||
#define PATTERN_WAIT_2_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_2_ADDR_MSK (0x00001fff << PATTERN_WAIT_2_ADDR_OFST)
|
||||
|
||||
#define FRAME_TIME_OUT_REG_1 (0xB06C)
|
||||
#define PATTERN_WAIT_TIMER_2_LSB_REG (0xB15C)
|
||||
|
||||
#define FRAME_TIME_OUT_REG_2 (0xB070)
|
||||
#define PATTERN_WAIT_TIMER_2_MSB_REG (0xB160)
|
||||
|
||||
#define PATTERN_LOOPDEF_BASE (0xB080)
|
||||
#define PATTERN_LOOP_3_ADDR_REG (0xB164)
|
||||
|
||||
#define PATTERN_LOOP_ADDR_WORD_OFST (0)
|
||||
#define PATTERN_LOOP_ADDR_WORD_MSK (0x00000001 << PATTERN_LOOP_ADDR_WORD_OFST)
|
||||
#define PATTERN_LOOP_ITERATION_WORD_OFST (1)
|
||||
#define PATTERN_LOOP_ITERATION_WORD_MSK (0x00000001 << PATTERN_LOOP_ITERATION_WORD_OFST)
|
||||
#define PATTERN_WAIT_ADDR_WORD_OFST (2)
|
||||
#define PATTERN_WAIT_ADDR_WORD_MSK (0x00000001 << PATTERN_WAIT_ADDR_WORD_OFST)
|
||||
#define PATTERN_WAIT_TIMER_LSB_WORD_OFST (3)
|
||||
#define PATTERN_WAIT_TIMER_LSB_WORD_MSK (0x00000001 << PATTERN_WAIT_TIMER_LSB_WORD_OFST)
|
||||
#define PATTERN_WAIT_TIMER_MSB_WORD_OFST (4)
|
||||
#define PATTERN_WAIT_TIMER_MSB_WORD_MSK (0x00000001 << PATTERN_WAIT_TIMER_MSB_WORD_OFST)
|
||||
#define PATTERN_LOOPDEF_NWORDS_OFST (5)
|
||||
#define PATTERN_LOOPDEF_NWORDS_MSK (0x00000001 << PATTERN_LOOPDEF_NWORDS_OFST)
|
||||
#define PATTERN_WAIT_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_ADDR_MSK (0x00001fff << PATTERN_WAIT_ADDR_OFST)
|
||||
#define PATTERN_LOOP_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_ADDR_STRT_MSK (0x00001fff << PATTERN_LOOP_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_ADDR_STP_OFST)
|
||||
#define PATTERN_LOOP_3_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_3_ADDR_STRT_MSK \
|
||||
(0x00001fff << PATTERN_LOOP_3_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_3_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_3_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_3_ADDR_STP_OFST)
|
||||
|
||||
#define DBITFIFOCTRLREG (0xC000)
|
||||
#define PATTERN_LOOP_3_ITERATION_REG (0xB168)
|
||||
|
||||
#define DBITRD_OFST (0)
|
||||
#define DBITRD_MSK (0x00000001 << DBITRD_OFST)
|
||||
#define DBITRST_OFST (1)
|
||||
#define DBITRST_MSK (0x00000001 << DBITRST_OFST)
|
||||
#define DBITFULL_OFST (2)
|
||||
#define DBITFULL_MSK (0x00000001 << DBITFULL_OFST)
|
||||
#define DBITEMPTY_OFST (3)
|
||||
#define DBITEMPTY_MSK (0x00000001 << DBITEMPTY_OFST)
|
||||
#define PATTERN_WAIT_3_ADDR_REG (0xB16C)
|
||||
|
||||
#define PATTERN_WAIT_3_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_3_ADDR_MSK (0x00001fff << PATTERN_WAIT_3_ADDR_OFST)
|
||||
|
||||
#define PATTERN_WAIT_TIMER_3_LSB_REG (0xB170)
|
||||
|
||||
#define PATTERN_WAIT_TIMER_3_MSB_REG (0xB174)
|
||||
|
||||
#define PATTERN_LOOP_4_ADDR_REG (0xB178)
|
||||
|
||||
#define PATTERN_LOOP_4_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_4_ADDR_STRT_MSK \
|
||||
(0x00001fff << PATTERN_LOOP_4_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_4_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_4_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_4_ADDR_STP_OFST)
|
||||
|
||||
#define PATTERN_LOOP_4_ITERATION_REG (0xB17C)
|
||||
|
||||
#define PATTERN_WAIT_4_ADDR_REG (0xB180)
|
||||
|
||||
#define PATTERN_WAIT_4_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_4_ADDR_MSK (0x00001fff << PATTERN_WAIT_4_ADDR_OFST)
|
||||
|
||||
#define PATTERN_WAIT_TIMER_4_LSB_REG (0xB184)
|
||||
|
||||
#define PATTERN_WAIT_TIMER_4_MSB_REG (0xB188)
|
||||
|
||||
#define PATTERN_LOOP_5_ADDR_REG (0xB18C)
|
||||
|
||||
#define PATTERN_LOOP_5_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_5_ADDR_STRT_MSK \
|
||||
(0x00001fff << PATTERN_LOOP_5_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_5_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_5_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_5_ADDR_STP_OFST)
|
||||
|
||||
#define PATTERN_LOOP_5_ITERATION_REG (0xB190)
|
||||
|
||||
#define PATTERN_WAIT_5_ADDR_REG (0xB194)
|
||||
|
||||
#define PATTERN_WAIT_5_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_5_ADDR_MSK (0x00001fff << PATTERN_WAIT_5_ADDR_OFST)
|
||||
|
||||
#define PATTERN_WAIT_TIMER_5_LSB_REG (0xB198)
|
||||
|
||||
#define PATTERN_WAIT_TIMER_5_MSB_REG (0xB19C)
|
||||
|
||||
#define PINIOCTRLREG (0xB1A0)
|
||||
|
||||
#define DBITFIFOCTRLREG (0xB1A4)
|
||||
|
||||
#define DBITRD_OFST (0)
|
||||
#define DBITRD_MSK (0x00000001 << DBITRD_OFST)
|
||||
#define DBITRST_OFST (1)
|
||||
#define DBITRST_MSK (0x00000001 << DBITRST_OFST)
|
||||
#define DBITFULL_OFST (2)
|
||||
#define DBITFULL_MSK (0x00000001 << DBITFULL_OFST)
|
||||
#define DBITEMPTY_OFST (3)
|
||||
#define DBITEMPTY_MSK (0x00000001 << DBITEMPTY_OFST)
|
||||
#define DBITUNDERFLOW_OFST (4)
|
||||
#define DBITUNDERFLOW_MSK (0x00000001 << DBITUNDERFLOW_OFST)
|
||||
#define DBITOVERFLOW_OFST (5)
|
||||
#define DBITOVERFLOW_MSK (0x00000001 << DBITOVERFLOW_OFST)
|
||||
#define DBITOVERFLOW_OFST (5)
|
||||
#define DBITOVERFLOW_MSK (0x00000001 << DBITOVERFLOW_OFST)
|
||||
|
||||
#define DBITFIFODATAREG1 (0xC004)
|
||||
#define DBITFIFODATAREG1 (0xB1A8)
|
||||
|
||||
#define DBITFIFODATAREG2 (0xC008)
|
||||
#define DBITFIFODATAREG2 (0xB1AC)
|
||||
|
||||
#define MATTERHORNSPIREG1 (0xC00C)
|
||||
#define MATTERHORNSPIREG1 (0xB1B0)
|
||||
|
||||
#define MATTERHORNSPIREG2 (0xC010)
|
||||
#define MATTERHORNSPIREG2 (0xB1B4)
|
||||
|
||||
#define MATTERHORNSPICTRL (0xC014)
|
||||
#define MATTERHORNSPICTRL (0xB1B8)
|
||||
|
||||
#define CONFIGSTART_P_OFST (0)
|
||||
#define CONFIGSTART_P_MSK (0x00000001 << CONFIGSTART_P_OFST)
|
||||
#define PERIPHERYRST_P_OFST (1)
|
||||
#define PERIPHERYRST_P_MSK (0x00000001 << PERIPHERYRST_P_OFST)
|
||||
#define STARTREAD_P_OFST (2)
|
||||
#define STARTREAD_P_MSK (0x00000001 << STARTREAD_P_OFST)
|
||||
#define BUSY_OFST (3)
|
||||
#define BUSY_MSK (0x00000001 << BUSY_OFST)
|
||||
#define CONFIGSTART_P_OFST (0)
|
||||
#define CONFIGSTART_P_MSK (0x00000001 << CONFIGSTART_P_OFST)
|
||||
#define PERIPHERYRST_P_OFST (1)
|
||||
#define PERIPHERYRST_P_MSK (0x00000001 << PERIPHERYRST_P_OFST)
|
||||
#define STARTREAD_P_OFST (2)
|
||||
#define STARTREAD_P_MSK (0x00000001 << STARTREAD_P_OFST)
|
||||
#define BUSY_OFST (3)
|
||||
#define BUSY_MSK (0x00000001 << BUSY_OFST)
|
||||
#define READOUTFROMASIC_OFST (4)
|
||||
#define READOUTFROMASIC_MSK (0x00000001 << READOUTFROMASIC_OFST)
|
||||
|
||||
#define TRANSCEIVERRXCTRL0REG1 (0xC100)
|
||||
#define TRANSCEIVERRXCTRL0REG1 (0xB800)
|
||||
|
||||
#define TRANSCEIVERRXCTRL0REG2 (0xC104)
|
||||
#define TRANSCEIVERRXCTRL0REG2 (0xB804)
|
||||
|
||||
#define TRANSCEIVERRXCTRL1REG1 (0xC108)
|
||||
#define TRANSCEIVERRXCTRL1REG1 (0xB808)
|
||||
|
||||
#define TRANSCEIVERRXCTRL1REG2 (0xC10C)
|
||||
#define TRANSCEIVERRXCTRL1REG2 (0xB80C)
|
||||
|
||||
#define TRANSCEIVERRXCTRL2REG (0xC110)
|
||||
#define TRANSCEIVERRXCTRL2REG (0xB810)
|
||||
|
||||
#define TRANSCEIVERRXCTRL3REG (0xC114)
|
||||
#define TRANSCEIVERRXCTRL3REG (0xB814)
|
||||
|
||||
#define TRANSCEIVERSTATUS (0xC118)
|
||||
#define TRANSCEIVERSTATUS (0xB818)
|
||||
|
||||
#define LINKDOWNLATCHEDOUT_OFST (0)
|
||||
#define LINKDOWNLATCHEDOUT_MSK (0x00000001 << LINKDOWNLATCHEDOUT_OFST)
|
||||
#define TXUSERCLKACTIVE_OFST (1)
|
||||
#define TXUSERCLKACTIVE_MSK (0x00000001 << TXUSERCLKACTIVE_OFST)
|
||||
#define RXUSERCLKACTIVE_OFST (2)
|
||||
#define RXUSERCLKACTIVE_MSK (0x00000001 << RXUSERCLKACTIVE_OFST)
|
||||
#define RXCOMMADET_OFST (3)
|
||||
#define RXCOMMADET_MSK (0x0000000f << RXCOMMADET_OFST)
|
||||
#define RXBYTEREALIGN_OFST (7)
|
||||
#define RXBYTEREALIGN_MSK (0x0000000f << RXBYTEREALIGN_OFST)
|
||||
#define RXBYTEISALIGNED_OFST (11)
|
||||
#define RXBYTEISALIGNED_MSK (0x0000000f << RXBYTEISALIGNED_OFST)
|
||||
#define GTWIZRXCDRSTABLE_OFST (15)
|
||||
#define GTWIZRXCDRSTABLE_MSK (0x00000001 << GTWIZRXCDRSTABLE_OFST)
|
||||
#define RESETTXDONE_OFST (16)
|
||||
#define RESETTXDONE_MSK (0x00000001 << RESETTXDONE_OFST)
|
||||
#define RESETRXDONE_OFST (17)
|
||||
#define RESETRXDONE_MSK (0x00000001 << RESETRXDONE_OFST)
|
||||
#define RXPMARESETDONE_OFST (18)
|
||||
#define RXPMARESETDONE_MSK (0x0000000f << RXPMARESETDONE_OFST)
|
||||
#define TXPMARESETDONE_OFST (22)
|
||||
#define TXPMARESETDONE_MSK (0x0000000f << TXPMARESETDONE_OFST)
|
||||
#define GTTPOWERGOOD_OFST (26)
|
||||
#define GTTPOWERGOOD_MSK (0x0000000f << GTTPOWERGOOD_OFST)
|
||||
#define TXUSERCLKACTIVE_OFST (1)
|
||||
#define TXUSERCLKACTIVE_MSK (0x00000001 << TXUSERCLKACTIVE_OFST)
|
||||
#define RXUSERCLKACTIVE_OFST (2)
|
||||
#define RXUSERCLKACTIVE_MSK (0x00000001 << RXUSERCLKACTIVE_OFST)
|
||||
#define RXCOMMADET_OFST (3)
|
||||
#define RXCOMMADET_MSK (0x0000000f << RXCOMMADET_OFST)
|
||||
#define RXBYTEREALIGN_OFST (7)
|
||||
#define RXBYTEREALIGN_MSK (0x0000000f << RXBYTEREALIGN_OFST)
|
||||
#define RXBYTEISALIGNED_OFST (11)
|
||||
#define RXBYTEISALIGNED_MSK (0x0000000f << RXBYTEISALIGNED_OFST)
|
||||
#define GTWIZRXCDRSTABLE_OFST (15)
|
||||
#define GTWIZRXCDRSTABLE_MSK (0x00000001 << GTWIZRXCDRSTABLE_OFST)
|
||||
#define RESETTXDONE_OFST (16)
|
||||
#define RESETTXDONE_MSK (0x00000001 << RESETTXDONE_OFST)
|
||||
#define RESETRXDONE_OFST (17)
|
||||
#define RESETRXDONE_MSK (0x00000001 << RESETRXDONE_OFST)
|
||||
#define RXPMARESETDONE_OFST (18)
|
||||
#define RXPMARESETDONE_MSK (0x0000000f << RXPMARESETDONE_OFST)
|
||||
#define TXPMARESETDONE_OFST (22)
|
||||
#define TXPMARESETDONE_MSK (0x0000000f << TXPMARESETDONE_OFST)
|
||||
#define GTTPOWERGOOD_OFST (26)
|
||||
#define GTTPOWERGOOD_MSK (0x0000000f << GTTPOWERGOOD_OFST)
|
||||
|
||||
#define TRANSCEIVERSTATUS2 (0xC11C)
|
||||
#define TRANSCEIVERSTATUS2 (0xB81C)
|
||||
|
||||
#define RXLOCKED_OFST (0)
|
||||
#define RXLOCKED_MSK (0x0000000f << RXLOCKED_OFST)
|
||||
|
||||
#define TRANSCEIVERCONTROL (0xC120)
|
||||
#define TRANSCEIVERCONTROL (0xB820)
|
||||
|
||||
#define GTWIZRESETALL_OFST (0)
|
||||
#define GTWIZRESETALL_MSK (0x00000001 << GTWIZRESETALL_OFST)
|
||||
#define GTWIZRESETALL_OFST (0)
|
||||
#define GTWIZRESETALL_MSK (0x00000001 << GTWIZRESETALL_OFST)
|
||||
#define RESETTXPLLANDDATAPATH_OFST (1)
|
||||
#define RESETTXPLLANDDATAPATH_MSK (0x00000001 << RESETTXPLLANDDATAPATH_OFST)
|
||||
#define RESETTXDATAPATHIN_OFST (2)
|
||||
#define RESETTXDATAPATHIN_MSK (0x00000001 << RESETTXDATAPATHIN_OFST)
|
||||
#define RESETTXDATAPATHIN_OFST (2)
|
||||
#define RESETTXDATAPATHIN_MSK (0x00000001 << RESETTXDATAPATHIN_OFST)
|
||||
#define RESETRXPLLANDDATAPATH_OFST (3)
|
||||
#define RESETRXPLLANDDATAPATH_MSK (0x00000001 << RESETRXPLLANDDATAPATH_OFST)
|
||||
#define RESETRXDATAPATHIN_OFST (4)
|
||||
#define RESETRXDATAPATHIN_MSK (0x00000001 << RESETRXDATAPATHIN_OFST)
|
||||
#define RXPOLARITY_OFST (5)
|
||||
#define RXPOLARITY_MSK (0x0000000f << RXPOLARITY_OFST)
|
||||
#define RXERRORCNTRESET_OFST (9)
|
||||
#define RXERRORCNTRESET_MSK (0x0000000f << RXERRORCNTRESET_OFST)
|
||||
#define RXMSBLSBINVERT_OFST (13)
|
||||
#define RXMSBLSBINVERT_MSK (0x0000000f << RXMSBLSBINVERT_OFST)
|
||||
#define RESETRXDATAPATHIN_OFST (4)
|
||||
#define RESETRXDATAPATHIN_MSK (0x00000001 << RESETRXDATAPATHIN_OFST)
|
||||
#define RXPOLARITY_OFST (5)
|
||||
#define RXPOLARITY_MSK (0x0000000f << RXPOLARITY_OFST)
|
||||
#define RXERRORCNTRESET_OFST (9)
|
||||
#define RXERRORCNTRESET_MSK (0x0000000f << RXERRORCNTRESET_OFST)
|
||||
#define RXMSBLSBINVERT_OFST (13)
|
||||
#define RXMSBLSBINVERT_MSK (0x0000000f << RXMSBLSBINVERT_OFST)
|
||||
|
||||
#define TRANSCEIVERERRCNT_REG0 (0xC124)
|
||||
#define TRANSCEIVERERRCNT_REG0 (0xB824)
|
||||
|
||||
#define TRANSCEIVERERRCNT_REG1 (0xC128)
|
||||
#define TRANSCEIVERERRCNT_REG1 (0xB828)
|
||||
|
||||
#define TRANSCEIVERERRCNT_REG2 (0xC12C)
|
||||
#define TRANSCEIVERERRCNT_REG2 (0xB82C)
|
||||
|
||||
#define TRANSCEIVERERRCNT_REG3 (0xC130)
|
||||
#define TRANSCEIVERERRCNT_REG3 (0xB830)
|
||||
|
||||
#define TRANSCEIVERALIGNCNT_REG0 (0xC134)
|
||||
#define TRANSCEIVERALIGNCNT_REG0 (0xB834)
|
||||
|
||||
#define RXALIGNCNTCH0_OFST (0)
|
||||
#define RXALIGNCNTCH0_MSK (0x0000ffff << RXALIGNCNTCH0_OFST)
|
||||
|
||||
#define TRANSCEIVERALIGNCNT_REG1 (0xC138)
|
||||
#define TRANSCEIVERALIGNCNT_REG1 (0xB838)
|
||||
|
||||
#define RXALIGNCNTCH1_OFST (0)
|
||||
#define RXALIGNCNTCH1_MSK (0x0000ffff << RXALIGNCNTCH1_OFST)
|
||||
|
||||
#define TRANSCEIVERALIGNCNT_REG2 (0xC13C)
|
||||
#define TRANSCEIVERALIGNCNT_REG2 (0xB83C)
|
||||
|
||||
#define RXALIGNCNTCH2_OFST (0)
|
||||
#define RXALIGNCNTCH2_MSK (0x0000ffff << RXALIGNCNTCH2_OFST)
|
||||
|
||||
#define TRANSCEIVERALIGNCNT_REG3 (0xC140)
|
||||
#define TRANSCEIVERALIGNCNT_REG3 (0xB840)
|
||||
|
||||
#define RXALIGNCNTCH3_OFST (0)
|
||||
#define RXALIGNCNTCH3_MSK (0x0000ffff << RXALIGNCNTCH3_OFST)
|
||||
|
||||
#define TRANSCEIVERLASTWORD_REG0 (0xC144)
|
||||
#define TRANSCEIVERLASTWORD_REG0 (0xB844)
|
||||
|
||||
#define RXDATACH0_OFST (0)
|
||||
#define RXDATACH0_MSK (0x0000ffff << RXDATACH0_OFST)
|
||||
|
||||
#define TRANSCEIVERLASTWORD_REG1 (0xC148)
|
||||
#define TRANSCEIVERLASTWORD_REG1 (0xB848)
|
||||
|
||||
#define RXDATACH1_OFST (0)
|
||||
#define RXDATACH1_MSK (0x0000ffff << RXDATACH1_OFST)
|
||||
|
||||
#define TRANSCEIVERLASTWORD_REG2 (0xC14C)
|
||||
#define TRANSCEIVERLASTWORD_REG2 (0xB84C)
|
||||
|
||||
#define RXDATACH2_OFST (0)
|
||||
#define RXDATACH2_MSK (0x0000ffff << RXDATACH2_OFST)
|
||||
|
||||
#define TRANSCEIVERLASTWORD_REG3 (0xC150)
|
||||
#define TRANSCEIVERLASTWORD_REG3 (0xB850)
|
||||
|
||||
#define RXDATACH3_OFST (0)
|
||||
#define RXDATACH3_MSK (0x0000ffff << RXDATACH3_OFST)
|
||||
|
||||
|
||||
// ----------------------------------------------------
|
||||
// TODO: fix these in the firmware reg generator:
|
||||
// ----------------------------------------------------:
|
||||
|
||||
#define DELAY_OUT_REG_1 (0xB054)
|
||||
#define DELAY_OUT_REG_2 (0xB058)
|
||||
#define CYCLES_OUT_REG_1 (0xB05C)
|
||||
#define CYCLES_OUT_REG_2 (0xB060)
|
||||
#define FRAMES_OUT_REG_1 (0xB064)
|
||||
#define FRAMES_OUT_REG_2 (0xB068)
|
||||
#define PERIOD_OUT_REG_1 (0xB06C)
|
||||
#define PERIOD_OUT_REG_2 (0xB070)
|
||||
|
||||
// clang-format on
|
||||
|
||||
Binary file not shown.
@@ -1,24 +1,24 @@
|
||||
# Prepare MH02 configuration
|
||||
reg 0xC00C 0x00000041
|
||||
reg 0xC010 0x01200004
|
||||
reg 0xB1B0 0x00000041
|
||||
reg 0xB1B4 0x01200004
|
||||
|
||||
# configure Matterhorn SPI
|
||||
setbit 0xC014 0
|
||||
setbit 0xB1B8 0
|
||||
|
||||
# wait till config is done
|
||||
pollbit 0xC014 3 0
|
||||
pollbit 0xB1B8 3 0
|
||||
|
||||
# reset transceiver
|
||||
reg 0xC120 0x0
|
||||
reg 0xC120 0x1
|
||||
reg 0xC120 0x0
|
||||
reg 0xB820 0x0
|
||||
reg 0xB820 0x1
|
||||
reg 0xB820 0x0
|
||||
|
||||
# set MSB LSB inversions and polarity for transceiver
|
||||
reg 0xC120 0x61e0
|
||||
reg 0xB820 0x61e0
|
||||
|
||||
# Enable MH02 PLL clock
|
||||
pattern enable_clock_pattern.pyat
|
||||
# start the flow
|
||||
setbit 0xB030 0
|
||||
clearbit 0xB030 0
|
||||
setbit 0xB004 0
|
||||
clearbit 0xB004 0
|
||||
sleep 1
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
|
||||
# turn off clock
|
||||
setbit 0xC00C 16
|
||||
setbit 0xC014 0
|
||||
setbit 0xB1B0 16
|
||||
setbit 0xB1B8 0
|
||||
sleep 1
|
||||
|
||||
# reset Matterhorn periphery
|
||||
setbit 0xC014 1
|
||||
setbit 0xB1B8 1
|
||||
sleep 1
|
||||
|
||||
# turn on clock
|
||||
clearbit 0xC00C 16
|
||||
setbit 0xC014 0
|
||||
clearbit 0xB1B0 16
|
||||
setbit 0xB1B8 0
|
||||
sleep 1
|
||||
|
||||
# reset rx transceiver datapath
|
||||
setbit 0xC120 4
|
||||
setbit 0xB820 4
|
||||
sleep 1
|
||||
|
||||
# reset 8b10b counters
|
||||
setbit 0xC120 9
|
||||
setbit 0xC120 10
|
||||
setbit 0xC120 11
|
||||
setbit 0xC120 12
|
||||
setbit 0xB820 9
|
||||
setbit 0xB820 10
|
||||
setbit 0xB820 11
|
||||
setbit 0xB820 12
|
||||
sleep 1
|
||||
clearbit 0xC120 9
|
||||
clearbit 0xC120 10
|
||||
clearbit 0xB820 9
|
||||
clearbit 0xB820 10
|
||||
|
||||
# reset buffer fifos
|
||||
reg 0x9024 0xFFFFFFFF
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "sls/versionAPI.h"
|
||||
|
||||
#include "LTC2620_Driver.h"
|
||||
#include "XILINX_PLL.h"
|
||||
|
||||
#include "loadPattern.h"
|
||||
#ifdef VIRTUAL
|
||||
@@ -40,7 +39,6 @@ char initErrorMessage[MAX_STR_LENGTH];
|
||||
|
||||
int detPos[2] = {0, 0};
|
||||
|
||||
uint32_t clkFrequency[NUM_CLOCKS] = {};
|
||||
int chipConfigured = 0;
|
||||
int analogEnable = 0;
|
||||
int digitalEnable = 0;
|
||||
@@ -375,10 +373,6 @@ void setupDetector() {
|
||||
LOG(logINFO, ("Setting up Server for 1 Xilinx Chip Test Board\n"));
|
||||
|
||||
// default variables
|
||||
clkFrequency[RUN_CLK] = DEFAULT_RUN_CLK;
|
||||
clkFrequency[ADC_CLK] = DEFAULT_ADC_CLK;
|
||||
clkFrequency[SYNC_CLK] = DEFAULT_SYNC_CLK;
|
||||
clkFrequency[DBIT_CLK] = DEFAULT_DBIT_CLK;
|
||||
chipConfigured = 0;
|
||||
analogEnable = 0;
|
||||
digitalEnable = 0;
|
||||
@@ -440,18 +434,14 @@ void cleanFifos() {
|
||||
#ifdef VIRTUAL
|
||||
return;
|
||||
#endif
|
||||
uint32_t t_enable_mask = getTransceiverEnableMask();
|
||||
uint32_t tclean_msk =
|
||||
((t_enable_mask << X_FIFO_CLEAN_OFST) & X_FIFO_CLEAN_MSK);
|
||||
uint32_t t_before_reg = bus_r(X_FIFO_CLEAN_REG);
|
||||
LOG(logINFO, ("Clearing Acquisition Fifos\n"));
|
||||
bus_w(A_FIFO_CLEAN_REG, bus_r(A_FIFO_CLEAN_REG) | BIT32_MSK);
|
||||
bus_w(D_FIFO_CLEAN_REG, bus_r(D_FIFO_CLEAN_REG) | D_FIFO_CLEAN_MSK);
|
||||
bus_w(X_FIFO_CLEAN_REG, t_before_reg | tclean_msk);
|
||||
bus_w(X_FIFO_CLEAN_REG, bus_r(X_FIFO_CLEAN_REG) | X_FIFO_CLEAN_MSK);
|
||||
|
||||
bus_w(A_FIFO_CLEAN_REG, 0);
|
||||
bus_w(D_FIFO_CLEAN_REG, bus_r(D_FIFO_CLEAN_REG) & ~D_FIFO_CLEAN_MSK);
|
||||
bus_w(X_FIFO_CLEAN_REG, t_before_reg);
|
||||
bus_w(X_FIFO_CLEAN_REG, bus_r(X_FIFO_CLEAN_REG) & ~X_FIFO_CLEAN_MSK);
|
||||
}
|
||||
|
||||
void resetFlow() {
|
||||
@@ -1068,12 +1058,12 @@ int setPeriod(int64_t val) {
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFO, ("Setting period %lld ns\n", (long long int)val));
|
||||
val *= (NS_TO_CLK_CYCLE * clkFrequency[RUN_CLK]);
|
||||
val *= (1E-3 * RUN_CLK);
|
||||
setU64BitReg(val, PERIOD_IN_REG_1, PERIOD_IN_REG_2);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getPeriod();
|
||||
val /= (NS_TO_CLK_CYCLE * clkFrequency[RUN_CLK]);
|
||||
val /= (1E-3 * RUN_CLK);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
@@ -1081,8 +1071,7 @@ int setPeriod(int64_t val) {
|
||||
}
|
||||
|
||||
int64_t getPeriod() {
|
||||
return getU64BitReg(PERIOD_IN_REG_1, PERIOD_IN_REG_2) /
|
||||
(NS_TO_CLK_CYCLE * clkFrequency[RUN_CLK]);
|
||||
return getU64BitReg(PERIOD_IN_REG_1, PERIOD_IN_REG_2) / (1E-3 * RUN_CLK);
|
||||
}
|
||||
|
||||
int setDelayAfterTrigger(int64_t val) {
|
||||
@@ -1091,12 +1080,12 @@ int setDelayAfterTrigger(int64_t val) {
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFO, ("Setting delay after trigger %ld ns\n", val));
|
||||
val *= (NS_TO_CLK_CYCLE * clkFrequency[RUN_CLK]);
|
||||
val *= (1E-3 * RUN_CLK);
|
||||
setU64BitReg(val, DELAY_IN_REG_1, DELAY_IN_REG_2);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getDelayAfterTrigger();
|
||||
val /= (NS_TO_CLK_CYCLE * clkFrequency[RUN_CLK]);
|
||||
val /= (1E-3 * RUN_CLK);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
@@ -1104,8 +1093,7 @@ int setDelayAfterTrigger(int64_t val) {
|
||||
}
|
||||
|
||||
int64_t getDelayAfterTrigger() {
|
||||
return getU64BitReg(DELAY_IN_REG_1, DELAY_IN_REG_2) /
|
||||
(NS_TO_CLK_CYCLE * clkFrequency[RUN_CLK]);
|
||||
return getU64BitReg(DELAY_IN_REG_1, DELAY_IN_REG_2) / (1E-3 * RUN_CLK);
|
||||
}
|
||||
|
||||
int64_t getNumFramesLeft() {
|
||||
@@ -1117,13 +1105,11 @@ int64_t getNumTriggersLeft() {
|
||||
}
|
||||
|
||||
int64_t getDelayAfterTriggerLeft() {
|
||||
return getU64BitReg(DELAY_OUT_REG_1, DELAY_OUT_REG_2) /
|
||||
(NS_TO_CLK_CYCLE * clkFrequency[RUN_CLK]);
|
||||
return getU64BitReg(DELAY_OUT_REG_1, DELAY_OUT_REG_2) / (1E-3 * RUN_CLK);
|
||||
}
|
||||
|
||||
int64_t getPeriodLeft() {
|
||||
return getU64BitReg(PERIOD_OUT_REG_1, PERIOD_OUT_REG_2) /
|
||||
(NS_TO_CLK_CYCLE * clkFrequency[RUN_CLK]);
|
||||
return getU64BitReg(PERIOD_OUT_REG_1, PERIOD_OUT_REG_2) / (1E-3 * RUN_CLK);
|
||||
}
|
||||
|
||||
int64_t getFramesFromStart() {
|
||||
@@ -1133,12 +1119,12 @@ int64_t getFramesFromStart() {
|
||||
|
||||
int64_t getActualTime() {
|
||||
return getU64BitReg(TIME_FROM_START_OUT_REG_1, TIME_FROM_START_OUT_REG_2) /
|
||||
(NS_TO_CLK_CYCLE * clkFrequency[SYNC_CLK]);
|
||||
(1E-3 * TICK_CLK);
|
||||
}
|
||||
|
||||
int64_t getMeasurementTime() {
|
||||
return getU64BitReg(FRAME_TIME_OUT_REG_1, FRAME_TIME_OUT_REG_2) /
|
||||
(NS_TO_CLK_CYCLE * clkFrequency[SYNC_CLK]);
|
||||
(1E-3 * TICK_CLK);
|
||||
}
|
||||
|
||||
/* parameters - dac, adc, hv */
|
||||
@@ -1205,26 +1191,6 @@ void setVLimit(int l) {
|
||||
vLimit = l;
|
||||
}
|
||||
|
||||
int getBitOffsetFromDACIndex(enum DACINDEX ind) {
|
||||
switch (ind) {
|
||||
case D_PWR_IO:
|
||||
return POWER_VIO_OFST;
|
||||
case D_PWR_A:
|
||||
return POWER_VCC_A_OFST;
|
||||
case D_PWR_B:
|
||||
return POWER_VCC_B_OFST;
|
||||
case D_PWR_C:
|
||||
return POWER_VCC_C_OFST;
|
||||
case D_PWR_D:
|
||||
return POWER_VCC_D_OFST;
|
||||
default:
|
||||
LOG(logERROR,
|
||||
("DAC index %d is not defined to get offset in ctrl register\n",
|
||||
ind));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int isPowerValid(enum DACINDEX ind, int val) {
|
||||
char *powerNames[] = {PWR_NAMES};
|
||||
int pwrIndex = (int)(ind - D_PWR_D);
|
||||
@@ -1247,23 +1213,10 @@ int isPowerValid(enum DACINDEX ind, int val) {
|
||||
}
|
||||
|
||||
int getPower(enum DACINDEX ind) {
|
||||
// get bit offset in ctrl register
|
||||
int bitOffset = getBitOffsetFromDACIndex(ind);
|
||||
if (bitOffset == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// powered enable off
|
||||
{
|
||||
uint32_t addr = CTRL_REG;
|
||||
uint32_t mask = (1 << bitOffset);
|
||||
if (!(bus_r(addr) & mask))
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *powerNames[] = {PWR_NAMES};
|
||||
int pwrIndex = (int)(ind - D_PWR_D);
|
||||
|
||||
// check dac value
|
||||
// not set yet
|
||||
if (dacValues[ind] == -1) {
|
||||
LOG(logERROR,
|
||||
@@ -1273,8 +1226,7 @@ int getPower(enum DACINDEX ind) {
|
||||
|
||||
// dac powered off
|
||||
if (dacValues[ind] == LTC2620_D_GetPowerDownValue()) {
|
||||
LOG(logWARNING, ("Power V%s enabled, but voltage is at minimum or 0.\n",
|
||||
powerNames[pwrIndex]));
|
||||
LOG(logWARNING, ("Power V%s is powered down\n", powerNames[pwrIndex]));
|
||||
return LTC2620_D_GetPowerDownValue();
|
||||
}
|
||||
|
||||
@@ -1288,43 +1240,26 @@ int getPower(enum DACINDEX ind) {
|
||||
}
|
||||
|
||||
void setPower(enum DACINDEX ind, int val) {
|
||||
// validate index and get bit offset in ctrl register
|
||||
int bitOffset = getBitOffsetFromDACIndex(ind);
|
||||
if (bitOffset == -1) {
|
||||
return;
|
||||
}
|
||||
uint32_t addr = CTRL_REG;
|
||||
uint32_t mask = (1 << bitOffset);
|
||||
|
||||
if (val == -1)
|
||||
return;
|
||||
|
||||
char *powerNames[] = {PWR_NAMES};
|
||||
int pwrIndex = (int)(ind - D_PWR_D);
|
||||
LOG(logINFO, ("Setting Power V%s to %d mV\n", powerNames[pwrIndex], val));
|
||||
|
||||
// validate value (already checked at tcp (funcs.c))
|
||||
if (!isPowerValid(ind, val)) {
|
||||
LOG(logERROR, ("Invalid power value for V%s: %d mV\n",
|
||||
powerNames[pwrIndex], val));
|
||||
return;
|
||||
}
|
||||
|
||||
// Switch off power enable
|
||||
LOG(logDEBUG1, ("Switching off power enable\n"));
|
||||
bus_w(addr, bus_r(addr) & ~(mask));
|
||||
|
||||
// power down dac
|
||||
LOG(logINFO, ("\tPowering down V%d\n", powerNames[pwrIndex]));
|
||||
setDAC(ind, LTC2620_D_GetPowerDownValue(), 0);
|
||||
if (val == LTC2620_D_GetPowerDownValue()) {
|
||||
LOG(logINFO, ("\tPowering down V%d\n", powerNames[pwrIndex]));
|
||||
setDAC(ind, LTC2620_D_GetPowerDownValue(), 0);
|
||||
}
|
||||
|
||||
//(power off is anyway done with power enable)
|
||||
if (val == 0)
|
||||
val = LTC2620_D_GetPowerDownValue();
|
||||
// set dac
|
||||
else if (val >= 0) {
|
||||
LOG(logINFO,
|
||||
("Setting Power V%s to %d mV\n", powerNames[pwrIndex], val));
|
||||
|
||||
// convert voltage to dac (power off is anyway done with power enable)
|
||||
if (val != LTC2620_D_GetPowerDownValue()) {
|
||||
// validate value (already checked at tcp (funcs.c))
|
||||
if (!isPowerValid(ind, val)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// convert voltage to dac
|
||||
int dacval = -1;
|
||||
if (ConvertToDifferentRange(
|
||||
POWER_RGLTR_MIN, POWER_RGLTR_MAX, LTC2620_D_GetMaxInput(),
|
||||
@@ -1341,12 +1276,6 @@ void setPower(enum DACINDEX ind, int val) {
|
||||
LOG(logINFO, ("Setting Power V%s: %d mV (%d dac)\n",
|
||||
powerNames[pwrIndex], val, dacval));
|
||||
setDAC(ind, dacval, 0);
|
||||
|
||||
// if valid, enable power
|
||||
if (dacval >= 0) {
|
||||
LOG(logDEBUG1, ("Switching on power enable\n"));
|
||||
bus_w(addr, bus_r(addr) | mask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1700,7 +1629,7 @@ int stopStateMachine() {
|
||||
#endif
|
||||
// stop state machine
|
||||
bus_w(FLOW_CONTROL_REG, bus_r(FLOW_CONTROL_REG) | STOP_F_MSK);
|
||||
cleanFifos();
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -1849,37 +1778,3 @@ void getNumberOfChannels(int *nchanx, int *nchany) {
|
||||
int getNumberOfChips() { return NCHIP; }
|
||||
int getNumberOfDACs() { return NDAC; }
|
||||
int getNumberOfChannelsPerChip() { return NCHAN; }
|
||||
|
||||
int setFrequency(enum CLKINDEX ind, int val) {
|
||||
if (ind < 0 || ind >= NUM_CLOCKS) {
|
||||
LOG(logERROR, ("Unknown clock index %d to set frequency\n", ind));
|
||||
return FAIL;
|
||||
}
|
||||
if (val <= 0) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
char *clock_names[] = {CLK_NAMES};
|
||||
LOG(logINFO, ("\tSetting %s clock (%d) frequency to %d kHz\n",
|
||||
clock_names[ind], ind, val));
|
||||
|
||||
if (XILINX_PLL_setFrequency(ind, val) == FAIL) {
|
||||
LOG(logERROR, ("\tCould not set %s clock (%d) frequency to %d kHz\n",
|
||||
clock_names[ind], ind, val));
|
||||
return FAIL;
|
||||
}
|
||||
clkFrequency[ind] = val;
|
||||
// TODO later: connect setPhase as phase gets reset on freq change
|
||||
return OK;
|
||||
}
|
||||
|
||||
int getFrequency(enum CLKINDEX ind) {
|
||||
if (ind < 0 || ind >= NUM_CLOCKS) {
|
||||
LOG(logERROR, ("Unknown clock index %d to get frequency\n", ind));
|
||||
return -1;
|
||||
}
|
||||
#ifndef VIRTUAL
|
||||
clkFrequency[ind] = XILINX_PLL_getFrequency(ind);
|
||||
#endif
|
||||
return clkFrequency[ind];
|
||||
}
|
||||
@@ -71,6 +71,12 @@
|
||||
#define POWER_RGLTR_MAX (2661)
|
||||
#define VIO_MIN_MV (1200) // for fpga to function
|
||||
|
||||
#define TICK_CLK (20) // MHz (trig_timeFromStart, frametime, timeFromStart)
|
||||
#define RUN_CLK \
|
||||
(100) // MHz (framesFromStart, c_swTrigger, run, waitForTrigger, starting,
|
||||
// acquiring, waitForPeriod, internalStop, c_framesFromSTart_reset,
|
||||
// s_start, c_stop, triggerEnable, period, frames, cycles, delay)
|
||||
|
||||
/* Defines in the Firmware */
|
||||
#define WAIT_TIME_PATTERN_READ (10)
|
||||
#define WAIT_TIME_OUT_0US_TIMES (35000) // 2s
|
||||
@@ -152,12 +158,3 @@ typedef struct udp_header_struct {
|
||||
|
||||
#define IP_HEADER_SIZE (20)
|
||||
#define UDP_IP_HEADER_LENGTH_BYTES (28)
|
||||
|
||||
enum CLKINDEX { RUN_CLK, ADC_CLK, SYNC_CLK, DBIT_CLK, NUM_CLOCKS };
|
||||
#define CLK_NAMES "run", "adc", "sync", "dbit"
|
||||
|
||||
#define DEFAULT_RUN_CLK (20000) // 20 MHz
|
||||
#define DEFAULT_ADC_CLK (100000) // 100 MHz
|
||||
#define DEFAULT_SYNC_CLK (20000) // 20 MHz
|
||||
#define DEFAULT_DBIT_CLK (100000) // 100 MHz
|
||||
#define NS_TO_CLK_CYCLE (1E-6) // ns to kHz
|
||||
|
||||
@@ -28,11 +28,12 @@ target_link_libraries(slsDetectorObject
|
||||
PUBLIC
|
||||
slsProjectOptions
|
||||
slsSupportStatic
|
||||
pthread
|
||||
rt
|
||||
PRIVATE
|
||||
slsProjectWarnings
|
||||
)
|
||||
|
||||
|
||||
set(DETECTOR_LIBRARY_TARGETS slsDetectorObject)
|
||||
|
||||
|
||||
@@ -97,7 +98,8 @@ if(SLS_USE_TEXTCLIENT)
|
||||
add_executable(${val1} src/CmdApp.cpp)
|
||||
|
||||
target_link_libraries(${val1}
|
||||
slsDetectorStatic
|
||||
slsDetectorStatic
|
||||
pthread
|
||||
)
|
||||
SET_SOURCE_FILES_PROPERTIES( src/Caller.cpp PROPERTIES COMPILE_FLAGS "-Wno-unused-variable -Wno-unused-but-set-variable")
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ _sd() {
|
||||
local IS_PATH=0
|
||||
|
||||
|
||||
local SLS_COMMANDS=" acquire activate adcclk adcenable adcenable10g adcindex adcinvert adclist adcname adcphase adcpipeline adcreg adcvpp apulse asamples autocompdisable badchannels blockingtrigger burstmode burstperiod bursts burstsl bustest cdsgain chipversion clearbit clearbusy clientversion clkdiv clkfreq clkphase collectionmode column compdisabletime confadc config configtransceiver counters currentsource dac dacindex daclist dacname dacvalues datastream dbitclk dbitphase dbitpipeline defaultdac defaultpattern delay delayl detectorserverversion detsize diodelay dpulse dr drlist dsamples execcommand exptime exptime1 exptime2 exptime3 extrastoragecells extsampling extsamplingsrc extsig fformat filtercells filterresistor findex firmwaretest firmwareversion fliprows flowcontrol10g fmaster fname foverwrite fpath framecounter frames framesl frametime free fwrite gaincaps gainmode gappixels gatedelay gatedelay1 gatedelay2 gatedelay3 gates getbit hardwareversion highvoltage hostname im_a im_b im_c im_d im_io imagetest include initialchecks inj_ch interpolation interruptsubframe kernelversion lastclient led lock master maxadcphaseshift maxclkphaseshift maxdbitphaseshift measuredperiod measuredsubperiod moduleid nextframenumber nmod numinterfaces overflow packageversion parallel parameters partialreset patfname patioctrl patlimits patloop patloop0 patloop1 patloop2 patmask patnloop patnloop0 patnloop1 patnloop2 patsetbit pattern patternstart patwait patwait0 patwait1 patwait2 patwaittime patwaittime0 patwaittime1 patwaittime2 patword pedestalmode period periodl polarity port powerchip powerindex powerlist powername powervalues programfpga pulse pulsechip pulsenmove pumpprobe quad ratecorr readnrows readout readoutspeed readoutspeedlist rebootcontroller reg resetdacs resetfpga romode row runclk runtime rx_arping rx_clearroi rx_dbitlist rx_dbitoffset rx_dbitreorder rx_discardpolicy rx_fifodepth rx_frameindex rx_framescaught rx_framesperfile rx_hostname rx_jsonaddheader rx_jsonpara rx_lastclient rx_lock rx_missingpackets rx_padding rx_printconfig rx_realudpsocksize rx_roi rx_silent rx_start rx_status rx_stop rx_tcpport rx_threads rx_udpsocksize rx_version rx_zmqfreq rx_zmqhwm rx_zmqip rx_zmqport rx_zmqstartfnum rx_zmqstream samples savepattern scan scanerrmsg selinterface serialnumber setbit settings settingslist settingspath signalindex signallist signalname sleep slowadc slowadcindex slowadclist slowadcname slowadcvalues start status stop stopport storagecell_delay storagecell_start subdeadtime subexptime sync syncclk temp_10ge temp_adc temp_control temp_dcdc temp_event temp_fpga temp_fpgaext temp_fpgafl temp_fpgafr temp_slowadc temp_sodl temp_sodr temp_threshold templist tempvalues tengiga threshold thresholdnotb timing timing_info_decoder timinglist timingsource top transceiverenable trigger triggers triggersl trimbits trimen trimval tsamples txdelay txdelay_frame txdelay_left txdelay_right type udp_cleardst udp_dstip udp_dstip2 udp_dstlist udp_dstmac udp_dstmac2 udp_dstport udp_dstport2 udp_firstdst udp_numdst udp_reconfigure udp_srcip udp_srcip2 udp_srcmac udp_srcmac2 udp_validate update updatedetectorserver updatekernel updatemode user v_a v_b v_c v_chip v_d v_io v_limit vchip_comp_adc vchip_comp_fe vchip_cs vchip_opa_1st vchip_opa_fd vchip_ref_comp_fe versions veto vetoalg vetofile vetophoton vetoref vetostream virtual vm_a vm_b vm_c vm_d vm_io zmqhwm zmqip zmqport "
|
||||
local SLS_COMMANDS=" acquire activate adcclk adcenable adcenable10g adcindex adcinvert adclist adcname adcphase adcpipeline adcreg adcvpp apulse asamples autocompdisable badchannels blockingtrigger burstmode burstperiod bursts burstsl bustest cdsgain chipversion clearbit clearbusy clientversion clkdiv clkfreq clkphase collectionmode column compdisabletime confadc config configtransceiver counters currentsource dac dacindex daclist dacname dacvalues datastream dbitclk dbitphase dbitpipeline defaultdac defaultpattern delay delayl detectorserverversion detsize diodelay dpulse dr drlist dsamples execcommand exptime exptime1 exptime2 exptime3 extrastoragecells extsampling extsamplingsrc extsig fformat filtercells filterresistor findex firmwaretest firmwareversion fliprows flowcontrol10g fmaster fname foverwrite fpath framecounter frames framesl frametime free fwrite gaincaps gainmode gappixels gatedelay gatedelay1 gatedelay2 gatedelay3 gates getbit hardwareversion highvoltage hostname im_a im_b im_c im_d im_io imagetest initialchecks inj_ch interpolation interruptsubframe kernelversion lastclient led lock master maxadcphaseshift maxclkphaseshift maxdbitphaseshift measuredperiod measuredsubperiod moduleid nextframenumber nmod numinterfaces overflow packageversion parallel parameters partialreset patfname patioctrl patlimits patloop patloop0 patloop1 patloop2 patmask patnloop patnloop0 patnloop1 patnloop2 patsetbit pattern patternstart patwait patwait0 patwait1 patwait2 patwaittime patwaittime0 patwaittime1 patwaittime2 patword pedestalmode period periodl polarity port powerchip powerindex powerlist powername powervalues programfpga pulse pulsechip pulsenmove pumpprobe quad ratecorr readnrows readout readoutspeed readoutspeedlist rebootcontroller reg resetdacs resetfpga romode row runclk runtime rx_arping rx_clearroi rx_dbitlist rx_dbitoffset rx_dbitreorder rx_discardpolicy rx_fifodepth rx_frameindex rx_framescaught rx_framesperfile rx_hostname rx_jsonaddheader rx_jsonpara rx_lastclient rx_lock rx_missingpackets rx_padding rx_printconfig rx_realudpsocksize rx_roi rx_silent rx_start rx_status rx_stop rx_tcpport rx_threads rx_udpsocksize rx_version rx_zmqfreq rx_zmqhwm rx_zmqip rx_zmqport rx_zmqstartfnum rx_zmqstream samples savepattern scan scanerrmsg selinterface serialnumber setbit settings settingslist settingspath signalindex signallist signalname sleep slowadc slowadcindex slowadclist slowadcname slowadcvalues start status stop stopport storagecell_delay storagecell_start subdeadtime subexptime sync syncclk temp_10ge temp_adc temp_control temp_dcdc temp_event temp_fpga temp_fpgaext temp_fpgafl temp_fpgafr temp_slowadc temp_sodl temp_sodr temp_threshold templist tempvalues tengiga threshold thresholdnotb timing timing_info_decoder timinglist timingsource top transceiverenable trigger triggers triggersl trimbits trimen trimval tsamples txdelay txdelay_frame txdelay_left txdelay_right type udp_cleardst udp_dstip udp_dstip2 udp_dstlist udp_dstmac udp_dstmac2 udp_dstport udp_dstport2 udp_firstdst udp_numdst udp_reconfigure udp_srcip udp_srcip2 udp_srcmac udp_srcmac2 udp_validate update updatedetectorserver updatekernel updatemode user v_a v_b v_c v_chip v_d v_io v_limit vchip_comp_adc vchip_comp_fe vchip_cs vchip_opa_1st vchip_opa_fd vchip_ref_comp_fe versions veto vetoalg vetofile vetophoton vetoref vetostream virtual vm_a vm_b vm_c vm_d vm_io zmqhwm zmqip zmqport "
|
||||
__acquire() {
|
||||
FCN_RETURN=""
|
||||
return 0
|
||||
@@ -1214,21 +1214,6 @@ fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
__include() {
|
||||
FCN_RETURN=""
|
||||
if [[ ${IS_GET} -eq 1 ]]; then
|
||||
if [[ "${cword}" == "2" ]]; then
|
||||
FCN_RETURN="0 1"
|
||||
fi
|
||||
fi
|
||||
if [[ ${IS_GET} -eq 0 ]]; then
|
||||
if [[ "${cword}" == "2" ]]; then
|
||||
FCN_RETURN=""
|
||||
IS_PATH=1
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
__initialchecks() {
|
||||
FCN_RETURN=""
|
||||
if [[ ${IS_GET} -eq 0 ]]; then
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
_sd() {
|
||||
|
||||
|
||||
local SLS_COMMANDS=" acquire activate adcclk adcenable adcenable10g adcindex adcinvert adclist adcname adcphase adcpipeline adcreg adcvpp apulse asamples autocompdisable badchannels blockingtrigger burstmode burstperiod bursts burstsl bustest cdsgain chipversion clearbit clearbusy clientversion clkdiv clkfreq clkphase collectionmode column compdisabletime confadc config configtransceiver counters currentsource dac dacindex daclist dacname dacvalues datastream dbitclk dbitphase dbitpipeline defaultdac defaultpattern delay delayl detectorserverversion detsize diodelay dpulse dr drlist dsamples execcommand exptime exptime1 exptime2 exptime3 extrastoragecells extsampling extsamplingsrc extsig fformat filtercells filterresistor findex firmwaretest firmwareversion fliprows flowcontrol10g fmaster fname foverwrite fpath framecounter frames framesl frametime free fwrite gaincaps gainmode gappixels gatedelay gatedelay1 gatedelay2 gatedelay3 gates getbit hardwareversion highvoltage hostname im_a im_b im_c im_d im_io imagetest include initialchecks inj_ch interpolation interruptsubframe kernelversion lastclient led lock master maxadcphaseshift maxclkphaseshift maxdbitphaseshift measuredperiod measuredsubperiod moduleid nextframenumber nmod numinterfaces overflow packageversion parallel parameters partialreset patfname patioctrl patlimits patloop patloop0 patloop1 patloop2 patmask patnloop patnloop0 patnloop1 patnloop2 patsetbit pattern patternstart patwait patwait0 patwait1 patwait2 patwaittime patwaittime0 patwaittime1 patwaittime2 patword pedestalmode period periodl polarity port powerchip powerindex powerlist powername powervalues programfpga pulse pulsechip pulsenmove pumpprobe quad ratecorr readnrows readout readoutspeed readoutspeedlist rebootcontroller reg resetdacs resetfpga romode row runclk runtime rx_arping rx_clearroi rx_dbitlist rx_dbitoffset rx_dbitreorder rx_discardpolicy rx_fifodepth rx_frameindex rx_framescaught rx_framesperfile rx_hostname rx_jsonaddheader rx_jsonpara rx_lastclient rx_lock rx_missingpackets rx_padding rx_printconfig rx_realudpsocksize rx_roi rx_silent rx_start rx_status rx_stop rx_tcpport rx_threads rx_udpsocksize rx_version rx_zmqfreq rx_zmqhwm rx_zmqip rx_zmqport rx_zmqstartfnum rx_zmqstream samples savepattern scan scanerrmsg selinterface serialnumber setbit settings settingslist settingspath signalindex signallist signalname sleep slowadc slowadcindex slowadclist slowadcname slowadcvalues start status stop stopport storagecell_delay storagecell_start subdeadtime subexptime sync syncclk temp_10ge temp_adc temp_control temp_dcdc temp_event temp_fpga temp_fpgaext temp_fpgafl temp_fpgafr temp_slowadc temp_sodl temp_sodr temp_threshold templist tempvalues tengiga threshold thresholdnotb timing timing_info_decoder timinglist timingsource top transceiverenable trigger triggers triggersl trimbits trimen trimval tsamples txdelay txdelay_frame txdelay_left txdelay_right type udp_cleardst udp_dstip udp_dstip2 udp_dstlist udp_dstmac udp_dstmac2 udp_dstport udp_dstport2 udp_firstdst udp_numdst udp_reconfigure udp_srcip udp_srcip2 udp_srcmac udp_srcmac2 udp_validate update updatedetectorserver updatekernel updatemode user v_a v_b v_c v_chip v_d v_io v_limit vchip_comp_adc vchip_comp_fe vchip_cs vchip_opa_1st vchip_opa_fd vchip_ref_comp_fe versions veto vetoalg vetofile vetophoton vetoref vetostream virtual vm_a vm_b vm_c vm_d vm_io zmqhwm zmqip zmqport "
|
||||
local SLS_COMMANDS=" acquire activate adcclk adcenable adcenable10g adcindex adcinvert adclist adcname adcphase adcpipeline adcreg adcvpp apulse asamples autocompdisable badchannels blockingtrigger burstmode burstperiod bursts burstsl bustest cdsgain chipversion clearbit clearbusy clientversion clkdiv clkfreq clkphase collectionmode column compdisabletime confadc config configtransceiver counters currentsource dac dacindex daclist dacname dacvalues datastream dbitclk dbitphase dbitpipeline defaultdac defaultpattern delay delayl detectorserverversion detsize diodelay dpulse dr drlist dsamples execcommand exptime exptime1 exptime2 exptime3 extrastoragecells extsampling extsamplingsrc extsig fformat filtercells filterresistor findex firmwaretest firmwareversion fliprows flowcontrol10g fmaster fname foverwrite fpath framecounter frames framesl frametime free fwrite gaincaps gainmode gappixels gatedelay gatedelay1 gatedelay2 gatedelay3 gates getbit hardwareversion highvoltage hostname im_a im_b im_c im_d im_io imagetest initialchecks inj_ch interpolation interruptsubframe kernelversion lastclient led lock master maxadcphaseshift maxclkphaseshift maxdbitphaseshift measuredperiod measuredsubperiod moduleid nextframenumber nmod numinterfaces overflow packageversion parallel parameters partialreset patfname patioctrl patlimits patloop patloop0 patloop1 patloop2 patmask patnloop patnloop0 patnloop1 patnloop2 patsetbit pattern patternstart patwait patwait0 patwait1 patwait2 patwaittime patwaittime0 patwaittime1 patwaittime2 patword pedestalmode period periodl polarity port powerchip powerindex powerlist powername powervalues programfpga pulse pulsechip pulsenmove pumpprobe quad ratecorr readnrows readout readoutspeed readoutspeedlist rebootcontroller reg resetdacs resetfpga romode row runclk runtime rx_arping rx_clearroi rx_dbitlist rx_dbitoffset rx_dbitreorder rx_discardpolicy rx_fifodepth rx_frameindex rx_framescaught rx_framesperfile rx_hostname rx_jsonaddheader rx_jsonpara rx_lastclient rx_lock rx_missingpackets rx_padding rx_printconfig rx_realudpsocksize rx_roi rx_silent rx_start rx_status rx_stop rx_tcpport rx_threads rx_udpsocksize rx_version rx_zmqfreq rx_zmqhwm rx_zmqip rx_zmqport rx_zmqstartfnum rx_zmqstream samples savepattern scan scanerrmsg selinterface serialnumber setbit settings settingslist settingspath signalindex signallist signalname sleep slowadc slowadcindex slowadclist slowadcname slowadcvalues start status stop stopport storagecell_delay storagecell_start subdeadtime subexptime sync syncclk temp_10ge temp_adc temp_control temp_dcdc temp_event temp_fpga temp_fpgaext temp_fpgafl temp_fpgafr temp_slowadc temp_sodl temp_sodr temp_threshold templist tempvalues tengiga threshold thresholdnotb timing timing_info_decoder timinglist timingsource top transceiverenable trigger triggers triggersl trimbits trimen trimval tsamples txdelay txdelay_frame txdelay_left txdelay_right type udp_cleardst udp_dstip udp_dstip2 udp_dstlist udp_dstmac udp_dstmac2 udp_dstport udp_dstport2 udp_firstdst udp_numdst udp_reconfigure udp_srcip udp_srcip2 udp_srcmac udp_srcmac2 udp_validate update updatedetectorserver updatekernel updatemode user v_a v_b v_c v_chip v_d v_io v_limit vchip_comp_adc vchip_comp_fe vchip_cs vchip_opa_1st vchip_opa_fd vchip_ref_comp_fe versions veto vetoalg vetofile vetophoton vetoref vetostream virtual vm_a vm_b vm_c vm_d vm_io zmqhwm zmqip zmqport "
|
||||
__acquire() {
|
||||
FCN_RETURN=""
|
||||
return 0
|
||||
@@ -1138,21 +1138,6 @@ fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
__include() {
|
||||
FCN_RETURN=""
|
||||
if [[ ${IS_GET} -eq 1 ]]; then
|
||||
if [[ "${cword}" == "2" ]]; then
|
||||
FCN_RETURN="0 1"
|
||||
fi
|
||||
fi
|
||||
if [[ ${IS_GET} -eq 0 ]]; then
|
||||
if [[ "${cword}" == "2" ]]; then
|
||||
FCN_RETURN=""
|
||||
IS_PATH=1
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
__initialchecks() {
|
||||
FCN_RETURN=""
|
||||
if [[ ${IS_GET} -eq 0 ]]; then
|
||||
|
||||
@@ -1272,7 +1272,7 @@ asamples:
|
||||
function: setNumberOfAnalogSamples
|
||||
|
||||
adcclk:
|
||||
help: "[n_clk in MHz]\n\t[Ctb] ADC clock frequency in MHz.\n\t[xilinx Ctb] ADC clock frequency in kHz."
|
||||
help: "[n_clk in MHz]\n\t[Ctb] ADC clock frequency in MHz."
|
||||
inherit_actions: INTEGER_COMMAND_VEC_ID
|
||||
actions:
|
||||
GET:
|
||||
@@ -1281,7 +1281,7 @@ adcclk:
|
||||
function: setADCClock
|
||||
|
||||
runclk:
|
||||
help: "[n_clk in MHz]\n\t[Ctb] Run clock in MHz.\n\t[xilinx Ctb] Run clock in kHz."
|
||||
help: "[n_clk in MHz]\n\t[Ctb] Run clock in MHz."
|
||||
inherit_actions: INTEGER_COMMAND_VEC_ID
|
||||
actions:
|
||||
GET:
|
||||
@@ -1318,7 +1318,7 @@ romode:
|
||||
input_types: [ defs::readoutMode ]
|
||||
|
||||
dbitclk:
|
||||
help: "[n_clk in MHz]\n\t[Ctb] Clock for latching the digital bits in MHz.\n\t[xilinx Ctb] Clock for latching the digital bits in kHz."
|
||||
help: "[n_clk in MHz]\n\t[Ctb] Clock for latching the digital bits in MHz."
|
||||
inherit_actions: INTEGER_COMMAND_VEC_ID
|
||||
actions:
|
||||
GET:
|
||||
@@ -1791,7 +1791,7 @@ defaultpattern:
|
||||
|
||||
patternstart:
|
||||
inherit_actions: EXECUTE_SET_COMMAND
|
||||
help: "\n\t[Mythen3][Ctb][Xilinx Ctb] Starts Pattern"
|
||||
help: "\n\t[Mythen3] Starts Pattern"
|
||||
actions:
|
||||
PUT:
|
||||
function: startPattern
|
||||
@@ -1846,13 +1846,6 @@ parameters:
|
||||
PUT:
|
||||
function: loadParameters
|
||||
|
||||
include:
|
||||
inherit_actions: EXECUTE_SET_COMMAND_NOID_1ARG
|
||||
help: "\n\tSets detector measurement parameters to those contained in fname. Set up per measurement. Same as parameters command."
|
||||
actions:
|
||||
PUT:
|
||||
function: loadParameters
|
||||
|
||||
savepattern:
|
||||
inherit_actions: EXECUTE_SET_COMMAND_NOID_1ARG
|
||||
help: "\n\t[Ctb][Mythen3][Xilinx Ctb] Saves pattern to file (ascii). \n\t[Ctb] Also executes pattern."
|
||||
|
||||
@@ -106,8 +106,7 @@ adcclk:
|
||||
store_result_in_t: false
|
||||
command_name: adcclk
|
||||
function_alias: adcclk
|
||||
help: "[n_clk in MHz]\n\t[Ctb] ADC clock frequency in MHz.\n\t[xilinx Ctb] ADC clock\
|
||||
\ frequency in kHz."
|
||||
help: "[n_clk in MHz]\n\t[Ctb] ADC clock frequency in MHz."
|
||||
infer_action: true
|
||||
template: true
|
||||
adcenable:
|
||||
@@ -2220,8 +2219,7 @@ dbitclk:
|
||||
store_result_in_t: false
|
||||
command_name: dbitclk
|
||||
function_alias: dbitclk
|
||||
help: "[n_clk in MHz]\n\t[Ctb] Clock for latching the digital bits in MHz.\n\t[xilinx\
|
||||
\ Ctb] Clock for latching the digital bits in kHz."
|
||||
help: "[n_clk in MHz]\n\t[Ctb] Clock for latching the digital bits in MHz."
|
||||
infer_action: true
|
||||
template: true
|
||||
dbitphase:
|
||||
@@ -4988,32 +4986,6 @@ imagetest:
|
||||
\ pixel intensity incremented by 1. If 1, all pixels almost saturated."
|
||||
infer_action: true
|
||||
template: true
|
||||
include:
|
||||
actions:
|
||||
PUT:
|
||||
args:
|
||||
- arg_types:
|
||||
- special::path
|
||||
argc: 1
|
||||
cast_input:
|
||||
- false
|
||||
check_det_id: true
|
||||
convert_det_id: true
|
||||
function: loadParameters
|
||||
input:
|
||||
- args[0]
|
||||
input_types:
|
||||
- std::string
|
||||
output:
|
||||
- args.front()
|
||||
require_det_id: false
|
||||
store_result_in_t: false
|
||||
command_name: include
|
||||
function_alias: include
|
||||
help: "\n\tSets detector measurement parameters to those contained in fname. Set\
|
||||
\ up per measurement. Same as parameters command."
|
||||
infer_action: true
|
||||
template: true
|
||||
initialchecks:
|
||||
actions:
|
||||
GET:
|
||||
@@ -6543,7 +6515,7 @@ patternstart:
|
||||
store_result_in_t: false
|
||||
command_name: patternstart
|
||||
function_alias: patternstart
|
||||
help: "\n\t[Mythen3][Ctb][Xilinx Ctb] Starts Pattern"
|
||||
help: "\n\t[Mythen3] Starts Pattern"
|
||||
infer_action: true
|
||||
template: true
|
||||
patwait:
|
||||
@@ -8161,7 +8133,7 @@ runclk:
|
||||
store_result_in_t: false
|
||||
command_name: runclk
|
||||
function_alias: runclk
|
||||
help: "[n_clk in MHz]\n\t[Ctb] Run clock in MHz.\n\t[xilinx Ctb] Run clock in kHz."
|
||||
help: "[n_clk in MHz]\n\t[Ctb] Run clock in MHz."
|
||||
infer_action: true
|
||||
template: true
|
||||
runtime:
|
||||
|
||||
@@ -1612,16 +1612,16 @@ class Detector {
|
||||
/** [CTB] */
|
||||
void setNumberOfAnalogSamples(int value, Positions pos = {});
|
||||
|
||||
/** [CTB] in MHz, [XCTB] in kHz */
|
||||
/** [CTB] */
|
||||
Result<int> getADCClock(Positions pos = {}) const;
|
||||
|
||||
/** [CTB] in MHz, [XCTB] in kHz */
|
||||
/** [CTB] */
|
||||
void setADCClock(int value_in_MHz, Positions pos = {});
|
||||
|
||||
/** [CTB] in MHz, [XCTB] in kHz */
|
||||
/** [CTB] */
|
||||
Result<int> getRUNClock(Positions pos = {}) const;
|
||||
|
||||
/** [CTB] in MHz, [XCTB] in kHz */
|
||||
/** [CTB] */
|
||||
void setRUNClock(int value_in_MHz, Positions pos = {});
|
||||
|
||||
/** [CTB] in MHZ */
|
||||
@@ -1691,10 +1691,10 @@ class Detector {
|
||||
*/
|
||||
void setReadoutMode(defs::readoutMode value, Positions pos = {});
|
||||
|
||||
/** [CTB] in MHz, [XCTB] in kHz */
|
||||
/** [CTB] */
|
||||
Result<int> getDBITClock(Positions pos = {}) const;
|
||||
|
||||
/** [CTB] in MHz, [XCTB] in kHz */
|
||||
/** [CTB] */
|
||||
void setDBITClock(int value_in_MHz, Positions pos = {});
|
||||
|
||||
/**
|
||||
@@ -1943,7 +1943,7 @@ class Detector {
|
||||
* selected bits */
|
||||
void setPatternBitMask(uint64_t mask, Positions pos = {});
|
||||
|
||||
/** [CTB][Mythen3][Xilinx CTB] */
|
||||
/** [Mythen3] */
|
||||
void startPattern(Positions pos = {});
|
||||
///@}
|
||||
|
||||
|
||||
@@ -73,8 +73,7 @@ std::string Caller::adcclk(int action) {
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << R"V0G0N([n_clk in MHz]
|
||||
[Ctb] ADC clock frequency in MHz.
|
||||
[xilinx Ctb] ADC clock frequency in kHz. )V0G0N"
|
||||
[Ctb] ADC clock frequency in MHz. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
@@ -2806,8 +2805,7 @@ std::string Caller::dbitclk(int action) {
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << R"V0G0N([n_clk in MHz]
|
||||
[Ctb] Clock for latching the digital bits in MHz.
|
||||
[xilinx Ctb] Clock for latching the digital bits in kHz. )V0G0N"
|
||||
[Ctb] Clock for latching the digital bits in MHz. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
@@ -6375,48 +6373,6 @@ std::string Caller::imagetest(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string Caller::include(int action) {
|
||||
|
||||
std::ostringstream os;
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << R"V0G0N(
|
||||
Sets detector measurement parameters to those contained in fname. Set up per measurement. Same as parameters command. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
// check if action and arguments are valid
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (1 && args.size() != 1) {
|
||||
throw RuntimeError("Wrong number of arguments for action PUT");
|
||||
}
|
||||
|
||||
if (args.size() == 1) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
throw RuntimeError(
|
||||
"INTERNAL ERROR: Invalid action: supported actions are ['PUT']");
|
||||
}
|
||||
|
||||
// generate code for each action
|
||||
if (action == slsDetectorDefs::PUT_ACTION) {
|
||||
if (args.size() == 1) {
|
||||
if (det_id != -1) {
|
||||
throw RuntimeError("Cannot execute include at module level");
|
||||
}
|
||||
det->loadParameters(args[0]);
|
||||
os << args.front() << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string Caller::initialchecks(int action) {
|
||||
|
||||
std::ostringstream os;
|
||||
@@ -8496,7 +8452,7 @@ std::string Caller::patternstart(int action) {
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << R"V0G0N(
|
||||
[Mythen3][Xilinx Ctb] Starts Pattern )V0G0N"
|
||||
[Mythen3] Starts Pattern )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
@@ -10473,8 +10429,7 @@ std::string Caller::runclk(int action) {
|
||||
// print help
|
||||
if (action == slsDetectorDefs::HELP_ACTION) {
|
||||
os << R"V0G0N([n_clk in MHz]
|
||||
[Ctb] Run clock in MHz.
|
||||
[xilinx Ctb] Run clock in kHz. )V0G0N"
|
||||
[Ctb] Run clock in MHz. )V0G0N"
|
||||
<< std::endl;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
@@ -161,7 +161,6 @@ class Caller {
|
||||
std::string im_d(int action);
|
||||
std::string im_io(int action);
|
||||
std::string imagetest(int action);
|
||||
std::string include(int action);
|
||||
std::string initialchecks(int action);
|
||||
std::string inj_ch(int action);
|
||||
std::string interpolation(int action);
|
||||
@@ -506,7 +505,6 @@ class Caller {
|
||||
{"im_d", &Caller::im_d},
|
||||
{"im_io", &Caller::im_io},
|
||||
{"imagetest", &Caller::imagetest},
|
||||
{"include", &Caller::include},
|
||||
{"initialchecks", &Caller::initialchecks},
|
||||
{"inj_ch", &Caller::inj_ch},
|
||||
{"interpolation", &Caller::interpolation},
|
||||
|
||||
@@ -27,10 +27,6 @@ void CmdParser::Parse(std::string s) {
|
||||
// taking s by value we can modify it.
|
||||
Reset();
|
||||
|
||||
// If the string is empty there is nothing to parse
|
||||
if (s.empty())
|
||||
return;
|
||||
|
||||
// Are we looking at -h --help? avoid removing h from command starting
|
||||
// with h when combined with detector id (ex, 1-hostname)
|
||||
bool h = replace_first(&s, "--help", " ");
|
||||
|
||||
@@ -1202,7 +1202,7 @@ void Module::setDestinationUDPIP(const IpAddr ip) {
|
||||
}
|
||||
sendToDetector(F_SET_DEST_UDP_IP, ip, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
MacAddr retval;
|
||||
MacAddr retval(0LU);
|
||||
sendToReceiver(F_SET_RECEIVER_UDP_IP, ip, retval);
|
||||
LOG(logINFO) << "Setting destination udp mac of Module " << moduleIndex
|
||||
<< " to " << retval;
|
||||
@@ -1225,7 +1225,7 @@ void Module::setDestinationUDPIP2(const IpAddr ip) {
|
||||
}
|
||||
sendToDetector(F_SET_DEST_UDP_IP2, ip, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
MacAddr retval;
|
||||
MacAddr retval(0LU);
|
||||
sendToReceiver(F_SET_RECEIVER_UDP_IP2, ip, retval);
|
||||
LOG(logINFO) << "Setting destination udp mac2 of Module " << moduleIndex
|
||||
<< " to " << retval;
|
||||
|
||||
@@ -25,27 +25,15 @@
|
||||
#include <sys/stat.h> // fstat
|
||||
#include <unistd.h>
|
||||
|
||||
// ********************** Defines for shared memory. **********************
|
||||
// WARNING! before chaning these search the codebase for their usage!
|
||||
|
||||
#define SHM_IS_VALID_CHECK_VERSION 0x250820
|
||||
|
||||
//Max shared memory name length in macOS is 31 characters
|
||||
#ifdef __APPLE__
|
||||
#define SHM_DETECTOR_PREFIX "/sls_"
|
||||
#define SHM_MODULE_PREFIX "_mod_"
|
||||
#else
|
||||
#define SHM_DETECTOR_PREFIX "/slsDetectorPackage_detector_"
|
||||
#define SHM_MODULE_PREFIX "_module_"
|
||||
#endif
|
||||
|
||||
#define SHM_ENV_NAME "SLSDETNAME"
|
||||
// ************************************************************************
|
||||
|
||||
namespace sls {
|
||||
|
||||
class CtbConfig;
|
||||
struct CtbConfig;
|
||||
// struct sharedDetector;
|
||||
|
||||
#define SHM_IS_VALID_CHECK_VERSION 0x250820
|
||||
#define SHM_DETECTOR_PREFIX "/slsDetectorPackage_detector_"
|
||||
#define SHM_MODULE_PREFIX "_module_"
|
||||
#define SHM_ENV_NAME "SLSDETNAME"
|
||||
|
||||
template <typename T, typename U> constexpr bool is_type() {
|
||||
return std::is_same_v<std::decay_t<U>, T>;
|
||||
@@ -279,11 +267,6 @@ template <typename T> class SharedMemory {
|
||||
throw SharedMemoryError(msg);
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
// On macOS, fstat returns the allocated size and not the requested size.
|
||||
// This means we can't check for size since we always get for example 16384 bytes.
|
||||
return;
|
||||
#endif
|
||||
auto actual_size = static_cast<size_t>(sb.st_size);
|
||||
auto expected_size = sizeof(T);
|
||||
if (actual_size != expected_size) {
|
||||
|
||||
@@ -1618,18 +1618,6 @@ int InferAction::imagetest() {
|
||||
}
|
||||
}
|
||||
|
||||
int InferAction::include() {
|
||||
|
||||
if (args.size() == 1) {
|
||||
return slsDetectorDefs::PUT_ACTION;
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
throw RuntimeError("Could not infer action: Wrong number of arguments");
|
||||
}
|
||||
}
|
||||
|
||||
int InferAction::initialchecks() {
|
||||
|
||||
if (args.size() == 0) {
|
||||
|
||||
@@ -116,7 +116,6 @@ class InferAction {
|
||||
int im_d();
|
||||
int im_io();
|
||||
int imagetest();
|
||||
int include();
|
||||
int initialchecks();
|
||||
int inj_ch();
|
||||
int interpolation();
|
||||
@@ -449,7 +448,6 @@ class InferAction {
|
||||
{"im_d", &InferAction::im_d},
|
||||
{"im_io", &InferAction::im_io},
|
||||
{"imagetest", &InferAction::imagetest},
|
||||
{"include", &InferAction::include},
|
||||
{"initialchecks", &InferAction::initialchecks},
|
||||
{"inj_ch", &InferAction::inj_ch},
|
||||
{"interpolation", &InferAction::interpolation},
|
||||
|
||||
@@ -8,7 +8,6 @@ target_sources(tests PRIVATE
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-rx.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-rx-running.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-pattern.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-eiger.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-jungfrau.cpp
|
||||
|
||||
@@ -1025,43 +1025,91 @@ TEST_CASE("dbitclk", "[.cmdcall]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("v_abcd", "[.cmdcall]") {
|
||||
TEST_CASE("v_a", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
std::vector<std::string> cmds{"v_a", "v_b", "v_c", "v_d"};
|
||||
std::vector<defs::dacIndex> indices{defs::V_POWER_A, defs::V_POWER_B,
|
||||
defs::V_POWER_C, defs::V_POWER_D};
|
||||
|
||||
if (det.isVirtualDetectorServer().tsquash("Inconsistent virtual servers")) {
|
||||
cmds.push_back("v_io");
|
||||
indices.push_back(defs::V_POWER_IO);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < cmds.size(); ++i) {
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
auto prev_val = det.getPower(indices[i]);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
caller.call(cmds[i], {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == cmds[i] + " 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call(cmds[i], {"1200"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == cmds[i] + " 1200\n");
|
||||
caller.call(cmds[i], {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == cmds[i] + " 1200\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPower(indices[i], prev_val[i], {i});
|
||||
}
|
||||
|
||||
} else {
|
||||
REQUIRE_THROWS(caller.call(cmds[i], {}, -1, GET));
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
auto prev_val = det.getPower(defs::V_POWER_A);
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("v_a", {"1200"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "v_a 1200\n");
|
||||
caller.call("v_a", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "v_a 1200\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPower(defs::V_POWER_A, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(caller.call("v_a", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("v_b", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
auto prev_val = det.getPower(defs::V_POWER_B);
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("v_b", {"1200"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "v_b 1200\n");
|
||||
caller.call("v_b", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "v_b 1200\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPower(defs::V_POWER_B, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(caller.call("v_b", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("v_c", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
auto prev_val = det.getPower(defs::V_POWER_C);
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("v_c", {"1200"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "v_c 1200\n");
|
||||
caller.call("v_c", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "v_c 1200\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPower(defs::V_POWER_C, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(caller.call("v_c", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("v_d", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
auto prev_val = det.getPower(defs::V_POWER_D);
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
caller.call("v_d", {"1200"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "v_d 1200\n");
|
||||
caller.call("v_d", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "v_d 1200\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPower(defs::V_POWER_D, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(caller.call("v_d", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -436,8 +436,7 @@ TEST_CASE("patternstart", "[.cmdcall]") {
|
||||
Caller caller(&det);
|
||||
REQUIRE_THROWS(caller.call("patternstart", {}, -1, GET));
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::MYTHEN3 || det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
if (det_type == defs::MYTHEN3) {
|
||||
REQUIRE_NOTHROW(caller.call("patternstart", {}, -1, PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(caller.call("patternstart", {}, -1, PUT));
|
||||
|
||||
@@ -1,239 +0,0 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2025 Contributors to the SLS Detector Package
|
||||
#include "Caller.h"
|
||||
#include "catch.hpp"
|
||||
#include "sls/Detector.h"
|
||||
#include "tests/globals.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace sls {
|
||||
|
||||
using test::PUT;
|
||||
|
||||
TEST_CASE("Ctb and xilinx - cant put if receiver is not idle",
|
||||
"[.cmdcall][.rx]") {
|
||||
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::XILINX_CHIPTESTBOARD) {
|
||||
auto prev_romode = det.getReadoutMode();
|
||||
auto prev_asamples = det.getNumberOfAnalogSamples();
|
||||
auto prev_dsamples = det.getNumberOfDigitalSamples();
|
||||
auto prev_tsamples = det.getNumberOfTransceiverSamples();
|
||||
auto prev_adcenable10g = det.getTenGigaADCEnableMask();
|
||||
auto prev_trasnsceiverenable = det.getTransceiverEnableMask();
|
||||
auto prev_rxdbitlist = det.getRxDbitList();
|
||||
auto prev_rxdbitoffset = det.getRxDbitOffset();
|
||||
auto prev_rxdbitreorder = det.getRxDbitReorder();
|
||||
|
||||
// start receiver
|
||||
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
|
||||
|
||||
REQUIRE_THROWS(caller.call("romode", {"digital"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("asamples", {"5"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("dsamples", {"100"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("tsamples", {"2"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("adcenable10g", {"0xFF00FFFF"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("transceiverenable", {"0x3"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("rx_dbitlist", {"{1,2,10}"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("rx_dbitoffset", {"5"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("rx_dbitreorder", {"0"}, -1, PUT));
|
||||
|
||||
// stop receiver
|
||||
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
|
||||
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setReadoutMode(prev_romode[i], {i});
|
||||
det.setNumberOfAnalogSamples(prev_asamples[i], {i});
|
||||
det.setNumberOfDigitalSamples(prev_dsamples[i], {i});
|
||||
det.setNumberOfTransceiverSamples(prev_tsamples[i], {i});
|
||||
det.setTenGigaADCEnableMask(prev_adcenable10g[i], {i});
|
||||
det.setTransceiverEnableMask(prev_trasnsceiverenable[i], {i});
|
||||
det.setRxDbitList(prev_rxdbitlist[i], {i});
|
||||
det.setRxDbitOffset(prev_rxdbitoffset[i], {i});
|
||||
det.setRxDbitReorder(prev_rxdbitreorder[i], {i});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("adcenable - cant put if receiver is not idle", "[.cmdcall][.rx]") {
|
||||
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
auto prev_adcenable = det.getADCEnableMask();
|
||||
|
||||
// start receiver
|
||||
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
|
||||
|
||||
REQUIRE_THROWS(caller.call("adcenable", {"0xFFFFFF00"}, -1, PUT));
|
||||
|
||||
// stop receiver
|
||||
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
|
||||
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setADCEnableMask(prev_adcenable[i], {i});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("bursts - cant put if receiver is not idle", "[.cmdcall][.rx]") {
|
||||
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
auto prev_burst =
|
||||
det.getNumberOfBursts().tsquash("#bursts should be same to test");
|
||||
|
||||
// start receiver
|
||||
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
|
||||
|
||||
REQUIRE_THROWS(caller.call("bursts", {"20"}, -1, PUT));
|
||||
|
||||
// stop receiver
|
||||
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
|
||||
|
||||
det.setNumberOfBursts(prev_burst);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("counters - cant put if receiver is not idle", "[.cmdcall][.rx]") {
|
||||
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::MYTHEN3) {
|
||||
auto prev_counters = det.getCounterMask();
|
||||
|
||||
// start receiver
|
||||
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
|
||||
|
||||
REQUIRE_THROWS(caller.call("counters", {"0 1 2"}, -1, PUT));
|
||||
|
||||
// stop receiver
|
||||
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
|
||||
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setCounterMask(prev_counters[i], {i});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("numinterfaces - cant put if receiver is not idle",
|
||||
"[.cmdcall][.rx]") {
|
||||
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
|
||||
auto prev_numinterfaces = det.getNumberofUDPInterfaces();
|
||||
|
||||
// start receiver
|
||||
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
|
||||
|
||||
REQUIRE_THROWS(caller.call("numinterafaces", {"2"}, -1, PUT));
|
||||
|
||||
// stop receiver
|
||||
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
|
||||
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setNumberofUDPInterfaces(prev_numinterfaces[i], {i});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("dr - cant put if receiver is not idle", "[.cmdcall][.rx]") {
|
||||
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::EIGER || det_type == defs::MYTHEN3) {
|
||||
auto prev_dr =
|
||||
det.getDynamicRange().tsquash("dr should be same to test");
|
||||
|
||||
// start receiver
|
||||
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
|
||||
|
||||
REQUIRE_THROWS(caller.call("dr", {"16"}, -1, PUT));
|
||||
|
||||
// stop receiver
|
||||
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
|
||||
|
||||
det.setDynamicRange(prev_dr);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("tengiga - cant put if receiver is not idle", "[.cmdcall][.rx]") {
|
||||
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::EIGER || det_type == defs::MYTHEN3 ||
|
||||
det_type == defs::CHIPTESTBOARD) {
|
||||
auto prev_tengiga = det.getTenGiga();
|
||||
|
||||
// start receiver
|
||||
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
|
||||
|
||||
REQUIRE_THROWS(caller.call("tengiga", {"1"}, -1, PUT));
|
||||
|
||||
// stop receiver
|
||||
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
|
||||
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setTenGiga(prev_tengiga[i], {i});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("general - cant put if receiver is not idle", "[.cmdcall][.rx]") {
|
||||
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
|
||||
{
|
||||
auto prev_frames =
|
||||
det.getNumberOfFrames().tsquash("#frames should be same to test");
|
||||
auto prev_triggers =
|
||||
det.getNumberOfTriggers().tsquash("#triggers must be same to test");
|
||||
auto prev_findex = det.getAcquisitionIndex();
|
||||
auto prev_fwrite = det.getFileWrite();
|
||||
auto prev_fifodepth = det.getRxFifoDepth();
|
||||
auto rx_hostname = det.getRxHostname();
|
||||
|
||||
// start receiver
|
||||
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
|
||||
|
||||
REQUIRE_THROWS(caller.call("frames", {"10"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("triggers", {"5"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("findex", {"2"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("fwrite", {"0"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("rx_fifodepth", {"1000"}, -1, PUT));
|
||||
REQUIRE_THROWS(caller.call("rx_hostname", {rx_hostname[0]}, 0, PUT));
|
||||
|
||||
// stop receiver
|
||||
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
|
||||
|
||||
det.setNumberOfFrames(prev_frames);
|
||||
det.setNumberOfTriggers(prev_triggers);
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setAcquisitionIndex(prev_findex[i], {i});
|
||||
det.setFileWrite(prev_fwrite[i], {i});
|
||||
det.setRxFifoDepth(prev_fifodepth[i], {i});
|
||||
det.setRxHostname(rx_hostname[i], {i});
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace sls
|
||||
@@ -46,46 +46,32 @@ TEST_CASE("config", "[.cmdcall]") {
|
||||
|
||||
// free: not testing
|
||||
|
||||
void test_include_file(const std::string &cmd) {
|
||||
TEST_CASE("parameters", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
|
||||
// put only
|
||||
REQUIRE_THROWS(caller.call(cmd, {}, -1, GET));
|
||||
|
||||
auto prev_frames = det.getNumberOfFrames().tsquash(
|
||||
"Number of frames has to be same to test");
|
||||
auto prev_fwrite =
|
||||
det.getFileWrite().tsquash("File write enable has to be same to test");
|
||||
|
||||
{
|
||||
system("echo -e 'frames 2\nfwrite 1' > /tmp/tempsetup.det ");
|
||||
std::ostringstream oss;
|
||||
caller.call(cmd, {"/tmp/tempsetup.det"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == cmd + " /tmp/tempsetup.det\n");
|
||||
REQUIRE(det.getNumberOfFrames().tsquash(
|
||||
"frames inconsistent and failed") == 2);
|
||||
REQUIRE(det.getFileWrite().tsquash("fwrite inconsistent and failed") ==
|
||||
1);
|
||||
}
|
||||
{
|
||||
system("echo -e 'frames 3\nfwrite 0' > /tmp/tempsetup.det ");
|
||||
std::ostringstream oss;
|
||||
caller.call(cmd, {"/tmp/tempsetup.det"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == cmd + " /tmp/tempsetup.det\n");
|
||||
REQUIRE(det.getNumberOfFrames().tsquash(
|
||||
"frames inconsistent and failed") == 3);
|
||||
REQUIRE(det.getFileWrite().tsquash("fwrite inconsistent and failed") ==
|
||||
0);
|
||||
}
|
||||
det.setNumberOfFrames(prev_frames);
|
||||
det.setFileWrite(prev_fwrite);
|
||||
REQUIRE_THROWS(caller.call("parameters", {}, -1, GET));
|
||||
/*
|
||||
auto prev_val = det.getNumberOfFrames().tsquash("Number of frames has to
|
||||
be same to test");
|
||||
{
|
||||
system("echo 'frames 2' > /tmp/tempsetup.det ");
|
||||
std::ostringstream oss;
|
||||
caller.call("parameters", {"/tmp/tempsetup.det"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "parameters /tmp/tempsetup.det\n");
|
||||
REQUIRE(det.getNumberOfFrames().tsquash("failed") == 2);
|
||||
}
|
||||
{
|
||||
system("echo '0:frames 1' > /tmp/tempsetup.det ");
|
||||
std::ostringstream oss;
|
||||
caller.call("parameters", {"/tmp/tempsetup.det"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "parameters /tmp/tempsetup.det\n");
|
||||
REQUIRE(det.getNumberOfFrames({0}).tsquash("failed") == 1);
|
||||
}
|
||||
det.setNumberOfFrames(prev_val);
|
||||
*/
|
||||
}
|
||||
|
||||
TEST_CASE("parameters", "[.cmdcall]") { test_include_file("parameters"); }
|
||||
|
||||
TEST_CASE("include", "[.cmdcall]") { test_include_file("include"); }
|
||||
|
||||
TEST_CASE("hostname", "[.cmdcall]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
|
||||
@@ -38,16 +38,10 @@ void freeShm(const int dindex, const int mIndex) {
|
||||
}
|
||||
|
||||
constexpr int shm_id = 10;
|
||||
|
||||
//macOS does not expose shm in the filesystem
|
||||
#ifndef __APPLE__
|
||||
|
||||
const std::string file_path =
|
||||
std::string("/dev/shm/slsDetectorPackage_detector_") +
|
||||
std::to_string(shm_id);
|
||||
|
||||
|
||||
|
||||
TEST_CASE("Free obsolete (without isValid)", "[detector][shm]") {
|
||||
|
||||
// ensure its clean to start
|
||||
@@ -95,8 +89,6 @@ TEST_CASE("Free obsolete (without isValid)", "[detector][shm]") {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
TEST_CASE("Create SharedMemory read and write", "[detector][shm]") {
|
||||
SharedMemory<Data> shm(shm_id, -1);
|
||||
if (shm.exists()) {
|
||||
@@ -104,9 +96,9 @@ TEST_CASE("Create SharedMemory read and write", "[detector][shm]") {
|
||||
}
|
||||
shm.createSharedMemory();
|
||||
|
||||
const char *env_p = std::getenv(SHM_ENV_NAME);
|
||||
const char *env_p = std::getenv("SLSDETNAME");
|
||||
std::string env_name = env_p ? ("_" + std::string(env_p)) : "";
|
||||
CHECK(shm.getName() == std::string(SHM_DETECTOR_PREFIX) +
|
||||
CHECK(shm.getName() == std::string("/slsDetectorPackage_detector_") +
|
||||
std::to_string(shm_id) + env_name);
|
||||
shm()->x = 3;
|
||||
shm()->y = 5.7;
|
||||
@@ -176,11 +168,11 @@ TEST_CASE("Open two shared memories to the same place", "[detector][shm]") {
|
||||
}
|
||||
|
||||
TEST_CASE("Move SharedMemory", "[detector][shm]") {
|
||||
const char *env_p = std::getenv(SHM_ENV_NAME);
|
||||
const char *env_p = std::getenv("SLSDETNAME");
|
||||
std::string env_name = env_p ? ("_" + std::string(env_p)) : "";
|
||||
|
||||
SharedMemory<Data> shm(shm_id, -1);
|
||||
CHECK(shm.getName() == std::string(SHM_DETECTOR_PREFIX) +
|
||||
CHECK(shm.getName() == std::string("/slsDetectorPackage_detector_") +
|
||||
std::to_string(shm_id) + env_name);
|
||||
shm.createSharedMemory();
|
||||
shm()->x = 9;
|
||||
@@ -191,13 +183,13 @@ TEST_CASE("Move SharedMemory", "[detector][shm]") {
|
||||
CHECK(shm2()->x == 9);
|
||||
REQUIRE_THROWS(
|
||||
shm()); // trying to access should throw instead of returning a nullptr
|
||||
CHECK(shm2.getName() == std::string(SHM_DETECTOR_PREFIX) +
|
||||
CHECK(shm2.getName() == std::string("/slsDetectorPackage_detector_") +
|
||||
std::to_string(shm_id) + env_name);
|
||||
shm2.removeSharedMemory();
|
||||
}
|
||||
|
||||
TEST_CASE("Create several shared memories", "[detector][shm]") {
|
||||
const char *env_p = std::getenv(SHM_ENV_NAME);
|
||||
const char *env_p = std::getenv("SLSDETNAME");
|
||||
std::string env_name = env_p ? ("_" + std::string(env_p)) : "";
|
||||
|
||||
constexpr int N = 5;
|
||||
@@ -213,7 +205,7 @@ TEST_CASE("Create several shared memories", "[detector][shm]") {
|
||||
|
||||
for (int i = 0; i != N; ++i) {
|
||||
CHECK(v[i]()->x == i);
|
||||
CHECK(v[i].getName() == std::string(SHM_DETECTOR_PREFIX) +
|
||||
CHECK(v[i].getName() == std::string("/slsDetectorPackage_detector_") +
|
||||
std::to_string(i + shm_id) + env_name);
|
||||
}
|
||||
|
||||
@@ -224,12 +216,12 @@ TEST_CASE("Create several shared memories", "[detector][shm]") {
|
||||
}
|
||||
|
||||
TEST_CASE("Create create a shared memory with a tag") {
|
||||
const char *env_p = std::getenv(SHM_ENV_NAME);
|
||||
const char *env_p = std::getenv("SLSDETNAME");
|
||||
std::string env_name = env_p ? ("_" + std::string(env_p)) : "";
|
||||
|
||||
SharedMemory<Data> shm(0, -1, "ctbdacs");
|
||||
REQUIRE(shm.getName() ==
|
||||
std::string(SHM_DETECTOR_PREFIX) + "0" + env_name + "_ctbdacs");
|
||||
"/slsDetectorPackage_detector_0" + env_name + "_ctbdacs");
|
||||
}
|
||||
|
||||
TEST_CASE("Create create a shared memory with a tag when SLSDETNAME is set") {
|
||||
@@ -243,7 +235,7 @@ TEST_CASE("Create create a shared memory with a tag when SLSDETNAME is set") {
|
||||
setenv(SHM_ENV_NAME, "myprefix", 1);
|
||||
|
||||
SharedMemory<Data> shm(0, -1, "ctbdacs");
|
||||
REQUIRE(shm.getName() == std::string(SHM_DETECTOR_PREFIX) + "0_myprefix_ctbdacs");
|
||||
REQUIRE(shm.getName() == "/slsDetectorPackage_detector_0_myprefix_ctbdacs");
|
||||
|
||||
// Clean up after us
|
||||
if (old_slsdetname.empty())
|
||||
|
||||
@@ -49,7 +49,7 @@ target_link_libraries(slsReceiverObject
|
||||
slsProjectOptions
|
||||
slsSupportStatic
|
||||
PRIVATE
|
||||
slsProjectWarnings #don't propagate warnings
|
||||
slsProjectWarnings #don't propagate warnigns
|
||||
)
|
||||
|
||||
target_compile_definitions(slsReceiverObject
|
||||
@@ -118,6 +118,8 @@ if (SLS_USE_RECEIVER_BINARIES)
|
||||
target_link_libraries(slsReceiver PUBLIC
|
||||
PUBLIC
|
||||
slsReceiverStatic
|
||||
pthread
|
||||
rt
|
||||
PRIVATE
|
||||
slsProjectWarnings
|
||||
)
|
||||
@@ -136,6 +138,8 @@ if (SLS_USE_RECEIVER_BINARIES)
|
||||
target_link_libraries(slsMultiReceiver
|
||||
PUBLIC
|
||||
slsReceiverStatic
|
||||
pthread
|
||||
rt
|
||||
PRIVATE
|
||||
slsProjectWarnings
|
||||
)
|
||||
@@ -154,19 +158,13 @@ if (SLS_USE_RECEIVER_BINARIES)
|
||||
target_link_libraries(slsFrameSynchronizer
|
||||
PUBLIC
|
||||
slsReceiverStatic
|
||||
pthread
|
||||
rt
|
||||
PRIVATE
|
||||
slsProjectWarnings
|
||||
|
||||
"$<BUILD_INTERFACE:libzmq-static>"
|
||||
)
|
||||
|
||||
#Treat both vendored and system zmq as interface for receiver binaries
|
||||
if(SLS_USE_SYSTEM_ZMQ)
|
||||
message(STATUS "slsFrameSynchronizer ZEROMQ_TARGET=${ZEROMQ_TARGET}")
|
||||
target_link_libraries(slsFrameSynchronizer PRIVATE "${ZEROMQ_TARGET}")
|
||||
else()
|
||||
target_link_libraries(slsFrameSynchronizer PRIVATE "$<BUILD_INTERFACE:libzmq-static>")
|
||||
endif()
|
||||
|
||||
install(TARGETS slsReceiver slsMultiReceiver slsFrameSynchronizer
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
|
||||
@@ -554,7 +554,6 @@ int ClientInterface::set_num_analog_samples(Interface &socket) {
|
||||
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD) {
|
||||
functionNotImplemented();
|
||||
}
|
||||
verifyIdle(socket);
|
||||
try {
|
||||
impl()->setNumberofAnalogSamples(value);
|
||||
} catch (const std::exception &e) {
|
||||
@@ -571,7 +570,6 @@ int ClientInterface::set_num_digital_samples(Interface &socket) {
|
||||
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD) {
|
||||
functionNotImplemented();
|
||||
}
|
||||
verifyIdle(socket);
|
||||
try {
|
||||
impl()->setNumberofDigitalSamples(value);
|
||||
} catch (const std::exception &e) {
|
||||
@@ -1767,7 +1765,6 @@ int ClientInterface::set_num_transceiver_samples(Interface &socket) {
|
||||
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD) {
|
||||
functionNotImplemented();
|
||||
}
|
||||
verifyIdle(socket);
|
||||
try {
|
||||
impl()->setNumberofTransceiverSamples(value);
|
||||
} catch (const std::exception &e) {
|
||||
|
||||
@@ -138,7 +138,8 @@ TEST_CASE("Parse version and help", "[detector]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Parse port and uid", "[detector]") {
|
||||
// TODO: fails on gitea CI due to uid issue, fix later
|
||||
TEST_CASE("Parse port and uid", "[.failsongitea][detector]") {
|
||||
uid_t uid = getuid();
|
||||
std::string uidStr = std::to_string(uid);
|
||||
uid_t invalidUid = uid + 1000;
|
||||
@@ -147,12 +148,8 @@ TEST_CASE("Parse port and uid", "[detector]") {
|
||||
for (auto app : {AppType::SingleReceiver, AppType::MultiReceiver,
|
||||
AppType::FrameSynchronizer}) {
|
||||
CommandLineOptions s(app);
|
||||
|
||||
// TODO! This test fails on gitea CI probably because the user can set the uid
|
||||
// commenting it out for now. Revisit later.
|
||||
// REQUIRE_THROWS(
|
||||
// s.parse({"", "-p", "1234", "-u", invalidUidStr})); // invalid uid
|
||||
|
||||
REQUIRE_THROWS(
|
||||
s.parse({"", "-p", "1234", "-u", invalidUidStr})); // invalid uid
|
||||
REQUIRE_THROWS(s.parse({"", "-p", "500"})); // invalid port
|
||||
|
||||
auto opts = s.parse({"", "-p", "1234", "-u", uidStr});
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
|
||||
|
||||
|
||||
set(SOURCES
|
||||
src/string_utils.cpp
|
||||
src/file_utils.cpp
|
||||
@@ -92,25 +89,13 @@ target_link_libraries(slsSupportObject
|
||||
PUBLIC
|
||||
slsProjectOptions
|
||||
${STD_FS_LIB} # from helpers.cmake
|
||||
Threads::Threads # slsDetector and Receiver need this
|
||||
|
||||
PRIVATE
|
||||
slsProjectWarnings
|
||||
md5sls
|
||||
"$<BUILD_INTERFACE:libzmq-static>"
|
||||
)
|
||||
|
||||
#RH8 glibc 2.28, RH9 glibc 2.34 linking rt is only needed with glibc < 2.34
|
||||
#but we do it for all Linux builds to avoid too many conditionals
|
||||
target_link_libraries (slsSupportObject PUBLIC $<$<PLATFORM_ID:Linux>:rt>)
|
||||
|
||||
#Treat both vendored and system zmq as interface for receiver binaries
|
||||
if(SLS_USE_SYSTEM_ZMQ)
|
||||
message(STATUS "slsSupportLib using ZEROMQ_TARGET=${ZEROMQ_TARGET}")
|
||||
target_link_libraries(slsSupportObject PRIVATE "${ZEROMQ_TARGET}")
|
||||
else()
|
||||
target_link_libraries(slsSupportObject PRIVATE "$<BUILD_INTERFACE:libzmq-static>")
|
||||
endif()
|
||||
|
||||
if (SLS_USE_TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif(SLS_USE_TESTS)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
/** API versions */
|
||||
#define APILIB "0.0.0 0x250909"
|
||||
#define APIRECEIVER "0.0.0 0x250822"
|
||||
#define APICTB "0.0.0 0x250922"
|
||||
#define APIGOTTHARD2 "0.0.0 0x250909"
|
||||
#define APIMOENCH "0.0.0 0x250909"
|
||||
#define APIEIGER "0.0.0 0x250909"
|
||||
#define APIXILINXCTB "0.0.0 0x251015"
|
||||
#define APIJUNGFRAU "0.0.0 0x250909"
|
||||
#define APIMYTHEN3 "0.0.0 0x250922"
|
||||
#define APILIB "10.0.0 0x250823"
|
||||
#define APIRECEIVER "10.0.0 0x250807"
|
||||
#define APICTB "10.0.0 0x250828"
|
||||
#define APIGOTTHARD2 "10.0.0 0x250828"
|
||||
#define APIMOENCH "10.0.0 0x250828"
|
||||
#define APIEIGER "10.0.0 0x250825"
|
||||
#define APIXILINXCTB "10.0.0 0x250828"
|
||||
#define APIJUNGFRAU "10.0.0 0x250828"
|
||||
#define APIMYTHEN3 "10.0.0 0x250828"
|
||||
|
||||
@@ -10,16 +10,11 @@
|
||||
#include <ios>
|
||||
#include <iostream>
|
||||
#include <libgen.h> // dirname
|
||||
#include <limits.h>
|
||||
#include <sstream>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h> //readlink
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <mach-o/dyld.h>
|
||||
#endif
|
||||
|
||||
namespace sls {
|
||||
|
||||
int readDataFile(std::ifstream &infile, short int *data, int nch, int offset) {
|
||||
@@ -251,40 +246,21 @@ std::vector<int> getChannelsFromFile(const std::string &fname) {
|
||||
}
|
||||
|
||||
std::string getAbsolutePathFromCurrentProcess(const std::string &fname) {
|
||||
|
||||
if (fname[0] == '/') {
|
||||
return fname;
|
||||
}
|
||||
|
||||
//in case PATH_MAX defines the longest possible path on linux and macOS
|
||||
//use string instead of char array to avoid overflow
|
||||
std::string path(PATH_MAX, '\0');
|
||||
|
||||
|
||||
#if defined(__APPLE__)
|
||||
uint32_t size = PATH_MAX;
|
||||
if (_NSGetExecutablePath(path.data(), &size) != 0) {
|
||||
throw std::runtime_error("Failed to get executable path");
|
||||
}
|
||||
// Resolve any symlinks and .. components
|
||||
std::string resolved(PATH_MAX, '\0');
|
||||
if (!realpath(path.data(), resolved.data())) {
|
||||
throw std::runtime_error("realpath failed for executable");
|
||||
}
|
||||
path = resolved;
|
||||
#else
|
||||
|
||||
|
||||
ssize_t len = readlink("/proc/self/exe", path.data(), PATH_MAX - 1);
|
||||
// get path of current binary
|
||||
char path[MAX_STR_LENGTH];
|
||||
memset(path, 0, MAX_STR_LENGTH);
|
||||
ssize_t len = readlink("/proc/self/exe", path, MAX_STR_LENGTH - 1);
|
||||
if (len < 0) {
|
||||
throw RuntimeError("Could not get absolute path for " + fname);
|
||||
}
|
||||
path[len] = '\0';
|
||||
|
||||
#endif
|
||||
|
||||
// get dir path and attach file name
|
||||
std::string absPath = (std::string(dirname(path.data())) + '/' + fname);
|
||||
std::string absPath = (std::string(dirname(path)) + '/' + fname);
|
||||
return absPath;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <netdb.h>
|
||||
#include <sstream>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
@@ -177,12 +178,6 @@ IpAddr InterfaceNameToIp(const std::string &ifn) {
|
||||
}
|
||||
|
||||
MacAddr InterfaceNameToMac(const std::string &inf) {
|
||||
|
||||
#ifdef __APPLE__
|
||||
throw RuntimeError(
|
||||
"InterfaceNameToMac not implemented on macOS yet");
|
||||
#else
|
||||
|
||||
// TODO! Copied from genericSocket needs to be refactored!
|
||||
struct ifreq ifr;
|
||||
char mac[32];
|
||||
@@ -208,7 +203,6 @@ MacAddr InterfaceNameToMac(const std::string &inf) {
|
||||
close(sock);
|
||||
}
|
||||
return MacAddr(mac);
|
||||
#endif
|
||||
}
|
||||
|
||||
void validatePortNumber(uint16_t port) {
|
||||
|
||||
@@ -72,10 +72,6 @@ TEST_CASE("Receive data from a vector") {
|
||||
CHECK(data_to_send == data_received);
|
||||
}
|
||||
|
||||
// TODO! Test blocking on apple, investigate when implementing
|
||||
// receiver support in macOS
|
||||
#ifndef __APPLE__
|
||||
|
||||
TEST_CASE("Shutdown socket without hanging when waiting for data") {
|
||||
constexpr int port = 50001;
|
||||
constexpr ssize_t packet_size = 8000;
|
||||
@@ -85,14 +81,13 @@ TEST_CASE("Shutdown socket without hanging when waiting for data") {
|
||||
// Start a thread and wait for package
|
||||
// if the socket is left open we would block
|
||||
std::future<bool> ret =
|
||||
std::async(std::launch::async, &UdpRxSocket::ReceivePacket, &s, (char *)&buff);
|
||||
std::async(&UdpRxSocket::ReceivePacket, &s, (char *)&buff);
|
||||
|
||||
s.Shutdown();
|
||||
auto r = ret.get();
|
||||
|
||||
CHECK(r == false); // since we didn't get the packet
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_CASE("Too small packet") {
|
||||
constexpr int port = 50001;
|
||||
|
||||
@@ -24,6 +24,8 @@ target_link_libraries(tests
|
||||
PUBLIC
|
||||
slsProjectOptions
|
||||
slsSupportStatic
|
||||
pthread
|
||||
rt
|
||||
PRIVATE
|
||||
slsProjectWarnings
|
||||
)
|
||||
@@ -62,5 +64,3 @@ configure_file(scripts/test_frame_synchronizer.py ${CMAKE_BINARY_DIR}/bin/test_f
|
||||
configure_file(scripts/utils_for_test.py ${CMAKE_BINARY_DIR}/bin/utils_for_test.py COPYONLY)
|
||||
configure_file(scripts/test_roi.py ${CMAKE_BINARY_DIR}/bin/test_roi.py COPYONLY)
|
||||
configure_file(scripts/test_free.py ${CMAKE_BINARY_DIR}/bin/test_free.py COPYONLY)
|
||||
configure_file(scripts/test_commands.py ${CMAKE_BINARY_DIR}/bin/test_commands.py COPYONLY)
|
||||
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
'''
|
||||
This file is used to start up simulators and test for freeing shm and accessing it from python.
|
||||
Run this using: pytest -s test_free.py
|
||||
'''
|
||||
|
||||
from time import time
|
||||
import pytest, sys, time
|
||||
|
||||
from slsdet import Detector, Ctb, freeSharedMemory
|
||||
from slsdet.defines import DEFAULT_TCP_RX_PORTNO
|
||||
from utils_for_test import (
|
||||
Log,
|
||||
LogLevel,
|
||||
cleanup,
|
||||
startDetectorVirtualServer,
|
||||
startProcessInBackground,
|
||||
loadConfig,
|
||||
loadBasicSettings
|
||||
)
|
||||
|
||||
def startReceiver(num_mods, fp):
|
||||
if num_mods == 1:
|
||||
cmd = ['slsReceiver']
|
||||
else:
|
||||
cmd = ['slsMultiReceiver', str(DEFAULT_TCP_RX_PORTNO), str(num_mods)]
|
||||
# in 10.0.0
|
||||
#cmd = ['slsMultiReceiver', '-p', str(DEFAULT_TCP_RX_PORTNO), '-n', str(num_mods)]
|
||||
startProcessInBackground(cmd, fp)
|
||||
time.sleep(1)
|
||||
|
||||
'''
|
||||
scope = module =>Once per test file/module
|
||||
to share expensive setup like startDetectorVirtualServer
|
||||
'''
|
||||
@pytest.fixture(scope="module")
|
||||
def det_config():
|
||||
return {
|
||||
"name": "ctb",
|
||||
"num_mods": 1
|
||||
}
|
||||
|
||||
# autouse is false to pass explictly
|
||||
@pytest.fixture(scope="module", autouse=False)
|
||||
def setup_simulator(det_config):
|
||||
"""Fixture to start the detector server once and clean up at the end."""
|
||||
fp = sys.stdout
|
||||
|
||||
cleanup(fp)
|
||||
# server
|
||||
startDetectorVirtualServer(det_config["name"], det_config["num_mods"], fp)
|
||||
# receiver
|
||||
startReceiver(det_config["num_mods"], fp)
|
||||
# config and basic settings
|
||||
d = loadConfig(name=det_config["name"], rx_hostname="localhost", settingsdir="", fp=fp, num_mods=det_config["num_mods"])
|
||||
loadBasicSettings(name=det_config["name"], d=d, fp=fp)
|
||||
|
||||
yield d # tests run here
|
||||
|
||||
cleanup(fp)
|
||||
|
||||
|
||||
|
||||
def test_parameters_file(setup_simulator):
|
||||
d = setup_simulator
|
||||
Log(LogLevel.INFOBLUE, f'\nRunning test_parameters_file')
|
||||
|
||||
assert isinstance(d, Detector)
|
||||
|
||||
with open("/tmp/params.det", "w") as f:
|
||||
f.write("frames 2\n")
|
||||
f.write("fwrite 1\n")
|
||||
|
||||
# this should not throw
|
||||
d.parameters = "/tmp/params.det"
|
||||
|
||||
assert d.frames == 2
|
||||
assert d.fwrite == 1
|
||||
|
||||
Log(LogLevel.INFOGREEN, f"✅ Test passed. Command: parameters")
|
||||
|
||||
|
||||
def test_include_file(setup_simulator):
|
||||
d = setup_simulator
|
||||
Log(LogLevel.INFOBLUE, f'\test_include_file test_parameters_file')
|
||||
|
||||
assert isinstance(d, Detector)
|
||||
|
||||
with open("/tmp/params.det", "w") as f:
|
||||
f.write("frames 3\n")
|
||||
f.write("fwrite 0\n")
|
||||
|
||||
# this should not throw
|
||||
d.include = "/tmp/params.det"
|
||||
|
||||
assert d.frames == 3
|
||||
assert d.fwrite == 0
|
||||
|
||||
Log(LogLevel.INFOGREEN, f"✅ Test passed. Command: include")
|
||||
@@ -113,7 +113,7 @@ def startTestsForAll(args, fp):
|
||||
startDetectorVirtualServer(server, args.num_mods, fp)
|
||||
startFrameSynchronizerPullSocket(server, fp)
|
||||
startFrameSynchronizer(args.num_mods, fp)
|
||||
d = loadConfig(name=server, rx_hostname=args.rx_hostname, settingsdir=args.settingspath, fp=fp, num_mods=args.num_mods, num_frames=args.num_frames)
|
||||
d = loadConfig(name=server, rx_hostname=args.rx_hostname, settingsdir=args.settingspath, log_file_fp=fp, num_mods=args.num_mods, num_frames=args.num_frames)
|
||||
loadBasicSettings(name=server, d=d, fp=fp)
|
||||
acquire(fp, d)
|
||||
testFramesCaught(server, d, args.num_frames)
|
||||
|
||||
@@ -18,9 +18,11 @@ from utils_for_test import (
|
||||
RuntimeException,
|
||||
cleanup,
|
||||
startProcessInBackground,
|
||||
startReceiver,
|
||||
startDetectorVirtualServer,
|
||||
connectToVirtualServers,
|
||||
loadBasicSettings,
|
||||
loadConfig,
|
||||
runProcessWithLogFile
|
||||
)
|
||||
|
||||
@@ -28,45 +30,6 @@ LOG_PREFIX_FNAME = '/tmp/slsDetectorPackage_virtual_roi_test'
|
||||
MAIN_LOG_FNAME = LOG_PREFIX_FNAME + '_log.txt'
|
||||
ROI_TEST_FNAME = LOG_PREFIX_FNAME + '_results_'
|
||||
|
||||
def startReceiver(num_mods, fp):
|
||||
if num_mods == 1:
|
||||
cmd = ['slsReceiver']
|
||||
else:
|
||||
cmd = ['slsMultiReceiver', str(DEFAULT_TCP_RX_PORTNO), str(num_mods)]
|
||||
# in 10.0.0
|
||||
#cmd = ['slsMultiReceiver', '-p', str(DEFAULT_TCP_RX_PORTNO), '-n', str(num_mods)]
|
||||
startProcessInBackground(cmd, fp)
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
def loadConfigForRoi(name, fp, num_mods = 1, num_interfaces = 1):
|
||||
Log(LogLevel.INFO, 'Loading config')
|
||||
Log(LogLevel.INFO, 'Loading config', fp)
|
||||
try:
|
||||
d = connectToVirtualServers(name, num_mods)
|
||||
|
||||
if name == 'jungfrau' or name == 'moench':
|
||||
d.numinterfaces = num_interfaces
|
||||
|
||||
d.udp_dstport = DEFAULT_UDP_DST_PORTNO
|
||||
if name == 'eiger' or name == 'jungfrau' or name == 'moench':
|
||||
d.udp_dstport2 = DEFAULT_UDP_DST_PORTNO + 1
|
||||
|
||||
d.rx_hostname = 'localhost'
|
||||
d.udp_dstip = 'auto'
|
||||
if name != "eiger":
|
||||
d.udp_srcip = 'auto'
|
||||
if name == 'jungfrau' or name == 'moench':
|
||||
d.udp_dstip2 = 'auto'
|
||||
d.powerchip = 1
|
||||
|
||||
d.frames = 5
|
||||
|
||||
except Exception as e:
|
||||
raise RuntimeException(f'Could not load config for {name}. Error: {str(e)}') from e
|
||||
|
||||
return d
|
||||
|
||||
def startTestsForAll(fp):
|
||||
servers = [
|
||||
'eiger',
|
||||
@@ -89,7 +52,7 @@ def startTestsForAll(fp):
|
||||
cleanup(fp)
|
||||
startDetectorVirtualServer(server, nmods, fp)
|
||||
startReceiver(nmods, fp)
|
||||
d = loadConfigForRoi(name=server, fp=fp, num_mods=nmods, num_interfaces=ninterfaces)
|
||||
d = loadConfig(name=server, log_file_fp = fp, num_mods=nmods, num_frames=5, num_interfaces=ninterfaces)
|
||||
loadBasicSettings(name=server, d=d, fp=fp)
|
||||
|
||||
fname = ROI_TEST_FNAME + server + '.txt'
|
||||
|
||||
@@ -63,7 +63,7 @@ def startCmdTestsForAll(args, fp):
|
||||
cleanup(fp)
|
||||
startDetectorVirtualServer(name=server, num_mods=num_mods, fp=fp)
|
||||
startReceiver(num_mods, fp)
|
||||
d = loadConfig(name=server, rx_hostname=args.rx_hostname, settingsdir=args.settingspath, fp=fp, num_mods=num_mods)
|
||||
d = loadConfig(name=server, rx_hostname=args.rx_hostname, settingsdir=args.settingspath, log_file_fp=fp, num_mods=num_mods)
|
||||
loadBasicSettings(name=server, d=d, fp=fp)
|
||||
runProcessWithLogFile('Cmd Tests (' + args.markers + ') for ' + server, cmd, fp, fname)
|
||||
except Exception as e:
|
||||
|
||||
@@ -16,7 +16,6 @@ SERVER_START_PORTNO=1900
|
||||
|
||||
init(autoreset=True)
|
||||
|
||||
|
||||
class LogLevel(Enum):
|
||||
INFO = 0
|
||||
INFORED = 1
|
||||
@@ -193,32 +192,51 @@ def connectToVirtualServers(name, num_mods, ctb_object=False):
|
||||
|
||||
return d
|
||||
|
||||
def startReceiver(num_mods, fp):
|
||||
if num_mods == 1:
|
||||
cmd = ['slsReceiver']
|
||||
else:
|
||||
cmd = ['slsMultiReceiver', str(DEFAULT_TCP_RX_PORTNO), str(num_mods)]
|
||||
# in 10.0.0
|
||||
#cmd = ['slsMultiReceiver', '-p', str(DEFAULT_TCP_RX_PORTNO), '-n', str(num_mods)]
|
||||
startProcessInBackground(cmd, fp)
|
||||
time.sleep(1)
|
||||
|
||||
def loadConfig(name, rx_hostname, settingsdir, fp, num_mods = 1, num_frames = 1):
|
||||
|
||||
def loadConfig(name, rx_hostname = 'localhost', settingsdir = None, log_file_fp = None, num_mods = 1, num_frames = 1, num_interfaces = 1):
|
||||
Log(LogLevel.INFO, 'Loading config')
|
||||
Log(LogLevel.INFO, 'Loading config', fp)
|
||||
Log(LogLevel.INFO, 'Loading config', log_file_fp)
|
||||
try:
|
||||
d = connectToVirtualServers(name, num_mods)
|
||||
|
||||
if name == 'jungfrau' or name == 'moench':
|
||||
d.numinterfaces = num_interfaces
|
||||
|
||||
d.udp_dstport = DEFAULT_UDP_DST_PORTNO
|
||||
if name == 'eiger':
|
||||
if name == 'eiger' or name == 'jungfrau' or name == 'moench':
|
||||
d.udp_dstport2 = DEFAULT_UDP_DST_PORTNO + 1
|
||||
|
||||
d.rx_hostname = rx_hostname
|
||||
|
||||
d.udp_dstip = 'auto'
|
||||
|
||||
if name != "eiger":
|
||||
d.udp_srcip = 'auto'
|
||||
|
||||
if name == "jungfrau" or name == "moench":
|
||||
d.udp_dstip2 = 'auto'
|
||||
|
||||
if name == "jungfrau" or name == "moench" or name == "xilinx_ctb":
|
||||
d.powerchip = 1
|
||||
|
||||
if name == "xilinx_ctb":
|
||||
d.configureTransceiver()
|
||||
|
||||
if name == "eiger":
|
||||
d.trimen = [4500, 5400, 6400]
|
||||
d.settingspath = settingsdir + '/eiger/'
|
||||
d.setThresholdEnergy(4500, detectorSettings.STANDARD)
|
||||
|
||||
if settingsdir is not None and name in ['eiger', 'mythen3']:
|
||||
d.settingspath = settingsdir + '/' + name + '/'
|
||||
d.trimen = [4500, 5400, 6400] if name == 'eiger' else [4000, 6000, 8000, 12000]
|
||||
d.setThresholdEnergy(4500, detectorSettings.STANDARD)
|
||||
|
||||
d.frames = num_frames
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user