Merge branch 'developer' into eigerserverlock

This commit is contained in:
maliakal_d 2020-09-21 17:28:38 +02:00
commit 4ad486fda0
11 changed files with 295 additions and 119 deletions

View File

@ -10,7 +10,7 @@ from .gotthard import Gotthard
from .moench import Moench from .moench import Moench
import _slsdet import _slsdet
xy = _slsdet.xy
defs = _slsdet.slsDetectorDefs defs = _slsdet.slsDetectorDefs
from .enums import * from .enums import *

View File

@ -10,6 +10,7 @@ detectorType = slsDetectorDefs.detectorType
from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask
from .utils import Geometry, to_geo, element, reduce_time, is_iterable from .utils import Geometry, to_geo, element, reduce_time, is_iterable
from _slsdet import xy
from . import utils as ut from . import utils as ut
from .proxy import JsonProxy, SlowAdcProxy, ClkDivProxy, MaxPhaseProxy, ClkFreqProxy from .proxy import JsonProxy, SlowAdcProxy, ClkDivProxy, MaxPhaseProxy, ClkFreqProxy
from .registers import Register, Adc_register from .registers import Register, Adc_register
@ -131,7 +132,15 @@ class Detector(CppDetectorApi):
@property @property
def hostname(self): def hostname(self):
"""Frees shared memory and sets hostname (or IP address) of all modules concatenated by + """ """Frees shared memory and sets hostname (or IP address) of all modules concatenated by +
Virtual servers can already use the port in hostname separated by ':' and ports incremented by 2 to accomodate the stop server as well.
Example
-------
>>> d.hostname = 'beb031+beb032+'
>>> d.hostname = 'localhost:1912+localhost:1914+'
>>> d.hostname
['localhost']
"""
return self.getHostname() return self.getHostname()
@hostname.setter @hostname.setter
@ -165,16 +174,35 @@ class Detector(CppDetectorApi):
@property @property
def firmwareversion(self): def firmwareversion(self):
"""
Fimware version of detector in format [0xYYMMDD] or an increasing 2 digit number for Eiger.
Example
-------
>>> hex(d.firmwareversion)
'0x200910'
"""
return element_if_equal(self.getFirmwareVersion()) return element_if_equal(self.getFirmwareVersion())
@property @property
def detectorserverversion(self): def detectorserverversion(self):
"""
On-board detector server software version in format [0xYYMMDD]
Example
-------
>>> hex(d.detectorserverversion)
'0x200910'
"""
# TODO! handle hex print # TODO! handle hex print
return element_if_equal(self.getDetectorServerVersion()) return element_if_equal(self.getDetectorServerVersion())
@property @property
def clientversion(self): def clientversion(self):
"""Client software version in format [YYMMDD]""" """Client software version in format [YYMMDD]
Example
-------
>>> hex(d.clientversion)
'0x200810'
"""
return self.getClientVersion() return self.getClientVersion()
@property @property
@ -206,6 +234,7 @@ class Detector(CppDetectorApi):
@property @property
def drlist(self): def drlist(self):
"""List of possible dynamic ranges for this detector"""
return self.getDynamicRangeList() return self.getDynamicRangeList()
@property @property
@ -219,8 +248,28 @@ class Detector(CppDetectorApi):
@property @property
def detsize(self): def detsize(self):
"""
Sets the detector size in both dimensions (number of channels).
Note
-----
This value is used to calculate row and column positions for each module and included into udp data packet header. \n
By default, it adds modules in y dimension for 2d detectors and in x dimension for 1d detectors.
Example
-------
>>> d.detsize
Geometry(x=3840, y=1)
>>> d.detsize = [1024, 512]
Geometry(x=1024, y = 512)
"""
return to_geo(self.getDetectorSize()) return to_geo(self.getDetectorSize())
@detsize.setter
def detsize(self, size):
if isinstance(size, xy):
self.setDetectorSize(size)
else:
self.setDetectorSize(xy(*size))
@property @property
def settings(self): def settings(self):
""" """
@ -247,8 +296,8 @@ class Detector(CppDetectorApi):
Note Note
----- -----
Cannot be set in modular level. ???? Cannot be set in modular level. \n
In scan mode, number of frames is set to number of steps. In scan mode, number of frames is set to number of steps. \n
[Gotthard2] Burst mode has a maximum of 2720 frames. [Gotthard2] Burst mode has a maximum of 2720 frames.
""" """
return element_if_equal(self.getNumberOfFrames()) return element_if_equal(self.getNumberOfFrames())
@ -260,6 +309,10 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def framesl(self): def framesl(self):
"""
[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] Number of frames left in acquisition.\n
[Gotthard2] only in continuous mode.
"""
return self.getNumberOfFramesLeft() return self.getNumberOfFramesLeft()
@property @property
@ -393,9 +446,9 @@ class Detector(CppDetectorApi):
Example Example
----------- -----------
>>> d.delay >>> d.delayl
181.23 181.23
>>> d.getDelayAfterTrigger() >>> d.getDelayAfterTriggerLeft()
[datetime.timedelta(seconds=181, microseconds=230000)] [datetime.timedelta(seconds=181, microseconds=230000)]
""" """
return ut.reduce_time(self.getDelayAfterTriggerLeft()) return ut.reduce_time(self.getDelayAfterTriggerLeft())
@ -623,7 +676,11 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def findex(self): def findex(self):
"""File or Acquisition index in receiver.""" """File or Acquisition index in receiver.
Note
----
File name: [file name prefix]_d[detector index]_f[sub file index]_[acquisition/file index].[raw/h5].
"""
return self.getAcquisitionIndex() return self.getAcquisitionIndex()
@findex.setter @findex.setter
@ -651,8 +708,7 @@ class Detector(CppDetectorApi):
@property @property
def fpath(self): def fpath(self):
"""Directory where output data files are written in receiver. """Directory where output data files are written in receiver. Default is "/".
Note Note
---- ----
If path does not exist, it will try to create it. If path does not exist, it will try to create it.
@ -1225,7 +1281,7 @@ class Detector(CppDetectorApi):
def dacvalues(self): def dacvalues(self):
"""Gets the dac values for every dac for this detector.""" """Gets the dac values for every dac for this detector."""
return { return {
dac.name.lower(): np.array(self.getDAC(dac, False)) dac.name.lower(): element_if_equal(np.array(self.getDAC(dac, False)))
for dac in self.getDacList() for dac in self.getDacList()
} }
@ -1264,6 +1320,11 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def adcinvert(self): def adcinvert(self):
"""[Ctb][Moench][Jungfrau] ADC Inversion Mask.
Note
-----
[Jungfrau][Moench] Inversions on top of the default mask.
"""
return self.getADCInvert() return self.getADCInvert()
@adcinvert.setter @adcinvert.setter
@ -1831,6 +1892,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def bursts(self): def bursts(self):
"""[Gotthard2] Number of bursts per aquire. Only in auto timing mode and burst mode."""
return self.getNumberOfBursts() return self.getNumberOfBursts()
@bursts.setter @bursts.setter
@ -1840,6 +1902,11 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def filter(self): def filter(self):
"""[Gotthard2] Set filter resistor.
Note
----
Default is 0. Options: 0-3.
"""
return self.getFilter() return self.getFilter()
@filter.setter @filter.setter
@ -1878,6 +1945,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def cdsgain(self): def cdsgain(self):
"""[Gotthard2] Enable or disable CDS gain. Default is disabled. """
return self.getCDSGain() return self.getCDSGain()
@cdsgain.setter @cdsgain.setter
@ -1888,6 +1956,11 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def burstmode(self): def burstmode(self):
"""[Gotthard2] Burst mode of detector. Enum: burstMode
Note
----
BURST_INTERNAL (default), BURST_EXTERNAL, CONTINUOUS_INTERNAL, CONTINUOUS_EXTERNAL
"""
return self.getBurstMode() return self.getBurstMode()
@burstmode.setter @burstmode.setter
@ -1896,6 +1969,22 @@ class Detector(CppDetectorApi):
@property @property
def burstperiod(self): def burstperiod(self):
"""
[Gotthard2] Period between 2 bursts. Only in burst mode and auto timing mode.
Note
-----
:getter: always returns in seconds. To get in datetime.delta, use getBurstPeriod
Example
-----------
>>> d.burstperiod = 1.05
>>> d.burstperiod = datetime.timedelta(minutes = 3, seconds = 1.23)
>>> d.burstperiod
181.23
>>> d.getBurstPeriod()
[datetime.timedelta(seconds=181, microseconds=230000)]
"""
return ut.reduce_time(self.getBurstPeriod()) return ut.reduce_time(self.getBurstPeriod())
@burstperiod.setter @burstperiod.setter
@ -2031,6 +2120,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def adcenable(self): def adcenable(self):
"""[Ctb][Moench] ADC Enable Mask for 1Gb. Enable for each 32 ADC channel."""
return self.getADCEnableMask() return self.getADCEnableMask()
@adcenable.setter @adcenable.setter
@ -2040,6 +2130,10 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def adcenable10g(self): def adcenable10g(self):
"""[Ctb][Moench] ADC Enable Mask for 10Gb mode for each 32 ADC channel.
Note
-----
If any of a consecutive 4 bits are enabled, the complete 4 bits are enabled."""
return self.getTenGigaADCEnableMask() return self.getTenGigaADCEnableMask()
@adcenable10g.setter @adcenable10g.setter
@ -2603,6 +2697,19 @@ class Detector(CppDetectorApi):
@property @property
def clkdiv(self): def clkdiv(self):
"""
[Gotthard2][Mythen3] Clock Divider of 5 clocks. Must be greater than 1.
Example
-------
>>> d.clkdiv[0] = 20
>>> d.clkdiv
0: 20
1: 10
2: 20
3: 10
4: 10
5: 5
"""
return ClkDivProxy(self) return ClkDivProxy(self)
@ -2612,6 +2719,18 @@ class Detector(CppDetectorApi):
@property @property
def exptimel(self): def exptimel(self):
"""[Gotthard] Exposure time left for current frame.
Note
-----
:getter: always returns in seconds. To get in datetime.delta, use getExptimeLeft
Example
-----------
>>> d.exptimel
181.23
>>> d.getExptimeLeft()
[datetime.timedelta(seconds=181, microseconds=230000)]
"""
t = self.getExptimeLeft() t = self.getExptimeLeft()
return reduce_time(t) return reduce_time(t)
@ -2623,6 +2742,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def gates(self): def gates(self):
"""[Mythen3] Number of external gates in gating or trigger_gating mode (external gating)."""
return self.getNumberOfGates() return self.getNumberOfGates()
@gates.setter @gates.setter
@ -2632,6 +2752,16 @@ class Detector(CppDetectorApi):
@property @property
def clkfreq(self): def clkfreq(self):
"""
[Gotthard2][Mythen3] Frequency of clock in Hz.
Note
-----
:setter: Not implemented. Use clkdiv to set frequency
Example
-------
>>> d.clkfreq[0]
50000000
"""
return ClkFreqProxy(self) return ClkFreqProxy(self)
""" """
@ -2640,6 +2770,14 @@ class Detector(CppDetectorApi):
@property @property
def initialchecks(self): def initialchecks(self):
"""
Enable or disable intial compatibility and other checks at detector start up.
Note
----
It is enabled by default. Must come before 'hostname' command to take effect. \n
Can be used to reprogram fpga when current firmware is incompatible. \n
Advanced user function!
"""
return self.getInitialChecks() return self.getInitialChecks()
@initialchecks.setter @initialchecks.setter

