merge conflict fix

This commit is contained in:
maliakal_d 2022-03-17 08:46:04 +01:00
commit ef1c52ddc1
46 changed files with 1531 additions and 544 deletions

View File

@ -31,7 +31,7 @@ This document describes the differences between v7.0.0 and v6.x.x
- rx_arping - rx_arping
- rx_threadsids max is now 9 (breaking api) - rx_threadsids max is now 9 (breaking api)
- fixed datastream disabling for eiger. Its only available in 10g mode. - fixed datastream disabling for eiger. Its only available in 10g mode.
- m3 server crash (vthrehsold) - m3 server crash (vthrehsold dac names were not provided)
- allow vtrim to be interpolated for Eiger settings - allow vtrim to be interpolated for Eiger settings
- m3 setThresholdEnergy and setAllThresholdEnergy was overwriting gaincaps with settings enum - m3 setThresholdEnergy and setAllThresholdEnergy was overwriting gaincaps with settings enum
- can set localhost with virtual server with minimum configuration: (hostname localhost, rx_hostname localhost, udp_dstip auto) - can set localhost with virtual server with minimum configuration: (hostname localhost, rx_hostname localhost, udp_dstip auto)
@ -39,7 +39,12 @@ This document describes the differences between v7.0.0 and v6.x.x
- current frame index points to listened frame index (not processed index) - current frame index points to listened frame index (not processed index)
- when in discard partial frames or empty mode, the frame number doesnt increase by 1, it increases to that number (so its faster) - when in discard partial frames or empty mode, the frame number doesnt increase by 1, it increases to that number (so its faster)
- file write disabled by default - file write disabled by default
- eiger 12 bit mode
- start non blocking acquisition at modular level - start non blocking acquisition at modular level
- connect master commands to api (allow set master for eiger)
--ignore-config command line
- command line argument 'master' mainly for virtual servers (also master/top for real eiger), only one virtual server for eiger, use command lines for master/top
- stop servers also check for errors at startup( in case it was running with an older version)
- hostname cmd failed when connecting to servers in update mode (ctb, moench, jungfrau, eiger) - hostname cmd failed when connecting to servers in update mode (ctb, moench, jungfrau, eiger)
- missingpackets signed (negative => extra packets) - missingpackets signed (negative => extra packets)
- 10g eiger nextframenumber get fixed. - 10g eiger nextframenumber get fixed.

View File

@ -11,9 +11,17 @@ manually
from clang import cindex from clang import cindex
import subprocess import subprocess
import argparse import argparse
import sys
from parse import system_include_paths, clang_format_version
required_version = 13
RED = '\033[91m'
ENDC = '\033[0m'
if (ver := clang_format_version()) != required_version:
print(f'{RED}Clang format version {required_version} required, detected: {ver}. Bye!{ENDC}')
sys.exit(1)
from parse import system_include_paths
default_build_path = "/home/l_frojdh/sls/build/" default_build_path = "/home/l_frojdh/sls/build/"
fpath = "../../slsDetectorSoftware/src/Detector.cpp" fpath = "../../slsDetectorSoftware/src/Detector.cpp"
@ -66,7 +74,7 @@ def get_arguments_with_default(node):
args = [] args = []
for arg in node.get_arguments(): for arg in node.get_arguments():
tokens = [t.spelling for t in arg.get_tokens()] tokens = [t.spelling for t in arg.get_tokens()]
print(tokens) # print(tokens)
if '=' in tokens: if '=' in tokens:
if arg.type.spelling == "sls::Positions": #TODO! automate if arg.type.spelling == "sls::Positions": #TODO! automate
args.append("py::arg() = Positions{}") args.append("py::arg() = Positions{}")
@ -111,19 +119,11 @@ def visit(node):
lines.append( lines.append(
f'.def("{child.spelling}",{fs} &Detector::{child.spelling}{args})' f'.def("{child.spelling}",{fs} &Detector::{child.spelling}{args})'
) )
print(f'&Detector::{child.spelling}{args})')
cn.append(child) cn.append(child)
for child in node.get_children(): for child in node.get_children():
visit(child) visit(child)
# .def("setRxHostname",
# (void (Detector::*)(const std::string &, Positions)) &
# Detector::setRxHostname,
# py::arg(), py::arg() = Positions{})
# .def("setRxHostname",
# (void (Detector::*)(const std::vector<std::string> &)) &
# Detector::setRxHostname,
# py::arg())
visit(tu.cursor) visit(tu.cursor)

View File

@ -5,6 +5,12 @@ import subprocess
from subprocess import PIPE from subprocess import PIPE
import os import os
def clang_format_version():
p = subprocess.run(['clang-format', '--version'], capture_output = True)
ver = p.stdout.decode().split()[2]
major = int(ver.split('.')[0])
return major
def remove_comments(text): def remove_comments(text):
def replacer(match): def replacer(match):

View File

