Compare commits

...

62 Commits

Author SHA1 Message Date
3b071cc43f WIP doc 2020-09-11 09:30:30 +02:00
2805359cd0 Merge pull request #179 from slsdetectorgroup/kernelcheck
g2 and m3: kernel checks only when its too old
2020-09-11 08:55:48 +02:00
1515b79c97 Merge branch 'kernelcheck' of github.com:slsdetectorgroup/slsDetectorPackage into kernelcheck 2020-09-11 08:50:01 +02:00
2ab4bb1c04 minor 2020-09-11 08:49:52 +02:00
5214c0f1a4 binaries in 2020-09-10 18:43:26 +02:00
60bc3a8fa7 Merge branch 'kernelcheck' of github.com:slsdetectorgroup/slsDetectorPackage into kernelcheck 2020-09-10 18:41:49 +02:00
00f780665f using common.c to extract date and using nios.c to check kernel version(a bit specific to nios) and using c api instead of system command to get uname 2020-09-10 18:41:31 +02:00
ab738790e0 python nmod 2020-09-10 17:13:05 +02:00
d4cff5b99c Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-10 17:08:55 +02:00
84f49a9b27 python 2020-09-10 17:08:51 +02:00
a4926e6ae1 help fix for cmd line 2020-09-10 17:04:08 +02:00
cf8785ad2e Merge branch 'developer' into kernelcheck 2020-09-10 16:57:54 +02:00
be8284f5c2 nmod added to command line 2020-09-10 16:57:30 +02:00
3fd32b2c9c missing file 2020-09-10 16:47:51 +02:00
d70090967d python funcs 2020-09-10 16:47:34 +02:00
88fe306902 binaries in 2020-09-10 16:23:29 +02:00
d931416def g2 and m3: kernel checks only when its too old 2020-09-10 16:22:08 +02:00
6cfaa92b61 removed wrongly named functions 2020-09-10 15:54:45 +02:00
c94dfde17c updated compare script 2020-09-10 15:48:25 +02:00
b879a377ba python cmds 2020-09-10 15:28:29 +02:00
d420451751 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-10 14:45:38 +02:00
2bc33ad34a default value for setDAC 2020-09-10 14:45:31 +02:00
cb23e827bf Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-10 14:11:29 +02:00
a0f915316e rx_readfreq to rx_zmqfreq and rx_datastream to rx_zmqstream 2020-09-10 14:11:21 +02:00
2733bc5320 added now 2020-09-10 14:02:25 +02:00
3b82e9fcc1 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-10 12:16:38 +02:00
a95d8f664a added slowadc to python 2020-09-10 12:16:25 +02:00
11e7d89da3 Merge branch 'developer' into pydoc 2020-09-10 12:01:38 +02:00
34043c358f Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-10 11:53:31 +02:00
da9c7c354e adc- 2020-09-10 11:53:17 +02:00
4d499e231d Merge pull request #178 from slsdetectorgroup/eigertempblockingfix
eiger temp fix: tempfpgafl and tempfpgafr cannot be used during block…
2020-09-10 11:48:31 +02:00
0a7809286b eiger temp fix: tempfpgafl and tempfpgafr cannot be used during blocking acquire as it goes through control server now 2020-09-10 11:47:42 +02:00
00abb5e14b Merge pull request #177 from slsdetectorgroup/eigerfw27
eiger: fw 27 fix for delays
2020-09-10 10:40:09 +02:00
22c2bb0258 eiger: fw 27 fix for delays 2020-09-10 10:26:16 +02:00
9d1cd09fd4 Merge pull request #176 from slsdetectorgroup/m3clks
M3 clks
2020-09-10 10:20:41 +02:00
80b053eb10 binaries resolved, merge conflict from developer 2020-09-10 10:19:34 +02:00
3cd4f3897b M3: software trigger (#175) 2020-09-10 10:15:45 +02:00
d011186b9a Merge pull request #173 from slsdetectorgroup/updatemode
server: Update mode to skip detector setup
2020-09-09 18:33:43 +02:00
669c14d6d5 Merge branch 'm3clks' into pydoc 2020-09-09 17:36:12 +02:00
ecabc94ade Merge branch 'developer' into m3clks 2020-09-09 17:34:02 +02:00
c58a2d957d Merge branch 'developer' into updatemode 2020-09-09 17:31:09 +02:00
1b214778a5 fix import 2020-09-09 17:26:50 +02:00
d5f6cbc075 Merge branch 'm3clks' into pydoc 2020-09-09 16:45:38 +02:00
52303daffd binaries in 2020-09-09 16:44:23 +02:00
02d4769f6a WIP 2020-09-09 16:39:48 +02:00
a9d1a78662 m3:smp_clk (timing rxr) changed back to clk div 5 2020-09-09 15:55:13 +02:00
3cf2160a2d binaries in 2020-09-09 15:25:48 +02:00
4917812bb0 Merge pull request #171 from slsdetectorgroup/rmMoenchAPI
Rm moench api
2020-09-09 15:22:30 +02:00
a0f9c6fe8c updated python API 2020-09-09 15:15:36 +02:00
82e978e901 WIP 2020-09-09 13:47:54 +02:00
04bf2aca6d Merge branch 'developer' into rmMoenchAPI 2020-09-09 13:45:19 +02:00
97687f0f6d binary in 2020-09-08 17:33:06 +02:00
bfbfe204f4 m3: default clocks changed 2020-09-08 17:31:44 +02:00
67d57eb5cd Merge branch 'updatemode' into m3trigger 2020-09-08 16:55:07 +02:00
f940c09290 Merge branch 'rmMoenchAPI' into updatemode 2020-09-08 16:54:44 +02:00
30293b1d36 Merge branch 'm3parallel' into rmMoenchAPI 2020-09-08 16:54:13 +02:00
87bad38f80 binary in 2020-09-08 15:46:32 +02:00
67f1f9924a m3:software trigger 2020-09-08 15:45:35 +02:00
e1e04ee755 binaries in 2020-09-08 15:18:07 +02:00
6e06d4307d WIP 2020-09-08 15:10:57 +02:00
20a959bf61 update mode to skip firmware checks and setupDetector, kernel check added to m3and g2 2020-09-08 15:08:45 +02:00
8e49a114db moench: removed api that goes only to processor (future: one has to use rX_jsonaddheader or rx_jsonpara to set key and values) 2020-09-08 12:34:56 +02:00
52 changed files with 675 additions and 652 deletions

View File

@ -41,11 +41,11 @@ hostname bchip074+bchip075+
r_readfreq 1 r_readfreq 1
rx_datastream 1 rx_zmqstream 1
#replace my_receiver_hostname with the hostname of 1Gb IP of the machine where the receiver runs #replace my_receiver_hostname with the hostname of 1Gb IP of the machine where the receiver runs
rx_hostname my_receiver_hostname rx_hostname my_receiver_hostname
rx_datastream 1 rx_zmqstream 1
outdir /tmp/ outdir /tmp/

View File

@ -459,8 +459,8 @@ rx_hostname mpc2011
tengiga 1 tengiga 1
rx_datastream 1 rx_zmqstream 1
rx_readfreq 1 rx_zmqfreq 1
dac 6 800 dac 6 800

View File

@ -35,7 +35,7 @@ zmqport 50001
tengiga 1 tengiga 1
rx_datastream 1 rx_zmqstream 1
@ -46,7 +46,7 @@ period 0.0006
############################################ ############################################
fpath /mnt/moench_data/scratch/ fpath /mnt/moench_data/scratch/
fwrite 0 fwrite 0
rx_datastream 1 rx_zmqstream 1
rx_jsonpara frameMode frame rx_jsonpara frameMode frame
rx_jsonpara detectorMode counting rx_jsonpara detectorMode counting

View File

@ -35,7 +35,7 @@ set( PYTHON_FILES
gotthard.py gotthard.py
gotthard2.py gotthard2.py
moench.py moench.py
jsonproxy.py proxy.py
ctb.py ctb.py
jungfrau.py jungfrau.py
mythen3.py mythen3.py

View File

@ -1,98 +0,0 @@
import subprocess
import locale
out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
cmd = out.stdout.splitlines()
cmd.pop(0)
from slsdet import Detector, Eiger, Ctb
pycmd = dir(Detector)+dir(Eiger)+dir(Ctb)
#Add commands that we should not expect as direct commands in python
pycmd += ['vrf', 'vtr', 'vrs', 'vtgstv', 'vsvn', 'vtrim',
'vsvp', 'vth1', 'vth2', 'vth3', 'vshaper', 'vshaperneg', 'rxb_rb',
'rxb_lb', 'vref_prech', 'vref_rstore', 'vref_cds',
'vpreamp', 'vref_comp', 'vref_comp_fe vref_ds', 'vref_h_adc',
'vref_l_adc', 'iodelay', 'list', 'vref_ds', 'vis', 'vpl',
'vref_comp_fe', 'vph', 'vout_cm', 'vcp', 'vcn', 'vcmp_ll', 'vcmp_lr'
]
# dacs are in general not included in the python commands and we expect to
# set them from the specialized class or using an enum
dacs = [
'vicin',
'vcassh',
'vcal_n',
'vcal_p'
'vipre_out',
'vipre_cds',
'vdd_prot',
'vcmp_rl',
'vcmp_rr',
'vcal', 'vcas',
'vipre',
'vin_com',
'vin_cm',
'vrshaper',
'vrshaper_n',
'vrpreamp',
'vishaper',
'vipre_out',
'vcom_adc1',
'vcom_adc2',
'vcom_cds',
'vdcsh',
'v_chip',
'vb_comp',
'vb_comp_adc',
'vb_comp_fe',
'vb_cs',
'vb_ds',
'vb_opa_1st',
'vb_opa_fd',
'vb_pixbuf',
'vb_sda',
'vbp_colbuf',
'vcal_p',
'vcasc_out',
'vcasc_sfp',
'vcascn_pb',
'vcascp_pb',
'vchip_comp_adc',
'vchip_comp_fe',
'vchip_cs',
'vchip_opa_1st',
'vchip_opa_fd',
'vchip_ref_comp_fe',
]
intentionally_missing = [
'temp_10ge', #temperatures already available from enum or specialized class
'temp_adc',
'temp_dcdc',
'temp_fpga',
'temp_fpgaext',
'temp_fpgafl',
'temp_fpgafr',
'temp_slowadc',
'temp_sodl',
'temp_sodr',
'trigger', #use sendSoftwareTrigger
'update', #use updateServerAndFirmare
'udp_validate', #use validateUdpConfiguration
'udp_reconfigure', #use reconfigureUdpDestination
'emin', #use rx_jsonpara
]
pycmd += intentionally_missing
pycmd += dacs
missing = []
for c in cmd:
if c not in pycmd:
print(c)
missing.append(c)
print(f'Missing: {len(missing)} commands')

View File

@ -0,0 +1,132 @@
import subprocess
import locale
out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
cmd = out.stdout.splitlines()
cmd.pop(0)
from slsdet import Detector
pycmd = dir(Detector)
# dacs are in general not included in the python commands and we expect to
# set them from the specialized class or using an enum
dacs = [
'adcvpp',
'iodelay',
'list',
'rxb_lb',
'rxb_rb',
'v_chip',
'vb_comp',
'vb_comp_adc',
'vb_comp_fe',
'vb_cs',
'vb_ds',
'vb_opa_1st',
'vb_opa_fd',
'vb_pixbuf',
'vb_sda',
'vbp_colbuf',
'vcal',
'vcal_n',
'vcal_p',
'vipre_out',
'vcas',
'vcasc_out',
'vcasc_sfp',
'vcascn_pb',
'vcascp_pb',
'vcassh',
'vchip_comp_adc',
'vchip_comp_fe',
'vchip_cs',
'vchip_opa_1st',
'vchip_opa_fd',
'vchip_ref_comp_fe',
'vcmp_ll',
'vcmp_lr',
'vcmp_rl',
'vcmp_rr',
'vcn',
'vcom_adc1',
'vcom_adc2',
'vcom_cds',
'vcp',
'vdcsh',
'vdd_prot',
'vicin',
'vin_cm',
'vin_com',
'vipre',
'vipre_cds',
'vipre_out',
'vishaper',
'vout_cm',
'vref_cds',
'vref_comp',
'vref_comp_fe',
'vref_ds',
'vref_h_adc',
'vref_l_adc',
'vref_prech',
'vref_rstore',
'vrpreamp',
'vrshaper',
'vrshaper_n',
'vsvn',
'vsvp',
'vtgstv',
'vth1',
'vth2',
'vth3',
'vtrim'
]
intentionally_missing = [
'activate', #use getActive and getRxPadDeactivatedMode syntax is not a good fit for python
'temp_10ge', #temperatures already available from enum or specialized class
'temp_adc',
'temp_dcdc',
'temp_fpga',
'temp_fpgaext',
'temp_fpgafl',
'temp_fpgafr',
'temp_slowadc',
'temp_sodl',
'temp_sodr',
'trigger', #use sendSoftwareTrigger
'update', #use updateServerAndFirmare
'udp_validate', #use validateUdpConfiguration
'udp_reconfigure', #use reconfigureUdpDestination
'pulse', # use pulseChip pulsePixel pulsePixelNmove
'pulsechip',
'pulsenmove',
]
pycmd += intentionally_missing
pycmd += dacs
missing = []
for c in cmd:
if c not in pycmd:
print(c)
missing.append(c)
print(f'\nMissing: {len(missing)} commands')
print(f'Excluded: {len(dacs)} dacs')
print(f'Excluded: {len(intentionally_missing)} other commands')
not_in_cmd = []
for c in pycmd:
if c.islower() and not c.startswith('_'):
if c not in cmd:
not_in_cmd.append(c)
print(f'\nCommands in Python and NOT in command line: {len(not_in_cmd)}')
for c in not_in_cmd:
print(c)
# print(',\n'.join([f'\'{d}\'' for d in sorted(dacs)]))

View File

@ -60,6 +60,23 @@ def get_arguments(node):
args = f", {args}" args = f", {args}"
return args return args
def get_arguments_with_default(node):
args = []
for arg in node.get_arguments():
tokens = [t.spelling for t in arg.get_tokens()]
print(tokens)
if '=' in tokens:
if arg.type.spelling == "sls::Positions": #TODO! automate
args.append("py::arg() = Positions{}")
else:
args.append('py::arg()' + ''.join(tokens[tokens.index('='):]))
else:
args.append('py::arg()')
args = ", ".join(args)
if args:
args = f", {args}"
return args
def get_fdec(node): def get_fdec(node):
args = [a.type.spelling for a in node.get_arguments()] args = [a.type.spelling for a in node.get_arguments()]
@ -86,7 +103,8 @@ def visit(node):
and child.access_specifier == cindex.AccessSpecifier.PUBLIC and child.access_specifier == cindex.AccessSpecifier.PUBLIC
): ):
m.append(child) m.append(child)
args = get_arguments(child) # args = get_arguments(child)
args = get_arguments_with_default(child)
fs = get_fdec(child) fs = get_fdec(child)
lines.append( lines.append(
f'.def("{child.spelling}",{fs} &Detector::{child.spelling}{args})' f'.def("{child.spelling}",{fs} &Detector::{child.spelling}{args})'

View File

@ -8,31 +8,12 @@ from .mythen3 import Mythen3
from .gotthard2 import Gotthard2 from .gotthard2 import Gotthard2
from .gotthard import Gotthard from .gotthard import Gotthard
from .moench import Moench from .moench import Moench
# from .jungfrau_ctb import JungfrauCTB
# from _slsdet import DetectorApi
import _slsdet import _slsdet
defs = _slsdet.slsDetectorDefs defs = _slsdet.slsDetectorDefs
from .enums import * from .enums import *
# 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
# masterFlags = _slsdet.slsDetectorDefs.masterFlags
# frameModeType = _slsdet.slsDetectorDefs.frameModeType
# detectorModeType = _slsdet.slsDetectorDefs.detectorModeType
# burstMode = _slsdet.slsDetectorDefs.burstMode
# timingSourceType = _slsdet.slsDetectorDefs.timingSourceType
IpAddr = _slsdet.IpAddr IpAddr = _slsdet.IpAddr

View File

@ -11,7 +11,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 . import utils as ut from . import utils as ut
from .jsonproxy import JsonProxy from .proxy import JsonProxy, SlowAdcProxy, ClkDivProxy
from .registers import Register, Adc_register from .registers import Register, Adc_register
import datetime as dt import datetime as dt
@ -68,6 +68,10 @@ class Detector(CppDetectorApi):
def __len__(self): def __len__(self):
return self.size() return self.size()
@property
def nmod(self):
return self.size()
def __repr__(self): def __repr__(self):
return "{}(id = {})".format(self.__class__.__name__, self.getShmId()) return "{}(id = {})".format(self.__class__.__name__, self.getShmId())
@ -140,6 +144,15 @@ class Detector(CppDetectorApi):
raise ValueError("hostname needs to be string or list of strings") raise ValueError("hostname needs to be string or list of strings")
@property
@element
def port(self):
return self.getControlPort()
@port.setter
def port(self, value):
ut.set_using_dict(self.setControlPort, value)
@property @property
@element @element
def stopport(self): def stopport(self):
@ -185,6 +198,10 @@ class Detector(CppDetectorApi):
def dr(self, dr): def dr(self, dr):
self.setDynamicRange(dr) self.setDynamicRange(dr)
@property
def drlist(self):
return self.getDynamicRangeList()
@property @property
def module_geometry(self): def module_geometry(self):
return to_geo(self.getModuleGeometry()) return to_geo(self.getModuleGeometry())
@ -195,7 +212,7 @@ class Detector(CppDetectorApi):
return element_if_equal(ms) return element_if_equal(ms)
@property @property
def detector_size(self): def detsize(self):
return to_geo(self.getDetectorSize()) return to_geo(self.getDetectorSize())
@property @property
@ -234,6 +251,25 @@ class Detector(CppDetectorApi):
def frames(self, n_frames): def frames(self, n_frames):
self.setNumberOfFrames(n_frames) self.setNumberOfFrames(n_frames)
@property
@element
def framesl(self):
return self.getNumberOfFramesLeft()
@property
@element
def nframes(self):
return self.getNumberOfFramesFromStart()
@property
@element
def powerchip(self):
return self.getPowerChip()
@powerchip.setter
def powerchip(self, value):
ut.set_using_dict(self.setPowerChip, value)
@property @property
def triggers(self): def triggers(self):
return element_if_equal(self.getNumberOfTriggers()) return element_if_equal(self.getNumberOfTriggers())
@ -572,13 +608,14 @@ class Detector(CppDetectorApi):
self.setFileFormat(format) self.setFileFormat(format)
@property @property
@element
def findex(self): def findex(self):
"""File or Acquisition index in receiver.""" """File or Acquisition index in receiver."""
return element_if_equal(self.getAcquisitionIndex()) return self.getAcquisitionIndex()
@findex.setter @findex.setter
def findex(self, index): def findex(self, index):
self.setAcquisitionIndex(index) ut.set_using_dict(self.setAcquisitionIndex, index)
@property @property
def fname(self): def fname(self):
@ -663,21 +700,22 @@ class Detector(CppDetectorApi):
# ZMQ Streaming Parameters (Receiver<->Client) # ZMQ Streaming Parameters (Receiver<->Client)
@property @property
def rx_datastream(self): @element
def rx_zmqstream(self):
""" """
Enable/ disable data streaming from receiver via zmq (eg. to GUI or to another process for further processing). \n Enable/ disable data streaming from receiver via zmq (eg. to GUI or to another process for further processing). \n
This creates/ destroys zmq streamer threads in receiver. \n This creates/ destroys zmq streamer threads in receiver. \n
Switching to Gui automatically enables data streaming in receiver. \n Switching to Gui automatically enables data streaming in receiver. \n
Switching back to command line acquire will require disabling data streaming in receiver for fast applications. Switching back to command line acquire will require disabling data streaming in receiver for fast applications.
""" """
return element_if_equal(self.getRxZmqDataStream()) return self.getRxZmqDataStream()
@rx_datastream.setter @rx_zmqstream.setter
def rx_zmqdatastream(self, enable): def rx_zmqstream(self, enable):
self.setRxZmqDataStream(enable) ut.set_using_dict(self.setRxZmqDataStream, enable)
@property @property
def rx_readfreq(self): def rx_zmqfreq(self):
"""Frequency of frames streamed out from receiver via zmq. """Frequency of frames streamed out from receiver via zmq.
Notes Notes
----- -----
@ -687,8 +725,8 @@ class Detector(CppDetectorApi):
""" """
return element_if_equal(self.getRxZmqFrequency()) return element_if_equal(self.getRxZmqFrequency())
@rx_readfreq.setter @rx_zmqfreq.setter
def rx_readfreq(self, nth_frame): def rx_zmqfreq(self, nth_frame):
self.setRxZmqFrequency(nth_frame) self.setRxZmqFrequency(nth_frame)
@property @property
@ -860,38 +898,6 @@ class Detector(CppDetectorApi):
def udp_dstport2(self, port): def udp_dstport2(self, port):
self.setDestinationUDPPort2(port) self.setDestinationUDPPort2(port)
@property
def src_udpmac(self):
return element_if_equal(self.getSourceUDPMAC())
@src_udpmac.setter
def src_udpmac(self, mac):
self.setSourceUDPMAC(MacAddr(mac))
@property
def src_udpip2(self):
return element_if_equal(self.getSourceUDPIP())
@src_udpip2.setter
def src_udpip2(self, ip):
self.setSourceUDPIP(IpAddr(ip))
@property
def src_udpip(self):
return element_if_equal(self.getSourceUDPIP())
@src_udpip.setter
def src_udpip(self, ip):
self.setSourceUDPIP(IpAddr(ip))
@property
def src_udpmac2(self):
return element_if_equal(self.getSourceUDPMAC2())
@src_udpmac2.setter
def src_udpmac2(self, mac):
self.setSourceUDPMAC2(MacAddr(mac))
@property @property
def highvoltage(self): def highvoltage(self):
"""High voltage to the sensor in Voltage. """High voltage to the sensor in Voltage.
@ -1013,6 +1019,10 @@ class Detector(CppDetectorApi):
""" """
return self._register return self._register
@property
def slowadc(self):
return SlowAdcProxy(self)
@property @property
def daclist(self): def daclist(self):
"""Gets the list of enums for every dac for this detector.""" """Gets the list of enums for every dac for this detector."""
@ -1184,23 +1194,27 @@ class Detector(CppDetectorApi):
return JsonProxy(self) return JsonProxy(self)
@rx_jsonpara.setter
def rx_jsonpara(self, args):
for key, value in args.items():
self.setAdditionalJsonParameter(key, str(value))
@property @property
@element @element
def rx_jsonaddheader(self): def rx_jsonaddheader(self):
return self.getAdditionalJsonHeader() return self.getAdditionalJsonHeader()
@rx_jsonaddheader.setter
def rx_jsonaddheader(self, args):
ut.set_using_dict(self.setAdditionalJsonHeader, args)
@property @property
def frameindex(self): def rx_frameindex(self):
return self.getRxCurrentFrameIndex() return self.getRxCurrentFrameIndex()
@property @property
def threshold(self): def threshold(self):
"""[Eiger] Threshold in eV
Note
----
To change settings as well or set threshold without trimbits, use setThresholdEnergy.
:setter: It loads trim files from settingspath.
"""
return element_if_equal(self.getThresholdEnergy()) return element_if_equal(self.getThresholdEnergy())
@threshold.setter @threshold.setter
@ -1209,6 +1223,15 @@ class Detector(CppDetectorApi):
@property @property
def timing(self): def timing(self):
"""
Set Timing Mode of detector. Enum: timingMode
Note
-----
Default: AUTO_TIMING \n
[Jungfrau][Gotthard][Ctb][Moench][Gotthard2] AUTO_TIMING, TRIGGER_EXPOSURE \n
[Mythen3] AUTO_TIMING, TRIGGER_EXPOSURE, GATED, TRIGGER_GATED \n
[Eiger] AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER
"""
return element_if_equal(self.getTimingMode()) return element_if_equal(self.getTimingMode())
@timing.setter @timing.setter
@ -1247,7 +1270,7 @@ class Detector(CppDetectorApi):
""" """
<<<Eiger>>> <<<-----------------------Eiger specific----------------------->>>
""" """
@ -1285,6 +1308,15 @@ class Detector(CppDetectorApi):
def subexptime(self, t): def subexptime(self, t):
ut.set_time_using_dict(self.setSubExptime, t) ut.set_time_using_dict(self.setSubExptime, t)
@property
@element
def readnlines(self):
return self.getPartialReadout()
@readnlines.setter
def readnlines(self, value):
ut.set_using_dict(self.setPartialReadout, value)
@property @property
def subdeadtime(self): def subdeadtime(self):
@ -1338,6 +1370,7 @@ class Detector(CppDetectorApi):
@property @property
def tengiga(self): def tengiga(self):
"""[Eiger][Ctb][Moench][Mythen3] 10GbE Enable."""
return element_if_equal(self.getTenGiga()) return element_if_equal(self.getTenGiga())
@tengiga.setter @tengiga.setter
@ -1424,6 +1457,12 @@ class Detector(CppDetectorApi):
def auto_comp_disable(self, value): def auto_comp_disable(self, value):
self.setAutoCompDisable(value) self.setAutoCompDisable(value)
@property
@element
def now(self):
return self.getActualTime()
@property @property
@element @element
def storagecells(self): def storagecells(self):
@ -1487,6 +1526,13 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def temp_threshold(self): def temp_threshold(self):
"""
[Jungfrau] Threshold temperature in degrees.
Note
-----
If temperature crosses threshold temperature and temperature control is enabled, power to chip will be switched off and temperature event occurs. \n
To power on chip again, temperature has to be less than threshold temperature and temperature event has to be cleared/reset.
"""
return self.getThresholdTemperature() return self.getThresholdTemperature()
@temp_threshold.setter @temp_threshold.setter
@ -1496,6 +1542,14 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def temp_event(self): def temp_event(self):
"""
[Jungfrau] 1, if a temperature event occured. \n
Note
----
If temperature crosses threshold temperature and temperature control is enabled, power to chip will be switched off and temperature event occurs. \n
To power on chip again, temperature has to be less than threshold temperature and temperature event has to be cleared/reset.
:setter: To clear the event, set it to 0.
"""
return self.getTemperatureEvent() return self.getTemperatureEvent()
@temp_event.setter @temp_event.setter
@ -1507,6 +1561,14 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def temp_control(self): def temp_control(self):
"""
[Jungfrau] Temperature control enable.
Note
-----
Default is 0 (disabled). \n
If temperature crosses threshold temperature and temperature control is enabled, power to chip will be switched off and temperature event occurs. \n
To power on chip again, temperature has to be less than threshold temperature and temperature event has to be cleared/reset.
"""
return self.getTemperatureControl() return self.getTemperatureControl()
@temp_control.setter @temp_control.setter
@ -1859,6 +1921,12 @@ class Detector(CppDetectorApi):
@property @property
def syncclk(self): def syncclk(self):
"""
[Ctb][Moench] Sync clock in MHz.
Note
-----
:setter: Not implemented
"""
return element_if_equal(self.getSYNCClock()) return element_if_equal(self.getSYNCClock())
@property @property
@ -2222,4 +2290,18 @@ class Detector(CppDetectorApi):
return self.getMeasuredCurrent(dacIndex.I_POWER_IO) return self.getMeasuredCurrent(dacIndex.I_POWER_IO)
@property
def clkdiv(self):
return ClkDivProxy(self)
"""
<<<-----------------------Gotthard specific----------------------->>>
"""
@property
def exptimel(self):
t = self.getExptimeLeft()
return reduce_time(t)

View File

@ -13,7 +13,5 @@ detectorSettings = _slsdet.slsDetectorDefs.detectorSettings
clockIndex = _slsdet.slsDetectorDefs.clockIndex clockIndex = _slsdet.slsDetectorDefs.clockIndex
readoutMode = _slsdet.slsDetectorDefs.readoutMode readoutMode = _slsdet.slsDetectorDefs.readoutMode
masterFlags = _slsdet.slsDetectorDefs.masterFlags masterFlags = _slsdet.slsDetectorDefs.masterFlags
frameModeType = _slsdet.slsDetectorDefs.frameModeType
detectorModeType = _slsdet.slsDetectorDefs.detectorModeType
burstMode = _slsdet.slsDetectorDefs.burstMode burstMode = _slsdet.slsDetectorDefs.burstMode
timingSourceType = _slsdet.slsDetectorDefs.timingSourceType timingSourceType = _slsdet.slsDetectorDefs.timingSourceType

View File

@ -1,30 +0,0 @@
from .utils import element_if_equal
class JsonProxy:
"""
Proxy class to allow for intuitive setting and getting of rx_jsonpara
This class is returned by Detectr.rx_jsonpara
"""
def __init__(self, det):
self.det = det
def __getitem__(self, key):
return element_if_equal(self.det.getAdditionalJsonParameter(key))
def __setitem__(self, key, value):
self.det.setAdditionalJsonParameter(key, str(value))
def __repr__(self):
r = element_if_equal(self.det.getAdditionalJsonHeader())
if isinstance(r, list):
rstr = ''
for i, list_item in enumerate(r):
list_item = dict(list_item)
rstr += ''.join([f'{i}:{key}: {value}\n' for key, value in list_item.items()])
return rstr.strip('\n')
else:
r = dict(r)
return '\n'.join([f'{key}: {value}' for key, value in r.items()])

85
python/slsdet/proxy.py Normal file
View File

@ -0,0 +1,85 @@
from .utils import element_if_equal
from .enums import dacIndex
def set_proxy_using_dict(func, key, value):
if isinstance(value, dict) and all(isinstance(k, int) for k in value.keys()):
for dkey, dvalue in value.items():
func(key, dvalue, [dkey])
else:
func(key, value)
class JsonProxy:
"""
Proxy class to allow for intuitive setting and getting of rx_jsonpara
This class is returned by Detectr.rx_jsonpara
"""
def __init__(self, det):
self.det = det
def __getitem__(self, key):
return element_if_equal(self.det.getAdditionalJsonParameter(key))
def __setitem__(self, key, value):
self.det.setAdditionalJsonParameter(key, str(value))
def __repr__(self):
r = element_if_equal(self.det.getAdditionalJsonHeader())
if isinstance(r, list):
rstr = ''
for i, list_item in enumerate(r):
list_item = dict(list_item)
rstr += ''.join([f'{i}:{key}: {value}\n' for key, value in list_item.items()])
return rstr.strip('\n')
else:
r = dict(r)
return '\n'.join([f'{key}: {value}' for key, value in r.items()])
class SlowAdcProxy:
"""
Proxy class to allow for more intuitive reading the slow ADCs
"""
def __init__(self, det):
self.det = det
def __getitem__(self, key):
dac_index = dacIndex(int(dacIndex.SLOW_ADC0)+key)
return element_if_equal(self.det.getSlowADC(dac_index))
def __repr__(self):
rstr = ''
for i in range(7):
r = element_if_equal(self.__getitem__(i))
if isinstance(r, list):
rstr += ' '.join(f'{item} mV' for item in r)
else:
rstr += f'{i}: {r} mV\n'
return rstr.strip('\n')
class ClkDivProxy:
"""
Proxy class to allow for more intuitive reading clockdivider
"""
def __init__(self, det):
self.det = det
def __getitem__(self, key):
return element_if_equal(self.det.getClockDivider(key))
def __setitem__(self, key, value):
set_proxy_using_dict(self.det.setClockDivider, key, value)
def __repr__(self):
rstr = ''
for i in range(6):
r = element_if_equal(self.__getitem__(i))
if isinstance(r, list):
rstr += ' '.join(f'{item}' for item in r)
else:
rstr += f'{i}: {r}\n'
return rstr.strip('\n')

View File

@ -111,14 +111,14 @@ def make_string_path(path):
def set_using_dict(func, args): def set_using_dict(func, args):
if isinstance(args, dict): if isinstance(args, dict) and all(isinstance(k, int) for k in args.keys()):
for key, value in args.items(): for key, value in args.items():
func(value, [key]) func(value, [key])
else: else:
func(args) func(args)
def set_time_using_dict(func, args): def set_time_using_dict(func, args):
if isinstance(args, dict): if isinstance(args, dict) and all(isinstance(k, int) for k in args.keys()):
for key, value in args.items(): for key, value in args.items():
if isinstance(value, int): if isinstance(value, int):
value = float(value) value = float(value)

View File

@ -322,11 +322,11 @@ void init_det(py::module &m) {
(Result<int>(Detector::*)(defs::dacIndex, bool, sls::Positions) (Result<int>(Detector::*)(defs::dacIndex, bool, sls::Positions)
const) & const) &
Detector::getDAC, Detector::getDAC,
py::arg(), py::arg(), py::arg() = Positions{}) py::arg(), py::arg() = false, py::arg() = Positions{})
.def("setDAC", .def("setDAC",
(void (Detector::*)(defs::dacIndex, int, bool, sls::Positions)) & (void (Detector::*)(defs::dacIndex, int, bool, sls::Positions)) &
Detector::setDAC, Detector::setDAC,
py::arg(), py::arg(), py::arg(), py::arg() = Positions{}) py::arg(), py::arg(), py::arg() = false, py::arg() = Positions{})
.def("getOnChipDAC", .def("getOnChipDAC",
(Result<int>(Detector::*)(defs::dacIndex, int, sls::Positions) (Result<int>(Detector::*)(defs::dacIndex, int, sls::Positions)
const) & const) &
@ -346,6 +346,14 @@ void init_det(py::module &m) {
sls::Positions)) & sls::Positions)) &
Detector::setExternalSignalFlags, Detector::setExternalSignalFlags,
py::arg(), py::arg(), py::arg() = Positions{}) py::arg(), py::arg(), py::arg() = Positions{})
.def("getParallelMode",
(Result<bool>(Detector::*)(sls::Positions) const) &
Detector::getParallelMode,
py::arg() = Positions{})
.def("setParallelMode",
(void (Detector::*)(bool, sls::Positions)) &
Detector::setParallelMode,
py::arg(), py::arg() = Positions{})
.def("acquire", (void (Detector::*)()) & Detector::acquire) .def("acquire", (void (Detector::*)()) & Detector::acquire)
.def("clearAcquiringFlag", .def("clearAcquiringFlag",
(void (Detector::*)()) & Detector::clearAcquiringFlag) (void (Detector::*)()) & Detector::clearAcquiringFlag)
@ -480,14 +488,14 @@ void init_det(py::module &m) {
py::arg() = Positions{}) py::arg() = Positions{})
.def("setDestinationUDPPort", .def("setDestinationUDPPort",
(void (Detector::*)(int, int)) & Detector::setDestinationUDPPort, (void (Detector::*)(int, int)) & Detector::setDestinationUDPPort,
py::arg(), py::arg()) py::arg(), py::arg() = -1)
.def("getDestinationUDPPort2", .def("getDestinationUDPPort2",
(Result<int>(Detector::*)(sls::Positions) const) & (Result<int>(Detector::*)(sls::Positions) const) &
Detector::getDestinationUDPPort2, Detector::getDestinationUDPPort2,
py::arg() = Positions{}) py::arg() = Positions{})
.def("setDestinationUDPPort2", .def("setDestinationUDPPort2",
(void (Detector::*)(int, int)) & Detector::setDestinationUDPPort2, (void (Detector::*)(int, int)) & Detector::setDestinationUDPPort2,
py::arg(), py::arg()) py::arg(), py::arg() = -1)
.def("reconfigureUDPDestination", .def("reconfigureUDPDestination",
(void (Detector::*)(sls::Positions)) & (void (Detector::*)(sls::Positions)) &
Detector::reconfigureUDPDestination, Detector::reconfigureUDPDestination,
@ -560,7 +568,7 @@ void init_det(py::module &m) {
Detector::getRxPort, Detector::getRxPort,
py::arg() = Positions{}) py::arg() = Positions{})
.def("setRxPort", (void (Detector::*)(int, int)) & Detector::setRxPort, .def("setRxPort", (void (Detector::*)(int, int)) & Detector::setRxPort,
py::arg(), py::arg()) py::arg(), py::arg() = -1)
.def("getRxFifoDepth", .def("getRxFifoDepth",
(Result<int>(Detector::*)(sls::Positions) const) & (Result<int>(Detector::*)(sls::Positions) const) &
Detector::getRxFifoDepth, Detector::getRxFifoDepth,
@ -722,7 +730,7 @@ void init_det(py::module &m) {
py::arg() = Positions{}) py::arg() = Positions{})
.def("setRxZmqPort", .def("setRxZmqPort",
(void (Detector::*)(int, int)) & Detector::setRxZmqPort, py::arg(), (void (Detector::*)(int, int)) & Detector::setRxZmqPort, py::arg(),
py::arg()) py::arg() = -1)
.def("getRxZmqIP", .def("getRxZmqIP",
(Result<sls::IpAddr>(Detector::*)(sls::Positions) const) & (Result<sls::IpAddr>(Detector::*)(sls::Positions) const) &
Detector::getRxZmqIP, Detector::getRxZmqIP,
@ -737,7 +745,7 @@ void init_det(py::module &m) {
py::arg() = Positions{}) py::arg() = Positions{})
.def("setClientZmqPort", .def("setClientZmqPort",
(void (Detector::*)(int, int)) & Detector::setClientZmqPort, (void (Detector::*)(int, int)) & Detector::setClientZmqPort,
py::arg(), py::arg()) py::arg(), py::arg() = -1)
.def("getClientZmqIp", .def("getClientZmqIp",
(Result<sls::IpAddr>(Detector::*)(sls::Positions) const) & (Result<sls::IpAddr>(Detector::*)(sls::Positions) const) &
Detector::getClientZmqIp, Detector::getClientZmqIp,
@ -770,7 +778,8 @@ void init_det(py::module &m) {
(void (Detector::*)(int, defs::detectorSettings, bool, (void (Detector::*)(int, defs::detectorSettings, bool,
sls::Positions)) & sls::Positions)) &
Detector::setThresholdEnergy, Detector::setThresholdEnergy,
py::arg(), py::arg(), py::arg(), py::arg() = Positions{}) py::arg(), py::arg() = defs::STANDARD, py::arg() = true,
py::arg() = Positions{})
.def("getSettingsPath", .def("getSettingsPath",
(Result<std::string>(Detector::*)(sls::Positions) const) & (Result<std::string>(Detector::*)(sls::Positions) const) &
Detector::getSettingsPath, Detector::getSettingsPath,
@ -779,14 +788,6 @@ void init_det(py::module &m) {
(void (Detector::*)(const std::string &, sls::Positions)) & (void (Detector::*)(const std::string &, sls::Positions)) &
Detector::setSettingsPath, Detector::setSettingsPath,
py::arg(), py::arg() = Positions{}) py::arg(), py::arg() = Positions{})
.def("getParallelMode",
(Result<bool>(Detector::*)(sls::Positions) const) &
Detector::getParallelMode,
py::arg() = Positions{})
.def("setParallelMode",
(void (Detector::*)(bool, sls::Positions)) &
Detector::setParallelMode,
py::arg(), py::arg() = Positions{})
.def("getOverFlowMode", .def("getOverFlowMode",
(Result<bool>(Detector::*)(sls::Positions) const) & (Result<bool>(Detector::*)(sls::Positions) const) &
Detector::getOverFlowMode, Detector::getOverFlowMode,
@ -1344,31 +1345,6 @@ void init_det(py::module &m) {
sls::Positions)) & sls::Positions)) &
Detector::setAdditionalJsonParameter, Detector::setAdditionalJsonParameter,
py::arg(), py::arg(), py::arg() = Positions{}) py::arg(), py::arg(), py::arg() = Positions{})
.def("getDetectorMinMaxEnergyThreshold",
(Result<int>(Detector::*)(const bool, sls::Positions) const) &
Detector::getDetectorMinMaxEnergyThreshold,
py::arg(), py::arg() = Positions{})
.def("setDetectorMinMaxEnergyThreshold",
(void (Detector::*)(const bool, const int, sls::Positions)) &
Detector::setDetectorMinMaxEnergyThreshold,
py::arg(), py::arg(), py::arg() = Positions{})
.def("getFrameMode",
(Result<defs::frameModeType>(Detector::*)(sls::Positions) const) &
Detector::getFrameMode,
py::arg() = Positions{})
.def("setFrameMode",
(void (Detector::*)(defs::frameModeType, sls::Positions)) &
Detector::setFrameMode,
py::arg(), py::arg() = Positions{})
.def("getDetectorMode",
(Result<defs::detectorModeType>(Detector::*)(sls::Positions)
const) &
Detector::getDetectorMode,
py::arg() = Positions{})
.def("setDetectorMode",
(void (Detector::*)(defs::detectorModeType, sls::Positions)) &
Detector::setDetectorMode,
py::arg(), py::arg() = Positions{})
.def("programFPGA", .def("programFPGA",
(void (Detector::*)(const std::string &, sls::Positions)) & (void (Detector::*)(const std::string &, sls::Positions)) &
Detector::programFPGA, Detector::programFPGA,

View File

@ -259,20 +259,6 @@ void init_enums(py::module &m) {
.value("IS_SLAVE", slsDetectorDefs::masterFlags::IS_SLAVE) .value("IS_SLAVE", slsDetectorDefs::masterFlags::IS_SLAVE)
.export_values(); .export_values();
py::enum_<slsDetectorDefs::frameModeType>(Defs, "frameModeType")
.value("PEDESTAL", slsDetectorDefs::frameModeType::PEDESTAL)
.value("NEW_PEDESTAL", slsDetectorDefs::frameModeType::NEW_PEDESTAL)
.value("FLATFIELD", slsDetectorDefs::frameModeType::FLATFIELD)
.value("NEW_FLATFIELD", slsDetectorDefs::frameModeType::NEW_FLATFIELD)
.export_values();
py::enum_<slsDetectorDefs::detectorModeType>(Defs, "detectorModeType")
.value("COUNTING", slsDetectorDefs::detectorModeType::COUNTING)
.value("INTERPOLATING",
slsDetectorDefs::detectorModeType::INTERPOLATING)
.value("ANALOG", slsDetectorDefs::detectorModeType::ANALOG)
.export_values();
py::enum_<slsDetectorDefs::burstMode>(Defs, "burstMode") py::enum_<slsDetectorDefs::burstMode>(Defs, "burstMode")
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL) .value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL) .value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)

View File

@ -379,15 +379,15 @@ def test_set_readout_clock_3(d, mocker):
d.readout_clock = 'Super Slow Speed' d.readout_clock = 'Super Slow Speed'
m.assert_called_once_with(3) m.assert_called_once_with(3)
#----------------------------------------------------------------rx_datastream #----------------------------------------------------------------rx_zmqstream
def test_get_rx_datastream(d, mocker): def test_get_rx_zmqstream(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getRxDataStreamStatus') m = mocker.patch('_slsdet.DetectorApi.getRxDataStreamStatus')
m.return_value = False m.return_value = False
assert d.rx_datastream == False assert d.rx_zmqstream == False
def test_set_rx_datastream(d, mocker): def test_set_rx_zmqstream(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setRxDataStreamStatus') m = mocker.patch('_slsdet.DetectorApi.setRxDataStreamStatus')
d.rx_datastream = True d.rx_zmqstream = True
m.assert_called_once_with(True) m.assert_called_once_with(True)
def test_get_rx_zmqip(d, mocker): def test_get_rx_zmqip(d, mocker):

View File

@ -412,15 +412,15 @@ def test_set_counters_single(d, mocker):
# d.readout_clock = 'Super Slow Speed' # d.readout_clock = 'Super Slow Speed'
# m.assert_called_once_with(3) # m.assert_called_once_with(3)
# #----------------------------------------------------------------rx_datastream # #----------------------------------------------------------------rx_zmqstream
# def test_get_rx_datastream(d, mocker): # def test_get_rx_zmqstream(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getRxDataStreamStatus') # m = mocker.patch('_slsdet.DetectorApi.getRxDataStreamStatus')
# m.return_value = False # m.return_value = False
# assert d.rx_datastream == False # assert d.rx_zmqstream == False
# def test_set_rx_datastream(d, mocker): # def test_set_rx_zmqstream(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setRxDataStreamStatus') # m = mocker.patch('_slsdet.DetectorApi.setRxDataStreamStatus')
# d.rx_datastream = True # d.rx_zmqstream = True
# m.assert_called_once_with(True) # m.assert_called_once_with(True)
# def test_get_rx_zmqip(d, mocker): # def test_get_rx_zmqip(d, mocker):

View File

@ -23,6 +23,7 @@
// Global variable from slsDetectorServer_funcs // Global variable from slsDetectorServer_funcs
extern int debugflag; extern int debugflag;
extern int updateFlag;
extern udpStruct udpDetails; extern udpStruct udpDetails;
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
@ -105,7 +106,8 @@ void basictests() {
} }
// does check only if flag is 0 (by default), set by command line // does check only if flag is 0 (by default), set by command line
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) || if ((!debugflag) && (!updateFlag) &&
((checkType() == FAIL) || (testFpga() == FAIL) ||
(testBus() == FAIL))) { (testBus() == FAIL))) {
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. " strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
"Dangerous to continue.\n"); "Dangerous to continue.\n");
@ -145,7 +147,7 @@ void basictests() {
(long long int)client_sw_apiversion)); (long long int)client_sw_apiversion));
// return if flag is not zero, debug mode // return if flag is not zero, debug mode
if (debugflag) { if (debugflag || updateFlag) {
return; return;
} }
@ -417,7 +419,7 @@ uint32_t getDetectorIP() {
/* initialization */ /* initialization */
void initControlServer() { void initControlServer() {
if (initError == OK) { if (!updateFlag && initError == OK) {
setupDetector(); setupDetector();
} }
initCheckDone = 1; initCheckDone = 1;

View File

@ -20,6 +20,7 @@
// Global variable from slsDetectorServer_funcs // Global variable from slsDetectorServer_funcs
extern int debugflag; extern int debugflag;
extern int updateFlag;
extern udpStruct udpDetails; extern udpStruct udpDetails;
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
@ -140,7 +141,7 @@ void basictests() {
return; return;
#endif #endif
// return if debugflag is not zero, debug mode // return if debugflag is not zero, debug mode
if (debugflag) { if (debugflag || updateFlag) {
return; return;
} }
@ -319,7 +320,7 @@ u_int32_t getDetectorIP() {
void initControlServer() { void initControlServer() {
LOG(logINFOBLUE, ("Configuring Control server\n")); LOG(logINFOBLUE, ("Configuring Control server\n"));
if (initError == OK) { if (!updateFlag && initError == OK) {
readDetectorNumber(); readDetectorNumber();
getModuleConfiguration(); getModuleConfiguration();
#ifndef VIRTUAL #ifndef VIRTUAL

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#define REQUIRED_FIRMWARE_VERSION (26) #define REQUIRED_FIRMWARE_VERSION (27)
#define IDFILECOMMAND "more /home/root/executables/detid.txt" #define IDFILECOMMAND "more /home/root/executables/detid.txt"
#define CONFIG_FILE ("config_eiger.txt") #define CONFIG_FILE ("config_eiger.txt")
#define WAIT_STOP_SERVER_START (1 * 1000 * 1000) #define WAIT_STOP_SERVER_START (1 * 1000 * 1000)

View File

@ -22,6 +22,7 @@
// Global variable from slsDetectorServer_funcs // Global variable from slsDetectorServer_funcs
extern int debugflag; extern int debugflag;
extern int updateFlag;
extern int checkModuleFlag; extern int checkModuleFlag;
extern udpStruct udpDetails; extern udpStruct udpDetails;
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
@ -92,8 +93,9 @@ void basictests() {
return; return;
} }
// does check only if flag is 0 (by default), set by command line // does check only if flag is 0 (by default), set by command line
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) || if ((!debugflag) && (!updateFlag) &&
(testBus() == FAIL))) { ((checkKernelVersion() == FAIL) || (checkType() == FAIL) ||
(testFpga() == FAIL) || (testBus() == FAIL))) {
sprintf(initErrorMessage, sprintf(initErrorMessage,
"Could not pass basic tests of FPGA and bus. Dangerous to " "Could not pass basic tests of FPGA and bus. Dangerous to "
"continue. (Firmware version:0x%llx) \n", "continue. (Firmware version:0x%llx) \n",
@ -131,7 +133,7 @@ void basictests() {
(long long int)client_sw_apiversion)); (long long int)client_sw_apiversion));
// return if flag is not zero, debug mode // return if flag is not zero, debug mode
if (debugflag) { if (debugflag || updateFlag) {
return; return;
} }
@ -175,6 +177,13 @@ void basictests() {
#endif #endif
} }
int checkKernelVersion() {
#ifdef VIRTUAL
return OK;
#endif
return Nios_checkKernelVersion(KERNEL_DATE_VRSN);
}
int checkType() { int checkType() {
#ifdef VIRTUAL #ifdef VIRTUAL
return OK; return OK;
@ -326,7 +335,7 @@ u_int32_t getDetectorIP() {
/* initialization */ /* initialization */
void initControlServer() { void initControlServer() {
if (initError == OK) { if (!updateFlag && initError == OK) {
setupDetector(); setupDetector();
} }
initCheckDone = 1; initCheckDone = 1;

View File

@ -2,6 +2,7 @@
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#define REQRD_FRMWRE_VRSN (0x200707) #define REQRD_FRMWRE_VRSN (0x200707)
#define KERNEL_DATE_VRSN "Wed May 20 13:58:38 CEST 2020"
#define CTRL_SRVR_INIT_TIME_US (300 * 1000) #define CTRL_SRVR_INIT_TIME_US (300 * 1000)

View File

@ -18,6 +18,9 @@
#include <time.h> #include <time.h>
#endif #endif
// Global variable from slsDetectorServer_funcs
extern int debugflag;
extern int updateFlag;
extern udpStruct udpDetails; extern udpStruct udpDetails;
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
@ -91,7 +94,8 @@ void basictests() {
} }
// does check only if flag is 0 (by default), set by command line // does check only if flag is 0 (by default), set by command line
if (((checkType() == FAIL) || (testFpga() == FAIL) || if ((!debugflag) && (!updateFlag) &&
((checkType() == FAIL) || (testFpga() == FAIL) ||
(testBus() == FAIL))) { (testBus() == FAIL))) {
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. " strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
"Dangerous to continue.\n"); "Dangerous to continue.\n");
@ -125,7 +129,9 @@ void basictests() {
(long long int)fwversion, (long long int)swversion, (long long int)fwversion, (long long int)swversion,
(long long int)client_sw_apiversion)); (long long int)client_sw_apiversion));
if (!debugflag || updateFlag) {
LOG(logINFO, ("Basic Tests - success\n")); LOG(logINFO, ("Basic Tests - success\n"));
}
#endif #endif
} }
@ -343,7 +349,7 @@ u_int32_t getBoardRevision() {
/* initialization */ /* initialization */
void initControlServer() { void initControlServer() {
if (initError == OK) { if (!updateFlag && initError == OK) {
setupDetector(); setupDetector();
} }
initCheckDone = 1; initCheckDone = 1;

View File

@ -22,6 +22,7 @@
// Global variable from slsDetectorServer_funcs // Global variable from slsDetectorServer_funcs
extern int debugflag; extern int debugflag;
extern int updateFlag;
extern udpStruct udpDetails; extern udpStruct udpDetails;
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
@ -77,7 +78,8 @@ void basictests() {
} }
// does check only if flag is 0 (by default), set by command line // does check only if flag is 0 (by default), set by command line
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) || if ((!debugflag) && (!updateFlag) &&
((checkType() == FAIL) || (testFpga() == FAIL) ||
(testBus() == FAIL))) { (testBus() == FAIL))) {
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. " strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
"Dangerous to continue.\n"); "Dangerous to continue.\n");
@ -119,7 +121,7 @@ void basictests() {
(long long int)client_sw_apiversion)); (long long int)client_sw_apiversion));
// return if flag is not zero, debug mode // return if flag is not zero, debug mode
if (debugflag) { if (debugflag || updateFlag) {
return; return;
} }
@ -347,7 +349,7 @@ u_int32_t getDetectorIP() {
/* initialization */ /* initialization */
void initControlServer() { void initControlServer() {
if (initError == OK) { if (!updateFlag && initError == OK) {
setupDetector(); setupDetector();
} }
initCheckDone = 1; initCheckDone = 1;

View File

@ -21,6 +21,7 @@
// Global variable from slsDetectorServer_funcs // Global variable from slsDetectorServer_funcs
extern int debugflag; extern int debugflag;
extern int updateFlag;
extern udpStruct udpDetails; extern udpStruct udpDetails;
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
@ -101,7 +102,8 @@ void basictests() {
} }
// does check only if flag is 0 (by default), set by command line // does check only if flag is 0 (by default), set by command line
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) || if ((!debugflag) && (!updateFlag) &&
((checkType() == FAIL) || (testFpga() == FAIL) ||
(testBus() == FAIL))) { (testBus() == FAIL))) {
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. " strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
"Dangerous to continue.\n"); "Dangerous to continue.\n");
@ -141,7 +143,7 @@ void basictests() {
(long long int)client_sw_apiversion)); (long long int)client_sw_apiversion));
// return if flag is not zero, debug mode // return if flag is not zero, debug mode
if (debugflag) { if (debugflag || updateFlag) {
return; return;
} }
@ -413,7 +415,7 @@ uint32_t getDetectorIP() {
/* initialization */ /* initialization */
void initControlServer() { void initControlServer() {
if (initError == OK) { if (!updateFlag && initError == OK) {
setupDetector(); setupDetector();
} }
initCheckDone = 1; initCheckDone = 1;

View File

@ -129,6 +129,10 @@
#define CONTROL_STP_ACQSTN_MSK (0x00000001 << CONTROL_STP_ACQSTN_OFST) #define CONTROL_STP_ACQSTN_MSK (0x00000001 << CONTROL_STP_ACQSTN_OFST)
#define CONTROL_STRT_PATTERN_OFST (2) #define CONTROL_STRT_PATTERN_OFST (2)
#define CONTROL_STRT_PATTERN_MSK (0x00000001 << CONTROL_STRT_PATTERN_OFST) #define CONTROL_STRT_PATTERN_MSK (0x00000001 << CONTROL_STRT_PATTERN_OFST)
#define CONTROL_STRT_READOUT_OFST (3) // not connected in software yet
#define CONTROL_STRT_READOUT_MSK (0x00000001 << CONTROL_STRT_READOUT_OFST)
#define CONTROL_STRT_SW_TRIGGER_OFST (4)
#define CONTROL_STRT_SW_TRIGGER_MSK (0x00000001 << CONTROL_STRT_SW_TRIGGER_OFST)
#define CONTROL_CRE_RST_OFST (10) #define CONTROL_CRE_RST_OFST (10)
#define CONTROL_CRE_RST_MSK (0x00000001 << CONTROL_CRE_RST_OFST) #define CONTROL_CRE_RST_MSK (0x00000001 << CONTROL_CRE_RST_OFST)
#define CONTROL_PRPHRL_RST_OFST (11) // Only GBE10? #define CONTROL_PRPHRL_RST_OFST (11) // Only GBE10?

View File

@ -21,6 +21,7 @@
// Global variable from slsDetectorServer_funcs // Global variable from slsDetectorServer_funcs
extern int debugflag; extern int debugflag;
extern int updateFlag;
extern int checkModuleFlag; extern int checkModuleFlag;
extern udpStruct udpDetails; extern udpStruct udpDetails;
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
@ -80,8 +81,9 @@ void basictests() {
return; return;
} }
// does check only if flag is 0 (by default), set by command line // does check only if flag is 0 (by default), set by command line
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) || if ((!debugflag) && (!updateFlag) &&
(testBus() == FAIL))) { ((checkKernelVersion() == FAIL) || (checkType() == FAIL) ||
(testFpga() == FAIL) || (testBus() == FAIL))) {
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. " strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
"Dangerous to continue.\n"); "Dangerous to continue.\n");
LOG(logERROR, ("%s\n\n", initErrorMessage)); LOG(logERROR, ("%s\n\n", initErrorMessage));
@ -117,7 +119,7 @@ void basictests() {
(long long int)client_sw_apiversion)); (long long int)client_sw_apiversion));
// return if flag is not zero, debug mode // return if flag is not zero, debug mode
if (debugflag) { if (debugflag || updateFlag) {
return; return;
} }
@ -161,6 +163,13 @@ void basictests() {
#endif #endif
} }
int checkKernelVersion() {
#ifdef VIRTUAL
return OK;
#endif
return Nios_checkKernelVersion(KERNEL_DATE_VRSN);
}
int checkType() { int checkType() {
#ifdef VIRTUAL #ifdef VIRTUAL
return OK; return OK;
@ -313,7 +322,7 @@ u_int32_t getDetectorIP() {
/* initialization */ /* initialization */
void initControlServer() { void initControlServer() {
if (initError == OK) { if (!updateFlag && initError == OK) {
setupDetector(); setupDetector();
} }
initCheckDone = 1; initCheckDone = 1;
@ -2297,6 +2306,12 @@ int stopStateMachine() {
return OK; return OK;
} }
int softwareTrigger() {
LOG(logINFO, ("Sending Software Trigger\n"));
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STRT_SW_TRIGGER_MSK);
return OK;
}
enum runStatus getRunStatus() { enum runStatus getRunStatus() {
LOG(logDEBUG1, ("Getting status\n")); LOG(logDEBUG1, ("Getting status\n"));
// scan error or running // scan error or running

View File

@ -2,6 +2,7 @@
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#define REQRD_FRMWRE_VRSN 0x190000 #define REQRD_FRMWRE_VRSN 0x190000
#define KERNEL_DATE_VRSN "Wed May 20 13:58:38 CEST 2020"
#define CTRL_SRVR_INIT_TIME_US (300 * 1000) #define CTRL_SRVR_INIT_TIME_US (300 * 1000)
@ -36,12 +37,14 @@
#define DEFAULT_DELAY_AFTER_TRIGGER (0) #define DEFAULT_DELAY_AFTER_TRIGGER (0)
#define DEFAULT_HIGH_VOLTAGE (0) #define DEFAULT_HIGH_VOLTAGE (0)
#define DEFAULT_TIMING_MODE (AUTO_TIMING) #define DEFAULT_TIMING_MODE (AUTO_TIMING)
#define DEFAULT_READOUT_C0 (8) //(125000000) // rdo_clk, 125 MHz #define DEFAULT_READOUT_C0 (10) //(100000000) // rdo_clk, 100 MHz
#define DEFAULT_READOUT_C1 (8) //(125000000) // rdo_x2_clk, 125 MHz #define DEFAULT_READOUT_C1 (10) //(100000000) // smp sample clk (x2), 100 MHz
#define DEFAULT_SYSTEM_C0 (4) //(250000000) // run_clk, 250 MHz #define DEFAULT_SYSTEM_C0 (20) // (50000000) // run_clk, 50 MHz
#define DEFAULT_SYSTEM_C1 (8) //(125000000) // sync_clk, 125 MHz #define DEFAULT_SYSTEM_C1 (10) //(100000000) // sync_clk, 100 MHz
#define DEFAULT_SYSTEM_C2 (8) //(125000000) // str_clk, 125 MHz #define DEFAULT_SYSTEM_C2 (10) //(100000000) // str_clk, 100 MHz
#define DEFAULT_SYSTEM_C3 (5) //(200000000) // smp_clk, 200 MHz (only for timing receiver) #define DEFAULT_SYSTEM_C3 (5) //(200000000) // smp_clk, 200 MHz
// (DEFAULT_SYSTEM_C3 only for timing receiver) should not be changed
#define DEFAULT_ASIC_LATCHING_NUM_PULSES (10) #define DEFAULT_ASIC_LATCHING_NUM_PULSES (10)
#define DEFAULT_MSTR_OTPT_P1_NUM_PULSES (20) #define DEFAULT_MSTR_OTPT_P1_NUM_PULSES (20)
@ -110,7 +113,8 @@ enum CLKINDEX {
NUM_CLOCKS NUM_CLOCKS
}; };
#define CLK_NAMES \ #define CLK_NAMES \
"READOUT_C0", "READOUT_C1", "SYSTEM_C0", "SYSTEM_C1", "SYSTEM_C2", "SYSTEM_C3" "READOUT_C0", "READOUT_C1", "SYSTEM_C0", "SYSTEM_C1", "SYSTEM_C2", \
"SYSTEM_C3"
enum PLLINDEX { READOUT_PLL, SYSTEM_PLL }; enum PLLINDEX { READOUT_PLL, SYSTEM_PLL };
/* Struct Definitions */ /* Struct Definitions */

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <stdio.h> #include <stdio.h>
#include <time.h>
/** /**
* Convert a value from a range to a different range (eg voltage to dac or vice * Convert a value from a range to a different range (eg voltage to dac or vice
@ -17,3 +18,5 @@ int ConvertToDifferentRange(int inputMin, int inputMax, int outputMin,
int outputMax, int inputValue, int *outputValue); int outputMax, int inputValue, int *outputValue);
int getAbsPath(char *buf, size_t bufSize, char *fname); int getAbsPath(char *buf, size_t bufSize, char *fname);
int GetTimeFromString(char *buf, time_t *result);

View File

@ -87,3 +87,7 @@ int mapCSP0(void);
* Get Nios base address * Get Nios base address
*/ */
u_int32_t *Nios_getBaseAddress(); u_int32_t *Nios_getBaseAddress();
/** check kernel version against expected version string (complain if too old)
* @returns OK or FAIL */
int Nios_checkKernelVersion(char *expectedVersion);

View File

@ -56,6 +56,9 @@ typedef struct udpStruct_s {
int isInitCheckDone(); int isInitCheckDone();
int getInitResult(char **mess); int getInitResult(char **mess);
void basictests(); void basictests();
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
int checkKernelVersion();
#endif
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || \ #if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || \
defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D) defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
int checkType(); int checkType();
@ -554,7 +557,7 @@ int startStateMachine();
void *start_timer(void *arg); void *start_timer(void *arg);
#endif #endif
int stopStateMachine(); int stopStateMachine();
#ifdef EIGERD #if defined(EIGERD) || defined(MYTHEN3D)
int softwareTrigger(); int softwareTrigger();
#endif #endif

View File

@ -1,3 +1,4 @@
#define _GNU_SOURCE // needed for strptime to be at the top
#include "common.h" #include "common.h"
#include "clogger.h" #include "clogger.h"
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
@ -60,3 +61,12 @@ int getAbsPath(char *buf, size_t bufSize, char *fname) {
LOG(logDEBUG1, ("full path for %s: %s\n", fname, buf)); LOG(logDEBUG1, ("full path for %s: %s\n", fname, buf));
return OK; return OK;
} }
int GetTimeFromString(char *buf, time_t *result) {
struct tm t;
if (NULL == strptime(buf, "%a %b %d %H:%M:%S %Z %Y", &t)) {
return FAIL;
}
*result = mktime(&t);
return OK;
}

View File

@ -2,10 +2,13 @@
#include "RegisterDefs.h" #include "RegisterDefs.h"
#include "ansi.h" #include "ansi.h"
#include "clogger.h" #include "clogger.h"
#include "common.h"
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#include <fcntl.h> // open #include <fcntl.h> // open
#include <string.h>
#include <sys/mman.h> // mmap #include <sys/mman.h> // mmap
#include <sys/utsname.h> // uname
/* global variables */ /* global variables */
u_int32_t *csp0base = 0; u_int32_t *csp0base = 0;
@ -127,3 +130,49 @@ int mapCSP0(void) {
} }
u_int32_t *Nios_getBaseAddress() { return csp0base; } u_int32_t *Nios_getBaseAddress() { return csp0base; }
int Nios_checkKernelVersion(char *expectedVersion) {
// extract kernel date string
struct utsname buf;
if (uname(&buf) == -1) {
LOG(logERROR, ("Could not get kernel version\n"));
return FAIL;
}
// remove first word (#version number)
const char *ptr = strchr(buf.version, ' ');
if (ptr == NULL) {
LOG(logERROR, ("Could not parse kernel version\n"));
return FAIL;
}
char output[256];
memset(output, 0, 256);
strcpy(output, buf.version + (ptr - buf.version + 1));
// convert kernel date string into time
time_t kernelDate;
if (GetTimeFromString(output, &kernelDate) == FAIL) {
LOG(logERROR, ("Could not parse retrieved kernel date, %s\n", output));
return FAIL;
}
// convert expected date into time
time_t expDate;
if (GetTimeFromString(expectedVersion, &expDate) == FAIL) {
LOG(logERROR,
("Could not parse expected kernel date, %s\n", expectedVersion));
return FAIL;
}
// compare if kernel time is older than expected time
if (kernelDate < expDate) {
LOG(logERROR, ("Kernel Version Incompatible (too old)! Expected: [%s], "
"Got [%s]\n",
expectedVersion, output));
return FAIL;
}
LOG(logINFOBLUE, ("Kernel Version Compatible: %s [min.: %s]\n", output,
expectedVersion));
return OK;
}

View File

@ -21,6 +21,7 @@ extern int ret;
// Global variables from slsDetectorServer_funcs // Global variables from slsDetectorServer_funcs
extern int sockfd; extern int sockfd;
extern int debugflag; extern int debugflag;
extern int updateFlag;
extern int checkModuleFlag; extern int checkModuleFlag;
// Global variables from slsDetectorFunctionList // Global variables from slsDetectorFunctionList
@ -41,6 +42,7 @@ int main(int argc, char *argv[]) {
int portno = DEFAULT_PORTNO; int portno = DEFAULT_PORTNO;
isControlServer = 1; isControlServer = 1;
debugflag = 0; debugflag = 0;
updateFlag = 0;
checkModuleFlag = 1; checkModuleFlag = 1;
int version = 0; int version = 0;
@ -53,10 +55,12 @@ int main(int argc, char *argv[]) {
"Possible arguments are:\n" "Possible arguments are:\n"
"\t-v, --version : Software version\n" "\t-v, --version : Software version\n"
"\t-p, --port <port> : TCP communication port with client. \n" "\t-p, --port <port> : TCP communication port with client. \n"
"\t-d, --devel : Developer mode. Skips firmware checks. \n"
"\t-g, --nomodule : [Mythen3][Gotthard2] Generic or No " "\t-g, --nomodule : [Mythen3][Gotthard2] Generic or No "
"Module mode. Skips detector type checks. \n" "Module mode. Skips detector type checks. \n"
"\t-f, --phaseshift <value> : [Gotthard] only. Sets phase shift. \n" "\t-f, --phaseshift <value> : [Gotthard] only. Sets phase shift. \n"
"\t-d, --devel : Developer mode. Skips firmware checks. \n"
"\t-u, --update : Update mode. Skips firmware checks and "
"initial detector setup. \n"
"\t-s, --stopserver : Stop server. Do not use as created by " "\t-s, --stopserver : Stop server. Do not use as created by "
"control server \n\n", "control server \n\n",
argv[0]); argv[0]);
@ -68,9 +72,10 @@ int main(int argc, char *argv[]) {
{"help", no_argument, NULL, 'h'}, {"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'v'},
{"port", required_argument, NULL, 'p'}, {"port", required_argument, NULL, 'p'},
{"devel", no_argument, NULL, 'd'},
{"phaseshift", required_argument, NULL, 'f'}, {"phaseshift", required_argument, NULL, 'f'},
{"nomodule", no_argument, NULL, 'g'}, // generic {"nomodule", no_argument, NULL, 'g'}, // generic
{"devel", no_argument, NULL, 'd'},
{"update", no_argument, NULL, 'u'},
{"stopserver", no_argument, NULL, 's'}, {"stopserver", no_argument, NULL, 's'},
{NULL, 0, NULL, 0}}; {NULL, 0, NULL, 0}};
@ -80,7 +85,7 @@ int main(int argc, char *argv[]) {
int c = 0; int c = 0;
while (c != -1) { while (c != -1) {
c = getopt_long(argc, argv, "hvp:df:gs", long_options, &option_index); c = getopt_long(argc, argv, "hvp:f:gdus", long_options, &option_index);
// Detect the end of the options // Detect the end of the options
if (c == -1) if (c == -1)
@ -116,11 +121,6 @@ int main(int argc, char *argv[]) {
LOG(logINFO, ("Detected port: %d\n", portno)); LOG(logINFO, ("Detected port: %d\n", portno));
break; break;
case 'd':
LOG(logINFO, ("Detected developer mode\n"));
debugflag = 1;
break;
case 'f': case 'f':
#ifndef GOTTHARDD #ifndef GOTTHARDD
LOG(logERROR, LOG(logERROR,
@ -141,6 +141,16 @@ int main(int argc, char *argv[]) {
checkModuleFlag = 0; checkModuleFlag = 0;
break; break;
case 'd':
LOG(logINFO, ("Detected developer mode\n"));
debugflag = 1;
break;
case 'u':
LOG(logINFO, ("Detected update mode\n"));
updateFlag = 1;
break;
case 's': case 's':
LOG(logINFO, ("Detected stop server\n")); LOG(logINFO, ("Detected stop server\n"));
isControlServer = 0; isControlServer = 0;

View File

@ -42,6 +42,7 @@ extern char mess[MAX_STR_LENGTH];
// Variables that will be exported // Variables that will be exported
int sockfd = 0; int sockfd = 0;
int debugflag = 0; int debugflag = 0;
int updateFlag = 0;
int checkModuleFlag = 1; int checkModuleFlag = 1;
udpStruct udpDetails = {32410, 32411, 50001, 50002, 0, 0, 0, 0, 0, 0, 0, 0}; udpStruct udpDetails = {32410, 32411, 50001, 50002, 0, 0, 0, 0, 0, 0, 0, 0};
int configured = FAIL; int configured = FAIL;
@ -4106,7 +4107,7 @@ int software_trigger(int file_des) {
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
LOG(logDEBUG1, ("Software Trigger\n")); LOG(logDEBUG1, ("Software Trigger\n"));
#ifndef EIGERD #if !defined(EIGERD) && !defined(MYTHEN3D)
functionNotImplemented(); functionNotImplemented();
#else #else
// only set // only set

View File

@ -231,9 +231,9 @@ class Detector {
Result<defs::timingMode> getTimingMode(Positions pos = {}) const; Result<defs::timingMode> getTimingMode(Positions pos = {}) const;
/** /**
* [Gotthard][Jungfrau][CTB][Moench][Mythen3] Options: * [Gotthard][Jungfrau][Gotthard][CTB][Moench][Gotthard2] Options:
* AUTO_TIMING, TRIGGER_EXPOSURE * AUTO_TIMING, TRIGGER_EXPOSURE \n
* [Gotthard2] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, TRIGGER_GATED * [Mythen3] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, TRIGGER_GATED \n
* [Eiger] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER * [Eiger] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER
*/ */
void setTimingMode(defs::timingMode value, Positions pos = {}); void setTimingMode(defs::timingMode value, Positions pos = {});
@ -354,21 +354,24 @@ class Detector {
/** /**
* (Degrees) * (Degrees)
* [Gotthard] Options: TEMPERATURE_ADC, TEMPERATURE_FPGA * [Gotthard] Options: TEMPERATURE_ADC, TEMPERATURE_FPGA \n
* [Jungfrau] Options: TEMPERATURE_ADC, TEMPERATURE_FPGA * [Jungfrau] Options: TEMPERATURE_ADC, TEMPERATURE_FPGA \n
* [Eiger] Options: TEMPERATURE_FPGA, TEMPERATURE_FPGAEXT, TEMPERATURE_10GE, * [Eiger] Options: TEMPERATURE_FPGA, TEMPERATURE_FPGAEXT, TEMPERATURE_10GE,
* TEMPERATURE_DCDC, TEMPERATURE_SODL, TEMPERATURE_SODR, TEMPERATURE_FPGA2, * TEMPERATURE_DCDC, TEMPERATURE_SODL, TEMPERATURE_SODR, TEMPERATURE_FPGA2,
* TEMPERATURE_FPGA3 * TEMPERATURE_FPGA3 \n
* [CTB] Options: SLOW_ADC_TEMP * Cannot call TEMPERATURE_FPGA2 and TEMPERATURE_FPGA3 when blocking acquire
* in progress \n [CTB] Options: SLOW_ADC_TEMP
*/ */
Result<int> getTemperature(defs::dacIndex index, Positions pos = {}) const; Result<int> getTemperature(defs::dacIndex index, Positions pos = {}) const;
/** gets list of dac enums for this detector */ /** gets list of dac enums for this detector */
std::vector<defs::dacIndex> getDacList() const; std::vector<defs::dacIndex> getDacList() const;
Result<int> getDAC(defs::dacIndex index, bool mV, Positions pos = {}) const; Result<int> getDAC(defs::dacIndex index, bool mV = false,
Positions pos = {}) const;
void setDAC(defs::dacIndex index, int value, bool mV, Positions pos = {}); void setDAC(defs::dacIndex index, int value, bool mV = false,
Positions pos = {});
/* [Gotthard2] */ /* [Gotthard2] */
Result<int> getOnChipDAC(defs::dacIndex index, int chipIndex, Result<int> getOnChipDAC(defs::dacIndex index, int chipIndex,
@ -457,7 +460,7 @@ class Detector {
* numbers for different modules.*/ * numbers for different modules.*/
void setStartingFrameNumber(uint64_t value, Positions pos = {}); void setStartingFrameNumber(uint64_t value, Positions pos = {});
/** [Eiger] Sends an internal software trigger to the detector */ /** [Eiger][Mythen3] Sends an internal software trigger to the detector */
void sendSoftwareTrigger(Positions pos = {}); void sendSoftwareTrigger(Positions pos = {});
Result<defs::scanParameters> getScan(Positions pos = {}) const; Result<defs::scanParameters> getScan(Positions pos = {}) const;
@ -850,7 +853,7 @@ class Detector {
/** [Eiger] */ /** [Eiger] */
Result<int> getThresholdEnergy(Positions pos = {}) const; Result<int> getThresholdEnergy(Positions pos = {}) const;
/** [Eiger] */ /** [Eiger] It loads trim files from settingspath */
void setThresholdEnergy(int threshold_ev, void setThresholdEnergy(int threshold_ev,
defs::detectorSettings settings = defs::STANDARD, defs::detectorSettings settings = defs::STANDARD,
bool trimbits = true, Positions pos = {}); bool trimbits = true, Positions pos = {});
@ -963,23 +966,24 @@ class Detector {
/** /**
* [Jungfrau]Set threshold temperature * [Jungfrau]Set threshold temperature
* If temperature crosses threshold temperature * If temperature crosses threshold temperature
* and temperature control is enabled, * and temperature control is enabled (default is disabled), power to chip
* power to chip will be switched off and * will be switched off and temperature event will be set. \n To power on
* temperature event will be set * chip again, temperature has to be less than threshold temperature and
* val is value in degrees * temperature event has to be cleared. val is value in degrees
*/ */
void setThresholdTemperature(int temp, Positions pos = {}); void setThresholdTemperature(int temp, Positions pos = {});
/** [Jungfrau] */ /** [Jungfrau] */
Result<bool> getTemperatureControl(Positions pos = {}) const; Result<bool> getTemperatureControl(Positions pos = {}) const;
/** [Jungfrau] */ /** [Jungfrau] refer to setThresholdTemperature
* Default is disabled */
void setTemperatureControl(bool enable, Positions pos = {}); void setTemperatureControl(bool enable, Positions pos = {});
/** [Jungfrau] */ /** [Jungfrau] refer to setThresdholdTemperature */
Result<int> getTemperatureEvent(Positions pos = {}) const; Result<int> getTemperatureEvent(Positions pos = {}) const;
/** [Jungfrau] */ /** [Jungfrau] refer to setThresdholdTemperature */
void resetTemperatureEvent(Positions pos = {}); void resetTemperatureEvent(Positions pos = {});
/** [Jungfrau] */ /** [Jungfrau] */
@ -1201,7 +1205,7 @@ class Detector {
/** [CTB][Moench] */ /** [CTB][Moench] */
void setRUNClock(int value_in_MHz, Positions pos = {}); void setRUNClock(int value_in_MHz, Positions pos = {});
/** [CTB][Moench] */ /** [CTB][Moench] in MHZ */
Result<int> getSYNCClock(Positions pos = {}) const; Result<int> getSYNCClock(Positions pos = {}) const;
/** [CTB][Moench] */ /** [CTB][Moench] */
@ -1396,7 +1400,7 @@ class Detector {
/************************************************** /**************************************************
* * * *
* Moench * * Moench specific *
* * * *
* ************************************************/ * ************************************************/
@ -1423,29 +1427,6 @@ class Detector {
const std::string &value, const std::string &value,
Positions pos = {}); Positions pos = {});
/** [Moench] TODO! How do we do this best??? Can be refactored to something
* else? Use a generic zmq message passing system...
* For now limiting to all detectors working the same*/
/** [Moench: -1 if not found or cannot convert to int] */
Result<int> getDetectorMinMaxEnergyThreshold(const bool isEmax,
Positions pos = {}) const;
/** [Moench] */
void setDetectorMinMaxEnergyThreshold(const bool isEmax, const int value,
Positions pos = {});
/** [Moench: -1 if unknown mode] */
Result<defs::frameModeType> getFrameMode(Positions pos = {}) const;
/** [Moench] */
void setFrameMode(defs::frameModeType value, Positions pos = {});
/** [Moench: -1 if unknown mode] */
Result<defs::detectorModeType> getDetectorMode(Positions pos = {}) const;
/** [Moench] */
void setDetectorMode(defs::detectorModeType value, Positions pos = {});
/************************************************** /**************************************************
* * * *
* Advanced * * Advanced *

View File

@ -670,7 +670,7 @@ std::string CmdProxy::ClockFrequency(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[n_clock (0-8)] [freq_in_Hz]\n\t[Gotthard2][Mythen3] Frequency " os << "[n_clock (0-5)] [freq_in_Hz]\n\t[Gotthard2][Mythen3] Frequency "
"of clock n_clock in Hz. Use clkdiv to set frequency." "of clock n_clock in Hz. Use clkdiv to set frequency."
<< '\n'; << '\n';
} else { } else {
@ -703,7 +703,7 @@ std::string CmdProxy::ClockPhase(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[n_clock (0-8)] [phase] [deg " os << "[n_clock (0-5)] [phase] [deg "
"(optional)]\n\t[Gotthard2][Mythen3] Phase of clock n_clock. If " "(optional)]\n\t[Gotthard2][Mythen3] Phase of clock n_clock. If "
"deg, then phase shift in degrees, else absolute phase shift " "deg, then phase shift in degrees, else absolute phase shift "
"values." "values."
@ -756,7 +756,7 @@ std::string CmdProxy::MaxClockPhaseShift(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[n_clock (0-8)]\n\t[Gotthard2][Mythen3] Absolute Maximum Phase " os << "[n_clock (0-5)]\n\t[Gotthard2][Mythen3] Absolute Maximum Phase "
"shift of clock n_clock." "shift of clock n_clock."
<< '\n'; << '\n';
} else { } else {
@ -785,7 +785,7 @@ std::string CmdProxy::ClockDivider(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[n_clock (0-8)] [n_divider]\n\t[Gotthard2][Mythen3] Clock " os << "[n_clock (0-5)] [n_divider]\n\t[Gotthard2][Mythen3] Clock "
"Divider of clock n_clock. Must be greater than 1." "Divider of clock n_clock. Must be greater than 1."
<< '\n'; << '\n';
} else { } else {
@ -1222,7 +1222,8 @@ std::string CmdProxy::Threshold(int action) {
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[eV] [(optinal settings) standard, lowgain, veryhighgain, " os << "[eV] [(optinal settings) standard, lowgain, veryhighgain, "
"verylowgain]" "verylowgain]"
"\n\t[Eiger] Threshold in eV" "\n\t[Eiger] Threshold in eV. It loads trim files from "
"settingspath."
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
if (!args.empty()) { if (!args.empty()) {
@ -1957,21 +1958,17 @@ std::string CmdProxy::SlowAdc(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[n_channel (0-7 for channel|8 for temperature)]\n\t[Ctb] Slow " os << "[n_channel (0-7 for channel]\n\t[Ctb] Slow "
"ADC channel in mV or °C." "ADC channel in mV"
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
if (args.size() != 1) { if (args.size() != 1) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
int nchan = StringTo<int>(args[0]); int nchan = StringTo<int>(args[0]);
if (nchan < 0 || nchan > defs::SLOW_ADC_TEMP - defs::SLOW_ADC0) { if (nchan < 0 || nchan > 7) {
throw sls::RuntimeError("Unknown adc argument " + args[0]); throw sls::RuntimeError("Unknown adc argument " + args[0]);
} }
if (nchan == 8) {
auto t = det->getTemperature(defs::SLOW_ADC_TEMP, {det_id});
os << OutString(t) << " °C\n";
} else {
auto t = det->getSlowADC( auto t = det->getSlowADC(
static_cast<defs::dacIndex>(nchan + defs::SLOW_ADC0), {det_id}); static_cast<defs::dacIndex>(nchan + defs::SLOW_ADC0), {det_id});
Result<double> result(t.size()); Result<double> result(t.size());
@ -1979,7 +1976,7 @@ std::string CmdProxy::SlowAdc(int action) {
result[i] = t[i] / 1000.00; result[i] = t[i] / 1000.00;
} }
os << OutString(result) << " mV\n"; os << OutString(result) << " mV\n";
}
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
throw sls::RuntimeError("cannot put"); throw sls::RuntimeError("cannot put");
} else { } else {
@ -2389,52 +2386,6 @@ std::string CmdProxy::JsonParameter(int action) {
return os.str(); return os.str();
} }
std::string CmdProxy::MinMaxEnergyThreshold(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
if (cmd == "emin") {
os << "[n_value]\n\t[Moench] Minimum energy threshold (soft "
"setting) for processor."
<< '\n';
} else if (cmd == "emax") {
os << "[n_value]\n\t[Moench] Maximum energy threshold (soft "
"setting) for processor."
<< '\n';
} else {
throw sls::RuntimeError(
"Unknown command, use list to list all commands");
}
} else {
bool emax = false;
if (cmd == "emin") {
emax = false;
} else if (cmd == "emax") {
emax = true;
} else {
throw sls::RuntimeError(
"Unknown command, use list to list all commands");
}
if (action == defs::GET_ACTION) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getDetectorMinMaxEnergyThreshold(emax, {det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
det->setDetectorMinMaxEnergyThreshold(emax, StringTo<int>(args[0]),
{det_id});
os << args.front() << '\n';
} else {
throw sls::RuntimeError("Unknown action");
}
}
return os.str();
}
/* Advanced */ /* Advanced */
std::string CmdProxy::ProgramFpga(int action) { std::string CmdProxy::ProgramFpga(int action) {

View File

@ -602,7 +602,9 @@ class CmdProxy {
{"r_framesperfile", "rx_framesperfile"}, {"r_framesperfile", "rx_framesperfile"},
/* ZMQ Streaming Parameters (Receiver<->Client) */ /* ZMQ Streaming Parameters (Receiver<->Client) */
{"r_readfreq", "rx_readfreq"}, {"r_readfreq", "rx_zmqfreq"},
{"rx_readfreq", "rx_zmqfreq"},
{"rx_datastream", "rx_zmqstream"},
/* Eiger Specific */ /* Eiger Specific */
{"trimdir", "settingspath"}, {"trimdir", "settingspath"},
@ -614,6 +616,7 @@ class CmdProxy {
/* Gotthard2 Specific */ /* Gotthard2 Specific */
/* Mythen3 Specific */ /* Mythen3 Specific */
/* CTB Specific */ /* CTB Specific */
{"adc", "slowadc"},
{"flags", "romode"}, {"flags", "romode"},
{"i_a", "im_a"}, {"i_a", "im_a"},
{"i_b", "im_b"}, {"i_b", "im_b"},
@ -647,6 +650,7 @@ class CmdProxy {
{"rx_version", &CmdProxy::rx_version}, {"rx_version", &CmdProxy::rx_version},
{"detectornumber", &CmdProxy::detectornumber}, {"detectornumber", &CmdProxy::detectornumber},
{"type", &CmdProxy::type}, {"type", &CmdProxy::type},
{"nmod", &CmdProxy::nmod},
{"detsize", &CmdProxy::DetectorSize}, {"detsize", &CmdProxy::DetectorSize},
{"settingslist", &CmdProxy::settingslist}, {"settingslist", &CmdProxy::settingslist},
{"settings", &CmdProxy::settings}, {"settings", &CmdProxy::settings},
@ -836,8 +840,8 @@ class CmdProxy {
{"rx_framesperfile", &CmdProxy::rx_framesperfile}, {"rx_framesperfile", &CmdProxy::rx_framesperfile},
/* ZMQ Streaming Parameters (Receiver<->Client) */ /* ZMQ Streaming Parameters (Receiver<->Client) */
{"rx_datastream", &CmdProxy::rx_datastream}, {"rx_zmqstream", &CmdProxy::rx_zmqstream},
{"rx_readfreq", &CmdProxy::rx_readfreq}, {"rx_zmqfreq", &CmdProxy::rx_zmqfreq},
{"rx_zmqstartfnum", &CmdProxy::rx_zmqstartfnum}, {"rx_zmqstartfnum", &CmdProxy::rx_zmqstartfnum},
{"rx_zmqport", &CmdProxy::rx_zmqport}, {"rx_zmqport", &CmdProxy::rx_zmqport},
{"zmqport", &CmdProxy::zmqport}, {"zmqport", &CmdProxy::zmqport},
@ -938,7 +942,7 @@ class CmdProxy {
{"im_c", &CmdProxy::im_c}, {"im_c", &CmdProxy::im_c},
{"im_d", &CmdProxy::im_d}, {"im_d", &CmdProxy::im_d},
{"im_io", &CmdProxy::im_io}, {"im_io", &CmdProxy::im_io},
{"adc", &CmdProxy::SlowAdc}, {"slowadc", &CmdProxy::SlowAdc},
{"extsampling", &CmdProxy::extsampling}, {"extsampling", &CmdProxy::extsampling},
{"extsamplingsrc", &CmdProxy::extsamplingsrc}, {"extsamplingsrc", &CmdProxy::extsamplingsrc},
{"rx_dbitlist", &CmdProxy::ReceiverDbitList}, {"rx_dbitlist", &CmdProxy::ReceiverDbitList},
@ -971,10 +975,6 @@ class CmdProxy {
/* Moench */ /* Moench */
{"rx_jsonaddheader", &CmdProxy::AdditionalJsonHeader}, {"rx_jsonaddheader", &CmdProxy::AdditionalJsonHeader},
{"rx_jsonpara", &CmdProxy::JsonParameter}, {"rx_jsonpara", &CmdProxy::JsonParameter},
{"emin", &CmdProxy::MinMaxEnergyThreshold},
{"emax", &CmdProxy::MinMaxEnergyThreshold},
{"framemode", &CmdProxy::framemode},
{"detectormode", &CmdProxy::detectormode},
/* Advanced */ /* Advanced */
{"programfpga", &CmdProxy::ProgramFpga}, {"programfpga", &CmdProxy::ProgramFpga},
@ -1091,7 +1091,6 @@ class CmdProxy {
/* Moench */ /* Moench */
std::string AdditionalJsonHeader(int action); std::string AdditionalJsonHeader(int action);
std::string JsonParameter(int action); std::string JsonParameter(int action);
std::string MinMaxEnergyThreshold(int action);
/* Advanced */ /* Advanced */
std::string ProgramFpga(int action); std::string ProgramFpga(int action);
std::string CopyDetectorServer(int action); std::string CopyDetectorServer(int action);
@ -1128,6 +1127,8 @@ class CmdProxy {
GET_COMMAND(type, getDetectorType, GET_COMMAND(type, getDetectorType,
"\n\tSerial number or MAC of detector (hex)."); "\n\tSerial number or MAC of detector (hex).");
GET_COMMAND_NOID(nmod, size, "\n\tNumber of modules in shared memory.");
GET_COMMAND_NOID(settingslist, getSettingsList, GET_COMMAND_NOID(settingslist, getSettingsList,
"\n\tList of settings implemented for this detector."); "\n\tList of settings implemented for this detector.");
@ -1207,8 +1208,8 @@ class CmdProxy {
INTEGER_COMMAND(timing, getTimingMode, setTimingMode, INTEGER_COMMAND(timing, getTimingMode, setTimingMode,
sls::StringTo<slsDetectorDefs::timingMode>, sls::StringTo<slsDetectorDefs::timingMode>,
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of " "[auto|trigger|gating|burst_trigger]\n\tTiming Mode of "
"detector.\n\t[Jungfrau][Gotthard][Mythen3][Ctb][Moench] " "detector.\n\t[Jungfrau][Gotthard][Ctb][Moench][Gotthard2] "
"[auto|trigger]\n\t[Gotthard2] " "[auto|trigger]\n\t[Mythen3] "
"[auto|trigger|gating|trigger_gating]\n\t[Eiger] " "[auto|trigger|gating|trigger_gating]\n\t[Eiger] "
"[auto|trigger|gating|burst_trigger]"); "[auto|trigger|gating|burst_trigger]");
@ -1287,11 +1288,13 @@ class CmdProxy {
GET_IND_COMMAND( GET_IND_COMMAND(
temp_fpgafl, getTemperature, slsDetectorDefs::TEMPERATURE_FPGA2, " °C", temp_fpgafl, getTemperature, slsDetectorDefs::TEMPERATURE_FPGA2, " °C",
"[n_value]\n\t[Eiger]Temperature of the left front end board fpga"); "[n_value]\n\t[Eiger]Temperature of the left front end board fpga. "
"Cannot call this while blocking acquire is going on.");
GET_IND_COMMAND( GET_IND_COMMAND(
temp_fpgafr, getTemperature, slsDetectorDefs::TEMPERATURE_FPGA3, " °C", temp_fpgafr, getTemperature, slsDetectorDefs::TEMPERATURE_FPGA3, " °C",
"[n_value]\n\t[Eiger]Temperature of the left front end board fpga"); "[n_value]\n\t[Eiger]Temperature of the left front end board fpga. "
"Cannot call this while blocking acquire is going on.");
GET_IND_COMMAND(temp_slowadc, getTemperature, GET_IND_COMMAND(temp_slowadc, getTemperature,
slsDetectorDefs::SLOW_ADC_TEMP, " °C", slsDetectorDefs::SLOW_ADC_TEMP, " °C",
@ -1638,7 +1641,7 @@ class CmdProxy {
EXECUTE_SET_COMMAND( EXECUTE_SET_COMMAND(
trigger, sendSoftwareTrigger, trigger, sendSoftwareTrigger,
"\n\t[Eiger] Sends software trigger signal to detector."); "\n\t[Eiger][Mythen3] Sends software trigger signal to detector.");
GET_COMMAND(scanerrmsg, getScanErrorMessage, GET_COMMAND(scanerrmsg, getScanErrorMessage,
"\n\tGets Scan error message if scan ended in error for non " "\n\tGets Scan error message if scan ended in error for non "
@ -1849,7 +1852,7 @@ class CmdProxy {
/* ZMQ Streaming Parameters (Receiver<->Client) */ /* ZMQ Streaming Parameters (Receiver<->Client) */
INTEGER_COMMAND( INTEGER_COMMAND(
rx_datastream, getRxZmqDataStream, setRxZmqDataStream, StringTo<int>, rx_zmqstream, getRxZmqDataStream, setRxZmqDataStream, StringTo<int>,
"[0, 1]\n\tEnable/ disable data streaming from receiver via zmq (eg. " "[0, 1]\n\tEnable/ disable data streaming from receiver via zmq (eg. "
"to GUI or to another process for further processing). This creates/ " "to GUI or to another process for further processing). This creates/ "
"destroys zmq streamer threads in receiver. \n\tSwitching to Gui " "destroys zmq streamer threads in receiver. \n\tSwitching to Gui "
@ -1858,7 +1861,7 @@ class CmdProxy {
"receiver for fast applications. "); "receiver for fast applications. ");
INTEGER_COMMAND( INTEGER_COMMAND(
rx_readfreq, getRxZmqFrequency, setRxZmqFrequency, StringTo<int>, rx_zmqfreq, getRxZmqFrequency, setRxZmqFrequency, StringTo<int>,
"[nth frame]\n\tFrequency of frames streamed out from receiver via " "[nth frame]\n\tFrequency of frames streamed out from receiver via "
"zmq\n\tDefault: 1, Means every frame is streamed out. \n\tIf 2, every " "zmq\n\tDefault: 1, Means every frame is streamed out. \n\tIf 2, every "
"second frame is streamed out. \n\tIf 0, streaming timer is the " "second frame is streamed out. \n\tIf 0, streaming timer is the "
@ -2209,17 +2212,6 @@ class CmdProxy {
"\n\t[Mythen3] Starts Pattern"); "\n\t[Mythen3] Starts Pattern");
/* Moench */ /* Moench */
INTEGER_COMMAND(framemode, getFrameMode, setFrameMode,
sls::StringTo<slsDetectorDefs::frameModeType>,
"[pedestal|newpedestal|flatfield|newflatfield]\n\t[Moench] "
"Frame mode (soft setting) in processor.");
INTEGER_COMMAND(detectormode, getDetectorMode, setDetectorMode,
sls::StringTo<slsDetectorDefs::detectorModeType>,
"[counting|interpolating|analog]\n\t[Moench] Detector mode "
"(soft setting) in processor.");
/* Advanced */ /* Advanced */
EXECUTE_SET_COMMAND(resetfpga, resetFPGA, EXECUTE_SET_COMMAND(resetfpga, resetFPGA,

View File

@ -1840,71 +1840,6 @@ void Detector::setAdditionalJsonParameter(const std::string &key,
pimpl->Parallel(&Module::setAdditionalJsonParameter, pos, key, value); pimpl->Parallel(&Module::setAdditionalJsonParameter, pos, key, value);
} }
Result<int> Detector::getDetectorMinMaxEnergyThreshold(const bool isEmax,
Positions pos) const {
auto res = pimpl->Parallel(&Module::getAdditionalJsonParameter, pos,
isEmax ? "emax" : "emin");
Result<int> intResult(res.size());
try {
for (unsigned int i = 0; i < res.size(); ++i) {
intResult[i] = stoi(res[i]);
}
} catch (...) {
throw RuntimeError(
"Cannot find or convert emin/emax string to integer");
}
return intResult;
}
void Detector::setDetectorMinMaxEnergyThreshold(const bool isEmax,
const int value,
Positions pos) {
pimpl->Parallel(&Module::setAdditionalJsonParameter, pos,
isEmax ? "emax" : "emin", std::to_string(value));
}
Result<defs::frameModeType> Detector::getFrameMode(Positions pos) const {
auto res =
pimpl->Parallel(&Module::getAdditionalJsonParameter, pos, "frameMode");
Result<defs::frameModeType> intResult(res.size());
try {
for (unsigned int i = 0; i < res.size(); ++i) {
intResult[i] =
sls::StringTo<slsDetectorDefs::frameModeType>(res[i]);
}
} catch (...) {
throw RuntimeError(
"Cannot find or convert frameMode string to integer");
}
return intResult;
}
void Detector::setFrameMode(defs::frameModeType value, Positions pos) {
pimpl->Parallel(&Module::setAdditionalJsonParameter, pos, "frameMode",
sls::ToString(value));
}
Result<defs::detectorModeType> Detector::getDetectorMode(Positions pos) const {
auto res = pimpl->Parallel(&Module::getAdditionalJsonParameter, pos,
"detectorMode");
Result<defs::detectorModeType> intResult(res.size());
try {
for (unsigned int i = 0; i < res.size(); ++i) {
intResult[i] =
sls::StringTo<slsDetectorDefs::detectorModeType>(res[i]);
}
} catch (...) {
throw RuntimeError(
"Cannot find or convert detectorMode string to integer");
}
return intResult;
}
void Detector::setDetectorMode(defs::detectorModeType value, Positions pos) {
pimpl->Parallel(&Module::setAdditionalJsonParameter, pos, "detectorMode",
sls::ToString(value));
}
// Advanced // Advanced
void Detector::programFPGA(const std::string &fname, Positions pos) { void Detector::programFPGA(const std::string &fname, Positions pos) {

View File

@ -357,6 +357,10 @@ void Module::setImageTestMode(const int value) {
} }
int Module::getADC(dacIndex index) const { int Module::getADC(dacIndex index) const {
// cannot access fpga links simultaneously (eiger) temp fix
if (index == TEMPERATURE_FPGA2 || index == TEMPERATURE_FPGA3) {
return sendToDetector<int>(F_GET_ADC, index);
}
return sendToDetectorStop<int>(F_GET_ADC, index); return sendToDetectorStop<int>(F_GET_ADC, index);
} }
@ -792,13 +796,6 @@ void Module::setReceiverHostname(const std::string &receiverIP) {
shm()->numUDPInterfaces = retval.udpInterfaces; shm()->numUDPInterfaces = retval.udpInterfaces;
if (shm()->myDetectorType == MOENCH) {
setAdditionalJsonParameter("adcmask_1g",
std::to_string(retval.adcMask));
setAdditionalJsonParameter("adcmask_10g",
std::to_string(retval.adc10gMask));
}
// to use rx_hostname if empty and also update client zmqip // to use rx_hostname if empty and also update client zmqip
updateReceiverStreamingIP(); updateReceiverStreamingIP();
} }
@ -1073,19 +1070,6 @@ void Module::setSubDeadTime(int64_t value) {
} }
int Module::getThresholdEnergy() const { int Module::getThresholdEnergy() const {
// moench - get threshold energy from json header
if (shm()->myDetectorType == MOENCH) {
getAdditionalJsonHeader();
std::string result = getAdditionalJsonParameter("threshold");
// convert to integer
try {
return std::stoi(result);
}
// not found or cannot scan integer
catch (...) {
return -1;
}
}
return sendToDetector<int>(F_GET_THRESHOLD_ENERGY); return sendToDetector<int>(F_GET_THRESHOLD_ENERGY);
} }
@ -1097,10 +1081,6 @@ void Module::setThresholdEnergy(int e_eV, detectorSettings isettings,
if (shm()->useReceiverFlag) { if (shm()->useReceiverFlag) {
sendToReceiver(F_RECEIVER_SET_THRESHOLD, e_eV, nullptr); sendToReceiver(F_RECEIVER_SET_THRESHOLD, e_eV, nullptr);
} }
}
// moench - send threshold energy to processor
else if (shm()->myDetectorType == MOENCH) {
setAdditionalJsonParameter("threshold", std::to_string(e_eV));
} else { } else {
throw RuntimeError( throw RuntimeError(
"Set threshold energy not implemented for this detector"); "Set threshold energy not implemented for this detector");
@ -1789,10 +1769,6 @@ void Module::setADCEnableMask(uint32_t mask) {
// update #nchan, as it depends on #samples, adcmask, // update #nchan, as it depends on #samples, adcmask,
updateNumberOfChannels(); updateNumberOfChannels();
// send to processor
if (shm()->myDetectorType == MOENCH)
setAdditionalJsonParameter("adcmask_1g", std::to_string(mask));
if (shm()->useReceiverFlag) { if (shm()->useReceiverFlag) {
sendToReceiver<int>(F_RECEIVER_SET_ADC_MASK, mask); sendToReceiver<int>(F_RECEIVER_SET_ADC_MASK, mask);
} }
@ -1806,10 +1782,6 @@ void Module::setTenGigaADCEnableMask(uint32_t mask) {
sendToDetector(F_SET_ADC_ENABLE_MASK_10G, mask, nullptr); sendToDetector(F_SET_ADC_ENABLE_MASK_10G, mask, nullptr);
updateNumberOfChannels(); // depends on samples and adcmask updateNumberOfChannels(); // depends on samples and adcmask
// send to processor
if (shm()->myDetectorType == MOENCH)
setAdditionalJsonParameter("adcmask_10g", std::to_string(mask));
if (shm()->useReceiverFlag) { if (shm()->useReceiverFlag) {
sendToReceiver<int>(F_RECEIVER_SET_ADC_MASK_10G, mask); sendToReceiver<int>(F_RECEIVER_SET_ADC_MASK_10G, mask);
} }

View File

@ -574,25 +574,25 @@ TEST_CASE("rx_framesperfile", "[.cmd][.rx][.new]") {
/* ZMQ Streaming Parameters (Receiver<->Client) */ /* ZMQ Streaming Parameters (Receiver<->Client) */
TEST_CASE("rx_datastream", "[.cmd][.rx][.new]") { TEST_CASE("rx_zmqstream", "[.cmd][.rx][.new]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
auto prev_val = det.getRxZmqDataStream(); auto prev_val = det.getRxZmqDataStream();
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("rx_datastream", {"1"}, -1, PUT, oss); proxy.Call("rx_zmqstream", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "rx_datastream 1\n"); REQUIRE(oss.str() == "rx_zmqstream 1\n");
REQUIRE(det.getRxZmqDataStream().squash() == true); REQUIRE(det.getRxZmqDataStream().squash() == true);
} }
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("rx_datastream", {}, -1, GET, oss); proxy.Call("rx_zmqstream", {}, -1, GET, oss);
REQUIRE(oss.str() == "rx_datastream 1\n"); REQUIRE(oss.str() == "rx_zmqstream 1\n");
} }
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("rx_datastream", {"0"}, -1, PUT, oss); proxy.Call("rx_zmqstream", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "rx_datastream 0\n"); REQUIRE(oss.str() == "rx_zmqstream 0\n");
REQUIRE(det.getRxZmqDataStream().squash() == false); REQUIRE(det.getRxZmqDataStream().squash() == false);
} }
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
@ -600,24 +600,24 @@ TEST_CASE("rx_datastream", "[.cmd][.rx][.new]") {
} }
} }
TEST_CASE("rx_readfreq", "[.cmd][.rx][.new]") { TEST_CASE("rx_zmqfreq", "[.cmd][.rx][.new]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
auto prev_val = det.getRxZmqFrequency(); auto prev_val = det.getRxZmqFrequency();
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("rx_readfreq", {"1"}, -1, PUT, oss); proxy.Call("rx_zmqfreq", {"1"}, -1, PUT, oss);
REQUIRE(oss.str() == "rx_readfreq 1\n"); REQUIRE(oss.str() == "rx_zmqfreq 1\n");
} }
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("rx_readfreq", {}, -1, GET, oss); proxy.Call("rx_zmqfreq", {}, -1, GET, oss);
REQUIRE(oss.str() == "rx_readfreq 1\n"); REQUIRE(oss.str() == "rx_zmqfreq 1\n");
} }
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("rx_readfreq", {"0"}, -1, PUT, oss); proxy.Call("rx_zmqfreq", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "rx_readfreq 0\n"); REQUIRE(oss.str() == "rx_zmqfreq 0\n");
} }
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setRxZmqFrequency(prev_val[i], {i}); det.setRxZmqFrequency(prev_val[i], {i});

View File

@ -32,8 +32,6 @@ std::string ToString(const defs::frameDiscardPolicy s);
std::string ToString(const defs::fileFormat s); std::string ToString(const defs::fileFormat s);
std::string ToString(const defs::externalSignalFlag s); std::string ToString(const defs::externalSignalFlag s);
std::string ToString(const defs::readoutMode s); std::string ToString(const defs::readoutMode s);
std::string ToString(const defs::frameModeType s);
std::string ToString(const defs::detectorModeType s);
std::string ToString(const defs::dacIndex s); std::string ToString(const defs::dacIndex s);
std::string ToString(const std::vector<defs::dacIndex> &vec); std::string ToString(const std::vector<defs::dacIndex> &vec);
std::string ToString(const defs::burstMode s); std::string ToString(const defs::burstMode s);
@ -283,8 +281,6 @@ template <> defs::frameDiscardPolicy StringTo(const std::string &s);
template <> defs::fileFormat StringTo(const std::string &s); template <> defs::fileFormat StringTo(const std::string &s);
template <> defs::externalSignalFlag StringTo(const std::string &s); template <> defs::externalSignalFlag StringTo(const std::string &s);
template <> defs::readoutMode StringTo(const std::string &s); template <> defs::readoutMode StringTo(const std::string &s);
template <> defs::frameModeType StringTo(const std::string &s);
template <> defs::detectorModeType StringTo(const std::string &s);
template <> defs::dacIndex StringTo(const std::string &s); template <> defs::dacIndex StringTo(const std::string &s);
template <> defs::burstMode StringTo(const std::string &s); template <> defs::burstMode StringTo(const std::string &s);
template <> defs::timingSourceType StringTo(const std::string &s); template <> defs::timingSourceType StringTo(const std::string &s);

View File

@ -377,16 +377,6 @@ typedef struct {
/** hierarchy in multi-detector structure, if any */ /** hierarchy in multi-detector structure, if any */
enum masterFlags { NO_MASTER, IS_MASTER, IS_SLAVE }; enum masterFlags { NO_MASTER, IS_MASTER, IS_SLAVE };
/**
* frame mode for processor
*/
enum frameModeType { PEDESTAL, NEW_PEDESTAL, FLATFIELD, NEW_FLATFIELD };
/**
* detector mode for processor
*/
enum detectorModeType { COUNTING, INTERPOLATING, ANALOG };
/** /**
* burst mode for gotthard2 * burst mode for gotthard2
*/ */

View File

@ -3,11 +3,11 @@
#define APILIB 0x200810 #define APILIB 0x200810
#define APIRECEIVER 0x200810 #define APIRECEIVER 0x200810
#define APIGUI 0x200804 #define APIGUI 0x200804
#define APICTB 0x200909
#define APIGOTTHARD 0x200909
#define APIGOTTHARD2 0x200909
#define APIJUNGFRAU 0x200909
#define APIMOENCH 0x200909
#define APIEIGER 0x200909
#define APIMYTHEN3 0x200909 #define APICTB 0x200910
#define APIGOTTHARD 0x200910
#define APIJUNGFRAU 0x200910
#define APIMOENCH 0x200910
#define APIEIGER 0x200910
#define APIGOTTHARD2 0x200910
#define APIMYTHEN3 0x200910

View File

@ -325,34 +325,6 @@ std::string ToString(const defs::readoutMode s) {
} }
} }
std::string ToString(const defs::frameModeType s) {
switch (s) {
case defs::PEDESTAL:
return std::string("pedestal");
case defs::NEW_PEDESTAL:
return std::string("newpedestal");
case defs::FLATFIELD:
return std::string("flatfield");
case defs::NEW_FLATFIELD:
return std::string("newflatfield");
default:
return std::string("Unknown");
}
}
std::string ToString(const defs::detectorModeType s) {
switch (s) {
case defs::COUNTING:
return std::string("counting");
case defs::INTERPOLATING:
return std::string("interpolating");
case defs::ANALOG:
return std::string("analog");
default:
return std::string("Unknown");
}
}
std::string ToString(const defs::dacIndex s) { std::string ToString(const defs::dacIndex s) {
switch (s) { switch (s) {
case defs::DAC_0: case defs::DAC_0:
@ -713,28 +685,6 @@ template <> defs::readoutMode StringTo(const std::string &s) {
throw sls::RuntimeError("Unknown readout mode " + s); throw sls::RuntimeError("Unknown readout mode " + s);
} }
template <> defs::frameModeType StringTo(const std::string &s) {
if (s == "pedestal")
return defs::PEDESTAL;
if (s == "newpedestal")
return defs::NEW_PEDESTAL;
if (s == "flatfield")
return defs::FLATFIELD;
if (s == "newflatfield")
return defs::NEW_FLATFIELD;
throw sls::RuntimeError("Unknown frame mode " + s);
}
template <> defs::detectorModeType StringTo(const std::string &s) {
if (s == "counting")
return defs::COUNTING;
if (s == "interpolating")
return defs::INTERPOLATING;
if (s == "analog")
return defs::ANALOG;
throw sls::RuntimeError("Unknown detector mode " + s);
}
template <> defs::dacIndex StringTo(const std::string &s) { template <> defs::dacIndex StringTo(const std::string &s) {
if (s == "dac 0") if (s == "dac 0")
return defs::DAC_0; return defs::DAC_0;