View File

@ -41,7 +41,7 @@ def to_geo(value):
if isinstance(value, _slsdet.xy): if isinstance(value, _slsdet.xy):
return Geometry(x = value.x, y = value.y) return Geometry(x = value.x, y = value.y)
else: else:
raise ValueError("Can only convert sls_detector.xy") raise ValueError("Can only convert slsdet.xy")
def all_equal(mylist): def all_equal(mylist):
"""If all elements are equal return true otherwise false""" """If all elements are equal return true otherwise false"""

View File

@ -4223,6 +4223,7 @@ int copy_detector_server(int file_des) {
strcat(cmd, sname); strcat(cmd, sname);
executeCommand(cmd, retvals, logDEBUG1); executeCommand(cmd, retvals, logDEBUG1);
#if !defined(GOTTHAR2D) && !defined(MYTHEN3D)
// edit /etc/inittab // edit /etc/inittab
// find line numbers in /etc/inittab where DetectorServer // find line numbers in /etc/inittab where DetectorServer
strcpy(cmd, "sed -n '/DetectorServer/=' /etc/inittab"); strcpy(cmd, "sed -n '/DetectorServer/=' /etc/inittab");
@ -4247,6 +4248,7 @@ int copy_detector_server(int file_des) {
executeCommand(cmd, retvals, logDEBUG1); executeCommand(cmd, retvals, logDEBUG1);
LOG(logINFO, ("/etc/inittab modified to have %s\n", sname)); LOG(logINFO, ("/etc/inittab modified to have %s\n", sname));
#endif
} }
} }
#endif #endif

View File