@ -287,7 +287,7 @@ class Detector(CppDetectorApi):
Note Note
----- -----
[Eiger] Options: 4, 8, 16, 32. If set to 32, also sets clkdivider to 2 (quarter speed), else to 0 (full speed)\n [Eiger] Options: 4, 8, 12, 16, 32. If set to 32, also sets clkdivider to 2 (quarter speed), else to 0 (full speed)\n
[Mythen3] Options: 8, 16, 32 \n [Mythen3] Options: 8, 16, 32 \n
[Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16 [Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16
""" """
@ -1474,6 +1474,19 @@ class Detector(CppDetectorApi):
def trimval(self, value): def trimval(self, value):
ut.set_using_dict(self.setAllTrimbits, value) ut.set_using_dict(self.setAllTrimbits, value)
@property
@element
def master(self):
"""
[Eiger] Sets half module to master and others to slaves.\n
[Gotthard][Gotthard2][Mythen3][Eiger] Gets if the current module/ half module is master.
"""
return self.getMaster()
@master.setter
def master(self, value):
ut.set_using_dict(self.setMaster, value)
@property @property
@element @element
def lock(self): def lock(self):
@ -2126,6 +2139,21 @@ class Detector(CppDetectorApi):
""" """
return ut.reduce_time(self.getMeasuredSubFramePeriod()) return ut.reduce_time(self.getMeasuredSubFramePeriod())
@property
@element
def top(self):
"""[Eiger] Sets half module to top (1), else bottom.
Note
-----
Advanced Function!
"""
return self.getTop()
@top.setter
def top(self, value):
ut.set_using_dict(self.setTop, value)
""" """
------------------<<<Jungfrau specific>>>------------------------- ------------------<<<Jungfrau specific>>>-------------------------
""" """

View File

@ -1,8 +1,8 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
/* WARINING This file is auto generated any edits might be overwritten without /* WARINING This file is auto generated any edits might be overwritten without
* warning */ * warning */
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#include <pybind11/chrono.h> #include <pybind11/chrono.h>
#include <pybind11/operators.h> #include <pybind11/operators.h>
#include <pybind11/pybind11.h> #include <pybind11/pybind11.h>
@ -173,6 +173,12 @@ void init_det(py::module &m) {
.def("setFlipRows", .def("setFlipRows",
(void (Detector::*)(bool, sls::Positions)) & Detector::setFlipRows, (void (Detector::*)(bool, sls::Positions)) & Detector::setFlipRows,
py::arg(), py::arg() = Positions{}) py::arg(), py::arg() = Positions{})
.def("getMaster",
(Result<bool>(Detector::*)(sls::Positions) const) &
Detector::getMaster,
py::arg() = Positions{})
.def("setMaster", (void (Detector::*)(bool, int)) & Detector::setMaster,
py::arg(), py::arg())
.def("isVirtualDetectorServer", .def("isVirtualDetectorServer",
(Result<bool>(Detector::*)(sls::Positions) const) & (Result<bool>(Detector::*)(sls::Positions) const) &
Detector::isVirtualDetectorServer, Detector::isVirtualDetectorServer,
@ -766,7 +772,7 @@ void init_det(py::module &m) {
Detector::getRxLastClientIP, Detector::getRxLastClientIP,
py::arg() = Positions{}) py::arg() = Positions{})
.def("getRxThreadIds", .def("getRxThreadIds",
(Result<std::array<pid_t, 8>>(Detector::*)(sls::Positions) const) & (Result<std::array<pid_t, 9>>(Detector::*)(sls::Positions) const) &
Detector::getRxThreadIds, Detector::getRxThreadIds,
py::arg() = Positions{}) py::arg() = Positions{})
.def("getRxArping", .def("getRxArping",
@ -1005,6 +1011,13 @@ void init_det(py::module &m) {
sls::Positions)) & sls::Positions)) &
Detector::setDataStream, Detector::setDataStream,
py::arg(), py::arg(), py::arg() = Positions{}) py::arg(), py::arg(), py::arg() = Positions{})
.def("getTop",
(Result<bool>(Detector::*)(sls::Positions) const) &
Detector::getTop,
py::arg() = Positions{})
.def("setTop",
(void (Detector::*)(bool, sls::Positions)) & Detector::setTop,
py::arg(), py::arg() = Positions{})
.def("getChipVersion", .def("getChipVersion",
(Result<double>(Detector::*)(sls::Positions) const) & (Result<double>(Detector::*)(sls::Positions) const) &
Detector::getChipVersion, Detector::getChipVersion,
@ -1263,10 +1276,6 @@ void init_det(py::module &m) {
(Result<std::array<ns, 3>>(Detector::*)(sls::Positions) const) & (Result<std::array<ns, 3>>(Detector::*)(sls::Positions) const) &
Detector::getGateDelayForAllGates, Detector::getGateDelayForAllGates,
py::arg() = Positions{}) py::arg() = Positions{})
.def("getMaster",
(Result<bool>(Detector::*)(sls::Positions) const) &
Detector::getMaster,
py::arg() = Positions{})
.def("getChipStatusRegister", .def("getChipStatusRegister",
(Result<int>(Detector::*)(sls::Positions) const) & (Result<int>(Detector::*)(sls::Positions) const) &
Detector::getChipStatusRegister, Detector::getChipStatusRegister,
@ -1555,7 +1564,7 @@ void init_det(py::module &m) {
Detector::getUpdateMode, Detector::getUpdateMode,
py::arg() = Positions{}) py::arg() = Positions{})
.def("setUpdateMode", .def("setUpdateMode",
(void (Detector::*)(bool, sls::Positions)) & (void (Detector::*)(const bool, sls::Positions)) &
Detector::setUpdateMode, Detector::setUpdateMode,
py::arg(), py::arg() = Positions{}) py::arg(), py::arg() = Positions{})
.def("readRegister", .def("readRegister",

View File

@ -97,6 +97,11 @@
<string>65535</string> <string>65535</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>4095</string>
</property>
</item>
<item> <item>
<property name="text"> <property name="text">
<string>255</string> <string>255</string>

View File

@ -69,5 +69,11 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
enum { DYNAMIC, FORCE_SWITCH_G1, FORCE_SWITCH_G2, FIX_G1, FIX_G2, FIX_G0 }; enum { DYNAMIC, FORCE_SWITCH_G1, FORCE_SWITCH_G2, FIX_G1, FIX_G2, FIX_G0 };
bool isVisibleFixG0{false}; bool isVisibleFixG0{false};
enum { DYNAMICRANGE_32, DYNAMICRANGE_16, DYNAMICRANGE_8, DYNAMICRANGE_4 }; enum {
DYNAMICRANGE_32,
DYNAMICRANGE_16,
DYNAMICRANGE_12,
DYNAMICRANGE_8,
DYNAMICRANGE_4
};
}; };

View File

@ -1064,6 +1064,8 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size,
// mythen3 / gotthard2 debugging // mythen3 / gotthard2 debugging
int discardBits = numDiscardBits; int discardBits = numDiscardBits;
uint16_t temp = 0;
uint8_t *src = (uint8_t *)source;
switch (dr) { switch (dr) {
case 4: case 4:
@ -1083,6 +1085,19 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size,
} }
break; break;
case 12:
for (ichan = 0; ichan < size; ++ichan) {
temp = (*src++ & 0xFF);
temp |= ((*src & 0xF) << 8u);
dest[ichan] = (double)temp;
++ichan;
temp = ((*src++ & 0xF0) >> 4u);
temp |= ((*src++ & 0xFF) << 4u);
dest[ichan] = (double)temp;
}
break;
case 16: case 16:
if (detType == slsDetectorDefs::JUNGFRAU || if (detType == slsDetectorDefs::JUNGFRAU ||
detType == slsDetectorDefs::GOTTHARD2) { detType == slsDetectorDefs::GOTTHARD2) {

View File

@ -60,13 +60,19 @@ void qTabSettings::SetupWidgetWindow() {
QStandardItemModel *model = QStandardItemModel *model =
qobject_cast<QStandardItemModel *>(comboDynamicRange->model()); qobject_cast<QStandardItemModel *>(comboDynamicRange->model());
if (model) { if (model) {
QModelIndex index;
QStandardItem *item; QStandardItem *item;
index = int dr = DYNAMICRANGE_4;
model->index(DYNAMICRANGE_4, comboDynamicRange->modelColumn(), for (int i = 0; i != 2; ++i) {
// disable dr 4
QModelIndex index =
model->index(dr, comboDynamicRange->modelColumn(),
comboDynamicRange->rootModelIndex()); comboDynamicRange->rootModelIndex());
item = model->itemFromIndex(index); item = model->itemFromIndex(index);
item->setEnabled(false); item->setEnabled(false);
// disable dr 12
dr = DYNAMICRANGE_12;
}
} }
} else if (detType == slsDetectorDefs::EIGER) { } else if (detType == slsDetectorDefs::EIGER) {
lblDynamicRange->setEnabled(true); lblDynamicRange->setEnabled(true);
@ -305,6 +311,9 @@ void qTabSettings::GetDynamicRange() {
case 16: case 16:
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_16); comboDynamicRange->setCurrentIndex(DYNAMICRANGE_16);
break; break;
case 12:
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_12);
break;
case 8: case 8:
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_8); comboDynamicRange->setCurrentIndex(DYNAMICRANGE_8);
break; break;
@ -333,6 +342,9 @@ void qTabSettings::SetDynamicRange(int index) {
case DYNAMICRANGE_16: case DYNAMICRANGE_16:
det->setDynamicRange(16); det->setDynamicRange(16);
break; break;
case DYNAMICRANGE_12:
det->setDynamicRange(12);
break;
case DYNAMICRANGE_8: case DYNAMICRANGE_8:
det->setDynamicRange(8); det->setDynamicRange(8);
break; break;

View File

@ -433,17 +433,22 @@ void initControlServer() {
} }
void initStopServer() { void initStopServer() {
if (!updateFlag && initError == OK) {
usleep(CTRL_SRVR_INIT_TIME_US); usleep(CTRL_SRVR_INIT_TIME_US);
if (mapCSP0() == FAIL) { if (mapCSP0() == FAIL) {
LOG(logERROR, initError = FAIL;
("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n")); strcpy(initErrorMessage,
exit(EXIT_FAILURE); "Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
LOG(logERROR, (initErrorMessage));
initCheckDone = 1;
return;
} }
#ifdef VIRTUAL #ifdef VIRTUAL
sharedMemory_setStop(0); sharedMemory_setStop(0);
#endif #endif
} }
initCheckDone = 1;
}
/* set up detector */ /* set up detector */
@ -702,8 +707,16 @@ void resetPeripheral() {
} }
/* set parameters - dr, adcenablemask */ /* set parameters - dr, adcenablemask */
int setDynamicRange(int dr) {
if (dr == 16)
return OK;
return FAIL;
}
int setDynamicRange(int dr) { return DYNAMIC_RANGE; } int getDynamicRange(int *retval) {
*retval = DYNAMIC_RANGE;
return OK;
}
int setADCEnableMask(uint32_t mask) { int setADCEnableMask(uint32_t mask) {
if (mask == 0u) { if (mask == 0u) {

View File

@ -177,7 +177,7 @@ void Beb_AdjustIPChecksum(struct udp_header_type *ip) {
ip->ip_header_checksum[1] = ip_checksum & 0xff; ip->ip_header_checksum[1] = ip_checksum & 0xff;
} }
void Beb_GetModuleConfiguration(int *master, int *top, int *normal) { int Beb_GetModuleConfiguration(int *master, int *top, int *normal) {
*top = 0; *top = 0;
*master = 0; *master = 0;
// mapping new memory to read master top module configuration // mapping new memory to read master top module configuration
@ -187,6 +187,7 @@ void Beb_GetModuleConfiguration(int *master, int *top, int *normal) {
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR); int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
if (fd < 0) { if (fd < 0) {
LOG(logERROR, ("Module Configuration FAIL\n")); LOG(logERROR, ("Module Configuration FAIL\n"));
return FAIL;
} else { } else {
// read data // read data
ret = Beb_Read32(csp0base, BEB_CONFIG_RD_OFST); ret = Beb_Read32(csp0base, BEB_CONFIG_RD_OFST);
@ -202,6 +203,7 @@ void Beb_GetModuleConfiguration(int *master, int *top, int *normal) {
// close file pointer // close file pointer
Beb_close(fd, csp0base); Beb_close(fd, csp0base);
} }
return OK;
} }
int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay) { int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay) {
@ -862,11 +864,17 @@ void Beb_ResetFrameNumber() {
} }
int Beb_SetUpTransferParameters(short the_bit_mode) { int Beb_SetUpTransferParameters(short the_bit_mode) {
if (the_bit_mode != 4 && the_bit_mode != 8 && the_bit_mode != 16 && switch (the_bit_mode) {
the_bit_mode != 32) case 4:
return 0; case 8:
case 12:
case 16:
case 32:
Beb_bit_mode = the_bit_mode; Beb_bit_mode = the_bit_mode;
return 1; return 1;
default:
return 0;
}
} }
int Beb_StopAcquisition() { int Beb_StopAcquisition() {

View File

@ -15,7 +15,7 @@ int Beb_SetHeaderData(uint64_t src_mac, uint32_t src_ip, uint16_t src_port,
uint64_t dst_mac, uint32_t dst_ip, uint16_t dst_port); uint64_t dst_mac, uint32_t dst_ip, uint16_t dst_port);
void Beb_AdjustIPChecksum(struct udp_header_type *ip); void Beb_AdjustIPChecksum(struct udp_header_type *ip);
void Beb_GetModuleConfiguration(int *master, int *top, int *normal); int Beb_GetModuleConfiguration(int *master, int *top, int *normal);
int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay); int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay);
void Beb_SetTopVariable(int val); void Beb_SetTopVariable(int val);

View File

@ -16,91 +16,31 @@ include_directories(
../../slsSupportLib/include ../../slsSupportLib/include
) )
add_executable(eigerDetectorServerMaster_virtual add_executable(eigerDetectorServer_virtual
${src} ${src}
) )
target_include_directories(eigerDetectorServerMaster_virtual target_include_directories(eigerDetectorServer_virtual
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
) )
target_compile_definitions(eigerDetectorServerMaster_virtual target_compile_definitions(eigerDetectorServer_virtual
PUBLIC EIGERD PCCOMPILE STOP_SERVER
PUBLIC VIRTUAL #VIRTUAL_9M
PUBLIC VIRTUAL_MASTER
)
target_link_libraries(eigerDetectorServerMaster_virtual
PUBLIC pthread rt slsProjectCSettings
)
set_target_properties(eigerDetectorServerMaster_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS eigerDetectorServerMaster_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
add_executable(eigerDetectorServerSlaveTop_virtual
${src}
)
target_include_directories(eigerDetectorServerSlaveTop_virtual
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
)
target_compile_definitions(eigerDetectorServerSlaveTop_virtual
PUBLIC EIGERD PCCOMPILE STOP_SERVER
PUBLIC VIRTUAL #VIRTUAL_9M
PUBLIC VIRTUAL_TOP
)
target_link_libraries(eigerDetectorServerSlaveTop_virtual
PUBLIC pthread rt slsProjectCSettings
)
set_target_properties(eigerDetectorServerSlaveTop_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS eigerDetectorServerSlaveTop_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
add_executable(eigerDetectorServerSlaveBottom_virtual
${src}
)
target_include_directories(eigerDetectorServerSlaveBottom_virtual
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
)
target_compile_definitions(eigerDetectorServerSlaveBottom_virtual
PUBLIC EIGERD PCCOMPILE STOP_SERVER PUBLIC EIGERD PCCOMPILE STOP_SERVER
PUBLIC VIRTUAL #VIRTUAL_9M PUBLIC VIRTUAL #VIRTUAL_9M
) )
target_link_libraries(eigerDetectorServerSlaveBottom_virtual target_link_libraries(eigerDetectorServer_virtual
PUBLIC pthread rt slsProjectCSettings PUBLIC pthread rt slsProjectCSettings
) )
set_target_properties(eigerDetectorServerSlaveBottom_virtual PROPERTIES set_target_properties(eigerDetectorServer_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
) )
install(TARGETS eigerDetectorServerSlaveBottom_virtual install(TARGETS eigerDetectorServer_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
) )
configure_file(config_eiger.txt ${CMAKE_BINARY_DIR}/bin/config_eiger.txt COPYONLY) configure_file(config_eiger.txt ${CMAKE_BINARY_DIR}/bin/config_eiger.txt COPYONLY)
configure_file(detid_eiger.txt ${CMAKE_BINARY_DIR}/bin/detid_eiger.txt COPYONLY) configure_file(detid_eiger.txt ${CMAKE_BINARY_DIR}/bin/detid_eiger.txt COPYONLY)

View File

@ -18,7 +18,7 @@
const unsigned int Feb_Control_leftAddress = 0x100; const unsigned int Feb_Control_leftAddress = 0x100;
const unsigned int Feb_Control_rightAddress = 0x200; const unsigned int Feb_Control_rightAddress = 0x200;
int Feb_Control_master = 0; int Feb_Control_master = -1;
int Feb_Control_normal = 0; int Feb_Control_normal = 0;
int Feb_Control_activated = 1; int Feb_Control_activated = 1;
@ -50,17 +50,16 @@ double ratemax = -1;
// setup // setup
void Feb_Control_activate(int activate) { Feb_Control_activated = activate; } void Feb_Control_activate(int activate) { Feb_Control_activated = activate; }
void Feb_Control_FebControl() { int Feb_Control_FebControl(int normal) {
Feb_Control_staticBits = Feb_Control_acquireNReadoutMode = Feb_Control_staticBits = 0;
Feb_Control_triggerMode = Feb_Control_externalEnableMode = Feb_Control_acquireNReadoutMode = 0;
Feb_Control_triggerMode = 0;
Feb_Control_externalEnableMode = 0;
Feb_Control_subFrameMode = 0; Feb_Control_subFrameMode = 0;
Feb_Control_trimbit_size = 263680; Feb_Control_trimbit_size = 263680;
Feb_Control_last_downloaded_trimbits = Feb_Control_last_downloaded_trimbits =
malloc(Feb_Control_trimbit_size * sizeof(int)); malloc(Feb_Control_trimbit_size * sizeof(int));
}
int Feb_Control_Init(int master, int normal) {
Feb_Control_master = master;
Feb_Control_normal = normal; Feb_Control_normal = normal;
Feb_Interface_SetAddress(Feb_Control_rightAddress, Feb_Control_leftAddress); Feb_Interface_SetAddress(Feb_Control_rightAddress, Feb_Control_leftAddress);
if (Feb_Control_activated) { if (Feb_Control_activated) {
@ -931,7 +930,10 @@ unsigned int Feb_Control_ConvertTimeToRegister(float time_in_sec) {
int Feb_Control_PrepareForAcquisition() { int Feb_Control_PrepareForAcquisition() {
LOG(logINFOBLUE, ("Preparing for Acquisition\n")); LOG(logINFOBLUE, ("Preparing for Acquisition\n"));
Feb_Control_PrintAcquisitionSetup(); if (!Feb_Control_PrintAcquisitionSetup()) {
LOG(logERROR, ("Could not prepare acquisition\n"));
return 0;
}
if (Feb_Control_Reset() == STATUS_ERROR) { if (Feb_Control_Reset() == STATUS_ERROR) {
LOG(logERROR, ("Trouble reseting daq or data stream\n")); LOG(logERROR, ("Trouble reseting daq or data stream\n"));
@ -988,20 +990,26 @@ int Feb_Control_PrepareForAcquisition() {
return 1; return 1;
} }
void Feb_Control_PrintAcquisitionSetup() { int Feb_Control_PrintAcquisitionSetup() {
time_t rawtime; time_t rawtime;
time(&rawtime); time(&rawtime);
struct tm *timeinfo = localtime(&rawtime); struct tm *timeinfo = localtime(&rawtime);
LOG(logINFO, int dr = 0;
("Starting an exposure: (%s)" if (!Feb_Control_GetDynamicRange(&dr)) {
LOG(logERROR, ("Could not print acquisition set up\n"));
return 0;
}
LOG(logINFO, ("Starting an exposure: (%s)"
"\t Dynamic range nbits: %d\n" "\t Dynamic range nbits: %d\n"
"\t Trigger mode: 0x%x\n" "\t Trigger mode: 0x%x\n"
"\t Number of exposures: %d\n" "\t Number of exposures: %d\n"
"\t Exsposure time (if used): %f seconds.\n" "\t Exsposure time (if used): %f seconds.\n"
"\t Exsposure period (if used): %f seconds.\n\n", "\t Exsposure period (if used): %f seconds.\n\n",
asctime(timeinfo), Feb_Control_GetDynamicRange(), asctime(timeinfo), dr, Feb_Control_triggerMode,
Feb_Control_triggerMode, Feb_Control_GetNExposures(), Feb_Control_GetNExposures(), Feb_Control_exposure_time_in_sec,
Feb_Control_exposure_time_in_sec, Feb_Control_exposure_period_in_sec)); Feb_Control_exposure_period_in_sec));
return 1;
} }
int Feb_Control_StartAcquisition() { int Feb_Control_StartAcquisition() {
@ -1169,49 +1177,106 @@ int Feb_Control_SoftwareTrigger(int block) {
} }
// parameters // parameters
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo) { int Feb_Control_SetDynamicRange(int dr) {
static unsigned int everything_but_bit_mode = DAQ_STATIC_BIT_PROGRAM | static unsigned int everything_but_bit_mode = DAQ_STATIC_BIT_PROGRAM |
DAQ_STATIC_BIT_CHIP_TEST | DAQ_STATIC_BIT_CHIP_TEST |
DAQ_STATIC_BIT_ROTEST; DAQ_STATIC_BIT_ROTEST;
if (four_eight_sixteen_or_thirtytwo == 4) { switch (dr) {
case 4:
Feb_Control_staticBits = Feb_Control_staticBits =
DAQ_STATIC_BIT_M4 | DAQ_STATIC_BIT_M4 |
(Feb_Control_staticBits & (Feb_Control_staticBits &
everything_but_bit_mode); // leave test bits in currernt state everything_but_bit_mode); // leave test bits in currernt state
Feb_Control_subFrameMode &= ~DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING; Feb_Control_subFrameMode &= ~DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING;
} else if (four_eight_sixteen_or_thirtytwo == 8) { break;
case 8:
Feb_Control_staticBits = DAQ_STATIC_BIT_M8 | (Feb_Control_staticBits & Feb_Control_staticBits = DAQ_STATIC_BIT_M8 | (Feb_Control_staticBits &
everything_but_bit_mode); everything_but_bit_mode);
Feb_Control_subFrameMode &= ~DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING; Feb_Control_subFrameMode &= ~DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING;
} else if (four_eight_sixteen_or_thirtytwo == 16) { break;
case 12:
case 16:
Feb_Control_staticBits = DAQ_STATIC_BIT_M12 | (Feb_Control_staticBits & Feb_Control_staticBits = DAQ_STATIC_BIT_M12 | (Feb_Control_staticBits &
everything_but_bit_mode); everything_but_bit_mode);
Feb_Control_subFrameMode &= ~DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING; Feb_Control_subFrameMode &= ~DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING;
} else if (four_eight_sixteen_or_thirtytwo == 32) {
// disable 16 bit conversion if 12 bit mode (enable if 16 bit)
if (!Feb_Control_Disable16bitConversion(dr == 12))
return 0;
break;
case 32:
Feb_Control_staticBits = DAQ_STATIC_BIT_M12 | (Feb_Control_staticBits & Feb_Control_staticBits = DAQ_STATIC_BIT_M12 | (Feb_Control_staticBits &
everything_but_bit_mode); everything_but_bit_mode);
Feb_Control_subFrameMode |= DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING; Feb_Control_subFrameMode |= DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING;
} else { break;
LOG(logERROR, ("dynamic range (%d) not valid, not setting bit mode.\n", default:
four_eight_sixteen_or_thirtytwo)); LOG(logERROR,
("dynamic range (%d) not valid, not setting bit mode.\n", dr));
LOG(logINFO, ("Set dynamic range int must equal 4,8 16, or 32.\n")); LOG(logINFO, ("Set dynamic range int must equal 4,8 16, or 32.\n"));
return 0; return 0;
} }
LOG(logINFO, LOG(logINFO, ("Dynamic range set to %d\n", dr));
("Dynamic range set to %d\n", four_eight_sixteen_or_thirtytwo));
return 1; return 1;
} }
unsigned int Feb_Control_GetDynamicRange() { int Feb_Control_GetDynamicRange(int *retval) {
if (Feb_Control_subFrameMode & DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING) if (Feb_Control_subFrameMode & DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING) {
return 32; *retval = 32;
else if (DAQ_STATIC_BIT_M4 & Feb_Control_staticBits) } else if (DAQ_STATIC_BIT_M4 & Feb_Control_staticBits) {
return 4; *retval = 4;
else if (DAQ_STATIC_BIT_M8 & Feb_Control_staticBits) } else if (DAQ_STATIC_BIT_M8 & Feb_Control_staticBits) {
return 8; *retval = 8;
} else {
int disable16 = 0;
if (!Feb_Control_Get16bitConversionDisabled(&disable16)) {
LOG(logERROR, ("Could not get dynamic range (12 or 16 bit)\n"));
return 0;
}
if (disable16) {
*retval = 12;
} else {
*retval = 16;
}
}
return 16; return 1;
}
int Feb_Control_Disable16bitConversion(int disable) {
LOG(logINFO, ("%s 16 bit expansion\n", disable ? "Disabling" : "Enabling"));
unsigned int regval = 0;
if (!Feb_Control_ReadRegister(DAQ_REG_HRDWRE, &regval)) {
LOG(logERROR, ("Could not %s 16 bit expansion (bit mode)\n",
(disable ? "disable" : "enable")));
return 0;
}
if (disable) {
regval |= DAQ_REG_HRDWRE_DSBL_16BIT_MSK;
} else {
regval &= ~DAQ_REG_HRDWRE_DSBL_16BIT_MSK;
}
if (!Feb_Control_WriteRegister(DAQ_REG_HRDWRE, regval)) {
LOG(logERROR, ("Could not %s 16 bit expansion (bit mode)\n",
(disable ? "disable" : "enable")));
return 0;
}
return 1;
}
int Feb_Control_Get16bitConversionDisabled(int *ret) {
unsigned int regval = 0;
if (!Feb_Control_ReadRegister(DAQ_REG_HRDWRE, &regval)) {
LOG(logERROR, ("Could not get 16 bit expansion (bit mode)\n"));
return 0;
}
if (regval & DAQ_REG_HRDWRE_DSBL_16BIT_MSK) {
*ret = 1;
} else {
*ret = 0;
}
return 1;
} }
int Feb_Control_SetReadoutSpeed(unsigned int readout_speed) { int Feb_Control_SetReadoutSpeed(unsigned int readout_speed) {
@ -1490,9 +1555,8 @@ int Feb_Control_SetTop(enum TOPINDEX ind, int left, int right) {
return 1; return 1;
} }
void Feb_Control_SetMasterVariable(int val) { Feb_Control_master = val; }
int Feb_Control_SetMaster(enum MASTERINDEX ind) { int Feb_Control_SetMaster(enum MASTERINDEX ind) {
uint32_t offset = DAQ_REG_HRDWRE; uint32_t offset = DAQ_REG_HRDWRE;
unsigned int addr[2] = {Feb_Control_leftAddress, Feb_Control_rightAddress}; unsigned int addr[2] = {Feb_Control_leftAddress, Feb_Control_rightAddress};
char *master_names[] = {MASTER_NAMES}; char *master_names[] = {MASTER_NAMES};
@ -1529,9 +1593,31 @@ int Feb_Control_SetMaster(enum MASTERINDEX ind) {
LOG(logINFOBLUE, ("%s Master flag to %s Feb\n", LOG(logINFOBLUE, ("%s Master flag to %s Feb\n",
(ind == MASTER_HARDWARE ? "Resetting" : "Overwriting"), (ind == MASTER_HARDWARE ? "Resetting" : "Overwriting"),
master_names[ind])); master_names[ind]));
return 1; return 1;
} }
int Feb_Control_SetMasterEffects(int master, int controlServer) {
int prevMaster = Feb_Control_master;
Feb_Control_master = master;
// change in master for 9m
if (controlServer && prevMaster != Feb_Control_master &&
!Feb_Control_normal) {
if (prevMaster) {
Feb_Control_CloseSerialCommunication();
}
if (Feb_Control_master) {
if (!Feb_Control_OpenSerialCommunication()) {
LOG(logERROR, ("Could not intitalize feb control serial "
"communication\n"));
return FAIL;
}
}
}
return OK;
}
int Feb_Control_SetQuad(int val) { int Feb_Control_SetQuad(int val) {
LOG(logINFO, ("Setting Quad to %d in Feb\n", val)); LOG(logINFO, ("Setting Quad to %d in Feb\n", val));
Feb_Control_quadMode = val; Feb_Control_quadMode = val;
@ -1554,7 +1640,10 @@ int Feb_Control_SetChipSignalsToTrimQuad(int enable) {
regval &= ~(DAQ_REG_HRDWRE_PROGRAM_MSK | DAQ_REG_HRDWRE_M8_MSK); regval &= ~(DAQ_REG_HRDWRE_PROGRAM_MSK | DAQ_REG_HRDWRE_M8_MSK);
} }
return Feb_Control_WriteRegister(DAQ_REG_HRDWRE, regval); if (!Feb_Control_WriteRegister(DAQ_REG_HRDWRE, regval)) {
LOG(logERROR, ("Could not set chip signals to trim quad\n"));
return 0;
}
} }
return 1; return 1;
} }
@ -1604,7 +1693,7 @@ int Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
for (int iloop = 0; iloop < 2; ++iloop) { for (int iloop = 0; iloop < 2; ++iloop) {
if (run[iloop]) { if (run[iloop]) {
LOG(logINFO, LOG(logDEBUG1,
("Writing 0x%x to %s 0x%x\n", data, side[iloop], actualOffset)); ("Writing 0x%x to %s 0x%x\n", data, side[iloop], actualOffset));
if (!Feb_Interface_WriteRegister(addr[iloop], actualOffset, data, 0, if (!Feb_Interface_WriteRegister(addr[iloop], actualOffset, data, 0,
0)) { 0)) {
@ -1612,6 +1701,18 @@ int Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
side[iloop], actualOffset)); side[iloop], actualOffset));
return 0; return 0;
} }
uint32_t regVal = 0;
if (!Feb_Interface_ReadRegister(addr[iloop], actualOffset,
&regVal)) {
LOG(logERROR, ("Could not read %s register\n", addr[iloop]));
return 0;
}
if (regVal != data) {
LOG(logERROR,
("Could not write %s register. Write 0x%x, read 0x%x\n",
addr[iloop], data, regVal));
return 0;
}
} }
} }
@ -1648,8 +1749,8 @@ int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval) {
side[iloop], actualOffset)); side[iloop], actualOffset));
return 0; return 0;
} }
LOG(logINFO, ("Read 0x%x from %s 0x%x\n", value[iloop], side[iloop], LOG(logDEBUG1, ("Read 0x%x from %s 0x%x\n", value[iloop],
actualOffset)); side[iloop], actualOffset));
*retval = value[iloop]; *retval = value[iloop];
// if not the other (left, not right OR right, not left), return the // if not the other (left, not right OR right, not left), return the
// value // value
@ -1824,7 +1925,11 @@ int64_t Feb_Control_Get_RateTable_Period_in_nsec() {
int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec) { int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec) {
// period = exptime if 16bit, period = subexptime if 32 bit // period = exptime if 16bit, period = subexptime if 32 bit
int dr = Feb_Control_GetDynamicRange(); int dr = 0;
if (!Feb_Control_GetDynamicRange(&dr)) {
LOG(logERROR, ("Could not set rate correction tau\n"));
return 0;
}
double period_in_sec = double period_in_sec =
(double)(Feb_Control_GetSubFrameExposureTime()) / (double)1e9; (double)(Feb_Control_GetSubFrameExposureTime()) / (double)1e9;
if (dr == 16) if (dr == 16)

View File

@ -7,8 +7,7 @@
// setup // setup
void Feb_Control_activate(int activate); void Feb_Control_activate(int activate);
void Feb_Control_FebControl(); int Feb_Control_FebControl(int normal);
int Feb_Control_Init(int master, int normal);
int Feb_Control_OpenSerialCommunication(); int Feb_Control_OpenSerialCommunication();
void Feb_Control_CloseSerialCommunication(); void Feb_Control_CloseSerialCommunication();
int Feb_Control_CheckSetup(); int Feb_Control_CheckSetup();
@ -55,7 +54,7 @@ int Feb_Control_ResetChipPartially();
int Feb_Control_SendBitModeToBebServer(); int Feb_Control_SendBitModeToBebServer();
unsigned int Feb_Control_ConvertTimeToRegister(float time_in_sec); unsigned int Feb_Control_ConvertTimeToRegister(float time_in_sec);
int Feb_Control_PrepareForAcquisition(); int Feb_Control_PrepareForAcquisition();
void Feb_Control_PrintAcquisitionSetup(); int Feb_Control_PrintAcquisitionSetup();
int Feb_Control_StartAcquisition(); int Feb_Control_StartAcquisition();
int Feb_Control_StopAcquisition(); int Feb_Control_StopAcquisition();
int Feb_Control_IsReadyForTrigger(int *readyForTrigger); int Feb_Control_IsReadyForTrigger(int *readyForTrigger);
@ -63,8 +62,10 @@ int Feb_Control_SendSoftwareTrigger();
int Feb_Control_SoftwareTrigger(int block); int Feb_Control_SoftwareTrigger(int block);
// parameters // parameters
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo); int Feb_Control_SetDynamicRange(int dr);
unsigned int Feb_Control_GetDynamicRange(); int Feb_Control_GetDynamicRange(int *retval);
int Feb_Control_Disable16bitConversion(int disable);
int Feb_Control_Get16bitConversionDisabled();
int Feb_Control_SetReadoutSpeed(unsigned int readout_speed); int Feb_Control_SetReadoutSpeed(unsigned int readout_speed);
int Feb_Control_SetReadoutMode(unsigned int readout_mode); int Feb_Control_SetReadoutMode(unsigned int readout_mode);
int Feb_Control_SetTriggerMode(unsigned int trigger_mode); int Feb_Control_SetTriggerMode(unsigned int trigger_mode);
@ -86,8 +87,8 @@ int Feb_Control_Get_Counter_Bit();
int Feb_Control_SetInterruptSubframe(int val); int Feb_Control_SetInterruptSubframe(int val);
int Feb_Control_GetInterruptSubframe(); int Feb_Control_GetInterruptSubframe();
int Feb_Control_SetTop(enum TOPINDEX ind, int left, int right); int Feb_Control_SetTop(enum TOPINDEX ind, int left, int right);
void Feb_Control_SetMasterVariable(int val);
int Feb_Control_SetMaster(enum MASTERINDEX ind); int Feb_Control_SetMaster(enum MASTERINDEX ind);
int Feb_Control_SetMasterEffects(int master, int controlServer);
int Feb_Control_SetQuad(int val); int Feb_Control_SetQuad(int val);
int Feb_Control_SetChipSignalsToTrimQuad(int enable); int Feb_Control_SetChipSignalsToTrimQuad(int enable);
int Feb_Control_SetReadNRows(int value); int Feb_Control_SetReadNRows(int value);

View File

@ -29,6 +29,8 @@
#define DAQ_REG_HRDWRE_OW_MASTER_MSK (0x00000001 << DAQ_REG_HRDWRE_OW_MASTER_OFST) #define DAQ_REG_HRDWRE_OW_MASTER_MSK (0x00000001 << DAQ_REG_HRDWRE_OW_MASTER_OFST)
#define DAQ_REG_HRDWRE_MASTER_OFST (4) #define DAQ_REG_HRDWRE_MASTER_OFST (4)
#define DAQ_REG_HRDWRE_MASTER_MSK (0x00000001 << DAQ_REG_HRDWRE_MASTER_OFST) #define DAQ_REG_HRDWRE_MASTER_MSK (0x00000001 << DAQ_REG_HRDWRE_MASTER_OFST)
#define DAQ_REG_HRDWRE_DSBL_16BIT_OFST (5)
#define DAQ_REG_HRDWRE_DSBL_16BIT_MSK (0x00000001 << DAQ_REG_HRDWRE_DSBL_16BIT_OFST)
#define DAQ_REG_HRDWRE_PROGRAM_OFST (30) #define DAQ_REG_HRDWRE_PROGRAM_OFST (30)
#define DAQ_REG_HRDWRE_PROGRAM_MSK (0x00000001 << DAQ_REG_HRDWRE_PROGRAM_OFST) #define DAQ_REG_HRDWRE_PROGRAM_MSK (0x00000001 << DAQ_REG_HRDWRE_PROGRAM_OFST)
#define DAQ_REG_HRDWRE_M8_OFST (31) #define DAQ_REG_HRDWRE_M8_OFST (31)

View File

@ -26,12 +26,17 @@ extern int updateFlag;
extern udpStruct udpDetails[MAX_UDP_DESTINATION]; extern udpStruct udpDetails[MAX_UDP_DESTINATION];
extern int numUdpDestinations; extern int numUdpDestinations;
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
extern int ignoreConfigFileFlag;
// Global variable from communication_funcs.c // Global variable from communication_funcs.c
extern int isControlServer; extern int isControlServer;
extern void getMacAddressinString(char *cmac, int size, uint64_t mac); extern void getMacAddressinString(char *cmac, int size, uint64_t mac);
extern void getIpAddressinString(char *cip, uint32_t ip); extern void getIpAddressinString(char *cip, uint32_t ip);
// Variables that will be exported
int masterCommandLine = -1;
int topCommandLine = -1;
int initError = OK; int initError = OK;
int initCheckDone = 0; int initCheckDone = 0;
char initErrorMessage[MAX_STR_LENGTH]; char initErrorMessage[MAX_STR_LENGTH];
@ -226,6 +231,23 @@ int getModuleId(int *ret, char *mess) {
return getModuleIdInFile(ret, mess, ID_FILE); return getModuleIdInFile(ret, mess, ID_FILE);
} }
int updateModuleId() {
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
if (initError == FAIL) {
return FAIL;
}
#ifdef VIRTUAL
eiger_virtual_module_id = modid;
#else
if (Beb_SetModuleId(modid) == FAIL) {
initError = FAIL;
strcpy(initErrorMessage, ("Could not get module id from the file"));
return FAIL;
}
#endif
return OK;
}
u_int64_t getDetectorMAC() { u_int64_t getDetectorMAC() {
char mac[255] = ""; char mac[255] = "";
u_int64_t res = 0; u_int64_t res = 0;
@ -305,46 +327,36 @@ u_int32_t getDetectorIP() {
void initControlServer() { void initControlServer() {
LOG(logINFOBLUE, ("Configuring Control server\n")); LOG(logINFOBLUE, ("Configuring Control server\n"));
if (!updateFlag && initError == OK) { if (!updateFlag && initError == OK) {
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE); if (updateModuleConfiguration() == FAIL) {
#ifdef VIRTUAL initCheckDone = 1;
eiger_virtual_module_id = modid;
#endif
if (initError == FAIL) {
return; return;
} }
getModuleConfiguration();
#ifndef VIRTUAL #ifndef VIRTUAL
sharedMemory_lockLocalLink(); sharedMemory_lockLocalLink();
Feb_Control_SetMasterVariable(master);
Feb_Interface_FebInterface(); Feb_Interface_FebInterface();
Feb_Control_FebControl(); if (!Feb_Control_FebControl(normal)) {
// same addresses for top and bottom
if (!Feb_Control_Init(master, normal)) {
initError = FAIL; initError = FAIL;
sprintf(initErrorMessage, "Could not intitalize feb control\n"); sprintf(initErrorMessage,
"Could not intitalize eiger detector sever: feb control\n");
LOG(logERROR, (initErrorMessage)); LOG(logERROR, (initErrorMessage));
initCheckDone = 1; initCheckDone = 1;
sharedMemory_unlockLocalLink(); sharedMemory_unlockLocalLink();
return; return;
} }
// master of 9M, check high voltage serial communication to blackfin if (Feb_Control_SetMasterEffects(master, isControlServer) == FAIL) {
if (master && !normal) {
if (!Feb_Control_OpenSerialCommunication()) {
initError = FAIL; initError = FAIL;
sprintf( sprintf(initErrorMessage, "Could not intitalize HV for eiger "
initErrorMessage, "detector server: feb control serial "
"Could not intitalize feb control serial communication\n"); "communication\n");
LOG(logERROR, (initErrorMessage)); LOG(logERROR, (initErrorMessage));
initCheckDone = 1; initCheckDone = 1;
sharedMemory_unlockLocalLink(); sharedMemory_unlockLocalLink();
return; return;
} }
}
sharedMemory_unlockLocalLink(); sharedMemory_unlockLocalLink();
LOG(logDEBUG1, ("Control server: FEB Initialization done\n")); LOG(logDEBUG1, ("Control server: FEB Initialization done\n"));
Beb_SetTopVariable(top); Beb_SetTopVariable(top);
Beb_Beb(); Beb_Beb();
Beb_SetModuleId(modid);
LOG(logDEBUG1, ("Control server: BEB Initialization done\n")); LOG(logDEBUG1, ("Control server: BEB Initialization done\n"));
#endif #endif
// also reads config file and deactivates // also reads config file and deactivates
@ -354,73 +366,126 @@ void initControlServer() {
} }
void initStopServer() { void initStopServer() {
#ifdef VIRTUAL if (!updateFlag && initError == OK) {
LOG(logINFOBLUE, ("Configuring Stop server\n")); // wait a few s (control server is setting top/master from config file/
getModuleConfiguration(); // command line)
sharedMemory_setStop(0);
// get top/master in virtual
readConfigFile();
#else
// wait a few s (control server is setting top/master from config file)
usleep(WAIT_STOP_SERVER_START); usleep(WAIT_STOP_SERVER_START);
LOG(logINFOBLUE, ("Configuring Stop server\n")); LOG(logINFOBLUE, ("Configuring Stop server\n"));
// exit(-1); if (updateModuleConfiguration() == FAIL) {
getModuleConfiguration(); initCheckDone = 1;
sharedMemory_lockLocalLink();
Feb_Control_SetMasterVariable(master);
Feb_Interface_FebInterface();
Feb_Control_FebControl();
// same addresses for top and bottom
Feb_Control_Init(master, normal);
sharedMemory_unlockLocalLink();
LOG(logDEBUG1, ("Stop server: FEB Initialization done\n"));
#endif
// client first connect (from shm) will activate
if (setActivate(0) == FAIL) {
LOG(logERROR, ("Could not deactivate in stop server\n"));
}
}
void getModuleConfiguration() {
if (initError == FAIL) {
return; return;
} }
#ifdef VIRTUAL #ifdef VIRTUAL
#ifdef VIRTUAL_MASTER sharedMemory_setStop(0);
master = 1; // force top or master if in config file
top = 1; if (readConfigFile() == FAIL) {
initCheckDone = 1;
return;
}
// force top or master if in command line
if (checkCommandLineConfiguration() == FAIL) {
initCheckDone = 1;
return;
}
#else #else
master = 0; // control server read config file and already set up master/top
#ifdef VIRTUAL_TOP sharedMemory_lockLocalLink();
top = 1; Feb_Interface_FebInterface();
#else if (!Feb_Control_FebControl(normal)) {
top = 0; initError = FAIL;
#endif sprintf(initErrorMessage, "Could not intitalize feb control\n");
LOG(logERROR, (initErrorMessage));
initCheckDone = 1;
sharedMemory_unlockLocalLink();
return;
}
if (Feb_Control_SetMasterEffects(master, isControlServer) == FAIL) {
initError = FAIL;
sprintf(initErrorMessage, "Could not intitalize HV for eiger "
"detector server: feb control serial "
"communication\n");
LOG(logERROR, (initErrorMessage));
initCheckDone = 1;
sharedMemory_unlockLocalLink();
return;
}
sharedMemory_unlockLocalLink();
LOG(logDEBUG1, ("Stop server: FEB Initialization done\n"));
Beb_SetTopVariable(top);
Beb_Beb();
LOG(logDEBUG1, ("Control server: BEB Initialization done\n"));
#endif #endif
// client first connect (from shm) will activate
if (setActivate(0) == FAIL) {
initError = FAIL;
strcpy(initErrorMessage, "Could not deactivate\n");
LOG(logERROR, (initErrorMessage));
}
}
initCheckDone = 1;
}
void checkVirtual9MFlag() {
#ifdef VIRTUAL
#ifdef VIRTUAL_9M #ifdef VIRTUAL_9M
normal = 0; normal = 0;
#else #else
normal = 1; normal = 1;
#endif #endif
#endif
}
#else int updateModuleConfiguration() {
Beb_GetModuleConfiguration(&master, &top, &normal); if (getModuleConfiguration(&master, &top, &normal) == FAIL) {
return FAIL;
}
#ifdef VIRTUAL
checkVirtual9MFlag();
#endif #endif
if (isControlServer) { if (isControlServer) {
LOG(logINFOBLUE, LOG(logINFOBLUE,
("Module: %s %s %s\n", (top ? "TOP" : "BOTTOM"), ("Module: %s %s %s\n", (top ? "TOP" : "BOTTOM"),
(master ? "MASTER" : "SLAVE"), (normal ? "NORMAL" : "SPECIAL"))); (master ? "MASTER" : "SLAVE"), (normal ? "NORMAL" : "SPECIAL")));
} }
return OK;
}
int getModuleConfiguration(int *m, int *t, int *n) {
if (initError == FAIL) {
return FAIL;
}
#ifdef VIRTUAL
*m = master;
*t = top;
*n = normal;
#else
if (Beb_GetModuleConfiguration(m, t, n) == FAIL) {
initError = FAIL;
strcpy(initErrorMessage, ("Could not get module configuration\n"));
LOG(logERROR, (initErrorMessage));
return FAIL;
}
#endif
LOG(logDEBUG,
("module config read: master:%d top:%d normal:%d\n", *m, *t, *n));
return OK;
} }
int readConfigFile() { int readConfigFile() {
if (initError == FAIL) { if (initError == FAIL) {
return initError; return initError;
} }
master = -1;
if (ignoreConfigFileFlag) {
LOG(logWARNING, ("Ignoring Config file\n"));
return OK;
}
#ifndef VIRTUAL
// if not found in config file, they will be reset to hardware settings
top = -1; top = -1;
master = -1;
#endif
const int fileNameSize = 128; const int fileNameSize = 128;
char fname[fileNameSize]; char fname[fileNameSize];
@ -471,91 +536,54 @@ int readConfigFile() {
// top command // top command
if (!strncmp(line, "top", strlen("top"))) { if (!strncmp(line, "top", strlen("top"))) {
int t = -1;
// cannot scan values // cannot scan values
if (sscanf(line, "%s %d", command, &top) != 2) { if (sscanf(line, "%s %d", command, &t) != 2) {
sprintf(initErrorMessage, sprintf(initErrorMessage,
"Could not scan top commands from on-board server " "Could not scan top commands from on-board server "
"config file. Line:[%s].\n", "config file. Line:[%s].\n",
line); line);
break; break;
} }
#ifndef VIRTUAL if (t != 0 && t != 1) {
enum TOPINDEX ind = (top == 1 ? OW_TOP : OW_BOTTOM); sprintf(initErrorMessage,
if (!Beb_SetTop(ind)) { "Invalid top argument from on-board server "
sprintf(
initErrorMessage,
"Could not overwrite top to %d in Beb from on-board server "
"config file. Line:[%s].\n", "config file. Line:[%s].\n",
top, line); line);
break; break;
} }
sharedMemory_lockLocalLink(); if (setTop(t == 1 ? OW_TOP : OW_BOTTOM) == FAIL) {
if (!Feb_Control_SetTop(ind, 1, 1)) { sprintf(initErrorMessage,
sprintf( "Could not set top from config file. Line:[%s].\n",
initErrorMessage, line);
"Could not overwrite top to %d in Feb from on-board server "
"config file. Line:[%s].\n",
top, line);
sharedMemory_unlockLocalLink();
break; break;
} }
sharedMemory_unlockLocalLink();
// validate change
int actual_top = -1, temp = -1, temp2 = -1;
Beb_GetModuleConfiguration(&temp, &actual_top, &temp2);
if (actual_top != top) {
sprintf(initErrorMessage, "Could not set top to %d. Read %d\n",
top, actual_top);
break;
}
Beb_SetTopVariable(top);
#endif
} }
// master command // master command
else if (!strncmp(line, "master", strlen("master"))) { else if (!strncmp(line, "master", strlen("master"))) {
int m = -1;
// cannot scan values // cannot scan values
if (sscanf(line, "%s %d", command, &master) != 2) { if (sscanf(line, "%s %d", command, &m) != 2) {
sprintf(initErrorMessage, sprintf(initErrorMessage,
"Could not scan master commands from on-board server " "Could not scan master commands from on-board server "
"config file. Line:[%s].\n", "config file. Line:[%s].\n",
line); line);
break; break;
} }
#ifndef VIRTUAL if (m != 0 && m != 1) {
enum MASTERINDEX ind = (master == 1 ? OW_MASTER : OW_SLAVE);
if (!Beb_SetMaster(ind)) {
sprintf(initErrorMessage, sprintf(initErrorMessage,
"Could not overwrite master to %d in Beb from on-board " "Invalid master argument from on-board server "
"server "
"config file. Line:[%s].\n", "config file. Line:[%s].\n",
master, line); line);
break; break;
} }
sharedMemory_lockLocalLink(); if (setMaster(m == 1 ? OW_MASTER : OW_SLAVE) == FAIL) {
if (!Feb_Control_SetMaster(ind)) {
sprintf(initErrorMessage, sprintf(initErrorMessage,
"Could not overwrite master to %d in Feb from on-board " "Could not set master from config file. Line:[%s].\n",
"server " line);
"config file. Line:[%s].\n",
master, line);
sharedMemory_unlockLocalLink();
break; break;
} }
sharedMemory_unlockLocalLink();
// validate change
int actual_master = -1, temp = -1, temp2 = -1;
Beb_GetModuleConfiguration(&actual_master, &temp, &temp2);
if (actual_master != master) {
sprintf(initErrorMessage,
"Could not set master to %d. Read %d\n", master,
actual_master);
break;
}
sharedMemory_lockLocalLink();
Feb_Control_SetMasterVariable(master);
sharedMemory_unlockLocalLink();
#endif
} }
// other commands // other commands
@ -576,8 +604,10 @@ int readConfigFile() {
LOG(logINFO, ("Successfully read config file\n")); LOG(logINFO, ("Successfully read config file\n"));
} }
#ifndef VIRTUAL
// reset to hardware settings if not in config file (if overwritten) // reset to hardware settings if not in config file (if overwritten)
resetToHardwareSettings(); resetToHardwareSettings();
#endif
return initError; return initError;
} }
@ -589,55 +619,56 @@ void resetToHardwareSettings() {
} }
// top not set in config file // top not set in config file
if (top == -1) { if (top == -1) {
if (!Beb_SetTop(TOP_HARDWARE)) { LOG(logINFO, ("Resetting Top to hardware settings\n"));
if (setTop(TOP_HARDWARE) == FAIL) {
initError = FAIL; initError = FAIL;
strcpy(initErrorMessage, strcpy(initErrorMessage,
"Could not reset Top flag to Beb hardware settings.\n"); "Could not reset Top flag to hardware settings.\n");
LOG(logERROR, ("%s\n\n", initErrorMessage)); LOG(logERROR, ("%s\n\n", initErrorMessage));
return; return;
} }
sharedMemory_lockLocalLink();
if (!Feb_Control_SetTop(TOP_HARDWARE, 1, 1)) {
initError = FAIL;
strcpy(initErrorMessage,
"Could not reset Top flag to Feb hardware settings.\n");
LOG(logERROR, ("%s\n\n", initErrorMessage));
sharedMemory_unlockLocalLink();
return;
}
sharedMemory_unlockLocalLink();
int temp = -1, temp2 = -1;
Beb_GetModuleConfiguration(&temp, &top, &temp2);
Beb_SetTopVariable(top);
} }
// master not set in config file // master not set in config file
if (master == -1) { if (master == -1) {
if (!Beb_SetMaster(TOP_HARDWARE)) { LOG(logINFO, ("Resetting Master to hardware settings\n"));
if (setMaster(MASTER_HARDWARE) == FAIL) {
initError = FAIL; initError = FAIL;
strcpy(initErrorMessage, strcpy(initErrorMessage,
"Could not reset Master flag to Beb hardware settings.\n"); "Could not reset Master flag to hardware settings.\n");
LOG(logERROR, ("%s\n\n", initErrorMessage)); LOG(logERROR, ("%s\n\n", initErrorMessage));
return; return;
} }
sharedMemory_lockLocalLink();
if (!Feb_Control_SetMaster(TOP_HARDWARE)) {
initError = FAIL;
strcpy(initErrorMessage,
"Could not reset Master flag to Feb hardware settings.\n");
LOG(logERROR, ("%s\n\n", initErrorMessage));
sharedMemory_unlockLocalLink();
return;
}
sharedMemory_unlockLocalLink();
int temp = -1, temp2 = -1;
Beb_GetModuleConfiguration(&master, &temp, &temp2);
sharedMemory_lockLocalLink();
Feb_Control_SetMasterVariable(master);
sharedMemory_unlockLocalLink();
} }
#endif #endif
} }
int checkCommandLineConfiguration() {
if (masterCommandLine != -1) {
LOG(logINFO, ("Setting %s from Command Line\n",
(masterCommandLine == 1 ? "Master" : "Slave")));
if (setMaster(masterCommandLine == 1 ? OW_MASTER : OW_SLAVE) == FAIL) {
initError = FAIL;
sprintf(initErrorMessage, "Could not set %s from command line.\n",
(masterCommandLine == 1 ? "Master" : "Slave"));
LOG(logERROR, (initErrorMessage));
return FAIL;
}
}
if (topCommandLine != -1) {
LOG(logINFO, ("Setting %s from Command Line\n",
(topCommandLine == 1 ? "Top" : "Bottom")));
if (setTop(topCommandLine == 1 ? OW_TOP : OW_BOTTOM) == FAIL) {
initError = FAIL;
sprintf(initErrorMessage, "Could not set %s from command line.\n",
(topCommandLine == 1 ? "Top" : "Bottom"));
LOG(logERROR, (initErrorMessage));
return FAIL;
}
}
return OK;
}
/* set up detector */ /* set up detector */
void allocateDetectorStructureMemory() { void allocateDetectorStructureMemory() {
@ -671,15 +702,29 @@ void allocateDetectorStructureMemory() {
} }
void setupDetector() { void setupDetector() {
allocateDetectorStructureMemory(); allocateDetectorStructureMemory();
// force top or master if in config file
if (readConfigFile() == FAIL)
return;
// force top or master if in command line
if (checkCommandLineConfiguration() == FAIL)
return;
LOG(logINFOBLUE,
("Module: %s %s %s\n", (top ? "TOP" : "BOTTOM"),
(master ? "MASTER" : "SLAVE"), (normal ? "NORMAL" : "SPECIAL")));
if (updateModuleId() == FAIL)
return;
LOG(logINFOBLUE, ("Setting Default Parameters\n"));
resetToDefaultDacs(0); resetToDefaultDacs(0);
#ifdef VIRTUAL #ifdef VIRTUAL
sharedMemory_setStatus(IDLE); sharedMemory_setStatus(IDLE);
setupUDPCommParameters(); setupUDPCommParameters();
#endif #endif
LOG(logINFOBLUE, ("Setting Default Parameters\n"));
// setting default measurement parameters // setting default measurement parameters
setNumFrames(DEFAULT_NUM_FRAMES); setNumFrames(DEFAULT_NUM_FRAMES);
setExpTime(DEFAULT_EXPTIME); setExpTime(DEFAULT_EXPTIME);
@ -719,14 +764,6 @@ void setupDetector() {
} }
sharedMemory_unlockLocalLink(); sharedMemory_unlockLocalLink();
#endif #endif
// force top or master if in config file
if (readConfigFile() == FAIL) {
return;
}
LOG(logINFOBLUE,
("Module: %s %s %s\n", (top ? "TOP" : "BOTTOM"),
(master ? "MASTER" : "SLAVE"), (normal ? "NORMAL" : "SPECIAL")));
if (setNumberofDestinations(numUdpDestinations) == FAIL) { if (setNumberofDestinations(numUdpDestinations) == FAIL) {
initError = FAIL; initError = FAIL;
strcpy(initErrorMessage, "Could not set number of udp destinations\n"); strcpy(initErrorMessage, "Could not set number of udp destinations\n");
@ -821,10 +858,12 @@ int readRegister(uint32_t offset, uint32_t *retval) {
/* set parameters - dr, roi */ /* set parameters - dr, roi */
int setDynamicRange(int dr) { int setDynamicRange(int dr) {
// setting dr if (dr <= 0) {
if (dr > 0) { return FAIL;
LOG(logDEBUG1, ("Setting dynamic range: %d\n", dr)); }
#ifndef VIRTUAL #ifdef VIRTUAL
LOG(logINFO, ("Setting dynamic range: %d\n", dr));
#else
sharedMemory_lockLocalLink(); sharedMemory_lockLocalLink();
if (Feb_Control_SetDynamicRange(dr)) { if (Feb_Control_SetDynamicRange(dr)) {
if (!Beb_SetUpTransferParameters(dr)) { if (!Beb_SetUpTransferParameters(dr)) {
@ -836,14 +875,21 @@ int setDynamicRange(int dr) {
sharedMemory_unlockLocalLink(); sharedMemory_unlockLocalLink();
#endif #endif
eiger_dynamicrange = dr; eiger_dynamicrange = dr;
return OK;
} }
// getting dr
#ifndef VIRTUAL int getDynamicRange(int *retval) {
#ifdef VIRTUAL
*retval = eiger_dynamicrange;
#else
sharedMemory_lockLocalLink(); sharedMemory_lockLocalLink();
eiger_dynamicrange = Feb_Control_GetDynamicRange(); if (!Feb_Control_GetDynamicRange(retval)) {
sharedMemory_unlockLocalLink();
return FAIL;
}
sharedMemory_unlockLocalLink(); sharedMemory_unlockLocalLink();
#endif #endif
return eiger_dynamicrange; return OK;
} }
/* parameters - readout */ /* parameters - readout */
@ -1158,6 +1204,7 @@ int setModule(sls_detector_module myMod, char *mess) {
// if quad, set M8 and PROGRAM manually // if quad, set M8 and PROGRAM manually
if (!Feb_Control_SetChipSignalsToTrimQuad(1)) { if (!Feb_Control_SetChipSignalsToTrimQuad(1)) {
sharedMemory_unlockLocalLink();
return FAIL; return FAIL;
} }
@ -1170,6 +1217,7 @@ int setModule(sls_detector_module myMod, char *mess) {
// if quad, reset M8 and PROGRAM manually // if quad, reset M8 and PROGRAM manually
if (!Feb_Control_SetChipSignalsToTrimQuad(0)) { if (!Feb_Control_SetChipSignalsToTrimQuad(0)) {
sharedMemory_unlockLocalLink();
return FAIL; return FAIL;
} }
@ -1179,6 +1227,7 @@ int setModule(sls_detector_module myMod, char *mess) {
// if quad, reset M8 and PROGRAM manually // if quad, reset M8 and PROGRAM manually
if (!Feb_Control_SetChipSignalsToTrimQuad(0)) { if (!Feb_Control_SetChipSignalsToTrimQuad(0)) {
sharedMemory_unlockLocalLink();
return FAIL; return FAIL;
} }
@ -1450,7 +1499,120 @@ int setHighVoltage(int val) {
/* parameters - timing, extsig */ /* parameters - timing, extsig */
int isMaster() { return master; } int setMaster(enum MASTERINDEX m) {
char *master_names[] = {MASTER_NAMES};
LOG(logINFOBLUE, ("Setting up Master flag as %s\n", master_names[m]));
#ifdef VIRTUAL
switch (m) {
case OW_MASTER:
master = 1;
break;
case OW_SLAVE:
master = 0;
break;
default:
// hardware settings (do nothing)
break;
}
#else
// need to set it only once via the control server
if (isControlServer) {
if (!Beb_SetMaster(m)) {
return FAIL;
}
sharedMemory_lockLocalLink();
if (!Feb_Control_SetMaster(m)) {
sharedMemory_unlockLocalLink();
return FAIL;
}
sharedMemory_unlockLocalLink();
}
// get and update master variable (cannot get from m, could be hardware)
if (isMaster(&master) == FAIL) {
return FAIL;
}
// verify for master and slave (not hardware)
if ((m == OW_MASTER && master == 0) || (m == OW_SLAVE && master == 1)) {
LOG(logERROR,
("could not set master/slave. Master value retrieved %d\n",
master));
return FAIL;
}
// feb variable and hv comms (9m)
sharedMemory_lockLocalLink();
if (Feb_Control_SetMasterEffects(master, isControlServer) == FAIL) {
sharedMemory_unlockLocalLink();
return FAIL;
}
sharedMemory_unlockLocalLink();
#endif
return OK;
}
int isMaster(int *retval) {
int m = -1, t = -1, n = -1;
if (getModuleConfiguration(&m, &t, &n) == FAIL) {
return FAIL;
}
*retval = m;
return OK;
}
int setTop(enum TOPINDEX t) {
char *top_names[] = {TOP_NAMES};
LOG(logINFOBLUE, ("Setting up Top flag as %s\n", top_names[t]));
#ifdef VIRTUAL
switch (t) {
case OW_TOP:
top = 1;
break;
case OW_BOTTOM:
top = 0;
break;
default:
// hardware settings (do nothing)
break;
}
#else
if (!Beb_SetTop(t)) {
return FAIL;
}
sharedMemory_lockLocalLink();
if (!Feb_Control_SetTop(t, 1, 1)) {
sharedMemory_unlockLocalLink();
return FAIL;
}
sharedMemory_unlockLocalLink();
// get and update top variable(cannot get from t, could be hardware)
if (isTop(&top) == FAIL) {
return FAIL;
}
// verify for master and slave (not hardware)
if ((t == OW_TOP && top == 0) || (t == OW_BOTTOM && top == 1)) {
LOG(logERROR,
("could not set top/bottom. Top value retrieved %d\n", top));
return FAIL;
}
Beb_SetTopVariable(top);
#endif
return OK;
}
int isTop(int *retval) {
int m = -1, t = -1, n = -1;
if (getModuleConfiguration(&m, &t, &n) == FAIL) {
return FAIL;
}
*retval = t;
return OK;
}
void setTiming(enum timingMode arg) { void setTiming(enum timingMode arg) {
int ret = 0; int ret = 0;
@ -1923,7 +2085,8 @@ int setRateCorrection(
else if (custom_tau_in_nsec == -1) else if (custom_tau_in_nsec == -1)
custom_tau_in_nsec = Feb_Control_Get_RateTable_Tau_in_nsec(); custom_tau_in_nsec = Feb_Control_Get_RateTable_Tau_in_nsec();
int dr = Feb_Control_GetDynamicRange(); int dr = eiger_dynamicrange;
// get period = subexptime if 32bit , else period = exptime if 16 bit // get period = subexptime if 32bit , else period = exptime if 16 bit
int64_t actual_period = int64_t actual_period =
Feb_Control_GetSubFrameExposureTime(); // already in nsec Feb_Control_GetSubFrameExposureTime(); // already in nsec
@ -2321,7 +2484,7 @@ void *start_timer(void *arg) {
const int maxRows = MAX_ROWS_PER_READOUT; const int maxRows = MAX_ROWS_PER_READOUT;
const int packetsPerFrame = (maxPacketsPerFrame * readNRows) / maxRows; const int packetsPerFrame = (maxPacketsPerFrame * readNRows) / maxRows;
LOG(logDEBUG1, LOG(logDEBUG,
(" dr:%d\n bytesperpixel:%f\n tgenable:%d\n datasize:%d\n " (" dr:%d\n bytesperpixel:%f\n tgenable:%d\n datasize:%d\n "
"packetsize:%d\n maxnumpackes:%d\n npixelsx:%d\n databytes:%d\n", "packetsize:%d\n maxnumpackes:%d\n npixelsx:%d\n databytes:%d\n",
dr, bytesPerPixel, tgEnable, datasize, packetsize, maxPacketsPerFrame, dr, bytesPerPixel, tgEnable, datasize, packetsize, maxPacketsPerFrame,
@ -2338,11 +2501,13 @@ void *start_timer(void *arg) {
npixels /= 2; npixels /= 2;
} }
LOG(logDEBUG1, LOG(logDEBUG1,
("pixels:%d pixelsperpacket:%d\n", npixels, pixelsPerPacket)); ("npixels:%d pixelsperpacket:%d\n", npixels, pixelsPerPacket));
uint8_t *src = (uint8_t *)imageData;
for (int i = 0; i < npixels; ++i) { for (int i = 0; i < npixels; ++i) {
if (i > 0 && i % pixelsPerPacket == 0) { if (i > 0 && i % pixelsPerPacket == 0) {
++pixelVal; ++pixelVal;
} }
switch (dr) { switch (dr) {
case 4: case 4:
*((uint8_t *)(imageData + i)) = *((uint8_t *)(imageData + i)) =
@ -2357,6 +2522,30 @@ void *start_timer(void *arg) {
*((uint8_t *)(imageData + i)) = *((uint8_t *)(imageData + i)) =
eiger_virtual_test_mode ? 0xFE : (uint8_t)pixelVal; eiger_virtual_test_mode ? 0xFE : (uint8_t)pixelVal;
break; break;
case 12:
if (eiger_virtual_test_mode) {
// first 12 bit pixel
// first 8 byte
*src++ = 0xFE;
// second 12bit pixel
++i;
// second 8 byte
*src++ = 0xEF;
// third byte
*src++ = 0xFF;
} else {
// first 12 bit pixel
// first 8 byte
*src++ = (uint8_t)(i & 0xFF);
// second 8 byte (first nibble)
*src = (uint8_t)((i++ >> 8u) & 0xF);
// second 12bit pixel
// second 8 byte (second nibble)
*src++ |= ((uint8_t)(i & 0xF) << 4u);
// third byte
*src++ = (uint8_t)((i >> 4u) & 0xFF);
}
break;
case 16: case 16:
*((uint16_t *)(imageData + i * sizeof(uint16_t))) = *((uint16_t *)(imageData + i * sizeof(uint16_t))) =
eiger_virtual_test_mode ? 0xFFE : (uint16_t)pixelVal; eiger_virtual_test_mode ? 0xFFE : (uint16_t)pixelVal;
@ -2433,9 +2622,27 @@ void *start_timer(void *arg) {
// fill data // fill data
int dstOffset = sizeof(sls_detector_header); int dstOffset = sizeof(sls_detector_header);
int dstOffset2 = sizeof(sls_detector_header); int dstOffset2 = sizeof(sls_detector_header);
{ if (dr == 12) {
for (int psize = 0; psize < datasize; psize += npixelsx) { // multiple of 768,1024,4096
int copysize = 256;
for (int psize = 0; psize < datasize; psize += copysize) {
memcpy(packetData + dstOffset, imageData + srcOffset,
copysize);
memcpy(packetData2 + dstOffset2, imageData + srcOffset2,
copysize);
srcOffset += copysize;
srcOffset2 += copysize;
dstOffset += copysize;
dstOffset2 += copysize;
// reached 1 row (quarter module)
if ((srcOffset % npixelsx) == 0) {
srcOffset += npixelsx;
srcOffset2 += npixelsx;
}
}
} else {
for (int psize = 0; psize < datasize; psize += npixelsx) {
if (dr == 32 && tgEnable == 0) { if (dr == 32 && tgEnable == 0) {
memcpy(packetData + dstOffset, memcpy(packetData + dstOffset,
imageData + srcOffset, npixelsx / 2); imageData + srcOffset, npixelsx / 2);
@ -2733,9 +2940,9 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
int calculateDataBytes() { int calculateDataBytes() {
if (send_to_ten_gig) if (send_to_ten_gig)
return setDynamicRange(-1) * ONE_GIGA_CONSTANT * TEN_GIGA_BUFFER_SIZE; return eiger_dynamicrange * ONE_GIGA_CONSTANT * TEN_GIGA_BUFFER_SIZE;
else else
return setDynamicRange(-1) * TEN_GIGA_CONSTANT * ONE_GIGA_BUFFER_SIZE; return eiger_dynamicrange * TEN_GIGA_CONSTANT * ONE_GIGA_BUFFER_SIZE;
} }
int getTotalNumberOfChannels() { int getTotalNumberOfChannels() {

View File

@ -5,7 +5,7 @@
#define LINKED_SERVER_NAME "eigerDetectorServer" #define LINKED_SERVER_NAME "eigerDetectorServer"
#define REQUIRED_FIRMWARE_VERSION (29) #define REQUIRED_FIRMWARE_VERSION (30)
// virtual ones renamed for consistency // virtual ones renamed for consistency
// real ones keep previous name for compatibility (already in production) // real ones keep previous name for compatibility (already in production)
#ifdef VIRTUAL #ifdef VIRTUAL

View File

@ -28,12 +28,16 @@ extern int updateFlag;
extern int checkModuleFlag; extern int checkModuleFlag;
extern udpStruct udpDetails[MAX_UDP_DESTINATION]; extern udpStruct udpDetails[MAX_UDP_DESTINATION];
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
extern int ignoreConfigFileFlag;
// Global variable from communication_funcs.c // Global variable from communication_funcs.c
extern int isControlServer; extern int isControlServer;
extern void getMacAddressinString(char *cmac, int size, uint64_t mac); extern void getMacAddressinString(char *cmac, int size, uint64_t mac);
extern void getIpAddressinString(char *cip, uint32_t ip); extern void getIpAddressinString(char *cip, uint32_t ip);
// Variables that will be exported
int masterCommandLine = -1;
int initError = OK; int initError = OK;
int initCheckDone = 0; int initCheckDone = 0;
char initErrorMessage[MAX_STR_LENGTH]; char initErrorMessage[MAX_STR_LENGTH];
@ -69,6 +73,7 @@ int64_t burstPeriodReg = 0;
int filterResistor = 0; int filterResistor = 0;
int cdsGain = 0; int cdsGain = 0;
int detPos[2] = {}; int detPos[2] = {};
int master = 1;
int isInitCheckDone() { return initCheckDone; } int isInitCheckDone() { return initCheckDone; }
@ -295,6 +300,18 @@ void setModuleId(int modid) {
bus_r(MOD_ID_REG) | ((modid << MOD_ID_OFST) & MOD_ID_MSK)); bus_r(MOD_ID_REG) | ((modid << MOD_ID_OFST) & MOD_ID_MSK));
} }
int updateModuleId() {
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
if (initError == FAIL) {
return FAIL;
}
#ifdef VIRTUAL
virtual_moduleid = modid;
#endif
setModuleId(modid);
return OK;
}
u_int64_t getDetectorMAC() { u_int64_t getDetectorMAC() {
#ifdef VIRTUAL #ifdef VIRTUAL
return 0; return 0;
@ -358,17 +375,28 @@ void initControlServer() {
} }
void initStopServer() { void initStopServer() {
if (!updateFlag && initError == OK) {
usleep(CTRL_SRVR_INIT_TIME_US); usleep(CTRL_SRVR_INIT_TIME_US);
LOG(logINFOBLUE, ("Configuring Stop server\n"));
if (mapCSP0() == FAIL) { if (mapCSP0() == FAIL) {
LOG(logERROR, initError = FAIL;
("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n")); strcpy(initErrorMessage,
exit(EXIT_FAILURE); "Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
LOG(logERROR, (initErrorMessage));
initCheckDone = 1;
return;
} }
#ifdef VIRTUAL #ifdef VIRTUAL
sharedMemory_setStop(0); sharedMemory_setStop(0);
// not reading config file (nothing of interest to stop server)
if (checkCommandLineConfiguration() == FAIL) {
initCheckDone = 1;
return;
}
#endif #endif
} }
initCheckDone = 1;
}
/* set up detector */ /* set up detector */
@ -480,15 +508,13 @@ void setupDetector() {
return; return;
} }
// set module id in register // master for virtual
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE); if (checkCommandLineConfiguration() == FAIL)
#ifdef VIRTUAL return;
virtual_moduleid = modid;
#endif if (updateModuleId() == FAIL) {
if (initError == FAIL) {
return; return;
} }
setModuleId(modid);
setBurstMode(DEFAULT_BURST_MODE); setBurstMode(DEFAULT_BURST_MODE);
setFilterResistor(DEFAULT_FILTER_RESISTOR); setFilterResistor(DEFAULT_FILTER_RESISTOR);
@ -600,6 +626,11 @@ int readConfigFile() {
return initError; return initError;
} }
if (ignoreConfigFileFlag) {
LOG(logWARNING, ("Ignoring Config file\n"));
return OK;
}
// require a sleep before and after the rst dac signal // require a sleep before and after the rst dac signal
usleep(INITIAL_STARTUP_WAIT); usleep(INITIAL_STARTUP_WAIT);
@ -924,6 +955,21 @@ int readConfigFile() {
return initError; return initError;
} }
int checkCommandLineConfiguration() {
if (masterCommandLine != -1) {
#ifdef VIRTUAL
master = masterCommandLine;
#else
initError = FAIL;
strcpy(initErrorMessage,
"Cannot set Master from command line for this detector. "
"Should have been caught before!\n");
return FAIL;
#endif
}
return OK;
}
/* firmware functions (resets) */ /* firmware functions (resets) */
void cleanFifos() { void cleanFifos() {
@ -952,7 +998,16 @@ void resetPeripheral() {
/* set parameters - dr, roi */ /* set parameters - dr, roi */
int setDynamicRange(int dr) { return DYNAMIC_RANGE; } int setDynamicRange(int dr) {
if (dr == 16)
return OK;
return FAIL;
}
int getDynamicRange(int *retval) {
*retval = DYNAMIC_RANGE;
return OK;
}
/* parameters - timer */ /* parameters - timer */
void setNumFrames(int64_t val) { void setNumFrames(int64_t val) {
@ -1442,6 +1497,11 @@ int setHighVoltage(int val) {
/* parameters - timing */ /* parameters - timing */
int isMaster(int *retval) {
*retval = master;
return OK;
}
void updatingRegisters() { void updatingRegisters() {
LOG(logINFO, ("\tUpdating registers\n")); LOG(logINFO, ("\tUpdating registers\n"));
// burst // burst
@ -1921,9 +1981,17 @@ int checkDetectorType() {
return -2; return -2;
} }
if ((abs(type - TYPE_GOTTHARD2_MODULE_VAL) > TYPE_TOLERANCE) && if (abs(type - TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL) <= TYPE_TOLERANCE) {
(abs(type - TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL) > TYPE_TOLERANCE) && LOG(logINFOBLUE, ("MASTER 25um Module\n"));
(abs(type - TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL) > TYPE_TOLERANCE)) { master = 1;
} else if (abs(type - TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL) <=
TYPE_TOLERANCE) {
master = 0;
LOG(logINFOBLUE, ("SLAVE 25um Module\n"));
} else if (abs(type - TYPE_GOTTHARD2_MODULE_VAL) <= TYPE_TOLERANCE) {
master = -1;
LOG(logINFOBLUE, ("50um Module\n"));
} else {
LOG(logERROR, LOG(logERROR,
("Wrong Module attached! Expected %d, %d or %d for Gotthard2, got " ("Wrong Module attached! Expected %d, %d or %d for Gotthard2, got "
"%d\n", "%d\n",

View File

@ -25,9 +25,11 @@ extern int debugflag;
extern int updateFlag; extern int updateFlag;
extern udpStruct udpDetails[MAX_UDP_DESTINATION]; extern udpStruct udpDetails[MAX_UDP_DESTINATION];
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
extern int ignoreConfigFileFlag;
// Variables that will be exported // Variables that will be exported
int phaseShift = DEFAULT_PHASE_SHIFT; int phaseShift = DEFAULT_PHASE_SHIFT;
int masterCommandLine = -1;
// Global variable from communication_funcs.c // Global variable from communication_funcs.c
extern int isControlServer; extern int isControlServer;
@ -359,16 +361,28 @@ void initControlServer() {
} }
void initStopServer() { void initStopServer() {
if (!updateFlag && initError == OK) {
usleep(CTRL_SRVR_INIT_TIME_US);
LOG(logINFOBLUE, ("Configuring Stop server\n"));
if (mapCSP0() == FAIL) { if (mapCSP0() == FAIL) {
LOG(logERROR, initError = FAIL;
("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n")); strcpy(initErrorMessage,
exit(EXIT_FAILURE); "Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
LOG(logERROR, (initErrorMessage));
initCheckDone = 1;
return;
} }
#ifdef VIRTUAL #ifdef VIRTUAL
sharedMemory_setStop(0); sharedMemory_setStop(0);
#endif #endif
// to get master from file // to get master from file
readConfigFile(); if (readConfigFile() == FAIL ||
checkCommandLineConfiguration() == FAIL) {
initCheckDone = 1;
return;
}
}
initCheckDone = 1;
} }
/* set up detector */ /* set up detector */
@ -421,6 +435,13 @@ void setupDetector() {
setROI(rois); // set adcsyncreg, daqreg, chipofinterestreg, cleanfifos, setROI(rois); // set adcsyncreg, daqreg, chipofinterestreg, cleanfifos,
setGbitReadout(); setGbitReadout();
// no config file or not first time server
if (readConfigFile() == FAIL)
return;
if (checkCommandLineConfiguration() == FAIL)
return;
// master, slave (25um) // master, slave (25um)
setMasterSlaveConfiguration(); setMasterSlaveConfiguration();
@ -624,6 +645,16 @@ void setGbitReadout() {
} }
int readConfigFile() { int readConfigFile() {
if (initError == FAIL) {
return initError;
}
if (ignoreConfigFileFlag) {
LOG(logWARNING, ("Ignoring Config file\n"));
return OK;
}
const int fileNameSize = 128; const int fileNameSize = 128;
char fname[fileNameSize]; char fname[fileNameSize];
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) { if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {
@ -647,7 +678,6 @@ int readConfigFile() {
memset(key, 0, keySize); memset(key, 0, keySize);
char value[keySize]; char value[keySize];
memset(value, 0, keySize); memset(value, 0, keySize);
int scan = OK;
// keep reading a line // keep reading a line
while (fgets(line, lineSize, fd)) { while (fgets(line, lineSize, fd)) {
@ -667,19 +697,22 @@ int readConfigFile() {
master = 0; master = 0;
LOG(logINFOBLUE, ("\tSlave or No Master\n")); LOG(logINFOBLUE, ("\tSlave or No Master\n"));
} else { } else {
LOG(logERROR, initError = FAIL;
("\tCould not scan masterflags %s value from config file\n", sprintf(
value)); initErrorMessage,
scan = FAIL; "Could not scan masterflags %s value from config file\n",
break; value);
LOG(logERROR, (initErrorMessage))
fclose(fd);
return FAIL;
} }
// not first server since detector power on // not first server since detector power on
if (!detectorFirstServer) { if (!detectorFirstServer) {
LOG(logINFOBLUE, ("\tServer has been started up before. " LOG(logWARNING, ("\tServer has been started up before. "
"Ignoring rest of config file\n")); "Ignoring rest of config file\n"));
fclose(fd); fclose(fd);
return FAIL; return OK;
} }
} }
@ -688,11 +721,14 @@ int readConfigFile() {
// convert value to int // convert value to int
int ival = 0; int ival = 0;
if (sscanf(value, "%d", &ival) <= 0) { if (sscanf(value, "%d", &ival) <= 0) {
LOG(logERROR, ("\tCould not scan parameter %s value %s from " initError = FAIL;
sprintf(initErrorMessage,
"Could not scan parameter %s value %s from "
"config file\n", "config file\n",
key, value)); key, value);
scan = FAIL; LOG(logERROR, (initErrorMessage))
break; fclose(fd);
return FAIL;
} }
// set value // set value
if (!strcasecmp(key, "masterdefaultdelay")) if (!strcasecmp(key, "masterdefaultdelay"))
@ -710,16 +746,16 @@ int readConfigFile() {
else if (!strcasecmp(key, "startacqdelay")) else if (!strcasecmp(key, "startacqdelay"))
startacqdelay = ival; startacqdelay = ival;
else { else {
LOG(logERROR, initError = FAIL;
("\tCould not scan parameter %s from config file\n", key)); sprintf(initErrorMessage,
scan = FAIL; "Could not scan parameter %s from config file\n", key);
break; LOG(logERROR, (initErrorMessage))
fclose(fd);
return FAIL;
} }
} }
} }
fclose(fd); fclose(fd);
if (scan == FAIL)
exit(EXIT_FAILURE);
LOG(logINFOBLUE, LOG(logINFOBLUE,
("\tmasterdefaultdelay:%d\n" ("\tmasterdefaultdelay:%d\n"
@ -734,13 +770,28 @@ int readConfigFile() {
return OK; return OK;
} }
int checkCommandLineConfiguration() {
if (masterCommandLine != -1) {
#ifdef VIRTUAL
master = masterCommandLine;
#else
initError = FAIL;
strcpy(initErrorMessage,
"Cannot set Master from command line for this detector. "
"Should have been caught before!\n");
return FAIL;
#endif
}
return OK;
}
void setMasterSlaveConfiguration() { void setMasterSlaveConfiguration() {
LOG(logINFO, ("Reading Master Slave Configuration\n")); // not the first time its being read
if (!detectorFirstServer) {
// no config file or not first time server
if (readConfigFile() == FAIL)
return; return;
}
LOG(logINFO, ("Reading Master Slave Configuration\n"));
// master configuration // master configuration
if (master) { if (master) {
// master default delay set, so reset delay // master default delay set, so reset delay
@ -788,7 +839,16 @@ void setMasterSlaveConfiguration() {
/* set parameters - dr, roi */ /* set parameters - dr, roi */
int setDynamicRange(int dr) { return DYNAMIC_RANGE; } int setDynamicRange(int dr) {
if (dr == 16)
return OK;
return FAIL;
}
int getDynamicRange(int *retval) {
*retval = DYNAMIC_RANGE;
return OK;
}
int setROI(ROI arg) { int setROI(ROI arg) {
@ -1238,7 +1298,10 @@ int setHighVoltage(int val) {
/* parameters - timing, extsig */ /* parameters - timing, extsig */
int isMaster() { return master; } int isMaster(int *retval) {
*retval = master;
return OK;
}
void setTiming(enum timingMode arg) { void setTiming(enum timingMode arg) {
u_int32_t addr = EXT_SIGNAL_REG; u_int32_t addr = EXT_SIGNAL_REG;

View File

@ -28,6 +28,7 @@ extern int updateFlag;
extern udpStruct udpDetails[MAX_UDP_DESTINATION]; extern udpStruct udpDetails[MAX_UDP_DESTINATION];
extern int numUdpDestinations; extern int numUdpDestinations;
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
extern int ignoreConfigFileFlag;
// Global variable from communication_funcs.c // Global variable from communication_funcs.c
extern int isControlServer; extern int isControlServer;
@ -392,12 +393,20 @@ void initControlServer() {
} }
void initStopServer() { void initStopServer() {
if (!updateFlag && initError == OK) {
usleep(CTRL_SRVR_INIT_TIME_US); usleep(CTRL_SRVR_INIT_TIME_US);
LOG(logINFOBLUE, ("Configuring Stop server\n"));
if (mapCSP0() == FAIL) { if (mapCSP0() == FAIL) {
LOG(logERROR, initError = FAIL;
("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n")); strcpy(initErrorMessage,
exit(EXIT_FAILURE); "Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
LOG(logERROR, (initErrorMessage));
initCheckDone = 1;
return;
}
if (readConfigFile() == FAIL) {
initCheckDone = 1;
return;
} }
#ifdef VIRTUAL #ifdef VIRTUAL
sharedMemory_setStop(0); sharedMemory_setStop(0);
@ -406,6 +415,8 @@ void initStopServer() {
setTemperatureEvent(0); setTemperatureEvent(0);
#endif #endif
} }
initCheckDone = 1;
}
/* set up detector */ /* set up detector */
@ -643,6 +654,11 @@ int readConfigFile() {
return initError; return initError;
} }
if (ignoreConfigFileFlag) {
LOG(logWARNING, ("Ignoring Config file\n"));
return OK;
}
const int fileNameSize = 128; const int fileNameSize = 128;
char fname[fileNameSize]; char fname[fileNameSize];
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) { if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {
@ -796,7 +812,16 @@ void resetPeripheral() {
/* set parameters - dr, roi */ /* set parameters - dr, roi */
int setDynamicRange(int dr) { return DYNAMIC_RANGE; } int setDynamicRange(int dr) {
if (dr == 16)
return OK;
return FAIL;
}
int getDynamicRange(int *retval) {
*retval = DYNAMIC_RANGE;
return OK;
}
void setADCInvertRegister(uint32_t val) { void setADCInvertRegister(uint32_t val) {
LOG(logINFO, ("Setting ADC Port Invert Reg to 0x%x\n", val)); LOG(logINFO, ("Setting ADC Port Invert Reg to 0x%x\n", val));

View File

@ -436,17 +436,23 @@ void initControlServer() {
} }
void initStopServer() { void initStopServer() {
if (!updateFlag && initError == OK) {
usleep(CTRL_SRVR_INIT_TIME_US); usleep(CTRL_SRVR_INIT_TIME_US);
LOG(logINFOBLUE, ("Configuring Stop server\n"));
if (mapCSP0() == FAIL) { if (mapCSP0() == FAIL) {
LOG(logERROR, initError = FAIL;
("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n")); strcpy(initErrorMessage,
exit(EXIT_FAILURE); "Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
LOG(logERROR, (initErrorMessage));
initCheckDone = 1;
return;
} }
#ifdef VIRTUAL #ifdef VIRTUAL
sharedMemory_setStop(0); sharedMemory_setStop(0);
#endif #endif
} }
initCheckDone = 1;
}
/* set up detector */ /* set up detector */
@ -706,7 +712,16 @@ void resetPeripheral() {
/* set parameters - dr, adcenablemask */ /* set parameters - dr, adcenablemask */
int setDynamicRange(int dr) { return DYNAMIC_RANGE; } int setDynamicRange(int dr) {
if (dr == 16)
return OK;
return FAIL;
}
int getDynamicRange(int *retval) {
*retval = DYNAMIC_RANGE;
return OK;
}
int setADCEnableMask(uint32_t mask) { int setADCEnableMask(uint32_t mask) {
if (mask == 0u) { if (mask == 0u) {

View File

@ -35,6 +35,9 @@ extern int isControlServer;
extern void getMacAddressinString(char *cmac, int size, uint64_t mac); extern void getMacAddressinString(char *cmac, int size, uint64_t mac);
extern void getIpAddressinString(char *cip, uint32_t ip); extern void getIpAddressinString(char *cip, uint32_t ip);
// Variables that will be exported
int masterCommandLine = -1;
int initError = OK; int initError = OK;
int initCheckDone = 0; int initCheckDone = 0;
char initErrorMessage[MAX_STR_LENGTH]; char initErrorMessage[MAX_STR_LENGTH];
@ -289,6 +292,18 @@ void setModuleId(int modid) {
bus_r(MOD_ID_REG) | ((modid << MOD_ID_OFST) & MOD_ID_MSK)); bus_r(MOD_ID_REG) | ((modid << MOD_ID_OFST) & MOD_ID_MSK));
} }
int updateModuleId() {
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
if (initError == FAIL) {
return FAIL;
}
#ifdef VIRTUAL
virtual_moduleid = modid;
#endif
setModuleId(modid);
return OK;
}
u_int64_t getDetectorMAC() { u_int64_t getDetectorMAC() {
#ifdef VIRTUAL #ifdef VIRTUAL
return 0; return 0;
@ -352,17 +367,27 @@ void initControlServer() {
} }
void initStopServer() { void initStopServer() {
if (!updateFlag && initError == OK) {
usleep(CTRL_SRVR_INIT_TIME_US); usleep(CTRL_SRVR_INIT_TIME_US);
LOG(logINFOBLUE, ("Configuring Stop server\n"));
if (mapCSP0() == FAIL) { if (mapCSP0() == FAIL) {
LOG(logERROR, initError = FAIL;
("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n")); strcpy(initErrorMessage,
exit(EXIT_FAILURE); "Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
LOG(logERROR, (initErrorMessage));
initCheckDone = 1;
return;
} }
#ifdef VIRTUAL #ifdef VIRTUAL
sharedMemory_setStop(0); sharedMemory_setStop(0);
if (checkCommandLineConfiguration() == FAIL) {
initCheckDone = 1;
return;
}
#endif #endif
} }
initCheckDone = 1;
}
/* set up detector */ /* set up detector */
@ -407,6 +432,12 @@ void setupDetector() {
allocateDetectorStructureMemory(); allocateDetectorStructureMemory();
if (checkCommandLineConfiguration() == FAIL)
return;
if (updateModuleId() == FAIL)
return;
clkDivider[READOUT_C0] = DEFAULT_READOUT_C0; clkDivider[READOUT_C0] = DEFAULT_READOUT_C0;
clkDivider[READOUT_C1] = DEFAULT_READOUT_C1; clkDivider[READOUT_C1] = DEFAULT_READOUT_C1;
clkDivider[SYSTEM_C0] = DEFAULT_SYSTEM_C0; clkDivider[SYSTEM_C0] = DEFAULT_SYSTEM_C0;
@ -447,16 +478,6 @@ void setupDetector() {
setASICDefaults(); setASICDefaults();
setADIFDefaults(); setADIFDefaults();
// set module id in register
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
#ifdef VIRTUAL
virtual_moduleid = modid;
#endif
if (initError == FAIL) {
return;
}
setModuleId(modid);
// set trigger flow for m3 (for all timing modes) // set trigger flow for m3 (for all timing modes)
bus_w(FLOW_TRIGGER_REG, bus_r(FLOW_TRIGGER_REG) | FLOW_TRIGGER_MSK); bus_w(FLOW_TRIGGER_REG, bus_r(FLOW_TRIGGER_REG) | FLOW_TRIGGER_MSK);
@ -480,10 +501,6 @@ void setupDetector() {
setInitialExtSignals(); setInitialExtSignals();
// 10G UDP // 10G UDP
enableTenGigabitEthernet(1); enableTenGigabitEthernet(1);
getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
if (initError == FAIL) {
return;
}
setSettings(DEFAULT_SETTINGS); setSettings(DEFAULT_SETTINGS);
// check module type attached if not in debug mode // check module type attached if not in debug mode
@ -700,6 +717,27 @@ void setADIFDefaults() {
ADIF_ADDTNL_OFST_MSK))); ADIF_ADDTNL_OFST_MSK)));
} }
int checkCommandLineConfiguration() {
if (masterCommandLine != -1) {
#ifdef VIRTUAL
if (masterCommandLine == 1) {
bus_w(SYSTEM_STATUS_REG,
bus_r(SYSTEM_STATUS_REG) & ~SYSTEM_STATUS_SLV_BRD_DTCT_MSK);
} else {
bus_w(SYSTEM_STATUS_REG,
bus_r(SYSTEM_STATUS_REG) | SYSTEM_STATUS_SLV_BRD_DTCT_MSK);
}
#else
initError = FAIL;
strcpy(initErrorMessage,
"Cannot set Master from command line for this detector. "
"Should have been caught before!\n");
return FAIL;
#endif
}
return OK;
}
/* firmware functions (resets) */ /* firmware functions (resets) */
void cleanFifos() { void cleanFifos() {
@ -729,7 +767,9 @@ void resetPeripheral() {
/* set parameters - dr, roi */ /* set parameters - dr, roi */
int setDynamicRange(int dr) { int setDynamicRange(int dr) {
if (dr > 0) { if (dr <= 0) {
return FAIL;
}
uint32_t regval = 0; uint32_t regval = 0;
switch (dr) { switch (dr) {
/*case 1: TODO:Not implemented in firmware yet /*case 1: TODO:Not implemented in firmware yet
@ -752,23 +792,29 @@ int setDynamicRange(int dr) {
bus_w(CONFIG_REG, bus_r(CONFIG_REG) & ~CONFIG_DYNAMIC_RANGE_MSK); bus_w(CONFIG_REG, bus_r(CONFIG_REG) & ~CONFIG_DYNAMIC_RANGE_MSK);
bus_w(CONFIG_REG, bus_r(CONFIG_REG) | regval); bus_w(CONFIG_REG, bus_r(CONFIG_REG) | regval);
updatePacketizing(); updatePacketizing();
return OK;
} }
int getDynamicRange(int *retval) {
uint32_t regval = bus_r(CONFIG_REG) & CONFIG_DYNAMIC_RANGE_MSK; uint32_t regval = bus_r(CONFIG_REG) & CONFIG_DYNAMIC_RANGE_MSK;
switch (regval) { switch (regval) {
/*case CONFIG_DYNAMIC_RANGE_1_VAL: TODO:Not implemented in firmware yet /*case CONFIG_DYNAMIC_RANGE_1_VAL: TODO:Not implemented in firmware yet
return 1;*/ return 1;*/
case CONFIG_DYNAMIC_RANGE_8_VAL: case CONFIG_DYNAMIC_RANGE_8_VAL:
return 8; *retval = 8;
break;
case CONFIG_DYNAMIC_RANGE_16_VAL: case CONFIG_DYNAMIC_RANGE_16_VAL:
return 16; *retval = 16;
break;
case CONFIG_DYNAMIC_RANGE_24_VAL: case CONFIG_DYNAMIC_RANGE_24_VAL:
return 32; *retval = 32;
break;
default: default:
LOG(logERROR, ("Invalid dynamic range %d read back\n", LOG(logERROR, ("Invalid dynamic range %d read back\n",
regval >> CONFIG_DYNAMIC_RANGE_OFST)); regval >> CONFIG_DYNAMIC_RANGE_OFST));
return -1; return FAIL;
} }
return OK;
} }
/* set parameters - readout */ /* set parameters - readout */
@ -1091,7 +1137,8 @@ void updatePacketizing() {
// 10g // 10g
if (tgEnable) { if (tgEnable) {
const int dr = setDynamicRange(-1); int dr = 0;
getDynamicRange(&dr);
packetsPerFrame = 1; packetsPerFrame = 1;
if (dr == 32 && ncounters > 1) { if (dr == 32 && ncounters > 1) {
packetsPerFrame = 2; packetsPerFrame = 2;
@ -1545,14 +1592,18 @@ int setHighVoltage(int val) {
/* parameters - timing */ /* parameters - timing */
int isMaster() { int isMaster(int *retval) {
return !((bus_r(SYSTEM_STATUS_REG) & SYSTEM_STATUS_SLV_BRD_DTCT_MSK) >> int slave = ((bus_r(SYSTEM_STATUS_REG) & SYSTEM_STATUS_SLV_BRD_DTCT_MSK) >>
SYSTEM_STATUS_SLV_BRD_DTCT_OFST); SYSTEM_STATUS_SLV_BRD_DTCT_OFST);
*retval = (slave == 0 ? 1 : 0);
return OK;
} }
void setTiming(enum timingMode arg) { void setTiming(enum timingMode arg) {
if (!isMaster() && arg == AUTO_TIMING) int master = 0;
isMaster(&master);
if (master && arg == AUTO_TIMING)
arg = TRIGGER_EXPOSURE; arg = TRIGGER_EXPOSURE;
uint32_t addr = CONFIG_REG; uint32_t addr = CONFIG_REG;
@ -2202,7 +2253,8 @@ void *start_timer(void *arg) {
const int imageSize = calculateDataBytes(); const int imageSize = calculateDataBytes();
const int tgEnable = enableTenGigabitEthernet(-1); const int tgEnable = enableTenGigabitEthernet(-1);
const int dr = setDynamicRange(-1); int dr = 0;
getDynamicRange(&dr);
int ncounters = __builtin_popcount(getCounterMask()); int ncounters = __builtin_popcount(getCounterMask());
int dataSize = 0; int dataSize = 0;
int packetsPerFrame = 0; int packetsPerFrame = 0;
@ -2523,7 +2575,8 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
int calculateDataBytes() { int calculateDataBytes() {
int numCounters = __builtin_popcount(getCounterMask()); int numCounters = __builtin_popcount(getCounterMask());
int dr = setDynamicRange(-1); int dr = 0;
getDynamicRange(&dr);
return (NCHAN_1_COUNTER * NCHIP * numCounters * ((double)dr / 8.00)); return (NCHAN_1_COUNTER * NCHIP * numCounters * ((double)dr / 8.00));
} }

View File

@ -97,6 +97,9 @@ u_int32_t getDetectorNumber();
#if defined(GOTTHARD2D) || defined(EIGERD) || defined(MYTHEN3D) #if defined(GOTTHARD2D) || defined(EIGERD) || defined(MYTHEN3D)
int getModuleId(int *ret, char *mess); int getModuleId(int *ret, char *mess);
#endif #endif
#if defined(EIGERD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
int updateModuleId();
#endif
#if defined(GOTTHARD2D) || defined(MYTHEN3D) #if defined(GOTTHARD2D) || defined(MYTHEN3D)
void setModuleId(int modid); void setModuleId(int modid);
#endif #endif
@ -110,7 +113,11 @@ u_int32_t getBoardRevision();
void initControlServer(); void initControlServer();
void initStopServer(); void initStopServer();
#ifdef EIGERD #ifdef EIGERD
void getModuleConfiguration(); int updateModuleConfiguration();
int getModuleConfiguration(int *m, int *t, int *n);
#ifdef VIRTUAL
void checkVirtual9MFlag();
#endif
#endif #endif
// set up detector // set up detector
@ -137,6 +144,10 @@ void setADIFDefaults();
#if defined(GOTTHARD2D) || defined(EIGERD) || defined(JUNGFRAUD) #if defined(GOTTHARD2D) || defined(EIGERD) || defined(JUNGFRAUD)
int readConfigFile(); int readConfigFile();
#endif #endif
#if defined(GOTTHARDD) || defined(GOTTHARD2D) || defined(EIGERD) || \
defined(MYTHEN3D)
int checkCommandLineConfiguration();
#endif
#ifdef EIGERD #ifdef EIGERD
void resetToHardwareSettings(); void resetToHardwareSettings();
#endif #endif
@ -173,6 +184,7 @@ void setMasterSlaveConfiguration();
// parameters - dr, roi // parameters - dr, roi
int setDynamicRange(int dr); int setDynamicRange(int dr);
int getDynamicRange(int *retval);
#ifdef GOTTHARDD #ifdef GOTTHARDD
int setROI(ROI arg); int setROI(ROI arg);
ROI getROI(); ROI getROI();
@ -362,9 +374,16 @@ int getADC(enum ADCINDEX ind);
int setHighVoltage(int val); int setHighVoltage(int val);
// parameters - timing, extsig // parameters - timing, extsig
#if defined(MYTHEN3D) || defined(EIGERD) || defined(GOTTHARDD) #ifdef EIGERD
int isMaster(); int setMaster(enum MASTERINDEX m);
int setTop(enum TOPINDEX t);
int isTop(int *retval);
#endif #endif
#if defined(MYTHEN3D) || defined(EIGERD) || defined(GOTTHARDD) || \
defined(GOTTHARD2D)
int isMaster(int *retval);
#endif
#ifdef GOTTHARD2D #ifdef GOTTHARD2D
void updatingRegisters(); void updatingRegisters();
#endif #endif

View File

@ -245,6 +245,7 @@ int get_pattern(int);
int load_default_pattern(int); int load_default_pattern(int);
int get_all_threshold_energy(int); int get_all_threshold_energy(int);
int get_master(int); int get_master(int);
int set_master(int);
int get_csr(); int get_csr();
int set_gain_caps(int); int set_gain_caps(int);
int get_gain_caps(int); int get_gain_caps(int);
@ -290,3 +291,5 @@ void receive_program_default(int file_des, enum PROGRAM_INDEX index,
char *checksum, char *serverName); char *checksum, char *serverName);
int get_update_mode(int); int get_update_mode(int);
int set_update_mode(int); int set_update_mode(int);
int get_top(int);
int set_top(int);

View File

@ -26,11 +26,19 @@ extern int sockfd;
extern int debugflag; extern int debugflag;
extern int updateFlag; extern int updateFlag;
extern int checkModuleFlag; extern int checkModuleFlag;
extern int ignoreConfigFileFlag;
// Global variables from slsDetectorFunctionList // Global variables from slsDetectorFunctionList
#ifdef GOTTHARDD #ifdef GOTTHARDD
extern int phaseShift; extern int phaseShift;
#endif #endif
#if defined(GOTTHARDD) || defined(GOTTHARD2D) || defined(EIGERD) || \
defined(MYTHEN3D)
extern int masterCommandLine;
#endif
#ifdef EIGERD
extern int topCommandLine;
#endif
void error(char *msg) { perror(msg); } void error(char *msg) { perror(msg); }
@ -48,6 +56,14 @@ int main(int argc, char *argv[]) {
updateFlag = 0; updateFlag = 0;
checkModuleFlag = 1; checkModuleFlag = 1;
int version = 0; int version = 0;
ignoreConfigFileFlag = 0;
#if defined(GOTTHARDD) || defined(GOTTHARD2D) || defined(EIGERD) || \
defined(MYTHEN3D)
masterCommandLine = -1;
#endif
#ifdef EIGERD
topCommandLine = -1;
#endif
// help message // help message
char helpMessage[MAX_STR_LENGTH]; char helpMessage[MAX_STR_LENGTH];
@ -58,15 +74,23 @@ 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-g, --nomodule : [Mythen3][Gotthard2] Generic or No " "\t-g, --nomodule : [Mythen3][Gotthard2] \n"
"Module mode. Skips detector type checks. \n" "\t Generic or No 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-d, --devel : Developer mode. Skips firmware checks. \n"
"\t-u, --update : Update mode. Skips firmware checks and " "\t-u, --update : Update mode. Skips firmware checks and "
"initial detector setup. \n" "initial detector setup. \n"
"\t-i, --ignore-config : "
"[Eiger][Jungfrau][Gotthard][Gotthard2] \n"
"\t Ignore config file. \n"
"\t-m, --master <master> : [Eiger][Mythen3][Gotthard][Gotthard2] \n"
"\t Set Master to 0 or 1. Precedence over "
"config file. Only for virtual servers except Eiger. \n"
"\t-t, --top <top> : [Eiger] Set Top to 0 or 1. Precedence "
"over config file. \n"
"\t-s, --stopserver : Stop server. Do not use as it is created " "\t-s, --stopserver : Stop server. Do not use as it is created "
"by " "by control server \n\n",
"control server \n\n",
argv[0]); argv[0]);
// parse command line for config // parse command line for config
@ -80,6 +104,9 @@ int main(int argc, char *argv[]) {
{"nomodule", no_argument, NULL, 'g'}, // generic {"nomodule", no_argument, NULL, 'g'}, // generic
{"devel", no_argument, NULL, 'd'}, {"devel", no_argument, NULL, 'd'},
{"update", no_argument, NULL, 'u'}, {"update", no_argument, NULL, 'u'},
{"ignore-config", no_argument, NULL, 'i'},
{"master", required_argument, NULL, 'm'},
{"top", required_argument, NULL, 't'},
{"stopserver", no_argument, NULL, 's'}, {"stopserver", no_argument, NULL, 's'},
{NULL, 0, NULL, 0}}; {NULL, 0, NULL, 0}};
@ -89,7 +116,8 @@ int main(int argc, char *argv[]) {
int c = 0; int c = 0;
while (c != -1) { while (c != -1) {
c = getopt_long(argc, argv, "hvp:f:gdus", long_options, &option_index); c = getopt_long(argc, argv, "hvp:f:gduim:t:s", long_options,
&option_index);
// Detect the end of the options // Detect the end of the options
if (c == -1) if (c == -1)
@ -160,6 +188,57 @@ int main(int argc, char *argv[]) {
isControlServer = 0; isControlServer = 0;
break; break;
case 'i':
#if defined(EIGERD) || defined(GOTTHARDD) || defined(GOTTHARD2D) || \
defined(JUNGFRAUD)
LOG(logINFO, ("Ignoring config file\n"));
ignoreConfigFileFlag = 1;
#else
LOG(logERROR, ("No server config files for this detector\n"));
exit(EXIT_FAILURE);
#endif
break;
case 'm':
#if (defined(MYTHEN3D) || defined(GOTTHARDD) || defined(GOTTHARD2D)) && \
!defined(VIRTUAL)
LOG(logERROR, ("Cannot set master via the detector server for this "
"detector\n"));
exit(EXIT_FAILURE);
#elif defined(GOTTHARDD) || defined(GOTTHARD2D) || defined(EIGERD) || \
defined(MYTHEN3D)
if (sscanf(optarg, "%d", &masterCommandLine) != 1) {
LOG(logERROR, ("Cannot scan master argument\n%s", helpMessage));
exit(EXIT_FAILURE);
}
if (masterCommandLine == 1) {
LOG(logINFO, ("Detector Master mode\n"));
} else {
LOG(logINFO, ("Detector Slave mode\n"));
}
#else
LOG(logERROR, ("No master implemented for this detector server\n"));
exit(EXIT_FAILURE);
#endif
break;
case 't':
#ifdef EIGERD
if (sscanf(optarg, "%d", &topCommandLine) != 1) {
LOG(logERROR, ("Cannot scan top argument\n%s", helpMessage));
exit(EXIT_FAILURE);
}
if (topCommandLine == 1) {
LOG(logINFO, ("Detector Top mode\n"));
} else {
LOG(logINFO, ("Detector Bottom mode\n"));
}
#else
LOG(logERROR, ("No top implemented for this detector server\n"));
exit(EXIT_FAILURE);
#endif
break;
case 'h': case 'h':
printf("%s", helpMessage); printf("%s", helpMessage);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);

View File

@ -54,6 +54,7 @@ int sockfd = 0;
int debugflag = 0; int debugflag = 0;
int updateFlag = 0; int updateFlag = 0;
int checkModuleFlag = 1; int checkModuleFlag = 1;
int ignoreConfigFileFlag = 0;
udpStruct udpDetails[MAX_UDP_DESTINATION]; udpStruct udpDetails[MAX_UDP_DESTINATION];
int numUdpDestinations = 1; int numUdpDestinations = 1;
@ -468,6 +469,9 @@ void function_table() {
flist[F_UPDATE_DETECTOR_SERVER] = &update_detector_server; flist[F_UPDATE_DETECTOR_SERVER] = &update_detector_server;
flist[F_GET_UPDATE_MODE] = &get_update_mode; flist[F_GET_UPDATE_MODE] = &get_update_mode;
flist[F_SET_UPDATE_MODE] = &set_update_mode; flist[F_SET_UPDATE_MODE] = &set_update_mode;
flist[F_SET_MASTER] = &set_master;
flist[F_GET_TOP] = &get_top;
flist[F_SET_TOP] = &set_top;
// check // check
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) { if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
@ -2815,6 +2819,9 @@ int set_dynamic_range(int file_des) {
#endif #endif
#if defined(EIGERD) || defined(MYTHEN3D) #if defined(EIGERD) || defined(MYTHEN3D)
case 8: case 8:
#ifdef EIGERD
case 12:
#endif
case 16: case 16:
case 32: case 32:
#endif #endif
@ -2822,14 +2829,25 @@ int set_dynamic_range(int file_des) {
defined(MOENCHD) || defined(GOTTHARD2D) defined(MOENCHD) || defined(GOTTHARD2D)
case 16: case 16:
#endif #endif
retval = setDynamicRange(dr); if (dr >= 0) {
LOG(logDEBUG1, ("Dynamic range: %d\n", retval)); ret = setDynamicRange(dr);
if (retval == -1) { if (ret == FAIL) {
ret = FAIL; sprintf(mess, "Could not set dynamic range to %d\n", dr);
sprintf(mess, "Could not get dynamic range.\n");
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} }
}
// get
if (ret == OK) {
ret = getDynamicRange(&retval);
if (ret == FAIL) {
strcpy(mess, "Could not get dynamic range\n");
LOG(logERROR, (mess));
} else {
LOG(logDEBUG1, ("Dynamic range: %d\n", retval));
validate(&ret, mess, dr, retval, "set dynamic range", DEC); validate(&ret, mess, dr, retval, "set dynamic range", DEC);
}
}
break; break;
default: default:
modeNotImplemented("Dynamic range", dr); modeNotImplemented("Dynamic range", dr);
@ -3977,7 +3995,6 @@ int check_version(int file_des) {
return printSocketReadError(); return printSocketReadError();
// check software- firmware compatibility and basic tests // check software- firmware compatibility and basic tests
if (isControlServer) {
LOG(logDEBUG1, ("Checking software-firmware compatibility and basic " LOG(logDEBUG1, ("Checking software-firmware compatibility and basic "
"test result\n")); "test result\n"));
@ -3986,12 +4003,11 @@ int check_version(int file_des) {
usleep(3 * 1000 * 1000); usleep(3 * 1000 * 1000);
if (!isInitCheckDone()) { if (!isInitCheckDone()) {
ret = FAIL; ret = FAIL;
strcpy(mess, "Firmware Software Compatibility Check (Server " strcpy(mess, "Server Initialization still not done done in server. Unexpected.\n");
"Initialization) "
"still not done done in server. Unexpected.\n");
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} }
} }
// check firmware check result // check firmware check result
if (ret == OK) { if (ret == OK) {
char *firmware_message = NULL; char *firmware_message = NULL;
@ -4001,7 +4017,6 @@ int check_version(int file_des) {
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} }
} }
}
if (ret == OK) { if (ret == OK) {
LOG(logDEBUG1, LOG(logDEBUG1,
@ -4650,11 +4665,17 @@ int set_read_n_rows(int file_des) {
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else { } else {
#ifdef EIGERD #ifdef EIGERD
int dr = setDynamicRange(GET_FLAG); int dr = 0;
ret = getDynamicRange(&dr);
int isTenGiga = enableTenGigabitEthernet(GET_FLAG); int isTenGiga = enableTenGigabitEthernet(GET_FLAG);
unsigned int maxnl = MAX_ROWS_PER_READOUT; unsigned int maxnl = MAX_ROWS_PER_READOUT;
unsigned int maxnp = (isTenGiga ? 4 : 16) * dr; unsigned int maxnp = (isTenGiga ? 4 : 16) * dr;
if ((arg * maxnp) % maxnl) { // get dr fail
if (ret == FAIL) {
strcpy(mess,
"Could not read n rows (failed to get dynamic range)\n");
LOG(logERROR, (mess));
} else if ((arg * maxnp) % maxnl) {
ret = FAIL; ret = FAIL;
sprintf(mess, sprintf(mess,
"Could not set number of rows to %d. For %d bit " "Could not set number of rows to %d. For %d bit "
@ -4862,6 +4883,7 @@ int is_udp_configured() {
LOG(logWARNING, ("%s", configureMessage)); LOG(logWARNING, ("%s", configureMessage));
return FAIL; return FAIL;
} }
// virtual: no check (can be eth name: lo, ip: 127.0.0.1)
#ifndef VIRTUAL #ifndef VIRTUAL
if (udpDetails[i].dstmac == 0) { if (udpDetails[i].dstmac == 0) {
sprintf(configureMessage, sprintf(configureMessage,
@ -7111,7 +7133,10 @@ int get_receiver_parameters(int file_des) {
} }
// dynamic range // dynamic range
i32 = setDynamicRange(GET_FLAG); ret = getDynamicRange(&i32);
if (ret == FAIL) {
i32 = 0;
}
n += sendData(file_des, &i32, sizeof(i32), INT32); n += sendData(file_des, &i32, sizeof(i32), INT32);
if (n < 0) if (n < 0)
return printSocketReadError(); return printSocketReadError();
@ -8193,14 +8218,60 @@ int get_master(int file_des) {
LOG(logDEBUG1, ("Getting master\n")); LOG(logDEBUG1, ("Getting master\n"));
#if !defined(MYTHEN3D) && !defined(EIGERD) && !defined(GOTTHARDD) #if !defined(MYTHEN3D) && !defined(EIGERD) && !defined(GOTTHARDD) && \
!defined(GOTTHARD2D)
functionNotImplemented(); functionNotImplemented();
#else #else
retval = isMaster(); ret = isMaster(&retval);
if (ret == FAIL) {
strcpy(mess, "Could not get master\n");
LOG(logERROR, (mess));
}
#endif #endif
return Server_SendResult(file_des, INT32, &retval, sizeof(retval)); return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
} }
int set_master(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int arg = -1;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError();
LOG(logDEBUG1, ("Setting master: %u\n", (int)arg));
#ifndef EIGERD
functionNotImplemented();
#else
// only set
if (Server_VerifyLock() == OK) {
if ((check_detector_idle("set master") == OK) &&
(arg != 0 && arg != 1)) {
ret = FAIL;
sprintf(mess, "Could not set master. Invalid argument %d.\n", arg);
LOG(logERROR, (mess));
} else {
ret = setMaster(arg == 1 ? OW_MASTER : OW_SLAVE);
if (ret == FAIL) {
strcpy(mess, "Could not set master\n");
LOG(logERROR, (mess));
} else {
int retval = 0;
ret = isMaster(&retval);
if (ret == FAIL) {
strcpy(mess, "Could not get master\n");
LOG(logERROR, (mess));
} else {
LOG(logDEBUG1, ("master retval: %u\n", retval));
validate(&ret, mess, arg, retval, "set master", DEC);
}
}
}
}
#endif
return Server_SendResult(file_des, INT32, NULL, 0);
}
int get_csr(int file_des) { int get_csr(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
@ -9675,3 +9746,65 @@ int set_update_mode(int file_des) {
return Server_SendResult(file_des, INT32, NULL, 0); return Server_SendResult(file_des, INT32, NULL, 0);
} }
int get_top(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int retval = -1;
LOG(logDEBUG1, ("Getting top\n"));
#ifndef EIGERD
functionNotImplemented();
#else
// get only
ret = isTop(&retval);
if (ret == FAIL) {
strcpy(mess, "Could not get Top\n");
LOG(logERROR, (mess));
} else {
LOG(logDEBUG1, ("retval top: %d\n", retval));
}
#endif
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
}
int set_top(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int arg = -1;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError();
LOG(logDEBUG1, ("Setting top : %u\n", arg));
#ifndef EIGERD
functionNotImplemented();
#else
// only set
if (Server_VerifyLock() == OK) {
if (arg != 0 && arg != 1) {
ret = FAIL;
sprintf(mess, "Could not set top mode. Invalid value: %d. Must be 0 or 1\n", arg);
LOG(logERROR, (mess));
} else {
ret = setTop(arg == 1 ? OW_TOP : OW_BOTTOM);
if (ret == FAIL) {
sprintf(mess, "Could not set %s\n", (arg == 1 ? "Top" : "Bottom"));
LOG(logERROR, (mess));
} else {
int retval = -1;
ret = isTop(&retval);
if (ret == FAIL) {
strcpy(mess, "Could not get Top mode\n");
LOG(logERROR, (mess));
} else {
LOG(logDEBUG1, ("retval top: %d\n", retval));
validate(&ret, mess, arg, retval, "set top mode", DEC);
}
}
}
}
#endif
return Server_SendResult(file_des, INT32, NULL, 0);
}

View File

@ -193,6 +193,12 @@ class Detector {
*/ */
void setFlipRows(bool value, Positions pos = {}); void setFlipRows(bool value, Positions pos = {});
/** [Eiger][Mythen3][Gotthard1] via stop server **/
Result<bool> getMaster(Positions pos = {}) const;
/** [Eiger] Set half module to master and the others to slaves */
void setMaster(bool value, int pos);
Result<bool> isVirtualDetectorServer(Positions pos = {}) const; Result<bool> isVirtualDetectorServer(Positions pos = {}) const;
///@} ///@}
@ -284,7 +290,7 @@ class Detector {
Result<int> getDynamicRange(Positions pos = {}) const; Result<int> getDynamicRange(Positions pos = {}) const;
/** /**
* [Eiger] Options: 4, 8, 16, 32. If i is 32, also sets clkdivider to 2, * [Eiger] Options: 4, 8, 12, 16, 32. If i is 32, also sets clkdivider to 2,
* else sets clkdivider to 1 \n [Mythen3] Options: 8, 16, 32 \n * else sets clkdivider to 1 \n [Mythen3] Options: 8, 16, 32 \n
* [Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16 * [Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16
*/ */
@ -1151,6 +1157,12 @@ class Detector {
void setDataStream(const defs::portPosition port, const bool enable, void setDataStream(const defs::portPosition port, const bool enable,
Positions pos = {}); Positions pos = {});
/** [Eiger] Advanced */
Result<bool> getTop(Positions pos = {}) const;
/** [Eiger] Advanced. Default is hardware default */
void setTop(bool value, Positions pos = {});
///@} ///@}
/** @name Jungfrau Specific */ /** @name Jungfrau Specific */
@ -1448,9 +1460,6 @@ class Detector {
* (internal gating). Gate index: 0-2, -1 for all */ * (internal gating). Gate index: 0-2, -1 for all */
Result<std::array<ns, 3>> getGateDelayForAllGates(Positions pos = {}) const; Result<std::array<ns, 3>> getGateDelayForAllGates(Positions pos = {}) const;
/** [Eiger][Mythen3][Gotthard1] via stop server **/
Result<bool> getMaster(Positions pos = {}) const;
// TODO! check if we really want to expose this !!!!! // TODO! check if we really want to expose this !!!!!
Result<int> getChipStatusRegister(Positions pos = {}) const; Result<int> getChipStatusRegister(Positions pos = {}) const;

View File

@ -784,6 +784,7 @@ class CmdProxy {
{"trimen", &CmdProxy::TrimEnergies}, {"trimen", &CmdProxy::TrimEnergies},
{"gappixels", &CmdProxy::GapPixels}, {"gappixels", &CmdProxy::GapPixels},
{"fliprows", &CmdProxy::fliprows}, {"fliprows", &CmdProxy::fliprows},
{"master", &CmdProxy::master},
/* acquisition parameters */ /* acquisition parameters */
{"acquire", &CmdProxy::Acquire}, {"acquire", &CmdProxy::Acquire},
@ -942,6 +943,7 @@ class CmdProxy {
{"pulsechip", &CmdProxy::PulseChip}, {"pulsechip", &CmdProxy::PulseChip},
{"quad", &CmdProxy::Quad}, {"quad", &CmdProxy::Quad},
{"datastream", &CmdProxy::DataStream}, {"datastream", &CmdProxy::DataStream},
{"top", &CmdProxy::top},
/* Jungfrau Specific */ /* Jungfrau Specific */
{"chipversion", &CmdProxy::chipversion}, {"chipversion", &CmdProxy::chipversion},
@ -1109,7 +1111,6 @@ class CmdProxy {
/* acquisition parameters */ /* acquisition parameters */
std::string Acquire(int action); std::string Acquire(int action);
std::string Exptime(int action); std::string Exptime(int action);
std::string DynamicRange(int action);
std::string ReadoutSpeed(int action); std::string ReadoutSpeed(int action);
std::string Adcphase(int action); std::string Adcphase(int action);
std::string Dbitphase(int action); std::string Dbitphase(int action);
@ -1281,6 +1282,12 @@ class CmdProxy {
"interfaces must be set to 2. slsReceiver and slsDetectorGui " "interfaces must be set to 2. slsReceiver and slsDetectorGui "
"does not handle."); "does not handle.");
INTEGER_COMMAND_VEC_ID_GET(
master, getMaster, setMaster, StringTo<int>,
"[0, 1]\n\t[Eiger] Sets half module to master and "
"others to slaves.\n\t[Gotthard][Gotthard2][Mythen3][Eiger] "
"Gets if the current module/ half module is master.");
/* acquisition parameters */ /* acquisition parameters */
INTEGER_COMMAND_SET_NOID_GET_ID( INTEGER_COMMAND_SET_NOID_GET_ID(
@ -1328,7 +1335,7 @@ class CmdProxy {
dr, getDynamicRange, setDynamicRange, StringTo<int>, dr, getDynamicRange, setDynamicRange, StringTo<int>,
"[value]\n\tDynamic Range or number of bits per " "[value]\n\tDynamic Range or number of bits per "
"pixel in detector.\n\t" "pixel in detector.\n\t"
"[Eiger] Options: 4, 8, 16, 32. If set to 32, also sets " "[Eiger] Options: 4, 8, 12, 16, 32. If set to 32, also sets "
"clkdivider to 2, else to 0.\n\t" "clkdivider to 2, else to 0.\n\t"
"[Mythen3] Options: 8, 16, 32\n\t" "[Mythen3] Options: 8, 16, 32\n\t"
"[Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16"); "[Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16");
@ -1901,6 +1908,10 @@ class CmdProxy {
"start of acquisition. 0 complete reset, 1 partial reset. Default is " "start of acquisition. 0 complete reset, 1 partial reset. Default is "
"complete reset. Advanced function!"); "complete reset. Advanced function!");
INTEGER_COMMAND_VEC_ID(
top, getTop, setTop, StringTo<int>,
"[0, 1]\n\t[Eiger] Sets half module to top (1), else bottom.");
/* Jungfrau Specific */ /* Jungfrau Specific */
GET_COMMAND(chipversion, getChipVersion, GET_COMMAND(chipversion, getChipVersion,

View File

@ -298,6 +298,23 @@ void Detector::setFlipRows(bool value, Positions pos) {
pimpl->Parallel(&Module::setFlipRows, pos, value); pimpl->Parallel(&Module::setFlipRows, pos, value);
} }
Result<bool> Detector::getMaster(Positions pos) const {
return pimpl->Parallel(&Module::isMaster, pos);
}
void Detector::setMaster(bool master, int pos) {
// multi mod, set slaves first
if (master && size() > 1) {
if (pos == -1) {
throw RuntimeError("Master can be set only to a single module");
}
pimpl->Parallel(&Module::setMaster, {}, false);
pimpl->Parallel(&Module::setMaster, {pos}, master);
} else {
pimpl->Parallel(&Module::setMaster, {pos}, master);
}
}
Result<bool> Detector::isVirtualDetectorServer(Positions pos) const { Result<bool> Detector::isVirtualDetectorServer(Positions pos) const {
return pimpl->Parallel(&Module::isVirtualDetectorServer, pos); return pimpl->Parallel(&Module::isVirtualDetectorServer, pos);
} }
@ -387,7 +404,7 @@ void Detector::setDynamicRange(int value) {
std::vector<int> Detector::getDynamicRangeList() const { std::vector<int> Detector::getDynamicRangeList() const {
switch (getDetectorType().squash()) { switch (getDetectorType().squash()) {
case defs::EIGER: case defs::EIGER:
return std::vector<int>{4, 8, 16, 32}; return std::vector<int>{4, 8, 12, 16, 32};
case defs::MYTHEN3: case defs::MYTHEN3:
return std::vector<int>{8, 16, 32}; return std::vector<int>{8, 16, 32};
default: default:
@ -1507,6 +1524,14 @@ void Detector::setDataStream(const defs::portPosition port, const bool enable,
pimpl->Parallel(&Module::setDataStream, pos, port, enable); pimpl->Parallel(&Module::setDataStream, pos, port, enable);
} }
Result<bool> Detector::getTop(Positions pos) const {
return pimpl->Parallel(&Module::getTop, pos);
}
void Detector::setTop(bool value, Positions pos) {
pimpl->Parallel(&Module::setTop, pos, value);
}
// Jungfrau Specific // Jungfrau Specific
Result<double> Detector::getChipVersion(Positions pos) const { Result<double> Detector::getChipVersion(Positions pos) const {
return pimpl->Parallel(&Module::getChipVersion, pos); return pimpl->Parallel(&Module::getChipVersion, pos);
@ -1826,10 +1851,6 @@ Detector::getGateDelayForAllGates(Positions pos) const {
return pimpl->Parallel(&Module::getGateDelayForAllGates, pos); return pimpl->Parallel(&Module::getGateDelayForAllGates, pos);
} }
Result<bool> Detector::getMaster(Positions pos) const {
return pimpl->Parallel(&Module::isMaster, pos);
}
Result<int> Detector::getChipStatusRegister(Positions pos) const { Result<int> Detector::getChipStatusRegister(Positions pos) const {
return pimpl->Parallel(&Module::getChipStatusRegister, pos); return pimpl->Parallel(&Module::getChipStatusRegister, pos);
} }

View File

@ -509,6 +509,13 @@ void Module::setFlipRows(bool value) {
} }
} }
bool Module::isMaster() const { return sendToDetectorStop<int>(F_GET_MASTER); }
void Module::setMaster(const bool master) {
sendToDetector(F_SET_MASTER, static_cast<int>(master), nullptr);
sendToDetectorStop(F_SET_MASTER, static_cast<int>(master), nullptr);
}
bool Module::isVirtualDetectorServer() const { bool Module::isVirtualDetectorServer() const {
return sendToDetector<int>(F_IS_VIRTUAL); return sendToDetector<int>(F_IS_VIRTUAL);
} }
@ -1673,6 +1680,14 @@ void Module::setDataStream(const portPosition port, const bool enable) {
} }
} }
bool Module::getTop() const {
return (static_cast<bool>(sendToDetector<int>(F_GET_TOP)));
}
void Module::setTop(bool value) {
sendToDetector(F_SET_TOP, static_cast<int>(value), nullptr);
}
// Jungfrau Specific // Jungfrau Specific
double Module::getChipVersion() const { double Module::getChipVersion() const {
return (sendToDetector<int>(F_GET_CHIP_VERSION)) / 10.00; return (sendToDetector<int>(F_GET_CHIP_VERSION)) / 10.00;
@ -2197,8 +2212,6 @@ std::array<time::ns, 3> Module::getGateDelayForAllGates() const {
return sendToDetector<std::array<time::ns, 3>>(F_GET_GATE_DELAY_ALL_GATES); return sendToDetector<std::array<time::ns, 3>>(F_GET_GATE_DELAY_ALL_GATES);
} }
bool Module::isMaster() const { return sendToDetectorStop<int>(F_GET_MASTER); }
int Module::getChipStatusRegister() const { int Module::getChipStatusRegister() const {
return sendToDetector<int>(F_GET_CSR); return sendToDetector<int>(F_GET_CSR);
} }

View File

@ -120,6 +120,9 @@ class Module : public virtual slsDetectorDefs {
int setTrimEn(const std::vector<int> &energies = {}); int setTrimEn(const std::vector<int> &energies = {});
bool getFlipRows() const; bool getFlipRows() const;
void setFlipRows(bool value); void setFlipRows(bool value);
bool isMaster() const;
void setMaster(const bool master);
bool isVirtualDetectorServer() const; bool isVirtualDetectorServer() const;
/************************************************** /**************************************************
@ -184,6 +187,7 @@ class Module : public virtual slsDetectorDefs {
void setDBITPipeline(int value); void setDBITPipeline(int value);
int getReadNRows() const; int getReadNRows() const;
void setReadNRows(const int value); void setReadNRows(const int value);
/************************************************** /**************************************************
* * * *
* Acquisition * * Acquisition *
@ -365,6 +369,8 @@ class Module : public virtual slsDetectorDefs {
void setQuad(const bool enable); void setQuad(const bool enable);
bool getDataStream(const portPosition port) const; bool getDataStream(const portPosition port) const;
void setDataStream(const portPosition port, const bool enable); void setDataStream(const portPosition port, const bool enable);
bool getTop() const;
void setTop(bool value);
/************************************************** /**************************************************
* * * *
@ -456,7 +462,6 @@ class Module : public virtual slsDetectorDefs {
int64_t getGateDelay(int gateIndex) const; int64_t getGateDelay(int gateIndex) const;
void setGateDelay(int gateIndex, int64_t value); void setGateDelay(int gateIndex, int64_t value);
std::array<time::ns, 3> getGateDelayForAllGates() const; std::array<time::ns, 3> getGateDelayForAllGates() const;
bool isMaster() const;
int getChipStatusRegister() const; int getChipStatusRegister() const;
void setGainCaps(int caps); void setGainCaps(int caps);
int getGainCaps(); int getGainCaps();

View File

@ -630,3 +630,31 @@ TEST_CASE("datastream", "[.cmd]") {
REQUIRE_THROWS(proxy.Call("datastream", {"left", "1"}, -1, PUT)); REQUIRE_THROWS(proxy.Call("datastream", {"left", "1"}, -1, PUT));
} }
} }
TEST_CASE("top", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::EIGER) {
auto prev_val = det.getTop();
int numModulesTested = 1;
if (det.size() > 1) {
numModulesTested = 2;
}
for (int i = 0; i != numModulesTested; ++i) {
std::ostringstream oss1, oss2, oss3;
proxy.Call("top", {"1"}, i, PUT, oss1);
REQUIRE(oss1.str() == "top 1\n");
proxy.Call("top", {}, i, GET, oss2);
REQUIRE(oss2.str() == "top 1\n");
proxy.Call("top", {"0"}, i, PUT, oss3);
REQUIRE(oss3.str() == "top 0\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setTop(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("top", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("top", {"1"}, -1, PUT));
}
}

View File

@ -570,6 +570,46 @@ TEST_CASE("fliprows", "[.cmd]") {
} }
} }
TEST_CASE("master", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::EIGER || det_type == defs::MYTHEN3 || det_type == defs::GOTTHARD || det_type == defs::GOTTHARD2) {
REQUIRE_NOTHROW(proxy.Call("master", {}, -1, GET));
if (det_type == defs::EIGER) {
// get previous master
int prevMaster = 0;
{
auto previous = det.getMaster();
for (int i = 0; i != det.size(); ++i) {
if (previous[i] == 1) {
prevMaster = i;
break;
}
}
}
{
std::ostringstream oss1;
proxy.Call("master", {"0"}, 0, PUT, oss3);
REQUIRE(oss3.str() == "master 0\n");
}
{
std::ostringstream oss1;
proxy.Call("master", {"1"}, 0, PUT, oss3);
REQUIRE(oss3.str() == "master 1\n");
}
REQUIRE_THROWS(proxy.Call("master", {"1"}, -1, PUT));
// set all to slaves, and then master
for (int i = 0; i != det.size(); ++i) {
det.setMaster(0, {i});
}
det.setMaster(1, prevMaster);
}
} else {
REQUIRE_THROWS(proxy.Call("master", {}, -1, GET));
}
}
/* acquisition parameters */ /* acquisition parameters */
// acquire: not testing // acquire: not testing

View File

@ -716,6 +716,7 @@ int ClientInterface::set_dynamic_range(Interface &socket) {
break; break;
*/ */
case 4: case 4:
case 12:
if (detType == EIGER) { if (detType == EIGER) {
exists = true; exists = true;
} }

View File

@ -112,6 +112,7 @@ void HDF5DataFile::CreateFirstHDF5DataFile(
udpPortNumber_ = udpPortNumber; udpPortNumber_ = udpPortNumber;
switch (dynamicRange_) { switch (dynamicRange_) {
case 12:
case 16: case 16:
dataType_ = PredType::STD_U16LE; dataType_ = PredType::STD_U16LE;
break; break;
@ -248,8 +249,30 @@ void HDF5DataFile::WriteToFile(char *buffer, const int buffersize,
WriteParameterDatasets(currentFrameNumber, (sls_receiver_header *)(buffer)); WriteParameterDatasets(currentFrameNumber, (sls_receiver_header *)(buffer));
} }
void HDF5DataFile::Convert12to16Bit(uint16_t *dst, uint8_t *src) {
for (int i = 0; i < EIGER_NUM_PIXELS; ++i) {
*dst = (uint16_t)(*src++ & 0xFF);
*dst++ |= (uint16_t)((*src & 0xF) << 8u);
++i;
*dst = (uint16_t)((*src++ & 0xF0) >> 4u);
*dst++ |= (uint16_t)((*src++ & 0xFF) << 4u);
}
}
void HDF5DataFile::WriteDataFile(const uint64_t currentFrameNumber, void HDF5DataFile::WriteDataFile(const uint64_t currentFrameNumber,
char *buffer) { char *buffer) {
// expand 12 bit to 16 bits
char *revBuffer = buffer;
if (dynamicRange_ == 12) {
revBuffer = (char *)malloc(EIGER_16_BIT_IMAGE_SIZE);
if (revBuffer == nullptr) {
throw sls::RuntimeError("Could not allocate memory for 12 bit to "
"16 bit conversion in object " +
std::to_string(index_));
}
Convert12to16Bit((uint16_t *)revBuffer, (uint8_t *)buffer);
}
std::lock_guard<std::mutex> lock(*hdf5Lib_); std::lock_guard<std::mutex> lock(*hdf5Lib_);
uint64_t nDimx = uint64_t nDimx =
@ -266,9 +289,15 @@ void HDF5DataFile::WriteDataFile(const uint64_t currentFrameNumber,
dataSpace_->selectHyperslab(H5S_SELECT_SET, count, start); dataSpace_->selectHyperslab(H5S_SELECT_SET, count, start);
DataSpace memspace(2, dims2); DataSpace memspace(2, dims2);
dataSet_->write(buffer, dataType_, memspace, *dataSpace_); dataSet_->write(revBuffer, dataType_, memspace, *dataSpace_);
memspace.close(); memspace.close();
if (dynamicRange_ == 12) {
free(revBuffer);
}
} catch (const Exception &error) { } catch (const Exception &error) {
if (dynamicRange_ == 12) {
free(revBuffer);
}
LOG(logERROR) << "Could not write to file in object " << index_; LOG(logERROR) << "Could not write to file in object " << index_;
error.printErrorStack(); error.printErrorStack();
throw sls::RuntimeError("Could not write to file in object " + throw sls::RuntimeError("Could not write to file in object " +

View File

@ -35,6 +35,7 @@ class HDF5DataFile : private virtual slsDetectorDefs, public File {
private: private:
void CreateFile(); void CreateFile();
void Convert12to16Bit(uint16_t *dst, uint8_t *src);
void WriteDataFile(const uint64_t currentFrameNumber, char *buffer); void WriteDataFile(const uint64_t currentFrameNumber, char *buffer);
void WriteParameterDatasets(const uint64_t currentFrameNumber, void WriteParameterDatasets(const uint64_t currentFrameNumber,
sls_receiver_header *rheader); sls_receiver_header *rheader);
@ -72,4 +73,7 @@ class HDF5DataFile : private virtual slsDetectorDefs, public File {
int detIndex_{0}; int detIndex_{0};
int numUnitsPerReadout_{0}; int numUnitsPerReadout_{0};
uint32_t udpPortNumber_{0}; uint32_t udpPortNumber_{0};
static const int EIGER_NUM_PIXELS{256 * 2 * 256};
static const int EIGER_16_BIT_IMAGE_SIZE{EIGER_NUM_PIXELS * 2};
}; };

View File

@ -258,6 +258,9 @@ enum detFuncs {
F_UPDATE_DETECTOR_SERVER, F_UPDATE_DETECTOR_SERVER,
F_GET_UPDATE_MODE, F_GET_UPDATE_MODE,
F_SET_UPDATE_MODE, F_SET_UPDATE_MODE,
F_SET_MASTER,
F_GET_TOP,
F_SET_TOP,
NUM_DET_FUNCTIONS, NUM_DET_FUNCTIONS,
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
@ -619,6 +622,9 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_UPDATE_DETECTOR_SERVER: return "F_UPDATE_DETECTOR_SERVER"; case F_UPDATE_DETECTOR_SERVER: return "F_UPDATE_DETECTOR_SERVER";
case F_GET_UPDATE_MODE: return "F_GET_UPDATE_MODE"; case F_GET_UPDATE_MODE: return "F_GET_UPDATE_MODE";
case F_SET_UPDATE_MODE: return "F_SET_UPDATE_MODE"; case F_SET_UPDATE_MODE: return "F_SET_UPDATE_MODE";
case F_SET_MASTER: return "F_SET_MASTER";
case F_GET_TOP: return "F_GET_TOP";
case F_SET_TOP: return "F_SET_TOP";
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS"; case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START"; case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";

View File

@ -5,11 +5,11 @@
#define APILIB 0x211125 #define APILIB 0x211125
#define APIRECEIVER 0x211124 #define APIRECEIVER 0x211124
#define APIGUI 0x211124 #define APIGUI 0x211124
#define APICTB 0x220317
#define APIGOTTHARD 0x220317
#define APIGOTTHARD2 0x220317
#define APIJUNGFRAU 0x220317
#define APIMYTHEN3 0x220317
#define APIMOENCH 0x220317
#define APICTB 0x220223 #define APIEIGER 0x220317
#define APIGOTTHARD 0x220223
#define APIGOTTHARD2 0x220223
#define APIJUNGFRAU 0x220223
#define APIMYTHEN3 0x220223
#define APIMOENCH 0x220223
#define APIEIGER 0x220315