mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-06 21:00:02 +02:00
Merge pull request #288 from slsdetectorgroup/jungfrau1.1
Jungfrau features for chipv1.1
This commit is contained in:
commit
799906a33a
@ -18,7 +18,8 @@ Checks: '*,
|
|||||||
-google-readability-todo,
|
-google-readability-todo,
|
||||||
-google-readability-braces-around-statements,
|
-google-readability-braces-around-statements,
|
||||||
-modernize-use-trailing-return-type,
|
-modernize-use-trailing-return-type,
|
||||||
-readability-isolate-declaration'
|
-readability-isolate-declaration,
|
||||||
|
-llvmlibc-*'
|
||||||
|
|
||||||
HeaderFilterRegex: \.h
|
HeaderFilterRegex: \.h
|
||||||
AnalyzeTemporaryDtors: false
|
AnalyzeTemporaryDtors: false
|
||||||
|
@ -39,6 +39,9 @@ This document describes the differences between 5.2.0 and 5.1.0 releases.
|
|||||||
1. Bad Channels moved to a new register
|
1. Bad Channels moved to a new register
|
||||||
|
|
||||||
|
|
||||||
|
Jungfrau- many Features
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
2. Resolved Issues
|
2. Resolved Issues
|
||||||
==================
|
==================
|
||||||
@ -59,7 +62,10 @@ This document describes the differences between 5.2.0 and 5.1.0 releases.
|
|||||||
detector server to reset core until firmware release.
|
detector server to reset core until firmware release.
|
||||||
|
|
||||||
|
|
||||||
|
getAutoCompDisable->getAutoComparatorDisable
|
||||||
|
filter->filterResistor
|
||||||
|
setBottom->setFlipRows
|
||||||
|
currentsource expects currentsrcparameters structure instread of bool
|
||||||
|
|
||||||
3. Firmware Requirements
|
3. Firmware Requirements
|
||||||
========================
|
========================
|
||||||
|
@ -101,15 +101,11 @@ def test_module_size(virtual_jf_detectors):
|
|||||||
|
|
||||||
def test_settings(virtual_jf_detectors):
|
def test_settings(virtual_jf_detectors):
|
||||||
d = ExperimentalDetector()
|
d = ExperimentalDetector()
|
||||||
assert d.settings == detectorSettings.DYNAMICGAIN
|
assert d.settings == detectorSettings.GAIN0
|
||||||
|
|
||||||
gain_list = [
|
gain_list = [
|
||||||
detectorSettings.FIXGAIN1,
|
detectorSettings.GAIN0,
|
||||||
detectorSettings.FIXGAIN2,
|
detectorSettings.HIGHGAIN0,
|
||||||
detectorSettings.FORCESWITCHG1,
|
|
||||||
detectorSettings.FORCESWITCHG2,
|
|
||||||
detectorSettings.DYNAMICHG0,
|
|
||||||
detectorSettings.DYNAMICGAIN,
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# Set all viable gain for Jungfrau to make sure nothing is crashing
|
# Set all viable gain for Jungfrau to make sure nothing is crashing
|
||||||
@ -117,15 +113,14 @@ def test_settings(virtual_jf_detectors):
|
|||||||
d.settings = gain
|
d.settings = gain
|
||||||
assert d.settings == gain
|
assert d.settings == gain
|
||||||
|
|
||||||
d.setSettings(detectorSettings.FORCESWITCHG1, [1])
|
d.setSettings(detectorSettings.GAIN0, [1])
|
||||||
assert d.settings == [
|
assert d.settings == [
|
||||||
detectorSettings.DYNAMICGAIN,
|
detectorSettings.GAIN0,
|
||||||
detectorSettings.FORCESWITCHG1,
|
detectorSettings.HIGHGAIN0,
|
||||||
detectorSettings.DYNAMICGAIN,
|
|
||||||
]
|
]
|
||||||
|
|
||||||
d.settings = detectorSettings.DYNAMICGAIN
|
d.settings = detectorSettings.GAIN0
|
||||||
assert d.settings == detectorSettings.DYNAMICGAIN
|
assert d.settings == detectorSettings.GAIN0
|
||||||
|
|
||||||
def test_frames(virtual_jf_detectors):
|
def test_frames(virtual_jf_detectors):
|
||||||
d = ExperimentalDetector()
|
d = ExperimentalDetector()
|
||||||
@ -161,4 +156,34 @@ def test_period(virtual_jf_detectors):
|
|||||||
d.period = t
|
d.period = t
|
||||||
assert d.period == 10e-6
|
assert d.period == 10e-6
|
||||||
|
|
||||||
|
def test_gainmode(virtual_jf_detectors):
|
||||||
|
d = ExperimentalDetector()
|
||||||
|
assert d.gainMode == gainMode.NORMAL_GAIN_MODE
|
||||||
|
|
||||||
|
gain_list = [
|
||||||
|
gainMode.DYNAMIC,
|
||||||
|
gainMode.FORCE_SWITCH_G1,
|
||||||
|
gainMode.FORCE_SWITCH_G2,
|
||||||
|
gainMode.FIX_G1,
|
||||||
|
gainMode.FIX_G2,
|
||||||
|
gainMode.FIX_G0
|
||||||
|
]
|
||||||
|
|
||||||
|
# Set all viable gain for Jungfrau to make sure nothing is crashing
|
||||||
|
for gain in gain_list:
|
||||||
|
d.gainMode = gain
|
||||||
|
assert d.gainMode == gain
|
||||||
|
|
||||||
|
d.setGainMode(gainMode.FORCE_SWITCH_G1, [1])
|
||||||
|
assert d.gainMode == [
|
||||||
|
gainMode.DYNAMIC,
|
||||||
|
gainMode.FORCE_SWITCH_G1,
|
||||||
|
gainMode.FORCE_SWITCH_G2,
|
||||||
|
gainMode.FIX_G1,
|
||||||
|
gainMode.FIX_G2,
|
||||||
|
gainMode.FIX_G0
|
||||||
|
]
|
||||||
|
|
||||||
|
d.gainMode = gainMode.FORCE_SWITCH_G1
|
||||||
|
assert d.gainMode == gainMode.FORCE_SWITCH_G1
|
||||||
|
|
@ -311,7 +311,7 @@ class Detector(CppDetectorApi):
|
|||||||
-----
|
-----
|
||||||
|
|
||||||
[Eiger] Use threshold command to load settings
|
[Eiger] Use threshold command to load settings
|
||||||
[Jungfrau] DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2 \n
|
[Jungfrau] GAIN0, HIGHGAIN0 \n
|
||||||
[Gotthard] DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN \n
|
[Gotthard] DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN \n
|
||||||
[Gotthard2] DYNAMICGAIN, FIXGAIN1, FIXGAIN2 \n
|
[Gotthard2] DYNAMICGAIN, FIXGAIN1, FIXGAIN2 \n
|
||||||
[Moench] G1_HIGHGAIN, G1_LOWGAIN, G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN, G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN \n
|
[Moench] G1_HIGHGAIN, G1_LOWGAIN, G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN, G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN \n
|
||||||
@ -370,7 +370,7 @@ class Detector(CppDetectorApi):
|
|||||||
Note
|
Note
|
||||||
----
|
----
|
||||||
[Moench] Default is disabled. \n
|
[Moench] Default is disabled. \n
|
||||||
[Jungfrau] Default is disabled. Get will return power status. Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled. \n
|
[Jungfrau] Default is disabled. Get will return power status. Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled. Will configure chip (only chip v1.1).\n
|
||||||
[Mythen3][Gotthard2] Default is 1. If module not connected or wrong module, powerchip will fail.
|
[Mythen3][Gotthard2] Default is 1. If module not connected or wrong module, powerchip will fail.
|
||||||
"""
|
"""
|
||||||
return self.getPowerChip()
|
return self.getPowerChip()
|
||||||
@ -1992,6 +1992,20 @@ class Detector(CppDetectorApi):
|
|||||||
Jungfrau specific
|
Jungfrau specific
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def chipversion(self):
|
||||||
|
"""
|
||||||
|
[Jungfrau] Chip version of module. Can be 1.0 or 1.1.
|
||||||
|
|
||||||
|
Example
|
||||||
|
-------
|
||||||
|
>>> d.chipversion
|
||||||
|
'1.0'
|
||||||
|
"""
|
||||||
|
return self.getChipVersion()
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def auto_comp_disable(self):
|
def auto_comp_disable(self):
|
||||||
@ -1999,14 +2013,39 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
Note
|
Note
|
||||||
-----
|
-----
|
||||||
By default, the on-chip gain switching is active during the entire exposure. This mode disables the on-chip gain switching comparator automatically after 93.75% of exposure time (only for longer than 100us).\n
|
By default, the on-chip gain switching is active during the entire exposure. This mode disables the on-chip gain switching comparator automatically after 93.75% of exposure time (only for longer than 100us). The % is only for chipv1.0, the duration can be set for chipv1.1.\n
|
||||||
Default is 0 or this mode disabled (comparator enabled throughout). 1 enables mode. 0 disables mode.
|
Default is 0 or this mode disabled (comparator enabled throughout). 1 enables mode. 0 disables mode.
|
||||||
"""
|
"""
|
||||||
return self.getAutoCompDisable()
|
return self.getAutoComparatorDisable()
|
||||||
|
|
||||||
@auto_comp_disable.setter
|
@auto_comp_disable.setter
|
||||||
def auto_comp_disable(self, value):
|
def auto_comp_disable(self, value):
|
||||||
ut.set_using_dict(self.setAutoCompDisable, value)
|
ut.set_using_dict(self.setAutoComparatorDisable, value)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def comp_disable_time(self):
|
||||||
|
"""[Jungfrau] Time before end of exposure when comparator is disabled.
|
||||||
|
|
||||||
|
Note
|
||||||
|
-----
|
||||||
|
It is only possible for chipv1.1.
|
||||||
|
:getter: always returns in seconds. To get in datetime.delta, use getComparatorDisableTime
|
||||||
|
|
||||||
|
Example
|
||||||
|
-----------
|
||||||
|
>>> d.comp_disable_time = 1.05
|
||||||
|
>>> d.comp_disable_time = datetime.timedelta(minutes = 3, seconds = 1.23)
|
||||||
|
>>> d.comp_disable_time
|
||||||
|
181.23
|
||||||
|
>>> d.getComparatorDisableTime()
|
||||||
|
[datetime.timedelta(seconds=181, microseconds=230000)]
|
||||||
|
"""
|
||||||
|
return ut.reduce_time(self.getComparatorDisableTime())
|
||||||
|
|
||||||
|
@comp_disable_time.setter
|
||||||
|
def comp_disable_time(self, value):
|
||||||
|
ut.set_time_using_dict(self.setComparatorDisableTime, value)
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -2026,7 +2065,7 @@ class Detector(CppDetectorApi):
|
|||||||
[Jungfrau] Number of additional storage cells.
|
[Jungfrau] Number of additional storage cells.
|
||||||
Note
|
Note
|
||||||
----
|
----
|
||||||
For advanced users only. \n
|
Only for chip v1.0. For advanced users only. \n
|
||||||
Options: 0 - 15. Default is 0.
|
Options: 0 - 15. Default is 0.
|
||||||
The #images = #frames x #triggers x (#storagecells + 1)
|
The #images = #frames x #triggers x (#storagecells + 1)
|
||||||
"""
|
"""
|
||||||
@ -2045,7 +2084,7 @@ class Detector(CppDetectorApi):
|
|||||||
Note
|
Note
|
||||||
----
|
----
|
||||||
For advanced users only.
|
For advanced users only.
|
||||||
Options 0-15. Default is 15. \n
|
Options 0-max. max is 15 (default) for chipv1.0 and 3 (default) for chipv1.1. \n
|
||||||
"""
|
"""
|
||||||
return self.getStorageCellStart()
|
return self.getStorageCellStart()
|
||||||
|
|
||||||
@ -2059,7 +2098,7 @@ class Detector(CppDetectorApi):
|
|||||||
[Jungfrau] Additional time delay between 2 consecutive exposures in burst mode, accepts either a value in seconds or datetime.timedelta
|
[Jungfrau] Additional time delay between 2 consecutive exposures in burst mode, accepts either a value in seconds or datetime.timedelta
|
||||||
Note
|
Note
|
||||||
-----
|
-----
|
||||||
For advanced users only \n
|
Only applicable for chipv1.0. For advanced users only \n
|
||||||
Value: 0-1638375 ns (resolution of 25ns) \n
|
Value: 0-1638375 ns (resolution of 25ns) \n
|
||||||
:getter: always returns in seconds. To get in datetime.delta, use getStorageCellDelay
|
:getter: always returns in seconds. To get in datetime.delta, use getStorageCellDelay
|
||||||
|
|
||||||
@ -2151,6 +2190,26 @@ class Detector(CppDetectorApi):
|
|||||||
def selinterface(self, i):
|
def selinterface(self, i):
|
||||||
ut.set_using_dict(self.selectUDPInterface, i)
|
ut.set_using_dict(self.selectUDPInterface, i)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def gainmodelist(self):
|
||||||
|
"""List of gainmode implemented for this detector."""
|
||||||
|
return self.getGainModeList()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def gainmode(self):
|
||||||
|
"""
|
||||||
|
[Jungfrau] Detector gain mode. Enum: gainMode
|
||||||
|
Note
|
||||||
|
-----
|
||||||
|
[Jungfrau] DYNAMIC, FORCE_SWITCH_G1, FORCE_SWITCH_G2, FIX_G1, FIX_G2, FIX_G0 \n
|
||||||
|
CAUTION: Do not use FIX_G0 without caution, you can damage the detector!!!
|
||||||
|
"""
|
||||||
|
return element_if_equal(self.getGainMode())
|
||||||
|
|
||||||
|
@gainmode.setter
|
||||||
|
def gainmode(self, value):
|
||||||
|
self.setGainMode(value)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
---------------------------<<<Gotthard2 specific>>>---------------------------
|
---------------------------<<<Gotthard2 specific>>>---------------------------
|
||||||
"""
|
"""
|
||||||
@ -2179,17 +2238,36 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def filter(self):
|
def filterresistor(self):
|
||||||
"""[Gotthard2] Set filter resistor.
|
"""
|
||||||
|
[Gotthard2][Jungfrau] Set filter resistor. Increasing values for increasing "
|
||||||
|
"resistance.
|
||||||
Note
|
Note
|
||||||
----
|
----
|
||||||
Default is 0. Options: 0-3.
|
Advanced user command.
|
||||||
|
[Gotthard2] Default is 0. Options: 0-3.
|
||||||
|
[Jungfrau] Default is 1. Options: 0-1.
|
||||||
"""
|
"""
|
||||||
return self.getFilter()
|
return self.getFilterResistor()
|
||||||
|
|
||||||
@filter.setter
|
@filterresistor.setter
|
||||||
def filter(self, value):
|
def filterresistor(self, value):
|
||||||
ut.set_using_dict(self.setFilter, value)
|
ut.set_using_dict(self.setFilterResistor, value)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def filtercell(self):
|
||||||
|
"""
|
||||||
|
[Jungfrau] Set filter capacitor.
|
||||||
|
Note
|
||||||
|
----
|
||||||
|
[Jungfrau] Options: 0-12. Default: 0. Advanced user command.
|
||||||
|
"""
|
||||||
|
return self.getFilterCell()
|
||||||
|
|
||||||
|
@filtercell.setter
|
||||||
|
def filtercell(self, value):
|
||||||
|
ut.set_using_dict(self.setFilterCell, value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def maxclkphaseshift(self):
|
def maxclkphaseshift(self):
|
||||||
|
@ -1,17 +1,20 @@
|
|||||||
|
"""
|
||||||
|
Automatically improt all enums from slsDetectorDefs and give an
|
||||||
|
alias with their name in the enum module. All names from the enum
|
||||||
|
module is later imported into slsdet
|
||||||
|
|
||||||
|
Example: detectorType = _slsdet.slsDetectorDefs.detectorType
|
||||||
|
Usage can later be:
|
||||||
|
|
||||||
|
from slsdet import detectorType
|
||||||
|
if dt === detectorType.EIGER:
|
||||||
|
#do something
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
import _slsdet
|
import _slsdet
|
||||||
runStatus = _slsdet.slsDetectorDefs.runStatus
|
for name, cls in _slsdet.slsDetectorDefs.__dict__.items():
|
||||||
speedLevel = _slsdet.slsDetectorDefs.speedLevel
|
if isinstance(cls, type):
|
||||||
detectorType = _slsdet.slsDetectorDefs.detectorType
|
exec(f'{name} = {cls.__module__}.{cls.__qualname__}')
|
||||||
frameDiscardPolicy = _slsdet.slsDetectorDefs.frameDiscardPolicy
|
|
||||||
fileFormat = _slsdet.slsDetectorDefs.fileFormat
|
|
||||||
dimension = _slsdet.slsDetectorDefs.dimension
|
|
||||||
externalSignalFlag = _slsdet.slsDetectorDefs.externalSignalFlag
|
|
||||||
timingMode = _slsdet.slsDetectorDefs.timingMode
|
|
||||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
|
||||||
detectorSettings = _slsdet.slsDetectorDefs.detectorSettings
|
|
||||||
clockIndex = _slsdet.slsDetectorDefs.clockIndex
|
|
||||||
readoutMode = _slsdet.slsDetectorDefs.readoutMode
|
|
||||||
burstMode = _slsdet.slsDetectorDefs.burstMode
|
|
||||||
timingSourceType = _slsdet.slsDetectorDefs.timingSourceType
|
|
||||||
M3_GainCaps = _slsdet.slsDetectorDefs.M3_GainCaps
|
|
||||||
|
@ -354,9 +354,28 @@ void init_det(py::module &m) {
|
|||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getDacList", (std::vector<defs::dacIndex>(Detector::*)() const) &
|
.def("getDacList", (std::vector<defs::dacIndex>(Detector::*)() const) &
|
||||||
Detector::getDacList)
|
Detector::getDacList)
|
||||||
.def("setDefaultDacs",
|
.def("getDefaultDac",
|
||||||
(void (Detector::*)(sls::Positions)) & Detector::setDefaultDacs,
|
(Result<int>(Detector::*)(defs::dacIndex, sls::Positions)) &
|
||||||
py::arg() = Positions{})
|
Detector::getDefaultDac,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("setDefaultDac",
|
||||||
|
(void (Detector::*)(defs::dacIndex, int, sls::Positions)) &
|
||||||
|
Detector::setDefaultDac,
|
||||||
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getDefaultDac",
|
||||||
|
(Result<int>(Detector::*)(defs::dacIndex, defs::detectorSettings,
|
||||||
|
sls::Positions)) &
|
||||||
|
Detector::getDefaultDac,
|
||||||
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
|
.def("setDefaultDac",
|
||||||
|
(void (Detector::*)(defs::dacIndex, int, defs::detectorSettings,
|
||||||
|
sls::Positions)) &
|
||||||
|
Detector::setDefaultDac,
|
||||||
|
py::arg(), py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
|
.def("resetToDefaultDacs",
|
||||||
|
(void (Detector::*)(const bool, sls::Positions)) &
|
||||||
|
Detector::resetToDefaultDacs,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getDAC",
|
.def("getDAC",
|
||||||
(Result<int>(Detector::*)(defs::dacIndex, bool, sls::Positions)
|
(Result<int>(Detector::*)(defs::dacIndex, bool, sls::Positions)
|
||||||
const) &
|
const) &
|
||||||
@ -829,12 +848,12 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(bool, sls::Positions)) &
|
(void (Detector::*)(bool, sls::Positions)) &
|
||||||
Detector::setOverFlowMode,
|
Detector::setOverFlowMode,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getBottom",
|
.def("getFlipRows",
|
||||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getBottom,
|
Detector::getFlipRows,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setBottom",
|
.def("setFlipRows",
|
||||||
(void (Detector::*)(bool, sls::Positions)) & Detector::setBottom,
|
(void (Detector::*)(bool, sls::Positions)) & Detector::setFlipRows,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getRateCorrection",
|
.def("getRateCorrection",
|
||||||
(Result<sls::ns>(Detector::*)(sls::Positions) const) &
|
(Result<sls::ns>(Detector::*)(sls::Positions) const) &
|
||||||
@ -923,6 +942,10 @@ void init_det(py::module &m) {
|
|||||||
sls::Positions)) &
|
sls::Positions)) &
|
||||||
Detector::setDataStream,
|
Detector::setDataStream,
|
||||||
py::arg(), py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getChipVersion",
|
||||||
|
(Result<double>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getChipVersion,
|
||||||
|
py::arg() = Positions{})
|
||||||
.def("getThresholdTemperature",
|
.def("getThresholdTemperature",
|
||||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getThresholdTemperature,
|
Detector::getThresholdTemperature,
|
||||||
@ -947,13 +970,21 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(sls::Positions)) &
|
(void (Detector::*)(sls::Positions)) &
|
||||||
Detector::resetTemperatureEvent,
|
Detector::resetTemperatureEvent,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getAutoCompDisable",
|
.def("getAutoComparatorDisable",
|
||||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getAutoCompDisable,
|
Detector::getAutoComparatorDisable,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setAutoCompDisable",
|
.def("setAutoComparatorDisable",
|
||||||
(void (Detector::*)(bool, sls::Positions)) &
|
(void (Detector::*)(bool, sls::Positions)) &
|
||||||
Detector::setAutoCompDisable,
|
Detector::setAutoComparatorDisable,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getComparatorDisableTime",
|
||||||
|
(Result<sls::ns>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getComparatorDisableTime,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setComparatorDisableTime",
|
||||||
|
(void (Detector::*)(sls::ns, sls::Positions)) &
|
||||||
|
Detector::setComparatorDisableTime,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getNumberOfAdditionalStorageCells",
|
.def("getNumberOfAdditionalStorageCells",
|
||||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||||
@ -979,6 +1010,17 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(sls::ns, sls::Positions)) &
|
(void (Detector::*)(sls::ns, sls::Positions)) &
|
||||||
Detector::setStorageCellDelay,
|
Detector::setStorageCellDelay,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getGainModeList",
|
||||||
|
(std::vector<defs::gainMode>(Detector::*)() const) &
|
||||||
|
Detector::getGainModeList)
|
||||||
|
.def("getGainMode",
|
||||||
|
(Result<defs::gainMode>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getGainMode,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setGainMode",
|
||||||
|
(void (Detector::*)(defs::gainMode, sls::Positions)) &
|
||||||
|
Detector::setGainMode,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getROI",
|
.def("getROI",
|
||||||
(Result<defs::ROI>(Detector::*)(sls::Positions) const) &
|
(Result<defs::ROI>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getROI,
|
Detector::getROI,
|
||||||
@ -1054,12 +1096,21 @@ void init_det(py::module &m) {
|
|||||||
.def("setCDSGain",
|
.def("setCDSGain",
|
||||||
(void (Detector::*)(bool, sls::Positions)) & Detector::setCDSGain,
|
(void (Detector::*)(bool, sls::Positions)) & Detector::setCDSGain,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getFilter",
|
.def("getFilterResistor",
|
||||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getFilter,
|
Detector::getFilterResistor,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setFilter",
|
.def("setFilterResistor",
|
||||||
(void (Detector::*)(int, sls::Positions)) & Detector::setFilter,
|
(void (Detector::*)(int, sls::Positions)) &
|
||||||
|
Detector::setFilterResistor,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getFilterCell",
|
||||||
|
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getFilterCell,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setFilterCell",
|
||||||
|
(void (Detector::*)(int, sls::Positions)) &
|
||||||
|
Detector::setFilterCell,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getCurrentSource",
|
.def("getCurrentSource",
|
||||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||||
|
@ -210,13 +210,9 @@ void init_enums(py::module &m) {
|
|||||||
.value("LOWGAIN", slsDetectorDefs::detectorSettings::LOWGAIN)
|
.value("LOWGAIN", slsDetectorDefs::detectorSettings::LOWGAIN)
|
||||||
.value("MEDIUMGAIN", slsDetectorDefs::detectorSettings::MEDIUMGAIN)
|
.value("MEDIUMGAIN", slsDetectorDefs::detectorSettings::MEDIUMGAIN)
|
||||||
.value("VERYHIGHGAIN", slsDetectorDefs::detectorSettings::VERYHIGHGAIN)
|
.value("VERYHIGHGAIN", slsDetectorDefs::detectorSettings::VERYHIGHGAIN)
|
||||||
.value("DYNAMICHG0", slsDetectorDefs::detectorSettings::DYNAMICHG0)
|
.value("HIGHGAIN0", slsDetectorDefs::detectorSettings::HIGHGAIN0)
|
||||||
.value("FIXGAIN1", slsDetectorDefs::detectorSettings::FIXGAIN1)
|
.value("FIXGAIN1", slsDetectorDefs::detectorSettings::FIXGAIN1)
|
||||||
.value("FIXGAIN2", slsDetectorDefs::detectorSettings::FIXGAIN2)
|
.value("FIXGAIN2", slsDetectorDefs::detectorSettings::FIXGAIN2)
|
||||||
.value("FORCESWITCHG1",
|
|
||||||
slsDetectorDefs::detectorSettings::FORCESWITCHG1)
|
|
||||||
.value("FORCESWITCHG2",
|
|
||||||
slsDetectorDefs::detectorSettings::FORCESWITCHG2)
|
|
||||||
.value("VERYLOWGAIN", slsDetectorDefs::detectorSettings::VERYLOWGAIN)
|
.value("VERYLOWGAIN", slsDetectorDefs::detectorSettings::VERYLOWGAIN)
|
||||||
.value("G1_HIGHGAIN", slsDetectorDefs::detectorSettings::G1_HIGHGAIN)
|
.value("G1_HIGHGAIN", slsDetectorDefs::detectorSettings::G1_HIGHGAIN)
|
||||||
.value("G1_LOWGAIN", slsDetectorDefs::detectorSettings::G1_LOWGAIN)
|
.value("G1_LOWGAIN", slsDetectorDefs::detectorSettings::G1_LOWGAIN)
|
||||||
@ -230,6 +226,7 @@ void init_enums(py::module &m) {
|
|||||||
slsDetectorDefs::detectorSettings::G2_LOWCAP_LOWGAIN)
|
slsDetectorDefs::detectorSettings::G2_LOWCAP_LOWGAIN)
|
||||||
.value("G4_HIGHGAIN", slsDetectorDefs::detectorSettings::G4_HIGHGAIN)
|
.value("G4_HIGHGAIN", slsDetectorDefs::detectorSettings::G4_HIGHGAIN)
|
||||||
.value("G4_LOWGAIN", slsDetectorDefs::detectorSettings::G4_LOWGAIN)
|
.value("G4_LOWGAIN", slsDetectorDefs::detectorSettings::G4_LOWGAIN)
|
||||||
|
.value("GAIN0", slsDetectorDefs::detectorSettings::GAIN0)
|
||||||
.value("UNDEFINED", slsDetectorDefs::detectorSettings::UNDEFINED)
|
.value("UNDEFINED", slsDetectorDefs::detectorSettings::UNDEFINED)
|
||||||
.value("UNINITIALIZED",
|
.value("UNINITIALIZED",
|
||||||
slsDetectorDefs::detectorSettings::UNINITIALIZED)
|
slsDetectorDefs::detectorSettings::UNINITIALIZED)
|
||||||
@ -309,4 +306,13 @@ void init_enums(py::module &m) {
|
|||||||
.value("DEFAULT_ALGORITHM",
|
.value("DEFAULT_ALGORITHM",
|
||||||
slsDetectorDefs::vetoAlgorithm::DEFAULT_ALGORITHM)
|
slsDetectorDefs::vetoAlgorithm::DEFAULT_ALGORITHM)
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
|
py::enum_<slsDetectorDefs::gainMode>(Defs, "gainMode")
|
||||||
|
.value("DYNAMIC", slsDetectorDefs::gainMode::DYNAMIC)
|
||||||
|
.value("FORCE_SWITCH_G1", slsDetectorDefs::gainMode::FORCE_SWITCH_G1)
|
||||||
|
.value("FORCE_SWITCH_G2", slsDetectorDefs::gainMode::FORCE_SWITCH_G2)
|
||||||
|
.value("FIX_G1", slsDetectorDefs::gainMode::FIX_G1)
|
||||||
|
.value("FIX_G2", slsDetectorDefs::gainMode::FIX_G2)
|
||||||
|
.value("FIX_G0", slsDetectorDefs::gainMode::FIX_G0)
|
||||||
|
.export_values();
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>775</width>
|
<width>775</width>
|
||||||
<height>345</height>
|
<height>380</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -32,7 +32,7 @@
|
|||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="3" column="3">
|
<item row="4" column="3">
|
||||||
<widget class="QCheckBox" name="chkCounter2">
|
<widget class="QCheckBox" name="chkCounter2">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -51,7 +51,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="4">
|
<item row="4" column="4">
|
||||||
<widget class="QCheckBox" name="chkCounter3">
|
<widget class="QCheckBox" name="chkCounter3">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -70,7 +70,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2" colspan="3">
|
<item row="3" column="2" colspan="3">
|
||||||
<widget class="QComboBox" name="comboDynamicRange">
|
<widget class="QComboBox" name="comboDynamicRange">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -109,7 +109,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2" colspan="3">
|
<item row="2" column="2" colspan="3">
|
||||||
<widget class="QSpinBox" name="spinThreshold">
|
<widget class="QSpinBox" name="spinThreshold">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -146,7 +146,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="6">
|
<item row="2" column="6">
|
||||||
<widget class="QSpinBox" name="spinThreshold3">
|
<widget class="QSpinBox" name="spinThreshold3">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -183,7 +183,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="lblDynamicRange">
|
<widget class="QLabel" name="lblDynamicRange">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -205,7 +205,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="2">
|
<item row="5" column="2">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -221,7 +221,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="8">
|
<item row="2" column="8">
|
||||||
<widget class="QPushButton" name="btnSetThreshold">
|
<widget class="QPushButton" name="btnSetThreshold">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -334,7 +334,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="lblThreshold">
|
<widget class="QLabel" name="lblThreshold">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -356,7 +356,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="5">
|
<item row="2" column="5">
|
||||||
<widget class="QSpinBox" name="spinThreshold2">
|
<widget class="QSpinBox" name="spinThreshold2">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -393,7 +393,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="9">
|
<item row="2" column="9">
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -409,7 +409,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="lblCounter">
|
<widget class="QLabel" name="lblCounter">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -431,7 +431,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="2">
|
<item row="4" column="2">
|
||||||
<widget class="QCheckBox" name="chkCounter1">
|
<widget class="QCheckBox" name="chkCounter1">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -514,7 +514,7 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Dynamic HG0</string>
|
<string>High Gain 0</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -527,16 +527,6 @@
|
|||||||
<string>Fix Gain 2</string>
|
<string>Fix Gain 2</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Force Switch G1</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Force Switch G2</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Very Low Gain</string>
|
<string>Very Low Gain</string>
|
||||||
@ -582,6 +572,11 @@
|
|||||||
<string>G4_LG</string>
|
<string>G4_LG</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Gain 0</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Undefined</string>
|
<string>Undefined</string>
|
||||||
@ -594,6 +589,86 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="lblGainMode">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>110</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>110</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Gain Mode:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QComboBox" name="comboGainMode">
|
||||||
|
<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>140</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>140</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Gain Mode of the detector</p><p> #gainmode#</p><p><br/></p><p>Fix G0 is to be used with utmost caution. Can damage the detector!</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Dynamic Gain</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Force Switch G1</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Force Switch G2</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Fix G1</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Fix G2</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Fix G0</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
|
@ -10,9 +10,12 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
|||||||
qTabSettings(QWidget *parent, sls::Detector *detector);
|
qTabSettings(QWidget *parent, sls::Detector *detector);
|
||||||
~qTabSettings();
|
~qTabSettings();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
public slots:
|
||||||
|
void SetExportMode(bool exportMode);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SetSettings(int index);
|
void SetSettings(int index);
|
||||||
|
void SetGainMode(int index);
|
||||||
void SetDynamicRange(int index);
|
void SetDynamicRange(int index);
|
||||||
void SetThresholdEnergy(int index);
|
void SetThresholdEnergy(int index);
|
||||||
void SetThresholdEnergies();
|
void SetThresholdEnergies();
|
||||||
@ -21,9 +24,12 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
|||||||
private:
|
private:
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
void SetupDetectorSettings();
|
void SetupDetectorSettings();
|
||||||
|
void SetupGainMode();
|
||||||
|
void ShowFixG0(bool expertMode);
|
||||||
void Initialization();
|
void Initialization();
|
||||||
|
|
||||||
void GetSettings();
|
void GetSettings();
|
||||||
|
void GetGainMode();
|
||||||
void GetDynamicRange();
|
void GetDynamicRange();
|
||||||
void GetThresholdEnergy();
|
void GetThresholdEnergy();
|
||||||
void GetThresholdEnergies();
|
void GetThresholdEnergies();
|
||||||
@ -40,11 +46,9 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
|||||||
LOWGAIN,
|
LOWGAIN,
|
||||||
MEDIUMGAIN,
|
MEDIUMGAIN,
|
||||||
VERYHIGHGAIN,
|
VERYHIGHGAIN,
|
||||||
DYNAMICHG0,
|
HIGHGAIN0,
|
||||||
FIXGAIN1,
|
FIXGAIN1,
|
||||||
FIXGAIN2,
|
FIXGAIN2,
|
||||||
FORCESWITCHG1,
|
|
||||||
FORCESWITCHG2,
|
|
||||||
VERLOWGAIN,
|
VERLOWGAIN,
|
||||||
G1_HIGHGAIN,
|
G1_HIGHGAIN,
|
||||||
G1_LOWGAIN,
|
G1_LOWGAIN,
|
||||||
@ -54,9 +58,21 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
|||||||
G2_LOWCAP_LOWGAIN,
|
G2_LOWCAP_LOWGAIN,
|
||||||
G4_HIGHGAIN,
|
G4_HIGHGAIN,
|
||||||
G4_LOWGAIN,
|
G4_LOWGAIN,
|
||||||
|
GAIN0,
|
||||||
UNDEFINED,
|
UNDEFINED,
|
||||||
UNINITIALIZED,
|
UNINITIALIZED,
|
||||||
NUMSETTINGS
|
NUMSETTINGS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
DYNAMIC,
|
||||||
|
FORCE_SWITCH_G1,
|
||||||
|
FORCE_SWITCH_G2,
|
||||||
|
FIX_G1,
|
||||||
|
FIX_G2,
|
||||||
|
FIX_G0
|
||||||
|
};
|
||||||
|
bool isVisibleFixG0{false};
|
||||||
|
|
||||||
enum { DYNAMICRANGE_32, DYNAMICRANGE_16, DYNAMICRANGE_8, DYNAMICRANGE_4 };
|
enum { DYNAMICRANGE_32, DYNAMICRANGE_16, DYNAMICRANGE_8, DYNAMICRANGE_4 };
|
||||||
};
|
};
|
||||||
|
@ -340,6 +340,7 @@ void qDetectorMain::EnableModes(QAction *action) {
|
|||||||
actionLoadTrimbits->setVisible(enable &&
|
actionLoadTrimbits->setVisible(enable &&
|
||||||
(detType == slsDetectorDefs::EIGER ||
|
(detType == slsDetectorDefs::EIGER ||
|
||||||
detType == slsDetectorDefs::MYTHEN3));
|
detType == slsDetectorDefs::MYTHEN3));
|
||||||
|
tabSettings->SetExportMode(enable);
|
||||||
LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable);
|
LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,24 +213,17 @@ void qTabMeasurement::SetupTimingMode() {
|
|||||||
index[i] = model->index(i, comboTimingMode->modelColumn(),
|
index[i] = model->index(i, comboTimingMode->modelColumn(),
|
||||||
comboTimingMode->rootModelIndex());
|
comboTimingMode->rootModelIndex());
|
||||||
item[i] = model->itemFromIndex(index[i]);
|
item[i] = model->itemFromIndex(index[i]);
|
||||||
|
item[i]->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
item[(int)GATED]->setEnabled(false);
|
auto res = det->getTimingModeList();
|
||||||
item[(int)BURST_TRIGGER]->setEnabled(false);
|
for (auto it : res) {
|
||||||
item[(int)TRIGGER_GATED]->setEnabled(false);
|
item[(int)it]->setEnabled(true);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CATCH_DISPLAY(std::string("Could not setup timing mode"),
|
||||||
|
"qTabMeasurement::SetupTimingMode")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMeasurement::EnableWidgetsforTimingMode() {
|
void qTabMeasurement::EnableWidgetsforTimingMode() {
|
||||||
|
@ -71,6 +71,9 @@ void qTabSettings::SetupWidgetWindow() {
|
|||||||
comboDynamicRange->setEnabled(true);
|
comboDynamicRange->setEnabled(true);
|
||||||
lblThreshold->setEnabled(true);
|
lblThreshold->setEnabled(true);
|
||||||
spinThreshold->setEnabled(true);
|
spinThreshold->setEnabled(true);
|
||||||
|
} else if (detType == slsDetectorDefs::JUNGFRAU) {
|
||||||
|
lblGainMode->setEnabled(true);
|
||||||
|
comboGainMode->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// default settings for the disabled
|
// default settings for the disabled
|
||||||
@ -83,75 +86,72 @@ void qTabSettings::SetupWidgetWindow() {
|
|||||||
spinThreshold2->setValue(-1);
|
spinThreshold2->setValue(-1);
|
||||||
spinThreshold3->setValue(-1);
|
spinThreshold3->setValue(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// default for gain mode
|
||||||
|
if (comboGainMode->isEnabled()) {
|
||||||
|
SetupGainMode();
|
||||||
|
}
|
||||||
|
|
||||||
Initialization();
|
Initialization();
|
||||||
// default for the disabled
|
// default for the disabled
|
||||||
GetDynamicRange();
|
GetDynamicRange();
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qTabSettings::SetExportMode(bool exportMode) {
|
||||||
|
if (comboGainMode->isVisible()) {
|
||||||
|
ShowFixG0(exportMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void qTabSettings::SetupDetectorSettings() {
|
void qTabSettings::SetupDetectorSettings() {
|
||||||
|
comboSettings->setCurrentIndex(UNINITIALIZED);
|
||||||
|
|
||||||
|
// enable only those available to detector
|
||||||
QStandardItemModel *model =
|
QStandardItemModel *model =
|
||||||
qobject_cast<QStandardItemModel *>(comboSettings->model());
|
qobject_cast<QStandardItemModel *>(comboSettings->model());
|
||||||
|
const int numSettings = comboSettings->count();
|
||||||
if (model) {
|
if (model) {
|
||||||
QModelIndex index[NUMSETTINGS];
|
std::vector<QModelIndex> index(numSettings);
|
||||||
QStandardItem *item[NUMSETTINGS];
|
std::vector<QStandardItem *> item(numSettings);
|
||||||
for (int i = 0; i < NUMSETTINGS; ++i) {
|
for (size_t i = 0; i < index.size(); ++i) {
|
||||||
index[i] = model->index(i, comboSettings->modelColumn(),
|
index[i] = model->index(i, comboSettings->modelColumn(),
|
||||||
comboSettings->rootModelIndex());
|
comboSettings->rootModelIndex());
|
||||||
item[i] = model->itemFromIndex(index[i]);
|
item[i] = model->itemFromIndex(index[i]);
|
||||||
item[i]->setEnabled(false);
|
item[i]->setEnabled(false);
|
||||||
}
|
}
|
||||||
switch (det->getDetectorType().squash()) {
|
try {
|
||||||
case slsDetectorDefs::EIGER:
|
auto res = det->getSettingsList();
|
||||||
item[(int)STANDARD]->setEnabled(true);
|
for (auto it : res) {
|
||||||
item[(int)HIGHGAIN]->setEnabled(true);
|
item[(int)it]->setEnabled(true);
|
||||||
item[(int)LOWGAIN]->setEnabled(true);
|
|
||||||
item[(int)VERYHIGHGAIN]->setEnabled(true);
|
|
||||||
item[(int)VERLOWGAIN]->setEnabled(true);
|
|
||||||
break;
|
|
||||||
case slsDetectorDefs::GOTTHARD:
|
|
||||||
item[(int)HIGHGAIN]->setEnabled(true);
|
|
||||||
item[(int)DYNAMICGAIN]->setEnabled(true);
|
|
||||||
item[(int)LOWGAIN]->setEnabled(true);
|
|
||||||
item[(int)MEDIUMGAIN]->setEnabled(true);
|
|
||||||
item[(int)VERYHIGHGAIN]->setEnabled(true);
|
|
||||||
break;
|
|
||||||
case slsDetectorDefs::JUNGFRAU:
|
|
||||||
item[(int)DYNAMICGAIN]->setEnabled(true);
|
|
||||||
item[(int)DYNAMICHG0]->setEnabled(true);
|
|
||||||
item[(int)FIXGAIN1]->setEnabled(true);
|
|
||||||
item[(int)FIXGAIN2]->setEnabled(true);
|
|
||||||
item[(int)FORCESWITCHG1]->setEnabled(true);
|
|
||||||
item[(int)FORCESWITCHG2]->setEnabled(true);
|
|
||||||
break;
|
|
||||||
case slsDetectorDefs::GOTTHARD2:
|
|
||||||
item[(int)DYNAMICGAIN]->setEnabled(true);
|
|
||||||
item[(int)FIXGAIN1]->setEnabled(true);
|
|
||||||
item[(int)FIXGAIN2]->setEnabled(true);
|
|
||||||
break;
|
|
||||||
case slsDetectorDefs::MOENCH:
|
|
||||||
item[(int)G1_HIGHGAIN]->setEnabled(true);
|
|
||||||
item[(int)G1_LOWGAIN]->setEnabled(true);
|
|
||||||
item[(int)G2_HIGHCAP_HIGHGAIN]->setEnabled(true);
|
|
||||||
item[(int)G2_HIGHCAP_LOWGAIN]->setEnabled(true);
|
|
||||||
item[(int)G2_LOWCAP_HIGHGAIN]->setEnabled(true);
|
|
||||||
item[(int)G2_LOWCAP_LOWGAIN]->setEnabled(true);
|
|
||||||
item[(int)G4_HIGHGAIN]->setEnabled(true);
|
|
||||||
item[(int)G4_LOWGAIN]->setEnabled(true);
|
|
||||||
break;
|
|
||||||
case slsDetectorDefs::MYTHEN3:
|
|
||||||
item[(int)STANDARD]->setEnabled(true);
|
|
||||||
item[(int)FAST]->setEnabled(true);
|
|
||||||
item[(int)HIGHGAIN]->setEnabled(true);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOG(logDEBUG) << "Unknown detector type. Exiting GUI.";
|
|
||||||
qDefs::Message(qDefs::CRITICAL,
|
|
||||||
"Unknown detector type. Exiting GUI.",
|
|
||||||
"qTabSettings::SetupDetectorSettings");
|
|
||||||
exit(-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CATCH_DISPLAY(std::string("Could not setup settings"),
|
||||||
|
"qTabSettings::SetupDetectorSettings")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void qTabSettings::SetupGainMode() {
|
||||||
|
comboGainMode->setCurrentIndex(DYNAMIC);
|
||||||
|
ShowFixG0(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void qTabSettings::ShowFixG0(bool expertMode) {
|
||||||
|
LOG(logINFO) << (expertMode ? "Showing" : "Hiding") << " FIX_G0";
|
||||||
|
|
||||||
|
// enable.disable Fix G0
|
||||||
|
QStandardItemModel *model =
|
||||||
|
qobject_cast<QStandardItemModel *>(comboGainMode->model());
|
||||||
|
const int numSettings = comboGainMode->count();
|
||||||
|
if (model) {
|
||||||
|
std::vector<QModelIndex> index(numSettings);
|
||||||
|
std::vector<QStandardItem *> item(numSettings);
|
||||||
|
index[FIX_G0] = model->index(FIX_G0, comboGainMode->modelColumn(),
|
||||||
|
comboGainMode->rootModelIndex());
|
||||||
|
item[FIX_G0] = model->itemFromIndex(index[FIX_G0]);
|
||||||
|
item[FIX_G0]->setEnabled(expertMode);
|
||||||
|
}
|
||||||
|
isVisibleFixG0 = expertMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabSettings::Initialization() {
|
void qTabSettings::Initialization() {
|
||||||
@ -159,6 +159,10 @@ void qTabSettings::Initialization() {
|
|||||||
if (comboSettings->isEnabled())
|
if (comboSettings->isEnabled())
|
||||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetSettings(int)));
|
SLOT(SetSettings(int)));
|
||||||
|
// Gain mode
|
||||||
|
if (comboGainMode->isEnabled())
|
||||||
|
connect(comboGainMode, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetGainMode(int)));
|
||||||
|
|
||||||
// Dynamic Range
|
// Dynamic Range
|
||||||
if (comboDynamicRange->isEnabled())
|
if (comboDynamicRange->isEnabled())
|
||||||
@ -202,7 +206,7 @@ void qTabSettings::GetSettings() {
|
|||||||
comboSettings->setCurrentIndex(UNINITIALIZED);
|
comboSettings->setCurrentIndex(UNINITIALIZED);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if ((int)retval < -1 || (int)retval >= NUMSETTINGS) {
|
if ((int)retval < -1 || (int)retval >= comboSettings->count()) {
|
||||||
throw sls::RuntimeError(std::string("Unknown settings: ") +
|
throw sls::RuntimeError(std::string("Unknown settings: ") +
|
||||||
std::to_string(retval));
|
std::to_string(retval));
|
||||||
}
|
}
|
||||||
@ -230,6 +234,60 @@ void qTabSettings::SetSettings(int index) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qTabSettings::GetGainMode() {
|
||||||
|
LOG(logDEBUG) << "Getting gain mode";
|
||||||
|
disconnect(comboGainMode, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetGainMode(int)));
|
||||||
|
try {
|
||||||
|
auto retval = det->getGainMode().tsquash(
|
||||||
|
"Inconsistent gain mode for all detectors.");
|
||||||
|
if ((int)retval < 0 || (int)retval >= comboGainMode->count()) {
|
||||||
|
throw sls::RuntimeError(std::string("Unknown gain mode: ") +
|
||||||
|
std::to_string(retval));
|
||||||
|
}
|
||||||
|
// warning when using fix_g0 and not in export mode
|
||||||
|
if ((int)retval == FIX_G0 && !isVisibleFixG0) {
|
||||||
|
std::string message =
|
||||||
|
"<nobr>You are not in Expert Mode and Gain Mode is in FIX_G0. "
|
||||||
|
"</nobr><br><nobr>Could damage the detector when used without "
|
||||||
|
"caution! </nobr>";
|
||||||
|
qDefs::Message(qDefs::WARNING, message,
|
||||||
|
"qTabSettings::GetGainMode");
|
||||||
|
LOG(logWARNING) << message;
|
||||||
|
}
|
||||||
|
comboGainMode->setCurrentIndex((int)retval);
|
||||||
|
}
|
||||||
|
CATCH_DISPLAY("Could not get gain mode.", "qTabSettings::GetGainMode")
|
||||||
|
connect(comboGainMode, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetGainMode(int)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void qTabSettings::SetGainMode(int index) {
|
||||||
|
// warning for fix_G0 even in export mode
|
||||||
|
if (index == FIX_G0) {
|
||||||
|
if (qDefs::Message(
|
||||||
|
qDefs::QUESTION,
|
||||||
|
"<nobr>You are in Export mode, "
|
||||||
|
"</nobr><br><nobr>but setting Gain Mode to FIX_G0 could "
|
||||||
|
"damage the detector! </nobr><br><nobr>Proceed and set "
|
||||||
|
"gainmode to FIX_G0 anyway?</nobr>",
|
||||||
|
"qTabSettings::SetGainMode") == slsDetectorDefs::FAIL) {
|
||||||
|
GetGainMode();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG(logINFO) << "Setting Gain Mode to "
|
||||||
|
<< comboGainMode->currentText().toAscii().data();
|
||||||
|
auto val = static_cast<slsDetectorDefs::gainMode>(index);
|
||||||
|
try {
|
||||||
|
|
||||||
|
det->setGainMode(val);
|
||||||
|
}
|
||||||
|
CATCH_HANDLE("Could not set gain mode.", "qTabSettings::SetGainMode", this,
|
||||||
|
&qTabSettings::GetGainMode)
|
||||||
|
}
|
||||||
|
|
||||||
void qTabSettings::GetDynamicRange() {
|
void qTabSettings::GetDynamicRange() {
|
||||||
LOG(logDEBUG) << "Getting dynamic range";
|
LOG(logDEBUG) << "Getting dynamic range";
|
||||||
disconnect(comboDynamicRange, SIGNAL(activated(int)), this,
|
disconnect(comboDynamicRange, SIGNAL(activated(int)), this,
|
||||||
@ -402,6 +460,10 @@ void qTabSettings::Refresh() {
|
|||||||
GetSettings();
|
GetSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (comboGainMode->isEnabled()) {
|
||||||
|
GetGainMode();
|
||||||
|
}
|
||||||
|
|
||||||
if (comboDynamicRange->isEnabled()) {
|
if (comboDynamicRange->isEnabled()) {
|
||||||
GetDynamicRange();
|
GetDynamicRange();
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -93,6 +93,7 @@ int eiger_virtual_interrupt_subframe = 0;
|
|||||||
int eiger_virtual_left_datastream = 1;
|
int eiger_virtual_left_datastream = 1;
|
||||||
int eiger_virtual_right_datastream = 1;
|
int eiger_virtual_right_datastream = 1;
|
||||||
#endif
|
#endif
|
||||||
|
int defaultDacValues[NDAC] = DEFAULT_DAC_VALS;
|
||||||
|
|
||||||
int isInitCheckDone() { return initCheckDone; }
|
int isInitCheckDone() { return initCheckDone; }
|
||||||
|
|
||||||
@ -434,8 +435,9 @@ int readConfigFile() {
|
|||||||
master = -1;
|
master = -1;
|
||||||
top = -1;
|
top = -1;
|
||||||
|
|
||||||
char fname[128];
|
const int fileNameSize = 128;
|
||||||
if (getAbsPath(fname, 128, CONFIG_FILE) == FAIL) {
|
char fname[fileNameSize];
|
||||||
|
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -684,7 +686,7 @@ void allocateDetectorStructureMemory() {
|
|||||||
void setupDetector() {
|
void setupDetector() {
|
||||||
|
|
||||||
allocateDetectorStructureMemory();
|
allocateDetectorStructureMemory();
|
||||||
setDefaultDacs();
|
resetToDefaultDacs(0);
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
sharedMemory_setStatus(IDLE);
|
sharedMemory_setStatus(IDLE);
|
||||||
#endif
|
#endif
|
||||||
@ -746,21 +748,53 @@ void setupDetector() {
|
|||||||
LOG(logDEBUG1, ("Setup detector done\n\n"));
|
LOG(logDEBUG1, ("Setup detector done\n\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
int setDefaultDacs() {
|
int resetToDefaultDacs(int hardReset) {
|
||||||
|
// reset defaults to hardcoded defaults
|
||||||
|
if (hardReset) {
|
||||||
|
const int vals[] = DEFAULT_DAC_VALS;
|
||||||
|
for (int i = 0; i < NDAC; ++i) {
|
||||||
|
defaultDacValues[i] = vals[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// reset dacs to defaults
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
|
||||||
for (int i = 0; i < NDAC; ++i) {
|
for (int i = 0; i < NDAC; ++i) {
|
||||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
setDAC((enum DACINDEX)i, defaultDacValues[i], 0);
|
||||||
if ((detectorModules)->dacs[i] != defaultvals[i]) {
|
if ((detectorModules)->dacs[i] != defaultDacValues[i]) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
||||||
defaultvals[i], (detectorModules)->dacs[i]));
|
defaultDacValues[i], (detectorModules)->dacs[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getDefaultDac(enum DACINDEX index, enum detectorSettings sett,
|
||||||
|
int *retval) {
|
||||||
|
if (sett != UNDEFINED) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
if (index < 0 || index >= NDAC)
|
||||||
|
return FAIL;
|
||||||
|
*retval = defaultDacValues[index];
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int setDefaultDac(enum DACINDEX index, enum detectorSettings sett, int value) {
|
||||||
|
if (sett != UNDEFINED) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
if (index < 0 || index >= NDAC)
|
||||||
|
return FAIL;
|
||||||
|
|
||||||
|
char *dac_names[] = {DAC_NAMES};
|
||||||
|
LOG(logINFO, ("Setting Default Dac [%d - %s]: %d\n", (int)index,
|
||||||
|
dac_names[index], value));
|
||||||
|
defaultDacValues[index] = value;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* advanced read/write reg */
|
/* advanced read/write reg */
|
||||||
int writeRegister(uint32_t offset, uint32_t data) {
|
int writeRegister(uint32_t offset, uint32_t data) {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
|
Binary file not shown.
@ -49,6 +49,7 @@ int highvoltage = 0;
|
|||||||
int dacValues[NDAC] = {};
|
int dacValues[NDAC] = {};
|
||||||
int onChipdacValues[ONCHIP_NDAC][NCHIP] = {};
|
int onChipdacValues[ONCHIP_NDAC][NCHIP] = {};
|
||||||
int defaultDacValues[NDAC] = {};
|
int defaultDacValues[NDAC] = {};
|
||||||
|
int hardCodedDefaultDacValues[NDAC] = {};
|
||||||
int defaultOnChipdacValues[ONCHIP_NDAC][NCHIP] = {};
|
int defaultOnChipdacValues[ONCHIP_NDAC][NCHIP] = {};
|
||||||
int injectedChannelsOffset = 0;
|
int injectedChannelsOffset = 0;
|
||||||
int injectedChannelsIncrement = 0;
|
int injectedChannelsIncrement = 0;
|
||||||
@ -62,7 +63,7 @@ int64_t numTriggersReg = 1;
|
|||||||
int64_t delayReg = 0;
|
int64_t delayReg = 0;
|
||||||
int64_t numBurstsReg = 1;
|
int64_t numBurstsReg = 1;
|
||||||
int64_t burstPeriodReg = 0;
|
int64_t burstPeriodReg = 0;
|
||||||
int filter = 0;
|
int filterResistor = 0;
|
||||||
int cdsGain = 0;
|
int cdsGain = 0;
|
||||||
int detPos[2] = {};
|
int detPos[2] = {};
|
||||||
|
|
||||||
@ -387,12 +388,13 @@ void setupDetector() {
|
|||||||
delayReg = 0;
|
delayReg = 0;
|
||||||
numBurstsReg = 1;
|
numBurstsReg = 1;
|
||||||
burstPeriodReg = 0;
|
burstPeriodReg = 0;
|
||||||
filter = 0;
|
filterResistor = 0;
|
||||||
cdsGain = 0;
|
cdsGain = 0;
|
||||||
memset(clkPhase, 0, sizeof(clkPhase));
|
memset(clkPhase, 0, sizeof(clkPhase));
|
||||||
memset(dacValues, 0, sizeof(dacValues));
|
memset(dacValues, 0, sizeof(dacValues));
|
||||||
for (int i = 0; i < NDAC; ++i) {
|
for (int i = 0; i < NDAC; ++i) {
|
||||||
defaultDacValues[i] = -1;
|
defaultDacValues[i] = -1;
|
||||||
|
hardCodedDefaultDacValues[i] = -1;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < ONCHIP_NDAC; ++i) {
|
for (int i = 0; i < ONCHIP_NDAC; ++i) {
|
||||||
for (int j = 0; j < NCHIP; ++j) {
|
for (int j = 0; j < NCHIP; ++j) {
|
||||||
@ -465,7 +467,7 @@ void setupDetector() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setBurstMode(DEFAULT_BURST_MODE);
|
setBurstMode(DEFAULT_BURST_MODE);
|
||||||
setFilter(DEFAULT_FILTER);
|
setFilterResistor(DEFAULT_FILTER_RESISTOR);
|
||||||
setCDSGain(DEFAILT_CDS_GAIN);
|
setCDSGain(DEFAILT_CDS_GAIN);
|
||||||
setSettings(DEFAULT_SETTINGS);
|
setSettings(DEFAULT_SETTINGS);
|
||||||
|
|
||||||
@ -481,7 +483,14 @@ void setupDetector() {
|
|||||||
setCurrentSource(DEFAULT_CURRENT_SOURCE);
|
setCurrentSource(DEFAULT_CURRENT_SOURCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int setDefaultDacs() {
|
int resetToDefaultDacs(int hardReset) {
|
||||||
|
// reset defaults to hardcoded defaults
|
||||||
|
if (hardReset) {
|
||||||
|
for (int i = 0; i < NDAC; ++i) {
|
||||||
|
defaultDacValues[i] = hardCodedDefaultDacValues[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// reset dacs to defaults
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||||
for (int i = 0; i < NDAC; ++i) {
|
for (int i = 0; i < NDAC; ++i) {
|
||||||
@ -515,6 +524,31 @@ int setDefaultDacs() {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getDefaultDac(enum DACINDEX index, enum detectorSettings sett,
|
||||||
|
int *retval) {
|
||||||
|
if (sett != UNDEFINED) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
if (index < 0 || index >= NDAC)
|
||||||
|
return FAIL;
|
||||||
|
*retval = defaultDacValues[index];
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int setDefaultDac(enum DACINDEX index, enum detectorSettings sett, int value) {
|
||||||
|
if (sett != UNDEFINED) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
if (index < 0 || index >= NDAC)
|
||||||
|
return FAIL;
|
||||||
|
|
||||||
|
char *dac_names[] = {DAC_NAMES};
|
||||||
|
LOG(logINFO, ("Setting Default Dac [%d - %s]: %d\n", (int)index,
|
||||||
|
dac_names[index], value));
|
||||||
|
defaultDacValues[index] = value;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
int readConfigFile() {
|
int readConfigFile() {
|
||||||
|
|
||||||
if (initError == FAIL) {
|
if (initError == FAIL) {
|
||||||
@ -530,8 +564,9 @@ int readConfigFile() {
|
|||||||
|
|
||||||
usleep(INITIAL_STARTUP_WAIT);
|
usleep(INITIAL_STARTUP_WAIT);
|
||||||
|
|
||||||
char fname[128];
|
const int fileNameSize = 128;
|
||||||
if (getAbsPath(fname, 128, CONFIG_FILE) == FAIL) {
|
char fname[fileNameSize];
|
||||||
|
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -805,6 +840,7 @@ int readConfigFile() {
|
|||||||
|
|
||||||
// set default dac variables
|
// set default dac variables
|
||||||
defaultDacValues[idac] = value;
|
defaultDacValues[idac] = value;
|
||||||
|
hardCodedDefaultDacValues[idac] = value;
|
||||||
|
|
||||||
// set dac
|
// set dac
|
||||||
setDAC(idac, value, 0);
|
setDAC(idac, value, 0);
|
||||||
@ -2422,7 +2458,7 @@ int setBurstMode(enum burstMode burst) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int configureASICGlobalSettings() {
|
int configureASICGlobalSettings() {
|
||||||
int value = ((filter << ASIC_FILTER_OFST) & ASIC_FILTER_MSK) |
|
int value = ((filterResistor << ASIC_FILTER_OFST) & ASIC_FILTER_MSK) |
|
||||||
((cdsGain << ASIC_CDS_GAIN_OFST) & ASIC_CDS_GAIN_MSK);
|
((cdsGain << ASIC_CDS_GAIN_OFST) & ASIC_CDS_GAIN_MSK);
|
||||||
switch (burstMode) {
|
switch (burstMode) {
|
||||||
case BURST_INTERNAL:
|
case BURST_INTERNAL:
|
||||||
@ -2437,9 +2473,9 @@ int configureASICGlobalSettings() {
|
|||||||
value |= (ASIC_CONT_MODE_MSK | ASIC_EXT_TIMING_MSK);
|
value |= (ASIC_CONT_MODE_MSK | ASIC_EXT_TIMING_MSK);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tSending Global Chip settings:0x%x (filter:%d, "
|
LOG(logINFO, ("\tSending Global Chip settings:0x%x (filterResistor:%d, "
|
||||||
"cdsgain:%d)\n",
|
"cdsgain:%d)\n",
|
||||||
value, filter, cdsGain));
|
value, filterResistor, cdsGain));
|
||||||
|
|
||||||
const int padding = 6; // due to address (4) to make it byte aligned
|
const int padding = 6; // due to address (4) to make it byte aligned
|
||||||
const int lenTotalBits = padding + ASIC_GLOBAL_SETT_MAX_BITS +
|
const int lenTotalBits = padding + ASIC_GLOBAL_SETT_MAX_BITS +
|
||||||
@ -2515,17 +2551,17 @@ int setCDSGain(int enable) {
|
|||||||
|
|
||||||
int getCDSGain() { return cdsGain; }
|
int getCDSGain() { return cdsGain; }
|
||||||
|
|
||||||
int setFilter(int value) {
|
int setFilterResistor(int value) {
|
||||||
if (value < 0 || value > ASIC_FILTER_MAX_VALUE) {
|
if (value < 0 || value > ASIC_FILTER_MAX_RES_VALUE) {
|
||||||
LOG(logERROR, ("Invalid filter value %d\n", value));
|
LOG(logERROR, ("Invalid filter resistor value %d\n", value));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
filter = value;
|
filterResistor = value;
|
||||||
LOG(logINFO, ("Setting Filter to %d\n", filter));
|
LOG(logINFO, ("Setting Filter Resistor to %d\n", filterResistor));
|
||||||
return configureASICGlobalSettings();
|
return configureASICGlobalSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
int getFilter() { return filter; }
|
int getFilterResistor() { return filterResistor; }
|
||||||
|
|
||||||
void setCurrentSource(int value) {
|
void setCurrentSource(int value) {
|
||||||
uint32_t addr = ASIC_CONFIG_REG;
|
uint32_t addr = ASIC_CONFIG_REG;
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
/** Default Parameters */
|
/** Default Parameters */
|
||||||
#define DEFAULT_BURST_MODE (BURST_INTERNAL)
|
#define DEFAULT_BURST_MODE (BURST_INTERNAL)
|
||||||
#define DEFAULT_FILTER (0)
|
#define DEFAULT_FILTER_RESISTOR (0)
|
||||||
#define DEFAILT_CDS_GAIN (0)
|
#define DEFAILT_CDS_GAIN (0)
|
||||||
#define DEFAULT_NUM_FRAMES (1)
|
#define DEFAULT_NUM_FRAMES (1)
|
||||||
#define DEFAULT_NUM_CYCLES (1)
|
#define DEFAULT_NUM_CYCLES (1)
|
||||||
@ -149,7 +149,7 @@ enum PLLINDEX { READOUT_PLL, SYSTEM_PLL };
|
|||||||
#define ASIC_CONT_MODE_MSK (0x1 << ASIC_CONT_MODE_OFST)
|
#define ASIC_CONT_MODE_MSK (0x1 << ASIC_CONT_MODE_OFST)
|
||||||
#define ASIC_FILTER_OFST (3)
|
#define ASIC_FILTER_OFST (3)
|
||||||
#define ASIC_FILTER_MSK (0x3 << ASIC_FILTER_OFST)
|
#define ASIC_FILTER_MSK (0x3 << ASIC_FILTER_OFST)
|
||||||
#define ASIC_FILTER_MAX_VALUE (3)
|
#define ASIC_FILTER_MAX_RES_VALUE (3)
|
||||||
#define ASIC_CDS_GAIN_OFST (5)
|
#define ASIC_CDS_GAIN_OFST (5)
|
||||||
#define ASIC_CDS_GAIN_MSK (0x1 << ASIC_CDS_GAIN_OFST)
|
#define ASIC_CDS_GAIN_MSK (0x1 << ASIC_CDS_GAIN_OFST)
|
||||||
|
|
||||||
|
Binary file not shown.
@ -45,6 +45,7 @@ int detPos[2] = {};
|
|||||||
|
|
||||||
int detectorFirstServer = 1;
|
int detectorFirstServer = 1;
|
||||||
int dacValues[NDAC] = {};
|
int dacValues[NDAC] = {};
|
||||||
|
int defaultDacValues[NDAC] = DEFAULT_DAC_VALS;
|
||||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||||
enum externalSignalFlag signalMode = 0;
|
enum externalSignalFlag signalMode = 0;
|
||||||
|
|
||||||
@ -405,7 +406,7 @@ void setupDetector() {
|
|||||||
DAC_MAX_MV);
|
DAC_MAX_MV);
|
||||||
LTC2620_Disable();
|
LTC2620_Disable();
|
||||||
LTC2620_Configure();
|
LTC2620_Configure();
|
||||||
setDefaultDacs();
|
resetToDefaultDacs(0);
|
||||||
|
|
||||||
// temp
|
// temp
|
||||||
bus_w(TEMP_SPI_IN_REG, TEMP_SPI_IN_IDLE_MSK);
|
bus_w(TEMP_SPI_IN_REG, TEMP_SPI_IN_IDLE_MSK);
|
||||||
@ -433,21 +434,53 @@ void setupDetector() {
|
|||||||
setDelayAfterTrigger(DEFAULT_DELAY);
|
setDelayAfterTrigger(DEFAULT_DELAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
int setDefaultDacs() {
|
int resetToDefaultDacs(int hardReset) {
|
||||||
|
// reset defaults to hardcoded defaults
|
||||||
|
if (hardReset) {
|
||||||
|
const int vals[] = DEFAULT_DAC_VALS;
|
||||||
|
for (int i = 0; i < NDAC; ++i) {
|
||||||
|
defaultDacValues[i] = vals[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// reset dacs to defaults
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
|
||||||
for (int i = 0; i < NDAC; ++i) {
|
for (int i = 0; i < NDAC; ++i) {
|
||||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
setDAC((enum DACINDEX)i, defaultDacValues[i], 0);
|
||||||
if (dacValues[i] != defaultvals[i]) {
|
if (dacValues[i] != defaultDacValues[i]) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
||||||
defaultvals[i], dacValues[i]));
|
defaultDacValues[i], dacValues[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getDefaultDac(enum DACINDEX index, enum detectorSettings sett,
|
||||||
|
int *retval) {
|
||||||
|
if (sett != UNDEFINED) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
if (index < 0 || index >= NDAC)
|
||||||
|
return FAIL;
|
||||||
|
*retval = defaultDacValues[index];
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int setDefaultDac(enum DACINDEX index, enum detectorSettings sett, int value) {
|
||||||
|
if (sett != UNDEFINED) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
if (index < 0 || index >= NDAC)
|
||||||
|
return FAIL;
|
||||||
|
|
||||||
|
char *dac_names[] = {DAC_NAMES};
|
||||||
|
LOG(logINFO, ("Setting Default Dac [%d - %s]: %d\n", (int)index,
|
||||||
|
dac_names[index], value));
|
||||||
|
defaultDacValues[index] = value;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t writeRegister16And32(uint32_t offset, uint32_t data) {
|
uint32_t writeRegister16And32(uint32_t offset, uint32_t data) {
|
||||||
if (((offset << MEM_MAP_SHIFT) == CONTROL_REG) ||
|
if (((offset << MEM_MAP_SHIFT) == CONTROL_REG) ||
|
||||||
((offset << MEM_MAP_SHIFT) == FIFO_DATA_REG)) {
|
((offset << MEM_MAP_SHIFT) == FIFO_DATA_REG)) {
|
||||||
@ -588,8 +621,9 @@ void setGbitReadout() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int readConfigFile() {
|
int readConfigFile() {
|
||||||
char fname[128];
|
const int fileNameSize = 128;
|
||||||
if (getAbsPath(fname, 128, CONFIG_FILE) == FAIL) {
|
char fname[fileNameSize];
|
||||||
|
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,3 +37,5 @@ install(TARGETS jungfrauDetectorServer_virtual
|
|||||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
configure_file(config_jungfrau.txt ${CMAKE_BINARY_DIR}/bin/config_jungfrau.txt COPYONLY)
|
||||||
|
@ -32,6 +32,7 @@ $(PROGS): $(OBJS)
|
|||||||
mkdir -p $(DESTDIR)
|
mkdir -p $(DESTDIR)
|
||||||
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
|
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
|
||||||
mv $(PROGS) $(DESTDIR)
|
mv $(PROGS) $(DESTDIR)
|
||||||
|
cp config_jungfrau.txt $(DESTDIR)
|
||||||
rm *.gdb
|
rm *.gdb
|
||||||
rm $(main_src)*.o
|
rm $(main_src)*.o
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
/* Definitions for FPGA*/
|
/* Definitions for FPGA*/
|
||||||
#define MEM_MAP_SHIFT 1
|
#define MEM_MAP_SHIFT 1
|
||||||
@ -33,24 +34,19 @@
|
|||||||
#define RUNMACHINE_BUSY_MSK (0x00000001 << RUNMACHINE_BUSY_OFST)
|
#define RUNMACHINE_BUSY_MSK (0x00000001 << RUNMACHINE_BUSY_OFST)
|
||||||
|
|
||||||
/* Look at me register */
|
/* Look at me register */
|
||||||
#define LOOK_AT_ME_REG \
|
#define LOOK_AT_ME_REG (0x03 << MEM_MAP_SHIFT) // Not used in firmware or software
|
||||||
(0x03 << MEM_MAP_SHIFT) // Not used in firmware or software
|
|
||||||
|
|
||||||
/* System Status register */
|
/* System Status register */
|
||||||
#define SYSTEM_STATUS_REG (0x04 << MEM_MAP_SHIFT) // Not used in software
|
#define SYSTEM_STATUS_REG (0x04 << MEM_MAP_SHIFT) // Not used in software
|
||||||
|
|
||||||
#define DDR3_CAL_DONE_OFST (0) // Not used in software
|
#define DDR3_CAL_DONE_OFST (0) // Not used in software
|
||||||
#define DDR3_CAL_DONE_MSK \
|
#define DDR3_CAL_DONE_MSK (0x00000001 << DDR3_CAL_DONE_OFST) // Not used in software
|
||||||
(0x00000001 << DDR3_CAL_DONE_OFST) // Not used in software
|
|
||||||
#define DDR3_CAL_FAIL_OFST (1) // Not used in software
|
#define DDR3_CAL_FAIL_OFST (1) // Not used in software
|
||||||
#define DDR3_CAL_FAIL_MSK \
|
#define DDR3_CAL_FAIL_MSK (0x00000001 << DDR3_CAL_FAIL_OFST) // Not used in software
|
||||||
(0x00000001 << DDR3_CAL_FAIL_OFST) // Not used in software
|
|
||||||
#define DDR3_INIT_DONE_OFST (2) // Not used in software
|
#define DDR3_INIT_DONE_OFST (2) // Not used in software
|
||||||
#define DDR3_INIT_DONE_MSK \
|
#define DDR3_INIT_DONE_MSK (0x00000001 << DDR3_INIT_DONE_OFST) // Not used in software
|
||||||
(0x00000001 << DDR3_INIT_DONE_OFST) // Not used in software
|
|
||||||
#define RECONFIG_PLL_LCK_OFST (3) // Not used in software
|
#define RECONFIG_PLL_LCK_OFST (3) // Not used in software
|
||||||
#define RECONFIG_PLL_LCK_MSK \
|
#define RECONFIG_PLL_LCK_MSK (0x00000001 << RECONFIG_PLL_LCK_OFST) // Not used in software
|
||||||
(0x00000001 << RECONFIG_PLL_LCK_OFST) // Not used in software
|
|
||||||
#define PLL_A_LCK_OFST (4) // Not used in software
|
#define PLL_A_LCK_OFST (4) // Not used in software
|
||||||
#define PLL_A_LCK_MSK (0x00000001 << PLL_A_LCK_OFST) // Not used in software
|
#define PLL_A_LCK_MSK (0x00000001 << PLL_A_LCK_OFST) // Not used in software
|
||||||
#define DD3_PLL_LCK_OFST (5) // Not used in software
|
#define DD3_PLL_LCK_OFST (5) // Not used in software
|
||||||
@ -63,8 +59,7 @@
|
|||||||
#define HARDWARE_SERIAL_NUM_MSK (0x000000FF << HARDWARE_SERIAL_NUM_OFST)
|
#define HARDWARE_SERIAL_NUM_MSK (0x000000FF << HARDWARE_SERIAL_NUM_OFST)
|
||||||
#define HARDWARE_VERSION_NUM_OFST (16)
|
#define HARDWARE_VERSION_NUM_OFST (16)
|
||||||
#define HARDWARE_VERSION_NUM_MSK (0x0000003F << HARDWARE_VERSION_NUM_OFST)
|
#define HARDWARE_VERSION_NUM_MSK (0x0000003F << HARDWARE_VERSION_NUM_OFST)
|
||||||
#define HARDWARE_VERSION_2_VAL \
|
#define HARDWARE_VERSION_2_VAL ((0x2 << HARDWARE_VERSION_NUM_OFST) & HARDWARE_VERSION_NUM_MSK)
|
||||||
((0x2 << HARDWARE_VERSION_NUM_OFST) & HARDWARE_VERSION_NUM_MSK)
|
|
||||||
|
|
||||||
/* API Version Register */
|
/* API Version Register */
|
||||||
#define API_VERSION_REG (0x0F << MEM_MAP_SHIFT)
|
#define API_VERSION_REG (0x0F << MEM_MAP_SHIFT)
|
||||||
@ -72,8 +67,7 @@
|
|||||||
#define API_VERSION_OFST (0)
|
#define API_VERSION_OFST (0)
|
||||||
#define API_VERSION_MSK (0x00FFFFFF << API_VERSION_OFST)
|
#define API_VERSION_MSK (0x00FFFFFF << API_VERSION_OFST)
|
||||||
#define API_VERSION_DETECTOR_TYPE_OFST (24) // Not used in software
|
#define API_VERSION_DETECTOR_TYPE_OFST (24) // Not used in software
|
||||||
#define API_VERSION_DETECTOR_TYPE_MSK \
|
#define API_VERSION_DETECTOR_TYPE_MSK (0x000000FF << API_VERSION_DETECTOR_TYPE_OFST) // Not used in software
|
||||||
(0x000000FF << API_VERSION_DETECTOR_TYPE_OFST) // Not used in software
|
|
||||||
|
|
||||||
/* Time from Start 64 bit register */
|
/* Time from Start 64 bit register */
|
||||||
#define TIME_FROM_START_LSB_REG (0x10 << MEM_MAP_SHIFT)
|
#define TIME_FROM_START_LSB_REG (0x10 << MEM_MAP_SHIFT)
|
||||||
@ -96,8 +90,7 @@
|
|||||||
#define GET_PERIOD_MSB_REG (0x19 << MEM_MAP_SHIFT)
|
#define GET_PERIOD_MSB_REG (0x19 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/** Get Temperature Carlos, incorrectl as get gates */
|
/** Get Temperature Carlos, incorrectl as get gates */
|
||||||
#define GET_TEMPERATURE_TMP112_REG \
|
#define GET_TEMPERATURE_TMP112_REG (0x1c << MEM_MAP_SHIFT) // (after multiplying by 625) in 10ths of
|
||||||
(0x1c << MEM_MAP_SHIFT) // (after multiplying by 625) in 10ths of
|
|
||||||
// millidegrees of TMP112
|
// millidegrees of TMP112
|
||||||
|
|
||||||
#define TEMPERATURE_VALUE_BIT (0)
|
#define TEMPERATURE_VALUE_BIT (0)
|
||||||
@ -105,6 +98,21 @@
|
|||||||
#define TEMPERATURE_POLARITY_BIT (11)
|
#define TEMPERATURE_POLARITY_BIT (11)
|
||||||
#define TEMPERATURE_POLARITY_MSK (0x00000001 << TEMPERATURE_POLARITY_BIT)
|
#define TEMPERATURE_POLARITY_MSK (0x00000001 << TEMPERATURE_POLARITY_BIT)
|
||||||
|
|
||||||
|
/* Config Status Register for chip 1.1 */
|
||||||
|
#define CONFIG_V11_STATUS_REG (0x1D << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
|
#define CONFIG_V11_STATUS_FLTR_CLL_OFST (0)
|
||||||
|
#define CONFIG_V11_STATUS_FLTR_CLL_MSK (0x00000FFF << CONFIG_V11_STATUS_FLTR_CLL_OFST)
|
||||||
|
#define CONFIG_V11_STATUS_STRG_CLL_OFST (12)
|
||||||
|
#define CONFIG_V11_STATUS_STRG_CLL_MSK (0x0000000F << CONFIG_V11_STATUS_STRG_CLL_OFST)
|
||||||
|
// CSM mode = high current (100%), low current (16%)
|
||||||
|
#define CONFIG_V11_STATUS_CRRNT_SRC_LOW_OFST (19)
|
||||||
|
#define CONFIG_V11_STATUS_CRRNT_SRC_LOW_MSK (0x00000001 << CONFIG_V11_STATUS_CRRNT_SRC_LOW_OFST)
|
||||||
|
#define CONFIG_V11_STATUS_FLTR_RSSTR_SMLR_OFST (21)
|
||||||
|
#define CONFIG_V11_STATUS_FLTR_RSSTR_SMLR_MSK (0x00000001 << CONFIG_V11_STATUS_FLTR_RSSTR_SMLR_OFST)
|
||||||
|
#define CONFIG_V11_STATUS_AUTO_MODE_OVRRD_OFST (23)
|
||||||
|
#define CONFIG_V11_STATUS_AUTO_MODE_OVRRD_MSK (0x00000001 << CONFIG_V11_STATUS_AUTO_MODE_OVRRD_OFST)
|
||||||
|
|
||||||
/* Get Frames from Start 64 bit register (frames from last reset using
|
/* Get Frames from Start 64 bit register (frames from last reset using
|
||||||
* CONTROL_CRST) */
|
* CONTROL_CRST) */
|
||||||
#define FRAMES_FROM_START_LSB_REG (0x22 << MEM_MAP_SHIFT)
|
#define FRAMES_FROM_START_LSB_REG (0x22 << MEM_MAP_SHIFT)
|
||||||
@ -166,25 +174,23 @@
|
|||||||
// (RDT + 1) * 25ns
|
// (RDT + 1) * 25ns
|
||||||
#define CONFIG_RDT_TMR_OFST (0)
|
#define CONFIG_RDT_TMR_OFST (0)
|
||||||
#define CONFIG_RDT_TMR_MSK (0x0000FFFF << CONFIG_RDT_TMR_OFST)
|
#define CONFIG_RDT_TMR_MSK (0x0000FFFF << CONFIG_RDT_TMR_OFST)
|
||||||
#define CONFIG_OPRTN_MDE_2_X_10GbE_OFST (16)
|
|
||||||
#define CONFIG_OPRTN_MDE_2_X_10GbE_MSK \
|
|
||||||
(0x00000001 << CONFIG_OPRTN_MDE_2_X_10GbE_OFST)
|
|
||||||
// if 0, outer is the primary interface
|
// if 0, outer is the primary interface
|
||||||
|
// bottom via port 0 (outer)
|
||||||
|
#define CONFIG_OPRTN_MDE_2_X_10GbE_OFST (16)
|
||||||
|
#define CONFIG_OPRTN_MDE_2_X_10GbE_MSK (0x00000001 << CONFIG_OPRTN_MDE_2_X_10GbE_OFST)
|
||||||
#define CONFIG_INNR_PRIMRY_INTRFCE_OFST (17)
|
#define CONFIG_INNR_PRIMRY_INTRFCE_OFST (17)
|
||||||
#define CONFIG_INNR_PRIMRY_INTRFCE_MSK \
|
#define CONFIG_INNR_PRIMRY_INTRFCE_MSK (0x00000001 << CONFIG_INNR_PRIMRY_INTRFCE_OFST)
|
||||||
(0x00000001 << CONFIG_INNR_PRIMRY_INTRFCE_OFST)
|
|
||||||
#define CONFIG_READOUT_SPEED_OFST (20)
|
#define CONFIG_READOUT_SPEED_OFST (20)
|
||||||
#define CONFIG_READOUT_SPEED_MSK (0x00000003 << CONFIG_READOUT_SPEED_OFST)
|
#define CONFIG_READOUT_SPEED_MSK (0x00000003 << CONFIG_READOUT_SPEED_OFST)
|
||||||
#define CONFIG_QUARTER_SPEED_10MHZ_VAL \
|
#define CONFIG_QUARTER_SPEED_10MHZ_VAL ((0x0 << CONFIG_READOUT_SPEED_OFST) & CONFIG_READOUT_SPEED_MSK)
|
||||||
((0x0 << CONFIG_READOUT_SPEED_OFST) & CONFIG_READOUT_SPEED_MSK)
|
#define CONFIG_HALF_SPEED_20MHZ_VAL ((0x1 << CONFIG_READOUT_SPEED_OFST) & CONFIG_READOUT_SPEED_MSK)
|
||||||
#define CONFIG_HALF_SPEED_20MHZ_VAL \
|
#define CONFIG_FULL_SPEED_40MHZ_VAL ((0x2 << CONFIG_READOUT_SPEED_OFST) & CONFIG_READOUT_SPEED_MSK)
|
||||||
((0x1 << CONFIG_READOUT_SPEED_OFST) & CONFIG_READOUT_SPEED_MSK)
|
|
||||||
#define CONFIG_FULL_SPEED_40MHZ_VAL \
|
|
||||||
((0x2 << CONFIG_READOUT_SPEED_OFST) & CONFIG_READOUT_SPEED_MSK)
|
|
||||||
#define CONFIG_TDMA_ENABLE_OFST (24)
|
#define CONFIG_TDMA_ENABLE_OFST (24)
|
||||||
#define CONFIG_TDMA_ENABLE_MSK (0x00000001 << CONFIG_TDMA_ENABLE_OFST)
|
#define CONFIG_TDMA_ENABLE_MSK (0x00000001 << CONFIG_TDMA_ENABLE_OFST)
|
||||||
#define CONFIG_TDMA_TIMESLOT_OFST (25) // 1ms
|
#define CONFIG_TDMA_TIMESLOT_OFST (25) // 1ms
|
||||||
#define CONFIG_TDMA_TIMESLOT_MSK (0x0000001F << CONFIG_TDMA_TIMESLOT_OFST)
|
#define CONFIG_TDMA_TIMESLOT_MSK (0x0000001F << CONFIG_TDMA_TIMESLOT_OFST)
|
||||||
|
#define CONFIG_BOTTOM_INVERT_STREAM_OFST (30)
|
||||||
|
#define CONFIG_BOTTOM_INVERT_STREAM_MSK (0x00000001 << CONFIG_BOTTOM_INVERT_STREAM_OFST)
|
||||||
#define CONFIG_ETHRNT_FLW_CNTRL_OFST (31)
|
#define CONFIG_ETHRNT_FLW_CNTRL_OFST (31)
|
||||||
#define CONFIG_ETHRNT_FLW_CNTRL_MSK (0x00000001 << CONFIG_ETHRNT_FLW_CNTRL_OFST)
|
#define CONFIG_ETHRNT_FLW_CNTRL_MSK (0x00000001 << CONFIG_ETHRNT_FLW_CNTRL_OFST)
|
||||||
|
|
||||||
@ -204,21 +210,15 @@
|
|||||||
#define CONTROL_CORE_RST_OFST (10)
|
#define CONTROL_CORE_RST_OFST (10)
|
||||||
#define CONTROL_CORE_RST_MSK (0x00000001 << CONTROL_CORE_RST_OFST)
|
#define CONTROL_CORE_RST_MSK (0x00000001 << CONTROL_CORE_RST_OFST)
|
||||||
#define CONTROL_PERIPHERAL_RST_OFST (11) // DDR3 HMem Ctrlr, GBE, Temp
|
#define CONTROL_PERIPHERAL_RST_OFST (11) // DDR3 HMem Ctrlr, GBE, Temp
|
||||||
#define CONTROL_PERIPHERAL_RST_MSK \
|
#define CONTROL_PERIPHERAL_RST_MSK (0x00000001 << CONTROL_PERIPHERAL_RST_OFST) // DDR3 HMem Ctrlr, GBE, Temp
|
||||||
(0x00000001 << CONTROL_PERIPHERAL_RST_OFST) // DDR3 HMem Ctrlr, GBE, Temp
|
#define CONTROL_DDR3_MEM_RST_OFST (12) // only PHY, not DDR3 PLL ,Not used in software
|
||||||
#define CONTROL_DDR3_MEM_RST_OFST \
|
#define CONTROL_DDR3_MEM_RST_MSK (0x00000001 << CONTROL_DDR3_MEM_RST_OFST) // only PHY, not DDR3 PLL ,Not used in software
|
||||||
(12) // only PHY, not DDR3 PLL ,Not used in software
|
|
||||||
#define CONTROL_DDR3_MEM_RST_MSK \
|
|
||||||
(0x00000001 << CONTROL_DDR3_MEM_RST_OFST) // only PHY, not DDR3 PLL ,Not
|
|
||||||
// used in software
|
|
||||||
#define CONTROL_ACQ_FIFO_CLR_OFST (14)
|
#define CONTROL_ACQ_FIFO_CLR_OFST (14)
|
||||||
#define CONTROL_ACQ_FIFO_CLR_MSK (0x00000001 << CONTROL_ACQ_FIFO_CLR_OFST)
|
#define CONTROL_ACQ_FIFO_CLR_MSK (0x00000001 << CONTROL_ACQ_FIFO_CLR_OFST)
|
||||||
#define CONTROL_STORAGE_CELL_NUM_OFST (16)
|
#define CONTROL_STORAGE_CELL_NUM_OFST (16)
|
||||||
#define CONTROL_STORAGE_CELL_NUM_MSK \
|
#define CONTROL_STORAGE_CELL_NUM_MSK (0x0000000F << CONTROL_STORAGE_CELL_NUM_OFST)
|
||||||
(0x0000000F << CONTROL_STORAGE_CELL_NUM_OFST)
|
|
||||||
#define CONTROL_RX_ADDTNL_ENDPTS_NUM_OFST (20)
|
#define CONTROL_RX_ADDTNL_ENDPTS_NUM_OFST (20)
|
||||||
#define CONTROL_RX_ADDTNL_ENDPTS_NUM_MSK \
|
#define CONTROL_RX_ADDTNL_ENDPTS_NUM_MSK (0x0000003F << CONTROL_RX_ADDTNL_ENDPTS_NUM_OFST)
|
||||||
(0x0000003F << CONTROL_RX_ADDTNL_ENDPTS_NUM_OFST)
|
|
||||||
#define CONTROL_RX_ENDPTS_START_OFST (26)
|
#define CONTROL_RX_ENDPTS_START_OFST (26)
|
||||||
#define CONTROL_RX_ENDPTS_START_MSK (0x0000003F << CONTROL_RX_ENDPTS_START_OFST)
|
#define CONTROL_RX_ENDPTS_START_MSK (0x0000003F << CONTROL_RX_ENDPTS_START_OFST)
|
||||||
|
|
||||||
@ -229,8 +229,7 @@
|
|||||||
#define PLL_CNTRL_REG (0x51 << MEM_MAP_SHIFT)
|
#define PLL_CNTRL_REG (0x51 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
#define PLL_CNTRL_RCNFG_PRMTR_RST_OFST (0) // parameter reset
|
#define PLL_CNTRL_RCNFG_PRMTR_RST_OFST (0) // parameter reset
|
||||||
#define PLL_CNTRL_RCNFG_PRMTR_RST_MSK \
|
#define PLL_CNTRL_RCNFG_PRMTR_RST_MSK (0x00000001 << PLL_CNTRL_RCNFG_PRMTR_RST_OFST) // parameter reset
|
||||||
(0x00000001 << PLL_CNTRL_RCNFG_PRMTR_RST_OFST) // parameter reset
|
|
||||||
#define PLL_CNTRL_WR_PRMTR_OFST (2)
|
#define PLL_CNTRL_WR_PRMTR_OFST (2)
|
||||||
#define PLL_CNTRL_WR_PRMTR_MSK (0x00000001 << PLL_CNTRL_WR_PRMTR_OFST)
|
#define PLL_CNTRL_WR_PRMTR_MSK (0x00000001 << PLL_CNTRL_WR_PRMTR_OFST)
|
||||||
#define PLL_CNTRL_PLL_RST_OFST (3)
|
#define PLL_CNTRL_PLL_RST_OFST (3)
|
||||||
@ -240,91 +239,76 @@
|
|||||||
#define PLL_CNTRL_ADDR_OFST (16)
|
#define PLL_CNTRL_ADDR_OFST (16)
|
||||||
#define PLL_CNTRL_ADDR_MSK (0x0000003F << PLL_CNTRL_ADDR_OFST)
|
#define PLL_CNTRL_ADDR_MSK (0x0000003F << PLL_CNTRL_ADDR_OFST)
|
||||||
|
|
||||||
|
/* Config Register for chip 1.1 */
|
||||||
|
#define CONFIG_V11_REG (0x58 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
|
#define CONFIG_V11_FLTR_CLL_OFST (0)
|
||||||
|
#define CONFIG_V11_FLTR_CLL_MSK (0x00000FFF << CONFIG_V11_FLTR_CLL_OFST)
|
||||||
|
#define CONFIG_V11_STRG_CLL_OFST (12)
|
||||||
|
#define CONFIG_V11_STRG_CLL_MSK (0x0000000F << CONFIG_V11_STRG_CLL_OFST)
|
||||||
|
// CSM mode = high current (100%), low current (16%)
|
||||||
|
#define CONFIG_V11_CRRNT_SRC_LOW_OFST (19)
|
||||||
|
#define CONFIG_V11_CRRNT_SRC_LOW_MSK (0x00000001 << CONFIG_V11_CRRNT_SRC_LOW_OFST)
|
||||||
|
#define CONFIG_V11_FLTR_RSSTR_SMLR_OFST (21)
|
||||||
|
#define CONFIG_V11_FLTR_RSSTR_SMLR_MSK (0x00000001 << CONFIG_V11_FLTR_RSSTR_SMLR_OFST)
|
||||||
|
#define CONFIG_V11_AUTO_MODE_OVRRD_OFST (23)
|
||||||
|
#define CONFIG_V11_AUTO_MODE_OVRRD_MSK (0x00000001 << CONFIG_V11_AUTO_MODE_OVRRD_OFST)
|
||||||
|
|
||||||
/* Sample Register */
|
/* Sample Register */
|
||||||
#define SAMPLE_REG (0x59 << MEM_MAP_SHIFT)
|
#define SAMPLE_REG (0x59 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
#define SAMPLE_ADC_SAMPLE_SEL_OFST (0)
|
#define SAMPLE_ADC_SAMPLE_SEL_OFST (0)
|
||||||
#define SAMPLE_ADC_SAMPLE_SEL_MSK (0x00000007 << SAMPLE_ADC_SAMPLE_SEL_OFST)
|
#define SAMPLE_ADC_SAMPLE_SEL_MSK (0x00000007 << SAMPLE_ADC_SAMPLE_SEL_OFST)
|
||||||
#define SAMPLE_ADC_SAMPLE_0_VAL \
|
#define SAMPLE_ADC_SAMPLE_0_VAL ((0x0 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
|
||||||
((0x0 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
|
#define SAMPLE_ADC_SAMPLE_1_VAL ((0x1 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
|
||||||
#define SAMPLE_ADC_SAMPLE_1_VAL \
|
#define SAMPLE_ADC_SAMPLE_2_VAL ((0x2 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
|
||||||
((0x1 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
|
#define SAMPLE_ADC_SAMPLE_3_VAL ((0x3 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
|
||||||
#define SAMPLE_ADC_SAMPLE_2_VAL \
|
#define SAMPLE_ADC_SAMPLE_4_VAL ((0x4 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
|
||||||
((0x2 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
|
#define SAMPLE_ADC_SAMPLE_5_VAL ((0x5 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
|
||||||
#define SAMPLE_ADC_SAMPLE_3_VAL \
|
#define SAMPLE_ADC_SAMPLE_6_VAL ((0x6 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
|
||||||
((0x3 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
|
#define SAMPLE_ADC_SAMPLE_7_VAL ((0x7 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
|
||||||
#define SAMPLE_ADC_SAMPLE_4_VAL \
|
|
||||||
((0x4 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
|
|
||||||
#define SAMPLE_ADC_SAMPLE_5_VAL \
|
|
||||||
((0x5 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
|
|
||||||
#define SAMPLE_ADC_SAMPLE_6_VAL \
|
|
||||||
((0x6 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
|
|
||||||
#define SAMPLE_ADC_SAMPLE_7_VAL \
|
|
||||||
((0x7 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
|
|
||||||
// Decimation = ADF + 1
|
// Decimation = ADF + 1
|
||||||
#define SAMPLE_ADC_DECMT_FACTOR_OFST (4)
|
#define SAMPLE_ADC_DECMT_FACTOR_OFST (4)
|
||||||
#define SAMPLE_ADC_DECMT_FACTOR_MSK (0x00000007 << SAMPLE_ADC_DECMT_FACTOR_OFST)
|
#define SAMPLE_ADC_DECMT_FACTOR_MSK (0x00000007 << SAMPLE_ADC_DECMT_FACTOR_OFST)
|
||||||
#define SAMPLE_ADC_DECMT_FACTOR_0_VAL \
|
#define SAMPLE_ADC_DECMT_FACTOR_0_VAL ((0x0 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
|
||||||
((0x0 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
|
#define SAMPLE_ADC_DECMT_FACTOR_1_VAL ((0x1 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
|
||||||
#define SAMPLE_ADC_DECMT_FACTOR_1_VAL \
|
#define SAMPLE_ADC_DECMT_FACTOR_2_VAL ((0x2 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
|
||||||
((0x1 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
|
#define SAMPLE_ADC_DECMT_FACTOR_3_VAL ((0x3 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
|
||||||
#define SAMPLE_ADC_DECMT_FACTOR_2_VAL \
|
#define SAMPLE_ADC_DECMT_FACTOR_4_VAL ((0x4 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
|
||||||
((0x2 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
|
#define SAMPLE_ADC_DECMT_FACTOR_5_VAL ((0x5 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
|
||||||
#define SAMPLE_ADC_DECMT_FACTOR_3_VAL \
|
#define SAMPLE_ADC_DECMT_FACTOR_6_VAL ((0x6 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
|
||||||
((0x3 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
|
#define SAMPLE_ADC_DECMT_FACTOR_7_VAL ((0x7 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
|
||||||
#define SAMPLE_ADC_DECMT_FACTOR_4_VAL \
|
|
||||||
((0x4 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
|
|
||||||
#define SAMPLE_ADC_DECMT_FACTOR_5_VAL \
|
|
||||||
((0x5 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
|
|
||||||
#define SAMPLE_ADC_DECMT_FACTOR_6_VAL \
|
|
||||||
((0x6 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
|
|
||||||
#define SAMPLE_ADC_DECMT_FACTOR_7_VAL \
|
|
||||||
((0x7 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
|
|
||||||
|
|
||||||
#define SAMPLE_DGTL_SAMPLE_SEL_OFST (8)
|
#define SAMPLE_DGTL_SAMPLE_SEL_OFST (8)
|
||||||
#define SAMPLE_DGTL_SAMPLE_SEL_MSK (0x0000000F << SAMPLE_DGTL_SAMPLE_SEL_OFST)
|
#define SAMPLE_DGTL_SAMPLE_SEL_MSK (0x0000000F << SAMPLE_DGTL_SAMPLE_SEL_OFST)
|
||||||
#define SAMPLE_DGTL_SAMPLE_0_VAL \
|
#define SAMPLE_DGTL_SAMPLE_0_VAL ((0x0 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
||||||
((0x0 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
#define SAMPLE_DGTL_SAMPLE_1_VAL ((0x1 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
||||||
#define SAMPLE_DGTL_SAMPLE_1_VAL \
|
#define SAMPLE_DGTL_SAMPLE_2_VAL ((0x2 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
||||||
((0x1 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
#define SAMPLE_DGTL_SAMPLE_3_VAL ((0x3 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
||||||
#define SAMPLE_DGTL_SAMPLE_2_VAL \
|
#define SAMPLE_DGTL_SAMPLE_4_VAL ((0x4 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
||||||
((0x2 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
#define SAMPLE_DGTL_SAMPLE_5_VAL ((0x5 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
||||||
#define SAMPLE_DGTL_SAMPLE_3_VAL \
|
#define SAMPLE_DGTL_SAMPLE_6_VAL ((0x6 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
||||||
((0x3 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
#define SAMPLE_DGTL_SAMPLE_7_VAL ((0x7 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
||||||
#define SAMPLE_DGTL_SAMPLE_4_VAL \
|
#define SAMPLE_DGTL_SAMPLE_8_VAL ((0x8 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
||||||
((0x4 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
#define SAMPLE_DGTL_SAMPLE_9_VAL ((0x9 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
||||||
#define SAMPLE_DGTL_SAMPLE_5_VAL \
|
#define SAMPLE_DGTL_SAMPLE_10_VAL ((0xa << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
||||||
((0x5 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
#define SAMPLE_DGTL_SAMPLE_11_VAL ((0xb << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
||||||
#define SAMPLE_DGTL_SAMPLE_6_VAL \
|
#define SAMPLE_DGTL_SAMPLE_12_VAL ((0xc << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
||||||
((0x6 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
#define SAMPLE_DGTL_SAMPLE_13_VAL ((0xd << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
||||||
#define SAMPLE_DGTL_SAMPLE_7_VAL \
|
#define SAMPLE_DGTL_SAMPLE_14_VAL ((0xe << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
||||||
((0x7 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
#define SAMPLE_DGTL_SAMPLE_15_VAL ((0xf << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
||||||
#define SAMPLE_DGTL_SAMPLE_8_VAL \
|
|
||||||
((0x8 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
|
||||||
#define SAMPLE_DGTL_SAMPLE_9_VAL \
|
|
||||||
((0x9 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
|
||||||
#define SAMPLE_DGTL_SAMPLE_10_VAL \
|
|
||||||
((0xa << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
|
||||||
#define SAMPLE_DGTL_SAMPLE_11_VAL \
|
|
||||||
((0xb << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
|
||||||
#define SAMPLE_DGTL_SAMPLE_12_VAL \
|
|
||||||
((0xc << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
|
||||||
#define SAMPLE_DGTL_SAMPLE_13_VAL \
|
|
||||||
((0xd << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
|
||||||
#define SAMPLE_DGTL_SAMPLE_14_VAL \
|
|
||||||
((0xe << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
|
||||||
#define SAMPLE_DGTL_SAMPLE_15_VAL \
|
|
||||||
((0xf << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
|
|
||||||
|
|
||||||
#define SAMPLE_DGTL_DECMT_FACTOR_OFST (12)
|
#define SAMPLE_DGTL_DECMT_FACTOR_OFST (12)
|
||||||
#define SAMPLE_DGTL_DECMT_FACTOR_MSK \
|
#define SAMPLE_DGTL_DECMT_FACTOR_MSK (0x00000003 << SAMPLE_DGTL_DECMT_FACTOR_OFST)
|
||||||
(0x00000003 << SAMPLE_DGTL_DECMT_FACTOR_OFST)
|
#define SAMPLE_DECMT_FACTOR_FULL_VAL ((0x0 << SAMPLE_DGTL_DECMT_FACTOR_OFST) & SAMPLE_DGTL_DECMT_FACTOR_MSK)
|
||||||
#define SAMPLE_DECMT_FACTOR_FULL_VAL \
|
#define SAMPLE_DECMT_FACTOR_HALF_VAL ((0x1 << SAMPLE_DGTL_DECMT_FACTOR_OFST) & SAMPLE_DGTL_DECMT_FACTOR_MSK)
|
||||||
((0x0 << SAMPLE_DGTL_DECMT_FACTOR_OFST) & SAMPLE_DGTL_DECMT_FACTOR_MSK)
|
#define SAMPLE_DECMT_FACTOR_QUARTER_VAL ((0x2 << SAMPLE_DGTL_DECMT_FACTOR_OFST) & SAMPLE_DGTL_DECMT_FACTOR_MSK)
|
||||||
#define SAMPLE_DECMT_FACTOR_HALF_VAL \
|
|
||||||
((0x1 << SAMPLE_DGTL_DECMT_FACTOR_OFST) & SAMPLE_DGTL_DECMT_FACTOR_MSK)
|
/** Current Source Column 0 (0 - 31)) */
|
||||||
#define SAMPLE_DECMT_FACTOR_QUARTER_VAL \
|
#define CRRNT_SRC_COL_LSB_REG (0x5A << MEM_MAP_SHIFT)
|
||||||
((0x2 << SAMPLE_DGTL_DECMT_FACTOR_OFST) & SAMPLE_DGTL_DECMT_FACTOR_MSK)
|
|
||||||
|
/** Current Source Column 1 (32 - 63) */
|
||||||
|
#define CRRNT_SRC_COL_MSB_REG (0x5B << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
/** Vref Comp Mod Register */
|
/** Vref Comp Mod Register */
|
||||||
#define EXT_DAQ_CTRL_REG (0x5C << MEM_MAP_SHIFT)
|
#define EXT_DAQ_CTRL_REG (0x5C << MEM_MAP_SHIFT)
|
||||||
@ -332,25 +316,18 @@
|
|||||||
#define EXT_DAQ_CTRL_VREF_COMP_OFST (0)
|
#define EXT_DAQ_CTRL_VREF_COMP_OFST (0)
|
||||||
#define EXT_DAQ_CTRL_VREF_COMP_MSK (0x00000FFF << EXT_DAQ_CTRL_VREF_COMP_OFST)
|
#define EXT_DAQ_CTRL_VREF_COMP_MSK (0x00000FFF << EXT_DAQ_CTRL_VREF_COMP_OFST)
|
||||||
#define EXT_DAQ_CTRL_CMP_LGC_ENBL_OFST (15)
|
#define EXT_DAQ_CTRL_CMP_LGC_ENBL_OFST (15)
|
||||||
#define EXT_DAQ_CTRL_CMP_LGC_ENBL_MSK \
|
#define EXT_DAQ_CTRL_CMP_LGC_ENBL_MSK (0x00000001 << EXT_DAQ_CTRL_CMP_LGC_ENBL_OFST)
|
||||||
(0x00000001 << EXT_DAQ_CTRL_CMP_LGC_ENBL_OFST)
|
|
||||||
#define EXT_DAQ_CTRL_INPT_DETECT_OFST (16)
|
#define EXT_DAQ_CTRL_INPT_DETECT_OFST (16)
|
||||||
#define EXT_DAQ_CTRL_INPT_DETECT_MSK \
|
#define EXT_DAQ_CTRL_INPT_DETECT_MSK (0x00000007 << EXT_DAQ_CTRL_INPT_DETECT_OFST)
|
||||||
(0x00000007 << EXT_DAQ_CTRL_INPT_DETECT_OFST)
|
|
||||||
#define EXT_DAQ_CTRL_INPT_DETECT_ENBL_OFST (19)
|
#define EXT_DAQ_CTRL_INPT_DETECT_ENBL_OFST (19)
|
||||||
#define EXT_DAQ_CTRL_INPT_DETECT_ENBL_MSK \
|
#define EXT_DAQ_CTRL_INPT_DETECT_ENBL_MSK (0x00000001 << EXT_DAQ_CTRL_INPT_DETECT_ENBL_OFST)
|
||||||
(0x00000001 << EXT_DAQ_CTRL_INPT_DETECT_ENBL_OFST)
|
|
||||||
|
|
||||||
/** DAQ Register */
|
/** DAQ Register */
|
||||||
#define DAQ_REG (0x5D << MEM_MAP_SHIFT)
|
#define DAQ_REG (0x5D << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
#define DAQ_SETTINGS_MSK \
|
// dynamic gain (default)
|
||||||
(DAQ_HIGH_GAIN_MSK | DAQ_FIX_GAIN_MSK | DAQ_FRCE_SWTCH_GAIN_MSK)
|
|
||||||
#define DAQ_HIGH_GAIN_OFST (0)
|
#define DAQ_HIGH_GAIN_OFST (0)
|
||||||
#define DAQ_HIGH_GAIN_MSK (0x00000001 << DAQ_HIGH_GAIN_OFST)
|
#define DAQ_HIGH_GAIN_MSK (0x00000001 << DAQ_HIGH_GAIN_OFST)
|
||||||
#define DAQ_FIX_GAIN_DYNMC_VAL ((0x0 << DAQ_HIGH_GAIN_OFST) & DAQ_HIGH_GAIN_MSK)
|
|
||||||
#define DAQ_FIX_GAIN_HIGHGAIN_VAL \
|
|
||||||
((0x1 << DAQ_HIGH_GAIN_OFST) & DAQ_HIGH_GAIN_MSK)
|
|
||||||
#define DAQ_FIX_GAIN_OFST (1)
|
#define DAQ_FIX_GAIN_OFST (1)
|
||||||
#define DAQ_FIX_GAIN_MSK (0x00000003 << DAQ_FIX_GAIN_OFST)
|
#define DAQ_FIX_GAIN_MSK (0x00000003 << DAQ_FIX_GAIN_OFST)
|
||||||
#define DAQ_FIX_GAIN_STG_1_VAL ((0x1 << DAQ_FIX_GAIN_OFST) & DAQ_FIX_GAIN_MSK)
|
#define DAQ_FIX_GAIN_STG_1_VAL ((0x1 << DAQ_FIX_GAIN_OFST) & DAQ_FIX_GAIN_MSK)
|
||||||
@ -361,10 +338,9 @@
|
|||||||
#define DAQ_STRG_CELL_SLCT_MSK (0x0000000F << DAQ_STRG_CELL_SLCT_OFST)
|
#define DAQ_STRG_CELL_SLCT_MSK (0x0000000F << DAQ_STRG_CELL_SLCT_OFST)
|
||||||
#define DAQ_FRCE_SWTCH_GAIN_OFST (12)
|
#define DAQ_FRCE_SWTCH_GAIN_OFST (12)
|
||||||
#define DAQ_FRCE_SWTCH_GAIN_MSK (0x00000003 << DAQ_FRCE_SWTCH_GAIN_OFST)
|
#define DAQ_FRCE_SWTCH_GAIN_MSK (0x00000003 << DAQ_FRCE_SWTCH_GAIN_OFST)
|
||||||
#define DAQ_FRCE_GAIN_STG_1_VAL \
|
#define DAQ_FRCE_GAIN_STG_0_VAL ((0x0 << DAQ_FRCE_SWTCH_GAIN_OFST) & DAQ_FRCE_SWTCH_GAIN_MSK)
|
||||||
((0x1 << DAQ_FRCE_SWTCH_GAIN_OFST) & DAQ_FRCE_SWTCH_GAIN_MSK)
|
#define DAQ_FRCE_GAIN_STG_1_VAL ((0x1 << DAQ_FRCE_SWTCH_GAIN_OFST) & DAQ_FRCE_SWTCH_GAIN_MSK)
|
||||||
#define DAQ_FRCE_GAIN_STG_2_VAL \
|
#define DAQ_FRCE_GAIN_STG_2_VAL ((0x3 << DAQ_FRCE_SWTCH_GAIN_OFST) & DAQ_FRCE_SWTCH_GAIN_MSK)
|
||||||
((0x3 << DAQ_FRCE_SWTCH_GAIN_OFST) & DAQ_FRCE_SWTCH_GAIN_MSK)
|
|
||||||
#define DAQ_ELCTRN_CLLCTN_MDE_OFST (14)
|
#define DAQ_ELCTRN_CLLCTN_MDE_OFST (14)
|
||||||
#define DAQ_ELCTRN_CLLCTN_MDE_MSK (0x00000001 << DAQ_ELCTRN_CLLCTN_MDE_OFST)
|
#define DAQ_ELCTRN_CLLCTN_MDE_MSK (0x00000001 << DAQ_ELCTRN_CLLCTN_MDE_OFST)
|
||||||
#define DAQ_G2_CNNT_OFST (15)
|
#define DAQ_G2_CNNT_OFST (15)
|
||||||
@ -375,6 +351,7 @@
|
|||||||
#define DAQ_CRRNT_SRC_CLMN_FIX_MSK (0x00000001 << DAQ_CRRNT_SRC_CLMN_FIX_OFST)
|
#define DAQ_CRRNT_SRC_CLMN_FIX_MSK (0x00000001 << DAQ_CRRNT_SRC_CLMN_FIX_OFST)
|
||||||
#define DAQ_CRRNT_SRC_CLMN_SLCT_OFST (20)
|
#define DAQ_CRRNT_SRC_CLMN_SLCT_OFST (20)
|
||||||
#define DAQ_CRRNT_SRC_CLMN_SLCT_MSK (0x0000003F << DAQ_CRRNT_SRC_CLMN_SLCT_OFST)
|
#define DAQ_CRRNT_SRC_CLMN_SLCT_MSK (0x0000003F << DAQ_CRRNT_SRC_CLMN_SLCT_OFST)
|
||||||
|
#define DAQ_GAIN_MODE_MASK (DAQ_FRCE_SWTCH_GAIN_MSK | DAQ_FIX_GAIN_MSK | DAQ_CMP_RST_MSK)
|
||||||
|
|
||||||
/** Chip Power Register */
|
/** Chip Power Register */
|
||||||
#define CHIP_POWER_REG (0x5E << MEM_MAP_SHIFT)
|
#define CHIP_POWER_REG (0x5E << MEM_MAP_SHIFT)
|
||||||
@ -388,8 +365,7 @@
|
|||||||
#define TEMP_CTRL_REG (0x5F << MEM_MAP_SHIFT)
|
#define TEMP_CTRL_REG (0x5F << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
#define TEMP_CTRL_PROTCT_THRSHLD_OFST (0)
|
#define TEMP_CTRL_PROTCT_THRSHLD_OFST (0)
|
||||||
#define TEMP_CTRL_PROTCT_THRSHLD_MSK \
|
#define TEMP_CTRL_PROTCT_THRSHLD_MSK (0x000007FF << TEMP_CTRL_PROTCT_THRSHLD_OFST)
|
||||||
(0x000007FF << TEMP_CTRL_PROTCT_THRSHLD_OFST)
|
|
||||||
#define TEMP_CTRL_PROTCT_ENABLE_OFST (16)
|
#define TEMP_CTRL_PROTCT_ENABLE_OFST (16)
|
||||||
#define TEMP_CTRL_PROTCT_ENABLE_MSK (0x00000001 << TEMP_CTRL_PROTCT_ENABLE_OFST)
|
#define TEMP_CTRL_PROTCT_ENABLE_MSK (0x00000001 << TEMP_CTRL_PROTCT_ENABLE_OFST)
|
||||||
// set when temp higher than over threshold, write 1 to clear it
|
// set when temp higher than over threshold, write 1 to clear it
|
||||||
@ -420,6 +396,11 @@
|
|||||||
#define FRAME_NUMBER_LSB_REG (0x6A << MEM_MAP_SHIFT)
|
#define FRAME_NUMBER_LSB_REG (0x6A << MEM_MAP_SHIFT)
|
||||||
#define FRAME_NUMBER_MSB_REG (0x6B << MEM_MAP_SHIFT)
|
#define FRAME_NUMBER_MSB_REG (0x6B << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
|
/* Comparator disable time (chipv1.1) 32 bit register tT = T x 25 ns
|
||||||
|
Time before end of exposure when comparator is disabled */
|
||||||
|
#define COMP_DSBLE_TIME_REG (0x6C << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
|
|
||||||
/* Trigger Delay 32 bit register */
|
/* Trigger Delay 32 bit register */
|
||||||
#define SET_TRIGGER_DELAY_LSB_REG (0x70 << MEM_MAP_SHIFT)
|
#define SET_TRIGGER_DELAY_LSB_REG (0x70 << MEM_MAP_SHIFT)
|
||||||
#define SET_TRIGGER_DELAY_MSB_REG (0x71 << MEM_MAP_SHIFT)
|
#define SET_TRIGGER_DELAY_MSB_REG (0x71 << MEM_MAP_SHIFT)
|
||||||
@ -453,13 +434,11 @@
|
|||||||
// tPC = (PCT + 1) * 25ns
|
// tPC = (PCT + 1) * 25ns
|
||||||
#define ASIC_CTRL_PRCHRG_TMR_OFST (0)
|
#define ASIC_CTRL_PRCHRG_TMR_OFST (0)
|
||||||
#define ASIC_CTRL_PRCHRG_TMR_MSK (0x000000FF << ASIC_CTRL_PRCHRG_TMR_OFST)
|
#define ASIC_CTRL_PRCHRG_TMR_MSK (0x000000FF << ASIC_CTRL_PRCHRG_TMR_OFST)
|
||||||
#define ASIC_CTRL_PRCHRG_TMR_VAL \
|
#define ASIC_CTRL_PRCHRG_TMR_VAL ((0x1F << ASIC_CTRL_PRCHRG_TMR_OFST) & ASIC_CTRL_PRCHRG_TMR_MSK)
|
||||||
((0x1F << ASIC_CTRL_PRCHRG_TMR_OFST) & ASIC_CTRL_PRCHRG_TMR_MSK)
|
|
||||||
// tDS = (DST + 1) * 25ns
|
// tDS = (DST + 1) * 25ns
|
||||||
#define ASIC_CTRL_DS_TMR_OFST (8)
|
#define ASIC_CTRL_DS_TMR_OFST (8)
|
||||||
#define ASIC_CTRL_DS_TMR_MSK (0x000000FF << ASIC_CTRL_DS_TMR_OFST)
|
#define ASIC_CTRL_DS_TMR_MSK (0x000000FF << ASIC_CTRL_DS_TMR_OFST)
|
||||||
#define ASIC_CTRL_DS_TMR_VAL \
|
#define ASIC_CTRL_DS_TMR_VAL ((0x1F << ASIC_CTRL_DS_TMR_OFST) & ASIC_CTRL_DS_TMR_MSK)
|
||||||
((0x1F << ASIC_CTRL_DS_TMR_OFST) & ASIC_CTRL_DS_TMR_MSK)
|
|
||||||
// tET = (ET + 1) * 25ns (increase timeout range between 2 consecutive storage
|
// tET = (ET + 1) * 25ns (increase timeout range between 2 consecutive storage
|
||||||
// cells)
|
// cells)
|
||||||
#define ASIC_CTRL_EXPSRE_TMR_OFST (16)
|
#define ASIC_CTRL_EXPSRE_TMR_OFST (16)
|
||||||
@ -469,26 +448,22 @@
|
|||||||
/* ADC 0 Deserializer Control */
|
/* ADC 0 Deserializer Control */
|
||||||
#define ADC_DSRLZR_0_REG (0xF0 << MEM_MAP_SHIFT)
|
#define ADC_DSRLZR_0_REG (0xF0 << MEM_MAP_SHIFT)
|
||||||
#define ADC_DSRLZR_0_RFRSH_ALGNMNT_OFST (31) /* Refresh alignment */
|
#define ADC_DSRLZR_0_RFRSH_ALGNMNT_OFST (31) /* Refresh alignment */
|
||||||
#define ADC_DSRLZR_0_RFRSH_ALGNMNT_MSK \
|
#define ADC_DSRLZR_0_RFRSH_ALGNMNT_MSK (0x00000001 << ADC_DSRLZR_0_RFRSH_ALGNMNT_OFST)
|
||||||
(0x00000001 << ADC_DSRLZR_0_RFRSH_ALGNMNT_OFST)
|
|
||||||
|
|
||||||
/* ADC 0 Deserializer Control */
|
/* ADC 0 Deserializer Control */
|
||||||
#define ADC_DSRLZR_1_REG (0xF1 << MEM_MAP_SHIFT)
|
#define ADC_DSRLZR_1_REG (0xF1 << MEM_MAP_SHIFT)
|
||||||
#define ADC_DSRLZR_1_RFRSH_ALGNMNT_OFST (31)
|
#define ADC_DSRLZR_1_RFRSH_ALGNMNT_OFST (31)
|
||||||
#define ADC_DSRLZR_1_RFRSH_ALGNMNT_MSK \
|
#define ADC_DSRLZR_1_RFRSH_ALGNMNT_MSK (0x00000001 << ADC_DSRLZR_1_RFRSH_ALGNMNT_OFST)
|
||||||
(0x00000001 << ADC_DSRLZR_1_RFRSH_ALGNMNT_OFST)
|
|
||||||
|
|
||||||
/* ADC 0 Deserializer Control */
|
/* ADC 0 Deserializer Control */
|
||||||
#define ADC_DSRLZR_2_REG (0xF2 << MEM_MAP_SHIFT)
|
#define ADC_DSRLZR_2_REG (0xF2 << MEM_MAP_SHIFT)
|
||||||
#define ADC_DSRLZR_2_RFRSH_ALGNMNT_OFST (31)
|
#define ADC_DSRLZR_2_RFRSH_ALGNMNT_OFST (31)
|
||||||
#define ADC_DSRLZR_2_RFRSH_ALGNMNT_MSK \
|
#define ADC_DSRLZR_2_RFRSH_ALGNMNT_MSK (0x00000001 << ADC_DSRLZR_2_RFRSH_ALGNMNT_OFST)
|
||||||
(0x00000001 << ADC_DSRLZR_2_RFRSH_ALGNMNT_OFST)
|
|
||||||
|
|
||||||
/* ADC 0 Deserializer Control */
|
/* ADC 0 Deserializer Control */
|
||||||
#define ADC_DSRLZR_3_REG (0xF3 << MEM_MAP_SHIFT)
|
#define ADC_DSRLZR_3_REG (0xF3 << MEM_MAP_SHIFT)
|
||||||
#define ADC_DSRLZR_3_RFRSH_ALGNMNT_OFST (31)
|
#define ADC_DSRLZR_3_RFRSH_ALGNMNT_OFST (31)
|
||||||
#define ADC_DSRLZR_3_RFRSH_ALGNMNT_MSK \
|
#define ADC_DSRLZR_3_RFRSH_ALGNMNT_MSK (0x00000001 << ADC_DSRLZR_3_RFRSH_ALGNMNT_OFST)
|
||||||
(0x00000001 << ADC_DSRLZR_3_RFRSH_ALGNMNT_OFST)
|
|
||||||
|
|
||||||
/* Round Robin */
|
/* Round Robin */
|
||||||
#define RXR_ENDPOINTS_MAX (64)
|
#define RXR_ENDPOINTS_MAX (64)
|
||||||
@ -496,3 +471,5 @@
|
|||||||
#define RXR_ENDPOINT_INNER_START_REG (0x2000 << MEM_MAP_SHIFT)
|
#define RXR_ENDPOINT_INNER_START_REG (0x2000 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
#define RXR_ENDPOINT_OFST (0x10 << MEM_MAP_SHIFT)
|
#define RXR_ENDPOINT_OFST (0x10 << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
|
// clang-format on
|
||||||
|
Binary file not shown.
4
slsDetectorServers/jungfrauDetectorServer/config_jungfrau.txt
Executable file
4
slsDetectorServers/jungfrauDetectorServer/config_jungfrau.txt
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#chip version version (multiplied by 10)
|
||||||
|
chipversion 11
|
@ -43,8 +43,13 @@ int virtual_image_test_mode = 0;
|
|||||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||||
int highvoltage = 0;
|
int highvoltage = 0;
|
||||||
int dacValues[NDAC] = {};
|
int dacValues[NDAC] = {};
|
||||||
|
int defaultDacValues[] = DEFAULT_DAC_VALS;
|
||||||
|
int defaultDacValue_G0[] = SPECIAL_DEFAULT_DYNAMIC_GAIN_VALS;
|
||||||
|
int defaultDacValue_HG0[] = SPECIAL_DEFAULT_DYNAMICHG0_GAIN_VALS;
|
||||||
int32_t clkPhase[NUM_CLOCKS] = {};
|
int32_t clkPhase[NUM_CLOCKS] = {};
|
||||||
int detPos[4] = {};
|
int detPos[4] = {};
|
||||||
|
int chipVersion = 10; // (1.0)
|
||||||
|
int chipConfigured = 0;
|
||||||
|
|
||||||
int isInitCheckDone() { return initCheckDone; }
|
int isInitCheckDone() { return initCheckDone; }
|
||||||
|
|
||||||
@ -101,6 +106,7 @@ void basictests() {
|
|||||||
|
|
||||||
if (fwversion >= MIN_REQRD_VRSN_T_RD_API)
|
if (fwversion >= MIN_REQRD_VRSN_T_RD_API)
|
||||||
sw_fw_apiversion = getFirmwareAPIVersion();
|
sw_fw_apiversion = getFirmwareAPIVersion();
|
||||||
|
|
||||||
LOG(logINFOBLUE,
|
LOG(logINFOBLUE,
|
||||||
("************ Jungfrau Server *********************\n"
|
("************ Jungfrau Server *********************\n"
|
||||||
"Hardware Version:\t\t 0x%x\n"
|
"Hardware Version:\t\t 0x%x\n"
|
||||||
@ -283,12 +289,17 @@ u_int16_t getHardwareSerialNumber() {
|
|||||||
|
|
||||||
// is board 1.0?, with value 2 (resistor network)
|
// is board 1.0?, with value 2 (resistor network)
|
||||||
int isHardwareVersion2() {
|
int isHardwareVersion2() {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
return (((bus_r(MOD_SERIAL_NUM_REG) & HARDWARE_VERSION_NUM_MSK) ==
|
return (((bus_r(MOD_SERIAL_NUM_REG) & HARDWARE_VERSION_NUM_MSK) ==
|
||||||
HARDWARE_VERSION_2_VAL)
|
HARDWARE_VERSION_2_VAL)
|
||||||
? 1
|
? 1
|
||||||
: 0);
|
: 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getChipVersion() { return chipVersion; }
|
||||||
|
|
||||||
u_int32_t getDetectorNumber() {
|
u_int32_t getDetectorNumber() {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return 0;
|
return 0;
|
||||||
@ -379,10 +390,16 @@ void setupDetector() {
|
|||||||
for (int i = 0; i < NUM_CLOCKS; ++i) {
|
for (int i = 0; i < NUM_CLOCKS; ++i) {
|
||||||
clkPhase[i] = 0;
|
clkPhase[i] = 0;
|
||||||
}
|
}
|
||||||
|
chipConfigured = 0;
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
sharedMemory_setStatus(IDLE);
|
sharedMemory_setStatus(IDLE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// get chip version
|
||||||
|
if (readConfigFile() == FAIL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ALTERA_PLL_ResetPLL();
|
ALTERA_PLL_ResetPLL();
|
||||||
resetCore();
|
resetCore();
|
||||||
resetPeripheral();
|
resetPeripheral();
|
||||||
@ -409,7 +426,7 @@ void setupDetector() {
|
|||||||
DAC_MAX_MV);
|
DAC_MAX_MV);
|
||||||
LTC2620_Disable();
|
LTC2620_Disable();
|
||||||
LTC2620_Configure();
|
LTC2620_Configure();
|
||||||
setDefaultDacs();
|
resetToDefaultDacs(0);
|
||||||
|
|
||||||
// altera pll
|
// altera pll
|
||||||
ALTERA_PLL_SetDefines(
|
ALTERA_PLL_SetDefines(
|
||||||
@ -434,15 +451,21 @@ void setupDetector() {
|
|||||||
|
|
||||||
// Initialization of acquistion parameters
|
// Initialization of acquistion parameters
|
||||||
setSettings(DEFAULT_SETTINGS);
|
setSettings(DEFAULT_SETTINGS);
|
||||||
|
setGainMode(DEFAULT_GAINMODE);
|
||||||
|
|
||||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||||
setNumTriggers(DEFAULT_NUM_CYCLES);
|
setNumTriggers(DEFAULT_NUM_CYCLES);
|
||||||
setExpTime(DEFAULT_EXPTIME);
|
setExpTime(DEFAULT_EXPTIME);
|
||||||
setPeriod(DEFAULT_PERIOD);
|
setPeriod(DEFAULT_PERIOD);
|
||||||
setDelayAfterTrigger(DEFAULT_DELAY);
|
setDelayAfterTrigger(DEFAULT_DELAY);
|
||||||
|
if (getChipVersion() == 11) {
|
||||||
|
selectStoragecellStart(DEFAULT_STRG_CLL_STRT_CHIP11);
|
||||||
|
} else {
|
||||||
setNumAdditionalStorageCells(DEFAULT_NUM_STRG_CLLS);
|
setNumAdditionalStorageCells(DEFAULT_NUM_STRG_CLLS);
|
||||||
setStorageCellDelay(DEFAULT_STRG_CLL_DLY);
|
|
||||||
selectStoragecellStart(DEFAULT_STRG_CLL_STRT);
|
selectStoragecellStart(DEFAULT_STRG_CLL_STRT);
|
||||||
|
// not applicable for chipv1.1
|
||||||
|
setStorageCellDelay(DEFAULT_STRG_CLL_DLY);
|
||||||
|
}
|
||||||
/*setClockDivider(RUN_CLK, HALF_SPEED); depends if all the previous stuff
|
/*setClockDivider(RUN_CLK, HALF_SPEED); depends if all the previous stuff
|
||||||
* works*/
|
* works*/
|
||||||
setTiming(DEFAULT_TIMING_MODE);
|
setTiming(DEFAULT_TIMING_MODE);
|
||||||
@ -451,21 +474,259 @@ void setupDetector() {
|
|||||||
// temp threshold and reset event
|
// temp threshold and reset event
|
||||||
setThresholdTemperature(DEFAULT_TMP_THRSHLD);
|
setThresholdTemperature(DEFAULT_TMP_THRSHLD);
|
||||||
setTemperatureEvent(0);
|
setTemperatureEvent(0);
|
||||||
|
setFlipRows(DEFAULT_FLIP_ROWS);
|
||||||
|
if (getChipVersion() == 11) {
|
||||||
|
setFilterResistor(DEFAULT_FILTER_RESISTOR);
|
||||||
|
setFilterCell(DEFAULT_FILTER_CELL);
|
||||||
|
}
|
||||||
|
disableCurrentSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
int setDefaultDacs() {
|
int resetToDefaultDacs(int hardReset) {
|
||||||
int ret = OK;
|
LOG(logINFOBLUE, ("Resetting %s to Default Dac values\n",
|
||||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
(hardReset == 1 ? "hard" : "")));
|
||||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
|
||||||
|
// reset defaults to hardcoded defaults
|
||||||
|
if (hardReset) {
|
||||||
|
const int vals[] = DEFAULT_DAC_VALS;
|
||||||
for (int i = 0; i < NDAC; ++i) {
|
for (int i = 0; i < NDAC; ++i) {
|
||||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
defaultDacValues[i] = vals[i];
|
||||||
if (dacValues[i] != defaultvals[i]) {
|
}
|
||||||
ret = FAIL;
|
const int vals_G0[] = SPECIAL_DEFAULT_DYNAMIC_GAIN_VALS;
|
||||||
|
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||||
|
defaultDacValue_G0[i] = vals_G0[i];
|
||||||
|
}
|
||||||
|
const int vals_HG0[] = SPECIAL_DEFAULT_DYNAMICHG0_GAIN_VALS;
|
||||||
|
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||||
|
defaultDacValue_HG0[i] = vals_HG0[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// remember settings
|
||||||
|
enum detectorSettings oldSettings = thisSettings;
|
||||||
|
|
||||||
|
// reset dacs to defaults
|
||||||
|
const int specialDacs[] = SPECIALDACINDEX;
|
||||||
|
for (int i = 0; i < NDAC; ++i) {
|
||||||
|
int value = defaultDacValues[i];
|
||||||
|
|
||||||
|
for (int j = 0; j < NSPECIALDACS; ++j) {
|
||||||
|
// special dac: replace default value
|
||||||
|
if (specialDacs[j] == i) {
|
||||||
|
switch (oldSettings) {
|
||||||
|
case GAIN0:
|
||||||
|
value = defaultDacValue_G0[j];
|
||||||
|
break;
|
||||||
|
case HIGHGAIN0:
|
||||||
|
value = defaultDacValue_HG0[j];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set to defualt
|
||||||
|
setDAC((enum DACINDEX)i, value, 0);
|
||||||
|
if (dacValues[i] != value) {
|
||||||
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
||||||
defaultvals[i], dacValues[i]));
|
value, dacValues[i]));
|
||||||
|
return FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getDefaultDac(enum DACINDEX index, enum detectorSettings sett,
|
||||||
|
int *retval) {
|
||||||
|
|
||||||
|
// settings only for special dacs
|
||||||
|
if (sett != UNDEFINED) {
|
||||||
|
const int specialDacs[] = SPECIALDACINDEX;
|
||||||
|
// find special dac index
|
||||||
|
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||||
|
if ((int)index == specialDacs[i]) {
|
||||||
|
switch (sett) {
|
||||||
|
case GAIN0:
|
||||||
|
*retval = defaultDacValue_G0[i];
|
||||||
|
return OK;
|
||||||
|
case HIGHGAIN0:
|
||||||
|
*retval = defaultDacValue_HG0[i];
|
||||||
|
return OK;
|
||||||
|
// unknown settings
|
||||||
|
default:
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// not a special dac
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index < 0 || index >= NDAC)
|
||||||
|
return FAIL;
|
||||||
|
*retval = defaultDacValues[index];
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int setDefaultDac(enum DACINDEX index, enum detectorSettings sett, int value) {
|
||||||
|
char *dac_names[] = {DAC_NAMES};
|
||||||
|
|
||||||
|
// settings only for special dacs
|
||||||
|
if (sett != UNDEFINED) {
|
||||||
|
const int specialDacs[] = SPECIALDACINDEX;
|
||||||
|
// find special dac index
|
||||||
|
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||||
|
if ((int)index == specialDacs[i]) {
|
||||||
|
switch (sett) {
|
||||||
|
case GAIN0:
|
||||||
|
LOG(logINFO, ("Setting Default Dac [%d - %s, gain0]: %d\n",
|
||||||
|
(int)index, dac_names[index], value));
|
||||||
|
defaultDacValue_G0[i] = value;
|
||||||
|
return OK;
|
||||||
|
case HIGHGAIN0:
|
||||||
|
LOG(logINFO,
|
||||||
|
("Setting Default Dac [%d - %s, highgain0]: %d\n",
|
||||||
|
(int)index, dac_names[index], value));
|
||||||
|
defaultDacValue_HG0[i] = value;
|
||||||
|
return OK;
|
||||||
|
// unknown settings
|
||||||
|
default:
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// not a special dac
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
if (index < 0 || index >= NDAC)
|
||||||
|
return FAIL;
|
||||||
|
LOG(logINFO, ("Setting Default Dac [%d - %s]: %d\n", (int)index,
|
||||||
|
dac_names[index], value));
|
||||||
|
defaultDacValues[index] = value;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int readConfigFile() {
|
||||||
|
|
||||||
|
if (initError == FAIL) {
|
||||||
|
return initError;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int fileNameSize = 128;
|
||||||
|
char fname[fileNameSize];
|
||||||
|
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// open config file
|
||||||
|
FILE *fd = fopen(fname, "r");
|
||||||
|
if (fd == NULL) {
|
||||||
|
sprintf(initErrorMessage,
|
||||||
|
"Could not open on-board detector server config file [%s].\n",
|
||||||
|
CONFIG_FILE);
|
||||||
|
initError = FAIL;
|
||||||
|
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG(logINFOBLUE, ("Reading config file %s\n", CONFIG_FILE));
|
||||||
|
|
||||||
|
// Initialization
|
||||||
|
const size_t LZ = 256;
|
||||||
|
char line[LZ];
|
||||||
|
memset(line, 0, LZ);
|
||||||
|
char command[LZ];
|
||||||
|
|
||||||
|
// keep reading a line
|
||||||
|
while (fgets(line, LZ, fd)) {
|
||||||
|
|
||||||
|
// ignore comments
|
||||||
|
if (line[0] == '#') {
|
||||||
|
LOG(logDEBUG1, ("Ignoring Comment\n"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ignore empty lines
|
||||||
|
if (strlen(line) <= 1) {
|
||||||
|
LOG(logDEBUG1, ("Ignoring Empty line\n"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// removing leading spaces
|
||||||
|
if (line[0] == ' ' || line[0] == '\t') {
|
||||||
|
int len = strlen(line);
|
||||||
|
// find first valid character
|
||||||
|
int i = 0;
|
||||||
|
for (i = 0; i < len; ++i) {
|
||||||
|
if (line[i] != ' ' && line[i] != '\t') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ignore the line full of spaces (last char \n)
|
||||||
|
if (i >= len - 1) {
|
||||||
|
LOG(logDEBUG1, ("Ignoring line full of spaces\n"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// copying only valid char
|
||||||
|
char temp[LZ];
|
||||||
|
memset(temp, 0, LZ);
|
||||||
|
memcpy(temp, line + i, strlen(line) - i);
|
||||||
|
memset(line, 0, LZ);
|
||||||
|
memcpy(line, temp, strlen(temp));
|
||||||
|
LOG(logDEBUG1, ("Removing leading spaces.\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG(logDEBUG1, ("Command to process: (size:%d) %.*s\n", strlen(line),
|
||||||
|
strlen(line) - 1, line));
|
||||||
|
memset(command, 0, LZ);
|
||||||
|
|
||||||
|
// chipversion command
|
||||||
|
if (!strncmp(line, "chipversion", strlen("chipversion"))) {
|
||||||
|
int version = 0;
|
||||||
|
|
||||||
|
// cannot scan values
|
||||||
|
if (sscanf(line, "%s %d", command, &version) != 2) {
|
||||||
|
sprintf(
|
||||||
|
initErrorMessage,
|
||||||
|
"Could not scan chipversion commands from on-board server "
|
||||||
|
"config file. Line:[%s].\n",
|
||||||
|
line);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// validations
|
||||||
|
if (version != 10 && version != 11) {
|
||||||
|
sprintf(initErrorMessage,
|
||||||
|
"Could not set chip version from on-board server "
|
||||||
|
"config file. Invalid chip version %d. Line:[%s].\n",
|
||||||
|
version, line);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// validations
|
||||||
|
chipVersion = version;
|
||||||
|
LOG(logINFOBLUE, ("Chip Version: v%.01f\n", chipVersion / 10.0));
|
||||||
|
|
||||||
|
// version 1.1 and HW 1.0 (version reg value = 2) is incompatible
|
||||||
|
if (chipVersion == 11 && isHardwareVersion2()) {
|
||||||
|
strcpy(initErrorMessage,
|
||||||
|
"Chip version 1.1 (from on-board config file) is incompatible with old board (v1.0). Please update board or correct on-board config file.\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(line, 0, LZ);
|
||||||
|
}
|
||||||
|
fclose(fd);
|
||||||
|
|
||||||
|
if (strlen(initErrorMessage)) {
|
||||||
|
initError = FAIL;
|
||||||
|
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||||
|
} else {
|
||||||
|
LOG(logINFOBLUE, ("Successfully read config file\n"));
|
||||||
|
}
|
||||||
|
return initError;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* firmware functions (resets) */
|
/* firmware functions (resets) */
|
||||||
@ -523,14 +784,57 @@ uint32_t getADCInvertRegister() {
|
|||||||
|
|
||||||
/* parameters - timer */
|
/* parameters - timer */
|
||||||
int selectStoragecellStart(int pos) {
|
int selectStoragecellStart(int pos) {
|
||||||
|
int value = pos;
|
||||||
|
uint32_t addr = DAQ_REG;
|
||||||
|
uint32_t mask = DAQ_STRG_CELL_SLCT_MSK;
|
||||||
|
int offset = DAQ_STRG_CELL_SLCT_OFST;
|
||||||
|
if (getChipVersion() == 11) {
|
||||||
|
// set the bit
|
||||||
|
value = 1 << pos;
|
||||||
|
addr = CONFIG_V11_REG;
|
||||||
|
mask = CONFIG_V11_STRG_CLL_MSK;
|
||||||
|
offset = CONFIG_V11_STRG_CLL_OFST;
|
||||||
|
}
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
LOG(logINFO, ("Setting storage cell start: %d\n", pos));
|
LOG(logINFO, ("Setting storage cell start: %d\n", pos));
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_STRG_CELL_SLCT_MSK);
|
bus_w(addr, bus_r(addr) & ~mask);
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | ((pos << DAQ_STRG_CELL_SLCT_OFST) &
|
bus_w(addr, bus_r(addr) | ((value << offset) & mask));
|
||||||
DAQ_STRG_CELL_SLCT_MSK));
|
// should not do a get to verify (status register does not update
|
||||||
|
// immediately during acquisition)
|
||||||
|
if (getChipVersion() == 11) {
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// read value back
|
||||||
|
// chipv1.1, writing and reading registers are different
|
||||||
|
#ifndef VIRTUAL
|
||||||
|
if (getChipVersion() == 11) {
|
||||||
|
addr = CONFIG_V11_STATUS_REG;
|
||||||
|
mask = CONFIG_V11_STATUS_STRG_CLL_MSK;
|
||||||
|
offset = CONFIG_V11_STATUS_STRG_CLL_OFST;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
int retval = ((bus_r(addr) & mask) >> offset);
|
||||||
|
if (getChipVersion() == 11) {
|
||||||
|
// get which bit
|
||||||
|
int max = getMaxStoragecellStart();
|
||||||
|
for (int i = 0; i != max + 1; ++i) {
|
||||||
|
if (retval & (1 << i)) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// chip v1.0
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getMaxStoragecellStart() {
|
||||||
|
if (getChipVersion() == 11) {
|
||||||
|
return MAX_STORAGE_CELL_CHIP11_VAL;
|
||||||
|
} else {
|
||||||
|
return MAX_STORAGE_CELL_VAL;
|
||||||
}
|
}
|
||||||
return ((bus_r(DAQ_REG) & DAQ_STRG_CELL_SLCT_MSK) >>
|
|
||||||
DAQ_STRG_CELL_SLCT_OFST);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int setNextFrameNumber(uint64_t value) {
|
int setNextFrameNumber(uint64_t value) {
|
||||||
@ -749,95 +1053,140 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
|||||||
if (sett == UNINITIALIZED)
|
if (sett == UNINITIALIZED)
|
||||||
return thisSettings;
|
return thisSettings;
|
||||||
|
|
||||||
|
int *dacVals = NULL;
|
||||||
// set settings
|
// set settings
|
||||||
switch (sett) {
|
switch (sett) {
|
||||||
case DYNAMICGAIN:
|
case GAIN0:
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_HIGH_GAIN_MSK);
|
||||||
LOG(logINFO,
|
LOG(logINFO,
|
||||||
("Set settings - Dyanmic Gain, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
|
("Set settings - Gain 0 [DAQ Reg:0x%x]\n", bus_r(DAQ_REG)));
|
||||||
|
dacVals = defaultDacValue_G0;
|
||||||
break;
|
break;
|
||||||
case DYNAMICHG0:
|
case HIGHGAIN0:
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_HIGH_GAIN_MSK);
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_HIGHGAIN_VAL);
|
|
||||||
LOG(logINFO, ("Set settings - Dyanmic High Gain 0, DAQ Reg: 0x%x\n",
|
|
||||||
bus_r(DAQ_REG)));
|
|
||||||
break;
|
|
||||||
case FIXGAIN1:
|
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_STG_1_VAL);
|
|
||||||
LOG(logINFO,
|
LOG(logINFO,
|
||||||
("Set settings - Fix Gain 1, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
|
("Set settings - High Gain 0 [DAQ Reg:0x%x]\n", bus_r(DAQ_REG)));
|
||||||
break;
|
dacVals = defaultDacValue_HG0;
|
||||||
case FIXGAIN2:
|
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_STG_2_VAL);
|
|
||||||
LOG(logINFO,
|
|
||||||
("Set settings - Fix Gain 2, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
|
|
||||||
break;
|
|
||||||
case FORCESWITCHG1:
|
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FRCE_GAIN_STG_1_VAL);
|
|
||||||
LOG(logINFO, ("Set settings - Force Switch Gain 1, DAQ Reg: 0x%x\n",
|
|
||||||
bus_r(DAQ_REG)));
|
|
||||||
break;
|
|
||||||
case FORCESWITCHG2:
|
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FRCE_GAIN_STG_2_VAL);
|
|
||||||
LOG(logINFO, ("Set settings - Force Switch Gain 2, DAQ Reg: 0x%x\n",
|
|
||||||
bus_r(DAQ_REG)));
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG(logERROR,
|
LOG(logERROR, ("This settings %d is not defined\n", (int)sett));
|
||||||
("This settings is not defined for this detector %d\n", (int)sett));
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
thisSettings = sett;
|
thisSettings = sett;
|
||||||
|
|
||||||
|
// set special dacs
|
||||||
|
const int specialDacs[] = SPECIALDACINDEX;
|
||||||
|
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||||
|
setDAC(specialDacs[i], dacVals[i], 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if chip 1.1, and power chip on, configure chip
|
||||||
|
if (getChipVersion() == 11 && powerChip(-1)) {
|
||||||
|
configureChip();
|
||||||
|
}
|
||||||
|
|
||||||
return getSettings();
|
return getSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
enum detectorSettings getSettings() {
|
enum detectorSettings getSettings() {
|
||||||
|
if (bus_r(DAQ_REG) & DAQ_HIGH_GAIN_MSK)
|
||||||
uint32_t regval = bus_r(DAQ_REG);
|
return HIGHGAIN0;
|
||||||
uint32_t val = regval & DAQ_SETTINGS_MSK;
|
return GAIN0;
|
||||||
LOG(logDEBUG1, ("Getting Settings\n Reading DAQ Register :0x%x\n", val));
|
|
||||||
|
|
||||||
switch (val) {
|
|
||||||
case DAQ_FIX_GAIN_DYNMC_VAL:
|
|
||||||
thisSettings = DYNAMICGAIN;
|
|
||||||
LOG(logDEBUG1,
|
|
||||||
("Settings read: Dynamic Gain. DAQ Reg: 0x%x\n", regval));
|
|
||||||
break;
|
|
||||||
case DAQ_FIX_GAIN_HIGHGAIN_VAL:
|
|
||||||
thisSettings = DYNAMICHG0;
|
|
||||||
LOG(logDEBUG1,
|
|
||||||
("Settings read: Dynamig High Gain. DAQ Reg: 0x%x\n", regval));
|
|
||||||
break;
|
|
||||||
case DAQ_FIX_GAIN_STG_1_VAL:
|
|
||||||
thisSettings = FIXGAIN1;
|
|
||||||
LOG(logDEBUG1, ("Settings read: Fix Gain 1. DAQ Reg: 0x%x\n", regval));
|
|
||||||
break;
|
|
||||||
case DAQ_FIX_GAIN_STG_2_VAL:
|
|
||||||
thisSettings = FIXGAIN2;
|
|
||||||
LOG(logDEBUG1, ("Settings read: Fix Gain 2. DAQ Reg: 0x%x\n", regval));
|
|
||||||
break;
|
|
||||||
case DAQ_FRCE_GAIN_STG_1_VAL:
|
|
||||||
thisSettings = FORCESWITCHG1;
|
|
||||||
LOG(logDEBUG1,
|
|
||||||
("Settings read: Force Switch Gain 1. DAQ Reg: 0x%x\n", regval));
|
|
||||||
break;
|
|
||||||
case DAQ_FRCE_GAIN_STG_2_VAL:
|
|
||||||
thisSettings = FORCESWITCHG2;
|
|
||||||
LOG(logDEBUG1,
|
|
||||||
("Settings read: Force Switch Gain 2. DAQ Reg: 0x%x\n", regval));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
thisSettings = UNDEFINED;
|
|
||||||
LOG(logERROR, ("Settings read: Undefined. DAQ Reg: 0x%x\n", regval));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return thisSettings;
|
enum gainMode getGainMode() {
|
||||||
|
uint32_t regval = bus_r(DAQ_REG);
|
||||||
|
uint32_t retval_force = regval & DAQ_FRCE_SWTCH_GAIN_MSK;
|
||||||
|
uint32_t retval_fix = regval & DAQ_FIX_GAIN_MSK;
|
||||||
|
uint32_t retval_cmp_rst = regval & DAQ_CMP_RST_MSK;
|
||||||
|
|
||||||
|
// only one set should be valid
|
||||||
|
if ((retval_force && retval_fix) || (retval_fix && retval_cmp_rst) ||
|
||||||
|
(retval_force && retval_cmp_rst)) {
|
||||||
|
LOG(logERROR, ("undefined gain mode. DAQ reg: 0x%x\n", regval));
|
||||||
|
}
|
||||||
|
|
||||||
|
// dynamic gain, when nothing is set
|
||||||
|
if (retval_force == 0 && retval_fix == 0 && retval_cmp_rst == 0) {
|
||||||
|
return DYNAMIC;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (retval_force) {
|
||||||
|
case DAQ_FRCE_GAIN_STG_1_VAL:
|
||||||
|
return FORCE_SWITCH_G1;
|
||||||
|
case DAQ_FRCE_GAIN_STG_2_VAL:
|
||||||
|
return FORCE_SWITCH_G2;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (retval_fix) {
|
||||||
|
case DAQ_FIX_GAIN_STG_1_VAL:
|
||||||
|
return FIX_G1;
|
||||||
|
case DAQ_FIX_GAIN_STG_2_VAL:
|
||||||
|
return FIX_G2;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (retval_cmp_rst) {
|
||||||
|
return FIX_G0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG(logERROR, ("This gain mode is undefined [DAQ reg: %d]\n", regval));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setGainMode(enum gainMode mode) {
|
||||||
|
uint32_t addr = DAQ_REG;
|
||||||
|
uint32_t value = bus_r(addr);
|
||||||
|
|
||||||
|
switch (mode) {
|
||||||
|
case DYNAMIC:
|
||||||
|
value &= ~(DAQ_GAIN_MODE_MASK);
|
||||||
|
bus_w(addr, value);
|
||||||
|
LOG(logINFO,
|
||||||
|
("Set gain mode - Dynamic Gain [DAQ Reg:0x%x]\n", bus_r(DAQ_REG)));
|
||||||
|
break;
|
||||||
|
case FORCE_SWITCH_G1:
|
||||||
|
value &= ~(DAQ_GAIN_MODE_MASK);
|
||||||
|
value |= DAQ_FRCE_GAIN_STG_1_VAL;
|
||||||
|
bus_w(addr, value);
|
||||||
|
LOG(logINFO, ("Set gain mode - Force Switch G1 [DAQ Reg:0x%x]\n",
|
||||||
|
bus_r(DAQ_REG)));
|
||||||
|
break;
|
||||||
|
case FORCE_SWITCH_G2:
|
||||||
|
value &= ~(DAQ_GAIN_MODE_MASK);
|
||||||
|
value |= DAQ_FRCE_GAIN_STG_2_VAL;
|
||||||
|
bus_w(addr, value);
|
||||||
|
LOG(logINFO, ("Set gain mode - Force Switch G2 [DAQ Reg:0x%x]\n",
|
||||||
|
bus_r(DAQ_REG)));
|
||||||
|
break;
|
||||||
|
case FIX_G1:
|
||||||
|
value &= ~(DAQ_GAIN_MODE_MASK);
|
||||||
|
value |= DAQ_FIX_GAIN_STG_1_VAL;
|
||||||
|
bus_w(addr, value);
|
||||||
|
LOG(logINFO,
|
||||||
|
("Set gain mode - Fix G1 [DAQ Reg:0x%x]\n", bus_r(DAQ_REG)));
|
||||||
|
break;
|
||||||
|
case FIX_G2:
|
||||||
|
value &= ~(DAQ_GAIN_MODE_MASK);
|
||||||
|
value |= DAQ_FIX_GAIN_STG_2_VAL;
|
||||||
|
bus_w(addr, value);
|
||||||
|
LOG(logINFO,
|
||||||
|
("Set gain mode - Fix G2 [DAQ Reg:0x%x]\n", bus_r(DAQ_REG)));
|
||||||
|
break;
|
||||||
|
case FIX_G0:
|
||||||
|
value &= ~(DAQ_GAIN_MODE_MASK);
|
||||||
|
value |= DAQ_CMP_RST_MSK;
|
||||||
|
bus_w(addr, value);
|
||||||
|
LOG(logINFO,
|
||||||
|
("Set gain mode - Fix G0 [DAQ Reg:0x%x]\n", bus_r(DAQ_REG)));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LOG(logERROR, ("This gain mode %d is not defined\n", (int)mode));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parameters - dac, adc, hv */
|
/* parameters - dac, adc, hv */
|
||||||
@ -846,11 +1195,10 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
char *dac_names[] = {DAC_NAMES};
|
char *dac_names[] = {DAC_NAMES};
|
||||||
LOG(logINFO, ("Setting DAC %s\n", dac_names[ind]));
|
|
||||||
LOG(logDEBUG1, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind],
|
|
||||||
val, (mV ? "mV" : "dac units")));
|
|
||||||
int dacval = val;
|
int dacval = val;
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
|
LOG(logINFO, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind],
|
||||||
|
val, (mV ? "mV" : "dac units")));
|
||||||
if (!mV) {
|
if (!mV) {
|
||||||
dacValues[ind] = val;
|
dacValues[ind] = val;
|
||||||
}
|
}
|
||||||
@ -859,6 +1207,7 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
|||||||
dacValues[ind] = dacval;
|
dacValues[ind] = dacval;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
LOG(logINFO, ("Setting DAC %s\n", dac_names[ind]));
|
||||||
if (LTC2620_SetDACValue((int)ind, val, mV, &dacval) == OK) {
|
if (LTC2620_SetDACValue((int)ind, val, mV, &dacval) == OK) {
|
||||||
dacValues[ind] = dacval;
|
dacValues[ind] = dacval;
|
||||||
if (ind == J_VREF_COMP &&
|
if (ind == J_VREF_COMP &&
|
||||||
@ -1280,13 +1629,17 @@ void initReadoutConfiguration() {
|
|||||||
int powerChip(int on) {
|
int powerChip(int on) {
|
||||||
if (on != -1) {
|
if (on != -1) {
|
||||||
if (on) {
|
if (on) {
|
||||||
LOG(logINFO, ("Powering chip: on\n"));
|
LOG(logINFOBLUE, ("Powering chip: on\n"));
|
||||||
bus_w(CHIP_POWER_REG,
|
bus_w(CHIP_POWER_REG,
|
||||||
bus_r(CHIP_POWER_REG) | CHIP_POWER_ENABLE_MSK);
|
bus_r(CHIP_POWER_REG) | CHIP_POWER_ENABLE_MSK);
|
||||||
|
|
||||||
|
configureChip();
|
||||||
} else {
|
} else {
|
||||||
LOG(logINFO, ("Powering chip: off\n"));
|
LOG(logINFOBLUE, ("Powering chip: off\n"));
|
||||||
bus_w(CHIP_POWER_REG,
|
bus_w(CHIP_POWER_REG,
|
||||||
bus_r(CHIP_POWER_REG) & ~CHIP_POWER_ENABLE_MSK);
|
bus_r(CHIP_POWER_REG) & ~CHIP_POWER_ENABLE_MSK);
|
||||||
|
|
||||||
|
chipConfigured = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
@ -1297,6 +1650,22 @@ int powerChip(int on) {
|
|||||||
CHIP_POWER_STATUS_OFST);
|
CHIP_POWER_STATUS_OFST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int isChipConfigured() {
|
||||||
|
return chipConfigured;
|
||||||
|
}
|
||||||
|
|
||||||
|
void configureChip() {
|
||||||
|
// only for chipv1.1
|
||||||
|
if (chipVersion == 11) {
|
||||||
|
LOG(logINFOBLUE, ("Configuring chip\n"));
|
||||||
|
// write same register values back to configure chip
|
||||||
|
uint32_t val = bus_r(CONFIG_V11_REG);
|
||||||
|
bus_w(CONFIG_V11_REG, val);
|
||||||
|
chipConfigured = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int autoCompDisable(int on) {
|
int autoCompDisable(int on) {
|
||||||
if (on != -1) {
|
if (on != -1) {
|
||||||
if (on) {
|
if (on) {
|
||||||
@ -1314,6 +1683,32 @@ int autoCompDisable(int on) {
|
|||||||
EXT_DAQ_CTRL_CMP_LGC_ENBL_OFST);
|
EXT_DAQ_CTRL_CMP_LGC_ENBL_OFST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int setComparatorDisableTime(int64_t val) {
|
||||||
|
if (getChipVersion() != 11) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
if (val < 0) {
|
||||||
|
LOG(logERROR,
|
||||||
|
("Invalid comp disable time: %lld ns\n", (long long int)val));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
LOG(logINFO, ("Setting comp disable time %lld ns\n", (long long int)val));
|
||||||
|
val *= (1E-3 * CLK_RUN);
|
||||||
|
bus_w(COMP_DSBLE_TIME_REG, val);
|
||||||
|
|
||||||
|
// validate for tolerance
|
||||||
|
int64_t retval = getComparatorDisableTime();
|
||||||
|
val /= (1E-3 * CLK_RUN);
|
||||||
|
if (val != retval) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t getComparatorDisableTime() {
|
||||||
|
return bus_r(COMP_DSBLE_TIME_REG) / (1E-3 * CLK_RUN);
|
||||||
|
}
|
||||||
|
|
||||||
void configureASICTimer() {
|
void configureASICTimer() {
|
||||||
LOG(logINFO, ("Configuring ASIC Timer\n"));
|
LOG(logINFO, ("Configuring ASIC Timer\n"));
|
||||||
bus_w(ASIC_CTRL_REG, (bus_r(ASIC_CTRL_REG) & ~ASIC_CTRL_PRCHRG_TMR_MSK) |
|
bus_w(ASIC_CTRL_REG, (bus_r(ASIC_CTRL_REG) & ~ASIC_CTRL_PRCHRG_TMR_MSK) |
|
||||||
@ -1613,6 +2008,167 @@ void alignDeserializer() {
|
|||||||
bus_r(ADC_DSRLZR_3_REG) & (~(ADC_DSRLZR_3_RFRSH_ALGNMNT_MSK)));
|
bus_r(ADC_DSRLZR_3_REG) & (~(ADC_DSRLZR_3_RFRSH_ALGNMNT_MSK)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getFlipRows() {
|
||||||
|
return ((bus_r(CONFIG_REG) & CONFIG_BOTTOM_INVERT_STREAM_MSK) >>
|
||||||
|
CONFIG_BOTTOM_INVERT_STREAM_OFST);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFlipRows(int arg) {
|
||||||
|
if (arg >= 0) {
|
||||||
|
if (arg == 0) {
|
||||||
|
LOG(logINFO, ("Switching off bottom row flipping\n"));
|
||||||
|
bus_w(CONFIG_REG,
|
||||||
|
bus_r(CONFIG_REG) & ~CONFIG_BOTTOM_INVERT_STREAM_MSK);
|
||||||
|
} else {
|
||||||
|
LOG(logINFO, ("Switching on bottom row flipping\n"));
|
||||||
|
bus_w(CONFIG_REG,
|
||||||
|
bus_r(CONFIG_REG) | CONFIG_BOTTOM_INVERT_STREAM_MSK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int getFilterResistor() {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
uint32_t addr = CONFIG_V11_REG;
|
||||||
|
#else
|
||||||
|
uint32_t addr = CONFIG_V11_STATUS_REG;
|
||||||
|
#endif
|
||||||
|
// 0 for lower value, 1 for higher value
|
||||||
|
if (bus_r(addr) & CONFIG_V11_STATUS_FLTR_RSSTR_SMLR_MSK) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int setFilterResistor(int value) {
|
||||||
|
// lower resistor
|
||||||
|
if (value == 0) {
|
||||||
|
LOG(logINFO, ("Setting Lower Filter Resistor\n"));
|
||||||
|
bus_w(CONFIG_V11_REG,
|
||||||
|
bus_r(CONFIG_V11_REG) | CONFIG_V11_FLTR_RSSTR_SMLR_MSK);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
// higher resistor
|
||||||
|
else if (value == 1) {
|
||||||
|
LOG(logINFO, ("Setting Higher Filter Resistor\n"));
|
||||||
|
bus_w(CONFIG_V11_REG,
|
||||||
|
bus_r(CONFIG_V11_REG) & ~CONFIG_V11_FLTR_RSSTR_SMLR_MSK);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
LOG(logERROR, ("Could not set Filter Resistor. Invalid value %d\n", value));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getFilterCell() {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
uint32_t addr = CONFIG_V11_REG;
|
||||||
|
#else
|
||||||
|
uint32_t addr = CONFIG_V11_STATUS_REG;
|
||||||
|
#endif
|
||||||
|
uint32_t value = (bus_r(addr) & CONFIG_V11_FLTR_CLL_MSK) >> CONFIG_V11_FLTR_CLL_OFST;
|
||||||
|
// count number of bits = which icell
|
||||||
|
return (__builtin_popcount(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
void setFilterCell(int iCell) {
|
||||||
|
uint32_t value = 0;
|
||||||
|
// sets the corresponding cell and the cells before it
|
||||||
|
if (iCell != 0) {
|
||||||
|
value = iCell;
|
||||||
|
if (value > 1) {
|
||||||
|
value += (value - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uint32_t addr = CONFIG_V11_REG;
|
||||||
|
bus_w(addr, bus_r(addr) &~ CONFIG_V11_FLTR_CLL_MSK);
|
||||||
|
bus_w(addr, bus_r(addr) | ((value << CONFIG_V11_FLTR_CLL_OFST) & CONFIG_V11_FLTR_CLL_MSK));
|
||||||
|
LOG(logINFO, ("Setting Filter Cell to %d [Reg:0x%x]\n", iCell, bus_r(addr)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void disableCurrentSource() {
|
||||||
|
LOG(logINFO, ("Disabling Current Source\n"));
|
||||||
|
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_CRRNT_SRC_ENBL_MSK);
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableCurrentSource(int fix, uint64_t select, int normal) {
|
||||||
|
if (chipVersion == 11) {
|
||||||
|
LOG(logINFO, ("Enabling current source [fix:%d, select:%lld]\n", fix,
|
||||||
|
(long long int)select));
|
||||||
|
} else {
|
||||||
|
LOG(logINFO,
|
||||||
|
("Enabling current source [fix:%d, select:0x%llx, normal:%d]\n",
|
||||||
|
fix, (long long int)select, normal));
|
||||||
|
}
|
||||||
|
disableCurrentSource();
|
||||||
|
LOG(logINFO, ("\tSetting current source parameters\n"));
|
||||||
|
// fix
|
||||||
|
if (fix) {
|
||||||
|
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_CRRNT_SRC_CLMN_FIX_MSK);
|
||||||
|
} else {
|
||||||
|
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_CRRNT_SRC_CLMN_FIX_MSK);
|
||||||
|
}
|
||||||
|
if (chipVersion == 10) {
|
||||||
|
// select
|
||||||
|
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_CRRNT_SRC_CLMN_SLCT_MSK);
|
||||||
|
bus_w(DAQ_REG,
|
||||||
|
bus_r(DAQ_REG) | ((select << DAQ_CRRNT_SRC_CLMN_SLCT_OFST) &
|
||||||
|
DAQ_CRRNT_SRC_CLMN_SLCT_MSK));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// select
|
||||||
|
set64BitReg(select, CRRNT_SRC_COL_LSB_REG, CRRNT_SRC_COL_MSB_REG);
|
||||||
|
// normal
|
||||||
|
if (normal) {
|
||||||
|
bus_w(CONFIG_V11_REG,
|
||||||
|
bus_r(CONFIG_V11_REG) & ~CONFIG_V11_CRRNT_SRC_LOW_MSK);
|
||||||
|
} else {
|
||||||
|
bus_w(CONFIG_V11_REG,
|
||||||
|
bus_r(CONFIG_V11_REG) | CONFIG_V11_CRRNT_SRC_LOW_MSK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// validating before enabling current source
|
||||||
|
if (getFixCurrentSource() != fix || getSelectCurrentSource() != select) {
|
||||||
|
LOG(logERROR,
|
||||||
|
("Could not set fix or select parameters for current source.\n"))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// not validating normal because the status register might not update during
|
||||||
|
// acquisition
|
||||||
|
|
||||||
|
// enabling current source
|
||||||
|
LOG(logINFO, ("Enabling Current Source\n"));
|
||||||
|
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_CRRNT_SRC_ENBL_MSK);
|
||||||
|
}
|
||||||
|
|
||||||
|
int getCurrentSource() {
|
||||||
|
return ((bus_r(DAQ_REG) & DAQ_CRRNT_SRC_ENBL_MSK) >>
|
||||||
|
DAQ_CRRNT_SRC_ENBL_OFST);
|
||||||
|
}
|
||||||
|
|
||||||
|
int getFixCurrentSource() {
|
||||||
|
return ((bus_r(DAQ_REG) & DAQ_CRRNT_SRC_CLMN_FIX_MSK) >>
|
||||||
|
DAQ_CRRNT_SRC_CLMN_FIX_OFST);
|
||||||
|
}
|
||||||
|
|
||||||
|
int getNormalCurrentSource() {
|
||||||
|
if (getChipVersion() == 11) {
|
||||||
|
int low = ((bus_r(CONFIG_V11_STATUS_REG) &
|
||||||
|
CONFIG_V11_STATUS_CRRNT_SRC_LOW_MSK) >>
|
||||||
|
CONFIG_V11_STATUS_CRRNT_SRC_LOW_OFST);
|
||||||
|
return (low == 0 ? 1 : 0);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t getSelectCurrentSource() {
|
||||||
|
if (chipVersion == 10) {
|
||||||
|
return ((bus_r(DAQ_REG) & DAQ_CRRNT_SRC_CLMN_SLCT_MSK) >>
|
||||||
|
DAQ_CRRNT_SRC_CLMN_SLCT_OFST);
|
||||||
|
} else {
|
||||||
|
return get64BitReg(CRRNT_SRC_COL_LSB_REG, CRRNT_SRC_COL_MSB_REG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int getTenGigaFlowControl() {
|
int getTenGigaFlowControl() {
|
||||||
return ((bus_r(CONFIG_REG) & CONFIG_ETHRNT_FLW_CNTRL_MSK) >>
|
return ((bus_r(CONFIG_REG) & CONFIG_ETHRNT_FLW_CNTRL_MSK) >>
|
||||||
CONFIG_ETHRNT_FLW_CNTRL_OFST);
|
CONFIG_ETHRNT_FLW_CNTRL_OFST);
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
#include "sls/sls_detector_defs.h"
|
#include "sls/sls_detector_defs.h"
|
||||||
|
|
||||||
#define MIN_REQRD_VRSN_T_RD_API 0x171220
|
#define MIN_REQRD_VRSN_T_RD_API 0x171220
|
||||||
#define REQRD_FRMWRE_VRSN_BOARD2 0x210218 // 1.0 pcb
|
#define REQRD_FRMWRE_VRSN_BOARD2 0x210621 // 1.0 pcb (version = 010)
|
||||||
#define REQRD_FRMWRE_VRSN 0x200721 // 2.0 pcb
|
#define REQRD_FRMWRE_VRSN 0x210622 // 2.0 pcb (version = 011)
|
||||||
|
|
||||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||||
|
|
||||||
@ -62,6 +62,15 @@ enum DACINDEX {
|
|||||||
480, /* J_VREF_DS */ \
|
480, /* J_VREF_DS */ \
|
||||||
420 /* J_VREF_COMP */ \
|
420 /* J_VREF_COMP */ \
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define NUMSETTINGS (2)
|
||||||
|
#define NSPECIALDACS (3)
|
||||||
|
#define SPECIALDACINDEX {J_VREF_PRECH, J_VREF_DS, J_VREF_COMP};
|
||||||
|
#define SPECIAL_DEFAULT_DYNAMIC_GAIN_VALS \
|
||||||
|
{ 1000, 500, 400 }
|
||||||
|
#define SPECIAL_DEFAULT_DYNAMICHG0_GAIN_VALS \
|
||||||
|
{ 1500, 550, 450 }
|
||||||
|
|
||||||
enum NETWORKINDEX { TXN_FRAME, FLOWCTRL_10G };
|
enum NETWORKINDEX { TXN_FRAME, FLOWCTRL_10G };
|
||||||
enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
||||||
#define CLK_NAMES "run", "adc", "dbit"
|
#define CLK_NAMES "run", "adc", "dbit"
|
||||||
@ -77,6 +86,7 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
|||||||
#define CLK_SYNC (20) // MHz
|
#define CLK_SYNC (20) // MHz
|
||||||
#define ADC_CLK_INDEX (1)
|
#define ADC_CLK_INDEX (1)
|
||||||
#define DBIT_CLK_INDEX (0)
|
#define DBIT_CLK_INDEX (0)
|
||||||
|
#define CONFIG_FILE ("config_jungfrau.txt")
|
||||||
|
|
||||||
/** Default Parameters */
|
/** Default Parameters */
|
||||||
#define DEFAULT_NUM_FRAMES (100 * 1000 * 1000)
|
#define DEFAULT_NUM_FRAMES (100 * 1000 * 1000)
|
||||||
@ -87,24 +97,33 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
|||||||
#define DEFAULT_DELAY (0)
|
#define DEFAULT_DELAY (0)
|
||||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||||
#define DEFAULT_SETTINGS (DYNAMICGAIN)
|
#define DEFAULT_SETTINGS (GAIN0)
|
||||||
|
#define DEFAULT_GAINMODE (DYNAMIC)
|
||||||
#define DEFAULT_TX_UDP_PORT (0x7e9a)
|
#define DEFAULT_TX_UDP_PORT (0x7e9a)
|
||||||
#define DEFAULT_TMP_THRSHLD (65 * 1000) // milli degree Celsius
|
#define DEFAULT_TMP_THRSHLD (65 * 1000) // milli degree Celsius
|
||||||
#define DEFAULT_NUM_STRG_CLLS (0)
|
#define DEFAULT_NUM_STRG_CLLS (0)
|
||||||
#define DEFAULT_STRG_CLL_STRT (0xf)
|
#define DEFAULT_STRG_CLL_STRT (0xf)
|
||||||
|
#define DEFAULT_STRG_CLL_STRT_CHIP11 (0x3)
|
||||||
#define DEFAULT_STRG_CLL_DLY (0)
|
#define DEFAULT_STRG_CLL_DLY (0)
|
||||||
|
#define DEFAULT_FLIP_ROWS (0)
|
||||||
|
#define DEFAULT_FILTER_RESISTOR (1) // higher resistor
|
||||||
|
#define DEFAULT_FILTER_CELL (0)
|
||||||
|
|
||||||
#define HIGHVOLTAGE_MIN (60)
|
#define HIGHVOLTAGE_MIN (60)
|
||||||
#define HIGHVOLTAGE_MAX (200)
|
#define HIGHVOLTAGE_MAX (200)
|
||||||
#define DAC_MIN_MV (0)
|
#define DAC_MIN_MV (0)
|
||||||
#define DAC_MAX_MV (2500)
|
#define DAC_MAX_MV (2500)
|
||||||
|
#define MAX_FILTER_CELL_VAL (12)
|
||||||
|
|
||||||
/* Defines in the Firmware */
|
/* Defines in the Firmware */
|
||||||
#define MAX_TIMESLOT_VAL (0x1F)
|
#define MAX_TIMESLOT_VAL (0x1F)
|
||||||
#define MAX_THRESHOLD_TEMP_VAL (127999) // millidegrees
|
#define MAX_THRESHOLD_TEMP_VAL (127999) // millidegrees
|
||||||
#define MAX_STORAGE_CELL_VAL (15) // 0xF
|
#define MAX_STORAGE_CELL_VAL (15) // 0xF
|
||||||
|
#define MAX_STORAGE_CELL_CHIP11_VAL (3)
|
||||||
#define MAX_STORAGE_CELL_DLY_NS_VAL (ASIC_CTRL_EXPSRE_TMR_MAX_VAL)
|
#define MAX_STORAGE_CELL_DLY_NS_VAL (ASIC_CTRL_EXPSRE_TMR_MAX_VAL)
|
||||||
#define ACQ_TIME_MIN_CLOCK (2)
|
#define ACQ_TIME_MIN_CLOCK (2)
|
||||||
|
#define ASIC_FILTER_MAX_RES_VALUE (1)
|
||||||
|
#define MAX_SELECT_CHIP10_VAL (63)
|
||||||
|
|
||||||
#define MAX_PHASE_SHIFTS (240)
|
#define MAX_PHASE_SHIFTS (240)
|
||||||
#define BIT16_MASK (0xFFFF)
|
#define BIT16_MASK (0xFFFF)
|
||||||
|
Binary file not shown.
@ -61,6 +61,7 @@ uint8_t adcEnableMask_10g = 0;
|
|||||||
int32_t clkPhase[NUM_CLOCKS] = {};
|
int32_t clkPhase[NUM_CLOCKS] = {};
|
||||||
uint32_t clkFrequency[NUM_CLOCKS] = {40, 20, 20, 200};
|
uint32_t clkFrequency[NUM_CLOCKS] = {40, 20, 20, 200};
|
||||||
int dacValues[NDAC] = {};
|
int dacValues[NDAC] = {};
|
||||||
|
int defaultDacValues[NDAC] = DEFAULT_DAC_VALS;
|
||||||
// software limit that depends on the current chip on the ctb
|
// software limit that depends on the current chip on the ctb
|
||||||
int vLimit = 0;
|
int vLimit = 0;
|
||||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||||
@ -516,7 +517,7 @@ void setupDetector() {
|
|||||||
DAC_MAX_MV); // has to be before setvchip
|
DAC_MAX_MV); // has to be before setvchip
|
||||||
LTC2620_Disable();
|
LTC2620_Disable();
|
||||||
LTC2620_Configure();
|
LTC2620_Configure();
|
||||||
setDefaultDacs();
|
resetToDefaultDacs(0);
|
||||||
|
|
||||||
// altera pll
|
// altera pll
|
||||||
ALTERA_PLL_SetDefines(PLL_CNTRL_REG, PLL_PARAM_REG,
|
ALTERA_PLL_SetDefines(PLL_CNTRL_REG, PLL_PARAM_REG,
|
||||||
@ -613,20 +614,51 @@ void updateDataBytes() {
|
|||||||
dataBytes = analogDataBytes;
|
dataBytes = analogDataBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
int setDefaultDacs() {
|
int resetToDefaultDacs(int hardReset) {
|
||||||
|
// reset defaults to hardcoded defaults
|
||||||
|
if (hardReset) {
|
||||||
|
const int vals[] = DEFAULT_DAC_VALS;
|
||||||
|
for (int i = 0; i < NDAC; ++i) {
|
||||||
|
defaultDacValues[i] = vals[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// reset dacs to defaults
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
|
||||||
for (int i = 0; i < NDAC; ++i) {
|
for (int i = 0; i < NDAC; ++i) {
|
||||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
setDAC((enum DACINDEX)i, defaultDacValues[i], 0);
|
||||||
if (dacValues[i] != defaultvals[i]) {
|
if (dacValues[i] != defaultDacValues[i]) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
||||||
defaultvals[i], dacValues[i]));
|
defaultDacValues[i], dacValues[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
int getDefaultDac(enum DACINDEX index, enum detectorSettings sett,
|
||||||
|
int *retval) {
|
||||||
|
if (sett != UNDEFINED) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
if (index < 0 || index >= NDAC)
|
||||||
|
return FAIL;
|
||||||
|
*retval = defaultDacValues[index];
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int setDefaultDac(enum DACINDEX index, enum detectorSettings sett, int value) {
|
||||||
|
if (sett != UNDEFINED) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
if (index < 0 || index >= NDAC)
|
||||||
|
return FAIL;
|
||||||
|
|
||||||
|
char *dac_names[] = {DAC_NAMES};
|
||||||
|
LOG(logINFO, ("Setting Default Dac [%d - %s]: %d\n", (int)index,
|
||||||
|
dac_names[index], value));
|
||||||
|
defaultDacValues[index] = value;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* firmware functions (resets) */
|
/* firmware functions (resets) */
|
||||||
|
|
||||||
|
Binary file not shown.
@ -42,11 +42,15 @@ pthread_t pthread_virtual_tid;
|
|||||||
int64_t virtual_currentFrameNumber = 2;
|
int64_t virtual_currentFrameNumber = 2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum detectorSettings thisSettings;
|
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||||
sls_detector_module *detectorModules = NULL;
|
sls_detector_module *detectorModules = NULL;
|
||||||
int *detectorChans = NULL;
|
int *detectorChans = NULL;
|
||||||
int *detectorDacs = NULL;
|
int *detectorDacs = NULL;
|
||||||
int *channelMask = NULL;
|
int *channelMask = NULL;
|
||||||
|
int defaultDacValues[NDAC] = DEFAULT_DAC_VALS;
|
||||||
|
int defaultDacValue_standard[] = SPECIAL_DEFAULT_STANDARD_DAC_VALS;
|
||||||
|
int defaultDacValue_fast[] = SPECIAL_DEFAULT_FAST_DAC_VALS;
|
||||||
|
int defaultDacValue_highgain[] = SPECIAL_DEFAULT_HIGHGAIN_DAC_VALS;
|
||||||
|
|
||||||
int32_t clkPhase[NUM_CLOCKS] = {};
|
int32_t clkPhase[NUM_CLOCKS] = {};
|
||||||
uint32_t clkDivider[NUM_CLOCKS] = {};
|
uint32_t clkDivider[NUM_CLOCKS] = {};
|
||||||
@ -446,7 +450,7 @@ void setupDetector() {
|
|||||||
|
|
||||||
// defaults
|
// defaults
|
||||||
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
||||||
setDefaultDacs();
|
resetToDefaultDacs(0);
|
||||||
setASICDefaults();
|
setASICDefaults();
|
||||||
setADIFDefaults();
|
setADIFDefaults();
|
||||||
|
|
||||||
@ -523,21 +527,147 @@ void setupDetector() {
|
|||||||
setAllTrimbits(DEFAULT_TRIMBIT_VALUE);
|
setAllTrimbits(DEFAULT_TRIMBIT_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int setDefaultDacs() {
|
int resetToDefaultDacs(int hardReset) {
|
||||||
int ret = OK;
|
LOG(logINFOBLUE, ("Resetting %s to Default Dac values\n",
|
||||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
(hardReset == 1 ? "hard" : "")));
|
||||||
{
|
|
||||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
// reset defaults to hardcoded defaults
|
||||||
|
if (hardReset) {
|
||||||
|
const int vals[] = DEFAULT_DAC_VALS;
|
||||||
for (int i = 0; i < NDAC; ++i) {
|
for (int i = 0; i < NDAC; ++i) {
|
||||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
defaultDacValues[i] = vals[i];
|
||||||
if (detectorDacs[i] != defaultvals[i]) {
|
}
|
||||||
ret = FAIL;
|
const int vals_standard[] = SPECIAL_DEFAULT_STANDARD_DAC_VALS;
|
||||||
|
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||||
|
defaultDacValue_standard[i] = vals_standard[i];
|
||||||
|
}
|
||||||
|
const int vals_fast[] = SPECIAL_DEFAULT_FAST_DAC_VALS;
|
||||||
|
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||||
|
defaultDacValue_fast[i] = vals_fast[i];
|
||||||
|
}
|
||||||
|
const int vals_highgain[] = SPECIAL_DEFAULT_HIGHGAIN_DAC_VALS;
|
||||||
|
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||||
|
defaultDacValue_highgain[i] = vals_highgain[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// remember settings
|
||||||
|
enum detectorSettings oldSettings = thisSettings;
|
||||||
|
|
||||||
|
// reset dacs to defaults
|
||||||
|
const int specialDacs[] = SPECIALDACINDEX;
|
||||||
|
for (int i = 0; i < NDAC; ++i) {
|
||||||
|
int value = defaultDacValues[i];
|
||||||
|
|
||||||
|
for (int j = 0; j < NSPECIALDACS; ++j) {
|
||||||
|
// special dac: replace default value
|
||||||
|
if (specialDacs[j] == i) {
|
||||||
|
switch (oldSettings) {
|
||||||
|
case STANDARD:
|
||||||
|
value = defaultDacValue_standard[j];
|
||||||
|
break;
|
||||||
|
case FAST:
|
||||||
|
value = defaultDacValue_fast[j];
|
||||||
|
break;
|
||||||
|
case HIGHGAIN:
|
||||||
|
value = defaultDacValue_highgain[j];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set to defualt
|
||||||
|
setDAC((enum DACINDEX)i, value, 0);
|
||||||
|
if (detectorDacs[i] != value) {
|
||||||
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
||||||
defaultvals[i], detectorDacs[i]));
|
value, detectorDacs[i]));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getDefaultDac(enum DACINDEX index, enum detectorSettings sett,
|
||||||
|
int *retval) {
|
||||||
|
|
||||||
|
// settings only for special dacs
|
||||||
|
if (sett != UNDEFINED) {
|
||||||
|
const int specialDacs[] = SPECIALDACINDEX;
|
||||||
|
// find special dac index
|
||||||
|
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||||
|
if ((int)index == specialDacs[i]) {
|
||||||
|
switch (sett) {
|
||||||
|
case STANDARD:
|
||||||
|
*retval = defaultDacValue_standard[i];
|
||||||
|
return OK;
|
||||||
|
case FAST:
|
||||||
|
*retval = defaultDacValue_fast[i];
|
||||||
|
return OK;
|
||||||
|
case HIGHGAIN:
|
||||||
|
*retval = defaultDacValue_highgain[i];
|
||||||
|
return OK;
|
||||||
|
// unknown settings
|
||||||
|
default:
|
||||||
|
return FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
// not a special dac
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index < 0 || index >= NDAC)
|
||||||
|
return FAIL;
|
||||||
|
*retval = defaultDacValues[index];
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int setDefaultDac(enum DACINDEX index, enum detectorSettings sett, int value) {
|
||||||
|
char *dac_names[] = {DAC_NAMES};
|
||||||
|
|
||||||
|
// settings only for special dacs
|
||||||
|
if (sett != UNDEFINED) {
|
||||||
|
const int specialDacs[] = SPECIALDACINDEX;
|
||||||
|
// find special dac index
|
||||||
|
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||||
|
if ((int)index == specialDacs[i]) {
|
||||||
|
switch (sett) {
|
||||||
|
case STANDARD:
|
||||||
|
LOG(logINFO,
|
||||||
|
("Setting Default Dac [%d - %s, standard]: %d\n",
|
||||||
|
(int)index, dac_names[index], value));
|
||||||
|
defaultDacValue_standard[i] = value;
|
||||||
|
return OK;
|
||||||
|
case FAST:
|
||||||
|
LOG(logINFO, ("Setting Default Dac [%d - %s, fast]: %d\n",
|
||||||
|
(int)index, dac_names[index], value));
|
||||||
|
defaultDacValue_fast[i] = value;
|
||||||
|
return OK;
|
||||||
|
case HIGHGAIN:
|
||||||
|
LOG(logINFO,
|
||||||
|
("Setting Default Dac [%d - %s, highgain]: %d\n",
|
||||||
|
(int)index, dac_names[index], value));
|
||||||
|
defaultDacValue_highgain[i] = value;
|
||||||
|
return OK;
|
||||||
|
// unknown settings
|
||||||
|
default:
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// not a special dac
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index < 0 || index >= NDAC)
|
||||||
|
return FAIL;
|
||||||
|
LOG(logINFO, ("Setting Default Dac [%d - %s]: %d\n", (int)index,
|
||||||
|
dac_names[index], value));
|
||||||
|
defaultDacValues[index] = value;
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setASICDefaults() {
|
void setASICDefaults() {
|
||||||
@ -1201,24 +1331,19 @@ int getAllTrimbits() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum detectorSettings setSettings(enum detectorSettings sett) {
|
enum detectorSettings setSettings(enum detectorSettings sett) {
|
||||||
|
int *dacVals = NULL;
|
||||||
switch (sett) {
|
switch (sett) {
|
||||||
case STANDARD:
|
case STANDARD:
|
||||||
LOG(logINFOBLUE, ("Setting to standard settings\n"));
|
LOG(logINFOBLUE, ("Setting to standard settings\n"));
|
||||||
thisSettings = sett;
|
dacVals = defaultDacValue_standard;
|
||||||
setDAC(M_VRPREAMP, DEFAULT_STANDARD_VRPREAMP, 0);
|
|
||||||
setDAC(M_VRSHAPER, DEFAULT_STANDARD_VRSHAPER, 0);
|
|
||||||
break;
|
break;
|
||||||
case FAST:
|
case FAST:
|
||||||
LOG(logINFOBLUE, ("Setting to fast settings\n"));
|
LOG(logINFOBLUE, ("Setting to fast settings\n"));
|
||||||
thisSettings = sett;
|
dacVals = defaultDacValue_fast;
|
||||||
setDAC(M_VRPREAMP, DEFAULT_FAST_VRPREAMP, 0);
|
|
||||||
setDAC(M_VRSHAPER, DEFAULT_FAST_VRSHAPER, 0);
|
|
||||||
break;
|
break;
|
||||||
case HIGHGAIN:
|
case HIGHGAIN:
|
||||||
LOG(logINFOBLUE, ("Setting to high gain settings\n"));
|
LOG(logINFOBLUE, ("Setting to high gain settings\n"));
|
||||||
thisSettings = sett;
|
dacVals = defaultDacValue_highgain;
|
||||||
setDAC(M_VRPREAMP, DEFAULT_HIGHGAIN_VRPREAMP, 0);
|
|
||||||
setDAC(M_VRSHAPER, DEFAULT_HIGHGAIN_VRSHAPER, 0);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG(logERROR,
|
LOG(logERROR,
|
||||||
@ -1226,34 +1351,54 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
|||||||
return thisSettings;
|
return thisSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
thisSettings = sett;
|
||||||
|
|
||||||
|
// set special dacs
|
||||||
|
const int specialDacs[] = SPECIALDACINDEX;
|
||||||
|
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||||
|
setDAC(specialDacs[i], dacVals[i], 0);
|
||||||
|
}
|
||||||
|
|
||||||
LOG(logINFO, ("Settings: %d\n", thisSettings));
|
LOG(logINFO, ("Settings: %d\n", thisSettings));
|
||||||
return thisSettings;
|
return thisSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void validateSettings() {
|
void validateSettings() {
|
||||||
if (detectorDacs[M_VRPREAMP] == DEFAULT_STANDARD_VRPREAMP &&
|
// if any special dac value is changed individually => undefined
|
||||||
detectorDacs[M_VRSHAPER] == DEFAULT_STANDARD_VRSHAPER) {
|
const int specialDacs[NSPECIALDACS] = SPECIALDACINDEX;
|
||||||
if (thisSettings != STANDARD) {
|
int *specialDacValues[] = {defaultDacValue_standard, defaultDacValue_fast,
|
||||||
thisSettings = STANDARD;
|
defaultDacValue_highgain};
|
||||||
LOG(logINFOBLUE, ("Validated Settings changed to standard!\n"));
|
int settList[] = {STANDARD, FAST, HIGHGAIN};
|
||||||
|
|
||||||
|
enum detectorSettings sett = UNDEFINED;
|
||||||
|
for (int isett = 0; isett != NUMSETTINGS; ++isett) {
|
||||||
|
|
||||||
|
// assume it matches current setting in list
|
||||||
|
sett = settList[isett];
|
||||||
|
// if one value does not match, = undefined
|
||||||
|
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||||
|
if (getDAC(specialDacs[i], 0) != specialDacValues[isett][i]) {
|
||||||
|
sett = UNDEFINED;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else if (detectorDacs[M_VRPREAMP] == DEFAULT_FAST_VRPREAMP &&
|
|
||||||
detectorDacs[M_VRSHAPER] == DEFAULT_FAST_VRSHAPER) {
|
|
||||||
if (thisSettings != FAST) {
|
|
||||||
thisSettings = FAST;
|
|
||||||
LOG(logINFOBLUE, ("Validated Settings changed to fast!\n"));
|
|
||||||
}
|
}
|
||||||
} else if (detectorDacs[M_VRPREAMP] == DEFAULT_HIGHGAIN_VRPREAMP &&
|
|
||||||
detectorDacs[M_VRSHAPER] == DEFAULT_HIGHGAIN_VRSHAPER) {
|
// all values matchd a setting
|
||||||
if (thisSettings != HIGHGAIN) {
|
if (sett != UNDEFINED) {
|
||||||
thisSettings = HIGHGAIN;
|
break;
|
||||||
LOG(logINFOBLUE, ("Validated Settings changed to highgain!\n"));
|
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
thisSettings = UNDEFINED;
|
// update settings
|
||||||
LOG(logWARNING,
|
if (thisSettings != sett) {
|
||||||
("Settings set to undefined [vrpreamp: %d, vrshaper: %d]\n",
|
LOG(logINFOBLUE,
|
||||||
detectorDacs[M_VRPREAMP], detectorDacs[M_VRSHAPER]));
|
("Validated settings to %s (%d)\n",
|
||||||
|
(sett == STANDARD
|
||||||
|
? "standard"
|
||||||
|
: (sett == FAST
|
||||||
|
? "fast"
|
||||||
|
: (sett == HIGHGAIN ? "highgain" : "undefined"))),
|
||||||
|
sett));
|
||||||
|
thisSettings = sett;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1335,10 +1480,13 @@ void setGeneralDAC(enum DACINDEX ind, int val, int mV) {
|
|||||||
detectorDacs[ind] = dacval;
|
detectorDacs[ind] = dacval;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (ind == M_VRPREAMP || ind == M_VRSHAPER) {
|
const int specialDacs[NSPECIALDACS] = SPECIALDACINDEX;
|
||||||
|
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||||
|
if ((int)ind == specialDacs[i]) {
|
||||||
validateSettings();
|
validateSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int getDAC(enum DACINDEX ind, int mV) {
|
int getDAC(enum DACINDEX ind, int mV) {
|
||||||
if (ind == M_VTHRESHOLD) {
|
if (ind == M_VTHRESHOLD) {
|
||||||
@ -2425,6 +2573,7 @@ int setChipStatusRegister(int csr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int setGainCaps(int caps) {
|
int setGainCaps(int caps) {
|
||||||
|
LOG(logINFO, ("Setting gain caps to: %u\n", caps));
|
||||||
// Update only gain caps, leave the rest of the CSR unchanged
|
// Update only gain caps, leave the rest of the CSR unchanged
|
||||||
int csr = getChipStatusRegister();
|
int csr = getChipStatusRegister();
|
||||||
csr &= ~GAIN_MASK;
|
csr &= ~GAIN_MASK;
|
||||||
|
@ -42,13 +42,6 @@
|
|||||||
#define DEFAULT_TRIMBIT_VALUE (0)
|
#define DEFAULT_TRIMBIT_VALUE (0)
|
||||||
#define DEFAULT_COUNTER_DISABLED_VTH_VAL (2800)
|
#define DEFAULT_COUNTER_DISABLED_VTH_VAL (2800)
|
||||||
|
|
||||||
#define DEFAULT_STANDARD_VRPREAMP (1100)
|
|
||||||
#define DEFAULT_FAST_VRPREAMP (300)
|
|
||||||
#define DEFAULT_HIGHGAIN_VRPREAMP (1300)
|
|
||||||
#define DEFAULT_STANDARD_VRSHAPER (1280)
|
|
||||||
#define DEFAULT_FAST_VRSHAPER (1500)
|
|
||||||
#define DEFAULT_HIGHGAIN_VRSHAPER (1100)
|
|
||||||
|
|
||||||
#define DEFAULT_READOUT_C0 (10) //(100000000) // rdo_clk, 100 MHz
|
#define DEFAULT_READOUT_C0 (10) //(100000000) // rdo_clk, 100 MHz
|
||||||
#define DEFAULT_READOUT_C1 (10) //(100000000) // smp sample clk (x2), 100 MHz
|
#define DEFAULT_READOUT_C1 (10) //(100000000) // smp sample clk (x2), 100 MHz
|
||||||
#define DEFAULT_SYSTEM_C0 (10) //(100000000) // run_clk, 100 MHz
|
#define DEFAULT_SYSTEM_C0 (10) //(100000000) // run_clk, 100 MHz
|
||||||
@ -118,6 +111,17 @@ enum DACINDEX {
|
|||||||
2800, /* vTrim */ \
|
2800, /* vTrim */ \
|
||||||
800 /* VdcSh */ \
|
800 /* VdcSh */ \
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define NUMSETTINGS (3)
|
||||||
|
#define NSPECIALDACS (2)
|
||||||
|
#define SPECIALDACINDEX {M_VRPREAMP, M_VRSHAPER};
|
||||||
|
#define SPECIAL_DEFAULT_STANDARD_DAC_VALS \
|
||||||
|
{ 1100, 1280 }
|
||||||
|
#define SPECIAL_DEFAULT_FAST_DAC_VALS \
|
||||||
|
{ 300, 1500 }
|
||||||
|
#define SPECIAL_DEFAULT_HIGHGAIN_DAC_VALS \
|
||||||
|
{ 1300, 1100 }
|
||||||
|
|
||||||
enum CLKINDEX {
|
enum CLKINDEX {
|
||||||
READOUT_C0,
|
READOUT_C0,
|
||||||
READOUT_C1,
|
READOUT_C1,
|
||||||
|
@ -87,6 +87,7 @@ u_int16_t getHardwareSerialNumber();
|
|||||||
#endif
|
#endif
|
||||||
#ifdef JUNGFRAUD
|
#ifdef JUNGFRAUD
|
||||||
int isHardwareVersion2();
|
int isHardwareVersion2();
|
||||||
|
int getChipVersion();
|
||||||
#endif
|
#endif
|
||||||
#if defined(EIGERD) || defined(MYTHEN3D)
|
#if defined(EIGERD) || defined(MYTHEN3D)
|
||||||
void readDetectorNumber();
|
void readDetectorNumber();
|
||||||
@ -116,13 +117,15 @@ void updateDataBytes();
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CHIPTESTBOARDD
|
#ifndef CHIPTESTBOARDD
|
||||||
int setDefaultDacs();
|
int resetToDefaultDacs(int hardReset);
|
||||||
|
int getDefaultDac(enum DACINDEX index, enum detectorSettings sett, int *retval);
|
||||||
|
int setDefaultDac(enum DACINDEX index, enum detectorSettings sett, int value);
|
||||||
#endif
|
#endif
|
||||||
#ifdef MYTHEN3D
|
#ifdef MYTHEN3D
|
||||||
void setASICDefaults();
|
void setASICDefaults();
|
||||||
void setADIFDefaults();
|
void setADIFDefaults();
|
||||||
#endif
|
#endif
|
||||||
#if defined(GOTTHARD2D) || defined(EIGERD)
|
#if defined(GOTTHARD2D) || defined(EIGERD) || defined(JUNGFRAUD)
|
||||||
int readConfigFile();
|
int readConfigFile();
|
||||||
#endif
|
#endif
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
@ -199,6 +202,7 @@ int getReadoutMode();
|
|||||||
// parameters - timer
|
// parameters - timer
|
||||||
#ifdef JUNGFRAUD
|
#ifdef JUNGFRAUD
|
||||||
int selectStoragecellStart(int pos);
|
int selectStoragecellStart(int pos);
|
||||||
|
int getMaxStoragecellStart();
|
||||||
#endif
|
#endif
|
||||||
#if defined(JUNGFRAUD) || defined(EIGERD)
|
#if defined(JUNGFRAUD) || defined(EIGERD)
|
||||||
int setNextFrameNumber(uint64_t value);
|
int setNextFrameNumber(uint64_t value);
|
||||||
@ -293,10 +297,11 @@ int getAllTrimbits();
|
|||||||
#ifndef CHIPTESTBOARDD
|
#ifndef CHIPTESTBOARDD
|
||||||
enum detectorSettings setSettings(enum detectorSettings sett);
|
enum detectorSettings setSettings(enum detectorSettings sett);
|
||||||
#endif
|
#endif
|
||||||
#ifdef MYTHEN3D
|
|
||||||
void validateSettings();
|
|
||||||
#endif
|
|
||||||
enum detectorSettings getSettings();
|
enum detectorSettings getSettings();
|
||||||
|
#ifdef JUNGFRAUD
|
||||||
|
enum gainMode getGainMode();
|
||||||
|
void setGainMode(enum gainMode mode);
|
||||||
|
#endif
|
||||||
|
|
||||||
// parameters - threshold
|
// parameters - threshold
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
@ -439,7 +444,11 @@ void setDigitalIODelay(uint64_t pinMask, int delay);
|
|||||||
#ifdef JUNGFRAUD
|
#ifdef JUNGFRAUD
|
||||||
void initReadoutConfiguration();
|
void initReadoutConfiguration();
|
||||||
int powerChip(int on);
|
int powerChip(int on);
|
||||||
|
int isChipConfigured();
|
||||||
|
void configureChip();
|
||||||
int autoCompDisable(int on);
|
int autoCompDisable(int on);
|
||||||
|
int setComparatorDisableTime(int64_t val);
|
||||||
|
int64_t getComparatorDisableTime();
|
||||||
void configureASICTimer();
|
void configureASICTimer();
|
||||||
int setClockDivider(enum CLKINDEX ind, int val);
|
int setClockDivider(enum CLKINDEX ind, int val);
|
||||||
int getClockDivider(enum CLKINDEX ind);
|
int getClockDivider(enum CLKINDEX ind);
|
||||||
@ -451,6 +460,18 @@ int setThresholdTemperature(int val);
|
|||||||
int setTemperatureControl(int val);
|
int setTemperatureControl(int val);
|
||||||
int setTemperatureEvent(int val);
|
int setTemperatureEvent(int val);
|
||||||
void alignDeserializer();
|
void alignDeserializer();
|
||||||
|
int getFlipRows();
|
||||||
|
void setFlipRows(int arg);
|
||||||
|
int setFilterResistor(int value);
|
||||||
|
int getFilterResistor();
|
||||||
|
int getFilterCell();
|
||||||
|
void setFilterCell(int iCell);
|
||||||
|
void disableCurrentSource();
|
||||||
|
void enableCurrentSource(int fix, uint64_t select, int normal);
|
||||||
|
int getCurrentSource();
|
||||||
|
int getFixCurrentSource();
|
||||||
|
int getNormalCurrentSource();
|
||||||
|
uint64_t getSelectCurrentSource();
|
||||||
|
|
||||||
// eiger specific - iodelay, pulse, rate, temp, activate, delay nw parameter
|
// eiger specific - iodelay, pulse, rate, temp, activate, delay nw parameter
|
||||||
#elif EIGERD
|
#elif EIGERD
|
||||||
@ -522,8 +543,8 @@ int configureASICGlobalSettings();
|
|||||||
enum burstMode getBurstMode();
|
enum burstMode getBurstMode();
|
||||||
int setCDSGain(int enable);
|
int setCDSGain(int enable);
|
||||||
int getCDSGain();
|
int getCDSGain();
|
||||||
int setFilter(int value);
|
int setFilterResistor(int value);
|
||||||
int getFilter();
|
int getFilterResistor();
|
||||||
void setCurrentSource(int value);
|
void setCurrentSource(int value);
|
||||||
int getCurrentSource();
|
int getCurrentSource();
|
||||||
void setTimingSource(enum timingSourceType value);
|
void setTimingSource(enum timingSourceType value);
|
||||||
|
@ -40,6 +40,7 @@ int get_adc(int);
|
|||||||
int write_register(int);
|
int write_register(int);
|
||||||
int read_register(int);
|
int read_register(int);
|
||||||
int set_module(int);
|
int set_module(int);
|
||||||
|
void validate_settings(enum detectorSettings sett);
|
||||||
int set_settings(int);
|
int set_settings(int);
|
||||||
int get_threshold_energy(int);
|
int get_threshold_energy(int);
|
||||||
int acquire(int blocking, int file_des);
|
int acquire(int blocking, int file_des);
|
||||||
@ -228,8 +229,8 @@ int set_scan(int);
|
|||||||
int get_scan_error_message(int);
|
int get_scan_error_message(int);
|
||||||
int get_cds_gain(int);
|
int get_cds_gain(int);
|
||||||
int set_cds_gain(int);
|
int set_cds_gain(int);
|
||||||
int get_filter(int);
|
int get_filter_resistor(int);
|
||||||
int set_filter(int);
|
int set_filter_resistor(int);
|
||||||
int get_adc_config(int);
|
int get_adc_config(int);
|
||||||
int set_adc_config(int);
|
int set_adc_config(int);
|
||||||
int get_bad_channels(int);
|
int get_bad_channels(int);
|
||||||
@ -238,7 +239,7 @@ int reconfigure_udp(int);
|
|||||||
int validate_udp_configuration(int);
|
int validate_udp_configuration(int);
|
||||||
int get_bursts_left(int);
|
int get_bursts_left(int);
|
||||||
int start_readout(int);
|
int start_readout(int);
|
||||||
int set_default_dacs(int);
|
int reset_to_default_dacs(int);
|
||||||
int is_virtual(int);
|
int is_virtual(int);
|
||||||
int get_pattern(int);
|
int get_pattern(int);
|
||||||
int load_default_pattern(int);
|
int load_default_pattern(int);
|
||||||
@ -253,3 +254,14 @@ int get_veto_stream(int);
|
|||||||
int set_veto_stream(int);
|
int set_veto_stream(int);
|
||||||
int get_veto_algorithm(int);
|
int get_veto_algorithm(int);
|
||||||
int set_veto_algorithm(int);
|
int set_veto_algorithm(int);
|
||||||
|
int get_chip_version(int);
|
||||||
|
int get_default_dac(int);
|
||||||
|
int set_default_dac(int);
|
||||||
|
int get_gain_mode(int);
|
||||||
|
int set_gain_mode(int);
|
||||||
|
int get_comp_disable_time(int);
|
||||||
|
int set_comp_disable_time(int);
|
||||||
|
int get_flip_rows(int);
|
||||||
|
int set_flip_rows(int);
|
||||||
|
int get_filter_cell(int);
|
||||||
|
int set_filter_cell(int);
|
@ -354,8 +354,8 @@ void function_table() {
|
|||||||
flist[F_GET_SCAN_ERROR_MESSAGE] = &get_scan_error_message;
|
flist[F_GET_SCAN_ERROR_MESSAGE] = &get_scan_error_message;
|
||||||
flist[F_GET_CDS_GAIN] = &get_cds_gain;
|
flist[F_GET_CDS_GAIN] = &get_cds_gain;
|
||||||
flist[F_SET_CDS_GAIN] = &set_cds_gain;
|
flist[F_SET_CDS_GAIN] = &set_cds_gain;
|
||||||
flist[F_GET_FILTER] = &get_filter;
|
flist[F_GET_FILTER_RESISTOR] = &get_filter_resistor;
|
||||||
flist[F_SET_FILTER] = &set_filter;
|
flist[F_SET_FILTER_RESISTOR] = &set_filter_resistor;
|
||||||
flist[F_GET_ADC_CONFIGURATION] = &get_adc_config;
|
flist[F_GET_ADC_CONFIGURATION] = &get_adc_config;
|
||||||
flist[F_SET_ADC_CONFIGURATION] = &set_adc_config;
|
flist[F_SET_ADC_CONFIGURATION] = &set_adc_config;
|
||||||
flist[F_GET_BAD_CHANNELS] = &get_bad_channels;
|
flist[F_GET_BAD_CHANNELS] = &get_bad_channels;
|
||||||
@ -364,7 +364,7 @@ void function_table() {
|
|||||||
flist[F_VALIDATE_UDP_CONFIG] = &validate_udp_configuration;
|
flist[F_VALIDATE_UDP_CONFIG] = &validate_udp_configuration;
|
||||||
flist[F_GET_BURSTS_LEFT] = &get_bursts_left;
|
flist[F_GET_BURSTS_LEFT] = &get_bursts_left;
|
||||||
flist[F_START_READOUT] = &start_readout;
|
flist[F_START_READOUT] = &start_readout;
|
||||||
flist[F_SET_DEFAULT_DACS] = &set_default_dacs;
|
flist[F_RESET_TO_DEFAULT_DACS] = &reset_to_default_dacs;
|
||||||
flist[F_IS_VIRTUAL] = &is_virtual;
|
flist[F_IS_VIRTUAL] = &is_virtual;
|
||||||
flist[F_GET_PATTERN] = &get_pattern;
|
flist[F_GET_PATTERN] = &get_pattern;
|
||||||
flist[F_LOAD_DEFAULT_PATTERN] = &load_default_pattern;
|
flist[F_LOAD_DEFAULT_PATTERN] = &load_default_pattern;
|
||||||
@ -379,6 +379,17 @@ void function_table() {
|
|||||||
flist[F_SET_VETO_STREAM] = &set_veto_stream;
|
flist[F_SET_VETO_STREAM] = &set_veto_stream;
|
||||||
flist[F_GET_VETO_ALGORITHM] = &get_veto_algorithm;
|
flist[F_GET_VETO_ALGORITHM] = &get_veto_algorithm;
|
||||||
flist[F_SET_VETO_ALGORITHM] = &set_veto_algorithm;
|
flist[F_SET_VETO_ALGORITHM] = &set_veto_algorithm;
|
||||||
|
flist[F_GET_CHIP_VERSION] = &get_chip_version;
|
||||||
|
flist[F_GET_DEFAULT_DAC] = &get_default_dac;
|
||||||
|
flist[F_SET_DEFAULT_DAC] = &set_default_dac;
|
||||||
|
flist[F_GET_GAIN_MODE] = &get_gain_mode;
|
||||||
|
flist[F_SET_GAIN_MODE] = &set_gain_mode;
|
||||||
|
flist[F_GET_COMP_DISABLE_TIME] = &get_comp_disable_time;
|
||||||
|
flist[F_SET_COMP_DISABLE_TIME] = &set_comp_disable_time;
|
||||||
|
flist[F_GET_FLIP_ROWS] = &get_flip_rows;
|
||||||
|
flist[F_SET_FLIP_ROWS] = &set_flip_rows;
|
||||||
|
flist[F_GET_FILTER_CELL] = &get_filter_cell;
|
||||||
|
flist[F_SET_FILTER_CELL] = &set_filter_cell;
|
||||||
|
|
||||||
// check
|
// check
|
||||||
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
||||||
@ -748,8 +759,6 @@ enum DACINDEX getDACIndex(enum dacIndex ind) {
|
|||||||
case IB_TESTC:
|
case IB_TESTC:
|
||||||
serverDacIndex = G_IB_TESTC;
|
serverDacIndex = G_IB_TESTC;
|
||||||
break;
|
break;
|
||||||
case HIGH_VOLTAGE:
|
|
||||||
break;
|
|
||||||
#elif EIGERD
|
#elif EIGERD
|
||||||
case VTHRESHOLD:
|
case VTHRESHOLD:
|
||||||
serverDacIndex = E_VTHRESHOLD;
|
serverDacIndex = E_VTHRESHOLD;
|
||||||
@ -802,13 +811,7 @@ enum DACINDEX getDACIndex(enum dacIndex ind) {
|
|||||||
case VISHAPER:
|
case VISHAPER:
|
||||||
serverDacIndex = E_VISHAPER;
|
serverDacIndex = E_VISHAPER;
|
||||||
break;
|
break;
|
||||||
case HIGH_VOLTAGE:
|
|
||||||
case IO_DELAY:
|
|
||||||
break;
|
|
||||||
#elif CHIPTESTBOARDD
|
#elif CHIPTESTBOARDD
|
||||||
case ADC_VPP:
|
|
||||||
case HIGH_VOLTAGE:
|
|
||||||
break;
|
|
||||||
case V_POWER_A:
|
case V_POWER_A:
|
||||||
serverDacIndex = D_PWR_A;
|
serverDacIndex = D_PWR_A;
|
||||||
break;
|
break;
|
||||||
@ -827,8 +830,6 @@ enum DACINDEX getDACIndex(enum dacIndex ind) {
|
|||||||
case V_POWER_CHIP:
|
case V_POWER_CHIP:
|
||||||
serverDacIndex = D_PWR_CHIP;
|
serverDacIndex = D_PWR_CHIP;
|
||||||
break;
|
break;
|
||||||
case V_LIMIT:
|
|
||||||
break;
|
|
||||||
#elif MOENCHD
|
#elif MOENCHD
|
||||||
case VBP_COLBUF:
|
case VBP_COLBUF:
|
||||||
serverDacIndex = MO_VBP_COLBUF;
|
serverDacIndex = MO_VBP_COLBUF;
|
||||||
@ -854,14 +855,7 @@ enum DACINDEX getDACIndex(enum dacIndex ind) {
|
|||||||
case IBIAS_SFP:
|
case IBIAS_SFP:
|
||||||
serverDacIndex = MO_IBIAS_SFP;
|
serverDacIndex = MO_IBIAS_SFP;
|
||||||
break;
|
break;
|
||||||
case ADC_VPP:
|
|
||||||
case HIGH_VOLTAGE:
|
|
||||||
case V_LIMIT:
|
|
||||||
break;
|
|
||||||
|
|
||||||
#elif MYTHEN3D
|
#elif MYTHEN3D
|
||||||
case HIGH_VOLTAGE:
|
|
||||||
break;
|
|
||||||
case VCASSH:
|
case VCASSH:
|
||||||
serverDacIndex = M_VCASSH;
|
serverDacIndex = M_VCASSH;
|
||||||
break;
|
break;
|
||||||
@ -1003,11 +997,29 @@ enum DACINDEX getDACIndex(enum dacIndex ind) {
|
|||||||
|
|
||||||
int validateAndSetDac(enum dacIndex ind, int val, int mV) {
|
int validateAndSetDac(enum dacIndex ind, int val, int mV) {
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
enum DACINDEX serverDacIndex = getDACIndex(ind);
|
enum DACINDEX serverDacIndex = 0;
|
||||||
|
|
||||||
if (ret == OK) {
|
// valid enums
|
||||||
|
switch (ind) {
|
||||||
|
case HIGH_VOLTAGE:
|
||||||
|
#ifdef EIGERD
|
||||||
|
case IO_DELAY:
|
||||||
|
#elif CHIPTESTBOARDD
|
||||||
|
case ADC_VPP:
|
||||||
|
case V_LIMIT:
|
||||||
|
#elif MOENCHD
|
||||||
|
case ADC_VPP:
|
||||||
|
case V_LIMIT:
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
serverDacIndex = getDACIndex(ind);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ret == FAIL) {
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
switch (ind) {
|
switch (ind) {
|
||||||
|
|
||||||
// adc vpp
|
// adc vpp
|
||||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||||
case ADC_VPP:
|
case ADC_VPP:
|
||||||
@ -1236,7 +1248,6 @@ int validateAndSetDac(enum dacIndex ind, int val, int mV) {
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1530,32 +1541,12 @@ int set_module(int file_des) {
|
|||||||
else if (Server_VerifyLock() == OK) {
|
else if (Server_VerifyLock() == OK) {
|
||||||
// check index
|
// check index
|
||||||
|
|
||||||
#if !(defined(EIGERD) || defined(MYTHEN3D))
|
#ifndef EIGERD
|
||||||
// TODO! Check if this is used for any detector
|
validate_settings((enum detectorSettings)(module.reg));
|
||||||
switch (module.reg) {
|
|
||||||
#ifdef JUNGFRAUD
|
|
||||||
case DYNAMICGAIN:
|
|
||||||
case DYNAMICHG0:
|
|
||||||
case FIXGAIN1:
|
|
||||||
case FIXGAIN2:
|
|
||||||
case FORCESWITCHG1:
|
|
||||||
case FORCESWITCHG2:
|
|
||||||
#elif GOTTHARDD
|
|
||||||
case DYNAMICGAIN:
|
|
||||||
case HIGHGAIN:
|
|
||||||
case LOWGAIN:
|
|
||||||
case MEDIUMGAIN:
|
|
||||||
case VERYHIGHGAIN:
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
modeNotImplemented("Settings", (int)module.reg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
ret = setModule(module, mess);
|
ret = setModule(module, mess);
|
||||||
enum detectorSettings retval = getSettings();
|
enum detectorSettings retval = getSettings();
|
||||||
#if !(defined(EIGERD) || defined(MYTHEN3D))
|
#ifndef EIGERD
|
||||||
validate(&ret, mess, module.reg, (int)retval, "set module (settings)",
|
validate(&ret, mess, module.reg, (int)retval, "set module (settings)",
|
||||||
DEC);
|
DEC);
|
||||||
#endif
|
#endif
|
||||||
@ -1568,33 +1559,14 @@ int set_module(int file_des) {
|
|||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int set_settings(int file_des) {
|
void validate_settings(enum detectorSettings sett) {
|
||||||
ret = OK;
|
|
||||||
memset(mess, 0, sizeof(mess));
|
|
||||||
enum detectorSettings isett = STANDARD;
|
|
||||||
enum detectorSettings retval = STANDARD;
|
|
||||||
|
|
||||||
if (receiveData(file_des, &isett, sizeof(isett), INT32) < 0)
|
|
||||||
return printSocketReadError();
|
|
||||||
|
|
||||||
#ifdef CHIPTESTBOARDD
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
LOG(logDEBUG1, ("Setting settings %d\n", isett));
|
|
||||||
|
|
||||||
// set & get
|
|
||||||
if (((int)isett == GET_FLAG) || (Server_VerifyLock() == OK)) {
|
|
||||||
|
|
||||||
if ((int)isett != GET_FLAG) {
|
|
||||||
// check index
|
// check index
|
||||||
switch (isett) {
|
switch (sett) {
|
||||||
#ifdef JUNGFRAUD
|
#ifdef EIGERD
|
||||||
case DYNAMICGAIN:
|
case STANDARD:
|
||||||
case DYNAMICHG0:
|
#elif JUNGFRAUD
|
||||||
case FIXGAIN1:
|
case GAIN0:
|
||||||
case FIXGAIN2:
|
case HIGHGAIN0:
|
||||||
case FORCESWITCHG1:
|
|
||||||
case FORCESWITCHG2:
|
|
||||||
#elif GOTTHARDD
|
#elif GOTTHARDD
|
||||||
case DYNAMICGAIN:
|
case DYNAMICGAIN:
|
||||||
case HIGHGAIN:
|
case HIGHGAIN:
|
||||||
@ -1621,16 +1593,37 @@ int set_settings(int file_des) {
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (myDetectorType == EIGER) {
|
modeNotImplemented("Settings Index", (int)sett);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int set_settings(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
enum detectorSettings isett = STANDARD;
|
||||||
|
enum detectorSettings retval = STANDARD;
|
||||||
|
|
||||||
|
if (receiveData(file_des, &isett, sizeof(isett), INT32) < 0)
|
||||||
|
return printSocketReadError();
|
||||||
|
|
||||||
|
#ifdef CHIPTESTBOARDD
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
LOG(logDEBUG1, ("Setting settings %d\n", isett));
|
||||||
|
|
||||||
|
// set & get
|
||||||
|
if (((int)isett == GET_FLAG) || (Server_VerifyLock() == OK)) {
|
||||||
|
|
||||||
|
if ((int)isett != GET_FLAG) {
|
||||||
|
#ifdef EIGERD
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess, "Cannot set settings via SET_SETTINGS, use "
|
sprintf(mess, "Cannot set settings via SET_SETTINGS, use "
|
||||||
"SET_MODULE\n");
|
"SET_MODULE\n");
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else
|
#else
|
||||||
modeNotImplemented("Settings Index", (int)isett);
|
validate_settings(isett);
|
||||||
break;
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
if (ret == OK) {
|
if (ret == OK) {
|
||||||
setSettings(isett);
|
setSettings(isett);
|
||||||
}
|
}
|
||||||
@ -1642,7 +1635,7 @@ int set_settings(int file_des) {
|
|||||||
validate(&ret, mess, (int)isett, (int)retval, "set settings", DEC);
|
validate(&ret, mess, (int)isett, (int)retval, "set settings", DEC);
|
||||||
#ifdef GOTTHARDD
|
#ifdef GOTTHARDD
|
||||||
if (ret == OK) {
|
if (ret == OK) {
|
||||||
ret = setDefaultDacs();
|
ret = resetToDefaultDacs(0);
|
||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
strcpy(mess, "Could change settings, but could not set to "
|
strcpy(mess, "Could change settings, but could not set to "
|
||||||
"default dacs\n");
|
"default dacs\n");
|
||||||
@ -1693,7 +1686,16 @@ int acquire(int blocking, int file_des) {
|
|||||||
}
|
}
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
#if defined(MOENCHD)
|
#ifdef JUNGFRAUD
|
||||||
|
// chipv1.1 has to be configured before acquisition
|
||||||
|
if (getChipVersion() == 11 && !isChipConfigured()) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess,
|
||||||
|
"Could not start acquisition. Chip is not configured.\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
#ifdef MOENCHD
|
||||||
if (getNumAnalogSamples() <= 0) {
|
if (getNumAnalogSamples() <= 0) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
@ -1703,7 +1705,7 @@ int acquire(int blocking, int file_des) {
|
|||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
#if defined(CHIPTESTBOARDD)
|
#ifdef CHIPTESTBOARDD
|
||||||
if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
|
if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
|
||||||
getReadoutMode() == ANALOG_ONLY) &&
|
getReadoutMode() == ANALOG_ONLY) &&
|
||||||
(getNumAnalogSamples() <= 0)) {
|
(getNumAnalogSamples() <= 0)) {
|
||||||
@ -2042,10 +2044,14 @@ int set_num_additional_storage_cells(int file_des) {
|
|||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
if (arg > MAX_STORAGE_CELL_VAL) {
|
if (getChipVersion() == 11) {
|
||||||
|
ret = FAIL;
|
||||||
|
sprintf(mess, "Cannot set addl. number of storage cells for chip v1.1\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else if (arg > getMaxStoragecellStart()) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess, "Max Storage cell number should not exceed %d\n",
|
sprintf(mess, "Max Storage cell number should not exceed %d\n",
|
||||||
MAX_STORAGE_CELL_VAL);
|
getMaxStoragecellStart());
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
} else {
|
||||||
setNumAdditionalStorageCells(arg);
|
setNumAdditionalStorageCells(arg);
|
||||||
@ -2489,9 +2495,15 @@ int get_storage_cell_delay(int file_des) {
|
|||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// get only
|
// get only
|
||||||
|
if (getChipVersion() == 11) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess, "Storage cell delay is not applicable for chipv 1.1\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else {
|
||||||
retval = getStorageCellDelay();
|
retval = getStorageCellDelay();
|
||||||
LOG(logDEBUG1,
|
LOG(logDEBUG1,
|
||||||
("retval storage cell delay %lld ns\n", (long long int)retval));
|
("retval storage cell delay %lld ns\n", (long long int)retval));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
|
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
|
||||||
}
|
}
|
||||||
@ -2511,7 +2523,11 @@ int set_storage_cell_delay(int file_des) {
|
|||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
if (arg > MAX_STORAGE_CELL_DLY_NS_VAL) {
|
if (getChipVersion() == 11) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess, "Storage cell delay is not applicable for chipv 1.1\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else if (arg > MAX_STORAGE_CELL_DLY_NS_VAL) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
"Max Storage cell delay value should not exceed %lld ns\n",
|
"Max Storage cell delay value should not exceed %lld ns\n",
|
||||||
@ -4013,9 +4029,9 @@ int storage_cell_start(int file_des) {
|
|||||||
#else
|
#else
|
||||||
// set & get
|
// set & get
|
||||||
if ((arg == GET_FLAG) || (Server_VerifyLock() == OK)) {
|
if ((arg == GET_FLAG) || (Server_VerifyLock() == OK)) {
|
||||||
if (arg > MAX_STORAGE_CELL_VAL) {
|
if (arg > getMaxStoragecellStart()) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess, "Max Storage cell number should not exceed 15\n");
|
sprintf(mess, "Max Storage cell number should not exceed %d\n", getMaxStoragecellStart());
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
} else {
|
||||||
retval = selectStoragecellStart(arg);
|
retval = selectStoragecellStart(arg);
|
||||||
@ -6737,21 +6753,104 @@ int set_burst_period(int file_des) {
|
|||||||
int set_current_source(int file_des) {
|
int set_current_source(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int arg = 0;
|
uint64_t select = 0;
|
||||||
|
int args[3] = {-1, -1, -1};
|
||||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
LOG(logINFO, ("Setting current source enable: %u\n", arg));
|
if (receiveData(file_des, &select, sizeof(select), INT64) < 0)
|
||||||
|
return printSocketReadError();
|
||||||
|
int enable = args[0];
|
||||||
|
int fix = args[1];
|
||||||
|
int normal = args[2];
|
||||||
|
|
||||||
#ifndef GOTTHARD2D
|
LOG(logINFOBLUE, ("Setting current source [enable:%d, fix:%d, select:%lld, "
|
||||||
|
"normal:%d]\n",
|
||||||
|
enable, fix, (long long int)select, normal));
|
||||||
|
|
||||||
|
#if !defined(GOTTHARD2D) && !defined(JUNGFRAUD)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
setCurrentSource(arg);
|
if (enable != 0 && enable != 1) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess,
|
||||||
|
"Could not enable/disable current source. Enable can be 0 or 1 only.\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
|
// disable
|
||||||
|
else if (enable == 0 && (fix != -1 || normal != -1)) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess,
|
||||||
|
"Could not disable current source. Requires no parameters.\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
|
// enable
|
||||||
|
else if (enable == 1) {
|
||||||
|
#ifdef GOTTHARD2D
|
||||||
|
// no parameters allowed
|
||||||
|
if (fix != -1 || normal != -1) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess,
|
||||||
|
"Could not enable current source. Fix and normal are invalid parameters for this detector.\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
int chipVersion = getChipVersion();
|
||||||
|
if (ret == OK) {
|
||||||
|
if (chipVersion == 11) {
|
||||||
|
// require both
|
||||||
|
if ((fix != 0 && fix != 1) ||
|
||||||
|
(normal != 0 && normal != 1)) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess, "Could not enable current source. Invalid "
|
||||||
|
"or insufficient parameters (fix or "
|
||||||
|
"normal). or Options: 0 or 1.\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// chipv1.0
|
||||||
|
else {
|
||||||
|
// require only fix
|
||||||
|
if (fix != 0 && fix != 1) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess,
|
||||||
|
"Could not enable current source. Invalid value for parameter (fix). Options: 0 or 1.\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else if (normal != -1) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess, "Could not enable current source. Invalid "
|
||||||
|
"parmaeter (normal). Require only fix and "
|
||||||
|
"select for chipv1.0.\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
|
// select can only be 0-63
|
||||||
|
else if (select > MAX_SELECT_CHIP10_VAL) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess,
|
||||||
|
"Could not enable current source. Invalid value "
|
||||||
|
"for parameter (select). Options: 0-63.\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret == OK) {
|
||||||
|
#ifdef JUNGFRAUD
|
||||||
|
if (enable == 0) {
|
||||||
|
disableCurrentSource();
|
||||||
|
} else {
|
||||||
|
enableCurrentSource(fix, select, normal);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setCurrentSource(enable);
|
||||||
|
#endif
|
||||||
int retval = getCurrentSource();
|
int retval = getCurrentSource();
|
||||||
LOG(logDEBUG1, ("current source enable retval: %u\n", retval));
|
LOG(logDEBUG1, ("current source enable retval: %u\n", retval));
|
||||||
validate(&ret, mess, arg, retval, "set current source enable", DEC);
|
validate(&ret, mess, enable, retval, "set current source enable", DEC);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
@ -6760,18 +6859,34 @@ int set_current_source(int file_des) {
|
|||||||
int get_current_source(int file_des) {
|
int get_current_source(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int retval = -1;
|
int retvals[3] = {-1, -1, -1};
|
||||||
|
uint64_t retval_select = 0;
|
||||||
|
|
||||||
LOG(logDEBUG1, ("Getting current source enable\n"));
|
LOG(logDEBUG1, ("Getting current source\n"));
|
||||||
|
|
||||||
#ifndef GOTTHARD2D
|
#if !defined(GOTTHARD2D) && !defined(JUNGFRAUD)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// get only
|
// get only
|
||||||
retval = getCurrentSource();
|
retvals[0] = getCurrentSource();
|
||||||
LOG(logDEBUG1, ("current source enable retval: %u\n", retval));
|
LOG(logDEBUG1, ("current source enable retval: %u\n", retvals[0]));
|
||||||
|
#ifdef JUNGFRAUD
|
||||||
|
if (retvals[0]) {
|
||||||
|
retvals[1] = getFixCurrentSource();
|
||||||
|
retvals[2] = getNormalCurrentSource();
|
||||||
|
retval_select = getSelectCurrentSource();
|
||||||
|
}
|
||||||
|
LOG(logDEBUG1, ("current source parameters retval: [enable:%d fix:%d, "
|
||||||
|
"normal:%d, select:%lld]\n",
|
||||||
|
retvals[0], retvals[1], retvals[2], retval_select));
|
||||||
#endif
|
#endif
|
||||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
#endif
|
||||||
|
Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
|
if (ret != FAIL) {
|
||||||
|
sendData(file_des, retvals, sizeof(retvals), INT32);
|
||||||
|
sendData(file_des, &retval_select, sizeof(retval_select), INT64);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int set_timing_source(int file_des) {
|
int set_timing_source(int file_des) {
|
||||||
@ -7651,6 +7766,7 @@ int set_scan(int file_des) {
|
|||||||
}
|
}
|
||||||
// dac scan
|
// dac scan
|
||||||
else {
|
else {
|
||||||
|
// validate index
|
||||||
getDACIndex(index);
|
getDACIndex(index);
|
||||||
if (ret == OK) {
|
if (ret == OK) {
|
||||||
LOG(logINFOBLUE, ("Dac [%d] scan enabled\n", index));
|
LOG(logINFOBLUE, ("Dac [%d] scan enabled\n", index));
|
||||||
@ -7756,49 +7872,76 @@ int set_cds_gain(int file_des) {
|
|||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_filter(int file_des) {
|
int get_filter_resistor(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
||||||
LOG(logDEBUG1, ("Getting filter\n"));
|
LOG(logDEBUG1, ("Getting filter resistor\n"));
|
||||||
|
|
||||||
#ifndef GOTTHARD2D
|
#if !defined(GOTTHAR2D) && !defined(JUNGFRAUD)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// get only
|
// get only
|
||||||
retval = getFilter();
|
#ifdef JUNGFRAUD
|
||||||
LOG(logDEBUG1, ("filter retval: %u\n", retval));
|
if (getChipVersion() == 10) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess, "Could not get filter cell. Not available for this chip "
|
||||||
|
"version 1.0.\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (ret == OK) {
|
||||||
|
retval = getFilterResistor();
|
||||||
|
LOG(logDEBUG1, ("filter resistor retval: %u\n", retval));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||||
}
|
}
|
||||||
|
|
||||||
int set_filter(int file_des) {
|
int set_filter_resistor(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int arg = 0;
|
int arg = 0;
|
||||||
|
|
||||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
LOG(logINFO, ("Setting filter: %u\n", arg));
|
LOG(logINFO, ("Setting filter resistor: %u\n", arg));
|
||||||
|
|
||||||
#ifndef GOTTHARD2D
|
#if !defined(GOTTHAR2D) && !defined(JUNGFRAUD)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
if (arg < 0 || arg > ASIC_FILTER_MAX_VALUE) {
|
if (arg < 0 || arg > ASIC_FILTER_MAX_RES_VALUE) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
"Could not set filter. Invalid filter %d. "
|
"Could not set filter resistor. Invalid filter argument %d. "
|
||||||
"Options [0-%d]\n",
|
"Options [0-%d]\n",
|
||||||
arg, ASIC_FILTER_MAX_VALUE);
|
arg, ASIC_FILTER_MAX_RES_VALUE);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
}
|
||||||
setFilter(arg);
|
#ifdef JUNGFRAUD
|
||||||
int retval = getFilter();
|
else if (getChipVersion() == 10) {
|
||||||
LOG(logDEBUG1, ("filter retval: %u\n", retval));
|
ret = FAIL;
|
||||||
validate(&ret, mess, arg, retval, "set filter", DEC);
|
strcpy(mess, "Could not set filter cell. Not available for this "
|
||||||
|
"chip version 1.0.\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
else {
|
||||||
|
ret = setFilterResistor(arg);
|
||||||
|
if (ret == FAIL) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess, "Could not set filter resistor.\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
|
#ifndef JUNGFRAUD
|
||||||
|
// jungfrau might take time to update status register if acquiring
|
||||||
|
int retval = getFilterResistor();
|
||||||
|
LOG(logDEBUG1, ("filter resistor retval: %u\n", retval));
|
||||||
|
validate(&ret, mess, arg, retval, "set filter resistor", DEC);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -8095,17 +8238,22 @@ int start_readout(int file_des) {
|
|||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int set_default_dacs(int file_des) {
|
int reset_to_default_dacs(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
|
int arg = -1;
|
||||||
|
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||||
|
return printSocketReadError();
|
||||||
|
LOG(logDEBUG1, ("Resetting dacs to defaults (hard reset: %d)\n", arg));
|
||||||
|
|
||||||
#ifdef CHIPTESTBOARDD
|
#ifdef CHIPTESTBOARDD
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
if (setDefaultDacs() == FAIL) {
|
if (resetToDefaultDacs(arg) == FAIL) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess, "Could not set default dacs");
|
sprintf(mess, "Could not %s reset default dacs",
|
||||||
|
(arg == 1 ? "hard" : ""));
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8196,7 +8344,7 @@ int set_gain_caps(int file_des) {
|
|||||||
|
|
||||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
LOG(logINFO, ("Setting gain caps to: %u\n", arg));
|
LOG(logDEBUG1, ("Setting gain caps to: %u\n", arg));
|
||||||
|
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
||||||
@ -8342,7 +8490,7 @@ int set_veto_stream(int file_des) {
|
|||||||
|
|
||||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
LOG(logINFO, ("Setting vetostream: %u\n", (int)arg));
|
LOG(logDEBUG1, ("Setting vetostream: %u\n", (int)arg));
|
||||||
|
|
||||||
#ifndef GOTTHARD2D
|
#ifndef GOTTHARD2D
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
@ -8403,7 +8551,7 @@ int set_veto_algorithm(int file_des) {
|
|||||||
|
|
||||||
enum vetoAlgorithm alg = args[0];
|
enum vetoAlgorithm alg = args[0];
|
||||||
enum streamingInterface interface = args[1];
|
enum streamingInterface interface = args[1];
|
||||||
LOG(logINFO, ("Setting vetoalgorithm (interface: %d): %u\n", (int)interface,
|
LOG(logDEBUG1, ("Setting vetoalgorithm (interface: %d): %u\n", (int)interface,
|
||||||
(int)alg));
|
(int)alg));
|
||||||
|
|
||||||
#ifndef GOTTHARD2D
|
#ifndef GOTTHARD2D
|
||||||
@ -8433,3 +8581,344 @@ int set_veto_algorithm(int file_des) {
|
|||||||
#endif
|
#endif
|
||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int get_chip_version(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
int retval = -1;
|
||||||
|
#ifndef JUNGFRAUD
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
retval = getChipVersion();
|
||||||
|
#endif
|
||||||
|
LOG(logDEBUG1, ("chip version retval: %d\n", retval));
|
||||||
|
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_default_dac(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
int args[2] = {-1, -1};
|
||||||
|
int retval = -1;
|
||||||
|
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||||
|
return printSocketReadError();
|
||||||
|
|
||||||
|
enum dacIndex dacindex = args[0];
|
||||||
|
enum detectorSettings sett = args[1];
|
||||||
|
LOG(logDEBUG1,
|
||||||
|
("Getting default dac [dacindex:%d, settings: %d]\n", dacindex, sett));
|
||||||
|
|
||||||
|
#ifdef CHIPTESTBOARDD
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
// get only
|
||||||
|
enum DACINDEX idac = getDACIndex(dacindex);
|
||||||
|
if (ret == OK) {
|
||||||
|
// to allow for default dacs (without settings)
|
||||||
|
if (sett != UNDEFINED) {
|
||||||
|
validate_settings(sett);
|
||||||
|
}
|
||||||
|
if (ret == OK) {
|
||||||
|
ret = getDefaultDac(idac, sett, &retval);
|
||||||
|
if (ret == FAIL) {
|
||||||
|
sprintf(mess, "Could not get default dac %d %s\n", (int)idac,
|
||||||
|
(sett != UNDEFINED ? "for this setting" : ""));
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else {
|
||||||
|
LOG(logDEBUG1,
|
||||||
|
("default dac retval [dacindex:%d, setting:%d]: %u\n",
|
||||||
|
(int)dacindex, (int)sett, retval));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||||
|
}
|
||||||
|
|
||||||
|
int set_default_dac(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
int args[3] = {-1, -1, -1};
|
||||||
|
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||||
|
return printSocketReadError();
|
||||||
|
|
||||||
|
enum dacIndex dacindex = args[0];
|
||||||
|
enum detectorSettings sett = args[1];
|
||||||
|
int value = args[2];
|
||||||
|
LOG(logDEBUG1, ("Setting default dac [dacindex: %d, settings: %d] to %d\n",
|
||||||
|
(int)dacindex, (int)sett, value));
|
||||||
|
|
||||||
|
#ifdef CHIPTESTBOARDD
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
// only set
|
||||||
|
if (Server_VerifyLock() == OK) {
|
||||||
|
enum DACINDEX idac = getDACIndex(dacindex);
|
||||||
|
if (ret == OK) {
|
||||||
|
// to allow for default dacs (without settings)
|
||||||
|
if (sett != UNDEFINED) {
|
||||||
|
validate_settings(sett);
|
||||||
|
}
|
||||||
|
if (ret == OK) {
|
||||||
|
ret = setDefaultDac(idac, sett, value);
|
||||||
|
if (ret == FAIL) {
|
||||||
|
sprintf(mess, "Could not set default dac %d %s\n",
|
||||||
|
(int)idac,
|
||||||
|
(sett != UNDEFINED ? "for this setting" : ""));
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else {
|
||||||
|
int retval = -1;
|
||||||
|
ret = getDefaultDac(idac, sett, &retval);
|
||||||
|
if (ret == FAIL) {
|
||||||
|
sprintf(mess, "Could not get default dac %d %s\n",
|
||||||
|
(int)idac,
|
||||||
|
(sett != UNDEFINED ? "for this setting" : ""));
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else {
|
||||||
|
LOG(logDEBUG1, ("default dac retval [dacindex:%d, "
|
||||||
|
"setting:%d]: %u\n",
|
||||||
|
(int)dacindex, (int)sett, retval));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_gain_mode(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
enum gainMode retval = DYNAMIC;
|
||||||
|
LOG(logDEBUG1, ("Getting gain mode\n"));
|
||||||
|
|
||||||
|
#ifndef JUNGFRAUD
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
// get only
|
||||||
|
retval = getGainMode();
|
||||||
|
LOG(logDEBUG1, ("gainmode retval: %u\n", retval));
|
||||||
|
if ((int)retval == -1) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess, "Could not get gain mode.\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||||
|
}
|
||||||
|
|
||||||
|
int set_gain_mode(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
int arg = -1;
|
||||||
|
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||||
|
return printSocketReadError();
|
||||||
|
enum gainMode gainmode = arg;
|
||||||
|
LOG(logDEBUG1, ("Setting gain mode %d\n", (int)gainmode));
|
||||||
|
|
||||||
|
#ifndef JUNGFRAUD
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
// only set
|
||||||
|
if (Server_VerifyLock() == OK) {
|
||||||
|
switch (gainmode) {
|
||||||
|
case DYNAMIC:
|
||||||
|
case FORCE_SWITCH_G1:
|
||||||
|
case FORCE_SWITCH_G2:
|
||||||
|
case FIX_G1:
|
||||||
|
case FIX_G2:
|
||||||
|
case FIX_G0:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
modeNotImplemented("Gain Mode Index", (int)gainmode);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
setGainMode(gainmode);
|
||||||
|
int retval = getGainMode();
|
||||||
|
LOG(logDEBUG1, ("gainmode retval: %u\n", retval));
|
||||||
|
if (retval == -1) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess, "Could not get gain mode.\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
|
validate(&ret, mess, arg, retval, "set gain mode", DEC);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_comp_disable_time(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
int64_t retval = -1;
|
||||||
|
#ifndef JUNGFRAUD
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
// get only
|
||||||
|
if (getChipVersion() != 11) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess,
|
||||||
|
"Cannot get comparator disable time. Only valid for chipv1.1\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else {
|
||||||
|
retval = getComparatorDisableTime();
|
||||||
|
LOG(logDEBUG1,
|
||||||
|
("retval comp disable time %lld ns\n", (long long int)retval));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
|
||||||
|
}
|
||||||
|
|
||||||
|
int set_comp_disable_time(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
int64_t arg = -1;
|
||||||
|
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||||
|
return printSocketReadError();
|
||||||
|
LOG(logDEBUG1, ("Setting comp disable time %lld ns\n", (long long int)arg));
|
||||||
|
|
||||||
|
#ifndef JUNGFRAUD
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
// only set
|
||||||
|
if (Server_VerifyLock() == OK) {
|
||||||
|
if (getChipVersion() != 11) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess, "Cannot get comparator disable time. Only valid for "
|
||||||
|
"chipv1.1\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else {
|
||||||
|
ret = setComparatorDisableTime(arg);
|
||||||
|
int64_t retval = getComparatorDisableTime();
|
||||||
|
LOG(logDEBUG1, ("retval get comp disable time %lld ns\n",
|
||||||
|
(long long int)retval));
|
||||||
|
if (ret == FAIL) {
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not set comp disable time. Set %lld ns, read "
|
||||||
|
"%lld ns.\n",
|
||||||
|
(long long int)arg, (long long int)retval);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, INT64, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_flip_rows(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
int retval = -1;
|
||||||
|
|
||||||
|
LOG(logDEBUG1, ("Getting flip rows\n"));
|
||||||
|
|
||||||
|
#ifndef JUNGFRAUD
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
// get only
|
||||||
|
retval = getFlipRows();
|
||||||
|
LOG(logDEBUG1, ("flip rows retval: %u\n", retval));
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||||
|
}
|
||||||
|
|
||||||
|
int set_flip_rows(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 flip rows: %u\n", (int)arg));
|
||||||
|
|
||||||
|
#ifndef JUNGFRAUD
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
// only set
|
||||||
|
if (Server_VerifyLock() == OK) {
|
||||||
|
|
||||||
|
if (arg != 0 && arg != 1) {
|
||||||
|
ret = FAIL;
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not set flip rows. Invalid argument %d.\n",
|
||||||
|
arg);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
|
// only for HW 2.0 (version = 3)
|
||||||
|
else if (isHardwareVersion2()) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess, "Could not set flip rows. Only available for "
|
||||||
|
"Hardware Board version 2.0.\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else if (getNumberofUDPInterfaces() == 1) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess, "Could not set flip rows. Number of udp "
|
||||||
|
"interfaces is still 1.\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else {
|
||||||
|
setFlipRows(arg);
|
||||||
|
int retval = getFlipRows();
|
||||||
|
LOG(logDEBUG1, ("flip rows retval: %u\n", retval));
|
||||||
|
validate(&ret, mess, arg, retval, "set flip rows", DEC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int get_filter_cell(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
int retval = -1;
|
||||||
|
|
||||||
|
LOG(logDEBUG1, ("Getting filter cell\n"));
|
||||||
|
|
||||||
|
#ifndef JUNGFRAUD
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
// get only
|
||||||
|
retval = getFilterCell();
|
||||||
|
LOG(logDEBUG1, ("filter cell retval: %u\n", retval));
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||||
|
}
|
||||||
|
|
||||||
|
int set_filter_cell(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 filter cell: %u\n", (int)arg));
|
||||||
|
|
||||||
|
#ifndef JUNGFRAUD
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
// only set
|
||||||
|
if (Server_VerifyLock() == OK) {
|
||||||
|
|
||||||
|
if (arg < 0 || arg > MAX_FILTER_CELL_VAL) {
|
||||||
|
ret = FAIL;
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not set filter cell. Invalid argument %d. Options: 0 - %d\n",
|
||||||
|
arg, MAX_FILTER_CELL_VAL);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
|
// only for chipv1.1
|
||||||
|
else if (getChipVersion() == 10) {
|
||||||
|
ret = FAIL;
|
||||||
|
strcpy(mess, "Could not set filter cell. Only available for "
|
||||||
|
"chip version 1.1\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else {
|
||||||
|
setFilterCell(arg);
|
||||||
|
// no validation as it might take time to update status register if acquiring
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
|
}
|
||||||
|
@ -113,8 +113,7 @@ class Detector {
|
|||||||
/** [Jungfrau][Gotthard][Gotthard2][Mythen3] */
|
/** [Jungfrau][Gotthard][Gotthard2][Mythen3] */
|
||||||
Result<defs::detectorSettings> getSettings(Positions pos = {}) const;
|
Result<defs::detectorSettings> getSettings(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Jungfrau] DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2,
|
/** [Jungfrau] GAIN0, HIGHGAIN0 \n [Gotthard] DYNAMICGAIN, HIGHGAIN,
|
||||||
* FORCESWITCHG1, FORCESWITCHG2 \n [Gotthard] DYNAMICGAIN, HIGHGAIN,
|
|
||||||
* LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN \n [Gotthard2] DYNAMICGAIN,
|
* LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN \n [Gotthard2] DYNAMICGAIN,
|
||||||
* FIXGAIN1, FIXGAIN2 \n [Moench] G1_HIGHGAIN, G1_LOWGAIN,
|
* FIXGAIN1, FIXGAIN2 \n [Moench] G1_HIGHGAIN, G1_LOWGAIN,
|
||||||
* G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN,
|
* G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN,
|
||||||
@ -173,6 +172,17 @@ class Detector {
|
|||||||
*/
|
*/
|
||||||
void setGapPixelsinCallback(const bool enable);
|
void setGapPixelsinCallback(const bool enable);
|
||||||
|
|
||||||
|
/** [Eiger][Jungfrau] */
|
||||||
|
Result<bool> getFlipRows(Positions pos = {}) const;
|
||||||
|
|
||||||
|
/** [Eiger] flips rows paramater sent to slsreceiver to stream as json
|
||||||
|
* parameter to flip rows in gui \n[Jungfrau] flips rows in the detector
|
||||||
|
* itself. For bottom module and number of interfaces must be set to 2.
|
||||||
|
* slsReceiver and slsDetectorGui does not handle.slsReceiver and
|
||||||
|
* slsDetectorGui does not handle
|
||||||
|
*/
|
||||||
|
void setFlipRows(bool value, Positions pos = {});
|
||||||
|
|
||||||
Result<bool> isVirtualDetectorServer(Positions pos = {}) const;
|
Result<bool> isVirtualDetectorServer(Positions pos = {}) const;
|
||||||
///@{
|
///@{
|
||||||
|
|
||||||
@ -383,7 +393,7 @@ class Detector {
|
|||||||
* [Moench] Default is disabled. \n
|
* [Moench] Default is disabled. \n
|
||||||
* [Jungfrau] Default is disabled. Get will return power status. Can be off
|
* [Jungfrau] Default is disabled. Get will return power status. Can be off
|
||||||
* if temperature event occured (temperature over temp_threshold with
|
* if temperature event occured (temperature over temp_threshold with
|
||||||
* temp_control enabled. \n [Mythen3][Gotthard2] Default is 1. If module not
|
* temp_control enabled. Will configure chip (only chip v1.1)\n [Mythen3][Gotthard2] Default is 1. If module not
|
||||||
* connected or wrong module, powerchip will fail.
|
* connected or wrong module, powerchip will fail.
|
||||||
*/
|
*/
|
||||||
void setPowerChip(bool on, Positions pos = {});
|
void setPowerChip(bool on, Positions pos = {});
|
||||||
@ -414,7 +424,24 @@ class Detector {
|
|||||||
std::vector<defs::dacIndex> getDacList() const;
|
std::vector<defs::dacIndex> getDacList() const;
|
||||||
|
|
||||||
/** [Eiger][Jungfrau][Moench][Gotthard][Gotthard2][Mythen3] */
|
/** [Eiger][Jungfrau][Moench][Gotthard][Gotthard2][Mythen3] */
|
||||||
void setDefaultDacs(Positions pos = {});
|
Result<int> getDefaultDac(defs::dacIndex index, Positions pos = {});
|
||||||
|
|
||||||
|
/** [Eiger][Jungfrau][Moench][Gotthard][Gotthard2][Mythen3] */
|
||||||
|
void setDefaultDac(defs::dacIndex index, int defaultValue,
|
||||||
|
Positions pos = {});
|
||||||
|
|
||||||
|
/** [Jungfrau][Mythen3] */
|
||||||
|
Result<int> getDefaultDac(defs::dacIndex index, defs::detectorSettings sett,
|
||||||
|
Positions pos = {});
|
||||||
|
|
||||||
|
/** [Jungfrau][Mythen3] */
|
||||||
|
void setDefaultDac(defs::dacIndex index, int defaultValue,
|
||||||
|
defs::detectorSettings sett, Positions pos = {});
|
||||||
|
|
||||||
|
/** [Eiger][Jungfrau][Moench][Gotthard][Gotthard2][Mythen3]
|
||||||
|
reset to defaults, hardReset will reset to hardcoded defaults on on-board
|
||||||
|
server */
|
||||||
|
void resetToDefaultDacs(const bool hardReset, Positions pos = {});
|
||||||
|
|
||||||
Result<int> getDAC(defs::dacIndex index, bool mV = false,
|
Result<int> getDAC(defs::dacIndex index, bool mV = false,
|
||||||
Positions pos = {}) const;
|
Positions pos = {}) const;
|
||||||
@ -452,6 +479,23 @@ class Detector {
|
|||||||
* [Mythen3] If exposure time is too short, acquisition will return with an
|
* [Mythen3] If exposure time is too short, acquisition will return with an
|
||||||
* ERROR and take fewer frames than expected */
|
* ERROR and take fewer frames than expected */
|
||||||
void setParallelMode(bool value, Positions pos = {});
|
void setParallelMode(bool value, Positions pos = {});
|
||||||
|
|
||||||
|
/** [Gotthard2][Jungfrau] */
|
||||||
|
Result<int> getFilterResistor(Positions pos = {}) const;
|
||||||
|
|
||||||
|
/** [Gotthard2][Jungfrau] Set filter resistor. Increasing values for
|
||||||
|
* increasing resistance.\n[Gotthard2] Options: [0|1|2|3]. Default is
|
||||||
|
* 0.\n[Jungfrau] Options: [0|1]. Default is 1.*/
|
||||||
|
void setFilterResistor(int value, Positions pos = {});
|
||||||
|
|
||||||
|
/** [Gotthard2][Jungfrau] */
|
||||||
|
Result<defs::currentSrcParameters>
|
||||||
|
getCurrentSource(Positions pos = {}) const;
|
||||||
|
|
||||||
|
/** [Gotthard2][Jungfrau] Please refer documentation on currentSrcParameters
|
||||||
|
* (sls_detector_defs.h) on the structure and its members */
|
||||||
|
void setCurrentSource(defs::currentSrcParameters par, Positions pos = {});
|
||||||
|
|
||||||
///@{
|
///@{
|
||||||
|
|
||||||
/** @name Acquisition */
|
/** @name Acquisition */
|
||||||
@ -979,12 +1023,6 @@ class Detector {
|
|||||||
/** [Eiger] Overflow in 32 bit mode. Default is disabled.*/
|
/** [Eiger] Overflow in 32 bit mode. Default is disabled.*/
|
||||||
void setOverFlowMode(bool value, Positions pos = {});
|
void setOverFlowMode(bool value, Positions pos = {});
|
||||||
|
|
||||||
/** [Eiger] */
|
|
||||||
Result<bool> getBottom(Positions pos = {}) const;
|
|
||||||
|
|
||||||
/** [Eiger] for client call back (gui) purposes to flip bottom image */
|
|
||||||
void setBottom(bool value, Positions pos = {});
|
|
||||||
|
|
||||||
/** [Eiger] deadtime in ns, 0 = disabled */
|
/** [Eiger] deadtime in ns, 0 = disabled */
|
||||||
Result<ns> getRateCorrection(Positions pos = {}) const;
|
Result<ns> getRateCorrection(Positions pos = {}) const;
|
||||||
|
|
||||||
@ -1081,6 +1119,9 @@ class Detector {
|
|||||||
* *
|
* *
|
||||||
* ************************************************/
|
* ************************************************/
|
||||||
|
|
||||||
|
/** [Jungfrau] */
|
||||||
|
Result<double> getChipVersion(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Jungfrau] */
|
/** [Jungfrau] */
|
||||||
Result<int> getThresholdTemperature(Positions pos = {}) const;
|
Result<int> getThresholdTemperature(Positions pos = {}) const;
|
||||||
|
|
||||||
@ -1108,24 +1149,32 @@ class Detector {
|
|||||||
void resetTemperatureEvent(Positions pos = {});
|
void resetTemperatureEvent(Positions pos = {});
|
||||||
|
|
||||||
/** [Jungfrau] */
|
/** [Jungfrau] */
|
||||||
Result<bool> getAutoCompDisable(Positions pos = {}) const;
|
Result<bool> getAutoComparatorDisable(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Jungfrau] Advanced
|
/** [Jungfrau] Advanced
|
||||||
* //TODO naming
|
* //TODO naming
|
||||||
* By default, the on-chip gain switching is active during the entire
|
* By default, the on-chip gain switching is active during the
|
||||||
* exposure. This mode disables the on-chip gain switching comparator
|
* entire exposure. This mode disables the on-chip gain switching comparator
|
||||||
* automatically after 93.75% of exposure time (only for longer than
|
* automatically after 93.75% of exposure time (only for longer than 100us).
|
||||||
* 100us).\n
|
* The % is for chipv1.0. One can set the duration for chipv1.1 using
|
||||||
* Default is false or this mode disabled(comparator enabled throughout).
|
* setComparatorDisableTime\n Default is false or this mode
|
||||||
* true enables mode. 0 disables mode.
|
* disabled(comparator enabled throughout). true enables mode. 0 disables
|
||||||
|
* mode.
|
||||||
*/
|
*/
|
||||||
void setAutoCompDisable(bool value, Positions pos = {});
|
void setAutoComparatorDisable(bool value, Positions pos = {});
|
||||||
|
|
||||||
|
/** [Jungfrau] */
|
||||||
|
Result<ns> getComparatorDisableTime(Positions pos = {}) const;
|
||||||
|
|
||||||
|
/** [Jungfrau] Time before end of exposure when comparator is disabled. It
|
||||||
|
* is only possible for chipv1.1.*/
|
||||||
|
void setComparatorDisableTime(ns t, Positions pos = {});
|
||||||
|
|
||||||
/** [Jungfrau] Advanced TODO naming */
|
/** [Jungfrau] Advanced TODO naming */
|
||||||
Result<int> getNumberOfAdditionalStorageCells(Positions pos = {}) const;
|
Result<int> getNumberOfAdditionalStorageCells(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Jungfrau] Advanced \n
|
/** [Jungfrau] Advanced \n
|
||||||
* Options: 0 - 15. Default: 0. \n
|
* Only for chipv1.0. Options: 0 - 15. Default: 0. \n
|
||||||
* The #images = #frames x #triggers x (#storagecells + 1) */
|
* The #images = #frames x #triggers x (#storagecells + 1) */
|
||||||
void setNumberOfAdditionalStorageCells(int value);
|
void setNumberOfAdditionalStorageCells(int value);
|
||||||
|
|
||||||
@ -1133,7 +1182,7 @@ class Detector {
|
|||||||
Result<int> getStorageCellStart(Positions pos = {}) const;
|
Result<int> getStorageCellStart(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Jungfrau] Advanced. Sets the storage cell storing the first acquisition
|
/** [Jungfrau] Advanced. Sets the storage cell storing the first acquisition
|
||||||
* of the series. Options: 0-15. Default: 15.
|
* of the series. Options: 0-max. max is 15 (default) for chipv1.0 and 3 (default) for chipv1.1.
|
||||||
*/
|
*/
|
||||||
void setStorageCellStart(int cell, Positions pos = {});
|
void setStorageCellStart(int cell, Positions pos = {});
|
||||||
|
|
||||||
@ -1141,9 +1190,30 @@ class Detector {
|
|||||||
Result<ns> getStorageCellDelay(Positions pos = {}) const;
|
Result<ns> getStorageCellDelay(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Jungfrau] Advanced \n Additional time delay between 2 consecutive
|
/** [Jungfrau] Advanced \n Additional time delay between 2 consecutive
|
||||||
* exposures in burst mode. \n Options: (0-1638375 ns (resolution of 25ns)
|
* exposures in burst mode. \n Options: (0-1638375 ns (resolution of 25ns)\n
|
||||||
|
* Only applicable for chipv1.0.
|
||||||
*/
|
*/
|
||||||
void setStorageCellDelay(ns value, Positions pos = {});
|
void setStorageCellDelay(ns value, Positions pos = {});
|
||||||
|
|
||||||
|
/** list of possible gainmode */
|
||||||
|
std::vector<defs::gainMode> getGainModeList() const;
|
||||||
|
|
||||||
|
/** [Jungfrau]*/
|
||||||
|
Result<defs::gainMode> getGainMode(Positions pos = {}) const;
|
||||||
|
|
||||||
|
/** [Jungfrau] Options: DYNAMIC, FORCE_SWITCH_G1, FORCE_SWITCH_G2,
|
||||||
|
* FIX_G1, FIX_G2, FIX_G0 \n\CAUTION: Do not use FIX_G0 without caution, you
|
||||||
|
* can damage the detector!!!\n
|
||||||
|
*/
|
||||||
|
void setGainMode(const defs::gainMode mode, Positions pos = {});
|
||||||
|
|
||||||
|
/** [Jungfrau] Advanced */
|
||||||
|
Result<int> getFilterCell(Positions pos = {}) const;
|
||||||
|
|
||||||
|
/** [Jungfrau] Advanced Options[0-12]
|
||||||
|
*/
|
||||||
|
void setFilterCell(int cell, Positions pos = {});
|
||||||
|
|
||||||
///@{
|
///@{
|
||||||
|
|
||||||
/** @name Gotthard Specific */
|
/** @name Gotthard Specific */
|
||||||
@ -1238,18 +1308,6 @@ class Detector {
|
|||||||
/** default disabled */
|
/** default disabled */
|
||||||
void setCDSGain(bool value, Positions pos = {});
|
void setCDSGain(bool value, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
|
||||||
Result<int> getFilter(Positions pos = {}) const;
|
|
||||||
|
|
||||||
/** [Gotthard2] Set filter resister. Options: 0-3. Default: 0 */
|
|
||||||
void setFilter(int value, Positions pos = {});
|
|
||||||
|
|
||||||
/** [Gotthard2] */
|
|
||||||
Result<bool> getCurrentSource(Positions pos = {}) const;
|
|
||||||
|
|
||||||
/** default disabled */
|
|
||||||
void setCurrentSource(bool value, Positions pos = {});
|
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Gotthard2] */
|
||||||
Result<defs::timingSourceType> getTimingSource(Positions pos = {}) const;
|
Result<defs::timingSourceType> getTimingSource(Positions pos = {}) const;
|
||||||
|
|
||||||
@ -1776,7 +1834,6 @@ class Detector {
|
|||||||
std::vector<int> getPortNumbers(int start_port);
|
std::vector<int> getPortNumbers(int start_port);
|
||||||
void updateRxRateCorrections();
|
void updateRxRateCorrections();
|
||||||
void setNumberofUDPInterfaces_(int n, Positions pos);
|
void setNumberofUDPInterfaces_(int n, Positions pos);
|
||||||
Result<int> getNumberofUDPInterfaces_(Positions pos) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
} // namespace sls
|
||||||
|
@ -959,6 +959,68 @@ std::string CmdProxy::ExternalSignal(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CmdProxy::CurrentSource(int action) {
|
||||||
|
std::ostringstream os;
|
||||||
|
os << cmd << ' ';
|
||||||
|
if (action == defs::HELP_ACTION) {
|
||||||
|
os << "[0|1]\n\t[Gotthard2] Enable or disable current source. Default "
|
||||||
|
"is disabled.\n[0|1] [fix|nofix] [select source] [(only for "
|
||||||
|
"chipv1.1)normal|low]\n\t[Jungfrau] Disable or enable current "
|
||||||
|
"source with some parameters. The select source is 0-63 for "
|
||||||
|
"chipv1.0 and a 64 bit mask for chipv1.1. To disable, one needs "
|
||||||
|
"only one argument '0'."
|
||||||
|
<< '\n';
|
||||||
|
} else if (action == defs::GET_ACTION) {
|
||||||
|
if (args.size() != 0) {
|
||||||
|
WrongNumberOfParameters(0);
|
||||||
|
}
|
||||||
|
auto t = det->getCurrentSource(std::vector<int>{det_id});
|
||||||
|
os << OutString(t) << '\n';
|
||||||
|
} else if (action == defs::PUT_ACTION) {
|
||||||
|
if (args.size() == 1) {
|
||||||
|
det->setCurrentSource(
|
||||||
|
defs::currentSrcParameters(StringTo<bool>(args[0])));
|
||||||
|
} else if (args.size() >= 3) {
|
||||||
|
// scan fix
|
||||||
|
bool fix = false;
|
||||||
|
if (args[1] == "fix") {
|
||||||
|
fix = true;
|
||||||
|
} else if (args[1] == "nofix") {
|
||||||
|
fix = false;
|
||||||
|
} else {
|
||||||
|
throw sls::RuntimeError("Invalid argument: " + args[1] +
|
||||||
|
". Did you mean fix or nofix?");
|
||||||
|
}
|
||||||
|
if (args.size() == 3) {
|
||||||
|
det->setCurrentSource(defs::currentSrcParameters(
|
||||||
|
fix, StringTo<int64_t>(args[2])));
|
||||||
|
} else if (args.size() == 4) {
|
||||||
|
bool normalCurrent = false;
|
||||||
|
if (args[3] == "normal") {
|
||||||
|
normalCurrent = true;
|
||||||
|
} else if (args[3] == "low") {
|
||||||
|
normalCurrent = false;
|
||||||
|
} else {
|
||||||
|
throw sls::RuntimeError("Invalid argument: " + args[3] +
|
||||||
|
". Did you mean normal or low?");
|
||||||
|
}
|
||||||
|
det->setCurrentSource(defs::currentSrcParameters(
|
||||||
|
fix, StringTo<int64_t>(args[2]), normalCurrent));
|
||||||
|
} else {
|
||||||
|
throw sls::RuntimeError(
|
||||||
|
"Invalid number of parareters for this command.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw sls::RuntimeError(
|
||||||
|
"Invalid number of parareters for this command.");
|
||||||
|
}
|
||||||
|
os << ToString(args) << '\n';
|
||||||
|
} else {
|
||||||
|
throw sls::RuntimeError("Unknown action");
|
||||||
|
}
|
||||||
|
return os.str();
|
||||||
|
}
|
||||||
|
|
||||||
/** temperature */
|
/** temperature */
|
||||||
std::string CmdProxy::TemperatureValues(int action) {
|
std::string CmdProxy::TemperatureValues(int action) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
@ -1095,6 +1157,82 @@ std::string CmdProxy::DacValues(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CmdProxy::ResetDacs(int action) {
|
||||||
|
std::ostringstream os;
|
||||||
|
os << cmd << ' ';
|
||||||
|
if (action == defs::HELP_ACTION) {
|
||||||
|
os << "[(optional) hard] "
|
||||||
|
"\n\t[Eiger][Jungfrau][Gotthard][Moench][Gotthard2]["
|
||||||
|
"Mythen3]Reset dac values to the defaults. A 'hard' optional "
|
||||||
|
"reset will reset the dacs to the hardcoded defaults in on-board "
|
||||||
|
"detector server."
|
||||||
|
<< '\n';
|
||||||
|
} else if (action == defs::GET_ACTION) {
|
||||||
|
throw sls::RuntimeError("Cannot get");
|
||||||
|
} else if (action == defs::PUT_ACTION) {
|
||||||
|
bool hardReset = false;
|
||||||
|
if (args.size() == 1) {
|
||||||
|
if (args[0] != "hard") {
|
||||||
|
throw sls::RuntimeError("Unknown argument " + args[0] +
|
||||||
|
". Did you mean hard?");
|
||||||
|
}
|
||||||
|
hardReset = true;
|
||||||
|
} else if (args.size() > 1) {
|
||||||
|
WrongNumberOfParameters(1);
|
||||||
|
}
|
||||||
|
det->resetToDefaultDacs(hardReset, std::vector<int>{det_id});
|
||||||
|
os << "successful\n";
|
||||||
|
} else {
|
||||||
|
throw sls::RuntimeError("Unknown action");
|
||||||
|
}
|
||||||
|
return os.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CmdProxy::DefaultDac(int action) {
|
||||||
|
std::ostringstream os;
|
||||||
|
os << cmd << ' ';
|
||||||
|
if (action == defs::HELP_ACTION) {
|
||||||
|
os << "[dac name][value][(optional)setting]\n\tSets the default for "
|
||||||
|
"that dac to this value.\n\t[Jungfrau][Mythen3] When settings is "
|
||||||
|
"provided, it sets the default value only for that setting"
|
||||||
|
<< '\n';
|
||||||
|
} else if (action == defs::GET_ACTION) {
|
||||||
|
if (args.size() < 1) {
|
||||||
|
WrongNumberOfParameters(1);
|
||||||
|
}
|
||||||
|
// optional settings
|
||||||
|
if (args.size() == 2) {
|
||||||
|
auto t = det->getDefaultDac(
|
||||||
|
StringTo<defs::dacIndex>(args[0]),
|
||||||
|
sls::StringTo<slsDetectorDefs::detectorSettings>(args[1]),
|
||||||
|
std::vector<int>{det_id});
|
||||||
|
os << args[0] << ' ' << args[1] << ' ' << OutString(t) << '\n';
|
||||||
|
} else {
|
||||||
|
auto t = det->getDefaultDac(StringTo<defs::dacIndex>(args[0]),
|
||||||
|
std::vector<int>{det_id});
|
||||||
|
os << args[0] << ' ' << OutString(t) << '\n';
|
||||||
|
}
|
||||||
|
} else if (action == defs::PUT_ACTION) {
|
||||||
|
if (args.size() < 2) {
|
||||||
|
WrongNumberOfParameters(2);
|
||||||
|
}
|
||||||
|
// optional settings
|
||||||
|
if (args.size() == 3) {
|
||||||
|
det->setDefaultDac(
|
||||||
|
StringTo<defs::dacIndex>(args[0]), StringTo<int>(args[1]),
|
||||||
|
sls::StringTo<slsDetectorDefs::detectorSettings>(args[2]),
|
||||||
|
std::vector<int>{det_id});
|
||||||
|
os << args[0] << ' ' << args[2] << ' ' << args[1] << '\n';
|
||||||
|
} else {
|
||||||
|
det->setDefaultDac(StringTo<defs::dacIndex>(args[0]),
|
||||||
|
StringTo<int>(args[1]));
|
||||||
|
os << args[0] << ' ' << args[1] << '\n';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw sls::RuntimeError("Unknown action");
|
||||||
|
}
|
||||||
|
return os.str();
|
||||||
|
}
|
||||||
/* acquisition */
|
/* acquisition */
|
||||||
|
|
||||||
std::string CmdProxy::ReceiverStatus(int action) {
|
std::string CmdProxy::ReceiverStatus(int action) {
|
||||||
|
@ -584,6 +584,7 @@ class CmdProxy {
|
|||||||
{"detsizechan", "detsize"},
|
{"detsizechan", "detsize"},
|
||||||
{"trimdir", "settingspath"},
|
{"trimdir", "settingspath"},
|
||||||
{"settingsdir", "settingspath"},
|
{"settingsdir", "settingspath"},
|
||||||
|
{"flippeddatax", "fliprows"},
|
||||||
|
|
||||||
/* acquisition parameters */
|
/* acquisition parameters */
|
||||||
{"cycles", "triggers"},
|
{"cycles", "triggers"},
|
||||||
@ -591,6 +592,7 @@ class CmdProxy {
|
|||||||
{"clkdivider", "speed"},
|
{"clkdivider", "speed"},
|
||||||
{"vhighvoltage", "highvoltage"},
|
{"vhighvoltage", "highvoltage"},
|
||||||
{"digitest", "imagetest"},
|
{"digitest", "imagetest"},
|
||||||
|
{"filter", "filterresistor"},
|
||||||
|
|
||||||
/** temperature */
|
/** temperature */
|
||||||
|
|
||||||
@ -671,6 +673,8 @@ class CmdProxy {
|
|||||||
{"vipre_cds", "dac"},
|
{"vipre_cds", "dac"},
|
||||||
{"ibias_sfp", "dac"},
|
{"ibias_sfp", "dac"},
|
||||||
|
|
||||||
|
{"defaultdacs", "resetdacs"},
|
||||||
|
|
||||||
/* acquisition */
|
/* acquisition */
|
||||||
{"busy", "clearbusy"},
|
{"busy", "clearbusy"},
|
||||||
{"receiver", "rx_status"},
|
{"receiver", "rx_status"},
|
||||||
@ -767,6 +771,7 @@ class CmdProxy {
|
|||||||
{"trimval", &CmdProxy::trimval},
|
{"trimval", &CmdProxy::trimval},
|
||||||
{"trimen", &CmdProxy::TrimEnergies},
|
{"trimen", &CmdProxy::TrimEnergies},
|
||||||
{"gappixels", &CmdProxy::GapPixels},
|
{"gappixels", &CmdProxy::GapPixels},
|
||||||
|
{"fliprows", &CmdProxy::fliprows},
|
||||||
|
|
||||||
/* acquisition parameters */
|
/* acquisition parameters */
|
||||||
{"acquire", &CmdProxy::Acquire},
|
{"acquire", &CmdProxy::Acquire},
|
||||||
@ -797,6 +802,8 @@ class CmdProxy {
|
|||||||
{"imagetest", &CmdProxy::imagetest},
|
{"imagetest", &CmdProxy::imagetest},
|
||||||
{"extsig", &CmdProxy::ExternalSignal},
|
{"extsig", &CmdProxy::ExternalSignal},
|
||||||
{"parallel", &CmdProxy::parallel},
|
{"parallel", &CmdProxy::parallel},
|
||||||
|
{"filterresistor", &CmdProxy::filterresistor},
|
||||||
|
{"currentsource", &CmdProxy::CurrentSource},
|
||||||
|
|
||||||
/** temperature */
|
/** temperature */
|
||||||
{"templist", &CmdProxy::templist},
|
{"templist", &CmdProxy::templist},
|
||||||
@ -816,7 +823,8 @@ class CmdProxy {
|
|||||||
{"dac", &CmdProxy::Dac},
|
{"dac", &CmdProxy::Dac},
|
||||||
{"daclist", &CmdProxy::daclist},
|
{"daclist", &CmdProxy::daclist},
|
||||||
{"dacvalues", &CmdProxy::DacValues},
|
{"dacvalues", &CmdProxy::DacValues},
|
||||||
{"defaultdacs", &CmdProxy::defaultdacs},
|
{"resetdacs", &CmdProxy::ResetDacs},
|
||||||
|
{"defaultdac", &CmdProxy::DefaultDac},
|
||||||
|
|
||||||
/* on chip dacs */
|
/* on chip dacs */
|
||||||
{"vchip_comp_fe", &CmdProxy::vchip_comp_fe},
|
{"vchip_comp_fe", &CmdProxy::vchip_comp_fe},
|
||||||
@ -903,7 +911,6 @@ class CmdProxy {
|
|||||||
{"subexptime", &CmdProxy::subexptime},
|
{"subexptime", &CmdProxy::subexptime},
|
||||||
{"subdeadtime", &CmdProxy::subdeadtime},
|
{"subdeadtime", &CmdProxy::subdeadtime},
|
||||||
{"overflow", &CmdProxy::overflow},
|
{"overflow", &CmdProxy::overflow},
|
||||||
{"flippeddatax", &CmdProxy::flippeddatax},
|
|
||||||
{"ratecorr", &CmdProxy::RateCorrection},
|
{"ratecorr", &CmdProxy::RateCorrection},
|
||||||
{"readnlines", &CmdProxy::readnlines},
|
{"readnlines", &CmdProxy::readnlines},
|
||||||
{"interruptsubframe", &CmdProxy::interruptsubframe},
|
{"interruptsubframe", &CmdProxy::interruptsubframe},
|
||||||
@ -918,13 +925,17 @@ class CmdProxy {
|
|||||||
{"datastream", &CmdProxy::DataStream},
|
{"datastream", &CmdProxy::DataStream},
|
||||||
|
|
||||||
/* Jungfrau Specific */
|
/* Jungfrau Specific */
|
||||||
|
{"chipversion", &CmdProxy::chipversion},
|
||||||
{"temp_threshold", &CmdProxy::temp_threshold},
|
{"temp_threshold", &CmdProxy::temp_threshold},
|
||||||
{"temp_control", &CmdProxy::temp_control},
|
{"temp_control", &CmdProxy::temp_control},
|
||||||
{"temp_event", &CmdProxy::TemperatureEvent},
|
{"temp_event", &CmdProxy::TemperatureEvent},
|
||||||
{"auto_comp_disable", &CmdProxy::auto_comp_disable},
|
{"auto_comp_disable", &CmdProxy::auto_comp_disable},
|
||||||
|
{"comp_disable_time", &CmdProxy::comp_disable_time},
|
||||||
{"storagecells", &CmdProxy::storagecells},
|
{"storagecells", &CmdProxy::storagecells},
|
||||||
{"storagecell_start", &CmdProxy::storagecell_start},
|
{"storagecell_start", &CmdProxy::storagecell_start},
|
||||||
{"storagecell_delay", &CmdProxy::storagecell_delay},
|
{"storagecell_delay", &CmdProxy::storagecell_delay},
|
||||||
|
{"gainmode", &CmdProxy::gainmode},
|
||||||
|
{"filtercell", &CmdProxy::filtercell},
|
||||||
|
|
||||||
/* Gotthard Specific */
|
/* Gotthard Specific */
|
||||||
{"roi", &CmdProxy::ROI},
|
{"roi", &CmdProxy::ROI},
|
||||||
@ -941,8 +952,6 @@ class CmdProxy {
|
|||||||
{"vetofile", &CmdProxy::VetoFile},
|
{"vetofile", &CmdProxy::VetoFile},
|
||||||
{"burstmode", &CmdProxy::BurstMode},
|
{"burstmode", &CmdProxy::BurstMode},
|
||||||
{"cdsgain", &CmdProxy::cdsgain},
|
{"cdsgain", &CmdProxy::cdsgain},
|
||||||
{"filter", &CmdProxy::filter},
|
|
||||||
{"currentsource", &CmdProxy::currentsource},
|
|
||||||
{"timingsource", &CmdProxy::timingsource},
|
{"timingsource", &CmdProxy::timingsource},
|
||||||
{"veto", &CmdProxy::veto},
|
{"veto", &CmdProxy::veto},
|
||||||
{"vetostream", &CmdProxy::VetoStreaming},
|
{"vetostream", &CmdProxy::VetoStreaming},
|
||||||
@ -1088,11 +1097,14 @@ class CmdProxy {
|
|||||||
std::string MaxClockPhaseShift(int action);
|
std::string MaxClockPhaseShift(int action);
|
||||||
std::string ClockDivider(int action);
|
std::string ClockDivider(int action);
|
||||||
std::string ExternalSignal(int action);
|
std::string ExternalSignal(int action);
|
||||||
|
std::string CurrentSource(int action);
|
||||||
/** temperature */
|
/** temperature */
|
||||||
std::string TemperatureValues(int action);
|
std::string TemperatureValues(int action);
|
||||||
/* dacs */
|
/* dacs */
|
||||||
std::string Dac(int action);
|
std::string Dac(int action);
|
||||||
std::string DacValues(int action);
|
std::string DacValues(int action);
|
||||||
|
std::string ResetDacs(int action);
|
||||||
|
std::string DefaultDac(int action);
|
||||||
/* acquisition */
|
/* acquisition */
|
||||||
std::string ReceiverStatus(int action);
|
std::string ReceiverStatus(int action);
|
||||||
std::string DetectorStatus(int action);
|
std::string DetectorStatus(int action);
|
||||||
@ -1195,13 +1207,12 @@ class CmdProxy {
|
|||||||
settings, getSettings, setSettings,
|
settings, getSettings, setSettings,
|
||||||
sls::StringTo<slsDetectorDefs::detectorSettings>,
|
sls::StringTo<slsDetectorDefs::detectorSettings>,
|
||||||
"[standard, fast, highgain, dynamicgain, lowgain, "
|
"[standard, fast, highgain, dynamicgain, lowgain, "
|
||||||
"mediumgain, veryhighgain, dynamichg0, "
|
"mediumgain, veryhighgain, highgain0, "
|
||||||
"fixgain1, fixgain2, forceswitchg1, forceswitchg2, "
|
"fixgain1, fixgain2, forceswitchg1, forceswitchg2, "
|
||||||
"verylowgain, g1_hg, g1_lg, g2_hc_hg, g2_hc_lg, "
|
"verylowgain, g1_hg, g1_lg, g2_hc_hg, g2_hc_lg, "
|
||||||
"g2_lc_hg, g2_lc_lg, g4_hg, g4_lg]"
|
"g2_lc_hg, g2_lc_lg, g4_hg, g4_lg, gain0]"
|
||||||
"\n\t Detector Settings"
|
"\n\t Detector Settings"
|
||||||
"\n\t[Jungfrau] - [dynamicgain | dynamichg0 | fixgain1 | "
|
"\n\t[Jungfrau] - [ gain0 | highgain0]"
|
||||||
"fixgain2 | forceswitchg1 | forceswitchg2]"
|
|
||||||
"\n\t[Gotthard] - [dynamicgain | highgain | lowgain | "
|
"\n\t[Gotthard] - [dynamicgain | highgain | lowgain | "
|
||||||
"mediumgain | veryhighgain]"
|
"mediumgain | veryhighgain]"
|
||||||
"\n\t[Gotthard2] - [dynamicgain | fixgain1 | fixgain2]"
|
"\n\t[Gotthard2] - [dynamicgain | fixgain1 | fixgain2]"
|
||||||
@ -1226,6 +1237,14 @@ class CmdProxy {
|
|||||||
"[n_trimval]\n\t[Eiger][Mythen3] All trimbits set to this "
|
"[n_trimval]\n\t[Eiger][Mythen3] All trimbits set to this "
|
||||||
"value. Returns -1 if all trimbits are different values.");
|
"value. Returns -1 if all trimbits are different values.");
|
||||||
|
|
||||||
|
INTEGER_COMMAND_VEC_ID(
|
||||||
|
fliprows, getFlipRows, setFlipRows, StringTo<int>,
|
||||||
|
"[0, 1]\n\t[Eiger] flips rows paramater sent to slsreceiver "
|
||||||
|
"to stream as json parameter to flip rows in gui \n\t[Jungfrau] flips "
|
||||||
|
"rows in the detector itself. For bottom module and number of "
|
||||||
|
"interfaces must be set to 2. slsReceiver and slsDetectorGui "
|
||||||
|
"does not handle.");
|
||||||
|
|
||||||
/* acquisition parameters */
|
/* acquisition parameters */
|
||||||
|
|
||||||
INTEGER_COMMAND_SET_NOID_GET_ID(
|
INTEGER_COMMAND_SET_NOID_GET_ID(
|
||||||
@ -1314,7 +1333,7 @@ class CmdProxy {
|
|||||||
"the chip. \n\t[Moench] Default is 0. \n\t[Jungfrau] Default is 0. Get "
|
"the chip. \n\t[Moench] Default is 0. \n\t[Jungfrau] Default is 0. Get "
|
||||||
"will return power status. Can be off if temperature event occured "
|
"will return power status. Can be off if temperature event occured "
|
||||||
"(temperature over temp_threshold with temp_control "
|
"(temperature over temp_threshold with temp_control "
|
||||||
"enabled.\n\t[Mythen3][Gotthard2] Default is 1. If module not "
|
"enabled. Will configure chip (only chip v1.1)\n\t[Mythen3][Gotthard2] Default is 1. If module not "
|
||||||
"connected or wrong module, powerchip will fail.");
|
"connected or wrong module, powerchip will fail.");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
@ -1331,6 +1350,12 @@ class CmdProxy {
|
|||||||
"acquisition will return ERROR status and take fewer "
|
"acquisition will return ERROR status and take fewer "
|
||||||
"frames than expected.");
|
"frames than expected.");
|
||||||
|
|
||||||
|
INTEGER_COMMAND_VEC_ID(
|
||||||
|
filterresistor, getFilterResistor, setFilterResistor, StringTo<int>,
|
||||||
|
"[value] [Gotthard2][Jungfrau] Set filter resistor. Increasing values "
|
||||||
|
"for increasing resistance.\n\t[Gotthard2] Options: [0|1|2|3]. Default "
|
||||||
|
"is 0.\n\t[Jungfrau] Options: [0|1]. Default is 1.");
|
||||||
|
|
||||||
/** temperature */
|
/** temperature */
|
||||||
GET_COMMAND_NOID(
|
GET_COMMAND_NOID(
|
||||||
templist, getTemperatureList,
|
templist, getTemperatureList,
|
||||||
@ -1381,10 +1406,6 @@ class CmdProxy {
|
|||||||
daclist, getDacList,
|
daclist, getDacList,
|
||||||
"\n\tGets the list of commands for every dac for this detector.");
|
"\n\tGets the list of commands for every dac for this detector.");
|
||||||
|
|
||||||
EXECUTE_SET_COMMAND(defaultdacs, setDefaultDacs,
|
|
||||||
"\n\t[Eiger][Jungfrau][Gotthard][Moench][Gotthard2]["
|
|
||||||
"Mythen3]Sets default dacs on to the detector.");
|
|
||||||
|
|
||||||
/* on chip dacs */
|
/* on chip dacs */
|
||||||
INTEGER_USER_IND_COMMAND(
|
INTEGER_USER_IND_COMMAND(
|
||||||
vchip_comp_fe, getOnChipDAC, setOnChipDAC, StringTo<int>,
|
vchip_comp_fe, getOnChipDAC, setOnChipDAC, StringTo<int>,
|
||||||
@ -1775,13 +1796,6 @@ class CmdProxy {
|
|||||||
"[0, 1]\n\t[Eiger] Enable or disable show overflow flag in "
|
"[0, 1]\n\t[Eiger] Enable or disable show overflow flag in "
|
||||||
"32 bit mode. Default is disabled.");
|
"32 bit mode. Default is disabled.");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
|
||||||
flippeddatax, getBottom, setBottom, StringTo<int>,
|
|
||||||
"[0, 1]\n\t[Eiger] Top or Bottom Half of Eiger module. 1 is bottom, 0 "
|
|
||||||
"is top. Used to let Gui (via zmq from receiver) know to flip the "
|
|
||||||
"bottom image over the x axis. Files are not written without the flip "
|
|
||||||
"however.");
|
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
readnlines, getPartialReadout, setPartialReadout, StringTo<int>,
|
readnlines, getPartialReadout, setPartialReadout, StringTo<int>,
|
||||||
"[1 - 256]\n\t[Eiger] Number of rows to readout per half module "
|
"[1 - 256]\n\t[Eiger] Number of rows to readout per half module "
|
||||||
@ -1812,6 +1826,9 @@ class CmdProxy {
|
|||||||
|
|
||||||
/* Jungfrau Specific */
|
/* Jungfrau Specific */
|
||||||
|
|
||||||
|
GET_COMMAND(chipversion, getChipVersion,
|
||||||
|
"\n\t[Jungfrau] Returns chip version. Can be 1.0 or 1.1");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
temp_threshold, getThresholdTemperature, setThresholdTemperature,
|
temp_threshold, getThresholdTemperature, setThresholdTemperature,
|
||||||
StringTo<int>,
|
StringTo<int>,
|
||||||
@ -1832,33 +1849,52 @@ class CmdProxy {
|
|||||||
"cleared.");
|
"cleared.");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
auto_comp_disable, getAutoCompDisable, setAutoCompDisable,
|
auto_comp_disable, getAutoComparatorDisable, setAutoComparatorDisable,
|
||||||
StringTo<int>,
|
StringTo<int>,
|
||||||
"[0, 1]\n\t[Jungfrau] Auto comparator disable mode. By default, the "
|
"[0, 1]\n\t[Jungfrau] Auto comparator disable mode. By default, the "
|
||||||
"on-chip gain switching is active during the entire exposure.This mode "
|
"on-chip gain switching is active during the entire exposure.This mode "
|
||||||
"disables the on - chip gain switching comparator automatically after "
|
"disables the on - chip gain switching comparator automatically after "
|
||||||
"93.75% of exposure time (only for longer than 100us). \n\tDefault is "
|
"93.75% (only for chipv1.0) of exposure time (only for longer than "
|
||||||
"0 or this mode disabled(comparator enabled throughout). 1 enables "
|
"100us). It is possible to set the duration for chipv1.1 using "
|
||||||
"mode. 0 disables mode. ");
|
"comp_disable_time command.\n\tDefault is 0 or this mode "
|
||||||
|
"disabled(comparator enabled throughout). 1 enables mode. 0 disables "
|
||||||
|
"mode. ");
|
||||||
|
|
||||||
|
TIME_COMMAND(comp_disable_time, getComparatorDisableTime,
|
||||||
|
setComparatorDisableTime,
|
||||||
|
"[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] Time "
|
||||||
|
"before end of exposure when comparator is disabled. It is "
|
||||||
|
"only possible for chipv1.1.");
|
||||||
|
|
||||||
INTEGER_COMMAND_SET_NOID_GET_ID(
|
INTEGER_COMMAND_SET_NOID_GET_ID(
|
||||||
storagecells, getNumberOfAdditionalStorageCells,
|
storagecells, getNumberOfAdditionalStorageCells,
|
||||||
setNumberOfAdditionalStorageCells, StringTo<int>,
|
setNumberOfAdditionalStorageCells, StringTo<int>,
|
||||||
"[0-15]\n\t[Jungfrau] Number of additional storage cells. Default is "
|
"[0-15]\n\t[Jungfrau] Only for chipv1.0. Number of additional storage cells. Default is "
|
||||||
"0. For advanced users only. \n\tThe #images = #frames x #triggers x "
|
"0. For advanced users only. \n\tThe #images = #frames x #triggers x "
|
||||||
"(#storagecells + 1).");
|
"(#storagecells + 1).");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
storagecell_start, getStorageCellStart, setStorageCellStart,
|
storagecell_start, getStorageCellStart, setStorageCellStart,
|
||||||
StringTo<int>,
|
StringTo<int>,
|
||||||
"[0-15]\n\t[Jungfrau] Storage cell that stores the first acquisition "
|
"[0-max]\n\t[Jungfrau] Storage cell that stores the first acquisition "
|
||||||
"of the series. Default is 15. For advanced users only.");
|
"of the series. max is 15 (default) for chipv1.0 and 3 (default) for chipv1.1. For advanced users only.");
|
||||||
|
|
||||||
TIME_COMMAND(
|
TIME_COMMAND(
|
||||||
storagecell_delay, getStorageCellDelay, setStorageCellDelay,
|
storagecell_delay, getStorageCellDelay, setStorageCellDelay,
|
||||||
"[duration (0-1638375 ns)] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] "
|
"[duration (0-1638375 ns)] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] "
|
||||||
"Additional time delay between 2 consecutive exposures in burst mode "
|
"Additional time delay between 2 consecutive exposures in burst mode "
|
||||||
"(resolution of 25ns). For advanced users only.");
|
"(resolution of 25ns). Only applicable for chipv1.0. For advanced users only.");
|
||||||
|
|
||||||
|
INTEGER_COMMAND_VEC_ID(
|
||||||
|
gainmode, getGainMode, setGainMode,
|
||||||
|
sls::StringTo<slsDetectorDefs::gainMode>,
|
||||||
|
"[dynamicgain|forceswitchg1|forceswitchg2|fixg1|fixg2|fixg0]\n\t["
|
||||||
|
"Jungfrau] Gain mode.\n\tCAUTION: Do not use fixg0 without caution, "
|
||||||
|
"you can damage the detector!!!");
|
||||||
|
|
||||||
|
INTEGER_COMMAND_VEC_ID(
|
||||||
|
filtercell, getFilterCell, setFilterCell, sls::StringTo<int>,
|
||||||
|
"[0-12]\n\t[Jungfrau] Set Filter Cell. Advanced user Command");
|
||||||
|
|
||||||
/* Gotthard Specific */
|
/* Gotthard Specific */
|
||||||
TIME_GET_COMMAND(exptimel, getExptimeLeft,
|
TIME_GET_COMMAND(exptimel, getExptimeLeft,
|
||||||
@ -1886,15 +1922,6 @@ class CmdProxy {
|
|||||||
"[0, 1]\n\t[Gotthard2] Enable or disable CDS gain. Default "
|
"[0, 1]\n\t[Gotthard2] Enable or disable CDS gain. Default "
|
||||||
"is disabled.");
|
"is disabled.");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
|
||||||
filter, getFilter, setFilter, StringTo<int>,
|
|
||||||
"[0|1|2|3]\n\t[Gotthard2] Set filter resistor. Default is 0.");
|
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
|
||||||
currentsource, getCurrentSource, setCurrentSource, StringTo<int>,
|
|
||||||
"[0, 1]\n\t[Gotthard2] Enable or disable current source. "
|
|
||||||
"Default is disabled.");
|
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
timingsource, getTimingSource, setTimingSource,
|
timingsource, getTimingSource, setTimingSource,
|
||||||
sls::StringTo<slsDetectorDefs::timingSourceType>,
|
sls::StringTo<slsDetectorDefs::timingSourceType>,
|
||||||
|
@ -158,13 +158,11 @@ std::vector<defs::detectorSettings> Detector::getSettingsList() const {
|
|||||||
defs::HIGHGAIN, defs::DYNAMICGAIN, defs::LOWGAIN, defs::MEDIUMGAIN,
|
defs::HIGHGAIN, defs::DYNAMICGAIN, defs::LOWGAIN, defs::MEDIUMGAIN,
|
||||||
defs::VERYHIGHGAIN};
|
defs::VERYHIGHGAIN};
|
||||||
case defs::JUNGFRAU:
|
case defs::JUNGFRAU:
|
||||||
return std::vector<defs::detectorSettings>{
|
return std::vector<defs::detectorSettings>{defs::GAIN0,
|
||||||
defs::DYNAMICGAIN, defs::DYNAMICHG0, defs::FIXGAIN1,
|
defs::HIGHGAIN0};
|
||||||
defs::FIXGAIN2, defs::FORCESWITCHG1, defs::FORCESWITCHG2};
|
|
||||||
case defs::GOTTHARD2:
|
case defs::GOTTHARD2:
|
||||||
return std::vector<defs::detectorSettings>{
|
return std::vector<defs::detectorSettings>{
|
||||||
defs::DYNAMICGAIN, defs::DYNAMICHG0, defs::FIXGAIN1,
|
defs::DYNAMICGAIN, defs::FIXGAIN1, defs::FIXGAIN2};
|
||||||
defs::FIXGAIN2};
|
|
||||||
case defs::MOENCH:
|
case defs::MOENCH:
|
||||||
return std::vector<defs::detectorSettings>{
|
return std::vector<defs::detectorSettings>{
|
||||||
defs::G1_HIGHGAIN, defs::G1_LOWGAIN,
|
defs::G1_HIGHGAIN, defs::G1_LOWGAIN,
|
||||||
@ -281,6 +279,14 @@ void Detector::setGapPixelsinCallback(bool enable) {
|
|||||||
pimpl->setGapPixelsinCallback(enable);
|
pimpl->setGapPixelsinCallback(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result<bool> Detector::getFlipRows(Positions pos) const {
|
||||||
|
return pimpl->Parallel(&Module::getFlipRows, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setFlipRows(bool value, Positions pos) {
|
||||||
|
pimpl->Parallel(&Module::setFlipRows, pos, value);
|
||||||
|
}
|
||||||
|
|
||||||
Result<bool> Detector::isVirtualDetectorServer(Positions pos) const {
|
Result<bool> Detector::isVirtualDetectorServer(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::isVirtualDetectorServer, pos);
|
return pimpl->Parallel(&Module::isVirtualDetectorServer, pos);
|
||||||
}
|
}
|
||||||
@ -621,8 +627,38 @@ std::vector<defs::dacIndex> Detector::getDacList() const {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setDefaultDacs(Positions pos) {
|
Result<int> Detector::getDefaultDac(defs::dacIndex index, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setDefaultDacs, pos);
|
return pimpl->getDefaultDac(index, defs::UNDEFINED, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setDefaultDac(defs::dacIndex index, int defaultValue,
|
||||||
|
Positions pos) {
|
||||||
|
pimpl->setDefaultDac(index, defaultValue, defs::UNDEFINED, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
Result<int> Detector::getDefaultDac(defs::dacIndex index,
|
||||||
|
defs::detectorSettings sett,
|
||||||
|
Positions pos) {
|
||||||
|
if (sett == defs::UNDEFINED) {
|
||||||
|
throw RuntimeError("Invalid settings given for default dac");
|
||||||
|
}
|
||||||
|
return pimpl->getDefaultDac(index, sett, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setDefaultDac(defs::dacIndex index, int defaultValue,
|
||||||
|
defs::detectorSettings sett, Positions pos) {
|
||||||
|
if (sett == defs::UNDEFINED) {
|
||||||
|
throw RuntimeError("Invalid settings given for default dac");
|
||||||
|
}
|
||||||
|
pimpl->setDefaultDac(index, defaultValue, sett, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Detector::resetToDefaultDacs(const bool hardReset, Positions pos) {
|
||||||
|
pimpl->Parallel(&Module::resetToDefaultDacs, pos, hardReset);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getDAC(defs::dacIndex index, bool mV,
|
Result<int> Detector::getDAC(defs::dacIndex index, bool mV,
|
||||||
@ -663,6 +699,22 @@ void Detector::setParallelMode(bool value, Positions pos) {
|
|||||||
pimpl->Parallel(&Module::setParallelMode, pos, value);
|
pimpl->Parallel(&Module::setParallelMode, pos, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result<int> Detector::getFilterResistor(Positions pos) const {
|
||||||
|
return pimpl->Parallel(&Module::getFilterResistor, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setFilterResistor(int value, Positions pos) {
|
||||||
|
pimpl->Parallel(&Module::setFilterResistor, pos, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
Result<defs::currentSrcParameters>
|
||||||
|
Detector::getCurrentSource(Positions pos) const {
|
||||||
|
return pimpl->Parallel(&Module::getCurrentSource, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setCurrentSource(defs::currentSrcParameters par, Positions pos) {
|
||||||
|
pimpl->Parallel(&Module::setCurrentSource, pos, par);
|
||||||
|
}
|
||||||
// Acquisition
|
// Acquisition
|
||||||
|
|
||||||
void Detector::acquire() { pimpl->acquire(); }
|
void Detector::acquire() { pimpl->acquire(); }
|
||||||
@ -754,7 +806,7 @@ Result<int> Detector::getNumberofUDPInterfaces(Positions pos) const {
|
|||||||
"Cannot set number of udp interfaces for this detector.");
|
"Cannot set number of udp interfaces for this detector.");
|
||||||
}
|
}
|
||||||
// also called by vetostream (for gotthard2)
|
// also called by vetostream (for gotthard2)
|
||||||
return getNumberofUDPInterfaces_(pos);
|
return pimpl->getNumberofUDPInterfaces(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setNumberofUDPInterfaces(int n, Positions pos) {
|
void Detector::setNumberofUDPInterfaces(int n, Positions pos) {
|
||||||
@ -766,10 +818,6 @@ void Detector::setNumberofUDPInterfaces(int n, Positions pos) {
|
|||||||
setNumberofUDPInterfaces_(n, pos);
|
setNumberofUDPInterfaces_(n, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getNumberofUDPInterfaces_(Positions pos) const {
|
|
||||||
return pimpl->Parallel(&Module::getNumberofUDPInterfaces, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Detector::setNumberofUDPInterfaces_(int n, Positions pos) {
|
void Detector::setNumberofUDPInterfaces_(int n, Positions pos) {
|
||||||
bool previouslyClientStreaming = pimpl->getDataStreamingToClient();
|
bool previouslyClientStreaming = pimpl->getDataStreamingToClient();
|
||||||
bool useReceiver = getUseReceiverFlag().squash(false);
|
bool useReceiver = getUseReceiverFlag().squash(false);
|
||||||
@ -1280,14 +1328,6 @@ void Detector::setOverFlowMode(bool value, Positions pos) {
|
|||||||
pimpl->Parallel(&Module::setOverFlowMode, pos, value);
|
pimpl->Parallel(&Module::setOverFlowMode, pos, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<bool> Detector::getBottom(Positions pos) const {
|
|
||||||
return pimpl->Parallel(&Module::getFlippedDataX, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Detector::setBottom(bool value, Positions pos) {
|
|
||||||
pimpl->Parallel(&Module::setFlippedDataX, pos, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
Result<ns> Detector::getRateCorrection(Positions pos) const {
|
Result<ns> Detector::getRateCorrection(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getRateCorrection, pos);
|
return pimpl->Parallel(&Module::getRateCorrection, pos);
|
||||||
}
|
}
|
||||||
@ -1398,6 +1438,9 @@ void Detector::setDataStream(const defs::portPosition port, const bool enable,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Jungfrau Specific
|
// Jungfrau Specific
|
||||||
|
Result<double> Detector::getChipVersion(Positions pos) const {
|
||||||
|
return pimpl->Parallel(&Module::getChipVersion, pos);
|
||||||
|
}
|
||||||
|
|
||||||
Result<int> Detector::getThresholdTemperature(Positions pos) const {
|
Result<int> Detector::getThresholdTemperature(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getThresholdTemperature, pos);
|
return pimpl->Parallel(&Module::getThresholdTemperature, pos);
|
||||||
@ -1423,14 +1466,22 @@ void Detector::resetTemperatureEvent(Positions pos) {
|
|||||||
pimpl->Parallel(&Module::resetTemperatureEvent, pos);
|
pimpl->Parallel(&Module::resetTemperatureEvent, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<bool> Detector::getAutoCompDisable(Positions pos) const {
|
Result<bool> Detector::getAutoComparatorDisable(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getAutoComparatorDisableMode, pos);
|
return pimpl->Parallel(&Module::getAutoComparatorDisableMode, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setAutoCompDisable(bool value, Positions pos) {
|
void Detector::setAutoComparatorDisable(bool value, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setAutoComparatorDisableMode, pos, value);
|
pimpl->Parallel(&Module::setAutoComparatorDisableMode, pos, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result<ns> Detector::getComparatorDisableTime(Positions pos) const {
|
||||||
|
return pimpl->Parallel(&Module::getComparatorDisableTime, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setComparatorDisableTime(ns t, Positions pos) {
|
||||||
|
pimpl->Parallel(&Module::setComparatorDisableTime, pos, t.count());
|
||||||
|
}
|
||||||
|
|
||||||
Result<int> Detector::getNumberOfAdditionalStorageCells(Positions pos) const {
|
Result<int> Detector::getNumberOfAdditionalStorageCells(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getNumberOfAdditionalStorageCells, pos);
|
return pimpl->Parallel(&Module::getNumberOfAdditionalStorageCells, pos);
|
||||||
}
|
}
|
||||||
@ -1455,6 +1506,37 @@ void Detector::setStorageCellDelay(ns value, Positions pos) {
|
|||||||
pimpl->Parallel(&Module::setStorageCellDelay, pos, value.count());
|
pimpl->Parallel(&Module::setStorageCellDelay, pos, value.count());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<defs::gainMode> Detector::getGainModeList() const {
|
||||||
|
switch (getDetectorType().squash()) {
|
||||||
|
case defs::JUNGFRAU:
|
||||||
|
return std::vector<defs::gainMode>{defs::DYNAMIC,
|
||||||
|
defs::FORCE_SWITCH_G1,
|
||||||
|
defs::FORCE_SWITCH_G2,
|
||||||
|
defs::FIX_G1,
|
||||||
|
defs::FIX_G2,
|
||||||
|
defs::FIX_G0};
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw RuntimeError("Gain mode is not implemented for this detector.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Result<defs::gainMode> Detector::getGainMode(Positions pos) const {
|
||||||
|
return pimpl->Parallel(&Module::getGainMode, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setGainMode(const defs::gainMode mode, Positions pos) {
|
||||||
|
pimpl->Parallel(&Module::setGainMode, pos, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
Result<int> Detector::getFilterCell(Positions pos) const {
|
||||||
|
return pimpl->Parallel(&Module::getFilterCell, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setFilterCell(int cell, Positions pos) {
|
||||||
|
pimpl->Parallel(&Module::setFilterCell, pos, cell);
|
||||||
|
}
|
||||||
|
|
||||||
// Gotthard Specific
|
// Gotthard Specific
|
||||||
|
|
||||||
Result<defs::ROI> Detector::getROI(Positions pos) const {
|
Result<defs::ROI> Detector::getROI(Positions pos) const {
|
||||||
@ -1546,22 +1628,6 @@ void Detector::setCDSGain(bool value, Positions pos) {
|
|||||||
pimpl->Parallel(&Module::setCDSGain, pos, value);
|
pimpl->Parallel(&Module::setCDSGain, pos, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getFilter(Positions pos) const {
|
|
||||||
return pimpl->Parallel(&Module::getFilter, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Detector::setFilter(int value, Positions pos) {
|
|
||||||
pimpl->Parallel(&Module::setFilter, pos, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
Result<bool> Detector::getCurrentSource(Positions pos) const {
|
|
||||||
return pimpl->Parallel(&Module::getCurrentSource, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Detector::setCurrentSource(bool value, Positions pos) {
|
|
||||||
pimpl->Parallel(&Module::setCurrentSource, pos, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
Result<defs::timingSourceType> Detector::getTimingSource(Positions pos) const {
|
Result<defs::timingSourceType> Detector::getTimingSource(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getTimingSource, pos);
|
return pimpl->Parallel(&Module::getTimingSource, pos);
|
||||||
}
|
}
|
||||||
@ -1582,7 +1648,7 @@ Result<defs::streamingInterface> Detector::getVetoStream(Positions pos) const {
|
|||||||
// 3gbe
|
// 3gbe
|
||||||
auto r3 = pimpl->Parallel(&Module::getVetoStream, pos);
|
auto r3 = pimpl->Parallel(&Module::getVetoStream, pos);
|
||||||
// 10gbe (debugging interface) opens 2nd udp interface in receiver
|
// 10gbe (debugging interface) opens 2nd udp interface in receiver
|
||||||
auto r10 = getNumberofUDPInterfaces_(pos);
|
auto r10 = pimpl->getNumberofUDPInterfaces(pos);
|
||||||
|
|
||||||
Result<defs::streamingInterface> res(r3.size());
|
Result<defs::streamingInterface> res(r3.size());
|
||||||
for (unsigned int i = 0; i < res.size(); ++i) {
|
for (unsigned int i = 0; i < res.size(); ++i) {
|
||||||
@ -1602,7 +1668,7 @@ void Detector::setVetoStream(defs::streamingInterface interface, Positions pos)
|
|||||||
pimpl->Parallel(&Module::setVetoStream, pos, LOW_LATENCY_LINK);
|
pimpl->Parallel(&Module::setVetoStream, pos, LOW_LATENCY_LINK);
|
||||||
|
|
||||||
// 10gbe (debugging interface) opens 2nd udp interface in receiver
|
// 10gbe (debugging interface) opens 2nd udp interface in receiver
|
||||||
int old_numinterfaces = getNumberofUDPInterfaces_(pos).tsquash(
|
int old_numinterfaces = pimpl->getNumberofUDPInterfaces(pos).tsquash(
|
||||||
"retrieved inconsistent number of udp interfaces");
|
"retrieved inconsistent number of udp interfaces");
|
||||||
int numinterfaces = (((interface & defs::streamingInterface::ETHERNET_10GB) ==
|
int numinterfaces = (((interface & defs::streamingInterface::ETHERNET_10GB) ==
|
||||||
defs::streamingInterface::ETHERNET_10GB)
|
defs::streamingInterface::ETHERNET_10GB)
|
||||||
@ -2167,7 +2233,7 @@ std::vector<int> Detector::getPortNumbers(int start_port) {
|
|||||||
break;
|
break;
|
||||||
case defs::JUNGFRAU:
|
case defs::JUNGFRAU:
|
||||||
case defs::GOTTHARD2:
|
case defs::GOTTHARD2:
|
||||||
if (getNumberofUDPInterfaces_({}).squash() == 2) {
|
if (pimpl->getNumberofUDPInterfaces({}).squash() == 2) {
|
||||||
num_sockets_per_detector *= 2;
|
num_sockets_per_detector *= 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -490,8 +490,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
|||||||
uint64_t currentAcquisitionIndex = -1, currentFrameIndex = -1,
|
uint64_t currentAcquisitionIndex = -1, currentFrameIndex = -1,
|
||||||
currentFileIndex = -1;
|
currentFileIndex = -1;
|
||||||
double currentProgress = 0.00;
|
double currentProgress = 0.00;
|
||||||
uint32_t currentSubFrameIndex = -1, coordX = -1, coordY = -1,
|
uint32_t currentSubFrameIndex = -1, coordX = -1, coordY = -1, flipRows = -1;
|
||||||
flippedDataX = -1;
|
|
||||||
|
|
||||||
while (numZmqRunning != 0) {
|
while (numZmqRunning != 0) {
|
||||||
// reset data
|
// reset data
|
||||||
@ -571,7 +570,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
|||||||
if (eiger) {
|
if (eiger) {
|
||||||
coordY = (nY - 1) - coordY;
|
coordY = (nY - 1) - coordY;
|
||||||
}
|
}
|
||||||
flippedDataX = zHeader.flippedDataX;
|
flipRows = zHeader.flipRows;
|
||||||
if (zHeader.completeImage == 0) {
|
if (zHeader.completeImage == 0) {
|
||||||
completeImage = false;
|
completeImage = false;
|
||||||
}
|
}
|
||||||
@ -585,7 +584,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
|||||||
<< "\n\tcurrentSubFrameIndex: " << currentSubFrameIndex
|
<< "\n\tcurrentSubFrameIndex: " << currentSubFrameIndex
|
||||||
<< "\n\tcurrentProgress: " << currentProgress
|
<< "\n\tcurrentProgress: " << currentProgress
|
||||||
<< "\n\tcoordX: " << coordX << "\n\tcoordY: " << coordY
|
<< "\n\tcoordX: " << coordX << "\n\tcoordY: " << coordY
|
||||||
<< "\n\tflippedDataX: " << flippedDataX
|
<< "\n\tflipRows: " << flipRows
|
||||||
<< "\n\tcompleteImage: " << completeImage;
|
<< "\n\tcompleteImage: " << completeImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -609,7 +608,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
|||||||
<< "\n\tsingledetrowoffset: " << singledetrowoffset
|
<< "\n\tsingledetrowoffset: " << singledetrowoffset
|
||||||
<< "\n\trowoffset: " << rowoffset;
|
<< "\n\trowoffset: " << rowoffset;
|
||||||
|
|
||||||
if (eiger && (flippedDataX != 0U)) {
|
if (eiger && (flipRows != 0U)) {
|
||||||
for (uint32_t i = 0; i < nPixelsY; ++i) {
|
for (uint32_t i = 0; i < nPixelsY; ++i) {
|
||||||
memcpy((multiframe.get()) +
|
memcpy((multiframe.get()) +
|
||||||
((yoffset + (nPixelsY - 1 - i)) *
|
((yoffset + (nPixelsY - 1 - i)) *
|
||||||
@ -1369,4 +1368,19 @@ std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sls::Result<int> DetectorImpl::getNumberofUDPInterfaces(Positions pos) const {
|
||||||
|
return Parallel(&Module::getNumberofUDPInterfaces, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
sls::Result<int> DetectorImpl::getDefaultDac(defs::dacIndex index,
|
||||||
|
defs::detectorSettings sett,
|
||||||
|
Positions pos) {
|
||||||
|
return Parallel(&Module::getDefaultDac, pos, index, sett);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DetectorImpl::setDefaultDac(defs::dacIndex index, int defaultValue,
|
||||||
|
defs::detectorSettings sett, Positions pos) {
|
||||||
|
Parallel(&Module::setDefaultDac, pos, index, defaultValue, sett);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace sls
|
} // namespace sls
|
@ -291,6 +291,14 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
std::vector<char> readProgrammingFile(const std::string &fname);
|
std::vector<char> readProgrammingFile(const std::string &fname);
|
||||||
|
|
||||||
|
sls::Result<int> getNumberofUDPInterfaces(Positions pos) const;
|
||||||
|
void setNumberofUDPInterfaces(int n, Positions pos);
|
||||||
|
sls::Result<int> getDefaultDac(defs::dacIndex index,
|
||||||
|
defs::detectorSettings sett,
|
||||||
|
Positions pos = {});
|
||||||
|
void setDefaultDac(defs::dacIndex index, int defaultValue,
|
||||||
|
defs::detectorSettings sett, Positions pos);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Creates/open shared memory, initializes detector structure and members
|
* Creates/open shared memory, initializes detector structure and members
|
||||||
|
@ -458,6 +458,21 @@ int Module::setTrimEn(const std::vector<int> &energies) {
|
|||||||
return shm()->trimEnergies.size();
|
return shm()->trimEnergies.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Module::getFlipRows() const {
|
||||||
|
if (shm()->myDetectorType == EIGER) {
|
||||||
|
return sendToReceiver<int>(F_GET_FLIP_ROWS_RECEIVER);
|
||||||
|
}
|
||||||
|
return sendToDetector<int>(F_GET_FLIP_ROWS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Module::setFlipRows(bool value) {
|
||||||
|
if (shm()->myDetectorType == EIGER) {
|
||||||
|
sendToReceiver<int>(F_SET_FLIP_ROWS_RECEIVER, static_cast<int>(value));
|
||||||
|
} else {
|
||||||
|
sendToDetector(F_SET_FLIP_ROWS, static_cast<int>(value), nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Module::isVirtualDetectorServer() const {
|
bool Module::isVirtualDetectorServer() const {
|
||||||
return sendToDetector<int>(F_IS_VIRTUAL);
|
return sendToDetector<int>(F_IS_VIRTUAL);
|
||||||
}
|
}
|
||||||
@ -618,8 +633,21 @@ int Module::getDAC(dacIndex index, bool mV) const {
|
|||||||
int args[]{static_cast<int>(index), static_cast<int>(mV), GET_FLAG};
|
int args[]{static_cast<int>(index), static_cast<int>(mV), GET_FLAG};
|
||||||
return sendToDetector<int>(F_SET_DAC, args);
|
return sendToDetector<int>(F_SET_DAC, args);
|
||||||
}
|
}
|
||||||
|
int Module::getDefaultDac(slsDetectorDefs::dacIndex index,
|
||||||
|
slsDetectorDefs::detectorSettings sett) {
|
||||||
|
int args[]{static_cast<int>(index), static_cast<int>(sett)};
|
||||||
|
return sendToDetector<int>(F_GET_DEFAULT_DAC, args);
|
||||||
|
}
|
||||||
|
void Module::setDefaultDac(slsDetectorDefs::dacIndex index, int defaultValue,
|
||||||
|
defs::detectorSettings sett) {
|
||||||
|
int args[]{static_cast<int>(index), static_cast<int>(sett), defaultValue};
|
||||||
|
return sendToDetector(F_SET_DEFAULT_DAC, args, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
void Module::setDefaultDacs() { sendToDetector(F_SET_DEFAULT_DACS); }
|
void Module::resetToDefaultDacs(const bool hardReset) {
|
||||||
|
sendToDetector(F_RESET_TO_DEFAULT_DACS, static_cast<int>(hardReset),
|
||||||
|
nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
void Module::setDAC(int val, dacIndex index, bool mV) {
|
void Module::setDAC(int val, dacIndex index, bool mV) {
|
||||||
int args[]{static_cast<int>(index), static_cast<int>(mV), val};
|
int args[]{static_cast<int>(index), static_cast<int>(mV), val};
|
||||||
@ -676,6 +704,22 @@ void Module::setParallelMode(const bool enable) {
|
|||||||
sendToDetector(F_SET_PARALLEL_MODE, static_cast<int>(enable), nullptr);
|
sendToDetector(F_SET_PARALLEL_MODE, static_cast<int>(enable), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Module::getFilterResistor() const {
|
||||||
|
return sendToDetector<int>(F_GET_FILTER_RESISTOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Module::setFilterResistor(int value) {
|
||||||
|
sendToDetector(F_SET_FILTER_RESISTOR, value, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
defs::currentSrcParameters Module::getCurrentSource() const {
|
||||||
|
return sendToDetector<defs::currentSrcParameters>(F_GET_CURRENT_SOURCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Module::setCurrentSource(defs::currentSrcParameters par) {
|
||||||
|
sendToDetector(F_SET_CURRENT_SOURCE, par, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
// Acquisition
|
// Acquisition
|
||||||
|
|
||||||
void Module::startReceiver() {
|
void Module::startReceiver() {
|
||||||
@ -1385,14 +1429,6 @@ void Module::setOverFlowMode(const bool enable) {
|
|||||||
sendToDetector(F_SET_OVERFLOW_MODE, static_cast<int>(enable), nullptr);
|
sendToDetector(F_SET_OVERFLOW_MODE, static_cast<int>(enable), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Module::getFlippedDataX() const {
|
|
||||||
return sendToReceiver<int>(F_SET_FLIPPED_DATA_RECEIVER, GET_FLAG);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setFlippedDataX(bool value) {
|
|
||||||
sendToReceiver<int>(F_SET_FLIPPED_DATA_RECEIVER, static_cast<int>(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t Module::getRateCorrection() const {
|
int64_t Module::getRateCorrection() const {
|
||||||
return sendToDetector<int64_t>(F_GET_RATE_CORRECT);
|
return sendToDetector<int64_t>(F_GET_RATE_CORRECT);
|
||||||
}
|
}
|
||||||
@ -1522,6 +1558,9 @@ void Module::setDataStream(const portPosition port, const bool enable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Jungfrau Specific
|
// Jungfrau Specific
|
||||||
|
double Module::getChipVersion() const {
|
||||||
|
return (sendToDetector<int>(F_GET_CHIP_VERSION)) / 10.00;
|
||||||
|
}
|
||||||
|
|
||||||
int Module::getThresholdTemperature() const {
|
int Module::getThresholdTemperature() const {
|
||||||
auto retval = sendToDetectorStop<int>(F_THRESHOLD_TEMP, GET_FLAG);
|
auto retval = sendToDetectorStop<int>(F_THRESHOLD_TEMP, GET_FLAG);
|
||||||
@ -1561,6 +1600,14 @@ void Module::setAutoComparatorDisableMode(bool val) {
|
|||||||
sendToDetector<int>(F_AUTO_COMP_DISABLE, static_cast<int>(val));
|
sendToDetector<int>(F_AUTO_COMP_DISABLE, static_cast<int>(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t Module::getComparatorDisableTime() const {
|
||||||
|
return sendToDetector<int64_t>(F_GET_COMP_DISABLE_TIME);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Module::setComparatorDisableTime(int64_t value) {
|
||||||
|
sendToDetector(F_SET_COMP_DISABLE_TIME, value, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
int Module::getNumberOfAdditionalStorageCells() const {
|
int Module::getNumberOfAdditionalStorageCells() const {
|
||||||
return sendToDetector<int>(F_GET_NUM_ADDITIONAL_STORAGE_CELLS);
|
return sendToDetector<int>(F_GET_NUM_ADDITIONAL_STORAGE_CELLS);
|
||||||
}
|
}
|
||||||
@ -1585,6 +1632,22 @@ void Module::setStorageCellDelay(int64_t value) {
|
|||||||
sendToDetector(F_SET_STORAGE_CELL_DELAY, value, nullptr);
|
sendToDetector(F_SET_STORAGE_CELL_DELAY, value, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slsDetectorDefs::gainMode Module::getGainMode() const {
|
||||||
|
return sendToDetector<gainMode>(F_GET_GAIN_MODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Module::setGainMode(const slsDetectorDefs::gainMode mode) {
|
||||||
|
sendToDetector(F_SET_GAIN_MODE, mode, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Module::getFilterCell() const {
|
||||||
|
return sendToDetector<int>(F_GET_FILTER_CELL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Module::setFilterCell(int value) {
|
||||||
|
sendToDetector(F_SET_FILTER_CELL, value, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
// Gotthard Specific
|
// Gotthard Specific
|
||||||
|
|
||||||
slsDetectorDefs::ROI Module::getROI() const {
|
slsDetectorDefs::ROI Module::getROI() const {
|
||||||
@ -1859,20 +1922,6 @@ void Module::setCDSGain(bool value) {
|
|||||||
sendToDetector(F_SET_CDS_GAIN, static_cast<int>(value), nullptr);
|
sendToDetector(F_SET_CDS_GAIN, static_cast<int>(value), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getFilter() const { return sendToDetector<int>(F_GET_FILTER); }
|
|
||||||
|
|
||||||
void Module::setFilter(int value) {
|
|
||||||
sendToDetector(F_SET_FILTER, value, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Module::getCurrentSource() const {
|
|
||||||
return sendToDetector<int>(F_GET_CURRENT_SOURCE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setCurrentSource(bool value) {
|
|
||||||
sendToDetector(F_SET_CURRENT_SOURCE, static_cast<int>(value), nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
slsDetectorDefs::timingSourceType Module::getTimingSource() const {
|
slsDetectorDefs::timingSourceType Module::getTimingSource() const {
|
||||||
return sendToDetector<timingSourceType>(F_GET_TIMING_SOURCE);
|
return sendToDetector<timingSourceType>(F_GET_TIMING_SOURCE);
|
||||||
}
|
}
|
||||||
|
@ -114,6 +114,8 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
void setAllTrimbits(int val);
|
void setAllTrimbits(int val);
|
||||||
std::vector<int> getTrimEn() const;
|
std::vector<int> getTrimEn() const;
|
||||||
int setTrimEn(const std::vector<int> &energies = {});
|
int setTrimEn(const std::vector<int> &energies = {});
|
||||||
|
bool getFlipRows() const;
|
||||||
|
void setFlipRows(bool value);
|
||||||
bool isVirtualDetectorServer() const;
|
bool isVirtualDetectorServer() const;
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
@ -148,8 +150,11 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
int getMaxClockPhaseShift(int clkIndex) const;
|
int getMaxClockPhaseShift(int clkIndex) const;
|
||||||
int getClockFrequency(int clkIndex) const;
|
int getClockFrequency(int clkIndex) const;
|
||||||
void setClockFrequency(int clkIndex, int value);
|
void setClockFrequency(int clkIndex, int value);
|
||||||
/** [Eiger][Jungfrau][Moench][Gotthard][Gotthard2][Mythen3] */
|
int getDefaultDac(slsDetectorDefs::dacIndex index,
|
||||||
void setDefaultDacs();
|
slsDetectorDefs::detectorSettings sett);
|
||||||
|
void setDefaultDac(slsDetectorDefs::dacIndex index, int defaultValue,
|
||||||
|
defs::detectorSettings sett);
|
||||||
|
void resetToDefaultDacs(const bool hardReset);
|
||||||
int getDAC(dacIndex index, bool mV) const;
|
int getDAC(dacIndex index, bool mV) const;
|
||||||
void setDAC(int val, dacIndex index, bool mV);
|
void setDAC(int val, dacIndex index, bool mV);
|
||||||
bool getPowerChip() const;
|
bool getPowerChip() const;
|
||||||
@ -165,7 +170,10 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
void setExternalSignalFlags(int signalIndex, externalSignalFlag type);
|
void setExternalSignalFlags(int signalIndex, externalSignalFlag type);
|
||||||
bool getParallelMode() const;
|
bool getParallelMode() const;
|
||||||
void setParallelMode(const bool enable);
|
void setParallelMode(const bool enable);
|
||||||
|
int getFilterResistor() const;
|
||||||
|
void setFilterResistor(int value);
|
||||||
|
defs::currentSrcParameters getCurrentSource() const;
|
||||||
|
void setCurrentSource(defs::currentSrcParameters par);
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
* Acquisition *
|
* Acquisition *
|
||||||
@ -320,8 +328,6 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
void setSubDeadTime(int64_t value);
|
void setSubDeadTime(int64_t value);
|
||||||
bool getOverFlowMode() const;
|
bool getOverFlowMode() const;
|
||||||
void setOverFlowMode(const bool enable);
|
void setOverFlowMode(const bool enable);
|
||||||
bool getFlippedDataX() const;
|
|
||||||
void setFlippedDataX(bool value);
|
|
||||||
int64_t getRateCorrection() const;
|
int64_t getRateCorrection() const;
|
||||||
void setDefaultRateCorrection();
|
void setDefaultRateCorrection();
|
||||||
void setRateCorrection(int64_t t = 0);
|
void setRateCorrection(int64_t t = 0);
|
||||||
@ -351,6 +357,7 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
* Jungfrau Specific *
|
* Jungfrau Specific *
|
||||||
* *
|
* *
|
||||||
* ************************************************/
|
* ************************************************/
|
||||||
|
double getChipVersion() const;
|
||||||
int getThresholdTemperature() const;
|
int getThresholdTemperature() const;
|
||||||
void setThresholdTemperature(int val);
|
void setThresholdTemperature(int val);
|
||||||
bool getTemperatureControl() const;
|
bool getTemperatureControl() const;
|
||||||
@ -359,12 +366,18 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
void resetTemperatureEvent();
|
void resetTemperatureEvent();
|
||||||
bool getAutoComparatorDisableMode() const;
|
bool getAutoComparatorDisableMode() const;
|
||||||
void setAutoComparatorDisableMode(bool val);
|
void setAutoComparatorDisableMode(bool val);
|
||||||
|
int64_t getComparatorDisableTime() const;
|
||||||
|
void setComparatorDisableTime(int64_t value);
|
||||||
int getNumberOfAdditionalStorageCells() const;
|
int getNumberOfAdditionalStorageCells() const;
|
||||||
void setNumberOfAdditionalStorageCells(int value);
|
void setNumberOfAdditionalStorageCells(int value);
|
||||||
int getStorageCellStart() const;
|
int getStorageCellStart() const;
|
||||||
void setStorageCellStart(int pos);
|
void setStorageCellStart(int pos);
|
||||||
int64_t getStorageCellDelay() const;
|
int64_t getStorageCellDelay() const;
|
||||||
void setStorageCellDelay(int64_t value);
|
void setStorageCellDelay(int64_t value);
|
||||||
|
gainMode getGainMode() const;
|
||||||
|
void setGainMode(const gainMode mode);
|
||||||
|
int getFilterCell() const;
|
||||||
|
void setFilterCell(int value);
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
@ -400,10 +413,6 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
void setBurstMode(burstMode value);
|
void setBurstMode(burstMode value);
|
||||||
bool getCDSGain() const;
|
bool getCDSGain() const;
|
||||||
void setCDSGain(bool value);
|
void setCDSGain(bool value);
|
||||||
int getFilter() const;
|
|
||||||
void setFilter(int value);
|
|
||||||
bool getCurrentSource() const;
|
|
||||||
void setCurrentSource(bool value);
|
|
||||||
slsDetectorDefs::timingSourceType getTimingSource() const;
|
slsDetectorDefs::timingSourceType getTimingSource() const;
|
||||||
void setTimingSource(slsDetectorDefs::timingSourceType value);
|
void setTimingSource(slsDetectorDefs::timingSourceType value);
|
||||||
bool getVeto() const;
|
bool getVeto() const;
|
||||||
|
@ -340,27 +340,6 @@ TEST_CASE("overflow", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("flippeddatax", "[.cmd]") {
|
|
||||||
Detector det;
|
|
||||||
CmdProxy proxy(&det);
|
|
||||||
auto det_type = det.getDetectorType().squash();
|
|
||||||
if (det_type == defs::EIGER) {
|
|
||||||
auto previous = det.getBottom();
|
|
||||||
std::ostringstream oss1, oss2, oss3;
|
|
||||||
proxy.Call("flippeddatax", {"1"}, -1, PUT, oss1);
|
|
||||||
REQUIRE(oss1.str() == "flippeddatax 1\n");
|
|
||||||
proxy.Call("flippeddatax", {}, -1, GET, oss2);
|
|
||||||
REQUIRE(oss2.str() == "flippeddatax 1\n");
|
|
||||||
proxy.Call("flippeddatax", {"0"}, -1, PUT, oss3);
|
|
||||||
REQUIRE(oss3.str() == "flippeddatax 0\n");
|
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
|
||||||
det.setBottom(previous[i], {i});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
REQUIRE_THROWS(proxy.Call("flippeddatax", {}, -1, GET));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("ratecorr", "[.cmd]") {
|
TEST_CASE("ratecorr", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
|
@ -519,66 +519,6 @@ TEST_CASE("cdsgain", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("filter", "[.cmd]") {
|
|
||||||
Detector det;
|
|
||||||
CmdProxy proxy(&det);
|
|
||||||
auto det_type = det.getDetectorType().squash();
|
|
||||||
|
|
||||||
if (det_type == defs::GOTTHARD2) {
|
|
||||||
auto prev_val = det.getFilter();
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call("filter", {"1"}, -1, PUT, oss);
|
|
||||||
REQUIRE(oss.str() == "filter 1\n");
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call("filter", {"0"}, -1, PUT, oss);
|
|
||||||
REQUIRE(oss.str() == "filter 0\n");
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call("filter", {}, -1, GET, oss);
|
|
||||||
REQUIRE(oss.str() == "filter 0\n");
|
|
||||||
}
|
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
|
||||||
det.setFilter(prev_val[i], {i});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
REQUIRE_THROWS(proxy.Call("filter", {}, -1, GET));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("currentsource", "[.cmd]") {
|
|
||||||
Detector det;
|
|
||||||
CmdProxy proxy(&det);
|
|
||||||
auto det_type = det.getDetectorType().squash();
|
|
||||||
|
|
||||||
if (det_type == defs::GOTTHARD2) {
|
|
||||||
auto prev_val = det.getCurrentSource();
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call("currentsource", {"1"}, -1, PUT, oss);
|
|
||||||
REQUIRE(oss.str() == "currentsource 1\n");
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call("currentsource", {"0"}, -1, PUT, oss);
|
|
||||||
REQUIRE(oss.str() == "currentsource 0\n");
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call("currentsource", {}, -1, GET, oss);
|
|
||||||
REQUIRE(oss.str() == "currentsource 0\n");
|
|
||||||
}
|
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
|
||||||
det.setCurrentSource(prev_val[i], {i});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
REQUIRE_THROWS(proxy.Call("currentsource", {}, -1, GET));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("timingsource", "[.cmd]") {
|
TEST_CASE("timingsource", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
|
@ -190,6 +190,18 @@ TEST_CASE("temp_threshold", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("chipversion", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::JUNGFRAU) {
|
||||||
|
REQUIRE_NOTHROW(proxy.Call("chipversion", {}, -1, GET));
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("chipversion", {}, -1, GET));
|
||||||
|
}
|
||||||
|
REQUIRE_THROWS(proxy.Call("chipversion", {"0"}, -1, PUT));
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("temp_control", "[.cmd]") {
|
TEST_CASE("temp_control", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
@ -246,7 +258,7 @@ TEST_CASE("auto_comp_disable", "[.cmd]") {
|
|||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
auto prev_val = det.getAutoCompDisable();
|
auto prev_val = det.getAutoComparatorDisable();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("auto_comp_disable", {"0"}, -1, PUT, oss);
|
proxy.Call("auto_comp_disable", {"0"}, -1, PUT, oss);
|
||||||
@ -263,7 +275,7 @@ TEST_CASE("auto_comp_disable", "[.cmd]") {
|
|||||||
REQUIRE(oss.str() == "auto_comp_disable 1\n");
|
REQUIRE(oss.str() == "auto_comp_disable 1\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setAutoCompDisable(prev_val[i], {i});
|
det.setAutoComparatorDisable(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("auto_comp_disable", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("auto_comp_disable", {}, -1, GET));
|
||||||
@ -271,11 +283,43 @@ TEST_CASE("auto_comp_disable", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("comp_disable_time", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::JUNGFRAU) {
|
||||||
|
auto prev_val = det.getComparatorDisableTime();
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("comp_disable_time", {"125ns"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "comp_disable_time 125ns\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("comp_disable_time", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "comp_disable_time 125ns\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("comp_disable_time", {"0"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "comp_disable_time 0\n");
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setComparatorDisableTime(prev_val[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("comp_disable_time", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(proxy.Call("comp_disable_time", {"0"}, -1, PUT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("storagecells", "[.cmd]") {
|
TEST_CASE("storagecells", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
|
// chip version 1.0
|
||||||
|
if (det.getChipVersion().squash()*10 == 10) {
|
||||||
auto prev_val = det.getNumberOfAdditionalStorageCells().tsquash(
|
auto prev_val = det.getNumberOfAdditionalStorageCells().tsquash(
|
||||||
"inconsistent #additional storage cells to test");
|
"inconsistent #additional storage cells to test");
|
||||||
{
|
{
|
||||||
@ -300,6 +344,12 @@ TEST_CASE("storagecells", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
REQUIRE_THROWS(proxy.Call("storagecells", {"16"}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("storagecells", {"16"}, -1, PUT));
|
||||||
det.setNumberOfAdditionalStorageCells(prev_val);
|
det.setNumberOfAdditionalStorageCells(prev_val);
|
||||||
|
}
|
||||||
|
// chip version 1.1
|
||||||
|
else {
|
||||||
|
// cannot set number of addl. storage cells
|
||||||
|
REQUIRE_THROWS(proxy.Call("storagecells", {"1"}, -1, PUT));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("storagecells", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("storagecells", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("storagecells", {"0"}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("storagecells", {"0"}, -1, PUT));
|
||||||
@ -317,11 +367,20 @@ TEST_CASE("storagecell_start", "[.cmd]") {
|
|||||||
proxy.Call("storagecell_start", {"1"}, -1, PUT, oss);
|
proxy.Call("storagecell_start", {"1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "storagecell_start 1\n");
|
REQUIRE(oss.str() == "storagecell_start 1\n");
|
||||||
}
|
}
|
||||||
{
|
// chip version 1.0
|
||||||
|
if (det.getChipVersion().squash()*10 == 10) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("storagecell_start", {"15"}, -1, PUT, oss);
|
proxy.Call("storagecell_start", {"15"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "storagecell_start 15\n");
|
REQUIRE(oss.str() == "storagecell_start 15\n");
|
||||||
}
|
}
|
||||||
|
// chip version 1.1
|
||||||
|
else {
|
||||||
|
// max is 3
|
||||||
|
REQUIRE_THROWS(proxy.Call("storagecell_start", {"15"}, -1, PUT));
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("storagecell_start", {"3"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "storagecell_start 3\n");
|
||||||
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("storagecell_start", {"0"}, -1, PUT, oss);
|
proxy.Call("storagecell_start", {"0"}, -1, PUT, oss);
|
||||||
@ -347,6 +406,8 @@ TEST_CASE("storagecell_delay", "[.cmd]") {
|
|||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
|
// chip version 1.0
|
||||||
|
if (det.getChipVersion().squash()*10 == 10) {
|
||||||
auto prev_val = det.getStorageCellDelay();
|
auto prev_val = det.getStorageCellDelay();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
@ -367,8 +428,108 @@ TEST_CASE("storagecell_delay", "[.cmd]") {
|
|||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setStorageCellDelay(prev_val[i], {i});
|
det.setStorageCellDelay(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// chip version 1.1
|
||||||
|
else {
|
||||||
|
// cannot set storage cell delay
|
||||||
|
REQUIRE_THROWS(proxy.Call("storagecell_delay", {"1.62ms"}, -1, PUT));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("storagecell_delay", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("storagecell_delay", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("storagecell_delay", {"0"}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("storagecell_delay", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("gainmode", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::JUNGFRAU) {
|
||||||
|
auto prev_val = det.getGainMode();
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("gainmode", {"forceswitchg1"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "gainmode forceswitchg1\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("gainmode", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "gainmode forceswitchg1\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("gainmode", {"dynamic"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "gainmode dynamic\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("gainmode", {"forceswitchg2"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "gainmode forceswitchg2\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("gainmode", {"fixg1"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "gainmode fixg1\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("gainmode", {"fixg2"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "gainmode fixg2\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("gainmode", {"fixg0"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "gainmode fixg0\n");
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setGainMode(prev_val[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("gainmode", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("filtercell", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::JUNGFRAU) {
|
||||||
|
// chip version 1.1
|
||||||
|
if (det.getChipVersion().squash() * 10 == 11) {
|
||||||
|
auto prev_val = det.getFilterCell();
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("filtercell", {"1"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "filtercell 1\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("filtercell", {"12"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "filtercell 12\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("filtercell", {"0"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "filtercell 0\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("filtercell", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "filtercell 0\n");
|
||||||
|
}
|
||||||
|
REQUIRE_THROWS(proxy.Call("filtercell", {"13"}, -1, PUT));
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setFilterCell(prev_val[i], {i});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// chip version 1.0
|
||||||
|
else {
|
||||||
|
// cannot set/get filter cell
|
||||||
|
REQUIRE_THROWS(proxy.Call("filtercell", {"1"}, -1, PUT));
|
||||||
|
REQUIRE_THROWS(proxy.Call("filtercell", {}, -1, GET));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("filtercell", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(proxy.Call("filtercell", {"0"}, -1, PUT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -142,15 +142,35 @@ TEST_CASE("settings", "[.cmd]") {
|
|||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
std::vector<std::string> allSett;
|
||||||
|
allSett.push_back("standard");
|
||||||
|
allSett.push_back("fast");
|
||||||
|
allSett.push_back("highgain");
|
||||||
|
allSett.push_back("dynamicgain");
|
||||||
|
allSett.push_back("lowgain");
|
||||||
|
allSett.push_back("mediumgain");
|
||||||
|
allSett.push_back("veryhighgain");
|
||||||
|
allSett.push_back("highgain0");
|
||||||
|
allSett.push_back("fixgain1");
|
||||||
|
allSett.push_back("fixgain2");
|
||||||
|
allSett.push_back("verylowgain");
|
||||||
|
allSett.push_back("g1_hg");
|
||||||
|
allSett.push_back("g1_lg");
|
||||||
|
allSett.push_back("g2_hc_hg");
|
||||||
|
allSett.push_back("g2_hc_lg");
|
||||||
|
allSett.push_back("g2_lc_hg");
|
||||||
|
allSett.push_back("g2_lc_lg");
|
||||||
|
allSett.push_back("g4_hg");
|
||||||
|
allSett.push_back("g4_lg");
|
||||||
|
allSett.push_back("forceswitchg1");
|
||||||
|
allSett.push_back("forceswitchg2");
|
||||||
|
allSett.push_back("gain0");
|
||||||
|
|
||||||
std::vector<std::string> sett;
|
std::vector<std::string> sett;
|
||||||
switch (det_type) {
|
switch (det_type) {
|
||||||
case defs::JUNGFRAU:
|
case defs::JUNGFRAU:
|
||||||
sett.push_back("dynamicgain");
|
sett.push_back("gain0");
|
||||||
sett.push_back("dynamichg0");
|
sett.push_back("highgain0");
|
||||||
sett.push_back("fixgain1");
|
|
||||||
sett.push_back("fixgain2");
|
|
||||||
sett.push_back("forceswitchg1");
|
|
||||||
sett.push_back("forceswitchg2");
|
|
||||||
break;
|
break;
|
||||||
case defs::GOTTHARD:
|
case defs::GOTTHARD:
|
||||||
sett.push_back("highgain");
|
sett.push_back("highgain");
|
||||||
@ -203,6 +223,11 @@ TEST_CASE("settings", "[.cmd]") {
|
|||||||
REQUIRE(oss.str() == "settings " + it + "\n");
|
REQUIRE(oss.str() == "settings " + it + "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (auto &it : allSett) {
|
||||||
|
if (std::find(sett.begin(), sett.end(), it) == sett.end()) {
|
||||||
|
REQUIRE_THROWS(proxy.Call("settings", {it}, -1, PUT));
|
||||||
|
}
|
||||||
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
if (prev_val[i] != defs::UNDEFINED &&
|
if (prev_val[i] != defs::UNDEFINED &&
|
||||||
prev_val[i] != defs::UNINITIALIZED) {
|
prev_val[i] != defs::UNINITIALIZED) {
|
||||||
@ -485,6 +510,34 @@ TEST_CASE("gappixels", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("fliprows", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::EIGER || det_type == defs::JUNGFRAU) {
|
||||||
|
auto previous = det.getFlipRows();
|
||||||
|
auto previous_numudp = det.getNumberofUDPInterfaces();
|
||||||
|
if (det_type == defs::JUNGFRAU) {
|
||||||
|
det.setNumberofUDPInterfaces(2);
|
||||||
|
}
|
||||||
|
std::ostringstream oss1, oss2, oss3;
|
||||||
|
proxy.Call("fliprows", {"1"}, -1, PUT, oss1);
|
||||||
|
REQUIRE(oss1.str() == "fliprows 1\n");
|
||||||
|
proxy.Call("fliprows", {}, -1, GET, oss2);
|
||||||
|
REQUIRE(oss2.str() == "fliprows 1\n");
|
||||||
|
proxy.Call("fliprows", {"0"}, -1, PUT, oss3);
|
||||||
|
REQUIRE(oss3.str() == "fliprows 0\n");
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setFlipRows(previous[i], {i});
|
||||||
|
if (det_type == defs::JUNGFRAU) {
|
||||||
|
det.setNumberofUDPInterfaces(previous_numudp[i], {i});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("fliprows", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* acquisition parameters */
|
/* acquisition parameters */
|
||||||
|
|
||||||
// acquire: not testing
|
// acquire: not testing
|
||||||
@ -1326,6 +1379,187 @@ TEST_CASE("parallel", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("filterresistor", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
|
// only for chipv1.1
|
||||||
|
bool chip11 = false;
|
||||||
|
if (det_type == defs::JUNGFRAU &&
|
||||||
|
det.getChipVersion().squash() * 10 == 11) {
|
||||||
|
chip11 = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (det_type == defs::GOTTHARD2 || chip11) {
|
||||||
|
auto prev_val = det.getFilterResistor();
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("filterresistor", {"1"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "filterresistor 1\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("filterresistor", {"0"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "filterresistor 0\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("filterresistor", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "filterresistor 0\n");
|
||||||
|
}
|
||||||
|
if (det_type == defs::GOTTHARD2) {
|
||||||
|
REQUIRE_NOTHROW(proxy.Call("filterresistor", {"2"}, -1, PUT));
|
||||||
|
REQUIRE_NOTHROW(proxy.Call("filterresistor", {"3"}, -1, PUT));
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("filterresistor", {"2"}, -1, PUT));
|
||||||
|
REQUIRE_THROWS(proxy.Call("filterresistor", {"3"}, -1, PUT));
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setFilterResistor(prev_val[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("filterresistor", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("currentsource", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
|
if (det_type == defs::GOTTHARD2 || det_type == defs::JUNGFRAU) {
|
||||||
|
auto prev_val = det.getCurrentSource();
|
||||||
|
|
||||||
|
if (det_type == defs::GOTTHARD2) {
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("currentsource", {"1"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "currentsource 1\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("currentsource", {"0"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "currentsource 0\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("currentsource", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "currentsource 0\n");
|
||||||
|
}
|
||||||
|
REQUIRE_THROWS(
|
||||||
|
proxy.Call("currentsource", {"1", "fix", "42"}, -1, PUT));
|
||||||
|
REQUIRE_THROWS(proxy.Call("currentsource",
|
||||||
|
{"1", "fix", "42", "normal"}, -1, PUT));
|
||||||
|
}
|
||||||
|
// jungfrau
|
||||||
|
else {
|
||||||
|
int chipVersion = det.getChipVersion().tsquash(
|
||||||
|
"inconsistent chip versions to test") *
|
||||||
|
10;
|
||||||
|
if (chipVersion == 10) {
|
||||||
|
REQUIRE_THROWS(proxy.Call("currentsource", {"1"}, -1, PUT));
|
||||||
|
REQUIRE_THROWS(
|
||||||
|
proxy.Call("currentsource", {"1", "fix"}, -1, PUT));
|
||||||
|
REQUIRE_THROWS(
|
||||||
|
proxy.Call("currentsource", {"1", "fix", "64"}, -1, PUT));
|
||||||
|
REQUIRE_THROWS(
|
||||||
|
proxy.Call("currentsource", {"1", "dfg", "64"}, -1, PUT));
|
||||||
|
REQUIRE_THROWS(proxy.Call(
|
||||||
|
"currentsource", {"1", "fix", "63", "normal"}, -1, PUT));
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("currentsource", {"1", "fix", "63"}, -1, PUT,
|
||||||
|
oss);
|
||||||
|
REQUIRE(oss.str() == "currentsource [1, fix, 63]\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("currentsource", {"0"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "currentsource [0]\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("currentsource", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "currentsource [disabled]\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("currentsource", {"1", "nofix", "63"}, -1, PUT,
|
||||||
|
oss);
|
||||||
|
REQUIRE(oss.str() == "currentsource [1, nofix, 63]\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("currentsource", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() ==
|
||||||
|
"currentsource [enabled, nofix, 63]\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// chipv1.1
|
||||||
|
else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("currentsource", {"1"}, -1, PUT));
|
||||||
|
REQUIRE_THROWS(
|
||||||
|
proxy.Call("currentsource", {"1", "fix"}, -1, PUT));
|
||||||
|
REQUIRE_THROWS(proxy.Call(
|
||||||
|
"currentsource", {"1", "ffgdfgix", "0x0000000000000041"},
|
||||||
|
-1, PUT));
|
||||||
|
REQUIRE_THROWS(proxy.Call(
|
||||||
|
"currentsource",
|
||||||
|
{"1", "fix", "0x0000000000000041", "normaldgf"}, -1, PUT));
|
||||||
|
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("currentsource",
|
||||||
|
{"1", "fix", "0x0000000000000041", "normal"}, -1,
|
||||||
|
PUT, oss);
|
||||||
|
REQUIRE(
|
||||||
|
oss.str() ==
|
||||||
|
"currentsource [1, fix, 0x0000000000000041, normal]\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("currentsource", {"0"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "currentsource [0]\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("currentsource", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "currentsource [disabled]\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("currentsource",
|
||||||
|
{"1", "nofix", "0x0000000000000041", "normal"},
|
||||||
|
-1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "currentsource [1, nofix, "
|
||||||
|
"0x0000000000000041, normal]\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("currentsource", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "currentsource [enabled, nofix, "
|
||||||
|
"0x0000000000000041, normal]\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("currentsource",
|
||||||
|
{"1", "nofix", "0x0000000000000041", "low"}, -1,
|
||||||
|
PUT, oss);
|
||||||
|
REQUIRE(
|
||||||
|
oss.str() ==
|
||||||
|
"currentsource [1, nofix, 0x0000000000000041, low]\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setCurrentSource(prev_val[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("currentsource", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** temperature */
|
/** temperature */
|
||||||
|
|
||||||
TEST_CASE("templist", "[.cmd]") {
|
TEST_CASE("templist", "[.cmd]") {
|
||||||
@ -1389,16 +1623,84 @@ TEST_CASE("dacvalues", "[.cmd]") {
|
|||||||
REQUIRE_THROWS(proxy.Call("dacvalues", {}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("dacvalues", {}, -1, PUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("defaultdacs", "[.cmd]") {
|
TEST_CASE("defaultdac", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type != defs::CHIPTESTBOARD) {
|
if (det_type != defs::CHIPTESTBOARD) {
|
||||||
REQUIRE_THROWS(proxy.Call("defaultdacs", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("defaultdac", {}, -1, GET));
|
||||||
REQUIRE_NOTHROW(proxy.Call("defaultdacs", {}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("defaultdac", {"blabla"}, -1, PUT));
|
||||||
|
auto daclist = det.getDacList();
|
||||||
|
for (auto it : daclist) {
|
||||||
|
auto dacname = sls::ToString(it);
|
||||||
|
auto prev_val = det.getDefaultDac(it);
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("defaultdac", {dacname, "1000"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == std::string("defaultdac ") + dacname +
|
||||||
|
std::string(" 1000\n"));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("defaultdac", {dacname}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == std::string("defaultdac ") + dacname +
|
||||||
|
std::string(" 1000\n"));
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setDefaultDac(it, prev_val[i], {i});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (det_type == defs::JUNGFRAU) {
|
||||||
|
std::vector<defs::dacIndex> daclist = {defs::VB_COMP, defs::VREF_DS,
|
||||||
|
defs::VREF_COMP};
|
||||||
|
for (auto it : daclist) {
|
||||||
|
auto dacname = sls::ToString(it);
|
||||||
|
auto prev_val = det.getDefaultDac(it, defs::DYNAMICGAIN);
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("defaultdac", {dacname, "1000", "dynamicgain"}, -1,
|
||||||
|
PUT, oss);
|
||||||
|
REQUIRE(oss.str() ==
|
||||||
|
std::string("defaultdac ") + dacname +
|
||||||
|
std::string(" dynamicgain 1000\n"));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("defaultdac", {dacname, "dynamicgain"}, -1, GET,
|
||||||
|
oss);
|
||||||
|
REQUIRE(oss.str() ==
|
||||||
|
std::string("defaultdac ") + dacname +
|
||||||
|
std::string(" dynamicgain 1000\n"));
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setDefaultDac(it, prev_val[i], defs::DYNAMICGAIN, {i});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("defaultdacs", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("defaultdac", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("defaultdacs", {}, -1, PUT));
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("resetdacs", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type != defs::CHIPTESTBOARD) {
|
||||||
|
auto prev_val = det.getSettings();
|
||||||
|
|
||||||
|
REQUIRE_THROWS(proxy.Call("resetdacs", {}, -1, GET));
|
||||||
|
REQUIRE_NOTHROW(proxy.Call("resetdacs", {}, -1, PUT));
|
||||||
|
REQUIRE_NOTHROW(proxy.Call("resetdacs", {"hard"}, -1, PUT));
|
||||||
|
|
||||||
|
// settings should not change especially for jungfrau and m3
|
||||||
|
auto next_val = det.getSettings();
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
REQUIRE(prev_val[i] == next_val[i]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("resetdacs", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(proxy.Call("resetdacs", {}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,8 @@ int ClientInterface::functionTable(){
|
|||||||
flist[F_SET_RECEIVER_STREAMING] = &ClientInterface::set_streaming;
|
flist[F_SET_RECEIVER_STREAMING] = &ClientInterface::set_streaming;
|
||||||
flist[F_GET_RECEIVER_STREAMING] = &ClientInterface::get_streaming;
|
flist[F_GET_RECEIVER_STREAMING] = &ClientInterface::get_streaming;
|
||||||
flist[F_RECEIVER_STREAMING_TIMER] = &ClientInterface::set_streaming_timer;
|
flist[F_RECEIVER_STREAMING_TIMER] = &ClientInterface::set_streaming_timer;
|
||||||
flist[F_SET_FLIPPED_DATA_RECEIVER] = &ClientInterface::set_flipped_data;
|
flist[F_GET_FLIP_ROWS_RECEIVER] = &ClientInterface::get_flip_rows;
|
||||||
|
flist[F_SET_FLIP_ROWS_RECEIVER] = &ClientInterface::set_flip_rows;
|
||||||
flist[F_SET_RECEIVER_FILE_FORMAT] = &ClientInterface::set_file_format;
|
flist[F_SET_RECEIVER_FILE_FORMAT] = &ClientInterface::set_file_format;
|
||||||
flist[F_GET_RECEIVER_FILE_FORMAT] = &ClientInterface::get_file_format;
|
flist[F_GET_RECEIVER_FILE_FORMAT] = &ClientInterface::get_file_format;
|
||||||
flist[F_SET_RECEIVER_STREAMING_PORT] = &ClientInterface::set_streaming_port;
|
flist[F_SET_RECEIVER_STREAMING_PORT] = &ClientInterface::set_streaming_port;
|
||||||
@ -1020,20 +1021,32 @@ int ClientInterface::set_streaming_timer(Interface &socket) {
|
|||||||
return socket.sendResult(retval);
|
return socket.sendResult(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ClientInterface::set_flipped_data(Interface &socket) {
|
int ClientInterface::get_flip_rows(Interface &socket) {
|
||||||
|
if (myDetectorType != EIGER)
|
||||||
|
functionNotImplemented();
|
||||||
|
|
||||||
|
int retval = impl()->getFlipRows();
|
||||||
|
LOG(logDEBUG1) << "Flip rows:" << retval;
|
||||||
|
return socket.sendResult(retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ClientInterface::set_flip_rows(Interface &socket) {
|
||||||
auto arg = socket.Receive<int>();
|
auto arg = socket.Receive<int>();
|
||||||
|
|
||||||
if (myDetectorType != EIGER)
|
if (myDetectorType != EIGER)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
|
|
||||||
if (arg >= 0) {
|
if (arg != 0 && arg != 1) {
|
||||||
verifyIdle(socket);
|
throw RuntimeError("Could not set flip rows. Invalid argument: " +
|
||||||
LOG(logDEBUG1) << "Setting flipped data:" << arg;
|
std::to_string(arg));
|
||||||
impl()->setFlippedDataX(arg);
|
|
||||||
}
|
}
|
||||||
int retval = impl()->getFlippedDataX();
|
verifyIdle(socket);
|
||||||
validate(arg, retval, std::string("set flipped data"), DEC);
|
LOG(logDEBUG1) << "Setting flip rows:" << arg;
|
||||||
LOG(logDEBUG1) << "Flipped Data:" << retval;
|
impl()->setFlipRows(static_cast<bool>(arg));
|
||||||
|
|
||||||
|
int retval = impl()->getFlipRows();
|
||||||
|
validate(arg, retval, std::string("set flip rows"), DEC);
|
||||||
|
LOG(logDEBUG1) << "Flip rows:" << retval;
|
||||||
return socket.sendResult(retval);
|
return socket.sendResult(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,8 @@ class ClientInterface : private virtual slsDetectorDefs {
|
|||||||
int set_streaming(sls::ServerInterface &socket);
|
int set_streaming(sls::ServerInterface &socket);
|
||||||
int get_streaming(sls::ServerInterface &socket);
|
int get_streaming(sls::ServerInterface &socket);
|
||||||
int set_streaming_timer(sls::ServerInterface &socket);
|
int set_streaming_timer(sls::ServerInterface &socket);
|
||||||
int set_flipped_data(sls::ServerInterface &socket);
|
int get_flip_rows(sls::ServerInterface &socket);
|
||||||
|
int set_flip_rows(sls::ServerInterface &socket);
|
||||||
int set_file_format(sls::ServerInterface &socket);
|
int set_file_format(sls::ServerInterface &socket);
|
||||||
int get_file_format(sls::ServerInterface &socket);
|
int get_file_format(sls::ServerInterface &socket);
|
||||||
int set_streaming_port(sls::ServerInterface &socket);
|
int set_streaming_port(sls::ServerInterface &socket);
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
const std::string DataStreamer::TypeName = "DataStreamer";
|
const std::string DataStreamer::TypeName = "DataStreamer";
|
||||||
|
|
||||||
DataStreamer::DataStreamer(int ind, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi,
|
DataStreamer::DataStreamer(int ind, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi,
|
||||||
int fd, int *nm, bool *qe, uint64_t *tot)
|
bool fr, int *nm, bool *qe, uint64_t *tot)
|
||||||
: ThreadObject(ind, TypeName), fifo(f), dynamicRange(dr), roi(r),
|
: ThreadObject(ind, TypeName), fifo(f), dynamicRange(dr), roi(r),
|
||||||
fileIndex(fi), flippedDataX(fd), quadEnable(qe), totalNumFrames(tot) {
|
fileIndex(fi), flipRows(fr), quadEnable(qe), totalNumFrames(tot) {
|
||||||
numMods[0] = nm[0];
|
numMods[0] = nm[0];
|
||||||
numMods[1] = nm[1];
|
numMods[1] = nm[1];
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ void DataStreamer::SetNumberofModules(int *nm) {
|
|||||||
numMods[1] = nm[1];
|
numMods[1] = nm[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataStreamer::SetFlippedDataX(int fd) { flippedDataX = fd; }
|
void DataStreamer::SetFlipRows(bool fd) { flipRows = fd; }
|
||||||
|
|
||||||
void DataStreamer::SetAdditionalJsonHeader(
|
void DataStreamer::SetAdditionalJsonHeader(
|
||||||
const std::map<std::string, std::string> &json) {
|
const std::map<std::string, std::string> &json) {
|
||||||
@ -240,7 +240,7 @@ int DataStreamer::SendHeader(sls_receiver_header *rheader, uint32_t size,
|
|||||||
zHeader.roundRNumber = header.roundRNumber;
|
zHeader.roundRNumber = header.roundRNumber;
|
||||||
zHeader.detType = header.detType;
|
zHeader.detType = header.detType;
|
||||||
zHeader.version = header.version;
|
zHeader.version = header.version;
|
||||||
zHeader.flippedDataX = flippedDataX;
|
zHeader.flipRows = static_cast<int>(flipRows);
|
||||||
zHeader.quad = *quadEnable;
|
zHeader.quad = *quadEnable;
|
||||||
zHeader.completeImage =
|
zHeader.completeImage =
|
||||||
(header.packetNumber < generalData->packetsPerFrame ? false : true);
|
(header.packetNumber < generalData->packetsPerFrame ? false : true);
|
||||||
|
@ -30,12 +30,12 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
* @param dr pointer to dynamic range
|
* @param dr pointer to dynamic range
|
||||||
* @param r roi
|
* @param r roi
|
||||||
* @param fi pointer to file index
|
* @param fi pointer to file index
|
||||||
* @param fd flipped data enable for x dimension
|
* @param fr flip rows
|
||||||
* @param nm pointer to number of modules in each dimension
|
* @param nm pointer to number of modules in each dimension
|
||||||
* @param qe pointer to quad Enable
|
* @param qe pointer to quad Enable
|
||||||
* @param tot pointer to total number of frames
|
* @param tot pointer to total number of frames
|
||||||
*/
|
*/
|
||||||
DataStreamer(int ind, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi, int fd,
|
DataStreamer(int ind, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi, bool fr,
|
||||||
int *nm, bool *qe, uint64_t *tot);
|
int *nm, bool *qe, uint64_t *tot);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,10 +68,10 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
void SetNumberofModules(int *nm);
|
void SetNumberofModules(int *nm);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Flipped data enable across x dimension
|
* Set Flipped rows
|
||||||
* @param fd data enable in x dimension
|
* @param fd flip rows enable
|
||||||
*/
|
*/
|
||||||
void SetFlippedDataX(int fd);
|
void SetFlipRows(bool fd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set additional json header
|
* Set additional json header
|
||||||
@ -165,8 +165,8 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
/** Pointer to file index */
|
/** Pointer to file index */
|
||||||
uint64_t *fileIndex;
|
uint64_t *fileIndex;
|
||||||
|
|
||||||
/** flipped data across x axis */
|
/** flip rows */
|
||||||
int flippedDataX;
|
bool flipRows;
|
||||||
|
|
||||||
/** additional json header */
|
/** additional json header */
|
||||||
std::map<std::string, std::string> additionalJsonHeader;
|
std::map<std::string, std::string> additionalJsonHeader;
|
||||||
|
@ -893,15 +893,15 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
|||||||
// streamer threads
|
// streamer threads
|
||||||
if (dataStreamEnable) {
|
if (dataStreamEnable) {
|
||||||
try {
|
try {
|
||||||
int fd = flippedDataX;
|
bool flip = flipRows;
|
||||||
int nm[2] = {numMods[0], numMods[1]};
|
int nm[2] = {numMods[0], numMods[1]};
|
||||||
if (quadEnable) {
|
if (quadEnable) {
|
||||||
fd = i;
|
flip = (i == 1 ? true : false);
|
||||||
nm[0] = 1;
|
nm[0] = 1;
|
||||||
nm[1] = 2;
|
nm[1] = 2;
|
||||||
}
|
}
|
||||||
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
||||||
i, fifo[i].get(), &dynamicRange, &roi, &fileIndex, fd,
|
i, fifo[i].get(), &dynamicRange, &roi, &fileIndex, flip,
|
||||||
(int *)nm, &quadEnable, &numberOfTotalFrames));
|
(int *)nm, &quadEnable, &numberOfTotalFrames));
|
||||||
dataStreamer[i]->SetGeneralData(generalData);
|
dataStreamer[i]->SetGeneralData(generalData);
|
||||||
dataStreamer[i]->CreateZmqSockets(
|
dataStreamer[i]->CreateZmqSockets(
|
||||||
@ -1022,15 +1022,15 @@ void Implementation::setDataStreamEnable(const bool enable) {
|
|||||||
if (enable) {
|
if (enable) {
|
||||||
for (int i = 0; i < numThreads; ++i) {
|
for (int i = 0; i < numThreads; ++i) {
|
||||||
try {
|
try {
|
||||||
int fd = flippedDataX;
|
bool flip = flipRows;
|
||||||
int nm[2] = {numMods[0], numMods[1]};
|
int nm[2] = {numMods[0], numMods[1]};
|
||||||
if (quadEnable) {
|
if (quadEnable) {
|
||||||
fd = i;
|
flip = (i == 1 ? true : false);
|
||||||
nm[0] = 1;
|
nm[0] = 1;
|
||||||
nm[1] = 2;
|
nm[1] = 2;
|
||||||
}
|
}
|
||||||
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
||||||
i, fifo[i].get(), &dynamicRange, &roi, &fileIndex, fd,
|
i, fifo[i].get(), &dynamicRange, &roi, &fileIndex, flip,
|
||||||
(int *)nm, &quadEnable, &numberOfTotalFrames));
|
(int *)nm, &quadEnable, &numberOfTotalFrames));
|
||||||
dataStreamer[i]->SetGeneralData(generalData);
|
dataStreamer[i]->SetGeneralData(generalData);
|
||||||
dataStreamer[i]->CreateZmqSockets(
|
dataStreamer[i]->CreateZmqSockets(
|
||||||
@ -1458,22 +1458,24 @@ void Implementation::setTenGigaEnable(const bool b) {
|
|||||||
LOG(logINFO) << "Packets per Frame: " << (generalData->packetsPerFrame);
|
LOG(logINFO) << "Packets per Frame: " << (generalData->packetsPerFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Implementation::getFlippedDataX() const { return flippedDataX; }
|
bool Implementation::getFlipRows() const { return flipRows; }
|
||||||
|
|
||||||
void Implementation::setFlippedDataX(int enable) {
|
void Implementation::setFlipRows(bool enable) {
|
||||||
flippedDataX = (enable == 0) ? 0 : 1;
|
flipRows = enable;
|
||||||
|
|
||||||
if (!quadEnable) {
|
if (!quadEnable) {
|
||||||
for (const auto &it : dataStreamer) {
|
for (const auto &it : dataStreamer) {
|
||||||
it->SetFlippedDataX(flippedDataX);
|
it->SetFlipRows(flipRows);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
// quad
|
||||||
|
else {
|
||||||
if (dataStreamer.size() == 2) {
|
if (dataStreamer.size() == 2) {
|
||||||
dataStreamer[0]->SetFlippedDataX(0);
|
dataStreamer[0]->SetFlipRows(false);
|
||||||
dataStreamer[1]->SetFlippedDataX(1);
|
dataStreamer[1]->SetFlipRows(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG(logINFO) << "Flipped Data X: " << flippedDataX;
|
LOG(logINFO) << "Flip Rows: " << flipRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Implementation::getQuad() const { return quadEnable; }
|
bool Implementation::getQuad() const { return quadEnable; }
|
||||||
@ -1485,7 +1487,7 @@ void Implementation::setQuad(const bool b) {
|
|||||||
if (!quadEnable) {
|
if (!quadEnable) {
|
||||||
for (const auto &it : dataStreamer) {
|
for (const auto &it : dataStreamer) {
|
||||||
it->SetNumberofModules(numMods);
|
it->SetNumberofModules(numMods);
|
||||||
it->SetFlippedDataX(flippedDataX);
|
it->SetFlipRows(flipRows);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int size[2] = {1, 2};
|
int size[2] = {1, 2};
|
||||||
@ -1493,8 +1495,8 @@ void Implementation::setQuad(const bool b) {
|
|||||||
it->SetNumberofModules(size);
|
it->SetNumberofModules(size);
|
||||||
}
|
}
|
||||||
if (dataStreamer.size() == 2) {
|
if (dataStreamer.size() == 2) {
|
||||||
dataStreamer[0]->SetFlippedDataX(0);
|
dataStreamer[0]->SetFlipRows(false);
|
||||||
dataStreamer[1]->SetFlippedDataX(1);
|
dataStreamer[1]->SetFlipRows(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,8 +202,8 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
bool getTenGigaEnable() const;
|
bool getTenGigaEnable() const;
|
||||||
/* [Eiger][Ctb] */
|
/* [Eiger][Ctb] */
|
||||||
void setTenGigaEnable(const bool b);
|
void setTenGigaEnable(const bool b);
|
||||||
int getFlippedDataX() const;
|
bool getFlipRows() const;
|
||||||
void setFlippedDataX(int enable = -1);
|
void setFlipRows(bool enable);
|
||||||
bool getQuad() const;
|
bool getQuad() const;
|
||||||
/* [Eiger] */
|
/* [Eiger] */
|
||||||
void setQuad(const bool b);
|
void setQuad(const bool b);
|
||||||
@ -347,7 +347,7 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
uint32_t dynamicRange{16};
|
uint32_t dynamicRange{16};
|
||||||
ROI roi{};
|
ROI roi{};
|
||||||
bool tengigaEnable{false};
|
bool tengigaEnable{false};
|
||||||
int flippedDataX{0};
|
bool flipRows{false};
|
||||||
bool quadEnable{false};
|
bool quadEnable{false};
|
||||||
bool activated{true};
|
bool activated{true};
|
||||||
std::array<bool, 2> detectorDataStream = {{true, true}};
|
std::array<bool, 2> detectorDataStream = {{true, true}};
|
||||||
|
@ -40,6 +40,7 @@ std::string ToString(const defs::M3_GainCaps s);
|
|||||||
std::string ToString(const defs::portPosition s);
|
std::string ToString(const defs::portPosition s);
|
||||||
std::string ToString(const defs::streamingInterface s);
|
std::string ToString(const defs::streamingInterface s);
|
||||||
std::string ToString(const defs::vetoAlgorithm s);
|
std::string ToString(const defs::vetoAlgorithm s);
|
||||||
|
std::string ToString(const defs::gainMode s);
|
||||||
|
|
||||||
std::string ToString(const slsDetectorDefs::xy &coord);
|
std::string ToString(const slsDetectorDefs::xy &coord);
|
||||||
std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::xy &coord);
|
std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::xy &coord);
|
||||||
@ -51,7 +52,12 @@ std::ostream &operator<<(std::ostream &os,
|
|||||||
std::string ToString(const slsDetectorDefs::scanParameters &r);
|
std::string ToString(const slsDetectorDefs::scanParameters &r);
|
||||||
std::ostream &operator<<(std::ostream &os,
|
std::ostream &operator<<(std::ostream &os,
|
||||||
const slsDetectorDefs::scanParameters &r);
|
const slsDetectorDefs::scanParameters &r);
|
||||||
|
std::string ToString(const slsDetectorDefs::currentSrcParameters &r);
|
||||||
|
std::ostream &operator<<(std::ostream &os,
|
||||||
|
const slsDetectorDefs::currentSrcParameters &r);
|
||||||
|
|
||||||
const std::string &ToString(const std::string &s);
|
const std::string &ToString(const std::string &s);
|
||||||
|
|
||||||
/** Convert std::chrono::duration with specified output unit */
|
/** Convert std::chrono::duration with specified output unit */
|
||||||
template <typename T, typename Rep = double>
|
template <typename T, typename Rep = double>
|
||||||
typename std::enable_if<is_duration<T>::value, std::string>::type
|
typename std::enable_if<is_duration<T>::value, std::string>::type
|
||||||
@ -305,6 +311,7 @@ template <> defs::M3_GainCaps StringTo(const std::string &s);
|
|||||||
template <> defs::portPosition StringTo(const std::string &s);
|
template <> defs::portPosition StringTo(const std::string &s);
|
||||||
template <> defs::streamingInterface StringTo(const std::string &s);
|
template <> defs::streamingInterface StringTo(const std::string &s);
|
||||||
template <> defs::vetoAlgorithm StringTo(const std::string &s);
|
template <> defs::vetoAlgorithm StringTo(const std::string &s);
|
||||||
|
template <> defs::gainMode StringTo(const std::string &s);
|
||||||
|
|
||||||
template <> uint32_t StringTo(const std::string &s);
|
template <> uint32_t StringTo(const std::string &s);
|
||||||
template <> uint64_t StringTo(const std::string &s);
|
template <> uint64_t StringTo(const std::string &s);
|
||||||
|
@ -58,8 +58,8 @@ struct zmqHeader {
|
|||||||
uint16_t roundRNumber{0};
|
uint16_t roundRNumber{0};
|
||||||
uint8_t detType{0};
|
uint8_t detType{0};
|
||||||
uint8_t version{0};
|
uint8_t version{0};
|
||||||
/** if image should be flipped across x axis */
|
/** if rows of image should be flipped */
|
||||||
int flippedDataX{0};
|
int flipRows{0};
|
||||||
/** quad type (eiger hardware specific) */
|
/** quad type (eiger hardware specific) */
|
||||||
uint32_t quad{0};
|
uint32_t quad{0};
|
||||||
/** true if complete image, else missing packets */
|
/** true if complete image, else missing packets */
|
||||||
|
@ -345,11 +345,9 @@ typedef struct {
|
|||||||
LOWGAIN,
|
LOWGAIN,
|
||||||
MEDIUMGAIN,
|
MEDIUMGAIN,
|
||||||
VERYHIGHGAIN,
|
VERYHIGHGAIN,
|
||||||
DYNAMICHG0,
|
HIGHGAIN0,
|
||||||
FIXGAIN1,
|
FIXGAIN1,
|
||||||
FIXGAIN2,
|
FIXGAIN2,
|
||||||
FORCESWITCHG1,
|
|
||||||
FORCESWITCHG2,
|
|
||||||
VERYLOWGAIN,
|
VERYLOWGAIN,
|
||||||
G1_HIGHGAIN,
|
G1_HIGHGAIN,
|
||||||
G1_LOWGAIN,
|
G1_LOWGAIN,
|
||||||
@ -359,6 +357,7 @@ typedef struct {
|
|||||||
G2_LOWCAP_LOWGAIN,
|
G2_LOWCAP_LOWGAIN,
|
||||||
G4_HIGHGAIN,
|
G4_HIGHGAIN,
|
||||||
G4_LOWGAIN,
|
G4_LOWGAIN,
|
||||||
|
GAIN0,
|
||||||
UNDEFINED = 200,
|
UNDEFINED = 200,
|
||||||
UNINITIALIZED
|
UNINITIALIZED
|
||||||
};
|
};
|
||||||
@ -416,6 +415,15 @@ typedef struct {
|
|||||||
|
|
||||||
enum vetoAlgorithm { DEFAULT_ALGORITHM };
|
enum vetoAlgorithm { DEFAULT_ALGORITHM };
|
||||||
|
|
||||||
|
enum gainMode {
|
||||||
|
DYNAMIC,
|
||||||
|
FORCE_SWITCH_G1,
|
||||||
|
FORCE_SWITCH_G2,
|
||||||
|
FIX_G1,
|
||||||
|
FIX_G2,
|
||||||
|
FIX_G0
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
/** scan structure */
|
/** scan structure */
|
||||||
@ -448,6 +456,39 @@ typedef struct {
|
|||||||
}
|
}
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
struct currentSrcParameters {
|
||||||
|
int enable;
|
||||||
|
int fix;
|
||||||
|
int normal;
|
||||||
|
uint64_t select;
|
||||||
|
|
||||||
|
/** [Gotthard2][Jungfrau] disable */
|
||||||
|
currentSrcParameters() : enable(0), fix(-1), normal(-1), select(0) {}
|
||||||
|
|
||||||
|
/** [Gotthard2] enable or disable */
|
||||||
|
currentSrcParameters(bool ena)
|
||||||
|
: enable(static_cast<int>(ena)), fix(-1), normal(-1), select(0) {}
|
||||||
|
|
||||||
|
/** [Jungfrau](chipv1.0) enable current src with fix or no fix,
|
||||||
|
* selectColumn is 0 to 63 columns only */
|
||||||
|
currentSrcParameters(bool fixCurrent, uint64_t selectColumn)
|
||||||
|
: enable(1), fix(static_cast<int>(fixCurrent)), normal(-1),
|
||||||
|
select(selectColumn) {}
|
||||||
|
|
||||||
|
/** [Jungfrau](chipv1.1) enable current src, fixCurrent[fix|no fix],
|
||||||
|
* selectColumn is a mask of 63 bits (muliple columns can be selected
|
||||||
|
* simultaneously, normalCurrent [normal|low] */
|
||||||
|
currentSrcParameters(bool fixCurrent, uint64_t selectColumn,
|
||||||
|
bool normalCurrent)
|
||||||
|
: enable(1), fix(static_cast<int>(fixCurrent)),
|
||||||
|
normal(static_cast<int>(normalCurrent)), select(selectColumn) {}
|
||||||
|
|
||||||
|
bool operator==(const currentSrcParameters &other) const {
|
||||||
|
return ((enable == other.enable) && (fix == other.fix) &&
|
||||||
|
(normal == other.normal) && (select == other.select));
|
||||||
|
}
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* structure to udpate receiver
|
* structure to udpate receiver
|
||||||
*/
|
*/
|
||||||
|
@ -205,8 +205,8 @@ enum detFuncs {
|
|||||||
F_GET_SCAN_ERROR_MESSAGE,
|
F_GET_SCAN_ERROR_MESSAGE,
|
||||||
F_GET_CDS_GAIN,
|
F_GET_CDS_GAIN,
|
||||||
F_SET_CDS_GAIN,
|
F_SET_CDS_GAIN,
|
||||||
F_GET_FILTER,
|
F_GET_FILTER_RESISTOR,
|
||||||
F_SET_FILTER,
|
F_SET_FILTER_RESISTOR,
|
||||||
F_GET_ADC_CONFIGURATION,
|
F_GET_ADC_CONFIGURATION,
|
||||||
F_SET_ADC_CONFIGURATION,
|
F_SET_ADC_CONFIGURATION,
|
||||||
F_GET_BAD_CHANNELS,
|
F_GET_BAD_CHANNELS,
|
||||||
@ -215,7 +215,7 @@ enum detFuncs {
|
|||||||
F_VALIDATE_UDP_CONFIG,
|
F_VALIDATE_UDP_CONFIG,
|
||||||
F_GET_BURSTS_LEFT,
|
F_GET_BURSTS_LEFT,
|
||||||
F_START_READOUT,
|
F_START_READOUT,
|
||||||
F_SET_DEFAULT_DACS,
|
F_RESET_TO_DEFAULT_DACS,
|
||||||
F_IS_VIRTUAL,
|
F_IS_VIRTUAL,
|
||||||
F_GET_PATTERN,
|
F_GET_PATTERN,
|
||||||
F_LOAD_DEFAULT_PATTERN,
|
F_LOAD_DEFAULT_PATTERN,
|
||||||
@ -230,6 +230,17 @@ enum detFuncs {
|
|||||||
F_SET_VETO_STREAM,
|
F_SET_VETO_STREAM,
|
||||||
F_GET_VETO_ALGORITHM,
|
F_GET_VETO_ALGORITHM,
|
||||||
F_SET_VETO_ALGORITHM,
|
F_SET_VETO_ALGORITHM,
|
||||||
|
F_GET_CHIP_VERSION,
|
||||||
|
F_GET_DEFAULT_DAC,
|
||||||
|
F_SET_DEFAULT_DAC,
|
||||||
|
F_GET_GAIN_MODE,
|
||||||
|
F_SET_GAIN_MODE,
|
||||||
|
F_GET_COMP_DISABLE_TIME,
|
||||||
|
F_SET_COMP_DISABLE_TIME,
|
||||||
|
F_GET_FLIP_ROWS,
|
||||||
|
F_SET_FLIP_ROWS,
|
||||||
|
F_GET_FILTER_CELL,
|
||||||
|
F_SET_FILTER_CELL,
|
||||||
|
|
||||||
NUM_DET_FUNCTIONS,
|
NUM_DET_FUNCTIONS,
|
||||||
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
|
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
|
||||||
@ -280,7 +291,8 @@ enum detFuncs {
|
|||||||
F_SET_RECEIVER_STREAMING,
|
F_SET_RECEIVER_STREAMING,
|
||||||
F_GET_RECEIVER_STREAMING,
|
F_GET_RECEIVER_STREAMING,
|
||||||
F_RECEIVER_STREAMING_TIMER,
|
F_RECEIVER_STREAMING_TIMER,
|
||||||
F_SET_FLIPPED_DATA_RECEIVER,
|
F_GET_FLIP_ROWS_RECEIVER,
|
||||||
|
F_SET_FLIP_ROWS_RECEIVER,
|
||||||
F_SET_RECEIVER_FILE_FORMAT,
|
F_SET_RECEIVER_FILE_FORMAT,
|
||||||
F_GET_RECEIVER_FILE_FORMAT,
|
F_GET_RECEIVER_FILE_FORMAT,
|
||||||
F_SET_RECEIVER_STREAMING_PORT,
|
F_SET_RECEIVER_STREAMING_PORT,
|
||||||
@ -542,8 +554,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_GET_SCAN_ERROR_MESSAGE: return "F_GET_SCAN_ERROR_MESSAGE";
|
case F_GET_SCAN_ERROR_MESSAGE: return "F_GET_SCAN_ERROR_MESSAGE";
|
||||||
case F_GET_CDS_GAIN: return "F_GET_CDS_GAIN";
|
case F_GET_CDS_GAIN: return "F_GET_CDS_GAIN";
|
||||||
case F_SET_CDS_GAIN: return "F_SET_CDS_GAIN";
|
case F_SET_CDS_GAIN: return "F_SET_CDS_GAIN";
|
||||||
case F_GET_FILTER: return "F_GET_FILTER";
|
case F_GET_FILTER_RESISTOR: return "F_GET_FILTER_RESISTOR";
|
||||||
case F_SET_FILTER: return "F_SET_FILTER";
|
case F_SET_FILTER_RESISTOR: return "F_SET_FILTER_RESISTOR";
|
||||||
case F_SET_ADC_CONFIGURATION: return "F_SET_ADC_CONFIGURATION";
|
case F_SET_ADC_CONFIGURATION: return "F_SET_ADC_CONFIGURATION";
|
||||||
case F_GET_ADC_CONFIGURATION: return "F_GET_ADC_CONFIGURATION";
|
case F_GET_ADC_CONFIGURATION: return "F_GET_ADC_CONFIGURATION";
|
||||||
case F_GET_BAD_CHANNELS: return "F_GET_BAD_CHANNELS";
|
case F_GET_BAD_CHANNELS: return "F_GET_BAD_CHANNELS";
|
||||||
@ -552,7 +564,7 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_VALIDATE_UDP_CONFIG: return "F_VALIDATE_UDP_CONFIG";
|
case F_VALIDATE_UDP_CONFIG: return "F_VALIDATE_UDP_CONFIG";
|
||||||
case F_GET_BURSTS_LEFT: return "F_GET_BURSTS_LEFT";
|
case F_GET_BURSTS_LEFT: return "F_GET_BURSTS_LEFT";
|
||||||
case F_START_READOUT: return "F_START_READOUT";
|
case F_START_READOUT: return "F_START_READOUT";
|
||||||
case F_SET_DEFAULT_DACS: return "F_SET_DEFAULT_DACS";
|
case F_RESET_TO_DEFAULT_DACS: return "F_RESET_TO_DEFAULT_DACS";
|
||||||
case F_IS_VIRTUAL: return "F_IS_VIRTUAL";
|
case F_IS_VIRTUAL: return "F_IS_VIRTUAL";
|
||||||
case F_GET_PATTERN: return "F_GET_PATTERN";
|
case F_GET_PATTERN: return "F_GET_PATTERN";
|
||||||
case F_LOAD_DEFAULT_PATTERN: return "F_LOAD_DEFAULT_PATTERN";
|
case F_LOAD_DEFAULT_PATTERN: return "F_LOAD_DEFAULT_PATTERN";
|
||||||
@ -566,6 +578,17 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_SET_VETO_STREAM: return "F_SET_VETO_STREAM";
|
case F_SET_VETO_STREAM: return "F_SET_VETO_STREAM";
|
||||||
case F_GET_VETO_ALGORITHM: return "F_GET_VETO_ALGORITHM";
|
case F_GET_VETO_ALGORITHM: return "F_GET_VETO_ALGORITHM";
|
||||||
case F_SET_VETO_ALGORITHM: return "F_SET_VETO_ALGORITHM";
|
case F_SET_VETO_ALGORITHM: return "F_SET_VETO_ALGORITHM";
|
||||||
|
case F_GET_CHIP_VERSION: return "F_GET_CHIP_VERSION";
|
||||||
|
case F_GET_DEFAULT_DAC: return "F_GET_DEFAULT_DAC";
|
||||||
|
case F_SET_DEFAULT_DAC: return "F_SET_DEFAULT_DAC";
|
||||||
|
case F_GET_GAIN_MODE: return "F_GET_GAIN_MODE";
|
||||||
|
case F_SET_GAIN_MODE: return "F_SET_GAIN_MODE";
|
||||||
|
case F_GET_COMP_DISABLE_TIME: return "F_GET_COMP_DISABLE_TIME";
|
||||||
|
case F_SET_COMP_DISABLE_TIME: return "F_SET_COMP_DISABLE_TIME";
|
||||||
|
case F_GET_FLIP_ROWS: return "F_GET_FLIP_ROWS";
|
||||||
|
case F_SET_FLIP_ROWS: return "F_SET_FLIP_ROWS";
|
||||||
|
case F_GET_FILTER_CELL: return "F_GET_FILTER_CELL";
|
||||||
|
case F_SET_FILTER_CELL: return "F_SET_FILTER_CELL";
|
||||||
|
|
||||||
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
||||||
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
||||||
@ -615,7 +638,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_SET_RECEIVER_STREAMING: return "F_SET_RECEIVER_STREAMING";
|
case F_SET_RECEIVER_STREAMING: return "F_SET_RECEIVER_STREAMING";
|
||||||
case F_GET_RECEIVER_STREAMING: return "F_GET_RECEIVER_STREAMING";
|
case F_GET_RECEIVER_STREAMING: return "F_GET_RECEIVER_STREAMING";
|
||||||
case F_RECEIVER_STREAMING_TIMER: return "F_RECEIVER_STREAMING_TIMER";
|
case F_RECEIVER_STREAMING_TIMER: return "F_RECEIVER_STREAMING_TIMER";
|
||||||
case F_SET_FLIPPED_DATA_RECEIVER: return "F_SET_FLIPPED_DATA_RECEIVER";
|
case F_GET_FLIP_ROWS_RECEIVER: return "F_GET_FLIP_ROWS_RECEIVER";
|
||||||
|
case F_SET_FLIP_ROWS_RECEIVER: return "F_SET_FLIP_ROWS_RECEIVER";
|
||||||
case F_SET_RECEIVER_FILE_FORMAT: return "F_SET_RECEIVER_FILE_FORMAT";
|
case F_SET_RECEIVER_FILE_FORMAT: return "F_SET_RECEIVER_FILE_FORMAT";
|
||||||
case F_GET_RECEIVER_FILE_FORMAT: return "F_GET_RECEIVER_FILE_FORMAT";
|
case F_GET_RECEIVER_FILE_FORMAT: return "F_GET_RECEIVER_FILE_FORMAT";
|
||||||
case F_SET_RECEIVER_STREAMING_PORT: return "F_SET_RECEIVER_STREAMING_PORT";
|
case F_SET_RECEIVER_STREAMING_PORT: return "F_SET_RECEIVER_STREAMING_PORT";
|
||||||
|
@ -3,10 +3,11 @@
|
|||||||
#define APILIB 0x210225
|
#define APILIB 0x210225
|
||||||
#define APIRECEIVER 0x210225
|
#define APIRECEIVER 0x210225
|
||||||
#define APIGUI 0x210225
|
#define APIGUI 0x210225
|
||||||
#define APICTB 0x210810
|
|
||||||
#define APIGOTTHARD 0x210810
|
#define APIEIGER 0x210811
|
||||||
#define APIGOTTHARD2 0x210810
|
#define APICTB 0x210811
|
||||||
#define APIJUNGFRAU 0x210810
|
#define APIGOTTHARD 0x210811
|
||||||
#define APIMYTHEN3 0x210810
|
#define APIGOTTHARD2 0x210811
|
||||||
#define APIMOENCH 0x210810
|
#define APIJUNGFRAU 0x210811
|
||||||
#define APIEIGER 0x210810
|
#define APIMYTHEN3 0x210811
|
||||||
|
#define APIMOENCH 0x210811
|
||||||
|
@ -114,6 +114,40 @@ std::ostream &operator<<(std::ostream &os,
|
|||||||
return os << ToString(r);
|
return os << ToString(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ToString(const slsDetectorDefs::currentSrcParameters &r) {
|
||||||
|
std::ostringstream oss;
|
||||||
|
if (r.fix < -1 || r.fix > 1 || r.normal < -1 || r.normal > 1) {
|
||||||
|
throw sls::RuntimeError(
|
||||||
|
"Invalid current source parameters. Cannot print.");
|
||||||
|
}
|
||||||
|
oss << '[';
|
||||||
|
if (r.enable) {
|
||||||
|
oss << "enabled";
|
||||||
|
// [jungfrau]
|
||||||
|
if (r.fix != -1) {
|
||||||
|
oss << (r.fix == 1 ? ", fix" : ", nofix");
|
||||||
|
}
|
||||||
|
// [jungfrau chip v1.1]
|
||||||
|
if (r.normal != -1) {
|
||||||
|
oss << ", " << ToStringHex(r.select, 16);
|
||||||
|
oss << (r.normal == 1 ? ", normal" : ", low");
|
||||||
|
}
|
||||||
|
// [jungfrau chip v1.0]
|
||||||
|
else {
|
||||||
|
oss << ", " << r.select;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
oss << "disabled";
|
||||||
|
}
|
||||||
|
oss << ']';
|
||||||
|
return oss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostream &operator<<(std::ostream &os,
|
||||||
|
const slsDetectorDefs::currentSrcParameters &r) {
|
||||||
|
return os << ToString(r);
|
||||||
|
}
|
||||||
|
|
||||||
std::string ToString(const defs::runStatus s) {
|
std::string ToString(const defs::runStatus s) {
|
||||||
switch (s) {
|
switch (s) {
|
||||||
case defs::ERROR:
|
case defs::ERROR:
|
||||||
@ -170,16 +204,12 @@ std::string ToString(const defs::detectorSettings s) {
|
|||||||
return std::string("mediumgain");
|
return std::string("mediumgain");
|
||||||
case defs::VERYHIGHGAIN:
|
case defs::VERYHIGHGAIN:
|
||||||
return std::string("veryhighgain");
|
return std::string("veryhighgain");
|
||||||
case defs::DYNAMICHG0:
|
case defs::HIGHGAIN0:
|
||||||
return std::string("dynamichg0");
|
return std::string("highgain0");
|
||||||
case defs::FIXGAIN1:
|
case defs::FIXGAIN1:
|
||||||
return std::string("fixgain1");
|
return std::string("fixgain1");
|
||||||
case defs::FIXGAIN2:
|
case defs::FIXGAIN2:
|
||||||
return std::string("fixgain2");
|
return std::string("fixgain2");
|
||||||
case defs::FORCESWITCHG1:
|
|
||||||
return std::string("forceswitchg1");
|
|
||||||
case defs::FORCESWITCHG2:
|
|
||||||
return std::string("forceswitchg2");
|
|
||||||
case defs::VERYLOWGAIN:
|
case defs::VERYLOWGAIN:
|
||||||
return std::string("verylowgain");
|
return std::string("verylowgain");
|
||||||
case defs::G1_HIGHGAIN:
|
case defs::G1_HIGHGAIN:
|
||||||
@ -198,6 +228,8 @@ std::string ToString(const defs::detectorSettings s) {
|
|||||||
return std::string("g4_hg");
|
return std::string("g4_hg");
|
||||||
case defs::G4_LOWGAIN:
|
case defs::G4_LOWGAIN:
|
||||||
return std::string("g4_lg");
|
return std::string("g4_lg");
|
||||||
|
case defs::GAIN0:
|
||||||
|
return std::string("gain0");
|
||||||
case defs::UNDEFINED:
|
case defs::UNDEFINED:
|
||||||
return std::string("undefined");
|
return std::string("undefined");
|
||||||
case defs::UNINITIALIZED:
|
case defs::UNINITIALIZED:
|
||||||
@ -583,6 +615,25 @@ std::string ToString(const defs::vetoAlgorithm s) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ToString(const defs::gainMode s) {
|
||||||
|
switch (s) {
|
||||||
|
case defs::DYNAMIC:
|
||||||
|
return std::string("dynamic");
|
||||||
|
case defs::FORCE_SWITCH_G1:
|
||||||
|
return std::string("forceswitchg1");
|
||||||
|
case defs::FORCE_SWITCH_G2:
|
||||||
|
return std::string("forceswitchg2");
|
||||||
|
case defs::FIX_G1:
|
||||||
|
return std::string("fixg1");
|
||||||
|
case defs::FIX_G2:
|
||||||
|
return std::string("fixg2");
|
||||||
|
case defs::FIX_G0:
|
||||||
|
return std::string("fixg0");
|
||||||
|
default:
|
||||||
|
return std::string("Unknown");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const std::string &ToString(const std::string &s) { return s; }
|
const std::string &ToString(const std::string &s) { return s; }
|
||||||
|
|
||||||
template <> defs::detectorType StringTo(const std::string &s) {
|
template <> defs::detectorType StringTo(const std::string &s) {
|
||||||
@ -618,16 +669,12 @@ template <> defs::detectorSettings StringTo(const std::string &s) {
|
|||||||
return defs::MEDIUMGAIN;
|
return defs::MEDIUMGAIN;
|
||||||
if (s == "veryhighgain")
|
if (s == "veryhighgain")
|
||||||
return defs::VERYHIGHGAIN;
|
return defs::VERYHIGHGAIN;
|
||||||
if (s == "dynamichg0")
|
if (s == "highgain0")
|
||||||
return defs::DYNAMICHG0;
|
return defs::HIGHGAIN0;
|
||||||
if (s == "fixgain1")
|
if (s == "fixgain1")
|
||||||
return defs::FIXGAIN1;
|
return defs::FIXGAIN1;
|
||||||
if (s == "fixgain2")
|
if (s == "fixgain2")
|
||||||
return defs::FIXGAIN2;
|
return defs::FIXGAIN2;
|
||||||
if (s == "forceswitchg1")
|
|
||||||
return defs::FORCESWITCHG1;
|
|
||||||
if (s == "forceswitchg2")
|
|
||||||
return defs::FORCESWITCHG2;
|
|
||||||
if (s == "verylowgain")
|
if (s == "verylowgain")
|
||||||
return defs::VERYLOWGAIN;
|
return defs::VERYLOWGAIN;
|
||||||
if (s == "g1_hg")
|
if (s == "g1_hg")
|
||||||
@ -644,6 +691,8 @@ template <> defs::detectorSettings StringTo(const std::string &s) {
|
|||||||
return defs::G2_LOWCAP_LOWGAIN;
|
return defs::G2_LOWCAP_LOWGAIN;
|
||||||
if (s == "g4_hg")
|
if (s == "g4_hg")
|
||||||
return defs::G4_HIGHGAIN;
|
return defs::G4_HIGHGAIN;
|
||||||
|
if (s == "gain0")
|
||||||
|
return defs::GAIN0;
|
||||||
if (s == "g4_lg")
|
if (s == "g4_lg")
|
||||||
return defs::G4_LOWGAIN;
|
return defs::G4_LOWGAIN;
|
||||||
throw sls::RuntimeError("Unknown setting " + s);
|
throw sls::RuntimeError("Unknown setting " + s);
|
||||||
@ -970,6 +1019,22 @@ template <> defs::vetoAlgorithm StringTo(const std::string &s) {
|
|||||||
throw sls::RuntimeError("Unknown veto algorithm " + s);
|
throw sls::RuntimeError("Unknown veto algorithm " + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <> defs::gainMode StringTo(const std::string &s) {
|
||||||
|
if (s == "dynamic")
|
||||||
|
return defs::DYNAMIC;
|
||||||
|
if (s == "forceswitchg1")
|
||||||
|
return defs::FORCE_SWITCH_G1;
|
||||||
|
if (s == "forceswitchg2")
|
||||||
|
return defs::FORCE_SWITCH_G2;
|
||||||
|
if (s == "fixg1")
|
||||||
|
return defs::FIX_G1;
|
||||||
|
if (s == "fixg2")
|
||||||
|
return defs::FIX_G2;
|
||||||
|
if (s == "fixg0")
|
||||||
|
return defs::FIX_G0;
|
||||||
|
throw sls::RuntimeError("Unknown gain mode " + s);
|
||||||
|
}
|
||||||
|
|
||||||
template <> uint32_t StringTo(const std::string &s) {
|
template <> uint32_t StringTo(const std::string &s) {
|
||||||
int base = s.find("0x") != std::string::npos ? 16 : 10;
|
int base = s.find("0x") != std::string::npos ? 16 : 10;
|
||||||
return std::stoul(s, nullptr, base);
|
return std::stoul(s, nullptr, base);
|
||||||
|
@ -160,7 +160,7 @@ int ZmqSocket::SendHeader(int index, zmqHeader header) {
|
|||||||
"\"version\":%u, "
|
"\"version\":%u, "
|
||||||
|
|
||||||
// additional stuff
|
// additional stuff
|
||||||
"\"flippedDataX\":%u, "
|
"\"flipRows\":%u, "
|
||||||
"\"quad\":%u"
|
"\"quad\":%u"
|
||||||
|
|
||||||
; //"}\n";
|
; //"}\n";
|
||||||
@ -177,7 +177,7 @@ int ZmqSocket::SendHeader(int index, zmqHeader header) {
|
|||||||
header.detType, header.version,
|
header.detType, header.version,
|
||||||
|
|
||||||
// additional stuff
|
// additional stuff
|
||||||
header.flippedDataX, header.quad);
|
header.flipRows, header.quad);
|
||||||
|
|
||||||
if (!header.addJsonHeader.empty()) {
|
if (!header.addJsonHeader.empty()) {
|
||||||
strcat(header_buffer.get(), ", ");
|
strcat(header_buffer.get(), ", ");
|
||||||
@ -303,7 +303,7 @@ int ZmqSocket::ParseHeader(const int index, int length, char *buff,
|
|||||||
zHeader.detType = document["detType"].GetUint();
|
zHeader.detType = document["detType"].GetUint();
|
||||||
zHeader.version = document["version"].GetUint();
|
zHeader.version = document["version"].GetUint();
|
||||||
|
|
||||||
zHeader.flippedDataX = document["flippedDataX"].GetUint();
|
zHeader.flipRows = document["flipRows"].GetUint();
|
||||||
zHeader.quad = document["quad"].GetUint();
|
zHeader.quad = document["quad"].GetUint();
|
||||||
zHeader.completeImage = document["completeImage"].GetUint();
|
zHeader.completeImage = document["completeImage"].GetUint();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user