@ -58,7 +58,7 @@ class Detector {
Result<std::string> getHostname(Positions pos = {}) const; Result<std::string> getHostname(Positions pos = {}) const;
/**Frees shared memory, adds detectors to the list */ /**Frees shared memory, adds detectors to the list. */
void setHostname(const std::vector<std::string> &hostname); void setHostname(const std::vector<std::string> &hostname);
/** connects to n servers at local host starting at specific control port */ /** connects to n servers at local host starting at specific control port */
@ -98,8 +98,10 @@ class Detector {
defs::xy getDetectorSize() const; defs::xy getDetectorSize() const;
/** /**
* Sets the detector size in both dimensions. \n * Sets the detector size in both dimensions (number of channels). \n
* This value is used to calculate row and column positions for each module. * This value is used to calculate row and column positions for each module
* and included into udp data packet header. \n By default, it adds modules
* in y dimension for 2d detectors and in x dimension for 1d detectors.
*/ */
void setDetectorSize(const defs::xy value); void setDetectorSize(const defs::xy value);
@ -183,7 +185,8 @@ class Detector {
Result<int64_t> getNumberOfFrames(Positions pos = {}) const; Result<int64_t> getNumberOfFrames(Positions pos = {}) const;
/** In trigger mode, number of frames per trigger. In scan mode, number of /** In trigger mode, number of frames per trigger. In scan mode, number of
* frames is set to number of steps */ * frames is set to number of steps \n [Gotthard2] Burst mode has a maximum
* of 2720 frames. */
void setNumberOfFrames(int64_t value); void setNumberOfFrames(int64_t value);
Result<int64_t> getNumberOfTriggers(Positions pos = {}) const; Result<int64_t> getNumberOfTriggers(Positions pos = {}) const;
@ -228,8 +231,8 @@ class Detector {
Result<int> getDynamicRange(Positions pos = {}) const; Result<int> getDynamicRange(Positions pos = {}) const;
/** /**
* [Eiger] Options: 4, 8, 16, 32. If i is 32, also sets clkdivider to 2, if * [Eiger] Options: 4, 8, 16, 32. If i is 32, also sets clkdivider to 2,
* 16, sets clkdivider to 1 \n [Mythen3] Options: 8, 16, 32 \n * else sets clkdivider to 1 \n [Mythen3] Options: 8, 16, 32 \n
* [Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16 * [Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16
*/ */
void setDynamicRange(int value); void setDynamicRange(int value);
@ -313,7 +316,7 @@ class Detector {
/** [Mythen3][Gotthard2] */ /** [Mythen3][Gotthard2] */
Result<int> getClockPhase(int clkIndex, Positions pos = {}); Result<int> getClockPhase(int clkIndex, Positions pos = {});
/** [Mythen3][Gotthard2] */ /** [Mythen3][Gotthard2] absolute phase shift */
void setClockPhase(int clkIndex, int value, Positions pos = {}); void setClockPhase(int clkIndex, int value, Positions pos = {});
/** [Mythen3][Gotthard2] */ /** [Mythen3][Gotthard2] */
@ -328,7 +331,7 @@ class Detector {
/** [Mythen3][Gotthard2] */ /** [Mythen3][Gotthard2] */
Result<int> getClockDivider(int clkIndex, Positions pos = {}); Result<int> getClockDivider(int clkIndex, Positions pos = {});
/** [Mythen3][Gotthard2] */ /** [Mythen3][Gotthard2] Must be greater than 1. */
void setClockDivider(int clkIndex, int value, Positions pos = {}); void setClockDivider(int clkIndex, int value, Positions pos = {});
Result<int> getHighVoltage(Positions pos = {}) const; Result<int> getHighVoltage(Positions pos = {}) const;
@ -350,9 +353,9 @@ class Detector {
Result<int> getImageTestMode(Positions pos = {}); Result<int> getImageTestMode(Positions pos = {});
/** [Gotthard] If 1, adds channel intensity with precalculated values. /** [Gotthard] If 1, adds channel intensity with precalculated values.
* Default is 0 * Default is 0 \n
* [Eiger virtual] If 1, pixels are saturated. If 0, increasing intensity * [Eiger][Jungfrau] Only for virtual servers, if 1, pixels are saturated.
* Only for virtual servers */ * If 0, increasing intensity */
void setImageTestMode(const int value, Positions pos = {}); void setImageTestMode(const int value, Positions pos = {});
/** gets list of temperature indices for this detector */ /** gets list of temperature indices for this detector */
@ -430,8 +433,8 @@ class Detector {
*/ */
void acquire(); void acquire();
/** If acquisition aborted, use this to clear before starting next /** If acquisition aborted during blocking acquire, use this to clear
* acquisition */ * acquiring flag in shared memory before starting next acquisition */
void clearAcquiringFlag(); void clearAcquiringFlag();
/** Non Blocking: Start receiver listener and create data file if file write /** Non Blocking: Start receiver listener and create data file if file write
@ -738,7 +741,7 @@ class Detector {
Result<std::string> getFilePath(Positions pos = {}) const; Result<std::string> getFilePath(Positions pos = {}) const;
/** If path does not exist, it will try to create it */ /** Default is "/"If path does not exist, it will try to create it */
void setFilePath(const std::string &fpath, Positions pos = {}); void setFilePath(const std::string &fpath, Positions pos = {});
Result<std::string> getFileNamePrefix(Positions pos = {}) const; Result<std::string> getFileNamePrefix(Positions pos = {}) const;
@ -751,7 +754,10 @@ class Detector {
Result<int64_t> getAcquisitionIndex(Positions pos = {}) const; Result<int64_t> getAcquisitionIndex(Positions pos = {}) const;
/** file or Acquisition index in receiver */ /** file or Acquisition index in receiver \n
* File name: [file name prefix]_d[detector index]_f[sub file
* index]_[acquisition/file index].[raw/h5].
*/
void setAcquisitionIndex(int64_t i, Positions pos = {}); void setAcquisitionIndex(int64_t i, Positions pos = {});
Result<bool> getFileWrite(Positions pos = {}) const; Result<bool> getFileWrite(Positions pos = {}) const;
@ -906,7 +912,7 @@ class Detector {
/** [Eiger] */ /** [Eiger] */
Result<bool> getBottom(Positions pos = {}) const; Result<bool> getBottom(Positions pos = {}) const;
/** [Eiger] for client call back (gui) purposes */ /** [Eiger] for client call back (gui) purposes to flip bottom image */
void setBottom(bool value, Positions pos = {}); void setBottom(bool value, Positions pos = {});
/**[Eiger] Returns energies in eV where the module is trimmed */ /**[Eiger] Returns energies in eV where the module is trimmed */
@ -954,13 +960,14 @@ class Detector {
/** [Eiger] */ /** [Eiger] */
Result<bool> getActive(Positions pos = {}) const; Result<bool> getActive(Positions pos = {}) const;
/** [Eiger] */ /** [Eiger] activated by default at hostname command. Deactivated does not
* send data or communicated with FEB or BEB */
void setActive(const bool active, Positions pos = {}); void setActive(const bool active, Positions pos = {});
/** [Eiger] */ /** [Eiger] */
Result<bool> getRxPadDeactivatedMode(Positions pos = {}) const; Result<bool> getRxPadDeactivatedMode(Positions pos = {}) const;
/** [Eiger] Pad deactivated modules in receiver */ /** [Eiger] Pad deactivated modules in receiver. Enabled by default */
void setRxPadDeactivatedMode(bool pad, Positions pos = {}); void setRxPadDeactivatedMode(bool pad, Positions pos = {});
/** [Eiger] Advanced */ /** [Eiger] Advanced */
@ -1033,7 +1040,7 @@ class Detector {
* automatically after 93.75% of exposure time (only for longer than * automatically after 93.75% of exposure time (only for longer than
* 100us).\n * 100us).\n
* Default is false or this mode disabled(comparator enabled throughout). * Default is false or this mode disabled(comparator enabled throughout).
* true enables " "mode. 0 disables mode. * true enables mode. 0 disables mode.
*/ */
void setAutoCompDisable(bool value, Positions pos = {}); void setAutoCompDisable(bool value, Positions pos = {});
@ -1080,7 +1087,8 @@ class Detector {
*/ */
void setROI(defs::ROI value, int module_id); void setROI(defs::ROI value, int module_id);
/** [Gotthard] Clear ROI */ /** [Gotthard] Clear ROI to all channels enabled. Default is all channels
* enabled. */
void clearROI(Positions pos = {}); void clearROI(Positions pos = {});
/** [Gotthard] */ /** [Gotthard] */
@ -1104,13 +1112,15 @@ class Detector {
/** [Gotthard2] only in burst mode and auto timing mode */ /** [Gotthard2] only in burst mode and auto timing mode */
Result<ns> getBurstPeriod(Positions pos = {}) const; Result<ns> getBurstPeriod(Positions pos = {}) const;
/** [Gotthard2] only in burst mode and auto timing mode */ /** [Gotthard2] Period between 2 bursts. Only in burst mode and auto timing
* mode */
void setBurstPeriod(ns value, Positions pos = {}); void setBurstPeriod(ns value, Positions pos = {});
/** [Gotthard2] offset channel, increment channel */ /** [Gotthard2] offset channel, increment channel */
Result<std::array<int, 2>> getInjectChannel(Positions pos = {}); Result<std::array<int, 2>> getInjectChannel(Positions pos = {});
/** [Gotthard2] /** [Gotthard2]
* Inject channels with current source for calibration.
* offsetChannel is starting channel to be injected * offsetChannel is starting channel to be injected
* incrementChannel is determines succeeding channels to be injected */ * incrementChannel is determines succeeding channels to be injected */
void setInjectChannel(const int offsetChannel, const int incrementChannel, void setInjectChannel(const int offsetChannel, const int incrementChannel,
@ -1149,7 +1159,7 @@ class Detector {
/** [Gotthard2] */ /** [Gotthard2] */
Result<int> getFilter(Positions pos = {}) const; Result<int> getFilter(Positions pos = {}) const;
/** default 0 */ /** [Gotthard2] Set filter resister. Options: 0-3. Default: 0 */
void setFilter(int value, Positions pos = {}); void setFilter(int value, Positions pos = {});
/** [Gotthard2] */ /** [Gotthard2] */
@ -1174,7 +1184,8 @@ class Detector {
Result<int> getADCConfiguration(const int chipIndex, const int adcIndex, Result<int> getADCConfiguration(const int chipIndex, const int adcIndex,
Positions pos = {}) const; Positions pos = {}) const;
/** [Gotthard2] */ /** [Gotthard2] configures one chip at a time for specific adc, chipIndex
* and adcIndex is -1 for all */
void setADCConfiguration(const int chipIndex, const int adcIndex, void setADCConfiguration(const int chipIndex, const int adcIndex,
const int value, Positions pos = {}); const int value, Positions pos = {});
@ -1283,7 +1294,8 @@ class Detector {
/** [CTB][Moench] */ /** [CTB][Moench] */
Result<uint32_t> getTenGigaADCEnableMask(Positions pos = {}) const; Result<uint32_t> getTenGigaADCEnableMask(Positions pos = {}) const;
/** [CTB][Moench] */ /** [CTB][Moench] If any of a consecutive 4 bits are enabled, the "
"complete 4 bits are enabled */
void setTenGigaADCEnableMask(uint32_t mask, Positions pos = {}); void setTenGigaADCEnableMask(uint32_t mask, Positions pos = {});
///@{ ///@{
@ -1337,13 +1349,13 @@ class Detector {
/** [CTB] */ /** [CTB] */
Result<int> getExternalSamplingSource(Positions pos = {}) const; Result<int> getExternalSamplingSource(Positions pos = {}) const;
/** [CTB] Value between 0-63 */ /** [CTB] Value between 0-63 \n For advanced users only.*/
void setExternalSamplingSource(int value, Positions pos = {}); void setExternalSamplingSource(int value, Positions pos = {});
/** [CTB] */ /** [CTB] */
Result<bool> getExternalSampling(Positions pos = {}) const; Result<bool> getExternalSampling(Positions pos = {}) const;
/** [CTB] */ /** [CTB] For advanced users only. */
void setExternalSampling(bool value, Positions pos = {}); void setExternalSampling(bool value, Positions pos = {});
/** [CTB] */ /** [CTB] */
@ -1504,9 +1516,10 @@ class Detector {
void resetFPGA(Positions pos = {}); void resetFPGA(Positions pos = {});
/** [Jungfrau][Gotthard][CTB][Moench][Mythen3][Gotthard2] /** [Jungfrau][Gotthard][CTB][Moench][Mythen3][Gotthard2]
* Advanced user Function! * Advanced user Function! \n
* Copy detector server fname from tftp folder of hostname to detector * Copy detector server fname from tftp folder of hostname to detector \n
* Also changes respawn server, which is effective after a reboot. * [Jungfrau][Gotthard][CTB][Moench] Also changes respawn server, which is
* effective after a reboot.
*/ */
void copyDetectorServer(const std::string &fname, void copyDetectorServer(const std::string &fname,
const std::string &hostname, Positions pos = {}); const std::string &hostname, Positions pos = {});
@ -1517,13 +1530,14 @@ class Detector {
/** /**
* [Jungfrau][Gotthard][CTB][Moench] * [Jungfrau][Gotthard][CTB][Moench]
* Advanced user Function! * Advanced user Function! \n
* Updates the firmware, detector server and then reboots detector * Updates the firmware, detector server and then reboots detector
* controller blackfin. * controller blackfin. \n
* sname is name of detector server binary found on tftp folder of host * [Mythen3][Gotthard2] Will still have old server starting up as the new
* pc * server is not respawned \n
* hostname is name of pc to tftp from sname is name of detector server binary found on
* fname is programming file name * tftp folder of host pc hostname is name of pc to tftp from fname is
* programming file name
*/ */
void updateFirmwareAndServer(const std::string &sname, void updateFirmwareAndServer(const std::string &sname,
const std::string &hostname, const std::string &hostname,
@ -1543,12 +1557,16 @@ class Detector {
/** Advanced user Function! */ /** Advanced user Function! */
void clearBit(uint32_t addr, int bitnr, Positions pos = {}); void clearBit(uint32_t addr, int bitnr, Positions pos = {});
/** Advanced user Function! */
Result<int> getBit(uint32_t addr, int bitnr, Positions pos = {});
/** [Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] Advanced user /** [Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] Advanced user
* Function! */ * Function! */
void executeFirmwareTest(Positions pos = {}); void executeFirmwareTest(Positions pos = {});
/** [Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] Advanced user /** [Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] Advanced user
* Function! */ * Function! Writes different values in a R/W register and confirms the
* writes to check bus */
void executeBusTest(Positions pos = {}); void executeBusTest(Positions pos = {});
/** [Gotthard][Jungfrau][CTB][Moench] Advanced user Function! not possible /** [Gotthard][Jungfrau][CTB][Moench] Advanced user Function! not possible
@ -1558,14 +1576,17 @@ class Detector {
/** Advanced user Function! */ /** Advanced user Function! */
bool getInitialChecks() const; bool getInitialChecks() const;
/** initial compaibility and other server start up checks /** Enables/disabled initial compaibility and other server start up checks.
* default enabled Advanced user Function! */ * \n Default is enabled. Must come before 'hostname' command to take
* effect. \n Can be used to reprogram fpga when current firmware is
* incompatible. \n Advanced user Function! */
void setInitialChecks(const bool value); void setInitialChecks(const bool value);
/** [CTB][Moench][Jungfrau] Advanced user Function! */ /** [CTB][Moench][Jungfrau] Advanced user Function! */
Result<uint32_t> getADCInvert(Positions pos = {}) const; Result<uint32_t> getADCInvert(Positions pos = {}) const;
/** [CTB][Moench][Jungfrau] Advanced user Function! */ /** [CTB][Moench][Jungfrau] Advanced user Function! \n
[Jungfrau] Inversions on top of default mask */
void setADCInvert(uint32_t value, Positions pos = {}); void setADCInvert(uint32_t value, Positions pos = {});
///@{ ///@{
@ -1606,11 +1627,11 @@ class Detector {
Result<int64_t> getNumberOfFramesFromStart(Positions pos = {}) const; Result<int64_t> getNumberOfFramesFromStart(Positions pos = {}) const;
/** [Jungfrau][Mythen3][CTB][Moench] Get time from detector start /** [Jungfrau][Mythen3][CTB][Moench] Get time from detector start
* [Gotthard2] only in continuous mode */ * [Gotthard2] not in burst and auto mode */
Result<ns> getActualTime(Positions pos = {}) const; Result<ns> getActualTime(Positions pos = {}) const;
/** [Jungfrau][Mythen3][CTB][Moench] Get timestamp at a frame start /** [Jungfrau][Mythen3][CTB][Moench] Get timestamp at a frame start
* [Gotthard2] only in continuous mode */ * [Gotthard2] not in burst and auto mode */
Result<ns> getMeasurementTime(Positions pos = {}) const; Result<ns> getMeasurementTime(Positions pos = {}) const;
/** get user details from shared memory (hostname, type, PID, User, Date) /** get user details from shared memory (hostname, type, PID, User, Date)

View File

@ -122,7 +122,9 @@ std::string CmdProxy::Hostname(int action) {
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "\n\tFrees shared memory and sets hostname (or IP address) of " os << "\n\tFrees shared memory and sets hostname (or IP address) of "
"all modules concatenated by +." "all modules concatenated by +.\n\t Virtual servers can already "
"use the port in hostname separated by ':' and ports incremented "
"by 2 to accomodate the stop server as well."
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
if (!args.empty()) { if (!args.empty()) {
@ -220,8 +222,8 @@ std::string CmdProxy::FirmwareVersion(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "\n\tFimware version of detector in format [0xYYMMDD] or integer " os << "\n\tFimware version of detector in format [0xYYMMDD] or an "
"for Eiger." "increasing 2 digit number for Eiger."
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
if (!args.empty()) { if (!args.empty()) {
@ -315,9 +317,9 @@ std::string CmdProxy::DetectorSize(int action) {
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[nx] [ny]\n\tDetector size, ie. Number of channels in x and y " os << "[nx] [ny]\n\tDetector size, ie. Number of channels in x and y "
"dim. If 0, then hostname adds all modules in y dim. This is " "dim. This is used to calculate module coordinates included in "
"used to calculate module coordinates included in UDP data " "UDP data. \n\tBy default, it adds module in y dimension for 2d "
"packet header." "detectors and in x dimension for 1d detectors packet header."
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
if (!args.empty()) { if (!args.empty()) {
@ -480,7 +482,8 @@ std::string CmdProxy::DynamicRange(int action) {
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[value]\n\tDynamic Range or number of bits per " os << "[value]\n\tDynamic Range or number of bits per "
"pixel in detector.\n\t" "pixel in detector.\n\t"
"[Eiger] Options: 4, 8, 16, 32\n\t" "[Eiger] Options: 4, 8, 16, 32. If set to 32, also sets "
"clkdivider to 2, else to 0.\n\t"
"[Mythen3] Options: 8, 16, 32\n\t" "[Mythen3] Options: 8, 16, 32\n\t"
"[Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16" "[Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16"
<< '\n'; << '\n';
@ -838,7 +841,7 @@ std::string CmdProxy::ExternalSignal(int action) {
"[trigger_in_rising_edge|trigger_in_falling_edge|inversion_on|" "[trigger_in_rising_edge|trigger_in_falling_edge|inversion_on|"
"inversion_off]\n\t where 0 is master input trigger signal, 1-3 " "inversion_off]\n\t where 0 is master input trigger signal, 1-3 "
"is master input gate signals, 4 is busy out signal and 5-7 is " "is master input gate signals, 4 is busy out signal and 5-7 is "
"master output gate signals" "master output gate signals."
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
if (args.size() != 1) { if (args.size() != 1) {
@ -1584,7 +1587,7 @@ std::string CmdProxy::ClearROI(int action) {
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "\n\t[Gotthard] Resets Region of interest in detector. All " os << "\n\t[Gotthard] Resets Region of interest in detector. All "
"channels enabled. Default is all channels." "channels enabled. Default is all channels enabled."
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
throw sls::RuntimeError("Cannot get"); throw sls::RuntimeError("Cannot get");
@ -2450,10 +2453,9 @@ std::string CmdProxy::CopyDetectorServer(int action) {
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[server_name] " os << "[server_name] "
"[pc_host_name]\n\t[Jungfrau][Ctb][Moench][Mythen3][Gotthard2] " "[pc_host_name]\n\t[Jungfrau][Ctb][Moench][Mythen3][Gotthard2] "
"Copies " "Copies detector server via tftp from pc. "
"detector " "\n\t[Jungfrau][Ctb][Moench]Also changes respawn server, which "
"server via tftp from pc and changes respawn server name in " "is effective after a reboot."
"/etc/inittab of detector."
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
throw sls::RuntimeError("Cannot get"); throw sls::RuntimeError("Cannot get");
@ -2554,16 +2556,13 @@ std::string CmdProxy::BitOperations(int action) {
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
if (cmd == "setbit") { if (cmd == "setbit") {
os << "[address] [value\n\t[Moench] Minimum energy threshold (soft " os << "[reg address in hex] [bit index]\n\tSets bit in address."
"setting) for processor."
<< '\n'; << '\n';
} else if (cmd == "clearbit") { } else if (cmd == "clearbit") {
os << "[n_value]\n\t[Moench] Maximum energy threshold (soft " os << "[reg address in hex] [bit index]\n\tClears bit in address."
"setting) for processor."
<< '\n'; << '\n';
} else if (cmd == "getbit") { } else if (cmd == "getbit") {
os << "[n_value]\n\t[Moench] Maximum energy threshold (soft " os << "[reg address in hex] [bit index]\n\tGets bit in address."
"setting) for processor."
<< '\n'; << '\n';
} else { } else {
throw sls::RuntimeError( throw sls::RuntimeError(
@ -2587,12 +2586,8 @@ std::string CmdProxy::BitOperations(int action) {
if (cmd == "setbit" || cmd == "clearbit") { if (cmd == "setbit" || cmd == "clearbit") {
throw sls::RuntimeError("Cannot get"); throw sls::RuntimeError("Cannot get");
} }
auto t = det->readRegister(addr, std::vector<int>{det_id}); auto t = det->getBit(addr, bitnr, std::vector<int>{det_id});
Result<int> result(t.size()); os << OutString(t) << '\n';
for (unsigned int i = 0; i < t.size(); ++i) {
result[i] = ((t[i] >> bitnr) & 0x1);
}
os << OutString(result) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (cmd == "getbit") { if (cmd == "getbit") {
throw sls::RuntimeError("Cannot put"); throw sls::RuntimeError("Cannot put");
@ -2617,7 +2612,8 @@ std::string CmdProxy::InitialChecks(int action) {
os << "[0, 1]\n\tEnable or disable intial compatibility and other " os << "[0, 1]\n\tEnable or disable intial compatibility and other "
"checks at detector start up. It is enabled by default. Must " "checks at detector start up. It is enabled by default. Must "
"come before 'hostname' command to take effect. Can be used to " "come before 'hostname' command to take effect. Can be used to "
"reprogram fpga when current firmware is incompatible." "reprogram fpga when current firmware is "
"incompatible.\n\tAdvanced User function!"
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
if (det_id != -1) { if (det_id != -1) {
@ -2651,7 +2647,8 @@ std::string CmdProxy::ExecuteCommand(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[command]\n\tExecutes command on detector server." << '\n'; os << "[command]\n\tExecutes command on detector server console."
<< '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
throw sls::RuntimeError("Cannot get."); throw sls::RuntimeError("Cannot get.");
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {

View File

@ -597,6 +597,7 @@ class CmdProxy {
{"detectorversion", "firmwareversion"}, {"detectorversion", "firmwareversion"},
{"softwareversion", "detectorserverversion"}, {"softwareversion", "detectorserverversion"},
{"receiverversion", "rx_version"}, {"receiverversion", "rx_version"},
{"detectornumber", "serialnumber"},
{"thisversion", "clientversion"}, {"thisversion", "clientversion"},
{"detsizechan", "detsize"}, {"detsizechan", "detsize"},
@ -703,7 +704,7 @@ class CmdProxy {
{"firmwareversion", &CmdProxy::FirmwareVersion}, {"firmwareversion", &CmdProxy::FirmwareVersion},
{"detectorserverversion", &CmdProxy::detectorserverversion}, {"detectorserverversion", &CmdProxy::detectorserverversion},
{"rx_version", &CmdProxy::rx_version}, {"rx_version", &CmdProxy::rx_version},
{"detectornumber", &CmdProxy::detectornumber}, {"serialnumber", &CmdProxy::serialnumber},
{"type", &CmdProxy::type}, {"type", &CmdProxy::type},
{"nmod", &CmdProxy::nmod}, {"nmod", &CmdProxy::nmod},
{"detsize", &CmdProxy::DetectorSize}, {"detsize", &CmdProxy::DetectorSize},
@ -1176,8 +1177,8 @@ class CmdProxy {
GET_COMMAND_HEX(rx_version, getReceiverVersion, GET_COMMAND_HEX(rx_version, getReceiverVersion,
"\n\tReceiver version in format [0xYYMMDD]."); "\n\tReceiver version in format [0xYYMMDD].");
GET_COMMAND_HEX(detectornumber, getSerialNumber, GET_COMMAND_HEX(serialnumber, getSerialNumber,
"\n\tReceiver version in format [0xYYMMDD]."); "\n\tSerial number of detector.");
GET_COMMAND(type, getDetectorType, GET_COMMAND(type, getDetectorType,
"\n\tReturns detector type. Can be Eiger, Jungfrau, Gotthard, " "\n\tReturns detector type. Can be Eiger, Jungfrau, Gotthard, "
@ -1222,8 +1223,8 @@ class CmdProxy {
INTEGER_COMMAND_NOID( INTEGER_COMMAND_NOID(
frames, getNumberOfFrames, setNumberOfFrames, StringTo<int64_t>, frames, getNumberOfFrames, setNumberOfFrames, StringTo<int64_t>,
"[n_frames]\n\tNumber of frames per acquisition. In " "[n_frames]\n\tNumber of frames per acquisition. In "
"trigger mode, number of frames per trigger. Cannot be set in modular " "trigger mode, number of frames per trigger. \n\tCannot be set in "
"level. In scan mode, number of frames is set to number of " "modular level. \n\tIn scan mode, number of frames is set to number of "
"steps.\n\t[Gotthard2] Burst mode has a maximum of 2720 frames."); "steps.\n\t[Gotthard2] Burst mode has a maximum of 2720 frames.");
INTEGER_COMMAND_NOID(triggers, getNumberOfTriggers, setNumberOfTriggers, INTEGER_COMMAND_NOID(triggers, getNumberOfTriggers, setNumberOfTriggers,
@ -1587,7 +1588,8 @@ class CmdProxy {
DAC_COMMAND( DAC_COMMAND(
adcvpp, getDAC, setDAC, defs::ADC_VPP, adcvpp, getDAC, setDAC, defs::ADC_VPP,
"[dac or mV value][(optional unit) mV] \n\t[Ctb][Moench] Vpp of " "[dac or mV value][(optional unit) mV] \n\t[Ctb][Moench] Vpp of "
"ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> 2V."); "ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> 2V. "
"\n\tAdvanced User function! ");
DAC_COMMAND(vb_ds, getDAC, setDAC, defs::VB_DS, DAC_COMMAND(vb_ds, getDAC, setDAC, defs::VB_DS,
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for "
@ -1667,9 +1669,10 @@ class CmdProxy {
/* acquisition */ /* acquisition */
EXECUTE_SET_COMMAND_NOID(clearbusy, clearAcquiringFlag, EXECUTE_SET_COMMAND_NOID(
"\n\tClears Acquiring Flag for unexpected acquire " clearbusy, clearAcquiringFlag,
"command terminations."); "\n\tIf acquisition aborted during acquire command, use this to clear "
"acquiring flag in shared memory before starting next acquisition");
EXECUTE_SET_COMMAND_NOID( EXECUTE_SET_COMMAND_NOID(
rx_start, startReceiver, rx_start, startReceiver,
@ -1899,10 +1902,10 @@ class CmdProxy {
"[binary|hdf5]\n\tFile format of data file. For HDF5, package must be " "[binary|hdf5]\n\tFile format of data file. For HDF5, package must be "
"compiled with HDF5 flags. Default is binary."); "compiled with HDF5 flags. Default is binary.");
STRING_COMMAND( STRING_COMMAND(fpath, getFilePath, setFilePath,
fpath, getFilePath, setFilePath, "[path]\n\tDirectory where output data files are written in "
"[path]\n\tDirectory where output data files are written in receiver. " "receiver. Default is '/'. \n\tIf path does not exist, it "
"If path does not exist, it will try to create it."); "will try to create it.");
STRING_COMMAND(fname, getFileNamePrefix, setFileNamePrefix, STRING_COMMAND(fname, getFileNamePrefix, setFileNamePrefix,
"[name]\n\tFile name prefix for output data file. Default " "[name]\n\tFile name prefix for output data file. Default "
@ -2012,8 +2015,9 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
flippeddatax, getBottom, setBottom, StringTo<int>, flippeddatax, getBottom, setBottom, StringTo<int>,
"[0, 1]\n\t[Eiger] Top or Bottom Half of Eiger module. 1 is bottom, 0 " "[0, 1]\n\t[Eiger] Top or Bottom Half of Eiger module. 1 is bottom, 0 "
"is top. Used to let Receivers and Gui know to flip the bottom image " "is top. Used to let Gui (via zmq from receiver) know to flip the "
"over the x axis. Files are not written without the flip however."); "bottom image over the x axis. Files are not written without the flip "
"however.");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
readnlines, getPartialReadout, setPartialReadout, StringTo<int>, readnlines, getPartialReadout, setPartialReadout, StringTo<int>,
@ -2105,9 +2109,10 @@ class CmdProxy {
"timing mode and burst mode. Use timing command to set timing mode and " "timing mode and burst mode. Use timing command to set timing mode and "
"burstmode command to set burst mode."); "burstmode command to set burst mode.");
TIME_COMMAND(burstperiod, getBurstPeriod, setBurstPeriod, TIME_COMMAND(
"[duration] [(optional unit) ns|us|ms|s]\n\t[Gotthard2] Burst " burstperiod, getBurstPeriod, setBurstPeriod,
"period. Only in burst mode and auto timing mode."); "[duration] [(optional unit) ns|us|ms|s]\n\t[Gotthard2] "
"Period between 2 bursts. Only in burst mode and auto timing mode.");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
cdsgain, getCDSGain, setCDSGain, StringTo<bool>, cdsgain, getCDSGain, setCDSGain, StringTo<bool>,
@ -2169,13 +2174,13 @@ class CmdProxy {
INTEGER_COMMAND_HEX(adcenable, getADCEnableMask, setADCEnableMask, INTEGER_COMMAND_HEX(adcenable, getADCEnableMask, setADCEnableMask,
StringTo<uint32_t>, StringTo<uint32_t>,
"[bitmask]\n\t[Ctb][Moench] ADC Enable Mask for 1Gb " "[bitmask]\n\t[Ctb][Moench] ADC Enable Mask for 1Gb "
"Mode for each 32 ADC channel."); "Enable for each 32 ADC channel.");
INTEGER_COMMAND_HEX( INTEGER_COMMAND_HEX(
adcenable10g, getTenGigaADCEnableMask, setTenGigaADCEnableMask, adcenable10g, getTenGigaADCEnableMask, setTenGigaADCEnableMask,
StringTo<uint32_t>, StringTo<uint32_t>,
"[bitmask]\n\t[Ctb][Moench] ADC Enable Mask for 10Gb mode for each 32 " "[bitmask]\n\t[Ctb][Moench] ADC Enable Mask for 10Gb mode for each 32 "
"ADC channel. However, if any of consecutive 4 bits are enabled, the " "ADC channel. However, if any of a consecutive 4 bits are enabled, the "
"complete 4 bits are enabled."); "complete 4 bits are enabled.");
/* CTB Specific */ /* CTB Specific */
@ -2258,8 +2263,8 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
extsampling, getExternalSampling, setExternalSampling, StringTo<int>, extsampling, getExternalSampling, setExternalSampling, StringTo<int>,
"[0, 1]\n\t[Ctb] Enable for external sampling signal to extsamplingsrc " "[0, 1]\n\t[Ctb] Enable for external sampling signal for digital data "
"signal for digital data. For advanced users only."); "to signal by extsampling src command. For advanced users only.");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
extsamplingsrc, getExternalSamplingSource, setExternalSamplingSource, extsamplingsrc, getExternalSamplingSource, setExternalSamplingSource,
@ -2319,7 +2324,8 @@ class CmdProxy {
EXECUTE_SET_COMMAND( EXECUTE_SET_COMMAND(
bustest, executeBusTest, bustest, executeBusTest,
"\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb][Moench] Bus test, " "\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb][Moench] Bus test, "
"ie. keeps writing and reading back different values in R/W register."); "ie. Writes different values in a R/W register and confirms the "
"writes to check bus.\n\tAdvanced User function!");
INTEGER_COMMAND_HEX( INTEGER_COMMAND_HEX(
adcinvert, getADCInvert, setADCInvert, StringTo<uint32_t>, adcinvert, getADCInvert, setADCInvert, StringTo<uint32_t>,
@ -2355,13 +2361,13 @@ class CmdProxy {
"[(optional unit) " "[(optional unit) "
"ns|us|ms|s]\n\t[Jungfrau][Mythen3][Gotthard2][Moench][" "ns|us|ms|s]\n\t[Jungfrau][Mythen3][Gotthard2][Moench]["
"CTB] Time from detector start up." "CTB] Time from detector start up."
"\n\t[Gotthard2] only in continuous mode."); "\n\t[Gotthard2] not in burst and auto mode.");
TIME_GET_COMMAND(timestamp, getMeasurementTime, TIME_GET_COMMAND(timestamp, getMeasurementTime,
"[(optional unit) " "[(optional unit) "
"ns|us|ms|s]\n\t[Jungfrau][Mythen3][Gotthard2][Moench][" "ns|us|ms|s]\n\t[Jungfrau][Mythen3][Gotthard2][Moench]["
"CTB] Timestamp at a frame start." "CTB] Timestamp at a frame start."
"\n\t[Gotthard2] only in continuous mode."); "\n\t[Gotthard2] not in burst and auto mode.");
GET_COMMAND( GET_COMMAND(
rx_frameindex, getRxCurrentFrameIndex, rx_frameindex, getRxCurrentFrameIndex,

View File

@ -384,7 +384,6 @@ Result<int> Detector::getClockFrequency(int clkIndex, Positions pos) {
return pimpl->Parallel(&Module::getClockFrequency, pos, clkIndex); return pimpl->Parallel(&Module::getClockFrequency, pos, clkIndex);
} }
Result<int> Detector::getClockPhase(int clkIndex, Positions pos) { Result<int> Detector::getClockPhase(int clkIndex, Positions pos) {
return pimpl->Parallel(&Module::getClockPhase, pos, clkIndex, false); return pimpl->Parallel(&Module::getClockPhase, pos, clkIndex, false);
} }
@ -1883,6 +1882,10 @@ void Detector::clearBit(uint32_t addr, int bitnr, Positions pos) {
pimpl->Parallel(&Module::clearBit, pos, addr, bitnr); pimpl->Parallel(&Module::clearBit, pos, addr, bitnr);
} }
Result<int> Detector::getBit(uint32_t addr, int bitnr, Positions pos) {
return pimpl->Parallel(&Module::getBit, pos, addr, bitnr);
}
void Detector::executeFirmwareTest(Positions pos) { void Detector::executeFirmwareTest(Positions pos) {
pimpl->Parallel(&Module::executeFirmwareTest, pos); pimpl->Parallel(&Module::executeFirmwareTest, pos);
} }

View File

@ -2195,21 +2195,29 @@ uint32_t Module::writeRegister(uint32_t addr, uint32_t val) {
return sendToDetectorStop<uint32_t>(F_WRITE_REGISTER, args); return sendToDetectorStop<uint32_t>(F_WRITE_REGISTER, args);
} }
uint32_t Module::setBit(uint32_t addr, int n) { void Module::setBit(uint32_t addr, int n) {
if (n < 0 || n > 31) { if (n < 0 || n > 31) {
throw RuntimeError("Bit number " + std::to_string(n) + " out of Range"); throw RuntimeError("Bit number " + std::to_string(n) + " out of Range");
} else { } else {
uint32_t val = readRegister(addr); uint32_t val = readRegister(addr);
return writeRegister(addr, val | 1 << n); writeRegister(addr, val | 1 << n);
} }
} }
uint32_t Module::clearBit(uint32_t addr, int n) { void Module::clearBit(uint32_t addr, int n) {
if (n < 0 || n > 31) { if (n < 0 || n > 31) {
throw RuntimeError("Bit number " + std::to_string(n) + " out of Range"); throw RuntimeError("Bit number " + std::to_string(n) + " out of Range");
} else { } else {
uint32_t val = readRegister(addr); uint32_t val = readRegister(addr);
return writeRegister(addr, val & ~(1 << n)); writeRegister(addr, val & ~(1 << n));
}
}
int Module::getBit(uint32_t addr, int n) {
if (n < 0 || n > 31) {
throw RuntimeError("Bit number " + std::to_string(n) + " out of Range");
} else {
return ((readRegister(addr) >> n) & 0x1);
} }
} }

View File

@ -497,8 +497,9 @@ class Module : public virtual slsDetectorDefs {
void rebootController(); void rebootController();
uint32_t readRegister(uint32_t addr) const; uint32_t readRegister(uint32_t addr) const;
uint32_t writeRegister(uint32_t addr, uint32_t val); uint32_t writeRegister(uint32_t addr, uint32_t val);
uint32_t setBit(uint32_t addr, int n); void setBit(uint32_t addr, int n);
uint32_t clearBit(uint32_t addr, int n); void clearBit(uint32_t addr, int n);
int getBit(uint32_t addr, int n);
void executeFirmwareTest(); void executeFirmwareTest();
void executeBusTest(); void executeBusTest();
void writeAdcRegister(uint32_t addr, uint32_t val); void writeAdcRegister(uint32_t addr, uint32_t val);

View File

@ -101,11 +101,11 @@ TEST_CASE("detectorserverversion", "[.cmd][.new]") {
REQUIRE_THROWS(proxy.Call("detectorserverversion", {"0"}, -1, PUT)); REQUIRE_THROWS(proxy.Call("detectorserverversion", {"0"}, -1, PUT));
} }
TEST_CASE("detectornumber", "[.cmd][.new]") { TEST_CASE("serialnumber", "[.cmd][.new]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
REQUIRE_NOTHROW(proxy.Call("detectornumber", {}, -1, GET)); REQUIRE_NOTHROW(proxy.Call("serialnumber", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("detectornumber", {"0"}, -1, PUT)); REQUIRE_THROWS(proxy.Call("serialnumber", {"0"}, -1, PUT));
} }
TEST_CASE("type", "[.cmd][.new]") { TEST_CASE("type", "[.cmd][.new]") {