mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
merge from developer (mythen3 branch)
This commit is contained in:
commit
46daa7e2de
@ -11,6 +11,10 @@ import subprocess
|
||||
|
||||
from parse import remove_comments
|
||||
|
||||
def single_line_enum(line):
|
||||
sub = line[line.find('{')+1:line.find('}')]
|
||||
return sub.strip().split(',')
|
||||
|
||||
def extract_enums(lines):
|
||||
line_iter = iter(lines)
|
||||
enums = {}
|
||||
@ -18,19 +22,26 @@ def extract_enums(lines):
|
||||
m = re.search("(?<=enum )\w+(?= {)", line)
|
||||
if m:
|
||||
enum_name = m.group()
|
||||
# print(enum_name)
|
||||
print(enum_name)
|
||||
# print(line)
|
||||
fields = []
|
||||
while True:
|
||||
l = next(line_iter)
|
||||
if '};' in l:
|
||||
break
|
||||
m = re.search("\w+", l)
|
||||
try:
|
||||
# print('\t', m.group())
|
||||
fields.append(m.group())
|
||||
|
||||
except:
|
||||
pass
|
||||
#deal with single line enums
|
||||
if '};' in line:
|
||||
fields = single_line_enum(line)
|
||||
else:
|
||||
#deal with multi line enums
|
||||
while True:
|
||||
l = next(line_iter)
|
||||
if '};' in l:
|
||||
break
|
||||
m = re.search("\w+", l)
|
||||
try:
|
||||
# print('\t', m.group())
|
||||
fields.append(m.group())
|
||||
|
||||
except:
|
||||
pass
|
||||
enums[enum_name] = fields
|
||||
return enums
|
||||
|
||||
|
@ -47,6 +47,8 @@ lines = []
|
||||
|
||||
ag2 = []
|
||||
|
||||
cn = []
|
||||
|
||||
def get_arguments(node):
|
||||
args = [a.type.spelling for a in node.get_arguments()]
|
||||
args = [
|
||||
@ -66,8 +68,12 @@ def get_fdec(node):
|
||||
else:
|
||||
return_type = 'void'
|
||||
|
||||
if node.is_const_method():
|
||||
const = 'const'
|
||||
else:
|
||||
const = ''
|
||||
args = ", ".join(args)
|
||||
args = f'({return_type}(Detector::*)({args}))'
|
||||
args = f'({return_type}(Detector::*)({args}){const})'
|
||||
return args
|
||||
|
||||
|
||||
@ -85,6 +91,7 @@ def visit(node):
|
||||
lines.append(
|
||||
f'.def("{child.spelling}",{fs} &Detector::{child.spelling}{args})'
|
||||
)
|
||||
cn.append(child)
|
||||
for child in node.get_children():
|
||||
visit(child)
|
||||
|
||||
|
@ -5,9 +5,10 @@ from _slsdet import IpAddr, MacAddr
|
||||
runStatus = slsDetectorDefs.runStatus
|
||||
speedLevel = slsDetectorDefs.speedLevel
|
||||
dacIndex = slsDetectorDefs.dacIndex
|
||||
detectorType = slsDetectorDefs.detectorType
|
||||
|
||||
from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask
|
||||
from .utils import Geometry, to_geo, element
|
||||
from .utils import Geometry, to_geo, element, reduce_time, is_iterable
|
||||
from .registers import Register, Adc_register
|
||||
import datetime as dt
|
||||
|
||||
@ -170,6 +171,9 @@ class Detector(CppDetectorApi):
|
||||
|
||||
@property
|
||||
def exptime(self):
|
||||
if self.type == detectorType.MYTHEN3:
|
||||
res = self.getExptimeForAllGates()
|
||||
return reduce_time(res)
|
||||
res = self.getExptime()
|
||||
return element_if_equal([it.total_seconds() for it in res])
|
||||
|
||||
@ -180,6 +184,26 @@ class Detector(CppDetectorApi):
|
||||
else:
|
||||
self.setExptime(dt.timedelta(seconds=t))
|
||||
|
||||
@property
|
||||
def gatedelay(self):
|
||||
return reduce_time(self.getGateDelayForAllGates())
|
||||
|
||||
@gatedelay.setter
|
||||
def gatedelay(self, value):
|
||||
if is_iterable(value):
|
||||
if len(value) == 3:
|
||||
for i,v in enumerate(value):
|
||||
if isinstance(v, dt.timedelta):
|
||||
self.setGateDelay(i, v)
|
||||
else:
|
||||
self.setGateDelay(i, dt.timedelta(seconds = v))
|
||||
else:
|
||||
if isinstance(value, dt.timedelta):
|
||||
self.setGateDelay(-1, value)
|
||||
else:
|
||||
self.setGateDelay(-1, dt.timedelta(seconds=value))
|
||||
|
||||
|
||||
@property
|
||||
def subexptime(self):
|
||||
res = self.getSubExptime()
|
||||
|
@ -7,10 +7,17 @@ but not directly used in controlling the detector
|
||||
from collections import namedtuple
|
||||
import _slsdet #C++ lib
|
||||
import functools
|
||||
|
||||
import datetime as dt
|
||||
|
||||
Geometry = namedtuple('Geometry', ['x', 'y'])
|
||||
|
||||
def is_iterable(item):
|
||||
try:
|
||||
iter(item)
|
||||
except TypeError:
|
||||
return False
|
||||
return True
|
||||
|
||||
def get_set_bits(mask):
|
||||
"""
|
||||
Return a list of the set bits in a python integer
|
||||
@ -41,6 +48,9 @@ def all_equal(mylist):
|
||||
|
||||
def element_if_equal(mylist):
|
||||
"""If all elements are equal return only one element"""
|
||||
if not is_iterable(mylist):
|
||||
return mylist
|
||||
|
||||
if all_equal(mylist):
|
||||
if len(mylist) == 0:
|
||||
return None
|
||||
@ -49,6 +59,15 @@ def element_if_equal(mylist):
|
||||
else:
|
||||
return mylist
|
||||
|
||||
def reduce_time(mylist):
|
||||
res = element_if_equal(element_if_equal(mylist))
|
||||
if isinstance(res, dt.timedelta):
|
||||
return res.total_seconds()
|
||||
elif isinstance(res[0], list):
|
||||
return [[item.total_seconds() for item in subl] for subl in res]
|
||||
else:
|
||||
return [r.total_seconds() for r in res]
|
||||
|
||||
def element(func):
|
||||
"""
|
||||
Wrapper to return either list or element
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8,12 +8,17 @@
|
||||
#include "network_utils.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include "typecaster.h"
|
||||
|
||||
#include "TimeHelper.h"
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
namespace py = pybind11;
|
||||
void init_det(py::module &m) {
|
||||
using sls::Detector;
|
||||
using sls::Positions;
|
||||
using sls::Result;
|
||||
using sls::defs;
|
||||
using sls::ns;
|
||||
|
||||
py::class_<Detector> CppDetectorApi(m, "CppDetectorApi");
|
||||
CppDetectorApi
|
||||
|
@ -65,38 +65,14 @@ void init_enums(py::module &m) {
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::externalSignalFlag>(Defs, "externalSignalFlag")
|
||||
.value("GET_EXTERNAL_SIGNAL_FLAG",
|
||||
slsDetectorDefs::externalSignalFlag::GET_EXTERNAL_SIGNAL_FLAG)
|
||||
.value("SIGNAL_OFF", slsDetectorDefs::externalSignalFlag::SIGNAL_OFF)
|
||||
.value("GATE_IN_ACTIVE_HIGH",
|
||||
slsDetectorDefs::externalSignalFlag::GATE_IN_ACTIVE_HIGH)
|
||||
.value("GATE_IN_ACTIVE_LOW",
|
||||
slsDetectorDefs::externalSignalFlag::GATE_IN_ACTIVE_LOW)
|
||||
.value("TRIGGER_IN_RISING_EDGE",
|
||||
slsDetectorDefs::externalSignalFlag::TRIGGER_IN_RISING_EDGE)
|
||||
.value("TRIGGER_IN_FALLING_EDGE",
|
||||
slsDetectorDefs::externalSignalFlag::TRIGGER_IN_FALLING_EDGE)
|
||||
.value("RO_TRIGGER_IN_RISING_EDGE",
|
||||
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_IN_RISING_EDGE)
|
||||
.value("RO_TRIGGER_IN_FALLING_EDGE",
|
||||
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_IN_FALLING_EDGE)
|
||||
.value("GATE_OUT_ACTIVE_HIGH",
|
||||
slsDetectorDefs::externalSignalFlag::GATE_OUT_ACTIVE_HIGH)
|
||||
.value("GATE_OUT_ACTIVE_LOW",
|
||||
slsDetectorDefs::externalSignalFlag::GATE_OUT_ACTIVE_LOW)
|
||||
.value("TRIGGER_OUT_RISING_EDGE",
|
||||
slsDetectorDefs::externalSignalFlag::TRIGGER_OUT_RISING_EDGE)
|
||||
.value("TRIGGER_OUT_FALLING_EDGE",
|
||||
slsDetectorDefs::externalSignalFlag::TRIGGER_OUT_FALLING_EDGE)
|
||||
.value("RO_TRIGGER_OUT_RISING_EDGE",
|
||||
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_OUT_RISING_EDGE)
|
||||
.value("RO_TRIGGER_OUT_FALLING_EDGE",
|
||||
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_OUT_FALLING_EDGE)
|
||||
.value("OUTPUT_LOW", slsDetectorDefs::externalSignalFlag::OUTPUT_LOW)
|
||||
.value("OUTPUT_HIGH", slsDetectorDefs::externalSignalFlag::OUTPUT_HIGH)
|
||||
.value(
|
||||
"MASTER_SLAVE_SYNCHRONIZATION",
|
||||
slsDetectorDefs::externalSignalFlag::MASTER_SLAVE_SYNCHRONIZATION)
|
||||
.value("INVERSION_ON",
|
||||
slsDetectorDefs::externalSignalFlag::INVERSION_ON)
|
||||
.value("INVERSION_OFF",
|
||||
slsDetectorDefs::externalSignalFlag::INVERSION_OFF)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::timingMode>(Defs, "timingMode")
|
||||
@ -106,6 +82,9 @@ void init_enums(py::module &m) {
|
||||
slsDetectorDefs::timingMode::TRIGGER_EXPOSURE)
|
||||
.value("GATED", slsDetectorDefs::timingMode::GATED)
|
||||
.value("BURST_TRIGGER", slsDetectorDefs::timingMode::BURST_TRIGGER)
|
||||
.value("TRIGGER_GATED", slsDetectorDefs::timingMode::TRIGGER_GATED)
|
||||
.value("NUM_TIMING_MODES",
|
||||
slsDetectorDefs::timingMode::NUM_TIMING_MODES)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::dacIndex>(Defs, "dacIndex")
|
||||
@ -248,22 +227,22 @@ void init_enums(py::module &m) {
|
||||
|
||||
py::enum_<slsDetectorDefs::clockIndex>(Defs, "clockIndex")
|
||||
.value("ADC_CLOCK", slsDetectorDefs::clockIndex::ADC_CLOCK)
|
||||
.value("DBIT_CLOCK", slsDetectorDefs::clockIndex::DBIT_CLOCK)
|
||||
.value("RUN_CLOCK", slsDetectorDefs::clockIndex::RUN_CLOCK)
|
||||
.value("SYNC_CLOCK", slsDetectorDefs::clockIndex::SYNC_CLOCK)
|
||||
.value(" DBIT_CLOCK", slsDetectorDefs::clockIndex::DBIT_CLOCK)
|
||||
.value(" RUN_CLOCK", slsDetectorDefs::clockIndex::RUN_CLOCK)
|
||||
.value(" SYNC_CLOCK", slsDetectorDefs::clockIndex::SYNC_CLOCK)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::readoutMode>(Defs, "readoutMode")
|
||||
.value("ANALOG_ONLY", slsDetectorDefs::readoutMode::ANALOG_ONLY)
|
||||
.value("DIGITAL_ONLY", slsDetectorDefs::readoutMode::DIGITAL_ONLY)
|
||||
.value("ANALOG_AND_DIGITAL",
|
||||
.value(" DIGITAL_ONLY", slsDetectorDefs::readoutMode::DIGITAL_ONLY)
|
||||
.value(" ANALOG_AND_DIGITAL",
|
||||
slsDetectorDefs::readoutMode::ANALOG_AND_DIGITAL)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::speedLevel>(Defs, "speedLevel")
|
||||
.value("FULL_SPEED", slsDetectorDefs::speedLevel::FULL_SPEED)
|
||||
.value("HALF_SPEED", slsDetectorDefs::speedLevel::HALF_SPEED)
|
||||
.value("QUARTER_SPEED", slsDetectorDefs::speedLevel::QUARTER_SPEED)
|
||||
.value(" HALF_SPEED", slsDetectorDefs::speedLevel::HALF_SPEED)
|
||||
.value(" QUARTER_SPEED", slsDetectorDefs::speedLevel::QUARTER_SPEED)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::portType>(Defs, "portType")
|
||||
@ -300,12 +279,13 @@ void init_enums(py::module &m) {
|
||||
.value("BURST_OFF", slsDetectorDefs::burstMode::BURST_OFF)
|
||||
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
|
||||
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
|
||||
.value("NUM_BURST_MODES", slsDetectorDefs::burstMode::NUM_BURST_MODES)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::timingSourceType>(Defs, "timingSourceType")
|
||||
.value("TIMING_INTERNAL",
|
||||
slsDetectorDefs::timingSourceType::TIMING_INTERNAL)
|
||||
.value("TIMING_EXTERNAL",
|
||||
.value(" TIMING_EXTERNAL",
|
||||
slsDetectorDefs::timingSourceType::TIMING_EXTERNAL)
|
||||
.export_values();
|
||||
}
|
||||
|
@ -5,7 +5,28 @@ Testing functions from utils.py
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from sls_detector.utils import *
|
||||
from slsdet.utils import *
|
||||
import datetime as dt
|
||||
|
||||
def test_iterable():
|
||||
assert iterable(5) == False
|
||||
assert iterable('abc') == True
|
||||
assert iterable([]) == True
|
||||
assert iterable(5.9) == False
|
||||
|
||||
def test_reduce_time_to_single_value_from_list():
|
||||
t = 3*[dt.timedelta(seconds = 1)]
|
||||
assert reduce_time(t) == 1
|
||||
|
||||
def test_reduce_time_to_single_value_from_list_of_lists():
|
||||
t = 3*[dt.timedelta(seconds = 3.3)]
|
||||
tt = 5*t
|
||||
assert reduce_time(tt) == 3.3
|
||||
|
||||
def test_reduce_time_when_sublist_is_different():
|
||||
t = [dt.timedelta(seconds = 1), dt.timedelta(seconds = 2), dt.timedelta(seconds = 1)]
|
||||
tt = 4*t
|
||||
assert reduce_time(tt) == [1,2,1]
|
||||
|
||||
|
||||
def test_convert_zero():
|
||||
|
@ -88,6 +88,7 @@ target_include_directories(slsDetectorGui PUBLIC
|
||||
)
|
||||
|
||||
target_link_libraries(slsDetectorGui PUBLIC
|
||||
slsProjectWarnings
|
||||
slsDetectorShared
|
||||
${QT_QTCORE_LIBRARIES}
|
||||
${QT_QTGUI_LIBRARIES}
|
||||
|
@ -1066,239 +1066,6 @@
|
||||
<string>Acquisition</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="1" column="4">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblNumStoragecells">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of additional storage cells. For Jungfrau only. </p><p>Default: 0. </p><p>Number of Images received: #frames * #triggers * (#storagecells+1) </p><p> #storagecells#</p><p><br/></p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Storage cells:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="2">
|
||||
<widget class="QSpinBox" name="spinNumStoragecells">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of additional storage cells. For Jungfrau only. </p><p>Default: 0. </p><p>Number of Images received: #frames * #triggers * (#storagecells+1) </p><p> #storagecells#</p><p><br/></p></body></html></string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>15</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QDoubleSpinBox" name="spinSubExpTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Exposure Time of a sub frame. Only for Eiger in 32 bit mode
|
||||
</nobr><br><nobr>
|
||||
#subexptime#
|
||||
</nobr></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblSubDeadTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Dead time between sub frames. Only for Eiger in 32 bit mode.
|
||||
</nobr><br><nobr>
|
||||
Default value is 0. A value less than the required minimum is ignored.
|
||||
</nobr><br><nobr>
|
||||
#subdeadtime#
|
||||
</nobr></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sub Frame Dead Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QDoubleSpinBox" name="spinSubDeadTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Period between sub frames. Only for Eiger in 32 bit mode.
|
||||
</nobr><br><nobr>
|
||||
Default value is 0. A value less than the required minimum is ignored.
|
||||
</nobr><br><nobr>
|
||||
#subperiod#
|
||||
</nobr></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblSubExpTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Exposure Time of a sub frame. Only for Eiger in 32 bit mode
|
||||
</nobr><br><nobr>
|
||||
#subexptime#
|
||||
</nobr></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sub Frame Exposure Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QComboBox" name="comboSubDeadTimeUnit">
|
||||
<property name="enabled">
|
||||
@ -1425,6 +1192,98 @@ Exposure Time of a sub frame. Only for Eiger in 32 bit mode
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblNumStoragecells">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of additional storage cells. For Jungfrau only. </p><p>Default: 0. </p><p>Number of Images received: #frames * #triggers * (#storagecells+1) </p><p> #storagecells#</p><p><br/></p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Storage cells:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QDoubleSpinBox" name="spinSubDeadTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Period between sub frames. Only for Eiger in 32 bit mode.
|
||||
</nobr><br><nobr>
|
||||
Default value is 0. A value less than the required minimum is ignored.
|
||||
</nobr><br><nobr>
|
||||
#subperiod#
|
||||
</nobr></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblSubExpTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Exposure Time of a sub frame. Only for Eiger in 32 bit mode
|
||||
</nobr><br><nobr>
|
||||
#subexptime#
|
||||
</nobr></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sub Frame Exposure Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lblDiscardBits">
|
||||
<property name="enabled">
|
||||
@ -1490,6 +1349,428 @@ Default value is 0. A value less than the required minimum is ignored.
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="2">
|
||||
<widget class="QSpinBox" name="spinNumStoragecells">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of additional storage cells. For Jungfrau only. </p><p>Default: 0. </p><p>Number of Images received: #frames * #triggers * (#storagecells+1) </p><p> #storagecells#</p><p><br/></p></body></html></string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>15</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QDoubleSpinBox" name="spinSubExpTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Exposure Time of a sub frame. Only for Eiger in 32 bit mode
|
||||
</nobr><br><nobr>
|
||||
#subexptime#
|
||||
</nobr></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblSubDeadTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Dead time between sub frames. Only for Eiger in 32 bit mode.
|
||||
</nobr><br><nobr>
|
||||
Default value is 0. A value less than the required minimum is ignored.
|
||||
</nobr><br><nobr>
|
||||
#subdeadtime#
|
||||
</nobr></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sub Frame Dead Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<widget class="QComboBox" name="comboExpTimeUnit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Exposure Time of a corresonding gate signal index. <br/>#exptime1# </p><p>#exptime2#</p><p>#exptime3# </p></body></html></string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>hr</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>min</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ms</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>us</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ns</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QDoubleSpinBox" name="spinExpTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Exposure Time of a corresonding gate signal index. <br/>#exptime1# </p><p>#exptime2#</p><p>#exptime3# </p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QSpinBox" name="spinGateIndex">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Gate index. It will get exposure time and gate delay for corresponding gate signal.</p></body></html></string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="lblGateDelay">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of additional storage cells. For Jungfrau only. </p><p>Default: 0. </p><p>Number of Images received: #frames * #triggers * (#storagecells+1) </p><p> #storagecells#</p><p><br/></p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Gate Delay:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QDoubleSpinBox" name="spinGateDelay">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Gate Delay of a corresonding gate signal index. <br/>#gatedelay1# </p><p>#gatedelay2#</p><p>#gatedelay3# </p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
<widget class="QComboBox" name="comboGateDelayUnit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Gate Delay of a corresonding gate signal index. <br/>#gatedelay1# </p><p>#gatedelay2#</p><p>#gatedelay3# </p></body></html></string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>hr</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>min</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ms</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>us</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ns</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lblExpTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of additional storage cells. For Jungfrau only. </p><p>Default: 0. </p><p>Number of Images received: #frames * #triggers * (#storagecells+1) </p><p> #storagecells#</p><p><br/></p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Expososure Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lblGateIndex">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of additional storage cells. For Jungfrau only. </p><p>Default: 0. </p><p>Number of Images received: #frames * #triggers * (#storagecells+1) </p><p> #storagecells#</p><p><br/></p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Gate Index:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -409,7 +409,7 @@
|
||||
<widget class="QFrame" name="frameTimeResolved">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<width>410</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -432,6 +432,77 @@
|
||||
<property name="verticalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="5" column="0">
|
||||
<widget class="QStackedWidget" name="stackedLblTriggerBurst">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>171</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>171</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageLblTrigger">
|
||||
<layout class="QGridLayout" name="gridLblTrigger">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblNumTriggers">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Triggers:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageLblBurst">
|
||||
<layout class="QGridLayout" name="gridLblBurst">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblNumBursts">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Bursts:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QComboBox" name="comboPeriodUnit">
|
||||
<property name="enabled">
|
||||
@ -501,53 +572,6 @@ Frame period between exposures.
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2" colspan="2">
|
||||
<widget class="QSpinBox" name="spinNumSamples">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of Triggers to be expected.
|
||||
#triggers#</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000000000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="2">
|
||||
<widget class="QSpinBox" name="spinNumMeasurements">
|
||||
<property name="sizePolicy">
|
||||
@ -594,25 +618,17 @@ Frame period between exposures.
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>175</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Measurements:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="lblNumSamples">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of Triggers to be expected.
|
||||
#triggers#</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Samples:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="2">
|
||||
<widget class="QComboBox" name="comboTimingMode">
|
||||
<property name="sizePolicy">
|
||||
@ -651,6 +667,11 @@ Frame period between exposures.
|
||||
<string>Burst Trigger</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Trigger Gated</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
@ -910,77 +931,6 @@ Frame period between exposures.
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QStackedWidget" name="stackedLblTriggerBurst">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>171</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>171</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageLblTrigger">
|
||||
<layout class="QGridLayout" name="gridLblTrigger">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblNumTriggers">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Triggers:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageLblBurst">
|
||||
<layout class="QGridLayout" name="gridLblBurst">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblNumBursts">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Bursts:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QStackedWidget" name="stackedSpinTriggerBurst">
|
||||
<property name="sizePolicy">
|
||||
@ -1481,6 +1431,214 @@ Frame period between exposures.
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QStackedWidget" name="stackedLblSamplesGates">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>171</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>171</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageLblSamples">
|
||||
<layout class="QGridLayout" name="gridLblTrigger_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblNumSamples">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of analog samples.</p><p>#asamples#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Samples:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageLblGates">
|
||||
<layout class="QGridLayout" name="gridLblBurst_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblNumGates">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of external gates.</p><p>#gates#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Gates:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QStackedWidget" name="stackedSpinSamplesGates">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>208</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>208</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageSpinSamples">
|
||||
<layout class="QGridLayout" name="gridSpinTrigger_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QSpinBox" name="spinNumSamples">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of analog samples.</p><p>#asamples#</p><p><br/></p></body></html></string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000000000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageSpinGates">
|
||||
<layout class="QGridLayout" name="gridSpinBurst_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QSpinBox" name="spinNumGates">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of external gates.</p><p>#gates#</p></body></html></string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000000000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1513,7 +1671,6 @@ Frame period between exposures.
|
||||
<tabstop>comboExpUnit</tabstop>
|
||||
<tabstop>spinPeriod</tabstop>
|
||||
<tabstop>comboPeriodUnit</tabstop>
|
||||
<tabstop>spinNumSamples</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../include/icons.qrc"/>
|
||||
|
@ -36,6 +36,9 @@ class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
|
||||
void SetNumStoragecells(int value);
|
||||
void SetSubExposureTime();
|
||||
void SetSubDeadTime();
|
||||
void SetGateIndex(int value);
|
||||
void SetExposureTime();
|
||||
void SetGateDelay();
|
||||
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
@ -59,6 +62,8 @@ class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
|
||||
void GetNumStoragecells();
|
||||
void GetSubExposureTime();
|
||||
void GetSubDeadTime();
|
||||
void GetExposureTime();
|
||||
void GetGateDelay();
|
||||
|
||||
sls::Detector *det;
|
||||
qDrawPlot *plot;
|
||||
|
@ -25,6 +25,7 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
|
||||
void SetNumTriggers(int val);
|
||||
void SetNumBursts(int val);
|
||||
void SetNumSamples(int val);
|
||||
void SetNumGates(int val);
|
||||
void SetExposureTime();
|
||||
void SetAcquisitionPeriod();
|
||||
void SetDelay();
|
||||
@ -45,6 +46,7 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
|
||||
* show bursts and burst period
|
||||
*/
|
||||
void ShowTriggerDelay();
|
||||
void ShowGates();
|
||||
void SetupTimingMode();
|
||||
void EnableWidgetsforTimingMode();
|
||||
|
||||
@ -53,6 +55,7 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
|
||||
void GetNumTriggers();
|
||||
void GetNumBursts();
|
||||
void GetNumSamples();
|
||||
void GetNumGates();
|
||||
void GetExposureTime();
|
||||
void GetAcquisitionPeriod();
|
||||
void CheckAcqPeriodGreaterThanExp();
|
||||
@ -76,7 +79,7 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
|
||||
sls::Detector *det;
|
||||
qDrawPlot *plot;
|
||||
// enum for the timing mode
|
||||
enum { AUTO, TRIGGER, GATED, BURST_TRIGGER, NUMTIMINGMODES };
|
||||
enum { AUTO, TRIGGER, GATED, BURST_TRIGGER, TRIGGER_GATED, NUMTIMINGMODES };
|
||||
QTimer *progressTimer;
|
||||
// tool tip variables
|
||||
QString acqPeriodTip;
|
||||
@ -84,6 +87,7 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
|
||||
QPalette red;
|
||||
bool delayImplemented;
|
||||
bool sampleImplemented;
|
||||
bool gateImplemented;
|
||||
bool startingFnumImplemented;
|
||||
bool isAcquisitionStopped{false};
|
||||
int numMeasurements{1};
|
||||
|
@ -29,9 +29,21 @@ void qTabAdvanced::SetupWidgetWindow() {
|
||||
tab_roi->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
lblDiscardBits->setEnabled(true);
|
||||
spinDiscardBits->setEnabled(true);
|
||||
lblGateIndex->setEnabled(true);
|
||||
spinGateIndex->setEnabled(true);
|
||||
lblExpTime->setEnabled(true);
|
||||
spinExpTime->setEnabled(true);
|
||||
comboExpTimeUnit->setEnabled(true);
|
||||
lblGateDelay->setEnabled(true);
|
||||
spinGateDelay->setEnabled(true);
|
||||
comboGateDelayUnit->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
lblDiscardBits->setEnabled(true);
|
||||
spinDiscardBits->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -116,6 +128,28 @@ void qTabAdvanced::Initialization() {
|
||||
connect(spinDiscardBits, SIGNAL(valueChanged(int)), plot,
|
||||
SLOT(SetNumDiscardBits(int)));
|
||||
}
|
||||
|
||||
// gate index
|
||||
if (lblGateIndex->isEnabled()) {
|
||||
connect(spinGateIndex, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetGateIndex(int)));
|
||||
}
|
||||
|
||||
// exptime1, exptime2, exptme3
|
||||
if (lblExpTime->isEnabled()) {
|
||||
connect(spinExpTime, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetExposureTime()));
|
||||
connect(comboExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetExposureTime()));
|
||||
}
|
||||
|
||||
// gatedelay1, gatedelay2, gatedelay3
|
||||
if (lblGateDelay->isEnabled()) {
|
||||
connect(spinGateDelay, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetGateDelay()));
|
||||
connect(comboGateDelayUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetGateDelay()));
|
||||
}
|
||||
}
|
||||
|
||||
void qTabAdvanced::PopulateDetectors() {
|
||||
@ -671,6 +705,92 @@ void qTabAdvanced::SetSubDeadTime() {
|
||||
GetSubDeadTime();
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetGateIndex(int value) {
|
||||
LOG(logINFO) << "Getting exptime and gate delay for gate index: " << value;
|
||||
GetExposureTime();
|
||||
GetGateDelay();
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetExposureTime() {
|
||||
int gateIndex = spinGateIndex->value();
|
||||
LOG(logDEBUG) << "Getting exposure time" << gateIndex;
|
||||
disconnect(spinExpTime, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetExposureTime()));
|
||||
disconnect(comboExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetExposureTime()));
|
||||
try {
|
||||
auto retval = det->getExptime(gateIndex).tsquash(
|
||||
"Exptime is inconsistent for all detectors.");
|
||||
auto time = qDefs::getUserFriendlyTime(retval);
|
||||
spinExpTime->setValue(time.first);
|
||||
comboExpTimeUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get exposure time.",
|
||||
"qTabSettings::GetExposureTime")
|
||||
connect(spinExpTime, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetExposureTime()));
|
||||
connect(comboExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetExposureTime()));
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetExposureTime() {
|
||||
int gateIndex = spinGateIndex->value();
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(
|
||||
spinExpTime->value(),
|
||||
static_cast<qDefs::timeUnit>(comboExpTimeUnit->currentIndex())));
|
||||
LOG(logINFO) << "Setting exptime" << gateIndex << " to " << timeNS.count()
|
||||
<< " ns"
|
||||
<< "/" << spinExpTime->value()
|
||||
<< qDefs::getUnitString(
|
||||
(qDefs::timeUnit)comboExpTimeUnit->currentIndex());
|
||||
try {
|
||||
det->setExptime(gateIndex, timeNS);
|
||||
}
|
||||
CATCH_DISPLAY("Could not set exposure time.",
|
||||
"qTabAdvanced::SetExposureTime")
|
||||
|
||||
GetExposureTime();
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetGateDelay() {
|
||||
int gateIndex = spinGateIndex->value();
|
||||
LOG(logDEBUG) << "Getting gate delay" << gateIndex;
|
||||
disconnect(spinGateDelay, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetGateDelay()));
|
||||
disconnect(comboGateDelayUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetGateDelay()));
|
||||
try {
|
||||
auto retval = det->getGateDelay(gateIndex).tsquash(
|
||||
"GateDelay is inconsistent for all detectors.");
|
||||
auto time = qDefs::getUserFriendlyTime(retval);
|
||||
spinGateDelay->setValue(time.first);
|
||||
comboGateDelayUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get gate delay.", "qTabSettings::GetGateDelay")
|
||||
connect(spinGateDelay, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetGateDelay()));
|
||||
connect(comboGateDelayUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetGateDelay()));
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetGateDelay() {
|
||||
int gateIndex = spinGateIndex->value();
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(
|
||||
spinGateDelay->value(),
|
||||
static_cast<qDefs::timeUnit>(comboGateDelayUnit->currentIndex())));
|
||||
LOG(logINFO) << "Setting gatedelay" << gateIndex << " to " << timeNS.count()
|
||||
<< " ns"
|
||||
<< "/" << spinGateDelay->value()
|
||||
<< qDefs::getUnitString(
|
||||
(qDefs::timeUnit)comboGateDelayUnit->currentIndex());
|
||||
try {
|
||||
det->setGateDelay(gateIndex, timeNS);
|
||||
}
|
||||
CATCH_DISPLAY("Could not set gate delay.", "qTabAdvanced::SetGateDelay")
|
||||
|
||||
GetGateDelay();
|
||||
}
|
||||
|
||||
void qTabAdvanced::Refresh() {
|
||||
LOG(logDEBUG) << "**Updating Advanced Tab";
|
||||
|
||||
@ -698,5 +818,14 @@ void qTabAdvanced::Refresh() {
|
||||
GetSubDeadTime();
|
||||
}
|
||||
|
||||
// exptime1, exptime2, exptme3
|
||||
if (lblExpTime->isEnabled()) {
|
||||
GetExposureTime();
|
||||
}
|
||||
|
||||
// gatedelay1, gatedelay2, gatedelay3
|
||||
if (lblGateDelay->isEnabled()) {
|
||||
GetGateDelay();
|
||||
}
|
||||
LOG(logDEBUG) << "**Updated Advanced Tab";
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ void qTabMeasurement::SetupWidgetWindow() {
|
||||
progressTimer = new QTimer(this);
|
||||
|
||||
sampleImplemented = false;
|
||||
gateImplemented = false;
|
||||
delayImplemented = true;
|
||||
startingFnumImplemented = false;
|
||||
// by default, delay and starting fnum is disabled in form
|
||||
@ -41,6 +42,8 @@ void qTabMeasurement::SetupWidgetWindow() {
|
||||
// default is triggers and delay (not #bursts and burst period for gotthard2
|
||||
// in auto mode)
|
||||
ShowTriggerDelay();
|
||||
// default is to show samples, mythen3, show gates
|
||||
ShowGates();
|
||||
|
||||
// enabling according to det type
|
||||
switch (det->getDetectorType().squash()) {
|
||||
@ -67,6 +70,9 @@ void qTabMeasurement::SetupWidgetWindow() {
|
||||
spinBurstPeriod->setEnabled(true);
|
||||
comboBurstPeriodUnit->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
gateImplemented = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -97,6 +103,10 @@ void qTabMeasurement::Initialization() {
|
||||
connect(spinNumSamples, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetNumSamples(int)));
|
||||
}
|
||||
if (gateImplemented) {
|
||||
connect(spinNumGates, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetNumGates(int)));
|
||||
}
|
||||
connect(spinExpTime, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetExposureTime()));
|
||||
connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
@ -161,6 +171,16 @@ void qTabMeasurement::ShowTriggerDelay() {
|
||||
}
|
||||
}
|
||||
|
||||
void qTabMeasurement::ShowGates() {
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::MYTHEN3) {
|
||||
stackedLblSamplesGates->setCurrentWidget(pageLblGates);
|
||||
stackedSpinSamplesGates->setCurrentWidget(pageSpinGates);
|
||||
} else {
|
||||
stackedLblSamplesGates->setCurrentWidget(pageLblSamples);
|
||||
stackedSpinSamplesGates->setCurrentWidget(pageSpinSamples);
|
||||
}
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetupTimingMode() {
|
||||
QStandardItemModel *model =
|
||||
qobject_cast<QStandardItemModel *>(comboTimingMode->model());
|
||||
@ -173,9 +193,20 @@ void qTabMeasurement::SetupTimingMode() {
|
||||
item[i] = model->itemFromIndex(index[i]);
|
||||
}
|
||||
|
||||
if (det->getDetectorType().squash() != slsDetectorDefs::EIGER) {
|
||||
item[(int)GATED]->setEnabled(false);
|
||||
item[(int)BURST_TRIGGER]->setEnabled(false);
|
||||
item[(int)GATED]->setEnabled(false);
|
||||
item[(int)BURST_TRIGGER]->setEnabled(false);
|
||||
item[(int)TRIGGER_GATED]->setEnabled(false);
|
||||
switch (det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
item[(int)GATED]->setEnabled(true);
|
||||
item[(int)BURST_TRIGGER]->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
item[(int)GATED]->setEnabled(true);
|
||||
item[(int)TRIGGER_GATED]->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -197,6 +228,8 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
||||
lblDelay->setEnabled(false);
|
||||
spinDelay->setEnabled(false);
|
||||
comboDelayUnit->setEnabled(false);
|
||||
lblNumGates->setEnabled(false);
|
||||
spinNumGates->setEnabled(false);
|
||||
|
||||
switch (comboTimingMode->currentIndex()) {
|
||||
case AUTO:
|
||||
@ -223,6 +256,7 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
||||
lblExpTime->setEnabled(true);
|
||||
spinExpTime->setEnabled(true);
|
||||
comboExpUnit->setEnabled(true);
|
||||
// not implemented in FW to have multiple frames for eiger
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::EIGER) {
|
||||
spinNumFrames->setValue(1);
|
||||
} else {
|
||||
@ -241,8 +275,12 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
||||
}
|
||||
break;
|
||||
case GATED:
|
||||
// #frames
|
||||
// #frames, #gates(mythen3)
|
||||
spinNumTriggers->setValue(1);
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::MYTHEN3) {
|
||||
lblNumGates->setEnabled(true);
|
||||
spinNumGates->setEnabled(true);
|
||||
}
|
||||
lblNumFrames->setEnabled(true);
|
||||
spinNumFrames->setEnabled(true);
|
||||
break;
|
||||
@ -258,6 +296,18 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
||||
spinPeriod->setEnabled(true);
|
||||
comboPeriodUnit->setEnabled(true);
|
||||
break;
|
||||
case TRIGGER_GATED:
|
||||
// #triggers, delay, #frames, #gates
|
||||
lblNumTriggers->setEnabled(true);
|
||||
spinNumTriggers->setEnabled(true);
|
||||
lblDelay->setEnabled(true);
|
||||
spinDelay->setEnabled(true);
|
||||
comboDelayUnit->setEnabled(true);
|
||||
lblNumFrames->setEnabled(true);
|
||||
spinNumFrames->setEnabled(true);
|
||||
lblNumGates->setEnabled(true);
|
||||
spinNumGates->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -278,6 +328,7 @@ void qTabMeasurement::GetTimingMode() {
|
||||
case slsDetectorDefs::TRIGGER_EXPOSURE:
|
||||
case slsDetectorDefs::GATED:
|
||||
case slsDetectorDefs::BURST_TRIGGER:
|
||||
case slsDetectorDefs::TRIGGER_GATED:
|
||||
comboTimingMode->setCurrentIndex((int)retval);
|
||||
// update widget enable only if different
|
||||
if (oldMode != comboTimingMode->currentIndex()) {
|
||||
@ -411,6 +462,31 @@ void qTabMeasurement::SetNumSamples(int val) {
|
||||
&qTabMeasurement::GetNumSamples)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetNumGates() {
|
||||
LOG(logDEBUG) << "Getting number of gates";
|
||||
disconnect(spinNumGates, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetNumGates(int)));
|
||||
try {
|
||||
auto retval = det->getNumberOfGates().tsquash(
|
||||
"Inconsistent number of gates for all detectors.");
|
||||
spinNumGates->setValue(retval);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get number of gates.",
|
||||
"qTabMeasurement::GetNumGates")
|
||||
connect(spinNumGates, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetNumGates(int)));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetNumGates(int val) {
|
||||
LOG(logINFO) << "Setting number of external gates to " << val;
|
||||
try {
|
||||
det->setNumberOfGates(val);
|
||||
}
|
||||
CATCH_HANDLE("Could not set number of gates.",
|
||||
"qTabMeasurement::SetNumGates", this,
|
||||
&qTabMeasurement::GetNumGates)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetExposureTime() {
|
||||
LOG(logDEBUG) << "Getting exposure time";
|
||||
disconnect(spinExpTime, SIGNAL(valueChanged(double)), this,
|
||||
@ -419,12 +495,30 @@ void qTabMeasurement::GetExposureTime() {
|
||||
SLOT(SetExposureTime()));
|
||||
try {
|
||||
spinExpTime->setValue(-1);
|
||||
auto retval = det->getExptime().tsquash(
|
||||
"Inconsistent exposure time for all detectors.");
|
||||
auto time = qDefs::getUserFriendlyTime(retval);
|
||||
spinExpTime->setValue(time.first);
|
||||
comboExpUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
|
||||
bool inconsistentGateValues = false;
|
||||
std::chrono::nanoseconds retval;
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::MYTHEN3) {
|
||||
auto retvals = det->getExptimeForAllGates().tsquash(
|
||||
"Inconsistent exposure time for all detectors.");
|
||||
// all gates have same value
|
||||
if (retvals[0] == retvals[1] && retvals[1] == retvals[2]) {
|
||||
retval = retvals[0];
|
||||
} else {
|
||||
// dont throw, just leave it as -1
|
||||
inconsistentGateValues = true;
|
||||
}
|
||||
} else {
|
||||
retval = det->getExptime().tsquash(
|
||||
"Inconsistent exposure time for all detectors.");
|
||||
}
|
||||
|
||||
if (!inconsistentGateValues) {
|
||||
auto time = qDefs::getUserFriendlyTime(retval);
|
||||
spinExpTime->setValue(time.first);
|
||||
comboExpUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
}
|
||||
}
|
||||
CATCH_DISPLAY("Could not get exposure time.",
|
||||
"qTabMeasurement::GetExposureTime")
|
||||
@ -826,6 +920,9 @@ void qTabMeasurement::Refresh() {
|
||||
if (sampleImplemented) {
|
||||
GetNumSamples();
|
||||
}
|
||||
if (gateImplemented) {
|
||||
GetNumGates();
|
||||
}
|
||||
GetFileWrite();
|
||||
GetFileName();
|
||||
GetRunIndex();
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -424,7 +424,7 @@ void setupDetector() {
|
||||
LOG(logINFOBLUE, ("Setting Default parameters\n"));
|
||||
|
||||
setSettings(DEFAULT_SETTINGS);
|
||||
setExtSignal(DEFAULT_TRIGGER_MODE);
|
||||
setExtSignal(0, DEFAULT_TRIGGER_MODE);
|
||||
setTiming(DEFAULT_TIMING_MODE);
|
||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||
setNumTriggers(DEFAULT_NUM_CYCLES);
|
||||
@ -1259,7 +1259,8 @@ enum timingMode getTiming() {
|
||||
}
|
||||
}
|
||||
|
||||
void setExtSignal(enum externalSignalFlag mode) {
|
||||
void setExtSignal(int signalIndex, enum externalSignalFlag mode) {
|
||||
LOG(logDEBUG1, ("Setting signal flag[%d] to %d\n", signalIndex, mode));
|
||||
switch (mode) {
|
||||
case TRIGGER_IN_RISING_EDGE:
|
||||
LOG(logINFO,
|
||||
@ -1278,7 +1279,10 @@ void setExtSignal(enum externalSignalFlag mode) {
|
||||
setTiming(getTiming());
|
||||
}
|
||||
|
||||
int getExtSignal() { return signalMode; }
|
||||
int getExtSignal(int signalIndex) {
|
||||
LOG(logDEBUG1, ("Getting signal flag[%d]\n", signalIndex));
|
||||
return signalMode;
|
||||
}
|
||||
|
||||
/* configure mac */
|
||||
|
||||
|
@ -42,6 +42,7 @@ enum CLKINDEX { ADC_CLK, NUM_CLOCKS };
|
||||
#define NUM_BITS_PER_PIXEL (DYNAMIC_RANGE / 8)
|
||||
#define DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL)
|
||||
#define CLK_FREQ (32007729) /* Hz */
|
||||
#define MAX_EXT_SIGNALS (1)
|
||||
|
||||
/** Firmware Definitions */
|
||||
#define IP_PACKET_SIZE_NO_ROI \
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1,326 +1,447 @@
|
||||
#pragma once
|
||||
|
||||
// clang-format off
|
||||
#define REG_OFFSET (4)
|
||||
|
||||
/* Base addresses 0x1804 0000 ---------------------------------------------*/
|
||||
|
||||
/* Reconfiguration core for readout pll */
|
||||
#define BASE_READOUT_PLL (0x0000) // 0x1804_0000 - 0x1804_07FF
|
||||
#define BASE_READOUT_PLL (0x0000) // 0x1804_0000 - 0x1804_07FF
|
||||
|
||||
/* Reconfiguration core for system pll */
|
||||
#define BASE_SYSTEM_PLL (0x0800) // 0x1804_0800 - 0x1804_0FFF
|
||||
#define BASE_SYSTEM_PLL (0x0800) // 0x1804_0800 - 0x1804_0FFF
|
||||
|
||||
/* Clock Generation */
|
||||
#define BASE_CLK_GENERATION (0x1000) // 0x1804_1000 - 0x1804_XXXX //TODO
|
||||
#define BASE_CLK_GENERATION (0x1000) // 0x1804_1000 - 0x1804_XXXX //TODO
|
||||
|
||||
/* Base addresses 0x1806 0000 ---------------------------------------------*/
|
||||
/* General purpose control and status registers */
|
||||
#define BASE_CONTROL (0x0000) // 0x1806_0000 - 0x1806_00FF
|
||||
#define BASE_CONTROL (0x0000) // 0x1806_0000 - 0x1806_00FF
|
||||
// https://git.psi.ch/sls_detectors_firmware/mythen_III_mcb/blob/master/code/hdl/ctrl/ctrl.vhd
|
||||
|
||||
/* ASIC Control */
|
||||
#define BASE_ASIC (0x0100) // 0x1806_0100 - 0x1806_010F
|
||||
|
||||
/* ASIC Digital Interface. Data recovery core */
|
||||
#define BASE_ADIF (0x0110) // 0x1806_0110 - 0x1806_011F
|
||||
// https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/2e81ccbdbc5cb81813ba190fbdba43e8d6884eb9/adif/adif_ctrl.vhd
|
||||
#define BASE_ADIF (0x0110) // 0x1806_0110 - 0x1806_011F
|
||||
// https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/xxx/adif/adif_ctrl.vhd
|
||||
|
||||
/* Formatting of data core */
|
||||
#define BASE_FMT (0x0120) // 0x1806_0120 - 0x1806_012F
|
||||
#define BASE_FMT (0x0120) // 0x1806_0120 - 0x1806_012F
|
||||
|
||||
/* Packetizer */
|
||||
#define BASE_PKT (0x0140) // 0x1806_0140 - 0x1806_014F
|
||||
#define BASE_PKT (0x0130) // 0x1806_0130 - 0x1806_013F
|
||||
// https://git.psi.ch/sls_detectors_firmware/mythen_III_mcb/blob/master/code/hdl/pkt/pkt_ctrl.vhd
|
||||
|
||||
/* Pattern control and status registers */
|
||||
#define BASE_PATTERN_CONTROL (0x00200) // 0x1806_0200 - 0x1806_02FF
|
||||
// https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/2e81ccbdbc5cb81813ba190fbdba43e8d6884eb9/pattern_flow/pattern_flow_ctrl.vhd
|
||||
/** Pipeline (Timing Rec) */
|
||||
#define BASE_PIPELINE (0x0140) // 0x1806_0140 - 0x1806_014F
|
||||
// https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/xxx/MythenIIITriggerBoard/timingReceier.vhd
|
||||
|
||||
/* ASIC Exposure Control */
|
||||
#define BASE_ASIC_EXP (0x0180) // 0x1806_0180 - 0x1806_01BF
|
||||
|
||||
/* Pattern control and status */
|
||||
#define BASE_PATTERN_CONTROL (0x00200) // 0x1806_0200 - 0x1806_02FF
|
||||
// https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/xxx/pattern_flow/pattern_flow_ctrl.vhd
|
||||
|
||||
/* Flow control and status */
|
||||
#define BASE_FLOW_CONTROL (0x00400) // 0x1806_0400 - 0x1806_04FF
|
||||
// https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/qsys/flow/flow_ctrl.vhd
|
||||
|
||||
/** ASIC Readout Control */
|
||||
#define BASE_ASIC_RDO (0x00500) // 0x1806_0500 - 0x1806_050F
|
||||
// https://git.psi.ch/sls_detectors_firmware/mythen_III_mcb/blob/master/code/hdl/asic_rdo/asic_rdo.vhd
|
||||
|
||||
/* UDP datagram generator */
|
||||
#define BASE_UDP_RAM (0x01000) // 0x1806_1000 - 0x1806_1FFF
|
||||
#define BASE_UDP_RAM (0x01000) // 0x1806_1000 - 0x1806_1FFF
|
||||
|
||||
/* Pattern RAM. Pattern table */
|
||||
#define BASE_PATTERN_RAM (0x10000) // 0x1807_0000 - 0x1807_FFFF
|
||||
#define BASE_PATTERN_RAM (0x10000) // 0x1807_0000 - 0x1807_FFFF
|
||||
|
||||
|
||||
/* Clock Generation registers
|
||||
* ------------------------------------------------------*/
|
||||
#define PLL_RESET_REG (0x00 * REG_OFFSET + BASE_CLK_GENERATION)
|
||||
#define PLL_RESET_REG (0x00 * REG_OFFSET + BASE_CLK_GENERATION)
|
||||
|
||||
#define PLL_RESET_READOUT_OFST (0)
|
||||
#define PLL_RESET_READOUT_MSK (0x00000001 << PLL_RESET_READOUT_OFST)
|
||||
#define PLL_RESET_SYSTEM_OFST (1)
|
||||
#define PLL_RESET_SYSTEM_MSK (0x00000001 << PLL_RESET_SYSTEM_OFST)
|
||||
#define PLL_RESET_READOUT_OFST (0)
|
||||
#define PLL_RESET_READOUT_MSK (0x00000001 << PLL_RESET_READOUT_OFST)
|
||||
#define PLL_RESET_SYSTEM_OFST (1)
|
||||
#define PLL_RESET_SYSTEM_MSK (0x00000001 << PLL_RESET_SYSTEM_OFST)
|
||||
|
||||
/* Control registers --------------------------------------------------*/
|
||||
|
||||
/* Module Control Board Serial Number Register */
|
||||
#define MCB_SERIAL_NO_REG (0x00 * REG_OFFSET + BASE_CONTROL)
|
||||
#define MCB_SERIAL_NO_REG (0x00 * REG_OFFSET + BASE_CONTROL)
|
||||
|
||||
#define MCB_SERIAL_NO_VRSN_OFST (16)
|
||||
#define MCB_SERIAL_NO_VRSN_MSK (0x0000001F << MCB_SERIAL_NO_VRSN_OFST)
|
||||
#define MCB_SERIAL_NO_VRSN_OFST (16)
|
||||
#define MCB_SERIAL_NO_VRSN_MSK (0x0000001F << MCB_SERIAL_NO_VRSN_OFST)
|
||||
|
||||
/* FPGA Version register */
|
||||
#define FPGA_VERSION_REG (0x01 * REG_OFFSET + BASE_CONTROL)
|
||||
#define FPGA_VERSION_REG (0x01 * REG_OFFSET + BASE_CONTROL)
|
||||
|
||||
#define FPGA_COMPILATION_DATE_OFST (0)
|
||||
#define FPGA_COMPILATION_DATE_MSK (0x00FFFFFF << FPGA_COMPILATION_DATE_OFST)
|
||||
#define DETECTOR_TYPE_OFST (24)
|
||||
#define DETECTOR_TYPE_MSK (0x000000FF << DETECTOR_TYPE_OFST)
|
||||
#define FPGA_COMPILATION_DATE_OFST (0)
|
||||
#define FPGA_COMPILATION_DATE_MSK (0x00FFFFFF << FPGA_COMPILATION_DATE_OFST)
|
||||
#define DETECTOR_TYPE_OFST (24)
|
||||
#define DETECTOR_TYPE_MSK (0x000000FF << DETECTOR_TYPE_OFST)
|
||||
|
||||
/* API Version Register */
|
||||
#define API_VERSION_REG (0x02 * REG_OFFSET + BASE_CONTROL)
|
||||
#define API_VERSION_REG (0x02 * REG_OFFSET + BASE_CONTROL)
|
||||
|
||||
#define API_VERSION_OFST (0)
|
||||
#define API_VERSION_MSK (0x00FFFFFF << API_VERSION_OFST)
|
||||
#define API_VERSION_DETECTOR_TYPE_OFST (24) // Not used in software
|
||||
#define API_VERSION_DETECTOR_TYPE_MSK \
|
||||
(0x000000FF << API_VERSION_DETECTOR_TYPE_OFST) // Not used in software
|
||||
#define API_VERSION_OFST (0)
|
||||
#define API_VERSION_MSK (0x00FFFFFF << API_VERSION_OFST)
|
||||
#define API_VERSION_DETECTOR_TYPE_OFST (24) // Not used in software
|
||||
#define API_VERSION_DETECTOR_TYPE_MSK (0x000000FF << API_VERSION_DETECTOR_TYPE_OFST) // Not used in software
|
||||
|
||||
/* Fix pattern register */
|
||||
#define FIX_PATT_REG (0x03 * REG_OFFSET + BASE_CONTROL)
|
||||
#define FIX_PATT_VAL (0xACDC2019)
|
||||
#define FIX_PATT_REG (0x03 * REG_OFFSET + BASE_CONTROL)
|
||||
#define FIX_PATT_VAL (0xACDC2019)
|
||||
|
||||
/* Status register */
|
||||
#define STATUS_REG (0x04 * REG_OFFSET + BASE_CONTROL)
|
||||
#define STATUS_REG (0x04 * REG_OFFSET + BASE_CONTROL)
|
||||
|
||||
/* Look at me register, read only */
|
||||
#define LOOK_AT_ME_REG \
|
||||
(0x05 * REG_OFFSET + \
|
||||
BASE_CONTROL) // Not used in firmware or software, good to play with
|
||||
#define LOOK_AT_ME_REG (0x05 * REG_OFFSET + BASE_CONTROL) // Not used in firmware or software, good to play with
|
||||
|
||||
#define SYSTEM_STATUS_REG \
|
||||
(0x06 * REG_OFFSET + BASE_CONTROL) // Not used in software
|
||||
#define SYSTEM_STATUS_REG (0x06 * REG_OFFSET + BASE_CONTROL) // Not used in software
|
||||
|
||||
/* Config RW regiseter */
|
||||
#define CONFIG_REG (0x20 * REG_OFFSET + BASE_CONTROL)
|
||||
#define CONFIG_COUNTER_ENA_OFST (0)
|
||||
#define CONFIG_COUNTER_ENA_MSK (0x00000003 << CONFIG_COUNTER_ENA_OFST)
|
||||
#define CONFIG_COUNTER_ENA_DEFAULT_VAL \
|
||||
((0x0 << CONFIG_COUNTER_ENA_OFST) & CONFIG_COUNTER_ENA_MSK)
|
||||
#define CONFIG_COUNTER_ENA_1_VAL \
|
||||
((0x1 << CONFIG_COUNTER_ENA_OFST) & CONFIG_COUNTER_ENA_MSK)
|
||||
#define CONFIG_COUNTER_ENA_2_VAL \
|
||||
((0x2 << CONFIG_COUNTER_ENA_OFST) & CONFIG_COUNTER_ENA_MSK)
|
||||
#define CONFIG_COUNTER_ENA_ALL_VAL \
|
||||
((0x3 << CONFIG_COUNTER_ENA_OFST) & CONFIG_COUNTER_ENA_MSK)
|
||||
#define CONFIG_DYNAMIC_RANGE_OFST (4)
|
||||
#define CONFIG_DYNAMIC_RANGE_MSK (0x00000003 << CONFIG_DYNAMIC_RANGE_OFST)
|
||||
#define CONFIG_DYNAMIC_RANGE_1_VAL \
|
||||
((0x0 << CONFIG_DYNAMIC_RANGE_OFST) & CONFIG_DYNAMIC_RANGE_MSK)
|
||||
#define CONFIG_DYNAMIC_RANGE_4_VAL \
|
||||
((0x1 << CONFIG_DYNAMIC_RANGE_OFST) & CONFIG_DYNAMIC_RANGE_MSK)
|
||||
#define CONFIG_DYNAMIC_RANGE_16_VAL \
|
||||
((0x2 << CONFIG_DYNAMIC_RANGE_OFST) & CONFIG_DYNAMIC_RANGE_MSK)
|
||||
#define CONFIG_DYNAMIC_RANGE_24_VAL \
|
||||
((0x3 << CONFIG_DYNAMIC_RANGE_OFST) & CONFIG_DYNAMIC_RANGE_MSK)
|
||||
#define CONFIG_REG (0x20 * REG_OFFSET + BASE_CONTROL)
|
||||
|
||||
#define CONFIG_COUNTER_ENA_OFST (0)
|
||||
#define CONFIG_COUNTER_ENA_MSK (0x00000003 << CONFIG_COUNTER_ENA_OFST)
|
||||
#define CONFIG_COUNTER_ENA_DEFAULT_VAL ((0x0 << CONFIG_COUNTER_ENA_OFST) & CONFIG_COUNTER_ENA_MSK)
|
||||
#define CONFIG_COUNTER_ENA_1_VAL ((0x1 << CONFIG_COUNTER_ENA_OFST) & CONFIG_COUNTER_ENA_MSK)
|
||||
#define CONFIG_COUNTER_ENA_2_VAL ((0x2 << CONFIG_COUNTER_ENA_OFST) & CONFIG_COUNTER_ENA_MSK)
|
||||
#define CONFIG_COUNTER_ENA_ALL_VAL ((0x3 << CONFIG_COUNTER_ENA_OFST) & CONFIG_COUNTER_ENA_MSK)
|
||||
#define CONFIG_DYNAMIC_RANGE_OFST (4)
|
||||
#define CONFIG_DYNAMIC_RANGE_MSK (0x00000003 << CONFIG_DYNAMIC_RANGE_OFST)
|
||||
#define CONFIG_DYNAMIC_RANGE_1_VAL ((0x0 << CONFIG_DYNAMIC_RANGE_OFST) & CONFIG_DYNAMIC_RANGE_MSK)
|
||||
#define CONFIG_DYNAMIC_RANGE_4_VAL ((0x1 << CONFIG_DYNAMIC_RANGE_OFST) & CONFIG_DYNAMIC_RANGE_MSK)
|
||||
#define CONFIG_DYNAMIC_RANGE_16_VAL ((0x2 << CONFIG_DYNAMIC_RANGE_OFST) & CONFIG_DYNAMIC_RANGE_MSK)
|
||||
#define CONFIG_DYNAMIC_RANGE_24_VAL ((0x3 << CONFIG_DYNAMIC_RANGE_OFST) & CONFIG_DYNAMIC_RANGE_MSK)
|
||||
|
||||
/* Control RW register */
|
||||
#define CONTROL_REG (0x21 * REG_OFFSET + BASE_CONTROL)
|
||||
#define CONTROL_REG (0x21 * REG_OFFSET + BASE_CONTROL)
|
||||
|
||||
#define CONTROL_STRT_ACQSTN_OFST (0)
|
||||
#define CONTROL_STRT_ACQSTN_MSK (0x00000001 << CONTROL_STRT_ACQSTN_OFST)
|
||||
#define CONTROL_STP_ACQSTN_OFST (1)
|
||||
#define CONTROL_STP_ACQSTN_MSK (0x00000001 << CONTROL_STP_ACQSTN_OFST)
|
||||
#define CONTROL_CRE_RST_OFST (10)
|
||||
#define CONTROL_CRE_RST_MSK (0x00000001 << CONTROL_CRE_RST_OFST)
|
||||
#define CONTROL_PRPHRL_RST_OFST (11) // Only GBE10?
|
||||
#define CONTROL_PRPHRL_RST_MSK (0x00000001 << CONTROL_PRPHRL_RST_OFST)
|
||||
#define CONTROL_CLR_ACQSTN_FIFO_OFST (15)
|
||||
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
|
||||
#define CONTROL_PWR_CHIP_OFST (31)
|
||||
#define CONTROL_PWR_CHIP_MSK (0x00000001 << CONTROL_PWR_CHIP_OFST)
|
||||
#define CONTROL_STRT_ACQSTN_OFST (0)
|
||||
#define CONTROL_STRT_ACQSTN_MSK (0x00000001 << CONTROL_STRT_ACQSTN_OFST)
|
||||
#define CONTROL_STP_ACQSTN_OFST (1)
|
||||
#define CONTROL_STP_ACQSTN_MSK (0x00000001 << CONTROL_STP_ACQSTN_OFST)
|
||||
#define CONTROL_STRT_PATTERN_OFST (2)
|
||||
#define CONTROL_STRT_PATTERN_MSK (0x00000001 << CONTROL_STRT_PATTERN_OFST)
|
||||
#define CONTROL_CRE_RST_OFST (10)
|
||||
#define CONTROL_CRE_RST_MSK (0x00000001 << CONTROL_CRE_RST_OFST)
|
||||
#define CONTROL_PRPHRL_RST_OFST (11) // Only GBE10?
|
||||
#define CONTROL_PRPHRL_RST_MSK (0x00000001 << CONTROL_PRPHRL_RST_OFST)
|
||||
#define CONTROL_CLR_ACQSTN_FIFO_OFST (15)
|
||||
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
|
||||
#define CONTROL_PWR_CHIP_OFST (31)
|
||||
#define CONTROL_PWR_CHIP_MSK (0x00000001 << CONTROL_PWR_CHIP_OFST)
|
||||
|
||||
/* Pattern IO Control 64 bit register */
|
||||
#define PATTERN_IO_CTRL_LSB_REG (0x22 * REG_OFFSET + BASE_CONTROL)
|
||||
#define PATTERN_IO_CTRL_MSB_REG (0x23 * REG_OFFSET + BASE_CONTROL)
|
||||
#define PATTERN_IO_CTRL_LSB_REG (0x22 * REG_OFFSET + BASE_CONTROL)
|
||||
#define PATTERN_IO_CTRL_MSB_REG (0x23 * REG_OFFSET + BASE_CONTROL)
|
||||
|
||||
#define DTA_OFFSET_REG (0x24 * REG_OFFSET + BASE_CONTROL)
|
||||
#define DTA_OFFSET_REG (0x24 * REG_OFFSET + BASE_CONTROL)
|
||||
|
||||
/* Packetizer -------------------------------------------------------------*/
|
||||
|
||||
/* Packetizer Config Register */
|
||||
#define PKT_CONFIG_REG (0x00 * REG_OFFSET + BASE_PKT)
|
||||
#define PKT_CONFIG_REG (0x00 * REG_OFFSET + BASE_PKT)
|
||||
|
||||
#define PKT_CONFIG_NRXR_MAX_OFST (0)
|
||||
#define PKT_CONFIG_NRXR_MAX_MSK (0x0000003F << PKT_CONFIG_NRXR_MAX_OFST)
|
||||
#define PKT_CONFIG_RXR_START_ID_OFST (8)
|
||||
#define PKT_CONFIG_RXR_START_ID_MSK (0x0000003F << PKT_CONFIG_RXR_START_ID_OFST)
|
||||
#define PKT_CONFIG_NRXR_MAX_OFST (0)
|
||||
#define PKT_CONFIG_NRXR_MAX_MSK (0x0000003F << PKT_CONFIG_NRXR_MAX_OFST)
|
||||
#define PKT_CONFIG_RXR_START_ID_OFST (8)
|
||||
#define PKT_CONFIG_RXR_START_ID_MSK (0x0000003F << PKT_CONFIG_RXR_START_ID_OFST)
|
||||
|
||||
/* Module Coordinates Register */
|
||||
#define COORD_0_REG (0x02 * REG_OFFSET + BASE_PKT)
|
||||
#define COORD_ROW_OFST (0)
|
||||
#define COORD_ROW_MSK (0x0000FFFF << COORD_ROW_OFST)
|
||||
#define COORD_COL_OFST (16)
|
||||
#define COORD_COL_MSK (0x0000FFFF << COORD_COL_OFST)
|
||||
#define COORD_0_REG (0x02 * REG_OFFSET + BASE_PKT)
|
||||
#define COORD_ROW_OFST (0)
|
||||
#define COORD_ROW_MSK (0x0000FFFF << COORD_ROW_OFST)
|
||||
#define COORD_COL_OFST (16)
|
||||
#define COORD_COL_MSK (0x0000FFFF << COORD_COL_OFST)
|
||||
|
||||
/* Module ID Register */
|
||||
#define COORD_1_REG (0x03 * REG_OFFSET + BASE_PKT)
|
||||
#define COORD_RESERVED_OFST (0)
|
||||
#define COORD_RESERVED_MSK (0x0000FFFF << COORD_RESERVED_OFST)
|
||||
#define COORD_ID_OFST (16) // Not connected in firmware TODO
|
||||
#define COORD_ID_MSK \
|
||||
(0x0000FFFF << COORD_ID_OFST) // Not connected in firmware TODO
|
||||
#define COORD_1_REG (0x03 * REG_OFFSET + BASE_PKT)
|
||||
#define COORD_RESERVED_OFST (0)
|
||||
#define COORD_RESERVED_MSK (0x0000FFFF << COORD_RESERVED_OFST)
|
||||
#define COORD_ID_OFST (16) // Not connected in firmware TODO
|
||||
#define COORD_ID_MSK (0x0000FFFF << COORD_ID_OFST) // Not connected in firmware TODO
|
||||
|
||||
/* Pipeline -------------------------------------------------------------*/
|
||||
|
||||
/** DINF1 Master Input Register */
|
||||
#define DINF1_REG (0x00 * REG_OFFSET + BASE_PIPELINE)
|
||||
|
||||
#define DINF1_TRIGGER_BYPASS_OFST (0)
|
||||
#define DINF1_TRIGGER_BYPASS_MSK (0x00000001 << DINF1_TRIGGER_BYPASS_OFST)
|
||||
#define DINF1_BYPASS_GATE_OFST (1)
|
||||
#define DINF1_BYPASS_GATE_MSK (0x00000007 << DINF1_BYPASS_GATE_OFST)
|
||||
#define DINF1_INVERSION_OFST (4)
|
||||
#define DINF1_INVERSION_MSK (0x0000000F << DINF1_INVERSION_OFST)
|
||||
#define DINF1_RISING_TRIGGER_OFST (8)
|
||||
#define DINF1_RISING_TRIGGER_MSK (0x00000001 << DINF1_RISING_TRIGGER_OFST)
|
||||
#define DINF1_RISING_GATE_OFST (9)
|
||||
#define DINF1_RISING_GATE_MSK (0x00000007 << DINF1_RISING_GATE_OFST)
|
||||
#define DINF1_FALLING_OFST (12)
|
||||
#define DINF1_FALLING_MSK (0x0000000F << DINF1_FALLING_OFST)
|
||||
|
||||
/** DOUTIF1 Master Ouput Register */
|
||||
#define DOUTIF1_REG (0x01 * REG_OFFSET + BASE_PIPELINE)
|
||||
|
||||
#define DOUTIF1_BYPASS_OFST (0)
|
||||
#define DOUTIF1_BYPASS_MSK (0x0000000F << DOUTIF1_BYPASS_OFST)
|
||||
#define DOUTIF1_INVERSION_OFST (4)
|
||||
#define DOUTIF1_INVERSION_MSK (0x0000000F << DOUTIF1_INVERSION_OFST)
|
||||
#define DOUTIF1_RISING_OFST (8)
|
||||
#define DOUTIF1_RISING_MSK (0x0000000F << DOUTIF1_RISING_OFST)
|
||||
#define DOUTIF1_FALLING_OFST (12)
|
||||
#define DOUTIF1_FALLING_MSK (0x0000000F << DOUTIF1_FALLING_OFST)
|
||||
|
||||
/** DINF2 Slave Input Register */
|
||||
#define DINF2_REG (0x02 * REG_OFFSET + BASE_PIPELINE)
|
||||
|
||||
#define DINF2_BYPASS_OFST (0)
|
||||
#define DINF2_BYPASS_MSK (0x0000000F << DINF2_BYPASS_OFST)
|
||||
#define DINF2_INVERSION_OFST (4)
|
||||
#define DINF2_INVERSION_MSK (0x0000000F << DINF2_INVERSION_OFST)
|
||||
#define DINF2_RISING_OFST (8)
|
||||
#define DINF2_RISING_MSK (0x0000000F << DINF2_RISING_OFST)
|
||||
#define DINF2_FALLING_OFST (12)
|
||||
#define DINF2_FALLING_MSK (0x0000000F << DINF2_FALLING_OFST)
|
||||
|
||||
/* Pulse length after rising edge TODO (maybe fix a value for port 1 later )*/
|
||||
#define DOUTIF_RISING_LNGTH_REG (0x03 * REG_OFFSET + BASE_PIPELINE)
|
||||
|
||||
#define DOUTIF_RISING_LNGTH_PORT_1_OFST (0)
|
||||
#define DOUTIF_RISING_LNGTH_PORT_1_MSK (0x0000000F << DOUTIF_RISING_LNGTH_PORT_1_OFST)
|
||||
#define DOUTIF_RISING_LNGTH_PORT_2_OFST (0)
|
||||
#define DOUTIF_RISING_LNGTH_PORT_2_MSK (0x0000000F << DOUTIF_RISING_LNGTH_PORT_2_OFST)
|
||||
#define DOUTIF_RISING_LNGTH_PORT_3_OFST (0)
|
||||
#define DOUTIF_RISING_LNGTH_PORT_3_MSK (0x0000000F << DOUTIF_RISING_LNGTH_PORT_3_OFST)
|
||||
#define DOUTIF_RISING_LNGTH_PORT_4_OFST (0)
|
||||
#define DOUTIF_RISING_LNGTH_PORT_4_MSK (0x0000000F << DOUTIF_RISING_LNGTH_PORT_4_OFST)
|
||||
|
||||
|
||||
/* ASIC Exposure Control registers
|
||||
* --------------------------------------------------*/
|
||||
|
||||
/** ASIC Exposure Status register */
|
||||
#define ASIC_EXP_STATUS_REG (0x00 * REG_OFFSET + BASE_ASIC_EXP)
|
||||
|
||||
#define ASIC_EXP_STAT_GATE_SRC_EXT_OFST (0)
|
||||
#define ASIC_EXP_STAT_GATE_SRC_EXT_MSK (0x00000001 << ASIC_EXP_STAT_GATE_SRC_EXT_OFST)
|
||||
#define ASIC_EXP_STAT_STO_LNGTH_OFST (16)
|
||||
#define ASIC_EXP_STAT_STO_LNGTH_MSK (0x000000FF << ASIC_EXP_STAT_STO_LNGTH_OFST)
|
||||
#define ASIC_EXP_STAT_RSCNTR_LNGTH_OFST (24)
|
||||
#define ASIC_EXP_STAT_RSCNTR_LNGTH_MSK (0x000000FF << ASIC_EXP_STAT_RSCNTR_LNGTH_OFST)
|
||||
|
||||
/** Gate 0 width register */
|
||||
#define ASIC_EXP_GATE_0_WIDTH_LSB_REG (0x01 * REG_OFFSET + BASE_ASIC_EXP)
|
||||
#define ASIC_EXP_GATE_0_WIDTH_MSB_REG (0x02 * REG_OFFSET + BASE_ASIC_EXP)
|
||||
|
||||
/** Gate 1 width register */
|
||||
#define ASIC_EXP_GATE_1_WIDTH_LSB_REG (0x03 * REG_OFFSET + BASE_ASIC_EXP)
|
||||
#define ASIC_EXP_GATE_1_WIDTH_MSB_REG (0x04 * REG_OFFSET + BASE_ASIC_EXP)
|
||||
|
||||
/** Gate 2 width register */
|
||||
#define ASIC_EXP_GATE_2_WIDTH_LSB_REG (0x05 * REG_OFFSET + BASE_ASIC_EXP)
|
||||
#define ASIC_EXP_GATE_2_WIDTH_MSB_REG (0x06 * REG_OFFSET + BASE_ASIC_EXP)
|
||||
|
||||
/** Gate 0 delay register */
|
||||
#define ASIC_EXP_GATE_0_DELAY_LSB_REG (0x07 * REG_OFFSET + BASE_ASIC_EXP)
|
||||
#define ASIC_EXP_GATE_0_DELAY_MSB_REG (0x08 * REG_OFFSET + BASE_ASIC_EXP)
|
||||
|
||||
/** Gate 1 delay register */
|
||||
#define ASIC_EXP_GATE_1_DELAY_LSB_REG (0x09 * REG_OFFSET + BASE_ASIC_EXP)
|
||||
#define ASIC_EXP_GATE_1_DELAY_MSB_REG (0x0A * REG_OFFSET + BASE_ASIC_EXP)
|
||||
|
||||
/** Gate 2 delay register */
|
||||
#define ASIC_EXP_GATE_2_DELAY_LSB_REG (0x0B * REG_OFFSET + BASE_ASIC_EXP)
|
||||
#define ASIC_EXP_GATE_2_DELAY_MSB_REG (0x0C * REG_OFFSET + BASE_ASIC_EXP)
|
||||
|
||||
/** Gate period register */
|
||||
#define ASIC_EXP_GATE_PERIOD_LSB_REG (0x0D * REG_OFFSET + BASE_ASIC_EXP)
|
||||
#define ASIC_EXP_GATE_PERIOD_MSB_REG (0x0E * REG_OFFSET + BASE_ASIC_EXP)
|
||||
|
||||
/** Number of Internal Gates register */
|
||||
#define ASIC_EXP_INT_GATE_NUMBER_REG (0x0F * REG_OFFSET + BASE_ASIC_EXP)
|
||||
|
||||
/** Number of Internal Gates register */
|
||||
#define ASIC_EXP_EXT_GATE_NUMBER_REG (0x10 * REG_OFFSET + BASE_ASIC_EXP)
|
||||
|
||||
/* Pattern Control registers
|
||||
* --------------------------------------------------*/
|
||||
|
||||
/* Pattern status Register*/
|
||||
#define PAT_STATUS_REG (0x00 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PAT_STATUS_RUN_BUSY_OFST (0)
|
||||
#define PAT_STATUS_RUN_BUSY_MSK (0x00000001 << PAT_STATUS_RUN_BUSY_OFST)
|
||||
#define PAT_STATUS_WAIT_FOR_TRGGR_OFST (3)
|
||||
#define PAT_STATUS_WAIT_FOR_TRGGR_MSK \
|
||||
(0x00000001 << PAT_STATUS_WAIT_FOR_TRGGR_OFST)
|
||||
#define PAT_STATUS_DLY_BFRE_TRGGR_OFST (4)
|
||||
#define PAT_STATUS_DLY_BFRE_TRGGR_MSK \
|
||||
(0x00000001 << PAT_STATUS_DLY_BFRE_TRGGR_OFST)
|
||||
#define PAT_STATUS_FIFO_FULL_OFST (5)
|
||||
#define PAT_STATUS_FIFO_FULL_MSK (0x00000001 << PAT_STATUS_FIFO_FULL_OFST)
|
||||
#define PAT_STATUS_DLY_AFTR_TRGGR_OFST (15)
|
||||
#define PAT_STATUS_DLY_AFTR_TRGGR_MSK \
|
||||
(0x00000001 << PAT_STATUS_DLY_AFTR_TRGGR_OFST)
|
||||
#define PAT_STATUS_CSM_BUSY_OFST (17)
|
||||
#define PAT_STATUS_CSM_BUSY_MSK (0x00000001 << PAT_STATUS_CSM_BUSY_OFST)
|
||||
|
||||
/* Delay left 64bit Register */
|
||||
#define GET_DELAY_LSB_REG (0x02 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define GET_DELAY_MSB_REG (0x03 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Triggers left 64bit Register */
|
||||
#define GET_CYCLES_LSB_REG (0x04 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define GET_CYCLES_MSB_REG (0x05 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Frames left 64bit Register */
|
||||
#define GET_FRAMES_LSB_REG (0x06 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define GET_FRAMES_MSB_REG (0x07 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Period left 64bit Register */
|
||||
#define GET_PERIOD_LSB_REG (0x08 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define GET_PERIOD_MSB_REG (0x09 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Time from Start 64 bit register */
|
||||
#define TIME_FROM_START_LSB_REG (0x0A * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define TIME_FROM_START_MSB_REG (0x0B * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Get Frames from Start 64 bit register (frames from last reset using
|
||||
* CONTROL_CRST) */
|
||||
#define FRAMES_FROM_START_LSB_REG (0x0C * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define FRAMES_FROM_START_MSB_REG (0x0D * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Measurement Time 64 bit register (timestamp at a frame start until reset)*/
|
||||
#define START_FRAME_TIME_LSB_REG (0x0E * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define START_FRAME_TIME_MSB_REG (0x0F * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Delay 64bit Write-register */
|
||||
#define SET_DELAY_LSB_REG (0x22 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define SET_DELAY_MSB_REG (0x23 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Cylces 64bit Write-register */
|
||||
#define SET_CYCLES_LSB_REG (0x24 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define SET_CYCLES_MSB_REG (0x25 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Frames 64bit Write-register */
|
||||
#define SET_FRAMES_LSB_REG (0x26 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define SET_FRAMES_MSB_REG (0x27 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Period 64bit Write-register */
|
||||
#define SET_PERIOD_LSB_REG (0x28 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define SET_PERIOD_MSB_REG (0x29 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* External Signal register */
|
||||
#define EXT_SIGNAL_REG (0x30 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
#define EXT_SIGNAL_OFST (0)
|
||||
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
|
||||
|
||||
/* Trigger Delay 64 bit register */
|
||||
#define SET_TRIGGER_DELAY_LSB_REG (0x32 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define SET_TRIGGER_DELAY_MSB_REG (0x33 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PAT_STATUS_REG (0x00 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PAT_STATUS_RUN_BUSY_OFST (0)
|
||||
#define PAT_STATUS_RUN_BUSY_MSK (0x00000001 << PAT_STATUS_RUN_BUSY_OFST)
|
||||
|
||||
/* Pattern Limit RW Register */
|
||||
#define PATTERN_LIMIT_REG (0x40 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_LIMIT_REG (0x40 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
#define PATTERN_LIMIT_STRT_OFST (0)
|
||||
#define PATTERN_LIMIT_STRT_MSK (0x00001FFF << PATTERN_LIMIT_STRT_OFST)
|
||||
#define PATTERN_LIMIT_STP_OFST (16)
|
||||
#define PATTERN_LIMIT_STP_MSK (0x00001FFF << PATTERN_LIMIT_STP_OFST)
|
||||
#define PATTERN_LIMIT_STRT_OFST (0)
|
||||
#define PATTERN_LIMIT_STRT_MSK (0x00001FFF << PATTERN_LIMIT_STRT_OFST)
|
||||
#define PATTERN_LIMIT_STP_OFST (16)
|
||||
#define PATTERN_LIMIT_STP_MSK (0x00001FFF << PATTERN_LIMIT_STP_OFST)
|
||||
|
||||
/** Pattern Mask 64 bit RW regiser */
|
||||
#define PATTERN_MASK_LSB_REG (0x42 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_MASK_MSB_REG (0x43 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_MASK_LSB_REG (0x42 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_MASK_MSB_REG (0x43 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/** Pattern Set 64 bit RW regiser */
|
||||
#define PATTERN_SET_LSB_REG (0x44 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_SET_MSB_REG (0x45 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_SET_LSB_REG (0x44 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_SET_MSB_REG (0x45 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Pattern Wait Timer 0 64bit RW Register */
|
||||
#define PATTERN_WAIT_TIMER_0_LSB_REG (0x60 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_WAIT_TIMER_0_MSB_REG (0x61 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_WAIT_TIMER_0_LSB_REG (0x60 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_WAIT_TIMER_0_MSB_REG (0x61 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Pattern Wait 0 RW Register*/
|
||||
#define PATTERN_WAIT_0_ADDR_REG (0x62 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_WAIT_0_ADDR_REG (0x62 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
#define PATTERN_WAIT_0_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_0_ADDR_MSK (0x00001FFF << PATTERN_WAIT_0_ADDR_OFST)
|
||||
#define PATTERN_WAIT_0_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_0_ADDR_MSK (0x00001FFF << PATTERN_WAIT_0_ADDR_OFST)
|
||||
|
||||
/* Pattern Loop 0 Iteration RW Register */
|
||||
#define PATTERN_LOOP_0_ITERATION_REG (0x63 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_LOOP_0_ITERATION_REG (0x63 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Pattern Loop 0 Address RW Register */
|
||||
#define PATTERN_LOOP_0_ADDR_REG (0x64 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_LOOP_0_ADDR_REG (0x64 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
#define PATTERN_LOOP_0_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_0_ADDR_STRT_MSK \
|
||||
(0x00001FFF << PATTERN_LOOP_0_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_0_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_0_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_0_ADDR_STP_OFST)
|
||||
#define PATTERN_LOOP_0_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_0_ADDR_STRT_MSK (0x00001FFF << PATTERN_LOOP_0_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_0_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_0_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_0_ADDR_STP_OFST)
|
||||
|
||||
/* Pattern Wait Timer 1 64bit RW Register */
|
||||
#define PATTERN_WAIT_TIMER_1_LSB_REG (0x65 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_WAIT_TIMER_1_MSB_REG (0x66 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_WAIT_TIMER_1_LSB_REG (0x65 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_WAIT_TIMER_1_MSB_REG (0x66 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Pattern Wait 1 RW Register*/
|
||||
#define PATTERN_WAIT_1_ADDR_REG (0x67 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_WAIT_1_ADDR_REG (0x67 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
#define PATTERN_WAIT_1_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_1_ADDR_MSK (0x00001FFF << PATTERN_WAIT_1_ADDR_OFST)
|
||||
#define PATTERN_WAIT_1_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_1_ADDR_MSK (0x00001FFF << PATTERN_WAIT_1_ADDR_OFST)
|
||||
|
||||
/* Pattern Loop 1 Iteration RW Register */
|
||||
#define PATTERN_LOOP_1_ITERATION_REG (0x68 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_LOOP_1_ITERATION_REG (0x68 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Pattern Loop 1 Address RW Register */
|
||||
#define PATTERN_LOOP_1_ADDR_REG (0x69 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_LOOP_1_ADDR_REG (0x69 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
#define PATTERN_LOOP_1_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_1_ADDR_STRT_MSK \
|
||||
(0x00001FFF << PATTERN_LOOP_1_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_1_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_1_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_1_ADDR_STP_OFST)
|
||||
#define PATTERN_LOOP_1_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_1_ADDR_STRT_MSK (0x00001FFF << PATTERN_LOOP_1_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_1_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_1_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_1_ADDR_STP_OFST)
|
||||
|
||||
/* Pattern Wait Timer 2 64bit RW Register */
|
||||
#define PATTERN_WAIT_TIMER_2_LSB_REG (0x6A * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_WAIT_TIMER_2_MSB_REG (0x6B * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_WAIT_TIMER_2_LSB_REG (0x6A * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_WAIT_TIMER_2_MSB_REG (0x6B * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Pattern Wait 2 RW Register*/
|
||||
#define PATTERN_WAIT_2_ADDR_REG (0x6C * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_WAIT_2_ADDR_REG (0x6C * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
#define PATTERN_WAIT_2_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_2_ADDR_MSK (0x00001FFF << PATTERN_WAIT_2_ADDR_OFST)
|
||||
#define PATTERN_WAIT_2_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_2_ADDR_MSK (0x00001FFF << PATTERN_WAIT_2_ADDR_OFST)
|
||||
|
||||
/* Pattern Loop 2 Iteration RW Register */
|
||||
#define PATTERN_LOOP_2_ITERATION_REG (0x6D * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_LOOP_2_ITERATION_REG (0x6D * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Pattern Loop 0 Address RW Register */
|
||||
#define PATTERN_LOOP_2_ADDR_REG (0x6E * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define PATTERN_LOOP_2_ADDR_REG (0x6E * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
#define PATTERN_LOOP_2_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_2_ADDR_STRT_MSK \
|
||||
(0x00001FFF << PATTERN_LOOP_2_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_2_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_2_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_2_ADDR_STP_OFST)
|
||||
#define PATTERN_LOOP_2_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_2_ADDR_STRT_MSK (0x00001FFF << PATTERN_LOOP_2_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_2_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_2_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_2_ADDR_STP_OFST)
|
||||
|
||||
/* Pattern RAM registers --------------------------------------------------*/
|
||||
|
||||
/* Register of first word */
|
||||
#define PATTERN_STEP0_LSB_REG (0x0 * REG_OFFSET + BASE_PATTERN_RAM)
|
||||
#define PATTERN_STEP0_MSB_REG (0x1 * REG_OFFSET + BASE_PATTERN_RAM)
|
||||
#define PATTERN_STEP0_LSB_REG (0x0 * REG_OFFSET + BASE_PATTERN_RAM)
|
||||
#define PATTERN_STEP0_MSB_REG (0x1 * REG_OFFSET + BASE_PATTERN_RAM)
|
||||
|
||||
|
||||
/* Flow Control registers
|
||||
* --------------------------------------------------*/
|
||||
|
||||
/* Flow status Register*/
|
||||
#define FLOW_STATUS_REG (0x00 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
#define FLOW_STATUS_RUN_BUSY_OFST (0)
|
||||
#define FLOW_STATUS_RUN_BUSY_MSK (0x00000001 << FLOW_STATUS_RUN_BUSY_OFST)
|
||||
#define FLOW_STATUS_WAIT_FOR_TRGGR_OFST (3)
|
||||
#define FLOW_STATUS_WAIT_FOR_TRGGR_MSK (0x00000001 << FLOW_STATUS_WAIT_FOR_TRGGR_OFST)
|
||||
#define FLOW_STATUS_DLY_BFRE_TRGGR_OFST (4)
|
||||
#define FLOW_STATUS_DLY_BFRE_TRGGR_MSK (0x00000001 << FLOW_STATUS_DLY_BFRE_TRGGR_OFST)
|
||||
#define FLOW_STATUS_FIFO_FULL_OFST (5)
|
||||
#define FLOW_STATUS_FIFO_FULL_MSK (0x00000001 << FLOW_STATUS_FIFO_FULL_OFST)
|
||||
#define FLOW_STATUS_DLY_AFTR_TRGGR_OFST (15)
|
||||
#define FLOW_STATUS_DLY_AFTR_TRGGR_MSK (0x00000001 << FLOW_STATUS_DLY_AFTR_TRGGR_OFST)
|
||||
#define FLOW_STATUS_CSM_BUSY_OFST (17)
|
||||
#define FLOW_STATUS_CSM_BUSY_MSK (0x00000001 << FLOW_STATUS_CSM_BUSY_OFST)
|
||||
|
||||
/* Delay left 64bit Register */
|
||||
#define GET_DELAY_LSB_REG (0x02 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define GET_DELAY_MSB_REG (0x03 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
/* Triggers left 64bit Register */
|
||||
#define GET_CYCLES_LSB_REG (0x04 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define GET_CYCLES_MSB_REG (0x05 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
/* Frames left 64bit Register */
|
||||
#define GET_FRAMES_LSB_REG (0x06 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define GET_FRAMES_MSB_REG (0x07 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
/* Period left 64bit Register */
|
||||
#define GET_PERIOD_LSB_REG (0x08 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define GET_PERIOD_MSB_REG (0x09 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
/* Time from Start 64 bit register */
|
||||
#define TIME_FROM_START_LSB_REG (0x0A * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define TIME_FROM_START_MSB_REG (0x0B * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
/* Get Frames from Start 64 bit register (frames from last reset using
|
||||
* CONTROL_CRST) */
|
||||
#define FRAMES_FROM_START_LSB_REG (0x0C * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define FRAMES_FROM_START_MSB_REG (0x0D * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
/* Measurement Time 64 bit register (timestamp at a frame start until reset)*/
|
||||
#define START_FRAME_TIME_LSB_REG (0x0E * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define START_FRAME_TIME_MSB_REG (0x0F * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
/* Delay 64bit Write-register */
|
||||
#define SET_DELAY_LSB_REG (0x22 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define SET_DELAY_MSB_REG (0x23 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
/* Cylces 64bit Write-register */
|
||||
#define SET_CYCLES_LSB_REG (0x24 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define SET_CYCLES_MSB_REG (0x25 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
/* Frames 64bit Write-register */
|
||||
#define SET_FRAMES_LSB_REG (0x26 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define SET_FRAMES_MSB_REG (0x27 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
/* Period 64bit Write-register */
|
||||
#define SET_PERIOD_LSB_REG (0x28 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define SET_PERIOD_MSB_REG (0x29 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
/* External Signal register */
|
||||
#define EXT_SIGNAL_REG (0x30 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
#define EXT_SIGNAL_OFST (0)
|
||||
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
|
||||
|
||||
/* Trigger Delay 64 bit register */
|
||||
#define SET_TRIGGER_DELAY_LSB_REG (0x32 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define SET_TRIGGER_DELAY_MSB_REG (0x33 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
|
||||
/* ASIC Readout Control registers
|
||||
* --------------------------------------------------*/
|
||||
|
||||
#define ASIC_RDO_CONFIG_REG (0x01 * REG_OFFSET + BASE_ASIC_RDO)
|
||||
|
||||
#define ASICRDO_CNFG_RESSTRG_LNGTH_OFST (0)
|
||||
#define ASICRDO_CNFG_RESSTRG_LNGTH_MSK (0x000000FF << ASICRDO_CNFG_RESSTRG_LNGTH_OFST)
|
||||
|
||||
// clang-format on
|
Binary file not shown.
@ -415,6 +415,7 @@ void setupDetector() {
|
||||
// defaults
|
||||
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
||||
setDefaultDacs();
|
||||
setASICDefaults();
|
||||
|
||||
// dynamic range
|
||||
setDynamicRange(DEFAULT_DYNAMIC_RANGE);
|
||||
@ -424,10 +425,16 @@ void setupDetector() {
|
||||
// Initialization of acquistion parameters
|
||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||
setNumTriggers(DEFAULT_NUM_CYCLES);
|
||||
setExpTime(DEFAULT_EXPTIME);
|
||||
setPeriod(DEFAULT_PERIOD);
|
||||
setDelayAfterTrigger(DEFAULT_DELAY_AFTER_TRIGGER);
|
||||
setTiming(DEFAULT_TIMING_MODE);
|
||||
setNumIntGates(DEFAULT_INTERNAL_GATES);
|
||||
setNumGates(DEFAULT_EXTERNAL_GATES);
|
||||
for (int i = 0; i != 3; ++i) {
|
||||
setExpTime(i, DEFAULT_GATE_WIDTH);
|
||||
setGateDelay(i, DEFAULT_GATE_DELAY);
|
||||
}
|
||||
setInitialExtSignals();
|
||||
}
|
||||
|
||||
int setDefaultDacs() {
|
||||
@ -446,6 +453,25 @@ int setDefaultDacs() {
|
||||
return ret;
|
||||
}
|
||||
|
||||
void setASICDefaults() {
|
||||
uint32_t val = bus_r(ASIC_EXP_STATUS_REG);
|
||||
val &= (~ASIC_EXP_STAT_STO_LNGTH_MSK);
|
||||
val |= ((DEFAULT_ASIC_LATCHING_NUM_PULSES << ASIC_EXP_STAT_STO_LNGTH_OFST) &
|
||||
ASIC_EXP_STAT_STO_LNGTH_MSK);
|
||||
val &= (~ASIC_EXP_STAT_RSCNTR_LNGTH_MSK);
|
||||
val |=
|
||||
((DEFAULT_ASIC_LATCHING_NUM_PULSES << ASIC_EXP_STAT_RSCNTR_LNGTH_OFST) &
|
||||
ASIC_EXP_STAT_RSCNTR_LNGTH_MSK);
|
||||
bus_w(ASIC_EXP_STATUS_REG, val);
|
||||
|
||||
val = bus_r(ASIC_RDO_CONFIG_REG);
|
||||
val &= (~ASICRDO_CNFG_RESSTRG_LNGTH_MSK);
|
||||
val |=
|
||||
((DEFAULT_ASIC_LATCHING_NUM_PULSES << ASICRDO_CNFG_RESSTRG_LNGTH_OFST) &
|
||||
ASICRDO_CNFG_RESSTRG_LNGTH_MSK);
|
||||
bus_w(ASIC_RDO_CONFIG_REG, val);
|
||||
}
|
||||
|
||||
/* firmware functions (resets) */
|
||||
|
||||
void cleanFifos() {
|
||||
@ -716,10 +742,8 @@ int setTrimbits(int *trimbits) {
|
||||
int start = 0, nloop = 0;
|
||||
setPatternLoop(-1, &start, &iaddr, &nloop);
|
||||
}
|
||||
// load the trimbits
|
||||
#ifndef VIRTUAL
|
||||
startStateMachine();
|
||||
#endif
|
||||
// send pattern to the chips
|
||||
startPattern();
|
||||
}
|
||||
|
||||
// copy trimbits locally
|
||||
@ -785,40 +809,18 @@ int64_t getNumTriggers() {
|
||||
return get64BitReg(SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
}
|
||||
|
||||
int setExpTime(int64_t val) {
|
||||
if (val < 0) {
|
||||
LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val));
|
||||
val *= (1E-9 * getFrequency(SYSTEM_C0));
|
||||
setPatternWaitTime(0, val);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getExpTime();
|
||||
val /= (1E-9 * getFrequency(SYSTEM_C0));
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getExpTime() {
|
||||
return setPatternWaitTime(0, -1) / (1E-9 * getFrequency(SYSTEM_C0));
|
||||
}
|
||||
|
||||
int setPeriod(int64_t val) {
|
||||
if (val < 0) {
|
||||
LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFO, ("Setting period %lld ns\n", (long long int)val));
|
||||
val *= (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
val *= (1E-9 * getFrequency(SYSTEM_C2));
|
||||
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getPeriod();
|
||||
val /= (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
val /= (1E-9 * getFrequency(SYSTEM_C2));
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
@ -827,7 +829,175 @@ int setPeriod(int64_t val) {
|
||||
|
||||
int64_t getPeriod() {
|
||||
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG) /
|
||||
(1E-9 * FIXED_PLL_FREQUENCY);
|
||||
(1E-9 * getFrequency(SYSTEM_C2));
|
||||
}
|
||||
|
||||
void setNumIntGates(int val) {
|
||||
if (val > 0) {
|
||||
LOG(logINFO,
|
||||
("Setting number of Internal Gates %lld\n", (long long int)val));
|
||||
bus_w(ASIC_EXP_INT_GATE_NUMBER_REG, val);
|
||||
}
|
||||
}
|
||||
|
||||
void setNumGates(int val) {
|
||||
if (val > 0) {
|
||||
LOG(logINFO, ("Setting number of Gates %lld\n", (long long int)val));
|
||||
bus_w(ASIC_EXP_EXT_GATE_NUMBER_REG, val);
|
||||
}
|
||||
}
|
||||
|
||||
int getNumGates() { return bus_r(ASIC_EXP_EXT_GATE_NUMBER_REG); }
|
||||
|
||||
void updateGatePeriod() {
|
||||
uint64_t max = 0;
|
||||
for (int i = 0; i != 3; ++i) {
|
||||
// TODO: only those counters enabled (when updated to mask in firmware)
|
||||
uint64_t sum = getExpTime(i) + getGateDelay(i);
|
||||
if (sum > max) {
|
||||
max = sum;
|
||||
}
|
||||
}
|
||||
LOG(logINFO, ("\tSetting Gate Period to %lld ns\n", (long long int)max));
|
||||
max *= (1E-9 * getFrequency(SYSTEM_C2));
|
||||
set64BitReg(max, ASIC_EXP_GATE_PERIOD_LSB_REG,
|
||||
ASIC_EXP_GATE_PERIOD_MSB_REG);
|
||||
}
|
||||
|
||||
int64_t getGatePeriod() {
|
||||
return get64BitReg(ASIC_EXP_GATE_PERIOD_LSB_REG,
|
||||
ASIC_EXP_GATE_PERIOD_MSB_REG) /
|
||||
(1E-9 * getFrequency(SYSTEM_C2));
|
||||
}
|
||||
|
||||
int setExpTime(int gateIndex, int64_t val) {
|
||||
uint32_t alsb = 0;
|
||||
uint32_t amsb = 0;
|
||||
switch (gateIndex) {
|
||||
case 0:
|
||||
alsb = ASIC_EXP_GATE_0_WIDTH_LSB_REG;
|
||||
amsb = ASIC_EXP_GATE_0_WIDTH_MSB_REG;
|
||||
break;
|
||||
case 1:
|
||||
alsb = ASIC_EXP_GATE_1_WIDTH_LSB_REG;
|
||||
amsb = ASIC_EXP_GATE_1_WIDTH_MSB_REG;
|
||||
break;
|
||||
case 2:
|
||||
alsb = ASIC_EXP_GATE_2_WIDTH_LSB_REG;
|
||||
amsb = ASIC_EXP_GATE_2_WIDTH_MSB_REG;
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR, ("Invalid gate index: %d\n", gateIndex));
|
||||
return FAIL;
|
||||
}
|
||||
if (val < 0) {
|
||||
LOG(logERROR, ("Invalid exptime (index:%d): %lld ns\n", gateIndex,
|
||||
(long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFO, ("Setting exptime %lld ns (index:%d)\n", (long long int)val,
|
||||
gateIndex));
|
||||
val *= (1E-9 * getFrequency(SYSTEM_C2));
|
||||
set64BitReg(val, alsb, amsb);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getExpTime(gateIndex);
|
||||
val /= (1E-9 * getFrequency(SYSTEM_C2));
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
updateGatePeriod();
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getExpTime(int gateIndex) {
|
||||
uint32_t alsb = 0;
|
||||
uint32_t amsb = 0;
|
||||
switch (gateIndex) {
|
||||
case 0:
|
||||
alsb = ASIC_EXP_GATE_0_WIDTH_LSB_REG;
|
||||
amsb = ASIC_EXP_GATE_0_WIDTH_MSB_REG;
|
||||
break;
|
||||
case 1:
|
||||
alsb = ASIC_EXP_GATE_1_WIDTH_LSB_REG;
|
||||
amsb = ASIC_EXP_GATE_1_WIDTH_MSB_REG;
|
||||
break;
|
||||
case 2:
|
||||
alsb = ASIC_EXP_GATE_2_WIDTH_LSB_REG;
|
||||
amsb = ASIC_EXP_GATE_2_WIDTH_MSB_REG;
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR, ("Invalid gate index: %d\n", gateIndex));
|
||||
return -1;
|
||||
}
|
||||
return get64BitReg(alsb, amsb) / (1E-9 * getFrequency(SYSTEM_C2));
|
||||
}
|
||||
|
||||
int setGateDelay(int gateIndex, int64_t val) {
|
||||
uint32_t alsb = 0;
|
||||
uint32_t amsb = 0;
|
||||
switch (gateIndex) {
|
||||
case 0:
|
||||
alsb = ASIC_EXP_GATE_0_DELAY_LSB_REG;
|
||||
amsb = ASIC_EXP_GATE_0_DELAY_MSB_REG;
|
||||
break;
|
||||
case 1:
|
||||
alsb = ASIC_EXP_GATE_1_DELAY_LSB_REG;
|
||||
amsb = ASIC_EXP_GATE_1_DELAY_MSB_REG;
|
||||
break;
|
||||
case 2:
|
||||
alsb = ASIC_EXP_GATE_2_DELAY_LSB_REG;
|
||||
amsb = ASIC_EXP_GATE_2_DELAY_MSB_REG;
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR, ("Invalid gate index: %d\n", gateIndex));
|
||||
return FAIL;
|
||||
}
|
||||
if (val < 0) {
|
||||
LOG(logERROR, ("Invalid gate delay (index:%d): %lld ns\n", gateIndex,
|
||||
(long long int)val));
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFO, ("Setting gate delay %lld ns (index:%d)\n", (long long int)val,
|
||||
gateIndex));
|
||||
val *= (1E-9 * getFrequency(SYSTEM_C2));
|
||||
set64BitReg(val, alsb, amsb);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getGateDelay(gateIndex);
|
||||
val /= (1E-9 * getFrequency(SYSTEM_C2));
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
updateGatePeriod();
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getGateDelay(int gateIndex) {
|
||||
uint32_t alsb = 0;
|
||||
uint32_t amsb = 0;
|
||||
switch (gateIndex) {
|
||||
case 0:
|
||||
alsb = ASIC_EXP_GATE_0_DELAY_LSB_REG;
|
||||
amsb = ASIC_EXP_GATE_0_DELAY_MSB_REG;
|
||||
break;
|
||||
case 1:
|
||||
alsb = ASIC_EXP_GATE_1_DELAY_LSB_REG;
|
||||
amsb = ASIC_EXP_GATE_1_DELAY_MSB_REG;
|
||||
break;
|
||||
case 2:
|
||||
alsb = ASIC_EXP_GATE_2_DELAY_LSB_REG;
|
||||
amsb = ASIC_EXP_GATE_2_DELAY_MSB_REG;
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR, ("Invalid gate index: %d\n", gateIndex));
|
||||
return -1;
|
||||
}
|
||||
return get64BitReg(alsb, amsb) / (1E-9 * getFrequency(SYSTEM_C2));
|
||||
}
|
||||
|
||||
void setCounterMask(uint32_t arg) {
|
||||
@ -854,6 +1024,8 @@ void setCounterMask(uint32_t arg) {
|
||||
bus_w(addr, bus_r(addr) & ~CONFIG_COUNTER_ENA_MSK);
|
||||
bus_w(addr, bus_r(addr) | val);
|
||||
LOG(logDEBUG, ("Config Reg: 0x%x\n", bus_r(addr)));
|
||||
|
||||
updateGatePeriod();
|
||||
}
|
||||
|
||||
uint32_t getCounterMask() {
|
||||
@ -899,12 +1071,12 @@ int setDelayAfterTrigger(int64_t val) {
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val));
|
||||
val *= (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
val *= (1E-9 * getFrequency(SYSTEM_C2));
|
||||
set64BitReg(val, SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getDelayAfterTrigger();
|
||||
val /= (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
val /= (1E-9 * getFrequency(SYSTEM_C2));
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
@ -913,7 +1085,7 @@ int setDelayAfterTrigger(int64_t val) {
|
||||
|
||||
int64_t getDelayAfterTrigger() {
|
||||
return get64BitReg(SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG) /
|
||||
(1E-9 * FIXED_PLL_FREQUENCY);
|
||||
(1E-9 * getFrequency(SYSTEM_C2));
|
||||
}
|
||||
|
||||
int64_t getNumFramesLeft() {
|
||||
@ -926,12 +1098,12 @@ int64_t getNumTriggersLeft() {
|
||||
|
||||
int64_t getDelayAfterTriggerLeft() {
|
||||
return get64BitReg(GET_DELAY_LSB_REG, GET_DELAY_MSB_REG) /
|
||||
(1E-9 * FIXED_PLL_FREQUENCY);
|
||||
(1E-9 * getFrequency(SYSTEM_C2));
|
||||
}
|
||||
|
||||
int64_t getPeriodLeft() {
|
||||
return get64BitReg(GET_PERIOD_LSB_REG, GET_PERIOD_MSB_REG) /
|
||||
(1E-9 * FIXED_PLL_FREQUENCY);
|
||||
(1E-9 * getFrequency(SYSTEM_C2));
|
||||
}
|
||||
|
||||
int64_t getFramesFromStart() {
|
||||
@ -1016,23 +1188,153 @@ void setTiming(enum timingMode arg) {
|
||||
if (arg != GET_TIMING_MODE) {
|
||||
switch (arg) {
|
||||
case AUTO_TIMING:
|
||||
LOG(logINFO, ("Set Timing: Auto\n"));
|
||||
LOG(logINFO, ("Set Timing: Auto (Int. Trigger, Int. Gating)\n"));
|
||||
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SIGNAL_MSK);
|
||||
bus_w(ASIC_EXP_STATUS_REG,
|
||||
bus_r(ASIC_EXP_STATUS_REG) & ~ASIC_EXP_STAT_GATE_SRC_EXT_MSK);
|
||||
break;
|
||||
case TRIGGER_EXPOSURE:
|
||||
LOG(logINFO, ("Set Timing: Trigger\n"));
|
||||
LOG(logINFO, ("Set Timing: Trigger (Ext. Trigger, Int. Gating)\n"));
|
||||
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) | EXT_SIGNAL_MSK);
|
||||
bus_w(ASIC_EXP_STATUS_REG,
|
||||
bus_r(ASIC_EXP_STATUS_REG) & ~ASIC_EXP_STAT_GATE_SRC_EXT_MSK);
|
||||
break;
|
||||
case GATED:
|
||||
LOG(logINFO, ("Set Timing: Gating (Int. Trigger, Ext. Gating)\n"));
|
||||
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SIGNAL_MSK);
|
||||
bus_w(ASIC_EXP_STATUS_REG,
|
||||
bus_r(ASIC_EXP_STATUS_REG) | ASIC_EXP_STAT_GATE_SRC_EXT_MSK);
|
||||
break;
|
||||
case TRIGGER_GATED:
|
||||
LOG(logINFO,
|
||||
("Set Timing: Trigger_Gating (Ext. Trigger, Ext. Gating)\n"));
|
||||
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) | EXT_SIGNAL_MSK);
|
||||
bus_w(ASIC_EXP_STATUS_REG,
|
||||
bus_r(ASIC_EXP_STATUS_REG) | ASIC_EXP_STAT_GATE_SRC_EXT_MSK);
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum timingMode getTiming() {
|
||||
if (bus_r(EXT_SIGNAL_REG) == EXT_SIGNAL_MSK)
|
||||
return TRIGGER_EXPOSURE;
|
||||
return AUTO_TIMING;
|
||||
uint32_t extTrigger = (bus_r(EXT_SIGNAL_REG) & EXT_SIGNAL_MSK);
|
||||
uint32_t extGate =
|
||||
(bus_r(ASIC_EXP_STATUS_REG) & ASIC_EXP_STAT_GATE_SRC_EXT_MSK);
|
||||
if (extTrigger) {
|
||||
if (extGate) {
|
||||
// external trigger, external gating
|
||||
return TRIGGER_GATED;
|
||||
} else {
|
||||
// external trigger, internal gating
|
||||
return TRIGGER_EXPOSURE;
|
||||
}
|
||||
} else {
|
||||
if (extGate) {
|
||||
// internal trigger, external gating
|
||||
return GATED;
|
||||
} else {
|
||||
// internal trigger, internal gating
|
||||
return AUTO_TIMING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setInitialExtSignals() {
|
||||
LOG(logINFOBLUE, ("Setting Initial External Signals\n"));
|
||||
// default, everything is 0
|
||||
// bypass everything
|
||||
// (except master input can edge detect)
|
||||
bus_w(DINF1_REG, DINF1_BYPASS_GATE_MSK);
|
||||
bus_w(DOUTIF1_REG, DOUTIF1_BYPASS_MSK);
|
||||
bus_w(DINF2_REG, DINF2_BYPASS_MSK);
|
||||
|
||||
// master input can edge detect, so rising is 1
|
||||
bus_w(DINF1_REG, bus_r(DINF1_REG) | DINF1_RISING_TRIGGER_MSK);
|
||||
}
|
||||
|
||||
void setExtSignal(int signalIndex, enum externalSignalFlag mode) {
|
||||
LOG(logDEBUG1, ("Setting signal flag[%d] to %d\n", signalIndex, mode));
|
||||
|
||||
if (signalIndex == 0 && mode != TRIGGER_IN_RISING_EDGE &&
|
||||
mode != TRIGGER_IN_FALLING_EDGE) {
|
||||
return;
|
||||
}
|
||||
|
||||
// getting addr and mask for each signal
|
||||
uint32_t addr = 0;
|
||||
uint32_t mask = 0;
|
||||
if (signalIndex <= 3) {
|
||||
addr = DINF1_REG;
|
||||
int offset = DINF1_INVERSION_OFST + signalIndex;
|
||||
mask = (1 << offset);
|
||||
} else {
|
||||
addr = DOUTIF1_REG;
|
||||
int offset = DOUTIF1_INVERSION_OFST + signalIndex - 4;
|
||||
mask = (1 << offset);
|
||||
}
|
||||
LOG(logDEBUG, ("addr: 0x%x mask:0x%x\n", addr, mask));
|
||||
|
||||
switch (mode) {
|
||||
case TRIGGER_IN_RISING_EDGE:
|
||||
LOG(logINFO, ("Setting External Master Input Signal flag: Trigger in "
|
||||
"Rising Edge\n"));
|
||||
bus_w(addr, bus_r(addr) & ~mask);
|
||||
break;
|
||||
case TRIGGER_IN_FALLING_EDGE:
|
||||
LOG(logINFO, ("Setting External Master Input Signal flag: Trigger in "
|
||||
"Falling Edge\n"));
|
||||
bus_w(addr, bus_r(addr) | mask);
|
||||
break;
|
||||
case INVERSION_ON:
|
||||
LOG(logINFO, ("Setting External Master %s Signal flag: Inversion on\n",
|
||||
(signalIndex <= 3 ? "Input" : "Output")));
|
||||
bus_w(addr, bus_r(addr) | mask);
|
||||
break;
|
||||
case INVERSION_OFF:
|
||||
LOG(logINFO, ("Setting External Master %s Signal flag: Inversion offn",
|
||||
(signalIndex <= 3 ? "Input" : "Output")));
|
||||
bus_w(addr, bus_r(addr) & ~mask);
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR,
|
||||
("Extsig (signal mode) %d not defined for this detector\n", mode));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int getExtSignal(int signalIndex) {
|
||||
// getting addr and mask for each signal
|
||||
uint32_t addr = 0;
|
||||
uint32_t mask = 0;
|
||||
if (signalIndex <= 3) {
|
||||
addr = DINF1_REG;
|
||||
int offset = DINF1_INVERSION_OFST + signalIndex;
|
||||
mask = (1 << offset);
|
||||
} else {
|
||||
addr = DOUTIF1_REG;
|
||||
int offset = DOUTIF1_INVERSION_OFST + signalIndex - 4;
|
||||
mask = (1 << offset);
|
||||
}
|
||||
LOG(logDEBUG, ("addr: 0x%x mask:0x%x\n", addr, mask));
|
||||
|
||||
int val = bus_r(addr) & mask;
|
||||
// master input trigger signal
|
||||
if (signalIndex == 0) {
|
||||
if (val) {
|
||||
return TRIGGER_IN_FALLING_EDGE;
|
||||
} else {
|
||||
return TRIGGER_IN_RISING_EDGE;
|
||||
}
|
||||
} else {
|
||||
if (val) {
|
||||
return INVERSION_ON;
|
||||
} else {
|
||||
return INVERSION_OFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int configureMAC() {
|
||||
@ -1186,6 +1488,16 @@ int *getDetectorPosition() { return detPos; }
|
||||
|
||||
/* pattern */
|
||||
|
||||
void startPattern() {
|
||||
LOG(logINFOBLUE, ("Starting Pattern\n"));
|
||||
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STRT_PATTERN_MSK);
|
||||
usleep(1);
|
||||
while (bus_r(PAT_STATUS_REG) & PAT_STATUS_RUN_BUSY_MSK) {
|
||||
usleep(1);
|
||||
}
|
||||
LOG(logINFOBLUE, ("Pattern done\n"));
|
||||
}
|
||||
|
||||
uint64_t readPatternWord(int addr) {
|
||||
// error (handled in tcp)
|
||||
if (addr < 0 || addr >= MAX_PATTERN_LENGTH) {
|
||||
@ -1726,7 +2038,7 @@ void *start_timer(void *arg) {
|
||||
|
||||
int64_t periodNs = getPeriod();
|
||||
int numFrames = (getNumFrames() * getNumTriggers());
|
||||
int64_t expUs = getExpTime() / 1000;
|
||||
int64_t expUs = getGatePeriod() / 1000;
|
||||
|
||||
// int dr = setDynamicRange(-1);
|
||||
int imagesize = calculateDataBytes();
|
||||
@ -1840,20 +2152,20 @@ enum runStatus getRunStatus() {
|
||||
}
|
||||
#endif
|
||||
LOG(logDEBUG1, ("Getting status\n"));
|
||||
uint32_t retval = bus_r(PAT_STATUS_REG);
|
||||
uint32_t retval = bus_r(FLOW_STATUS_REG);
|
||||
LOG(logINFO, ("Status Register: %08x\n", retval));
|
||||
|
||||
enum runStatus s;
|
||||
|
||||
// running
|
||||
if (retval & PAT_STATUS_RUN_BUSY_MSK) {
|
||||
if (retval & PAT_STATUS_WAIT_FOR_TRGGR_MSK) {
|
||||
if (retval & FLOW_STATUS_RUN_BUSY_MSK) {
|
||||
if (retval & FLOW_STATUS_WAIT_FOR_TRGGR_MSK) {
|
||||
LOG(logINFOBLUE, ("Status: WAITING\n"));
|
||||
s = WAITING;
|
||||
} else {
|
||||
if (retval & PAT_STATUS_DLY_BFRE_TRGGR_MSK) {
|
||||
if (retval & FLOW_STATUS_DLY_BFRE_TRGGR_MSK) {
|
||||
LOG(logINFO, ("Status: Delay before Trigger\n"));
|
||||
} else if (retval & PAT_STATUS_DLY_AFTR_TRGGR_MSK) {
|
||||
} else if (retval & FLOW_STATUS_DLY_AFTR_TRGGR_MSK) {
|
||||
LOG(logINFO, ("Status: Delay after Trigger\n"));
|
||||
}
|
||||
LOG(logINFOBLUE, ("Status: RUNNING\n"));
|
||||
@ -1864,10 +2176,10 @@ enum runStatus getRunStatus() {
|
||||
// not running
|
||||
else {
|
||||
// stopped or error
|
||||
if (retval & PAT_STATUS_FIFO_FULL_MSK) {
|
||||
if (retval & FLOW_STATUS_FIFO_FULL_MSK) {
|
||||
LOG(logINFOBLUE, ("Status: STOPPED\n")); // FIFO FULL??
|
||||
s = STOPPED;
|
||||
} else if (retval & PAT_STATUS_CSM_BUSY_MSK) {
|
||||
} else if (retval & FLOW_STATUS_CSM_BUSY_MSK) {
|
||||
LOG(logINFOBLUE, ("Status: READ MACHINE BUSY\n"));
|
||||
s = TRANSMITTING;
|
||||
} else if (!retval) {
|
||||
@ -1912,7 +2224,7 @@ u_int32_t runBusy() {
|
||||
}
|
||||
return virtual_status;
|
||||
#endif
|
||||
u_int32_t s = (bus_r(PAT_STATUS_REG) & PAT_STATUS_RUN_BUSY_MSK);
|
||||
u_int32_t s = (bus_r(FLOW_STATUS_REG) & FLOW_STATUS_RUN_BUSY_MSK);
|
||||
// LOG(logDEBUG1, ("Status Register: %08x\n", s));
|
||||
return s;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
#define NCHAN (128 * NCOUNTERS)
|
||||
#define NCHIP (10)
|
||||
#define NDAC (16)
|
||||
#define HV_SOFT_MAX_VOLTAGE (200)
|
||||
#define HV_SOFT_MAX_VOLTAGE (500)
|
||||
#define HV_HARD_MAX_VOLTAGE (530)
|
||||
#define HV_DRIVER_FILE_NAME ("/etc/devlinks/hvdac")
|
||||
#define DAC_DRIVER_FILE_NAME ("/etc/devlinks/dac")
|
||||
@ -21,21 +21,26 @@
|
||||
#define TYPE_MYTHEN3_MODULE_VAL (93)
|
||||
#define TYPE_TOLERANCE (10)
|
||||
#define TYPE_NO_MODULE_STARTING_VAL (800)
|
||||
#define MAX_EXT_SIGNALS (8)
|
||||
|
||||
/** Default Parameters */
|
||||
#define DEFAULT_DYNAMIC_RANGE (24)
|
||||
#define DEFAULT_NUM_FRAMES (1)
|
||||
#define DEFAULT_NUM_CYCLES (1)
|
||||
#define DEFAULT_EXPTIME (100 * 1000 * 1000) // ns
|
||||
#define DEFAULT_PERIOD (2 * 1000 * 1000) // ns
|
||||
#define DEFAULT_DELAY_AFTER_TRIGGER (0)
|
||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||
#define DEFAULT_READOUT_C0 (10) //(125000000) // rdo_clk, 125 MHz
|
||||
#define DEFAULT_READOUT_C1 (10) //(125000000) // rdo_x2_clk, 125 MHz
|
||||
#define DEFAULT_SYSTEM_C0 (5) //(250000000) // run_clk, 250 MHz
|
||||
#define DEFAULT_SYSTEM_C1 (10) //(125000000) // chip_clk, 125 MHz
|
||||
#define DEFAULT_SYSTEM_C2 (10) //(125000000) // sync_clk, 125 MHz
|
||||
#define DEFAULT_INTERNAL_GATES (1)
|
||||
#define DEFAULT_EXTERNAL_GATES (1)
|
||||
#define DEFAULT_DYNAMIC_RANGE (24)
|
||||
#define DEFAULT_NUM_FRAMES (1)
|
||||
#define DEFAULT_NUM_CYCLES (1)
|
||||
#define DEFAULT_GATE_WIDTH (100 * 1000 * 1000) // ns
|
||||
#define DEFAULT_GATE_DELAY (0)
|
||||
#define DEFAULT_PERIOD (2 * 1000 * 1000) // ns
|
||||
#define DEFAULT_DELAY_AFTER_TRIGGER (0)
|
||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||
#define DEFAULT_READOUT_C0 (10) //(125000000) // rdo_clk, 125 MHz
|
||||
#define DEFAULT_READOUT_C1 (10) //(125000000) // rdo_x2_clk, 125 MHz
|
||||
#define DEFAULT_SYSTEM_C0 (5) //(250000000) // run_clk, 250 MHz
|
||||
#define DEFAULT_SYSTEM_C1 (10) //(125000000) // chip_clk, 125 MHz
|
||||
#define DEFAULT_SYSTEM_C2 (10) //(125000000) // sync_clk, 125 MHz
|
||||
#define DEFAULT_ASIC_LATCHING_NUM_PULSES (10)
|
||||
|
||||
/* Firmware Definitions */
|
||||
#define IP_HEADER_SIZE (20)
|
||||
|
@ -115,6 +115,9 @@ void updateDataBytes();
|
||||
defined(MOENCHD)
|
||||
int setDefaultDacs();
|
||||
#endif
|
||||
#ifdef MYTHEN3D
|
||||
void setASICDefaults();
|
||||
#endif
|
||||
#if defined(GOTTHARD2D) || defined(EIGERD)
|
||||
int readConfigFile();
|
||||
#endif
|
||||
@ -201,10 +204,23 @@ void setNumFrames(int64_t val);
|
||||
int64_t getNumFrames();
|
||||
void setNumTriggers(int64_t val);
|
||||
int64_t getNumTriggers();
|
||||
#ifndef MYTHEN3D
|
||||
int setExpTime(int64_t val);
|
||||
int64_t getExpTime();
|
||||
#endif
|
||||
int setPeriod(int64_t val);
|
||||
int64_t getPeriod();
|
||||
#ifdef MYTHEN3D
|
||||
void setNumIntGates(int val);
|
||||
void setNumGates(int val);
|
||||
int getNumGates();
|
||||
void updateGatePeriod();
|
||||
int64_t getGatePeriod();
|
||||
int setExpTime(int gateIndex, int64_t val);
|
||||
int64_t getExpTime(int gateIndex);
|
||||
int setGateDelay(int gateIndex, int64_t val);
|
||||
int64_t getGateDelay(int gateIndex);
|
||||
#endif
|
||||
#ifdef GOTTHARD2D
|
||||
void setNumBursts(int64_t val);
|
||||
int64_t getNumBursts();
|
||||
@ -321,9 +337,12 @@ int setHighVoltage(int val);
|
||||
// parameters - timing, extsig
|
||||
void setTiming(enum timingMode arg);
|
||||
enum timingMode getTiming();
|
||||
#ifdef GOTTHARDD
|
||||
void setExtSignal(enum externalSignalFlag mode);
|
||||
int getExtSignal();
|
||||
#ifdef MYTHEN3D
|
||||
void setInitialExtSignals();
|
||||
#endif
|
||||
#if defined(GOTTHARDD) || defined(MYTHEN3D)
|
||||
void setExtSignal(int signalIndex, enum externalSignalFlag mode);
|
||||
int getExtSignal(int signalIndex);
|
||||
#endif
|
||||
|
||||
// configure mac
|
||||
@ -449,6 +468,7 @@ int getActivate(int *retval);
|
||||
int setPhase(enum CLKINDEX ind, int val, int degrees);
|
||||
|
||||
#elif MYTHEN3D
|
||||
void startPattern();
|
||||
uint64_t readPatternWord(int addr);
|
||||
uint64_t writePatternWord(int addr, uint64_t word);
|
||||
int setPatternWaitAddress(int level, int addr);
|
||||
|
@ -26,6 +26,7 @@ void rebootNiosControllerAndFPGA();
|
||||
// functions called by client
|
||||
int exec_command(int);
|
||||
int get_detector_type(int);
|
||||
int get_external_signal_flag(int);
|
||||
int set_external_signal_flag(int);
|
||||
int set_timing_mode(int);
|
||||
int get_firmware_version(int);
|
||||
@ -217,3 +218,10 @@ int set_timing_source(int);
|
||||
int get_num_channels(int);
|
||||
int update_rate_correction(int);
|
||||
int get_receiver_parameters(int);
|
||||
int start_pattern(int);
|
||||
int set_num_gates(int);
|
||||
int get_num_gates(int);
|
||||
int set_gate_delay(int);
|
||||
int get_gate_delay(int);
|
||||
int get_exptime_all_gates(int);
|
||||
int get_gate_delay_all_gates(int);
|
@ -44,7 +44,7 @@ int findFlash(char *mess) {
|
||||
if (fp == NULL) {
|
||||
strcpy(mess, "popen returned NULL. Need that to get mtd drive.\n");
|
||||
LOG(logERROR, (mess));
|
||||
return RO_TRIGGER_IN_FALLING_EDGE;
|
||||
return FAIL;
|
||||
}
|
||||
if (fgets(output, sizeof(output), fp) == NULL) {
|
||||
strcpy(mess, "fgets returned NULL. Need that to get mtd drive.\n");
|
||||
|
@ -137,10 +137,10 @@ const char *getRunStateName(enum runStatus ind) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void function_table() {
|
||||
flist[F_EXEC_COMMAND] = &exec_command;
|
||||
flist[F_GET_DETECTOR_TYPE] = &get_detector_type;
|
||||
flist[F_GET_EXTERNAL_SIGNAL_FLAG] = &get_external_signal_flag;
|
||||
flist[F_SET_EXTERNAL_SIGNAL_FLAG] = &set_external_signal_flag;
|
||||
flist[F_SET_TIMING_MODE] = &set_timing_mode;
|
||||
flist[F_GET_FIRMWARE_VERSION] = &get_firmware_version;
|
||||
@ -329,6 +329,13 @@ void function_table() {
|
||||
flist[F_GET_NUM_CHANNELS] = &get_num_channels;
|
||||
flist[F_UPDATE_RATE_CORRECTION] = &update_rate_correction;
|
||||
flist[F_GET_RECEIVER_PARAMETERS] = &get_receiver_parameters;
|
||||
flist[F_START_PATTERN] = &start_pattern;
|
||||
flist[F_SET_NUM_GATES] = &set_num_gates;
|
||||
flist[F_GET_NUM_GATES] = &get_num_gates;
|
||||
flist[F_SET_GATE_DELAY] = &set_gate_delay;
|
||||
flist[F_GET_GATE_DELAY] = &get_gate_delay;
|
||||
flist[F_GET_EXPTIME_ALL_GATES] = &get_exptime_all_gates;
|
||||
flist[F_GET_GATE_DELAY_ALL_GATES] = &get_gate_delay_all_gates;
|
||||
|
||||
// check
|
||||
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
||||
@ -464,29 +471,98 @@ int get_detector_type(int file_des) {
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_external_signal_flag(int file_des) {
|
||||
int get_external_signal_flag(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int arg = -1;
|
||||
enum externalSignalFlag retval = GET_EXTERNAL_SIGNAL_FLAG;
|
||||
enum externalSignalFlag retval = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
enum externalSignalFlag flag = arg;
|
||||
LOG(logDEBUG1, ("Setting external signal flag to %d\n", flag));
|
||||
LOG(logDEBUG1, ("Getting external signal flag (%d)\n", arg));
|
||||
|
||||
#ifndef GOTTHARDD
|
||||
#if !defined(GOTTHARDD) && !defined(MYTHEN3D)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// set
|
||||
if ((flag != GET_EXTERNAL_SIGNAL_FLAG) && (Server_VerifyLock() == OK)) {
|
||||
setExtSignal(flag);
|
||||
}
|
||||
// get
|
||||
retval = getExtSignal();
|
||||
validate((int)flag, (int)retval, "set external signal flag", DEC);
|
||||
LOG(logDEBUG1, ("External Signal Flag: %d\n", retval));
|
||||
if (arg < 0 || arg >= MAX_EXT_SIGNALS) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Signal index %d can only be between 0 and %d\n", arg,
|
||||
MAX_EXT_SIGNALS - 1);
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
retval = getExtSignal(arg);
|
||||
LOG(logDEBUG1, ("External Signal Flag: %d\n", retval));
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_external_signal_flag(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int args[2] = {-1, -1};
|
||||
enum externalSignalFlag retval = -1;
|
||||
|
||||
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
int signalIndex = args[0];
|
||||
enum externalSignalFlag flag = args[1];
|
||||
LOG(logDEBUG1,
|
||||
("Setting external signal flag [%d] to %d\n", signalIndex, flag));
|
||||
|
||||
#if !defined(GOTTHARDD) && !defined(MYTHEN3D)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if (signalIndex < 0 || signalIndex >= MAX_EXT_SIGNALS) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Signal index %d can only be between 0 and %d\n",
|
||||
signalIndex, MAX_EXT_SIGNALS - 1);
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
switch (flag) {
|
||||
case TRIGGER_IN_RISING_EDGE:
|
||||
case TRIGGER_IN_FALLING_EDGE:
|
||||
#ifdef MYTHEN3D
|
||||
if (signalIndex > 0) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Only Master input trigger signal can edge detect. "
|
||||
"Not signal %d\n",
|
||||
signalIndex);
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
#ifdef MYTHEN3D
|
||||
case INVERSION_ON:
|
||||
case INVERSION_OFF:
|
||||
if (signalIndex == 0) {
|
||||
ret = FAIL;
|
||||
sprintf(
|
||||
mess,
|
||||
"Master input trigger signal cannot invert. Use "
|
||||
"trigger_in_rising_edge or trigger_in_falling_edge\n");
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Unknown flag %d for this detector\n", flag);
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
if (ret == OK) {
|
||||
setExtSignal(signalIndex, flag);
|
||||
retval = getExtSignal(signalIndex);
|
||||
validate((int)flag, (int)retval, "set external signal flag", DEC);
|
||||
LOG(logDEBUG1, ("External Signal Flag: %d\n", retval));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
@ -509,6 +585,9 @@ int set_timing_mode(int file_des) {
|
||||
#ifdef EIGERD
|
||||
case GATED:
|
||||
case BURST_TRIGGER:
|
||||
#elif MYTHEN3D
|
||||
case GATED:
|
||||
case TRIGGER_GATED:
|
||||
#endif
|
||||
setTiming(arg);
|
||||
break;
|
||||
@ -2082,34 +2161,114 @@ int set_num_digital_samples(int file_des) {
|
||||
int get_exptime(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int gateIndex = -1;
|
||||
int64_t retval = -1;
|
||||
|
||||
// get only
|
||||
retval = getExpTime();
|
||||
LOG(logDEBUG1, ("retval exptime %lld ns\n", (long long int)retval));
|
||||
if (receiveData(file_des, &gateIndex, sizeof(gateIndex), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
// get only
|
||||
#ifdef MYTHEN3D
|
||||
if (gateIndex < 0 || gateIndex > 2) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not get exposure time. Invalid gate index %d. "
|
||||
"Options [0-2]\n",
|
||||
gateIndex);
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
retval = getExpTime(gateIndex);
|
||||
LOG(logDEBUG1, ("retval exptime %lld ns\n", (long long int)retval));
|
||||
}
|
||||
#else
|
||||
if (gateIndex != -1) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not get exposure time. Gate index not implemented "
|
||||
"for this detector\n");
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
retval = getExpTime();
|
||||
LOG(logDEBUG1, ("retval exptime %lld ns\n", (long long int)retval));
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_exptime(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t arg = -1;
|
||||
int64_t args[2] = {-1, -1};
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||
if (receiveData(file_des, args, sizeof(args), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
LOG(logDEBUG1, ("Setting exptime %lld ns\n", (long long int)arg));
|
||||
int gateIndex = args[0];
|
||||
int64_t val = args[1];
|
||||
LOG(logDEBUG1, ("Setting exptime %lld ns (gateIndex:%d)\n",
|
||||
(long long int)val, gateIndex));
|
||||
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
ret = setExpTime(arg);
|
||||
int64_t retval = getExpTime();
|
||||
LOG(logDEBUG1, ("retval exptime %lld ns\n", (long long int)retval));
|
||||
if (ret == FAIL) {
|
||||
#ifdef MYTHEN3D
|
||||
if (gateIndex < -1 || gateIndex > 2) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not set exposure time. Set %lld ns, read %lld ns.\n",
|
||||
(long long int)arg, (long long int)retval);
|
||||
"Could not set exposure time. Invalid gate index %d. "
|
||||
"Options [-1, 0-2]\n",
|
||||
gateIndex);
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
// specific gate index
|
||||
if (gateIndex != -1) {
|
||||
ret = setExpTime(gateIndex, val);
|
||||
int64_t retval = getExpTime(gateIndex);
|
||||
LOG(logDEBUG1,
|
||||
("retval exptime %lld ns\n", (long long int)retval));
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess,
|
||||
"Could not set exposure time. Set %lld ns, read "
|
||||
"%lld ns.\n",
|
||||
(long long int)val, (long long int)retval);
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
// all gate indices
|
||||
else {
|
||||
for (int i = 0; i != 3; ++i) {
|
||||
ret = setExpTime(i, val);
|
||||
int64_t retval = getExpTime(i);
|
||||
LOG(logDEBUG1, ("retval exptime %lld ns (index:%d)\n",
|
||||
(long long int)retval, i));
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess,
|
||||
"Could not set exptime. Set %lld ns, read %lld "
|
||||
"ns.\n",
|
||||
(long long int)val, (long long int)retval);
|
||||
LOG(logERROR, (mess));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (gateIndex != -1) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not get exposure time. Gate index not implemented "
|
||||
"for this detector\n");
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
ret = setExpTime(val);
|
||||
int64_t retval = getExpTime();
|
||||
LOG(logDEBUG1, ("retval exptime %lld ns\n", (long long int)retval));
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess,
|
||||
"Could not set exposure time. Set %lld ns, read "
|
||||
"%lld ns.\n",
|
||||
(long long int)val, (long long int)retval);
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return Server_SendResult(file_des, INT64, NULL, 0);
|
||||
}
|
||||
@ -3266,8 +3425,8 @@ int set_rate_correct(int file_des) {
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
ret = validateAndSetRateCorrection(tau_ns, mess);
|
||||
int64_t retval = getCurrentTau(); // to update eiger_tau_ns (for update
|
||||
// rate correction)
|
||||
int64_t retval = getCurrentTau(); // to update eiger_tau_ns (for
|
||||
// update rate correction)
|
||||
if (ret == FAIL) {
|
||||
strcpy(mess, "Rate correction failed\n");
|
||||
LOG(logERROR, (mess));
|
||||
@ -3690,14 +3849,13 @@ int power_chip(int file_des) {
|
||||
LOG(logERROR, (mess));
|
||||
} else if (type_ret == FAIL) {
|
||||
ret = FAIL;
|
||||
sprintf(
|
||||
mess,
|
||||
"Could not power on chip. Wrong module attached!\n");
|
||||
sprintf(mess, "Could not power on chip. Wrong module "
|
||||
"attached!\n");
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
} else {
|
||||
LOG(logINFOBLUE,
|
||||
("In No-Module mode: Ignoring module type. Continuing.\n"));
|
||||
LOG(logINFOBLUE, ("In No-Module mode: Ignoring module "
|
||||
"type. Continuing.\n"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -4224,10 +4382,10 @@ int set_adc_enable_mask_10g(int file_des) {
|
||||
uint32_t retval = getADCEnableMask_10G();
|
||||
if (arg != retval) {
|
||||
ret = FAIL;
|
||||
sprintf(
|
||||
mess,
|
||||
"Could not set 10Gb ADC Enable mask. Set 0x%x, but read 0x%x\n",
|
||||
arg, retval);
|
||||
sprintf(mess,
|
||||
"Could not set 10Gb ADC Enable mask. Set 0x%x, but "
|
||||
"read 0x%x\n",
|
||||
arg, retval);
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
@ -4270,10 +4428,10 @@ int set_adc_invert(int file_des) {
|
||||
uint32_t retval = getADCInvertRegister();
|
||||
if (arg != retval) {
|
||||
ret = FAIL;
|
||||
sprintf(
|
||||
mess,
|
||||
"Could not set ADC Invert register. Set 0x%x, but read 0x%x\n",
|
||||
arg, retval);
|
||||
sprintf(mess,
|
||||
"Could not set ADC Invert register. Set 0x%x, but read "
|
||||
"0x%x\n",
|
||||
arg, retval);
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
@ -4446,9 +4604,8 @@ int get_starting_frame_number(int file_des) {
|
||||
// get
|
||||
ret = getStartingFrameNumber(&retval);
|
||||
if (ret == FAIL) {
|
||||
sprintf(
|
||||
mess,
|
||||
"Could not get starting frame number. Failed to map address.\n");
|
||||
sprintf(mess, "Could not get starting frame number. Failed to map "
|
||||
"address.\n");
|
||||
LOG(logERROR, (mess));
|
||||
} else if (ret == -2) {
|
||||
sprintf(mess, "Inconsistent starting frame number from left and right "
|
||||
@ -4532,10 +4689,10 @@ int set_interrupt_subframe(int file_des) {
|
||||
int retval = getInterruptSubframe();
|
||||
if (arg != retval) {
|
||||
ret = FAIL;
|
||||
sprintf(
|
||||
mess,
|
||||
"Could not set Intertupt Subframe. Set %d, but read %d\n",
|
||||
retval, arg);
|
||||
sprintf(mess,
|
||||
"Could not set Intertupt Subframe. Set %d, but "
|
||||
"read %d\n",
|
||||
retval, arg);
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
@ -4613,10 +4770,10 @@ int set_read_n_lines(int file_des) {
|
||||
int retval = getReadNLines();
|
||||
if (arg != retval) {
|
||||
ret = FAIL;
|
||||
sprintf(
|
||||
mess,
|
||||
"Could not set read n lines. Set %d, but read %d\n",
|
||||
retval, arg);
|
||||
sprintf(mess,
|
||||
"Could not set read n lines. Set %d, but "
|
||||
"read %d\n",
|
||||
retval, arg);
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
@ -6179,10 +6336,10 @@ int get_on_chip_dac(int file_des) {
|
||||
(int)dacIndex, chipIndex);
|
||||
if (chipIndex < -1 || chipIndex >= NCHIP) {
|
||||
ret = FAIL;
|
||||
sprintf(
|
||||
mess,
|
||||
"Could not get %s. Invalid Chip Index. Options[-1, 0 - %d]\n",
|
||||
modeName, NCHIP - 1);
|
||||
sprintf(mess,
|
||||
"Could not get %s. Invalid Chip Index. Options[-1, 0 - "
|
||||
"%d]\n",
|
||||
modeName, NCHIP - 1);
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
retval = getOnChipDAC(dacIndex, chipIndex);
|
||||
@ -6211,10 +6368,10 @@ int set_inject_channel(int file_des) {
|
||||
int increment = args[1];
|
||||
if (offset < 0 || increment < 1) {
|
||||
ret = FAIL;
|
||||
sprintf(
|
||||
mess,
|
||||
"Could not inject channel. Invalid offset %d or increment %d\n",
|
||||
offset, increment);
|
||||
sprintf(mess,
|
||||
"Could not inject channel. Invalid offset %d or "
|
||||
"increment %d\n",
|
||||
offset, increment);
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
ret = setInjectChannel(offset, increment);
|
||||
@ -6864,8 +7021,12 @@ int get_receiver_parameters(int file_des) {
|
||||
if (n < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
// exptime
|
||||
// exptime
|
||||
#ifdef MYTHEN3D
|
||||
i64 = 0;
|
||||
#else
|
||||
i64 = getExpTime();
|
||||
#endif
|
||||
n += sendData(file_des, &i64, sizeof(i64), INT64);
|
||||
if (n < 0)
|
||||
return printSocketReadError();
|
||||
@ -7006,7 +7167,256 @@ int get_receiver_parameters(int file_des) {
|
||||
if (n < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
// exptime1
|
||||
#ifdef MYTHEN3D
|
||||
i64 = getExpTime(0);
|
||||
#else
|
||||
i64 = 0;
|
||||
#endif
|
||||
n += sendData(file_des, &i64, sizeof(i64), INT64);
|
||||
if (n < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
// exptime2
|
||||
#ifdef MYTHEN3D
|
||||
i64 = getExpTime(1);
|
||||
#else
|
||||
i64 = 0;
|
||||
#endif
|
||||
n += sendData(file_des, &i64, sizeof(i64), INT64);
|
||||
if (n < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
// exptime3
|
||||
#ifdef MYTHEN3D
|
||||
i64 = getExpTime(2);
|
||||
#else
|
||||
i64 = 0;
|
||||
#endif
|
||||
n += sendData(file_des, &i64, sizeof(i64), INT64);
|
||||
if (n < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
// gatedelay1
|
||||
#ifdef MYTHEN3D
|
||||
i64 = getGateDelay(0);
|
||||
#else
|
||||
i64 = 0;
|
||||
#endif
|
||||
n += sendData(file_des, &i64, sizeof(i64), INT64);
|
||||
if (n < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
// gatedelay2
|
||||
#ifdef MYTHEN3D
|
||||
i64 = getGateDelay(1);
|
||||
#else
|
||||
i64 = 0;
|
||||
#endif
|
||||
n += sendData(file_des, &i64, sizeof(i64), INT64);
|
||||
if (n < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
// gatedelay3
|
||||
#ifdef MYTHEN3D
|
||||
i64 = getGateDelay(2);
|
||||
#else
|
||||
i64 = 0;
|
||||
#endif
|
||||
n += sendData(file_des, &i64, sizeof(i64), INT64);
|
||||
if (n < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
// gates
|
||||
#ifdef MYTHEN3D
|
||||
i32 = getNumGates();
|
||||
#else
|
||||
i32 = 0;
|
||||
#endif
|
||||
n += sendData(file_des, &i32, sizeof(i32), INT32);
|
||||
if (n < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
LOG(logINFO, ("Sent %d bytes for receiver parameters\n", n));
|
||||
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
int start_pattern(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
|
||||
LOG(logDEBUG1, ("Starting Pattern\n"));
|
||||
#ifndef MYTHEN3D
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
startPattern();
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
}
|
||||
|
||||
int set_num_gates(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int arg = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
LOG(logDEBUG1, ("Setting number of gates %d\n", arg));
|
||||
|
||||
#if !defined(MYTHEN3D)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
setNumGates(arg);
|
||||
int retval = getNumGates();
|
||||
LOG(logDEBUG1, ("retval num gates %d\n", retval));
|
||||
validate(arg, retval, "set number of gates", DEC);
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
}
|
||||
|
||||
int get_num_gates(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int retval = -1;
|
||||
|
||||
#if !defined(MYTHEN3D)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
retval = getNumGates();
|
||||
LOG(logDEBUG1, ("retval num gates %d\n", retval));
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_gate_delay(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t args[2] = {-1, -1};
|
||||
|
||||
if (receiveData(file_des, args, sizeof(args), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
int gateIndex = args[0];
|
||||
int64_t val = args[1];
|
||||
LOG(logDEBUG1, ("Setting gate delay %lld ns (gateIndex:%d)\n",
|
||||
(long long int)val, gateIndex));
|
||||
|
||||
#if !defined(MYTHEN3D)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
if (gateIndex < -1 || gateIndex > 2) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not set gate delay. Invalid gate index %d. "
|
||||
"Options [-1, 0-2]\n",
|
||||
gateIndex);
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
// specific gate index
|
||||
if (gateIndex != -1) {
|
||||
ret = setGateDelay(gateIndex, val);
|
||||
int64_t retval = getGateDelay(gateIndex);
|
||||
LOG(logDEBUG1,
|
||||
("retval exptime %lld ns\n", (long long int)retval));
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess,
|
||||
"Could not set gate delay. Set %lld ns, read %lld "
|
||||
"ns.\n",
|
||||
(long long int)val, (long long int)retval);
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
// all gate indices
|
||||
else {
|
||||
for (int i = 0; i != 3; ++i) {
|
||||
ret = setGateDelay(i, val);
|
||||
int64_t retval = getGateDelay(i);
|
||||
LOG(logDEBUG1, ("retval gate delay %lld ns (index:%d)\n",
|
||||
(long long int)retval, i));
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess,
|
||||
"Could not set gate delay. Set %lld ns, "
|
||||
"read %lld "
|
||||
"ns.\n",
|
||||
(long long int)val, (long long int)retval);
|
||||
LOG(logERROR, (mess));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, NULL, 0);
|
||||
}
|
||||
|
||||
int get_gate_delay(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int gateIndex = -1;
|
||||
int64_t retval = -1;
|
||||
|
||||
if (receiveData(file_des, &gateIndex, sizeof(gateIndex), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
#if !defined(MYTHEN3D)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
if (gateIndex < 0 || gateIndex > 2) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not set gate delay. Invalid gate index %d. "
|
||||
"Options [0-2]\n",
|
||||
gateIndex);
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
retval = getGateDelay(gateIndex);
|
||||
LOG(logDEBUG1, ("retval gate delay %lld ns\n", (long long int)retval));
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int get_exptime_all_gates(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retvals[3] = {-1, -1, -1};
|
||||
|
||||
#if !defined(MYTHEN3D)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
for (int i = 0; i != 3; ++i) {
|
||||
retvals[i] = getExpTime(i);
|
||||
LOG(logINFO, ("retval exptime %lld ns (index:%d)\n",
|
||||
(long long int)retvals[i], i));
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, retvals, sizeof(retvals));
|
||||
}
|
||||
|
||||
int get_gate_delay_all_gates(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retvals[3] = {-1, -1, -1};
|
||||
|
||||
#if !defined(MYTHEN3D)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
for (int i = 0; i != 3; ++i) {
|
||||
retvals[i] = getGateDelay(i);
|
||||
LOG(logDEBUG1, ("retval gate delay %lld ns (index:%d)\n",
|
||||
(long long int)retvals[i], i));
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, retvals, sizeof(retvals));
|
||||
}
|
||||
|
@ -203,7 +203,9 @@ class Detector {
|
||||
Result<defs::timingMode> getTimingMode(Positions pos = {}) const;
|
||||
|
||||
/**
|
||||
* [Gotthard][Jungfrau][CTB][Moench] Options: AUTO_TIMING, TRIGGER_EXPOSURE
|
||||
* [Gotthard][Jungfrau][CTB][Moench][Mythen3] Options:
|
||||
* AUTO_TIMING, TRIGGER_EXPOSURE
|
||||
* [Gotthard2] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, TRIGGER_GATED
|
||||
* [Eiger] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER
|
||||
*/
|
||||
void setTimingMode(defs::timingMode value, Positions pos = {});
|
||||
@ -914,12 +916,17 @@ class Detector {
|
||||
/** [Gotthard] */
|
||||
Result<ns> getExptimeLeft(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard] */
|
||||
/** [Gotthard] signal index is 0
|
||||
* [Mythen3] signal index 0-3 for master input, 4-7 master output signals */
|
||||
Result<defs::externalSignalFlag>
|
||||
getExternalSignalFlags(Positions pos = {}) const;
|
||||
getExternalSignalFlags(int signalIndex, Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard] Options: TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE */
|
||||
void setExternalSignalFlags(defs::externalSignalFlag value,
|
||||
/** [Gotthard] signal index is 0
|
||||
* Options: TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE
|
||||
* [Mythen3] signal index 0-3 for master input, 4-7 master output signals
|
||||
* Options: TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE (for master
|
||||
* input trigger only), INVERSION_ON, INVERSION_OFF */
|
||||
void setExternalSignalFlags(int signalIndex, defs::externalSignalFlag value,
|
||||
Positions pos = {});
|
||||
|
||||
/**************************************************
|
||||
@ -997,6 +1004,36 @@ class Detector {
|
||||
/** [Mythen3] countermask bit set for each counter enabled */
|
||||
void setCounterMask(uint32_t countermask, Positions pos = {});
|
||||
|
||||
Result<int> getNumberOfGates(Positions pos = {}) const;
|
||||
|
||||
/** [Mythen3] external gates in gating or trigger_gating mode (external
|
||||
* gating) */
|
||||
void setNumberOfGates(int value, Positions pos = {});
|
||||
|
||||
/** [Mythen3] exptime for each gate signal in auto or trigger timing mode
|
||||
* (internal gating). Gate index: 0-2 */
|
||||
Result<ns> getExptime(int gateIndex, Positions pos = {}) const;
|
||||
|
||||
/** [Mythen3] exptime for each gate signal in auto or trigger timing mode
|
||||
* (internal gating). Gate index: 0-2, -1 for all */
|
||||
void setExptime(int gateIndex, ns t, Positions pos = {});
|
||||
|
||||
/** [Mythen3] exptime for each gate signal in auto or trigger timing mode
|
||||
* (internal gating). Gate index: 0-2, -1 for all */
|
||||
Result<std::array<ns, 3>> getExptimeForAllGates(Positions pos = {}) const;
|
||||
|
||||
/** [Mythen3] gate delay for each gate signal in auto or trigger timing mode
|
||||
* (internal gating). Gate index: 0-2 */
|
||||
Result<ns> getGateDelay(int gateIndex, Positions pos = {}) const;
|
||||
|
||||
/** [Mythen3] gate delay for each gate signal in auto or trigger timing mode
|
||||
* (internal gating). Gate index: 0-2, -1 for all */
|
||||
void setGateDelay(int gateIndex, ns t, Positions pos = {});
|
||||
|
||||
/** [Mythen3] gate delay for each gate signal in auto or trigger timing mode
|
||||
* (internal gating). Gate index: 0-2, -1 for all */
|
||||
Result<std::array<ns, 3>> getGateDelayForAllGates(Positions pos = {}) const;
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* CTB / Moench Specific *
|
||||
@ -1216,6 +1253,9 @@ class Detector {
|
||||
*/
|
||||
void setPatternBitMask(uint64_t mask, Positions pos = {});
|
||||
|
||||
/** [Mythen3] */
|
||||
void startPattern(Positions pos = {});
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Moench *
|
||||
|
@ -333,6 +333,110 @@ std::string CmdProxy::DetectorSize(int action) {
|
||||
|
||||
/* acquisition parameters */
|
||||
|
||||
std::string CmdProxy::Exptime(int action) {
|
||||
int gateIndex = -1;
|
||||
if (cmd == "exptime") {
|
||||
gateIndex = -1;
|
||||
} else if (cmd == "exptime1") {
|
||||
gateIndex = 0;
|
||||
} else if (cmd == "exptime2") {
|
||||
gateIndex = 1;
|
||||
} else if (cmd == "exptime3") {
|
||||
gateIndex = 2;
|
||||
} else {
|
||||
throw sls::RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
}
|
||||
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
if (cmd == "exptime") {
|
||||
os << "[duration] [(optional unit) "
|
||||
"ns|us|ms|s]\n\t[Eiger][Jungfrau][Gotthard][Gotthard2]["
|
||||
"Moench][Ctb] Exposure time"
|
||||
"\n\t[Gotthard2] Uploaded to detector just before "
|
||||
"acquisition starts"
|
||||
"\n\t[Mythen3] Exposure time of all gate signals in auto and "
|
||||
"trigger mode (internal gating)."
|
||||
<< '\n';
|
||||
} else if (cmd == "exptime1") {
|
||||
os << "[n_value]\n\t[Mythen3] Exposure time of gate signal 1 in "
|
||||
"auto and "
|
||||
"trigger mode (internal gating)."
|
||||
<< '\n';
|
||||
} else if (cmd == "exptime2") {
|
||||
os << "[n_value]\n\t[Mythen3] Exposure time of gate signal 2 in "
|
||||
"auto and "
|
||||
"trigger mode (internal gating)."
|
||||
<< '\n';
|
||||
} else {
|
||||
os << "[n_value]\n\t[Mythen3] Exposure time of gate signal 3 in "
|
||||
"auto and "
|
||||
"trigger mode (internal gating)."
|
||||
<< '\n';
|
||||
}
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() > 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
// vector of exptimes
|
||||
if (gateIndex == -1 &&
|
||||
det->getDetectorType().squash() == defs::MYTHEN3) {
|
||||
auto t = det->getExptimeForAllGates({det_id});
|
||||
if (args.size() == 0) {
|
||||
os << OutString(t) << '\n';
|
||||
} else if (args.size() == 1) {
|
||||
os << OutString(t, args[0]) << '\n';
|
||||
}
|
||||
}
|
||||
// single exptime
|
||||
else {
|
||||
Result<ns> t;
|
||||
if (gateIndex == -1) {
|
||||
t = det->getExptime({det_id});
|
||||
} else {
|
||||
t = det->getExptime(gateIndex, {det_id});
|
||||
}
|
||||
if (args.size() == 0) {
|
||||
os << OutString(t) << '\n';
|
||||
} else if (args.size() == 1) {
|
||||
os << OutString(t, args[0]) << '\n';
|
||||
}
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
defs::detectorType type = det->getDetectorType().squash();
|
||||
if (args.size() == 1) {
|
||||
std::string time_str(args[0]);
|
||||
std::string unit = RemoveUnit(time_str);
|
||||
auto t = StringTo<time::ns>(time_str, unit);
|
||||
if (type == defs::MYTHEN3) {
|
||||
det->setExptime(gateIndex, t, {det_id});
|
||||
} else {
|
||||
det->setExptime(t, {det_id});
|
||||
}
|
||||
} else if (args.size() == 2) {
|
||||
auto t = StringTo<time::ns>(args[0], args[1]);
|
||||
if (type == defs::MYTHEN3) {
|
||||
det->setExptime(gateIndex, t, {det_id});
|
||||
} else {
|
||||
det->setExptime(t, {det_id});
|
||||
}
|
||||
} else {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
/* TODO: os << args << '\n'; (doesnt work for vectors in .h)*/
|
||||
if (args.size() > 1) {
|
||||
os << args[0] << args[1] << '\n';
|
||||
} else {
|
||||
os << args[0] << '\n';
|
||||
}
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::Speed(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
@ -652,6 +756,39 @@ std::string CmdProxy::ClockDivider(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::ExternalSignal(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[n_signal] [signal_type] External signal mode for trigger "
|
||||
"timing mode."
|
||||
"\n\t[Gotthard] [0] "
|
||||
"[trigger_in_rising_edge|trigger_in_falling_edge]"
|
||||
"\n\t[Mythen3] [0-7] "
|
||||
"[trigger_in_rising_edge|trigger_in_falling_edge|inversion_on|"
|
||||
"inversion_off]\n\t where 0-3 is master input signals and 4-7 is "
|
||||
"master output signals"
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
auto t = det->getExternalSignalFlags(StringTo<int>(args[0]), {det_id});
|
||||
os << args[0] << " " << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
det->setExternalSignalFlags(
|
||||
StringTo<int>(args[0]),
|
||||
StringTo<slsDetectorDefs::externalSignalFlag>(args[1]), {det_id});
|
||||
os << args[0] << " " << args[1] << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/** temperature */
|
||||
/* dacs */
|
||||
std::string CmdProxy::Dac(int action) {
|
||||
@ -1591,6 +1728,92 @@ std::string CmdProxy::Counters(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::GateDelay(int action) {
|
||||
int gateIndex = -1;
|
||||
if (cmd == "gatedelay") {
|
||||
gateIndex = -1;
|
||||
} else if (cmd == "gatedelay1") {
|
||||
gateIndex = 0;
|
||||
} else if (cmd == "gatedelay2") {
|
||||
gateIndex = 1;
|
||||
} else if (cmd == "gatedelay3") {
|
||||
gateIndex = 2;
|
||||
} else {
|
||||
throw sls::RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
}
|
||||
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
if (cmd == "gatedelay") {
|
||||
os << "[duration] [(optional unit) "
|
||||
"ns|us|ms|s]\n\t[Mythen3] Gate Delay of all gate signals in "
|
||||
"auto and "
|
||||
"trigger mode (internal gating)."
|
||||
<< '\n';
|
||||
} else if (cmd == "gatedelay1") {
|
||||
os << "[n_value]\n\t[Mythen3] Gate Delay of gate signal 1 in "
|
||||
"auto and "
|
||||
"trigger mode (internal gating)."
|
||||
<< '\n';
|
||||
} else if (cmd == "gatedelay2") {
|
||||
os << "[n_value]\n\t[Mythen3] Gate Delay of gate signal 2 in "
|
||||
"auto and "
|
||||
"trigger mode (internal gating)."
|
||||
<< '\n';
|
||||
} else {
|
||||
os << "[n_value]\n\t[Mythen3] Gate Delay of gate signal 3 in "
|
||||
"auto and "
|
||||
"trigger mode (internal gating)."
|
||||
<< '\n';
|
||||
}
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() > 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
// vector of gate delays
|
||||
if (gateIndex == -1) {
|
||||
auto t = det->getGateDelayForAllGates({det_id});
|
||||
if (args.size() == 0) {
|
||||
os << OutString(t) << '\n';
|
||||
} else if (args.size() == 1) {
|
||||
os << OutString(t, args[0]) << '\n';
|
||||
}
|
||||
}
|
||||
// single gate delay
|
||||
else {
|
||||
auto t = det->getGateDelay(gateIndex, {det_id});
|
||||
if (args.size() == 0) {
|
||||
os << OutString(t) << '\n';
|
||||
} else if (args.size() == 1) {
|
||||
os << OutString(t, args[0]) << '\n';
|
||||
}
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() == 1) {
|
||||
std::string time_str(args[0]);
|
||||
std::string unit = RemoveUnit(time_str);
|
||||
auto t = StringTo<time::ns>(time_str, unit);
|
||||
det->setGateDelay(gateIndex, t, {det_id});
|
||||
} else if (args.size() == 2) {
|
||||
auto t = StringTo<time::ns>(args[0], args[1]);
|
||||
det->setGateDelay(gateIndex, t, {det_id});
|
||||
} else {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
/* TODO: os << args << '\n'; (doesnt work for vectors in .h)*/
|
||||
if (args.size() > 1) {
|
||||
os << args[0] << args[1] << '\n';
|
||||
} else {
|
||||
os << args[0] << '\n';
|
||||
}
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/* CTB / Moench Specific */
|
||||
|
||||
std::string CmdProxy::Samples(int action) {
|
||||
|
@ -570,7 +570,7 @@ class CmdProxy {
|
||||
{"acquire", &CmdProxy::acquire},
|
||||
{"frames", &CmdProxy::frames},
|
||||
{"triggers", &CmdProxy::triggers},
|
||||
{"exptime", &CmdProxy::exptime},
|
||||
{"exptime", &CmdProxy::Exptime},
|
||||
{"period", &CmdProxy::period},
|
||||
{"delay", &CmdProxy::delay},
|
||||
{"framesl", &CmdProxy::framesl},
|
||||
@ -590,6 +590,7 @@ class CmdProxy {
|
||||
{"vhighvoltage", &CmdProxy::vhighvoltage},
|
||||
{"powerchip", &CmdProxy::powerchip},
|
||||
{"imagetest", &CmdProxy::imagetest},
|
||||
{"extsig", &CmdProxy::ExternalSignal},
|
||||
|
||||
/** temperature */
|
||||
{"temp_adc", &CmdProxy::temp_adc},
|
||||
@ -784,7 +785,6 @@ class CmdProxy {
|
||||
{"roi", &CmdProxy::ROI},
|
||||
{"clearroi", &CmdProxy::ClearROI},
|
||||
{"exptimel", &CmdProxy::exptimel},
|
||||
{"extsig", &CmdProxy::extsig},
|
||||
|
||||
/* Gotthard2 Specific */
|
||||
{"bursts", &CmdProxy::bursts},
|
||||
@ -799,6 +799,14 @@ class CmdProxy {
|
||||
|
||||
/* Mythen3 Specific */
|
||||
{"counters", &CmdProxy::Counters},
|
||||
{"gates", &CmdProxy::gates},
|
||||
{"exptime1", &CmdProxy::Exptime},
|
||||
{"exptime2", &CmdProxy::Exptime},
|
||||
{"exptime3", &CmdProxy::Exptime},
|
||||
{"gatedelay", &CmdProxy::GateDelay},
|
||||
{"gatedelay1", &CmdProxy::GateDelay},
|
||||
{"gatedelay2", &CmdProxy::GateDelay},
|
||||
{"gatedelay3", &CmdProxy::GateDelay},
|
||||
|
||||
/* CTB/ Moench Specific */
|
||||
{"samples", &CmdProxy::Samples},
|
||||
@ -861,6 +869,7 @@ class CmdProxy {
|
||||
{"patwaittime2", &CmdProxy::PatternWaitTime},
|
||||
{"patmask", &CmdProxy::patmask},
|
||||
{"patsetbit", &CmdProxy::patsetbit},
|
||||
{"patternstart", &CmdProxy::patternstart},
|
||||
|
||||
/* Moench */
|
||||
{"rx_jsonaddheader", &CmdProxy::AdditionalJsonHeader},
|
||||
@ -916,6 +925,7 @@ class CmdProxy {
|
||||
std::string DetectorSize(int action);
|
||||
/* acquisition parameters */
|
||||
std::string acquire(int action);
|
||||
std::string Exptime(int action);
|
||||
std::string Speed(int action);
|
||||
std::string Adcphase(int action);
|
||||
std::string Dbitphase(int action);
|
||||
@ -923,6 +933,7 @@ class CmdProxy {
|
||||
std::string ClockPhase(int action);
|
||||
std::string MaxClockPhaseShift(int action);
|
||||
std::string ClockDivider(int action);
|
||||
std::string ExternalSignal(int action);
|
||||
/** temperature */
|
||||
/* dacs */
|
||||
std::string Dac(int action);
|
||||
@ -963,6 +974,7 @@ class CmdProxy {
|
||||
std::string BurstMode(int action);
|
||||
/* Mythen3 Specific */
|
||||
std::string Counters(int action);
|
||||
std::string GateDelay(int action);
|
||||
/* CTB/ Moench Specific */
|
||||
std::string Samples(int action);
|
||||
/* CTB Specific */
|
||||
@ -1055,11 +1067,6 @@ class CmdProxy {
|
||||
"[n_triggers]\n\tNumber of triggers per aquire. Use "
|
||||
"timing command to set timing mode.");
|
||||
|
||||
TIME_COMMAND(
|
||||
exptime, getExptime, setExptime,
|
||||
"[duration] [(optional unit) ns|us|ms|s]\n\tExposure time"
|
||||
"\n\t[Gotthard2] Uploaded to detector just before acquisition starts");
|
||||
|
||||
TIME_COMMAND(
|
||||
period, getPeriod, setPeriod,
|
||||
"[duration] [(optional unit) ns|us|ms|s]\n\tPeriod between frames"
|
||||
@ -1094,12 +1101,13 @@ class CmdProxy {
|
||||
" Period left for current frame."
|
||||
"\n\t[Gotthard2] only in continuous mode.");
|
||||
|
||||
INTEGER_COMMAND(
|
||||
timing, getTimingMode, setTimingMode,
|
||||
sls::StringTo<slsDetectorDefs::timingMode>,
|
||||
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of "
|
||||
"detector.\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb][Moench] "
|
||||
"[auto|trigger]\n\t[Eiger] [auto|trigger|gating|burst_trigger]");
|
||||
INTEGER_COMMAND(timing, getTimingMode, setTimingMode,
|
||||
sls::StringTo<slsDetectorDefs::timingMode>,
|
||||
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of "
|
||||
"detector.\n\t[Jungfrau][Gotthard][Mythen3][Ctb][Moench] "
|
||||
"[auto|trigger]\n\t[Gotthard2] "
|
||||
"[auto|trigger|gating|trigger_gating]\n\t[Eiger] "
|
||||
"[auto|trigger|gating|burst_trigger]");
|
||||
|
||||
GET_COMMAND(maxadcphaseshift, getMaxADCPhaseShift,
|
||||
"\n\t[Jungfrau][CTB][Moench] Absolute maximum Phase shift of "
|
||||
@ -1852,11 +1860,6 @@ class CmdProxy {
|
||||
"[(optional unit) ns|us|ms|s]\n\t[Gotthard] Exposure time "
|
||||
"left for current frame. ");
|
||||
|
||||
INTEGER_COMMAND(extsig, getExternalSignalFlags, setExternalSignalFlags,
|
||||
sls::StringTo<slsDetectorDefs::externalSignalFlag>,
|
||||
"[trigger_in_rising_edge|trigger_in_falling_edge]\n\t["
|
||||
"Gotthard] External signal mode for trigger timing mode.");
|
||||
|
||||
/* Gotthard2 Specific */
|
||||
INTEGER_COMMAND_NOID(
|
||||
bursts, getNumberOfBursts, setNumberOfBursts, StringTo<int64_t>,
|
||||
@ -1881,6 +1884,10 @@ class CmdProxy {
|
||||
|
||||
/* Mythen3 Specific */
|
||||
|
||||
INTEGER_COMMAND(gates, getNumberOfGates, setNumberOfGates, StringTo<int>,
|
||||
"[n_gates]\n\t[Mythen3] Number of external gates in gating "
|
||||
"or trigger_gating mode (external gating).");
|
||||
|
||||
/* CTB/ Moench Specific */
|
||||
|
||||
INTEGER_COMMAND(
|
||||
@ -2038,6 +2045,9 @@ class CmdProxy {
|
||||
"[64 bit mask]\n\t[Ctb][Moench][Mythen3] 64 bit values "
|
||||
"applied to the selected patmask for every pattern.");
|
||||
|
||||
EXECUTE_SET_COMMAND(patternstart, startPattern,
|
||||
"\n\t[Mythen3] Starts Pattern");
|
||||
|
||||
/* Moench */
|
||||
|
||||
INTEGER_COMMAND(framemode, getFrameMode, setFrameMode,
|
||||
|
@ -202,11 +202,11 @@ void Detector::setNumberOfTriggers(int64_t value) {
|
||||
}
|
||||
|
||||
Result<ns> Detector::getExptime(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getExptime, pos);
|
||||
return pimpl->Parallel(&Module::getExptime, pos, -1);
|
||||
}
|
||||
|
||||
void Detector::setExptime(ns t, Positions pos) {
|
||||
pimpl->Parallel(&Module::setExptime, pos, t.count());
|
||||
pimpl->Parallel(&Module::setExptime, pos, -1, t.count());
|
||||
}
|
||||
|
||||
Result<ns> Detector::getPeriod(Positions pos) const {
|
||||
@ -1169,14 +1169,14 @@ Result<ns> Detector::getExptimeLeft(Positions pos) const {
|
||||
}
|
||||
|
||||
Result<defs::externalSignalFlag>
|
||||
Detector::getExternalSignalFlags(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::setExternalSignalFlags, pos,
|
||||
defs::GET_EXTERNAL_SIGNAL_FLAG);
|
||||
Detector::getExternalSignalFlags(int signalIndex, Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getExternalSignalFlags, pos, signalIndex);
|
||||
}
|
||||
|
||||
void Detector::setExternalSignalFlags(defs::externalSignalFlag value,
|
||||
void Detector::setExternalSignalFlags(int signalIndex,
|
||||
defs::externalSignalFlag value,
|
||||
Positions pos) {
|
||||
pimpl->Parallel(&Module::setExternalSignalFlags, pos, value);
|
||||
pimpl->Parallel(&Module::setExternalSignalFlags, pos, signalIndex, value);
|
||||
}
|
||||
|
||||
// Gotthard2 Specific
|
||||
@ -1266,6 +1266,39 @@ void Detector::setCounterMask(uint32_t countermask, Positions pos) {
|
||||
pimpl->Parallel(&Module::setCounterMask, pos, countermask);
|
||||
}
|
||||
|
||||
Result<int> Detector::getNumberOfGates(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getNumberOfGates, pos);
|
||||
}
|
||||
|
||||
void Detector::setNumberOfGates(int value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setNumberOfGates, pos, value);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getExptime(int gateIndex, Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getExptime, pos, gateIndex);
|
||||
}
|
||||
|
||||
void Detector::setExptime(int gateIndex, ns t, Positions pos) {
|
||||
pimpl->Parallel(&Module::setExptime, pos, gateIndex, t.count());
|
||||
}
|
||||
|
||||
Result<std::array<ns, 3>> Detector::getExptimeForAllGates(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getExptimeForAllGates, pos);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getGateDelay(int gateIndex, Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getGateDelay, pos, gateIndex);
|
||||
}
|
||||
|
||||
void Detector::setGateDelay(int gateIndex, ns t, Positions pos) {
|
||||
pimpl->Parallel(&Module::setGateDelay, pos, gateIndex, t.count());
|
||||
}
|
||||
|
||||
Result<std::array<ns, 3>>
|
||||
Detector::getGateDelayForAllGates(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getGateDelayForAllGates, pos);
|
||||
}
|
||||
|
||||
// CTB/ Moench Specific
|
||||
|
||||
Result<int> Detector::getNumberOfAnalogSamples(Positions pos) const {
|
||||
@ -1582,6 +1615,10 @@ void Detector::setPatternBitMask(uint64_t mask, Positions pos) {
|
||||
pimpl->Parallel(&Module::setPatternBitMask, pos, mask);
|
||||
}
|
||||
|
||||
void Detector::startPattern(Positions pos) {
|
||||
pimpl->Parallel(&Module::startPattern, pos);
|
||||
}
|
||||
|
||||
// Moench
|
||||
|
||||
Result<std::map<std::string, std::string>>
|
||||
|
@ -151,7 +151,7 @@ template <typename Ret> Ret Module::sendToDetector(int fnum) {
|
||||
<< sizeof(Ret) << "]";
|
||||
Ret retval{};
|
||||
sendToDetector(fnum, nullptr, 0, &retval, sizeof(retval));
|
||||
LOG(logDEBUG1) << "Got back: " << retval;
|
||||
LOG(logDEBUG1) << "Got back: " << ToString(retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -163,7 +163,7 @@ Ret Module::sendToDetector(int fnum, const Arg &args) {
|
||||
<< typeid(Ret).name() << ", " << sizeof(Ret) << "]";
|
||||
Ret retval{};
|
||||
sendToDetector(fnum, &args, sizeof(args), &retval, sizeof(retval));
|
||||
LOG(logDEBUG1) << "Got back: " << retval;
|
||||
LOG(logDEBUG1) << "Got back: " << ToString(retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -1027,24 +1027,64 @@ void Module::setNumberOfDigitalSamples(int value) {
|
||||
}
|
||||
}
|
||||
|
||||
int64_t Module::getExptime() { return sendToDetector<int64_t>(F_GET_EXPTIME); }
|
||||
int Module::getNumberOfGates() { return sendToDetector<int>(F_GET_NUM_GATES); }
|
||||
|
||||
void Module::setExptime(int64_t value) {
|
||||
void Module::setNumberOfGates(int value) {
|
||||
LOG(logDEBUG1) << "Setting number of gates to " << value;
|
||||
sendToDetector(F_SET_NUM_GATES, value, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
LOG(logDEBUG1) << "Sending number of gates to Receiver: " << value;
|
||||
sendToReceiver(F_SET_RECEIVER_NUM_GATES, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t Module::getExptime(int gateIndex) {
|
||||
return sendToDetector<int64_t>(F_GET_EXPTIME, gateIndex);
|
||||
}
|
||||
|
||||
void Module::setExptime(int gateIndex, int64_t value) {
|
||||
int64_t prevVal = value;
|
||||
if (shm()->myDetectorType == EIGER) {
|
||||
prevVal = getExptime();
|
||||
prevVal = getExptime(-1);
|
||||
}
|
||||
LOG(logDEBUG1) << "Setting exptime to " << value << "ns";
|
||||
sendToDetector(F_SET_EXPTIME, value, nullptr);
|
||||
LOG(logDEBUG1) << "Setting exptime to " << value
|
||||
<< "ns (gateindex: " << gateIndex << ")";
|
||||
int64_t args[]{static_cast<int64_t>(gateIndex), value};
|
||||
sendToDetector(F_SET_EXPTIME, args, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
LOG(logDEBUG1) << "Sending exptime to Receiver: " << value;
|
||||
sendToReceiver(F_RECEIVER_SET_EXPTIME, value, nullptr);
|
||||
sendToReceiver(F_RECEIVER_SET_EXPTIME, args, nullptr);
|
||||
}
|
||||
if (prevVal != value) {
|
||||
updateRateCorrection();
|
||||
}
|
||||
}
|
||||
|
||||
std::array<time::ns, 3> Module::getExptimeForAllGates() {
|
||||
static_assert(sizeof(time::ns) == 8, "ns needs to be 64bit");
|
||||
return sendToDetector<std::array<time::ns, 3>>(F_GET_EXPTIME_ALL_GATES);
|
||||
}
|
||||
|
||||
int64_t Module::getGateDelay(int gateIndex) {
|
||||
return sendToDetector<int64_t>(F_GET_GATE_DELAY, gateIndex);
|
||||
}
|
||||
|
||||
void Module::setGateDelay(int gateIndex, int64_t value) {
|
||||
LOG(logDEBUG1) << "Setting gate delay to " << value
|
||||
<< "ns (gateindex: " << gateIndex << ")";
|
||||
int64_t args[]{static_cast<int64_t>(gateIndex), value};
|
||||
sendToDetector(F_SET_GATE_DELAY, args, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
LOG(logDEBUG1) << "Sending gate delay to Receiver: " << value;
|
||||
sendToReceiver(F_SET_RECEIVER_GATE_DELAY, args, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
std::array<time::ns, 3> Module::getGateDelayForAllGates() {
|
||||
static_assert(sizeof(time::ns) == 8, "ns needs to be 64bit");
|
||||
return sendToDetector<std::array<time::ns, 3>>(F_GET_GATE_DELAY_ALL_GATES);
|
||||
}
|
||||
|
||||
int64_t Module::getPeriod() { return sendToDetector<int64_t>(F_GET_PERIOD); }
|
||||
|
||||
void Module::setPeriod(int64_t value) {
|
||||
@ -1272,10 +1312,15 @@ int Module::getADC(dacIndex index) {
|
||||
}
|
||||
|
||||
slsDetectorDefs::externalSignalFlag
|
||||
Module::setExternalSignalFlags(externalSignalFlag pol) {
|
||||
LOG(logDEBUG1) << "Setting signal flag to " << pol;
|
||||
Module::getExternalSignalFlags(int signalIndex) {
|
||||
return sendToDetector<slsDetectorDefs::externalSignalFlag>(
|
||||
F_SET_EXTERNAL_SIGNAL_FLAG, pol);
|
||||
F_GET_EXTERNAL_SIGNAL_FLAG, signalIndex);
|
||||
}
|
||||
|
||||
void Module::setExternalSignalFlags(int signalIndex, externalSignalFlag type) {
|
||||
LOG(logDEBUG1) << "Setting signal flag (" << signalIndex << ") to " << type;
|
||||
int args[]{signalIndex, static_cast<int>(type)};
|
||||
sendToDetector(F_SET_EXTERNAL_SIGNAL_FLAG, args, nullptr);
|
||||
}
|
||||
|
||||
void Module::setParallelMode(const bool enable) {
|
||||
@ -1439,7 +1484,14 @@ void Module::setReceiverHostname(const std::string &receiverIP) {
|
||||
<< "roi.xmin:" << retval.roi.xmin << std::endl
|
||||
<< "roi.xmax:" << retval.roi.xmax << std::endl
|
||||
<< "countermask:" << retval.countermask << std::endl
|
||||
<< "burstType:" << retval.burstType << std::endl;
|
||||
<< "burstType:" << retval.burstType << std::endl
|
||||
<< "exptime1:" << retval.expTime1Ns << std::endl
|
||||
<< "exptime2:" << retval.expTime2Ns << std::endl
|
||||
<< "exptime3:" << retval.expTime3Ns << std::endl
|
||||
<< "gateDelay1:" << retval.gateDelay1Ns << std::endl
|
||||
<< "gateDelay2:" << retval.gateDelay2Ns << std::endl
|
||||
<< "gateDelay3:" << retval.gateDelay3Ns << std::endl
|
||||
<< "gates:" << retval.gates << std::endl;
|
||||
|
||||
sls::MacAddr retvals[2];
|
||||
sendToReceiver(F_SETUP_RECEIVER, retval, retvals);
|
||||
@ -2874,6 +2926,8 @@ uint64_t Module::getPatternBitMask() {
|
||||
return sendToDetector<uint64_t>(F_GET_PATTERN_BIT_MASK);
|
||||
}
|
||||
|
||||
void Module::startPattern() { sendToDetector(F_START_PATTERN); }
|
||||
|
||||
int Module::setLEDEnable(int enable) {
|
||||
return sendToDetector<int>(F_LED, enable);
|
||||
}
|
||||
|
@ -419,9 +419,29 @@ class Module : public virtual slsDetectorDefs {
|
||||
/** [CTB] */
|
||||
void setNumberOfDigitalSamples(int value);
|
||||
|
||||
int64_t getExptime();
|
||||
/** [Mythen3] */
|
||||
int getNumberOfGates();
|
||||
|
||||
void setExptime(int64_t value);
|
||||
/** [Mythen3] */
|
||||
void setNumberOfGates(int value);
|
||||
|
||||
/** [Mythen3] gatIndex: 0-2, [Others]: -1 always */
|
||||
int64_t getExptime(int gateIndex);
|
||||
|
||||
/** [Mythen3] gatIndex: -1 for all, 0-2, [Others]: -1 always */
|
||||
void setExptime(int gateIndex, int64_t value);
|
||||
|
||||
/** [Mythen3] for all gates */
|
||||
std::array<time::ns, 3> getExptimeForAllGates();
|
||||
|
||||
/** [Mythen3] gatIndex: 0-2 */
|
||||
int64_t getGateDelay(int gateIndex);
|
||||
|
||||
/** [Mythen3] gatIndex: -1 for all, 0-2 */
|
||||
void setGateDelay(int gateIndex, int64_t value);
|
||||
|
||||
/** [Mythen3] for all gates */
|
||||
std::array<time::ns, 3> getGateDelayForAllGates();
|
||||
|
||||
int64_t getPeriod();
|
||||
|
||||
@ -529,14 +549,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
*/
|
||||
int getADC(dacIndex index);
|
||||
|
||||
/**
|
||||
* Set/get external signal flags (to specify triggerinrising edge etc)
|
||||
* (Gotthard, Mythen)
|
||||
* @param pol external signal flag (-1 gets)
|
||||
* @returns current timing mode
|
||||
*/
|
||||
externalSignalFlag
|
||||
setExternalSignalFlags(externalSignalFlag pol = GET_EXTERNAL_SIGNAL_FLAG);
|
||||
externalSignalFlag getExternalSignalFlags(int signalIndex);
|
||||
void setExternalSignalFlags(int signalIndex, externalSignalFlag type);
|
||||
|
||||
/**
|
||||
* Set Parallel readout mode (Only for Eiger)
|
||||
@ -1506,6 +1520,9 @@ class Module : public virtual slsDetectorDefs {
|
||||
*/
|
||||
uint64_t getPatternBitMask();
|
||||
|
||||
/** [Mythen3] */
|
||||
void startPattern();
|
||||
|
||||
/**
|
||||
* Set LED Enable (Moench, CTB only)
|
||||
* @param enable 1 to switch on, 0 to switch off, -1 gets
|
||||
|
@ -228,6 +228,41 @@ TEST_CASE("Setting and reading back EIGER dacs", "[.cmd][.dacs][.new]") {
|
||||
}
|
||||
}
|
||||
|
||||
/* acquisition */
|
||||
|
||||
TEST_CASE("trigger", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
REQUIRE_THROWS(proxy.Call("trigger", {}, -1, GET));
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type != defs::EIGER) {
|
||||
REQUIRE_THROWS(proxy.Call("trigger", {}, -1, PUT));
|
||||
} else {
|
||||
auto prev_timing =
|
||||
det.getTimingMode().tsquash("inconsistent timing mode in test");
|
||||
auto prev_frames =
|
||||
det.getNumberOfFrames().tsquash("inconsistent #frames in test");
|
||||
det.setTimingMode(defs::TRIGGER_EXPOSURE);
|
||||
det.setNumberOfFrames(1);
|
||||
auto startingfnum = det.getStartingFrameNumber().tsquash(
|
||||
"inconsistent frame nr in test");
|
||||
det.startDetector();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("trigger", {}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "trigger successful\n");
|
||||
}
|
||||
auto currentfnum = det.getStartingFrameNumber().tsquash(
|
||||
"inconsistent frame nr in test");
|
||||
REQUIRE(startingfnum + 1 == currentfnum);
|
||||
det.stopDetector();
|
||||
det.setTimingMode(prev_timing);
|
||||
det.setNumberOfFrames(prev_frames);
|
||||
}
|
||||
}
|
||||
|
||||
/* Network Configuration (Detector<->Receiver) */
|
||||
|
||||
TEST_CASE("Eiger transmission delay", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@ -493,84 +528,3 @@ TEST_CASE("quad", "[.cmd]") {
|
||||
REQUIRE_THROWS(proxy.Call("quad", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
// TEST_CASE("trigger", "[.cmd]") {
|
||||
// Detector det;
|
||||
// CmdProxy proxy(&det);
|
||||
// auto det_type = det.getDetectorType().squash();
|
||||
// if (det_type != defs::EIGER) {
|
||||
// proxy.Call("trigger", {}, -1, PUT);
|
||||
// } else {
|
||||
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// proxy.Call("timing", {"trigger"}, -1, PUT, oss);
|
||||
// REQUIRE(oss.str() == "timing trigger\n");
|
||||
// }
|
||||
// auto startingfnum = det.getStartingFrameNumber().tsquash(
|
||||
// "inconsistent frame nr in test");
|
||||
// det.startDetector();
|
||||
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// proxy.Call("trigger", {}, -1, PUT, oss);
|
||||
// REQUIRE(oss.str() == "trigger successful\n");
|
||||
// }
|
||||
|
||||
// auto currentfnum = det.getStartingFrameNumber().tsquash(
|
||||
// "inconsistent frame nr in test");
|
||||
|
||||
// REQUIRE(startingfnum +1 == currentfnum);
|
||||
// det.stopDetector();
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// proxy.Call("timing", {"auto"}, -1, PUT, oss);
|
||||
// REQUIRE(oss.str() == "timing auto\n");
|
||||
// }
|
||||
// }
|
||||
// if(test::type != slsDetectorDefs::EIGER) {
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("trigger", PUT));
|
||||
// } else {
|
||||
// // trigger
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("timing trigger", PUT,
|
||||
// nullptr, oss)); REQUIRE(oss.str() == "timing trigger\n");
|
||||
// }
|
||||
// int startingfnum = 0;
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("startingfnum", GET,
|
||||
// nullptr, oss)); std::string s = (oss.str()).erase (0,
|
||||
// strlen("startingfnum ")); startingfnum = std::stoi(s);
|
||||
// }
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("start", PUT, nullptr,
|
||||
// oss)); REQUIRE(oss.str() == "start successful\n");
|
||||
// }
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("status", GET,
|
||||
// nullptr, oss)); REQUIRE(oss.str() != "status idle\n");
|
||||
// REQUIRE(oss.str()
|
||||
// != "status stopped\n");
|
||||
// }
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("trigger", PUT,
|
||||
// nullptr, oss)); REQUIRE(oss.str() == "trigger successful\n");
|
||||
// }
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("stop", PUT));
|
||||
// int currentfnum = 0;
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("startingfnum", GET,
|
||||
// nullptr, oss)); std::string s = (oss.str()).erase (0,
|
||||
// strlen("startingfnum ")); currentfnum = std::stoi(s);
|
||||
// }
|
||||
// REQUIRE((startingfnum + 1) == currentfnum);
|
||||
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("timing auto", PUT));
|
||||
// }
|
||||
// }
|
||||
|
@ -190,6 +190,46 @@ TEST_CASE("settings", "[.cmd][.new]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("trimbits", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
REQUIRE_NOTHROW(proxy.Call("trimbits", {}, -1, GET));
|
||||
}
|
||||
|
||||
TEST_CASE("trimval", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::MYTHEN3 || det_type == defs::EIGER) {
|
||||
auto prev_val = det.getAllTrimbits();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("trimval", {"63"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "trimval 63\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("trimval", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "trimval 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("trimval", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "trimval 0\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("trimval", {"64"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("trimval", {"-1"}, -1, PUT));
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
if (prev_val[i] != -1) {
|
||||
det.setAllTrimbits(prev_val[i], {i});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("trimval", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
/* acquisition parameters */
|
||||
|
||||
// acquire: not testing
|
||||
@ -407,9 +447,27 @@ TEST_CASE("timing", "[.cmd][.new]") {
|
||||
proxy.Call("timing", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "timing burst_trigger\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("timing", {"trigger_gating"}, -1, PUT));
|
||||
} else if (det_type == defs::MYTHEN3) {
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("timing", {"gating"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "timing gating\n");
|
||||
proxy.Call("timing", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "timing gating\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("timing", {"trigger_gating"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "timing trigger_gating\n");
|
||||
proxy.Call("timing", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "timing trigger_gating\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("timing", {"burst_trigger"}, -1, PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("timing", {"gating"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("timing", {"burst_trigger"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("timing", {"trigger_gating"}, -1, PUT));
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setTimingMode(prev_val[i], {i});
|
||||
@ -812,6 +870,85 @@ TEST_CASE("imagetest", "[.cmd][.new]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("extsig", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::GOTTHARD) {
|
||||
auto prev_val = det.getExternalSignalFlags(0);
|
||||
REQUIRE_THROWS(proxy.Call("extsig", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("extsig", {"1"}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("extsig", {"0", "inversion_on"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("extsig", {"0", "inversion_off"}, -1, PUT));
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("extsig", {"0", "trigger_in_rising_edge"}, -1, PUT,
|
||||
oss1);
|
||||
REQUIRE(oss1.str() == "extsig 0 trigger_in_rising_edge\n");
|
||||
proxy.Call("extsig", {"0"}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "extsig trigger_in_rising_edge\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("extsig", {"0", "trigger_in_falling_edge"}, -1, PUT,
|
||||
oss1);
|
||||
REQUIRE(oss1.str() == "extsig 0 trigger_in_falling_edge\n");
|
||||
proxy.Call("extsig", {"0"}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "extsig 0 trigger_in_falling_edge\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setExternalSignalFlags(0, prev_val[i], {i});
|
||||
}
|
||||
} else if (det_type == defs::MYTHEN3) {
|
||||
auto prev_val_0 = det.getExternalSignalFlags(0);
|
||||
auto prev_val_1 = det.getExternalSignalFlags(1);
|
||||
REQUIRE_THROWS(proxy.Call("extsig", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("extsig", {"8"}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("extsig", {"0", "inversion_on"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("extsig", {"0", "inversion_off"}, -1, PUT));
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call("extsig", {"1", "trigger_in_rising_edge"}, -1, PUT));
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call("extsig", {"1", "trigger_in_falling_edge"}, -1, PUT));
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("extsig", {"0", "trigger_in_rising_edge"}, -1, PUT,
|
||||
oss1);
|
||||
REQUIRE(oss1.str() == "extsig 0 trigger_in_rising_edge\n");
|
||||
proxy.Call("extsig", {"0"}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "extsig trigger_in_rising_edge\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("extsig", {"0", "trigger_in_falling_edge"}, -1, PUT,
|
||||
oss1);
|
||||
REQUIRE(oss1.str() == "extsig 0 trigger_in_falling_edge\n");
|
||||
proxy.Call("extsig", {"0"}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "extsig 0 trigger_in_falling_edge\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("extsig", {"1", "inversion_off"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "extsig 1 inversion_off\n");
|
||||
proxy.Call("extsig", {"1"}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "extsig inversion_off\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("extsig", {"1", "inversion_on"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "extsig 1 inversion_on\n");
|
||||
proxy.Call("extsig", {"1"}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "extsig 1 inversion_on\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setExternalSignalFlags(0, prev_val_0[i], {i});
|
||||
det.setExternalSignalFlags(1, prev_val_1[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("extsig", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
/** temperature */
|
||||
|
||||
TEST_CASE("temp_adc", "[.cmd][.new]") {
|
||||
@ -958,6 +1095,43 @@ TEST_CASE("startingfnum", "[.cmd][.new]") {
|
||||
}
|
||||
}
|
||||
|
||||
/* Network Configuration (Detector<->Receiver) */
|
||||
|
||||
TEST_CASE("numinterfaces", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::GOTTHARD2) {
|
||||
auto prev_val = det.getNumberofUDPInterfaces().tsquash(
|
||||
"inconsistent numinterfaces to test");
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("numinterfaces", {"2"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "numinterfaces 2\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("numinterfaces", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "numinterfaces 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("numinterfaces", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "numinterfaces 1\n");
|
||||
}
|
||||
det.setNumberofUDPInterfaces(prev_val);
|
||||
} else {
|
||||
std::ostringstream oss;
|
||||
proxy.Call("numinterfaces", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "numinterfaces 1\n");
|
||||
REQUIRE_THROWS(proxy.Call("numinterfaces", {"1"}, -1, PUT));
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("numinterfaces", {"3"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("numinterfaces", {"0"}, -1, PUT));
|
||||
}
|
||||
|
||||
/* Advanced */
|
||||
|
||||
TEST_CASE("initialchecks", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@ -987,18 +1161,7 @@ TEST_CASE("initialchecks", "[.cmd]") {
|
||||
det.setInitialChecks(check);
|
||||
}
|
||||
|
||||
TEST_CASE("user", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
proxy.Call("user", {}, -1, GET);
|
||||
|
||||
// This is a get only command
|
||||
REQUIRE_THROWS(proxy.Call("user", {}, -1, PUT));
|
||||
}
|
||||
|
||||
// TEST_CASE("execcommand", "[.cmd]") {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("execcommand ls", PUT));
|
||||
// }
|
||||
/* Insignificant */
|
||||
|
||||
TEST_CASE("port", "[.cmd]") {
|
||||
Detector det;
|
||||
@ -1034,6 +1197,19 @@ TEST_CASE("stopport", "[.cmd]") {
|
||||
REQUIRE(port == 1953);
|
||||
}
|
||||
|
||||
// TEST_CASE("execcommand", "[.cmd]") {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("execcommand ls", PUT));
|
||||
// }
|
||||
|
||||
TEST_CASE("user", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
proxy.Call("user", {}, -1, GET);
|
||||
|
||||
// This is a get only command
|
||||
REQUIRE_THROWS(proxy.Call("user", {}, -1, PUT));
|
||||
}
|
||||
|
||||
// TEST_CASE("reg", "[.cmd]") {
|
||||
// if (test::type == defs::JUNGFRAU) {
|
||||
// {
|
||||
@ -2366,29 +2542,6 @@ TEST_CASE("stopport", "[.cmd]") {
|
||||
// }
|
||||
// }
|
||||
|
||||
// TEST_CASE("trimval", "[.cmd][.eiger]") {
|
||||
// if (test::type == defs::EIGER) {
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("trimval 63", PUT,
|
||||
// nullptr, oss)); REQUIRE(oss.str() == "trimval 63\n");
|
||||
// }
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("trimval", GET, nullptr,
|
||||
// oss)); REQUIRE(oss.str() == "trimval 63\n");
|
||||
// }
|
||||
// {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("trimval 31", PUT,
|
||||
// nullptr, oss)); REQUIRE(oss.str() == "trimval 31\n");
|
||||
// }
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("trimval 0", PUT));
|
||||
// } else {
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("trimval", GET));
|
||||
// }
|
||||
// }
|
||||
|
||||
// TEST_CASE("flippeddatax", "[.cmd][.eiger]") {
|
||||
// if (test::type == defs::EIGER) {
|
||||
// {
|
||||
@ -2746,29 +2899,6 @@ TEST_CASE("zmqport", "[.cmd]") {
|
||||
// }
|
||||
// }
|
||||
|
||||
// TEST_CASE("numinterfaces", "[.cmd][.jungfrau]") {
|
||||
// if (test::type == defs::JUNGFRAU) {
|
||||
// {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("numinterfaces 2", PUT));
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:numinterfaces", GET,
|
||||
// nullptr, oss)); REQUIRE(oss.str() == "numinterfaces 2\n");
|
||||
// }
|
||||
// {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("numinterfaces 1", PUT));
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:numinterfaces", GET,
|
||||
// nullptr, oss)); REQUIRE(oss.str() == "numinterfaces 1\n");
|
||||
// }
|
||||
// } else {
|
||||
// std::ostringstream oss;
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("0:numinterfaces", GET,
|
||||
// nullptr, oss)); REQUIRE(oss.str() == "numinterfaces 1\n");
|
||||
// }
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("numinterfaces 3", PUT));
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("numinterfaces 0", PUT));
|
||||
// }
|
||||
|
||||
// TEST_CASE("adc", "[.cmd][.ctb]") {
|
||||
// if (test::type != defs::CHIPTESTBOARD) {
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("adc 8", GET));
|
||||
|
@ -191,6 +191,13 @@ void BinaryFile::CreateMasterFile(bool masterFileWriteEnable,
|
||||
"Dbit Offset : %d\n"
|
||||
"Dbit Bitset : %lld\n"
|
||||
"Roi (xmin, xmax) : %d %d\n"
|
||||
"Exptime1 (ns) : %lld\n"
|
||||
"Exptime2 (ns) : %lld\n"
|
||||
"Exptime3 (ns) : %lld\n"
|
||||
"GateDelay1 (ns) : %lld\n"
|
||||
"GateDelay2 (ns) : %lld\n"
|
||||
"GateDelay3 (ns) : %lld\n"
|
||||
"Gates : %d\n"
|
||||
"Timestamp : %s\n\n"
|
||||
|
||||
"#Frame Header\n"
|
||||
@ -224,7 +231,13 @@ void BinaryFile::CreateMasterFile(bool masterFileWriteEnable,
|
||||
masterFileAttributes.dbitoffset,
|
||||
(long long int)masterFileAttributes.dbitlist,
|
||||
masterFileAttributes.roiXmin, masterFileAttributes.roiXmax,
|
||||
ctime(&t));
|
||||
(long long int)masterFileAttributes.exptime1Ns,
|
||||
(long long int)masterFileAttributes.exptime2Ns,
|
||||
(long long int)masterFileAttributes.exptime3Ns,
|
||||
(long long int)masterFileAttributes.gateDelay1Ns,
|
||||
(long long int)masterFileAttributes.gateDelay2Ns,
|
||||
(long long int)masterFileAttributes.gateDelay3Ns,
|
||||
masterFileAttributes.gates, ctime(&t));
|
||||
if (strlen(message) > maxMasterFileSize) {
|
||||
throw sls::RuntimeError("Master File Size " +
|
||||
std::to_string(strlen(message)) +
|
||||
|
@ -197,7 +197,9 @@ int ClientInterface::functionTable(){
|
||||
flist[F_SET_ADDITIONAL_JSON_PARAMETER] = &ClientInterface::set_additional_json_parameter;
|
||||
flist[F_GET_ADDITIONAL_JSON_PARAMETER] = &ClientInterface::get_additional_json_parameter;
|
||||
flist[F_GET_RECEIVER_PROGRESS] = &ClientInterface::get_progress;
|
||||
|
||||
flist[F_SET_RECEIVER_NUM_GATES] = &ClientInterface::set_num_gates;
|
||||
flist[F_SET_RECEIVER_GATE_DELAY] = &ClientInterface::set_gate_delay;
|
||||
|
||||
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
|
||||
LOG(logDEBUG1) << "function fnum: " << i << " (" <<
|
||||
getFunctionNameFromEnum((enum detFuncs)i) << ") located at " << flist[i];
|
||||
@ -368,7 +370,14 @@ int ClientInterface::setup_receiver(Interface &socket) {
|
||||
<< "roi.xmin:" << arg.roi.xmin << std::endl
|
||||
<< "roi.xmax:" << arg.roi.xmax << std::endl
|
||||
<< "countermask:" << arg.countermask << std::endl
|
||||
<< "burstType:" << arg.burstType << std::endl;
|
||||
<< "burstType:" << arg.burstType << std::endl
|
||||
<< "exptime1:" << arg.expTime1Ns << std::endl
|
||||
<< "exptime2:" << arg.expTime2Ns << std::endl
|
||||
<< "exptime3:" << arg.expTime3Ns << std::endl
|
||||
<< "gateDelay1:" << arg.gateDelay1Ns << std::endl
|
||||
<< "gateDelay2:" << arg.gateDelay2Ns << std::endl
|
||||
<< "gateDelay3:" << arg.gateDelay3Ns << std::endl
|
||||
<< "gates:" << arg.gates << std::endl;
|
||||
|
||||
// if object exists, verify unlocked and idle, else only verify lock
|
||||
// (connecting first time)
|
||||
@ -438,7 +447,9 @@ int ClientInterface::setup_receiver(Interface &socket) {
|
||||
" due to fifo structure memory allocation.");
|
||||
}
|
||||
}
|
||||
impl()->setAcquisitionTime(arg.expTimeNs);
|
||||
if (myDetectorType != MYTHEN3) {
|
||||
impl()->setAcquisitionTime(arg.expTimeNs);
|
||||
}
|
||||
impl()->setAcquisitionPeriod(arg.periodNs);
|
||||
if (myDetectorType == EIGER) {
|
||||
impl()->setSubExpTime(arg.subExpTimeNs);
|
||||
@ -502,6 +513,13 @@ int ClientInterface::setup_receiver(Interface &socket) {
|
||||
if (myDetectorType == MYTHEN3) {
|
||||
int ncounters = __builtin_popcount(arg.countermask);
|
||||
impl()->setNumberofCounters(ncounters);
|
||||
impl()->setAcquisitionTime1(arg.expTime1Ns);
|
||||
impl()->setAcquisitionTime2(arg.expTime2Ns);
|
||||
impl()->setAcquisitionTime3(arg.expTime3Ns);
|
||||
impl()->setGateDelay1(arg.gateDelay1Ns);
|
||||
impl()->setGateDelay2(arg.gateDelay2Ns);
|
||||
impl()->setGateDelay3(arg.gateDelay3Ns);
|
||||
impl()->setNumberOfGates(arg.gates);
|
||||
}
|
||||
if (myDetectorType == GOTTHARD2) {
|
||||
impl()->setBurstMode(arg.burstType);
|
||||
@ -679,9 +697,44 @@ int ClientInterface::set_num_digital_samples(Interface &socket) {
|
||||
}
|
||||
|
||||
int ClientInterface::set_exptime(Interface &socket) {
|
||||
auto value = socket.Receive<int64_t>();
|
||||
LOG(logDEBUG1) << "Setting exptime to " << value << "ns";
|
||||
impl()->setAcquisitionTime(value);
|
||||
int64_t args[2]{-1, -1};
|
||||
socket.Receive(args);
|
||||
int gateIndex = static_cast<int>(args[0]);
|
||||
int64_t value = args[1];
|
||||
LOG(logDEBUG1) << "Setting exptime to " << value
|
||||
<< "ns (gateIndex: " << gateIndex << ")";
|
||||
switch (gateIndex) {
|
||||
case -1:
|
||||
if (myDetectorType == MYTHEN3) {
|
||||
impl()->setAcquisitionTime1(value);
|
||||
impl()->setAcquisitionTime2(value);
|
||||
impl()->setAcquisitionTime3(value);
|
||||
} else {
|
||||
impl()->setAcquisitionTime(value);
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
if (myDetectorType != MYTHEN3) {
|
||||
functionNotImplemented();
|
||||
}
|
||||
impl()->setAcquisitionTime1(value);
|
||||
break;
|
||||
case 1:
|
||||
if (myDetectorType != MYTHEN3) {
|
||||
functionNotImplemented();
|
||||
}
|
||||
impl()->setAcquisitionTime2(value);
|
||||
break;
|
||||
case 2:
|
||||
if (myDetectorType != MYTHEN3) {
|
||||
functionNotImplemented();
|
||||
}
|
||||
impl()->setAcquisitionTime3(value);
|
||||
break;
|
||||
default:
|
||||
throw RuntimeError("Unknown gate index for exptime " +
|
||||
std::to_string(gateIndex));
|
||||
}
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
@ -1651,4 +1704,46 @@ int ClientInterface::get_progress(Interface &socket) {
|
||||
int retval = impl()->getProgress();
|
||||
LOG(logDEBUG1) << "progress retval: " << retval;
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
||||
int ClientInterface::set_num_gates(Interface &socket) {
|
||||
auto value = socket.Receive<int>();
|
||||
LOG(logDEBUG1) << "Setting num gates to " << value;
|
||||
if (myDetectorType != MYTHEN3) {
|
||||
functionNotImplemented();
|
||||
}
|
||||
impl()->setNumberOfGates(value);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int ClientInterface::set_gate_delay(Interface &socket) {
|
||||
int64_t args[2]{-1, -1};
|
||||
socket.Receive(args);
|
||||
int gateIndex = static_cast<int>(args[0]);
|
||||
int64_t value = args[1];
|
||||
LOG(logDEBUG1) << "Setting gate delay to " << value
|
||||
<< "ns (gateIndex: " << gateIndex << ")";
|
||||
if (myDetectorType != MYTHEN3) {
|
||||
functionNotImplemented();
|
||||
}
|
||||
switch (gateIndex) {
|
||||
case -1:
|
||||
impl()->setGateDelay1(value);
|
||||
impl()->setGateDelay2(value);
|
||||
impl()->setGateDelay3(value);
|
||||
break;
|
||||
case 0:
|
||||
impl()->setGateDelay1(value);
|
||||
break;
|
||||
case 1:
|
||||
impl()->setGateDelay2(value);
|
||||
break;
|
||||
case 2:
|
||||
impl()->setGateDelay3(value);
|
||||
break;
|
||||
default:
|
||||
throw RuntimeError("Unknown gate index for gate delay " +
|
||||
std::to_string(gateIndex));
|
||||
}
|
||||
return socket.Send(OK);
|
||||
}
|
@ -2,8 +2,8 @@
|
||||
#include "Implementation.h"
|
||||
#include "ServerSocket.h"
|
||||
#include "receiver_defs.h"
|
||||
#include "sls_detector_funcs.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include "sls_detector_funcs.h"
|
||||
class ServerInterface;
|
||||
|
||||
#include <atomic>
|
||||
@ -153,6 +153,8 @@ class ClientInterface : private virtual slsDetectorDefs {
|
||||
int set_additional_json_parameter(sls::ServerInterface &socket);
|
||||
int get_additional_json_parameter(sls::ServerInterface &socket);
|
||||
int get_progress(sls::ServerInterface &socket);
|
||||
int set_num_gates(sls::ServerInterface &socket);
|
||||
int set_gate_delay(sls::ServerInterface &socket);
|
||||
|
||||
Implementation *impl() {
|
||||
if (receiver != nullptr) {
|
||||
|
@ -725,6 +725,98 @@ void HDF5File::CreateMasterDataFile(masterAttributes &masterFileAttributes) {
|
||||
PredType::NATIVE_INT);
|
||||
}
|
||||
|
||||
// Exptime1
|
||||
{
|
||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
||||
DataSet dataset = group5.createDataSet(
|
||||
"exposure time1", PredType::STD_U64LE, dataspace);
|
||||
dataset.write(&(masterFileAttributes.exptime1Ns),
|
||||
PredType::STD_U64LE);
|
||||
DataSpace dataspaceAttr = DataSpace(H5S_SCALAR);
|
||||
StrType strdatatype(PredType::C_S1, 256);
|
||||
Attribute attribute =
|
||||
dataset.createAttribute("unit", strdatatype, dataspaceAttr);
|
||||
attribute.write(strdatatype, std::string("ns"));
|
||||
}
|
||||
|
||||
// Exptime2
|
||||
{
|
||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
||||
DataSet dataset = group5.createDataSet(
|
||||
"exposure time2", PredType::STD_U64LE, dataspace);
|
||||
dataset.write(&(masterFileAttributes.exptime2Ns),
|
||||
PredType::STD_U64LE);
|
||||
DataSpace dataspaceAttr = DataSpace(H5S_SCALAR);
|
||||
StrType strdatatype(PredType::C_S1, 256);
|
||||
Attribute attribute =
|
||||
dataset.createAttribute("unit", strdatatype, dataspaceAttr);
|
||||
attribute.write(strdatatype, std::string("ns"));
|
||||
}
|
||||
|
||||
// Exptime3
|
||||
{
|
||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
||||
DataSet dataset = group5.createDataSet(
|
||||
"exposure time3", PredType::STD_U64LE, dataspace);
|
||||
dataset.write(&(masterFileAttributes.exptime3Ns),
|
||||
PredType::STD_U64LE);
|
||||
DataSpace dataspaceAttr = DataSpace(H5S_SCALAR);
|
||||
StrType strdatatype(PredType::C_S1, 256);
|
||||
Attribute attribute =
|
||||
dataset.createAttribute("unit", strdatatype, dataspaceAttr);
|
||||
attribute.write(strdatatype, std::string("ns"));
|
||||
}
|
||||
|
||||
// GateDelay1
|
||||
{
|
||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
||||
DataSet dataset = group5.createDataSet(
|
||||
"gate delay1", PredType::STD_U64LE, dataspace);
|
||||
dataset.write(&(masterFileAttributes.gateDelay1Ns),
|
||||
PredType::STD_U64LE);
|
||||
DataSpace dataspaceAttr = DataSpace(H5S_SCALAR);
|
||||
StrType strdatatype(PredType::C_S1, 256);
|
||||
Attribute attribute =
|
||||
dataset.createAttribute("unit", strdatatype, dataspaceAttr);
|
||||
attribute.write(strdatatype, std::string("ns"));
|
||||
}
|
||||
|
||||
// GateDelay2
|
||||
{
|
||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
||||
DataSet dataset = group5.createDataSet(
|
||||
"gate delay2", PredType::STD_U64LE, dataspace);
|
||||
dataset.write(&(masterFileAttributes.gateDelay2Ns),
|
||||
PredType::STD_U64LE);
|
||||
DataSpace dataspaceAttr = DataSpace(H5S_SCALAR);
|
||||
StrType strdatatype(PredType::C_S1, 256);
|
||||
Attribute attribute =
|
||||
dataset.createAttribute("unit", strdatatype, dataspaceAttr);
|
||||
attribute.write(strdatatype, std::string("ns"));
|
||||
}
|
||||
|
||||
// GateDelay3
|
||||
{
|
||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
||||
DataSet dataset = group5.createDataSet(
|
||||
"gate delay3", PredType::STD_U64LE, dataspace);
|
||||
dataset.write(&(masterFileAttributes.gateDelay3Ns),
|
||||
PredType::STD_U64LE);
|
||||
DataSpace dataspaceAttr = DataSpace(H5S_SCALAR);
|
||||
StrType strdatatype(PredType::C_S1, 256);
|
||||
Attribute attribute =
|
||||
dataset.createAttribute("unit", strdatatype, dataspaceAttr);
|
||||
attribute.write(strdatatype, std::string("ns"));
|
||||
}
|
||||
|
||||
// Dbit Offset
|
||||
{
|
||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
||||
DataSet dataset =
|
||||
group5.createDataSet("gates", PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&(masterFileAttributes.gates), PredType::NATIVE_INT);
|
||||
}
|
||||
|
||||
// Timestamp
|
||||
{
|
||||
time_t t = time(0);
|
||||
|
@ -100,10 +100,17 @@ void Implementation::InitializeMembers() {
|
||||
numberOfTriggers = 1;
|
||||
numberOfBursts = 1;
|
||||
numberOfAdditionalStorageCells = 0;
|
||||
numberOfGates = 0;
|
||||
timingMode = AUTO_TIMING;
|
||||
burstMode = BURST_INTERNAL;
|
||||
acquisitionPeriod = SAMPLE_TIME_IN_NS;
|
||||
acquisitionTime = 0;
|
||||
acquisitionTime1 = 0;
|
||||
acquisitionTime2 = 0;
|
||||
acquisitionTime3 = 0;
|
||||
gateDelay1 = 0;
|
||||
gateDelay2 = 0;
|
||||
gateDelay3 = 0;
|
||||
subExpTime = 0;
|
||||
subPeriod = 0;
|
||||
numberOfAnalogSamples = 0;
|
||||
@ -889,6 +896,13 @@ void Implementation::SetupWriter() {
|
||||
for (auto &i : ctbDbitList) {
|
||||
attr.dbitlist |= (1 << i);
|
||||
}
|
||||
attr.exptime1Ns = acquisitionTime1;
|
||||
attr.exptime2Ns = acquisitionTime2;
|
||||
attr.exptime3Ns = acquisitionTime3;
|
||||
attr.gateDelay1Ns = gateDelay1;
|
||||
attr.gateDelay2Ns = gateDelay2;
|
||||
attr.gateDelay3Ns = gateDelay3;
|
||||
attr.gates = numberOfGates;
|
||||
|
||||
try {
|
||||
for (unsigned int i = 0; i < dataProcessor.size(); ++i) {
|
||||
@ -1343,6 +1357,12 @@ void Implementation::setNumberOfAdditionalStorageCells(const int i) {
|
||||
updateTotalNumberOfFrames();
|
||||
}
|
||||
|
||||
void Implementation::setNumberOfGates(const int i) {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
numberOfGates = i;
|
||||
LOG(logINFO) << "Number of Gates: " << numberOfGates;
|
||||
}
|
||||
|
||||
slsDetectorDefs::timingMode Implementation::getTimingMode() const {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return timingMode;
|
||||
@ -1385,6 +1405,15 @@ uint64_t Implementation::getAcquisitionTime() const {
|
||||
return acquisitionTime;
|
||||
}
|
||||
|
||||
void Implementation::updateAcquisitionTime() {
|
||||
if (acquisitionTime1 == acquisitionTime2 &&
|
||||
acquisitionTime2 == acquisitionTime3) {
|
||||
acquisitionTime = acquisitionTime1;
|
||||
} else {
|
||||
acquisitionTime = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void Implementation::setAcquisitionTime(const uint64_t i) {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
@ -1393,6 +1422,54 @@ void Implementation::setAcquisitionTime(const uint64_t i) {
|
||||
<< "s";
|
||||
}
|
||||
|
||||
void Implementation::setAcquisitionTime1(const uint64_t i) {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
acquisitionTime1 = i;
|
||||
LOG(logINFO) << "Acquisition Time1: " << (double)acquisitionTime1 / (1E9)
|
||||
<< "s";
|
||||
updateAcquisitionTime();
|
||||
}
|
||||
|
||||
void Implementation::setAcquisitionTime2(const uint64_t i) {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
acquisitionTime2 = i;
|
||||
LOG(logINFO) << "Acquisition Time2: " << (double)acquisitionTime2 / (1E9)
|
||||
<< "s";
|
||||
updateAcquisitionTime();
|
||||
}
|
||||
|
||||
void Implementation::setAcquisitionTime3(const uint64_t i) {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
acquisitionTime3 = i;
|
||||
LOG(logINFO) << "Acquisition Time3: " << (double)acquisitionTime3 / (1E9)
|
||||
<< "s";
|
||||
updateAcquisitionTime();
|
||||
}
|
||||
|
||||
void Implementation::setGateDelay1(const uint64_t i) {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
gateDelay1 = i;
|
||||
LOG(logINFO) << "Gate Delay1: " << (double)gateDelay1 / (1E9) << "s";
|
||||
}
|
||||
|
||||
void Implementation::setGateDelay2(const uint64_t i) {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
gateDelay2 = i;
|
||||
LOG(logINFO) << "Gate Delay2: " << (double)gateDelay2 / (1E9) << "s";
|
||||
}
|
||||
|
||||
void Implementation::setGateDelay3(const uint64_t i) {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
|
||||
gateDelay3 = i;
|
||||
LOG(logINFO) << "Gate Delay3: " << (double)gateDelay3 / (1E9) << "s";
|
||||
}
|
||||
|
||||
uint64_t Implementation::getSubExpTime() const {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return subExpTime;
|
||||
|
@ -140,15 +140,34 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
uint64_t getNumberOfTriggers() const;
|
||||
void setNumberOfTriggers(const uint64_t i);
|
||||
uint64_t getNumberOfBursts() const;
|
||||
/** [Gottthard2] */
|
||||
void setNumberOfBursts(const uint64_t i);
|
||||
int getNumberOfAdditionalStorageCells() const;
|
||||
/** [Jungfrau] */
|
||||
void setNumberOfAdditionalStorageCells(const int i);
|
||||
/** [Mythen3] */
|
||||
void setNumberOfGates(const int i);
|
||||
timingMode getTimingMode() const;
|
||||
void setTimingMode(const timingMode i);
|
||||
burstMode getBurstMode() const;
|
||||
/** [Gottthard2] */
|
||||
void setBurstMode(const burstMode i);
|
||||
uint64_t getAcquisitionTime() const;
|
||||
void setAcquisitionTime(const uint64_t i);
|
||||
/** [Mythen3] */
|
||||
void updateAcquisitionTime();
|
||||
/** [Mythen3] */
|
||||
void setAcquisitionTime1(const uint64_t i);
|
||||
/** [Mythen3] */
|
||||
void setAcquisitionTime2(const uint64_t i);
|
||||
/** [Mythen3] */
|
||||
void setAcquisitionTime3(const uint64_t i);
|
||||
/** [Mythen3] */
|
||||
void setGateDelay1(const uint64_t i);
|
||||
/** [Mythen3] */
|
||||
void setGateDelay2(const uint64_t i);
|
||||
/** [Mythen3] */
|
||||
void setGateDelay3(const uint64_t i);
|
||||
uint64_t getAcquisitionPeriod() const;
|
||||
void setAcquisitionPeriod(const uint64_t i);
|
||||
uint64_t getSubExpTime() const;
|
||||
@ -286,10 +305,17 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
uint64_t numberOfTriggers;
|
||||
uint64_t numberOfBursts;
|
||||
int numberOfAdditionalStorageCells;
|
||||
int numberOfGates;
|
||||
timingMode timingMode;
|
||||
burstMode burstMode;
|
||||
uint64_t acquisitionPeriod;
|
||||
uint64_t acquisitionTime;
|
||||
uint64_t acquisitionTime1;
|
||||
uint64_t acquisitionTime2;
|
||||
uint64_t acquisitionTime3;
|
||||
uint64_t gateDelay1;
|
||||
uint64_t gateDelay2;
|
||||
uint64_t gateDelay3;
|
||||
uint64_t subExpTime;
|
||||
uint64_t subPeriod;
|
||||
uint64_t numberOfAnalogSamples;
|
||||
|
@ -40,8 +40,8 @@
|
||||
#define MAX_CHUNKED_IMAGES (1)
|
||||
|
||||
// versions
|
||||
#define HDF5_WRITER_VERSION (5.0) // 1 decimal places
|
||||
#define BINARY_WRITER_VERSION (5.0) // 1 decimal places
|
||||
#define HDF5_WRITER_VERSION (6.0) // 1 decimal places
|
||||
#define BINARY_WRITER_VERSION (6.0) // 1 decimal places
|
||||
|
||||
// parameters to calculate fifo depth
|
||||
#define SAMPLE_TIME_IN_NS (100000000) // 100ms
|
||||
@ -79,4 +79,11 @@ struct masterAttributes {
|
||||
uint64_t dbitlist;
|
||||
uint32_t roiXmin;
|
||||
uint32_t roiXmax;
|
||||
uint64_t exptime1Ns;
|
||||
uint64_t exptime2Ns;
|
||||
uint64_t exptime3Ns;
|
||||
uint64_t gateDelay1Ns;
|
||||
uint64_t gateDelay2Ns;
|
||||
uint64_t gateDelay3Ns;
|
||||
uint32_t gates;
|
||||
};
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "sls_detector_defs.h"
|
||||
#include "sls_detector_exceptions.h"
|
||||
#include "string_utils.h"
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <iomanip>
|
||||
#include <map>
|
||||
@ -38,9 +39,6 @@ std::string ToString(const defs::timingSourceType s);
|
||||
|
||||
std::string ToString(const slsDetectorDefs::ROI &roi);
|
||||
std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::ROI &roi);
|
||||
|
||||
|
||||
|
||||
const std::string &ToString(const std::string &s);
|
||||
|
||||
/** Convert std::chrono::duration with specified output unit */
|
||||
|
@ -207,29 +207,10 @@ typedef struct {
|
||||
use of the external signals
|
||||
*/
|
||||
enum externalSignalFlag {
|
||||
GET_EXTERNAL_SIGNAL_FLAG = -1, /**<return flag for signal */
|
||||
SIGNAL_OFF, /**<signal unused - tristate*/
|
||||
GATE_IN_ACTIVE_HIGH, /**<input gate active high*/
|
||||
GATE_IN_ACTIVE_LOW, /**<input gate active low */
|
||||
TRIGGER_IN_RISING_EDGE, /**<input exposure trigger on rising edge */
|
||||
TRIGGER_IN_FALLING_EDGE, /**<input exposure trigger on falling edge */
|
||||
RO_TRIGGER_IN_RISING_EDGE, /**<input raedout trigger on rising edge */
|
||||
RO_TRIGGER_IN_FALLING_EDGE, /**<input readout trigger on falling edge */
|
||||
GATE_OUT_ACTIVE_HIGH, /**<output active high when detector is exposing*/
|
||||
GATE_OUT_ACTIVE_LOW, /**<output active low when detector is exposing*/
|
||||
TRIGGER_OUT_RISING_EDGE, /**<output trigger rising edge at start of
|
||||
exposure */
|
||||
TRIGGER_OUT_FALLING_EDGE, /**<output trigger falling edge at start of
|
||||
exposure */
|
||||
RO_TRIGGER_OUT_RISING_EDGE, /**<output trigger rising edge at start of
|
||||
readout */
|
||||
RO_TRIGGER_OUT_FALLING_EDGE, /**<output trigger falling edge at start of
|
||||
readout */
|
||||
OUTPUT_LOW, /**< output always low */
|
||||
OUTPUT_HIGH, /**< output always high */
|
||||
MASTER_SLAVE_SYNCHRONIZATION /**< reserved for master/slave
|
||||
synchronization in multi detector
|
||||
systems */
|
||||
TRIGGER_IN_RISING_EDGE,
|
||||
TRIGGER_IN_FALLING_EDGE,
|
||||
INVERSION_ON,
|
||||
INVERSION_OFF
|
||||
};
|
||||
|
||||
/**
|
||||
@ -241,6 +222,7 @@ typedef struct {
|
||||
TRIGGER_EXPOSURE, /**< trigger mode i.e. exposure is triggered */
|
||||
GATED, /**< gated */
|
||||
BURST_TRIGGER, /**< trigger a burst of frames */
|
||||
TRIGGER_GATED, /**< trigger and gating */
|
||||
NUM_TIMING_MODES
|
||||
};
|
||||
|
||||
@ -476,6 +458,13 @@ typedef struct {
|
||||
ROI roi;
|
||||
uint32_t countermask{0};
|
||||
burstMode burstType{BURST_OFF};
|
||||
int64_t expTime1Ns{0};
|
||||
int64_t expTime2Ns{0};
|
||||
int64_t expTime3Ns{0};
|
||||
int64_t gateDelay1Ns{0};
|
||||
int64_t gateDelay2Ns{0};
|
||||
int64_t gateDelay3Ns{0};
|
||||
int gates{0};
|
||||
} __attribute__((packed));
|
||||
#endif
|
||||
|
||||
@ -483,9 +472,9 @@ typedef struct {
|
||||
protected:
|
||||
#endif
|
||||
|
||||
// #ifndef MYROOT
|
||||
// #include "sls_detector_funcs.h"
|
||||
// #endif
|
||||
// #ifndef MYROOT
|
||||
// #include "sls_detector_funcs.h"
|
||||
// #endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
|
@ -11,6 +11,7 @@
|
||||
enum detFuncs {
|
||||
F_EXEC_COMMAND = 0,
|
||||
F_GET_DETECTOR_TYPE,
|
||||
F_GET_EXTERNAL_SIGNAL_FLAG,
|
||||
F_SET_EXTERNAL_SIGNAL_FLAG,
|
||||
F_SET_TIMING_MODE,
|
||||
F_GET_FIRMWARE_VERSION,
|
||||
@ -197,6 +198,13 @@ enum detFuncs {
|
||||
F_GET_NUM_CHANNELS,
|
||||
F_UPDATE_RATE_CORRECTION,
|
||||
F_GET_RECEIVER_PARAMETERS,
|
||||
F_START_PATTERN,
|
||||
F_SET_NUM_GATES,
|
||||
F_GET_NUM_GATES,
|
||||
F_SET_GATE_DELAY,
|
||||
F_GET_GATE_DELAY,
|
||||
F_GET_EXPTIME_ALL_GATES,
|
||||
F_GET_GATE_DELAY_ALL_GATES,
|
||||
|
||||
NUM_DET_FUNCTIONS,
|
||||
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
|
||||
@ -291,6 +299,8 @@ enum detFuncs {
|
||||
F_GET_ADDITIONAL_JSON_PARAMETER,
|
||||
F_GET_RECEIVER_PROGRESS,
|
||||
F_SETUP_RECEIVER,
|
||||
F_SET_RECEIVER_NUM_GATES,
|
||||
F_SET_RECEIVER_GATE_DELAY,
|
||||
|
||||
NUM_REC_FUNCTIONS
|
||||
};
|
||||
@ -304,6 +314,7 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
switch (func) {
|
||||
case F_EXEC_COMMAND: return "F_EXEC_COMMAND";
|
||||
case F_GET_DETECTOR_TYPE: return "F_GET_DETECTOR_TYPE";
|
||||
case F_GET_EXTERNAL_SIGNAL_FLAG: return "F_GET_EXTERNAL_SIGNAL_FLAG";
|
||||
case F_SET_EXTERNAL_SIGNAL_FLAG: return "F_SET_EXTERNAL_SIGNAL_FLAG";
|
||||
case F_SET_TIMING_MODE: return "F_SET_TIMING_MODE";
|
||||
case F_GET_FIRMWARE_VERSION: return "F_GET_FIRMWARE_VERSION";
|
||||
@ -490,6 +501,14 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_GET_NUM_CHANNELS: return "F_GET_NUM_CHANNELS";
|
||||
case F_UPDATE_RATE_CORRECTION: return "F_UPDATE_RATE_CORRECTION";
|
||||
case F_GET_RECEIVER_PARAMETERS: return "F_GET_RECEIVER_PARAMETERS";
|
||||
case F_START_PATTERN: return "F_START_PATTERN";
|
||||
case F_SET_NUM_GATES: return "F_SET_NUM_GATES";
|
||||
case F_GET_NUM_GATES: return "F_GET_NUM_GATES";
|
||||
case F_SET_GATE_DELAY: return "F_SET_GATE_DELAY";
|
||||
case F_GET_GATE_DELAY: return "F_GET_GATE_DELAY";
|
||||
case F_GET_EXPTIME_ALL_GATES: return "F_GET_EXPTIME_ALL_GATES";
|
||||
case F_GET_GATE_DELAY_ALL_GATES: return "F_GET_GATE_DELAY_ALL_GATES";
|
||||
|
||||
|
||||
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
||||
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
||||
@ -583,6 +602,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_GET_ADDITIONAL_JSON_PARAMETER: return "F_GET_ADDITIONAL_JSON_PARAMETER";
|
||||
case F_GET_RECEIVER_PROGRESS: return "F_GET_RECEIVER_PROGRESS";
|
||||
case F_SETUP_RECEIVER: return "F_SETUP_RECEIVER";
|
||||
case F_SET_RECEIVER_NUM_GATES: return "F_SET_RECEIVER_NUM_GATES" ;
|
||||
case F_SET_RECEIVER_GATE_DELAY: return "F_SET_RECEIVER_GATE_DELAY" ;
|
||||
|
||||
case NUM_REC_FUNCTIONS: return "NUM_REC_FUNCTIONS";
|
||||
default: return "Unknown Function";
|
||||
@ -590,4 +611,3 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,12 @@
|
||||
/** API versions */
|
||||
#define GITBRANCH "setrxhostname"
|
||||
#define APILIB 0x200409
|
||||
#define APIRECEIVER 0x200409
|
||||
#define APIGUI 0x200409
|
||||
|
||||
#define APIEIGER 0x200515
|
||||
#define APICTB 0x200515
|
||||
#define APIGOTTHARD 0x200515
|
||||
#define APIJUNGFRAU 0x200515
|
||||
#define APIMYTHEN3 0x200515
|
||||
#define APIMOENCH 0x200515
|
||||
#define APIGOTTHARD2 0x200526
|
||||
#define GITBRANCH "setrxhostname"
|
||||
#define APILIB 0x200409
|
||||
#define APIRECEIVER 0x200409
|
||||
#define APIGUI 0x200409
|
||||
#define APICTB 0x200520
|
||||
#define APIGOTTHARD 0x200520
|
||||
#define APIJUNGFRAU 0x200520
|
||||
#define APIMOENCH 0x200515
|
||||
#define APIEIGER 0x200520
|
||||
#define APIMYTHEN3 0x200526
|
||||
#define APIGOTTHARD2 0x200527
|
||||
|
@ -128,6 +128,8 @@ std::string ToString(const defs::timingMode s) {
|
||||
return std::string("gating");
|
||||
case defs::BURST_TRIGGER:
|
||||
return std::string("burst_trigger");
|
||||
case defs::TRIGGER_GATED:
|
||||
return std::string("trigger_gating");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
@ -163,6 +165,10 @@ std::string ToString(const defs::externalSignalFlag s) {
|
||||
return std::string("trigger_in_rising_edge");
|
||||
case defs::TRIGGER_IN_FALLING_EDGE:
|
||||
return std::string("trigger_in_falling_edge");
|
||||
case defs::INVERSION_ON:
|
||||
return std::string("inversion_on");
|
||||
case defs::INVERSION_OFF:
|
||||
return std::string("inversion_off");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
@ -318,6 +324,8 @@ template <> defs::timingMode StringTo(const std::string &s) {
|
||||
return defs::GATED;
|
||||
if (s == "burst_trigger")
|
||||
return defs::BURST_TRIGGER;
|
||||
if (s == "trigger_gating")
|
||||
return defs::TRIGGER_GATED;
|
||||
throw sls::RuntimeError("Unknown timing mode " + s);
|
||||
}
|
||||
|
||||
@ -344,6 +352,10 @@ template <> defs::externalSignalFlag StringTo(const std::string &s) {
|
||||
return defs::TRIGGER_IN_RISING_EDGE;
|
||||
if (s == "trigger_in_falling_edge")
|
||||
return defs::TRIGGER_IN_FALLING_EDGE;
|
||||
if (s == "inversion_on")
|
||||
return defs::INVERSION_ON;
|
||||
if (s == "inversion_off")
|
||||
return defs::INVERSION_OFF;
|
||||
throw sls::RuntimeError("Unknown external signal flag " + s);
|
||||
}
|
||||
|
||||
|
@ -232,3 +232,9 @@ TEST_CASE("Streaming of slsDetectorDefs::ROI") {
|
||||
REQUIRE(oss.str() == "[-10, 1]");
|
||||
}
|
||||
|
||||
TEST_CASE("std::array"){
|
||||
std::array<int, 3> arr{4,6,7};
|
||||
REQUIRE(ToString(arr) == "[4, 6, 7]");
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user