mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00
Release of 5.1.0 (#237)
* Setting pattern from memory (#218) * ToString accepts c-style arrays * fixed patwait time bug in validation * Introduced pattern class * compile for servers too * Python binding for Pattern * added scanParameters in Python * slsReceiver: avoid potential memory leak around Implementation::generalData * additional constructors for scanPrameters in python * bugfix: avoid potentital memory leak in receiver if called outside constructor context * added scanParameters in Python * additional constructors for scanPrameters in python * M3defaultpattern (#227) * default pattern for m3 and moench including Python bindings * M3settings (#228) * some changes to compile on RH7 and in the server to load the default chip status register at startup * Updated mythen3DeectorServer_developer executable with correct initialization at startup Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com> Co-authored-by: Anna Bergamaschi <anna.bergamaschi@psi.ch> * Pattern.h as a public header files (#229) * fixed buffer overflow but caused by using global instead of local enum * replacing out of range trimbits with edge values * replacing dac values that are out of range after interpolation * updated pybind11 to 2.6.2 * Mythen3 improved synchronization (#231) Disabling scans for multi module Mythen3, since there is no feedback of the detectors being ready startDetector first starts the slaves then the master acquire firs calls startDetector for the slaves then acquire on the master getMaster to read back from hardware which one is master * New server for JF to go with the new FW (#232) * Modified Jungfrau speed settings for HW1.0 - FW fix version 1.1.1, compilation date 210218 * Corrected bug. DBIT clk phase is implemented in both HW version 1.0 and 2.0. Previous version did not update the DBIT phase shift on the configuration of a speed. * fix for m3 scan with single module * m3 fw version * m3 server * bugfix for bottom when setting quad * new strategy for finding zmq based on cppzmq Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch> Co-authored-by: Dhanya Thattil <33750417+thattil@users.noreply.github.com> Co-authored-by: Alejandro Homs Puron <ahoms@esrf.fr> Co-authored-by: Anna Bergamaschi <anna.bergamaschi@psi.ch> Co-authored-by: Xiaoqiang Wang <xiaoqiangwang@gmail.com> Co-authored-by: lopez_c <carlos.lopez-cuenca@psi.ch>
This commit is contained in:
@ -22,6 +22,7 @@ add_executable(ctbDetectorServer_virtual
|
||||
include_directories(
|
||||
../slsDetectorServer/include
|
||||
../../slsSupportLib/include
|
||||
../../slsDetectorSoftware/include/sls/
|
||||
)
|
||||
|
||||
target_include_directories(ctbDetectorServer_virtual
|
||||
|
@ -2,10 +2,11 @@ current_dir = $(shell pwd)
|
||||
main_inc = ../slsDetectorServer/include/
|
||||
main_src = ../slsDetectorServer/src/
|
||||
support_lib = ../../slsSupportLib/include/
|
||||
det_lib = ../../slsDetectorSoftware/include/sls/
|
||||
|
||||
CROSS = bfin-uclinux-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -std=gnu99 -DCHIPTESTBOARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
CFLAGS += -Wall -std=gnu99 -DCHIPTESTBOARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(det_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm -lrt -pthread
|
||||
PROGS = ctbDetectorServer
|
||||
DESTDIR ?= bin
|
||||
|
BIN
slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_5.1.0
Executable file
BIN
slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_5.1.0
Executable file
Binary file not shown.
Binary file not shown.
@ -1395,7 +1395,7 @@ int Feb_Control_SetMaster(enum MASTERINDEX ind) {
|
||||
int Feb_Control_SetQuad(int val) {
|
||||
LOG(logINFO, ("Setting Quad to %d in Feb\n", val));
|
||||
// only setting on the right feb if quad
|
||||
return Feb_Control_SetTop(val == 0 ? TOP_HARDWARE : OW_TOP, 0, 1);
|
||||
return Feb_Control_SetTop(val == 0 ? TOP_HARDWARE : OW_BOTTOM, 0, 1);
|
||||
}
|
||||
|
||||
int Feb_Control_SetReadNLines(int value) {
|
||||
|
2
slsDetectorServers/eigerDetectorServer/bin/config_eiger.txt
Executable file
2
slsDetectorServers/eigerDetectorServer/bin/config_eiger.txt
Executable file
@ -0,0 +1,2 @@
|
||||
top 1
|
||||
master 1
|
BIN
slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_5.1.0
Executable file
BIN
slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_5.1.0
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -669,7 +669,9 @@ void allocateDetectorStructureMemory() {
|
||||
(detectorModules)->reg = 0;
|
||||
(detectorModules)->iodelay = 0;
|
||||
(detectorModules)->tau = 0;
|
||||
(detectorModules)->eV = 0;
|
||||
(detectorModules)->eV[0] = 0;
|
||||
(detectorModules)->eV[1] = 0;
|
||||
(detectorModules)->eV[2] = 0;
|
||||
thisSettings = UNINITIALIZED;
|
||||
|
||||
// if trimval requested, should return -1 to acknowledge unknown
|
||||
@ -1090,8 +1092,8 @@ int setModule(sls_detector_module myMod, char *mess) {
|
||||
}
|
||||
|
||||
// threshold
|
||||
if (myMod.eV >= 0)
|
||||
setThresholdEnergy(myMod.eV);
|
||||
if (myMod.eV[0] >= 0)
|
||||
setThresholdEnergy(myMod.eV[0]);
|
||||
else {
|
||||
// (loading a random trim file) (dont return fail)
|
||||
setSettings(UNDEFINED);
|
||||
@ -2554,8 +2556,8 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
||||
destMod->iodelay = srcMod->iodelay;
|
||||
if (srcMod->tau >= 0)
|
||||
destMod->tau = srcMod->tau;
|
||||
if (srcMod->eV >= 0)
|
||||
destMod->eV = srcMod->eV;
|
||||
if (srcMod->eV[0] >= 0)
|
||||
destMod->eV[0] = srcMod->eV[0];
|
||||
LOG(logDEBUG1, ("Copying register %x (%x)\n", destMod->reg, srcMod->reg));
|
||||
|
||||
if (destMod->nchan != 0) {
|
||||
|
33
slsDetectorServers/gotthard2DetectorServer/bin/config_gotthard2.txt
Executable file
33
slsDetectorServers/gotthard2DetectorServer/bin/config_gotthard2.txt
Executable file
@ -0,0 +1,33 @@
|
||||
|
||||
|
||||
#onchip dacs chip index value (max 0x3ff)
|
||||
vchip_comp_fe -1 0x137
|
||||
vchip_opa_1st -1 0x000
|
||||
vchip_opa_fd -1 0x134
|
||||
vchip_comp_adc -1 0x3FF
|
||||
vchip_ref_comp_fe -1 0x180
|
||||
vchip_cs -1 0x0D0
|
||||
|
||||
#dacs value (max 4096)
|
||||
vref_h_adc 2116
|
||||
vb_comp_fe 0
|
||||
vb_comp_adc 0
|
||||
vcom_cds 705
|
||||
vref_rstore 150
|
||||
vb_opa_1st 0
|
||||
vref_comp_fe 0
|
||||
vcom_adc1 705
|
||||
vref_prech 869
|
||||
vref_l_adc 700
|
||||
vref_cds 700
|
||||
vb_cs 2799
|
||||
vb_opa_fd 0
|
||||
vcom_adc2 704
|
||||
|
||||
#configure adc chip index adc index value(max 0x7F)
|
||||
confadc -1 -1 0x22
|
||||
|
||||
#vetoreference gain index value(max 4095)
|
||||
vetoref 1 0
|
||||
|
||||
|
BIN
slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_5.1.0
Executable file
BIN
slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_5.1.0
Executable file
Binary file not shown.
Binary file not shown.
@ -409,9 +409,9 @@ void setupDetector() {
|
||||
|
||||
// pll defines
|
||||
ALTERA_PLL_C10_SetDefines(REG_OFFSET, BASE_READOUT_PLL, BASE_SYSTEM_PLL,
|
||||
PLL_RESET_REG, PLL_RESET_REG,
|
||||
PLL_RESET_READOUT_MSK, PLL_RESET_SYSTEM_MSK,
|
||||
READOUT_PLL_VCO_FREQ_HZ, SYSTEM_PLL_VCO_FREQ_HZ);
|
||||
PLL_RESET_REG, PLL_RESET_READOUT_MSK,
|
||||
PLL_RESET_SYSTEM_MSK, READOUT_PLL_VCO_FREQ_HZ,
|
||||
SYSTEM_PLL_VCO_FREQ_HZ);
|
||||
ALTERA_PLL_C10_ResetPLL(READOUT_PLL);
|
||||
ALTERA_PLL_C10_ResetPLL(SYSTEM_PLL);
|
||||
// hv
|
||||
|
23
slsDetectorServers/gotthardDetectorServer/bin/config_gotthard.txt
Executable file
23
slsDetectorServers/gotthardDetectorServer/bin/config_gotthard.txt
Executable file
@ -0,0 +1,23 @@
|
||||
#masterflags (no_master, is_master, is_slave)
|
||||
masterflags no_master
|
||||
|
||||
#master default delay
|
||||
masterdefaultdelay 70
|
||||
|
||||
#patternphase
|
||||
patternphase 0
|
||||
|
||||
#adcphase
|
||||
adcphase 0
|
||||
|
||||
#slave pattern phase
|
||||
slavepatternphase 0
|
||||
|
||||
#slave adc phase
|
||||
slaveadcphase 0
|
||||
|
||||
#rst to sw1 delay
|
||||
rsttosw1delay 2
|
||||
|
||||
#start acquisition delay
|
||||
startacqdelay 1
|
BIN
slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_5.1.0
Executable file
BIN
slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_5.1.0
Executable file
Binary file not shown.
Binary file not shown.
BIN
slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_5.1.0
Executable file
BIN
slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_5.1.0
Executable file
Binary file not shown.
Binary file not shown.
@ -1396,11 +1396,8 @@ int setClockDivider(enum CLKINDEX ind, int val) {
|
||||
setPhase(ADC_CLK, adcPhase, 0);
|
||||
LOG(logINFO, ("\tSet ADC Phase Reg to %d\n", adcPhase));
|
||||
|
||||
// only implemented in the new boards now
|
||||
if (!isHardwareVersion2()) {
|
||||
setPhase(DBIT_CLK, dbitPhase, 0);
|
||||
LOG(logINFO, ("\tSet DBIT Phase Reg to %d\n", dbitPhase));
|
||||
}
|
||||
setPhase(DBIT_CLK, dbitPhase, 0);
|
||||
LOG(logINFO, ("\tSet DBIT Phase Reg to %d\n", dbitPhase));
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "sls/sls_detector_defs.h"
|
||||
|
||||
#define MIN_REQRD_VRSN_T_RD_API 0x171220
|
||||
#define REQRD_FRMWRE_VRSN_BOARD2 0x200724 // 1.0 pcb
|
||||
#define REQRD_FRMWRE_VRSN_BOARD2 0x210218 // 1.0 pcb
|
||||
#define REQRD_FRMWRE_VRSN 0x200721 // 2.0 pcb
|
||||
|
||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||
@ -113,8 +113,8 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
||||
#define ADC_OFST_FULL_SPEED_VAL (0x10) // 2.0 pcb
|
||||
#define ADC_OFST_HALF_SPEED_VAL (0x08) // 2.0 pcb
|
||||
#define ADC_OFST_QUARTER_SPEED_VAL (0x04) // 2.0 pcb
|
||||
#define ADC_OFST_HALF_SPEED_BOARD2_VAL (0x13) // 1.0 pcb (2 resistor network)
|
||||
#define ADC_OFST_QUARTER_SPEED_BOARD2_VAL (0x0b) // 1.0 pcb (2 resistor network)
|
||||
#define ADC_OFST_HALF_SPEED_BOARD2_VAL (0x10) // 1.0 pcb (2 resistor network)
|
||||
#define ADC_OFST_QUARTER_SPEED_BOARD2_VAL (0x08) // 1.0 pcb (2 resistor network)
|
||||
|
||||
#define ADC_PORT_INVERT_VAL (0x5A5A5A5A)
|
||||
#define ADC_PORT_INVERT_BOARD2_VAL (0x453b2a9c)
|
||||
@ -140,8 +140,8 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
||||
#define ADC_PHASE_FULL_SPEED (150) // 2.0 pcb
|
||||
#define ADC_PHASE_HALF_SPEED (200) // 2.0 pcb
|
||||
#define ADC_PHASE_QUARTER_SPEED (200) // 2.0 pcb
|
||||
#define ADC_PHASE_HALF_SPEED_BOARD2 (75) // 1.0 pcb (2 resistor network)
|
||||
#define ADC_PHASE_QUARTER_SPEED_BOARD2 (75) // 1.0 pcb (2 resistor network)
|
||||
#define ADC_PHASE_HALF_SPEED_BOARD2 (110) // 1.0 pcb (2 resistor network)
|
||||
#define ADC_PHASE_QUARTER_SPEED_BOARD2 (220) // 1.0 pcb (2 resistor network)
|
||||
|
||||
#define DBIT_PHASE_FULL_SPEED (85) // 2.0 pcb
|
||||
#define DBIT_PHASE_HALF_SPEED (150) // 2.0 pcb
|
||||
|
@ -20,6 +20,7 @@ add_executable(moenchDetectorServer_virtual
|
||||
include_directories(
|
||||
../slsDetectorServer/include
|
||||
../../slsSupportLib/include
|
||||
../../slsDetectorSoftware/include/sls/
|
||||
)
|
||||
|
||||
target_include_directories(moenchDetectorServer_virtual
|
||||
|
@ -2,10 +2,11 @@ current_dir = $(shell pwd)
|
||||
main_inc = ../slsDetectorServer/include/
|
||||
main_src = ../slsDetectorServer/src/
|
||||
support_lib = ../../slsSupportLib/include/
|
||||
det_lib = ../../slsDetectorSoftware/include/sls/
|
||||
|
||||
CROSS = bfin-uclinux-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -std=gnu99 -DMOENCHD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
|
||||
CFLAGS += -Wall -std=gnu99 -DMOENCHD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(det_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm -lrt -pthread
|
||||
PROGS = moenchDetectorServer
|
||||
DESTDIR ?= bin
|
||||
|
288
slsDetectorServers/moenchDetectorServer/bin/DefaultPattern_moench.txt
Executable file
288
slsDetectorServers/moenchDetectorServer/bin/DefaultPattern_moench.txt
Executable file
@ -0,0 +1,288 @@
|
||||
patword 0x0000 0x0008599f0418503a
|
||||
patword 0x0001 0x0008599f0418503a
|
||||
patword 0x0002 0x000859960418503a
|
||||
patword 0x0003 0x000859960418503a
|
||||
patword 0x0004 0x000859960418503a
|
||||
patword 0x0005 0x000859960418503a
|
||||
patword 0x0006 0x000859960418503a
|
||||
patword 0x0007 0x000859960418503a
|
||||
patword 0x0008 0x000859960418503a
|
||||
patword 0x0009 0x000859960418503a
|
||||
patword 0x000a 0x000859960418503a
|
||||
patword 0x000b 0x000859960418503a
|
||||
patword 0x000c 0x000859960418503a
|
||||
patword 0x000d 0x000859960418503a
|
||||
patword 0x000e 0x000859960418503a
|
||||
patword 0x000f 0x000859960418503a
|
||||
patword 0x0010 0x000859960418503a
|
||||
patword 0x0011 0x000859960418503a
|
||||
patword 0x0012 0x000859960418503a
|
||||
patword 0x0013 0x000859960418503a
|
||||
patword 0x0014 0x000859960418503a
|
||||
patword 0x0015 0x000859960418503a
|
||||
patword 0x0016 0x000819960418501a
|
||||
patword 0x0017 0x000819960418501a
|
||||
patword 0x0018 0x000819960418501a
|
||||
patword 0x0019 0x000819960418501a
|
||||
patword 0x001a 0x000819960418501a
|
||||
patword 0x001b 0x000819960418501a
|
||||
patword 0x001c 0x000819960418501a
|
||||
patword 0x001d 0x000819960418501a
|
||||
patword 0x001e 0x000819960418501a
|
||||
patword 0x001f 0x000819960418501a
|
||||
patword 0x0020 0x000819960418501a
|
||||
patword 0x0021 0x000819960418501a
|
||||
patword 0x0022 0x000819960418501a
|
||||
patword 0x0023 0x000819960418501a
|
||||
patword 0x0024 0x000819960418501a
|
||||
patword 0x0025 0x000819960418501a
|
||||
patword 0x0026 0x000819960418501a
|
||||
patword 0x0027 0x000819960418501a
|
||||
patword 0x0028 0x000819960418501a
|
||||
patword 0x0029 0x000819960418501a
|
||||
patword 0x002a 0x000819960418501a
|
||||
patword 0x002b 0x000819960418501a
|
||||
patword 0x002c 0x000819960418501a
|
||||
patword 0x002d 0x000819960418501a
|
||||
patword 0x002e 0x000819960418501a
|
||||
patword 0x002f 0x000819960418501a
|
||||
patword 0x0030 0x000819960008501a
|
||||
patword 0x0031 0x000819960008501a
|
||||
patword 0x0032 0x000819960008501a
|
||||
patword 0x0033 0x000819960008501a
|
||||
patword 0x0034 0x000819960008501a
|
||||
patword 0x0035 0x000819960008501a
|
||||
patword 0x0036 0x000819960008501a
|
||||
patword 0x0037 0x000819960008501a
|
||||
patword 0x0038 0x000819960008501a
|
||||
patword 0x0039 0x000819960008501a
|
||||
patword 0x003a 0x000819960008501a
|
||||
patword 0x003b 0x000819960008501a
|
||||
patword 0x003c 0x000819960008501a
|
||||
patword 0x003d 0x000819960008501a
|
||||
patword 0x003e 0x000819960008501a
|
||||
patword 0x003f 0x000819960008501a
|
||||
patword 0x0040 0x000819960008501a
|
||||
patword 0x0041 0x000819960008501a
|
||||
patword 0x0042 0x000819960008501a
|
||||
patword 0x0043 0x000819960008501a
|
||||
patword 0x0044 0x0008199f0008501a
|
||||
patword 0x0045 0x0008199f0008501a
|
||||
patword 0x0046 0x0008199f0008501a
|
||||
patword 0x0047 0x0008199f0008501a
|
||||
patword 0x0048 0x0008199f0008501a
|
||||
patword 0x0049 0x0008199f0008501a
|
||||
patword 0x004a 0x0008199f0008501a
|
||||
patword 0x004b 0x0008199f0008501a
|
||||
patword 0x004c 0x0008199f0008501a
|
||||
patword 0x004d 0x0008199f0008501a
|
||||
patword 0x004e 0x0008199f0008501a
|
||||
patword 0x004f 0x0008199f0008501a
|
||||
patword 0x0050 0x0008199f0008501a
|
||||
patword 0x0051 0x0008199f0008501a
|
||||
patword 0x0052 0x0008199f0008501a
|
||||
patword 0x0053 0x0008199f0008501a
|
||||
patword 0x0054 0x0008199f0008501a
|
||||
patword 0x0055 0x0008199f0008501a
|
||||
patword 0x0056 0x0008199f0008501a
|
||||
patword 0x0057 0x0008199f0008501a
|
||||
patword 0x0058 0x0008599f0008503a
|
||||
patword 0x0059 0x0008599f0008503a
|
||||
patword 0x005a 0x000c599f000850ba
|
||||
patword 0x005b 0x000c599f000850ba
|
||||
patword 0x005c 0x000c599f000850ba
|
||||
patword 0x005d 0x000c599f000850ba
|
||||
patword 0x005e 0x000c599f000850ba
|
||||
patword 0x005f 0x000c599f000850ba
|
||||
patword 0x0060 0x000c599f000850ba
|
||||
patword 0x0061 0x000c599f000850ba
|
||||
patword 0x0062 0x000c599f000850ba
|
||||
patword 0x0063 0x000c599f000850ba
|
||||
patword 0x0064 0x000c599f000850ba
|
||||
patword 0x0065 0x000c599f000850ba
|
||||
patword 0x0066 0x000c599f000850ba
|
||||
patword 0x0067 0x000c599f000850ba
|
||||
patword 0x0068 0x000c599f000850ba
|
||||
patword 0x0069 0x000c599f000850ba
|
||||
patword 0x006a 0x000c599f000850ba
|
||||
patword 0x006b 0x000c599f000850ba
|
||||
patword 0x006c 0x000c599f000850ba
|
||||
patword 0x006d 0x000c599f000850ba
|
||||
patword 0x006e 0x000c799f010858ba
|
||||
patword 0x006f 0x000c799f010858ba
|
||||
patword 0x0070 0x000c599f000850ba
|
||||
patword 0x0071 0x000c599f000850ba
|
||||
patword 0x0072 0x000c599f000850ba
|
||||
patword 0x0073 0x000c599f000850ba
|
||||
patword 0x0074 0x000c599f000850ba
|
||||
patword 0x0075 0x000c599f000850ba
|
||||
patword 0x0076 0x000c599f000850ba
|
||||
patword 0x0077 0x000c599f000850ba
|
||||
patword 0x0078 0x000c599f000850ba
|
||||
patword 0x0079 0x000c599f000850ba
|
||||
patword 0x007a 0x000c599f000850ba
|
||||
patword 0x007b 0x000c599f000850ba
|
||||
patword 0x007c 0x000c599f000850ba
|
||||
patword 0x007d 0x000c599f000850ba
|
||||
patword 0x007e 0x000c599f000850ba
|
||||
patword 0x007f 0x000c599f000850ba
|
||||
patword 0x0080 0x000c599f000850ba
|
||||
patword 0x0081 0x000c599f000850ba
|
||||
patword 0x0082 0x000c599f000850ba
|
||||
patword 0x0083 0x000c599f000850ba
|
||||
patword 0x0084 0x000c599f000850ba
|
||||
patword 0x0085 0x000c599f000850ba
|
||||
patword 0x0086 0x000c599f400850ba
|
||||
patword 0x0087 0x000c599f400850ba
|
||||
patword 0x0088 0x000c599f600850ba
|
||||
patword 0x0089 0x000c599f400850ba
|
||||
patword 0x008a 0x000c599f400850ba
|
||||
patword 0x008b 0x000c599f400850ba
|
||||
patword 0x008c 0x840c599f682e50ba
|
||||
patword 0x008d 0x840c599f482850ba
|
||||
patword 0x008e 0x840c599f000e50ba
|
||||
patword 0x008f 0x840c599f000850ba
|
||||
patword 0x0090 0x840c599f000e50ba
|
||||
patword 0x0091 0x840c599f000850ba
|
||||
patword 0x0092 0x840c599f000e50ba
|
||||
patword 0x0093 0x840c599f000850ba
|
||||
patword 0x0094 0x840c599f000e50ba
|
||||
patword 0x0095 0x840c599f000850ba
|
||||
patword 0x0096 0x840c599f000e50ba
|
||||
patword 0x0097 0x840c599f000850ba
|
||||
patword 0x0098 0x840c599f000e50ba
|
||||
patword 0x0099 0x840c599f000850ba
|
||||
patword 0x009a 0x840c599f000e50ba
|
||||
patword 0x009b 0x840c599f000850ba
|
||||
patword 0x009c 0x840c599f000e50ba
|
||||
patword 0x009d 0x840c599f000850ba
|
||||
patword 0x009e 0x840c599f000e50ba
|
||||
patword 0x009f 0x840c599f000850ba
|
||||
patword 0x00a0 0x840c599f000e50ba
|
||||
patword 0x00a1 0x840c599f000850ba
|
||||
patword 0x00a2 0x840c599f000e50ba
|
||||
patword 0x00a3 0x840c599f000850ba
|
||||
patword 0x00a4 0x840c599f000e50ba
|
||||
patword 0x00a5 0x840c599f000850ba
|
||||
patword 0x00a6 0x840c599f200e50ba
|
||||
patword 0x00a7 0x840c599f000850ba
|
||||
patword 0x00a8 0x840c599f000e50ba
|
||||
patword 0x00a9 0x840c599f000850ba
|
||||
patword 0x00aa 0x840c599f000e50ba
|
||||
patword 0x00ab 0x840c599f000850ba
|
||||
patword 0x00ac 0x840c599f000e50ba
|
||||
patword 0x00ad 0x840c599f000850ba
|
||||
patword 0x00ae 0x840c599f000e50ba
|
||||
patword 0x00af 0x840c599f000850ba
|
||||
patword 0x00b0 0x840c599f000e50ba
|
||||
patword 0x00b1 0x840c599f000850ba
|
||||
patword 0x00b2 0x840c599f000e50ba
|
||||
patword 0x00b3 0x840c599f000850ba
|
||||
patword 0x00b4 0x840c599f000e50ba
|
||||
patword 0x00b5 0x840c599f000850ba
|
||||
patword 0x00b6 0x840c599f000e50ba
|
||||
patword 0x00b7 0x840c599f000850ba
|
||||
patword 0x00b8 0x840c599f000e50ba
|
||||
patword 0x00b9 0x840c599f000850ba
|
||||
patword 0x00ba 0x840c599f000e50ba
|
||||
patword 0x00bb 0x840c599f000850ba
|
||||
patword 0x00bc 0x840c599f000e50ba
|
||||
patword 0x00bd 0x840c599f000850ba
|
||||
patword 0x00be 0x840c599f282e50ba
|
||||
patword 0x00bf 0x840c599f082850ba
|
||||
patword 0x00c0 0x840c599f000e50ba
|
||||
patword 0x00c1 0x840c599f000850ba
|
||||
patword 0x00c2 0x840c599f000e50ba
|
||||
patword 0x00c3 0x840c599f000850ba
|
||||
patword 0x00c4 0x840c599f000e50ba
|
||||
patword 0x00c5 0x840c599f000850ba
|
||||
patword 0x00c6 0x840c599f000e50ba
|
||||
patword 0x00c7 0x840c599f000850ba
|
||||
patword 0x00c8 0x840c599f000e50ba
|
||||
patword 0x00c9 0x840c599f000850ba
|
||||
patword 0x00ca 0x840c599f000e50ba
|
||||
patword 0x00cb 0x840c599f000850ba
|
||||
patword 0x00cc 0x840c599f000e50ba
|
||||
patword 0x00cd 0x840c599f000850ba
|
||||
patword 0x00ce 0x840c599f000e50ba
|
||||
patword 0x00cf 0x840c599f000850ba
|
||||
patword 0x00d0 0x840c599f000e50ba
|
||||
patword 0x00d1 0x840c599f000850ba
|
||||
patword 0x00d2 0x840c599f000e50ba
|
||||
patword 0x00d3 0x840c599f000850ba
|
||||
patword 0x00d4 0x840c599f000e50ba
|
||||
patword 0x00d5 0x840c599f000850ba
|
||||
patword 0x00d6 0x840c599f000e50ba
|
||||
patword 0x00d7 0x840c599f000850ba
|
||||
patword 0x00d8 0x840c599f200e50ba
|
||||
patword 0x00d9 0x840c599f000850ba
|
||||
patword 0x00da 0x840c599f000e50ba
|
||||
patword 0x00db 0x840c599f000850ba
|
||||
patword 0x00dc 0x840c599f000e50ba
|
||||
patword 0x00dd 0x840c599f000850ba
|
||||
patword 0x00de 0x840c599f000e50ba
|
||||
patword 0x00df 0x840c599f000850ba
|
||||
patword 0x00e0 0x840c599f000e50ba
|
||||
patword 0x00e1 0x840c599f000850ba
|
||||
patword 0x00e2 0x840c599f000e50ba
|
||||
patword 0x00e3 0x840c599f000850ba
|
||||
patword 0x00e4 0x840c599f000e50ba
|
||||
patword 0x00e5 0x840c599f000850ba
|
||||
patword 0x00e6 0x840c599f000e50ba
|
||||
patword 0x00e7 0x840c599f000850ba
|
||||
patword 0x00e8 0x840c599f000e50ba
|
||||
patword 0x00e9 0x840c599f000850ba
|
||||
patword 0x00ea 0x840c599f000e50ba
|
||||
patword 0x00eb 0x840c599f000850ba
|
||||
patword 0x00ec 0x840c599f000e50ba
|
||||
patword 0x00ed 0x840c599f000850ba
|
||||
patword 0x00ee 0x840c599f000e50ba
|
||||
patword 0x00ef 0x840c599f000850ba
|
||||
patword 0x00f0 0x040c599f000850ba
|
||||
patword 0x00f1 0x040c599f000850ba
|
||||
patword 0x00f2 0x000c599f000850ba
|
||||
patword 0x00f3 0x000c599f000850ba
|
||||
patword 0x00f4 0x0008599f200e503a
|
||||
patword 0x00f5 0x0008599f0008503a
|
||||
patword 0x00f6 0x0008599f200e503a
|
||||
patword 0x00f7 0x0008599f0008503a
|
||||
patword 0x00f8 0x0008599f0008503a
|
||||
patword 0x00f9 0x0008599f0008503a
|
||||
patword 0x00fa 0x0008599f0008503a
|
||||
patword 0x00fb 0x0008599f0008503a
|
||||
patword 0x00fc 0x0008599f0008503a
|
||||
patword 0x00fd 0x0008599f0008503a
|
||||
patword 0x00fe 0x0008599f0008503a
|
||||
patword 0x00ff 0x0008599f0008503a
|
||||
patword 0x0100 0x0008599f0008503a
|
||||
patword 0x0101 0x0008599f0008503a
|
||||
patword 0x0102 0x0008599f0008503a
|
||||
patword 0x0103 0x0008599f0008503a
|
||||
patword 0x0104 0x0008599f0008503a
|
||||
patword 0x0105 0x0008599f0008503a
|
||||
patword 0x0106 0x0008599f0008503a
|
||||
patword 0x0107 0x0008599f0008503a
|
||||
patword 0x0108 0x0008599f0008503a
|
||||
patword 0x0109 0x0008599f0008503a
|
||||
patword 0x010a 0x0008599f0008503a
|
||||
patword 0x010b 0x0008599f0008503a
|
||||
patword 0x010c 0x0008599f0008503a
|
||||
patword 0x010d 0x0008599f0008503a
|
||||
patword 0x010e 0x0008599f0008503a
|
||||
patword 0x010f 0x0008599f0008503a
|
||||
patword 0x0110 0x0008599f0008503a
|
||||
patword 0x0111 0x0008599f0008503a
|
||||
patioctrl 0x8f0effff6dbffdbf
|
||||
patlimits 0x0000 0x0110
|
||||
patloop0 0x00be 0x00ef
|
||||
patnloop0 199
|
||||
patloop1 0x0400 0x0400
|
||||
patnloop1 0
|
||||
patloop2 0x0400 0x0400
|
||||
patnloop2 0
|
||||
patwait0 0x002e
|
||||
patwaittime0 800
|
||||
patwait1 0x0400
|
||||
patwaittime1 0
|
||||
patwait2 0x0400
|
||||
patwaittime2 0
|
BIN
slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_5.1.0
Executable file
BIN
slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_5.1.0
Executable file
Binary file not shown.
Binary file not shown.
@ -550,7 +550,9 @@ void setupDetector() {
|
||||
initError = FAIL;
|
||||
}
|
||||
setPipeline(ADC_CLK, DEFAULT_PIPELINE);
|
||||
loadDefaultPattern(DEFAULT_PATTERN_FILE);
|
||||
if (initError != FAIL) {
|
||||
initError = loadDefaultPattern(DEFAULT_PATTERN_FILE, initErrorMessage);
|
||||
}
|
||||
setSettings(DEFAULT_SETTINGS);
|
||||
|
||||
setFrequency(RUN_CLK, DEFAULT_RUN_CLK);
|
||||
|
@ -17,6 +17,7 @@ add_executable(mythen3DetectorServer_virtual
|
||||
include_directories(
|
||||
../slsDetectorServer/include
|
||||
../../slsSupportLib/include
|
||||
../../slsDetectorSoftware/include/sls/
|
||||
)
|
||||
|
||||
target_include_directories(mythen3DetectorServer_virtual
|
||||
|
@ -2,10 +2,11 @@ current_dir = $(shell pwd)
|
||||
main_inc = ../slsDetectorServer/include/
|
||||
main_src = ../slsDetectorServer/src/
|
||||
support_lib = ../../slsSupportLib/include/
|
||||
det_lib = ../../slsDetectorSoftware/include/sls/
|
||||
|
||||
CROSS = nios2-buildroot-linux-gnu-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -std=gnu99 -DMYTHEN3D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
CFLAGS += -Wall -std=gnu99 -DMYTHEN3D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(det_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm -lrt -pthread
|
||||
PROGS = mythen3DetectorServer
|
||||
DESTDIR ?= bin
|
||||
|
@ -103,7 +103,12 @@
|
||||
/* Look at me register, read only */
|
||||
#define LOOK_AT_ME_REG (0x05 * REG_OFFSET + BASE_CONTROL) // Not used in firmware or software, good to play with
|
||||
|
||||
#define SYSTEM_STATUS_REG (0x06 * REG_OFFSET + BASE_CONTROL) // Not used in software
|
||||
#define SYSTEM_STATUS_REG (0x06 * REG_OFFSET + BASE_CONTROL)
|
||||
|
||||
#define SYSTEM_STATUS_R_PLL_LCKD_OFST (1)
|
||||
#define SYSTEM_STATUS_R_PLL_LCKD_MSK (0x00000001 << SYSTEM_STATUS_R_PLL_LCKD_OFST)
|
||||
#define SYSTEM_STATUS_RDO_PLL_LCKD_OFST (2)
|
||||
#define SYSTEM_STATUS_RDO_PLL_LCKD_MSK (0x00000001 << SYSTEM_STATUS_RDO_PLL_LCKD_OFST)
|
||||
|
||||
/* Config RW regiseter */
|
||||
#define CONFIG_REG (0x20 * REG_OFFSET + BASE_CONTROL)
|
||||
@ -483,6 +488,14 @@
|
||||
/* ASIC Readout Control registers
|
||||
* --------------------------------------------------*/
|
||||
|
||||
/** ASIC Readout Status register */
|
||||
#define ASIC_RDO_STATUS_REG (0x00 * REG_OFFSET + BASE_ASIC_RDO)
|
||||
|
||||
#define ASIC_RDO_STATUS_BUSY_OFST (1)
|
||||
#define ASIC_RDO_STATUS_BUSY_MSK (0x00000001 << ASIC_RDO_STATUS_BUSY_OFST)
|
||||
|
||||
|
||||
/** ASIC Readout Res Storage Counter register */
|
||||
#define ASIC_RDO_CONFIG_REG (0x01 * REG_OFFSET + BASE_ASIC_RDO)
|
||||
|
||||
#define ASICRDO_CNFG_RESSTRG_LNGTH_OFST (0)
|
||||
|
256
slsDetectorServers/mythen3DetectorServer/bin/DefaultPattern_mythen3.txt
Executable file
256
slsDetectorServers/mythen3DetectorServer/bin/DefaultPattern_mythen3.txt
Executable file
@ -0,0 +1,256 @@
|
||||
patword 0x0000 0x0000000000000000
|
||||
patword 0x0001 0x0000000000000000
|
||||
patword 0x0002 0x0000000000000000
|
||||
patword 0x0003 0x0000000000000000
|
||||
patword 0x0004 0x0000000000000000
|
||||
patword 0x0005 0x0000000000000000
|
||||
patword 0x0006 0x0000000000c00000
|
||||
patword 0x0007 0x0000000000c00000
|
||||
patword 0x0008 0x0000000000c00000
|
||||
patword 0x0009 0x0000000000c00000
|
||||
patword 0x000a 0x0000000000c00000
|
||||
patword 0x000b 0x0000000000c00000
|
||||
patword 0x000c 0x0000000000000000
|
||||
patword 0x000d 0x0000000000000000
|
||||
patword 0x000e 0x0000000000000000
|
||||
patword 0x000f 0x0000000000000000
|
||||
patword 0x0010 0x0000000000000000
|
||||
patword 0x0011 0x0000000000000000
|
||||
patword 0x0012 0x0000000000200000
|
||||
patword 0x0013 0x0000000000200000
|
||||
patword 0x0014 0x0000000000e00000
|
||||
patword 0x0015 0x0000000000e00000
|
||||
patword 0x0016 0x0000000000e00000
|
||||
patword 0x0017 0x0000000000e00000
|
||||
patword 0x0018 0x0000000000e00000
|
||||
patword 0x0019 0x0000000000e00000
|
||||
patword 0x001a 0x0000000000e00000
|
||||
patword 0x001b 0x0000000000e00000
|
||||
patword 0x001c 0x0000000000200000
|
||||
patword 0x001d 0x0000000000200000
|
||||
patword 0x001e 0x0000000000200000
|
||||
patword 0x001f 0x0000000000200000
|
||||
patword 0x0020 0x0000000000200000
|
||||
patword 0x0021 0x0000000000200000
|
||||
patword 0x0022 0x0000000000200000
|
||||
patword 0x0023 0x0000000000200000
|
||||
patword 0x0024 0x0000000000200000
|
||||
patword 0x0025 0x0000000000200000
|
||||
patword 0x0026 0x0000000000200000
|
||||
patword 0x0027 0x0000000000200000
|
||||
patword 0x0028 0x0000000000200000
|
||||
patword 0x0029 0x0000000001200000
|
||||
patword 0x002a 0x0000000000200000
|
||||
patword 0x002b 0x0000000000200000
|
||||
patword 0x002c 0x0000000000200000
|
||||
patword 0x002d 0x0000000000200000
|
||||
patword 0x002e 0x0000000000200000
|
||||
patword 0x002f 0x0000000000200000
|
||||
patword 0x0030 0x0000000000200000
|
||||
patword 0x0031 0x0000000000200000
|
||||
patword 0x0032 0x0000000001200000
|
||||
patword 0x0033 0x0000000000200000
|
||||
patword 0x0034 0x0000000000200000
|
||||
patword 0x0035 0x0000000000200000
|
||||
patword 0x0036 0x0000000000200000
|
||||
patword 0x0037 0x0000000000200000
|
||||
patword 0x0038 0x0000000000200000
|
||||
patword 0x0039 0x0000000000200000
|
||||
patword 0x003a 0x0000000000200000
|
||||
patword 0x003b 0x0000000001200000
|
||||
patword 0x003c 0x0000000000200000
|
||||
patword 0x003d 0x0000000000200000
|
||||
patword 0x003e 0x0000000000200000
|
||||
patword 0x003f 0x0000000000200000
|
||||
patword 0x0040 0x0000000000200000
|
||||
patword 0x0041 0x0000000000200000
|
||||
patword 0x0042 0x0000000000200000
|
||||
patword 0x0043 0x0000000000200000
|
||||
patword 0x0044 0x0000000001200000
|
||||
patword 0x0045 0x0000000000200000
|
||||
patword 0x0046 0x0000000000200000
|
||||
patword 0x0047 0x0000000000200000
|
||||
patword 0x0048 0x0000000000200000
|
||||
patword 0x0049 0x0000000000200000
|
||||
patword 0x004a 0x0000000000200000
|
||||
patword 0x004b 0x0000000000200000
|
||||
patword 0x004c 0x0000000000200000
|
||||
patword 0x004d 0x0000000001200000
|
||||
patword 0x004e 0x0000000000200000
|
||||
patword 0x004f 0x0000000000200000
|
||||
patword 0x0050 0x0000000000200000
|
||||
patword 0x0051 0x0000000000200000
|
||||
patword 0x0052 0x0000000000200000
|
||||
patword 0x0053 0x0000000000200000
|
||||
patword 0x0054 0x0000000000200000
|
||||
patword 0x0055 0x0000000000200000
|
||||
patword 0x0056 0x0000000001200000
|
||||
patword 0x0057 0x0000000000200000
|
||||
patword 0x0058 0x0000000000200000
|
||||
patword 0x0059 0x0000000000200000
|
||||
patword 0x005a 0x0000000000280000
|
||||
patword 0x005b 0x0000000000280000
|
||||
patword 0x005c 0x0000000000280000
|
||||
patword 0x005d 0x0000000000280000
|
||||
patword 0x005e 0x0000000000280000
|
||||
patword 0x005f 0x0000000001280000
|
||||
patword 0x0060 0x0000000000280000
|
||||
patword 0x0061 0x0000000000200000
|
||||
patword 0x0062 0x0000000000200000
|
||||
patword 0x0063 0x0000000000200000
|
||||
patword 0x0064 0x0000000000200000
|
||||
patword 0x0065 0x0000000000200000
|
||||
patword 0x0066 0x0000000000200000
|
||||
patword 0x0067 0x0000000000200000
|
||||
patword 0x0068 0x0000000001200000
|
||||
patword 0x0069 0x0000000000200000
|
||||
patword 0x006a 0x0000000000200000
|
||||
patword 0x006b 0x0000000000200000
|
||||
patword 0x006c 0x0000000000200000
|
||||
patword 0x006d 0x0000000000200000
|
||||
patword 0x006e 0x0000000000200000
|
||||
patword 0x006f 0x0000000000200000
|
||||
patword 0x0070 0x0000000000200000
|
||||
patword 0x0071 0x0000000001200000
|
||||
patword 0x0072 0x0000000000200000
|
||||
patword 0x0073 0x0000000000200000
|
||||
patword 0x0074 0x0000000000200000
|
||||
patword 0x0075 0x0000000000200000
|
||||
patword 0x0076 0x0000000000200000
|
||||
patword 0x0077 0x0000000000200000
|
||||
patword 0x0078 0x0000000000200000
|
||||
patword 0x0079 0x0000000000200000
|
||||
patword 0x007a 0x0000000001200000
|
||||
patword 0x007b 0x0000000000200000
|
||||
patword 0x007c 0x0000000000200000
|
||||
patword 0x007d 0x0000000000200000
|
||||
patword 0x007e 0x0000000000280000
|
||||
patword 0x007f 0x0000000000280000
|
||||
patword 0x0080 0x0000000000280000
|
||||
patword 0x0081 0x0000000000280000
|
||||
patword 0x0082 0x0000000000280000
|
||||
patword 0x0083 0x0000000001280000
|
||||
patword 0x0084 0x0000000000280000
|
||||
patword 0x0085 0x0000000000200000
|
||||
patword 0x0086 0x0000000000200000
|
||||
patword 0x0087 0x0000000000200000
|
||||
patword 0x0088 0x0000000000200000
|
||||
patword 0x0089 0x0000000000200000
|
||||
patword 0x008a 0x0000000000200000
|
||||
patword 0x008b 0x0000000000200000
|
||||
patword 0x008c 0x0000000001200000
|
||||
patword 0x008d 0x0000000000200000
|
||||
patword 0x008e 0x0000000000200000
|
||||
patword 0x008f 0x0000000000200000
|
||||
patword 0x0090 0x0000000000200000
|
||||
patword 0x0091 0x0000000000200000
|
||||
patword 0x0092 0x0000000000200000
|
||||
patword 0x0093 0x0000000000200000
|
||||
patword 0x0094 0x0000000000200000
|
||||
patword 0x0095 0x0000000001200000
|
||||
patword 0x0096 0x0000000000200000
|
||||
patword 0x0097 0x0000000000200000
|
||||
patword 0x0098 0x0000000000200000
|
||||
patword 0x0099 0x0000000000200000
|
||||
patword 0x009a 0x0000000000200000
|
||||
patword 0x009b 0x0000000000200000
|
||||
patword 0x009c 0x0000000000200000
|
||||
patword 0x009d 0x0000000000200000
|
||||
patword 0x009e 0x0000000001200000
|
||||
patword 0x009f 0x0000000000200000
|
||||
patword 0x00a0 0x0000000000200000
|
||||
patword 0x00a1 0x0000000000200000
|
||||
patword 0x00a2 0x0000000000200000
|
||||
patword 0x00a3 0x0000000000200000
|
||||
patword 0x00a4 0x0000000000200000
|
||||
patword 0x00a5 0x0000000000200000
|
||||
patword 0x00a6 0x0000000000200000
|
||||
patword 0x00a7 0x0000000001200000
|
||||
patword 0x00a8 0x0000000000200000
|
||||
patword 0x00a9 0x0000000000200000
|
||||
patword 0x00aa 0x0000000000200000
|
||||
patword 0x00ab 0x0000000000200000
|
||||
patword 0x00ac 0x0000000000200000
|
||||
patword 0x00ad 0x0000000000200000
|
||||
patword 0x00ae 0x0000000000200000
|
||||
patword 0x00af 0x0000000000200000
|
||||
patword 0x00b0 0x0000000001200000
|
||||
patword 0x00b1 0x0000000000200000
|
||||
patword 0x00b2 0x0000000000200000
|
||||
patword 0x00b3 0x0000000000200000
|
||||
patword 0x00b4 0x0000000000200000
|
||||
patword 0x00b5 0x0000000000200000
|
||||
patword 0x00b6 0x0000000000200000
|
||||
patword 0x00b7 0x0000000000200000
|
||||
patword 0x00b8 0x0000000000200000
|
||||
patword 0x00b9 0x0000000001200000
|
||||
patword 0x00ba 0x0000000000200000
|
||||
patword 0x00bb 0x0000000000200000
|
||||
patword 0x00bc 0x0000000000200000
|
||||
patword 0x00bd 0x0000000000200000
|
||||
patword 0x00be 0x0000000000200000
|
||||
patword 0x00bf 0x0000000000200000
|
||||
patword 0x00c0 0x0000000000200000
|
||||
patword 0x00c1 0x0000000000200000
|
||||
patword 0x00c2 0x0000000001200000
|
||||
patword 0x00c3 0x0000000000200000
|
||||
patword 0x00c4 0x0000000000200000
|
||||
patword 0x00c5 0x0000000000200000
|
||||
patword 0x00c6 0x0000000000300000
|
||||
patword 0x00c7 0x0000000000300000
|
||||
patword 0x00c8 0x0000000000300000
|
||||
patword 0x00c9 0x0000000000300000
|
||||
patword 0x00ca 0x0000000000300000
|
||||
patword 0x00cb 0x0000000000200000
|
||||
patword 0x00cc 0x0000000000200000
|
||||
patword 0x00cd 0x0000000000200000
|
||||
patword 0x00ce 0x0000000000200000
|
||||
patword 0x00cf 0x0000000000200000
|
||||
patword 0x00d0 0x0000000000200000
|
||||
patword 0x00d1 0x0000000000200000
|
||||
patword 0x00d2 0x0000000000000000
|
||||
patword 0x00d3 0x0000000000000000
|
||||
patword 0x00d4 0x0000000000000000
|
||||
patword 0x00d5 0x0000000000000000
|
||||
patword 0x00d6 0x0000000000000000
|
||||
patword 0x00d7 0x0000000000000000
|
||||
patword 0x00d8 0x0000000000000000
|
||||
patword 0x00d9 0x0000000000000000
|
||||
patword 0x00da 0x0000000000c00000
|
||||
patword 0x00db 0x0000000000c00000
|
||||
patword 0x00dc 0x0000000000c00000
|
||||
patword 0x00dd 0x0000000000c00000
|
||||
patword 0x00de 0x0000000000c00000
|
||||
patword 0x00df 0x0000000000c00000
|
||||
patword 0x00e0 0x0000000000c00000
|
||||
patword 0x00e1 0x0000000000c00000
|
||||
patword 0x00e2 0x0000000000c00000
|
||||
patword 0x00e3 0x0000000000c00000
|
||||
patword 0x00e4 0x0000000000000000
|
||||
patword 0x00e5 0x0000000000000000
|
||||
patword 0x00e6 0x0000000000000000
|
||||
patword 0x00e7 0x0000000000000000
|
||||
patword 0x00e8 0x0000000000000000
|
||||
patword 0x00e9 0x0000000000000000
|
||||
patword 0x00ea 0x0000000000000000
|
||||
patword 0x00eb 0x0000000000000000
|
||||
patword 0x00ec 0x0000000000000000
|
||||
patword 0x00ed 0x0000000000000000
|
||||
patword 0x00ee 0x0000000000000000
|
||||
patword 0x00ef 0x0000000000000000
|
||||
patword 0x00f0 0x0000000000000000
|
||||
patword 0x00f1 0x0000000000000000
|
||||
patword 0x00f2 0x0000000000000000
|
||||
patlimits 0x0000 0x00f2
|
||||
patloop0 0x0400 0x0400
|
||||
patnloop0 0
|
||||
patloop1 0x0400 0x0400
|
||||
patnloop1 0
|
||||
patloop2 0x0400 0x0400
|
||||
patnloop2 0
|
||||
patwait0 0x0400
|
||||
patwaittime0 0
|
||||
patwait1 0x0400
|
||||
patwaittime1 0
|
||||
patwait2 0x0400
|
||||
patwaittime2 0
|
BIN
slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_5.1.0
Executable file
BIN
slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_5.1.0
Executable file
Binary file not shown.
Binary file not shown.
@ -19,6 +19,9 @@
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
/// NOT the right place to put it!
|
||||
int setChipStatusRegister(int csr);
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
@ -40,6 +43,7 @@ pthread_t pthread_virtual_tid;
|
||||
int64_t virtual_currentFrameNumber = 2;
|
||||
#endif
|
||||
|
||||
enum detectorSettings thisSettings;
|
||||
sls_detector_module *detectorModules = NULL;
|
||||
int *detectorChans = NULL;
|
||||
int *detectorDacs = NULL;
|
||||
@ -50,8 +54,10 @@ uint32_t clkDivider[NUM_CLOCKS] = {};
|
||||
|
||||
int highvoltage = 0;
|
||||
int detPos[2] = {};
|
||||
int64_t exptimeReg[3] = {0, 0, 0};
|
||||
int64_t gateDelayReg[3] = {0, 0, 0};
|
||||
int64_t exptimeReg[NCOUNTERS] = {0, 0, 0};
|
||||
int64_t gateDelayReg[NCOUNTERS] = {0, 0, 0};
|
||||
int vthEnabledVals[NCOUNTERS] = {0, 0, 0};
|
||||
int detID = 0;
|
||||
|
||||
int isInitCheckDone() { return initCheckDone; }
|
||||
|
||||
@ -264,13 +270,29 @@ u_int16_t getHardwareVersionNumber() {
|
||||
MCB_SERIAL_NO_VRSN_OFST);
|
||||
}
|
||||
|
||||
u_int32_t getDetectorNumber() {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
void readDetectorNumber() {
|
||||
#ifndef VIRTUAL
|
||||
if (initError == FAIL) {
|
||||
return;
|
||||
}
|
||||
FILE *fd = fopen(ID_FILE, "r");
|
||||
if (fd == NULL) {
|
||||
sprintf(initErrorMessage, "No %s file found.\n", ID_FILE);
|
||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
initError = FAIL;
|
||||
return;
|
||||
}
|
||||
char output[255];
|
||||
fgets(output, sizeof(output), fd);
|
||||
sscanf(output, "%u", &detID);
|
||||
if (isControlServer) {
|
||||
LOG(logINFOBLUE, ("Detector ID: %u\n", detID));
|
||||
}
|
||||
#endif
|
||||
return bus_r(MCB_SERIAL_NO_REG);
|
||||
}
|
||||
|
||||
u_int32_t getDetectorNumber() { return detID; }
|
||||
|
||||
u_int64_t getDetectorMAC() {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
@ -365,17 +387,19 @@ void allocateDetectorStructureMemory() {
|
||||
(detectorModules)->reg = UNINITIALIZED;
|
||||
(detectorModules)->iodelay = 0;
|
||||
(detectorModules)->tau = 0;
|
||||
(detectorModules)->eV = 0;
|
||||
// thisSettings = UNINITIALIZED;
|
||||
(detectorModules)->eV[0] = 0;
|
||||
(detectorModules)->eV[1] = 0;
|
||||
(detectorModules)->eV[2] = 0;
|
||||
thisSettings = UNINITIALIZED;
|
||||
|
||||
// initialize dacs
|
||||
for (int idac = 0; idac < (detectorModules)->ndac; ++idac) {
|
||||
detectorDacs[idac] = 0;
|
||||
}
|
||||
|
||||
// if trimval requested, should return -1 to acknowledge unknown
|
||||
// trimbits start at 0 //TODO: restart server will not have 0 always
|
||||
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||
*((detectorModules->chanregs) + ichan) = -1;
|
||||
*((detectorModules->chanregs) + ichan) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -401,10 +425,11 @@ void setupDetector() {
|
||||
#endif
|
||||
|
||||
// pll defines
|
||||
ALTERA_PLL_C10_SetDefines(REG_OFFSET, BASE_READOUT_PLL, BASE_SYSTEM_PLL,
|
||||
PLL_RESET_REG, PLL_RESET_REG,
|
||||
PLL_RESET_READOUT_MSK, PLL_RESET_SYSTEM_MSK,
|
||||
READOUT_PLL_VCO_FREQ_HZ, SYSTEM_PLL_VCO_FREQ_HZ);
|
||||
ALTERA_PLL_C10_SetDefines(
|
||||
REG_OFFSET, BASE_READOUT_PLL, BASE_SYSTEM_PLL, PLL_RESET_REG,
|
||||
PLL_RESET_READOUT_MSK, PLL_RESET_SYSTEM_MSK, SYSTEM_STATUS_REG,
|
||||
SYSTEM_STATUS_RDO_PLL_LCKD_MSK, SYSTEM_STATUS_R_PLL_LCKD_MSK,
|
||||
READOUT_PLL_VCO_FREQ_HZ, SYSTEM_PLL_VCO_FREQ_HZ);
|
||||
ALTERA_PLL_C10_ResetPLL(READOUT_PLL);
|
||||
ALTERA_PLL_C10_ResetPLL(SYSTEM_PLL);
|
||||
// hv
|
||||
@ -438,7 +463,7 @@ void setupDetector() {
|
||||
setTiming(DEFAULT_TIMING_MODE);
|
||||
setNumIntGates(DEFAULT_INTERNAL_GATES);
|
||||
setNumGates(DEFAULT_EXTERNAL_GATES);
|
||||
for (int i = 0; i != 3; ++i) {
|
||||
for (int i = 0; i != NCOUNTERS; ++i) {
|
||||
setExpTime(i, DEFAULT_GATE_WIDTH);
|
||||
setGateDelay(i, DEFAULT_GATE_DELAY);
|
||||
}
|
||||
@ -448,6 +473,11 @@ void setupDetector() {
|
||||
#ifdef VIRTUAL
|
||||
enableTenGigabitEthernet(0);
|
||||
#endif
|
||||
readDetectorNumber();
|
||||
if (initError == FAIL) {
|
||||
return;
|
||||
}
|
||||
setSettings(DEFAULT_SETTINGS);
|
||||
|
||||
// check module type attached if not in debug mode
|
||||
{
|
||||
@ -482,7 +512,12 @@ void setupDetector() {
|
||||
}
|
||||
|
||||
powerChip(1);
|
||||
loadDefaultPattern(DEFAULT_PATTERN_FILE);
|
||||
if (initError != FAIL) {
|
||||
initError = setChipStatusRegister(CSR_default);
|
||||
//loadDefaultPattern(DEFAULT_PATTERN_FILE, initErrorMessage);
|
||||
//startStateMachine(); //this was missing in previous code! runs the default pattern
|
||||
}
|
||||
setAllTrimbits(DEFAULT_TRIMBIT_VALUE);
|
||||
}
|
||||
|
||||
int setDefaultDacs() {
|
||||
@ -690,7 +725,7 @@ int getNumGates() { return bus_r(ASIC_EXP_EXT_GATE_NUMBER_REG); }
|
||||
void updateGatePeriod() {
|
||||
uint64_t max = 0;
|
||||
uint32_t countermask = getCounterMask();
|
||||
for (int i = 0; i != 3; ++i) {
|
||||
for (int i = 0; i != NCOUNTERS; ++i) {
|
||||
// only if counter enabled
|
||||
if (countermask & (1 << i)) {
|
||||
uint64_t sum = getExpTime(i) + getGateDelay(i);
|
||||
@ -877,6 +912,7 @@ void setCounterMask(uint32_t arg) {
|
||||
if (arg == 0 || arg > MAX_COUNTER_MSK) {
|
||||
return;
|
||||
}
|
||||
uint32_t oldmask = getCounterMask();
|
||||
LOG(logINFO, ("Setting counter mask to 0x%x\n", arg));
|
||||
uint32_t addr = CONFIG_REG;
|
||||
bus_w(addr, bus_r(addr) & ~CONFIG_COUNTERS_ENA_MSK);
|
||||
@ -886,12 +922,21 @@ void setCounterMask(uint32_t arg) {
|
||||
|
||||
updatePacketizing();
|
||||
LOG(logINFO, ("\tUpdating Exptime and Gate Delay\n"));
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int i = 0; i < NCOUNTERS; ++i) {
|
||||
uint64_t ns = exptimeReg[i] / (1E-9 * getFrequency(SYSTEM_C0));
|
||||
setExpTime(i, ns);
|
||||
ns = gateDelayReg[i] / (1E-9 * getFrequency(SYSTEM_C0));
|
||||
setGateDelay(i, ns);
|
||||
}
|
||||
|
||||
LOG(logINFO, ("\tUpdating Vth dacs\n"));
|
||||
for (int i = 0; i < NCOUNTERS; ++i) {
|
||||
// if change in enable
|
||||
if ((arg & (1 << i)) ^ (oldmask & (1 << i))) {
|
||||
// will disable if counter disabled
|
||||
setDAC(VTH1, vthEnabledVals[i], 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t getCounterMask() {
|
||||
@ -1011,24 +1056,28 @@ int setModule(sls_detector_module myMod, char *mess) {
|
||||
|
||||
LOG(logINFO, ("Setting module\n"));
|
||||
|
||||
/* future implementation
|
||||
// settings (not yet implemented)
|
||||
setSettings((enum detectorSettings)myMod.reg);
|
||||
// settings
|
||||
if (myMod.reg >= 0) {
|
||||
setSettings((enum detectorSettings)myMod.reg);
|
||||
if (getSettings() != (enum detectorSettings)myMod.reg) {
|
||||
sprintf(
|
||||
mess,
|
||||
"Could not set module. Could not set settings to %d, read %d\n",
|
||||
myMod.reg, (int)getSettings());
|
||||
LOG(logERROR, (mess));
|
||||
return FAIL;
|
||||
}
|
||||
detectorModules->reg = myMod.reg;
|
||||
}
|
||||
|
||||
// threshold
|
||||
if (myMod.eV >= 0)
|
||||
setThresholdEnergy(myMod.eV);
|
||||
// custom trimbit file
|
||||
else {
|
||||
// (loading a random trim file) (dont return fail)
|
||||
setSettings(UNDEFINED);
|
||||
LOG(logERROR,
|
||||
("Settings has been changed to undefined (random trim
|
||||
file)\n"));
|
||||
// changed for setsettings (direct),
|
||||
// custom trimbit file (setmodule with myMod.reg as -1),
|
||||
// change of dac (direct)
|
||||
for (int i = 0; i < NCOUNTERS; ++i) {
|
||||
setThresholdEnergy(i, -1);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// dacs
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
@ -1036,16 +1085,42 @@ int setModule(sls_detector_module myMod, char *mess) {
|
||||
if (myMod.dacs[i] != -1) {
|
||||
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
|
||||
if (myMod.dacs[i] != detectorDacs[i]) {
|
||||
sprintf(mess, "Could not set module. Could not set dac %d\n",
|
||||
i);
|
||||
// dont complain if that counter was disabled
|
||||
if ((i == M_VTH1 || i == M_VTH2 || i == M_VTH3) &&
|
||||
(detectorDacs[i] == DEFAULT_COUNTER_DISABLED_VTH_VAL)) {
|
||||
continue;
|
||||
}
|
||||
sprintf(mess,
|
||||
"Could not set module. Could not set dac %d, wrote %d, "
|
||||
"read %d\n",
|
||||
i, myMod.dacs[i], detectorDacs[i]);
|
||||
LOG(logERROR, (mess));
|
||||
// setSettings(UNDEFINED);
|
||||
// LOG(logERROR, ("Settings has been changed to undefined\n"));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if settings given and cannot be validated (after setting dacs), return
|
||||
// error
|
||||
if (myMod.reg >= 0) {
|
||||
if (getSettings() != (enum detectorSettings)myMod.reg) {
|
||||
sprintf(
|
||||
mess,
|
||||
"Could not set module. The dacs in file do not correspond to "
|
||||
"settings %d\n",
|
||||
myMod.reg);
|
||||
LOG(logERROR, (mess));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
// threshold
|
||||
for (int i = 0; i < NCOUNTERS; ++i) {
|
||||
if (myMod.eV[i] >= 0) {
|
||||
setThresholdEnergy(i, myMod.eV[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// trimbits
|
||||
if (myMod.nchan == 0) {
|
||||
LOG(logINFO, ("Setting module without trimbits\n"));
|
||||
@ -1054,9 +1129,6 @@ int setModule(sls_detector_module myMod, char *mess) {
|
||||
if (setTrimbits(myMod.chanregs) == FAIL) {
|
||||
sprintf(mess, "Could not set module. Could not set trimbits\n");
|
||||
LOG(logERROR, (mess));
|
||||
// setSettings(UNDEFINED);
|
||||
// LOG(logERROR, ("Settings has been changed to undefined (random "
|
||||
// "trim file)\n"));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
@ -1236,6 +1308,7 @@ int setTrimbits(int *trimbits) {
|
||||
}
|
||||
|
||||
int setAllTrimbits(int val) {
|
||||
LOG(logINFO, ("Setting all trimbits to %d\n", val));
|
||||
int *trimbits = malloc(sizeof(int) * ((detectorModules)->nchan));
|
||||
for (int ichan = 0; ichan < ((detectorModules)->nchan); ++ichan) {
|
||||
trimbits[ichan] = val;
|
||||
@ -1245,11 +1318,14 @@ int setAllTrimbits(int val) {
|
||||
free(trimbits);
|
||||
return FAIL;
|
||||
}
|
||||
// setSettings(UNDEFINED);
|
||||
// LOG(logERROR, ("Settings has been changed to undefined (random "
|
||||
// "trim file)\n"));
|
||||
LOG(logINFO, ("All trimbits have been set to %d\n", val));
|
||||
free(trimbits);
|
||||
// changed for setsettings (direct),
|
||||
// custom trimbit file (setmodule with myMod.reg as -1),
|
||||
// change of dac (direct)
|
||||
for (int i = 0; i < NCOUNTERS; ++i) {
|
||||
setThresholdEnergy(i, -1);
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -1267,6 +1343,73 @@ int getAllTrimbits() {
|
||||
return value;
|
||||
}
|
||||
|
||||
enum detectorSettings setSettings(enum detectorSettings sett) {
|
||||
switch (sett) {
|
||||
case STANDARD:
|
||||
LOG(logINFOBLUE, ("Setting to standard settings\n"));
|
||||
thisSettings = sett;
|
||||
setDAC(M_VRPREAMP, DEFAULT_STANDARD_VRPREAMP, 0);
|
||||
setDAC(M_VRSHAPER, DEFAULT_STANDARD_VRSHAPER, 0);
|
||||
break;
|
||||
case FAST:
|
||||
LOG(logINFOBLUE, ("Setting to fast settings\n"));
|
||||
thisSettings = sett;
|
||||
setDAC(M_VRPREAMP, DEFAULT_FAST_VRPREAMP, 0);
|
||||
setDAC(M_VRSHAPER, DEFAULT_FAST_VRSHAPER, 0);
|
||||
break;
|
||||
case HIGHGAIN:
|
||||
LOG(logINFOBLUE, ("Setting to high gain settings\n"));
|
||||
thisSettings = sett;
|
||||
setDAC(M_VRPREAMP, DEFAULT_HIGHGAIN_VRPREAMP, 0);
|
||||
setDAC(M_VRSHAPER, DEFAULT_HIGHGAIN_VRSHAPER, 0);
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR,
|
||||
("Settings %d not defined for this detector\n", (int)sett));
|
||||
return thisSettings;
|
||||
}
|
||||
|
||||
LOG(logINFO, ("Settings: %d\n", thisSettings));
|
||||
return thisSettings;
|
||||
}
|
||||
|
||||
void validateSettings() {
|
||||
if (detectorDacs[M_VRPREAMP] == DEFAULT_STANDARD_VRPREAMP &&
|
||||
detectorDacs[M_VRSHAPER] == DEFAULT_STANDARD_VRSHAPER) {
|
||||
if (thisSettings != STANDARD) {
|
||||
thisSettings = STANDARD;
|
||||
LOG(logINFOBLUE, ("Validated Settings changed to standard!\n"));
|
||||
}
|
||||
} else if (detectorDacs[M_VRPREAMP] == DEFAULT_FAST_VRPREAMP &&
|
||||
detectorDacs[M_VRSHAPER] == DEFAULT_FAST_VRSHAPER) {
|
||||
if (thisSettings != FAST) {
|
||||
thisSettings = FAST;
|
||||
LOG(logINFOBLUE, ("Validated Settings changed to fast!\n"));
|
||||
}
|
||||
} else if (detectorDacs[M_VRPREAMP] == DEFAULT_HIGHGAIN_VRPREAMP &&
|
||||
detectorDacs[M_VRSHAPER] == DEFAULT_HIGHGAIN_VRSHAPER) {
|
||||
if (thisSettings != HIGHGAIN) {
|
||||
thisSettings = HIGHGAIN;
|
||||
LOG(logINFOBLUE, ("Validated Settings changed to highgain!\n"));
|
||||
}
|
||||
} else {
|
||||
thisSettings = UNDEFINED;
|
||||
LOG(logWARNING,
|
||||
("Settings set to undefined [vrpreamp: %d, vrshaper: %d]\n",
|
||||
detectorDacs[M_VRPREAMP], detectorDacs[M_VRSHAPER]));
|
||||
}
|
||||
}
|
||||
|
||||
enum detectorSettings getSettings() { return thisSettings; }
|
||||
|
||||
int getThresholdEnergy(int counterIndex) {
|
||||
return (detectorModules)->eV[counterIndex];
|
||||
}
|
||||
|
||||
void setThresholdEnergy(int counterIndex, int eV) {
|
||||
(detectorModules)->eV[counterIndex] = eV;
|
||||
}
|
||||
|
||||
/* parameters - dac, hv */
|
||||
void setDAC(enum DACINDEX ind, int val, int mV) {
|
||||
if (val < 0) {
|
||||
@ -1281,12 +1424,37 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
||||
setDAC(M_VTH3, val, mV);
|
||||
return;
|
||||
}
|
||||
|
||||
char *dac_names[] = {DAC_NAMES};
|
||||
|
||||
// remember vthx values and set 2800 if counter disabled
|
||||
uint32_t counters = getCounterMask();
|
||||
int vthdacs[] = {M_VTH1, M_VTH2, M_VTH3};
|
||||
for (int i = 0; i < NCOUNTERS; ++i) {
|
||||
if (vthdacs[i] == (int)ind) {
|
||||
// remember enabled values for vthx
|
||||
if (val != DEFAULT_COUNTER_DISABLED_VTH_VAL) {
|
||||
int vthval = val;
|
||||
if (mV) {
|
||||
if (LTC2620_D_VoltageToDac(val, &vthval) == FAIL) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
vthEnabledVals[i] = vthval;
|
||||
LOG(logINFO, ("Remembering %s [%d]\n", dac_names[ind], vthval));
|
||||
}
|
||||
// set vthx to disable val, if counter disabled
|
||||
if (!(counters & (1 << i))) {
|
||||
LOG(logINFO, ("Disabling %s\n", dac_names[ind]));
|
||||
val = DEFAULT_COUNTER_DISABLED_VTH_VAL;
|
||||
mV = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOG(logDEBUG1, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind],
|
||||
val, (mV ? "mV" : "dac units")));
|
||||
|
||||
int dacval = val;
|
||||
|
||||
#ifdef VIRTUAL
|
||||
LOG(logINFO, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind],
|
||||
val, (mV ? "mV" : "dac units")));
|
||||
@ -1303,11 +1471,14 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
||||
detectorDacs[ind] = dacval;
|
||||
}
|
||||
#endif
|
||||
if (ind == M_VRPREAMP || ind == M_VRSHAPER) {
|
||||
validateSettings();
|
||||
}
|
||||
}
|
||||
|
||||
int getDAC(enum DACINDEX ind, int mV) {
|
||||
if (ind == M_VTHRESHOLD) {
|
||||
int ret[3] = {0};
|
||||
int ret[NCOUNTERS] = {0};
|
||||
ret[0] = getDAC(M_VTH1, mV);
|
||||
ret[1] = getDAC(M_VTH2, mV);
|
||||
ret[2] = getDAC(M_VTH3, mV);
|
||||
@ -1351,8 +1522,16 @@ int setHighVoltage(int val) {
|
||||
return highvoltage;
|
||||
}
|
||||
|
||||
int isMaster(){
|
||||
return !(bus_r(0x18) >> 31);
|
||||
}
|
||||
|
||||
/* parameters - timing */
|
||||
void setTiming(enum timingMode arg) {
|
||||
|
||||
if (!isMaster() && arg == AUTO_TIMING)
|
||||
arg = TRIGGER_EXPOSURE;
|
||||
|
||||
uint32_t addr = CONFIG_REG;
|
||||
switch (arg) {
|
||||
case AUTO_TIMING:
|
||||
@ -1719,8 +1898,8 @@ uint64_t readPatternWord(int addr) {
|
||||
LOG(logDEBUG1, (" Reading Pattern Word (addr:0x%x)\n", addr));
|
||||
uint32_t reg_lsb =
|
||||
PATTERN_STEP0_LSB_REG +
|
||||
addr * REG_OFFSET * 2; // the first word in RAM as base plus the offset
|
||||
// of the word to write (addr)
|
||||
addr * REG_OFFSET * 2; // the first word in RAM as base plus the
|
||||
// offset of the word to write (addr)
|
||||
uint32_t reg_msb = PATTERN_STEP0_MSB_REG + addr * REG_OFFSET * 2;
|
||||
|
||||
// read value
|
||||
@ -1750,8 +1929,8 @@ uint64_t writePatternWord(int addr, uint64_t word) {
|
||||
// write word
|
||||
uint32_t reg_lsb =
|
||||
PATTERN_STEP0_LSB_REG +
|
||||
addr * REG_OFFSET * 2; // the first word in RAM as base plus the offset
|
||||
// of the word to write (addr)
|
||||
addr * REG_OFFSET * 2; // the first word in RAM as base plus the
|
||||
// offset of the word to write (addr)
|
||||
uint32_t reg_msb = PATTERN_STEP0_MSB_REG + addr * REG_OFFSET * 2;
|
||||
set64BitReg(word, reg_lsb, reg_msb);
|
||||
|
||||
@ -2420,8 +2599,12 @@ int startReadOut() {
|
||||
|
||||
// start readout
|
||||
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STRT_READOUT_MSK);
|
||||
|
||||
LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG)));
|
||||
usleep(1);
|
||||
while (bus_r(ASIC_RDO_STATUS_REG) & ASIC_RDO_STATUS_BUSY_MSK) {
|
||||
usleep(1);
|
||||
}
|
||||
LOG(logINFOBLUE, ("Readout done\n"));
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -2472,9 +2655,9 @@ enum runStatus getRunStatus() {
|
||||
uint32_t deadtimeReg = bus_r(DEADTIME_CONFIG_REG);
|
||||
if ((deadtimeReg & DEADTIME_EARLY_EXP_FIN_ERR_MSK) >>
|
||||
DEADTIME_EARLY_EXP_FIN_ERR_OFST) {
|
||||
LOG(logERROR,
|
||||
("Status: ERROR in Dead Time Reg (too short exptime) %08x\n",
|
||||
deadtimeReg));
|
||||
LOG(logERROR, ("Status: ERROR in Dead Time Reg (too short "
|
||||
"exptime) %08x\n",
|
||||
deadtimeReg));
|
||||
s = ERROR;
|
||||
}
|
||||
// stopped or error
|
||||
@ -2560,9 +2743,12 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
||||
destMod->iodelay = srcMod->iodelay;
|
||||
if (srcMod->tau >= 0)
|
||||
destMod->tau = srcMod->tau;
|
||||
if (srcMod->eV >= 0)
|
||||
destMod->eV = srcMod->eV;
|
||||
*/
|
||||
for (int i = 0; i < NCOUNTERS; ++i) {
|
||||
if (srcMod->eV[i] >= 0)
|
||||
destMod->eV[i] = srcMod->eV[i];
|
||||
}
|
||||
|
||||
LOG(logDEBUG1, ("Copying register %x (%x)\n", destMod->reg, srcMod->reg));
|
||||
|
||||
if (destMod->nchan != 0) {
|
||||
@ -2592,3 +2778,78 @@ int getTotalNumberOfChannels() {
|
||||
int getNumberOfChips() { return NCHIP; }
|
||||
int getNumberOfDACs() { return NDAC; }
|
||||
int getNumberOfChannelsPerChip() { return NCHAN; }
|
||||
|
||||
int setChipStatusRegister(int csr) {
|
||||
int iaddr=0;
|
||||
int nbits=18;
|
||||
int error=0;
|
||||
//int start=0, stop=MAX_PATTERN_LENGTH, loop=0;
|
||||
int patword=0;
|
||||
patword=setBit(SIGNAL_STATLOAD,patword);
|
||||
for (int i=0; i<2; i++)
|
||||
writePatternWord(iaddr++, patword);
|
||||
patword=setBit(SIGNAL_resStorage,patword);
|
||||
patword=setBit(SIGNAL_resCounter,patword);
|
||||
for (int i=0; i<8; i++)
|
||||
writePatternWord(iaddr++, patword);
|
||||
patword=clearBit(SIGNAL_resStorage,patword);
|
||||
patword=clearBit(SIGNAL_resCounter,patword);
|
||||
for (int i=0; i<8; i++)
|
||||
writePatternWord(iaddr++, patword);
|
||||
//#This version of the serializer pushes in the MSB first (compatible with the CSR bit numbering)
|
||||
for (int ib=nbits-1; ib>=0; ib--) {
|
||||
if (csr&(1<<ib))
|
||||
patword=setBit(SIGNAL_serialIN,patword);
|
||||
else
|
||||
patword=clearBit(SIGNAL_serialIN,patword);
|
||||
for (int i=0; i<4; i++)
|
||||
writePatternWord(iaddr++, patword);
|
||||
patword=setBit(SIGNAL_CHSclk,patword);
|
||||
writePatternWord(iaddr++, patword);
|
||||
patword=clearBit(SIGNAL_CHSclk,patword);
|
||||
writePatternWord(iaddr++, patword);
|
||||
}
|
||||
|
||||
patword=clearBit(SIGNAL_serialIN,patword);
|
||||
for (int i=0; i<2; i++)
|
||||
writePatternWord(iaddr++, patword);
|
||||
patword=setBit(SIGNAL_STO,patword);
|
||||
for (int i=0; i<5; i++)
|
||||
writePatternWord(iaddr++, patword);
|
||||
patword=clearBit(SIGNAL_STO,patword);
|
||||
for (int i=0; i<5; i++)
|
||||
writePatternWord(iaddr++, patword);
|
||||
patword=clearBit(SIGNAL_STATLOAD,patword);
|
||||
for (int i=0; i<5; i++)
|
||||
writePatternWord(iaddr++, patword);
|
||||
|
||||
if (iaddr >= MAX_PATTERN_LENGTH) {
|
||||
LOG(logERROR, ("Addr 0x%x is past max_address_length 0x%x!\n",
|
||||
iaddr, MAX_PATTERN_LENGTH));
|
||||
error = 1;
|
||||
}
|
||||
// set pattern wait address
|
||||
for (int i = 0; i <= 2; i++)
|
||||
setPatternWaitAddress(i, MAX_PATTERN_LENGTH - 1);
|
||||
|
||||
// pattern loop
|
||||
for (int i = 0; i <= 2; i++) {
|
||||
int stop = MAX_PATTERN_LENGTH - 1, nloop = 0;
|
||||
setPatternLoop(i, &stop, &stop, &nloop);
|
||||
}
|
||||
|
||||
// pattern limits
|
||||
{
|
||||
int start = 0, nloop = 0;
|
||||
setPatternLoop(-1, &start, &iaddr, &nloop);
|
||||
}
|
||||
// send pattern to the chips
|
||||
startPattern();
|
||||
|
||||
if (error != 0) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
#pragma once
|
||||
#include "sls/sls_detector_defs.h"
|
||||
|
||||
#define REQRD_FRMWRE_VRSN (0x200925)
|
||||
#define REQRD_FRMWRE_VRSN (0x210201)
|
||||
#define KERNEL_DATE_VRSN "Wed May 20 13:58:38 CEST 2020"
|
||||
#define ID_FILE "detid_mythen3.txt"
|
||||
|
||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||
|
||||
@ -25,24 +26,35 @@
|
||||
#define MAX_EXT_SIGNALS (8)
|
||||
|
||||
/** Default Parameters */
|
||||
#define DEFAULT_PATTERN_FILE ("DefaultPattern_mythen3.txt")
|
||||
#define DEFAULT_INTERNAL_GATES (1)
|
||||
#define DEFAULT_EXTERNAL_GATES (1)
|
||||
#define DEFAULT_DYNAMIC_RANGE (32)
|
||||
#define DEFAULT_NUM_FRAMES (1)
|
||||
#define DEFAULT_NUM_CYCLES (1)
|
||||
#define DEFAULT_GATE_WIDTH (100 * 1000 * 1000) // ns
|
||||
#define DEFAULT_GATE_DELAY (0)
|
||||
#define DEFAULT_PERIOD (2 * 1000 * 1000) // ns
|
||||
#define DEFAULT_DELAY_AFTER_TRIGGER (0)
|
||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||
#define DEFAULT_READOUT_C0 (10) //(100000000) // rdo_clk, 100 MHz
|
||||
#define DEFAULT_READOUT_C1 (10) //(100000000) // smp sample clk (x2), 100 MHz
|
||||
#define DEFAULT_SYSTEM_C0 (10) //(100000000) // run_clk, 100 MHz
|
||||
#define DEFAULT_SYSTEM_C1 (10) //(100000000) // sync_clk, 100 MHz
|
||||
#define DEFAULT_SYSTEM_C2 (10) //(100000000) // str_clk, 100 MHz
|
||||
#define DEFAULT_SYSTEM_C3 (5) //(200000000) // smp_clk, 200 MHz
|
||||
#define DEFAULT_PATTERN_FILE ("DefaultPattern_mythen3.txt")
|
||||
#define DEFAULT_INTERNAL_GATES (1)
|
||||
#define DEFAULT_EXTERNAL_GATES (1)
|
||||
#define DEFAULT_DYNAMIC_RANGE (32)
|
||||
#define DEFAULT_NUM_FRAMES (1)
|
||||
#define DEFAULT_NUM_CYCLES (1)
|
||||
#define DEFAULT_GATE_WIDTH (100 * 1000 * 1000) // ns
|
||||
#define DEFAULT_GATE_DELAY (0)
|
||||
#define DEFAULT_PERIOD (2 * 1000 * 1000) // ns
|
||||
#define DEFAULT_DELAY_AFTER_TRIGGER (0)
|
||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||
#define DEFAULT_SETTINGS (STANDARD)
|
||||
#define DEFAULT_TRIMBIT_VALUE (0)
|
||||
#define DEFAULT_COUNTER_DISABLED_VTH_VAL (2800)
|
||||
|
||||
#define DEFAULT_STANDARD_VRPREAMP (1100)
|
||||
#define DEFAULT_FAST_VRPREAMP (300)
|
||||
#define DEFAULT_HIGHGAIN_VRPREAMP (1300)
|
||||
#define DEFAULT_STANDARD_VRSHAPER (1280)
|
||||
#define DEFAULT_FAST_VRSHAPER (1500)
|
||||
#define DEFAULT_HIGHGAIN_VRSHAPER (1100)
|
||||
|
||||
#define DEFAULT_READOUT_C0 (10) //(100000000) // rdo_clk, 100 MHz
|
||||
#define DEFAULT_READOUT_C1 (10) //(100000000) // smp sample clk (x2), 100 MHz
|
||||
#define DEFAULT_SYSTEM_C0 (10) //(100000000) // run_clk, 100 MHz
|
||||
#define DEFAULT_SYSTEM_C1 (10) //(100000000) // sync_clk, 100 MHz
|
||||
#define DEFAULT_SYSTEM_C2 (10) //(100000000) // str_clk, 100 MHz
|
||||
#define DEFAULT_SYSTEM_C3 (5) //(200000000) // smp_clk, 200 MHz
|
||||
// (DEFAULT_SYSTEM_C3 only for timing receiver) should not be changed
|
||||
#define DEFAULT_TRIMMING_RUN_CLKDIV (40) // (25000000) // 25 MHz
|
||||
|
||||
@ -174,3 +186,19 @@ typedef struct udp_header_struct {
|
||||
#define SIGNAL_resCounter (23)
|
||||
#define SIGNAL_CHSclk (24)
|
||||
#define SIGNAL_exposing (25)
|
||||
|
||||
//CHIP STARTUS REGISTER BITS
|
||||
#define CSR_spypads 0
|
||||
#define CSR_invpol 4
|
||||
#define CSR_dpulse 5
|
||||
#define CSR_interp 6
|
||||
#define CSR_C10pre 7 //#default
|
||||
#define CSR_pumprobe 8
|
||||
#define CSR_apulse 9
|
||||
#define CSR_C15sh 10
|
||||
#define CSR_C30sh 11 //#default
|
||||
#define CSR_C50sh 12
|
||||
#define CSR_C225ACsh 13 // Connects 225fF SHAPER AC cap (1: 225 to shaper, 225 to GND. 0: 450 to shaper)
|
||||
#define CSR_C15pre 14
|
||||
|
||||
#define CSR_default (1<<CSR_C10pre )|(1<< CSR_C30sh)
|
||||
|
@ -15,9 +15,13 @@
|
||||
* @param vcofreq1 vco frequency of pll 1
|
||||
*/
|
||||
void ALTERA_PLL_C10_SetDefines(int regofst, uint32_t baseaddr0,
|
||||
uint32_t baseaddr1, uint32_t resetreg0,
|
||||
uint32_t resetreg1, uint32_t resetmsk0,
|
||||
uint32_t resetmsk1, int vcofreq0, int vcofreq1);
|
||||
uint32_t baseaddr1, uint32_t resetreg,
|
||||
uint32_t resetmsk0, uint32_t resetmsk1,
|
||||
#ifdef MYTHEN3D
|
||||
uint32_t statusreg, uint32_t statusmsk0,
|
||||
uint32_t statusmsk1,
|
||||
#endif
|
||||
int vcofreq0, int vcofreq1);
|
||||
|
||||
/**
|
||||
* Get Max Clock Divider
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
int loadDefaultPattern(char *patFname);
|
||||
int loadDefaultPattern(char *patFname, char *errMessage);
|
||||
|
||||
int default_writePatternWord(char *line, uint32_t addr, uint64_t word);
|
||||
|
||||
|
@ -87,7 +87,7 @@ u_int16_t getHardwareSerialNumber();
|
||||
#ifdef JUNGFRAUD
|
||||
int isHardwareVersion2();
|
||||
#endif
|
||||
#ifdef EIGERD
|
||||
#if defined(EIGERD) || defined(MYTHEN3D)
|
||||
void readDetectorNumber();
|
||||
#endif
|
||||
u_int32_t getDetectorNumber();
|
||||
@ -291,19 +291,23 @@ int setTrimbits(int *trimbits);
|
||||
int setAllTrimbits(int val);
|
||||
int getAllTrimbits();
|
||||
#endif
|
||||
#if (!defined(CHIPTESTBOARDD)) && (!defined(MYTHEN3D))
|
||||
#ifndef CHIPTESTBOARDD
|
||||
enum detectorSettings setSettings(enum detectorSettings sett);
|
||||
#endif
|
||||
#if !defined(MYTHEN3D)
|
||||
enum detectorSettings getSettings();
|
||||
#ifdef MYTHEN3D
|
||||
void validateSettings();
|
||||
#endif
|
||||
enum detectorSettings getSettings();
|
||||
|
||||
// parameters - threshold
|
||||
#ifdef EIGERD
|
||||
int getThresholdEnergy();
|
||||
int setThresholdEnergy(int ev);
|
||||
#endif
|
||||
|
||||
#ifdef MYTHEN3D
|
||||
int getThresholdEnergy(int counterIndex);
|
||||
void setThresholdEnergy(int counterIndex, int eV);
|
||||
#endif
|
||||
// parameters - dac, adc, hv
|
||||
|
||||
#ifdef GOTTHARD2D
|
||||
@ -348,6 +352,7 @@ void setTiming(enum timingMode arg);
|
||||
enum timingMode getTiming();
|
||||
#ifdef MYTHEN3D
|
||||
void setInitialExtSignals();
|
||||
int isMaster();
|
||||
#endif
|
||||
#if defined(GOTTHARDD) || defined(MYTHEN3D)
|
||||
void setExtSignal(int signalIndex, enum externalSignalFlag mode);
|
||||
|
@ -242,4 +242,8 @@ int validate_udp_configuration(int);
|
||||
int get_bursts_left(int);
|
||||
int start_readout(int);
|
||||
int set_default_dacs(int);
|
||||
int is_virtual(int);
|
||||
int is_virtual(int);
|
||||
int get_pattern(int);
|
||||
int load_default_pattern(int);
|
||||
int get_all_threshold_energy(int);
|
||||
int get_master(int);
|
@ -56,21 +56,35 @@
|
||||
int ALTERA_PLL_C10_Reg_offset = 0x0;
|
||||
const int ALTERA_PLL_C10_NUM = 2;
|
||||
uint32_t ALTERA_PLL_C10_BaseAddress[2] = {0x0, 0x0};
|
||||
uint32_t ALTERA_PLL_C10_Reset_Reg[2] = {0x0, 0x0};
|
||||
uint32_t ALTERA_PLL_C10_Reset_Reg = 0x0;
|
||||
uint32_t ALTERA_PLL_C10_Reset_Msk[2] = {0x0, 0x0};
|
||||
#ifdef MYTHEN3D
|
||||
uint32_t ALTERA_PLL_C10_Locked_Status_Reg = 0x0;
|
||||
uint32_t ALTERA_PLL_C10_Locked_Status_Msk[2] = {0x0, 0x0};
|
||||
#endif
|
||||
int ALTERA_PLL_C10_VCO_FREQ[2] = {0, 0};
|
||||
|
||||
void ALTERA_PLL_C10_SetDefines(int regofst, uint32_t baseaddr0,
|
||||
uint32_t baseaddr1, uint32_t resetreg0,
|
||||
uint32_t resetreg1, uint32_t resetmsk0,
|
||||
uint32_t resetmsk1, int vcofreq0, int vcofreq1) {
|
||||
uint32_t baseaddr1, uint32_t resetreg,
|
||||
uint32_t resetmsk0, uint32_t resetmsk1,
|
||||
#ifdef MYTHEN3D
|
||||
uint32_t statusreg, uint32_t statusmsk0,
|
||||
uint32_t statusmsk1,
|
||||
#endif
|
||||
int vcofreq0, int vcofreq1) {
|
||||
ALTERA_PLL_C10_Reg_offset = regofst;
|
||||
ALTERA_PLL_C10_BaseAddress[0] = baseaddr0;
|
||||
ALTERA_PLL_C10_BaseAddress[1] = baseaddr1;
|
||||
ALTERA_PLL_C10_Reset_Reg[0] = resetreg0;
|
||||
ALTERA_PLL_C10_Reset_Reg[1] = resetreg1;
|
||||
ALTERA_PLL_C10_Reset_Reg = resetreg;
|
||||
ALTERA_PLL_C10_Reset_Msk[0] = resetmsk0;
|
||||
ALTERA_PLL_C10_Reset_Msk[1] = resetmsk1;
|
||||
|
||||
// pll locked status reg and msk only used for m3 now
|
||||
#ifdef MYTHEN3D
|
||||
ALTERA_PLL_C10_Locked_Status_Reg = statusreg;
|
||||
ALTERA_PLL_C10_Locked_Status_Msk[0] = statusmsk0;
|
||||
ALTERA_PLL_C10_Locked_Status_Msk[1] = statusmsk1;
|
||||
#endif
|
||||
ALTERA_PLL_C10_VCO_FREQ[0] = vcofreq0;
|
||||
ALTERA_PLL_C10_VCO_FREQ[1] = vcofreq1;
|
||||
}
|
||||
@ -98,12 +112,24 @@ void ALTERA_PLL_C10_Reconfigure(int pllIndex) {
|
||||
}
|
||||
|
||||
void ALTERA_PLL_C10_ResetPLL(int pllIndex) {
|
||||
uint32_t resetreg = ALTERA_PLL_C10_Reset_Reg[pllIndex];
|
||||
uint32_t resetreg = ALTERA_PLL_C10_Reset_Reg;
|
||||
uint32_t resetmsk = ALTERA_PLL_C10_Reset_Msk[pllIndex];
|
||||
LOG(logINFO, ("Resetting PLL %d\n", pllIndex));
|
||||
bus_w_csp1(resetreg, bus_r_csp1(resetreg) | resetmsk);
|
||||
|
||||
usleep(ALTERA_PLL_C10_WAIT_TIME_US);
|
||||
|
||||
#ifndef VIRTUAL
|
||||
#ifdef MYTHEN3D
|
||||
uint32_t statusreg = ALTERA_PLL_C10_Locked_Status_Reg;
|
||||
uint32_t statusmsk = ALTERA_PLL_C10_Locked_Status_Msk[pllIndex];
|
||||
// wait for pll locked bit to go high
|
||||
while (!(bus_r(statusreg) & statusmsk)) {
|
||||
usleep(ALTERA_PLL_C10_WAIT_TIME_US);
|
||||
LOG(logWARNING, ("Still waiting for PLL %d recovery\n", pllIndex));
|
||||
}
|
||||
LOG(logINFO, ("Reset success for PLL %d\n", pllIndex));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void ALTERA_PLL_C10_SetPhaseShift(int pllIndex, int clkIndex, int phase,
|
||||
|
@ -458,12 +458,12 @@ int receiveModule(int file_des, sls_detector_module *myMod) {
|
||||
}
|
||||
ts += n;
|
||||
LOG(level, ("tau received. %d bytes. tau: %d\n", n, myMod->tau));
|
||||
n = receiveData(file_des, &(myMod->eV), sizeof(myMod->eV), INT32);
|
||||
n = receiveData(file_des, myMod->eV, sizeof(myMod->eV), INT32);
|
||||
if (!n) {
|
||||
return -1;
|
||||
}
|
||||
ts += n;
|
||||
LOG(level, ("eV received. %d bytes. eV: %d\n", n, myMod->eV));
|
||||
LOG(level, ("eV received. %d bytes. eV: %d\n", n, myMod->eV[0]));
|
||||
// dacs
|
||||
if (nDacs != (myMod->ndac)) {
|
||||
LOG(logERROR, ("received wrong number of dacs. "
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <string.h>
|
||||
|
||||
extern char initErrorMessage[MAX_STR_LENGTH];
|
||||
extern int initError;
|
||||
|
||||
#ifndef MYTHEN3D
|
||||
extern uint64_t writePatternIOControl(uint64_t word);
|
||||
@ -19,11 +18,7 @@ extern uint64_t setPatternWaitTime(int level, uint64_t t);
|
||||
extern void setPatternLoop(int level, int *startAddr, int *stopAddr,
|
||||
int *nLoop);
|
||||
|
||||
int loadDefaultPattern(char *patFname) {
|
||||
if (initError == FAIL) {
|
||||
return initError;
|
||||
}
|
||||
|
||||
int loadDefaultPattern(char *patFname, char *errMessage) {
|
||||
char fname[128];
|
||||
if (getAbsPath(fname, 128, patFname) == FAIL) {
|
||||
return FAIL;
|
||||
@ -32,10 +27,8 @@ int loadDefaultPattern(char *patFname) {
|
||||
// open config file
|
||||
FILE *fd = fopen(fname, "r");
|
||||
if (fd == NULL) {
|
||||
sprintf(initErrorMessage, "Could not open pattern file [%s].\n",
|
||||
patFname);
|
||||
initError = FAIL;
|
||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
sprintf(errMessage, "Could not open pattern file [%s].\n", patFname);
|
||||
LOG(logERROR, ("%s\n\n", errMessage));
|
||||
return FAIL;
|
||||
}
|
||||
LOG(logINFOBLUE, ("Reading default pattern file %s\n", patFname));
|
||||
@ -100,7 +93,7 @@ int loadDefaultPattern(char *patFname) {
|
||||
#else
|
||||
if (sscanf(line, "%s 0x%x 0x%llx", command, &addr, &word) != 3) {
|
||||
#endif
|
||||
sprintf(initErrorMessage,
|
||||
sprintf(errMessage,
|
||||
"Could not scan patword arguments from default "
|
||||
"pattern file. Line:[%s].\n",
|
||||
line);
|
||||
@ -123,7 +116,7 @@ int loadDefaultPattern(char *patFname) {
|
||||
#else
|
||||
if (sscanf(line, "%s 0x%llx", command, &arg) != 2) {
|
||||
#endif
|
||||
sprintf(initErrorMessage,
|
||||
sprintf(errMessage,
|
||||
"Could not scan patioctrl arguments from default "
|
||||
"pattern file. Line:[%s].\n",
|
||||
line);
|
||||
@ -144,7 +137,7 @@ int loadDefaultPattern(char *patFname) {
|
||||
// cannot scan values
|
||||
if (sscanf(line, "%s 0x%x 0x%x", command, &startAddr, &stopAddr) !=
|
||||
3) {
|
||||
sprintf(initErrorMessage,
|
||||
sprintf(errMessage,
|
||||
"Could not scan patlimits arguments from default "
|
||||
"pattern file. Line:[%s].\n",
|
||||
line);
|
||||
@ -177,7 +170,7 @@ int loadDefaultPattern(char *patFname) {
|
||||
// cannot scan values
|
||||
if (sscanf(line, "%s 0x%x 0x%x", command, &startAddr, &stopAddr) !=
|
||||
3) {
|
||||
sprintf(initErrorMessage,
|
||||
sprintf(errMessage,
|
||||
"Could not scan patloop%d arguments from default "
|
||||
"pattern file. Line:[%s].\n",
|
||||
level, line);
|
||||
@ -208,7 +201,7 @@ int loadDefaultPattern(char *patFname) {
|
||||
int numLoops = -1;
|
||||
// cannot scan values
|
||||
if (sscanf(line, "%s %d", command, &numLoops) != 2) {
|
||||
sprintf(initErrorMessage,
|
||||
sprintf(errMessage,
|
||||
"Could not scan patnloop%d arguments from default "
|
||||
"pattern file. Line:[%s].\n",
|
||||
level, line);
|
||||
@ -238,7 +231,7 @@ int loadDefaultPattern(char *patFname) {
|
||||
uint32_t addr = 0;
|
||||
// cannot scan values
|
||||
if (sscanf(line, "%s 0x%x", command, &addr) != 2) {
|
||||
sprintf(initErrorMessage,
|
||||
sprintf(errMessage,
|
||||
"Could not scan patwait%d arguments from default "
|
||||
"pattern file. Line:[%s].\n",
|
||||
level, line);
|
||||
@ -273,7 +266,7 @@ int loadDefaultPattern(char *patFname) {
|
||||
#else
|
||||
if (sscanf(line, "%s %lld", command, &waittime) != 2) {
|
||||
#endif
|
||||
sprintf(initErrorMessage,
|
||||
sprintf(errMessage,
|
||||
"Could not scan patwaittime%d arguments from default "
|
||||
"pattern file. Line:[%s].\n",
|
||||
level, line);
|
||||
@ -289,13 +282,12 @@ int loadDefaultPattern(char *patFname) {
|
||||
}
|
||||
fclose(fd);
|
||||
|
||||
if (strlen(initErrorMessage)) {
|
||||
initError = FAIL;
|
||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
} else {
|
||||
LOG(logINFOBLUE, ("Successfully read default pattern file\n"));
|
||||
if (strlen(errMessage)) {
|
||||
LOG(logERROR, ("%s\n\n", errMessage));
|
||||
return FAIL;
|
||||
}
|
||||
return initError;
|
||||
LOG(logINFOBLUE, ("Successfully read default pattern file\n"));
|
||||
return OK;
|
||||
}
|
||||
|
||||
int default_writePatternWord(char *line, uint32_t addr, uint64_t word) {
|
||||
|
@ -5,6 +5,10 @@
|
||||
#include "sls/sls_detector_funcs.h"
|
||||
#include "slsDetectorFunctionList.h"
|
||||
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D)
|
||||
#include "Pattern.h"
|
||||
#endif
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <pthread.h>
|
||||
#include <string.h>
|
||||
@ -361,6 +365,10 @@ void function_table() {
|
||||
flist[F_START_READOUT] = &start_readout;
|
||||
flist[F_SET_DEFAULT_DACS] = &set_default_dacs;
|
||||
flist[F_IS_VIRTUAL] = &is_virtual;
|
||||
flist[F_GET_PATTERN] = &get_pattern;
|
||||
flist[F_LOAD_DEFAULT_PATTERN] = &load_default_pattern;
|
||||
flist[F_GET_ALL_THRESHOLD_ENERGY] = &get_all_threshold_energy;
|
||||
flist[F_GET_MASTER] = &get_master;
|
||||
|
||||
// check
|
||||
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
||||
@ -631,7 +639,9 @@ int set_timing_mode(int file_des) {
|
||||
}
|
||||
// get
|
||||
retval = getTiming();
|
||||
#ifndef MYTHEN3D
|
||||
validate((int)arg, (int)retval, "set timing mode", DEC);
|
||||
#endif
|
||||
LOG(logDEBUG1, ("Timing Mode: %d\n", retval));
|
||||
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
@ -1232,6 +1242,16 @@ int validateAndSetDac(enum dacIndex ind, int val, int mV) {
|
||||
}
|
||||
LOG(logDEBUG1, ("Dac (%d): %d %s\n\n", serverDacIndex, retval,
|
||||
(mV ? "mV" : "dac units")));
|
||||
#ifdef MYTHEN3D
|
||||
// changed for setsettings (direct),
|
||||
// custom trimbit file (setmodule with myMod.reg as -1),
|
||||
// change of dac (direct)
|
||||
if (val != GET_FLAG && ret == OK) {
|
||||
for (int i = 0; i < NCOUNTERS; ++i) {
|
||||
setThresholdEnergy(i, -1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1507,7 +1527,7 @@ int set_module(int file_des) {
|
||||
LOG(logDEBUG1, ("module register is %d, nchan %d, nchip %d, "
|
||||
"ndac %d, iodelay %d, tau %d, eV %d\n",
|
||||
module.reg, module.nchan, module.nchip, module.ndac,
|
||||
module.iodelay, module.tau, module.eV));
|
||||
module.iodelay, module.tau, module.eV[0]));
|
||||
// should at least have a dac
|
||||
if (ts <= (int)sizeof(sls_detector_module)) {
|
||||
ret = FAIL;
|
||||
@ -1534,6 +1554,10 @@ int set_module(int file_des) {
|
||||
case LOWGAIN:
|
||||
case VERYHIGHGAIN:
|
||||
case VERYLOWGAIN:
|
||||
#elif MYTHEN3D
|
||||
case STANDARD:
|
||||
case FAST:
|
||||
case HIGHGAIN:
|
||||
#elif JUNGFRAUD
|
||||
case DYNAMICGAIN:
|
||||
case DYNAMICHG0:
|
||||
@ -1555,11 +1579,9 @@ int set_module(int file_des) {
|
||||
}
|
||||
|
||||
ret = setModule(module, mess);
|
||||
#ifndef MYTHEN3D
|
||||
enum detectorSettings retval = getSettings();
|
||||
validate(module.reg, (int)retval, "set module (settings)", DEC);
|
||||
LOG(logDEBUG1, ("Settings: %d\n", retval));
|
||||
#endif
|
||||
}
|
||||
free(myChan);
|
||||
free(myDac);
|
||||
@ -1577,7 +1599,7 @@ int set_settings(int file_des) {
|
||||
if (receiveData(file_des, &isett, sizeof(isett), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
#if defined(CHIPTESTBOARDD) || defined(MYTHEN3D)
|
||||
#ifdef CHIPTESTBOARDD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
LOG(logDEBUG1, ("Setting settings %d\n", isett));
|
||||
@ -1614,13 +1636,17 @@ int set_settings(int file_des) {
|
||||
case G2_LOWCAP_LOWGAIN:
|
||||
case G4_HIGHGAIN:
|
||||
case G4_LOWGAIN:
|
||||
#elif MYTHEN3D
|
||||
case STANDARD:
|
||||
case FAST:
|
||||
case HIGHGAIN:
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
if (myDetectorType == EIGER) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Cannot set settings via SET_SETTINGS, use "
|
||||
"SET_MODULE (set threshold)\n");
|
||||
"SET_MODULE\n");
|
||||
LOG(logERROR, (mess));
|
||||
} else
|
||||
modeNotImplemented("Settings Index", (int)isett);
|
||||
@ -1645,6 +1671,16 @@ int set_settings(int file_des) {
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef MYTHEN3D
|
||||
// changed for setsettings (direct),
|
||||
// custom trimbit file (setmodule with myMod.reg as -1),
|
||||
// change of dac (direct)
|
||||
if (ret == OK) {
|
||||
for (int i = 0; i < NCOUNTERS; ++i) {
|
||||
setThresholdEnergy(i, -1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -7094,15 +7130,20 @@ int get_receiver_parameters(int file_des) {
|
||||
if (n < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
// threshold ev
|
||||
// threshold ev
|
||||
{
|
||||
int i32s[3] = {0, 0, 0};
|
||||
#ifdef EIGERD
|
||||
i32 = getThresholdEnergy();
|
||||
#else
|
||||
i32 = 0;
|
||||
i32s[0] = getThresholdEnergy();
|
||||
#elif MYTHEN3D
|
||||
for (int i = 0; i < NCOUNTERS; ++i) {
|
||||
i32s[i] = getThresholdEnergy(i);
|
||||
}
|
||||
#endif
|
||||
n += sendData(file_des, &i32, sizeof(i32), INT32);
|
||||
if (n < 0)
|
||||
return printSocketReadError();
|
||||
n += sendData(file_des, i32s, sizeof(i32s), INT32);
|
||||
if (n < 0)
|
||||
return printSocketReadError();
|
||||
}
|
||||
|
||||
// dynamic range
|
||||
i32 = setDynamicRange(GET_FLAG);
|
||||
@ -7530,133 +7571,220 @@ int set_veto(int file_des) {
|
||||
int set_pattern(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint64_t *patwords = malloc(sizeof(uint64_t) * MAX_PATTERN_LENGTH);
|
||||
memset(patwords, 0, sizeof(uint64_t) * MAX_PATTERN_LENGTH);
|
||||
uint64_t patioctrl = 0;
|
||||
int patlimits[2] = {0, 0};
|
||||
int patloop[6] = {0, 0, 0, 0, 0, 0};
|
||||
int patnloop[3] = {0, 0, 0};
|
||||
int patwait[3] = {0, 0, 0};
|
||||
uint64_t patwaittime[3] = {0, 0, 0};
|
||||
if (receiveData(file_des, patwords, sizeof(uint64_t) * MAX_PATTERN_LENGTH,
|
||||
INT64) < 0)
|
||||
return printSocketReadError();
|
||||
if (receiveData(file_des, &patioctrl, sizeof(patioctrl), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
if (receiveData(file_des, patlimits, sizeof(patlimits), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
if (receiveData(file_des, patloop, sizeof(patloop), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
if (receiveData(file_des, patnloop, sizeof(patnloop), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
if (receiveData(file_des, patwait, sizeof(patwait), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
if (receiveData(file_des, patwaittime, sizeof(patwaittime), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
|
||||
patternParameters *pat = malloc(sizeof(patternParameters));
|
||||
memset(pat, 0, sizeof(patternParameters));
|
||||
|
||||
// ignoring endianness for eiger
|
||||
if (receiveData(file_des, pat, sizeof(patternParameters), INT32) < 0) {
|
||||
if (pat != NULL)
|
||||
free(pat);
|
||||
return printSocketReadError();
|
||||
}
|
||||
|
||||
if (Server_VerifyLock() == OK) {
|
||||
LOG(logINFO, ("Setting Pattern from file\n"));
|
||||
LOG(logINFO, ("Setting Pattern from structure\n"));
|
||||
LOG(logINFO,
|
||||
("Setting Pattern Word (printing every 10 words that are not 0\n"));
|
||||
for (int i = 0; i < MAX_PATTERN_LENGTH; ++i) {
|
||||
if ((i % 10 == 0) && patwords[i] != 0) {
|
||||
if ((i % 10 == 0) && pat->word[i] != 0) {
|
||||
LOG(logINFO, ("Setting Pattern Word (addr:0x%x, word:0x%llx)\n",
|
||||
i, (long long int)patwords[i]));
|
||||
i, (long long int)pat->word[i]));
|
||||
}
|
||||
writePatternWord(i, patwords[i]);
|
||||
writePatternWord(i, pat->word[i]);
|
||||
}
|
||||
int numLoops = -1, retval0 = -1, retval1 = -1;
|
||||
uint64_t retval64 = -1;
|
||||
#ifndef MYTHEN3D
|
||||
if (ret == OK) {
|
||||
retval64 = writePatternIOControl(patioctrl);
|
||||
validate64(patioctrl, retval64, "set pattern IO Control", HEX);
|
||||
uint64_t retval64 = writePatternIOControl(pat->ioctrl);
|
||||
validate64(pat->ioctrl, retval64, "set pattern IO Control", HEX);
|
||||
}
|
||||
#endif
|
||||
if (ret == OK) {
|
||||
numLoops = -1;
|
||||
retval0 = patlimits[0];
|
||||
retval1 = patlimits[1];
|
||||
int numLoops = -1;
|
||||
int retval0 = pat->limits[0];
|
||||
int retval1 = pat->limits[1];
|
||||
setPatternLoop(-1, &retval0, &retval1, &numLoops);
|
||||
validate(patlimits[0], retval0, "set pattern Limits start address",
|
||||
HEX);
|
||||
validate(patlimits[1], retval1, "set pattern Limits start address",
|
||||
HEX);
|
||||
validate(pat->limits[0], retval0,
|
||||
"set pattern Limits start address", HEX);
|
||||
validate(pat->limits[1], retval1,
|
||||
"set pattern Limits start address", HEX);
|
||||
}
|
||||
if (ret == OK) {
|
||||
retval0 = patloop[0];
|
||||
retval1 = patloop[1];
|
||||
numLoops = patnloop[0];
|
||||
setPatternLoop(0, &patloop[0], &patloop[1], &numLoops);
|
||||
validate(patloop[0], retval0, "set pattern Loop 0 start address",
|
||||
HEX);
|
||||
validate(patloop[1], retval1, "set pattern Loop 0 stop address",
|
||||
HEX);
|
||||
validate(patnloop[0], numLoops, "set pattern Loop 0 num loops",
|
||||
HEX);
|
||||
}
|
||||
if (ret == OK) {
|
||||
retval0 = patloop[2];
|
||||
retval1 = patloop[3];
|
||||
numLoops = patnloop[1];
|
||||
setPatternLoop(1, &patloop[2], &patloop[3], &numLoops);
|
||||
validate(patloop[2], retval0, "set pattern Loop 1 start address",
|
||||
HEX);
|
||||
validate(patloop[3], retval1, "set pattern Loop 1 stop address",
|
||||
HEX);
|
||||
validate(patnloop[1], numLoops, "set pattern Loop 1 num loops",
|
||||
HEX);
|
||||
}
|
||||
if (ret == OK) {
|
||||
retval0 = patloop[4];
|
||||
retval1 = patloop[5];
|
||||
numLoops = patnloop[2];
|
||||
setPatternLoop(2, &patloop[4], &patloop[5], &numLoops);
|
||||
validate(patloop[4], retval0, "set pattern Loop 2 start address",
|
||||
HEX);
|
||||
validate(patloop[5], retval1, "set pattern Loop 2 stop address",
|
||||
HEX);
|
||||
validate(patnloop[2], numLoops, "set pattern Loop 2 num loops",
|
||||
HEX);
|
||||
}
|
||||
if (ret == OK) {
|
||||
retval0 = setPatternWaitAddress(0, patwait[0]);
|
||||
validate(patwait[0], retval0, "set pattern Loop 0 wait address",
|
||||
HEX);
|
||||
}
|
||||
if (ret == OK) {
|
||||
retval0 = setPatternWaitAddress(1, patwait[1]);
|
||||
validate(patwait[1], retval0, "set pattern Loop 1 wait address",
|
||||
HEX);
|
||||
}
|
||||
if (ret == OK) {
|
||||
retval0 = setPatternWaitAddress(2, patwait[2]);
|
||||
validate(patwait[2], retval0, "set pattern Loop 2 wait address",
|
||||
HEX);
|
||||
}
|
||||
if (ret == OK) {
|
||||
uint64_t retval64 = setPatternWaitTime(0, patwaittime[0]);
|
||||
validate64(patwaittime[0], retval64, "set pattern Loop 0 wait time",
|
||||
HEX);
|
||||
}
|
||||
if (ret == OK) {
|
||||
retval64 = setPatternWaitTime(1, patwaittime[1]);
|
||||
validate64(patwaittime[1], retval64, "set pattern Loop 1 wait time",
|
||||
HEX);
|
||||
}
|
||||
if (ret == OK) {
|
||||
retval64 = setPatternWaitTime(2, patwaittime[2]);
|
||||
validate64(patwaittime[1], retval64, "set pattern Loop 2 wait time",
|
||||
HEX);
|
||||
for (int i = 0; i <= 2; ++i) {
|
||||
char msg[128];
|
||||
int retval0 = -1, retval1 = -1, numLoops = -1;
|
||||
uint64_t retval64 = -1;
|
||||
|
||||
// patloop
|
||||
retval0 = pat->loop[i * 2 + 0];
|
||||
retval1 = pat->loop[i * 2 + 1];
|
||||
numLoops = pat->nloop[i];
|
||||
setPatternLoop(i, &retval0, &retval1, &numLoops);
|
||||
memset(msg, 0, sizeof(msg));
|
||||
sprintf(msg, "set pattern Loop %d start address", i);
|
||||
validate(pat->loop[i * 2 + 0], retval0, msg, HEX);
|
||||
if (ret == FAIL) {
|
||||
break;
|
||||
}
|
||||
memset(msg, 0, sizeof(msg));
|
||||
sprintf(msg, "set pattern Loop %d stop address", i);
|
||||
validate(pat->loop[i * 2 + 1], retval1, msg, HEX);
|
||||
if (ret == FAIL) {
|
||||
break;
|
||||
}
|
||||
memset(msg, 0, sizeof(msg));
|
||||
sprintf(msg, "set pattern Loop %d num loops", i);
|
||||
validate(pat->nloop[i], numLoops, msg, HEX);
|
||||
if (ret == FAIL) {
|
||||
break;
|
||||
}
|
||||
|
||||
// patwait
|
||||
memset(msg, 0, sizeof(msg));
|
||||
sprintf(msg, "set pattern Loop %d wait address", i);
|
||||
retval0 = setPatternWaitAddress(i, pat->wait[i]);
|
||||
validate(pat->wait[i], retval0, msg, HEX);
|
||||
if (ret == FAIL) {
|
||||
break;
|
||||
}
|
||||
|
||||
// patwaittime
|
||||
memset(msg, 0, sizeof(msg));
|
||||
sprintf(msg, "set pattern Loop %d wait time", i);
|
||||
retval64 = setPatternWaitTime(i, pat->waittime[i]);
|
||||
validate64(pat->waittime[i], retval64, msg, HEX);
|
||||
if (ret == FAIL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pat != NULL)
|
||||
free(pat);
|
||||
#endif
|
||||
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
}
|
||||
|
||||
int get_pattern(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
|
||||
#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D)
|
||||
functionNotImplemented();
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
#else
|
||||
|
||||
patternParameters *pat = malloc(sizeof(patternParameters));
|
||||
memset(pat, 0, sizeof(patternParameters));
|
||||
|
||||
if (Server_VerifyLock() == OK) {
|
||||
LOG(logINFO, ("Getting Pattern from structure\n"));
|
||||
|
||||
// patword
|
||||
LOG(logDEBUG,
|
||||
("retval pattern word (printing every 10 words that are not 0\n"));
|
||||
for (int i = 0; i < MAX_PATTERN_LENGTH; ++i) {
|
||||
pat->word[i] = readPatternWord(i);
|
||||
if ((int64_t)pat->word[i] == -1) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "could not read pattern word for address 0x%x\n",
|
||||
i);
|
||||
LOG(logERROR, (mess));
|
||||
break;
|
||||
}
|
||||
// debug print
|
||||
if ((i % 10 == 0) && pat->word[i] != 0) {
|
||||
LOG(logDEBUG,
|
||||
("retval Patpattern word (addr:0x%x, word:0x%llx)\n", i,
|
||||
(long long int)pat->word[i]));
|
||||
}
|
||||
}
|
||||
|
||||
// patioctrl
|
||||
#ifndef MYTHEN3D
|
||||
if (ret == OK) {
|
||||
pat->ioctrl = writePatternIOControl(-1);
|
||||
LOG(logDEBUG, ("retval pattern io control:0x%llx\n",
|
||||
(long long int)pat->ioctrl));
|
||||
}
|
||||
#endif
|
||||
if (ret == OK) {
|
||||
// patlimits
|
||||
int numLoops = -1;
|
||||
int retval0 = -1;
|
||||
int retval1 = -1;
|
||||
setPatternLoop(-1, &retval0, &retval1, &numLoops);
|
||||
pat->limits[0] = retval0;
|
||||
pat->limits[1] = retval1;
|
||||
LOG(logDEBUG, ("retval pattern limits start:0x%x stop:0x%x\n",
|
||||
pat->limits[0], pat->limits[1]));
|
||||
|
||||
for (int i = 0; i <= 2; ++i) {
|
||||
// patloop
|
||||
{
|
||||
int numLoops = -1;
|
||||
int retval0 = -1;
|
||||
int retval1 = -1;
|
||||
setPatternLoop(i, &retval0, &retval1, &numLoops);
|
||||
pat->nloop[i] = numLoops;
|
||||
pat->loop[i * 2 + 0] = retval0;
|
||||
pat->loop[i * 2 + 1] = retval1;
|
||||
LOG(logDEBUG, ("retval pattern loop level %d start:0x%x "
|
||||
"stop:0x%x numLoops:%d\n",
|
||||
i, pat->loop[i * 2 + 0],
|
||||
pat->loop[i * 2 + 0], pat->nloop[i]));
|
||||
}
|
||||
// patwait
|
||||
{
|
||||
pat->wait[i] = setPatternWaitAddress(i, -1);
|
||||
if ((int)pat->wait[i] == -1) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"could not read pattern wait address for level "
|
||||
"%d\n",
|
||||
i);
|
||||
LOG(logERROR, (mess));
|
||||
break;
|
||||
}
|
||||
LOG(logDEBUG,
|
||||
("retval pattern wait address for level %d: 0x%x\n", i,
|
||||
pat->wait[i]));
|
||||
}
|
||||
|
||||
// patwaittime
|
||||
{
|
||||
pat->waittime[i] = setPatternWaitTime(i, -1);
|
||||
if ((int64_t)pat->waittime[i] == -1) {
|
||||
ret = FAIL;
|
||||
sprintf(
|
||||
mess,
|
||||
"could not read pattern wait time for level %d\n",
|
||||
i);
|
||||
LOG(logERROR, (mess));
|
||||
break;
|
||||
}
|
||||
LOG(logDEBUG,
|
||||
("retval pattern wait time for level %d: %lld\n", i,
|
||||
(long long int)pat->waittime[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ignoring endianness for eiger
|
||||
int ret =
|
||||
Server_SendResult(file_des, INT32, pat, sizeof(patternParameters));
|
||||
if (pat != NULL)
|
||||
free(pat);
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
int get_scan(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
@ -8205,3 +8333,53 @@ int is_virtual(int file_des) {
|
||||
LOG(logDEBUG1, ("is virtual retval: %d\n", retval));
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int load_default_pattern(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
|
||||
#if !defined(MYTHEN3D) && !defined(MOENCHD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
if (Server_VerifyLock() == OK) {
|
||||
ret = loadDefaultPattern(DEFAULT_PATTERN_FILE, mess);
|
||||
if (ret == FAIL) {
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
}
|
||||
|
||||
int get_all_threshold_energy(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int retvals[3] = {-1, -1, -1};
|
||||
|
||||
LOG(logDEBUG1, ("Getting all threshold energy\n"));
|
||||
|
||||
#ifndef MYTHEN3D
|
||||
functionNotImplemented();
|
||||
#else
|
||||
for (int i = 0; i < NCOUNTERS; ++i) {
|
||||
retvals[i] = getThresholdEnergy(i);
|
||||
LOG(logDEBUG, ("eV[%d]: %deV\n", i, retvals[i]));
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, retvals, sizeof(retvals));
|
||||
}
|
||||
|
||||
int get_master(int file_des){
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int retval = -1;
|
||||
|
||||
LOG(logDEBUG1, ("Getting master\n"));
|
||||
|
||||
#ifndef MYTHEN3D
|
||||
functionNotImplemented();
|
||||
#else
|
||||
retval = isMaster();
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
|
Reference in New Issue
Block a user