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-braces-around-statements,
|
||||
-modernize-use-trailing-return-type,
|
||||
-readability-isolate-declaration'
|
||||
-readability-isolate-declaration,
|
||||
-llvmlibc-*'
|
||||
|
||||
HeaderFilterRegex: \.h
|
||||
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
|
||||
|
||||
|
||||
Jungfrau- many Features
|
||||
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
getAutoCompDisable->getAutoComparatorDisable
|
||||
filter->filterResistor
|
||||
setBottom->setFlipRows
|
||||
currentsource expects currentsrcparameters structure instread of bool
|
||||
|
||||
3. Firmware Requirements
|
||||
========================
|
||||
|
@ -101,15 +101,11 @@ def test_module_size(virtual_jf_detectors):
|
||||
|
||||
def test_settings(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
assert d.settings == detectorSettings.DYNAMICGAIN
|
||||
assert d.settings == detectorSettings.GAIN0
|
||||
|
||||
gain_list = [
|
||||
detectorSettings.FIXGAIN1,
|
||||
detectorSettings.FIXGAIN2,
|
||||
detectorSettings.FORCESWITCHG1,
|
||||
detectorSettings.FORCESWITCHG2,
|
||||
detectorSettings.DYNAMICHG0,
|
||||
detectorSettings.DYNAMICGAIN,
|
||||
detectorSettings.GAIN0,
|
||||
detectorSettings.HIGHGAIN0,
|
||||
]
|
||||
|
||||
# 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
|
||||
assert d.settings == gain
|
||||
|
||||
d.setSettings(detectorSettings.FORCESWITCHG1, [1])
|
||||
d.setSettings(detectorSettings.GAIN0, [1])
|
||||
assert d.settings == [
|
||||
detectorSettings.DYNAMICGAIN,
|
||||
detectorSettings.FORCESWITCHG1,
|
||||
detectorSettings.DYNAMICGAIN,
|
||||
detectorSettings.GAIN0,
|
||||
detectorSettings.HIGHGAIN0,
|
||||
]
|
||||
|
||||
d.settings = detectorSettings.DYNAMICGAIN
|
||||
assert d.settings == detectorSettings.DYNAMICGAIN
|
||||
d.settings = detectorSettings.GAIN0
|
||||
assert d.settings == detectorSettings.GAIN0
|
||||
|
||||
def test_frames(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
@ -161,4 +156,34 @@ def test_period(virtual_jf_detectors):
|
||||
d.period = t
|
||||
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
|
||||
[Jungfrau] DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2 \n
|
||||
[Jungfrau] GAIN0, HIGHGAIN0 \n
|
||||
[Gotthard] DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN \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
|
||||
@ -370,7 +370,7 @@ class Detector(CppDetectorApi):
|
||||
Note
|
||||
----
|
||||
[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.
|
||||
"""
|
||||
return self.getPowerChip()
|
||||
@ -1992,6 +1992,20 @@ class Detector(CppDetectorApi):
|
||||
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
|
||||
@element
|
||||
def auto_comp_disable(self):
|
||||
@ -1999,14 +2013,39 @@ class Detector(CppDetectorApi):
|
||||
|
||||
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.
|
||||
"""
|
||||
return self.getAutoCompDisable()
|
||||
return self.getAutoComparatorDisable()
|
||||
|
||||
@auto_comp_disable.setter
|
||||
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
|
||||
@ -2026,7 +2065,7 @@ class Detector(CppDetectorApi):
|
||||
[Jungfrau] Number of additional storage cells.
|
||||
Note
|
||||
----
|
||||
For advanced users only. \n
|
||||
Only for chip v1.0. For advanced users only. \n
|
||||
Options: 0 - 15. Default is 0.
|
||||
The #images = #frames x #triggers x (#storagecells + 1)
|
||||
"""
|
||||
@ -2045,7 +2084,7 @@ class Detector(CppDetectorApi):
|
||||
Note
|
||||
----
|
||||
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()
|
||||
|
||||
@ -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
|
||||
Note
|
||||
-----
|
||||
For advanced users only \n
|
||||
Only applicable for chipv1.0. For advanced users only \n
|
||||
Value: 0-1638375 ns (resolution of 25ns) \n
|
||||
:getter: always returns in seconds. To get in datetime.delta, use getStorageCellDelay
|
||||
|
||||
@ -2151,6 +2190,26 @@ class Detector(CppDetectorApi):
|
||||
def selinterface(self, 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>>>---------------------------
|
||||
"""
|
||||
@ -2179,17 +2238,36 @@ class Detector(CppDetectorApi):
|
||||
|
||||
@property
|
||||
@element
|
||||
def filter(self):
|
||||
"""[Gotthard2] Set filter resistor.
|
||||
def filterresistor(self):
|
||||
"""
|
||||
[Gotthard2][Jungfrau] Set filter resistor. Increasing values for increasing "
|
||||
"resistance.
|
||||
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
|
||||
def filter(self, value):
|
||||
ut.set_using_dict(self.setFilter, value)
|
||||
@filterresistor.setter
|
||||
def filterresistor(self, 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
|
||||
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
|
||||
runStatus = _slsdet.slsDetectorDefs.runStatus
|
||||
speedLevel = _slsdet.slsDetectorDefs.speedLevel
|
||||
detectorType = _slsdet.slsDetectorDefs.detectorType
|
||||
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
|
||||
for name, cls in _slsdet.slsDetectorDefs.__dict__.items():
|
||||
if isinstance(cls, type):
|
||||
exec(f'{name} = {cls.__module__}.{cls.__qualname__}')
|
||||
|
||||
|
@ -354,9 +354,28 @@ void init_det(py::module &m) {
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getDacList", (std::vector<defs::dacIndex>(Detector::*)() const) &
|
||||
Detector::getDacList)
|
||||
.def("setDefaultDacs",
|
||||
(void (Detector::*)(sls::Positions)) & Detector::setDefaultDacs,
|
||||
py::arg() = Positions{})
|
||||
.def("getDefaultDac",
|
||||
(Result<int>(Detector::*)(defs::dacIndex, sls::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",
|
||||
(Result<int>(Detector::*)(defs::dacIndex, bool, sls::Positions)
|
||||
const) &
|
||||
@ -829,12 +848,12 @@ void init_det(py::module &m) {
|
||||
(void (Detector::*)(bool, sls::Positions)) &
|
||||
Detector::setOverFlowMode,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getBottom",
|
||||
.def("getFlipRows",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getBottom,
|
||||
Detector::getFlipRows,
|
||||
py::arg() = Positions{})
|
||||
.def("setBottom",
|
||||
(void (Detector::*)(bool, sls::Positions)) & Detector::setBottom,
|
||||
.def("setFlipRows",
|
||||
(void (Detector::*)(bool, sls::Positions)) & Detector::setFlipRows,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getRateCorrection",
|
||||
(Result<sls::ns>(Detector::*)(sls::Positions) const) &
|
||||
@ -923,6 +942,10 @@ void init_det(py::module &m) {
|
||||
sls::Positions)) &
|
||||
Detector::setDataStream,
|
||||
py::arg(), py::arg(), py::arg() = Positions{})
|
||||
.def("getChipVersion",
|
||||
(Result<double>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getChipVersion,
|
||||
py::arg() = Positions{})
|
||||
.def("getThresholdTemperature",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getThresholdTemperature,
|
||||
@ -947,13 +970,21 @@ void init_det(py::module &m) {
|
||||
(void (Detector::*)(sls::Positions)) &
|
||||
Detector::resetTemperatureEvent,
|
||||
py::arg() = Positions{})
|
||||
.def("getAutoCompDisable",
|
||||
.def("getAutoComparatorDisable",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getAutoCompDisable,
|
||||
Detector::getAutoComparatorDisable,
|
||||
py::arg() = Positions{})
|
||||
.def("setAutoCompDisable",
|
||||
.def("setAutoComparatorDisable",
|
||||
(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{})
|
||||
.def("getNumberOfAdditionalStorageCells",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
@ -979,6 +1010,17 @@ void init_det(py::module &m) {
|
||||
(void (Detector::*)(sls::ns, sls::Positions)) &
|
||||
Detector::setStorageCellDelay,
|
||||
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",
|
||||
(Result<defs::ROI>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getROI,
|
||||
@ -1054,12 +1096,21 @@ void init_det(py::module &m) {
|
||||
.def("setCDSGain",
|
||||
(void (Detector::*)(bool, sls::Positions)) & Detector::setCDSGain,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getFilter",
|
||||
.def("getFilterResistor",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getFilter,
|
||||
Detector::getFilterResistor,
|
||||
py::arg() = Positions{})
|
||||
.def("setFilter",
|
||||
(void (Detector::*)(int, sls::Positions)) & Detector::setFilter,
|
||||
.def("setFilterResistor",
|
||||
(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{})
|
||||
.def("getCurrentSource",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
|
@ -210,13 +210,9 @@ void init_enums(py::module &m) {
|
||||
.value("LOWGAIN", slsDetectorDefs::detectorSettings::LOWGAIN)
|
||||
.value("MEDIUMGAIN", slsDetectorDefs::detectorSettings::MEDIUMGAIN)
|
||||
.value("VERYHIGHGAIN", slsDetectorDefs::detectorSettings::VERYHIGHGAIN)
|
||||
.value("DYNAMICHG0", slsDetectorDefs::detectorSettings::DYNAMICHG0)
|
||||
.value("HIGHGAIN0", slsDetectorDefs::detectorSettings::HIGHGAIN0)
|
||||
.value("FIXGAIN1", slsDetectorDefs::detectorSettings::FIXGAIN1)
|
||||
.value("FIXGAIN2", slsDetectorDefs::detectorSettings::FIXGAIN2)
|
||||
.value("FORCESWITCHG1",
|
||||
slsDetectorDefs::detectorSettings::FORCESWITCHG1)
|
||||
.value("FORCESWITCHG2",
|
||||
slsDetectorDefs::detectorSettings::FORCESWITCHG2)
|
||||
.value("VERYLOWGAIN", slsDetectorDefs::detectorSettings::VERYLOWGAIN)
|
||||
.value("G1_HIGHGAIN", slsDetectorDefs::detectorSettings::G1_HIGHGAIN)
|
||||
.value("G1_LOWGAIN", slsDetectorDefs::detectorSettings::G1_LOWGAIN)
|
||||
@ -230,6 +226,7 @@ void init_enums(py::module &m) {
|
||||
slsDetectorDefs::detectorSettings::G2_LOWCAP_LOWGAIN)
|
||||
.value("G4_HIGHGAIN", slsDetectorDefs::detectorSettings::G4_HIGHGAIN)
|
||||
.value("G4_LOWGAIN", slsDetectorDefs::detectorSettings::G4_LOWGAIN)
|
||||
.value("GAIN0", slsDetectorDefs::detectorSettings::GAIN0)
|
||||
.value("UNDEFINED", slsDetectorDefs::detectorSettings::UNDEFINED)
|
||||
.value("UNINITIALIZED",
|
||||
slsDetectorDefs::detectorSettings::UNINITIALIZED)
|
||||
@ -309,4 +306,13 @@ void init_enums(py::module &m) {
|
||||
.value("DEFAULT_ALGORITHM",
|
||||
slsDetectorDefs::vetoAlgorithm::DEFAULT_ALGORITHM)
|
||||
.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>
|
||||
<y>0</y>
|
||||
<width>775</width>
|
||||
<height>345</height>
|
||||
<height>380</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -32,7 +32,7 @@
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="3" column="3">
|
||||
<item row="4" column="3">
|
||||
<widget class="QCheckBox" name="chkCounter2">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -51,7 +51,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<item row="4" column="4">
|
||||
<widget class="QCheckBox" name="chkCounter3">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -70,7 +70,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" colspan="3">
|
||||
<item row="3" column="2" colspan="3">
|
||||
<widget class="QComboBox" name="comboDynamicRange">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -109,7 +109,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="3">
|
||||
<item row="2" column="2" colspan="3">
|
||||
<widget class="QSpinBox" name="spinThreshold">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -146,7 +146,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<item row="2" column="6">
|
||||
<widget class="QSpinBox" name="spinThreshold3">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -183,7 +183,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lblDynamicRange">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -205,7 +205,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<item row="5" column="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -221,7 +221,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="8">
|
||||
<item row="2" column="8">
|
||||
<widget class="QPushButton" name="btnSetThreshold">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
@ -334,7 +334,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblThreshold">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -356,7 +356,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<item row="2" column="5">
|
||||
<widget class="QSpinBox" name="spinThreshold2">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -393,7 +393,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="9">
|
||||
<item row="2" column="9">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -409,7 +409,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lblCounter">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -431,7 +431,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<item row="4" column="2">
|
||||
<widget class="QCheckBox" name="chkCounter1">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -514,7 +514,7 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Dynamic HG0</string>
|
||||
<string>High Gain 0</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@ -527,16 +527,6 @@
|
||||
<string>Fix Gain 2</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>Very Low Gain</string>
|
||||
@ -582,6 +572,11 @@
|
||||
<string>G4_LG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Gain 0</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Undefined</string>
|
||||
@ -594,6 +589,86 @@
|
||||
</item>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
<tabstops>
|
||||
|
@ -10,9 +10,12 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
||||
qTabSettings(QWidget *parent, sls::Detector *detector);
|
||||
~qTabSettings();
|
||||
void Refresh();
|
||||
public slots:
|
||||
void SetExportMode(bool exportMode);
|
||||
|
||||
private slots:
|
||||
void SetSettings(int index);
|
||||
void SetGainMode(int index);
|
||||
void SetDynamicRange(int index);
|
||||
void SetThresholdEnergy(int index);
|
||||
void SetThresholdEnergies();
|
||||
@ -21,9 +24,12 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void SetupDetectorSettings();
|
||||
void SetupGainMode();
|
||||
void ShowFixG0(bool expertMode);
|
||||
void Initialization();
|
||||
|
||||
void GetSettings();
|
||||
void GetGainMode();
|
||||
void GetDynamicRange();
|
||||
void GetThresholdEnergy();
|
||||
void GetThresholdEnergies();
|
||||
@ -40,11 +46,9 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
||||
LOWGAIN,
|
||||
MEDIUMGAIN,
|
||||
VERYHIGHGAIN,
|
||||
DYNAMICHG0,
|
||||
HIGHGAIN0,
|
||||
FIXGAIN1,
|
||||
FIXGAIN2,
|
||||
FORCESWITCHG1,
|
||||
FORCESWITCHG2,
|
||||
VERLOWGAIN,
|
||||
G1_HIGHGAIN,
|
||||
G1_LOWGAIN,
|
||||
@ -54,9 +58,21 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
||||
G2_LOWCAP_LOWGAIN,
|
||||
G4_HIGHGAIN,
|
||||
G4_LOWGAIN,
|
||||
GAIN0,
|
||||
UNDEFINED,
|
||||
UNINITIALIZED,
|
||||
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 };
|
||||
};
|
||||
|
@ -340,6 +340,7 @@ void qDetectorMain::EnableModes(QAction *action) {
|
||||
actionLoadTrimbits->setVisible(enable &&
|
||||
(detType == slsDetectorDefs::EIGER ||
|
||||
detType == slsDetectorDefs::MYTHEN3));
|
||||
tabSettings->SetExportMode(enable);
|
||||
LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable);
|
||||
}
|
||||
|
||||
|
@ -213,23 +213,16 @@ void qTabMeasurement::SetupTimingMode() {
|
||||
index[i] = model->index(i, comboTimingMode->modelColumn(),
|
||||
comboTimingMode->rootModelIndex());
|
||||
item[i] = model->itemFromIndex(index[i]);
|
||||
item[i]->setEnabled(false);
|
||||
}
|
||||
|
||||
item[(int)GATED]->setEnabled(false);
|
||||
item[(int)BURST_TRIGGER]->setEnabled(false);
|
||||
item[(int)TRIGGER_GATED]->setEnabled(false);
|
||||
switch (det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
item[(int)GATED]->setEnabled(true);
|
||||
item[(int)BURST_TRIGGER]->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
item[(int)GATED]->setEnabled(true);
|
||||
item[(int)TRIGGER_GATED]->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
try {
|
||||
auto res = det->getTimingModeList();
|
||||
for (auto it : res) {
|
||||
item[(int)it]->setEnabled(true);
|
||||
}
|
||||
}
|
||||
CATCH_DISPLAY(std::string("Could not setup timing mode"),
|
||||
"qTabMeasurement::SetupTimingMode")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,9 @@ void qTabSettings::SetupWidgetWindow() {
|
||||
comboDynamicRange->setEnabled(true);
|
||||
lblThreshold->setEnabled(true);
|
||||
spinThreshold->setEnabled(true);
|
||||
} else if (detType == slsDetectorDefs::JUNGFRAU) {
|
||||
lblGainMode->setEnabled(true);
|
||||
comboGainMode->setEnabled(true);
|
||||
}
|
||||
|
||||
// default settings for the disabled
|
||||
@ -83,82 +86,83 @@ void qTabSettings::SetupWidgetWindow() {
|
||||
spinThreshold2->setValue(-1);
|
||||
spinThreshold3->setValue(-1);
|
||||
}
|
||||
|
||||
// default for gain mode
|
||||
if (comboGainMode->isEnabled()) {
|
||||
SetupGainMode();
|
||||
}
|
||||
|
||||
Initialization();
|
||||
// default for the disabled
|
||||
GetDynamicRange();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void qTabSettings::SetExportMode(bool exportMode) {
|
||||
if (comboGainMode->isVisible()) {
|
||||
ShowFixG0(exportMode);
|
||||
}
|
||||
}
|
||||
|
||||
void qTabSettings::SetupDetectorSettings() {
|
||||
comboSettings->setCurrentIndex(UNINITIALIZED);
|
||||
|
||||
// enable only those available to detector
|
||||
QStandardItemModel *model =
|
||||
qobject_cast<QStandardItemModel *>(comboSettings->model());
|
||||
const int numSettings = comboSettings->count();
|
||||
if (model) {
|
||||
QModelIndex index[NUMSETTINGS];
|
||||
QStandardItem *item[NUMSETTINGS];
|
||||
for (int i = 0; i < NUMSETTINGS; ++i) {
|
||||
std::vector<QModelIndex> index(numSettings);
|
||||
std::vector<QStandardItem *> item(numSettings);
|
||||
for (size_t i = 0; i < index.size(); ++i) {
|
||||
index[i] = model->index(i, comboSettings->modelColumn(),
|
||||
comboSettings->rootModelIndex());
|
||||
item[i] = model->itemFromIndex(index[i]);
|
||||
item[i]->setEnabled(false);
|
||||
}
|
||||
switch (det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
item[(int)STANDARD]->setEnabled(true);
|
||||
item[(int)HIGHGAIN]->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);
|
||||
try {
|
||||
auto res = det->getSettingsList();
|
||||
for (auto it : res) {
|
||||
item[(int)it]->setEnabled(true);
|
||||
}
|
||||
}
|
||||
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() {
|
||||
// Settings
|
||||
if (comboSettings->isEnabled())
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSettings(int)));
|
||||
// Gain mode
|
||||
if (comboGainMode->isEnabled())
|
||||
connect(comboGainMode, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetGainMode(int)));
|
||||
|
||||
// Dynamic Range
|
||||
if (comboDynamicRange->isEnabled())
|
||||
@ -202,7 +206,7 @@ void qTabSettings::GetSettings() {
|
||||
comboSettings->setCurrentIndex(UNINITIALIZED);
|
||||
break;
|
||||
default:
|
||||
if ((int)retval < -1 || (int)retval >= NUMSETTINGS) {
|
||||
if ((int)retval < -1 || (int)retval >= comboSettings->count()) {
|
||||
throw sls::RuntimeError(std::string("Unknown settings: ") +
|
||||
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() {
|
||||
LOG(logDEBUG) << "Getting dynamic range";
|
||||
disconnect(comboDynamicRange, SIGNAL(activated(int)), this,
|
||||
@ -402,6 +460,10 @@ void qTabSettings::Refresh() {
|
||||
GetSettings();
|
||||
}
|
||||
|
||||
if (comboGainMode->isEnabled()) {
|
||||
GetGainMode();
|
||||
}
|
||||
|
||||
if (comboDynamicRange->isEnabled()) {
|
||||
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_right_datastream = 1;
|
||||
#endif
|
||||
int defaultDacValues[NDAC] = DEFAULT_DAC_VALS;
|
||||
|
||||
int isInitCheckDone() { return initCheckDone; }
|
||||
|
||||
@ -434,8 +435,9 @@ int readConfigFile() {
|
||||
master = -1;
|
||||
top = -1;
|
||||
|
||||
char fname[128];
|
||||
if (getAbsPath(fname, 128, CONFIG_FILE) == FAIL) {
|
||||
const int fileNameSize = 128;
|
||||
char fname[fileNameSize];
|
||||
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@ -684,7 +686,7 @@ void allocateDetectorStructureMemory() {
|
||||
void setupDetector() {
|
||||
|
||||
allocateDetectorStructureMemory();
|
||||
setDefaultDacs();
|
||||
resetToDefaultDacs(0);
|
||||
#ifdef VIRTUAL
|
||||
sharedMemory_setStatus(IDLE);
|
||||
#endif
|
||||
@ -746,21 +748,53 @@ void setupDetector() {
|
||||
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;
|
||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
||||
if ((detectorModules)->dacs[i] != defaultvals[i]) {
|
||||
setDAC((enum DACINDEX)i, defaultDacValues[i], 0);
|
||||
if ((detectorModules)->dacs[i] != defaultDacValues[i]) {
|
||||
ret = FAIL;
|
||||
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
||||
defaultvals[i], (detectorModules)->dacs[i]));
|
||||
defaultDacValues[i], (detectorModules)->dacs[i]));
|
||||
}
|
||||
}
|
||||
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 */
|
||||
int writeRegister(uint32_t offset, uint32_t data) {
|
||||
#ifdef VIRTUAL
|
||||
|
Binary file not shown.
@ -49,6 +49,7 @@ int highvoltage = 0;
|
||||
int dacValues[NDAC] = {};
|
||||
int onChipdacValues[ONCHIP_NDAC][NCHIP] = {};
|
||||
int defaultDacValues[NDAC] = {};
|
||||
int hardCodedDefaultDacValues[NDAC] = {};
|
||||
int defaultOnChipdacValues[ONCHIP_NDAC][NCHIP] = {};
|
||||
int injectedChannelsOffset = 0;
|
||||
int injectedChannelsIncrement = 0;
|
||||
@ -62,7 +63,7 @@ int64_t numTriggersReg = 1;
|
||||
int64_t delayReg = 0;
|
||||
int64_t numBurstsReg = 1;
|
||||
int64_t burstPeriodReg = 0;
|
||||
int filter = 0;
|
||||
int filterResistor = 0;
|
||||
int cdsGain = 0;
|
||||
int detPos[2] = {};
|
||||
|
||||
@ -387,12 +388,13 @@ void setupDetector() {
|
||||
delayReg = 0;
|
||||
numBurstsReg = 1;
|
||||
burstPeriodReg = 0;
|
||||
filter = 0;
|
||||
filterResistor = 0;
|
||||
cdsGain = 0;
|
||||
memset(clkPhase, 0, sizeof(clkPhase));
|
||||
memset(dacValues, 0, sizeof(dacValues));
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
defaultDacValues[i] = -1;
|
||||
hardCodedDefaultDacValues[i] = -1;
|
||||
}
|
||||
for (int i = 0; i < ONCHIP_NDAC; ++i) {
|
||||
for (int j = 0; j < NCHIP; ++j) {
|
||||
@ -465,7 +467,7 @@ void setupDetector() {
|
||||
return;
|
||||
}
|
||||
setBurstMode(DEFAULT_BURST_MODE);
|
||||
setFilter(DEFAULT_FILTER);
|
||||
setFilterResistor(DEFAULT_FILTER_RESISTOR);
|
||||
setCDSGain(DEFAILT_CDS_GAIN);
|
||||
setSettings(DEFAULT_SETTINGS);
|
||||
|
||||
@ -481,7 +483,14 @@ void setupDetector() {
|
||||
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;
|
||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
@ -515,6 +524,31 @@ int setDefaultDacs() {
|
||||
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() {
|
||||
|
||||
if (initError == FAIL) {
|
||||
@ -530,8 +564,9 @@ int readConfigFile() {
|
||||
|
||||
usleep(INITIAL_STARTUP_WAIT);
|
||||
|
||||
char fname[128];
|
||||
if (getAbsPath(fname, 128, CONFIG_FILE) == FAIL) {
|
||||
const int fileNameSize = 128;
|
||||
char fname[fileNameSize];
|
||||
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@ -805,6 +840,7 @@ int readConfigFile() {
|
||||
|
||||
// set default dac variables
|
||||
defaultDacValues[idac] = value;
|
||||
hardCodedDefaultDacValues[idac] = value;
|
||||
|
||||
// set dac
|
||||
setDAC(idac, value, 0);
|
||||
@ -2422,7 +2458,7 @@ int setBurstMode(enum burstMode burst) {
|
||||
}
|
||||
|
||||
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);
|
||||
switch (burstMode) {
|
||||
case BURST_INTERNAL:
|
||||
@ -2437,9 +2473,9 @@ int configureASICGlobalSettings() {
|
||||
value |= (ASIC_CONT_MODE_MSK | ASIC_EXT_TIMING_MSK);
|
||||
break;
|
||||
}
|
||||
LOG(logINFO, ("\tSending Global Chip settings:0x%x (filter:%d, "
|
||||
LOG(logINFO, ("\tSending Global Chip settings:0x%x (filterResistor:%d, "
|
||||
"cdsgain:%d)\n",
|
||||
value, filter, cdsGain));
|
||||
value, filterResistor, cdsGain));
|
||||
|
||||
const int padding = 6; // due to address (4) to make it byte aligned
|
||||
const int lenTotalBits = padding + ASIC_GLOBAL_SETT_MAX_BITS +
|
||||
@ -2515,17 +2551,17 @@ int setCDSGain(int enable) {
|
||||
|
||||
int getCDSGain() { return cdsGain; }
|
||||
|
||||
int setFilter(int value) {
|
||||
if (value < 0 || value > ASIC_FILTER_MAX_VALUE) {
|
||||
LOG(logERROR, ("Invalid filter value %d\n", value));
|
||||
int setFilterResistor(int value) {
|
||||
if (value < 0 || value > ASIC_FILTER_MAX_RES_VALUE) {
|
||||
LOG(logERROR, ("Invalid filter resistor value %d\n", value));
|
||||
return FAIL;
|
||||
}
|
||||
filter = value;
|
||||
LOG(logINFO, ("Setting Filter to %d\n", filter));
|
||||
filterResistor = value;
|
||||
LOG(logINFO, ("Setting Filter Resistor to %d\n", filterResistor));
|
||||
return configureASICGlobalSettings();
|
||||
}
|
||||
|
||||
int getFilter() { return filter; }
|
||||
int getFilterResistor() { return filterResistor; }
|
||||
|
||||
void setCurrentSource(int value) {
|
||||
uint32_t addr = ASIC_CONFIG_REG;
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
/** Default Parameters */
|
||||
#define DEFAULT_BURST_MODE (BURST_INTERNAL)
|
||||
#define DEFAULT_FILTER (0)
|
||||
#define DEFAULT_FILTER_RESISTOR (0)
|
||||
#define DEFAILT_CDS_GAIN (0)
|
||||
#define DEFAULT_NUM_FRAMES (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_FILTER_OFST (3)
|
||||
#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_MSK (0x1 << ASIC_CDS_GAIN_OFST)
|
||||
|
||||
|
Binary file not shown.
@ -45,6 +45,7 @@ int detPos[2] = {};
|
||||
|
||||
int detectorFirstServer = 1;
|
||||
int dacValues[NDAC] = {};
|
||||
int defaultDacValues[NDAC] = DEFAULT_DAC_VALS;
|
||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||
enum externalSignalFlag signalMode = 0;
|
||||
|
||||
@ -405,7 +406,7 @@ void setupDetector() {
|
||||
DAC_MAX_MV);
|
||||
LTC2620_Disable();
|
||||
LTC2620_Configure();
|
||||
setDefaultDacs();
|
||||
resetToDefaultDacs(0);
|
||||
|
||||
// temp
|
||||
bus_w(TEMP_SPI_IN_REG, TEMP_SPI_IN_IDLE_MSK);
|
||||
@ -433,21 +434,53 @@ void setupDetector() {
|
||||
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;
|
||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
||||
if (dacValues[i] != defaultvals[i]) {
|
||||
setDAC((enum DACINDEX)i, defaultDacValues[i], 0);
|
||||
if (dacValues[i] != defaultDacValues[i]) {
|
||||
ret = FAIL;
|
||||
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
||||
defaultvals[i], dacValues[i]));
|
||||
defaultDacValues[i], dacValues[i]));
|
||||
}
|
||||
}
|
||||
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) {
|
||||
if (((offset << MEM_MAP_SHIFT) == CONTROL_REG) ||
|
||||
((offset << MEM_MAP_SHIFT) == FIFO_DATA_REG)) {
|
||||
@ -588,8 +621,9 @@ void setGbitReadout() {
|
||||
}
|
||||
|
||||
int readConfigFile() {
|
||||
char fname[128];
|
||||
if (getAbsPath(fname, 128, CONFIG_FILE) == FAIL) {
|
||||
const int fileNameSize = 128;
|
||||
char fname[fileNameSize];
|
||||
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
@ -37,3 +37,5 @@ install(TARGETS jungfrauDetectorServer_virtual
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
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)
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
|
||||
mv $(PROGS) $(DESTDIR)
|
||||
cp config_jungfrau.txt $(DESTDIR)
|
||||
rm *.gdb
|
||||
rm $(main_src)*.o
|
||||
|
||||
|
@ -1,498 +1,475 @@
|
||||
#pragma once
|
||||
// clang-format off
|
||||
|
||||
/* Definitions for FPGA*/
|
||||
#define MEM_MAP_SHIFT 1
|
||||
|
||||
/* FPGA Version register */
|
||||
#define FPGA_VERSION_REG (0x00 << MEM_MAP_SHIFT)
|
||||
#define FPGA_VERSION_REG (0x00 << MEM_MAP_SHIFT)
|
||||
|
||||
#define FPGA_COMPILATION_DATE_OFST (0)
|
||||
#define FPGA_COMPILATION_DATE_MSK (0x00FFFFFF << FPGA_COMPILATION_DATE_OFST)
|
||||
#define DETECTOR_TYPE_OFST (24)
|
||||
#define DETECTOR_TYPE_MSK (0x000000FF << DETECTOR_TYPE_OFST)
|
||||
#define FPGA_COMPILATION_DATE_OFST (0)
|
||||
#define FPGA_COMPILATION_DATE_MSK (0x00FFFFFF << FPGA_COMPILATION_DATE_OFST)
|
||||
#define DETECTOR_TYPE_OFST (24)
|
||||
#define DETECTOR_TYPE_MSK (0x000000FF << DETECTOR_TYPE_OFST)
|
||||
|
||||
/* Fix pattern register */
|
||||
#define FIX_PATT_REG (0x01 << MEM_MAP_SHIFT)
|
||||
#define FIX_PATT_REG (0x01 << MEM_MAP_SHIFT)
|
||||
|
||||
#define FIX_PATT_VAL (0xACDC2014)
|
||||
#define FIX_PATT_VAL (0xACDC2014)
|
||||
|
||||
/* Status register */
|
||||
#define STATUS_REG (0x02 << MEM_MAP_SHIFT)
|
||||
#define STATUS_REG (0x02 << MEM_MAP_SHIFT)
|
||||
|
||||
#define RUN_BUSY_OFST (0)
|
||||
#define RUN_BUSY_MSK (0x00000001 << RUN_BUSY_OFST)
|
||||
#define WAITING_FOR_TRIGGER_OFST (3)
|
||||
#define WAITING_FOR_TRIGGER_MSK (0x00000001 << WAITING_FOR_TRIGGER_OFST)
|
||||
#define DELAYBEFORE_OFST (4) // Not used in software
|
||||
#define DELAYBEFORE_MSK (0x00000001 << DELAYBEFORE_OFST) // Not used in software
|
||||
#define DELAYAFTER_OFST (5) // Not used in software
|
||||
#define DELAYAFTER_MSK (0x00000001 << DELAYAFTER_OFST) // Not used in software
|
||||
#define STOPPED_OFST (15)
|
||||
#define STOPPED_MSK (0x00000001 << STOPPED_OFST)
|
||||
#define RUNMACHINE_BUSY_OFST (17)
|
||||
#define RUNMACHINE_BUSY_MSK (0x00000001 << RUNMACHINE_BUSY_OFST)
|
||||
#define RUN_BUSY_OFST (0)
|
||||
#define RUN_BUSY_MSK (0x00000001 << RUN_BUSY_OFST)
|
||||
#define WAITING_FOR_TRIGGER_OFST (3)
|
||||
#define WAITING_FOR_TRIGGER_MSK (0x00000001 << WAITING_FOR_TRIGGER_OFST)
|
||||
#define DELAYBEFORE_OFST (4) // Not used in software
|
||||
#define DELAYBEFORE_MSK (0x00000001 << DELAYBEFORE_OFST) // Not used in software
|
||||
#define DELAYAFTER_OFST (5) // Not used in software
|
||||
#define DELAYAFTER_MSK (0x00000001 << DELAYAFTER_OFST) // Not used in software
|
||||
#define STOPPED_OFST (15)
|
||||
#define STOPPED_MSK (0x00000001 << STOPPED_OFST)
|
||||
#define RUNMACHINE_BUSY_OFST (17)
|
||||
#define RUNMACHINE_BUSY_MSK (0x00000001 << RUNMACHINE_BUSY_OFST)
|
||||
|
||||
/* Look at me register */
|
||||
#define LOOK_AT_ME_REG \
|
||||
(0x03 << MEM_MAP_SHIFT) // Not used in firmware or software
|
||||
#define LOOK_AT_ME_REG (0x03 << MEM_MAP_SHIFT) // Not used in firmware or software
|
||||
|
||||
/* 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_MSK \
|
||||
(0x00000001 << DDR3_CAL_DONE_OFST) // Not used in software
|
||||
#define DDR3_CAL_FAIL_OFST (1) // Not used in software
|
||||
#define DDR3_CAL_FAIL_MSK \
|
||||
(0x00000001 << DDR3_CAL_FAIL_OFST) // Not used in software
|
||||
#define DDR3_INIT_DONE_OFST (2) // Not used in software
|
||||
#define DDR3_INIT_DONE_MSK \
|
||||
(0x00000001 << DDR3_INIT_DONE_OFST) // Not used in software
|
||||
#define RECONFIG_PLL_LCK_OFST (3) // Not used in software
|
||||
#define RECONFIG_PLL_LCK_MSK \
|
||||
(0x00000001 << RECONFIG_PLL_LCK_OFST) // 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 DD3_PLL_LCK_OFST (5) // Not used in software
|
||||
#define DD3_PLL_LCK_MSK (0x00000001 << DD3_PLL_LCK_OFST) // Not used in software
|
||||
#define DDR3_CAL_DONE_OFST (0) // Not used in software
|
||||
#define DDR3_CAL_DONE_MSK (0x00000001 << DDR3_CAL_DONE_OFST) // Not used in software
|
||||
#define DDR3_CAL_FAIL_OFST (1) // Not used in software
|
||||
#define DDR3_CAL_FAIL_MSK (0x00000001 << DDR3_CAL_FAIL_OFST) // Not used in software
|
||||
#define DDR3_INIT_DONE_OFST (2) // Not used in software
|
||||
#define DDR3_INIT_DONE_MSK (0x00000001 << DDR3_INIT_DONE_OFST) // Not used in software
|
||||
#define RECONFIG_PLL_LCK_OFST (3) // Not used in software
|
||||
#define RECONFIG_PLL_LCK_MSK (0x00000001 << RECONFIG_PLL_LCK_OFST) // 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 DD3_PLL_LCK_OFST (5) // Not used in software
|
||||
#define DD3_PLL_LCK_MSK (0x00000001 << DD3_PLL_LCK_OFST) // Not used in software
|
||||
|
||||
/* Module Control Board Serial Number Register */
|
||||
#define MOD_SERIAL_NUM_REG (0x0A << MEM_MAP_SHIFT)
|
||||
#define MOD_SERIAL_NUM_REG (0x0A << MEM_MAP_SHIFT)
|
||||
|
||||
#define HARDWARE_SERIAL_NUM_OFST (0)
|
||||
#define HARDWARE_SERIAL_NUM_MSK (0x000000FF << HARDWARE_SERIAL_NUM_OFST)
|
||||
#define HARDWARE_VERSION_NUM_OFST (16)
|
||||
#define HARDWARE_VERSION_NUM_MSK (0x0000003F << HARDWARE_VERSION_NUM_OFST)
|
||||
#define HARDWARE_VERSION_2_VAL \
|
||||
((0x2 << HARDWARE_VERSION_NUM_OFST) & HARDWARE_VERSION_NUM_MSK)
|
||||
#define HARDWARE_SERIAL_NUM_OFST (0)
|
||||
#define HARDWARE_SERIAL_NUM_MSK (0x000000FF << HARDWARE_SERIAL_NUM_OFST)
|
||||
#define HARDWARE_VERSION_NUM_OFST (16)
|
||||
#define HARDWARE_VERSION_NUM_MSK (0x0000003F << HARDWARE_VERSION_NUM_OFST)
|
||||
#define HARDWARE_VERSION_2_VAL ((0x2 << HARDWARE_VERSION_NUM_OFST) & HARDWARE_VERSION_NUM_MSK)
|
||||
|
||||
/* API Version Register */
|
||||
#define API_VERSION_REG (0x0F << MEM_MAP_SHIFT)
|
||||
#define API_VERSION_REG (0x0F << MEM_MAP_SHIFT)
|
||||
|
||||
#define API_VERSION_OFST (0)
|
||||
#define API_VERSION_MSK (0x00FFFFFF << API_VERSION_OFST)
|
||||
#define API_VERSION_DETECTOR_TYPE_OFST (24) // Not used in software
|
||||
#define API_VERSION_DETECTOR_TYPE_MSK \
|
||||
(0x000000FF << API_VERSION_DETECTOR_TYPE_OFST) // Not used in software
|
||||
#define API_VERSION_OFST (0)
|
||||
#define API_VERSION_MSK (0x00FFFFFF << API_VERSION_OFST)
|
||||
#define API_VERSION_DETECTOR_TYPE_OFST (24) // Not used in software
|
||||
#define API_VERSION_DETECTOR_TYPE_MSK (0x000000FF << API_VERSION_DETECTOR_TYPE_OFST) // Not used in software
|
||||
|
||||
/* Time from Start 64 bit register */
|
||||
#define TIME_FROM_START_LSB_REG (0x10 << MEM_MAP_SHIFT)
|
||||
#define TIME_FROM_START_MSB_REG (0x11 << MEM_MAP_SHIFT)
|
||||
#define TIME_FROM_START_LSB_REG (0x10 << MEM_MAP_SHIFT)
|
||||
#define TIME_FROM_START_MSB_REG (0x11 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Get Delay 64 bit register */
|
||||
#define GET_DELAY_LSB_REG (0x12 << MEM_MAP_SHIFT) // different kind of delay
|
||||
#define GET_DELAY_MSB_REG (0x13 << MEM_MAP_SHIFT) // different kind of delay
|
||||
#define GET_DELAY_LSB_REG (0x12 << MEM_MAP_SHIFT) // different kind of delay
|
||||
#define GET_DELAY_MSB_REG (0x13 << MEM_MAP_SHIFT) // different kind of delay
|
||||
|
||||
/* Get Triggers 64 bit register */
|
||||
#define GET_CYCLES_LSB_REG (0x14 << MEM_MAP_SHIFT)
|
||||
#define GET_CYCLES_MSB_REG (0x15 << MEM_MAP_SHIFT)
|
||||
#define GET_CYCLES_LSB_REG (0x14 << MEM_MAP_SHIFT)
|
||||
#define GET_CYCLES_MSB_REG (0x15 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Get Frames 64 bit register */
|
||||
#define GET_FRAMES_LSB_REG (0x16 << MEM_MAP_SHIFT)
|
||||
#define GET_FRAMES_MSB_REG (0x17 << MEM_MAP_SHIFT)
|
||||
#define GET_FRAMES_LSB_REG (0x16 << MEM_MAP_SHIFT)
|
||||
#define GET_FRAMES_MSB_REG (0x17 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Get Period 64 bit register tT = T x 50 ns */
|
||||
#define GET_PERIOD_LSB_REG (0x18 << MEM_MAP_SHIFT)
|
||||
#define GET_PERIOD_MSB_REG (0x19 << MEM_MAP_SHIFT)
|
||||
#define GET_PERIOD_LSB_REG (0x18 << MEM_MAP_SHIFT)
|
||||
#define GET_PERIOD_MSB_REG (0x19 << MEM_MAP_SHIFT)
|
||||
|
||||
/** Get Temperature Carlos, incorrectl as get gates */
|
||||
#define GET_TEMPERATURE_TMP112_REG \
|
||||
(0x1c << MEM_MAP_SHIFT) // (after multiplying by 625) in 10ths of
|
||||
#define GET_TEMPERATURE_TMP112_REG (0x1c << MEM_MAP_SHIFT) // (after multiplying by 625) in 10ths of
|
||||
// millidegrees of TMP112
|
||||
|
||||
#define TEMPERATURE_VALUE_BIT (0)
|
||||
#define TEMPERATURE_VALUE_MSK (0x000007FF << TEMPERATURE_VALUE_BIT)
|
||||
#define TEMPERATURE_POLARITY_BIT (11)
|
||||
#define TEMPERATURE_POLARITY_MSK (0x00000001 << TEMPERATURE_POLARITY_BIT)
|
||||
#define TEMPERATURE_VALUE_BIT (0)
|
||||
#define TEMPERATURE_VALUE_MSK (0x000007FF << TEMPERATURE_VALUE_BIT)
|
||||
#define TEMPERATURE_POLARITY_BIT (11)
|
||||
#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
|
||||
* CONTROL_CRST) */
|
||||
#define FRAMES_FROM_START_LSB_REG (0x22 << MEM_MAP_SHIFT)
|
||||
#define FRAMES_FROM_START_MSB_REG (0x23 << MEM_MAP_SHIFT)
|
||||
#define FRAMES_FROM_START_LSB_REG (0x22 << MEM_MAP_SHIFT)
|
||||
#define FRAMES_FROM_START_MSB_REG (0x23 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Get Starting Frame Number */
|
||||
#define GET_FRAME_NUMBER_LSB_REG (0x24 << MEM_MAP_SHIFT)
|
||||
#define GET_FRAME_NUMBER_MSB_REG (0x25 << MEM_MAP_SHIFT)
|
||||
#define GET_FRAME_NUMBER_LSB_REG (0x24 << MEM_MAP_SHIFT)
|
||||
#define GET_FRAME_NUMBER_MSB_REG (0x25 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Measurement Time 64 bit register (timestamp at a frame start until reset)*/
|
||||
#define START_FRAME_TIME_LSB_REG (0x26 << MEM_MAP_SHIFT)
|
||||
#define START_FRAME_TIME_MSB_REG (0x27 << MEM_MAP_SHIFT)
|
||||
#define START_FRAME_TIME_LSB_REG (0x26 << MEM_MAP_SHIFT)
|
||||
#define START_FRAME_TIME_MSB_REG (0x27 << MEM_MAP_SHIFT)
|
||||
|
||||
/* SPI (Serial Peripheral Interface) Register */
|
||||
#define SPI_REG (0x40 << MEM_MAP_SHIFT)
|
||||
#define SPI_REG (0x40 << MEM_MAP_SHIFT)
|
||||
|
||||
#define SPI_DAC_SRL_DGTL_OTPT_OFST (0)
|
||||
#define SPI_DAC_SRL_DGTL_OTPT_MSK (0x00000001 << SPI_DAC_SRL_DGTL_OTPT_OFST)
|
||||
#define SPI_DAC_SRL_CLK_OTPT_OFST (1)
|
||||
#define SPI_DAC_SRL_CLK_OTPT_MSK (0x00000001 << SPI_DAC_SRL_CLK_OTPT_OFST)
|
||||
#define SPI_DAC_SRL_CS_OTPT_OFST (2)
|
||||
#define SPI_DAC_SRL_CS_OTPT_MSK (0x00000001 << SPI_DAC_SRL_CS_OTPT_OFST)
|
||||
#define SPI_HV_SRL_DGTL_OTPT_OFST (8)
|
||||
#define SPI_HV_SRL_DGTL_OTPT_MSK (0x00000001 << SPI_HV_SRL_DGTL_OTPT_OFST)
|
||||
#define SPI_HV_SRL_CLK_OTPT_OFST (9)
|
||||
#define SPI_HV_SRL_CLK_OTPT_MSK (0x00000001 << SPI_HV_SRL_CLK_OTPT_OFST)
|
||||
#define SPI_HV_SRL_CS_OTPT_OFST (10)
|
||||
#define SPI_HV_SRL_CS_OTPT_MSK (0x00000001 << SPI_HV_SRL_CS_OTPT_OFST)
|
||||
#define SPI_DAC_SRL_DGTL_OTPT_OFST (0)
|
||||
#define SPI_DAC_SRL_DGTL_OTPT_MSK (0x00000001 << SPI_DAC_SRL_DGTL_OTPT_OFST)
|
||||
#define SPI_DAC_SRL_CLK_OTPT_OFST (1)
|
||||
#define SPI_DAC_SRL_CLK_OTPT_MSK (0x00000001 << SPI_DAC_SRL_CLK_OTPT_OFST)
|
||||
#define SPI_DAC_SRL_CS_OTPT_OFST (2)
|
||||
#define SPI_DAC_SRL_CS_OTPT_MSK (0x00000001 << SPI_DAC_SRL_CS_OTPT_OFST)
|
||||
#define SPI_HV_SRL_DGTL_OTPT_OFST (8)
|
||||
#define SPI_HV_SRL_DGTL_OTPT_MSK (0x00000001 << SPI_HV_SRL_DGTL_OTPT_OFST)
|
||||
#define SPI_HV_SRL_CLK_OTPT_OFST (9)
|
||||
#define SPI_HV_SRL_CLK_OTPT_MSK (0x00000001 << SPI_HV_SRL_CLK_OTPT_OFST)
|
||||
#define SPI_HV_SRL_CS_OTPT_OFST (10)
|
||||
#define SPI_HV_SRL_CS_OTPT_MSK (0x00000001 << SPI_HV_SRL_CS_OTPT_OFST)
|
||||
|
||||
/* ADC SPI (Serial Peripheral Interface) Register */
|
||||
#define ADC_SPI_REG (0x41 << MEM_MAP_SHIFT)
|
||||
#define ADC_SPI_REG (0x41 << MEM_MAP_SHIFT)
|
||||
|
||||
#define ADC_SPI_SRL_CLK_OTPT_OFST (0)
|
||||
#define ADC_SPI_SRL_CLK_OTPT_MSK (0x00000001 << ADC_SPI_SRL_CLK_OTPT_OFST)
|
||||
#define ADC_SPI_SRL_DT_OTPT_OFST (1)
|
||||
#define ADC_SPI_SRL_DT_OTPT_MSK (0x00000001 << ADC_SPI_SRL_DT_OTPT_OFST)
|
||||
#define ADC_SPI_SRL_CS_OTPT_OFST (2)
|
||||
#define ADC_SPI_SRL_CS_OTPT_MSK (0x0000000F << ADC_SPI_SRL_CS_OTPT_OFST)
|
||||
#define ADC_SPI_SRL_CLK_OTPT_OFST (0)
|
||||
#define ADC_SPI_SRL_CLK_OTPT_MSK (0x00000001 << ADC_SPI_SRL_CLK_OTPT_OFST)
|
||||
#define ADC_SPI_SRL_DT_OTPT_OFST (1)
|
||||
#define ADC_SPI_SRL_DT_OTPT_MSK (0x00000001 << ADC_SPI_SRL_DT_OTPT_OFST)
|
||||
#define ADC_SPI_SRL_CS_OTPT_OFST (2)
|
||||
#define ADC_SPI_SRL_CS_OTPT_MSK (0x0000000F << ADC_SPI_SRL_CS_OTPT_OFST)
|
||||
|
||||
/* ADC offset Register */
|
||||
#define ADC_OFST_REG (0x42 << MEM_MAP_SHIFT)
|
||||
#define ADC_OFST_REG (0x42 << MEM_MAP_SHIFT)
|
||||
|
||||
/* ADC Port Invert Register */
|
||||
#define ADC_PORT_INVERT_REG (0x43 << MEM_MAP_SHIFT)
|
||||
#define ADC_PORT_INVERT_REG (0x43 << MEM_MAP_SHIFT)
|
||||
|
||||
#define ADC_PORT_INVERT_ADC_0_OFST (0)
|
||||
#define ADC_PORT_INVERT_ADC_0_MSK (0x000000FF << ADC_PORT_INVERT_ADC_0_OFST)
|
||||
#define ADC_PORT_INVERT_ADC_1_OFST (8)
|
||||
#define ADC_PORT_INVERT_ADC_1_MSK (0x000000FF << ADC_PORT_INVERT_ADC_1_OFST)
|
||||
#define ADC_PORT_INVERT_ADC_2_OFST (16)
|
||||
#define ADC_PORT_INVERT_ADC_2_MSK (0x000000FF << ADC_PORT_INVERT_ADC_2_OFST)
|
||||
#define ADC_PORT_INVERT_ADC_3_OFST (24)
|
||||
#define ADC_PORT_INVERT_ADC_3_MSK (0x000000FF << ADC_PORT_INVERT_ADC_3_OFST)
|
||||
#define ADC_PORT_INVERT_ADC_0_OFST (0)
|
||||
#define ADC_PORT_INVERT_ADC_0_MSK (0x000000FF << ADC_PORT_INVERT_ADC_0_OFST)
|
||||
#define ADC_PORT_INVERT_ADC_1_OFST (8)
|
||||
#define ADC_PORT_INVERT_ADC_1_MSK (0x000000FF << ADC_PORT_INVERT_ADC_1_OFST)
|
||||
#define ADC_PORT_INVERT_ADC_2_OFST (16)
|
||||
#define ADC_PORT_INVERT_ADC_2_MSK (0x000000FF << ADC_PORT_INVERT_ADC_2_OFST)
|
||||
#define ADC_PORT_INVERT_ADC_3_OFST (24)
|
||||
#define ADC_PORT_INVERT_ADC_3_MSK (0x000000FF << ADC_PORT_INVERT_ADC_3_OFST)
|
||||
|
||||
/* Configuration Register */
|
||||
#define CONFIG_REG (0x4D << MEM_MAP_SHIFT)
|
||||
#define CONFIG_REG (0x4D << MEM_MAP_SHIFT)
|
||||
|
||||
// readout timer (from chip) to stabilize (esp in burst acquisition mode) tRDT =
|
||||
// (RDT + 1) * 25ns
|
||||
#define CONFIG_RDT_TMR_OFST (0)
|
||||
#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)
|
||||
#define CONFIG_RDT_TMR_OFST (0)
|
||||
#define CONFIG_RDT_TMR_MSK (0x0000FFFF << CONFIG_RDT_TMR_OFST)
|
||||
// if 0, outer is the primary interface
|
||||
#define CONFIG_INNR_PRIMRY_INTRFCE_OFST (17)
|
||||
#define CONFIG_INNR_PRIMRY_INTRFCE_MSK \
|
||||
(0x00000001 << CONFIG_INNR_PRIMRY_INTRFCE_OFST)
|
||||
#define CONFIG_READOUT_SPEED_OFST (20)
|
||||
#define CONFIG_READOUT_SPEED_MSK (0x00000003 << CONFIG_READOUT_SPEED_OFST)
|
||||
#define CONFIG_QUARTER_SPEED_10MHZ_VAL \
|
||||
((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_FULL_SPEED_40MHZ_VAL \
|
||||
((0x2 << CONFIG_READOUT_SPEED_OFST) & CONFIG_READOUT_SPEED_MSK)
|
||||
#define CONFIG_TDMA_ENABLE_OFST (24)
|
||||
#define CONFIG_TDMA_ENABLE_MSK (0x00000001 << CONFIG_TDMA_ENABLE_OFST)
|
||||
#define CONFIG_TDMA_TIMESLOT_OFST (25) // 1ms
|
||||
#define CONFIG_TDMA_TIMESLOT_MSK (0x0000001F << CONFIG_TDMA_TIMESLOT_OFST)
|
||||
#define CONFIG_ETHRNT_FLW_CNTRL_OFST (31)
|
||||
#define CONFIG_ETHRNT_FLW_CNTRL_MSK (0x00000001 << CONFIG_ETHRNT_FLW_CNTRL_OFST)
|
||||
// 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_MSK (0x00000001 << CONFIG_INNR_PRIMRY_INTRFCE_OFST)
|
||||
#define CONFIG_READOUT_SPEED_OFST (20)
|
||||
#define CONFIG_READOUT_SPEED_MSK (0x00000003 << CONFIG_READOUT_SPEED_OFST)
|
||||
#define CONFIG_QUARTER_SPEED_10MHZ_VAL ((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_FULL_SPEED_40MHZ_VAL ((0x2 << CONFIG_READOUT_SPEED_OFST) & CONFIG_READOUT_SPEED_MSK)
|
||||
#define CONFIG_TDMA_ENABLE_OFST (24)
|
||||
#define CONFIG_TDMA_ENABLE_MSK (0x00000001 << CONFIG_TDMA_ENABLE_OFST)
|
||||
#define CONFIG_TDMA_TIMESLOT_OFST (25) // 1ms
|
||||
#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_MSK (0x00000001 << CONFIG_ETHRNT_FLW_CNTRL_OFST)
|
||||
|
||||
/* External Signal Register */
|
||||
#define EXT_SIGNAL_REG (0x4E << MEM_MAP_SHIFT)
|
||||
#define EXT_SIGNAL_REG (0x4E << MEM_MAP_SHIFT)
|
||||
|
||||
#define EXT_SIGNAL_OFST (0)
|
||||
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
|
||||
#define EXT_SIGNAL_OFST (0)
|
||||
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
|
||||
|
||||
/* Control Register */
|
||||
#define CONTROL_REG (0x4F << MEM_MAP_SHIFT)
|
||||
#define CONTROL_REG (0x4F << MEM_MAP_SHIFT)
|
||||
|
||||
#define CONTROL_START_ACQ_OFST (0)
|
||||
#define CONTROL_START_ACQ_MSK (0x00000001 << CONTROL_START_ACQ_OFST)
|
||||
#define CONTROL_STOP_ACQ_OFST (1)
|
||||
#define CONTROL_STOP_ACQ_MSK (0x00000001 << CONTROL_STOP_ACQ_OFST)
|
||||
#define CONTROL_CORE_RST_OFST (10)
|
||||
#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_MSK \
|
||||
(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_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_MSK (0x00000001 << CONTROL_ACQ_FIFO_CLR_OFST)
|
||||
#define CONTROL_STORAGE_CELL_NUM_OFST (16)
|
||||
#define CONTROL_STORAGE_CELL_NUM_MSK \
|
||||
(0x0000000F << CONTROL_STORAGE_CELL_NUM_OFST)
|
||||
#define CONTROL_RX_ADDTNL_ENDPTS_NUM_OFST (20)
|
||||
#define CONTROL_RX_ADDTNL_ENDPTS_NUM_MSK \
|
||||
(0x0000003F << CONTROL_RX_ADDTNL_ENDPTS_NUM_OFST)
|
||||
#define CONTROL_RX_ENDPTS_START_OFST (26)
|
||||
#define CONTROL_RX_ENDPTS_START_MSK (0x0000003F << CONTROL_RX_ENDPTS_START_OFST)
|
||||
#define CONTROL_START_ACQ_OFST (0)
|
||||
#define CONTROL_START_ACQ_MSK (0x00000001 << CONTROL_START_ACQ_OFST)
|
||||
#define CONTROL_STOP_ACQ_OFST (1)
|
||||
#define CONTROL_STOP_ACQ_MSK (0x00000001 << CONTROL_STOP_ACQ_OFST)
|
||||
#define CONTROL_CORE_RST_OFST (10)
|
||||
#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_MSK (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_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_MSK (0x00000001 << CONTROL_ACQ_FIFO_CLR_OFST)
|
||||
#define CONTROL_STORAGE_CELL_NUM_OFST (16)
|
||||
#define CONTROL_STORAGE_CELL_NUM_MSK (0x0000000F << CONTROL_STORAGE_CELL_NUM_OFST)
|
||||
#define CONTROL_RX_ADDTNL_ENDPTS_NUM_OFST (20)
|
||||
#define CONTROL_RX_ADDTNL_ENDPTS_NUM_MSK (0x0000003F << CONTROL_RX_ADDTNL_ENDPTS_NUM_OFST)
|
||||
#define CONTROL_RX_ENDPTS_START_OFST (26)
|
||||
#define CONTROL_RX_ENDPTS_START_MSK (0x0000003F << CONTROL_RX_ENDPTS_START_OFST)
|
||||
|
||||
/* Reconfiguratble PLL Paramater Register */
|
||||
#define PLL_PARAM_REG (0x50 << MEM_MAP_SHIFT)
|
||||
#define PLL_PARAM_REG (0x50 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Reconfiguratble PLL Control Regiser */
|
||||
#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_MSK \
|
||||
(0x00000001 << PLL_CNTRL_RCNFG_PRMTR_RST_OFST) // parameter reset
|
||||
#define PLL_CNTRL_WR_PRMTR_OFST (2)
|
||||
#define PLL_CNTRL_WR_PRMTR_MSK (0x00000001 << PLL_CNTRL_WR_PRMTR_OFST)
|
||||
#define PLL_CNTRL_PLL_RST_OFST (3)
|
||||
#define PLL_CNTRL_PLL_RST_MSK (0x00000001 << PLL_CNTRL_PLL_RST_OFST)
|
||||
#define PLL_CNTRL_DBIT_WR_PRMTR_OFST (5)
|
||||
#define PLL_CNTRL_DBIT_WR_PRMTR_MSK (0x00000001 << PLL_CNTRL_DBIT_WR_PRMTR_OFST)
|
||||
#define PLL_CNTRL_ADDR_OFST (16)
|
||||
#define PLL_CNTRL_ADDR_MSK (0x0000003F << PLL_CNTRL_ADDR_OFST)
|
||||
#define PLL_CNTRL_RCNFG_PRMTR_RST_OFST (0) // parameter reset
|
||||
#define PLL_CNTRL_RCNFG_PRMTR_RST_MSK (0x00000001 << PLL_CNTRL_RCNFG_PRMTR_RST_OFST) // parameter reset
|
||||
#define PLL_CNTRL_WR_PRMTR_OFST (2)
|
||||
#define PLL_CNTRL_WR_PRMTR_MSK (0x00000001 << PLL_CNTRL_WR_PRMTR_OFST)
|
||||
#define PLL_CNTRL_PLL_RST_OFST (3)
|
||||
#define PLL_CNTRL_PLL_RST_MSK (0x00000001 << PLL_CNTRL_PLL_RST_OFST)
|
||||
#define PLL_CNTRL_DBIT_WR_PRMTR_OFST (5)
|
||||
#define PLL_CNTRL_DBIT_WR_PRMTR_MSK (0x00000001 << PLL_CNTRL_DBIT_WR_PRMTR_OFST)
|
||||
#define PLL_CNTRL_ADDR_OFST (16)
|
||||
#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 */
|
||||
#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_MSK (0x00000007 << SAMPLE_ADC_SAMPLE_SEL_OFST)
|
||||
#define SAMPLE_ADC_SAMPLE_0_VAL \
|
||||
((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_2_VAL \
|
||||
((0x2 << 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_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)
|
||||
#define SAMPLE_ADC_SAMPLE_SEL_OFST (0)
|
||||
#define SAMPLE_ADC_SAMPLE_SEL_MSK (0x00000007 << SAMPLE_ADC_SAMPLE_SEL_OFST)
|
||||
#define SAMPLE_ADC_SAMPLE_0_VAL ((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_2_VAL ((0x2 << 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_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
|
||||
#define SAMPLE_ADC_DECMT_FACTOR_OFST (4)
|
||||
#define SAMPLE_ADC_DECMT_FACTOR_MSK (0x00000007 << SAMPLE_ADC_DECMT_FACTOR_OFST)
|
||||
#define SAMPLE_ADC_DECMT_FACTOR_0_VAL \
|
||||
((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_2_VAL \
|
||||
((0x2 << 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_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_ADC_DECMT_FACTOR_OFST (4)
|
||||
#define SAMPLE_ADC_DECMT_FACTOR_MSK (0x00000007 << SAMPLE_ADC_DECMT_FACTOR_OFST)
|
||||
#define SAMPLE_ADC_DECMT_FACTOR_0_VAL ((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_2_VAL ((0x2 << 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_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_MSK (0x0000000F << SAMPLE_DGTL_SAMPLE_SEL_OFST)
|
||||
#define SAMPLE_DGTL_SAMPLE_0_VAL \
|
||||
((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_2_VAL \
|
||||
((0x2 << 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_4_VAL \
|
||||
((0x4 << 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_6_VAL \
|
||||
((0x6 << 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_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_SAMPLE_SEL_OFST (8)
|
||||
#define SAMPLE_DGTL_SAMPLE_SEL_MSK (0x0000000F << SAMPLE_DGTL_SAMPLE_SEL_OFST)
|
||||
#define SAMPLE_DGTL_SAMPLE_0_VAL ((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_2_VAL ((0x2 << 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_4_VAL ((0x4 << 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_6_VAL ((0x6 << 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_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_MSK \
|
||||
(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_HALF_VAL \
|
||||
((0x1 << 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_DGTL_DECMT_FACTOR_OFST (12)
|
||||
#define SAMPLE_DGTL_DECMT_FACTOR_MSK (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_HALF_VAL ((0x1 << 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)
|
||||
|
||||
/** Current Source Column 0 (0 - 31)) */
|
||||
#define CRRNT_SRC_COL_LSB_REG (0x5A << MEM_MAP_SHIFT)
|
||||
|
||||
/** Current Source Column 1 (32 - 63) */
|
||||
#define CRRNT_SRC_COL_MSB_REG (0x5B << MEM_MAP_SHIFT)
|
||||
|
||||
/** Vref Comp Mod Register */
|
||||
#define EXT_DAQ_CTRL_REG (0x5C << MEM_MAP_SHIFT)
|
||||
#define EXT_DAQ_CTRL_REG (0x5C << MEM_MAP_SHIFT)
|
||||
|
||||
#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_CMP_LGC_ENBL_OFST (15)
|
||||
#define EXT_DAQ_CTRL_CMP_LGC_ENBL_MSK \
|
||||
(0x00000001 << EXT_DAQ_CTRL_CMP_LGC_ENBL_OFST)
|
||||
#define EXT_DAQ_CTRL_INPT_DETECT_OFST (16)
|
||||
#define EXT_DAQ_CTRL_INPT_DETECT_MSK \
|
||||
(0x00000007 << EXT_DAQ_CTRL_INPT_DETECT_OFST)
|
||||
#define EXT_DAQ_CTRL_INPT_DETECT_ENBL_OFST (19)
|
||||
#define EXT_DAQ_CTRL_INPT_DETECT_ENBL_MSK \
|
||||
(0x00000001 << EXT_DAQ_CTRL_INPT_DETECT_ENBL_OFST)
|
||||
#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_CMP_LGC_ENBL_OFST (15)
|
||||
#define EXT_DAQ_CTRL_CMP_LGC_ENBL_MSK (0x00000001 << EXT_DAQ_CTRL_CMP_LGC_ENBL_OFST)
|
||||
#define EXT_DAQ_CTRL_INPT_DETECT_OFST (16)
|
||||
#define EXT_DAQ_CTRL_INPT_DETECT_MSK (0x00000007 << EXT_DAQ_CTRL_INPT_DETECT_OFST)
|
||||
#define EXT_DAQ_CTRL_INPT_DETECT_ENBL_OFST (19)
|
||||
#define EXT_DAQ_CTRL_INPT_DETECT_ENBL_MSK (0x00000001 << EXT_DAQ_CTRL_INPT_DETECT_ENBL_OFST)
|
||||
|
||||
/** DAQ Register */
|
||||
#define DAQ_REG (0x5D << MEM_MAP_SHIFT)
|
||||
#define DAQ_REG (0x5D << MEM_MAP_SHIFT)
|
||||
|
||||
#define DAQ_SETTINGS_MSK \
|
||||
(DAQ_HIGH_GAIN_MSK | DAQ_FIX_GAIN_MSK | DAQ_FRCE_SWTCH_GAIN_MSK)
|
||||
#define DAQ_HIGH_GAIN_OFST (0)
|
||||
#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_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_2_VAL ((0x3 << DAQ_FIX_GAIN_OFST) & DAQ_FIX_GAIN_MSK)
|
||||
#define DAQ_CMP_RST_OFST (4)
|
||||
#define DAQ_CMP_RST_MSK (0x00000001 << DAQ_CMP_RST_OFST)
|
||||
#define DAQ_STRG_CELL_SLCT_OFST (8)
|
||||
#define DAQ_STRG_CELL_SLCT_MSK (0x0000000F << DAQ_STRG_CELL_SLCT_OFST)
|
||||
#define DAQ_FRCE_SWTCH_GAIN_OFST (12)
|
||||
#define DAQ_FRCE_SWTCH_GAIN_MSK (0x00000003 << DAQ_FRCE_SWTCH_GAIN_OFST)
|
||||
#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 \
|
||||
((0x3 << DAQ_FRCE_SWTCH_GAIN_OFST) & DAQ_FRCE_SWTCH_GAIN_MSK)
|
||||
#define DAQ_ELCTRN_CLLCTN_MDE_OFST (14)
|
||||
#define DAQ_ELCTRN_CLLCTN_MDE_MSK (0x00000001 << DAQ_ELCTRN_CLLCTN_MDE_OFST)
|
||||
#define DAQ_G2_CNNT_OFST (15)
|
||||
#define DAQ_G2_CNNT_MSK (0x00000001 << DAQ_G2_CNNT_OFST)
|
||||
#define DAQ_CRRNT_SRC_ENBL_OFST (16)
|
||||
#define DAQ_CRRNT_SRC_ENBL_MSK (0x00000001 << DAQ_CRRNT_SRC_ENBL_OFST)
|
||||
#define DAQ_CRRNT_SRC_CLMN_FIX_OFST (17)
|
||||
#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_MSK (0x0000003F << DAQ_CRRNT_SRC_CLMN_SLCT_OFST)
|
||||
// dynamic gain (default)
|
||||
#define DAQ_HIGH_GAIN_OFST (0)
|
||||
#define DAQ_HIGH_GAIN_MSK (0x00000001 << DAQ_HIGH_GAIN_OFST)
|
||||
#define DAQ_FIX_GAIN_OFST (1)
|
||||
#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_2_VAL ((0x3 << DAQ_FIX_GAIN_OFST) & DAQ_FIX_GAIN_MSK)
|
||||
#define DAQ_CMP_RST_OFST (4)
|
||||
#define DAQ_CMP_RST_MSK (0x00000001 << DAQ_CMP_RST_OFST)
|
||||
#define DAQ_STRG_CELL_SLCT_OFST (8)
|
||||
#define DAQ_STRG_CELL_SLCT_MSK (0x0000000F << DAQ_STRG_CELL_SLCT_OFST)
|
||||
#define DAQ_FRCE_SWTCH_GAIN_OFST (12)
|
||||
#define DAQ_FRCE_SWTCH_GAIN_MSK (0x00000003 << DAQ_FRCE_SWTCH_GAIN_OFST)
|
||||
#define DAQ_FRCE_GAIN_STG_0_VAL ((0x0 << 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 ((0x3 << DAQ_FRCE_SWTCH_GAIN_OFST) & DAQ_FRCE_SWTCH_GAIN_MSK)
|
||||
#define DAQ_ELCTRN_CLLCTN_MDE_OFST (14)
|
||||
#define DAQ_ELCTRN_CLLCTN_MDE_MSK (0x00000001 << DAQ_ELCTRN_CLLCTN_MDE_OFST)
|
||||
#define DAQ_G2_CNNT_OFST (15)
|
||||
#define DAQ_G2_CNNT_MSK (0x00000001 << DAQ_G2_CNNT_OFST)
|
||||
#define DAQ_CRRNT_SRC_ENBL_OFST (16)
|
||||
#define DAQ_CRRNT_SRC_ENBL_MSK (0x00000001 << DAQ_CRRNT_SRC_ENBL_OFST)
|
||||
#define DAQ_CRRNT_SRC_CLMN_FIX_OFST (17)
|
||||
#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_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 */
|
||||
#define CHIP_POWER_REG (0x5E << MEM_MAP_SHIFT)
|
||||
#define CHIP_POWER_REG (0x5E << MEM_MAP_SHIFT)
|
||||
|
||||
#define CHIP_POWER_ENABLE_OFST (0)
|
||||
#define CHIP_POWER_ENABLE_MSK (0x00000001 << CHIP_POWER_ENABLE_OFST)
|
||||
#define CHIP_POWER_STATUS_OFST (1)
|
||||
#define CHIP_POWER_STATUS_MSK (0x00000001 << CHIP_POWER_STATUS_OFST)
|
||||
#define CHIP_POWER_ENABLE_OFST (0)
|
||||
#define CHIP_POWER_ENABLE_MSK (0x00000001 << CHIP_POWER_ENABLE_OFST)
|
||||
#define CHIP_POWER_STATUS_OFST (1)
|
||||
#define CHIP_POWER_STATUS_MSK (0x00000001 << CHIP_POWER_STATUS_OFST)
|
||||
|
||||
/** Temperature Control Register */
|
||||
#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_MSK \
|
||||
(0x000007FF << TEMP_CTRL_PROTCT_THRSHLD_OFST)
|
||||
#define TEMP_CTRL_PROTCT_ENABLE_OFST (16)
|
||||
#define TEMP_CTRL_PROTCT_ENABLE_MSK (0x00000001 << TEMP_CTRL_PROTCT_ENABLE_OFST)
|
||||
#define TEMP_CTRL_PROTCT_THRSHLD_OFST (0)
|
||||
#define TEMP_CTRL_PROTCT_THRSHLD_MSK (0x000007FF << TEMP_CTRL_PROTCT_THRSHLD_OFST)
|
||||
#define TEMP_CTRL_PROTCT_ENABLE_OFST (16)
|
||||
#define TEMP_CTRL_PROTCT_ENABLE_MSK (0x00000001 << TEMP_CTRL_PROTCT_ENABLE_OFST)
|
||||
// set when temp higher than over threshold, write 1 to clear it
|
||||
#define TEMP_CTRL_OVR_TMP_EVNT_OFST (31)
|
||||
#define TEMP_CTRL_OVR_TMP_EVNT_MSK (0x00000001 << TEMP_CTRL_OVR_TMP_EVNT_OFST)
|
||||
#define TEMP_CTRL_OVR_TMP_EVNT_OFST (31)
|
||||
#define TEMP_CTRL_OVR_TMP_EVNT_MSK (0x00000001 << TEMP_CTRL_OVR_TMP_EVNT_OFST)
|
||||
|
||||
/* Set Delay 64 bit register */
|
||||
#define SET_DELAY_LSB_REG (0x60 << MEM_MAP_SHIFT) // different kind of delay
|
||||
#define SET_DELAY_MSB_REG (0x61 << MEM_MAP_SHIFT) // different kind of delay
|
||||
#define SET_DELAY_LSB_REG (0x60 << MEM_MAP_SHIFT) // different kind of delay
|
||||
#define SET_DELAY_MSB_REG (0x61 << MEM_MAP_SHIFT) // different kind of delay
|
||||
|
||||
/* Set Triggers 64 bit register */
|
||||
#define SET_CYCLES_LSB_REG (0x62 << MEM_MAP_SHIFT)
|
||||
#define SET_CYCLES_MSB_REG (0x63 << MEM_MAP_SHIFT)
|
||||
#define SET_CYCLES_LSB_REG (0x62 << MEM_MAP_SHIFT)
|
||||
#define SET_CYCLES_MSB_REG (0x63 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Set Frames 64 bit register */
|
||||
#define SET_FRAMES_LSB_REG (0x64 << MEM_MAP_SHIFT)
|
||||
#define SET_FRAMES_MSB_REG (0x65 << MEM_MAP_SHIFT)
|
||||
#define SET_FRAMES_LSB_REG (0x64 << MEM_MAP_SHIFT)
|
||||
#define SET_FRAMES_MSB_REG (0x65 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Set Period 64 bit register tT = T x 50 ns */
|
||||
#define SET_PERIOD_LSB_REG (0x66 << MEM_MAP_SHIFT)
|
||||
#define SET_PERIOD_MSB_REG (0x67 << MEM_MAP_SHIFT)
|
||||
#define SET_PERIOD_LSB_REG (0x66 << MEM_MAP_SHIFT)
|
||||
#define SET_PERIOD_MSB_REG (0x67 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Set Exptime 64 bit register eEXP = Exp x 25 ns */
|
||||
#define SET_EXPTIME_LSB_REG (0x68 << MEM_MAP_SHIFT)
|
||||
#define SET_EXPTIME_MSB_REG (0x69 << MEM_MAP_SHIFT)
|
||||
#define SET_EXPTIME_LSB_REG (0x68 << MEM_MAP_SHIFT)
|
||||
#define SET_EXPTIME_MSB_REG (0x69 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Starting Frame number 64 bit register */
|
||||
#define FRAME_NUMBER_LSB_REG (0x6A << MEM_MAP_SHIFT)
|
||||
#define FRAME_NUMBER_MSB_REG (0x6B << MEM_MAP_SHIFT)
|
||||
#define FRAME_NUMBER_LSB_REG (0x6A << 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 */
|
||||
#define SET_TRIGGER_DELAY_LSB_REG (0x70 << MEM_MAP_SHIFT)
|
||||
#define SET_TRIGGER_DELAY_MSB_REG (0x71 << MEM_MAP_SHIFT)
|
||||
#define SET_TRIGGER_DELAY_LSB_REG (0x70 << MEM_MAP_SHIFT)
|
||||
#define SET_TRIGGER_DELAY_MSB_REG (0x71 << MEM_MAP_SHIFT)
|
||||
|
||||
/** Module row coordinates */
|
||||
#define COORD_ROW_REG (0x7C << MEM_MAP_SHIFT)
|
||||
#define COORD_ROW_REG (0x7C << MEM_MAP_SHIFT)
|
||||
|
||||
#define COORD_ROW_OUTER_OFST (0)
|
||||
#define COORD_ROW_OUTER_MSK (0x0000FFFF << COORD_ROW_OUTER_OFST)
|
||||
#define COORD_ROW_INNER_OFST (16)
|
||||
#define COORD_ROW_INNER_MSK (0x0000FFFF << COORD_ROW_INNER_OFST)
|
||||
#define COORD_ROW_OUTER_OFST (0)
|
||||
#define COORD_ROW_OUTER_MSK (0x0000FFFF << COORD_ROW_OUTER_OFST)
|
||||
#define COORD_ROW_INNER_OFST (16)
|
||||
#define COORD_ROW_INNER_MSK (0x0000FFFF << COORD_ROW_INNER_OFST)
|
||||
|
||||
/** Module column coordinates */
|
||||
#define COORD_COL_REG (0x7D << MEM_MAP_SHIFT)
|
||||
#define COORD_COL_REG (0x7D << MEM_MAP_SHIFT)
|
||||
|
||||
#define COORD_COL_OUTER_OFST (0)
|
||||
#define COORD_COL_OUTER_MSK (0x0000FFFF << COORD_COL_OUTER_OFST)
|
||||
#define COORD_COL_INNER_OFST (16)
|
||||
#define COORD_COL_INNER_MSK (0x0000FFFF << COORD_COL_INNER_OFST)
|
||||
#define COORD_COL_OUTER_OFST (0)
|
||||
#define COORD_COL_OUTER_MSK (0x0000FFFF << COORD_COL_OUTER_OFST)
|
||||
#define COORD_COL_INNER_OFST (16)
|
||||
#define COORD_COL_INNER_MSK (0x0000FFFF << COORD_COL_INNER_OFST)
|
||||
|
||||
/** Module column coordinates */
|
||||
#define COORD_RESERVED_REG (0x7E << MEM_MAP_SHIFT)
|
||||
#define COORD_RESERVED_REG (0x7E << MEM_MAP_SHIFT)
|
||||
|
||||
#define COORD_RESERVED_OUTER_OFST (0)
|
||||
#define COORD_RESERVED_OUTER_MSK (0x0000FFFF << COORD_RESERVED_OUTER_OFST)
|
||||
#define COORD_RESERVED_INNER_OFST (16)
|
||||
#define COORD_RESERVED_INNER_MSK (0x0000FFFF << COORD_RESERVED_INNER_OFST)
|
||||
#define COORD_RESERVED_OUTER_OFST (0)
|
||||
#define COORD_RESERVED_OUTER_MSK (0x0000FFFF << COORD_RESERVED_OUTER_OFST)
|
||||
#define COORD_RESERVED_INNER_OFST (16)
|
||||
#define COORD_RESERVED_INNER_MSK (0x0000FFFF << COORD_RESERVED_INNER_OFST)
|
||||
|
||||
/* ASIC Control Register */
|
||||
#define ASIC_CTRL_REG (0x7F << MEM_MAP_SHIFT)
|
||||
#define ASIC_CTRL_REG (0x7F << MEM_MAP_SHIFT)
|
||||
// tPC = (PCT + 1) * 25ns
|
||||
#define ASIC_CTRL_PRCHRG_TMR_OFST (0)
|
||||
#define ASIC_CTRL_PRCHRG_TMR_MSK (0x000000FF << ASIC_CTRL_PRCHRG_TMR_OFST)
|
||||
#define ASIC_CTRL_PRCHRG_TMR_VAL \
|
||||
((0x1F << ASIC_CTRL_PRCHRG_TMR_OFST) & ASIC_CTRL_PRCHRG_TMR_MSK)
|
||||
#define ASIC_CTRL_PRCHRG_TMR_OFST (0)
|
||||
#define ASIC_CTRL_PRCHRG_TMR_MSK (0x000000FF << ASIC_CTRL_PRCHRG_TMR_OFST)
|
||||
#define ASIC_CTRL_PRCHRG_TMR_VAL ((0x1F << ASIC_CTRL_PRCHRG_TMR_OFST) & ASIC_CTRL_PRCHRG_TMR_MSK)
|
||||
// tDS = (DST + 1) * 25ns
|
||||
#define ASIC_CTRL_DS_TMR_OFST (8)
|
||||
#define ASIC_CTRL_DS_TMR_MSK (0x000000FF << ASIC_CTRL_DS_TMR_OFST)
|
||||
#define ASIC_CTRL_DS_TMR_VAL \
|
||||
((0x1F << ASIC_CTRL_DS_TMR_OFST) & ASIC_CTRL_DS_TMR_MSK)
|
||||
#define ASIC_CTRL_DS_TMR_OFST (8)
|
||||
#define ASIC_CTRL_DS_TMR_MSK (0x000000FF << ASIC_CTRL_DS_TMR_OFST)
|
||||
#define ASIC_CTRL_DS_TMR_VAL ((0x1F << ASIC_CTRL_DS_TMR_OFST) & ASIC_CTRL_DS_TMR_MSK)
|
||||
// tET = (ET + 1) * 25ns (increase timeout range between 2 consecutive storage
|
||||
// cells)
|
||||
#define ASIC_CTRL_EXPSRE_TMR_OFST (16)
|
||||
#define ASIC_CTRL_EXPSRE_TMR_MSK (0x0000FFFF << ASIC_CTRL_EXPSRE_TMR_OFST)
|
||||
#define ASIC_CTRL_EXPSRE_TMR_MAX_VAL (0x0000FFFF / (CLK_RUN * 1E-3))
|
||||
#define ASIC_CTRL_EXPSRE_TMR_OFST (16)
|
||||
#define ASIC_CTRL_EXPSRE_TMR_MSK (0x0000FFFF << ASIC_CTRL_EXPSRE_TMR_OFST)
|
||||
#define ASIC_CTRL_EXPSRE_TMR_MAX_VAL (0x0000FFFF / (CLK_RUN * 1E-3))
|
||||
|
||||
/* ADC 0 Deserializer Control */
|
||||
#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_MSK \
|
||||
(0x00000001 << ADC_DSRLZR_0_RFRSH_ALGNMNT_OFST)
|
||||
#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_MSK (0x00000001 << ADC_DSRLZR_0_RFRSH_ALGNMNT_OFST)
|
||||
|
||||
/* ADC 0 Deserializer Control */
|
||||
#define ADC_DSRLZR_1_REG (0xF1 << MEM_MAP_SHIFT)
|
||||
#define ADC_DSRLZR_1_RFRSH_ALGNMNT_OFST (31)
|
||||
#define ADC_DSRLZR_1_RFRSH_ALGNMNT_MSK \
|
||||
(0x00000001 << ADC_DSRLZR_1_RFRSH_ALGNMNT_OFST)
|
||||
#define ADC_DSRLZR_1_REG (0xF1 << MEM_MAP_SHIFT)
|
||||
#define ADC_DSRLZR_1_RFRSH_ALGNMNT_OFST (31)
|
||||
#define ADC_DSRLZR_1_RFRSH_ALGNMNT_MSK (0x00000001 << ADC_DSRLZR_1_RFRSH_ALGNMNT_OFST)
|
||||
|
||||
/* ADC 0 Deserializer Control */
|
||||
#define ADC_DSRLZR_2_REG (0xF2 << MEM_MAP_SHIFT)
|
||||
#define ADC_DSRLZR_2_RFRSH_ALGNMNT_OFST (31)
|
||||
#define ADC_DSRLZR_2_RFRSH_ALGNMNT_MSK \
|
||||
(0x00000001 << ADC_DSRLZR_2_RFRSH_ALGNMNT_OFST)
|
||||
#define ADC_DSRLZR_2_REG (0xF2 << MEM_MAP_SHIFT)
|
||||
#define ADC_DSRLZR_2_RFRSH_ALGNMNT_OFST (31)
|
||||
#define ADC_DSRLZR_2_RFRSH_ALGNMNT_MSK (0x00000001 << ADC_DSRLZR_2_RFRSH_ALGNMNT_OFST)
|
||||
|
||||
/* ADC 0 Deserializer Control */
|
||||
#define ADC_DSRLZR_3_REG (0xF3 << MEM_MAP_SHIFT)
|
||||
#define ADC_DSRLZR_3_RFRSH_ALGNMNT_OFST (31)
|
||||
#define ADC_DSRLZR_3_RFRSH_ALGNMNT_MSK \
|
||||
(0x00000001 << ADC_DSRLZR_3_RFRSH_ALGNMNT_OFST)
|
||||
#define ADC_DSRLZR_3_REG (0xF3 << MEM_MAP_SHIFT)
|
||||
#define ADC_DSRLZR_3_RFRSH_ALGNMNT_OFST (31)
|
||||
#define ADC_DSRLZR_3_RFRSH_ALGNMNT_MSK (0x00000001 << ADC_DSRLZR_3_RFRSH_ALGNMNT_OFST)
|
||||
|
||||
/* Round Robin */
|
||||
#define RXR_ENDPOINTS_MAX (64)
|
||||
#define RXR_ENDPOINT_OUTER_START_REG (0x1000 << MEM_MAP_SHIFT)
|
||||
#define RXR_ENDPOINT_INNER_START_REG (0x2000 << MEM_MAP_SHIFT)
|
||||
#define RXR_ENDPOINTS_MAX (64)
|
||||
#define RXR_ENDPOINT_OUTER_START_REG (0x1000 << 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;
|
||||
int highvoltage = 0;
|
||||
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] = {};
|
||||
int detPos[4] = {};
|
||||
int chipVersion = 10; // (1.0)
|
||||
int chipConfigured = 0;
|
||||
|
||||
int isInitCheckDone() { return initCheckDone; }
|
||||
|
||||
@ -101,6 +106,7 @@ void basictests() {
|
||||
|
||||
if (fwversion >= MIN_REQRD_VRSN_T_RD_API)
|
||||
sw_fw_apiversion = getFirmwareAPIVersion();
|
||||
|
||||
LOG(logINFOBLUE,
|
||||
("************ Jungfrau Server *********************\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)
|
||||
int isHardwareVersion2() {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
#endif
|
||||
return (((bus_r(MOD_SERIAL_NUM_REG) & HARDWARE_VERSION_NUM_MSK) ==
|
||||
HARDWARE_VERSION_2_VAL)
|
||||
? 1
|
||||
: 0);
|
||||
}
|
||||
|
||||
int getChipVersion() { return chipVersion; }
|
||||
|
||||
u_int32_t getDetectorNumber() {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
@ -379,10 +390,16 @@ void setupDetector() {
|
||||
for (int i = 0; i < NUM_CLOCKS; ++i) {
|
||||
clkPhase[i] = 0;
|
||||
}
|
||||
chipConfigured = 0;
|
||||
#ifdef VIRTUAL
|
||||
sharedMemory_setStatus(IDLE);
|
||||
#endif
|
||||
|
||||
// get chip version
|
||||
if (readConfigFile() == FAIL) {
|
||||
return;
|
||||
}
|
||||
|
||||
ALTERA_PLL_ResetPLL();
|
||||
resetCore();
|
||||
resetPeripheral();
|
||||
@ -409,7 +426,7 @@ void setupDetector() {
|
||||
DAC_MAX_MV);
|
||||
LTC2620_Disable();
|
||||
LTC2620_Configure();
|
||||
setDefaultDacs();
|
||||
resetToDefaultDacs(0);
|
||||
|
||||
// altera pll
|
||||
ALTERA_PLL_SetDefines(
|
||||
@ -434,15 +451,21 @@ void setupDetector() {
|
||||
|
||||
// Initialization of acquistion parameters
|
||||
setSettings(DEFAULT_SETTINGS);
|
||||
setGainMode(DEFAULT_GAINMODE);
|
||||
|
||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||
setNumTriggers(DEFAULT_NUM_CYCLES);
|
||||
setExpTime(DEFAULT_EXPTIME);
|
||||
setPeriod(DEFAULT_PERIOD);
|
||||
setDelayAfterTrigger(DEFAULT_DELAY);
|
||||
setNumAdditionalStorageCells(DEFAULT_NUM_STRG_CLLS);
|
||||
setStorageCellDelay(DEFAULT_STRG_CLL_DLY);
|
||||
selectStoragecellStart(DEFAULT_STRG_CLL_STRT);
|
||||
if (getChipVersion() == 11) {
|
||||
selectStoragecellStart(DEFAULT_STRG_CLL_STRT_CHIP11);
|
||||
} else {
|
||||
setNumAdditionalStorageCells(DEFAULT_NUM_STRG_CLLS);
|
||||
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
|
||||
* works*/
|
||||
setTiming(DEFAULT_TIMING_MODE);
|
||||
@ -451,21 +474,259 @@ void setupDetector() {
|
||||
// temp threshold and reset event
|
||||
setThresholdTemperature(DEFAULT_TMP_THRSHLD);
|
||||
setTemperatureEvent(0);
|
||||
setFlipRows(DEFAULT_FLIP_ROWS);
|
||||
if (getChipVersion() == 11) {
|
||||
setFilterResistor(DEFAULT_FILTER_RESISTOR);
|
||||
setFilterCell(DEFAULT_FILTER_CELL);
|
||||
}
|
||||
disableCurrentSource();
|
||||
}
|
||||
|
||||
int setDefaultDacs() {
|
||||
int ret = OK;
|
||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
||||
if (dacValues[i] != defaultvals[i]) {
|
||||
ret = FAIL;
|
||||
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
||||
defaultvals[i], dacValues[i]));
|
||||
int resetToDefaultDacs(int hardReset) {
|
||||
LOG(logINFOBLUE, ("Resetting %s to Default Dac values\n",
|
||||
(hardReset == 1 ? "hard" : "")));
|
||||
|
||||
// reset defaults to hardcoded defaults
|
||||
if (hardReset) {
|
||||
const int vals[] = DEFAULT_DAC_VALS;
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
defaultDacValues[i] = vals[i];
|
||||
}
|
||||
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];
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
// 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,
|
||||
value, dacValues[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 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) */
|
||||
@ -523,14 +784,57 @@ uint32_t getADCInvertRegister() {
|
||||
|
||||
/* parameters - timer */
|
||||
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) {
|
||||
LOG(logINFO, ("Setting storage cell start: %d\n", pos));
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_STRG_CELL_SLCT_MSK);
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | ((pos << DAQ_STRG_CELL_SLCT_OFST) &
|
||||
DAQ_STRG_CELL_SLCT_MSK));
|
||||
bus_w(addr, bus_r(addr) & ~mask);
|
||||
bus_w(addr, bus_r(addr) | ((value << offset) & mask));
|
||||
// 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) {
|
||||
@ -749,95 +1053,140 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
||||
if (sett == UNINITIALIZED)
|
||||
return thisSettings;
|
||||
|
||||
int *dacVals = NULL;
|
||||
// set settings
|
||||
switch (sett) {
|
||||
case DYNAMICGAIN:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||
case GAIN0:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_HIGH_GAIN_MSK);
|
||||
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;
|
||||
case DYNAMICHG0:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_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);
|
||||
case HIGHGAIN0:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_HIGH_GAIN_MSK);
|
||||
LOG(logINFO,
|
||||
("Set settings - Fix Gain 1, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
|
||||
break;
|
||||
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)));
|
||||
("Set settings - High Gain 0 [DAQ Reg:0x%x]\n", bus_r(DAQ_REG)));
|
||||
dacVals = defaultDacValue_HG0;
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR,
|
||||
("This settings is not defined for this detector %d\n", (int)sett));
|
||||
LOG(logERROR, ("This settings %d is not defined\n", (int)sett));
|
||||
return -1;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
enum detectorSettings getSettings() {
|
||||
if (bus_r(DAQ_REG) & DAQ_HIGH_GAIN_MSK)
|
||||
return HIGHGAIN0;
|
||||
return GAIN0;
|
||||
}
|
||||
|
||||
enum gainMode getGainMode() {
|
||||
uint32_t regval = bus_r(DAQ_REG);
|
||||
uint32_t val = regval & DAQ_SETTINGS_MSK;
|
||||
LOG(logDEBUG1, ("Getting Settings\n Reading DAQ Register :0x%x\n", val));
|
||||
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;
|
||||
|
||||
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));
|
||||
// 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));
|
||||
}
|
||||
|
||||
return thisSettings;
|
||||
// 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 */
|
||||
@ -846,11 +1195,10 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
||||
return;
|
||||
|
||||
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;
|
||||
#ifdef VIRTUAL
|
||||
LOG(logINFO, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind],
|
||||
val, (mV ? "mV" : "dac units")));
|
||||
if (!mV) {
|
||||
dacValues[ind] = val;
|
||||
}
|
||||
@ -859,6 +1207,7 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
||||
dacValues[ind] = dacval;
|
||||
}
|
||||
#else
|
||||
LOG(logINFO, ("Setting DAC %s\n", dac_names[ind]));
|
||||
if (LTC2620_SetDACValue((int)ind, val, mV, &dacval) == OK) {
|
||||
dacValues[ind] = dacval;
|
||||
if (ind == J_VREF_COMP &&
|
||||
@ -1280,13 +1629,17 @@ void initReadoutConfiguration() {
|
||||
int powerChip(int on) {
|
||||
if (on != -1) {
|
||||
if (on) {
|
||||
LOG(logINFO, ("Powering chip: on\n"));
|
||||
LOG(logINFOBLUE, ("Powering chip: on\n"));
|
||||
bus_w(CHIP_POWER_REG,
|
||||
bus_r(CHIP_POWER_REG) | CHIP_POWER_ENABLE_MSK);
|
||||
|
||||
configureChip();
|
||||
} else {
|
||||
LOG(logINFO, ("Powering chip: off\n"));
|
||||
LOG(logINFOBLUE, ("Powering chip: off\n"));
|
||||
bus_w(CHIP_POWER_REG,
|
||||
bus_r(CHIP_POWER_REG) & ~CHIP_POWER_ENABLE_MSK);
|
||||
|
||||
chipConfigured = 0;
|
||||
}
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
@ -1297,6 +1650,22 @@ int powerChip(int on) {
|
||||
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) {
|
||||
if (on != -1) {
|
||||
if (on) {
|
||||
@ -1314,6 +1683,32 @@ int autoCompDisable(int on) {
|
||||
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() {
|
||||
LOG(logINFO, ("Configuring ASIC Timer\n"));
|
||||
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)));
|
||||
}
|
||||
|
||||
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() {
|
||||
return ((bus_r(CONFIG_REG) & CONFIG_ETHRNT_FLW_CNTRL_MSK) >>
|
||||
CONFIG_ETHRNT_FLW_CNTRL_OFST);
|
||||
|
@ -3,8 +3,8 @@
|
||||
#include "sls/sls_detector_defs.h"
|
||||
|
||||
#define MIN_REQRD_VRSN_T_RD_API 0x171220
|
||||
#define REQRD_FRMWRE_VRSN_BOARD2 0x210218 // 1.0 pcb
|
||||
#define REQRD_FRMWRE_VRSN 0x200721 // 2.0 pcb
|
||||
#define REQRD_FRMWRE_VRSN_BOARD2 0x210621 // 1.0 pcb (version = 010)
|
||||
#define REQRD_FRMWRE_VRSN 0x210622 // 2.0 pcb (version = 011)
|
||||
|
||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||
|
||||
@ -62,6 +62,15 @@ enum DACINDEX {
|
||||
480, /* J_VREF_DS */ \
|
||||
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 CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
||||
#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 ADC_CLK_INDEX (1)
|
||||
#define DBIT_CLK_INDEX (0)
|
||||
#define CONFIG_FILE ("config_jungfrau.txt")
|
||||
|
||||
/** Default Parameters */
|
||||
#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_HIGH_VOLTAGE (0)
|
||||
#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_TMP_THRSHLD (65 * 1000) // milli degree Celsius
|
||||
#define DEFAULT_NUM_STRG_CLLS (0)
|
||||
#define DEFAULT_STRG_CLL_STRT (0xf)
|
||||
#define DEFAULT_STRG_CLL_STRT_CHIP11 (0x3)
|
||||
#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_MAX (200)
|
||||
#define DAC_MIN_MV (0)
|
||||
#define DAC_MAX_MV (2500)
|
||||
#define MAX_FILTER_CELL_VAL (12)
|
||||
|
||||
/* Defines in the Firmware */
|
||||
#define MAX_TIMESLOT_VAL (0x1F)
|
||||
#define MAX_THRESHOLD_TEMP_VAL (127999) // millidegrees
|
||||
#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 ACQ_TIME_MIN_CLOCK (2)
|
||||
#define ASIC_FILTER_MAX_RES_VALUE (1)
|
||||
#define MAX_SELECT_CHIP10_VAL (63)
|
||||
|
||||
#define MAX_PHASE_SHIFTS (240)
|
||||
#define BIT16_MASK (0xFFFF)
|
||||
|
Binary file not shown.
@ -61,6 +61,7 @@ uint8_t adcEnableMask_10g = 0;
|
||||
int32_t clkPhase[NUM_CLOCKS] = {};
|
||||
uint32_t clkFrequency[NUM_CLOCKS] = {40, 20, 20, 200};
|
||||
int dacValues[NDAC] = {};
|
||||
int defaultDacValues[NDAC] = DEFAULT_DAC_VALS;
|
||||
// software limit that depends on the current chip on the ctb
|
||||
int vLimit = 0;
|
||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||
@ -516,7 +517,7 @@ void setupDetector() {
|
||||
DAC_MAX_MV); // has to be before setvchip
|
||||
LTC2620_Disable();
|
||||
LTC2620_Configure();
|
||||
setDefaultDacs();
|
||||
resetToDefaultDacs(0);
|
||||
|
||||
// altera pll
|
||||
ALTERA_PLL_SetDefines(PLL_CNTRL_REG, PLL_PARAM_REG,
|
||||
@ -613,20 +614,51 @@ void updateDataBytes() {
|
||||
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;
|
||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
||||
if (dacValues[i] != defaultvals[i]) {
|
||||
setDAC((enum DACINDEX)i, defaultDacValues[i], 0);
|
||||
if (dacValues[i] != defaultDacValues[i]) {
|
||||
ret = FAIL;
|
||||
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
||||
defaultvals[i], dacValues[i]));
|
||||
defaultDacValues[i], dacValues[i]));
|
||||
}
|
||||
}
|
||||
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) */
|
||||
|
||||
|
Binary file not shown.
@ -42,11 +42,15 @@ pthread_t pthread_virtual_tid;
|
||||
int64_t virtual_currentFrameNumber = 2;
|
||||
#endif
|
||||
|
||||
enum detectorSettings thisSettings;
|
||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||
sls_detector_module *detectorModules = NULL;
|
||||
int *detectorChans = NULL;
|
||||
int *detectorDacs = 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] = {};
|
||||
uint32_t clkDivider[NUM_CLOCKS] = {};
|
||||
@ -446,7 +450,7 @@ void setupDetector() {
|
||||
|
||||
// defaults
|
||||
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
||||
setDefaultDacs();
|
||||
resetToDefaultDacs(0);
|
||||
setASICDefaults();
|
||||
setADIFDefaults();
|
||||
|
||||
@ -523,21 +527,147 @@ void setupDetector() {
|
||||
setAllTrimbits(DEFAULT_TRIMBIT_VALUE);
|
||||
}
|
||||
|
||||
int setDefaultDacs() {
|
||||
int ret = OK;
|
||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||
{
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
int resetToDefaultDacs(int hardReset) {
|
||||
LOG(logINFOBLUE, ("Resetting %s to Default Dac values\n",
|
||||
(hardReset == 1 ? "hard" : "")));
|
||||
|
||||
// reset defaults to hardcoded defaults
|
||||
if (hardReset) {
|
||||
const int vals[] = DEFAULT_DAC_VALS;
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
||||
if (detectorDacs[i] != defaultvals[i]) {
|
||||
ret = FAIL;
|
||||
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
||||
defaultvals[i], detectorDacs[i]));
|
||||
}
|
||||
defaultDacValues[i] = vals[i];
|
||||
}
|
||||
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];
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
// 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,
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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() {
|
||||
@ -1201,24 +1331,19 @@ int getAllTrimbits() {
|
||||
}
|
||||
|
||||
enum detectorSettings setSettings(enum detectorSettings sett) {
|
||||
int *dacVals = NULL;
|
||||
switch (sett) {
|
||||
case STANDARD:
|
||||
LOG(logINFOBLUE, ("Setting to standard settings\n"));
|
||||
thisSettings = sett;
|
||||
setDAC(M_VRPREAMP, DEFAULT_STANDARD_VRPREAMP, 0);
|
||||
setDAC(M_VRSHAPER, DEFAULT_STANDARD_VRSHAPER, 0);
|
||||
dacVals = defaultDacValue_standard;
|
||||
break;
|
||||
case FAST:
|
||||
LOG(logINFOBLUE, ("Setting to fast settings\n"));
|
||||
thisSettings = sett;
|
||||
setDAC(M_VRPREAMP, DEFAULT_FAST_VRPREAMP, 0);
|
||||
setDAC(M_VRSHAPER, DEFAULT_FAST_VRSHAPER, 0);
|
||||
dacVals = defaultDacValue_fast;
|
||||
break;
|
||||
case HIGHGAIN:
|
||||
LOG(logINFOBLUE, ("Setting to high gain settings\n"));
|
||||
thisSettings = sett;
|
||||
setDAC(M_VRPREAMP, DEFAULT_HIGHGAIN_VRPREAMP, 0);
|
||||
setDAC(M_VRSHAPER, DEFAULT_HIGHGAIN_VRSHAPER, 0);
|
||||
dacVals = defaultDacValue_highgain;
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR,
|
||||
@ -1226,34 +1351,54 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
||||
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));
|
||||
return thisSettings;
|
||||
}
|
||||
|
||||
void validateSettings() {
|
||||
if (detectorDacs[M_VRPREAMP] == DEFAULT_STANDARD_VRPREAMP &&
|
||||
detectorDacs[M_VRSHAPER] == DEFAULT_STANDARD_VRSHAPER) {
|
||||
if (thisSettings != STANDARD) {
|
||||
thisSettings = STANDARD;
|
||||
LOG(logINFOBLUE, ("Validated Settings changed to standard!\n"));
|
||||
// if any special dac value is changed individually => undefined
|
||||
const int specialDacs[NSPECIALDACS] = SPECIALDACINDEX;
|
||||
int *specialDacValues[] = {defaultDacValue_standard, defaultDacValue_fast,
|
||||
defaultDacValue_highgain};
|
||||
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"));
|
||||
|
||||
// all values matchd a setting
|
||||
if (sett != UNDEFINED) {
|
||||
break;
|
||||
}
|
||||
} else if (detectorDacs[M_VRPREAMP] == DEFAULT_HIGHGAIN_VRPREAMP &&
|
||||
detectorDacs[M_VRSHAPER] == DEFAULT_HIGHGAIN_VRSHAPER) {
|
||||
if (thisSettings != HIGHGAIN) {
|
||||
thisSettings = HIGHGAIN;
|
||||
LOG(logINFOBLUE, ("Validated Settings changed to highgain!\n"));
|
||||
}
|
||||
} else {
|
||||
thisSettings = UNDEFINED;
|
||||
LOG(logWARNING,
|
||||
("Settings set to undefined [vrpreamp: %d, vrshaper: %d]\n",
|
||||
detectorDacs[M_VRPREAMP], detectorDacs[M_VRSHAPER]));
|
||||
}
|
||||
// update settings
|
||||
if (thisSettings != sett) {
|
||||
LOG(logINFOBLUE,
|
||||
("Validated settings to %s (%d)\n",
|
||||
(sett == STANDARD
|
||||
? "standard"
|
||||
: (sett == FAST
|
||||
? "fast"
|
||||
: (sett == HIGHGAIN ? "highgain" : "undefined"))),
|
||||
sett));
|
||||
thisSettings = sett;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1335,8 +1480,11 @@ void setGeneralDAC(enum DACINDEX ind, int val, int mV) {
|
||||
detectorDacs[ind] = dacval;
|
||||
}
|
||||
#endif
|
||||
if (ind == M_VRPREAMP || ind == M_VRSHAPER) {
|
||||
validateSettings();
|
||||
const int specialDacs[NSPECIALDACS] = SPECIALDACINDEX;
|
||||
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||
if ((int)ind == specialDacs[i]) {
|
||||
validateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2425,6 +2573,7 @@ int setChipStatusRegister(int csr) {
|
||||
}
|
||||
|
||||
int setGainCaps(int caps) {
|
||||
LOG(logINFO, ("Setting gain caps to: %u\n", caps));
|
||||
// Update only gain caps, leave the rest of the CSR unchanged
|
||||
int csr = getChipStatusRegister();
|
||||
csr &= ~GAIN_MASK;
|
||||
|
@ -42,13 +42,6 @@
|
||||
#define DEFAULT_TRIMBIT_VALUE (0)
|
||||
#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_C1 (10) //(100000000) // smp sample clk (x2), 100 MHz
|
||||
#define DEFAULT_SYSTEM_C0 (10) //(100000000) // run_clk, 100 MHz
|
||||
@ -118,6 +111,17 @@ enum DACINDEX {
|
||||
2800, /* vTrim */ \
|
||||
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 {
|
||||
READOUT_C0,
|
||||
READOUT_C1,
|
||||
|
@ -87,6 +87,7 @@ u_int16_t getHardwareSerialNumber();
|
||||
#endif
|
||||
#ifdef JUNGFRAUD
|
||||
int isHardwareVersion2();
|
||||
int getChipVersion();
|
||||
#endif
|
||||
#if defined(EIGERD) || defined(MYTHEN3D)
|
||||
void readDetectorNumber();
|
||||
@ -116,13 +117,15 @@ void updateDataBytes();
|
||||
#endif
|
||||
|
||||
#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
|
||||
#ifdef MYTHEN3D
|
||||
void setASICDefaults();
|
||||
void setADIFDefaults();
|
||||
#endif
|
||||
#if defined(GOTTHARD2D) || defined(EIGERD)
|
||||
#if defined(GOTTHARD2D) || defined(EIGERD) || defined(JUNGFRAUD)
|
||||
int readConfigFile();
|
||||
#endif
|
||||
#ifdef EIGERD
|
||||
@ -199,6 +202,7 @@ int getReadoutMode();
|
||||
// parameters - timer
|
||||
#ifdef JUNGFRAUD
|
||||
int selectStoragecellStart(int pos);
|
||||
int getMaxStoragecellStart();
|
||||
#endif
|
||||
#if defined(JUNGFRAUD) || defined(EIGERD)
|
||||
int setNextFrameNumber(uint64_t value);
|
||||
@ -293,10 +297,11 @@ int getAllTrimbits();
|
||||
#ifndef CHIPTESTBOARDD
|
||||
enum detectorSettings setSettings(enum detectorSettings sett);
|
||||
#endif
|
||||
#ifdef MYTHEN3D
|
||||
void validateSettings();
|
||||
#endif
|
||||
enum detectorSettings getSettings();
|
||||
#ifdef JUNGFRAUD
|
||||
enum gainMode getGainMode();
|
||||
void setGainMode(enum gainMode mode);
|
||||
#endif
|
||||
|
||||
// parameters - threshold
|
||||
#ifdef EIGERD
|
||||
@ -439,7 +444,11 @@ void setDigitalIODelay(uint64_t pinMask, int delay);
|
||||
#ifdef JUNGFRAUD
|
||||
void initReadoutConfiguration();
|
||||
int powerChip(int on);
|
||||
int isChipConfigured();
|
||||
void configureChip();
|
||||
int autoCompDisable(int on);
|
||||
int setComparatorDisableTime(int64_t val);
|
||||
int64_t getComparatorDisableTime();
|
||||
void configureASICTimer();
|
||||
int setClockDivider(enum CLKINDEX ind, int val);
|
||||
int getClockDivider(enum CLKINDEX ind);
|
||||
@ -451,6 +460,18 @@ int setThresholdTemperature(int val);
|
||||
int setTemperatureControl(int val);
|
||||
int setTemperatureEvent(int val);
|
||||
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
|
||||
#elif EIGERD
|
||||
@ -522,8 +543,8 @@ int configureASICGlobalSettings();
|
||||
enum burstMode getBurstMode();
|
||||
int setCDSGain(int enable);
|
||||
int getCDSGain();
|
||||
int setFilter(int value);
|
||||
int getFilter();
|
||||
int setFilterResistor(int value);
|
||||
int getFilterResistor();
|
||||
void setCurrentSource(int value);
|
||||
int getCurrentSource();
|
||||
void setTimingSource(enum timingSourceType value);
|
||||
|
@ -40,6 +40,7 @@ int get_adc(int);
|
||||
int write_register(int);
|
||||
int read_register(int);
|
||||
int set_module(int);
|
||||
void validate_settings(enum detectorSettings sett);
|
||||
int set_settings(int);
|
||||
int get_threshold_energy(int);
|
||||
int acquire(int blocking, int file_des);
|
||||
@ -228,8 +229,8 @@ int set_scan(int);
|
||||
int get_scan_error_message(int);
|
||||
int get_cds_gain(int);
|
||||
int set_cds_gain(int);
|
||||
int get_filter(int);
|
||||
int set_filter(int);
|
||||
int get_filter_resistor(int);
|
||||
int set_filter_resistor(int);
|
||||
int get_adc_config(int);
|
||||
int set_adc_config(int);
|
||||
int get_bad_channels(int);
|
||||
@ -238,7 +239,7 @@ int reconfigure_udp(int);
|
||||
int validate_udp_configuration(int);
|
||||
int get_bursts_left(int);
|
||||
int start_readout(int);
|
||||
int set_default_dacs(int);
|
||||
int reset_to_default_dacs(int);
|
||||
int is_virtual(int);
|
||||
int get_pattern(int);
|
||||
int load_default_pattern(int);
|
||||
@ -253,3 +254,14 @@ int get_veto_stream(int);
|
||||
int set_veto_stream(int);
|
||||
int get_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);
|
File diff suppressed because it is too large
Load Diff
@ -113,8 +113,7 @@ class Detector {
|
||||
/** [Jungfrau][Gotthard][Gotthard2][Mythen3] */
|
||||
Result<defs::detectorSettings> getSettings(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2,
|
||||
* FORCESWITCHG1, FORCESWITCHG2 \n [Gotthard] DYNAMICGAIN, HIGHGAIN,
|
||||
/** [Jungfrau] GAIN0, HIGHGAIN0 \n [Gotthard] DYNAMICGAIN, HIGHGAIN,
|
||||
* LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN \n [Gotthard2] DYNAMICGAIN,
|
||||
* FIXGAIN1, FIXGAIN2 \n [Moench] G1_HIGHGAIN, G1_LOWGAIN,
|
||||
* G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN,
|
||||
@ -173,6 +172,17 @@ class Detector {
|
||||
*/
|
||||
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;
|
||||
///@{
|
||||
|
||||
@ -383,7 +393,7 @@ class Detector {
|
||||
* [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 [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.
|
||||
*/
|
||||
void setPowerChip(bool on, Positions pos = {});
|
||||
@ -414,7 +424,24 @@ class Detector {
|
||||
std::vector<defs::dacIndex> getDacList() const;
|
||||
|
||||
/** [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,
|
||||
Positions pos = {}) const;
|
||||
@ -452,6 +479,23 @@ class Detector {
|
||||
* [Mythen3] If exposure time is too short, acquisition will return with an
|
||||
* ERROR and take fewer frames than expected */
|
||||
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 */
|
||||
@ -979,12 +1023,6 @@ class Detector {
|
||||
/** [Eiger] Overflow in 32 bit mode. Default is disabled.*/
|
||||
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 */
|
||||
Result<ns> getRateCorrection(Positions pos = {}) const;
|
||||
|
||||
@ -1081,6 +1119,9 @@ class Detector {
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
/** [Jungfrau] */
|
||||
Result<double> getChipVersion(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] */
|
||||
Result<int> getThresholdTemperature(Positions pos = {}) const;
|
||||
|
||||
@ -1108,24 +1149,32 @@ class Detector {
|
||||
void resetTemperatureEvent(Positions pos = {});
|
||||
|
||||
/** [Jungfrau] */
|
||||
Result<bool> getAutoCompDisable(Positions pos = {}) const;
|
||||
Result<bool> getAutoComparatorDisable(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] Advanced
|
||||
* //TODO naming
|
||||
* 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
|
||||
* Default is false or this mode disabled(comparator enabled throughout).
|
||||
* true enables mode. 0 disables mode.
|
||||
* 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 for chipv1.0. One can set the duration for chipv1.1 using
|
||||
* setComparatorDisableTime\n Default is false or this 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 */
|
||||
Result<int> getNumberOfAdditionalStorageCells(Positions pos = {}) const;
|
||||
|
||||
/** [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) */
|
||||
void setNumberOfAdditionalStorageCells(int value);
|
||||
|
||||
@ -1133,7 +1182,7 @@ class Detector {
|
||||
Result<int> getStorageCellStart(Positions pos = {}) const;
|
||||
|
||||
/** [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 = {});
|
||||
|
||||
@ -1141,9 +1190,30 @@ class Detector {
|
||||
Result<ns> getStorageCellDelay(Positions pos = {}) const;
|
||||
|
||||
/** [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 = {});
|
||||
|
||||
/** 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 */
|
||||
@ -1238,18 +1308,6 @@ class Detector {
|
||||
/** default disabled */
|
||||
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] */
|
||||
Result<defs::timingSourceType> getTimingSource(Positions pos = {}) const;
|
||||
|
||||
@ -1776,7 +1834,6 @@ class Detector {
|
||||
std::vector<int> getPortNumbers(int start_port);
|
||||
void updateRxRateCorrections();
|
||||
void setNumberofUDPInterfaces_(int n, Positions pos);
|
||||
Result<int> getNumberofUDPInterfaces_(Positions pos) const;
|
||||
};
|
||||
|
||||
} // namespace sls
|
||||
|
@ -959,6 +959,68 @@ std::string CmdProxy::ExternalSignal(int action) {
|
||||
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 */
|
||||
std::string CmdProxy::TemperatureValues(int action) {
|
||||
std::ostringstream os;
|
||||
@ -1095,6 +1157,82 @@ std::string CmdProxy::DacValues(int action) {
|
||||
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 */
|
||||
|
||||
std::string CmdProxy::ReceiverStatus(int action) {
|
||||
|
@ -584,6 +584,7 @@ class CmdProxy {
|
||||
{"detsizechan", "detsize"},
|
||||
{"trimdir", "settingspath"},
|
||||
{"settingsdir", "settingspath"},
|
||||
{"flippeddatax", "fliprows"},
|
||||
|
||||
/* acquisition parameters */
|
||||
{"cycles", "triggers"},
|
||||
@ -591,6 +592,7 @@ class CmdProxy {
|
||||
{"clkdivider", "speed"},
|
||||
{"vhighvoltage", "highvoltage"},
|
||||
{"digitest", "imagetest"},
|
||||
{"filter", "filterresistor"},
|
||||
|
||||
/** temperature */
|
||||
|
||||
@ -671,6 +673,8 @@ class CmdProxy {
|
||||
{"vipre_cds", "dac"},
|
||||
{"ibias_sfp", "dac"},
|
||||
|
||||
{"defaultdacs", "resetdacs"},
|
||||
|
||||
/* acquisition */
|
||||
{"busy", "clearbusy"},
|
||||
{"receiver", "rx_status"},
|
||||
@ -767,6 +771,7 @@ class CmdProxy {
|
||||
{"trimval", &CmdProxy::trimval},
|
||||
{"trimen", &CmdProxy::TrimEnergies},
|
||||
{"gappixels", &CmdProxy::GapPixels},
|
||||
{"fliprows", &CmdProxy::fliprows},
|
||||
|
||||
/* acquisition parameters */
|
||||
{"acquire", &CmdProxy::Acquire},
|
||||
@ -797,6 +802,8 @@ class CmdProxy {
|
||||
{"imagetest", &CmdProxy::imagetest},
|
||||
{"extsig", &CmdProxy::ExternalSignal},
|
||||
{"parallel", &CmdProxy::parallel},
|
||||
{"filterresistor", &CmdProxy::filterresistor},
|
||||
{"currentsource", &CmdProxy::CurrentSource},
|
||||
|
||||
/** temperature */
|
||||
{"templist", &CmdProxy::templist},
|
||||
@ -816,7 +823,8 @@ class CmdProxy {
|
||||
{"dac", &CmdProxy::Dac},
|
||||
{"daclist", &CmdProxy::daclist},
|
||||
{"dacvalues", &CmdProxy::DacValues},
|
||||
{"defaultdacs", &CmdProxy::defaultdacs},
|
||||
{"resetdacs", &CmdProxy::ResetDacs},
|
||||
{"defaultdac", &CmdProxy::DefaultDac},
|
||||
|
||||
/* on chip dacs */
|
||||
{"vchip_comp_fe", &CmdProxy::vchip_comp_fe},
|
||||
@ -903,7 +911,6 @@ class CmdProxy {
|
||||
{"subexptime", &CmdProxy::subexptime},
|
||||
{"subdeadtime", &CmdProxy::subdeadtime},
|
||||
{"overflow", &CmdProxy::overflow},
|
||||
{"flippeddatax", &CmdProxy::flippeddatax},
|
||||
{"ratecorr", &CmdProxy::RateCorrection},
|
||||
{"readnlines", &CmdProxy::readnlines},
|
||||
{"interruptsubframe", &CmdProxy::interruptsubframe},
|
||||
@ -918,13 +925,17 @@ class CmdProxy {
|
||||
{"datastream", &CmdProxy::DataStream},
|
||||
|
||||
/* Jungfrau Specific */
|
||||
{"chipversion", &CmdProxy::chipversion},
|
||||
{"temp_threshold", &CmdProxy::temp_threshold},
|
||||
{"temp_control", &CmdProxy::temp_control},
|
||||
{"temp_event", &CmdProxy::TemperatureEvent},
|
||||
{"auto_comp_disable", &CmdProxy::auto_comp_disable},
|
||||
{"comp_disable_time", &CmdProxy::comp_disable_time},
|
||||
{"storagecells", &CmdProxy::storagecells},
|
||||
{"storagecell_start", &CmdProxy::storagecell_start},
|
||||
{"storagecell_delay", &CmdProxy::storagecell_delay},
|
||||
{"gainmode", &CmdProxy::gainmode},
|
||||
{"filtercell", &CmdProxy::filtercell},
|
||||
|
||||
/* Gotthard Specific */
|
||||
{"roi", &CmdProxy::ROI},
|
||||
@ -941,8 +952,6 @@ class CmdProxy {
|
||||
{"vetofile", &CmdProxy::VetoFile},
|
||||
{"burstmode", &CmdProxy::BurstMode},
|
||||
{"cdsgain", &CmdProxy::cdsgain},
|
||||
{"filter", &CmdProxy::filter},
|
||||
{"currentsource", &CmdProxy::currentsource},
|
||||
{"timingsource", &CmdProxy::timingsource},
|
||||
{"veto", &CmdProxy::veto},
|
||||
{"vetostream", &CmdProxy::VetoStreaming},
|
||||
@ -1088,11 +1097,14 @@ class CmdProxy {
|
||||
std::string MaxClockPhaseShift(int action);
|
||||
std::string ClockDivider(int action);
|
||||
std::string ExternalSignal(int action);
|
||||
std::string CurrentSource(int action);
|
||||
/** temperature */
|
||||
std::string TemperatureValues(int action);
|
||||
/* dacs */
|
||||
std::string Dac(int action);
|
||||
std::string DacValues(int action);
|
||||
std::string ResetDacs(int action);
|
||||
std::string DefaultDac(int action);
|
||||
/* acquisition */
|
||||
std::string ReceiverStatus(int action);
|
||||
std::string DetectorStatus(int action);
|
||||
@ -1195,13 +1207,12 @@ class CmdProxy {
|
||||
settings, getSettings, setSettings,
|
||||
sls::StringTo<slsDetectorDefs::detectorSettings>,
|
||||
"[standard, fast, highgain, dynamicgain, lowgain, "
|
||||
"mediumgain, veryhighgain, dynamichg0, "
|
||||
"mediumgain, veryhighgain, highgain0, "
|
||||
"fixgain1, fixgain2, forceswitchg1, forceswitchg2, "
|
||||
"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[Jungfrau] - [dynamicgain | dynamichg0 | fixgain1 | "
|
||||
"fixgain2 | forceswitchg1 | forceswitchg2]"
|
||||
"\n\t[Jungfrau] - [ gain0 | highgain0]"
|
||||
"\n\t[Gotthard] - [dynamicgain | highgain | lowgain | "
|
||||
"mediumgain | veryhighgain]"
|
||||
"\n\t[Gotthard2] - [dynamicgain | fixgain1 | fixgain2]"
|
||||
@ -1226,6 +1237,14 @@ class CmdProxy {
|
||||
"[n_trimval]\n\t[Eiger][Mythen3] All trimbits set to this "
|
||||
"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 */
|
||||
|
||||
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 "
|
||||
"will return power status. Can be off if temperature event occured "
|
||||
"(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.");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
@ -1331,6 +1350,12 @@ class CmdProxy {
|
||||
"acquisition will return ERROR status and take fewer "
|
||||
"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 */
|
||||
GET_COMMAND_NOID(
|
||||
templist, getTemperatureList,
|
||||
@ -1381,10 +1406,6 @@ class CmdProxy {
|
||||
daclist, getDacList,
|
||||
"\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 */
|
||||
INTEGER_USER_IND_COMMAND(
|
||||
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 "
|
||||
"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(
|
||||
readnlines, getPartialReadout, setPartialReadout, StringTo<int>,
|
||||
"[1 - 256]\n\t[Eiger] Number of rows to readout per half module "
|
||||
@ -1812,6 +1826,9 @@ class CmdProxy {
|
||||
|
||||
/* Jungfrau Specific */
|
||||
|
||||
GET_COMMAND(chipversion, getChipVersion,
|
||||
"\n\t[Jungfrau] Returns chip version. Can be 1.0 or 1.1");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
temp_threshold, getThresholdTemperature, setThresholdTemperature,
|
||||
StringTo<int>,
|
||||
@ -1832,33 +1849,52 @@ class CmdProxy {
|
||||
"cleared.");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
auto_comp_disable, getAutoCompDisable, setAutoCompDisable,
|
||||
auto_comp_disable, getAutoComparatorDisable, setAutoComparatorDisable,
|
||||
StringTo<int>,
|
||||
"[0, 1]\n\t[Jungfrau] Auto comparator disable mode. 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\tDefault is "
|
||||
"0 or this mode disabled(comparator enabled throughout). 1 enables "
|
||||
"mode. 0 disables mode. ");
|
||||
"93.75% (only for chipv1.0) of exposure time (only for longer than "
|
||||
"100us). It is possible to set the duration for chipv1.1 using "
|
||||
"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(
|
||||
storagecells, getNumberOfAdditionalStorageCells,
|
||||
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 "
|
||||
"(#storagecells + 1).");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
storagecell_start, getStorageCellStart, setStorageCellStart,
|
||||
StringTo<int>,
|
||||
"[0-15]\n\t[Jungfrau] Storage cell that stores the first acquisition "
|
||||
"of the series. Default is 15. For advanced users only.");
|
||||
"[0-max]\n\t[Jungfrau] Storage cell that stores the first acquisition "
|
||||
"of the series. max is 15 (default) for chipv1.0 and 3 (default) for chipv1.1. For advanced users only.");
|
||||
|
||||
TIME_COMMAND(
|
||||
storagecell_delay, getStorageCellDelay, setStorageCellDelay,
|
||||
"[duration (0-1638375 ns)] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] "
|
||||
"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 */
|
||||
TIME_GET_COMMAND(exptimel, getExptimeLeft,
|
||||
@ -1886,15 +1922,6 @@ class CmdProxy {
|
||||
"[0, 1]\n\t[Gotthard2] Enable or disable CDS gain. Default "
|
||||
"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(
|
||||
timingsource, getTimingSource, setTimingSource,
|
||||
sls::StringTo<slsDetectorDefs::timingSourceType>,
|
||||
|
@ -158,13 +158,11 @@ std::vector<defs::detectorSettings> Detector::getSettingsList() const {
|
||||
defs::HIGHGAIN, defs::DYNAMICGAIN, defs::LOWGAIN, defs::MEDIUMGAIN,
|
||||
defs::VERYHIGHGAIN};
|
||||
case defs::JUNGFRAU:
|
||||
return std::vector<defs::detectorSettings>{
|
||||
defs::DYNAMICGAIN, defs::DYNAMICHG0, defs::FIXGAIN1,
|
||||
defs::FIXGAIN2, defs::FORCESWITCHG1, defs::FORCESWITCHG2};
|
||||
return std::vector<defs::detectorSettings>{defs::GAIN0,
|
||||
defs::HIGHGAIN0};
|
||||
case defs::GOTTHARD2:
|
||||
return std::vector<defs::detectorSettings>{
|
||||
defs::DYNAMICGAIN, defs::DYNAMICHG0, defs::FIXGAIN1,
|
||||
defs::FIXGAIN2};
|
||||
defs::DYNAMICGAIN, defs::FIXGAIN1, defs::FIXGAIN2};
|
||||
case defs::MOENCH:
|
||||
return std::vector<defs::detectorSettings>{
|
||||
defs::G1_HIGHGAIN, defs::G1_LOWGAIN,
|
||||
@ -281,6 +279,14 @@ void Detector::setGapPixelsinCallback(bool 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 {
|
||||
return pimpl->Parallel(&Module::isVirtualDetectorServer, pos);
|
||||
}
|
||||
@ -621,8 +627,38 @@ std::vector<defs::dacIndex> Detector::getDacList() const {
|
||||
return retval;
|
||||
}
|
||||
|
||||
void Detector::setDefaultDacs(Positions pos) {
|
||||
pimpl->Parallel(&Module::setDefaultDacs, pos);
|
||||
Result<int> Detector::getDefaultDac(defs::dacIndex index, Positions 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,
|
||||
@ -663,6 +699,22 @@ void Detector::setParallelMode(bool value, Positions pos) {
|
||||
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
|
||||
|
||||
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.");
|
||||
}
|
||||
// also called by vetostream (for gotthard2)
|
||||
return getNumberofUDPInterfaces_(pos);
|
||||
return pimpl->getNumberofUDPInterfaces(pos);
|
||||
}
|
||||
|
||||
void Detector::setNumberofUDPInterfaces(int n, Positions pos) {
|
||||
@ -766,10 +818,6 @@ void Detector::setNumberofUDPInterfaces(int n, Positions pos) {
|
||||
setNumberofUDPInterfaces_(n, pos);
|
||||
}
|
||||
|
||||
Result<int> Detector::getNumberofUDPInterfaces_(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getNumberofUDPInterfaces, pos);
|
||||
}
|
||||
|
||||
void Detector::setNumberofUDPInterfaces_(int n, Positions pos) {
|
||||
bool previouslyClientStreaming = pimpl->getDataStreamingToClient();
|
||||
bool useReceiver = getUseReceiverFlag().squash(false);
|
||||
@ -1280,14 +1328,6 @@ void Detector::setOverFlowMode(bool value, Positions pos) {
|
||||
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 {
|
||||
return pimpl->Parallel(&Module::getRateCorrection, pos);
|
||||
}
|
||||
@ -1398,6 +1438,9 @@ void Detector::setDataStream(const defs::portPosition port, const bool enable,
|
||||
}
|
||||
|
||||
// Jungfrau Specific
|
||||
Result<double> Detector::getChipVersion(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getChipVersion, pos);
|
||||
}
|
||||
|
||||
Result<int> Detector::getThresholdTemperature(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getThresholdTemperature, pos);
|
||||
@ -1423,14 +1466,22 @@ void Detector::resetTemperatureEvent(Positions 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);
|
||||
}
|
||||
|
||||
void Detector::setAutoCompDisable(bool value, Positions pos) {
|
||||
void Detector::setAutoComparatorDisable(bool value, Positions pos) {
|
||||
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 {
|
||||
return pimpl->Parallel(&Module::getNumberOfAdditionalStorageCells, pos);
|
||||
}
|
||||
@ -1455,6 +1506,37 @@ void Detector::setStorageCellDelay(ns value, Positions pos) {
|
||||
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
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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 {
|
||||
return pimpl->Parallel(&Module::getTimingSource, pos);
|
||||
}
|
||||
@ -1582,7 +1648,7 @@ Result<defs::streamingInterface> Detector::getVetoStream(Positions pos) const {
|
||||
// 3gbe
|
||||
auto r3 = pimpl->Parallel(&Module::getVetoStream, pos);
|
||||
// 10gbe (debugging interface) opens 2nd udp interface in receiver
|
||||
auto r10 = getNumberofUDPInterfaces_(pos);
|
||||
auto r10 = pimpl->getNumberofUDPInterfaces(pos);
|
||||
|
||||
Result<defs::streamingInterface> res(r3.size());
|
||||
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);
|
||||
|
||||
// 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");
|
||||
int numinterfaces = (((interface & defs::streamingInterface::ETHERNET_10GB) ==
|
||||
defs::streamingInterface::ETHERNET_10GB)
|
||||
@ -2167,7 +2233,7 @@ std::vector<int> Detector::getPortNumbers(int start_port) {
|
||||
break;
|
||||
case defs::JUNGFRAU:
|
||||
case defs::GOTTHARD2:
|
||||
if (getNumberofUDPInterfaces_({}).squash() == 2) {
|
||||
if (pimpl->getNumberofUDPInterfaces({}).squash() == 2) {
|
||||
num_sockets_per_detector *= 2;
|
||||
}
|
||||
break;
|
||||
|
@ -490,8 +490,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
uint64_t currentAcquisitionIndex = -1, currentFrameIndex = -1,
|
||||
currentFileIndex = -1;
|
||||
double currentProgress = 0.00;
|
||||
uint32_t currentSubFrameIndex = -1, coordX = -1, coordY = -1,
|
||||
flippedDataX = -1;
|
||||
uint32_t currentSubFrameIndex = -1, coordX = -1, coordY = -1, flipRows = -1;
|
||||
|
||||
while (numZmqRunning != 0) {
|
||||
// reset data
|
||||
@ -571,7 +570,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
if (eiger) {
|
||||
coordY = (nY - 1) - coordY;
|
||||
}
|
||||
flippedDataX = zHeader.flippedDataX;
|
||||
flipRows = zHeader.flipRows;
|
||||
if (zHeader.completeImage == 0) {
|
||||
completeImage = false;
|
||||
}
|
||||
@ -585,7 +584,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
<< "\n\tcurrentSubFrameIndex: " << currentSubFrameIndex
|
||||
<< "\n\tcurrentProgress: " << currentProgress
|
||||
<< "\n\tcoordX: " << coordX << "\n\tcoordY: " << coordY
|
||||
<< "\n\tflippedDataX: " << flippedDataX
|
||||
<< "\n\tflipRows: " << flipRows
|
||||
<< "\n\tcompleteImage: " << completeImage;
|
||||
}
|
||||
|
||||
@ -609,7 +608,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
<< "\n\tsingledetrowoffset: " << singledetrowoffset
|
||||
<< "\n\trowoffset: " << rowoffset;
|
||||
|
||||
if (eiger && (flippedDataX != 0U)) {
|
||||
if (eiger && (flipRows != 0U)) {
|
||||
for (uint32_t i = 0; i < nPixelsY; ++i) {
|
||||
memcpy((multiframe.get()) +
|
||||
((yoffset + (nPixelsY - 1 - i)) *
|
||||
@ -1369,4 +1368,19 @@ std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
|
||||
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
|
@ -291,6 +291,14 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
||||
*/
|
||||
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:
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
|
||||
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 {
|
||||
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};
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
void Module::startReceiver() {
|
||||
@ -1385,14 +1429,6 @@ void Module::setOverFlowMode(const bool enable) {
|
||||
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 {
|
||||
return sendToDetector<int64_t>(F_GET_RATE_CORRECT);
|
||||
}
|
||||
@ -1522,6 +1558,9 @@ void Module::setDataStream(const portPosition port, const bool enable) {
|
||||
}
|
||||
|
||||
// Jungfrau Specific
|
||||
double Module::getChipVersion() const {
|
||||
return (sendToDetector<int>(F_GET_CHIP_VERSION)) / 10.00;
|
||||
}
|
||||
|
||||
int Module::getThresholdTemperature() const {
|
||||
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));
|
||||
}
|
||||
|
||||
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 {
|
||||
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);
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
slsDetectorDefs::ROI Module::getROI() const {
|
||||
@ -1859,20 +1922,6 @@ void Module::setCDSGain(bool value) {
|
||||
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 {
|
||||
return sendToDetector<timingSourceType>(F_GET_TIMING_SOURCE);
|
||||
}
|
||||
|
@ -114,6 +114,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setAllTrimbits(int val);
|
||||
std::vector<int> getTrimEn() const;
|
||||
int setTrimEn(const std::vector<int> &energies = {});
|
||||
bool getFlipRows() const;
|
||||
void setFlipRows(bool value);
|
||||
bool isVirtualDetectorServer() const;
|
||||
|
||||
/**************************************************
|
||||
@ -148,8 +150,11 @@ class Module : public virtual slsDetectorDefs {
|
||||
int getMaxClockPhaseShift(int clkIndex) const;
|
||||
int getClockFrequency(int clkIndex) const;
|
||||
void setClockFrequency(int clkIndex, int value);
|
||||
/** [Eiger][Jungfrau][Moench][Gotthard][Gotthard2][Mythen3] */
|
||||
void setDefaultDacs();
|
||||
int getDefaultDac(slsDetectorDefs::dacIndex index,
|
||||
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;
|
||||
void setDAC(int val, dacIndex index, bool mV);
|
||||
bool getPowerChip() const;
|
||||
@ -165,7 +170,10 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setExternalSignalFlags(int signalIndex, externalSignalFlag type);
|
||||
bool getParallelMode() const;
|
||||
void setParallelMode(const bool enable);
|
||||
|
||||
int getFilterResistor() const;
|
||||
void setFilterResistor(int value);
|
||||
defs::currentSrcParameters getCurrentSource() const;
|
||||
void setCurrentSource(defs::currentSrcParameters par);
|
||||
/**************************************************
|
||||
* *
|
||||
* Acquisition *
|
||||
@ -320,8 +328,6 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setSubDeadTime(int64_t value);
|
||||
bool getOverFlowMode() const;
|
||||
void setOverFlowMode(const bool enable);
|
||||
bool getFlippedDataX() const;
|
||||
void setFlippedDataX(bool value);
|
||||
int64_t getRateCorrection() const;
|
||||
void setDefaultRateCorrection();
|
||||
void setRateCorrection(int64_t t = 0);
|
||||
@ -351,6 +357,7 @@ class Module : public virtual slsDetectorDefs {
|
||||
* Jungfrau Specific *
|
||||
* *
|
||||
* ************************************************/
|
||||
double getChipVersion() const;
|
||||
int getThresholdTemperature() const;
|
||||
void setThresholdTemperature(int val);
|
||||
bool getTemperatureControl() const;
|
||||
@ -359,12 +366,18 @@ class Module : public virtual slsDetectorDefs {
|
||||
void resetTemperatureEvent();
|
||||
bool getAutoComparatorDisableMode() const;
|
||||
void setAutoComparatorDisableMode(bool val);
|
||||
int64_t getComparatorDisableTime() const;
|
||||
void setComparatorDisableTime(int64_t value);
|
||||
int getNumberOfAdditionalStorageCells() const;
|
||||
void setNumberOfAdditionalStorageCells(int value);
|
||||
int getStorageCellStart() const;
|
||||
void setStorageCellStart(int pos);
|
||||
int64_t getStorageCellDelay() const;
|
||||
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);
|
||||
bool getCDSGain() const;
|
||||
void setCDSGain(bool value);
|
||||
int getFilter() const;
|
||||
void setFilter(int value);
|
||||
bool getCurrentSource() const;
|
||||
void setCurrentSource(bool value);
|
||||
slsDetectorDefs::timingSourceType getTimingSource() const;
|
||||
void setTimingSource(slsDetectorDefs::timingSourceType value);
|
||||
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]") {
|
||||
Detector 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]") {
|
||||
Detector 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]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@ -246,7 +258,7 @@ TEST_CASE("auto_comp_disable", "[.cmd]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
auto prev_val = det.getAutoCompDisable();
|
||||
auto prev_val = det.getAutoComparatorDisable();
|
||||
{
|
||||
std::ostringstream 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");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setAutoCompDisable(prev_val[i], {i});
|
||||
det.setAutoComparatorDisable(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("auto_comp_disable", {}, -1, GET));
|
||||
@ -271,35 +283,73 @@ 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]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
auto prev_val = det.getNumberOfAdditionalStorageCells().tsquash(
|
||||
"inconsistent #additional storage cells to test");
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecells 1\n");
|
||||
// chip version 1.0
|
||||
if (det.getChipVersion().squash()*10 == 10) {
|
||||
auto prev_val = det.getNumberOfAdditionalStorageCells().tsquash(
|
||||
"inconsistent #additional storage cells to test");
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecells 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {"15"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecells 15\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecells 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "storagecells 0\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("storagecells", {"16"}, -1, PUT));
|
||||
det.setNumberOfAdditionalStorageCells(prev_val);
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {"15"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecells 15\n");
|
||||
// chip version 1.1
|
||||
else {
|
||||
// cannot set number of addl. storage cells
|
||||
REQUIRE_THROWS(proxy.Call("storagecells", {"1"}, -1, PUT));
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecells 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecells", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "storagecells 0\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("storagecells", {"16"}, -1, PUT));
|
||||
det.setNumberOfAdditionalStorageCells(prev_val);
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("storagecells", {}, -1, GET));
|
||||
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);
|
||||
REQUIRE(oss.str() == "storagecell_start 1\n");
|
||||
}
|
||||
{
|
||||
// chip version 1.0
|
||||
if (det.getChipVersion().squash()*10 == 10) {
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecell_start", {"15"}, -1, PUT, oss);
|
||||
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;
|
||||
proxy.Call("storagecell_start", {"0"}, -1, PUT, oss);
|
||||
@ -347,28 +406,130 @@ TEST_CASE("storagecell_delay", "[.cmd]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
auto prev_val = det.getStorageCellDelay();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecell_delay", {"1.62ms"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecell_delay 1.62ms\n");
|
||||
// chip version 1.0
|
||||
if (det.getChipVersion().squash()*10 == 10) {
|
||||
auto prev_val = det.getStorageCellDelay();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecell_delay", {"1.62ms"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecell_delay 1.62ms\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecell_delay", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "storagecell_delay 1.62ms\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecell_delay", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecell_delay 0\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("storagecell_delay", {"1638376ns"}, -1, PUT));
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setStorageCellDelay(prev_val[i], {i});
|
||||
}
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecell_delay", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "storagecell_delay 1.62ms\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecell_delay", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecell_delay 0\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("storagecell_delay", {"1638376ns"}, -1, PUT));
|
||||
for (int i = 0; i != det.size(); ++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 {
|
||||
REQUIRE_THROWS(proxy.Call("storagecell_delay", {}, -1, GET));
|
||||
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;
|
||||
CmdProxy proxy(&det);
|
||||
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;
|
||||
switch (det_type) {
|
||||
case defs::JUNGFRAU:
|
||||
sett.push_back("dynamicgain");
|
||||
sett.push_back("dynamichg0");
|
||||
sett.push_back("fixgain1");
|
||||
sett.push_back("fixgain2");
|
||||
sett.push_back("forceswitchg1");
|
||||
sett.push_back("forceswitchg2");
|
||||
sett.push_back("gain0");
|
||||
sett.push_back("highgain0");
|
||||
break;
|
||||
case defs::GOTTHARD:
|
||||
sett.push_back("highgain");
|
||||
@ -203,6 +223,11 @@ TEST_CASE("settings", "[.cmd]") {
|
||||
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) {
|
||||
if (prev_val[i] != defs::UNDEFINED &&
|
||||
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 */
|
||||
|
||||
// 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 */
|
||||
|
||||
TEST_CASE("templist", "[.cmd]") {
|
||||
@ -1389,16 +1623,84 @@ TEST_CASE("dacvalues", "[.cmd]") {
|
||||
REQUIRE_THROWS(proxy.Call("dacvalues", {}, -1, PUT));
|
||||
}
|
||||
|
||||
TEST_CASE("defaultdacs", "[.cmd]") {
|
||||
TEST_CASE("defaultdac", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type != defs::CHIPTESTBOARD) {
|
||||
REQUIRE_THROWS(proxy.Call("defaultdacs", {}, -1, GET));
|
||||
REQUIRE_NOTHROW(proxy.Call("defaultdacs", {}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("defaultdac", {}, -1, GET));
|
||||
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 {
|
||||
REQUIRE_THROWS(proxy.Call("defaultdacs", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("defaultdacs", {}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("defaultdac", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
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_GET_RECEIVER_STREAMING] = &ClientInterface::get_streaming;
|
||||
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_GET_RECEIVER_FILE_FORMAT] = &ClientInterface::get_file_format;
|
||||
flist[F_SET_RECEIVER_STREAMING_PORT] = &ClientInterface::set_streaming_port;
|
||||
@ -1020,21 +1021,33 @@ int ClientInterface::set_streaming_timer(Interface &socket) {
|
||||
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>();
|
||||
|
||||
if (myDetectorType != EIGER)
|
||||
functionNotImplemented();
|
||||
|
||||
if (arg >= 0) {
|
||||
verifyIdle(socket);
|
||||
LOG(logDEBUG1) << "Setting flipped data:" << arg;
|
||||
impl()->setFlippedDataX(arg);
|
||||
if (arg != 0 && arg != 1) {
|
||||
throw RuntimeError("Could not set flip rows. Invalid argument: " +
|
||||
std::to_string(arg));
|
||||
}
|
||||
int retval = impl()->getFlippedDataX();
|
||||
validate(arg, retval, std::string("set flipped data"), DEC);
|
||||
LOG(logDEBUG1) << "Flipped Data:" << retval;
|
||||
return socket.sendResult(retval);
|
||||
verifyIdle(socket);
|
||||
LOG(logDEBUG1) << "Setting flip rows:" << arg;
|
||||
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);
|
||||
}
|
||||
|
||||
int ClientInterface::set_file_format(Interface &socket) {
|
||||
|
@ -107,7 +107,8 @@ class ClientInterface : private virtual slsDetectorDefs {
|
||||
int set_streaming(sls::ServerInterface &socket);
|
||||
int get_streaming(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 get_file_format(sls::ServerInterface &socket);
|
||||
int set_streaming_port(sls::ServerInterface &socket);
|
||||
|
@ -15,9 +15,9 @@
|
||||
const std::string DataStreamer::TypeName = "DataStreamer";
|
||||
|
||||
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),
|
||||
fileIndex(fi), flippedDataX(fd), quadEnable(qe), totalNumFrames(tot) {
|
||||
fileIndex(fi), flipRows(fr), quadEnable(qe), totalNumFrames(tot) {
|
||||
numMods[0] = nm[0];
|
||||
numMods[1] = nm[1];
|
||||
|
||||
@ -65,7 +65,7 @@ void DataStreamer::SetNumberofModules(int *nm) {
|
||||
numMods[1] = nm[1];
|
||||
}
|
||||
|
||||
void DataStreamer::SetFlippedDataX(int fd) { flippedDataX = fd; }
|
||||
void DataStreamer::SetFlipRows(bool fd) { flipRows = fd; }
|
||||
|
||||
void DataStreamer::SetAdditionalJsonHeader(
|
||||
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.detType = header.detType;
|
||||
zHeader.version = header.version;
|
||||
zHeader.flippedDataX = flippedDataX;
|
||||
zHeader.flipRows = static_cast<int>(flipRows);
|
||||
zHeader.quad = *quadEnable;
|
||||
zHeader.completeImage =
|
||||
(header.packetNumber < generalData->packetsPerFrame ? false : true);
|
||||
|
@ -30,12 +30,12 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
* @param dr pointer to dynamic range
|
||||
* @param r roi
|
||||
* @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 qe pointer to quad Enable
|
||||
* @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);
|
||||
|
||||
/**
|
||||
@ -68,10 +68,10 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
void SetNumberofModules(int *nm);
|
||||
|
||||
/**
|
||||
* Set Flipped data enable across x dimension
|
||||
* @param fd data enable in x dimension
|
||||
* Set Flipped rows
|
||||
* @param fd flip rows enable
|
||||
*/
|
||||
void SetFlippedDataX(int fd);
|
||||
void SetFlipRows(bool fd);
|
||||
|
||||
/**
|
||||
* Set additional json header
|
||||
@ -165,8 +165,8 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
/** Pointer to file index */
|
||||
uint64_t *fileIndex;
|
||||
|
||||
/** flipped data across x axis */
|
||||
int flippedDataX;
|
||||
/** flip rows */
|
||||
bool flipRows;
|
||||
|
||||
/** additional json header */
|
||||
std::map<std::string, std::string> additionalJsonHeader;
|
||||
|
@ -893,15 +893,15 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
||||
// streamer threads
|
||||
if (dataStreamEnable) {
|
||||
try {
|
||||
int fd = flippedDataX;
|
||||
bool flip = flipRows;
|
||||
int nm[2] = {numMods[0], numMods[1]};
|
||||
if (quadEnable) {
|
||||
fd = i;
|
||||
flip = (i == 1 ? true : false);
|
||||
nm[0] = 1;
|
||||
nm[1] = 2;
|
||||
}
|
||||
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));
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
dataStreamer[i]->CreateZmqSockets(
|
||||
@ -1022,15 +1022,15 @@ void Implementation::setDataStreamEnable(const bool enable) {
|
||||
if (enable) {
|
||||
for (int i = 0; i < numThreads; ++i) {
|
||||
try {
|
||||
int fd = flippedDataX;
|
||||
bool flip = flipRows;
|
||||
int nm[2] = {numMods[0], numMods[1]};
|
||||
if (quadEnable) {
|
||||
fd = i;
|
||||
flip = (i == 1 ? true : false);
|
||||
nm[0] = 1;
|
||||
nm[1] = 2;
|
||||
}
|
||||
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));
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
dataStreamer[i]->CreateZmqSockets(
|
||||
@ -1458,22 +1458,24 @@ void Implementation::setTenGigaEnable(const bool b) {
|
||||
LOG(logINFO) << "Packets per Frame: " << (generalData->packetsPerFrame);
|
||||
}
|
||||
|
||||
int Implementation::getFlippedDataX() const { return flippedDataX; }
|
||||
bool Implementation::getFlipRows() const { return flipRows; }
|
||||
|
||||
void Implementation::setFlippedDataX(int enable) {
|
||||
flippedDataX = (enable == 0) ? 0 : 1;
|
||||
void Implementation::setFlipRows(bool enable) {
|
||||
flipRows = enable;
|
||||
|
||||
if (!quadEnable) {
|
||||
for (const auto &it : dataStreamer) {
|
||||
it->SetFlippedDataX(flippedDataX);
|
||||
}
|
||||
} else {
|
||||
if (dataStreamer.size() == 2) {
|
||||
dataStreamer[0]->SetFlippedDataX(0);
|
||||
dataStreamer[1]->SetFlippedDataX(1);
|
||||
it->SetFlipRows(flipRows);
|
||||
}
|
||||
}
|
||||
LOG(logINFO) << "Flipped Data X: " << flippedDataX;
|
||||
// quad
|
||||
else {
|
||||
if (dataStreamer.size() == 2) {
|
||||
dataStreamer[0]->SetFlipRows(false);
|
||||
dataStreamer[1]->SetFlipRows(true);
|
||||
}
|
||||
}
|
||||
LOG(logINFO) << "Flip Rows: " << flipRows;
|
||||
}
|
||||
|
||||
bool Implementation::getQuad() const { return quadEnable; }
|
||||
@ -1485,7 +1487,7 @@ void Implementation::setQuad(const bool b) {
|
||||
if (!quadEnable) {
|
||||
for (const auto &it : dataStreamer) {
|
||||
it->SetNumberofModules(numMods);
|
||||
it->SetFlippedDataX(flippedDataX);
|
||||
it->SetFlipRows(flipRows);
|
||||
}
|
||||
} else {
|
||||
int size[2] = {1, 2};
|
||||
@ -1493,8 +1495,8 @@ void Implementation::setQuad(const bool b) {
|
||||
it->SetNumberofModules(size);
|
||||
}
|
||||
if (dataStreamer.size() == 2) {
|
||||
dataStreamer[0]->SetFlippedDataX(0);
|
||||
dataStreamer[1]->SetFlippedDataX(1);
|
||||
dataStreamer[0]->SetFlipRows(false);
|
||||
dataStreamer[1]->SetFlipRows(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -202,8 +202,8 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
bool getTenGigaEnable() const;
|
||||
/* [Eiger][Ctb] */
|
||||
void setTenGigaEnable(const bool b);
|
||||
int getFlippedDataX() const;
|
||||
void setFlippedDataX(int enable = -1);
|
||||
bool getFlipRows() const;
|
||||
void setFlipRows(bool enable);
|
||||
bool getQuad() const;
|
||||
/* [Eiger] */
|
||||
void setQuad(const bool b);
|
||||
@ -347,7 +347,7 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
uint32_t dynamicRange{16};
|
||||
ROI roi{};
|
||||
bool tengigaEnable{false};
|
||||
int flippedDataX{0};
|
||||
bool flipRows{false};
|
||||
bool quadEnable{false};
|
||||
bool activated{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::streamingInterface s);
|
||||
std::string ToString(const defs::vetoAlgorithm s);
|
||||
std::string ToString(const defs::gainMode s);
|
||||
|
||||
std::string ToString(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::ostream &operator<<(std::ostream &os,
|
||||
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);
|
||||
|
||||
/** Convert std::chrono::duration with specified output unit */
|
||||
template <typename T, typename Rep = double>
|
||||
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::streamingInterface 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 <> uint64_t StringTo(const std::string &s);
|
||||
|
@ -58,8 +58,8 @@ struct zmqHeader {
|
||||
uint16_t roundRNumber{0};
|
||||
uint8_t detType{0};
|
||||
uint8_t version{0};
|
||||
/** if image should be flipped across x axis */
|
||||
int flippedDataX{0};
|
||||
/** if rows of image should be flipped */
|
||||
int flipRows{0};
|
||||
/** quad type (eiger hardware specific) */
|
||||
uint32_t quad{0};
|
||||
/** true if complete image, else missing packets */
|
||||
|
@ -345,11 +345,9 @@ typedef struct {
|
||||
LOWGAIN,
|
||||
MEDIUMGAIN,
|
||||
VERYHIGHGAIN,
|
||||
DYNAMICHG0,
|
||||
HIGHGAIN0,
|
||||
FIXGAIN1,
|
||||
FIXGAIN2,
|
||||
FORCESWITCHG1,
|
||||
FORCESWITCHG2,
|
||||
VERYLOWGAIN,
|
||||
G1_HIGHGAIN,
|
||||
G1_LOWGAIN,
|
||||
@ -359,6 +357,7 @@ typedef struct {
|
||||
G2_LOWCAP_LOWGAIN,
|
||||
G4_HIGHGAIN,
|
||||
G4_LOWGAIN,
|
||||
GAIN0,
|
||||
UNDEFINED = 200,
|
||||
UNINITIALIZED
|
||||
};
|
||||
@ -416,6 +415,15 @@ typedef struct {
|
||||
|
||||
enum vetoAlgorithm { DEFAULT_ALGORITHM };
|
||||
|
||||
enum gainMode {
|
||||
DYNAMIC,
|
||||
FORCE_SWITCH_G1,
|
||||
FORCE_SWITCH_G2,
|
||||
FIX_G1,
|
||||
FIX_G2,
|
||||
FIX_G0
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/** scan structure */
|
||||
@ -448,6 +456,39 @@ typedef struct {
|
||||
}
|
||||
} __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
|
||||
*/
|
||||
|
@ -205,8 +205,8 @@ enum detFuncs {
|
||||
F_GET_SCAN_ERROR_MESSAGE,
|
||||
F_GET_CDS_GAIN,
|
||||
F_SET_CDS_GAIN,
|
||||
F_GET_FILTER,
|
||||
F_SET_FILTER,
|
||||
F_GET_FILTER_RESISTOR,
|
||||
F_SET_FILTER_RESISTOR,
|
||||
F_GET_ADC_CONFIGURATION,
|
||||
F_SET_ADC_CONFIGURATION,
|
||||
F_GET_BAD_CHANNELS,
|
||||
@ -215,7 +215,7 @@ enum detFuncs {
|
||||
F_VALIDATE_UDP_CONFIG,
|
||||
F_GET_BURSTS_LEFT,
|
||||
F_START_READOUT,
|
||||
F_SET_DEFAULT_DACS,
|
||||
F_RESET_TO_DEFAULT_DACS,
|
||||
F_IS_VIRTUAL,
|
||||
F_GET_PATTERN,
|
||||
F_LOAD_DEFAULT_PATTERN,
|
||||
@ -230,6 +230,17 @@ enum detFuncs {
|
||||
F_SET_VETO_STREAM,
|
||||
F_GET_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,
|
||||
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
|
||||
@ -280,7 +291,8 @@ enum detFuncs {
|
||||
F_SET_RECEIVER_STREAMING,
|
||||
F_GET_RECEIVER_STREAMING,
|
||||
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_GET_RECEIVER_FILE_FORMAT,
|
||||
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_CDS_GAIN: return "F_GET_CDS_GAIN";
|
||||
case F_SET_CDS_GAIN: return "F_SET_CDS_GAIN";
|
||||
case F_GET_FILTER: return "F_GET_FILTER";
|
||||
case F_SET_FILTER: return "F_SET_FILTER";
|
||||
case F_GET_FILTER_RESISTOR: return "F_GET_FILTER_RESISTOR";
|
||||
case F_SET_FILTER_RESISTOR: return "F_SET_FILTER_RESISTOR";
|
||||
case F_SET_ADC_CONFIGURATION: return "F_SET_ADC_CONFIGURATION";
|
||||
case F_GET_ADC_CONFIGURATION: return "F_GET_ADC_CONFIGURATION";
|
||||
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_GET_BURSTS_LEFT: return "F_GET_BURSTS_LEFT";
|
||||
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_GET_PATTERN: return "F_GET_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_GET_VETO_ALGORITHM: return "F_GET_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 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_GET_RECEIVER_STREAMING: return "F_GET_RECEIVER_STREAMING";
|
||||
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_GET_RECEIVER_FILE_FORMAT: return "F_GET_RECEIVER_FILE_FORMAT";
|
||||
case F_SET_RECEIVER_STREAMING_PORT: return "F_SET_RECEIVER_STREAMING_PORT";
|
||||
|
@ -3,10 +3,11 @@
|
||||
#define APILIB 0x210225
|
||||
#define APIRECEIVER 0x210225
|
||||
#define APIGUI 0x210225
|
||||
#define APICTB 0x210810
|
||||
#define APIGOTTHARD 0x210810
|
||||
#define APIGOTTHARD2 0x210810
|
||||
#define APIJUNGFRAU 0x210810
|
||||
#define APIMYTHEN3 0x210810
|
||||
#define APIMOENCH 0x210810
|
||||
#define APIEIGER 0x210810
|
||||
|
||||
#define APIEIGER 0x210811
|
||||
#define APICTB 0x210811
|
||||
#define APIGOTTHARD 0x210811
|
||||
#define APIGOTTHARD2 0x210811
|
||||
#define APIJUNGFRAU 0x210811
|
||||
#define APIMYTHEN3 0x210811
|
||||
#define APIMOENCH 0x210811
|
||||
|
@ -114,6 +114,40 @@ std::ostream &operator<<(std::ostream &os,
|
||||
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) {
|
||||
switch (s) {
|
||||
case defs::ERROR:
|
||||
@ -170,16 +204,12 @@ std::string ToString(const defs::detectorSettings s) {
|
||||
return std::string("mediumgain");
|
||||
case defs::VERYHIGHGAIN:
|
||||
return std::string("veryhighgain");
|
||||
case defs::DYNAMICHG0:
|
||||
return std::string("dynamichg0");
|
||||
case defs::HIGHGAIN0:
|
||||
return std::string("highgain0");
|
||||
case defs::FIXGAIN1:
|
||||
return std::string("fixgain1");
|
||||
case defs::FIXGAIN2:
|
||||
return std::string("fixgain2");
|
||||
case defs::FORCESWITCHG1:
|
||||
return std::string("forceswitchg1");
|
||||
case defs::FORCESWITCHG2:
|
||||
return std::string("forceswitchg2");
|
||||
case defs::VERYLOWGAIN:
|
||||
return std::string("verylowgain");
|
||||
case defs::G1_HIGHGAIN:
|
||||
@ -198,6 +228,8 @@ std::string ToString(const defs::detectorSettings s) {
|
||||
return std::string("g4_hg");
|
||||
case defs::G4_LOWGAIN:
|
||||
return std::string("g4_lg");
|
||||
case defs::GAIN0:
|
||||
return std::string("gain0");
|
||||
case defs::UNDEFINED:
|
||||
return std::string("undefined");
|
||||
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; }
|
||||
|
||||
template <> defs::detectorType StringTo(const std::string &s) {
|
||||
@ -618,16 +669,12 @@ template <> defs::detectorSettings StringTo(const std::string &s) {
|
||||
return defs::MEDIUMGAIN;
|
||||
if (s == "veryhighgain")
|
||||
return defs::VERYHIGHGAIN;
|
||||
if (s == "dynamichg0")
|
||||
return defs::DYNAMICHG0;
|
||||
if (s == "highgain0")
|
||||
return defs::HIGHGAIN0;
|
||||
if (s == "fixgain1")
|
||||
return defs::FIXGAIN1;
|
||||
if (s == "fixgain2")
|
||||
return defs::FIXGAIN2;
|
||||
if (s == "forceswitchg1")
|
||||
return defs::FORCESWITCHG1;
|
||||
if (s == "forceswitchg2")
|
||||
return defs::FORCESWITCHG2;
|
||||
if (s == "verylowgain")
|
||||
return defs::VERYLOWGAIN;
|
||||
if (s == "g1_hg")
|
||||
@ -644,6 +691,8 @@ template <> defs::detectorSettings StringTo(const std::string &s) {
|
||||
return defs::G2_LOWCAP_LOWGAIN;
|
||||
if (s == "g4_hg")
|
||||
return defs::G4_HIGHGAIN;
|
||||
if (s == "gain0")
|
||||
return defs::GAIN0;
|
||||
if (s == "g4_lg")
|
||||
return defs::G4_LOWGAIN;
|
||||
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);
|
||||
}
|
||||
|
||||
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) {
|
||||
int base = s.find("0x") != std::string::npos ? 16 : 10;
|
||||
return std::stoul(s, nullptr, base);
|
||||
|
@ -160,7 +160,7 @@ int ZmqSocket::SendHeader(int index, zmqHeader header) {
|
||||
"\"version\":%u, "
|
||||
|
||||
// additional stuff
|
||||
"\"flippedDataX\":%u, "
|
||||
"\"flipRows\":%u, "
|
||||
"\"quad\":%u"
|
||||
|
||||
; //"}\n";
|
||||
@ -177,7 +177,7 @@ int ZmqSocket::SendHeader(int index, zmqHeader header) {
|
||||
header.detType, header.version,
|
||||
|
||||
// additional stuff
|
||||
header.flippedDataX, header.quad);
|
||||
header.flipRows, header.quad);
|
||||
|
||||
if (!header.addJsonHeader.empty()) {
|
||||
strcat(header_buffer.get(), ", ");
|
||||
@ -303,7 +303,7 @@ int ZmqSocket::ParseHeader(const int index, int length, char *buff,
|
||||
zHeader.detType = document["detType"].GetUint();
|
||||
zHeader.version = document["version"].GetUint();
|
||||
|
||||
zHeader.flippedDataX = document["flippedDataX"].GetUint();
|
||||
zHeader.flipRows = document["flipRows"].GetUint();
|
||||
zHeader.quad = document["quad"].GetUint();
|
||||
zHeader.completeImage = document["completeImage"].GetUint();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user