mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
Merge branch 'developer' into jf_h5reader
This commit is contained in:
commit
543b311c06
@ -22,6 +22,8 @@ Common
|
|||||||
* Check transeiver and fibers are compatible (all MMF 850nm or all SMF 1030nm)
|
* Check transeiver and fibers are compatible (all MMF 850nm or all SMF 1030nm)
|
||||||
* Check fiber
|
* Check fiber
|
||||||
* Check fiber polarity (if short range, unplug the link anywhere, and look at the light/dark pattern: dark has to mate with light)
|
* Check fiber polarity (if short range, unplug the link anywhere, and look at the light/dark pattern: dark has to mate with light)
|
||||||
|
* For Jungfrau, check if the blue sfp light is blinking rapidly (even when it is not sending data). If so, most likely the link is down and something is wrong with the board. If it connected to a switch, then you do not see it with the ethtool command if link is down. One option is to connect it directly to a pc to see if link is down.
|
||||||
|
* With nc, try "nc -u -p 50001 -l" in receiving pc, and from another pc try "echo hallo | nc -u 10.1.2.172 50001" to send something to the recieving pc interface to see if the link is up and see if the other nc console receives the hallo.
|
||||||
|
|
||||||
#. Detector is not acquiring (Not Eiger)
|
#. Detector is not acquiring (Not Eiger)
|
||||||
* Take an acquisition with many images and using the following steps instead of acquire:
|
* Take an acquisition with many images and using the following steps instead of acquire:
|
||||||
@ -47,11 +49,20 @@ Common
|
|||||||
* Ensure that the interfaces (on NIC and the switch) used in receiver pc have MTU 9000 (jumbo frames) enabled.
|
* Ensure that the interfaces (on NIC and the switch) used in receiver pc have MTU 9000 (jumbo frames) enabled.
|
||||||
|
|
||||||
|
|
||||||
#. Check if 'rx_frames' counter in 'ifconfig' do not increment for interface.
|
#. Check if 'rx packets' counter in 'ifconfig' do not increment for interface.
|
||||||
* If no, check switch configuration if present. Port counters of switch can also help to identify problem.
|
* If no, check switch configuration if present. Port counters of switch can also help to identify problem.
|
||||||
* If yes, but receiver software does not see it:
|
* If yes, but receiver software does not see it:
|
||||||
|
|
||||||
* Check no firewall (eg. firewalld) is present or add rules
|
* Check no firewall (eg. firewalld) is present or add rules
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# Stop and disable firewall
|
||||||
|
service firewalld stop
|
||||||
|
systemctl disable firewalld
|
||||||
|
# Check status
|
||||||
|
service firewalld status
|
||||||
|
|
||||||
* Check that selinux is disabled ( or add rules)
|
* Check that selinux is disabled ( or add rules)
|
||||||
|
|
||||||
#. Source UDP IP in config file (Not Eiger)
|
#. Source UDP IP in config file (Not Eiger)
|
||||||
|
@ -183,8 +183,8 @@ int main(int argc, char *argv[]) {
|
|||||||
gainfname = args["gainfile"];
|
gainfname = args["gainfile"];
|
||||||
etafname = args["etafilefile"];
|
etafname = args["etafilefile"];
|
||||||
|
|
||||||
if (atoi(args["nuninterfaces"].c_str())>1){
|
if (atoi(args["numinterfaces"].c_str())>1){
|
||||||
cprintf(RED, "Sorry, at the moment only a single interface is supported instead of %d\n",atoi(args["nuninterfaces"].c_str()));
|
cprintf(RED, "Sorry, at the moment only a single interface is supported instead of %d\n",atoi(args["numinterfaces"].c_str()));
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,54 +272,34 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
sls::ZmqSocket *zmqsocket = NULL;
|
sls::ZmqSocket *zmqsocket = NULL;
|
||||||
|
|
||||||
#ifdef NEWZMQ
|
|
||||||
// receive socket
|
// receive socket
|
||||||
try {
|
try {
|
||||||
#endif
|
|
||||||
|
|
||||||
zmqsocket = new sls::ZmqSocket(socketip.c_str(), portnum);
|
zmqsocket = new sls::ZmqSocket(socketip.c_str(), portnum);
|
||||||
|
|
||||||
#ifdef NEWZMQ
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
cprintf(RED,
|
cprintf(RED,
|
||||||
"Error: Could not create Zmq socket on port %d with ip %s\n",
|
"Error: Could not create Zmq receiving socket on port %d with ip %s\n",
|
||||||
portnum, socketip.c_str());
|
portnum, socketip.c_str());
|
||||||
delete zmqsocket;
|
delete zmqsocket;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NEWZMQ
|
|
||||||
if (zmqsocket->IsError()) {
|
|
||||||
cprintf(RED,
|
|
||||||
"Error: Could not create Zmq socket on port %d with ip %s\n",
|
|
||||||
portnum, socketip.c_str());
|
|
||||||
delete zmqsocket;
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (zmqsocket->Connect()) {
|
if (zmqsocket->Connect()) {
|
||||||
cprintf(RED, "Error: Could not connect to socket %s\n",
|
cprintf(RED, "Error: Could not connect to Zmq receiving socket %s\n",
|
||||||
(zmqsocket->GetZmqServerAddress()).c_str());
|
(zmqsocket->GetZmqServerAddress()).c_str());
|
||||||
delete zmqsocket;
|
delete zmqsocket;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
} else
|
} else
|
||||||
printf("Zmq Client at %s\n", zmqsocket->GetZmqServerAddress().c_str());
|
printf("Zmq receiving socket at %s\n", zmqsocket->GetZmqServerAddress().c_str());
|
||||||
|
|
||||||
// send socket
|
// send socket
|
||||||
sls::ZmqSocket *zmqsocket2 = 0;
|
sls::ZmqSocket *zmqsocket2 = 0;
|
||||||
// cout << "zmq2 " << endl;
|
// cout << "zmq2 " << endl;
|
||||||
if (send) {
|
if (send) {
|
||||||
#ifdef NEWZMQ
|
|
||||||
// receive socket
|
// receive socket
|
||||||
try {
|
try {
|
||||||
#endif
|
zmqsocket2 = new sls::ZmqSocket(portnum2, socketip2.c_str());
|
||||||
zmqsocket2 = new sls::ZmqSocket(portnum2, socketip2.c_str());
|
|
||||||
|
|
||||||
#ifdef NEWZMQ
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
cprintf(RED,
|
cprintf(RED,
|
||||||
"Error: Could not create Zmq socket server on port %d and "
|
"Error: Could not create Zmq sending socket on port %d and "
|
||||||
"ip %s\n",
|
"ip %s\n",
|
||||||
portnum2, socketip2.c_str());
|
portnum2, socketip2.c_str());
|
||||||
// delete zmqsocket2;
|
// delete zmqsocket2;
|
||||||
@ -328,28 +308,7 @@ int main(int argc, char *argv[]) {
|
|||||||
// return EXIT_FAILURE;
|
// return EXIT_FAILURE;
|
||||||
send = false;
|
send = false;
|
||||||
}
|
}
|
||||||
#endif
|
printf("Zmq sending socket at %s\n",
|
||||||
|
|
||||||
#ifndef NEWZMQ
|
|
||||||
if (zmqsocket2->IsError()) {
|
|
||||||
cprintf(RED,
|
|
||||||
"AAA Error: Could not create Zmq socket server on port %d "
|
|
||||||
"and ip %s\n",
|
|
||||||
portnum2, socketip2.c_str());
|
|
||||||
// delete zmqsocket2;
|
|
||||||
// delete zmqsocket;
|
|
||||||
// return EXIT_FAILURE;
|
|
||||||
send = false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (zmqsocket2->Connect()) {
|
|
||||||
cprintf(RED, "BBB Error: Could not connect to socket %s\n",
|
|
||||||
zmqsocket2->GetZmqServerAddress().c_str());
|
|
||||||
// delete zmqsocket2;
|
|
||||||
send = false;
|
|
||||||
// return EXIT_FAILURE;
|
|
||||||
} else
|
|
||||||
printf("Zmq Client at %s\n",
|
|
||||||
zmqsocket2->GetZmqServerAddress().c_str());
|
zmqsocket2->GetZmqServerAddress().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -839,8 +839,8 @@ void qTabMeasurement::UpdateProgress() {
|
|||||||
int qTabMeasurement::VerifyOutputDirectoryError() {
|
int qTabMeasurement::VerifyOutputDirectoryError() {
|
||||||
try {
|
try {
|
||||||
auto retval = det->getFilePath();
|
auto retval = det->getFilePath();
|
||||||
for (auto &it : retval) {
|
for (size_t i = 0; i < retval.size(); i++) {
|
||||||
det->setFilePath(it);
|
det->setFilePath(retval[i], {i});
|
||||||
}
|
}
|
||||||
return slsDetectorDefs::OK;
|
return slsDetectorDefs::OK;
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -626,8 +626,8 @@ int Feb_Control_SetTrimbits(unsigned int *trimbits, int top) {
|
|||||||
<< ((7 - i) * 4); // upper
|
<< ((7 - i) * 4); // upper
|
||||||
}
|
}
|
||||||
} // end column loop i
|
} // end column loop i
|
||||||
} // end supercolumn loop sc
|
} // end supercolumn loop sc
|
||||||
} // end row loop
|
} // end row loop
|
||||||
|
|
||||||
if (Feb_Control_activated) {
|
if (Feb_Control_activated) {
|
||||||
if (!Feb_Interface_WriteMemoryInLoops(Feb_Control_leftAddress,
|
if (!Feb_Interface_WriteMemoryInLoops(Feb_Control_leftAddress,
|
||||||
@ -644,7 +644,7 @@ int Feb_Control_SetTrimbits(unsigned int *trimbits, int top) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // end row_set loop (groups of 16 rows)
|
} // end row_set loop (groups of 16 rows)
|
||||||
} // end l_r loop
|
} // end l_r loop
|
||||||
|
|
||||||
memcpy(Feb_Control_last_downloaded_trimbits, trimbits,
|
memcpy(Feb_Control_last_downloaded_trimbits, trimbits,
|
||||||
Feb_Control_trimbit_size * sizeof(unsigned int));
|
Feb_Control_trimbit_size * sizeof(unsigned int));
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -473,8 +473,8 @@ void setupDetector() {
|
|||||||
// hv
|
// hv
|
||||||
DAC6571_SetDefines(HV_HARD_MAX_VOLTAGE, HV_DRIVER_FILE_NAME);
|
DAC6571_SetDefines(HV_HARD_MAX_VOLTAGE, HV_DRIVER_FILE_NAME);
|
||||||
// dacs
|
// dacs
|
||||||
LTC2620_D_SetDefines(DAC_MIN_MV, DAC_MAX_MV, DAC_DRIVER_FILE_NAME, NDAC, 1,
|
LTC2620_D_SetDefines(DAC_MIN_MV, DAC_MAX_MV, DAC_DRIVER_FILE_NAME, NDAC, 0,
|
||||||
0, "");
|
"");
|
||||||
// on chip dacs
|
// on chip dacs
|
||||||
ASIC_Driver_SetDefines(ONCHIP_DAC_DRIVER_FILE_NAME);
|
ASIC_Driver_SetDefines(ONCHIP_DAC_DRIVER_FILE_NAME);
|
||||||
setTimingSource(DEFAULT_TIMING_SOURCE);
|
setTimingSource(DEFAULT_TIMING_SOURCE);
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -489,6 +489,7 @@ void setupDetector() {
|
|||||||
AD9257_SetDefines(ADC_SPI_REG, ADC_SPI_SRL_CS_OTPT_MSK,
|
AD9257_SetDefines(ADC_SPI_REG, ADC_SPI_SRL_CS_OTPT_MSK,
|
||||||
ADC_SPI_SRL_CLK_OTPT_MSK, ADC_SPI_SRL_DT_OTPT_MSK,
|
ADC_SPI_SRL_CLK_OTPT_MSK, ADC_SPI_SRL_DT_OTPT_MSK,
|
||||||
ADC_SPI_SRL_DT_OTPT_OFST);
|
ADC_SPI_SRL_DT_OTPT_OFST);
|
||||||
|
AD9257_Set_Jungfrau_Hardware_Version_1_0(isHardwareVersion_1_0());
|
||||||
AD9257_Disable();
|
AD9257_Disable();
|
||||||
AD9257_Configure();
|
AD9257_Configure();
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -486,8 +486,8 @@ void setupDetector() {
|
|||||||
// hv
|
// hv
|
||||||
DAC6571_SetDefines(HV_HARD_MAX_VOLTAGE, HV_DRIVER_FILE_NAME);
|
DAC6571_SetDefines(HV_HARD_MAX_VOLTAGE, HV_DRIVER_FILE_NAME);
|
||||||
// dac
|
// dac
|
||||||
LTC2620_D_SetDefines(DAC_MIN_MV, DAC_MAX_MV, DAC_DRIVER_FILE_NAME, NDAC, 1,
|
LTC2620_D_SetDefines(DAC_MIN_MV, DAC_MAX_MV, DAC_DRIVER_FILE_NAME, NDAC, 0,
|
||||||
0, "");
|
"");
|
||||||
|
|
||||||
resetCore();
|
resetCore();
|
||||||
resetPeripheral();
|
resetPeripheral();
|
||||||
|
@ -4,6 +4,10 @@
|
|||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#ifdef JUNGFRAUD
|
||||||
|
void AD9257_Set_Jungfrau_Hardware_Version_1_0(int val);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Defines
|
* Set Defines
|
||||||
* @param reg spi register
|
* @param reg spi register
|
||||||
|
@ -5,10 +5,12 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
void LTC2620_D_SetDefines(int hardMinV, int hardMaxV, char *driverfname,
|
void LTC2620_D_SetDefines(int hardMinV, int hardMaxV, char *driverfname,
|
||||||
int numdacs, int numdevices, int startingDeviceIndex,
|
int numdacs, int numpowers,
|
||||||
char *powerdownDriverfname);
|
char *powerdownDriverfname);
|
||||||
int LTC2620_D_GetMaxNumSteps();
|
int LTC2620_D_GetMaxNumSteps();
|
||||||
int LTC2620_D_GetPowerDownValue();
|
int LTC2620_D_GetPowerDownValue();
|
||||||
|
int LTC2620_D_GetMinInput();
|
||||||
|
int LTC2620_D_GetMaxInput();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert voltage to dac units
|
* Convert voltage to dac units
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
int resetFPGA(char *mess);
|
int resetFPGA(char *mess);
|
||||||
int loadDeviceTree(char *mess, int *adcDeviceIndex, int *dacDeviceIndex);
|
int loadDeviceTree(char *mess);
|
||||||
|
|
||||||
int checksBeforeCreatingDeviceTree(char *mess);
|
int checksBeforeCreatingDeviceTree(char *mess);
|
||||||
int createDeviceTree(char *mess);
|
int createDeviceTree(char *mess);
|
||||||
int verifyDeviceTree(char *mess, int *adcDeviceIndex, int *dacDeviceIndex);
|
int verifyDeviceTree(char *mess);
|
@ -184,7 +184,7 @@ uint32_t readRegister16And32(uint32_t offset);
|
|||||||
#if defined(XILINX_CHIPTESTBOARDD)
|
#if defined(XILINX_CHIPTESTBOARDD)
|
||||||
void cleanFifos();
|
void cleanFifos();
|
||||||
void resetFlow();
|
void resetFlow();
|
||||||
int waitTranseiverReset(char *mess);
|
int waitTransceiverReset(char *mess);
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
void setTransceiverAlignment(int align);
|
void setTransceiverAlignment(int align);
|
||||||
#endif
|
#endif
|
||||||
@ -424,6 +424,8 @@ int getPower();
|
|||||||
void setPower(enum DACINDEX ind, int val);
|
void setPower(enum DACINDEX ind, int val);
|
||||||
void powerOff();
|
void powerOff();
|
||||||
#elif XILINX_CHIPTESTBOARDD
|
#elif XILINX_CHIPTESTBOARDD
|
||||||
|
int isPowerValid(enum DACINDEX ind, int val);
|
||||||
|
|
||||||
int getPower();
|
int getPower();
|
||||||
void setPower(enum DACINDEX ind, int val);
|
void setPower(enum DACINDEX ind, int val);
|
||||||
#endif
|
#endif
|
||||||
|
@ -172,6 +172,14 @@ uint32_t AD9257_DigMask = 0x0;
|
|||||||
int AD9257_DigOffset = 0x0;
|
int AD9257_DigOffset = 0x0;
|
||||||
int AD9257_VrefVoltage = 0;
|
int AD9257_VrefVoltage = 0;
|
||||||
|
|
||||||
|
#ifdef JUNGFRAUD
|
||||||
|
int AD9257_is_Jungfrau_Hardware_Version_1_0 = 0;
|
||||||
|
|
||||||
|
void AD9257_Set_Jungfrau_Hardware_Version_1_0(int val) {
|
||||||
|
AD9257_is_Jungfrau_Hardware_Version_1_0 = val;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void AD9257_SetDefines(uint32_t reg, uint32_t cmsk, uint32_t clkmsk,
|
void AD9257_SetDefines(uint32_t reg, uint32_t cmsk, uint32_t clkmsk,
|
||||||
uint32_t dmsk, int dofst) {
|
uint32_t dmsk, int dofst) {
|
||||||
AD9257_Reg = reg;
|
AD9257_Reg = reg;
|
||||||
@ -286,8 +294,18 @@ void AD9257_Configure() {
|
|||||||
AD9257_OUT_BINARY_OFST_VAL | AD9257_OUT_LVDS_IEEE_VAL);
|
AD9257_OUT_BINARY_OFST_VAL | AD9257_OUT_LVDS_IEEE_VAL);
|
||||||
|
|
||||||
// output clock phase
|
// output clock phase
|
||||||
|
#ifdef JUNGFRAUD
|
||||||
|
if (AD9257_is_Jungfrau_Hardware_Version_1_0) {
|
||||||
|
LOG(logINFO, ("\tOutput clock phase: 120\n"));
|
||||||
|
AD9257_Set(AD9257_OUT_PHASE_REG, AD9257_OUT_CLK_120_VAL);
|
||||||
|
} else {
|
||||||
|
LOG(logINFO, ("\tOutput clock phase: 180\n"));
|
||||||
|
AD9257_Set(AD9257_OUT_PHASE_REG, AD9257_OUT_CLK_180_VAL);
|
||||||
|
}
|
||||||
|
#else
|
||||||
LOG(logINFO, ("\tOutput clock phase: 180\n"));
|
LOG(logINFO, ("\tOutput clock phase: 180\n"));
|
||||||
AD9257_Set(AD9257_OUT_PHASE_REG, AD9257_OUT_CLK_180_VAL);
|
AD9257_Set(AD9257_OUT_PHASE_REG, AD9257_OUT_CLK_180_VAL);
|
||||||
|
#endif
|
||||||
|
|
||||||
// all devices on chip to receive next command
|
// all devices on chip to receive next command
|
||||||
LOG(logINFO, ("\tAll devices on chip to receive next command\n"));
|
LOG(logINFO, ("\tAll devices on chip to receive next command\n"));
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
/* LTC2620 DAC DEFINES */
|
/* LTC2620 DAC DEFINES */
|
||||||
#define LTC2620_D_PWR_DOWN_VAL (-100)
|
#define LTC2620_D_PWR_DOWN_VAL (-100)
|
||||||
|
#define LTC2620_D_MIN_DAC_VAL (0)
|
||||||
#define LTC2620_D_MAX_DAC_VAL (4095) // 12 bits
|
#define LTC2620_D_MAX_DAC_VAL (4095) // 12 bits
|
||||||
#define LTC2620_D_MAX_STEPS (LTC2620_D_MAX_DAC_VAL + 1)
|
#define LTC2620_D_MAX_STEPS (LTC2620_D_MAX_DAC_VAL + 1)
|
||||||
|
|
||||||
@ -18,17 +19,15 @@ int LTC2620_D_HardMaxVoltage = 0;
|
|||||||
char LTC2620_D_DriverFileName[MAX_STR_LENGTH];
|
char LTC2620_D_DriverFileName[MAX_STR_LENGTH];
|
||||||
char LTC2620_D_PowerDownDriverFileName[MAX_STR_LENGTH];
|
char LTC2620_D_PowerDownDriverFileName[MAX_STR_LENGTH];
|
||||||
int LTC2620_D_NumDacs = 0;
|
int LTC2620_D_NumDacs = 0;
|
||||||
int LTC2620_D_NumDevices = 0;
|
int LTC2620_D_NumDacsOnly = 0;
|
||||||
int LTC2620_D_NumChannelsPerDevice = 0;
|
|
||||||
int LTC2620_D_DacDriverStartingDeviceIndex = 0;
|
|
||||||
|
|
||||||
void LTC2620_D_SetDefines(int hardMinV, int hardMaxV, char *driverfname,
|
void LTC2620_D_SetDefines(int hardMinV, int hardMaxV, char *driverfname,
|
||||||
int numdacs, int numdevices, int startingDeviceIndex,
|
int numdacs, int numpowers,
|
||||||
char *powerdownDriverfname) {
|
char *powerdownDriverfname) {
|
||||||
LOG(logINFOBLUE,
|
LOG(logINFOBLUE,
|
||||||
("Configuring DACs (LTC2620) to %s\n\t (numdacs:%d, hard min:%d, hard "
|
("Configuring DACs (LTC2620) to %s\n\t (numdacs:%d, hard min:%d, hard "
|
||||||
"max: %dmV, idev:%d)\n",
|
"max: %dmV)\n",
|
||||||
driverfname, numdacs, hardMinV, hardMaxV, startingDeviceIndex));
|
driverfname, numdacs, hardMinV, hardMaxV));
|
||||||
LTC2620_D_HardMinVoltage = hardMinV;
|
LTC2620_D_HardMinVoltage = hardMinV;
|
||||||
LTC2620_D_HardMaxVoltage = hardMaxV;
|
LTC2620_D_HardMaxVoltage = hardMaxV;
|
||||||
memset(LTC2620_D_DriverFileName, 0, MAX_STR_LENGTH);
|
memset(LTC2620_D_DriverFileName, 0, MAX_STR_LENGTH);
|
||||||
@ -36,15 +35,17 @@ void LTC2620_D_SetDefines(int hardMinV, int hardMaxV, char *driverfname,
|
|||||||
memset(LTC2620_D_PowerDownDriverFileName, 0, MAX_STR_LENGTH);
|
memset(LTC2620_D_PowerDownDriverFileName, 0, MAX_STR_LENGTH);
|
||||||
strcpy(LTC2620_D_PowerDownDriverFileName, powerdownDriverfname);
|
strcpy(LTC2620_D_PowerDownDriverFileName, powerdownDriverfname);
|
||||||
LTC2620_D_NumDacs = numdacs;
|
LTC2620_D_NumDacs = numdacs;
|
||||||
LTC2620_D_NumDevices = numdevices;
|
LTC2620_D_NumDacsOnly = numdacs - numpowers;
|
||||||
LTC2620_D_NumChannelsPerDevice = LTC2620_D_NumDacs / LTC2620_D_NumDevices;
|
|
||||||
LTC2620_D_DacDriverStartingDeviceIndex = startingDeviceIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int LTC2620_D_GetMaxNumSteps() { return LTC2620_D_MAX_STEPS; }
|
int LTC2620_D_GetMaxNumSteps() { return LTC2620_D_MAX_STEPS; }
|
||||||
|
|
||||||
int LTC2620_D_GetPowerDownValue() { return LTC2620_D_PWR_DOWN_VAL; }
|
int LTC2620_D_GetPowerDownValue() { return LTC2620_D_PWR_DOWN_VAL; }
|
||||||
|
|
||||||
|
int LTC2620_D_GetMinInput() { return LTC2620_D_MIN_DAC_VAL; }
|
||||||
|
|
||||||
|
int LTC2620_D_GetMaxInput() { return LTC2620_D_MAX_DAC_VAL; }
|
||||||
|
|
||||||
int LTC2620_D_VoltageToDac(int voltage, int *dacval) {
|
int LTC2620_D_VoltageToDac(int voltage, int *dacval) {
|
||||||
return ConvertToDifferentRange(LTC2620_D_HardMinVoltage,
|
return ConvertToDifferentRange(LTC2620_D_HardMinVoltage,
|
||||||
LTC2620_D_HardMaxVoltage, 0,
|
LTC2620_D_HardMaxVoltage, 0,
|
||||||
@ -94,7 +95,10 @@ int LTC2620_D_SetDACValue(int dacnum, int val, int mV, char *dacname,
|
|||||||
int dacmV = val;
|
int dacmV = val;
|
||||||
if (mV) {
|
if (mV) {
|
||||||
ret = LTC2620_D_VoltageToDac(val, dacval);
|
ret = LTC2620_D_VoltageToDac(val, dacval);
|
||||||
} else if (val >= 0) {
|
}
|
||||||
|
|
||||||
|
// mV only for print out (dont convert to mV for power regulators)
|
||||||
|
else if (val >= 0 && dacnum < LTC2620_D_NumDacsOnly) {
|
||||||
// do not convert power down dac val
|
// do not convert power down dac val
|
||||||
ret = LTC2620_D_DacToVoltage(val, &dacmV);
|
ret = LTC2620_D_DacToVoltage(val, &dacmV);
|
||||||
}
|
}
|
||||||
@ -109,8 +113,16 @@ int LTC2620_D_SetDACValue(int dacnum, int val, int mV, char *dacname,
|
|||||||
// print and set
|
// print and set
|
||||||
#ifdef XILINX_CHIPTESTBOARDD
|
#ifdef XILINX_CHIPTESTBOARDD
|
||||||
if (*dacval >= 0) {
|
if (*dacval >= 0) {
|
||||||
LOG(logINFO, ("Setting DAC %2d [%-6s] : %d dac (%d mV)\n", dacnum,
|
// also print mV
|
||||||
dacname, *dacval, dacmV));
|
if (dacnum < LTC2620_D_NumDacsOnly) {
|
||||||
|
LOG(logINFO, ("Setting DAC %2d [%-6s] : %d dac (%d mV)\n",
|
||||||
|
dacnum, dacname, *dacval, dacmV));
|
||||||
|
}
|
||||||
|
// do not print mV for power regulators
|
||||||
|
else {
|
||||||
|
LOG(logINFO, ("Setting Power DAC%2d [%-6s] : %d dac \n", dacnum,
|
||||||
|
dacname, *dacval));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if ((*dacval >= 0) || (*dacval == LTC2620_D_PWR_DOWN_VAL)) {
|
if ((*dacval >= 0) || (*dacval == LTC2620_D_PWR_DOWN_VAL)) {
|
||||||
@ -125,10 +137,7 @@ int LTC2620_D_SetDACValue(int dacnum, int val, int mV, char *dacname,
|
|||||||
char fname[MAX_STR_LENGTH];
|
char fname[MAX_STR_LENGTH];
|
||||||
memset(fname, 0, MAX_STR_LENGTH);
|
memset(fname, 0, MAX_STR_LENGTH);
|
||||||
#ifdef XILINX_CHIPTESTBOARDD
|
#ifdef XILINX_CHIPTESTBOARDD
|
||||||
int idev = LTC2620_D_DacDriverStartingDeviceIndex +
|
sprintf(fname, fnameFormat, dacnum);
|
||||||
(dacnum / LTC2620_D_NumChannelsPerDevice);
|
|
||||||
int idac = dacnum % LTC2620_D_NumChannelsPerDevice;
|
|
||||||
sprintf(fname, fnameFormat, idev, idac);
|
|
||||||
#else
|
#else
|
||||||
sprintf(fname, "%s%d", fnameFormat, dacnum);
|
sprintf(fname, "%s%d", fnameFormat, dacnum);
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,11 +11,11 @@
|
|||||||
#include <sys/mman.h> // mmap
|
#include <sys/mman.h> // mmap
|
||||||
|
|
||||||
/* global variables */
|
/* global variables */
|
||||||
#define CSP0 (0xB0080000)
|
#define CSP0 (0xB0080000)
|
||||||
#define CSP1 (0xB0050000) // udp
|
#define CSP1 (0xB0050000) // udp
|
||||||
#define MEM_SIZE (0x10000)
|
#define MEM_SIZE_CSP0 (0x10000)
|
||||||
//#define MEM_SIZE_CSP0 (4096)
|
#define MEM_SIZE_CSP1 (0x2000) // smaller size for udp
|
||||||
//#define MEM_SIZE_CSP1 (2 * 4096)
|
|
||||||
u_int32_t *csp0base = 0;
|
u_int32_t *csp0base = 0;
|
||||||
u_int32_t *csp1base = 0;
|
u_int32_t *csp1base = 0;
|
||||||
|
|
||||||
@ -52,6 +52,7 @@ u_int32_t writeRegister(u_int32_t offset, u_int32_t data) {
|
|||||||
int mapCSP0(void) {
|
int mapCSP0(void) {
|
||||||
u_int32_t csps[2] = {CSP0, CSP1};
|
u_int32_t csps[2] = {CSP0, CSP1};
|
||||||
u_int32_t **cspbases[2] = {&csp0base, &csp1base};
|
u_int32_t **cspbases[2] = {&csp0base, &csp1base};
|
||||||
|
u_int32_t memsize[2] = {MEM_SIZE_CSP0, MEM_SIZE_CSP1};
|
||||||
char names[2][10] = {"csp0base", "csp1base"};
|
char names[2][10] = {"csp0base", "csp1base"};
|
||||||
|
|
||||||
for (int i = 0; i < 2; ++i) {
|
for (int i = 0; i < 2; ++i) {
|
||||||
@ -59,10 +60,11 @@ int mapCSP0(void) {
|
|||||||
if (*cspbases[i] == 0) {
|
if (*cspbases[i] == 0) {
|
||||||
LOG(logINFO, ("Mapping memory for %s\n", names[i]));
|
LOG(logINFO, ("Mapping memory for %s\n", names[i]));
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
*cspbases[i] = malloc(MEM_SIZE);
|
*cspbases[i] = malloc(memsize[i]);
|
||||||
if (*cspbases[i] == NULL) {
|
if (*cspbases[i] == NULL) {
|
||||||
LOG(logERROR,
|
LOG(logERROR,
|
||||||
("Could not allocate virtual memory for %s.\n", names[i]));
|
("Could not allocate virtual memory of size %d for %s.\n",
|
||||||
|
memsize[i], names[i]));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("memory allocated for %s\n", names[i]));
|
LOG(logINFO, ("memory allocated for %s\n", names[i]));
|
||||||
@ -75,15 +77,16 @@ int mapCSP0(void) {
|
|||||||
LOG(logDEBUG1,
|
LOG(logDEBUG1,
|
||||||
("/dev/mem opened for %s, (CSP:0x%x)\n", names[i], csps[i]));
|
("/dev/mem opened for %s, (CSP:0x%x)\n", names[i], csps[i]));
|
||||||
*cspbases[i] =
|
*cspbases[i] =
|
||||||
(u_int32_t *)mmap(0, MEM_SIZE, PROT_READ | PROT_WRITE,
|
(u_int32_t *)mmap(0, memsize[i], PROT_READ | PROT_WRITE,
|
||||||
MAP_FILE | MAP_SHARED, fd, csps[i]);
|
MAP_FILE | MAP_SHARED, fd, csps[i]);
|
||||||
if (*cspbases[i] == MAP_FAILED) {
|
if (*cspbases[i] == MAP_FAILED) {
|
||||||
LOG(logERROR, ("Can't map memmory area for %s\n", names[i]));
|
LOG(logERROR, ("Can't map memmory area for %s\n", names[i]));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
LOG(logINFO, ("%s mapped from %p to %p,(CSP:0x%x) \n", names[i],
|
LOG(logINFO,
|
||||||
*cspbases[i], *cspbases[i] + MEM_SIZE, csps[i]));
|
("%s mapped of size %d from %p to %p,(CSP:0x%x) \n", names[i],
|
||||||
|
memsize[i], *cspbases[i], *cspbases[i] + memsize[i], csps[i]));
|
||||||
// LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG)));
|
// LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG)));
|
||||||
} else
|
} else
|
||||||
LOG(logINFO, ("Memory %s already mapped before\n", names[i]));
|
LOG(logINFO, ("Memory %s already mapped before\n", names[i]));
|
||||||
|
@ -35,8 +35,8 @@ int resetFPGA(char *mess) {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int loadDeviceTree(char *mess, int *adcDeviceIndex, int *dacDeviceIndex) {
|
int loadDeviceTree(char *mess) {
|
||||||
if (verifyDeviceTree(mess, adcDeviceIndex, dacDeviceIndex) == OK)
|
if (verifyDeviceTree(mess) == OK)
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
if (checksBeforeCreatingDeviceTree(mess) == FAIL)
|
if (checksBeforeCreatingDeviceTree(mess) == FAIL)
|
||||||
@ -45,7 +45,7 @@ int loadDeviceTree(char *mess, int *adcDeviceIndex, int *dacDeviceIndex) {
|
|||||||
if (createDeviceTree(mess) == FAIL)
|
if (createDeviceTree(mess) == FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
|
||||||
if (verifyDeviceTree(mess, adcDeviceIndex, dacDeviceIndex) == FAIL) {
|
if (verifyDeviceTree(mess) == FAIL) {
|
||||||
LOG(logERROR, ("Device tree loading failed at verification\n"));
|
LOG(logERROR, ("Device tree loading failed at verification\n"));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -129,10 +129,8 @@ int createDeviceTree(char *mess) {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int verifyDeviceTree(char *mess, int *adcDeviceIndex, int *dacDeviceIndex) {
|
int verifyDeviceTree(char *mess) {
|
||||||
LOG(logINFOBLUE, ("Verifying Device Tree...\n"));
|
LOG(logINFOBLUE, ("Verifying Device Tree...\n"));
|
||||||
*adcDeviceIndex = 1;
|
|
||||||
*dacDeviceIndex = 2;
|
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
|
|
||||||
// check if iio:device0-4 exists in device tree destination
|
// check if iio:device0-4 exists in device tree destination
|
||||||
@ -170,8 +168,6 @@ int verifyDeviceTree(char *mess, int *adcDeviceIndex, int *dacDeviceIndex) {
|
|||||||
strstr(retvals, deviceNames[hardcodedDeviceIndex + 1]) !=
|
strstr(retvals, deviceNames[hardcodedDeviceIndex + 1]) !=
|
||||||
NULL) {
|
NULL) {
|
||||||
++hardcodedDeviceIndex;
|
++hardcodedDeviceIndex;
|
||||||
*adcDeviceIndex = 4;
|
|
||||||
*dacDeviceIndex = 1;
|
|
||||||
} else {
|
} else {
|
||||||
snprintf(
|
snprintf(
|
||||||
mess, MAX_STR_LENGTH,
|
mess, MAX_STR_LENGTH,
|
||||||
@ -188,9 +184,6 @@ int verifyDeviceTree(char *mess, int *adcDeviceIndex, int *dacDeviceIndex) {
|
|||||||
hardcodedDeviceIndex = 1;
|
hardcodedDeviceIndex = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
LOG(logINFOBLUE, ("Device tree verified successfully [temp: 0, adc:%d, "
|
LOG(logINFOBLUE, ("Device tree verified successfully\n"));
|
||||||
"dac:%d, %d, %d]\n",
|
|
||||||
*adcDeviceIndex, *dacDeviceIndex, *dacDeviceIndex + 1,
|
|
||||||
*dacDeviceIndex + 2));
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
@ -1297,7 +1297,7 @@ int validateAndSetDac(enum dacIndex ind, int val, int mV) {
|
|||||||
ind, getVLimit());
|
ind, getVLimit());
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
}
|
}
|
||||||
#ifdef CHIPTESTBOARDD
|
|
||||||
else if (!isPowerValid(serverDacIndex, val)) {
|
else if (!isPowerValid(serverDacIndex, val)) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(
|
sprintf(
|
||||||
@ -1306,10 +1306,14 @@ int validateAndSetDac(enum dacIndex ind, int val, int mV) {
|
|||||||
"should be between %d and %d mV\n",
|
"should be between %d and %d mV\n",
|
||||||
ind,
|
ind,
|
||||||
(serverDacIndex == D_PWR_IO ? VIO_MIN_MV : POWER_RGLTR_MIN),
|
(serverDacIndex == D_PWR_IO ? VIO_MIN_MV : POWER_RGLTR_MIN),
|
||||||
|
#ifdef CHIPTESTBOARDD
|
||||||
(VCHIP_MAX_MV - VCHIP_POWER_INCRMNT));
|
(VCHIP_MAX_MV - VCHIP_POWER_INCRMNT));
|
||||||
|
#else
|
||||||
|
POWER_RGLTR_MAX);
|
||||||
|
#endif
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
else {
|
else {
|
||||||
setPower(serverDacIndex, val);
|
setPower(serverDacIndex, val);
|
||||||
}
|
}
|
||||||
@ -2022,105 +2026,101 @@ int acquire(int blocking, int file_des) {
|
|||||||
#if defined(JUNGFRAUD)
|
#if defined(JUNGFRAUD)
|
||||||
// chipv1.1 has to be configured before acquisition
|
// chipv1.1 has to be configured before acquisition
|
||||||
if (getChipVersion() == 11 && !isChipConfigured()) {
|
if (getChipVersion() == 11 && !isChipConfigured()) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess,
|
strcpy(mess, "Could not start acquisition. Chip is not configured. "
|
||||||
"Could not start acquisition. Chip is not configured. "
|
"Power it on to configure it.\n");
|
||||||
"Power it on to configure it.\n");
|
LOG(logERROR, (mess));
|
||||||
LOG(logERROR, (mess));
|
} else
|
||||||
} else
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
|
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
|
||||||
if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
|
if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
|
||||||
getReadoutMode() == ANALOG_ONLY) &&
|
getReadoutMode() == ANALOG_ONLY) &&
|
||||||
(getNumAnalogSamples() <= 0)) {
|
(getNumAnalogSamples() <= 0)) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
"Could not start acquisition. Invalid number of analog "
|
"Could not start acquisition. Invalid number of analog "
|
||||||
"samples: %d.\n",
|
"samples: %d.\n",
|
||||||
getNumAnalogSamples());
|
getNumAnalogSamples());
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
|
} else if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
|
||||||
getReadoutMode() == DIGITAL_ONLY ||
|
getReadoutMode() == DIGITAL_ONLY ||
|
||||||
getReadoutMode() == DIGITAL_AND_TRANSCEIVER) &&
|
getReadoutMode() == DIGITAL_AND_TRANSCEIVER) &&
|
||||||
(getNumDigitalSamples() <= 0)) {
|
(getNumDigitalSamples() <= 0)) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(
|
sprintf(mess,
|
||||||
mess,
|
|
||||||
"Could not start acquisition. Invalid number of digital "
|
"Could not start acquisition. Invalid number of digital "
|
||||||
"samples: %d.\n",
|
"samples: %d.\n",
|
||||||
getNumDigitalSamples());
|
getNumDigitalSamples());
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else if ((getReadoutMode() == TRANSCEIVER_ONLY ||
|
} else if ((getReadoutMode() == TRANSCEIVER_ONLY ||
|
||||||
getReadoutMode() == DIGITAL_AND_TRANSCEIVER) &&
|
getReadoutMode() == DIGITAL_AND_TRANSCEIVER) &&
|
||||||
(getNumTransceiverSamples() <= 0)) {
|
(getNumTransceiverSamples() <= 0)) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
"Could not start acquisition. Invalid number of "
|
"Could not start acquisition. Invalid number of "
|
||||||
"transceiver "
|
"transceiver "
|
||||||
"samples: %d.\n",
|
"samples: %d.\n",
|
||||||
getNumTransceiverSamples());
|
getNumTransceiverSamples());
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
// check for hardware mac and hardware ip
|
// check for hardware mac and hardware ip
|
||||||
if (udpDetails[0].srcmac != getDetectorMAC()) {
|
if (udpDetails[0].srcmac != getDetectorMAC()) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
uint64_t sourcemac = getDetectorMAC();
|
uint64_t sourcemac = getDetectorMAC();
|
||||||
char src_mac[MAC_ADDRESS_SIZE];
|
char src_mac[MAC_ADDRESS_SIZE];
|
||||||
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac);
|
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac);
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
"Invalid udp source mac address for this detector. "
|
"Invalid udp source mac address for this detector. "
|
||||||
"Must be "
|
"Must be "
|
||||||
"same as hardware detector mac address %s\n",
|
"same as hardware detector mac address %s\n",
|
||||||
src_mac);
|
src_mac);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else if (!enableTenGigabitEthernet(GET_FLAG) &&
|
} else if (!enableTenGigabitEthernet(GET_FLAG) &&
|
||||||
(udpDetails[0].srcip != getDetectorIP())) {
|
(udpDetails[0].srcip != getDetectorIP())) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
uint32_t sourceip = getDetectorIP();
|
uint32_t sourceip = getDetectorIP();
|
||||||
char src_ip[INET_ADDRSTRLEN];
|
char src_ip[INET_ADDRSTRLEN];
|
||||||
getIpAddressinString(src_ip, sourceip);
|
getIpAddressinString(src_ip, sourceip);
|
||||||
sprintf(
|
sprintf(mess,
|
||||||
mess,
|
"Invalid udp source ip address for this detector. Must "
|
||||||
"Invalid udp source ip address for this detector. Must "
|
"be "
|
||||||
"be "
|
"same as hardware detector ip address %s in 1G readout "
|
||||||
"same as hardware detector ip address %s in 1G readout "
|
"mode \n",
|
||||||
"mode \n",
|
src_ip);
|
||||||
src_ip);
|
LOG(logERROR, (mess));
|
||||||
LOG(logERROR, (mess));
|
} else
|
||||||
} else
|
|
||||||
#endif
|
#endif
|
||||||
if (configured == FAIL) {
|
if (configured == FAIL) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess, "Could not start acquisition because ");
|
strcpy(mess, "Could not start acquisition because ");
|
||||||
strcat(mess, configureMessage);
|
strcat(mess, configureMessage);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else if (sharedMemory_getScanStatus() == RUNNING) {
|
} else if (sharedMemory_getScanStatus() == RUNNING) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess,
|
strcpy(mess, "Could not start acquisition because a scan is "
|
||||||
"Could not start acquisition because a scan is "
|
"already running!\n");
|
||||||
"already running!\n");
|
LOG(logERROR, (mess));
|
||||||
LOG(logERROR, (mess));
|
} else {
|
||||||
} else {
|
memset(scanErrMessage, 0, MAX_STR_LENGTH);
|
||||||
memset(scanErrMessage, 0, MAX_STR_LENGTH);
|
sharedMemory_setScanStop(0);
|
||||||
sharedMemory_setScanStop(0);
|
sharedMemory_setScanStatus(IDLE); // if it was error
|
||||||
sharedMemory_setScanStatus(IDLE); // if it was error
|
if (pthread_create(&pthread_tid, NULL, &start_state_machine,
|
||||||
if (pthread_create(&pthread_tid, NULL, &start_state_machine,
|
&blocking)) {
|
||||||
&blocking)) {
|
ret = FAIL;
|
||||||
ret = FAIL;
|
strcpy(mess, "Could not start acquisition thread!\n");
|
||||||
strcpy(mess, "Could not start acquisition thread!\n");
|
LOG(logERROR, (mess));
|
||||||
LOG(logERROR, (mess));
|
} else {
|
||||||
} else {
|
// wait for blocking always (scan or not)
|
||||||
// wait for blocking always (scan or not)
|
// non blocking-no scan also wait (for error message)
|
||||||
// non blocking-no scan also wait (for error message)
|
// non blcoking-scan dont wait (there is
|
||||||
// non blcoking-scan dont wait (there is
|
// scanErrorMessage)
|
||||||
// scanErrorMessage)
|
if (blocking || !scan) {
|
||||||
if (blocking || !scan) {
|
pthread_join(pthread_tid, NULL);
|
||||||
pthread_join(pthread_tid, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,10 @@ SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(m
|
|||||||
OBJS = $(SRCS:.c=.o)
|
OBJS = $(SRCS:.c=.o)
|
||||||
|
|
||||||
all: clean $(PROGS)
|
all: clean $(PROGS)
|
||||||
|
|
||||||
|
local: CC := gcc
|
||||||
|
local: clean $(PROGS)
|
||||||
|
|
||||||
version: clean versioning $(PROGS)
|
version: clean versioning $(PROGS)
|
||||||
|
|
||||||
boot: $(OBJS)
|
boot: $(OBJS)
|
||||||
|
Binary file not shown.
@ -39,8 +39,6 @@ char initErrorMessage[MAX_STR_LENGTH];
|
|||||||
|
|
||||||
int detPos[2] = {0, 0};
|
int detPos[2] = {0, 0};
|
||||||
|
|
||||||
int adcDeviceIndex = 0;
|
|
||||||
int dacDeviceIndex = 0;
|
|
||||||
int chipConfigured = 0;
|
int chipConfigured = 0;
|
||||||
int analogEnable = 0;
|
int analogEnable = 0;
|
||||||
int digitalEnable = 0;
|
int digitalEnable = 0;
|
||||||
@ -75,8 +73,7 @@ void basictests() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
initError =
|
initError = loadDeviceTree(initErrorMessage);
|
||||||
loadDeviceTree(initErrorMessage, &adcDeviceIndex, &dacDeviceIndex);
|
|
||||||
if (initError == FAIL) {
|
if (initError == FAIL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -390,19 +387,18 @@ void setupDetector() {
|
|||||||
initializePatternWord();
|
initializePatternWord();
|
||||||
#endif
|
#endif
|
||||||
// initialization only at start up (restart fpga)
|
// initialization only at start up (restart fpga)
|
||||||
initError = waitTranseiverReset(initErrorMessage);
|
// initError = waitTransceiverReset(initErrorMessage);
|
||||||
if (initError == FAIL) {
|
// if (initError == FAIL) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
// power off chip
|
// // power off chip
|
||||||
initError = powerChip(0, initErrorMessage);
|
initError = powerChip(0, initErrorMessage);
|
||||||
if (initError == FAIL) {
|
// if (initError == FAIL) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
LTC2620_D_SetDefines(DAC_MAX_MV, DAC_MIN_MV, DAC_DRIVER_FILE_NAME, NDAC,
|
LTC2620_D_SetDefines(DAC_MIN_MV, DAC_MAX_MV, DAC_DRIVER_FILE_NAME, NDAC,
|
||||||
DAC_DRIVER_NUM_DEVICES, dacDeviceIndex,
|
NPWR, DAC_POWERDOWN_DRIVER_FILE_NAME);
|
||||||
DAC_POWERDOWN_DRIVER_FILE_NAME);
|
|
||||||
LOG(logINFOBLUE, ("Powering down all dacs\n"));
|
LOG(logINFOBLUE, ("Powering down all dacs\n"));
|
||||||
for (int idac = 0; idac < NDAC; ++idac) {
|
for (int idac = 0; idac < NDAC; ++idac) {
|
||||||
setDAC(idac, LTC2620_D_GetPowerDownValue(), 0);
|
setDAC(idac, LTC2620_D_GetPowerDownValue(), 0);
|
||||||
@ -458,7 +454,7 @@ void resetFlow() {
|
|||||||
bus_w(FLOW_CONTROL_REG, bus_r(FLOW_CONTROL_REG) & ~RST_F_MSK);
|
bus_w(FLOW_CONTROL_REG, bus_r(FLOW_CONTROL_REG) & ~RST_F_MSK);
|
||||||
}
|
}
|
||||||
|
|
||||||
int waitTranseiverReset(char *mess) {
|
int waitTransceiverReset(char *mess) {
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
int resetTransceiverDone = (bus_r(TRANSCEIVERSTATUS) & RESETRXDONE_MSK);
|
int resetTransceiverDone = (bus_r(TRANSCEIVERSTATUS) & RESETRXDONE_MSK);
|
||||||
int times = 0;
|
int times = 0;
|
||||||
@ -556,7 +552,7 @@ int powerChip(int on, char *mess) {
|
|||||||
POWER_VCC_C_MSK | POWER_VCC_D_MSK;
|
POWER_VCC_C_MSK | POWER_VCC_D_MSK;
|
||||||
if (on) {
|
if (on) {
|
||||||
LOG(logINFOBLUE, ("Powering chip: on\n"));
|
LOG(logINFOBLUE, ("Powering chip: on\n"));
|
||||||
bus_w(addr, bus_r(addr) & ~mask);
|
bus_w(addr, bus_r(addr) | mask);
|
||||||
|
|
||||||
if (configureChip(mess) == FAIL)
|
if (configureChip(mess) == FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -566,7 +562,7 @@ int powerChip(int on, char *mess) {
|
|||||||
chipConfigured = 1;
|
chipConfigured = 1;
|
||||||
} else {
|
} else {
|
||||||
LOG(logINFOBLUE, ("Powering chip: off\n"));
|
LOG(logINFOBLUE, ("Powering chip: off\n"));
|
||||||
bus_w(addr, bus_r(addr) | mask);
|
bus_w(addr, bus_r(addr) & ~mask);
|
||||||
|
|
||||||
chipConfigured = 0;
|
chipConfigured = 0;
|
||||||
|
|
||||||
@ -588,7 +584,7 @@ int getPowerChip() {
|
|||||||
uint32_t addr = CTRL_REG;
|
uint32_t addr = CTRL_REG;
|
||||||
uint32_t mask = POWER_VIO_MSK | POWER_VCC_A_MSK | POWER_VCC_B_MSK |
|
uint32_t mask = POWER_VIO_MSK | POWER_VCC_A_MSK | POWER_VCC_B_MSK |
|
||||||
POWER_VCC_C_MSK | POWER_VCC_D_MSK;
|
POWER_VCC_C_MSK | POWER_VCC_D_MSK;
|
||||||
return (((bus_r(addr) & mask) == mask) ? 0 : 1);
|
return (((bus_r(addr) & mask) == mask) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int configureChip(char *mess) {
|
int configureChip(char *mess) {
|
||||||
@ -981,21 +977,8 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
|||||||
LOG(logDEBUG1, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dacName, val,
|
LOG(logDEBUG1, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dacName, val,
|
||||||
(mV ? "mV" : "dac units")));
|
(mV ? "mV" : "dac units")));
|
||||||
int dacval = val;
|
int dacval = val;
|
||||||
|
|
||||||
#ifdef VIRTUAL
|
|
||||||
LOG(logINFO, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dacName, val,
|
|
||||||
(mV ? "mV" : "dac units")));
|
|
||||||
if (!mV) {
|
|
||||||
dacValues[ind] = val;
|
|
||||||
}
|
|
||||||
// convert to dac units
|
|
||||||
else if (LTC2620_D_VoltageToDac(val, &dacval) == OK) {
|
|
||||||
dacValues[ind] = dacval;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (LTC2620_D_SetDACValue((int)ind, val, mV, dacName, &dacval) == OK)
|
if (LTC2620_D_SetDACValue((int)ind, val, mV, dacName, &dacval) == OK)
|
||||||
dacValues[ind] = dacval;
|
dacValues[ind] = dacval;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int getDAC(enum DACINDEX ind, int mV) {
|
int getDAC(enum DACINDEX ind, int mV) {
|
||||||
@ -1045,74 +1028,91 @@ void setVLimit(int l) {
|
|||||||
vLimit = l;
|
vLimit = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getPower(enum DACINDEX ind) {
|
int isPowerValid(enum DACINDEX ind, int val) {
|
||||||
// check power enable first
|
char *powerNames[] = {PWR_NAMES};
|
||||||
uint32_t addr = CTRL_REG;
|
int pwrIndex = (int)(ind - D_PWR_D);
|
||||||
uint32_t offset = POWER_VCC_A_OFST + (int)(D_PWR_A - ind);
|
|
||||||
if (ind == D_PWR_IO)
|
int min = POWER_RGLTR_MIN;
|
||||||
offset = POWER_VIO_OFST;
|
if (!strcmp(powerNames[pwrIndex], "IO")) {
|
||||||
uint32_t mask = (1 << offset);
|
min = VIO_MIN_MV;
|
||||||
if ((bus_r(addr) & mask) != 0) {
|
}
|
||||||
LOG(logINFO, ("Power for dac %d is off\n", ind));
|
|
||||||
|
// not power_rgltr_max because it is allowed only upto vchip max - 200
|
||||||
|
if (val != 0 && (val != LTC2620_D_GetPowerDownValue()) &&
|
||||||
|
(val < min || val > POWER_RGLTR_MAX)) {
|
||||||
|
LOG(logERROR,
|
||||||
|
("Invalid value of %d mV for Power V%s. Is not between %d and "
|
||||||
|
"%d mV\n",
|
||||||
|
val, powerNames[pwrIndex], min, POWER_RGLTR_MAX));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getPower(enum DACINDEX ind) {
|
||||||
|
char *powerNames[] = {PWR_NAMES};
|
||||||
|
int pwrIndex = (int)(ind - D_PWR_D);
|
||||||
|
|
||||||
// check dac value
|
// check dac value
|
||||||
// not set yet
|
// not set yet
|
||||||
if (dacValues[ind] == -1) {
|
if (dacValues[ind] == -1) {
|
||||||
LOG(logERROR,
|
LOG(logERROR,
|
||||||
("Power enabled, but unknown dac value for power index %d!", ind));
|
("Unknown dac value for Power V%s!\n", powerNames[pwrIndex]));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// dac powered off
|
// dac powered off
|
||||||
if (dacValues[ind] == LTC2620_D_GetPowerDownValue()) {
|
if (dacValues[ind] == LTC2620_D_GetPowerDownValue()) {
|
||||||
LOG(logWARNING,
|
LOG(logWARNING, ("Power V%s powered down\n", powerNames[pwrIndex]));
|
||||||
("Power %d enabled, dac value %d, voltage at minimum or 0\n", ind,
|
|
||||||
LTC2620_D_GetPowerDownValue()));
|
|
||||||
return LTC2620_D_GetPowerDownValue();
|
return LTC2620_D_GetPowerDownValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
// get dac in mV
|
// get dac in mV
|
||||||
// (unless its a different voltage range compared to other dacs)
|
int retval = -1;
|
||||||
return getDAC(ind, 1);
|
ConvertToDifferentRange(LTC2620_D_GetMaxInput(), LTC2620_D_GetMinInput(),
|
||||||
|
POWER_RGLTR_MIN, POWER_RGLTR_MAX, dacValues[ind],
|
||||||
|
&retval);
|
||||||
|
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPower(enum DACINDEX ind, int val) {
|
void setPower(enum DACINDEX ind, int val) {
|
||||||
|
char *powerNames[] = {PWR_NAMES};
|
||||||
|
int pwrIndex = (int)(ind - D_PWR_D);
|
||||||
|
|
||||||
uint32_t addr = CTRL_REG;
|
// power down dac
|
||||||
uint32_t offset = POWER_VCC_A_OFST + (int)(D_PWR_A - ind);
|
if (val == LTC2620_D_GetPowerDownValue()) {
|
||||||
if (ind == D_PWR_IO)
|
LOG(logINFO, ("\tPowering down V%d\n", powerNames[pwrIndex]));
|
||||||
offset = POWER_VIO_OFST;
|
|
||||||
uint32_t mask = (1 << offset);
|
|
||||||
|
|
||||||
if (val >= 0 || val == LTC2620_D_GetPowerDownValue()) {
|
|
||||||
if (val > 0) {
|
|
||||||
LOG(logINFO, ("Setting Power to %d mV\n", val));
|
|
||||||
}
|
|
||||||
|
|
||||||
// switch off power enable
|
|
||||||
LOG(logINFO, ("\tSwitching off enable for P%d (ctrl reg)\n",
|
|
||||||
(int)(ind - D_PWR_A)));
|
|
||||||
bus_w(addr, bus_r(addr) | mask);
|
|
||||||
|
|
||||||
// power down dac
|
|
||||||
LOG(logINFO, ("\tPowering down P%d\n", (int)(ind - D_PWR_A)));
|
|
||||||
setDAC(ind, LTC2620_D_GetPowerDownValue(), 0);
|
setDAC(ind, LTC2620_D_GetPowerDownValue(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
// set dac in mV
|
// set dac
|
||||||
if (val > 0) {
|
else if (val >= 0) {
|
||||||
LOG(logINFO, ("\tSetting Power P%d (DAC %d) to %d mV\n",
|
LOG(logINFO,
|
||||||
(int)(ind - D_PWR_A), (int)ind, val));
|
("Setting Power V%s to %d mV\n", powerNames[pwrIndex], val));
|
||||||
setDAC(ind, val, 1);
|
|
||||||
|
// validate value (already checked at tcp (funcs.c))
|
||||||
|
if (!isPowerValid(ind, val)) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// switch on power enable
|
// convert voltage to dac
|
||||||
if (getDAC(ind, 1) == val || val == LTC2620_D_GetPowerDownValue()) {
|
int dacval = -1;
|
||||||
LOG(logINFO, ("\tSwitching on enable for P%d (ctrl reg)\n",
|
if (ConvertToDifferentRange(
|
||||||
(int)(ind - D_PWR_A)));
|
POWER_RGLTR_MIN, POWER_RGLTR_MAX, LTC2620_D_GetMaxInput(),
|
||||||
bus_w(addr, bus_r(addr) & ~mask);
|
LTC2620_D_GetMinInput(), val, &dacval) == FAIL) {
|
||||||
|
LOG(logERROR,
|
||||||
|
("\tCannot convert Power V%s to dac value. Invalid value of %d "
|
||||||
|
"mV. Is not between "
|
||||||
|
"%d and %d mV\n",
|
||||||
|
powerNames[pwrIndex], val, POWER_RGLTR_MIN, POWER_RGLTR_MAX));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set and power on/ update dac
|
||||||
|
LOG(logINFO, ("Setting Power V%s: %d mV (%d dac)\n",
|
||||||
|
powerNames[pwrIndex], val, dacval));
|
||||||
|
setDAC(ind, dacval, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1147,7 +1147,7 @@ int getSlowADC(int ichan, int *retval) {
|
|||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
char fname[MAX_STR_LENGTH];
|
char fname[MAX_STR_LENGTH];
|
||||||
memset(fname, 0, MAX_STR_LENGTH);
|
memset(fname, 0, MAX_STR_LENGTH);
|
||||||
sprintf(fname, SLOWADC_DRIVER_FILE_NAME, adcDeviceIndex, ichan);
|
sprintf(fname, SLOWADC_DRIVER_FILE_NAME, ichan);
|
||||||
LOG(logDEBUG1, ("fname %s\n", fname));
|
LOG(logDEBUG1, ("fname %s\n", fname));
|
||||||
|
|
||||||
if (readParameterFromFile(fname, "slow adc", retval) == FAIL) {
|
if (readParameterFromFile(fname, "slow adc", retval) == FAIL) {
|
||||||
|
@ -25,15 +25,13 @@
|
|||||||
#define DYNAMIC_RANGE (16)
|
#define DYNAMIC_RANGE (16)
|
||||||
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8)
|
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8)
|
||||||
|
|
||||||
#define DAC_DRIVER_NUM_DEVICES (3)
|
#define DAC_DRIVER_FILE_NAME ("/root/apps/xilinx-ctb/current_board_links/ao%d")
|
||||||
#define DAC_DRIVER_FILE_NAME \
|
|
||||||
("/sys/bus/iio/devices/iio:device%d/out_voltage%d_raw")
|
|
||||||
#define DAC_POWERDOWN_DRIVER_FILE_NAME \
|
#define DAC_POWERDOWN_DRIVER_FILE_NAME \
|
||||||
("/sys/bus/iio/devices/iio:device%d/out_voltage%d_powerdown")
|
("/root/apps/xilinx-ctb/current_board_links/ao%d_pd")
|
||||||
|
|
||||||
#define SLOWADC_DRIVER_FILE_NAME \
|
#define SLOWADC_DRIVER_FILE_NAME \
|
||||||
("/sys/bus/iio/devices/iio:device%d/in_voltage%d_raw")
|
("/root/apps/xilinx-ctb/mythenIII_0.2_1.1/links/ai%d")
|
||||||
//#define SLOWDAC_CONVERTION_FACTOR_TO_UV (62.500953)
|
// #define SLOWDAC_CONVERTION_FACTOR_TO_UV (62.500953)
|
||||||
|
|
||||||
#define TEMP_DRIVER_FILE_NAME \
|
#define TEMP_DRIVER_FILE_NAME \
|
||||||
("/sys/bus/iio/devices/iio:device0/in_temp7_input")
|
("/sys/bus/iio/devices/iio:device0/in_temp7_input")
|
||||||
@ -60,8 +58,11 @@
|
|||||||
#define MAX_ANALOG_SAMPLES (0x3FFF)
|
#define MAX_ANALOG_SAMPLES (0x3FFF)
|
||||||
#define MAX_DIGITAL_SAMPLES (0x3FFF)
|
#define MAX_DIGITAL_SAMPLES (0x3FFF)
|
||||||
|
|
||||||
#define DAC_MIN_MV (0)
|
#define DAC_MIN_MV (0)
|
||||||
#define DAC_MAX_MV (2500)
|
#define DAC_MAX_MV (2048)
|
||||||
|
#define POWER_RGLTR_MIN (1041)
|
||||||
|
#define POWER_RGLTR_MAX (2661)
|
||||||
|
#define VIO_MIN_MV (1200) // for fpga to function
|
||||||
|
|
||||||
#define TICK_CLK (20) // MHz (trig_timeFromStart, frametime, timeFromStart)
|
#define TICK_CLK (20) // MHz (trig_timeFromStart, frametime, timeFromStart)
|
||||||
#define RUN_CLK \
|
#define RUN_CLK \
|
||||||
@ -117,28 +118,35 @@ enum DACINDEX {
|
|||||||
D_PWR_C
|
D_PWR_C
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define PWR_NAMES "D", "_unknown", "IO", "A", "B", "C"
|
||||||
|
|
||||||
/* Struct Definitions */
|
/* Struct Definitions */
|
||||||
|
// For arm has to be multiple of 16
|
||||||
|
// We dont byteswap in the upd_gen so the order has to be different
|
||||||
typedef struct udp_header_struct {
|
typedef struct udp_header_struct {
|
||||||
uint32_t udp_destmac_msb;
|
|
||||||
uint16_t udp_srcmac_msb;
|
uint16_t udp_srcmac_msb;
|
||||||
uint16_t udp_destmac_lsb;
|
uint16_t udp_destmac_lsb;
|
||||||
uint32_t udp_srcmac_lsb;
|
uint32_t udp_destmac_msb;
|
||||||
uint8_t ip_tos;
|
uint8_t ip_tos;
|
||||||
uint8_t ip_ihl : 4, ip_ver : 4;
|
uint8_t ip_ihl : 4, ip_ver : 4;
|
||||||
uint16_t udp_ethertype;
|
uint16_t udp_ethertype;
|
||||||
uint16_t ip_identification;
|
uint32_t udp_srcmac_lsb;
|
||||||
uint16_t ip_totallength;
|
|
||||||
uint8_t ip_protocol;
|
uint8_t ip_protocol;
|
||||||
uint8_t ip_ttl;
|
uint8_t ip_ttl;
|
||||||
uint16_t ip_fragmentoffset : 13, ip_flags : 3;
|
uint16_t ip_fragmentoffset : 13, ip_flags : 3;
|
||||||
uint16_t ip_srcip_msb;
|
uint16_t ip_identification;
|
||||||
uint16_t ip_checksum;
|
uint16_t ip_totallength;
|
||||||
uint16_t ip_destip_msb;
|
uint16_t ip_destip_msb;
|
||||||
uint16_t ip_srcip_lsb;
|
uint16_t ip_srcip_lsb;
|
||||||
uint16_t udp_srcport;
|
uint16_t ip_srcip_msb;
|
||||||
uint16_t ip_destip_lsb;
|
uint16_t ip_checksum;
|
||||||
uint16_t udp_checksum;
|
uint16_t udp_checksum;
|
||||||
uint16_t udp_destport;
|
uint16_t udp_destport;
|
||||||
|
uint16_t udp_srcport;
|
||||||
|
uint16_t ip_destip_lsb;
|
||||||
|
// padding
|
||||||
|
uint32_t padding0;
|
||||||
|
uint32_t padding1;
|
||||||
} udp_header;
|
} udp_header;
|
||||||
|
|
||||||
#define IP_HEADER_SIZE (20)
|
#define IP_HEADER_SIZE (20)
|
||||||
|
@ -82,10 +82,11 @@ if(SLS_USE_TEXTCLIENT)
|
|||||||
set(det_bin_names "sls_detector_put"
|
set(det_bin_names "sls_detector_put"
|
||||||
"sls_detector_get"
|
"sls_detector_get"
|
||||||
"sls_detector_acquire"
|
"sls_detector_acquire"
|
||||||
|
"sls_detector_acquire_zmq"
|
||||||
"sls_detector_help"
|
"sls_detector_help"
|
||||||
"sls_detector"
|
"sls_detector"
|
||||||
)
|
)
|
||||||
set(det_cmd_name "PUT" "GET" "READOUT" "HELP" "INFER")
|
set(det_cmd_name "PUT" "GET" "READOUT" "READOUTZMQ" "HELP" "INFER")
|
||||||
list(LENGTH det_bin_names len1)
|
list(LENGTH det_bin_names len1)
|
||||||
math(EXPR len2 "${len1} - 1")
|
math(EXPR len2 "${len1} - 1")
|
||||||
|
|
||||||
|
@ -71,6 +71,9 @@ class Caller {
|
|||||||
using StringMap = std::map<std::string, std::string>;
|
using StringMap = std::map<std::string, std::string>;
|
||||||
Detector *ptr; // pointer to the detector that executes the command
|
Detector *ptr; // pointer to the detector that executes the command
|
||||||
|
|
||||||
|
static void EmptyDataCallBack(detectorData *data, uint64_t frameIndex,
|
||||||
|
uint32_t subFrameIndex, void *this_pointer);
|
||||||
|
|
||||||
FunctionMap functions{
|
FunctionMap functions{
|
||||||
{"list", &Caller::list},
|
{"list", &Caller::list},
|
||||||
|
|
||||||
|
@ -397,6 +397,9 @@ class Caller {
|
|||||||
using StringMap = std::map<std::string, std::string>;
|
using StringMap = std::map<std::string, std::string>;
|
||||||
Detector *ptr; // pointer to the detector that executes the command
|
Detector *ptr; // pointer to the detector that executes the command
|
||||||
|
|
||||||
|
static void EmptyDataCallBack(detectorData *data, uint64_t frameIndex,
|
||||||
|
uint32_t subFrameIndex, void *this_pointer);
|
||||||
|
|
||||||
FunctionMap functions{
|
FunctionMap functions{
|
||||||
{"list", &Caller::list},
|
{"list", &Caller::list},
|
||||||
|
|
||||||
|
@ -212,6 +212,12 @@ std::string Caller::hostname(int action) {
|
|||||||
}
|
}
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Caller::EmptyDataCallBack(detectorData *data, uint64_t frameIndex,
|
||||||
|
uint32_t subFrameIndex, void *this_pointer) {
|
||||||
|
LOG(logDEBUG) << "EmptyDataCallBack to start up zmq sockets";
|
||||||
|
}
|
||||||
|
|
||||||
std::string Caller::acquire(int action) {
|
std::string Caller::acquire(int action) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
@ -232,6 +238,9 @@ std::string Caller::acquire(int action) {
|
|||||||
if (det_id >= 0) {
|
if (det_id >= 0) {
|
||||||
throw RuntimeError("Individual detectors not allowed for readout.");
|
throw RuntimeError("Individual detectors not allowed for readout.");
|
||||||
}
|
}
|
||||||
|
if (action == defs::READOUT_ZMQ_ACTION) {
|
||||||
|
det->registerDataCallback(&(EmptyDataCallBack), this);
|
||||||
|
}
|
||||||
det->acquire();
|
det->acquire();
|
||||||
|
|
||||||
if (det->getUseReceiverFlag().squash(false)) {
|
if (det->getUseReceiverFlag().squash(false)) {
|
||||||
|
@ -20,6 +20,10 @@ int main(int argc, char *argv[]) {
|
|||||||
int action = slsDetectorDefs::READOUT_ACTION;
|
int action = slsDetectorDefs::READOUT_ACTION;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef READOUTZMQ
|
||||||
|
int action = slsDetectorDefs::READOUT_ZMQ_ACTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HELP
|
#ifdef HELP
|
||||||
int action = slsDetectorDefs::HELP_ACTION;
|
int action = slsDetectorDefs::HELP_ACTION;
|
||||||
#endif
|
#endif
|
||||||
@ -38,7 +42,8 @@ int main(int argc, char *argv[]) {
|
|||||||
sls::CmdParser parser;
|
sls::CmdParser parser;
|
||||||
parser.Parse(argc, argv);
|
parser.Parse(argc, argv);
|
||||||
|
|
||||||
if (action == slsDetectorDefs::READOUT_ACTION)
|
if (action == slsDetectorDefs::READOUT_ACTION ||
|
||||||
|
action == slsDetectorDefs::READOUT_ZMQ_ACTION)
|
||||||
parser.setCommand("acquire");
|
parser.setCommand("acquire");
|
||||||
|
|
||||||
if (parser.isHelp())
|
if (parser.isHelp())
|
||||||
|
@ -744,8 +744,9 @@ void DetectorImpl::readFrameFromReceiver() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(logDEBUG) << "Call Back Info:" << "\n\t nDetPixelsX: "
|
LOG(logDEBUG) << "Call Back Info:"
|
||||||
<< nDetPixelsX << "\n\t nDetPixelsY: " << nDetPixelsY
|
<< "\n\t nDetPixelsX: " << nDetPixelsX
|
||||||
|
<< "\n\t nDetPixelsY: " << nDetPixelsY
|
||||||
<< "\n\t databytes: " << multisize
|
<< "\n\t databytes: " << multisize
|
||||||
<< "\n\t dynamicRange: " << dynamicRange;
|
<< "\n\t dynamicRange: " << dynamicRange;
|
||||||
|
|
||||||
@ -763,8 +764,8 @@ void DetectorImpl::readFrameFromReceiver() {
|
|||||||
callbackImage = multigappixels;
|
callbackImage = multigappixels;
|
||||||
imagesize = n;
|
imagesize = n;
|
||||||
}
|
}
|
||||||
LOG(logDEBUG) << "Image Info:" << "\n\tnDetActualPixelsX: "
|
LOG(logDEBUG) << "Image Info:"
|
||||||
<< nDetActualPixelsX
|
<< "\n\tnDetActualPixelsX: " << nDetActualPixelsX
|
||||||
<< "\n\tnDetActualPixelsY: " << nDetActualPixelsY
|
<< "\n\tnDetActualPixelsY: " << nDetActualPixelsY
|
||||||
<< "\n\timagesize: " << imagesize
|
<< "\n\timagesize: " << imagesize
|
||||||
<< "\n\tdynamicRange: " << dynamicRange;
|
<< "\n\tdynamicRange: " << dynamicRange;
|
||||||
@ -799,7 +800,8 @@ void DetectorImpl::readFrameFromReceiver() {
|
|||||||
int DetectorImpl::insertGapPixels(char *image, char *&gpImage, bool quadEnable,
|
int DetectorImpl::insertGapPixels(char *image, char *&gpImage, bool quadEnable,
|
||||||
int dr, int &nPixelsx, int &nPixelsy) {
|
int dr, int &nPixelsx, int &nPixelsy) {
|
||||||
|
|
||||||
LOG(logDEBUG) << "Insert Gap pixels:" << "\n\t nPixelsx: " << nPixelsx
|
LOG(logDEBUG) << "Insert Gap pixels:"
|
||||||
|
<< "\n\t nPixelsx: " << nPixelsx
|
||||||
<< "\n\t nPixelsy: " << nPixelsy
|
<< "\n\t nPixelsy: " << nPixelsy
|
||||||
<< "\n\t quadEnable: " << quadEnable << "\n\t dr: " << dr;
|
<< "\n\t quadEnable: " << quadEnable << "\n\t dr: " << dr;
|
||||||
|
|
||||||
@ -884,10 +886,12 @@ int DetectorImpl::insertGapPixels(char *image, char *&gpImage, bool quadEnable,
|
|||||||
<< "nMod1Pixelsy: " << nMod1Pixelsy << "\n\t"
|
<< "nMod1Pixelsy: " << nMod1Pixelsy << "\n\t"
|
||||||
<< "nMod1GapPixelsx: " << nMod1GapPixelsx << "\n\t"
|
<< "nMod1GapPixelsx: " << nMod1GapPixelsx << "\n\t"
|
||||||
<< "nMod1GapPixelsy: " << nMod1GapPixelsy << "\n\t"
|
<< "nMod1GapPixelsy: " << nMod1GapPixelsy << "\n\t"
|
||||||
<< "nChipy: " << nChipy << "\n\t" << "nChipx: " << nChipx
|
<< "nChipy: " << nChipy << "\n\t"
|
||||||
<< "\n\t" << "nModx: " << nModx << "\n\t"
|
<< "nChipx: " << nChipx << "\n\t"
|
||||||
<< "nMody: " << nMody << "\n\t" << "nTotx: " << nTotx
|
<< "nModx: " << nModx << "\n\t"
|
||||||
<< "\n\t" << "nToty: " << nToty << "\n\t"
|
<< "nMody: " << nMody << "\n\t"
|
||||||
|
<< "nTotx: " << nTotx << "\n\t"
|
||||||
|
<< "nToty: " << nToty << "\n\t"
|
||||||
<< "bytesPerPixel: " << bytesPerPixel << "\n\t"
|
<< "bytesPerPixel: " << bytesPerPixel << "\n\t"
|
||||||
<< "imagesize: " << imagesize << "\n\t"
|
<< "imagesize: " << imagesize << "\n\t"
|
||||||
<< "nChipBytesx: " << nChipBytesx << "\n\t"
|
<< "nChipBytesx: " << nChipBytesx << "\n\t"
|
||||||
@ -1219,10 +1223,14 @@ int DetectorImpl::acquire() {
|
|||||||
|
|
||||||
if (acquisition_finished != nullptr) {
|
if (acquisition_finished != nullptr) {
|
||||||
// status
|
// status
|
||||||
runStatus status = IDLE;
|
|
||||||
auto statusList = Parallel(&Module::getRunStatus, {});
|
auto statusList = Parallel(&Module::getRunStatus, {});
|
||||||
status = statusList.squash(ERROR);
|
// if any slave still waiting, wait up to 1s (gotthard)
|
||||||
// difference, but none error
|
for (int i = 0; i != 20 && statusList.any(WAITING); ++i) {
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||||
|
statusList = Parallel(&Module::getRunStatus, {});
|
||||||
|
}
|
||||||
|
runStatus status = statusList.squash(ERROR);
|
||||||
|
// inconsistent status (squash error), but none of them in error
|
||||||
if (status == ERROR && (!statusList.any(ERROR))) {
|
if (status == ERROR && (!statusList.any(ERROR))) {
|
||||||
// handle jf sync issue (master idle, slaves stopped)
|
// handle jf sync issue (master idle, slaves stopped)
|
||||||
if (statusList.contains_only(IDLE, STOPPED)) {
|
if (statusList.contains_only(IDLE, STOPPED)) {
|
||||||
@ -1318,13 +1326,13 @@ void DetectorImpl::startAcquisition(const bool blocking, Positions pos) {
|
|||||||
Parallel(&Module::startAndReadAll, masters);
|
Parallel(&Module::startAndReadAll, masters);
|
||||||
// ensure all status normal (slaves not blocking)
|
// ensure all status normal (slaves not blocking)
|
||||||
// to catch those slaves that are still 'waiting'
|
// to catch those slaves that are still 'waiting'
|
||||||
auto status = Parallel(&Module::getRunStatus, pos);
|
auto statusList = Parallel(&Module::getRunStatus, pos);
|
||||||
// if any slave still waiting, wait up to 1s
|
// if any slave still waiting, wait up to 1s (gotthard)
|
||||||
for (int i = 0; i != 20 && status.any(WAITING); ++i) {
|
for (int i = 0; i != 20 && statusList.any(WAITING); ++i) {
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||||
status = Parallel(&Module::getRunStatus, pos);
|
statusList = Parallel(&Module::getRunStatus, pos);
|
||||||
}
|
}
|
||||||
if (!status.contains_only(IDLE, STOPPED, RUN_FINISHED)) {
|
if (!statusList.contains_only(IDLE, STOPPED, RUN_FINISHED)) {
|
||||||
throw RuntimeError("Acquisition not successful. "
|
throw RuntimeError("Acquisition not successful. "
|
||||||
"Unexpected detector status");
|
"Unexpected detector status");
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ void HDF5DataFile::CreateFile() {
|
|||||||
// property list
|
// property list
|
||||||
H5::DSetCreatPropList plist;
|
H5::DSetCreatPropList plist;
|
||||||
H5::DSetCreatPropList plistPara;
|
H5::DSetCreatPropList plistPara;
|
||||||
int fill_value = -1;
|
uint64_t fill_value = -1;
|
||||||
plist.setFillValue(dataType, &fill_value);
|
plist.setFillValue(dataType, &fill_value);
|
||||||
// plistPara.setFillValue(dataType, &fill_value);
|
// plistPara.setFillValue(dataType, &fill_value);
|
||||||
plist.setChunk(DATA_RANK, dimsChunk);
|
plist.setChunk(DATA_RANK, dimsChunk);
|
||||||
|
@ -215,7 +215,7 @@ std::string CreateVirtualHDF5File(
|
|||||||
|
|
||||||
// property list
|
// property list
|
||||||
H5::DSetCreatPropList plist;
|
H5::DSetCreatPropList plist;
|
||||||
int fill_value = -1;
|
uint64_t fill_value = -1;
|
||||||
plist.setFillValue(dataType, &fill_value);
|
plist.setFillValue(dataType, &fill_value);
|
||||||
std::vector<H5::DSetCreatPropList> plistPara(paraSize);
|
std::vector<H5::DSetCreatPropList> plistPara(paraSize);
|
||||||
// ignoring last fill (string)
|
// ignoring last fill (string)
|
||||||
|
@ -216,7 +216,13 @@ typedef struct {
|
|||||||
/**
|
/**
|
||||||
type of action performed (for text client)
|
type of action performed (for text client)
|
||||||
*/
|
*/
|
||||||
enum { GET_ACTION, PUT_ACTION, READOUT_ACTION, HELP_ACTION };
|
enum {
|
||||||
|
GET_ACTION,
|
||||||
|
PUT_ACTION,
|
||||||
|
READOUT_ACTION,
|
||||||
|
HELP_ACTION,
|
||||||
|
READOUT_ZMQ_ACTION
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
dimension indexes
|
dimension indexes
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
#define RELEASE "developer"
|
#define RELEASE "developer"
|
||||||
#define APILIB "developer 0x230224"
|
#define APILIB "developer 0x230224"
|
||||||
#define APIRECEIVER "developer 0x230224"
|
#define APIRECEIVER "developer 0x230224"
|
||||||
#define APICTB "developer 0x240725"
|
#define APICTB "developer 0x240820"
|
||||||
#define APIGOTTHARD "developer 0x240725"
|
#define APIGOTTHARD "developer 0x240820"
|
||||||
#define APIJUNGFRAU "developer 0x240725"
|
#define APIGOTTHARD2 "developer 0x240820"
|
||||||
#define APIMYTHEN3 "developer 0x240725"
|
#define APIMYTHEN3 "developer 0x240820"
|
||||||
#define APIMOENCH "developer 0x240725"
|
#define APIMOENCH "developer 0x240820"
|
||||||
#define APIXILINXCTB "developer 0x240725"
|
#define APIEIGER "developer 0x240820"
|
||||||
#define APIEIGER "developer 0x240725"
|
#define APIXILINXCTB "developer 0x240820"
|
||||||
#define APIGOTTHARD2 "developer 0x240731"
|
#define APIJUNGFRAU "developer 0x240822"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user