mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 22:07:12 +02:00
Compare commits
37 Commits
pattern_un
...
developer
Author | SHA1 | Date | |
---|---|---|---|
d19fe8b66a | |||
f4345a91a1 | |||
ec67617e5c | |||
bab6a5e9e1 | |||
f84454fbc1 | |||
c92830f854 | |||
e77fd8d85d | |||
cd0fb1b7bb | |||
50ab20317d | |||
d0a946a919 | |||
ed142aa34e | |||
1227574590 | |||
3ac7b579a0 | |||
feb1b0868e | |||
6d2f34ef1d | |||
b36a5b9933 | |||
d8ce5eabb8 | |||
ceecb0ca27 | |||
ac3670dcd2 | |||
1c7bc61531 | |||
58245a62a4 | |||
a464262558 | |||
995d3e0034 | |||
90d57cb6a9 | |||
30eab42294 | |||
1d0eeea7ee | |||
d7c012d306 | |||
1665937540 | |||
9343e3c667 | |||
b4c8fc1765 | |||
3ad4e01a5d | |||
015b4add65 | |||
68bdd75c9c | |||
a53873b695 | |||
77a39b4ef2 | |||
64be8b1e89 | |||
68bd9fb4f7 |
64
.github/workflows/build_wheel.yml
vendored
Normal file
64
.github/workflows/build_wheel.yml
vendored
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
name: Build wheel
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- published
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_wheels:
|
||||||
|
name: Build wheels on ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest,]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Build wheels
|
||||||
|
run: pipx run cibuildwheel==2.23.0
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
|
||||||
|
path: ./wheelhouse/*.whl
|
||||||
|
|
||||||
|
build_sdist:
|
||||||
|
name: Build source distribution
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Build sdist
|
||||||
|
run: pipx run build --sdist
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: cibw-sdist
|
||||||
|
path: dist/*.tar.gz
|
||||||
|
|
||||||
|
upload_pypi:
|
||||||
|
needs: [build_wheels, build_sdist]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: pypi
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
if: github.event_name == 'release' && github.event.action == 'published'
|
||||||
|
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
|
||||||
|
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
# unpacks all CIBW artifacts into dist/
|
||||||
|
pattern: cibw-*
|
||||||
|
path: dist
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
- uses: pypa/gh-action-pypi-publish@release/v1
|
@ -21,6 +21,7 @@ if (${CMAKE_VERSION} VERSION_GREATER "3.24")
|
|||||||
endif()
|
endif()
|
||||||
include(cmake/project_version.cmake)
|
include(cmake/project_version.cmake)
|
||||||
include(cmake/SlsAddFlag.cmake)
|
include(cmake/SlsAddFlag.cmake)
|
||||||
|
include(cmake/helpers.cmake)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -193,11 +194,9 @@ find_package(ClangFormat)
|
|||||||
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
default_build_type("Release")
|
||||||
message(STATUS "No build type selected, default to Release")
|
set_std_fs_lib()
|
||||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type (default Release)" FORCE)
|
message(STATUS "Extra linking to fs lib:${STD_FS_LIB}")
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
#Enable LTO if available
|
#Enable LTO if available
|
||||||
include(CheckIPOSupported)
|
include(CheckIPOSupported)
|
||||||
|
@ -25,7 +25,9 @@ mark_as_advanced(
|
|||||||
ClangFormat_BIN)
|
ClangFormat_BIN)
|
||||||
|
|
||||||
if(ClangFormat_FOUND)
|
if(ClangFormat_FOUND)
|
||||||
exec_program(${ClangFormat_BIN} ${CMAKE_CURRENT_SOURCE_DIR} ARGS --version OUTPUT_VARIABLE CLANG_VERSION_TEXT)
|
execute_process(COMMAND ${ClangFormat_BIN} --version
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE CLANG_VERSION_TEXT)
|
||||||
string(REGEX MATCH "([0-9]+)\\.[0-9]+\\.[0-9]+" CLANG_VERSION ${CLANG_VERSION_TEXT})
|
string(REGEX MATCH "([0-9]+)\\.[0-9]+\\.[0-9]+" CLANG_VERSION ${CLANG_VERSION_TEXT})
|
||||||
if((${CLANG_VERSION} GREATER "9") OR (${CLANG_VERSION} EQUAL "9"))
|
if((${CLANG_VERSION} GREATER "9") OR (${CLANG_VERSION} EQUAL "9"))
|
||||||
# A CMake script to find all source files and setup clang-format targets for them
|
# A CMake script to find all source files and setup clang-format targets for them
|
||||||
|
46
cmake/helpers.cmake
Normal file
46
cmake/helpers.cmake
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
function(default_build_type val)
|
||||||
|
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
|
message(STATUS "No build type selected, default to Release")
|
||||||
|
set(CMAKE_BUILD_TYPE ${val} CACHE STRING "Build type (default ${val})" FORCE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(set_std_fs_lib)
|
||||||
|
# from pybind11
|
||||||
|
# Check if we need to add -lstdc++fs or -lc++fs or nothing
|
||||||
|
if(DEFINED CMAKE_CXX_STANDARD AND CMAKE_CXX_STANDARD LESS 17)
|
||||||
|
set(STD_FS_NO_LIB_NEEDED TRUE)
|
||||||
|
elseif(MSVC)
|
||||||
|
set(STD_FS_NO_LIB_NEEDED TRUE)
|
||||||
|
else()
|
||||||
|
file(
|
||||||
|
WRITE ${CMAKE_CURRENT_BINARY_DIR}/main.cpp
|
||||||
|
"#include <filesystem>\nint main(int argc, char ** argv) {\n std::filesystem::path p(argv[0]);\n return p.string().length();\n}"
|
||||||
|
)
|
||||||
|
try_compile(
|
||||||
|
STD_FS_NO_LIB_NEEDED ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/main.cpp
|
||||||
|
COMPILE_DEFINITIONS -std=c++17)
|
||||||
|
try_compile(
|
||||||
|
STD_FS_NEEDS_STDCXXFS ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/main.cpp
|
||||||
|
COMPILE_DEFINITIONS -std=c++17
|
||||||
|
LINK_LIBRARIES stdc++fs)
|
||||||
|
try_compile(
|
||||||
|
STD_FS_NEEDS_CXXFS ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/main.cpp
|
||||||
|
COMPILE_DEFINITIONS -std=c++17
|
||||||
|
LINK_LIBRARIES c++fs)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(${STD_FS_NEEDS_STDCXXFS})
|
||||||
|
set(STD_FS_LIB stdc++fs PARENT_SCOPE)
|
||||||
|
elseif(${STD_FS_NEEDS_CXXFS})
|
||||||
|
set(STD_FS_LIB c++fs PARENT_SCOPE)
|
||||||
|
elseif(${STD_FS_NO_LIB_NEEDED})
|
||||||
|
set(STD_FS_LIB "" PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
message(WARNING "Unknown C++17 compiler - not passing -lstdc++fs")
|
||||||
|
set(STD_FS_LIB "")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
@ -28,7 +28,8 @@ requirements:
|
|||||||
- libgl-devel # [linux]
|
- libgl-devel # [linux]
|
||||||
- libtiff
|
- libtiff
|
||||||
- zlib
|
- zlib
|
||||||
|
- expat
|
||||||
|
|
||||||
run:
|
run:
|
||||||
- libstdcxx-ng
|
- libstdcxx-ng
|
||||||
- libgcc-ng
|
- libgcc-ng
|
||||||
@ -57,6 +58,7 @@ outputs:
|
|||||||
- {{ compiler('c') }}
|
- {{ compiler('c') }}
|
||||||
- {{compiler('cxx')}}
|
- {{compiler('cxx')}}
|
||||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||||
|
|
||||||
|
|
||||||
run:
|
run:
|
||||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||||
|
@ -42,6 +42,7 @@ set(SPHINX_SOURCE_FILES
|
|||||||
src/pyexamples.rst
|
src/pyexamples.rst
|
||||||
src/pyPatternGenerator.rst
|
src/pyPatternGenerator.rst
|
||||||
src/servers.rst
|
src/servers.rst
|
||||||
|
src/multidet.rst
|
||||||
src/receiver_api.rst
|
src/receiver_api.rst
|
||||||
src/result.rst
|
src/result.rst
|
||||||
src/type_traits.rst
|
src/type_traits.rst
|
||||||
|
@ -6,6 +6,8 @@ Usage
|
|||||||
|
|
||||||
The syntax is *'[detector index]-[module index]:[command]'*, where the indices are by default '0', when not specified.
|
The syntax is *'[detector index]-[module index]:[command]'*, where the indices are by default '0', when not specified.
|
||||||
|
|
||||||
|
.. _cl-module-index-label:
|
||||||
|
|
||||||
Module index
|
Module index
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
Modules are indexed based on their order in the hostname command. They are used to configure a specific module within a detector and are followed by a ':' in syntax.
|
Modules are indexed based on their order in the hostname command. They are used to configure a specific module within a detector and are followed by a ':' in syntax.
|
||||||
|
@ -28,6 +28,12 @@ Welcome to slsDetectorPackage's documentation!
|
|||||||
receiver_api
|
receiver_api
|
||||||
examples
|
examples
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:caption: how to
|
||||||
|
:maxdepth: 2
|
||||||
|
|
||||||
|
multidet
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:caption: Python API
|
:caption: Python API
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
@ -81,8 +87,9 @@ Welcome to slsDetectorPackage's documentation!
|
|||||||
:caption: Receiver
|
:caption: Receiver
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
||||||
receivers
|
|
||||||
slsreceiver
|
slsreceiver
|
||||||
|
receivers
|
||||||
|
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:caption: Receiver Files
|
:caption: Receiver Files
|
||||||
|
@ -6,18 +6,33 @@
|
|||||||
Installation
|
Installation
|
||||||
===============
|
===============
|
||||||
|
|
||||||
One can either install pre-built binaries using conda or build from source.
|
.. contents::
|
||||||
|
:local:
|
||||||
|
:depth: 2
|
||||||
|
:backlinks: top
|
||||||
|
|
||||||
|
|
||||||
|
Overview
|
||||||
|
--------------
|
||||||
|
|
||||||
|
The ``slsDetectorPackage`` provides core detector software implemented in C++, along with Python bindings packaged as the ``slsdet`` Python extension module. Choose the option that best fits your environment and use case.
|
||||||
|
|
||||||
|
:ref:`conda pre-built binaries`:
|
||||||
|
Install pre-built binaries for the C++ client, receiver, GUI and the Python API (``slsdet``), simplifying setup across platforms.
|
||||||
|
|
||||||
|
:ref:`pip`:
|
||||||
|
Install only the Python extension module, either by downloading the pre-built library from PyPI or by building the extension locally from source. Available only from v9.2.0 onwards.
|
||||||
|
|
||||||
|
:ref:`build from source`:
|
||||||
|
Compile the entire package yourself, including both the C++ core and the Python bindings, for maximum control and customization. However, make sure that you have the :doc:`dependencies <../dependencies>` installed. If installing using conda, conda will manage the dependencies. Avoid installing packages with pip and conda simultaneously.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.. warning ::
|
|
||||||
|
|
||||||
Before building from source make sure that you have the
|
|
||||||
:doc:`dependencies <../dependencies>` installed. If installing using conda, conda will
|
|
||||||
manage the dependencies. Avoid also installing packages with pip.
|
|
||||||
|
|
||||||
|
.. _conda pre-built binaries:
|
||||||
|
|
||||||
|
1. Install pre-built binaries using conda (Recommended)
|
||||||
Install binaries using conda
|
--------------------------------------------------------
|
||||||
----------------------------------
|
|
||||||
|
|
||||||
Conda is not only useful to manage python environments but can also
|
Conda is not only useful to manage python environments but can also
|
||||||
be used as a user space package manager. Dates in the tag (for eg. 2020.07.23.dev0)
|
be used as a user space package manager. Dates in the tag (for eg. 2020.07.23.dev0)
|
||||||
@ -63,12 +78,29 @@ We have four different packages available:
|
|||||||
conda search moenchzmq
|
conda search moenchzmq
|
||||||
|
|
||||||
|
|
||||||
|
.. _pip:
|
||||||
|
|
||||||
|
2. Pip
|
||||||
|
-------
|
||||||
|
The Python extension module ``slsdet`` can be installed using pip. This is available from v9.2.0 onwards.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
#Install the Python extension module from PyPI
|
||||||
|
pip install slsdet
|
||||||
|
|
||||||
|
# or install the python extension locally from source
|
||||||
|
git clone https://github.com/slsdetectorgroup/slsDetectorPackage.git --branch 9.2.0
|
||||||
|
cd slsDetectorPackage
|
||||||
|
pip install .
|
||||||
|
|
||||||
|
|
||||||
Build from source
|
.. _build from source:
|
||||||
----------------------
|
|
||||||
|
|
||||||
1. Download Source Code from github
|
3. Build from source
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
3.1. Download Source Code from github
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
@ -83,12 +115,12 @@ Build from source
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
2. Build from Source
|
3.2. Build from Source
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
One can either build using cmake or use the in-built cmk.sh script.
|
One can either build using cmake or use the in-built cmk.sh script.
|
||||||
|
|
||||||
Build using CMake
|
3.2.1. Build using CMake
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
@ -135,7 +167,7 @@ Example cmake options Comment
|
|||||||
For v7.x.x of slsDetectorPackage and older, refer :ref:`zeromq notes for cmake option to hint library location. <zeromq for different slsDetectorPackage versions>`
|
For v7.x.x of slsDetectorPackage and older, refer :ref:`zeromq notes for cmake option to hint library location. <zeromq for different slsDetectorPackage versions>`
|
||||||
|
|
||||||
|
|
||||||
Build using in-built cmk.sh script
|
3.2.2. Build using in-built cmk.sh script
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
|
||||||
@ -185,8 +217,8 @@ Build using in-built cmk.sh script
|
|||||||
For v7.x.x of slsDetectorPackage and older, refer :ref:`zeromq notes for cmk script option to hint library location. <zeromq for different slsDetectorPackage versions>`
|
For v7.x.x of slsDetectorPackage and older, refer :ref:`zeromq notes for cmk script option to hint library location. <zeromq for different slsDetectorPackage versions>`
|
||||||
|
|
||||||
|
|
||||||
Build on old distributions
|
3.3. Build on old distributions using conda
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
If your linux distribution doesn't come with a C++11 compiler (gcc>4.8) then
|
If your linux distribution doesn't come with a C++11 compiler (gcc>4.8) then
|
||||||
it's possible to install a newer gcc using conda and build the slsDetectorPackage
|
it's possible to install a newer gcc using conda and build the slsDetectorPackage
|
||||||
@ -210,7 +242,7 @@ using this compiler
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Build slsDetectorGui (Qt5)
|
3.4. Build slsDetectorGui (Qt5)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
1. Using pre-built binary on conda
|
1. Using pre-built binary on conda
|
||||||
@ -271,7 +303,7 @@ Build slsDetectorGui (Qt5)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Build this documentation
|
3.5. Build this documentation
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The documentation for the slsDetectorPackage is build using a combination
|
The documentation for the slsDetectorPackage is build using a combination
|
||||||
@ -294,8 +326,8 @@ is to use conda
|
|||||||
make rst # rst only, saves time in case the API did not change
|
make rst # rst only, saves time in case the API did not change
|
||||||
|
|
||||||
|
|
||||||
Pybind and Zeromq
|
4. Pybind and Zeromq
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
-------------------------
|
||||||
|
|
||||||
.. _pybind for different slsDetectorPackage versions:
|
.. _pybind for different slsDetectorPackage versions:
|
||||||
|
|
||||||
|
228
docs/src/multidet.rst
Normal file
228
docs/src/multidet.rst
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
Using multiple detectors
|
||||||
|
==========================
|
||||||
|
|
||||||
|
The slsDetectorPackage supports using several detectors on the same computer.
|
||||||
|
This can either be two users, that need to use the same computer without interfering
|
||||||
|
with each other, or the same user that wants to use multiple detectors at the same time.
|
||||||
|
The detectors in turn can consist of multiple modules. For example, a 9M Jungfrau detector
|
||||||
|
consists of 18 modules which typically are addressed at once as a single detector.
|
||||||
|
|
||||||
|
.. note ::
|
||||||
|
|
||||||
|
To address a single module of a multi-module detector you can use the module index.
|
||||||
|
|
||||||
|
- Command line: :ref:`cl-module-index-label`
|
||||||
|
- Python: :ref:`py-module-index-label`
|
||||||
|
|
||||||
|
|
||||||
|
Coming back to multiple detectors we have two tools to our disposal:
|
||||||
|
|
||||||
|
#. Detector index
|
||||||
|
#. The SLSDETNAME environment variable
|
||||||
|
|
||||||
|
They can be used together or separately depending on the use case.
|
||||||
|
|
||||||
|
Detector index
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
When configuring a detector you can specify a detector index. The default is 0.
|
||||||
|
|
||||||
|
**Command line**
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# Given that we have two detectors (my-det and my-det2) that we want to use,
|
||||||
|
# we can configure them with different indices.
|
||||||
|
|
||||||
|
# Configure the first detector with index 0
|
||||||
|
$ sls_detector_put hostname my-det
|
||||||
|
|
||||||
|
# Set number of frames for detector 0 to 10
|
||||||
|
$ sls_detector_put frames 10
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
#Configure the second detector with index 1 (notice the 1- before hostname)
|
||||||
|
$ sls_detector_put 1-hostname my-det2
|
||||||
|
|
||||||
|
|
||||||
|
# Further configuration
|
||||||
|
...
|
||||||
|
|
||||||
|
# Set number of frames for detector 1 to 19
|
||||||
|
$ sls_detector_put 1-frames 19
|
||||||
|
|
||||||
|
# Note that if we call sls_detector_get without specifying the index,
|
||||||
|
# it will return the configuration of detector 0
|
||||||
|
$ sls_detector_get frames
|
||||||
|
10
|
||||||
|
|
||||||
|
The detector index is added to the name of the shared memory segment, so in this case
|
||||||
|
the shared memory segments would be:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
|
||||||
|
#First detector
|
||||||
|
/dev/shm/slsDetectorPackage_detector_0
|
||||||
|
/dev/shm/slsDetectorPackage_detector_0_module_0
|
||||||
|
|
||||||
|
#Second detector
|
||||||
|
/dev/shm/slsDetectorPackage_detector_1
|
||||||
|
/dev/shm/slsDetectorPackage_detector_1_module_0
|
||||||
|
|
||||||
|
|
||||||
|
**Python**
|
||||||
|
|
||||||
|
The main difference between the command line and the Python API is that you set the index
|
||||||
|
when you create the detector object and you don't have to repeat it for every call.
|
||||||
|
|
||||||
|
The C++ API works int the same way.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
from slsdet import Detector
|
||||||
|
|
||||||
|
|
||||||
|
# The same can be achieved in Python by creating a detector object with an index.
|
||||||
|
# Again we have two detectors (my-det and my-det2) that we want to use:
|
||||||
|
|
||||||
|
# Configure detector with index 0
|
||||||
|
d = Detector()
|
||||||
|
|
||||||
|
# If the detector has already been configured and has a shared memory
|
||||||
|
# segment, you can omit setting the hostname again
|
||||||
|
d.hostname = 'my-det'
|
||||||
|
|
||||||
|
#Further configuration
|
||||||
|
...
|
||||||
|
|
||||||
|
# Configure a second detector with index 1
|
||||||
|
d2 = Detector(1)
|
||||||
|
d2.hostname = 'my-det2'
|
||||||
|
|
||||||
|
d.frames = 10
|
||||||
|
d2.frames = 19
|
||||||
|
|
||||||
|
|
||||||
|
$SLSDETNAME
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
To avoid interfering with other users on shared PCs it is best to always set the SLSDETNAME environmental variable.
|
||||||
|
Imagining a fictive user: Anna, we can set SLSDETNAME from the shell before configuring the detector:
|
||||||
|
|
||||||
|
**Command line**
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# Set the SLSDETNAME variable
|
||||||
|
$ export SLSDETNAME=Anna
|
||||||
|
|
||||||
|
# You can check that it is set
|
||||||
|
$ echo $SLSDETNAME
|
||||||
|
Anna
|
||||||
|
|
||||||
|
# Now configures a detector with index 0 and prefixed with the name Anna
|
||||||
|
# /dev/shm/slsDetectorPackage_detector_0_Anna
|
||||||
|
$ sls_detector_put hostname my-det
|
||||||
|
|
||||||
|
|
||||||
|
.. tip ::
|
||||||
|
|
||||||
|
Set SLSDETNAME in your .bashrc in order to not forget it when opening a new terminal.
|
||||||
|
|
||||||
|
|
||||||
|
**Python**
|
||||||
|
|
||||||
|
With python the best way is to set the SLSDETNAME from the command line before starting the python interpreter.
|
||||||
|
|
||||||
|
Bash:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ export SLSDETNAME=Anna
|
||||||
|
|
||||||
|
Python:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
from slsdet import Detector
|
||||||
|
|
||||||
|
# Now configures a detector with index 0 and prefixed with the name Anna
|
||||||
|
# /dev/shm/slsDetectorPackage_detector_0_Anna
|
||||||
|
d = Detector()
|
||||||
|
d.hostname = 'my-det'
|
||||||
|
|
||||||
|
You can also set SLSDETNAME from within the Python interpreter, but you have to be aware that it will only
|
||||||
|
affect the current process and not the whole shell session.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
import os
|
||||||
|
os.environ['SLSDETNAME'] = 'Anna'
|
||||||
|
|
||||||
|
# You can check that it is set
|
||||||
|
print(os.environ['SLSDETNAME']) # Output: Anna
|
||||||
|
|
||||||
|
#Now SLSDETNAME is set to Anna but as soon as you exit the python interpreter
|
||||||
|
# it will not be set anymore
|
||||||
|
|
||||||
|
.. note ::
|
||||||
|
|
||||||
|
Python has two ways of reading environment variables: `**os.environ**` as shown above which throws a
|
||||||
|
KeyError if the variable is not set and `os.getenv('SLSDETNAME')` which returns None if the variable is not set.
|
||||||
|
|
||||||
|
For more details see the official python documentation on: https://docs.python.org/3/library/os.html#os.environ
|
||||||
|
|
||||||
|
|
||||||
|
Checking for other detectors
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
If using shared accounts on a shared computer (which you anyway should not do), it is good practice to check
|
||||||
|
if there are other detectors configured by other users before configuring your own detector.
|
||||||
|
|
||||||
|
You can do this by listing the files in the shared memory directory `/dev/shm/` that start with `sls`. In this
|
||||||
|
example we can see that two single module detectors are configured one with index 0 and one with index 1.
|
||||||
|
SLSDETNAME is set to `Anna` so it makes sense to assume that she is the user that configured these detectors.
|
||||||
|
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# List the files in /dev/shm that starts with sls
|
||||||
|
$ ls /dev/shm/sls*
|
||||||
|
/dev/shm/slsDetectorPackage_detector_0_Anna
|
||||||
|
/dev/shm/slsDetectorPackage_detector_0_module_0_Anna
|
||||||
|
/dev/shm/slsDetectorPackage_detector_1_Anna
|
||||||
|
/dev/shm/slsDetectorPackage_detector_1_module_0_Anna
|
||||||
|
|
||||||
|
We also provide a command: user, which gets information about the shared memory segment that
|
||||||
|
the client points to without doing any changes.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
#in this case 3 simulated Mythen3 modules
|
||||||
|
$ sls_detector_get user
|
||||||
|
user
|
||||||
|
Hostname: localhost+localhost+localhost+
|
||||||
|
Type: Mythen3
|
||||||
|
PID: 1226078
|
||||||
|
User: l_msdetect
|
||||||
|
Date: Mon Jun 2 05:46:20 PM CEST 2025
|
||||||
|
|
||||||
|
|
||||||
|
Other considerations
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
The shared memory is not the only way to interfere with other users. You also need to make sure that you are not
|
||||||
|
using the same:
|
||||||
|
|
||||||
|
* rx_tcpport
|
||||||
|
* Unique combination of udp_dstip and udp_dstport
|
||||||
|
* rx_zmqport
|
||||||
|
* zmqport
|
||||||
|
|
||||||
|
.. attention ::
|
||||||
|
|
||||||
|
The computer that you are using need to have enough resources to run multiple detectors at the same time.
|
||||||
|
This includes CPU and network bandwidth. Please coordinate with the other users!
|
||||||
|
|
@ -123,6 +123,47 @@ in a large detector.
|
|||||||
# Set exposure time for module 1, 5 and 7
|
# Set exposure time for module 1, 5 and 7
|
||||||
d.setExptime(0.1, [1,5,7])
|
d.setExptime(0.1, [1,5,7])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.. _py-module-index-label:
|
||||||
|
|
||||||
|
----------------------------------
|
||||||
|
Accessing individual modules
|
||||||
|
----------------------------------
|
||||||
|
|
||||||
|
Using the C++ like API you can access individual modules in a large detector
|
||||||
|
by passing in the module index as an argument to the function.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
# Read the UDP destination port for all modules
|
||||||
|
>>> d.getDestinationUDPPort()
|
||||||
|
[50001, 50002, 50003]
|
||||||
|
|
||||||
|
|
||||||
|
# Read it for module 0 and 1
|
||||||
|
>>> d.getDestinationUDPPort([0, 1])
|
||||||
|
[50001, 50002]
|
||||||
|
|
||||||
|
>>> d.setDestinationUDPPort(50010, 1)
|
||||||
|
>>> d.getDestinationUDPPort()
|
||||||
|
[50001, 50010, 50003]
|
||||||
|
|
||||||
|
From the more pythonic API there is no way to read from only one module but you can read
|
||||||
|
and then use list slicing to get the values for the modules you are interested in.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
>>> d.udp_dstport
|
||||||
|
[50001, 50010, 50003]
|
||||||
|
>>> d.udp_dstport[0]
|
||||||
|
50001
|
||||||
|
|
||||||
|
#For some but not all properties you can also pass in a dictionary with module index as key
|
||||||
|
>>> ip = IpAddr('127.0.0.1')
|
||||||
|
>>> d.udp_dstip = {1:ip}
|
||||||
|
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
Finding functions
|
Finding functions
|
||||||
--------------------
|
--------------------
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
Receivers
|
Custom Receiver
|
||||||
=================
|
=================
|
||||||
|
|
||||||
Receiver processes can be run on same or different machines as the client, receives the data from the detector (via UDP packets).
|
The receiver essentially listens to UDP data packets sent out by the detector.
|
||||||
When using the slsReceiver/ slsMultiReceiver, they can be further configured by the client control software (via TCP/IP) to set file name, file path, progress of acquisition etc.
|
|
||||||
|
To know more about detector receiver setup in the config file, please check out :ref:`the detector-receiver UDP configuration in the config file<detector udp header config>` and the :ref:`detector udp format<detector udp header>`.
|
||||||
|
|
||||||
|
|
||||||
To know more about detector receiver configuration, please check out :ref:`detector udp header and udp commands in the config file <detector udp header>`
|
| Please note the following when using a custom receiver:
|
||||||
|
|
||||||
Custom Receiver
|
* **udp_dstmac** must be configured in the config file. This parameter is not required when using an in-built receiver.
|
||||||
----------------
|
|
||||||
|
|
||||||
| When using custom receiver with our package, ensure that **udp_dstmac** is also configured in the config file. This parameter is not required when using slsReceiver.
|
* Cannot use "auto" for **udp_dstip**.
|
||||||
|
|
||||||
| Cannot use "auto" for **udp_dstip**.
|
* No **rx_** commands in the config file. These commands are for configuring the slsReceiver.
|
||||||
|
|
||||||
| Also ensure that there are no **rx_** commands in the config file. These commands are for configuring the slsReceiver.
|
|
||||||
|
|
||||||
|
The main difference is the lack of **rx_** commands or file commands (eg. **f**write, **f**path) and the **udp_dstmac** is required in config file.
|
||||||
|
|
||||||
Example of a custom receiver config file
|
Example of a custom receiver config file
|
||||||
|
|
||||||
* The main difference is the lack of **rx_** commands or file commands (eg. fwrite, fpath) and the udp_dstmac is required in config file.
|
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
# detector hostname
|
# detector hostname
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
.. _Detector Server Upgrade:
|
.. _Detector Server Upgrade:
|
||||||
|
|
||||||
Upgrade
|
Upgrade
|
||||||
========
|
========
|
||||||
|
|
||||||
|
@ -1,16 +1,55 @@
|
|||||||
slsReceiver/ slsMultiReceiver
|
In-built Receiver
|
||||||
================================
|
================================
|
||||||
|
|
||||||
| One has to start the slsReceiver before loading config file or using any receiver commands (prefix: **rx_** )
|
|
||||||
|
|
||||||
|
|
||||||
|
The receiver essentially listens to UDP data packets sent out by the detector. It's main features are:
|
||||||
|
|
||||||
|
- **Listening**: Receives UDP data from the detector.
|
||||||
|
- **Writing to File**: Optionally writes received data to disk.
|
||||||
|
- **Streaming via ZMQ**: Optionally streams out the data using ZeroMQ.
|
||||||
|
|
||||||
|
Each of these operations runs asynchronously and in parallel for each UDP port.
|
||||||
|
|
||||||
|
|
||||||
|
.. note ::
|
||||||
|
|
||||||
|
* Can be run on the same or different machine as the client.
|
||||||
|
* Can be configured by the client. (set file name/ discard policy, get progress etc.)
|
||||||
|
* Has to be started before the client runs any receiver specific command.
|
||||||
|
|
||||||
|
|
||||||
|
Receiver Variants
|
||||||
|
-----------------
|
||||||
|
There are three main receiver types. How to start them is described :ref:`below<Starting up the Receiver>`.
|
||||||
|
|
||||||
|
+----------------------+--------------------+-----------------------------------------+--------------------------------+
|
||||||
|
| Receiver Type | slsReceiver | slsMultiReceiver |slsFrameSynchronizer |
|
||||||
|
+======================+====================+=========================================+================================+
|
||||||
|
| Modules Supported | 1 | Multiple | Multiple |
|
||||||
|
+----------------------+--------------------+-----------------------------------------+--------------------------------+
|
||||||
|
| Internal Architecture| Threads per porttt | Multiple child processes of slsReceiver | Multi-threading of slsReceiver |
|
||||||
|
+----------------------+--------------------+-----------------------------------------+--------------------------------+
|
||||||
|
| ZMQ Streaming | Disabled by default| Disabled by default | Enabled, not optional |
|
||||||
|
+----------------------+--------------------+-----------------------------------------+--------------------------------+
|
||||||
|
| ZMQ Synchronization | No | No | Yes, across ports |
|
||||||
|
+----------------------+--------------------+-----------------------------------------+--------------------------------+
|
||||||
|
| Image Reconstruction | No | No | No |
|
||||||
|
+----------------------+--------------------+-----------------------------------------+--------------------------------+
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.. _Starting up the Receiver:
|
||||||
|
|
||||||
|
Starting up the Receiver
|
||||||
|
-------------------------
|
||||||
For a Single Module
|
For a Single Module
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
|
slsReceiver # default port 1954
|
||||||
|
|
||||||
# default port 1954
|
slsReceiver -t2012 # custom port 2012
|
||||||
slsReceiver
|
|
||||||
|
|
||||||
# custom port 2012
|
|
||||||
slsReceiver -t2012
|
|
||||||
|
|
||||||
|
|
||||||
For Multiple Modules
|
For Multiple Modules
|
||||||
@ -18,57 +57,66 @@ For Multiple Modules
|
|||||||
|
|
||||||
# each receiver (for each module) requires a unique tcp port (if all on same machine)
|
# each receiver (for each module) requires a unique tcp port (if all on same machine)
|
||||||
|
|
||||||
# using slsReceiver in multiple consoles
|
# option 1 (one for each module)
|
||||||
slsReceiver
|
slsReceiver
|
||||||
slsReceiver -t1955
|
slsReceiver -t1955
|
||||||
|
|
||||||
# slsMultiReceiver [starting port] [number of receivers]
|
# option 2
|
||||||
slsMultiReceiver 2012 2
|
slsMultiReceiver 2012 2
|
||||||
|
|
||||||
# slsMultiReceiver [starting port] [number of receivers] [print each frame header for debugging]
|
# option 3
|
||||||
slsMultiReceiver 2012 2 1
|
slsFrameSynchronizer 2012 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Client Commands
|
Client Commands
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
| One can remove **udp_dstmac** from the config file, as the slsReceiver fetches this from the **udp_ip**.
|
* Client commands to the receiver begin with **rx_** or **f_** (file commands).
|
||||||
|
|
||||||
| One can use "auto" for **udp_dstip** if one wants to use default ip of **rx_hostname**.
|
* **rx_hostname** has to be the first command to the receiver so the client knows which receiver process to communicate with.
|
||||||
|
|
||||||
| The first command to the receiver (**rx_** commands) should be **rx_hostname**. The following are the different ways to establish contact.
|
* Can use 'auto' for **udp_dstip** if using 1GbE interface or the :ref:`virtual simulators<Virtual Detector Servers>`.
|
||||||
|
|
||||||
|
|
||||||
|
To know more about detector receiver setup in the config file, please check out :ref:`the detector-receiver UDP configuration in the config file<detector udp header config>` and the :ref:`detector udp format<detector udp header>`.
|
||||||
|
|
||||||
|
|
||||||
|
The following are the different ways to establish contact using **rx_hostname** command.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
# default receiver tcp port (1954)
|
# ---single module---
|
||||||
|
|
||||||
|
# default receiver port at 1954
|
||||||
|
rx_hostname xxx
|
||||||
|
|
||||||
|
# custom receiver port
|
||||||
|
rx_hostname xxx:1957 # option 1
|
||||||
|
|
||||||
|
rx_tcpport 1957 # option 2
|
||||||
rx_hostname xxx
|
rx_hostname xxx
|
||||||
|
|
||||||
# custom receiver port
|
|
||||||
rx_hostname xxx:1957
|
|
||||||
|
|
||||||
# custom receiver port
|
# ---multi module---
|
||||||
rx_tcpport 1954
|
|
||||||
rx_hostname xxx
|
|
||||||
|
|
||||||
# multi modules with custom ports
|
# using increasing tcp ports
|
||||||
rx_hostname xxx:1955+xxx:1956+
|
|
||||||
|
|
||||||
|
|
||||||
# multi modules using increasing tcp ports when using multi detector command
|
|
||||||
rx_tcpport 1955
|
rx_tcpport 1955
|
||||||
rx_hostname xxx
|
rx_hostname xxx
|
||||||
|
|
||||||
# or specify multi modules with custom ports on same rxr pc
|
# custom ports
|
||||||
0:rx_tcpport 1954
|
rx_hostname xxx:1955+xxx:1958+ # option 1
|
||||||
|
|
||||||
|
0:rx_tcpport 1954 # option 2
|
||||||
1:rx_tcpport 1955
|
1:rx_tcpport 1955
|
||||||
2:rx_tcpport 1956
|
2:rx_tcpport 1956
|
||||||
rx_hostname xxx
|
rx_hostname xxx
|
||||||
|
|
||||||
# multi modules with custom ports on different rxr pc
|
# custom ports on different receiver machines
|
||||||
0:rx_tcpport 1954
|
0:rx_tcpport 1954
|
||||||
0:rx_hostname xxx
|
0:rx_hostname xxx
|
||||||
1:rx_tcpport 1955
|
1:rx_tcpport 1955
|
||||||
1:rx_hostname yyy
|
1:rx_hostname yyyrxr
|
||||||
|
|
||||||
|
|
||||||
| Example commands:
|
| Example commands:
|
||||||
@ -91,6 +139,32 @@ Client Commands
|
|||||||
sls_detector_get -h rx_framescaught
|
sls_detector_get -h rx_framescaught
|
||||||
|
|
||||||
|
|
||||||
|
Example of a config file using in-built receiver
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# detector hostname
|
||||||
|
hostname bchip052+bchip053+
|
||||||
|
|
||||||
|
# udp destination port (receiver)
|
||||||
|
# sets increasing destination udp ports starting at 50004
|
||||||
|
udp_dstport 50004
|
||||||
|
|
||||||
|
# udp destination ip (receiver)
|
||||||
|
0:udp_dstip 10.0.1.100
|
||||||
|
1:udp_dstip 10.0.2.100
|
||||||
|
|
||||||
|
# udp source ip (same subnet as udp_dstip)
|
||||||
|
0:udp_srcip 10.0.1.184
|
||||||
|
1:udp_srcip 10.0.2.184
|
||||||
|
|
||||||
|
# udp destination mac - not required (picked up from udp_dstip)
|
||||||
|
#udp_dstmac 22:47:d5:48:ad:ef
|
||||||
|
|
||||||
|
# connects to receivers at increasing tcp port starting at 1954
|
||||||
|
rx_hostname mpc3434
|
||||||
|
# same as rx_hostname mpc3434:1954+mpc3434:1955+
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Performance
|
Performance
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.. _detector udp header:
|
.. _detector udp header config:
|
||||||
|
|
||||||
|
|
||||||
Config file
|
Config file
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
.. _Virtual Detector Servers:
|
.. _Virtual Detector Servers:
|
||||||
|
|
||||||
Simulators
|
Simulators
|
||||||
===========
|
===========
|
||||||
|
|
||||||
|
@ -13,5 +13,5 @@ slsDetectorPackage/8.0.2_rh7 stable cmake/3.15.5 Qt/5.12.10
|
|||||||
slsDetectorPackage/8.0.2_rh8 stable cmake/3.15.5 Qt/5.12.10
|
slsDetectorPackage/8.0.2_rh8 stable cmake/3.15.5 Qt/5.12.10
|
||||||
slsDetectorPackage/9.0.0_rh8 stable cmake/3.15.5 Qt/5.12.10
|
slsDetectorPackage/9.0.0_rh8 stable cmake/3.15.5 Qt/5.12.10
|
||||||
slsDetectorPackage/9.1.0_rh8 stable cmake/3.15.5 Qt/5.12.10
|
slsDetectorPackage/9.1.0_rh8 stable cmake/3.15.5 Qt/5.12.10
|
||||||
|
slsDetectorPackage/9.1.1_rh8 stable cmake/3.15.5 Qt/5.12.10
|
||||||
|
slsDetectorPackage/9.2.0_rh8 stable cmake/3.15.5 Qt/5.12.10
|
||||||
|
@ -11,9 +11,13 @@ build-backend = "scikit_build_core.build"
|
|||||||
[project]
|
[project]
|
||||||
name = "slsdet"
|
name = "slsdet"
|
||||||
dynamic = ["version"]
|
dynamic = ["version"]
|
||||||
|
dependencies = [
|
||||||
|
"numpy",
|
||||||
|
]
|
||||||
|
|
||||||
[tool.cibuildwheel]
|
[tool.cibuildwheel]
|
||||||
before-all = "uname -a"
|
before-all = "uname -a"
|
||||||
|
build = "cp{311,312,313}-manylinux_x86_64"
|
||||||
|
|
||||||
[tool.scikit-build.build]
|
[tool.scikit-build.build]
|
||||||
verbose = true
|
verbose = true
|
||||||
|
@ -65,6 +65,9 @@ configure_file( scripts/test_virtual.py
|
|||||||
${CMAKE_BINARY_DIR}/test_virtual.py
|
${CMAKE_BINARY_DIR}/test_virtual.py
|
||||||
)
|
)
|
||||||
|
|
||||||
|
configure_file(scripts/frameSynchronizerPullSocket.py
|
||||||
|
${CMAKE_BINARY_DIR}/bin/frameSynchronizerPullSocket.py COPYONLY)
|
||||||
|
|
||||||
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/../VERSION
|
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/../VERSION
|
||||||
${CMAKE_BINARY_DIR}/bin/slsdet/VERSION
|
${CMAKE_BINARY_DIR}/bin/slsdet/VERSION
|
||||||
)
|
)
|
||||||
|
28
slsDetectorServers/compileAllServers.sh
Normal file → Executable file
28
slsDetectorServers/compileAllServers.sh
Normal file → Executable file
@ -1,16 +1,19 @@
|
|||||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
|
|
||||||
# empty branch = developer branch in updateAPIVersion.sh
|
|
||||||
branch=""
|
|
||||||
det_list=("ctbDetectorServer
|
det_list=("ctbDetectorServer
|
||||||
gotthard2DetectorServer
|
gotthard2DetectorServer
|
||||||
jungfrauDetectorServer
|
jungfrauDetectorServer
|
||||||
mythen3DetectorServer
|
mythen3DetectorServer
|
||||||
moenchDetectorServer
|
moenchDetectorServer
|
||||||
xilinx_ctbDetectorServer"
|
xilinx_ctbDetectorServer"
|
||||||
)
|
)
|
||||||
usage="\nUsage: compileAllServers.sh [server|all(opt)] [branch(opt)]. \n\tNo arguments mean all servers with 'developer' branch. \n\tNo 'branch' input means 'developer branch'"
|
usage="\nUsage: compileAllServers.sh [server|all(opt)] [update_api(opt)]. \n\tNo arguments mean all servers with 'developer' branch. \n\tupdate_api if true updates the api to version in VERSION file"
|
||||||
|
|
||||||
|
update_api=true
|
||||||
|
target=version
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# arguments
|
# arguments
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
@ -34,15 +37,12 @@ elif [ $# -eq 1 ] || [ $# -eq 2 ]; then
|
|||||||
declare -a det=("${1}")
|
declare -a det=("${1}")
|
||||||
#echo "Compiling only $1"
|
#echo "Compiling only $1"
|
||||||
fi
|
fi
|
||||||
# branch
|
|
||||||
if [ $# -eq 2 ]; then
|
if [ $# -eq 2 ]; then
|
||||||
# arg in list
|
update_api=$2
|
||||||
if [[ $det_list == *$2* ]]; then
|
if not $update_api ; then
|
||||||
echo -e "Invalid argument 2: $2. $usage"
|
target=clean
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
branch+=$2
|
|
||||||
#echo "with branch $branch"
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e "Too many arguments.$usage"
|
echo -e "Too many arguments.$usage"
|
||||||
@ -53,6 +53,9 @@ declare -a deterror=("OK" "OK" "OK" "OK" "OK" "OK")
|
|||||||
|
|
||||||
echo -e "list is ${det[@]}"
|
echo -e "list is ${det[@]}"
|
||||||
|
|
||||||
|
if $update_api; then
|
||||||
|
echo "updating api to $(cat ../VERSION)"
|
||||||
|
fi
|
||||||
# compile each server
|
# compile each server
|
||||||
idet=0
|
idet=0
|
||||||
for i in ${det[@]}
|
for i in ${det[@]}
|
||||||
@ -62,14 +65,13 @@ do
|
|||||||
echo -e "Compiling $dir [$file]"
|
echo -e "Compiling $dir [$file]"
|
||||||
cd $dir
|
cd $dir
|
||||||
make clean
|
make clean
|
||||||
if make version API_BRANCH=$branch; then
|
if make $target; then
|
||||||
deterror[$idet]="OK"
|
deterror[$idet]="OK"
|
||||||
else
|
else
|
||||||
deterror[$idet]="FAIL"
|
deterror[$idet]="FAIL"
|
||||||
fi
|
fi
|
||||||
mv bin/$dir bin/$file
|
mv bin/$dir bin/$file
|
||||||
git add -f bin/$file
|
git add -f bin/$file
|
||||||
cp bin/$file /tftpboot/
|
|
||||||
cd ..
|
cd ..
|
||||||
echo -e "\n\n"
|
echo -e "\n\n"
|
||||||
((++idet))
|
((++idet))
|
||||||
|
@ -1,86 +0,0 @@
|
|||||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
|
||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
||||||
|
|
||||||
# empty branch = developer branch in updateAPIVersion.sh
|
|
||||||
branch=""
|
|
||||||
det_list=("ctbDetectorServer"
|
|
||||||
"gotthard2DetectorServer"
|
|
||||||
"jungfrauDetectorServer"
|
|
||||||
"mythen3DetectorServer"
|
|
||||||
"moenchDetectorServer"
|
|
||||||
"xilinx_ctbDetectorServer"
|
|
||||||
)
|
|
||||||
usage="\nUsage: compileAllServers.sh [server|all(opt)] [branch(opt)]. \n\tNo arguments mean all servers with 'developer' branch. \n\tNo 'branch' input means 'developer branch'"
|
|
||||||
|
|
||||||
# arguments
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
# no argument, all servers
|
|
||||||
declare -a det=${det_list[@]}
|
|
||||||
echo "Compiling all servers"
|
|
||||||
elif [ $# -eq 1 ] || [ $# -eq 2 ]; then
|
|
||||||
# 'all' servers
|
|
||||||
if [[ $1 == "all" ]]; then
|
|
||||||
declare -a det=${det_list[@]}
|
|
||||||
echo "Compiling all servers"
|
|
||||||
else
|
|
||||||
# only one server
|
|
||||||
# arg not in list
|
|
||||||
if [[ $det_list != *$1* ]]; then
|
|
||||||
echo -e "Invalid argument 1: $1. $usage"
|
|
||||||
return -1
|
|
||||||
fi
|
|
||||||
declare -a det=("${1}")
|
|
||||||
#echo "Compiling only $1"
|
|
||||||
fi
|
|
||||||
# branch
|
|
||||||
if [ $# -eq 2 ]; then
|
|
||||||
# arg in list
|
|
||||||
if [[ $det_list == *$2* ]]; then
|
|
||||||
echo -e "Invalid argument 2: $2. $usage"
|
|
||||||
return -1
|
|
||||||
fi
|
|
||||||
branch+=$2
|
|
||||||
#echo "with branch $branch"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo -e "Too many arguments.$usage"
|
|
||||||
return -1
|
|
||||||
fi
|
|
||||||
|
|
||||||
declare -a deterror=("OK" "OK" "OK" "OK" "OK" "OK")
|
|
||||||
|
|
||||||
echo -e "list is ${det[@]}"
|
|
||||||
|
|
||||||
# compile each server
|
|
||||||
idet=0
|
|
||||||
for i in ${det[@]}
|
|
||||||
do
|
|
||||||
dir=$i
|
|
||||||
file="${i}_developer"
|
|
||||||
echo -e "Compiling $dir [$file]"
|
|
||||||
cd $dir
|
|
||||||
make clean
|
|
||||||
if make API_BRANCH=$branch; then
|
|
||||||
deterror[$idet]="OK"
|
|
||||||
else
|
|
||||||
deterror[$idet]="FAIL"
|
|
||||||
fi
|
|
||||||
mv bin/$dir bin/$file
|
|
||||||
git add -f bin/$file
|
|
||||||
cp bin/$file /tftpboot/
|
|
||||||
cd ..
|
|
||||||
echo -e "\n\n"
|
|
||||||
((++idet))
|
|
||||||
done
|
|
||||||
|
|
||||||
echo -e "Results:"
|
|
||||||
idet=0
|
|
||||||
for i in ${det[@]}
|
|
||||||
do
|
|
||||||
printf "%s\t\t= %s\n" "$i" "${deterror[$idet]}"
|
|
||||||
((++idet))
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
23
slsDetectorServers/compileEigerServer.sh
Normal file → Executable file
23
slsDetectorServers/compileEigerServer.sh
Normal file → Executable file
@ -3,21 +3,31 @@
|
|||||||
deterror="OK"
|
deterror="OK"
|
||||||
dir="eigerDetectorServer"
|
dir="eigerDetectorServer"
|
||||||
file="${dir}_developer"
|
file="${dir}_developer"
|
||||||
branch=""
|
|
||||||
|
usage="\nUsage: compileAllServers.sh [update_api(opt)]. \n\t update_api if true updates the api to version in VERSION file"
|
||||||
|
|
||||||
|
update_api=true
|
||||||
|
target=version
|
||||||
|
|
||||||
# arguments
|
# arguments
|
||||||
if [ $# -eq 1 ]; then
|
if [ $# -eq 1 ]; then
|
||||||
branch+=$1
|
update_api=$1
|
||||||
#echo "with branch $branch"
|
if not $update_api ; then
|
||||||
|
target=clean
|
||||||
|
|
||||||
|
fi
|
||||||
elif [ ! $# -eq 0 ]; then
|
elif [ ! $# -eq 0 ]; then
|
||||||
echo -e "Only one optional argument allowed for branch."
|
echo -e "Only one optional argument allowed for update_api."
|
||||||
return -1
|
return -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if $update_api; then
|
||||||
|
echo "updating api to $(cat ../VERSION)"
|
||||||
|
fi
|
||||||
|
|
||||||
echo -e "Compiling $dir [$file]"
|
echo -e "Compiling $dir [$file]"
|
||||||
cd $dir
|
cd $dir
|
||||||
make clean
|
if make $target; then
|
||||||
if make version API_BRANCH=$branch; then
|
|
||||||
deterror="OK"
|
deterror="OK"
|
||||||
else
|
else
|
||||||
deterror="FAIL"
|
deterror="FAIL"
|
||||||
@ -25,7 +35,6 @@ fi
|
|||||||
|
|
||||||
mv bin/$dir bin/$file
|
mv bin/$dir bin/$file
|
||||||
git add -f bin/$file
|
git add -f bin/$file
|
||||||
cp bin/$file /tftpboot/
|
|
||||||
cd ..
|
cd ..
|
||||||
echo -e "\n\n"
|
echo -e "\n\n"
|
||||||
printf "Result:\t\t= %s\n" "${deterror}"
|
printf "Result:\t\t= %s\n" "${deterror}"
|
||||||
|
@ -25,11 +25,10 @@ version: clean versioning $(PROGS)
|
|||||||
|
|
||||||
boot: $(OBJS)
|
boot: $(OBJS)
|
||||||
|
|
||||||
version_branch=$(API_BRANCH)
|
|
||||||
version_name=APICTB
|
version_name=APICTB
|
||||||
version_path=slsDetectorServers/ctbDetectorServer
|
version_path=slsDetectorServers/ctbDetectorServer
|
||||||
versioning:
|
versioning:
|
||||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path) $(version_branch); tput sgr0;`
|
cd ../../ && echo $(PWD) && echo `tput setaf 6; python updateAPIVersion.py $(version_name) $(version_path); tput sgr0;`
|
||||||
|
|
||||||
|
|
||||||
$(PROGS): $(OBJS)
|
$(PROGS): $(OBJS)
|
||||||
|
@ -65,8 +65,8 @@
|
|||||||
(0x000000FF << STATUS_PT_CNTRL_STTS_OFF_OFST)
|
(0x000000FF << STATUS_PT_CNTRL_STTS_OFF_OFST)
|
||||||
#define STATUS_IDLE_MSK (0x677FF)
|
#define STATUS_IDLE_MSK (0x677FF)
|
||||||
|
|
||||||
/* Register containing the git hash of the FPGA firmware */
|
/* Look at me RO register TODO */
|
||||||
#define FIRMWARE_GIT_HASH_REG (0x03 << MEM_MAP_SHIFT)
|
#define LOOK_AT_ME_REG (0x03 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* System Status RO register */
|
/* System Status RO register */
|
||||||
#define SYSTEM_STATUS_REG (0x04 << MEM_MAP_SHIFT)
|
#define SYSTEM_STATUS_REG (0x04 << MEM_MAP_SHIFT)
|
||||||
@ -119,7 +119,7 @@
|
|||||||
#define MOD_SERIAL_NUMBER_VRSN_MSK (0x0000003F << MOD_SERIAL_NUMBER_VRSN_OFST)
|
#define MOD_SERIAL_NUMBER_VRSN_MSK (0x0000003F << MOD_SERIAL_NUMBER_VRSN_OFST)
|
||||||
|
|
||||||
/* API Version RO register */
|
/* 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_OFST (0)
|
||||||
#define API_VERSION_MSK (0x00FFFFFF << API_VERSION_OFST)
|
#define API_VERSION_MSK (0x00FFFFFF << API_VERSION_OFST)
|
||||||
@ -128,24 +128,24 @@
|
|||||||
|
|
||||||
/* Time from Start 64 bit RO register. t = GCLK x 50 ns. Reset using
|
/* Time from Start 64 bit RO register. t = GCLK x 50 ns. Reset using
|
||||||
* CONTROL_CRST. TODO */
|
* CONTROL_CRST. TODO */
|
||||||
#define TIME_FROM_START_LSB_REG (0x97 << MEM_MAP_SHIFT)
|
#define TIME_FROM_START_LSB_REG (0x10 << MEM_MAP_SHIFT)
|
||||||
#define TIME_FROM_START_MSB_REG (0x98 << 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 */
|
/* Delay Left 64 bit RO register. t = DLY x 50 ns. TODO */
|
||||||
#define DELAY_LEFT_LSB_REG (0x8D << MEM_MAP_SHIFT)
|
#define DELAY_LEFT_LSB_REG (0x12 << MEM_MAP_SHIFT)
|
||||||
#define DELAY_LEFT_MSB_REG (0x8E << MEM_MAP_SHIFT)
|
#define DELAY_LEFT_MSB_REG (0x13 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Triggers Left 64 bit RO register TODO */
|
/* Triggers Left 64 bit RO register TODO */
|
||||||
#define CYCLES_LEFT_LSB_REG (0x8F << MEM_MAP_SHIFT)
|
#define CYCLES_LEFT_LSB_REG (0x14 << MEM_MAP_SHIFT)
|
||||||
#define CYCLES_LEFT_MSB_REG (0x90 << MEM_MAP_SHIFT)
|
#define CYCLES_LEFT_MSB_REG (0x15 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Frames Left 64 bit RO register TODO */
|
/* Frames Left 64 bit RO register TODO */
|
||||||
#define FRAMES_LEFT_LSB_REG (0x91 << MEM_MAP_SHIFT)
|
#define FRAMES_LEFT_LSB_REG (0x16 << MEM_MAP_SHIFT)
|
||||||
#define FRAMES_LEFT_MSB_REG (0x92 << MEM_MAP_SHIFT)
|
#define FRAMES_LEFT_MSB_REG (0x17 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Period Left 64 bit RO register. t = T x 50 ns. TODO */
|
/* Period Left 64 bit RO register. t = T x 50 ns. TODO */
|
||||||
#define PERIOD_LEFT_LSB_REG (0x93 << MEM_MAP_SHIFT)
|
#define PERIOD_LEFT_LSB_REG (0x18 << MEM_MAP_SHIFT)
|
||||||
#define PERIOD_LEFT_MSB_REG (0x94 << MEM_MAP_SHIFT)
|
#define PERIOD_LEFT_MSB_REG (0x19 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Exposure Time Left 64 bit RO register */
|
/* Exposure Time Left 64 bit RO register */
|
||||||
// #define EXPTIME_LEFT_LSB_REG (0x1A << MEM_MAP_SHIFT) // Not
|
// #define EXPTIME_LEFT_LSB_REG (0x1A << MEM_MAP_SHIFT) // Not
|
||||||
@ -160,34 +160,34 @@
|
|||||||
//// Not used in FW
|
//// Not used in FW
|
||||||
|
|
||||||
/* Data In 64 bit RO register TODO */
|
/* Data In 64 bit RO register TODO */
|
||||||
#define DATA_IN_LSB_REG (0x10 << MEM_MAP_SHIFT)
|
#define DATA_IN_LSB_REG (0x1E << MEM_MAP_SHIFT)
|
||||||
#define DATA_IN_MSB_REG (0x11 << MEM_MAP_SHIFT)
|
#define DATA_IN_MSB_REG (0x1F << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Pattern Out 64 bit RO register */
|
/* Pattern Out 64 bit RO register */
|
||||||
#define PATTERN_OUT_LSB_REG (0x80 << MEM_MAP_SHIFT)
|
#define PATTERN_OUT_LSB_REG (0x20 << MEM_MAP_SHIFT)
|
||||||
#define PATTERN_OUT_MSB_REG (0x81 << MEM_MAP_SHIFT)
|
#define PATTERN_OUT_MSB_REG (0x21 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Frame number of next acquisition register (64 bit register) */
|
/* 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_LSB_REG (0x22 << MEM_MAP_SHIFT)
|
||||||
#define NEXT_FRAME_NUMB_LOCAL_MSB_REG (0x13 << 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 */
|
/* 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_LSB_REG (0x24 << MEM_MAP_SHIFT)
|
||||||
#define FRAMES_FROM_START_PG_MSB_REG (0x9A << 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 Frame Time (Measurement Time) 64 bit register (timestamp at a frame
|
||||||
* start until reset) TODO */
|
* start until reset) TODO */
|
||||||
#define START_FRAME_TIME_LSB_REG (0x9B << MEM_MAP_SHIFT)
|
#define START_FRAME_TIME_LSB_REG (0x26 << MEM_MAP_SHIFT)
|
||||||
#define START_FRAME_TIME_MSB_REG (0x9C << MEM_MAP_SHIFT)
|
#define START_FRAME_TIME_MSB_REG (0x27 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Power Status RO register */
|
/* 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_OFST (27)
|
||||||
#define POWER_STATUS_ALRT_MSK (0x0000001F << POWER_STATUS_ALRT_OFST)
|
#define POWER_STATUS_ALRT_MSK (0x0000001F << POWER_STATUS_ALRT_OFST)
|
||||||
|
|
||||||
/* FIFO Transceiver In Status RO register */
|
/* 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_OFST (4)
|
||||||
#define FIFO_TIN_STATUS_FIFO_EMPTY_1_MSK (0x00000001 << FIFO_TIN_STATUS_FIFO_EMPTY_1_OFST)
|
#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)
|
#define FIFO_TIN_STATUS_FIFO_EMPTY_2_OFST (5)
|
||||||
@ -198,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_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)
|
#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 */
|
/* FIFO Transceiver In 64 bit RO register */
|
||||||
#define FIFO_TIN_LSB_REG (0x1B << MEM_MAP_SHIFT)
|
#define FIFO_TIN_LSB_REG (0x31 << MEM_MAP_SHIFT)
|
||||||
#define FIFO_TIN_MSB_REG (0x1C << MEM_MAP_SHIFT)
|
#define FIFO_TIN_MSB_REG (0x32 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* FIFO Digital In Status RO register */
|
/* FIFO Digital In Status RO register */
|
||||||
#define FIFO_DIN_STATUS_REG (0x1D << MEM_MAP_SHIFT)
|
#define FIFO_DIN_STATUS_REG (0x3B << MEM_MAP_SHIFT)
|
||||||
#define FIFO_DIN_STATUS_FIFO_FILL_OFST (0)
|
|
||||||
#define FIFO_DIN_STATUS_FIFO_FILL_MSK (0x00003FFF)
|
|
||||||
#define FIFO_DIN_STATUS_FIFO_FULL_OFST (30)
|
#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_FULL_MSK (0x00000001 << FIFO_DIN_STATUS_FIFO_FULL_OFST)
|
||||||
#define FIFO_DIN_STATUS_FIFO_EMPTY_OFST (31)
|
#define FIFO_DIN_STATUS_FIFO_EMPTY_OFST (31)
|
||||||
#define FIFO_DIN_STATUS_FIFO_EMPTY_MSK (0x00000001 << FIFO_DIN_STATUS_FIFO_EMPTY_OFST)
|
#define FIFO_DIN_STATUS_FIFO_EMPTY_MSK (0x00000001 << FIFO_DIN_STATUS_FIFO_EMPTY_OFST)
|
||||||
|
|
||||||
/* FIFO Digital In 64 bit RO register */
|
/* FIFO Digital In 64 bit RO register */
|
||||||
#define FIFO_DIN_LSB_REG (0x1E << MEM_MAP_SHIFT)
|
#define FIFO_DIN_LSB_REG (0x3C << MEM_MAP_SHIFT)
|
||||||
#define FIFO_DIN_MSB_REG (0x1F << MEM_MAP_SHIFT)
|
#define FIFO_DIN_MSB_REG (0x3D << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* SPI (Serial Peripheral Interface) DAC, HV RW register */
|
/* 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_OFST (0)
|
||||||
#define SPI_DAC_SRL_DGTL_OTPT_MSK (0x00000001 << SPI_DAC_SRL_DGTL_OTPT_OFST)
|
#define SPI_DAC_SRL_DGTL_OTPT_MSK (0x00000001 << SPI_DAC_SRL_DGTL_OTPT_OFST)
|
||||||
@ -261,7 +230,7 @@
|
|||||||
#define SPI_HV_SRL_CS_OTPT_MSK (0x00000001 << SPI_HV_SRL_CS_OTPT_OFST)
|
#define SPI_HV_SRL_CS_OTPT_MSK (0x00000001 << SPI_HV_SRL_CS_OTPT_OFST)
|
||||||
|
|
||||||
/* ADC SPI (Serial Peripheral Interface) RW register */
|
/* 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_OFST (0)
|
||||||
#define ADC_SPI_SRL_CLK_OTPT_MSK (0x00000001 << ADC_SPI_SRL_CLK_OTPT_OFST)
|
#define ADC_SPI_SRL_CLK_OTPT_MSK (0x00000001 << ADC_SPI_SRL_CLK_OTPT_OFST)
|
||||||
@ -271,7 +240,7 @@
|
|||||||
#define ADC_SPI_SRL_CS_OTPT_MSK (0x0000000F << ADC_SPI_SRL_CS_OTPT_OFST)
|
#define ADC_SPI_SRL_CS_OTPT_MSK (0x0000000F << ADC_SPI_SRL_CS_OTPT_OFST)
|
||||||
|
|
||||||
/* ADC Offset RW register */
|
/* 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_OFST (0)
|
||||||
#define ADC_OFFSET_ADC_PPLN_MSK (0x000000FF << ADC_OFFSET_ADC_PPLN_OFST)
|
#define ADC_OFFSET_ADC_PPLN_MSK (0x000000FF << ADC_OFFSET_ADC_PPLN_OFST)
|
||||||
@ -279,7 +248,7 @@
|
|||||||
#define ADC_OFFSET_DBT_PPLN_MSK (0x000000FF << ADC_OFFSET_DBT_PPLN_OFST)
|
#define ADC_OFFSET_DBT_PPLN_MSK (0x000000FF << ADC_OFFSET_DBT_PPLN_OFST)
|
||||||
|
|
||||||
/* ADC Port Invert RW register */
|
/* 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_OFST (0)
|
||||||
#define ADC_PORT_INVERT_0_INPT_MSK (0x000000FF << ADC_PORT_INVERT_0_INPT_OFST)
|
#define ADC_PORT_INVERT_0_INPT_MSK (0x000000FF << ADC_PORT_INVERT_0_INPT_OFST)
|
||||||
@ -291,7 +260,7 @@
|
|||||||
#define ADC_PORT_INVERT_3_INPT_MSK (0x000000FF << ADC_PORT_INVERT_3_INPT_OFST)
|
#define ADC_PORT_INVERT_3_INPT_MSK (0x000000FF << ADC_PORT_INVERT_3_INPT_OFST)
|
||||||
|
|
||||||
/* Dummy RW register */
|
/* 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_OFST (0)
|
||||||
#define DUMMY_FIFO_CHNNL_SLCT_MSK (0x0000003F << DUMMY_FIFO_CHNNL_SLCT_OFST)
|
#define DUMMY_FIFO_CHNNL_SLCT_MSK (0x0000003F << DUMMY_FIFO_CHNNL_SLCT_OFST)
|
||||||
@ -304,8 +273,46 @@
|
|||||||
#define DUMMY_TRNSCVR_FIFO_RD_STRBE_OFST (14)
|
#define DUMMY_TRNSCVR_FIFO_RD_STRBE_OFST (14)
|
||||||
#define DUMMY_TRNSCVR_FIFO_RD_STRBE_MSK (0x00000001 << DUMMY_TRNSCVR_FIFO_RD_STRBE_OFST)
|
#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 */
|
/* 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_OFST (0)
|
||||||
#define CONFIG_LED_DSBL_MSK (0x00000001 << CONFIG_LED_DSBL_OFST)
|
#define CONFIG_LED_DSBL_MSK (0x00000001 << CONFIG_LED_DSBL_OFST)
|
||||||
@ -320,7 +327,7 @@
|
|||||||
#define CONFIG_GB10_SND_UDP_MSK (0x00000001 << CONFIG_GB10_SND_UDP_OFST)
|
#define CONFIG_GB10_SND_UDP_MSK (0x00000001 << CONFIG_GB10_SND_UDP_OFST)
|
||||||
|
|
||||||
/* External Signal RW register */
|
/* 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_OFST (0)
|
||||||
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
|
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
|
||||||
@ -328,7 +335,7 @@
|
|||||||
#define EXT_SIGNAL_TRGGR_VAL ((0x1 << EXT_SIGNAL_OFST) & EXT_SIGNAL_MSK)
|
#define EXT_SIGNAL_TRGGR_VAL ((0x1 << EXT_SIGNAL_OFST) & EXT_SIGNAL_MSK)
|
||||||
|
|
||||||
/* Control RW register */
|
/* 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_OFST (0)
|
||||||
#define CONTROL_STRT_ACQSTN_MSK (0x00000001 << CONTROL_STRT_ACQSTN_OFST)
|
#define CONTROL_STRT_ACQSTN_MSK (0x00000001 << CONTROL_STRT_ACQSTN_OFST)
|
||||||
@ -368,10 +375,10 @@
|
|||||||
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
|
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
|
||||||
|
|
||||||
/* Reconfiguratble PLL Paramater RW register */
|
/* 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 */
|
/* 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_OFST (0)
|
||||||
#define PLL_CNTRL_RCNFG_PRMTR_RST_MSK \
|
#define PLL_CNTRL_RCNFG_PRMTR_RST_MSK \
|
||||||
@ -384,7 +391,7 @@
|
|||||||
#define PLL_CNTRL_ADDR_MSK (0x0000003F << PLL_CNTRL_ADDR_OFST)
|
#define PLL_CNTRL_ADDR_MSK (0x0000003F << PLL_CNTRL_ADDR_OFST)
|
||||||
|
|
||||||
/* Pattern Control RW register */
|
/* 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_OFST (0)
|
||||||
#define PATTERN_CNTRL_WR_MSK (0x00000001 << PATTERN_CNTRL_WR_OFST)
|
#define PATTERN_CNTRL_WR_MSK (0x00000001 << PATTERN_CNTRL_WR_OFST)
|
||||||
@ -394,7 +401,7 @@
|
|||||||
#define PATTERN_CNTRL_ADDR_MSK (0x00001FFF << PATTERN_CNTRL_ADDR_OFST)
|
#define PATTERN_CNTRL_ADDR_MSK (0x00001FFF << PATTERN_CNTRL_ADDR_OFST)
|
||||||
|
|
||||||
/* Pattern Limit RW regiser */
|
/* 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_OFST (0)
|
||||||
#define PATTERN_LIMIT_STRT_MSK (0x00001FFF << PATTERN_LIMIT_STRT_OFST)
|
#define PATTERN_LIMIT_STRT_MSK (0x00001FFF << PATTERN_LIMIT_STRT_OFST)
|
||||||
@ -402,7 +409,7 @@
|
|||||||
#define PATTERN_LIMIT_STP_MSK (0x00001FFF << PATTERN_LIMIT_STP_OFST)
|
#define PATTERN_LIMIT_STP_MSK (0x00001FFF << PATTERN_LIMIT_STP_OFST)
|
||||||
|
|
||||||
/* Pattern Loop 0 Address RW regiser */
|
/* Pattern Loop 0 Address RW regiser */
|
||||||
#define PATTERN_LOOP_0_ADDR_REG (0xA0 << MEM_MAP_SHIFT)
|
#define PATTERN_LOOP_0_ADDR_REG (0x54 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
#define PATTERN_LOOP_0_ADDR_STRT_OFST (0)
|
#define PATTERN_LOOP_0_ADDR_STRT_OFST (0)
|
||||||
#define PATTERN_LOOP_0_ADDR_STRT_MSK \
|
#define PATTERN_LOOP_0_ADDR_STRT_MSK \
|
||||||
@ -411,10 +418,10 @@
|
|||||||
#define PATTERN_LOOP_0_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_0_ADDR_STP_OFST)
|
#define PATTERN_LOOP_0_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_0_ADDR_STP_OFST)
|
||||||
|
|
||||||
/* Pattern Loop 0 Iteration RW regiser */
|
/* Pattern Loop 0 Iteration RW regiser */
|
||||||
#define PATTERN_LOOP_0_ITERATION_REG (0xA1 << MEM_MAP_SHIFT)
|
#define PATTERN_LOOP_0_ITERATION_REG (0x55 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Pattern Loop 1 Address RW regiser */
|
/* Pattern Loop 1 Address RW regiser */
|
||||||
#define PATTERN_LOOP_1_ADDR_REG (0xA5 << MEM_MAP_SHIFT)
|
#define PATTERN_LOOP_1_ADDR_REG (0x56 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
#define PATTERN_LOOP_1_ADDR_STRT_OFST (0)
|
#define PATTERN_LOOP_1_ADDR_STRT_OFST (0)
|
||||||
#define PATTERN_LOOP_1_ADDR_STRT_MSK \
|
#define PATTERN_LOOP_1_ADDR_STRT_MSK \
|
||||||
@ -423,10 +430,10 @@
|
|||||||
#define PATTERN_LOOP_1_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_1_ADDR_STP_OFST)
|
#define PATTERN_LOOP_1_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_1_ADDR_STP_OFST)
|
||||||
|
|
||||||
/* Pattern Loop 1 Iteration RW regiser */
|
/* Pattern Loop 1 Iteration RW regiser */
|
||||||
#define PATTERN_LOOP_1_ITERATION_REG (0xA6 << MEM_MAP_SHIFT)
|
#define PATTERN_LOOP_1_ITERATION_REG (0x57 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Pattern Loop 2 Address RW regiser */
|
/* Pattern Loop 2 Address RW regiser */
|
||||||
#define PATTERN_LOOP_2_ADDR_REG (0xAA << MEM_MAP_SHIFT)
|
#define PATTERN_LOOP_2_ADDR_REG (0x58 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
#define PATTERN_LOOP_2_ADDR_STRT_OFST (0)
|
#define PATTERN_LOOP_2_ADDR_STRT_OFST (0)
|
||||||
#define PATTERN_LOOP_2_ADDR_STRT_MSK \
|
#define PATTERN_LOOP_2_ADDR_STRT_MSK \
|
||||||
@ -435,29 +442,29 @@
|
|||||||
#define PATTERN_LOOP_2_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_2_ADDR_STP_OFST)
|
#define PATTERN_LOOP_2_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_2_ADDR_STP_OFST)
|
||||||
|
|
||||||
/* Pattern Loop 2 Iteration RW regiser */
|
/* Pattern Loop 2 Iteration RW regiser */
|
||||||
#define PATTERN_LOOP_2_ITERATION_REG (0xAB << MEM_MAP_SHIFT)
|
#define PATTERN_LOOP_2_ITERATION_REG (0x59 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Pattern Wait 0 RW regiser */
|
/* Pattern Wait 0 RW regiser */
|
||||||
#define PATTERN_WAIT_0_ADDR_REG (0xA2 << MEM_MAP_SHIFT)
|
#define PATTERN_WAIT_0_ADDR_REG (0x5A << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
#define PATTERN_WAIT_0_ADDR_OFST (0)
|
#define PATTERN_WAIT_0_ADDR_OFST (0)
|
||||||
#define PATTERN_WAIT_0_ADDR_MSK (0x00001FFF << PATTERN_WAIT_0_ADDR_OFST)
|
#define PATTERN_WAIT_0_ADDR_MSK (0x00001FFF << PATTERN_WAIT_0_ADDR_OFST)
|
||||||
// FIXME: is mask 3FF
|
// FIXME: is mask 3FF
|
||||||
|
|
||||||
/* Pattern Wait 1 RW regiser */
|
/* Pattern Wait 1 RW regiser */
|
||||||
#define PATTERN_WAIT_1_ADDR_REG (0xA7 << MEM_MAP_SHIFT)
|
#define PATTERN_WAIT_1_ADDR_REG (0x5B << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
#define PATTERN_WAIT_1_ADDR_OFST (0)
|
#define PATTERN_WAIT_1_ADDR_OFST (0)
|
||||||
#define PATTERN_WAIT_1_ADDR_MSK (0x00001FFF << PATTERN_WAIT_1_ADDR_OFST)
|
#define PATTERN_WAIT_1_ADDR_MSK (0x00001FFF << PATTERN_WAIT_1_ADDR_OFST)
|
||||||
|
|
||||||
/* Pattern Wait 2 RW regiser */
|
/* Pattern Wait 2 RW regiser */
|
||||||
#define PATTERN_WAIT_2_ADDR_REG (0xAC << MEM_MAP_SHIFT)
|
#define PATTERN_WAIT_2_ADDR_REG (0x5C << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
#define PATTERN_WAIT_2_ADDR_OFST (0)
|
#define PATTERN_WAIT_2_ADDR_OFST (0)
|
||||||
#define PATTERN_WAIT_2_ADDR_MSK (0x00001FFF << PATTERN_WAIT_2_ADDR_OFST)
|
#define PATTERN_WAIT_2_ADDR_MSK (0x00001FFF << PATTERN_WAIT_2_ADDR_OFST)
|
||||||
|
|
||||||
/* Samples RW register */
|
/* 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_OFST (0)
|
||||||
#define SAMPLES_DIGITAL_MSK (0x0000FFFF << SAMPLES_DIGITAL_OFST)
|
#define SAMPLES_DIGITAL_MSK (0x0000FFFF << SAMPLES_DIGITAL_OFST)
|
||||||
@ -465,7 +472,7 @@
|
|||||||
#define SAMPLES_ANALOG_MSK (0x0000FFFF << SAMPLES_ANALOG_OFST)
|
#define SAMPLES_ANALOG_MSK (0x0000FFFF << SAMPLES_ANALOG_OFST)
|
||||||
|
|
||||||
/** Power RW register */
|
/** 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_OFST (16)
|
||||||
#define POWER_ENBL_VLTG_RGLTR_MSK (0x0000001F << POWER_ENBL_VLTG_RGLTR_OFST)
|
#define POWER_ENBL_VLTG_RGLTR_MSK (0x0000001F << POWER_ENBL_VLTG_RGLTR_OFST)
|
||||||
@ -473,25 +480,25 @@
|
|||||||
#define POWER_HV_INTERNAL_SLCT_MSK (0x00000001 << POWER_HV_INTERNAL_SLCT_OFST)
|
#define POWER_HV_INTERNAL_SLCT_MSK (0x00000001 << POWER_HV_INTERNAL_SLCT_OFST)
|
||||||
|
|
||||||
/* Number of samples from transceiver RW register */
|
/* 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_OFST (0)
|
||||||
#define SAMPLES_TRANSCEIVER_MSK (0x0000FFFF << SAMPLES_TRANSCEIVER_OFST)
|
#define SAMPLES_TRANSCEIVER_MSK (0x0000FFFF << SAMPLES_TRANSCEIVER_OFST)
|
||||||
|
|
||||||
/* Delay 64 bit RW register. t = DLY x 50 ns. */
|
/* Delay 64 bit RW register. t = DLY x 50 ns. */
|
||||||
#define DELAY_LSB_REG (0x8D << MEM_MAP_SHIFT)
|
#define DELAY_LSB_REG (0x60 << MEM_MAP_SHIFT)
|
||||||
#define DELAY_MSB_REG (0x8E << MEM_MAP_SHIFT)
|
#define DELAY_MSB_REG (0x61 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Triggers 64 bit RW register */
|
/* Triggers 64 bit RW register */
|
||||||
#define CYCLES_LSB_REG (0x8F << MEM_MAP_SHIFT)
|
#define CYCLES_LSB_REG (0x62 << MEM_MAP_SHIFT)
|
||||||
#define CYCLES_MSB_REG (0x90 << MEM_MAP_SHIFT)
|
#define CYCLES_MSB_REG (0x63 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Frames 64 bit RW register */
|
/* Frames 64 bit RW register */
|
||||||
#define FRAMES_LSB_REG (0x91 << MEM_MAP_SHIFT)
|
#define FRAMES_LSB_REG (0x64 << MEM_MAP_SHIFT)
|
||||||
#define FRAMES_MSB_REG (0x92 << MEM_MAP_SHIFT)
|
#define FRAMES_MSB_REG (0x65 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Period 64 bit RW register */
|
/* Period 64 bit RW register */
|
||||||
#define PERIOD_LSB_REG (0x93 << MEM_MAP_SHIFT)
|
#define PERIOD_LSB_REG (0x66 << MEM_MAP_SHIFT)
|
||||||
#define PERIOD_MSB_REG (0x94 << MEM_MAP_SHIFT)
|
#define PERIOD_MSB_REG (0x67 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Period 64 bit RW register */
|
/* Period 64 bit RW register */
|
||||||
// #define EXPTIME_LSB_REG (0x68 << MEM_MAP_SHIFT) //
|
// #define EXPTIME_LSB_REG (0x68 << MEM_MAP_SHIFT) //
|
||||||
@ -506,27 +513,33 @@
|
|||||||
|
|
||||||
/* Pattern IO Control 64 bit RW regiser
|
/* Pattern IO Control 64 bit RW regiser
|
||||||
* Each bit configured as output(1)/ input(0) */
|
* Each bit configured as output(1)/ input(0) */
|
||||||
#define PATTERN_IO_CNTRL_LSB_REG (0x8A << MEM_MAP_SHIFT)
|
#define PATTERN_IO_CNTRL_LSB_REG (0x6C << MEM_MAP_SHIFT)
|
||||||
#define PATTERN_IO_CNTRL_MSB_REG (0x8B << 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 */
|
/* Pattern In 64 bit RW register */
|
||||||
#define PATTERN_IN_LSB_REG (0x82 << MEM_MAP_SHIFT)
|
#define PATTERN_IN_LSB_REG (0x70 << MEM_MAP_SHIFT)
|
||||||
#define PATTERN_IN_MSB_REG (0x83 << 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 */
|
/* Pattern Wait Timer 0 64 bit RW register. t = PWT1 x T run clock */
|
||||||
#define PATTERN_WAIT_TIMER_0_LSB_REG (0xA3 << MEM_MAP_SHIFT)
|
#define PATTERN_WAIT_TIMER_0_LSB_REG (0x72 << MEM_MAP_SHIFT)
|
||||||
#define PATTERN_WAIT_TIMER_0_MSB_REG (0xA4 << 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 */
|
/* Pattern Wait Timer 1 64 bit RW register. t = PWT2 x T run clock */
|
||||||
#define PATTERN_WAIT_TIMER_1_LSB_REG (0xA8 << MEM_MAP_SHIFT)
|
#define PATTERN_WAIT_TIMER_1_LSB_REG (0x74 << MEM_MAP_SHIFT)
|
||||||
#define PATTERN_WAIT_TIMER_1_MSB_REG (0xA9 << 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 */
|
/* Pattern Wait Timer 2 64 bit RW register. t = PWT3 x T run clock */
|
||||||
#define PATTERN_WAIT_TIMER_2_LSB_REG (0xAD << MEM_MAP_SHIFT)
|
#define PATTERN_WAIT_TIMER_2_LSB_REG (0x76 << MEM_MAP_SHIFT)
|
||||||
#define PATTERN_WAIT_TIMER_2_MSB_REG (0xAE << MEM_MAP_SHIFT)
|
#define PATTERN_WAIT_TIMER_2_MSB_REG (0x77 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Readout enable RW register */
|
/* 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_OFST (0)
|
||||||
#define READOUT_10G_ENABLE_ANLG_MSK (0x000000FF << READOUT_10G_ENABLE_ANLG_OFST)
|
#define READOUT_10G_ENABLE_ANLG_MSK (0x000000FF << READOUT_10G_ENABLE_ANLG_OFST)
|
||||||
@ -537,7 +550,7 @@
|
|||||||
(0x0000000F << READOUT_10G_ENABLE_TRNSCVR_OFST)
|
(0x0000000F << READOUT_10G_ENABLE_TRNSCVR_OFST)
|
||||||
|
|
||||||
/* Digital Bit External Trigger RW register */
|
/* 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_OFST (0)
|
||||||
#define DBIT_EXT_TRG_SRC_MSK (0x0000003F << DBIT_EXT_TRG_SRC_OFST)
|
#define DBIT_EXT_TRG_SRC_MSK (0x0000003F << DBIT_EXT_TRG_SRC_OFST)
|
||||||
@ -545,7 +558,7 @@
|
|||||||
#define DBIT_EXT_TRG_OPRTN_MD_MSK (0x00000001 << DBIT_EXT_TRG_OPRTN_MD_OFST)
|
#define DBIT_EXT_TRG_OPRTN_MD_MSK (0x00000001 << DBIT_EXT_TRG_OPRTN_MD_OFST)
|
||||||
|
|
||||||
/* Pin Delay 0 RW register */
|
/* 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_STEPS (25)
|
||||||
#define OUTPUT_DELAY_0_OTPT_STTNG_OFST \
|
#define OUTPUT_DELAY_0_OTPT_STTNG_OFST \
|
||||||
(0) // t = OTPT_STTNG * 25 ps, max for Cyclone V = 775 ps
|
(0) // t = OTPT_STTNG * 25 ps, max for Cyclone V = 775 ps
|
||||||
@ -561,18 +574,18 @@
|
|||||||
|
|
||||||
/* Pin Delay 1 RW register
|
/* Pin Delay 1 RW register
|
||||||
* Each bit configured as enable for dynamic output delay configuration */
|
* 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 */
|
/** Pattern Mask 64 bit RW regiser */
|
||||||
#define PATTERN_MASK_LSB_REG (0x84 << MEM_MAP_SHIFT)
|
#define PATTERN_MASK_LSB_REG (0x80 << MEM_MAP_SHIFT)
|
||||||
#define PATTERN_MASK_MSB_REG (0x85 << MEM_MAP_SHIFT)
|
#define PATTERN_MASK_MSB_REG (0x81 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/** Pattern Set 64 bit RW regiser */
|
/** Pattern Set 64 bit RW regiser */
|
||||||
#define PATTERN_SET_LSB_REG (0x86 << MEM_MAP_SHIFT)
|
#define PATTERN_SET_LSB_REG (0x82 << MEM_MAP_SHIFT)
|
||||||
#define PATTERN_SET_MSB_REG (0x87 << MEM_MAP_SHIFT)
|
#define PATTERN_SET_MSB_REG (0x83 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Pattern Loop 3 Address RW regiser */
|
/* Pattern Loop 3 Address RW regiser */
|
||||||
#define PATTERN_LOOP_3_ADDR_REG (0xAF << MEM_MAP_SHIFT)
|
#define PATTERN_LOOP_3_ADDR_REG (0x84 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
#define PATTERN_LOOP_3_ADDR_STRT_OFST (0)
|
#define PATTERN_LOOP_3_ADDR_STRT_OFST (0)
|
||||||
#define PATTERN_LOOP_3_ADDR_STRT_MSK \
|
#define PATTERN_LOOP_3_ADDR_STRT_MSK \
|
||||||
@ -581,10 +594,10 @@
|
|||||||
#define PATTERN_LOOP_3_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_3_ADDR_STP_OFST)
|
#define PATTERN_LOOP_3_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_3_ADDR_STP_OFST)
|
||||||
|
|
||||||
/* Pattern Loop 3 Iteration RW regiser */
|
/* Pattern Loop 3 Iteration RW regiser */
|
||||||
#define PATTERN_LOOP_3_ITERATION_REG (0xB0 << MEM_MAP_SHIFT)
|
#define PATTERN_LOOP_3_ITERATION_REG (0x85 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Pattern Loop 4 Address RW regiser */
|
/* Pattern Loop 4 Address RW regiser */
|
||||||
#define PATTERN_LOOP_4_ADDR_REG (0xB4 << MEM_MAP_SHIFT)
|
#define PATTERN_LOOP_4_ADDR_REG (0x86 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
#define PATTERN_LOOP_4_ADDR_STRT_OFST (0)
|
#define PATTERN_LOOP_4_ADDR_STRT_OFST (0)
|
||||||
#define PATTERN_LOOP_4_ADDR_STRT_MSK \
|
#define PATTERN_LOOP_4_ADDR_STRT_MSK \
|
||||||
@ -593,10 +606,10 @@
|
|||||||
#define PATTERN_LOOP_4_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_4_ADDR_STP_OFST)
|
#define PATTERN_LOOP_4_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_4_ADDR_STP_OFST)
|
||||||
|
|
||||||
/* Pattern Loop 4 Iteration RW regiser */
|
/* Pattern Loop 4 Iteration RW regiser */
|
||||||
#define PATTERN_LOOP_4_ITERATION_REG (0xB5 << MEM_MAP_SHIFT)
|
#define PATTERN_LOOP_4_ITERATION_REG (0x87 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Pattern Loop 5 Address RW regiser */
|
/* Pattern Loop 5 Address RW regiser */
|
||||||
#define PATTERN_LOOP_5_ADDR_REG (0xB9 << MEM_MAP_SHIFT)
|
#define PATTERN_LOOP_5_ADDR_REG (0x88 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
#define PATTERN_LOOP_5_ADDR_STRT_OFST (0)
|
#define PATTERN_LOOP_5_ADDR_STRT_OFST (0)
|
||||||
#define PATTERN_LOOP_5_ADDR_STRT_MSK \
|
#define PATTERN_LOOP_5_ADDR_STRT_MSK \
|
||||||
@ -605,43 +618,43 @@
|
|||||||
#define PATTERN_LOOP_5_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_5_ADDR_STP_OFST)
|
#define PATTERN_LOOP_5_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_5_ADDR_STP_OFST)
|
||||||
|
|
||||||
/* Pattern Loop 5 Iteration RW regiser */
|
/* Pattern Loop 5 Iteration RW regiser */
|
||||||
#define PATTERN_LOOP_5_ITERATION_REG (0xBA << MEM_MAP_SHIFT)
|
#define PATTERN_LOOP_5_ITERATION_REG (0x89 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Pattern Wait 3 RW regiser */
|
/* Pattern Wait 3 RW regiser */
|
||||||
#define PATTERN_WAIT_3_ADDR_REG (0xB1 << MEM_MAP_SHIFT)
|
#define PATTERN_WAIT_3_ADDR_REG (0x8A << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
#define PATTERN_WAIT_3_ADDR_OFST (0)
|
#define PATTERN_WAIT_3_ADDR_OFST (0)
|
||||||
#define PATTERN_WAIT_3_ADDR_MSK (0x00001FFF << PATTERN_WAIT_3_ADDR_OFST)
|
#define PATTERN_WAIT_3_ADDR_MSK (0x00001FFF << PATTERN_WAIT_3_ADDR_OFST)
|
||||||
|
|
||||||
/* Pattern Wait 4 RW regiser */
|
/* Pattern Wait 4 RW regiser */
|
||||||
#define PATTERN_WAIT_4_ADDR_REG (0xB6 << MEM_MAP_SHIFT)
|
#define PATTERN_WAIT_4_ADDR_REG (0x8B << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
#define PATTERN_WAIT_4_ADDR_OFST (0)
|
#define PATTERN_WAIT_4_ADDR_OFST (0)
|
||||||
#define PATTERN_WAIT_4_ADDR_MSK (0x00001FFF << PATTERN_WAIT_4_ADDR_OFST)
|
#define PATTERN_WAIT_4_ADDR_MSK (0x00001FFF << PATTERN_WAIT_4_ADDR_OFST)
|
||||||
|
|
||||||
/* Pattern Wait 5 RW regiser */
|
/* Pattern Wait 5 RW regiser */
|
||||||
#define PATTERN_WAIT_5_ADDR_REG (0xBB << MEM_MAP_SHIFT)
|
#define PATTERN_WAIT_5_ADDR_REG (0x8C << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
#define PATTERN_WAIT_5_ADDR_OFST (0)
|
#define PATTERN_WAIT_5_ADDR_OFST (0)
|
||||||
#define PATTERN_WAIT_5_ADDR_MSK (0x00001FFF << PATTERN_WAIT_5_ADDR_OFST)
|
#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 */
|
/* Pattern Wait Timer 3 64 bit RW register. t = PWT1 x T run clock */
|
||||||
#define PATTERN_WAIT_TIMER_3_LSB_REG (0xB2 << MEM_MAP_SHIFT)
|
#define PATTERN_WAIT_TIMER_3_LSB_REG (0x8D << MEM_MAP_SHIFT)
|
||||||
#define PATTERN_WAIT_TIMER_3_MSB_REG (0xB3 << 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 */
|
/* Pattern Wait Timer 4 64 bit RW register. t = PWT1 x T run clock */
|
||||||
#define PATTERN_WAIT_TIMER_4_LSB_REG (0xB7 << MEM_MAP_SHIFT)
|
#define PATTERN_WAIT_TIMER_4_LSB_REG (0x8F << MEM_MAP_SHIFT)
|
||||||
#define PATTERN_WAIT_TIMER_4_MSB_REG (0xB8 << 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 */
|
/* Pattern Wait Timer 5 64 bit RW register. t = PWT1 x T run clock */
|
||||||
#define PATTERN_WAIT_TIMER_5_LSB_REG (0xBC << MEM_MAP_SHIFT)
|
#define PATTERN_WAIT_TIMER_5_LSB_REG (0x91 << MEM_MAP_SHIFT)
|
||||||
#define PATTERN_WAIT_TIMER_5_MSB_REG (0xBD << MEM_MAP_SHIFT)
|
#define PATTERN_WAIT_TIMER_5_MSB_REG (0x92 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/* Slow ADC SPI Value RO register */
|
/* 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 */
|
/* 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 */
|
/** Read back CFG Register */
|
||||||
#define ADC_SLOW_CFG_RB_OFST (2)
|
#define ADC_SLOW_CFG_RB_OFST (2)
|
||||||
#define ADC_SLOW_CFG_RB_MSK (0x00000001 << ADC_SLOW_CFG_RB_OFST)
|
#define ADC_SLOW_CFG_RB_MSK (0x00000001 << ADC_SLOW_CFG_RB_OFST)
|
||||||
@ -720,7 +733,7 @@
|
|||||||
((0x1 << ADC_SLOW_CFG_CFG_OFST) & ADC_SLOW_CFG_CFG_MSK)
|
((0x1 << ADC_SLOW_CFG_CFG_OFST) & ADC_SLOW_CFG_CFG_MSK)
|
||||||
|
|
||||||
/* Slow ADC SPI Value Control register */
|
/* 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_OFST (0)
|
||||||
#define ADC_SLOW_CTRL_STRT_MSK (0x00000001 << ADC_SLOW_CTRL_STRT_OFST)
|
#define ADC_SLOW_CTRL_STRT_MSK (0x00000001 << ADC_SLOW_CTRL_STRT_OFST)
|
||||||
|
Binary file not shown.
@ -94,7 +94,10 @@ void basictests() {
|
|||||||
LOG(logINFOBLUE, ("********* Chip Test Board Virtual Server *********\n"));
|
LOG(logINFOBLUE, ("********* Chip Test Board Virtual Server *********\n"));
|
||||||
#else
|
#else
|
||||||
LOG(logINFOBLUE, ("************* Chip Test Board Server *************\n"));
|
LOG(logINFOBLUE, ("************* Chip Test Board Server *************\n"));
|
||||||
enableBlackfinAMCExternalAccessExtension();
|
initError = enableBlackfinAMCExternalAccessExtension(initErrorMessage);
|
||||||
|
if (initError == FAIL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
initError = defineGPIOpins(initErrorMessage);
|
initError = defineGPIOpins(initErrorMessage);
|
||||||
if (initError == FAIL) {
|
if (initError == FAIL) {
|
||||||
return;
|
return;
|
||||||
@ -440,31 +443,30 @@ uint32_t getDetectorIP() {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void enableBlackfinAMCExternalAccessExtension() {
|
int enableBlackfinAMCExternalAccessExtension(char *mess) {
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
const char *file_path = "/sys/kernel/debug/blackfin/ebiu_amc/EBIU_AMBCTL1";
|
const char *file_path = BFIN_AMC_ACCESS_EXTENSION_FNAME;
|
||||||
|
|
||||||
FILE *file = fopen(file_path, "r");
|
FILE *file = fopen(file_path, "r");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
LOG(logERROR, ("Failed to read EBIU_AMBCTL1\n"));
|
strcpy(mess, "Failed to enable blackfin AMC access extension. Could "
|
||||||
return;
|
"not read EBIU_AMBCTL1\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
}
|
}
|
||||||
fscanf(file, "%x", &value);
|
fscanf(file, "%x", &value);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
// enable support for ARDY signal on interface to FPGA
|
value |= BFIN_AMC_ACCESS_EXTENSION_ENA_VAL;
|
||||||
// needed to properly translate avalon_mm_waitrequest in the CTB firmware
|
|
||||||
// https://www.analog.com/media/en/dsp-documentation/processor-manuals/bf537_hwr_Rev3.2.pdf
|
|
||||||
// page 274
|
|
||||||
value |= 0x3;
|
|
||||||
|
|
||||||
file = fopen(file_path, "w");
|
file = fopen(file_path, "w");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
LOG(logERROR, ("Failed to enable blackfin AMC access extension\n"));
|
strcpy(mess, "Failed to enable blackfin AMC access extension. Could "
|
||||||
return;
|
"not write EBIU_AMBCTL1\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
return FAIL;
|
||||||
}
|
}
|
||||||
fprintf(file, "0x%x", value);
|
fprintf(file, "0x%x", value);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialization */
|
/* initialization */
|
||||||
|
@ -25,11 +25,10 @@ version: clean versioning $(PROGS) #hv9m_blackfin_server
|
|||||||
|
|
||||||
boot: $(OBJS)
|
boot: $(OBJS)
|
||||||
|
|
||||||
version_branch=$(API_BRANCH)
|
|
||||||
version_name=APIEIGER
|
version_name=APIEIGER
|
||||||
version_path=slsDetectorServers/eigerDetectorServer
|
version_path=slsDetectorServers/eigerDetectorServer
|
||||||
versioning:
|
versioning:
|
||||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path) $(version_branch); tput sgr0;`
|
cd ../../ && echo $(PWD) && echo `tput setaf 6; python updateAPIVersion.py $(version_name) $(version_path); tput sgr0;`
|
||||||
|
|
||||||
|
|
||||||
$(PROGS): $(OBJS)
|
$(PROGS): $(OBJS)
|
||||||
|
@ -24,11 +24,10 @@ version: clean versioning $(PROGS)
|
|||||||
|
|
||||||
boot: $(OBJS)
|
boot: $(OBJS)
|
||||||
|
|
||||||
version_branch=$(API_BRANCH)
|
|
||||||
version_name=APIGOTTHARD2
|
version_name=APIGOTTHARD2
|
||||||
version_path=slsDetectorServers/gotthard2DetectorServer
|
version_path=slsDetectorServers/gotthard2DetectorServer
|
||||||
versioning:
|
versioning:
|
||||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path) $(version_branch); tput sgr0;`
|
cd ../../ && echo $(PWD) && echo `tput setaf 6; python updateAPIVersion.py $(version_name) $(version_path); tput sgr0;`
|
||||||
|
|
||||||
|
|
||||||
$(PROGS): $(OBJS)
|
$(PROGS): $(OBJS)
|
||||||
|
@ -24,11 +24,10 @@ version: clean versioning $(PROGS)
|
|||||||
|
|
||||||
boot: $(OBJS)
|
boot: $(OBJS)
|
||||||
|
|
||||||
version_branch=$(API_BRANCH)
|
|
||||||
version_name=APIJUNGFRAU
|
version_name=APIJUNGFRAU
|
||||||
version_path=slsDetectorServers/jungfrauDetectorServer
|
version_path=slsDetectorServers/jungfrauDetectorServer
|
||||||
versioning:
|
versioning:
|
||||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path) $(version_branch); tput sgr0;`
|
cd ../../ && echo $(PWD) && echo `tput setaf 6; python updateAPIVersion.py $(version_name) $(version_path); tput sgr0;`
|
||||||
|
|
||||||
|
|
||||||
$(PROGS): $(OBJS)
|
$(PROGS): $(OBJS)
|
||||||
|
@ -24,11 +24,10 @@ version: clean versioning $(PROGS)
|
|||||||
|
|
||||||
boot: $(OBJS)
|
boot: $(OBJS)
|
||||||
|
|
||||||
version_branch=$(API_BRANCH)
|
|
||||||
version_name=APIMOENCH
|
version_name=APIMOENCH
|
||||||
version_path=slsDetectorServers/moenchDetectorServer
|
version_path=slsDetectorServers/moenchDetectorServer
|
||||||
versioning:
|
versioning:
|
||||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path) $(version_branch); tput sgr0;`
|
cd ../../ && echo $(PWD) && echo `tput setaf 6; python updateAPIVersion.py $(version_name) $(version_path); tput sgr0;`
|
||||||
|
|
||||||
|
|
||||||
$(PROGS): $(OBJS)
|
$(PROGS): $(OBJS)
|
||||||
|
@ -25,11 +25,10 @@ version: clean versioning $(PROGS)
|
|||||||
|
|
||||||
boot: $(OBJS)
|
boot: $(OBJS)
|
||||||
|
|
||||||
version_branch=$(API_BRANCH)
|
|
||||||
version_name=APIMYTHEN3
|
version_name=APIMYTHEN3
|
||||||
version_path=slsDetectorServers/mythen3DetectorServer
|
version_path=slsDetectorServers/mythen3DetectorServer
|
||||||
versioning:
|
versioning:
|
||||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path) $(version_branch); tput sgr0;`
|
cd ../../ && echo $(PWD) && echo `tput setaf 6; python updateAPIVersion.py $(version_name) $(version_path); tput sgr0;`
|
||||||
|
|
||||||
|
|
||||||
$(PROGS): $(OBJS)
|
$(PROGS): $(OBJS)
|
||||||
|
@ -5,6 +5,23 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
/** enable support for ARDY signal on interface to FPGA
|
||||||
|
* needed to properly translate avalon_mm_waitrequest in the CTB firmware
|
||||||
|
* https://www.analog.com/media/en/dsp-documentation/processor-manuals/bf537_hwr_Rev3.2.pdf
|
||||||
|
* page 274
|
||||||
|
* */
|
||||||
|
#define BFIN_EBIU_AMBCTL1_B2_ARDY_ENA_OFST (0)
|
||||||
|
#define BFIN_EBIU_AMBCTL1_B2_ARDY_ENA_MSK \
|
||||||
|
(1 << BFIN_EBIU_AMBCTL1_B2_ARDY_ENA_OFST)
|
||||||
|
#define BFIN_EBIU_AMBCTL1_B2_ARDY_POL_OFST (1)
|
||||||
|
#define BFIN_EBIU_AMBCTL1_B2_ARDY_POL_MSK \
|
||||||
|
(1 << BFIN_EBIU_AMBCTL1_B2_ARDY_POL_OFST)
|
||||||
|
|
||||||
|
#define BFIN_AMC_ACCESS_EXTENSION_ENA_VAL \
|
||||||
|
(BFIN_EBIU_AMBCTL1_B2_ARDY_ENA_MSK | BFIN_EBIU_AMBCTL1_B2_ARDY_POL_MSK)
|
||||||
|
#define BFIN_AMC_ACCESS_EXTENSION_FNAME \
|
||||||
|
"/sys/kernel/debug/blackfin/ebiu_amc/EBIU_AMBCTL1"
|
||||||
|
|
||||||
/** I2C defines */
|
/** I2C defines */
|
||||||
#define I2C_CLOCK_MHZ (131.25)
|
#define I2C_CLOCK_MHZ (131.25)
|
||||||
|
|
||||||
|
@ -113,6 +113,10 @@ void setModuleId(int modid);
|
|||||||
u_int64_t getDetectorMAC();
|
u_int64_t getDetectorMAC();
|
||||||
u_int32_t getDetectorIP();
|
u_int32_t getDetectorIP();
|
||||||
|
|
||||||
|
#if defined(CHIPTESTBOARDD)
|
||||||
|
int enableBlackfinAMCExternalAccessExtension(char *mess);
|
||||||
|
#endif
|
||||||
|
|
||||||
// initialization
|
// initialization
|
||||||
void initControlServer();
|
void initControlServer();
|
||||||
void initStopServer();
|
void initStopServer();
|
||||||
@ -135,7 +139,6 @@ void setupDetector();
|
|||||||
#if defined(CHIPTESTBOARDD)
|
#if defined(CHIPTESTBOARDD)
|
||||||
int updateDatabytesandAllocateRAM();
|
int updateDatabytesandAllocateRAM();
|
||||||
void updateDataBytes();
|
void updateDataBytes();
|
||||||
void enableBlackfinAMCExternalAccessExtension();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD)
|
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD)
|
||||||
|
@ -44,6 +44,5 @@ install(TARGETS xilinx_ctbDetectorServer_virtual
|
|||||||
configure_file(chip_config_xilinx.txt ${CMAKE_BINARY_DIR}/bin/chip_config_xilinx.txt COPYONLY)
|
configure_file(chip_config_xilinx.txt ${CMAKE_BINARY_DIR}/bin/chip_config_xilinx.txt COPYONLY)
|
||||||
configure_file(reset_chip_xilinx.txt ${CMAKE_BINARY_DIR}/bin/reset_chip_xilinx.txt COPYONLY)
|
configure_file(reset_chip_xilinx.txt ${CMAKE_BINARY_DIR}/bin/reset_chip_xilinx.txt COPYONLY)
|
||||||
configure_file(enable_clock_pattern.pyat ${CMAKE_BINARY_DIR}/bin/enable_clock_pattern.pyat COPYONLY)
|
configure_file(enable_clock_pattern.pyat ${CMAKE_BINARY_DIR}/bin/enable_clock_pattern.pyat COPYONLY)
|
||||||
configure_file(put_trimbits_zero.pyat ${CMAKE_BINARY_DIR}/bin/put_trimbits_zero.pyat COPYONLY)
|
|
||||||
configure_file(readout_pattern.pyat ${CMAKE_BINARY_DIR}/bin/readout_pattern.pyat COPYONLY)
|
configure_file(readout_pattern.pyat ${CMAKE_BINARY_DIR}/bin/readout_pattern.pyat COPYONLY)
|
||||||
|
|
||||||
|
@ -36,11 +36,10 @@ version: clean versioning $(PROGS)
|
|||||||
|
|
||||||
boot: $(OBJS)
|
boot: $(OBJS)
|
||||||
|
|
||||||
version_branch=$(API_BRANCH)
|
|
||||||
version_name=APIXILINXCTB
|
version_name=APIXILINXCTB
|
||||||
version_path=slsDetectorServers/xilinx_ctbDetectorServer
|
version_path=slsDetectorServers/xilinx_ctbDetectorServer
|
||||||
versioning:
|
versioning:
|
||||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path) $(version_branch); tput sgr0;`
|
cd ../../ && echo $(PWD) && echo `tput setaf 6; python updateAPIVersion.py $(version_name) $(version_path); tput sgr0;`
|
||||||
|
|
||||||
|
|
||||||
$(PROGS): $(OBJS)
|
$(PROGS): $(OBJS)
|
||||||
@ -51,7 +50,6 @@ $(PROGS): $(OBJS)
|
|||||||
cp chip_config_xilinx.txt $(DESTDIR)
|
cp chip_config_xilinx.txt $(DESTDIR)
|
||||||
cp reset_chip_xilinx.txt $(DESTDIR)
|
cp reset_chip_xilinx.txt $(DESTDIR)
|
||||||
cp enable_clock_pattern.pyat $(DESTDIR)
|
cp enable_clock_pattern.pyat $(DESTDIR)
|
||||||
cp put_trimbits_zero.pyat $(DESTDIR)
|
|
||||||
cp readout_pattern.pyat $(DESTDIR)
|
cp readout_pattern.pyat $(DESTDIR)
|
||||||
rm $(main_src)*.o $(md5_dir)*.o
|
rm $(main_src)*.o $(md5_dir)*.o
|
||||||
clean:
|
clean:
|
||||||
|
@ -2,12 +2,10 @@
|
|||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define PATTERN_RAM_BASE_ADDR (0x0000)
|
|
||||||
|
|
||||||
#define CTRL_REG (0x8000)
|
#define CTRL_REG (0x8000)
|
||||||
|
|
||||||
#define POWER_VIO_OFST (0)
|
#define POWER_VIO_OFST (0)
|
||||||
#define POWER_VIO_MSK (0x00000001 << POWER_VIO_OFST)
|
#define POWER_VIO_MSK (0x00000001 << POWER_VIO_OFST)
|
||||||
#define POWER_VCC_A_OFST (1)
|
#define POWER_VCC_A_OFST (1)
|
||||||
#define POWER_VCC_A_MSK (0x00000001 << POWER_VCC_A_OFST)
|
#define POWER_VCC_A_MSK (0x00000001 << POWER_VCC_A_OFST)
|
||||||
#define POWER_VCC_B_OFST (2)
|
#define POWER_VCC_B_OFST (2)
|
||||||
@ -19,20 +17,20 @@
|
|||||||
|
|
||||||
#define STATUS_REG (0x8004)
|
#define STATUS_REG (0x8004)
|
||||||
|
|
||||||
#define PATTERN_RUNNING_OFST (0)
|
#define PATTERN_RUNNING_OFST (0)
|
||||||
#define PATTERN_RUNNING_MSK (0x00000001 << PATTERN_RUNNING_OFST)
|
#define PATTERN_RUNNING_MSK (0x00000001 << PATTERN_RUNNING_OFST)
|
||||||
#define RX_BUSY_OFST (1)
|
#define RX_BUSY_OFST (1)
|
||||||
#define RX_BUSY_MSK (0x00000001 << RX_BUSY_OFST)
|
#define RX_BUSY_MSK (0x00000001 << RX_BUSY_OFST)
|
||||||
#define PROCESSING_BUSY_OFST (2)
|
#define PROCESSING_BUSY_OFST (2)
|
||||||
#define PROCESSING_BUSY_MSK (0x00000001 << PROCESSING_BUSY_OFST)
|
#define PROCESSING_BUSY_MSK (0x00000001 << PROCESSING_BUSY_OFST)
|
||||||
#define UDP_GEN_BUSY_OFST (3)
|
#define UDP_GEN_BUSY_OFST (3)
|
||||||
#define UDP_GEN_BUSY_MSK (0x00000001 << UDP_GEN_BUSY_OFST)
|
#define UDP_GEN_BUSY_MSK (0x00000001 << UDP_GEN_BUSY_OFST)
|
||||||
#define NETWORK_BUSY_OFST (4)
|
#define NETWORK_BUSY_OFST (4)
|
||||||
#define NETWORK_BUSY_MSK (0x00000001 << NETWORK_BUSY_OFST)
|
#define NETWORK_BUSY_MSK (0x00000001 << NETWORK_BUSY_OFST)
|
||||||
#define WAIT_FOR_TRIGGER_OFST (5)
|
#define WAIT_FOR_TRIGGER_OFST (5)
|
||||||
#define WAIT_FOR_TRIGGER_MSK (0x00000001 << WAIT_FOR_TRIGGER_OFST)
|
#define WAIT_FOR_TRIGGER_MSK (0x00000001 << WAIT_FOR_TRIGGER_OFST)
|
||||||
#define RX_NOT_GOOD_OFST (6)
|
#define RX_NOT_GOOD_OFST (6)
|
||||||
#define RX_NOT_GOOD_MSK (0x00000001 << RX_NOT_GOOD_OFST)
|
#define RX_NOT_GOOD_MSK (0x00000001 << RX_NOT_GOOD_OFST)
|
||||||
|
|
||||||
#define STATUS_REG2 (0x8008)
|
#define STATUS_REG2 (0x8008)
|
||||||
|
|
||||||
@ -40,8 +38,8 @@
|
|||||||
|
|
||||||
#define FPGACOMPDATE_OFST (0)
|
#define FPGACOMPDATE_OFST (0)
|
||||||
#define FPGACOMPDATE_MSK (0x00ffffff << FPGACOMPDATE_OFST)
|
#define FPGACOMPDATE_MSK (0x00ffffff << FPGACOMPDATE_OFST)
|
||||||
#define FPGADETTYPE_OFST (24)
|
#define FPGADETTYPE_OFST (24)
|
||||||
#define FPGADETTYPE_MSK (0x000000ff << FPGADETTYPE_OFST)
|
#define FPGADETTYPE_MSK (0x000000ff << FPGADETTYPE_OFST)
|
||||||
|
|
||||||
#define FPGA_GIT_HEAD (0x8010)
|
#define FPGA_GIT_HEAD (0x8010)
|
||||||
|
|
||||||
@ -52,8 +50,8 @@
|
|||||||
|
|
||||||
#define APICOMPDATE_OFST (0)
|
#define APICOMPDATE_OFST (0)
|
||||||
#define APICOMPDATE_MSK (0x00ffffff << APICOMPDATE_OFST)
|
#define APICOMPDATE_MSK (0x00ffffff << APICOMPDATE_OFST)
|
||||||
#define APIDETTYPE_OFST (24)
|
#define APIDETTYPE_OFST (24)
|
||||||
#define APIDETTYPE_MSK (0x000000ff << APIDETTYPE_OFST)
|
#define APIDETTYPE_MSK (0x000000ff << APIDETTYPE_OFST)
|
||||||
|
|
||||||
#define A_FIFO_OVERFLOW_STATUS_REG (0x9000)
|
#define A_FIFO_OVERFLOW_STATUS_REG (0x9000)
|
||||||
|
|
||||||
@ -105,22 +103,23 @@
|
|||||||
|
|
||||||
#define FIFO_TO_GB_CONTROL_REG (0xA000)
|
#define FIFO_TO_GB_CONTROL_REG (0xA000)
|
||||||
|
|
||||||
#define ENABLED_CHANNELS_ADC_OFST (0)
|
#define ENABLED_CHANNELS_ADC_OFST (0)
|
||||||
#define ENABLED_CHANNELS_ADC_MSK (0x000000ff << ENABLED_CHANNELS_ADC_OFST)
|
#define ENABLED_CHANNELS_ADC_MSK (0x000000ff << ENABLED_CHANNELS_ADC_OFST)
|
||||||
#define ENABLED_CHANNELS_D_OFST (8)
|
#define ENABLED_CHANNELS_D_OFST (8)
|
||||||
#define ENABLED_CHANNELS_D_MSK (0x00000001 << ENABLED_CHANNELS_D_OFST)
|
#define ENABLED_CHANNELS_D_MSK (0x00000001 << ENABLED_CHANNELS_D_OFST)
|
||||||
#define ENABLED_CHANNELS_X_OFST (9)
|
#define ENABLED_CHANNELS_X_OFST (9)
|
||||||
#define ENABLED_CHANNELS_X_MSK (0x0000000f << ENABLED_CHANNELS_X_OFST)
|
#define ENABLED_CHANNELS_X_MSK (0x0000000f << ENABLED_CHANNELS_X_OFST)
|
||||||
#define RO_MODE_ADC_OFST (13)
|
#define RO_MODE_ADC_OFST (13)
|
||||||
#define RO_MODE_ADC_MSK (0x00000001 << RO_MODE_ADC_OFST)
|
#define RO_MODE_ADC_MSK (0x00000001 << RO_MODE_ADC_OFST)
|
||||||
#define RO_MODE_D_OFST (14)
|
#define RO_MODE_D_OFST (14)
|
||||||
#define RO_MODE_D_MSK (0x00000001 << RO_MODE_D_OFST)
|
#define RO_MODE_D_MSK (0x00000001 << RO_MODE_D_OFST)
|
||||||
#define RO_MODE_X_OFST (15)
|
#define RO_MODE_X_OFST (15)
|
||||||
#define RO_MODE_X_MSK (0x00000001 << RO_MODE_X_OFST)
|
#define RO_MODE_X_MSK (0x00000001 << RO_MODE_X_OFST)
|
||||||
#define COUNT_FRAMES_FROM_UPDATE_OFST (16)
|
#define COUNT_FRAMES_FROM_UPDATE_OFST (16)
|
||||||
#define COUNT_FRAMES_FROM_UPDATE_MSK (0x00000001 << COUNT_FRAMES_FROM_UPDATE_OFST)
|
#define COUNT_FRAMES_FROM_UPDATE_MSK \
|
||||||
#define START_STREAMING_P_OFST (17)
|
(0x00000001 << COUNT_FRAMES_FROM_UPDATE_OFST)
|
||||||
#define START_STREAMING_P_MSK (0x00000001 << START_STREAMING_P_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_OFST (18)
|
||||||
#define STREAM_BUFFER_CLEAR_MSK (0x00000001 << STREAM_BUFFER_CLEAR_OFST)
|
#define STREAM_BUFFER_CLEAR_MSK (0x00000001 << STREAM_BUFFER_CLEAR_OFST)
|
||||||
|
|
||||||
@ -149,26 +148,26 @@
|
|||||||
|
|
||||||
#define PKTPACKETLENGTHREG (0xA020)
|
#define PKTPACKETLENGTHREG (0xA020)
|
||||||
|
|
||||||
#define PACKETLENGTH1G_OFST (0)
|
#define PACKETLENGTH1G_OFST (0)
|
||||||
#define PACKETLENGTH1G_MSK (0x0000ffff << PACKETLENGTH1G_OFST)
|
#define PACKETLENGTH1G_MSK (0x0000ffff << PACKETLENGTH1G_OFST)
|
||||||
#define PACKETLENGTH10G_OFST (16)
|
#define PACKETLENGTH10G_OFST (16)
|
||||||
#define PACKETLENGTH10G_MSK (0x0000ffff << PACKETLENGTH10G_OFST)
|
#define PACKETLENGTH10G_MSK (0x0000ffff << PACKETLENGTH10G_OFST)
|
||||||
|
|
||||||
#define PKTNOPACKETSREG (0xA024)
|
#define PKTNOPACKETSREG (0xA024)
|
||||||
|
|
||||||
#define NOPACKETS1G_OFST (0)
|
#define NOPACKETS1G_OFST (0)
|
||||||
#define NOPACKETS1G_MSK (0x0000003f << NOPACKETS1G_OFST)
|
#define NOPACKETS1G_MSK (0x0000003f << NOPACKETS1G_OFST)
|
||||||
#define NOPACKETS10G_OFST (16)
|
#define NOPACKETS10G_OFST (16)
|
||||||
#define NOPACKETS10G_MSK (0x0000003f << NOPACKETS10G_OFST)
|
#define NOPACKETS10G_MSK (0x0000003f << NOPACKETS10G_OFST)
|
||||||
|
|
||||||
#define PKTCTRLREG (0xA028)
|
#define PKTCTRLREG (0xA028)
|
||||||
|
|
||||||
#define NOSERVERS_OFST (0)
|
#define NOSERVERS_OFST (0)
|
||||||
#define NOSERVERS_MSK (0x0000003f << NOSERVERS_OFST)
|
#define NOSERVERS_MSK (0x0000003f << NOSERVERS_OFST)
|
||||||
#define SERVERSTART_OFST (8)
|
#define SERVERSTART_OFST (8)
|
||||||
#define SERVERSTART_MSK (0x0000001f << SERVERSTART_OFST)
|
#define SERVERSTART_MSK (0x0000001f << SERVERSTART_OFST)
|
||||||
#define ETHINTERF_OFST (16)
|
#define ETHINTERF_OFST (16)
|
||||||
#define ETHINTERF_MSK (0x00000001 << ETHINTERF_OFST)
|
#define ETHINTERF_MSK (0x00000001 << ETHINTERF_OFST)
|
||||||
|
|
||||||
#define PKTCOORDREG1 (0xA02C)
|
#define PKTCOORDREG1 (0xA02C)
|
||||||
|
|
||||||
@ -182,306 +181,124 @@
|
|||||||
#define COORDZ_OFST (0)
|
#define COORDZ_OFST (0)
|
||||||
#define COORDZ_MSK (0x0000ffff << COORDZ_OFST)
|
#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 FRAME_TIME_OUT_REG_2 (0xB01C)
|
||||||
#define PATTERN_CNTRL_WR_MSK (0x00000001 << PATTERN_CNTRL_WR_OFST)
|
|
||||||
#define PATTERN_CNTRL_RD_OFST (1)
|
#define DELAY_OUT_REG_1 (0xB020)
|
||||||
#define PATTERN_CNTRL_RD_MSK (0x00000001 << PATTERN_CNTRL_RD_OFST)
|
|
||||||
|
#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_OFST (16)
|
||||||
#define PATTERN_CNTRL_ADDR_MSK (0x00001fff << PATTERN_CNTRL_ADDR_OFST)
|
#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_OFST (0)
|
||||||
#define PATTERN_LIMIT_STRT_MSK (0x00001fff << PATTERN_LIMIT_STRT_OFST)
|
#define PATTERN_LIMIT_STRT_MSK (0x00001fff << PATTERN_LIMIT_STRT_OFST)
|
||||||
#define PATTERN_LIMIT_STP_OFST (16)
|
#define PATTERN_LIMIT_STP_OFST (16)
|
||||||
#define PATTERN_LIMIT_STP_MSK (0x00001fff << PATTERN_LIMIT_STP_OFST)
|
#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 FLOW_CONTROL_REG (0xB030)
|
|
||||||
|
|
||||||
#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 DELAY_IN_REG_1 (0xB034)
|
|
||||||
|
|
||||||
#define DELAY_IN_REG_2 (0xB038)
|
|
||||||
|
|
||||||
#define CYCLES_IN_REG_1 (0xB03C)
|
|
||||||
|
|
||||||
#define CYCLES_IN_REG_2 (0xB040)
|
|
||||||
|
|
||||||
#define FRAMES_IN_REG_1 (0xB044)
|
|
||||||
|
|
||||||
#define FRAMES_IN_REG_2 (0xB048)
|
|
||||||
|
|
||||||
#define PERIOD_IN_REG_1 (0xB04C)
|
|
||||||
|
|
||||||
#define PERIOD_IN_REG_2 (0xB050)
|
|
||||||
|
|
||||||
#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)
|
|
||||||
|
|
||||||
#define PATTERN_TEST_REG (0xB074)
|
|
||||||
|
|
||||||
#define PATTERN_FIRMWARE_REG (0xB078)
|
|
||||||
|
|
||||||
#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 TIME_FROM_START_OUT_REG_1 (0xB07C)
|
|
||||||
|
|
||||||
#define TIME_FROM_START_OUT_REG_2 (0xB080)
|
|
||||||
|
|
||||||
#define FRAMES_FROM_START_OUT_REG_1 (0xB084)
|
|
||||||
|
|
||||||
#define FRAMES_FROM_START_OUT_REG_2 (0xB088)
|
|
||||||
|
|
||||||
#define FRAME_TIME_OUT_REG_1 (0xB08C)
|
|
||||||
|
|
||||||
#define FRAME_TIME_OUT_REG_2 (0xB090)
|
|
||||||
|
|
||||||
#define PATTERN_LOOPDEF_START_REG (0xB080)
|
|
||||||
|
|
||||||
#define PATTERN_LOOPDEF_LOOP_ADDR_OFST (0)
|
|
||||||
#define PATTERN_LOOPDEF_LOOP_ADDR_MSK (0x00000001 << PATTERN_LOOPDEF_LOOP_ADDR_OFST)
|
|
||||||
#define PATTERN_LOOPDEF_LOOP_ITERATION_OFST (1)
|
|
||||||
#define PATTERN_LOOPDEF_LOOP_ITERATION_MSK (0x00000001 << PATTERN_LOOPDEF_LOOP_ITERATION_OFST)
|
|
||||||
#define PATTERN_LOOPDEF_WAIT_ADDR_OFST (2)
|
|
||||||
#define PATTERN_LOOPDEF_WAIT_ADDR_MSK (0x00000001 << PATTERN_LOOPDEF_WAIT_ADDR_OFST)
|
|
||||||
#define PATTERN_LOOPDEF_WAIT_TIME_LSB_OFST (3)
|
|
||||||
#define PATTERN_LOOPDEF_WAIT_TIME_LSB_MSK (0x00000001 << PATTERN_LOOPDEF_WAIT_TIME_LSB_OFST)
|
|
||||||
#define PATTERN_LOOPDEF_WAIT_TIME_MSB_OFST (4)
|
|
||||||
#define PATTERN_LOOPDEF_WAIT_TIME_MSB_MSK (0x00000001 << PATTERN_LOOPDEF_WAIT_TIME_MSB_OFST)
|
|
||||||
|
|
||||||
#define DBITFIFOCTRLREG (0xC000)
|
|
||||||
|
|
||||||
#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 DBITFIFODATAREG1 (0xC004)
|
|
||||||
|
|
||||||
#define DBITFIFODATAREG2 (0xC008)
|
|
||||||
|
|
||||||
#define MATTERHORNSPIREG1 (0xC00C)
|
|
||||||
|
|
||||||
#define MATTERHORNSPIREG2 (0xC010)
|
|
||||||
|
|
||||||
#define MATTERHORNSPICTRL (0xC014)
|
|
||||||
|
|
||||||
#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 TRANSCEIVERRXCTRL0REG2 (0xC104)
|
|
||||||
|
|
||||||
#define TRANSCEIVERRXCTRL1REG1 (0xC108)
|
|
||||||
|
|
||||||
#define TRANSCEIVERRXCTRL1REG2 (0xC10C)
|
|
||||||
|
|
||||||
#define TRANSCEIVERRXCTRL2REG (0xC110)
|
|
||||||
|
|
||||||
#define TRANSCEIVERRXCTRL3REG (0xC114)
|
|
||||||
|
|
||||||
#define TRANSCEIVERSTATUS (0xC118)
|
|
||||||
|
|
||||||
#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 TRANSCEIVERSTATUS2 (0xC11C)
|
|
||||||
|
|
||||||
#define RXLOCKED_OFST (0)
|
|
||||||
#define RXLOCKED_MSK (0x0000000f << RXLOCKED_OFST)
|
|
||||||
|
|
||||||
#define TRANSCEIVERCONTROL (0xC120)
|
|
||||||
|
|
||||||
#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 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 TRANSCEIVERERRCNT_REG0 (0xC124)
|
|
||||||
|
|
||||||
#define TRANSCEIVERERRCNT_REG1 (0xC128)
|
|
||||||
|
|
||||||
#define TRANSCEIVERERRCNT_REG2 (0xC12C)
|
|
||||||
|
|
||||||
#define TRANSCEIVERERRCNT_REG3 (0xC130)
|
|
||||||
|
|
||||||
#define TRANSCEIVERALIGNCNT_REG0 (0xC134)
|
|
||||||
|
|
||||||
#define RXALIGNCNTCH0_OFST (0)
|
|
||||||
#define RXALIGNCNTCH0_MSK (0x0000ffff << RXALIGNCNTCH0_OFST)
|
|
||||||
|
|
||||||
#define TRANSCEIVERALIGNCNT_REG1 (0xC138)
|
|
||||||
|
|
||||||
#define RXALIGNCNTCH1_OFST (0)
|
|
||||||
#define RXALIGNCNTCH1_MSK (0x0000ffff << RXALIGNCNTCH1_OFST)
|
|
||||||
|
|
||||||
#define TRANSCEIVERALIGNCNT_REG2 (0xC13C)
|
|
||||||
|
|
||||||
#define RXALIGNCNTCH2_OFST (0)
|
|
||||||
#define RXALIGNCNTCH2_MSK (0x0000ffff << RXALIGNCNTCH2_OFST)
|
|
||||||
|
|
||||||
#define TRANSCEIVERALIGNCNT_REG3 (0xC140)
|
|
||||||
|
|
||||||
#define RXALIGNCNTCH3_OFST (0)
|
|
||||||
#define RXALIGNCNTCH3_MSK (0x0000ffff << RXALIGNCNTCH3_OFST)
|
|
||||||
|
|
||||||
#define TRANSCEIVERLASTWORD_REG0 (0xC144)
|
|
||||||
|
|
||||||
#define RXDATACH0_OFST (0)
|
|
||||||
#define RXDATACH0_MSK (0x0000ffff << RXDATACH0_OFST)
|
|
||||||
|
|
||||||
#define TRANSCEIVERLASTWORD_REG1 (0xC148)
|
|
||||||
|
|
||||||
#define RXDATACH1_OFST (0)
|
|
||||||
#define RXDATACH1_MSK (0x0000ffff << RXDATACH1_OFST)
|
|
||||||
|
|
||||||
#define TRANSCEIVERLASTWORD_REG2 (0xC14C)
|
|
||||||
|
|
||||||
#define RXDATACH2_OFST (0)
|
|
||||||
#define RXDATACH2_MSK (0x0000ffff << RXDATACH2_OFST)
|
|
||||||
|
|
||||||
#define TRANSCEIVERLASTWORD_REG3 (0xC150)
|
|
||||||
|
|
||||||
#define RXDATACH3_OFST (0)
|
|
||||||
#define RXDATACH3_MSK (0x0000ffff << RXDATACH3_OFST)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------
|
|
||||||
// TODO: remove these:
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------
|
|
||||||
#define PINIOCTRLREG (0xB028)
|
|
||||||
|
|
||||||
#define PATTERN_LOOP_0_ADDR_REG (0xB080)
|
|
||||||
#define PATTERN_LOOP_0_ADDR_STRT_OFST (0)
|
#define PATTERN_LOOP_0_ADDR_STRT_OFST (0)
|
||||||
#define PATTERN_LOOP_0_ADDR_STRT_MSK \
|
#define PATTERN_LOOP_0_ADDR_STRT_MSK \
|
||||||
(0x00001fff << PATTERN_LOOP_0_ADDR_STRT_OFST)
|
(0x00001fff << PATTERN_LOOP_0_ADDR_STRT_OFST)
|
||||||
#define PATTERN_LOOP_0_ADDR_STP_OFST (16)
|
#define PATTERN_LOOP_0_ADDR_STP_OFST (16)
|
||||||
#define PATTERN_LOOP_0_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_0_ADDR_STP_OFST)
|
#define PATTERN_LOOP_0_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_0_ADDR_STP_OFST)
|
||||||
#define PATTERN_LOOP_0_ITERATION_REG (0xB084)
|
|
||||||
|
|
||||||
#define PATTERN_WAIT_0_ADDR_REG (0xB088)
|
#define PATTERN_LOOP_0_ITERATION_REG (0xB12C)
|
||||||
|
|
||||||
|
#define PATTERN_WAIT_0_ADDR_REG (0xB130)
|
||||||
|
|
||||||
#define PATTERN_WAIT_0_ADDR_OFST (0)
|
#define PATTERN_WAIT_0_ADDR_OFST (0)
|
||||||
#define PATTERN_WAIT_0_ADDR_MSK (0x00001fff << PATTERN_WAIT_0_ADDR_OFST)
|
#define PATTERN_WAIT_0_ADDR_MSK (0x00001fff << PATTERN_WAIT_0_ADDR_OFST)
|
||||||
|
|
||||||
#define PATTERN_WAIT_TIMER_0_LSB_REG (0xB08C)
|
#define PATTERN_WAIT_TIMER_0_LSB_REG (0xB134)
|
||||||
|
|
||||||
#define PATTERN_WAIT_TIMER_0_MSB_REG (0xB090)
|
#define PATTERN_WAIT_TIMER_0_MSB_REG (0xB138)
|
||||||
|
|
||||||
#define PATTERN_LOOP_1_ADDR_REG (0xB094)
|
#define PATTERN_LOOP_1_ADDR_REG (0xB13C)
|
||||||
|
|
||||||
#define PATTERN_LOOP_1_ADDR_STRT_OFST (0)
|
#define PATTERN_LOOP_1_ADDR_STRT_OFST (0)
|
||||||
#define PATTERN_LOOP_1_ADDR_STRT_MSK \
|
#define PATTERN_LOOP_1_ADDR_STRT_MSK \
|
||||||
@ -489,18 +306,18 @@
|
|||||||
#define PATTERN_LOOP_1_ADDR_STP_OFST (16)
|
#define PATTERN_LOOP_1_ADDR_STP_OFST (16)
|
||||||
#define PATTERN_LOOP_1_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_1_ADDR_STP_OFST)
|
#define PATTERN_LOOP_1_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_1_ADDR_STP_OFST)
|
||||||
|
|
||||||
#define PATTERN_LOOP_1_ITERATION_REG (0xB098)
|
#define PATTERN_LOOP_1_ITERATION_REG (0xB140)
|
||||||
|
|
||||||
#define PATTERN_WAIT_1_ADDR_REG (0xB09C)
|
#define PATTERN_WAIT_1_ADDR_REG (0xB144)
|
||||||
|
|
||||||
#define PATTERN_WAIT_1_ADDR_OFST (0)
|
#define PATTERN_WAIT_1_ADDR_OFST (0)
|
||||||
#define PATTERN_WAIT_1_ADDR_MSK (0x00001fff << PATTERN_WAIT_1_ADDR_OFST)
|
#define PATTERN_WAIT_1_ADDR_MSK (0x00001fff << PATTERN_WAIT_1_ADDR_OFST)
|
||||||
|
|
||||||
#define PATTERN_WAIT_TIMER_1_LSB_REG (0xB0A0)
|
#define PATTERN_WAIT_TIMER_1_LSB_REG (0xB148)
|
||||||
|
|
||||||
#define PATTERN_WAIT_TIMER_1_MSB_REG (0xB0A4)
|
#define PATTERN_WAIT_TIMER_1_MSB_REG (0xB14C)
|
||||||
|
|
||||||
#define PATTERN_LOOP_2_ADDR_REG (0xB0A8)
|
#define PATTERN_LOOP_2_ADDR_REG (0xB150)
|
||||||
|
|
||||||
#define PATTERN_LOOP_2_ADDR_STRT_OFST (0)
|
#define PATTERN_LOOP_2_ADDR_STRT_OFST (0)
|
||||||
#define PATTERN_LOOP_2_ADDR_STRT_MSK \
|
#define PATTERN_LOOP_2_ADDR_STRT_MSK \
|
||||||
@ -508,18 +325,18 @@
|
|||||||
#define PATTERN_LOOP_2_ADDR_STP_OFST (16)
|
#define PATTERN_LOOP_2_ADDR_STP_OFST (16)
|
||||||
#define PATTERN_LOOP_2_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_2_ADDR_STP_OFST)
|
#define PATTERN_LOOP_2_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_2_ADDR_STP_OFST)
|
||||||
|
|
||||||
#define PATTERN_LOOP_2_ITERATION_REG (0xB0AC)
|
#define PATTERN_LOOP_2_ITERATION_REG (0xB154)
|
||||||
|
|
||||||
#define PATTERN_WAIT_2_ADDR_REG (0xB0B0)
|
#define PATTERN_WAIT_2_ADDR_REG (0xB158)
|
||||||
|
|
||||||
#define PATTERN_WAIT_2_ADDR_OFST (0)
|
#define PATTERN_WAIT_2_ADDR_OFST (0)
|
||||||
#define PATTERN_WAIT_2_ADDR_MSK (0x00001fff << PATTERN_WAIT_2_ADDR_OFST)
|
#define PATTERN_WAIT_2_ADDR_MSK (0x00001fff << PATTERN_WAIT_2_ADDR_OFST)
|
||||||
|
|
||||||
#define PATTERN_WAIT_TIMER_2_LSB_REG (0xB0B4)
|
#define PATTERN_WAIT_TIMER_2_LSB_REG (0xB15C)
|
||||||
|
|
||||||
#define PATTERN_WAIT_TIMER_2_MSB_REG (0xB0B8)
|
#define PATTERN_WAIT_TIMER_2_MSB_REG (0xB160)
|
||||||
|
|
||||||
#define PATTERN_LOOP_3_ADDR_REG (0xB0BC)
|
#define PATTERN_LOOP_3_ADDR_REG (0xB164)
|
||||||
|
|
||||||
#define PATTERN_LOOP_3_ADDR_STRT_OFST (0)
|
#define PATTERN_LOOP_3_ADDR_STRT_OFST (0)
|
||||||
#define PATTERN_LOOP_3_ADDR_STRT_MSK \
|
#define PATTERN_LOOP_3_ADDR_STRT_MSK \
|
||||||
@ -527,18 +344,18 @@
|
|||||||
#define PATTERN_LOOP_3_ADDR_STP_OFST (16)
|
#define PATTERN_LOOP_3_ADDR_STP_OFST (16)
|
||||||
#define PATTERN_LOOP_3_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_3_ADDR_STP_OFST)
|
#define PATTERN_LOOP_3_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_3_ADDR_STP_OFST)
|
||||||
|
|
||||||
#define PATTERN_LOOP_3_ITERATION_REG (0xB0C0)
|
#define PATTERN_LOOP_3_ITERATION_REG (0xB168)
|
||||||
|
|
||||||
#define PATTERN_WAIT_3_ADDR_REG (0xB0C4)
|
#define PATTERN_WAIT_3_ADDR_REG (0xB16C)
|
||||||
|
|
||||||
#define PATTERN_WAIT_3_ADDR_OFST (0)
|
#define PATTERN_WAIT_3_ADDR_OFST (0)
|
||||||
#define PATTERN_WAIT_3_ADDR_MSK (0x00001fff << PATTERN_WAIT_3_ADDR_OFST)
|
#define PATTERN_WAIT_3_ADDR_MSK (0x00001fff << PATTERN_WAIT_3_ADDR_OFST)
|
||||||
|
|
||||||
#define PATTERN_WAIT_TIMER_3_LSB_REG (0xB0C8)
|
#define PATTERN_WAIT_TIMER_3_LSB_REG (0xB170)
|
||||||
|
|
||||||
#define PATTERN_WAIT_TIMER_3_MSB_REG (0xB0CC)
|
#define PATTERN_WAIT_TIMER_3_MSB_REG (0xB174)
|
||||||
|
|
||||||
#define PATTERN_LOOP_4_ADDR_REG (0xB0D0)
|
#define PATTERN_LOOP_4_ADDR_REG (0xB178)
|
||||||
|
|
||||||
#define PATTERN_LOOP_4_ADDR_STRT_OFST (0)
|
#define PATTERN_LOOP_4_ADDR_STRT_OFST (0)
|
||||||
#define PATTERN_LOOP_4_ADDR_STRT_MSK \
|
#define PATTERN_LOOP_4_ADDR_STRT_MSK \
|
||||||
@ -546,18 +363,18 @@
|
|||||||
#define PATTERN_LOOP_4_ADDR_STP_OFST (16)
|
#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_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_4_ADDR_STP_OFST)
|
||||||
|
|
||||||
#define PATTERN_LOOP_4_ITERATION_REG (0xB0D4)
|
#define PATTERN_LOOP_4_ITERATION_REG (0xB17C)
|
||||||
|
|
||||||
#define PATTERN_WAIT_4_ADDR_REG (0xB0D8)
|
#define PATTERN_WAIT_4_ADDR_REG (0xB180)
|
||||||
|
|
||||||
#define PATTERN_WAIT_4_ADDR_OFST (0)
|
#define PATTERN_WAIT_4_ADDR_OFST (0)
|
||||||
#define PATTERN_WAIT_4_ADDR_MSK (0x00001fff << PATTERN_WAIT_4_ADDR_OFST)
|
#define PATTERN_WAIT_4_ADDR_MSK (0x00001fff << PATTERN_WAIT_4_ADDR_OFST)
|
||||||
|
|
||||||
#define PATTERN_WAIT_TIMER_4_LSB_REG (0xB0DC)
|
#define PATTERN_WAIT_TIMER_4_LSB_REG (0xB184)
|
||||||
|
|
||||||
#define PATTERN_WAIT_TIMER_4_MSB_REG (0xB0E0)
|
#define PATTERN_WAIT_TIMER_4_MSB_REG (0xB188)
|
||||||
|
|
||||||
#define PATTERN_LOOP_5_ADDR_REG (0xB0E4)
|
#define PATTERN_LOOP_5_ADDR_REG (0xB18C)
|
||||||
|
|
||||||
#define PATTERN_LOOP_5_ADDR_STRT_OFST (0)
|
#define PATTERN_LOOP_5_ADDR_STRT_OFST (0)
|
||||||
#define PATTERN_LOOP_5_ADDR_STRT_MSK \
|
#define PATTERN_LOOP_5_ADDR_STRT_MSK \
|
||||||
@ -565,10 +382,162 @@
|
|||||||
#define PATTERN_LOOP_5_ADDR_STP_OFST (16)
|
#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_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_5_ADDR_STP_OFST)
|
||||||
|
|
||||||
#define PATTERN_LOOP_5_ITERATION_REG (0xB0E8)
|
#define PATTERN_LOOP_5_ITERATION_REG (0xB190)
|
||||||
|
|
||||||
|
#define PATTERN_WAIT_5_ADDR_REG (0xB194)
|
||||||
|
|
||||||
#define PATTERN_WAIT_5_ADDR_REG (0xB0EC)
|
|
||||||
#define PATTERN_WAIT_5_ADDR_OFST (0)
|
#define PATTERN_WAIT_5_ADDR_OFST (0)
|
||||||
#define PATTERN_WAIT_5_ADDR_MSK (0x00001fff << PATTERN_WAIT_5_ADDR_OFST)
|
#define PATTERN_WAIT_5_ADDR_MSK (0x00001fff << PATTERN_WAIT_5_ADDR_OFST)
|
||||||
#define PATTERN_WAIT_TIMER_5_LSB_REG (0xB0F0)
|
|
||||||
#define PATTERN_WAIT_TIMER_5_MSB_REG (0xB0F4)
|
#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 DBITFIFODATAREG1 (0xB1A8)
|
||||||
|
|
||||||
|
#define DBITFIFODATAREG2 (0xB1AC)
|
||||||
|
|
||||||
|
#define MATTERHORNSPIREG1 (0xB1B0)
|
||||||
|
|
||||||
|
#define MATTERHORNSPIREG2 (0xB1B4)
|
||||||
|
|
||||||
|
#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 READOUTFROMASIC_OFST (4)
|
||||||
|
#define READOUTFROMASIC_MSK (0x00000001 << READOUTFROMASIC_OFST)
|
||||||
|
|
||||||
|
#define TRANSCEIVERRXCTRL0REG1 (0xB800)
|
||||||
|
|
||||||
|
#define TRANSCEIVERRXCTRL0REG2 (0xB804)
|
||||||
|
|
||||||
|
#define TRANSCEIVERRXCTRL1REG1 (0xB808)
|
||||||
|
|
||||||
|
#define TRANSCEIVERRXCTRL1REG2 (0xB80C)
|
||||||
|
|
||||||
|
#define TRANSCEIVERRXCTRL2REG (0xB810)
|
||||||
|
|
||||||
|
#define TRANSCEIVERRXCTRL3REG (0xB814)
|
||||||
|
|
||||||
|
#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 TRANSCEIVERSTATUS2 (0xB81C)
|
||||||
|
|
||||||
|
#define RXLOCKED_OFST (0)
|
||||||
|
#define RXLOCKED_MSK (0x0000000f << RXLOCKED_OFST)
|
||||||
|
|
||||||
|
#define TRANSCEIVERCONTROL (0xB820)
|
||||||
|
|
||||||
|
#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 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 TRANSCEIVERERRCNT_REG0 (0xB824)
|
||||||
|
|
||||||
|
#define TRANSCEIVERERRCNT_REG1 (0xB828)
|
||||||
|
|
||||||
|
#define TRANSCEIVERERRCNT_REG2 (0xB82C)
|
||||||
|
|
||||||
|
#define TRANSCEIVERERRCNT_REG3 (0xB830)
|
||||||
|
|
||||||
|
#define TRANSCEIVERALIGNCNT_REG0 (0xB834)
|
||||||
|
|
||||||
|
#define RXALIGNCNTCH0_OFST (0)
|
||||||
|
#define RXALIGNCNTCH0_MSK (0x0000ffff << RXALIGNCNTCH0_OFST)
|
||||||
|
|
||||||
|
#define TRANSCEIVERALIGNCNT_REG1 (0xB838)
|
||||||
|
|
||||||
|
#define RXALIGNCNTCH1_OFST (0)
|
||||||
|
#define RXALIGNCNTCH1_MSK (0x0000ffff << RXALIGNCNTCH1_OFST)
|
||||||
|
|
||||||
|
#define TRANSCEIVERALIGNCNT_REG2 (0xB83C)
|
||||||
|
|
||||||
|
#define RXALIGNCNTCH2_OFST (0)
|
||||||
|
#define RXALIGNCNTCH2_MSK (0x0000ffff << RXALIGNCNTCH2_OFST)
|
||||||
|
|
||||||
|
#define TRANSCEIVERALIGNCNT_REG3 (0xB840)
|
||||||
|
|
||||||
|
#define RXALIGNCNTCH3_OFST (0)
|
||||||
|
#define RXALIGNCNTCH3_MSK (0x0000ffff << RXALIGNCNTCH3_OFST)
|
||||||
|
|
||||||
|
#define TRANSCEIVERLASTWORD_REG0 (0xB844)
|
||||||
|
|
||||||
|
#define RXDATACH0_OFST (0)
|
||||||
|
#define RXDATACH0_MSK (0x0000ffff << RXDATACH0_OFST)
|
||||||
|
|
||||||
|
#define TRANSCEIVERLASTWORD_REG1 (0xB848)
|
||||||
|
|
||||||
|
#define RXDATACH1_OFST (0)
|
||||||
|
#define RXDATACH1_MSK (0x0000ffff << RXDATACH1_OFST)
|
||||||
|
|
||||||
|
#define TRANSCEIVERLASTWORD_REG2 (0xB84C)
|
||||||
|
|
||||||
|
#define RXDATACH2_OFST (0)
|
||||||
|
#define RXDATACH2_MSK (0x0000ffff << RXDATACH2_OFST)
|
||||||
|
|
||||||
|
#define TRANSCEIVERLASTWORD_REG3 (0xB850)
|
||||||
|
|
||||||
|
#define RXDATACH3_OFST (0)
|
||||||
|
#define RXDATACH3_MSK (0x0000ffff << RXDATACH3_OFST)
|
||||||
|
@ -1,37 +1,24 @@
|
|||||||
# Prepare MH02 configuration
|
# Prepare MH02 configuration
|
||||||
reg 0xC00C 0x00000041
|
reg 0xB1B0 0x00000041
|
||||||
reg 0xC010 0x01200004
|
reg 0xB1B4 0x01200004
|
||||||
|
|
||||||
# turn on external CLKSEL for trimbit upload
|
|
||||||
setbit 0xC00C 17
|
|
||||||
|
|
||||||
# configure Matterhorn SPI
|
# configure Matterhorn SPI
|
||||||
setbit 0xC014 0
|
setbit 0xB1B8 0
|
||||||
|
|
||||||
# wait till config is done
|
# wait till config is done
|
||||||
pollbit 0xC014 3 0
|
pollbit 0xB1B8 3 0
|
||||||
|
|
||||||
# set trimbits to 0
|
|
||||||
pattern put_trimbits_zero.pyat
|
|
||||||
setbit 0xB030 0
|
|
||||||
clearbit 0xB030 0
|
|
||||||
sleep 1
|
|
||||||
pollbit 0xB004 0 0
|
|
||||||
clearbit 0xC00C 17
|
|
||||||
setbit 0xC014 0
|
|
||||||
pollbit 0xC014 3 0
|
|
||||||
|
|
||||||
# reset transceiver
|
# reset transceiver
|
||||||
reg 0xC120 0x0
|
reg 0xB820 0x0
|
||||||
reg 0xC120 0x1
|
reg 0xB820 0x1
|
||||||
reg 0xC120 0x0
|
reg 0xB820 0x0
|
||||||
|
|
||||||
# set MSB LSB inversions and polarity for transceiver
|
# set MSB LSB inversions and polarity for transceiver
|
||||||
reg 0xC120 0x61e0
|
reg 0xB820 0x61e0
|
||||||
|
|
||||||
# Enable MH02 PLL clock
|
# Enable MH02 PLL clock
|
||||||
pattern enable_clock_pattern.pyat
|
pattern enable_clock_pattern.pyat
|
||||||
# start the flow
|
# start the flow
|
||||||
setbit 0xB030 0
|
setbit 0xB004 0
|
||||||
clearbit 0xB030 0
|
clearbit 0xB004 0
|
||||||
sleep 1
|
sleep 1
|
||||||
|
@ -1,82 +0,0 @@
|
|||||||
patword 0x0000 0x0000000000000000
|
|
||||||
patword 0x0001 0x0000000000000000
|
|
||||||
patword 0x0002 0x0000000000000000
|
|
||||||
patword 0x0003 0x0000000000000000
|
|
||||||
patword 0x0004 0x0000000000000000
|
|
||||||
patword 0x0005 0x0000000000000000
|
|
||||||
patword 0x0006 0x0000000000000000
|
|
||||||
patword 0x0007 0x0000000000000000
|
|
||||||
patword 0x0008 0x0000000000000000
|
|
||||||
patword 0x0009 0x0000000000000000
|
|
||||||
patword 0x000a 0x0000000000000000
|
|
||||||
patword 0x000b 0x0000000000000000
|
|
||||||
patword 0x000c 0x0000000000000000
|
|
||||||
patword 0x000d 0x0000000000001000
|
|
||||||
patword 0x000e 0x0000000000001000
|
|
||||||
patword 0x000f 0x0000000000001000
|
|
||||||
patword 0x0010 0x0000000000001000
|
|
||||||
patword 0x0011 0x0000000000001000
|
|
||||||
patword 0x0012 0x0000000000000000
|
|
||||||
patword 0x0013 0x0000000000000000
|
|
||||||
patword 0x0014 0x0000000000000000
|
|
||||||
patword 0x0015 0x0000000000000000
|
|
||||||
patword 0x0016 0x0000000000000000
|
|
||||||
patword 0x0017 0x0000000000000400
|
|
||||||
patword 0x0018 0x0000000000000400
|
|
||||||
patword 0x0019 0x0000000000000400
|
|
||||||
patword 0x001a 0x0000000000000400
|
|
||||||
patword 0x001b 0x0000000001000400
|
|
||||||
patword 0x001c 0x0000000001000400
|
|
||||||
patword 0x001d 0x0000000001000400
|
|
||||||
patword 0x001e 0x0000000001000400
|
|
||||||
patword 0x001f 0x0000000000000400
|
|
||||||
patword 0x0020 0x0000000000000400
|
|
||||||
patword 0x0021 0x0000000000000400
|
|
||||||
patword 0x0022 0x0000000000000400
|
|
||||||
patword 0x0023 0x0000000000001400
|
|
||||||
patword 0x0024 0x0000000000001400
|
|
||||||
patword 0x0025 0x0000000000001400
|
|
||||||
patword 0x0026 0x0000000000001400
|
|
||||||
patword 0x0027 0x0000000001001400
|
|
||||||
patword 0x0028 0x0000000001001400
|
|
||||||
patword 0x0029 0x0000000001001400
|
|
||||||
patword 0x002a 0x0000000001001400
|
|
||||||
patword 0x002b 0x0000000000001400
|
|
||||||
patword 0x002c 0x0000000000001400
|
|
||||||
patword 0x002d 0x0000000000001400
|
|
||||||
patword 0x002e 0x0000000000001400
|
|
||||||
patword 0x002f 0x0000000000000400
|
|
||||||
patword 0x0030 0x0000000000000400
|
|
||||||
patword 0x0031 0x0000000000000400
|
|
||||||
patword 0x0032 0x0000000000000400
|
|
||||||
patword 0x0033 0x0000000000000400
|
|
||||||
patword 0x0034 0x0000000000000400
|
|
||||||
patword 0x0035 0x0000000000000400
|
|
||||||
patword 0x0036 0x0000000000000400
|
|
||||||
patword 0x0037 0x0000000000000000
|
|
||||||
patioctrl 0x0000000001b3ffff
|
|
||||||
patlimits 0x0000 0x0037
|
|
||||||
patloop 0 0x0018 0x0036
|
|
||||||
patnloop 0 192
|
|
||||||
patloop 1 0x0400 0x0400
|
|
||||||
patnloop 1 0
|
|
||||||
patloop 2 0x0400 0x0400
|
|
||||||
patnloop 2 0
|
|
||||||
patloop 3 0x0400 0x0400
|
|
||||||
patnloop 3 0
|
|
||||||
patloop 4 0x0400 0x0400
|
|
||||||
patnloop 4 0
|
|
||||||
patloop 5 0x0400 0x0400
|
|
||||||
patnloop 5 0
|
|
||||||
patwait 0 0x0400
|
|
||||||
patwaittime 0 0
|
|
||||||
patwait 1 0x0400
|
|
||||||
patwaittime 1 0
|
|
||||||
patwait 2 0x0400
|
|
||||||
patwaittime 2 0
|
|
||||||
patwait 3 0x0400
|
|
||||||
patwaittime 3 0
|
|
||||||
patwait 4 0x0400
|
|
||||||
patwaittime 4 0
|
|
||||||
patwait 5 0x0400
|
|
||||||
patwaittime 5 0
|
|
@ -1,30 +1,30 @@
|
|||||||
|
|
||||||
# turn off clock
|
# turn off clock
|
||||||
setbit 0xC00C 16
|
setbit 0xB1B0 16
|
||||||
setbit 0xC014 0
|
setbit 0xB1B8 0
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# reset Matterhorn periphery
|
# reset Matterhorn periphery
|
||||||
setbit 0xC014 1
|
setbit 0xB1B8 1
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# turn on clock
|
# turn on clock
|
||||||
clearbit 0xC00C 16
|
clearbit 0xB1B0 16
|
||||||
setbit 0xC014 0
|
setbit 0xB1B8 0
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# reset rx transceiver datapath
|
# reset rx transceiver datapath
|
||||||
setbit 0xC120 4
|
setbit 0xB820 4
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# reset 8b10b counters
|
# reset 8b10b counters
|
||||||
setbit 0xC120 9
|
setbit 0xB820 9
|
||||||
setbit 0xC120 10
|
setbit 0xB820 10
|
||||||
setbit 0xC120 11
|
setbit 0xB820 11
|
||||||
setbit 0xC120 12
|
setbit 0xB820 12
|
||||||
sleep 1
|
sleep 1
|
||||||
clearbit 0xC120 9
|
clearbit 0xB820 9
|
||||||
clearbit 0xC120 10
|
clearbit 0xB820 10
|
||||||
|
|
||||||
# reset buffer fifos
|
# reset buffer fifos
|
||||||
reg 0x9024 0xFFFFFFFF
|
reg 0x9024 0xFFFFFFFF
|
||||||
|
@ -100,7 +100,6 @@ if(SLS_USE_TEXTCLIENT)
|
|||||||
target_link_libraries(${val1}
|
target_link_libraries(${val1}
|
||||||
slsDetectorStatic
|
slsDetectorStatic
|
||||||
pthread
|
pthread
|
||||||
rt
|
|
||||||
)
|
)
|
||||||
SET_SOURCE_FILES_PROPERTIES( src/Caller.cpp PROPERTIES COMPILE_FLAGS "-Wno-unused-variable -Wno-unused-but-set-variable")
|
SET_SOURCE_FILES_PROPERTIES( src/Caller.cpp PROPERTIES COMPILE_FLAGS "-Wno-unused-variable -Wno-unused-but-set-variable")
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
uint32_t streamingTimerInMs;
|
uint32_t streamingTimerInMs;
|
||||||
uint32_t streamingStartFnum;
|
uint32_t streamingStartFnum;
|
||||||
uint32_t currentFreqCount{0};
|
uint32_t currentFreqCount{0};
|
||||||
struct timespec timerbegin{};
|
struct timespec timerbegin {};
|
||||||
bool framePadding;
|
bool framePadding;
|
||||||
std::atomic<bool> startedFlag{false};
|
std::atomic<bool> startedFlag{false};
|
||||||
std::atomic<uint64_t> firstIndex{0};
|
std::atomic<uint64_t> firstIndex{0};
|
||||||
|
@ -104,11 +104,11 @@ void zmq_free(void *data, void *hint) { delete[] static_cast<char *>(data); }
|
|||||||
void print_frames(const PortFrameMap &frame_port_map) {
|
void print_frames(const PortFrameMap &frame_port_map) {
|
||||||
LOG(sls::logDEBUG) << "Printing frames";
|
LOG(sls::logDEBUG) << "Printing frames";
|
||||||
for (const auto &it : frame_port_map) {
|
for (const auto &it : frame_port_map) {
|
||||||
uint16_t udpPort = it.first;
|
const uint16_t udpPort = it.first;
|
||||||
const auto &frame_map = it.second;
|
const auto &frame_map = it.second;
|
||||||
LOG(sls::logDEBUG) << "UDP port: " << udpPort;
|
LOG(sls::logDEBUG) << "UDP port: " << udpPort;
|
||||||
for (const auto &frame : frame_map) {
|
for (const auto &frame : frame_map) {
|
||||||
uint64_t fnum = frame.first;
|
const uint64_t fnum = frame.first;
|
||||||
const auto &msg_list = frame.second;
|
const auto &msg_list = frame.second;
|
||||||
LOG(sls::logDEBUG)
|
LOG(sls::logDEBUG)
|
||||||
<< " acq index: " << fnum << '[' << msg_list.size() << ']';
|
<< " acq index: " << fnum << '[' << msg_list.size() << ']';
|
||||||
@ -127,30 +127,26 @@ std::set<uint64_t> get_valid_fnums(const PortFrameMap &port_frame_map) {
|
|||||||
|
|
||||||
// collect all unique frame numbers from all ports
|
// collect all unique frame numbers from all ports
|
||||||
std::set<uint64_t> unique_fnums;
|
std::set<uint64_t> unique_fnums;
|
||||||
for (auto it = port_frame_map.begin(); it != port_frame_map.begin(); ++it) {
|
for (const auto &it : port_frame_map) {
|
||||||
const FrameMap &frame_map = it->second;
|
const FrameMap &frame_map = it.second;
|
||||||
for (auto frame = frame_map.begin(); frame != frame_map.end();
|
for (const auto &frame : frame_map) {
|
||||||
++frame) {
|
unique_fnums.insert(frame.first);
|
||||||
unique_fnums.insert(frame->first);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// collect valid frame numbers
|
// collect valid frame numbers
|
||||||
for (auto &fnum : unique_fnums) {
|
for (auto &fnum : unique_fnums) {
|
||||||
bool is_valid = true;
|
bool is_valid = true;
|
||||||
for (auto it = port_frame_map.begin(); it != port_frame_map.end();
|
for (const auto &it : port_frame_map) {
|
||||||
++it) {
|
const uint16_t port = it.first;
|
||||||
uint16_t port = it->first;
|
const FrameMap &frame_map = it.second;
|
||||||
const FrameMap &frame_map = it->second;
|
|
||||||
auto frame = frame_map.find(fnum);
|
auto frame = frame_map.find(fnum);
|
||||||
// invalid: fnum missing in one port
|
// invalid: fnum missing in one port
|
||||||
if (frame == frame_map.end()) {
|
if (frame == frame_map.end()) {
|
||||||
LOG(sls::logDEBUG)
|
LOG(sls::logDEBUG)
|
||||||
<< "Fnum " << fnum << " is missing in port " << port;
|
<< "Fnum " << fnum << " is missing in port " << port;
|
||||||
// invalid: fnum greater than all in that port
|
auto upper_frame = frame_map.upper_bound(fnum);
|
||||||
auto last_frame = std::prev(frame_map.end());
|
if (upper_frame == frame_map.end()) {
|
||||||
auto last_fnum = last_frame->first;
|
|
||||||
if (fnum > last_fnum) {
|
|
||||||
LOG(sls::logDEBUG) << "And no larger fnum found. Fnum "
|
LOG(sls::logDEBUG) << "And no larger fnum found. Fnum "
|
||||||
<< fnum << " is invalid.\n";
|
<< fnum << " is invalid.\n";
|
||||||
is_valid = false;
|
is_valid = false;
|
||||||
@ -220,18 +216,26 @@ void Correlate(FrameStatus *stat) {
|
|||||||
// sending all valid fnum data packets
|
// sending all valid fnum data packets
|
||||||
for (const auto &fnum : valid_fnums) {
|
for (const auto &fnum : valid_fnums) {
|
||||||
ZmqMsgList msg_list;
|
ZmqMsgList msg_list;
|
||||||
PortFrameMap &port_frame_map = stat->frames;
|
for (const auto &it : stat->frames) {
|
||||||
for (auto it = port_frame_map.begin();
|
const uint16_t port = it.first;
|
||||||
it != port_frame_map.end(); ++it) {
|
const FrameMap &frame_map = it.second;
|
||||||
uint16_t port = it->first;
|
|
||||||
const FrameMap &frame_map = it->second;
|
|
||||||
auto frame = frame_map.find(fnum);
|
auto frame = frame_map.find(fnum);
|
||||||
if (frame != frame_map.end()) {
|
if (frame != frame_map.end()) {
|
||||||
msg_list.insert(msg_list.end(),
|
msg_list.insert(msg_list.end(),
|
||||||
stat->frames[port][fnum].begin(),
|
stat->frames[port][fnum].begin(),
|
||||||
stat->frames[port][fnum].end());
|
stat->frames[port][fnum].end());
|
||||||
// clean up
|
}
|
||||||
for (zmq_msg_t *msg : stat->frames[port][fnum]) {
|
}
|
||||||
|
LOG(printHeadersLevel)
|
||||||
|
<< "Sending data packets for fnum " << fnum;
|
||||||
|
zmq_send_multipart(socket, msg_list);
|
||||||
|
// clean up
|
||||||
|
for (const auto &it : stat->frames) {
|
||||||
|
const uint16_t port = it.first;
|
||||||
|
const FrameMap &frame_map = it.second;
|
||||||
|
auto frame = frame_map.find(fnum);
|
||||||
|
if (frame != frame_map.end()) {
|
||||||
|
for (zmq_msg_t *msg : frame->second) {
|
||||||
if (msg) {
|
if (msg) {
|
||||||
zmq_msg_close(msg);
|
zmq_msg_close(msg);
|
||||||
delete msg;
|
delete msg;
|
||||||
@ -240,9 +244,6 @@ void Correlate(FrameStatus *stat) {
|
|||||||
stat->frames[port].erase(fnum);
|
stat->frames[port].erase(fnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG(printHeadersLevel)
|
|
||||||
<< "Sending data packets for fnum " << fnum;
|
|
||||||
zmq_send_multipart(socket, msg_list);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// sending all end packets
|
// sending all end packets
|
||||||
@ -256,6 +257,21 @@ void Correlate(FrameStatus *stat) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stat->ends.clear();
|
stat->ends.clear();
|
||||||
|
// clean up old frames
|
||||||
|
for (auto &it : stat->frames) {
|
||||||
|
FrameMap &frame_map = it.second;
|
||||||
|
for (auto &frame : frame_map) {
|
||||||
|
for (zmq_msg_t *msg : frame.second) {
|
||||||
|
if (msg) {
|
||||||
|
zmq_msg_close(msg);
|
||||||
|
delete msg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
frame.second.clear();
|
||||||
|
}
|
||||||
|
frame_map.clear();
|
||||||
|
}
|
||||||
|
stat->frames.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,8 +63,8 @@ class GeneralData {
|
|||||||
slsDetectorDefs::frameDiscardPolicy frameDiscardMode{
|
slsDetectorDefs::frameDiscardPolicy frameDiscardMode{
|
||||||
slsDetectorDefs::NO_DISCARD};
|
slsDetectorDefs::NO_DISCARD};
|
||||||
|
|
||||||
GeneralData() {};
|
GeneralData(){};
|
||||||
virtual ~GeneralData() {};
|
virtual ~GeneralData(){};
|
||||||
|
|
||||||
// Returns the pixel depth in byte, 4 bits being 0.5 byte
|
// Returns the pixel depth in byte, 4 bits being 0.5 byte
|
||||||
float GetPixelDepth() { return float(dynamicRange) / 8; }
|
float GetPixelDepth() { return float(dynamicRange) / 8; }
|
||||||
|
@ -47,8 +47,8 @@ class GeneralDataTest : public GeneralData {
|
|||||||
// dummy DataProcessor class for testing
|
// dummy DataProcessor class for testing
|
||||||
class DataProcessorTest : public DataProcessor {
|
class DataProcessorTest : public DataProcessor {
|
||||||
public:
|
public:
|
||||||
DataProcessorTest() : DataProcessor(0) {};
|
DataProcessorTest() : DataProcessor(0){};
|
||||||
~DataProcessorTest() {};
|
~DataProcessorTest(){};
|
||||||
void ArrangeDbitData(size_t &size, char *data) {
|
void ArrangeDbitData(size_t &size, char *data) {
|
||||||
DataProcessor::ArrangeDbitData(size, data);
|
DataProcessor::ArrangeDbitData(size, data);
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,7 @@ message(STATUS "RAPID: ${SLS_INTERNAL_RAPIDJSON_DIR}")
|
|||||||
target_link_libraries(slsSupportObject
|
target_link_libraries(slsSupportObject
|
||||||
PUBLIC
|
PUBLIC
|
||||||
slsProjectOptions
|
slsProjectOptions
|
||||||
|
${STD_FS_LIB} # from helpers.cmake
|
||||||
|
|
||||||
PRIVATE
|
PRIVATE
|
||||||
slsProjectWarnings
|
slsProjectWarnings
|
||||||
|
@ -113,10 +113,10 @@ template <typename T, size_t Capacity> class StaticVector {
|
|||||||
// auto begin() noexcept -> decltype(data_.begin()) { return data_.begin();
|
// auto begin() noexcept -> decltype(data_.begin()) { return data_.begin();
|
||||||
// }
|
// }
|
||||||
const_iterator begin() const noexcept { return data_.begin(); }
|
const_iterator begin() const noexcept { return data_.begin(); }
|
||||||
iterator end() noexcept { return &data_[current_size]; }
|
iterator end() noexcept { return data_.begin()+current_size; }
|
||||||
const_iterator end() const noexcept { return &data_[current_size]; }
|
const_iterator end() const noexcept { return data_.begin()+current_size; }
|
||||||
const_iterator cbegin() const noexcept { return data_.cbegin(); }
|
const_iterator cbegin() const noexcept { return data_.cbegin(); }
|
||||||
const_iterator cend() const noexcept { return &data_[current_size]; }
|
const_iterator cend() const noexcept { return data_.cbegin()+current_size; }
|
||||||
|
|
||||||
void size_check(size_type s) const {
|
void size_check(size_type s) const {
|
||||||
if (s > Capacity) {
|
if (s > Capacity) {
|
||||||
|
@ -47,6 +47,8 @@ std::string ToString(const defs::polarity s);
|
|||||||
std::string ToString(const defs::timingInfoDecoder s);
|
std::string ToString(const defs::timingInfoDecoder s);
|
||||||
std::string ToString(const defs::collectionMode s);
|
std::string ToString(const defs::collectionMode s);
|
||||||
|
|
||||||
|
std::string ToString(bool value);
|
||||||
|
|
||||||
std::string ToString(const slsDetectorDefs::xy &coord);
|
std::string ToString(const slsDetectorDefs::xy &coord);
|
||||||
std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::xy &coord);
|
std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::xy &coord);
|
||||||
std::string ToString(const slsDetectorDefs::ROI &roi);
|
std::string ToString(const slsDetectorDefs::ROI &roi);
|
||||||
|
@ -11,7 +11,7 @@ class Version {
|
|||||||
private:
|
private:
|
||||||
std::string version_;
|
std::string version_;
|
||||||
std::string date_;
|
std::string date_;
|
||||||
const std::string defaultBranch_ = "developer";
|
inline static const std::string defaultVersion_[] = {"developer", "0.0.0"};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Version(const std::string &s);
|
explicit Version(const std::string &s);
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
/** API versions */
|
/** API versions */
|
||||||
#define APILIB "developer 0x241122"
|
#define APILIB "0.0.0 0x250523"
|
||||||
#define APIRECEIVER "developer 0x241122"
|
#define APIRECEIVER "0.0.0 0x250523"
|
||||||
#define APICTB "developer 0x250310"
|
#define APICTB "0.0.0 0x250523"
|
||||||
#define APIGOTTHARD2 "developer 0x250310"
|
#define APIGOTTHARD2 "0.0.0 0x250523"
|
||||||
#define APIMOENCH "developer 0x250310"
|
#define APIMOENCH "0.0.0 0x250523"
|
||||||
#define APIEIGER "developer 0x250310"
|
#define APIEIGER "0.0.0 0x250523"
|
||||||
#define APIXILINXCTB "developer 0x250311"
|
#define APIXILINXCTB "0.0.0 0x250523"
|
||||||
#define APIJUNGFRAU "developer 0x250318"
|
#define APIJUNGFRAU "0.0.0 0x250523"
|
||||||
#define APIMYTHEN3 "developer 0x250409"
|
#define APIMYTHEN3 "0.0.0 0x250523"
|
||||||
|
|
||||||
|
@ -5,6 +5,13 @@
|
|||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
|
|
||||||
|
|
||||||
|
std::string ToString(bool value) {
|
||||||
|
return value ? "1" : "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::string ToString(const slsDetectorDefs::xy &coord) {
|
std::string ToString(const slsDetectorDefs::xy &coord) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << '[' << coord.x << ", " << coord.y << ']';
|
oss << '[' << coord.x << ", " << coord.y << ']';
|
||||||
|
@ -21,7 +21,8 @@ Version::Version(const std::string &s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Version::hasSemanticVersioning() const {
|
bool Version::hasSemanticVersioning() const {
|
||||||
return version_ != defaultBranch_;
|
|
||||||
|
return (version_ != defaultVersion_[0]) && (version_ != defaultVersion_[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Version::getVersion() const { return version_; }
|
std::string Version::getVersion() const { return version_; }
|
||||||
|
@ -14,6 +14,7 @@ target_sources(tests PRIVATE
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-TypeTraits.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/test-TypeTraits.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-UdpRxSocket.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/test-UdpRxSocket.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-logger.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/test-logger.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/test-Version.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-ZmqSocket.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/test-ZmqSocket.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -8,12 +8,15 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace sls {
|
|
||||||
|
using sls::StaticVector;
|
||||||
|
|
||||||
TEST_CASE("StaticVector is a container") {
|
TEST_CASE("StaticVector is a container") {
|
||||||
REQUIRE(is_container<StaticVector<int, 7>>::value == true);
|
REQUIRE(sls::is_container<StaticVector<int, 7>>::value == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("Comparing StaticVector containers") {
|
TEST_CASE("Comparing StaticVector containers") {
|
||||||
StaticVector<int, 5> a{0, 1, 2};
|
StaticVector<int, 5> a{0, 1, 2};
|
||||||
StaticVector<int, 5> b{0, 1, 2};
|
StaticVector<int, 5> b{0, 1, 2};
|
||||||
@ -90,10 +93,17 @@ TEST_CASE("Copy construct from array") {
|
|||||||
REQUIRE(fcc == arr);
|
REQUIRE(fcc == arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Construct from a smaller StaticVector") {
|
||||||
|
StaticVector<int, 3> sv{1, 2, 3};
|
||||||
|
StaticVector<int, 5> sv2{sv};
|
||||||
|
REQUIRE(sv == sv2);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("Free function and method gives the same iterators") {
|
TEST_CASE("Free function and method gives the same iterators") {
|
||||||
StaticVector<int, 3> fcc{1, 2, 3};
|
StaticVector<int, 3> fcc{1, 2, 3};
|
||||||
REQUIRE(std::begin(fcc) == fcc.begin());
|
REQUIRE(std::begin(fcc) == fcc.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
SCENARIO("StaticVectors can be sized and resized", "[support]") {
|
SCENARIO("StaticVectors can be sized and resized", "[support]") {
|
||||||
|
|
||||||
GIVEN("A default constructed container") {
|
GIVEN("A default constructed container") {
|
||||||
@ -246,23 +256,23 @@ SCENARIO("Sorting, removing and other manipulation of a container",
|
|||||||
REQUIRE(a[3] == 90);
|
REQUIRE(a[3] == 90);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// WHEN("Sorting is done using free function for begin and end") {
|
WHEN("Sorting is done using free function for begin and end") {
|
||||||
// std::sort(begin(a), end(a));
|
std::sort(std::begin(a), std::end(a));
|
||||||
// THEN("it also works") {
|
THEN("it also works") {
|
||||||
// REQUIRE(a[0] == 12);
|
REQUIRE(a[0] == 12);
|
||||||
// REQUIRE(a[1] == 12);
|
REQUIRE(a[1] == 12);
|
||||||
// REQUIRE(a[2] == 14);
|
REQUIRE(a[2] == 14);
|
||||||
// REQUIRE(a[3] == 90);
|
REQUIRE(a[3] == 90);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// WHEN("Erasing elements of a certain value") {
|
WHEN("Erasing elements of a certain value") {
|
||||||
// a.erase(std::remove(begin(a), end(a), 12));
|
a.erase(std::remove(std::begin(a), std::end(a), 12));
|
||||||
// THEN("all elements of that value are removed") {
|
THEN("all elements of that value are removed") {
|
||||||
// REQUIRE(a.size() == 2);
|
REQUIRE(a.size() == 2);
|
||||||
// REQUIRE(a[0] == 14);
|
REQUIRE(a[0] == 14);
|
||||||
// REQUIRE(a[1] == 90);
|
REQUIRE(a[1] == 90);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,4 +345,3 @@ TEST_CASE("StaticVector stream") {
|
|||||||
REQUIRE(oss.str() == "[33, 85667, 2]");
|
REQUIRE(oss.str() == "[33, 85667, 2]");
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
|
||||||
|
@ -16,6 +16,17 @@ namespace sls {
|
|||||||
|
|
||||||
using namespace sls::time;
|
using namespace sls::time;
|
||||||
|
|
||||||
|
TEST_CASE("Convert bool to string", "[support]") {
|
||||||
|
REQUIRE(ToString(true) == "1");
|
||||||
|
REQUIRE(ToString(false) == "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Convert string to bool", "[support]") {
|
||||||
|
REQUIRE(StringTo<bool>("1") == true);
|
||||||
|
REQUIRE(StringTo<bool>("0") == false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("Integer conversions", "[support]") {
|
TEST_CASE("Integer conversions", "[support]") {
|
||||||
REQUIRE(ToString(0) == "0");
|
REQUIRE(ToString(0) == "0");
|
||||||
REQUIRE(ToString(1) == "1");
|
REQUIRE(ToString(1) == "1");
|
||||||
|
19
slsSupportLib/tests/test-Version.cpp
Normal file
19
slsSupportLib/tests/test-Version.cpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
|
#include "catch.hpp"
|
||||||
|
#include "sls/Version.h"
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
|
TEST_CASE("check if version is semantic", "[.version]") {
|
||||||
|
|
||||||
|
auto [version_string, has_semantic_version] =
|
||||||
|
GENERATE(std::make_tuple("developer 0x250512", false),
|
||||||
|
std::make_tuple("0.0.0 0x250512", false));
|
||||||
|
|
||||||
|
Version version(version_string);
|
||||||
|
|
||||||
|
CHECK(version.hasSemanticVersioning() == has_semantic_version);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
@ -60,3 +60,5 @@ include(Catch)
|
|||||||
catch_discover_tests(tests)
|
catch_discover_tests(tests)
|
||||||
|
|
||||||
configure_file(scripts/test_simulators.py ${CMAKE_BINARY_DIR}/bin/test_simulators.py COPYONLY)
|
configure_file(scripts/test_simulators.py ${CMAKE_BINARY_DIR}/bin/test_simulators.py COPYONLY)
|
||||||
|
configure_file(scripts/test_frame_synchronizer.py ${CMAKE_BINARY_DIR}/bin/test_frame_synchronizer.py COPYONLY)
|
||||||
|
configure_file(scripts/utils_for_test.py ${CMAKE_BINARY_DIR}/bin/utils_for_test.py COPYONLY)
|
||||||
|
141
tests/scripts/test_frame_synchronizer.py
Normal file
141
tests/scripts/test_frame_synchronizer.py
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
# 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, frame synchronizer, pull sockets, acquire, test and kill them finally.
|
||||||
|
'''
|
||||||
|
|
||||||
|
import sys, time
|
||||||
|
import traceback, json
|
||||||
|
|
||||||
|
from slsdet import Detector
|
||||||
|
from slsdet.defines import DEFAULT_TCP_RX_PORTNO
|
||||||
|
|
||||||
|
from utils_for_test import (
|
||||||
|
Log,
|
||||||
|
LogLevel,
|
||||||
|
RuntimeException,
|
||||||
|
checkIfProcessRunning,
|
||||||
|
killProcess,
|
||||||
|
cleanup,
|
||||||
|
cleanSharedmemory,
|
||||||
|
startProcessInBackground,
|
||||||
|
startProcessInBackgroundWithLogFile,
|
||||||
|
checkLogForErrors,
|
||||||
|
startDetectorVirtualServer,
|
||||||
|
loadConfig,
|
||||||
|
ParseArguments
|
||||||
|
)
|
||||||
|
|
||||||
|
LOG_PREFIX_FNAME = '/tmp/slsFrameSynchronizer_test'
|
||||||
|
MAIN_LOG_FNAME = LOG_PREFIX_FNAME + '_log.txt'
|
||||||
|
PULL_SOCKET_PREFIX_FNAME = LOG_PREFIX_FNAME + '_pull_socket_'
|
||||||
|
|
||||||
|
|
||||||
|
def startFrameSynchronizerPullSocket(name, fp):
|
||||||
|
fname = PULL_SOCKET_PREFIX_FNAME + name + '.txt'
|
||||||
|
cmd = ['python', '-u', 'frameSynchronizerPullSocket.py']
|
||||||
|
startProcessInBackgroundWithLogFile(cmd, fp, fname)
|
||||||
|
time.sleep(1)
|
||||||
|
checkLogForErrors(fp, fname)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def startFrameSynchronizer(num_mods, fp):
|
||||||
|
cmd = ['slsFrameSynchronizer', str(DEFAULT_TCP_RX_PORTNO), str(num_mods)]
|
||||||
|
# in 10.0.0
|
||||||
|
#cmd = ['slsFrameSynchronizer', '-p', str(DEFAULT_TCP_RX_PORTNO), '-n', str(num_mods)]
|
||||||
|
startProcessInBackground(cmd, fp)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
|
def acquire(fp, det):
|
||||||
|
Log(LogLevel.INFO, 'Acquiring')
|
||||||
|
Log(LogLevel.INFO, 'Acquiring', fp)
|
||||||
|
det.acquire()
|
||||||
|
|
||||||
|
|
||||||
|
def testFramesCaught(name, det, num_frames):
|
||||||
|
fnum = det.rx_framescaught[0]
|
||||||
|
if fnum != num_frames:
|
||||||
|
raise RuntimeException(f"{name} caught only {fnum}. Expected {num_frames}")
|
||||||
|
|
||||||
|
Log(LogLevel.INFOGREEN, f'Frames caught test passed for {name}')
|
||||||
|
Log(LogLevel.INFOGREEN, f'Frames caught test passed for {name}', fp)
|
||||||
|
|
||||||
|
|
||||||
|
def testZmqHeadetTypeCount(name, det, num_mods, num_frames, fp):
|
||||||
|
|
||||||
|
Log(LogLevel.INFO, f"Testing Zmq Header type count for {name}")
|
||||||
|
Log(LogLevel.INFO, f"Testing Zmq Header type count for {name}", fp)
|
||||||
|
htype_counts = {
|
||||||
|
"header": 0,
|
||||||
|
"series_end": 0,
|
||||||
|
"module": 0
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
# get a count of each htype from file
|
||||||
|
pull_socket_fname = PULL_SOCKET_PREFIX_FNAME + name + '.txt'
|
||||||
|
with open(pull_socket_fname, 'r') as log_fp:
|
||||||
|
for line in log_fp:
|
||||||
|
line = line.strip()
|
||||||
|
if not line or not line.startswith('{'):
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
data = json.loads(line)
|
||||||
|
htype = data.get("htype")
|
||||||
|
if htype in htype_counts:
|
||||||
|
htype_counts[htype] += 1
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# test if file contents matches expected counts
|
||||||
|
num_ports_per_module = 1 if name == "gotthard2" else det.numinterfaces
|
||||||
|
total_num_frame_parts = num_ports_per_module * num_mods * num_frames
|
||||||
|
for htype, expected_count in [("header", num_mods), ("series_end", num_mods), ("module", total_num_frame_parts)]:
|
||||||
|
if htype_counts[htype] != expected_count:
|
||||||
|
msg = f"Expected {expected_count} '{htype}' entries, found {htype_counts[htype]}"
|
||||||
|
raise RuntimeException(msg)
|
||||||
|
except Exception as e:
|
||||||
|
raise RuntimeException(f'Failed to get zmq header count type. Error:{str(e)}') from e
|
||||||
|
|
||||||
|
Log(LogLevel.INFOGREEN, f"Zmq Header type count test passed for {name}")
|
||||||
|
Log(LogLevel.INFOGREEN, f"Zmq Header type count test passed for {name}", fp)
|
||||||
|
|
||||||
|
|
||||||
|
def startTestsForAll(args, fp):
|
||||||
|
for server in args.servers:
|
||||||
|
try:
|
||||||
|
Log(LogLevel.INFOBLUE, f'Synchronizer Tests for {server}')
|
||||||
|
Log(LogLevel.INFOBLUE, f'Synchronizer Tests for {server}', fp)
|
||||||
|
cleanup(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)
|
||||||
|
acquire(fp, d)
|
||||||
|
testFramesCaught(server, d, args.num_frames)
|
||||||
|
testZmqHeadetTypeCount(server, d, args.num_mods, args.num_frames, fp)
|
||||||
|
Log(LogLevel.INFO, '\n')
|
||||||
|
except Exception as e:
|
||||||
|
raise RuntimeException(f'Synchronizer Tests failed') from e
|
||||||
|
|
||||||
|
Log(LogLevel.INFOGREEN, 'Passed all synchronizer tests for all detectors \n' + str(args.servers))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
args = ParseArguments(description='Automated tests to test frame synchronizer', default_num_mods=2)
|
||||||
|
|
||||||
|
Log(LogLevel.INFOBLUE, '\nLog File: ' + MAIN_LOG_FNAME + '\n')
|
||||||
|
|
||||||
|
with open(MAIN_LOG_FNAME, 'w') as fp:
|
||||||
|
try:
|
||||||
|
startTestsForAll(args, fp)
|
||||||
|
cleanup(fp)
|
||||||
|
except Exception as e:
|
||||||
|
with open(MAIN_LOG_FNAME, 'a') as fp_error:
|
||||||
|
traceback.print_exc(file=fp_error)
|
||||||
|
cleanup(fp)
|
||||||
|
Log(LogLevel.ERROR, f'Tests Failed.')
|
||||||
|
|
||||||
|
|
@ -4,244 +4,86 @@
|
|||||||
This file is used to start up simulators, receivers and run all the tests on them and finally kill the simulators and receivers.
|
This file is used to start up simulators, receivers and run all the tests on them and finally kill the simulators and receivers.
|
||||||
'''
|
'''
|
||||||
import argparse
|
import argparse
|
||||||
import os, sys, subprocess, time, colorama
|
import sys, subprocess, time, traceback
|
||||||
|
|
||||||
from colorama import Fore, Style
|
from slsdet import Detector
|
||||||
from slsdet import Detector, detectorType, detectorSettings
|
from slsdet.defines import DEFAULT_TCP_RX_PORTNO
|
||||||
from slsdet.defines import DEFAULT_TCP_CNTRL_PORTNO, DEFAULT_TCP_RX_PORTNO, DEFAULT_UDP_DST_PORTNO
|
|
||||||
HALFMOD2_TCP_CNTRL_PORTNO=1955
|
|
||||||
HALFMOD2_TCP_RX_PORTNO=1957
|
|
||||||
|
|
||||||
colorama.init(autoreset=True)
|
from utils_for_test import (
|
||||||
|
Log,
|
||||||
def Log(color, message):
|
LogLevel,
|
||||||
print(f"{color}{message}{Style.RESET_ALL}", flush=True)
|
RuntimeException,
|
||||||
|
checkIfProcessRunning,
|
||||||
class RuntimeException (Exception):
|
killProcess,
|
||||||
def __init__ (self, message):
|
cleanup,
|
||||||
super().__init__(Log(Fore.RED, message))
|
cleanSharedmemory,
|
||||||
|
startProcessInBackground,
|
||||||
def checkIfProcessRunning(processName):
|
runProcessWithLogFile,
|
||||||
cmd = f"pgrep -f {processName}"
|
startDetectorVirtualServer,
|
||||||
res = subprocess.getoutput(cmd)
|
loadConfig,
|
||||||
return res.strip().splitlines()
|
ParseArguments
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def killProcess(name):
|
LOG_PREFIX_FNAME = '/tmp/slsDetectorPackage_virtual_test'
|
||||||
pids = checkIfProcessRunning(name)
|
MAIN_LOG_FNAME = LOG_PREFIX_FNAME + '_log.txt'
|
||||||
if pids:
|
GENERAL_TESTS_LOG_FNAME = LOG_PREFIX_FNAME + '_results_general.txt'
|
||||||
Log(Fore.GREEN, f"Killing '{name}' processes with PIDs: {', '.join(pids)}")
|
CMD_TEST_LOG_PREFIX_FNAME = LOG_PREFIX_FNAME + '_results_cmd_'
|
||||||
for pid in pids:
|
|
||||||
try:
|
|
||||||
p = subprocess.run(['kill', pid])
|
|
||||||
if p.returncode != 0 and bool(checkIfProcessRunning(name)):
|
|
||||||
raise RuntimeException(f"Could not kill {name} with pid {pid}")
|
|
||||||
except Exception as e:
|
|
||||||
Log(Fore.RED, f"Failed to kill process {name} pid:{pid}. Exception occured: [code:{e}, msg:{e.stderr}]")
|
|
||||||
raise
|
|
||||||
#else:
|
|
||||||
# Log(Fore.WHITE, 'process not running : ' + name)
|
|
||||||
|
|
||||||
|
|
||||||
def cleanup(fp):
|
def startReceiver(num_mods, fp):
|
||||||
'''
|
if num_mods == 1:
|
||||||
kill both servers, receivers and clean shared memory
|
cmd = ['slsReceiver']
|
||||||
'''
|
else:
|
||||||
Log(Fore.GREEN, 'Cleaning up...')
|
cmd = ['slsMultiReceiver', str(DEFAULT_TCP_RX_PORTNO), str(num_mods)]
|
||||||
killProcess('DetectorServer_virtual')
|
# in 10.0.0
|
||||||
killProcess('slsReceiver')
|
#cmd = ['slsMultiReceiver', '-p', str(DEFAULT_TCP_RX_PORTNO), '-n', str(num_mods)]
|
||||||
killProcess('slsMultiReceiver')
|
startProcessInBackground(cmd, fp)
|
||||||
cleanSharedmemory(fp)
|
time.sleep(1)
|
||||||
|
|
||||||
def cleanSharedmemory(fp):
|
def startGeneralTests(fp):
|
||||||
Log(Fore.GREEN, 'Cleaning up shared memory...')
|
fname = GENERAL_TESTS_LOG_FNAME
|
||||||
|
cmd = ['tests', '--abort', '-s']
|
||||||
try:
|
try:
|
||||||
p = subprocess.run(['sls_detector_get', 'free'], stdout=fp, stderr=fp)
|
|
||||||
except:
|
|
||||||
Log(Fore.RED, 'Could not free shared memory')
|
|
||||||
raise
|
|
||||||
|
|
||||||
def startProcessInBackground(name):
|
|
||||||
try:
|
|
||||||
# in background and dont print output
|
|
||||||
p = subprocess.Popen(name.split(), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, restore_signals=False)
|
|
||||||
Log(Fore.GREEN, 'Starting up ' + name + ' ...')
|
|
||||||
except Exception as e:
|
|
||||||
Log(Fore.RED, f'Could not start {name}:{e}')
|
|
||||||
raise
|
|
||||||
|
|
||||||
def startServer(name):
|
|
||||||
|
|
||||||
startProcessInBackground(name + 'DetectorServer_virtual')
|
|
||||||
# second half
|
|
||||||
if name == 'eiger':
|
|
||||||
startProcessInBackground(name + 'DetectorServer_virtual -p' + str(HALFMOD2_TCP_CNTRL_PORTNO))
|
|
||||||
tStartup = 6
|
|
||||||
Log(Fore.WHITE, 'Takes ' + str(tStartup) + ' seconds... Please be patient')
|
|
||||||
time.sleep(tStartup)
|
|
||||||
|
|
||||||
def startReceiver(name):
|
|
||||||
startProcessInBackground('slsReceiver')
|
|
||||||
# second half
|
|
||||||
if name == 'eiger':
|
|
||||||
startProcessInBackground('slsReceiver -t' + str(HALFMOD2_TCP_RX_PORTNO))
|
|
||||||
time.sleep(2)
|
|
||||||
|
|
||||||
def loadConfig(name, rx_hostname, settingsdir):
|
|
||||||
Log(Fore.GREEN, 'Loading config')
|
|
||||||
try:
|
|
||||||
d = Detector()
|
|
||||||
if name == 'eiger':
|
|
||||||
d.hostname = 'localhost:' + str(DEFAULT_TCP_CNTRL_PORTNO) + '+localhost:' + str(HALFMOD2_TCP_CNTRL_PORTNO)
|
|
||||||
#d.udp_dstport = {2: 50003}
|
|
||||||
# will set up for every module
|
|
||||||
d.udp_dstport = DEFAULT_UDP_DST_PORTNO
|
|
||||||
d.udp_dstport2 = DEFAULT_UDP_DST_PORTNO + 1
|
|
||||||
d.rx_hostname = rx_hostname + ':' + str(DEFAULT_TCP_RX_PORTNO) + '+' + rx_hostname + ':' + str(HALFMOD2_TCP_RX_PORTNO)
|
|
||||||
d.udp_dstip = 'auto'
|
|
||||||
d.trimen = [4500, 5400, 6400]
|
|
||||||
d.settingspath = settingsdir + '/eiger/'
|
|
||||||
d.setThresholdEnergy(4500, detectorSettings.STANDARD)
|
|
||||||
else:
|
|
||||||
d.hostname = 'localhost'
|
|
||||||
d.rx_hostname = rx_hostname
|
|
||||||
d.udp_dstip = 'auto'
|
|
||||||
d.udp_srcip = 'auto'
|
|
||||||
if d.type == detectorType.JUNGFRAU or d.type == detectorType.MOENCH or d.type == detectorType.XILINX_CHIPTESTBOARD:
|
|
||||||
d.powerchip = 1
|
|
||||||
if d.type == detectorType.XILINX_CHIPTESTBOARD:
|
|
||||||
d.configureTransceiver()
|
|
||||||
except:
|
|
||||||
Log(Fore.RED, 'Could not load config for ' + name)
|
|
||||||
raise
|
|
||||||
|
|
||||||
def startCmdTests(name, fp, fname):
|
|
||||||
Log(Fore.GREEN, 'Cmd Tests for ' + name)
|
|
||||||
cmd = 'tests --abort [.cmdcall] -s -o ' + fname
|
|
||||||
try:
|
|
||||||
subprocess.run(cmd.split(), stdout=fp, stderr=fp, check=True, text=True)
|
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
pass
|
|
||||||
|
|
||||||
with open (fname, 'r') as f:
|
|
||||||
for line in f:
|
|
||||||
if "FAILED" in line:
|
|
||||||
msg = 'Cmd tests failed for ' + name + '!!!'
|
|
||||||
sys.stdout = original_stdout
|
|
||||||
Log(Fore.RED, msg)
|
|
||||||
Log(Fore.RED, line)
|
|
||||||
sys.stdout = fp
|
|
||||||
raise Exception(msg)
|
|
||||||
|
|
||||||
Log(Fore.GREEN, 'Cmd Tests successful for ' + name)
|
|
||||||
|
|
||||||
def startGeneralTests(fp, fname):
|
|
||||||
Log(Fore.GREEN, 'General Tests')
|
|
||||||
cmd = 'tests --abort -s -o ' + fname
|
|
||||||
try:
|
|
||||||
subprocess.run(cmd.split(), stdout=fp, stderr=fp, check=True, text=True)
|
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
pass
|
|
||||||
|
|
||||||
with open (fname, 'r') as f:
|
|
||||||
for line in f:
|
|
||||||
if "FAILED" in line:
|
|
||||||
msg = 'General tests failed !!!'
|
|
||||||
sys.stdout = original_stdout
|
|
||||||
Log(Fore.RED, msg + '\n' + line)
|
|
||||||
sys.stdout = fp
|
|
||||||
raise Exception(msg)
|
|
||||||
|
|
||||||
Log(Fore.GREEN, 'General Tests successful')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# parse cmd line for rx_hostname and settingspath using the argparse library
|
|
||||||
parser = argparse.ArgumentParser(description = 'automated tests with the virtual detector servers')
|
|
||||||
parser.add_argument('rx_hostname', nargs='?', default='localhost', help = 'hostname/ip of the current machine')
|
|
||||||
parser.add_argument('settingspath', nargs='?', default='../../settingsdir', help = 'Relative or absolut path to the settingspath')
|
|
||||||
parser.add_argument('-s', '--servers', help='Detector servers to run', nargs='*')
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
if args.servers is None:
|
|
||||||
servers = [
|
|
||||||
'eiger',
|
|
||||||
'jungfrau',
|
|
||||||
'mythen3',
|
|
||||||
'gotthard2',
|
|
||||||
'ctb',
|
|
||||||
'moench',
|
|
||||||
'xilinx_ctb'
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
servers = args.servers
|
|
||||||
|
|
||||||
|
|
||||||
Log(Fore.WHITE, 'Arguments:\nrx_hostname: ' + args.rx_hostname + '\nsettingspath: \'' + args.settingspath + '\nservers: \'' + ' '.join(servers) + '\'')
|
|
||||||
|
|
||||||
|
|
||||||
# redirect to file
|
|
||||||
prefix_fname = '/tmp/slsDetectorPackage_virtual_test'
|
|
||||||
original_stdout = sys.stdout
|
|
||||||
original_stderr = sys.stderr
|
|
||||||
fname = prefix_fname + '_log.txt'
|
|
||||||
Log(Fore.BLUE, '\nLog File: ' + fname)
|
|
||||||
|
|
||||||
with open(fname, 'w') as fp:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# general tests
|
|
||||||
file_results = prefix_fname + '_results_general.txt'
|
|
||||||
Log(Fore.BLUE, 'General tests (results: ' + file_results + ')')
|
|
||||||
sys.stdout = fp
|
|
||||||
sys.stderr = fp
|
|
||||||
Log(Fore.BLUE, 'General tests (results: ' + file_results + ')')
|
|
||||||
|
|
||||||
try:
|
|
||||||
startGeneralTests(fp, file_results)
|
|
||||||
cleanup(fp)
|
cleanup(fp)
|
||||||
|
runProcessWithLogFile('General Tests', cmd, fp, fname)
|
||||||
testError = False
|
|
||||||
for server in servers:
|
|
||||||
try:
|
|
||||||
# print to terminal for progress
|
|
||||||
sys.stdout = original_stdout
|
|
||||||
sys.stderr = original_stderr
|
|
||||||
file_results = prefix_fname + '_results_cmd_' + server + '.txt'
|
|
||||||
Log(Fore.BLUE, 'Cmd tests for ' + server + ' (results: ' + file_results + ')')
|
|
||||||
sys.stdout = fp
|
|
||||||
sys.stderr = fp
|
|
||||||
Log(Fore.BLUE, 'Cmd tests for ' + server + ' (results: ' + file_results + ')')
|
|
||||||
|
|
||||||
# cmd tests for det
|
|
||||||
cleanup(fp)
|
|
||||||
startServer(server)
|
|
||||||
startReceiver(server)
|
|
||||||
loadConfig(server, args.rx_hostname, args.settingspath)
|
|
||||||
startCmdTests(server, fp, file_results)
|
|
||||||
cleanup(fp)
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
# redirect to terminal
|
|
||||||
sys.stdout = original_stdout
|
|
||||||
sys.stderr = original_stderr
|
|
||||||
Log(Fore.RED, f'Exception caught while testing {server}. Cleaning up...')
|
|
||||||
testError = True
|
|
||||||
break
|
|
||||||
|
|
||||||
# redirect to terminal
|
|
||||||
sys.stdout = original_stdout
|
|
||||||
sys.stderr = original_stderr
|
|
||||||
if not testError:
|
|
||||||
Log(Fore.GREEN, 'Passed all tests for virtual detectors \n' + str(servers))
|
|
||||||
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# redirect to terminal
|
raise RuntimeException(f'General tests failed.') from e
|
||||||
sys.stdout = original_stdout
|
|
||||||
sys.stderr = original_stderr
|
|
||||||
Log(Fore.RED, f'Exception caught with general testing. Cleaning up...')
|
|
||||||
cleanSharedmemory(sys.stdout)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def startCmdTestsForAll(args, fp):
|
||||||
|
for server in args.servers:
|
||||||
|
try:
|
||||||
|
num_mods = 2 if server == 'eiger' else 1
|
||||||
|
fname = CMD_TEST_LOG_PREFIX_FNAME + server + '.txt'
|
||||||
|
cmd = ['tests', '--abort', '[.cmdcall]', '-s']
|
||||||
|
|
||||||
|
Log(LogLevel.INFOBLUE, f'Starting Cmd Tests for {server}')
|
||||||
|
cleanup(fp)
|
||||||
|
startDetectorVirtualServer(name=server, num_mods=num_mods, fp=fp)
|
||||||
|
startReceiver(num_mods, fp)
|
||||||
|
loadConfig(name=server, rx_hostname=args.rx_hostname, settingsdir=args.settingspath, fp=fp, num_mods=num_mods)
|
||||||
|
runProcessWithLogFile('Cmd Tests for ' + server, cmd, fp, fname)
|
||||||
|
except Exception as e:
|
||||||
|
raise RuntimeException(f'Cmd Tests failed for {server}.') from e
|
||||||
|
|
||||||
|
Log(LogLevel.INFOGREEN, 'Passed all tests for all detectors \n' + str(args.servers))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
args = ParseArguments('Automated tests with the virtual detector servers')
|
||||||
|
if args.num_mods > 1:
|
||||||
|
raise RuntimeException(f'Cannot support multiple modules at the moment (except Eiger).')
|
||||||
|
|
||||||
|
Log(LogLevel.INFOBLUE, '\nLog File: ' + MAIN_LOG_FNAME + '\n')
|
||||||
|
|
||||||
|
with open(MAIN_LOG_FNAME, 'w') as fp:
|
||||||
|
try:
|
||||||
|
startGeneralTests(fp)
|
||||||
|
startCmdTestsForAll(args, fp)
|
||||||
|
cleanup(fp)
|
||||||
|
except Exception as e:
|
||||||
|
with open(MAIN_LOG_FNAME, 'a') as fp_error:
|
||||||
|
traceback.print_exc(file=fp_error)
|
||||||
|
cleanup(fp)
|
||||||
|
Log(LogLevel.ERROR, f'Tests Failed.')
|
||||||
|
259
tests/scripts/utils_for_test.py
Normal file
259
tests/scripts/utils_for_test.py
Normal file
@ -0,0 +1,259 @@
|
|||||||
|
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
|
'''
|
||||||
|
This file is used for common utils used for integration tests between simulators and receivers.
|
||||||
|
'''
|
||||||
|
|
||||||
|
import sys, subprocess, time, argparse
|
||||||
|
from enum import Enum
|
||||||
|
from colorama import Fore, Style, init
|
||||||
|
|
||||||
|
from slsdet import Detector, detectorSettings
|
||||||
|
from slsdet.defines import DEFAULT_TCP_RX_PORTNO, DEFAULT_UDP_DST_PORTNO
|
||||||
|
SERVER_START_PORTNO=1900
|
||||||
|
|
||||||
|
init(autoreset=True)
|
||||||
|
|
||||||
|
|
||||||
|
class LogLevel(Enum):
|
||||||
|
INFO = 0
|
||||||
|
INFORED = 1
|
||||||
|
INFOGREEN = 2
|
||||||
|
INFOBLUE = 3
|
||||||
|
WARNING = 4
|
||||||
|
ERROR = 5
|
||||||
|
DEBUG = 6
|
||||||
|
|
||||||
|
|
||||||
|
LOG_LABELS = {
|
||||||
|
LogLevel.WARNING: "WARNING: ",
|
||||||
|
LogLevel.ERROR: "ERROR: ",
|
||||||
|
LogLevel.DEBUG: "DEBUG: "
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LOG_COLORS = {
|
||||||
|
LogLevel.INFO: Fore.WHITE,
|
||||||
|
LogLevel.INFORED: Fore.RED,
|
||||||
|
LogLevel.INFOGREEN: Fore.GREEN,
|
||||||
|
LogLevel.INFOBLUE: Fore.BLUE,
|
||||||
|
LogLevel.WARNING: Fore.YELLOW,
|
||||||
|
LogLevel.ERROR: Fore.RED,
|
||||||
|
LogLevel.DEBUG: Fore.CYAN
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def Log(level: LogLevel, message: str, stream=sys.stdout):
|
||||||
|
color = LOG_COLORS.get(level, Fore.WHITE)
|
||||||
|
label = LOG_LABELS.get(level, "")
|
||||||
|
print(f"{color}{label}{message}{Style.RESET_ALL}", file=stream, flush=True)
|
||||||
|
|
||||||
|
|
||||||
|
class RuntimeException (Exception):
|
||||||
|
def __init__ (self, message):
|
||||||
|
Log(LogLevel.ERROR, message)
|
||||||
|
super().__init__(message)
|
||||||
|
|
||||||
|
|
||||||
|
def checkIfProcessRunning(processName):
|
||||||
|
cmd = f"pgrep -f {processName}"
|
||||||
|
res = subprocess.getoutput(cmd)
|
||||||
|
return res.strip().splitlines()
|
||||||
|
|
||||||
|
|
||||||
|
def killProcess(name, fp):
|
||||||
|
pids = checkIfProcessRunning(name)
|
||||||
|
if pids:
|
||||||
|
Log(LogLevel.INFO, f"Killing '{name}' processes with PIDs: {', '.join(pids)}", fp)
|
||||||
|
for pid in pids:
|
||||||
|
try:
|
||||||
|
p = subprocess.run(['kill', pid])
|
||||||
|
if p.returncode != 0 and bool(checkIfProcessRunning(name)):
|
||||||
|
raise RuntimeException(f"Could not kill {name} with pid {pid}")
|
||||||
|
except Exception as e:
|
||||||
|
raise RuntimeException(f"Failed to kill process {name} pid:{pid}. Error: {str(e)}") from e
|
||||||
|
#else:
|
||||||
|
# Log(LogLevel.INFO, 'process not running : ' + name)
|
||||||
|
|
||||||
|
|
||||||
|
def cleanSharedmemory(fp):
|
||||||
|
Log(LogLevel.INFO, 'Cleaning up shared memory', fp)
|
||||||
|
try:
|
||||||
|
p = subprocess.run(['sls_detector_get', 'free'], stdout=fp, stderr=fp)
|
||||||
|
except:
|
||||||
|
raise RuntimeException('Could not free shared memory')
|
||||||
|
|
||||||
|
|
||||||
|
def cleanup(fp):
|
||||||
|
Log(LogLevel.INFO, 'Cleaning up')
|
||||||
|
Log(LogLevel.INFO, 'Cleaning up', fp)
|
||||||
|
killProcess('DetectorServer_virtual', fp)
|
||||||
|
killProcess('slsReceiver', fp)
|
||||||
|
killProcess('slsMultiReceiver', fp)
|
||||||
|
killProcess('slsFrameSynchronizer', fp)
|
||||||
|
killProcess('frameSynchronizerPullSocket', fp)
|
||||||
|
cleanSharedmemory(fp)
|
||||||
|
|
||||||
|
|
||||||
|
def startProcessInBackground(cmd, fp):
|
||||||
|
Log(LogLevel.INFO, 'Starting up ' + ' '.join(cmd))
|
||||||
|
Log(LogLevel.INFO, 'Starting up ' + ' '.join(cmd), fp)
|
||||||
|
try:
|
||||||
|
p = subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, restore_signals=False)
|
||||||
|
except Exception as e:
|
||||||
|
raise RuntimeException(f'Failed to start {cmd}:{str(e)}') from e
|
||||||
|
|
||||||
|
|
||||||
|
def startProcessInBackgroundWithLogFile(cmd, fp, log_file_name: str):
|
||||||
|
Log(LogLevel.INFOBLUE, 'Starting up ' + ' '.join(cmd) + '. Log: ' + log_file_name)
|
||||||
|
Log(LogLevel.INFOBLUE, 'Starting up ' + ' '.join(cmd) + '. Log: ' + log_file_name, fp)
|
||||||
|
try:
|
||||||
|
with open(log_file_name, 'w') as log_fp:
|
||||||
|
subprocess.Popen(cmd, stdout=log_fp, stderr=log_fp, text=True)
|
||||||
|
except Exception as e:
|
||||||
|
raise RuntimeException(f'Failed to start {cmd}:{str(e)}') from e
|
||||||
|
|
||||||
|
|
||||||
|
def checkLogForErrors(fp, log_file_path: str):
|
||||||
|
try:
|
||||||
|
with open(log_file_path, 'r') as log_file:
|
||||||
|
for line in log_file:
|
||||||
|
if 'Error' in line:
|
||||||
|
Log(LogLevel.ERROR, f"Error found in log: {line.strip()}")
|
||||||
|
Log(LogLevel.ERROR, f"Error found in log: {line.strip()}", fp)
|
||||||
|
raise RuntimeException("Error found in log file")
|
||||||
|
except FileNotFoundError:
|
||||||
|
print(f"Log file not found: {log_file_path}")
|
||||||
|
raise
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Exception while reading log: {e}")
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
def runProcessWithLogFile(name, cmd, fp, log_file_name):
|
||||||
|
Log(LogLevel.INFOBLUE, 'Running ' + name + '. Log: ' + log_file_name)
|
||||||
|
Log(LogLevel.INFOBLUE, 'Running ' + name + '. Log: ' + log_file_name, fp)
|
||||||
|
Log(LogLevel.INFOBLUE, 'Cmd: ' + ' '.join(cmd), fp)
|
||||||
|
try:
|
||||||
|
with open(log_file_name, 'w') as log_fp:
|
||||||
|
subprocess.run(cmd, stdout=log_fp, stderr=log_fp, check=True, text=True)
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
pass
|
||||||
|
except Exception as e:
|
||||||
|
Log(LogLevel.ERROR, f'Failed to run {name}:{str(e)}', fp)
|
||||||
|
raise RuntimeException(f'Failed to run {name}:{str(e)}')
|
||||||
|
|
||||||
|
with open (log_file_name, 'r') as f:
|
||||||
|
for line in f:
|
||||||
|
if "FAILED" in line:
|
||||||
|
raise RuntimeException(f'{line}')
|
||||||
|
|
||||||
|
Log(LogLevel.INFOGREEN, name + ' successful!\n')
|
||||||
|
Log(LogLevel.INFOGREEN, name + ' successful!\n', fp)
|
||||||
|
|
||||||
|
|
||||||
|
def startDetectorVirtualServer(name :str, num_mods, fp):
|
||||||
|
for i in range(num_mods):
|
||||||
|
port_no = SERVER_START_PORTNO + (i * 2)
|
||||||
|
cmd = [name + 'DetectorServer_virtual', '-p', str(port_no)]
|
||||||
|
startProcessInBackgroundWithLogFile(cmd, fp, "/tmp/virtual_det_" + name + str(i) + ".txt")
|
||||||
|
match name:
|
||||||
|
case 'jungfrau':
|
||||||
|
time.sleep(7)
|
||||||
|
case 'gotthard2':
|
||||||
|
time.sleep(5)
|
||||||
|
case _:
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
|
|
||||||
|
def connectToVirtualServers(name, num_mods):
|
||||||
|
try:
|
||||||
|
d = Detector()
|
||||||
|
except Exception as e:
|
||||||
|
raise RuntimeException(f'Could not create Detector object for {name}. Error: {str(e)}') from e
|
||||||
|
|
||||||
|
counts_sec = 5
|
||||||
|
while (counts_sec != 0):
|
||||||
|
try:
|
||||||
|
d.virtual = [num_mods, SERVER_START_PORTNO]
|
||||||
|
break
|
||||||
|
except Exception as e:
|
||||||
|
# stop server still not up, wait a bit longer
|
||||||
|
if "Cannot connect to" in str(e):
|
||||||
|
Log(LogLevel.WARNING, f'Still waiting for {name} virtual server to be up...{counts_sec}s left')
|
||||||
|
time.sleep(1)
|
||||||
|
counts_sec -= 1
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
|
||||||
|
return d
|
||||||
|
|
||||||
|
|
||||||
|
def loadConfig(name, rx_hostname, settingsdir, fp, num_mods = 1, num_frames = 1):
|
||||||
|
Log(LogLevel.INFO, 'Loading config')
|
||||||
|
Log(LogLevel.INFO, 'Loading config', fp)
|
||||||
|
try:
|
||||||
|
d = connectToVirtualServers(name, num_mods)
|
||||||
|
d.udp_dstport = DEFAULT_UDP_DST_PORTNO
|
||||||
|
if name == 'eiger':
|
||||||
|
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" 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)
|
||||||
|
|
||||||
|
d.frames = num_frames
|
||||||
|
except Exception as e:
|
||||||
|
raise RuntimeException(f'Could not load config for {name}. Error: {str(e)}') from e
|
||||||
|
|
||||||
|
return d
|
||||||
|
|
||||||
|
|
||||||
|
def ParseArguments(description, default_num_mods=1):
|
||||||
|
parser = argparse.ArgumentParser(description)
|
||||||
|
|
||||||
|
parser.add_argument('rx_hostname', nargs='?', default='localhost',
|
||||||
|
help='Hostname/IP of the current machine')
|
||||||
|
parser.add_argument('settingspath', nargs='?', default='../../settingsdir',
|
||||||
|
help='Relative or absolute path to the settings directory')
|
||||||
|
parser.add_argument('-n', '--num-mods', nargs='?', default=default_num_mods, type=int,
|
||||||
|
help='Number of modules to test with')
|
||||||
|
parser.add_argument('-f', '--num-frames', nargs='?', default=1, type=int,
|
||||||
|
help='Number of frames to test with')
|
||||||
|
parser.add_argument('-s', '--servers', nargs='*',
|
||||||
|
help='Detector servers to run')
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
# Set default server list if not provided
|
||||||
|
if args.servers is None:
|
||||||
|
args.servers = [
|
||||||
|
'eiger',
|
||||||
|
'jungfrau',
|
||||||
|
'mythen3',
|
||||||
|
'gotthard2',
|
||||||
|
'ctb',
|
||||||
|
'moench',
|
||||||
|
'xilinx_ctb'
|
||||||
|
]
|
||||||
|
|
||||||
|
Log(LogLevel.INFO, 'Arguments:\n' +
|
||||||
|
'rx_hostname: ' + args.rx_hostname +
|
||||||
|
'\nsettingspath: \'' + args.settingspath +
|
||||||
|
'\nservers: \'' + ' '.join(args.servers) +
|
||||||
|
'\nnum_mods: \'' + str(args.num_mods) +
|
||||||
|
'\nnum_frames: \'' + str(args.num_frames) + '\'')
|
||||||
|
|
||||||
|
return args
|
81
updateAPIVersion.py
Normal file
81
updateAPIVersion.py
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
|
# Copyright (C) 2025 Contributors to the SLS Detector Package
|
||||||
|
"""
|
||||||
|
Script to update API VERSION file based on the version in VERSION file.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import time
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
|
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
API_FILE = SCRIPT_DIR + "/slsSupportLib/include/sls/versionAPI.h"
|
||||||
|
|
||||||
|
VERSION_FILE = SCRIPT_DIR + "/VERSION"
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description = 'updates API version')
|
||||||
|
parser.add_argument('api_module_name', choices=["APILIB", "APIRECEIVER", "APICTB", "APIGOTTHARD2", "APIMOENCH", "APIEIGER", "APIXILINXCTB", "APIJUNGFRAU", "APIMYTHEN3"], help = 'module name to change api version options are: ["APILIB", "APIRECEIVER", "APICTB", "APIGOTTHARD2", "APIMOENCH", "APIEIGER", "APIXILINXCTB", "APIJUNGFRAU", "APIMYTHEN3"]')
|
||||||
|
parser.add_argument('api_dir', help = 'Relative or absolute path to the module code')
|
||||||
|
|
||||||
|
def update_api_file(new_api : str, api_module_name : str, api_file_name : str):
|
||||||
|
|
||||||
|
regex_pattern = re.compile(rf'#define\s+{api_module_name}\s+')
|
||||||
|
with open(api_file_name, "r") as api_file:
|
||||||
|
lines = api_file.readlines()
|
||||||
|
|
||||||
|
with open(api_file_name, "w") as api_file:
|
||||||
|
for line in lines:
|
||||||
|
if regex_pattern.match(line):
|
||||||
|
api_file.write(f'#define {api_module_name} "{new_api}"\n')
|
||||||
|
else:
|
||||||
|
api_file.write(line)
|
||||||
|
|
||||||
|
def get_latest_modification_date(directory : str):
|
||||||
|
latest_time = 0
|
||||||
|
latest_date = None
|
||||||
|
|
||||||
|
for root, dirs, files in os.walk(directory):
|
||||||
|
for file in files:
|
||||||
|
if file.endswith(".o"):
|
||||||
|
continue
|
||||||
|
full_path = os.path.join(root, file)
|
||||||
|
try:
|
||||||
|
mtime = os.path.getmtime(full_path)
|
||||||
|
if mtime > latest_time:
|
||||||
|
latest_time = mtime
|
||||||
|
except FileNotFoundError:
|
||||||
|
continue
|
||||||
|
|
||||||
|
latest_date = datetime.fromtimestamp(latest_time).strftime("%y%m%d")
|
||||||
|
|
||||||
|
return latest_date
|
||||||
|
|
||||||
|
|
||||||
|
def update_api_version(api_module_name : str, api_dir : str):
|
||||||
|
api_date = get_latest_modification_date(api_dir)
|
||||||
|
api_date = "0x"+str(api_date)
|
||||||
|
|
||||||
|
with open(VERSION_FILE, "r") as version_file:
|
||||||
|
api_version = version_file.read().strip()
|
||||||
|
|
||||||
|
api_version = api_version + " " + api_date #not sure if we should give an argument option version_branch
|
||||||
|
|
||||||
|
update_api_file(api_version, api_module_name, API_FILE)
|
||||||
|
|
||||||
|
print(f"updated {api_module_name} api version to: {api_version}")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
api_dir = SCRIPT_DIR + "/" + args.api_dir
|
||||||
|
|
||||||
|
|
||||||
|
update_api_version(args.api_module_name, api_dir)
|
||||||
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
|||||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
|
||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
||||||
usage="\nUsage: updateAPIVersion.sh [API_NAME] [API_DIR] [API_BRANCH(opt)]."
|
|
||||||
|
|
||||||
if [ $# -lt 2 ]; then
|
|
||||||
echo -e "Requires atleast 2 arguments. $usage"
|
|
||||||
return [-1]
|
|
||||||
fi
|
|
||||||
|
|
||||||
API_NAME=$1
|
|
||||||
PACKAGE_DIR=$PWD
|
|
||||||
API_DIR=$PACKAGE_DIR/$2
|
|
||||||
API_FILE=$PACKAGE_DIR/slsSupportLib/include/sls/versionAPI.h
|
|
||||||
CURR_DIR=$PWD
|
|
||||||
|
|
||||||
if [ ! -d "$API_DIR" ]; then
|
|
||||||
echo "[API_DIR] does not exist. $usage"
|
|
||||||
return [-1]
|
|
||||||
fi
|
|
||||||
|
|
||||||
#go to directory
|
|
||||||
cd $API_DIR
|
|
||||||
|
|
||||||
#deleting line from file
|
|
||||||
NUM=$(sed -n '/'$API_NAME' /=' $API_FILE)
|
|
||||||
#echo $NUM
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$NUM" -gt 0 ]; then
|
|
||||||
sed -i ${NUM}d $API_FILE
|
|
||||||
fi
|
|
||||||
|
|
||||||
#find new API date
|
|
||||||
API_DATE="find . -printf \"%T@ %CY-%Cm-%Cd\n\"| sort -nr | cut -d' ' -f2- | egrep -v '(\.)o' | head -n 1"
|
|
||||||
|
|
||||||
API_DATE=`eval $API_DATE`
|
|
||||||
|
|
||||||
API_DATE=$(sed "s/-//g" <<< $API_DATE | awk '{print $1;}' )
|
|
||||||
|
|
||||||
#extracting only date
|
|
||||||
API_DATE=${API_DATE:2:6}
|
|
||||||
|
|
||||||
#prefix of 0x
|
|
||||||
API_DATE=${API_DATE/#/0x}
|
|
||||||
echo "date="$API_DATE
|
|
||||||
|
|
||||||
|
|
||||||
# API_VAL concatenates branch and date
|
|
||||||
API_VAL=""
|
|
||||||
# API branch is defined (3rd argument)
|
|
||||||
if [ $# -eq 3 ]; then
|
|
||||||
API_BRANCH=$3
|
|
||||||
echo "branch="$API_BRANCH
|
|
||||||
API_VAL+="\"$API_BRANCH $API_DATE\""
|
|
||||||
else
|
|
||||||
# API branch not defined (default is developer)
|
|
||||||
echo "branch=developer"
|
|
||||||
API_VAL+="\"developer $API_DATE\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
#copy it to versionAPI.h
|
|
||||||
echo "#define "$API_NAME $API_VAL >> $API_FILE
|
|
||||||
|
|
||||||
#go back to original directory
|
|
||||||
cd $CURR_DIR
|
|
34
updateClientAPIVersion.py
Normal file
34
updateClientAPIVersion.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
|
# Copyright (C) 2025 Contributors to the SLS Detector Package
|
||||||
|
"""
|
||||||
|
Script to update API VERSION for slsReceiverSoftware or slsDetectorSoftware
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
|
||||||
|
from updateAPIVersion import update_api_version
|
||||||
|
|
||||||
|
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description = 'updates API version')
|
||||||
|
parser.add_argument('module_name', nargs="?", choices=["slsDetectorSoftware", "slsReceiverSoftware", "all"], default="all", help = 'module name to change api version options are: ["slsDetectorSoftware", "slsReceiverSoftware, "all"]')
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if args.module_name == "all":
|
||||||
|
client_names = ["APILIB", "APIRECEIVER"]
|
||||||
|
client_directories = [SCRIPT_DIR+"/slsDetectorSoftware", SCRIPT_DIR+"/slsReceiverSoftware"]
|
||||||
|
elif args.module_name == "slsDetectorSoftware":
|
||||||
|
client_names = ["APILIB"]
|
||||||
|
client_directories = [SCRIPT_DIR+"/slsDetectorSoftware"]
|
||||||
|
else:
|
||||||
|
client_names = ["APIRECEIVER"]
|
||||||
|
client_directories = [SCRIPT_DIR+"/slsReceiverSoftware"]
|
||||||
|
|
||||||
|
for client_name, client_directory in zip(client_names, client_directories):
|
||||||
|
update_api_version(client_name, client_directory)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
|||||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
|
||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
||||||
branch=""
|
|
||||||
client_list=("slsDetectorSoftware" "slsReceiverSoftware")
|
|
||||||
usage="\nUsage: updateClientAPI.sh [all|slsDetectorSoftware|slsReceiverSoftware] [branch]. \n\tNo arguments means all with 'developer' branch. \n\tNo 'branch' input means 'developer branch'"
|
|
||||||
|
|
||||||
# arguments
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
declare -a client=${client_list[@]}
|
|
||||||
echo "API Versioning all"
|
|
||||||
elif [ $# -eq 1 ] || [ $# -eq 2 ]; then
|
|
||||||
# 'all' client
|
|
||||||
if [[ $1 == "all" ]]; then
|
|
||||||
declare -a client=${client_list[@]}
|
|
||||||
echo "API Versioning all"
|
|
||||||
else
|
|
||||||
# only one server
|
|
||||||
if [[ $client_list != *$1* ]]; then
|
|
||||||
echo -e "Invalid argument 1: $1. $usage"
|
|
||||||
return -1
|
|
||||||
fi
|
|
||||||
declare -a client=("${1}")
|
|
||||||
#echo "Versioning only $1"
|
|
||||||
fi
|
|
||||||
if [ $# -eq 2 ]; then
|
|
||||||
if [[ $client_list == *$2* ]]; then
|
|
||||||
echo -e "Invalid argument 2: $2. $usage"
|
|
||||||
return -1
|
|
||||||
fi
|
|
||||||
branch+=$2
|
|
||||||
#echo "with branch $branch"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo -e "Too many arguments.$usage"
|
|
||||||
return -1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#echo "list is: ${client[@]}"
|
|
||||||
|
|
||||||
# versioning each client
|
|
||||||
for i in ${client[@]}
|
|
||||||
do
|
|
||||||
dir=$i
|
|
||||||
case $dir in
|
|
||||||
slsDetectorSoftware)
|
|
||||||
declare -a name=APILIB
|
|
||||||
;;
|
|
||||||
slsReceiverSoftware)
|
|
||||||
declare -a name=APIRECEIVER
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo -n "unknown client argument $i"
|
|
||||||
return -1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
echo -e "Versioning $dir [$name]"
|
|
||||||
./updateAPIVersion.sh $name $dir $branch
|
|
||||||
done
|
|
||||||
|
|
Reference in New Issue
Block a user