mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
Merge pull request #267 from slsdetectorgroup/jungfrauchip
Jungfrau features: 1. chip version
This commit is contained in:
commit
0eca60c791
@ -1992,6 +1992,20 @@ class Detector(CppDetectorApi):
|
|||||||
Jungfrau specific
|
Jungfrau specific
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@property
|
||||||
|
@element
|
||||||
|
def chipversion(self):
|
||||||
|
"""
|
||||||
|
[Jungfrau] Chip version of module. Can be 1.0 or 1.1.
|
||||||
|
|
||||||
|
Example
|
||||||
|
-------
|
||||||
|
>>> d.chipversion
|
||||||
|
'1.0'
|
||||||
|
"""
|
||||||
|
return self.getChipVersion()
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def auto_comp_disable(self):
|
def auto_comp_disable(self):
|
||||||
|
@ -947,6 +947,10 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(sls::Positions)) &
|
(void (Detector::*)(sls::Positions)) &
|
||||||
Detector::resetTemperatureEvent,
|
Detector::resetTemperatureEvent,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
|
.def("getChipVersion",
|
||||||
|
(Result<double>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getChipVersion,
|
||||||
|
py::arg() = Positions{})
|
||||||
.def("getAutoCompDisable",
|
.def("getAutoCompDisable",
|
||||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getAutoCompDisable,
|
Detector::getAutoCompDisable,
|
||||||
|
Binary file not shown.
@ -1106,7 +1106,7 @@ int Feb_Control_SendSoftwareTrigger() {
|
|||||||
LOG(logERROR, ("Could not give software trigger\n"));
|
LOG(logERROR, ("Could not give software trigger\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("Software Internal Trigger Sent!\n"));
|
LOG(logDEBUG1, ("Software Internal Trigger Sent!\n"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1129,7 +1129,7 @@ int Feb_Control_SoftwareTrigger(int block) {
|
|||||||
|
|
||||||
// wait for next trigger ready
|
// wait for next trigger ready
|
||||||
if (block) {
|
if (block) {
|
||||||
LOG(logINFO, ("Blocking Software Trigger\n"));
|
LOG(logDEBUG1, ("Blocking Software Trigger\n"));
|
||||||
int readyForTrigger = 0;
|
int readyForTrigger = 0;
|
||||||
if (!Feb_Control_IsReadyForTrigger(&readyForTrigger)) {
|
if (!Feb_Control_IsReadyForTrigger(&readyForTrigger)) {
|
||||||
LOG(logERROR, ("Could not read FEB_REG_STATUS reg after giving "
|
LOG(logERROR, ("Could not read FEB_REG_STATUS reg after giving "
|
||||||
@ -1138,6 +1138,15 @@ int Feb_Control_SoftwareTrigger(int block) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (!readyForTrigger) {
|
while (!readyForTrigger) {
|
||||||
|
// end of acquisition (cannot monitor readyForTrigger)
|
||||||
|
int status = Feb_Control_AcquisitionInProgress();
|
||||||
|
if (status == STATUS_ERROR) {
|
||||||
|
LOG(logERROR, ("Status: ERROR reading DAQ status register\n"));
|
||||||
|
return 0;
|
||||||
|
} else if (status == STATUS_IDLE) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
usleep(5000);
|
usleep(5000);
|
||||||
if (!Feb_Control_IsReadyForTrigger(&readyForTrigger)) {
|
if (!Feb_Control_IsReadyForTrigger(&readyForTrigger)) {
|
||||||
LOG(logERROR, ("Could not read FEB_REG_STATUS reg after "
|
LOG(logERROR, ("Could not read FEB_REG_STATUS reg after "
|
||||||
@ -1145,8 +1154,10 @@ int Feb_Control_SoftwareTrigger(int block) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("Done waiting (wait for trigger)!\n"));
|
LOG(logDEBUG2, ("Done waiting (wait for trigger)!\n"));
|
||||||
}
|
}
|
||||||
|
LOG(logINFO, ("%s Software Trigger %s\n", (block ? "Blocking" : "Non blocking"), (block ? "Acquired" : "Sent")));
|
||||||
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
Binary file not shown.
@ -434,8 +434,9 @@ int readConfigFile() {
|
|||||||
master = -1;
|
master = -1;
|
||||||
top = -1;
|
top = -1;
|
||||||
|
|
||||||
char fname[128];
|
const int fileNameSize = 128;
|
||||||
if (getAbsPath(fname, 128, CONFIG_FILE) == FAIL) {
|
char fname[fileNameSize];
|
||||||
|
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
@ -530,8 +530,9 @@ int readConfigFile() {
|
|||||||
|
|
||||||
usleep(INITIAL_STARTUP_WAIT);
|
usleep(INITIAL_STARTUP_WAIT);
|
||||||
|
|
||||||
char fname[128];
|
const int fileNameSize = 128;
|
||||||
if (getAbsPath(fname, 128, CONFIG_FILE) == FAIL) {
|
char fname[fileNameSize];
|
||||||
|
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1833,15 +1834,23 @@ int checkDetectorType() {
|
|||||||
int type = atoi(buffer);
|
int type = atoi(buffer);
|
||||||
if (type > TYPE_NO_MODULE_STARTING_VAL) {
|
if (type > TYPE_NO_MODULE_STARTING_VAL) {
|
||||||
LOG(logERROR,
|
LOG(logERROR,
|
||||||
("No Module attached! Expected %d for Gotthard2, got %d\n",
|
("No Module attached! Expected %d, %d or %d for Gotthard2, got %d\n",
|
||||||
TYPE_GOTTHARD2_MODULE_VAL, type));
|
TYPE_GOTTHARD2_MODULE_VAL,
|
||||||
|
TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL,
|
||||||
|
TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL,
|
||||||
|
type));
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (abs(type - TYPE_GOTTHARD2_MODULE_VAL) > TYPE_TOLERANCE) {
|
if ((abs(type - TYPE_GOTTHARD2_MODULE_VAL) > TYPE_TOLERANCE) &&
|
||||||
|
(abs(type - TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL) > TYPE_TOLERANCE) &&
|
||||||
|
(abs(type - TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL) > TYPE_TOLERANCE)) {
|
||||||
LOG(logERROR,
|
LOG(logERROR,
|
||||||
("Wrong Module attached! Expected %d for Gotthard2, got %d\n",
|
("Wrong Module attached! Expected %d, %d or %d for Gotthard2, got %d\n",
|
||||||
TYPE_GOTTHARD2_MODULE_VAL, type));
|
TYPE_GOTTHARD2_MODULE_VAL,
|
||||||
|
TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL,
|
||||||
|
TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL,
|
||||||
|
type));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -26,7 +26,10 @@
|
|||||||
#define ADU_MAX_BITS (12)
|
#define ADU_MAX_BITS (12)
|
||||||
#define MAX_FRAMES_IN_BURST_MODE (2720)
|
#define MAX_FRAMES_IN_BURST_MODE (2720)
|
||||||
#define TYPE_GOTTHARD2_MODULE_VAL (536)
|
#define TYPE_GOTTHARD2_MODULE_VAL (536)
|
||||||
#define TYPE_TOLERANCE (10)
|
#define TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL (683)
|
||||||
|
#define TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL (704)
|
||||||
|
#define TYPE_GOTTHARD2_MODULE_VAL (536)
|
||||||
|
#define TYPE_TOLERANCE (5)
|
||||||
#define TYPE_NO_MODULE_STARTING_VAL (800)
|
#define TYPE_NO_MODULE_STARTING_VAL (800)
|
||||||
#define INITIAL_STARTUP_WAIT (1 * 1000 * 1000)
|
#define INITIAL_STARTUP_WAIT (1 * 1000 * 1000)
|
||||||
|
|
||||||
|
Binary file not shown.
@ -588,8 +588,9 @@ void setGbitReadout() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int readConfigFile() {
|
int readConfigFile() {
|
||||||
char fname[128];
|
const int fileNameSize = 128;
|
||||||
if (getAbsPath(fname, 128, CONFIG_FILE) == FAIL) {
|
char fname[fileNameSize];
|
||||||
|
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,4 +36,6 @@ set_target_properties(jungfrauDetectorServer_virtual PROPERTIES
|
|||||||
install(TARGETS jungfrauDetectorServer_virtual
|
install(TARGETS jungfrauDetectorServer_virtual
|
||||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
configure_file(config_jungfrau.txt ${CMAKE_BINARY_DIR}/bin/config_jungfrau.txt COPYONLY)
|
||||||
|
@ -32,6 +32,7 @@ $(PROGS): $(OBJS)
|
|||||||
mkdir -p $(DESTDIR)
|
mkdir -p $(DESTDIR)
|
||||||
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
|
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
|
||||||
mv $(PROGS) $(DESTDIR)
|
mv $(PROGS) $(DESTDIR)
|
||||||
|
cp config_jungfrau.txt $(DESTDIR)
|
||||||
rm *.gdb
|
rm *.gdb
|
||||||
rm $(main_src)*.o
|
rm $(main_src)*.o
|
||||||
|
|
||||||
|
Binary file not shown.
4
slsDetectorServers/jungfrauDetectorServer/config_jungfrau.txt
Executable file
4
slsDetectorServers/jungfrauDetectorServer/config_jungfrau.txt
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#chip version version (multiplied by 10)
|
||||||
|
chipversion 11
|
@ -45,6 +45,7 @@ int highvoltage = 0;
|
|||||||
int dacValues[NDAC] = {};
|
int dacValues[NDAC] = {};
|
||||||
int32_t clkPhase[NUM_CLOCKS] = {};
|
int32_t clkPhase[NUM_CLOCKS] = {};
|
||||||
int detPos[4] = {};
|
int detPos[4] = {};
|
||||||
|
int chipVersion = 10; // (1.0)
|
||||||
|
|
||||||
int isInitCheckDone() { return initCheckDone; }
|
int isInitCheckDone() { return initCheckDone; }
|
||||||
|
|
||||||
@ -101,6 +102,7 @@ void basictests() {
|
|||||||
|
|
||||||
if (fwversion >= MIN_REQRD_VRSN_T_RD_API)
|
if (fwversion >= MIN_REQRD_VRSN_T_RD_API)
|
||||||
sw_fw_apiversion = getFirmwareAPIVersion();
|
sw_fw_apiversion = getFirmwareAPIVersion();
|
||||||
|
|
||||||
LOG(logINFOBLUE,
|
LOG(logINFOBLUE,
|
||||||
("************ Jungfrau Server *********************\n"
|
("************ Jungfrau Server *********************\n"
|
||||||
"Hardware Version:\t\t 0x%x\n"
|
"Hardware Version:\t\t 0x%x\n"
|
||||||
@ -283,12 +285,17 @@ u_int16_t getHardwareSerialNumber() {
|
|||||||
|
|
||||||
// is board 1.0?, with value 2 (resistor network)
|
// is board 1.0?, with value 2 (resistor network)
|
||||||
int isHardwareVersion2() {
|
int isHardwareVersion2() {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
return (((bus_r(MOD_SERIAL_NUM_REG) & HARDWARE_VERSION_NUM_MSK) ==
|
return (((bus_r(MOD_SERIAL_NUM_REG) & HARDWARE_VERSION_NUM_MSK) ==
|
||||||
HARDWARE_VERSION_2_VAL)
|
HARDWARE_VERSION_2_VAL)
|
||||||
? 1
|
? 1
|
||||||
: 0);
|
: 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getChipVersion() { return chipVersion; }
|
||||||
|
|
||||||
u_int32_t getDetectorNumber() {
|
u_int32_t getDetectorNumber() {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return 0;
|
return 0;
|
||||||
@ -383,6 +390,11 @@ void setupDetector() {
|
|||||||
sharedMemory_setStatus(IDLE);
|
sharedMemory_setStatus(IDLE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// get chip version
|
||||||
|
if (readConfigFile() == FAIL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ALTERA_PLL_ResetPLL();
|
ALTERA_PLL_ResetPLL();
|
||||||
resetCore();
|
resetCore();
|
||||||
resetPeripheral();
|
resetPeripheral();
|
||||||
@ -468,6 +480,127 @@ int setDefaultDacs() {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int readConfigFile() {
|
||||||
|
|
||||||
|
if (initError == FAIL) {
|
||||||
|
return initError;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int fileNameSize = 128;
|
||||||
|
char fname[fileNameSize];
|
||||||
|
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// open config file
|
||||||
|
FILE *fd = fopen(fname, "r");
|
||||||
|
if (fd == NULL) {
|
||||||
|
sprintf(initErrorMessage,
|
||||||
|
"Could not open on-board detector server config file [%s].\n",
|
||||||
|
CONFIG_FILE);
|
||||||
|
initError = FAIL;
|
||||||
|
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG(logINFOBLUE, ("Reading config file %s\n", CONFIG_FILE));
|
||||||
|
|
||||||
|
// Initialization
|
||||||
|
const size_t LZ = 256;
|
||||||
|
char line[LZ];
|
||||||
|
memset(line, 0, LZ);
|
||||||
|
char command[LZ];
|
||||||
|
|
||||||
|
// keep reading a line
|
||||||
|
while (fgets(line, LZ, fd)) {
|
||||||
|
|
||||||
|
// ignore comments
|
||||||
|
if (line[0] == '#') {
|
||||||
|
LOG(logDEBUG1, ("Ignoring Comment\n"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ignore empty lines
|
||||||
|
if (strlen(line) <= 1) {
|
||||||
|
LOG(logDEBUG1, ("Ignoring Empty line\n"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// removing leading spaces
|
||||||
|
if (line[0] == ' ' || line[0] == '\t') {
|
||||||
|
int len = strlen(line);
|
||||||
|
// find first valid character
|
||||||
|
int i = 0;
|
||||||
|
for (i = 0; i < len; ++i) {
|
||||||
|
if (line[i] != ' ' && line[i] != '\t') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ignore the line full of spaces (last char \n)
|
||||||
|
if (i >= len - 1) {
|
||||||
|
LOG(logDEBUG1, ("Ignoring line full of spaces\n"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// copying only valid char
|
||||||
|
char temp[LZ];
|
||||||
|
memset(temp, 0, LZ);
|
||||||
|
memcpy(temp, line + i, strlen(line) - i);
|
||||||
|
memset(line, 0, LZ);
|
||||||
|
memcpy(line, temp, strlen(temp));
|
||||||
|
LOG(logDEBUG1, ("Removing leading spaces.\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG(logDEBUG1, ("Command to process: (size:%d) %.*s\n", strlen(line),
|
||||||
|
strlen(line) - 1, line));
|
||||||
|
memset(command, 0, LZ);
|
||||||
|
|
||||||
|
// chipversion command
|
||||||
|
if (!strncmp(line, "chipversion", strlen("chipversion"))) {
|
||||||
|
int version = 0;
|
||||||
|
|
||||||
|
// cannot scan values
|
||||||
|
if (sscanf(line, "%s %d", command, &version) != 2) {
|
||||||
|
sprintf(
|
||||||
|
initErrorMessage,
|
||||||
|
"Could not scan chipversion commands from on-board server "
|
||||||
|
"config file. Line:[%s].\n",
|
||||||
|
line);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// validations
|
||||||
|
if (version != 10 && version != 11) {
|
||||||
|
sprintf(initErrorMessage,
|
||||||
|
"Could not set chip version from on-board server "
|
||||||
|
"config file. Invalid chip version %d. Line:[%s].\n",
|
||||||
|
version, line);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// validations
|
||||||
|
chipVersion = version;
|
||||||
|
LOG(logINFOBLUE, ("Chip Version: v%.01f\n", chipVersion / 10.0));
|
||||||
|
|
||||||
|
// version 1.1 and HW 1.0 (version reg value = 2) is incompatible
|
||||||
|
if (chipVersion == 11 && isHardwareVersion2()) {
|
||||||
|
strcpy(initErrorMessage,
|
||||||
|
"Chip version 1.1 (from on-board config file) is incompatible with old board (v1.0). Please update board or correct on-board config file.\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(line, 0, LZ);
|
||||||
|
}
|
||||||
|
fclose(fd);
|
||||||
|
|
||||||
|
if (strlen(initErrorMessage)) {
|
||||||
|
initError = FAIL;
|
||||||
|
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||||
|
} else {
|
||||||
|
LOG(logINFOBLUE, ("Successfully read config file\n"));
|
||||||
|
}
|
||||||
|
return initError;
|
||||||
|
}
|
||||||
|
|
||||||
/* firmware functions (resets) */
|
/* firmware functions (resets) */
|
||||||
|
|
||||||
void cleanFifos() {
|
void cleanFifos() {
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
#include "sls/sls_detector_defs.h"
|
#include "sls/sls_detector_defs.h"
|
||||||
|
|
||||||
#define MIN_REQRD_VRSN_T_RD_API 0x171220
|
#define MIN_REQRD_VRSN_T_RD_API 0x171220
|
||||||
#define REQRD_FRMWRE_VRSN_BOARD2 0x210218 // 1.0 pcb
|
#define REQRD_FRMWRE_VRSN_BOARD2 0x210621 // 1.0 pcb
|
||||||
#define REQRD_FRMWRE_VRSN 0x200721 // 2.0 pcb
|
#define REQRD_FRMWRE_VRSN 0x210622 // 2.0 pcb
|
||||||
|
|
||||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||||
|
|
||||||
@ -77,6 +77,7 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
|||||||
#define CLK_SYNC (20) // MHz
|
#define CLK_SYNC (20) // MHz
|
||||||
#define ADC_CLK_INDEX (1)
|
#define ADC_CLK_INDEX (1)
|
||||||
#define DBIT_CLK_INDEX (0)
|
#define DBIT_CLK_INDEX (0)
|
||||||
|
#define CONFIG_FILE ("config_jungfrau.txt")
|
||||||
|
|
||||||
/** Default Parameters */
|
/** Default Parameters */
|
||||||
#define DEFAULT_NUM_FRAMES (100 * 1000 * 1000)
|
#define DEFAULT_NUM_FRAMES (100 * 1000 * 1000)
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -21,7 +21,7 @@
|
|||||||
#define TYPE_FILE_NAME ("/etc/devlinks/type")
|
#define TYPE_FILE_NAME ("/etc/devlinks/type")
|
||||||
#define DAC_MAX_MV (2048)
|
#define DAC_MAX_MV (2048)
|
||||||
#define TYPE_MYTHEN3_MODULE_VAL (93)
|
#define TYPE_MYTHEN3_MODULE_VAL (93)
|
||||||
#define TYPE_TOLERANCE (10)
|
#define TYPE_TOLERANCE (5)
|
||||||
#define TYPE_NO_MODULE_STARTING_VAL (800)
|
#define TYPE_NO_MODULE_STARTING_VAL (800)
|
||||||
#define MAX_EXT_SIGNALS (8)
|
#define MAX_EXT_SIGNALS (8)
|
||||||
|
|
||||||
|
@ -87,6 +87,7 @@ u_int16_t getHardwareSerialNumber();
|
|||||||
#endif
|
#endif
|
||||||
#ifdef JUNGFRAUD
|
#ifdef JUNGFRAUD
|
||||||
int isHardwareVersion2();
|
int isHardwareVersion2();
|
||||||
|
int getChipVersion();
|
||||||
#endif
|
#endif
|
||||||
#if defined(EIGERD) || defined(MYTHEN3D)
|
#if defined(EIGERD) || defined(MYTHEN3D)
|
||||||
void readDetectorNumber();
|
void readDetectorNumber();
|
||||||
@ -122,7 +123,7 @@ int setDefaultDacs();
|
|||||||
void setASICDefaults();
|
void setASICDefaults();
|
||||||
void setADIFDefaults();
|
void setADIFDefaults();
|
||||||
#endif
|
#endif
|
||||||
#if defined(GOTTHARD2D) || defined(EIGERD)
|
#if defined(GOTTHARD2D) || defined(EIGERD) || defined(JUNGFRAUD)
|
||||||
int readConfigFile();
|
int readConfigFile();
|
||||||
#endif
|
#endif
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
|
@ -253,3 +253,4 @@ int get_veto_stream(int);
|
|||||||
int set_veto_stream(int);
|
int set_veto_stream(int);
|
||||||
int get_veto_algorithm(int);
|
int get_veto_algorithm(int);
|
||||||
int set_veto_algorithm(int);
|
int set_veto_algorithm(int);
|
||||||
|
int get_chip_version(int);
|
||||||
|
@ -379,6 +379,7 @@ void function_table() {
|
|||||||
flist[F_SET_VETO_STREAM] = &set_veto_stream;
|
flist[F_SET_VETO_STREAM] = &set_veto_stream;
|
||||||
flist[F_GET_VETO_ALGORITHM] = &get_veto_algorithm;
|
flist[F_GET_VETO_ALGORITHM] = &get_veto_algorithm;
|
||||||
flist[F_SET_VETO_ALGORITHM] = &set_veto_algorithm;
|
flist[F_SET_VETO_ALGORITHM] = &set_veto_algorithm;
|
||||||
|
flist[F_GET_CHIP_VERSION] = &get_chip_version;
|
||||||
|
|
||||||
// check
|
// check
|
||||||
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
||||||
@ -8432,4 +8433,17 @@ int set_veto_algorithm(int file_des) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_chip_version(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
int retval = -1;
|
||||||
|
#ifndef JUNGFRAUD
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
retval = getChipVersion();
|
||||||
|
#endif
|
||||||
|
LOG(logDEBUG1, ("chip version retval: %d\n", retval));
|
||||||
|
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||||
}
|
}
|
@ -1081,6 +1081,9 @@ class Detector {
|
|||||||
* *
|
* *
|
||||||
* ************************************************/
|
* ************************************************/
|
||||||
|
|
||||||
|
/** [Jungfrau] */
|
||||||
|
Result<double> getChipVersion(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Jungfrau] */
|
/** [Jungfrau] */
|
||||||
Result<int> getThresholdTemperature(Positions pos = {}) const;
|
Result<int> getThresholdTemperature(Positions pos = {}) const;
|
||||||
|
|
||||||
|
@ -918,6 +918,7 @@ class CmdProxy {
|
|||||||
{"datastream", &CmdProxy::DataStream},
|
{"datastream", &CmdProxy::DataStream},
|
||||||
|
|
||||||
/* Jungfrau Specific */
|
/* Jungfrau Specific */
|
||||||
|
{"chipversion", &CmdProxy::chipversion},
|
||||||
{"temp_threshold", &CmdProxy::temp_threshold},
|
{"temp_threshold", &CmdProxy::temp_threshold},
|
||||||
{"temp_control", &CmdProxy::temp_control},
|
{"temp_control", &CmdProxy::temp_control},
|
||||||
{"temp_event", &CmdProxy::TemperatureEvent},
|
{"temp_event", &CmdProxy::TemperatureEvent},
|
||||||
@ -1812,6 +1813,9 @@ class CmdProxy {
|
|||||||
|
|
||||||
/* Jungfrau Specific */
|
/* Jungfrau Specific */
|
||||||
|
|
||||||
|
GET_COMMAND(chipversion, getChipVersion,
|
||||||
|
"\n\t[Jungfrau] Returns chip version. Can be 1.0 or 1.1");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
temp_threshold, getThresholdTemperature, setThresholdTemperature,
|
temp_threshold, getThresholdTemperature, setThresholdTemperature,
|
||||||
StringTo<int>,
|
StringTo<int>,
|
||||||
|
@ -1398,6 +1398,9 @@ void Detector::setDataStream(const defs::portPosition port, const bool enable,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Jungfrau Specific
|
// Jungfrau Specific
|
||||||
|
Result<double> Detector::getChipVersion(Positions pos) const {
|
||||||
|
return pimpl->Parallel(&Module::getChipVersion, pos);
|
||||||
|
}
|
||||||
|
|
||||||
Result<int> Detector::getThresholdTemperature(Positions pos) const {
|
Result<int> Detector::getThresholdTemperature(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getThresholdTemperature, pos);
|
return pimpl->Parallel(&Module::getThresholdTemperature, pos);
|
||||||
|
@ -1522,6 +1522,9 @@ void Module::setDataStream(const portPosition port, const bool enable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Jungfrau Specific
|
// Jungfrau Specific
|
||||||
|
double Module::getChipVersion() const {
|
||||||
|
return (sendToDetector<int>(F_GET_CHIP_VERSION)) / 10.00;
|
||||||
|
}
|
||||||
|
|
||||||
int Module::getThresholdTemperature() const {
|
int Module::getThresholdTemperature() const {
|
||||||
auto retval = sendToDetectorStop<int>(F_THRESHOLD_TEMP, GET_FLAG);
|
auto retval = sendToDetectorStop<int>(F_THRESHOLD_TEMP, GET_FLAG);
|
||||||
|
@ -351,6 +351,7 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
* Jungfrau Specific *
|
* Jungfrau Specific *
|
||||||
* *
|
* *
|
||||||
* ************************************************/
|
* ************************************************/
|
||||||
|
double getChipVersion() const;
|
||||||
int getThresholdTemperature() const;
|
int getThresholdTemperature() const;
|
||||||
void setThresholdTemperature(int val);
|
void setThresholdTemperature(int val);
|
||||||
bool getTemperatureControl() const;
|
bool getTemperatureControl() const;
|
||||||
|
@ -190,6 +190,18 @@ TEST_CASE("temp_threshold", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("chipversion", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::JUNGFRAU) {
|
||||||
|
REQUIRE_NOTHROW(proxy.Call("chipversion", {}, -1, GET));
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("chipversion", {}, -1, GET));
|
||||||
|
}
|
||||||
|
REQUIRE_THROWS(proxy.Call("chipversion", {"0"}, -1, PUT));
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("temp_control", "[.cmd]") {
|
TEST_CASE("temp_control", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
|
@ -230,6 +230,7 @@ enum detFuncs {
|
|||||||
F_SET_VETO_STREAM,
|
F_SET_VETO_STREAM,
|
||||||
F_GET_VETO_ALGORITHM,
|
F_GET_VETO_ALGORITHM,
|
||||||
F_SET_VETO_ALGORITHM,
|
F_SET_VETO_ALGORITHM,
|
||||||
|
F_GET_CHIP_VERSION,
|
||||||
|
|
||||||
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
|
||||||
@ -566,6 +567,7 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_SET_VETO_STREAM: return "F_SET_VETO_STREAM";
|
case F_SET_VETO_STREAM: return "F_SET_VETO_STREAM";
|
||||||
case F_GET_VETO_ALGORITHM: return "F_GET_VETO_ALGORITHM";
|
case F_GET_VETO_ALGORITHM: return "F_GET_VETO_ALGORITHM";
|
||||||
case F_SET_VETO_ALGORITHM: return "F_SET_VETO_ALGORITHM";
|
case F_SET_VETO_ALGORITHM: return "F_SET_VETO_ALGORITHM";
|
||||||
|
case F_GET_CHIP_VERSION: return "F_GET_CHIP_VERSION";
|
||||||
|
|
||||||
case 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";
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
#define APILIB 0x210225
|
#define APILIB 0x210225
|
||||||
#define APIRECEIVER 0x210225
|
#define APIRECEIVER 0x210225
|
||||||
#define APIGUI 0x210225
|
#define APIGUI 0x210225
|
||||||
#define APICTB 0x210722
|
#define APICTB 0x210727
|
||||||
#define APIGOTTHARD 0x210722
|
#define APIGOTTHARD 0x210727
|
||||||
#define APIGOTTHARD2 0x210722
|
#define APIGOTTHARD2 0x210727
|
||||||
#define APIJUNGFRAU 0x210722
|
#define APIMYTHEN3 0x210727
|
||||||
#define APIMYTHEN3 0x210722
|
#define APIMOENCH 0x210727
|
||||||
#define APIMOENCH 0x210722
|
#define APIEIGER 0x210727
|
||||||
#define APIEIGER 0x210722
|
#define APIJUNGFRAU 0x210727
|
||||||
|
Loading…
x
Reference in New Issue
Block a user