Compare commits

...

18 Commits

Author SHA1 Message Date
ae58e9f0f4 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-25 19:28:12 +02:00
603ddb0d75 updated docs, execcommand multiple words 2020-09-25 19:24:26 +02:00
c0be5ab8cb merge args fix 2020-09-25 11:55:55 +02:00
30f4c80031 fix 2020-09-25 11:00:51 +02:00
d25da43851 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-25 11:00:25 +02:00
ec2d6c597f added merge_args 2020-09-25 11:00:14 +02:00
fe81963873 rxr: udp socket size max of INT_MAX/2 (#191) 2020-09-25 10:15:39 +02:00
f950e32893 fix to utils 2020-09-25 08:53:35 +02:00
aa3af2f0ce Merge pull request #190 from slsdetectorgroup/g2cont
G2cont
2020-09-24 17:20:05 +02:00
e4615a11bb binary in 2020-09-24 17:19:21 +02:00
c01ce3d514 Merge branch 'developer' into g2cont 2020-09-24 17:18:04 +02:00
99642dad69 g2 fix: cont trigger frames in rxr should be 1 2020-09-24 17:16:46 +02:00
2c1fddee84 Cmddacs (#189)
Moved dacs to it's own command for command line. 
Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
2020-09-24 17:16:34 +02:00
c862f1df81 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-24 16:55:50 +02:00
671a2724ac more set_using_dict 2020-09-24 16:55:41 +02:00
9c5d8cfcd7 gui fix g2 disabling frame period in con ext 2020-09-24 16:05:43 +02:00
8483e05f4c binary in 2020-09-24 15:44:07 +02:00
d96352f2ae g2:fix for period in trigger cont 2020-09-24 15:43:14 +02:00
38 changed files with 1458 additions and 570 deletions

View File

@ -1,2 +1,114 @@
Draft
- dr 4, 8, 16 in eiger -> speed 0, 32 stays same (speed 1)
SLS Detector Package 5.0.0-rc1 released on 25.09.2020 (Release Candidate 1)
===========================================================================
CONTENTS
--------
1. Firmware Requirements
2. Download, Documentation & Support
1. Firmware Requirements
========================
Eiger
=====
Minimum compatible version : 27
Latest compatible version : 27
Jungfrau
========
Minimum compatible version (PCB v1.0) : 24.07.2020 (v0.8)
Latest compatible version (PCB v1.0) : 24.07.2020 (v0.8)
Minimum compatible version (PCB v2.0) : 21.07.2020 (v2.1)
Latest compatible version (PCB v2.0) : 21.07.2020 (v2.1)
Gotthard
========
Minimum compatible version : 11.01.2013
Latest compatible version : 08.02.2018 (50um and 25um Master)
09.02.2018 (25 um Slave)
Mythen3
=======
Minimum compatible version : 25.09.2020
Latest compatible version : 25.09.2020
Gotthard2
=========
Minimum compatible version : 25.09.2020
Latest compatible version : 25.09.2020
Moench
======
Minimum compatible version : 02.03.2020
Latest compatible version : 02.03.2020
Ctb
===
Minimum compatible version : 27.11.2019
Latest compatible version : 27.11.2019
Detector Upgrade
================
Eiger Remotely via bit files
Jungfrau Remotely using sls_detector_put programfpga <pof>
Gotthard Cannot be upgraded remotely. Requires programming via USB blaster
Mythen3 Remotely using sls_detector_put programfpga <rbf>
Gotthard2 Remotely using sls_detector_put programfpga <rbf>
Moench Remotely using sls_detector_put programfpga <pof>
Ctb Remotely using sls_detector_put programfpga <pof>
Instructions available at
https://slsdetectorgroup.github.io/devdoc/firmware.html
Please refer to the link below for more details on the firmware versions.
https://www.psi.ch/en/detectors/firmware
2. Download, Documentation & Support
====================================
Download
--------
The Source Code (Default C++ API):
https://github.com/slsdetectorgroup/slsDetectorPackage
Documentation
-------------
Installation:
https://slsdetectorgroup.github.io/devdoc/installation.html#
Consuming slsDetectorPackage:
https://slsdetectorgroup.github.io/devdoc/consuming.html
Command Line Documentation:
https://slsdetectorgroup.github.io/devdoc/commandline.html
C++ API Documentation:
https://slsdetectorgroup.github.io/devdoc/detector.html
C++ API Example:
https://slsdetectorgroup.github.io/devdoc/examples.html#
Python API Documentation:
https://slsdetectorgroup.github.io/devdoc/pygettingstarted.html
Python API Example:
https://slsdetectorgroup.github.io/devdoc/pyexamples.html
TroubleShooting:
https://www.psi.ch/en/detectors/troubleshooting
Further Documentation:
https://www.psi.ch/en/detectors/users-support
Support
-------
dhanya.thattil@psi.ch
erik.frojdh@psi.ch
anna.bergamaschi@psi.ch

View File

@ -45,6 +45,8 @@ set(SPHINX_SOURCE_FILES
src/ToString.rst
src/examples.rst
src/pygettingstarted.rst
src/firmware.rst
src/serverupgrade.rst
)

View File

@ -4,12 +4,28 @@ Command line interface
Usage
-------------
Commands can be uses either with sls_detector_get or sls_detector_put
Commands can be used either with sls_detector_get or sls_detector_put
.. code-block::
sls_detector_get vrf
Help
--------
.. code-block::
# get list of commands
sls_detector_get list
# search for a particular command using a word
sls_detector_get list | grep adc
# get help for a particular command
sls_detector_get -h fpath
sls_detector_help fpath
Commands
-----------

357
docs/src/firmware.rst Normal file
View File

@ -0,0 +1,357 @@
Firmware Upgrade
=================
Eiger
-------------
.. note ::
| Eiger firmware can be upgraded remotely.
| The programming executable (bcp) and corresponding bit files are provided by the SLS Detector group.
Compatibility
^^^^^^^^^^^^^
**Release candidate 5.0.0-rc1**
.. code-block:: bash
Minimum compatible version : 27
Latest compatible version : 27
`Older versions <https://www.psi.ch/en/detectors/latest-installation>`_
Upgrade
^^^^^^^^
#. Tftp must be already installed on your pc to use the bcp executable.
#. Kill the on-board servers and copy new servers to the board.
.. code-block:: bash
# Option 1: from detector console
# kill old server
ssh root@bebxxx
killall eigerDetectorServer
# copy new server
cd executables
scp user@pc:/path/eigerDetectorServerxxx .
chmod 777 eigerDetectorServerxxx
ln -sf eigerDetectorServerxxx eigerDetectorServer
sync
# Options 2: from client console for multiple modules
for i in bebxxx bebyyy;
do ssh root@$i killall eigerDetectorServer;
scp eigerDetectorServerxxx root@$i:~/executables/eigerDetectorServer;
ssh root@$i sync; done
* This is crucial when registers between firmwares change. Failure to do so will result in linux on boards to crash and boards can't be pinged anymore.
#. Bring the board into programmable mode using either of the 2 ways. Both methods result in only the central LED blinking.
* **Manual:**
Do a hard reset for each half module on back panel boards, between the LEDs, closer to each of the 1G ethernet connectors. Push until all LEDs start to blink.
* Software:
.. code-block:: bash
ssh root@bebxxx
cd executables
./boot_recovery
#. Start a terminal for each half module and run the following to see progress.
.. code-block:: bash
nc -p 3000 -u bebxxx 3000
# Press enter twice to see prompt with board name.
> bebxxx
# After each bcp command, wait for this terminal to print "Success".
#. In another terminal, run the following to update firmware. Please update bit files with great caution as it could make your board inaccessible, if done incorrectly.
.. code-block:: bash
#update back end fpga
bcp download.bit bebxxx:/fw0
#update front left fpga
bcp download.bit bebxxx:/febl
#update front right fpga
bcp download.bit bebxxx:/febr
#update kernel (only if required by the SLS Detector Group)
bcp download.bit bebxxx:/kernel
#. Reboot the detector.
Jungfrau
-------------
.. note ::
| Jungfrau firmware can be upgraded remotely.
| The corresponding programming file (pof) is provided by the SLS Detector group.
Compatibility
^^^^^^^^^^^^^
**Release candidate 5.0.0-rc1**
.. code-block:: bash
# PCB v1.0
Minimum compatible version : 24.07.2020 (v0.8)
Latest compatible version : 24.07.2020 (v0.8)
# PCB v2.0
Minimum compatible version : 21.07.2020 (v2.1)
Latest compatible version : 21.07.2020 (v2.1)
`Older versions <https://www.psi.ch/en/detectors/latest-installation>`_
Upgrade (from v4.x.x)
^^^^^^^^^^^^^^^^^^^^
#. Tftp must be installed on pc.
#. Update client package to the latest (5.0.0-rc1).
#. Disable server respawning or kill old server
.. code-block:: bash
# Option 1: if respawning enabled
telnet bchipxxx
# edit /etc/inittab
# comment out line #ttyS0::respawn:/jungfrauDetectorServervxxx
reboot
# ensure servers did not start up after reboot
telnet bchipxxx
ps
# Option 2: if respawning already disabled
telnet bchipxxx
killall jungfrauDetectorServerv*
#. Copy new server and start in update mode
.. code-block:: bash
tftp pcxxx -r jungfrauDetectorServervxxx -g
chmod 777 jungfrauDetectorServervxxx
./jungfrauDetectorServervxxx -u
#. Program fpga from the client console
.. code-block:: bash
sls_detector_get free
# Crucial that the next command executes without any errors
sls_detector_put hostname bchipxxx
sls_detector_put programfpga xxx.pof
#. After programming, kill update server using Ctrl + C.
#. Enable server respawning if needed
.. code-block:: bash
telnet bchipxxx
# edit /etc/inittab
# uncomment out line #ttyS0::respawn:/jungfrauDetectorServervxxx
# ensure the line has the new server name
reboot
# ensure both servers are running using ps
jungfrauDetectorServervxxx
jungfrauDetectorServervxxx --stop-server 1953
Upgrade (from v5.0.0-rc1)
^^^^^^^^^^^^^^^^^^^^^^^^
#. Program from console
.. code-block:: bash
# copies server from tftp folder of pc, programs fpga,
# removes old server from respawn, sets up new server to respawn
# and reboots
sls_detector_put update jungfrauDetectorServervxxx pcxxx xx.pof
# Or only program firmware
sls_detector_put programfpga xxx.pof
Gotthard
---------
.. warning ::
| Gotthard firmware cannot be upgraded remotely and requires the use of USB-Blaster.
| It is generally updated by the SLS Detector group.
Compatibility
^^^^^^^^^^^^^
**Release candidate 5.0.0-rc1**
.. code-block:: bash
Minimum compatible version : 11.01.2013
Latest compatible version : 08.02.2018 (50um and 25um Master)
09.02.2018 (25 um Slave)
`Older versions <https://www.psi.ch/en/detectors/latest-installation>`_
Upgrade
^^^^^^^^
#. Download `Altera Quartus software or Quartus programmer <https://fpgasoftware.intel.com/20.1/?edition=standard&platform=linux&product=qprogrammer#tabs-4>`_.
#. Start Quartus programmer, click on Hardware Setup. In the "Currently selected hardware" window, select USB-Blaster.
#. In the Mode combo box, select "Active Serial Programming".
#. Plug the end of your USB-Blaster with the adaptor provided to the connector 'AS config' on the Gotthard board.
#. Click on 'Add file'. Select programming (pof) file provided by the SLS Detector group.
#. Check "Program/Configure" and "Verify". Push the start button. Wait until the programming process is finished.
#. In case of error messages, check the polarity of cable (that pin1 corresponds) and that the correct programming connector is selected.
#. Reboot the detector.
Mythen3
-------
.. note ::
| Mythen3 firmware can be upgraded remotely.
| The corresponding programming file (rbf) is provided by the SLS Detector group.
Compatibility
^^^^^^^^^^^^^
**Release candidate 5.0.0-rc1**
.. code-block:: bash
Minimum compatible version : 25.09.2020
Latest compatible version : 25.09.2020
Upgrade (from v5.0.0-rc1)
^^^^^^^^^^^^^^^^^^^^^^^^
#. Program from console
.. code-block:: bash
# copies server from tftp folder of pc, programs fpga,
# and reboots (new server not respawned currently)
sls_detector_put update mythen3DetectorServervxxx pcxxx xxx.rbf
# Or only program firmware
sls_detector_put programfpga xxx.rbf
Gotthard2
----------
.. note ::
| Gotthard2 firmware can be upgraded remotely.
| The corresponding programming file (rbf) is provided by the SLS Detector group.
Compatibility
^^^^^^^^^^^^^
**Release candidate 5.0.0-rc1**
.. code-block:: bash
Minimum compatible version : 25.09.2020
Latest compatible version : 25.09.2020
Upgrade (from v5.0.0-rc1)
^^^^^^^^^^^^^^^^^^^^^^^^
#. Program from console
.. code-block:: bash
# copies server from tftp folder of pc, programs fpga,
# and reboots (new server not respawned currently)
sls_detector_put update gotthard2DetectorServervxxx pcxxx xxx.rbf
# Or only program firmware
sls_detector_put programfpga xxx.rbf
Moench
------
.. note ::
| Moench firmware can be upgraded remotely.
| The corresponding programming file (pof) is provided by the SLS Detector group.
Compatibility
^^^^^^^^^^^^^
**Release candidate 5.0.0-rc1**
.. code-block:: bash
Minimum compatible version : 02.03.2020
Latest compatible version : 02.03.2020
Upgrade (from v5.0.0-rc1)
^^^^^^^^^^^^^^^^^^^^^^^^
#. Program from console
.. code-block:: bash
# copies server from tftp folder of pc, programs fpga,
# removes old server from respawn, sets up new server to respawn
# and reboots
sls_detector_put update moenchDetectorServervxxx pcxxx xx.pof
# Or only program firmware
sls_detector_put programfpga xxx.pof
Ctb
---
.. note ::
| Ctb firmware can be upgraded remotely.
| The corresponding programming file (pof) is provided by the SLS Detector group.
Compatibility
^^^^^^^^^^^^^
**Release candidate 5.0.0-rc1**
.. code-block:: bash
Minimum compatible version : 27.11.2019
Latest compatible version : 27.11.2019
Upgrade (from v5.0.0-rc1)
^^^^^^^^^^^^^^^^^^^^^^^^
#. Program from console
.. code-block:: bash
# copies server from tftp folder of pc, programs fpga,
# removes old server from respawn, sets up new server to respawn
# and reboots
sls_detector_put update ctbDetectorServervxxx pcxxx xx.pof
# Or only program firmware
sls_detector_put programfpga xxx.pof

View File

@ -54,6 +54,12 @@ Welcome to slsDetectorPackage's documentation!
:caption: Servers
servers
serverupgrade
.. toctree::
:caption: Firmware
firmware
.. Indices and tables
.. ==================

View File

@ -44,6 +44,26 @@ The easiest way to configure options is to use the ccmake utility.
ccmake .
Build using cmk.sh script
-------------------------
.. code-block:: bash
# new build and make with 9 parallel threads
./cmk.sh -cbj9
# build with python
./cmk.sh -bpj9
# build with GUI
./cmk.sh -bgj9
# build with hdf5
./cmk.sh -hj9 -d [path of hdf5 dir]
# get all options
./cmk.sh -?
Install binaries using conda
--------------------------------

View File

@ -0,0 +1,88 @@
Server Upgrade
=================
Eiger
-------------
#. Kill old server and copy new server
.. code-block:: bash
# Option 1: from detector console
# kill old server
ssh root@bebxxx
killall eigerDetectorServer
# copy new server
cd executables
scp user@pc:/path/eigerDetectorServerxxx .
chmod 777 eigerDetectorServerxxx
ln -sf eigerDetectorServerxxx eigerDetectorServer
sync
# Options 2: from client console for multiple modules
for i in bebxxx bebyyy;
do ssh root@$i killall eigerDetectorServer;
scp eigerDetectorServerxxx root@$i:~/executables/eigerDetectorServer;
ssh root@$i sync; done
#. Reboot the detector.
Jungfrau
-------------
#. Program from console (only from 5.0.0-rc1)
.. code-block:: bash
# copies new server from pc tftp folder, respawns and reboots
sls_detector_put copydetectorserver jungfrauDetectorServerxxx pcxxx
Gotthard
---------
#. Program from console (only from 5.0.0-rc1)
.. code-block:: bash
# copies new server from pc tftp folder, respawns and reboots
sls_detector_put copydetectorserver gotthardDetectorServerxxx pcxxx
Mythen3
-------
#. Program from console (only from 5.0.0-rc1)
.. code-block:: bash
# copies new server from pc tftp folder and reboots (does not respawn)
sls_detector_put copydetectorserver mythen3DetectorServerxxx pcxxx
Gotthard2
----------
#. Program from console (only from 5.0.0-rc1)
.. code-block:: bash
# copies new server from pc tftp folder and reboots (does not respawn)
sls_detector_put copydetectorserver gotthard2DetectorServerxxx pcxxx
Moench
------
#. Program from console (only from 5.0.0-rc1)
.. code-block:: bash
# copies new server from pc tftp folder, respawns and reboots
sls_detector_put copydetectorserver moenchDetectorServerxxx pcxxx
Ctb
---
#. Program from console (only from 5.0.0-rc1)
.. code-block:: bash
# copies new server from pc tftp folder, respawns and reboots
sls_detector_put copydetectorserver ctbDetectorServerxxx pcxxx

View File

@ -342,7 +342,7 @@ class Detector(CppDetectorApi):
def framesl(self):
"""
[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] Number of frames left in acquisition.\n
[Gotthard2] only in continuous mode.
[Gotthard2] only in continuous auto mode.
:setter: Not Implemented
"""
return self.getNumberOfFramesLeft()
@ -1298,7 +1298,7 @@ class Detector(CppDetectorApi):
@property
@element
def rx_udpsocksize(self):
"""UDP socket buffer size in receiver. Tune rmem_default and rmem_max accordingly."""
"""UDP socket buffer size in receiver. Tune rmem_default and rmem_max accordingly. Max size: INT_MAX/2."""
return self.getRxUDPSocketBufferSize()
@rx_udpsocksize.setter
@ -1492,7 +1492,7 @@ class Detector(CppDetectorApi):
[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] Number of triggers left in acquisition.\n
Note
----
[Gotthard2] only in continuous mode.
Only when external trigger used.
:setter: Not Implemented
"""
return self.getNumberOfTriggersLeft()
@ -2119,6 +2119,18 @@ class Detector(CppDetectorApi):
def bursts(self, value):
self.setNumberOfBursts(value)
@property
@element
def burstsl(self):
"""
[Gotthard2] Number of bursts left in acquisition.\n
Note
----
Only in burst auto mode.
:setter: Not Implemented
"""
return self.getNumberOfBurstsLeft()
@property
@element
def filter(self):
@ -2563,24 +2575,27 @@ class Detector(CppDetectorApi):
ut.set_using_dict(self.setADCPhase, value)
@property
@element
def adcpipeline(self):
"""[Ctb][Moench] Sets pipeline for ADC clock. """
return element_if_equal(self.getADCPipeline())
return self.getADCPipeline()
@adcpipeline.setter
def adcpipeline(self, value):
self.setADCPipeline(value)
ut.set_using_dict(self.setADCPipeline, value)
@property
@element
def adcclk(self):
"""[Ctb][Moench] Sets ADC clock frequency in MHz. """
return element_if_equal(self.getADCClock())
return self.getADCClock()
@adcclk.setter
def adcclk(self, value):
self.setADCClock(value)
ut.set_using_dict(self.setADCClock, value)
@property
@element
def syncclk(self):
"""
[Ctb][Moench] Sync clock in MHz.
@ -2588,7 +2603,7 @@ class Detector(CppDetectorApi):
-----
:setter: Not implemented
"""
return element_if_equal(self.getSYNCClock())
return self.getSYNCClock()
@property
def pattern(self):
@ -2600,17 +2615,16 @@ class Detector(CppDetectorApi):
---------
>>> d.pattern = '/tmp/pat.txt'
"""
# TODO! Clean fix
print("Set only")
return 0
raise NotImplementedError("Pattern is set only")
@pattern.setter
def pattern(self, fname):
fname = ut.make_string_path(fname)
self.setPattern(fname)
ut.set_using_dict(self.setPattern, fname)
# patioctrl
@property
@element
def patioctrl(self):
"""[Ctb][Moench] 64 bit mask defining input (0) and output (1) signals.
@ -2620,13 +2634,14 @@ class Detector(CppDetectorApi):
>>> hex(d.patioctrl)
'0x8f0effff6dbffdbf'
"""
return element_if_equal(self.getPatternIOControl())
return self.getPatternIOControl()
@patioctrl.setter
def patioctrl(self, mask):
self.setPatternIOControl(mask)
ut.set_using_dict(self.setPatternIOControl, mask)
@property
@element
def patlimits(self):
"""[Ctb][Moench][Mythen3] Limits (start and stop address) of complete pattern.
@ -2638,11 +2653,12 @@ class Detector(CppDetectorApi):
>>> [hex(l) for l in d.patlimits]
['0x0', '0x18c']
"""
return element_if_equal(self.getPatternLoopAddresses(-1))
return self.getPatternLoopAddresses(-1)
@patlimits.setter
def patlimits(self, lim):
self.setPatternLoopAddresses(-1, lim[0], lim[1])
def patlimits(self, args):
args = ut.merge_args(-1, args)
ut.set_using_dict(self.setPatternLoopAddresses, *args)
@property
@element
@ -2659,9 +2675,10 @@ class Detector(CppDetectorApi):
@patsetbit.setter
def patsetbit(self, mask):
self.setPatternBitMask(mask)
ut.set_using_dict(self.setPatternBitMask, mask)
@property
@element
def patmask(self):
"""[Ctb][Moench][Mythen3] Sets the mask applied to every pattern to the selected bits.
@ -2671,15 +2688,14 @@ class Detector(CppDetectorApi):
>>> hex(d.patmask)
'0x8f0effff6dbffdbf'
"""
return element_if_equal(self.getPatternMask())
return self.getPatternMask()
@patmask.setter
def patmask(self, mask):
self.setPatternMask(mask)
ut.set_using_dict(self.setPatternMask, mask)
@property
@element
def patwait0(self):
"""[Ctb][Moench][Mythen3] Wait 0 address.
@ -2691,13 +2707,15 @@ class Detector(CppDetectorApi):
>>> hex(d.patwait0)
'0xaa'
"""
return element_if_equal(self.getPatternWaitAddr(0))
return self.getPatternWaitAddr(0)
@patwait0.setter
def patwait0(self, addr):
self.setPatternWaitAddr(0, addr)
addr = ut.merge_args(0, addr)
ut.set_using_dict(self.setPatternWaitAddr, *addr)
@property
@element
def patwait1(self):
"""[Ctb][Moench][Mythen3] Wait 1 address.
@ -2709,13 +2727,15 @@ class Detector(CppDetectorApi):
>>> hex(d.patwait1)
'0xaa'
"""
return element_if_equal(self.getPatternWaitAddr(1))
return self.getPatternWaitAddr(1)
@patwait1.setter
def patwait1(self, addr):
self.setPatternWaitAddr(1, addr)
addr = ut.merge_args(1, addr)
ut.set_using_dict(self.setPatternWaitAddr, *addr)
@property
@element
def patwait2(self):
"""[Ctb][Moench][Mythen3] Wait 2 address.
@ -2727,40 +2747,49 @@ class Detector(CppDetectorApi):
>>> hex(d.patwait2)
'0xaa'
"""
return element_if_equal(self.getPatternWaitAddr(2))
return self.getPatternWaitAddr(2)
@patwait2.setter
def patwait2(self, addr):
self.setPatternWaitAddr(2, addr)
addr = ut.merge_args(2, addr)
ut.set_using_dict(self.setPatternWaitAddr, *addr)
@property
@element
def patwaittime0(self):
"""[Ctb][Moench][Mythen3] Wait 0 time in clock cycles."""
return element_if_equal(self.getPatternWaitTime(0))
return self.getPatternWaitTime(0)
@patwaittime0.setter
def patwaittime0(self, nclk):
self.setPatternWaitTime(0, nclk)
nclk = ut.merge_args(0, nclk)
ut.set_using_dict(self.setPatternWaitTime, *nclk)
@property
@element
def patwaittime1(self):
"""[Ctb][Moench][Mythen3] Wait 1 time in clock cycles."""
return element_if_equal(self.getPatternWaitTime(1))
return self.getPatternWaitTime(1)
@patwaittime1.setter
def patwaittime1(self, nclk):
self.setPatternWaitTime(1, nclk)
nclk = ut.merge_args(1, nclk)
ut.set_using_dict(self.setPatternWaitTime, *nclk)
@property
@element
def patwaittime2(self):
"""[Ctb][Moench][Mythen3] Wait 2 time in clock cycles."""
return element_if_equal(self.getPatternWaitTime(2))
return self.getPatternWaitTime(2)
@patwaittime2.setter
def patwaittime2(self, nclk):
self.setPatternWaitTime(2, nclk)
nclk = ut.merge_args(2, nclk)
ut.set_using_dict(self.setPatternWaitTime, *nclk)
@property
@element
def patloop0(self):
"""[Ctb][Moench][Mythen3] Limits (start and stop address) of loop 0.
@ -2772,13 +2801,15 @@ class Detector(CppDetectorApi):
>>> [hex(l) for l in d.patloop0]
['0x0', '0x18c']
"""
return element_if_equal(self.getPatternLoopAddresses(0))
return self.getPatternLoopAddresses(0)
@patloop0.setter
def patloop0(self, addr):
self.setPatternLoopAddresses(0, addr[0], addr[1])
addr = ut.merge_args(0, addr)
ut.set_using_dict(self.setPatternLoopAddresses, *addr)
@property
@element
def patloop1(self):
"""[Ctb][Moench][Mythen3] Limits (start and stop address) of loop 1.
@ -2791,13 +2822,15 @@ class Detector(CppDetectorApi):
['0x0', '0x18c']
"""
return element_if_equal(self.getPatternLoopAddresses(1))
return self.getPatternLoopAddresses(1)
@patloop1.setter
def patloop1(self, addr):
self.setPatternLoopAddresses(1, addr[0], addr[1])
addr = ut.merge_args(1, addr)
ut.set_using_dict(self.setPatternLoopAddresses, *addr)
@property
@element
def patloop2(self):
"""[Ctb][Moench][Mythen3] Limits (start and stop address) of loop 2.
@ -2810,38 +2843,45 @@ class Detector(CppDetectorApi):
['0x0', '0x18c']
"""
return element_if_equal(self.getPatternLoopAddresses(2))
return self.getPatternLoopAddresses(2)
@patloop2.setter
def patloop2(self, addr):
self.setPatternLoopAddresses(2, addr[0], addr[1])
addr = ut.merge_args(2, addr)
ut.set_using_dict(self.setPatternLoopAddresses, *addr)
@property
@element
def patnloop0(self):
"""[Ctb][Moench][Mythen3] Number of cycles of loop 0."""
return element_if_equal(self.getPatternLoopCycles(0))
return self.getPatternLoopCycles(0)
@patnloop0.setter
def patnloop0(self, n):
self.setPatternLoopCycles(0, n)
n = ut.merge_args(0, n)
ut.set_using_dict(self.setPatternLoopCycles, *n)
@property
@element
def patnloop1(self):
"""[Ctb][Moench][Mythen3] Number of cycles of loop 1."""
return element_if_equal(self.getPatternLoopCycles(1))
return self.getPatternLoopCycles(1)
@patnloop1.setter
def patnloop1(self, n):
self.setPatternLoopCycles(1, n)
n = ut.merge_args(1, n)
ut.set_using_dict(self.setPatternLoopCycles, *n)
@property
@element
def patnloop2(self):
"""[Ctb][Moench][Mythen3] Number of cycles of loop 2."""
return element_if_equal(self.getPatternLoopCycles(2))
return self.getPatternLoopCycles(2)
@patnloop2.setter
def patnloop2(self, n):
self.setPatternLoopCycles(2, n)
n = ut.merge_args(2, n)
ut.set_using_dict(self.setPatternLoopCycles, *n)
@property
@element
@ -2851,7 +2891,8 @@ class Detector(CppDetectorApi):
@v_a.setter
def v_a(self, value):
self.setDAC(dacIndex.V_POWER_A, value, True)
value = ut.merge_args(dacIndex.V_POWER_A, value, True)
ut.set_using_dict(self.setDAC, *value)
@property
@element
@ -2861,7 +2902,8 @@ class Detector(CppDetectorApi):
@v_b.setter
def v_b(self, value):
self.setDAC(dacIndex.V_POWER_B, value, True)
value = ut.merge_args(dacIndex.V_POWER_B, value, True)
ut.set_using_dict(self.setDAC, *value)
@property
@element
@ -2871,7 +2913,8 @@ class Detector(CppDetectorApi):
@v_c.setter
def v_c(self, value):
self.setDAC(dacIndex.V_POWER_C, value, True)
value = ut.merge_args(dacIndex.V_POWER_C, value, True)
ut.set_using_dict(self.setDAC, *value)
@property
@element
@ -2881,7 +2924,8 @@ class Detector(CppDetectorApi):
@v_d.setter
def v_d(self, value):
self.setDAC(dacIndex.V_POWER_D, value, True)
value = ut.merge_args(dacIndex.V_POWER_D, value, True)
ut.set_using_dict(self.setDAC, *value)
@property
@element
@ -2895,7 +2939,8 @@ class Detector(CppDetectorApi):
@v_io.setter
def v_io(self, value):
self.setDAC(dacIndex.V_POWER_IO, value, True)
value = ut.merge_args(dacIndex.V_POWER_IO, value, True)
ut.set_using_dict(self.setDAC, *value)
@property
@element
@ -2905,7 +2950,9 @@ class Detector(CppDetectorApi):
@v_limit.setter
def v_limit(self, value):
self.setDAC(dacIndex.V_LIMIT, value, True)
value = ut.merge_args(dacIndex.V_LIMIT, value, True)
ut.set_using_dict(self.setDAC, *value)
@property
@element

View File

@ -189,4 +189,73 @@ def lhex(iterable):
def lpath(iterable):
return [Path(item) for item in iterable]
return [Path(item) for item in iterable]
def add_argument_before(a, args):
"""Add a before the other arguments. Also works with
dict that holds args to several modules. Always puts the
args in a dict to be compatible with set_using_dict"""
if isinstance(args, tuple):
return (a, *args)
elif isinstance(args, dict):
ret = {}
for key, value in args.items():
if isinstance(value, tuple):
ret[key] = (a, *value)
else:
ret[key] = (a, value)
return (ret,)
return a, args
def add_argument_after(args, a):
"""Add a before the other arguments. Also works with
dict that holds args to several modules. Always puts the
args in a dict to be compatible with set_using_dict"""
if isinstance(args, tuple):
return (*args, a)
elif isinstance(args, dict):
ret = {}
for key, value in args.items():
if isinstance(value, tuple):
ret[key] = (*value, a)
else:
ret[key] = (value, a)
return (ret,)
return args, a
def pop_dict(args):
for i,a in enumerate(args):
if isinstance(a, dict):
return args.pop(i), i
def tuplify(args):
if not isinstance(args, tuple):
return (args, )
else:
return args
def merge_args(*args):
n_dict = sum(isinstance(a, dict) for a in args)
if n_dict == 0: #no dict just make a tuple of arguments
ret = []
for a in args:
if isinstance(a, tuple):
ret.extend(a)
else:
ret.append(a)
return tuple(ret)
elif n_dict == 1:
args = [a for a in args] #these are the args to be added
values,pos = pop_dict(args)
ret = {}
for k, v in values.items():
v = tuplify(v)
items = [a for a in args]
items[pos:pos] = v
ret[k] = tuple(items)
return (ret,)
else:
raise ValueError("Multiple dictionaries passes cannot merge args")

View File

@ -965,6 +965,10 @@ void init_det(py::module &m) {
(void (Detector::*)(sls::ns, sls::Positions)) &
Detector::setBurstPeriod,
py::arg(), py::arg() = Positions{})
.def("getNumberOfBurstsLeft",
(Result<int64_t>(Detector::*)(sls::Positions) const) &
Detector::getNumberOfBurstsLeft,
py::arg() = Positions{})
.def("getInjectChannel",
(Result<std::array<int, 2>>(Detector::*)(sls::Positions)) &
Detector::getInjectChannel,

View File

@ -306,3 +306,37 @@ def test_make_bitmask_from_list_of_int():
def test_make_bitmask_from_dict():
assert make_bitmask({0: [0, 1], 1: [0, 1, 7]}) == {0: 0b11, 1: 0b10000011}
def test_add_argument_before():
assert add_argument_before("a", 5) == ("a", 5)
assert add_argument_before(3, ("a", "b")) == (3, "a", "b")
def test_add_argument_before_dict():
assert add_argument_before(5, {0: "a"}) == ({0: (5, "a")},)
assert add_argument_before(0, {0: 1}) == ({0: (0, 1)},)
assert add_argument_before(5, {0: ("a", "b")}) == ({0: (5, "a", "b")}, )
assert add_argument_before(6, "hej") == (6, "hej")
assert add_argument_before("another", {9: "string"}) == ({
9: ("another", "string")
}, )
def test_add_argument_after():
assert add_argument_after("a", 5) == ("a", 5)
assert add_argument_after(("a", "b"), 3) == ("a", "b", 3)
def test_add_argument_after_dict():
assert add_argument_after({0: "a"}, "b") == ({0: ("a", "b")},)
assert add_argument_after({0: ("a", 1)}, True) == ({0: ("a", 1, True)}, )
def test_merge_args():
assert merge_args("a", "b", 1) == ("a", "b", 1)
assert merge_args({0:1, 1:2}, "a") == ({0: (1, "a"), 1: (2, "a")},)
def test_merge_args_tuple():
assert merge_args(*("a", "b"), 5) == ("a", "b", 5)
def test_merge_args_dict_with_tuple():
assert merge_args({0: (1,2)}, 3) == ({0: (1,2,3)},)

View File

@ -167,7 +167,7 @@ void qTabMeasurement::ShowTriggerDelay() {
if ((comboBurstMode->currentIndex() ==
slsDetectorDefs::CONTINUOUS_INTERNAL ||
comboBurstMode->currentIndex() ==
slsDetectorDefs::CONTINUOUS_INTERNAL) &&
slsDetectorDefs::CONTINUOUS_EXTERNAL) &&
(comboTimingMode->currentIndex() == TRIGGER)) {
enableFramePeriod = false;
}

View File

@ -994,7 +994,7 @@ int64_t getPeriod() {
// trigger
if (getTiming() == TRIGGER_EXPOSURE) {
// #frames limited in cont trigger mode
return periodReg;
return periodReg / (1E-9 * systemFrequency);
}
// auto
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG) /
@ -1077,11 +1077,21 @@ int64_t getBurstPeriod() {
}
int64_t getNumFramesLeft() {
return get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
// continuous and auto
if ((burstMode == CONTINUOUS_INTERNAL ||
burstMode == CONTINUOUS_EXTERNAL) &&
getTiming() == AUTO_TIMING) {
return get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
}
return -1;
}
int64_t getNumTriggersLeft() {
return get64BitReg(GET_CYCLES_LSB_REG, GET_CYCLES_MSB_REG);
// trigger
if (getTiming() == TRIGGER_EXPOSURE) {
return get64BitReg(GET_CYCLES_LSB_REG, GET_CYCLES_MSB_REG);
}
return -1;
}
int64_t getDelayAfterTriggerLeft() {
@ -1094,6 +1104,15 @@ int64_t getPeriodLeft() {
(1E-9 * systemFrequency);
}
int64_t getNumBurstsLeft() {
// burst and auto
if ((burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) &&
getTiming() == AUTO_TIMING) {
return get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
}
return -1;
}
int64_t getFramesFromStart() {
return get64BitReg(FRAMES_FROM_START_LSB_REG, FRAMES_FROM_START_MSB_REG);
}
@ -2631,7 +2650,13 @@ void *start_timer(void *arg) {
}
int repeatPeriodNs = getBurstPeriod();
int numFrames = getNumFrames();
// continuous trigger mode, #frames = 1
int64_t periodNs = getPeriod();
if (getTiming() == TRIGGER_EXPOSURE && (burstMode == CONTINUOUS_INTERNAL ||
burstMode == CONTINUOUS_EXTERNAL)) {
numFrames = 1;
periodNs = 0;
}
int64_t expUs = getExpTime() / 1000;
int imagesize = NCHAN * NCHIP * 2;
int datasize = imagesize;
@ -2832,15 +2857,7 @@ void readFrame(int *ret, char *mess) {
#endif
*ret = (int)OK;
// frames left to give status
int64_t retval = getNumFramesLeft() + 1;
if (retval > 0) {
LOG(logERROR, ("No data and run stopped: %lld frames left\n",
(long long int)retval));
} else {
LOG(logINFOGREEN, ("Acquisition successfully finished\n"));
}
LOG(logINFOGREEN, ("Acquisition successfully finished\n"));
}
u_int32_t runBusy() {

View File

@ -267,6 +267,9 @@ int64_t getNumTriggersLeft();
int64_t getDelayAfterTriggerLeft();
int64_t getPeriodLeft();
#endif
#ifdef GOTTHARD2D
int64_t getNumBurstsLeft();
#endif
#ifdef GOTTHARDD
int64_t getExpTimeLeft();
#endif

View File

@ -238,4 +238,5 @@ int set_adc_config(int);
int get_bad_channels(int);
int set_bad_channels(int);
int reconfigure_udp(int);
int validate_udp_configuration(int);
int validate_udp_configuration(int);
int get_bursts_left(int);

View File

@ -357,6 +357,7 @@ void function_table() {
flist[F_SET_BAD_CHANNELS] = &set_bad_channels;
flist[F_RECONFIGURE_UDP] = &reconfigure_udp;
flist[F_VALIDATE_UDP_CONFIG] = &validate_udp_configuration;
flist[F_GET_BURSTS_LEFT] = &get_bursts_left;
// check
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
@ -8067,4 +8068,19 @@ int validate_udp_configuration(int file_des) {
}
return Server_SendResult(file_des, INT32, NULL, 0);
}
int get_bursts_left(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int64_t retval = -1;
#ifndef GOTTHARD2D
functionNotImplemented();
#else
// get only
retval = getNumBurstsLeft();
LOG(logDEBUG1, ("retval num bursts left %lld\n", (long long int)retval));
#endif
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
}

View File

@ -214,11 +214,11 @@ class Detector {
void setDelayAfterTrigger(ns value, Positions pos = {});
/** [Gotthard][Jungfrau][CTB][Moench][Mythen3]
* [Gotthard2] only in continuous mode */
* [Gotthard2] only in continuous auto mode */
Result<int64_t> getNumberOfFramesLeft(Positions pos = {}) const;
/** [Gotthard][Jungfrau][CTB][Moench][Mythen3]
* [Gotthard2] only in continuous mode */
* Only when external trigger used */
Result<int64_t> getNumberOfTriggersLeft(Positions pos = {}) const;
/** [Gotthard][Jungfrau][CTB][Moench][Mythen3][Gotthard2]
@ -717,17 +717,17 @@ class Detector {
/** Default: padding enabled. Disabling padding is the fastest */
void setPartialFramesPadding(bool value, Positions pos = {});
Result<int64_t> getRxUDPSocketBufferSize(Positions pos = {}) const;
Result<int> getRxUDPSocketBufferSize(Positions pos = {}) const;
/** UDP socket buffer size in receiver. Tune rmem_default and rmem_max
* accordingly */
void setRxUDPSocketBufferSize(int64_t udpsockbufsize, Positions pos = {});
* accordingly. Max value is INT_MAX/2. */
void setRxUDPSocketBufferSize(int udpsockbufsize, Positions pos = {});
/** TODO:
* Gets actual udp socket buffer size. Double the size of rx_udpsocksize due
* to kernel bookkeeping.
*/
Result<int64_t> getRxRealUDPSocketBufferSize(Positions pos = {}) const;
Result<int> getRxRealUDPSocketBufferSize(Positions pos = {}) const;
Result<bool> getRxLock(Positions pos = {});
@ -1140,6 +1140,9 @@ class Detector {
* mode */
void setBurstPeriod(ns value, Positions pos = {});
/** [Gotthard2] only in burst auto mode */
Result<int64_t> getNumberOfBurstsLeft(Positions pos = {}) const;
/** [Gotthard2] offset channel, increment channel */
Result<std::array<int, 2>> getInjectChannel(Positions pos = {});

View File

@ -1,4 +1,5 @@
#include "CmdProxy.h"
#include "HelpDacs.h"
#include "TimeHelper.h"
#include "ToString.h"
#include "bit_utils.h"
@ -33,7 +34,11 @@ void CmdProxy::Call(const std::string &command,
args = arguments;
det_id = detector_id;
ReplaceIfDepreciated(cmd);
std::string temp;
while (temp != cmd) {
temp = cmd;
ReplaceIfDepreciated(cmd);
}
auto it = functions.find(cmd);
if (it != functions.end()) {
@ -51,6 +56,10 @@ bool CmdProxy::ReplaceIfDepreciated(std::string &command) {
<< command
<< " is depreciated and will be removed. Please migrate to: "
<< d_it->second;
// insert old command into arguments (for dacs)
if (d_it->second == "dac") {
args.insert(args.begin(), command);
}
command = d_it->second;
return true;
}
@ -905,45 +914,59 @@ std::string CmdProxy::TemperatureValues(int action) {
std::string CmdProxy::Dac(int action) {
std::ostringstream os;
os << cmd << ' ';
// dac indices only for ctb
if (args.size() > 0 && action != defs::HELP_ACTION) {
if (is_int(args[0]) &&
det->getDetectorType().squash() != defs::CHIPTESTBOARD) {
throw sls::RuntimeError(
"Dac indices can only be used for chip test board. Use daclist "
"to get list of dac names for current detector.");
}
}
if (action == defs::HELP_ACTION) {
os << "[dac index] [dac or mV value] [(optional unit) mV] "
"\n\t[Ctb] Dac."
<< '\n';
} else if (det->getDetectorType().squash(defs::GENERIC) !=
defs::CHIPTESTBOARD) {
throw sls::RuntimeError(
"Dac command can only be used for chip test board. Use daclist to "
"get list of dac commands for current detector.");
if (args.size() == 0) {
os << GetHelpDac(std::to_string(0)) << '\n';
} else {
os << args[0] << ' ' << GetHelpDac(args[0]) << '\n';
}
} else if (action == defs::GET_ACTION) {
bool mv = false;
if (args.empty())
WrongNumberOfParameters(1); // This prints slightly wrong
defs::dacIndex dacIndex = StringTo<defs::dacIndex>(args[0]);
bool mV = false;
if (args.size() == 2) {
if ((args[1] != "mv") && (args[1] != "mV")) {
throw sls::RuntimeError("Unknown argument " + args[1] +
". Did you mean mV?");
}
mv = true;
mV = true;
} else if (args.size() > 2) {
WrongNumberOfParameters(1);
}
auto t =
det->getDAC(static_cast<defs::dacIndex>(StringTo<int>(args[0])), mv,
std::vector<int>{det_id});
os << args[0] << ' ' << OutString(t)
<< (args.size() > 1 ? " mV\n" : "\n");
auto t = det->getDAC(dacIndex, mV, std::vector<int>{det_id});
os << args[0] << ' ' << OutString(t) << (mV ? " mV\n" : "\n");
} else if (action == defs::PUT_ACTION) {
bool mv = false;
if (args.empty())
WrongNumberOfParameters(1); // This prints slightly wrong
defs::dacIndex dacIndex = StringTo<defs::dacIndex>(args[0]);
bool mV = false;
if (args.size() == 3) {
if ((args[2] != "mv") && (args[2] != "mV")) {
throw sls::RuntimeError("Unknown argument " + args[2] +
". Did you mean mV?");
}
mv = true;
mV = true;
} else if (args.size() > 3 || args.size() < 2) {
WrongNumberOfParameters(2);
}
det->setDAC(static_cast<defs::dacIndex>(StringTo<int>(args[0])),
StringTo<int>(args[1]), mv, std::vector<int>{det_id});
os << args[0] << ' ' << args[1] << (args.size() > 2 ? " mV\n" : "\n");
det->setDAC(dacIndex, StringTo<int>(args[1]), mV,
std::vector<int>{det_id});
os << args[0] << ' ' << args[1] << (mV ? " mV\n" : "\n");
} else {
throw sls::RuntimeError("Unknown action");
}
@ -2657,10 +2680,11 @@ std::string CmdProxy::ExecuteCommand(int action) {
} else if (action == defs::GET_ACTION) {
throw sls::RuntimeError("Cannot get.");
} else if (action == defs::PUT_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
std::string command;
for (auto &i: args) {
command += (i + ' ');
}
auto t = det->executeCommand(args[0], std::vector<int>{det_id});
auto t = det->executeCommand(command, std::vector<int>{det_id});
os << OutString(t) << '\n';
} else {
throw sls::RuntimeError("Unknown action");

View File

@ -318,46 +318,6 @@
return os.str(); \
}
/** dac */
#define DAC_COMMAND(CMDNAME, GETFCN, SETFCN, DAC_INDEX, HLPSTR) \
std::string CMDNAME(const int action) { \
std::ostringstream os; \
os << cmd << ' '; \
if (action == slsDetectorDefs::HELP_ACTION) \
os << HLPSTR << '\n'; \
else if (action == slsDetectorDefs::GET_ACTION) { \
bool mv = false; \
if (args.size() == 1) { \
if ((args[0] != "mv") && (args[0] != "mV")) { \
throw sls::RuntimeError("Unknown argument " + args[0] + \
". Did you mean mV?"); \
} \
mv = true; \
} else if (args.size() > 1) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN(DAC_INDEX, mv, std::vector<int>{det_id}); \
os << OutString(t) << (!args.empty() ? " mV\n" : "\n"); \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
bool mv = false; \
if (args.size() == 2) { \
if ((args[1] != "mv") && (args[1] != "mV")) { \
throw sls::RuntimeError("Unknown argument " + args[1] + \
". Did you mean mV?"); \
} \
mv = true; \
} else if (args.size() > 2 || args.empty()) { \
WrongNumberOfParameters(1); \
} \
det->SETFCN(DAC_INDEX, StringTo<int>(args[0]), mv, \
std::vector<int>{det_id}); \
os << args.front() << (args.size() > 1 ? " mV\n" : "\n"); \
} else { \
throw sls::RuntimeError("Unknown action"); \
} \
return os.str(); \
}
/** set only, no arguments, no id */
#define EXECUTE_SET_COMMAND_NOID(CMDNAME, SETFCN, HLPSTR) \
std::string CMDNAME(const int action) { \
@ -615,7 +575,7 @@ class CmdProxy {
/** temperature */
/** dacs */
/** super old dacs */
{"vtr", "vtrim"},
{"vrf", "vrpreamp"},
{"vrs", "vrshaper"},
@ -627,6 +587,70 @@ class CmdProxy {
{"viinsh", "vishaper"},
{"vpl", "vcal_n"},
{"vph", "vcal_p"},
/** dacs */
{"vthreshold", "dac"},
{"vsvp", "dac"},
{"vsvn", "dac"},
{"vtrim", "dac"},
{"vrpreamp", "dac"},
{"vrshaper", "dac"},
{"vtgstv", "dac"},
{"vcmp_ll", "dac"},
{"vcmp_lr", "dac"},
{"vcal", "dac"},
{"vcmp_rl", "dac"},
{"vcmp_rr", "dac"},
{"rxb_rb", "dac"},
{"rxb_lb", "dac"},
{"vcp", "dac"},
{"vcn", "dac"},
{"vishaper", "dac"},
{"iodelay", "dac"},
{"vref_ds", "dac"},
{"vcascn_pb", "dac"},
{"vcascp_pb", "dac"},
{"vout_cm", "dac"},
{"vcasc_out", "dac"},
{"vin_cm", "dac"},
{"vref_comp", "dac"},
{"ib_test_c", "dac"},
{"vrshaper_n", "dac"},
{"vipre", "dac"},
{"vdcsh", "dac"},
{"vth1", "dac"},
{"vth2", "dac"},
{"vth3", "dac"},
{"vcal_n", "dac"},
{"vcal_p", "dac"},
{"vcassh", "dac"},
{"vcas", "dac"},
{"vicin", "dac"},
{"vipre_out", "dac"},
{"vref_h_adc", "dac"},
{"vb_comp_fe", "dac"},
{"vb_comp_adc", "dac"},
{"vcom_cds", "dac"},
{"vref_rstore", "dac"},
{"vb_opa_1st", "dac"},
{"vref_comp_fe", "dac"},
{"vcom_adc1", "dac"},
{"vref_prech", "dac"},
{"vref_l_adc", "dac"},
{"vref_cds", "dac"},
{"vb_cs", "dac"},
{"vb_opa_fd", "dac"},
{"vcom_adc2", "dac"},
{"adcvpp", "dac"},
{"vb_ds", "dac"},
{"vb_comp", "dac"},
{"vb_pixbuf", "dac"},
{"vin_com", "dac"},
{"vdd_prot", "dac"},
{"vbp_colbuf", "dac"},
{"vb_sda", "dac"},
{"vcasc_sfp", "dac"},
{"vipre_cds", "dac"},
{"ibias_sfp", "dac"},
/* acquisition */
{"busy", "clearbusy"},
@ -764,70 +788,6 @@ class CmdProxy {
{"temp_slowadc", &CmdProxy::temp_slowadc},
/* dacs */
{"vthreshold", &CmdProxy::vthreshold},
{"vsvp", &CmdProxy::vsvp},
{"vsvn", &CmdProxy::vsvn},
{"vtrim", &CmdProxy::vtrim},
{"vrpreamp", &CmdProxy::vrpreamp},
{"vrshaper", &CmdProxy::vrshaper},
{"vtgstv", &CmdProxy::vtgstv},
{"vcmp_ll", &CmdProxy::vcmp_ll},
{"vcmp_lr", &CmdProxy::vcmp_lr},
{"vcal", &CmdProxy::vcal},
{"vcmp_rl", &CmdProxy::vcmp_rl},
{"vcmp_rr", &CmdProxy::vcmp_rr},
{"rxb_rb", &CmdProxy::rxb_rb},
{"rxb_lb", &CmdProxy::rxb_lb},
{"vcp", &CmdProxy::vcp},
{"vcn", &CmdProxy::vcn},
{"vishaper", &CmdProxy::vishaper},
{"iodelay", &CmdProxy::iodelay},
{"vref_ds", &CmdProxy::vref_ds},
{"vcascn_pb", &CmdProxy::vcascn_pb},
{"vcascp_pb", &CmdProxy::vcascp_pb},
{"vout_cm", &CmdProxy::vout_cm},
{"vcasc_out", &CmdProxy::vcasc_out},
{"vin_cm", &CmdProxy::vin_cm},
{"vref_comp", &CmdProxy::vref_comp},
{"ib_test_c", &CmdProxy::ib_test_c},
{"vrshaper_n", &CmdProxy::vrshaper_n},
{"vipre", &CmdProxy::vipre},
{"vdcsh", &CmdProxy::vdcsh},
{"vth1", &CmdProxy::vth1},
{"vth2", &CmdProxy::vth2},
{"vth3", &CmdProxy::vth3},
{"vcal_n", &CmdProxy::vcal_n},
{"vcal_p", &CmdProxy::vcal_p},
{"vcassh", &CmdProxy::vcassh},
{"vcas", &CmdProxy::vcas},
{"vicin", &CmdProxy::vicin},
{"vipre_out", &CmdProxy::vipre_out},
{"vref_h_adc", &CmdProxy::vref_h_adc},
{"vb_comp_fe", &CmdProxy::vb_comp_fe},
{"vb_comp_adc", &CmdProxy::vb_comp_adc},
{"vcom_cds", &CmdProxy::vcom_cds},
{"vref_rstore", &CmdProxy::vref_rstore},
{"vb_opa_1st", &CmdProxy::vb_opa_1st},
{"vref_comp_fe", &CmdProxy::vref_comp_fe},
{"vcom_adc1", &CmdProxy::vcom_adc1},
{"vref_prech", &CmdProxy::vref_prech},
{"vref_l_adc", &CmdProxy::vref_l_adc},
{"vref_cds", &CmdProxy::vref_cds},
{"vb_cs", &CmdProxy::vb_cs},
{"vb_opa_fd", &CmdProxy::vb_opa_fd},
{"vcom_adc2", &CmdProxy::vcom_adc2},
{"adcvpp", &CmdProxy::adcvpp},
{"vb_ds", &CmdProxy::vb_ds},
{"vb_comp", &CmdProxy::vb_comp},
{"vb_pixbuf", &CmdProxy::vb_pixbuf},
{"vin_com", &CmdProxy::vin_com},
{"vdd_prot", &CmdProxy::vdd_prot},
{"vbp_colbuf", &CmdProxy::vbp_colbuf},
{"vb_sda", &CmdProxy::vb_sda},
{"vcasc_sfp", &CmdProxy::vcasc_sfp},
{"vipre_cds", &CmdProxy::vipre_cds},
{"ibias_sfp", &CmdProxy::ibias_sfp},
{"dac", &CmdProxy::Dac},
{"daclist", &CmdProxy::daclist},
{"dacvalues", &CmdProxy::DacValues},
@ -947,6 +907,7 @@ class CmdProxy {
/* Gotthard2 Specific */
{"bursts", &CmdProxy::bursts},
{"burstperiod", &CmdProxy::burstperiod},
{"burstsl", &CmdProxy::burstsl},
{"inj_ch", &CmdProxy::InjectChannel},
{"vetophoton", &CmdProxy::VetoPhoton},
{"vetoref", &CmdProxy::VetoReference},
@ -1249,12 +1210,12 @@ class CmdProxy {
GET_COMMAND(framesl, getNumberOfFramesLeft,
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] "
"Number of frames left in acquisition."
"\n\t[Gotthard2] only in continuous mode.");
"\n\t[Gotthard2] only in continuous auto mode.");
GET_COMMAND(triggersl, getNumberOfTriggersLeft,
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] "
"Number of triggers left in acquisition."
"\n\t[Gotthard2] only in continuous mode.");
"Number of triggers left in acquisition. Only when external "
"trigger used.");
TIME_GET_COMMAND(delayl, getDelayAfterTriggerLeft,
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench]"
@ -1365,269 +1326,6 @@ class CmdProxy {
/* dacs */
DAC_COMMAND(
vthreshold, getDAC, setDAC, defs::VTHRESHOLD,
"[dac or mV value][(optional unit) mV] \n\t[Eiger][Mythen3] "
"Detector threshold voltage for single photon counters.\n\t[Eiger] "
"Sets vcmp_ll, vcmp_lr, vcmp_rl, vcmp_rr and vcp to the same value. "
"\n\t[Mythen3] Sets vth1, vth2 and vth3 to the same value.");
DAC_COMMAND(vsvp, getDAC, setDAC, defs::VSVP,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vsvn, getDAC, setDAC, defs::VSVN,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? \n\t[Mythen3] voltage "
"to define feedback resistance of the first shaper"); // TODO
DAC_COMMAND(vtrim, getDAC, setDAC, defs::VTRIM,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? \n\t[Mythen3] Dac for "
"the voltage defining the trim bit size."); // TODO
DAC_COMMAND(vrpreamp, getDAC, setDAC, defs::VRPREAMP,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? \n\t[Mythen3] voltage "
"to define the preamplifier feedback resistance."); // TODO
DAC_COMMAND(vrshaper, getDAC, setDAC, defs::VRSHAPER,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? \n\t[Mythen3] voltage to define feedback resistance of "
"the first shaper"); // TODO
DAC_COMMAND(vtgstv, getDAC, setDAC, defs::VTGSTV,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vcmp_ll, getDAC, setDAC, defs::VCMP_LL,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vcmp_lr, getDAC, setDAC, defs::VCMP_LR,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vcal, getDAC, setDAC, defs::VCAL,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vcmp_rl, getDAC, setDAC, defs::VCMP_RL,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vcmp_rr, getDAC, setDAC, defs::VCMP_RR,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(rxb_rb, getDAC, setDAC, defs::RXB_RB,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(rxb_lb, getDAC, setDAC, defs::RXB_LB,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vcp, getDAC, setDAC, defs::VCP,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vcn, getDAC, setDAC, defs::VCN,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vishaper, getDAC, setDAC, defs::VISHAPER,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? \n\t[Mythen3] Dac for "
"the bias current for the shaper."); // TODO
DAC_COMMAND(iodelay, getDAC, setDAC, defs::IO_DELAY,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO
DAC_COMMAND(vref_ds, getDAC, setDAC, defs::VREF_DS,
"[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard][Jungfrau] Dac for ?? "); // TODO
DAC_COMMAND(vcascn_pb, getDAC, setDAC, defs::VCASCN_PB,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for "
"?? "); // TODO
DAC_COMMAND(vcascp_pb, getDAC, setDAC, defs::VCASCP_PB,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for "
"?? "); // TODO
DAC_COMMAND(vout_cm, getDAC, setDAC, defs::VOUT_CM,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for "
"?? \n\t[Moench] Dac for 5"); // TODO
DAC_COMMAND(vcasc_out, getDAC, setDAC, defs::VCASC_OUT,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for "
"?? "); // TODO
DAC_COMMAND(vin_cm, getDAC, setDAC, defs::VIN_CM,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for "
"?? \n\t[Moench] Dac for 2"); // TODO
DAC_COMMAND(vref_comp, getDAC, setDAC, defs::VREF_COMP,
"[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard][Jungfrau] Dac for ?? "); // TODO
DAC_COMMAND(ib_test_c, getDAC, setDAC, defs::IB_TESTC,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for "
"?? "); // TODO
DAC_COMMAND(vrshaper_n, getDAC, setDAC, defs::VRSHAPER_N,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] voltage "
"to define feedback resistance of the second shaper.");
DAC_COMMAND(
vipre, getDAC, setDAC, defs::VIPRE,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"preamplifier's input transistor current.\n\t[Moench] Dac for 1");
DAC_COMMAND(vdcsh, getDAC, setDAC, defs::VDCSH,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"the reference (DC) voltage for the shaper.");
DAC_COMMAND(vth1, getDAC, setDAC, defs::VTH1,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"first detector threshold voltage.");
DAC_COMMAND(vth2, getDAC, setDAC, defs::VTH2,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"second detector threshold voltage.");
DAC_COMMAND(vth3, getDAC, setDAC, defs::VTH3,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"third detector threshold voltage.");
DAC_COMMAND(vcal_n, getDAC, setDAC, defs::VCAL_N,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"the low voltage for analog pulsing.");
DAC_COMMAND(vcal_p, getDAC, setDAC, defs::VCAL_P,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"the high voltage for analog pulsing.");
DAC_COMMAND(vcassh, getDAC, setDAC, defs::VCASSH,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"the shaper's cascode voltage.");
DAC_COMMAND(vcas, getDAC, setDAC, defs::VCAS,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"the preamplifier's cascode voltage.");
DAC_COMMAND(vicin, getDAC, setDAC, defs::VICIN,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"the bias current for the comparator.");
DAC_COMMAND(vipre_out, getDAC, setDAC, defs::VIPRE_OUT,
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"preamplifier's output transistor current."); // TODO
DAC_COMMAND(vref_h_adc, getDAC, setDAC, defs::VREF_H_ADC,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage high of ADC.");
DAC_COMMAND(vb_comp_fe, getDAC, setDAC, defs::VB_COMP_FE,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"comparator current of analogue front end.");
DAC_COMMAND(vb_comp_adc, getDAC, setDAC, defs::VB_COMP_ADC,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"comparator current of ADC.");
DAC_COMMAND(vcom_cds, getDAC, setDAC, defs::VCOM_CDS,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"common mode voltage of CDS stage.");
DAC_COMMAND(
vref_rstore, getDAC, setDAC, defs::VREF_RSTORE,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference charging voltage of temparory storage cell in high gain.");
DAC_COMMAND(vb_opa_1st, getDAC, setDAC, defs::VB_OPA_1ST,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] dac dac "
"for opa current for driving the other DACs in chip.");
DAC_COMMAND(vref_comp_fe, getDAC, setDAC, defs::VREF_COMP_FE,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage of the comparator of analogue front end.");
DAC_COMMAND(vcom_adc1, getDAC, setDAC, defs::VCOM_ADC1,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"common mode voltage of ADC DAC bank 1.");
DAC_COMMAND(
vref_prech, getDAC, setDAC, defs::VREF_PRECH,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2][Jungfrau] Dac "
"for reference votlage for precharing the preamplifier."); // TODO also
// for
// jungfrau?
DAC_COMMAND(vref_l_adc, getDAC, setDAC, defs::VREF_L_ADC,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage low for ADC.");
DAC_COMMAND(vref_cds, getDAC, setDAC, defs::VREF_CDS,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage of CDS applied to the temporary storage "
"cell in medium and low gain.");
DAC_COMMAND(vb_cs, getDAC, setDAC, defs::VB_CS,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"current injection into preamplifier.");
DAC_COMMAND(vb_opa_fd, getDAC, setDAC, defs::VB_OPA_FD,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"current for CDS opa stage.");
DAC_COMMAND(vcom_adc2, getDAC, setDAC, defs::VCOM_ADC2,
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"common mode voltage of ADC DAC bank 2.");
DAC_COMMAND(
adcvpp, getDAC, setDAC, defs::ADC_VPP,
"[dac or mV value][(optional unit) mV] \n\t[Ctb][Moench] Vpp of "
"ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> 2V. "
"\n\tAdvanced User function! ");
DAC_COMMAND(vb_ds, getDAC, setDAC, defs::VB_DS,
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for "
"??"); // TODO
DAC_COMMAND(vb_comp, getDAC, setDAC, defs::VB_COMP,
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for "
"??"); // TODO
DAC_COMMAND(vb_pixbuf, getDAC, setDAC, defs::VB_PIXBUF,
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for "
"??"); // TODO
DAC_COMMAND(vin_com, getDAC, setDAC, defs::VIN_COM,
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for "
"??"); // TODO
DAC_COMMAND(vdd_prot, getDAC, setDAC, defs::VDD_PROT,
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for "
"??"); // TODO
DAC_COMMAND(vbp_colbuf, getDAC, setDAC, defs::VBP_COLBUF,
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 0");
DAC_COMMAND(vb_sda, getDAC, setDAC, defs::VB_SDA,
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 3");
DAC_COMMAND(vcasc_sfp, getDAC, setDAC, defs::VCASC_SFP,
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 4");
DAC_COMMAND(vipre_cds, getDAC, setDAC, defs::VIPRE_CDS,
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 6");
DAC_COMMAND(ibias_sfp, getDAC, setDAC, defs::IBIAS_SFP,
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 7");
GET_COMMAND_NOID(
daclist, getDacList,
"\n\tGets the list of commands for every dac for this detector.");
@ -1870,9 +1568,9 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID(
rx_udpsocksize, getRxUDPSocketBufferSize, setRxUDPSocketBufferSize,
StringTo<int64_t>,
StringTo<int>,
"[n_size]\n\tUDP socket buffer size in receiver. Tune rmem_default and "
"rmem_max accordingly.");
"rmem_max accordingly. Max value is INT_MAX/2.");
GET_COMMAND(rx_realudpsocksize, getRxRealUDPSocketBufferSize,
"\n\tActual udp socket buffer size. Double the size of "
@ -2116,6 +1814,10 @@ class CmdProxy {
"[duration] [(optional unit) ns|us|ms|s]\n\t[Gotthard2] "
"Period between 2 bursts. Only in burst mode and auto timing mode.");
GET_COMMAND(burstsl, getNumberOfBurstsLeft,
"\n\t[Gotthard2] Number of bursts left in acquisition. Only in "
"burst auto mode.");
INTEGER_COMMAND_VEC_ID(
cdsgain, getCDSGain, setCDSGain, StringTo<bool>,
"[0, 1]\n\t[Gotthard2] Enable or disable CDS gain. Default "

View File

@ -907,16 +907,16 @@ void Detector::setPartialFramesPadding(bool value, Positions pos) {
pimpl->Parallel(&Module::setPartialFramesPadding, pos, value);
}
Result<int64_t> Detector::getRxUDPSocketBufferSize(Positions pos) const {
Result<int> Detector::getRxUDPSocketBufferSize(Positions pos) const {
return pimpl->Parallel(&Module::getReceiverUDPSocketBufferSize, pos);
}
void Detector::setRxUDPSocketBufferSize(int64_t udpsockbufsize, Positions pos) {
void Detector::setRxUDPSocketBufferSize(int udpsockbufsize, Positions pos) {
pimpl->Parallel(&Module::setReceiverUDPSocketBufferSize, pos,
udpsockbufsize);
}
Result<int64_t> Detector::getRxRealUDPSocketBufferSize(Positions pos) const {
Result<int> Detector::getRxRealUDPSocketBufferSize(Positions pos) const {
return pimpl->Parallel(&Module::getReceiverRealUDPSocketBufferSize, pos);
}
@ -1353,6 +1353,10 @@ void Detector::setBurstPeriod(ns value, Positions pos) {
pimpl->Parallel(&Module::setBurstPeriod, pos, value.count());
}
Result<int64_t> Detector::getNumberOfBurstsLeft(Positions pos) const {
return pimpl->Parallel(&Module::getNumberOfBurstsLeft, pos);
}
Result<std::array<int, 2>> Detector::getInjectChannel(Positions pos) {
return pimpl->Parallel(&Module::getInjectChannel, pos);
}

View File

@ -0,0 +1,302 @@
#include "string_utils.h"
std::string GetHelpDac(std::string dac) {
if (sls::is_int(dac)) {
return std::string("[dac name] [dac or mV value] [(optional unit) mV] "
"\n\t[Ctb] Use dac index for dac name.");
}
if (dac == "vthreshold") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger][Mythen3] "
"Detector threshold voltage for single photon counters.\n\t[Eiger] "
"Sets vcmp_ll, vcmp_lr, vcmp_rl, vcmp_rr and vcp to the same "
"value. \n\t[Mythen3] Sets vth1, vth2 and vth3 to the same value.");
}
if (dac == "vsvp") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ?? ");
}
if (dac == "vsvn") {
return std::string("[dac or mV value][(optional unit) mV] \n\t[Eiger] "
"Dac for ?? \n\t[Mythen3] voltage to define "
"feedback resistance of the first shaper");
}
if (dac == "vtrim") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ?? "
"\n\t[Mythen3] Dac for the voltage defining the trim bit size.");
}
if (dac == "vrpreamp") {
return std::string("[dac or mV value][(optional unit) mV] \n\t[Eiger] "
"Dac for ?? \n\t[Mythen3] voltage to define the "
"preamplifier feedback resistance.");
}
if (dac == "vrshaper") {
return std::string("[dac or mV value][(optional unit) mV] \n\t[Eiger] "
"Dac for ?? \n\t[Mythen3] voltage to define "
"feedback resistance of the first shaper");
}
if (dac == "vtgstv") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcmp_ll") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcmp_lr") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcal") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcmp_rl") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcmp_rr") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "rxb_rb") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "rxb_lb") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcp") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vcn") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vishaper") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "iodelay") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
}
if (dac == "vref_ds") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard][Jungfrau] Dac for ??");
}
if (dac == "vcascn_pb") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
}
if (dac == "vcascp_pb") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
}
if (dac == "vout_cm") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard] Dac for ??\n\t[Moench] Dac for 5");
}
if (dac == "vcasc_out") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
}
if (dac == "vin_cm") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard] Dac for ??\n\t[Moench] Dac for 2");
}
if (dac == "vref_comp") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard][Jungfrau] Dac for ??");
}
if (dac == "ib_test_c") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
}
if (dac == "vrshaper_n") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] voltage to "
"define feedback resistance of the second shaper.");
}
if (dac == "vipre") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"preamplifier's input transistor current.\n\t[Moench] Dac for 1");
}
if (dac == "vdcsh") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"reference (DC) voltage for the shaper.");
}
if (dac == "vth1") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for first "
"detector threshold voltage.");
}
if (dac == "vth2") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"second detector threshold voltage.");
}
if (dac == "vth3") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for third "
"detector threshold voltage.");
}
if (dac == "vcal_n") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"low voltage for analog pulsing.");
}
if (dac == "vcal_p") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"high voltage for analog pulsing.");
}
if (dac == "vcassh") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"shaper's cascode voltage.");
}
if (dac == "vcas") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"preamplifier's cascode voltage.");
}
if (dac == "vicin") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"bias current for the comparator.");
}
if (dac == "vipre_out") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"preamplifier's output transistor current.");
}
if (dac == "vref_h_adc") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage high of ADC.");
}
if (dac == "vb_comp_fe") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"comparator current of analogue front end.");
}
if (dac == "vb_comp_adc") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"comparator current of ADC.");
}
if (dac == "vcom_cds") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"common mode voltage of CDS stage.");
}
if (dac == "vref_rstore") {
return std::string("[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard2] Dac for reference charging voltage "
"of temparory storage cell in high gain.");
}
if (dac == "vb_opa_1st") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] dac dac for "
"opa current for driving the other DACs in chip.");
}
if (dac == "vref_comp_fe") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage of the comparator of analogue front end.");
}
if (dac == "vcom_adc1") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"common mode voltage of ADC DAC bank 1.");
}
if (dac == "vref_prech") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2][Jungfrau] "
"Dac for reference votlage for precharing the preamplifier.");
}
if (dac == "vref_l_adc") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage low for ADC.");
}
if (dac == "vref_cds") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage of CDS applied to the temporary storage cell in "
"medium and low gain.");
}
if (dac == "vb_cs") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"current injection into preamplifier.");
}
if (dac == "vb_opa_fd") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"current for CDS opa stage.");
}
if (dac == "vcom_adc2") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"common mode voltage of ADC DAC bank 2.");
}
if (dac == "adcvpp") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Ctb][Moench] Vpp of "
"ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> 2V. "
"\n\tAdvanced User function! ");
}
if (dac == "vb_ds") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for ??");
}
if (dac == "vb_comp") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for ??");
}
if (dac == "vb_pixbuf") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for ??");
}
if (dac == "vin_com") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for ??");
}
if (dac == "vdd_prot") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for ??");
}
if (dac == "vbp_colbuf") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 0");
}
if (dac == "vb_sda") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 3");
}
if (dac == "vcasc_sfp") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 4");
}
if (dac == "vipre_cds") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 6");
}
if (dac == "ibias_sfp") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 7");
}
// clang-format off
if (dac == "vtgstv") { return std::string(""); }
// clang-format on
throw sls::RuntimeError("Unknown dac command");
}

View File

@ -844,17 +844,17 @@ void Module::setPartialFramesPadding(bool padding) {
sendToReceiver(F_SET_RECEIVER_PADDING, static_cast<int>(padding), nullptr);
}
int64_t Module::getReceiverUDPSocketBufferSize() const {
int64_t arg = GET_FLAG;
return sendToReceiver<int64_t>(F_RECEIVER_UDP_SOCK_BUF_SIZE, arg);
int Module::getReceiverUDPSocketBufferSize() const {
int arg = GET_FLAG;
return sendToReceiver<int>(F_RECEIVER_UDP_SOCK_BUF_SIZE, arg);
}
int64_t Module::getReceiverRealUDPSocketBufferSize() const {
return sendToReceiver<int64_t>(F_RECEIVER_REAL_UDP_SOCK_BUF_SIZE);
int Module::getReceiverRealUDPSocketBufferSize() const {
return sendToReceiver<int>(F_RECEIVER_REAL_UDP_SOCK_BUF_SIZE);
}
void Module::setReceiverUDPSocketBufferSize(int64_t udpsockbufsize) {
sendToReceiver<int64_t>(F_RECEIVER_UDP_SOCK_BUF_SIZE, udpsockbufsize);
void Module::setReceiverUDPSocketBufferSize(int udpsockbufsize) {
sendToReceiver<int>(F_RECEIVER_UDP_SOCK_BUF_SIZE, udpsockbufsize);
}
bool Module::getReceiverLock() const {
@ -1355,6 +1355,10 @@ void Module::setBurstPeriod(int64_t value) {
sendToDetector(F_SET_BURST_PERIOD, value, nullptr);
}
int64_t Module::getNumberOfBurstsLeft() const {
return sendToDetectorStop<int64_t>(F_GET_BURSTS_LEFT);
}
std::array<int, 2> Module::getInjectChannel() const {
return sendToDetector<std::array<int, 2>>(F_GET_INJECT_CHANNEL);
}

View File

@ -236,9 +236,9 @@ class Module : public virtual slsDetectorDefs {
void setReceiverFramesDiscardPolicy(frameDiscardPolicy f);
bool getPartialFramesPadding() const;
void setPartialFramesPadding(bool padding);
int64_t getReceiverUDPSocketBufferSize() const;
int64_t getReceiverRealUDPSocketBufferSize() const;
void setReceiverUDPSocketBufferSize(int64_t udpsockbufsize);
int getReceiverUDPSocketBufferSize() const;
int getReceiverRealUDPSocketBufferSize() const;
void setReceiverUDPSocketBufferSize(int udpsockbufsize);
bool getReceiverLock() const;
void setReceiverLock(bool lock);
sls::IpAddr getReceiverLastClientIP() const;
@ -372,6 +372,7 @@ class Module : public virtual slsDetectorDefs {
void setNumberOfBursts(int64_t value);
int64_t getBurstPeriod() const;
void setBurstPeriod(int64_t value);
int64_t getNumberOfBurstsLeft() const;
std::array<int, 2> getInjectChannel() const;
void setInjectChannel(const int offsetChannel, const int incrementChannel);
void sendVetoPhoton(const int chipIndex,

View File

@ -284,6 +284,17 @@ TEST_CASE("burstperiod", "[.cmd][.new]") {
}
}
TEST_CASE("burstsl", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::GOTTHARD2) {
REQUIRE_NOTHROW(proxy.Call("burstsl", {}, -1, GET));
} else {
REQUIRE_THROWS(proxy.Call("burstsl", {}, -1, GET));
}
}
TEST_CASE("inj_ch", "[.cmd][.new]") {
Detector det;
CmdProxy proxy(&det);

View File

@ -12,6 +12,7 @@
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <limits.h>
#include <map>
#include <memory>
#include <sstream>
@ -1138,15 +1139,22 @@ int ClientInterface::get_additional_json_header(Interface &socket) {
}
int ClientInterface::set_udp_socket_buffer_size(Interface &socket) {
auto index = socket.Receive<int64_t>();
if (index >= 0) {
verifyIdle(socket);
LOG(logDEBUG1) << "Setting UDP Socket Buffer size: " << index;
impl()->setUDPSocketBufferSize(index);
auto size = socket.Receive<int>();
if (size == 0) {
throw RuntimeError("Receiver socket buffer size must be > 0.");
}
int64_t retval = impl()->getUDPSocketBufferSize();
if (index != 0)
validate(index, retval,
if (size > 0) {
verifyIdle(socket);
if (size > INT_MAX / 2) {
throw RuntimeError(
"Receiver socket buffer size exceeded max (INT_MAX/2)");
}
LOG(logDEBUG1) << "Setting UDP Socket Buffer size: " << size;
impl()->setUDPSocketBufferSize(size);
}
int retval = impl()->getUDPSocketBufferSize();
if (size != 0)
validate(size, retval,
"set udp socket buffer size (No CAP_NET_ADMIN privileges?)",
DEC);
LOG(logDEBUG1) << "UDP Socket Buffer Size:" << retval;

View File

@ -167,11 +167,10 @@ void Implementation::setDetectorType(const detectorType d) {
&activated, &deactivatedPaddingEnable, &silentMode));
dataProcessor.push_back(sls::make_unique<DataProcessor>(
i, myDetectorType, fifo_ptr, &fileFormatType, fileWriteEnable,
&masterFileWriteEnable, &dataStreamEnable,
&streamingFrequency, &streamingTimerInMs, &streamingStartFnum,
&framePadding, &activated, &deactivatedPaddingEnable,
&silentMode, &ctbDbitList, &ctbDbitOffset,
&ctbAnalogDataBytes));
&masterFileWriteEnable, &dataStreamEnable, &streamingFrequency,
&streamingTimerInMs, &streamingStartFnum, &framePadding,
&activated, &deactivatedPaddingEnable, &silentMode,
&ctbDbitList, &ctbDbitOffset, &ctbAnalogDataBytes));
} catch (...) {
listener.clear();
dataProcessor.clear();
@ -841,10 +840,10 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
auto fifo_ptr = fifo[i].get();
listener.push_back(sls::make_unique<Listener>(
i, myDetectorType, fifo_ptr, &status, &udpPortNum[i],
&eth[i], &numberOfTotalFrames,
&udpSocketBufferSize, &actualUDPSocketBufferSize,
&framesPerFile, &frameDiscardMode, &activated,
&deactivatedPaddingEnable, &silentMode));
&eth[i], &numberOfTotalFrames, &udpSocketBufferSize,
&actualUDPSocketBufferSize, &framesPerFile,
&frameDiscardMode, &activated, &deactivatedPaddingEnable,
&silentMode));
listener[i]->SetGeneralData(generalData);
dataProcessor.push_back(sls::make_unique<DataProcessor>(
@ -852,8 +851,8 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
fileWriteEnable, &masterFileWriteEnable, &dataStreamEnable,
&streamingFrequency, &streamingTimerInMs,
&streamingStartFnum, &framePadding, &activated,
&deactivatedPaddingEnable, &silentMode,
&ctbDbitList, &ctbDbitOffset, &ctbAnalogDataBytes));
&deactivatedPaddingEnable, &silentMode, &ctbDbitList,
&ctbDbitOffset, &ctbAnalogDataBytes));
dataProcessor[i]->SetGeneralData(generalData);
} catch (...) {
listener.clear();
@ -947,12 +946,14 @@ void Implementation::setUDPPortNumber2(const uint32_t i) {
LOG(logINFO) << "UDP Port Number[1]: " << udpPortNum[1];
}
int64_t Implementation::getUDPSocketBufferSize() const {
int Implementation::getUDPSocketBufferSize() const {
return udpSocketBufferSize;
}
void Implementation::setUDPSocketBufferSize(const int64_t s) {
int64_t size = (s == 0) ? udpSocketBufferSize : s;
void Implementation::setUDPSocketBufferSize(const int s) {
// custom setup is not 0 (must complain if set up didnt work)
// testing default setup at startup, argument is 0 to use default values
int size = (s == 0) ? udpSocketBufferSize : s;
size_t listSize = listener.size();
if (myDetectorType == JUNGFRAU && (int)listSize != numUDPInterfaces) {
throw sls::RuntimeError(
@ -960,12 +961,17 @@ void Implementation::setUDPSocketBufferSize(const int64_t s) {
" do not match listener size " + std::to_string(listSize));
}
for (unsigned int i = 0; i < listSize; ++i) {
listener[i]->CreateDummySocketForUDPSocketBufferSize(size);
for (auto &l : listener) {
l->CreateDummySocketForUDPSocketBufferSize(size);
}
// custom and didnt set, throw error
if (s != 0 && udpSocketBufferSize != s) {
throw sls::RuntimeError("Could not set udp socket buffer size. (No "
"CAP_NET_ADMIN privileges?)");
}
}
int64_t Implementation::getActualUDPSocketBufferSize() const {
int Implementation::getActualUDPSocketBufferSize() const {
return actualUDPSocketBufferSize;
}
@ -1123,18 +1129,31 @@ void Implementation::setAdditionalJsonParameter(const std::string &key,
* ************************************************/
void Implementation::updateTotalNumberOfFrames() {
int64_t repeats = numberOfTriggers;
// gotthard2: auto mode
// burst mode: (bursts instead of triggers)
// continuous mode: no bursts or triggers
if (myDetectorType == GOTTHARD2 && timingMode == AUTO_TIMING) {
if (burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) {
repeats = numberOfBursts;
} else {
repeats = 1;
int64_t numFrames = numberOfFrames;
// gotthard2
if (myDetectorType == GOTTHARD2) {
// auto
if (timingMode == AUTO_TIMING) {
// burst mode, repeats = #bursts
if (burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) {
repeats = numberOfBursts;
}
// continuous, repeats = 1 (no trigger as well)
else {
repeats = 1;
}
}
// trigger
else {
// continuous, numFrames is limited
if (burstMode == CONTINUOUS_INTERNAL ||
burstMode == CONTINUOUS_EXTERNAL) {
numFrames = 1;
}
}
}
numberOfTotalFrames = numberOfFrames * repeats *
(int64_t)(numberOfAdditionalStorageCells + 1);
numberOfTotalFrames =
numFrames * repeats * (int64_t)(numberOfAdditionalStorageCells + 1);
if (numberOfTotalFrames == 0) {
throw sls::RuntimeError("Invalid total number of frames to receive: 0");
}

View File

@ -108,9 +108,9 @@ class Implementation : private virtual slsDetectorDefs {
uint32_t getUDPPortNumber2() const;
/* [Eiger][Jungfrau] */
void setUDPPortNumber2(const uint32_t i);
int64_t getUDPSocketBufferSize() const;
void setUDPSocketBufferSize(const int64_t s);
int64_t getActualUDPSocketBufferSize() const;
int getUDPSocketBufferSize() const;
void setUDPSocketBufferSize(const int s);
int getActualUDPSocketBufferSize() const;
/**************************************************
* *
@ -302,8 +302,8 @@ class Implementation : private virtual slsDetectorDefs {
std::array<std::string, MAX_NUMBER_OF_LISTENING_THREADS> eth;
std::array<uint32_t, MAX_NUMBER_OF_LISTENING_THREADS> udpPortNum{
{DEFAULT_UDP_PORTNO, DEFAULT_UDP_PORTNO + 1}};
int64_t udpSocketBufferSize{0};
int64_t actualUDPSocketBufferSize{0};
int udpSocketBufferSize{0};
int actualUDPSocketBufferSize{0};
// zmq parameters
bool dataStreamEnable{false};

View File

@ -21,14 +21,12 @@ const std::string Listener::TypeName = "Listener";
Listener::Listener(int ind, detectorType dtype, Fifo *f,
std::atomic<runStatus> *s, uint32_t *portno, std::string *e,
uint64_t *nf, int64_t *us, int64_t *as,
uint32_t *fpf, frameDiscardPolicy *fdp, bool *act,
bool *depaden, bool *sm)
uint64_t *nf, int *us, int *as, uint32_t *fpf,
frameDiscardPolicy *fdp, bool *act, bool *depaden, bool *sm)
: ThreadObject(ind, TypeName), fifo(f), myDetectorType(dtype), status(s),
udpPortNumber(portno), eth(e), numImages(nf),
udpSocketBufferSize(us), actualUDPSocketBufferSize(as),
framesPerFile(fpf), frameDiscardMode(fdp), activated(act),
deactivatedPaddingEnable(depaden), silentMode(sm) {
udpPortNumber(portno), eth(e), numImages(nf), udpSocketBufferSize(us),
actualUDPSocketBufferSize(as), framesPerFile(fpf), frameDiscardMode(fdp),
activated(act), deactivatedPaddingEnable(depaden), silentMode(sm) {
LOG(logDEBUG) << "Listener " << ind << " created";
}
@ -142,7 +140,7 @@ void Listener::ShutDownUDPSocket() {
}
}
void Listener::CreateDummySocketForUDPSocketBufferSize(int64_t s) {
void Listener::CreateDummySocketForUDPSocketBufferSize(int s) {
LOG(logINFO) << "Testing UDP Socket Buffer size " << s << " with test port "
<< *udpPortNumber;
@ -151,7 +149,7 @@ void Listener::CreateDummySocketForUDPSocketBufferSize(int64_t s) {
return;
}
int64_t temp = *udpSocketBufferSize;
int temp = *udpSocketBufferSize;
*udpSocketBufferSize = s;
// if eth is mistaken with ip address

View File

@ -41,9 +41,9 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
* @param sm pointer to silent mode
*/
Listener(int ind, detectorType dtype, Fifo *f, std::atomic<runStatus> *s,
uint32_t *portno, std::string *e, uint64_t *nf,
int64_t *us, int64_t *as, uint32_t *fpf, frameDiscardPolicy *fdp,
bool *act, bool *depaden, bool *sm);
uint32_t *portno, std::string *e, uint64_t *nf, int *us, int *as,
uint32_t *fpf, frameDiscardPolicy *fdp, bool *act, bool *depaden,
bool *sm);
/**
* Destructor
@ -98,7 +98,7 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
* to set & get actual buffer size
* @param s UDP socket buffer size to be set
*/
void CreateDummySocketForUDPSocketBufferSize(int64_t s);
void CreateDummySocketForUDPSocketBufferSize(int s);
/**
* Set hard coded (calculated but not from detector) row and column
@ -173,10 +173,10 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
uint64_t *numImages;
/** UDP Socket Buffer Size */
int64_t *udpSocketBufferSize;
int *udpSocketBufferSize;
/** actual UDP Socket Buffer Size (double due to kernel bookkeeping) */
int64_t *actualUDPSocketBufferSize;
int *actualUDPSocketBufferSize;
/** frames per file */
uint32_t *framesPerFile;

View File

@ -14,11 +14,11 @@ class UdpRxSocket {
public:
UdpRxSocket(int port, ssize_t packet_size, const char *hostname = nullptr,
size_t kernel_buffer_size = 0);
int kernel_buffer_size = 0);
~UdpRxSocket();
bool ReceivePacket(char *dst) noexcept;
size_t getBufferSize() const;
void setBufferSize(ssize_t size);
int getBufferSize() const;
void setBufferSize(int size);
ssize_t getPacketSize() const noexcept;
void Shutdown();

View File

@ -213,6 +213,7 @@ enum detFuncs {
F_SET_BAD_CHANNELS,
F_RECONFIGURE_UDP,
F_VALIDATE_UDP_CONFIG,
F_GET_BURSTS_LEFT,
NUM_DET_FUNCTIONS,
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
@ -529,7 +530,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_SET_BAD_CHANNELS: return "F_SET_BAD_CHANNELS";
case F_RECONFIGURE_UDP: return "F_RECONFIGURE_UDP";
case F_VALIDATE_UDP_CONFIG: return "F_VALIDATE_UDP_CONFIG";
case F_GET_BURSTS_LEFT: return "F_GET_BURSTS_LEFT";
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";

View File

@ -51,4 +51,7 @@ implementation should not be used in a performance critical place.
std::vector<std::string> split(const std::string &strToSplit, char delimeter);
std::string RemoveUnit(std::string &str);
bool is_int(const std::string& s);
} // namespace sls

View File

@ -3,11 +3,10 @@
#define APILIB 0x200810
#define APIRECEIVER 0x200810
#define APIGUI 0x200804
#define APICTB 0x200910
#define APIMOENCH 0x200910
#define APIMYTHEN3 0x200923
#define APIGOTTHARD 0x200917
#define APIJUNGFRAU 0x200917
#define APIEIGER 0x200918
#define APIMYTHEN3 0x200923
#define APIGOTTHARD2 0x200924

View File

@ -686,41 +686,41 @@ template <> defs::readoutMode StringTo(const std::string &s) {
}
template <> defs::dacIndex StringTo(const std::string &s) {
if (s == "dac 0")
if (s == "dac 0" || s == "0")
return defs::DAC_0;
if (s == "dac 1")
if (s == "dac 1" || s == "1")
return defs::DAC_1;
if (s == "dac 2")
if (s == "dac 2" || s == "2")
return defs::DAC_2;
if (s == "dac 3")
if (s == "dac 3" || s == "3")
return defs::DAC_3;
if (s == "dac 4")
if (s == "dac 4" || s == "4")
return defs::DAC_4;
if (s == "dac 5")
if (s == "dac 5"|| s == "5")
return defs::DAC_5;
if (s == "dac 6")
if (s == "dac 6"|| s == "6")
return defs::DAC_6;
if (s == "dac 7")
if (s == "dac 7"|| s == "7")
return defs::DAC_7;
if (s == "dac 8")
if (s == "dac 8"|| s == "8")
return defs::DAC_8;
if (s == "dac 9")
if (s == "dac 9"|| s == "9")
return defs::DAC_9;
if (s == "dac 10")
if (s == "dac 10"|| s == "10")
return defs::DAC_10;
if (s == "dac 11")
if (s == "dac 11"|| s == "11")
return defs::DAC_11;
if (s == "dac 12")
if (s == "dac 12"|| s == "12")
return defs::DAC_12;
if (s == "dac 13")
if (s == "dac 13"|| s == "13")
return defs::DAC_13;
if (s == "dac 14")
if (s == "dac 14"|| s == "14")
return defs::DAC_14;
if (s == "dac 15")
if (s == "dac 15"|| s == "15")
return defs::DAC_15;
if (s == "dac 16")
if (s == "dac 16"|| s == "16")
return defs::DAC_16;
if (s == "dac 17")
if (s == "dac 17"|| s == "17")
return defs::DAC_17;
if (s == "vsvp")
return defs::VSVP;

View File

@ -14,7 +14,7 @@
namespace sls {
UdpRxSocket::UdpRxSocket(int port, ssize_t packet_size, const char *hostname,
size_t kernel_buffer_size)
int kernel_buffer_size)
: packet_size_(packet_size) {
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
@ -73,15 +73,15 @@ ssize_t UdpRxSocket::ReceiveDataOnly(char *dst) noexcept {
return r;
}
size_t UdpRxSocket::getBufferSize() const {
size_t ret = 0;
int UdpRxSocket::getBufferSize() const {
int ret = 0;
socklen_t optlen = sizeof(ret);
if (getsockopt(sockfd_, SOL_SOCKET, SO_RCVBUF, &ret, &optlen) == -1)
throw RuntimeError("Could not get socket buffer size");
return ret;
}
void UdpRxSocket::setBufferSize(ssize_t size) {
void UdpRxSocket::setBufferSize(int size) {
if (setsockopt(sockfd_, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)))
throw RuntimeError("Could not set socket buffer size");
}

View File

@ -30,4 +30,10 @@ std::string RemoveUnit(std::string &str) {
return unit;
}
bool is_int(const std::string &s) {
return !s.empty() && std::find_if(s.begin(), s.end(), [](unsigned char c) {
return !std::isdigit(c);
}) == s.end();
}
}; // namespace sls

View File

@ -66,4 +66,14 @@ TEST_CASE("Many characters in a row") {
REQUIRE(std::string(str) == "someeequite::ongstring");
}
TEST_CASE("Check is string is integer"){
REQUIRE(sls::is_int("75"));
REQUIRE(sls::is_int("11675"));
REQUIRE_FALSE(sls::is_int("7.5"));
REQUIRE_FALSE(sls::is_int("hej"));
REQUIRE_FALSE(sls::is_int("7a"));
REQUIRE_FALSE(sls::is_int(""));
}
// TEST_CASE("concat things not being strings")