mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
Dev/xilinx ctb test (#942)
* voltage regulators only looks at dac and not at ctrl_reg * xilinx: change dac max to 2048, setting dac ist not inverse conversion from dac to voltage anymore, but setting power is inverse, also there is max and min to power, a different min for vio and this is checked at funcs interface, not printign or converting to mv in dac for power regulators (as its conversion max and min are different) * Use links for dacs/adc and adapt power rglt thresholds * Remove wait for transceiver reset * adc and dac device not used anymore and hence removed * udp restucturing: arm has to be multiple of 16 and no byteswap in udp_gen, option to compile locally in arm architecture, memsize of the second udp memory has to be limited --------- Co-authored-by: Martin Brückner <martin.brueckner@psi.ch>
This commit is contained in:
@ -5,10 +5,12 @@
|
||||
#include <inttypes.h>
|
||||
|
||||
void LTC2620_D_SetDefines(int hardMinV, int hardMaxV, char *driverfname,
|
||||
int numdacs, int numdevices, int startingDeviceIndex,
|
||||
int numdacs, int numpowers,
|
||||
char *powerdownDriverfname);
|
||||
int LTC2620_D_GetMaxNumSteps();
|
||||
int LTC2620_D_GetPowerDownValue();
|
||||
int LTC2620_D_GetMinInput();
|
||||
int LTC2620_D_GetMaxInput();
|
||||
|
||||
/**
|
||||
* Convert voltage to dac units
|
||||
|
@ -5,8 +5,8 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
int resetFPGA(char *mess);
|
||||
int loadDeviceTree(char *mess, int *adcDeviceIndex, int *dacDeviceIndex);
|
||||
int loadDeviceTree(char *mess);
|
||||
|
||||
int checksBeforeCreatingDeviceTree(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)
|
||||
void cleanFifos();
|
||||
void resetFlow();
|
||||
int waitTranseiverReset(char *mess);
|
||||
int waitTransceiverReset(char *mess);
|
||||
#ifdef VIRTUAL
|
||||
void setTransceiverAlignment(int align);
|
||||
#endif
|
||||
@ -424,6 +424,8 @@ int getPower();
|
||||
void setPower(enum DACINDEX ind, int val);
|
||||
void powerOff();
|
||||
#elif XILINX_CHIPTESTBOARDD
|
||||
int isPowerValid(enum DACINDEX ind, int val);
|
||||
|
||||
int getPower();
|
||||
void setPower(enum DACINDEX ind, int val);
|
||||
#endif
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
/* LTC2620 DAC DEFINES */
|
||||
#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_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_PowerDownDriverFileName[MAX_STR_LENGTH];
|
||||
int LTC2620_D_NumDacs = 0;
|
||||
int LTC2620_D_NumDevices = 0;
|
||||
int LTC2620_D_NumChannelsPerDevice = 0;
|
||||
int LTC2620_D_DacDriverStartingDeviceIndex = 0;
|
||||
int LTC2620_D_NumDacsOnly = 0;
|
||||
|
||||
void LTC2620_D_SetDefines(int hardMinV, int hardMaxV, char *driverfname,
|
||||
int numdacs, int numdevices, int startingDeviceIndex,
|
||||
int numdacs, int numpowers,
|
||||
char *powerdownDriverfname) {
|
||||
LOG(logINFOBLUE,
|
||||
("Configuring DACs (LTC2620) to %s\n\t (numdacs:%d, hard min:%d, hard "
|
||||
"max: %dmV, idev:%d)\n",
|
||||
driverfname, numdacs, hardMinV, hardMaxV, startingDeviceIndex));
|
||||
"max: %dmV)\n",
|
||||
driverfname, numdacs, hardMinV, hardMaxV));
|
||||
LTC2620_D_HardMinVoltage = hardMinV;
|
||||
LTC2620_D_HardMaxVoltage = hardMaxV;
|
||||
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);
|
||||
strcpy(LTC2620_D_PowerDownDriverFileName, powerdownDriverfname);
|
||||
LTC2620_D_NumDacs = numdacs;
|
||||
LTC2620_D_NumDevices = numdevices;
|
||||
LTC2620_D_NumChannelsPerDevice = LTC2620_D_NumDacs / LTC2620_D_NumDevices;
|
||||
LTC2620_D_DacDriverStartingDeviceIndex = startingDeviceIndex;
|
||||
LTC2620_D_NumDacsOnly = numdacs - numpowers;
|
||||
}
|
||||
|
||||
int LTC2620_D_GetMaxNumSteps() { return LTC2620_D_MAX_STEPS; }
|
||||
|
||||
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) {
|
||||
return ConvertToDifferentRange(LTC2620_D_HardMinVoltage,
|
||||
LTC2620_D_HardMaxVoltage, 0,
|
||||
@ -94,7 +95,10 @@ int LTC2620_D_SetDACValue(int dacnum, int val, int mV, char *dacname,
|
||||
int dacmV = val;
|
||||
if (mV) {
|
||||
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
|
||||
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
|
||||
#ifdef XILINX_CHIPTESTBOARDD
|
||||
if (*dacval >= 0) {
|
||||
LOG(logINFO, ("Setting DAC %2d [%-6s] : %d dac (%d mV)\n", dacnum,
|
||||
dacname, *dacval, dacmV));
|
||||
// also print mV
|
||||
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
|
||||
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];
|
||||
memset(fname, 0, MAX_STR_LENGTH);
|
||||
#ifdef XILINX_CHIPTESTBOARDD
|
||||
int idev = LTC2620_D_DacDriverStartingDeviceIndex +
|
||||
(dacnum / LTC2620_D_NumChannelsPerDevice);
|
||||
int idac = dacnum % LTC2620_D_NumChannelsPerDevice;
|
||||
sprintf(fname, fnameFormat, idev, idac);
|
||||
sprintf(fname, fnameFormat, dacnum);
|
||||
#else
|
||||
sprintf(fname, "%s%d", fnameFormat, dacnum);
|
||||
#endif
|
||||
|
@ -13,9 +13,9 @@
|
||||
/* global variables */
|
||||
#define CSP0 (0xB0080000)
|
||||
#define CSP1 (0xB0050000) // udp
|
||||
#define MEM_SIZE (0x10000)
|
||||
//#define MEM_SIZE_CSP0 (4096)
|
||||
//#define MEM_SIZE_CSP1 (2 * 4096)
|
||||
#define MEM_SIZE_CSP0 (0x10000)
|
||||
#define MEM_SIZE_CSP1 (0x2000) // smaller size for udp
|
||||
|
||||
u_int32_t *csp0base = 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) {
|
||||
u_int32_t csps[2] = {CSP0, CSP1};
|
||||
u_int32_t **cspbases[2] = {&csp0base, &csp1base};
|
||||
u_int32_t memsize[2] = {MEM_SIZE_CSP0, MEM_SIZE_CSP1};
|
||||
char names[2][10] = {"csp0base", "csp1base"};
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
@ -59,10 +60,10 @@ int mapCSP0(void) {
|
||||
if (*cspbases[i] == 0) {
|
||||
LOG(logINFO, ("Mapping memory for %s\n", names[i]));
|
||||
#ifdef VIRTUAL
|
||||
*cspbases[i] = malloc(MEM_SIZE);
|
||||
*cspbases[i] = malloc(memsize[i]);
|
||||
if (*cspbases[i] == NULL) {
|
||||
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;
|
||||
}
|
||||
LOG(logINFO, ("memory allocated for %s\n", names[i]));
|
||||
@ -75,15 +76,15 @@ int mapCSP0(void) {
|
||||
LOG(logDEBUG1,
|
||||
("/dev/mem opened for %s, (CSP:0x%x)\n", names[i], csps[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]);
|
||||
if (*cspbases[i] == MAP_FAILED) {
|
||||
LOG(logERROR, ("Can't map memmory area for %s\n", names[i]));
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
LOG(logINFO, ("%s mapped from %p to %p,(CSP:0x%x) \n", names[i],
|
||||
*cspbases[i], *cspbases[i] + MEM_SIZE, csps[i]));
|
||||
LOG(logINFO, ("%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)));
|
||||
} else
|
||||
LOG(logINFO, ("Memory %s already mapped before\n", names[i]));
|
||||
|
@ -35,8 +35,8 @@ int resetFPGA(char *mess) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int loadDeviceTree(char *mess, int *adcDeviceIndex, int *dacDeviceIndex) {
|
||||
if (verifyDeviceTree(mess, adcDeviceIndex, dacDeviceIndex) == OK)
|
||||
int loadDeviceTree(char *mess) {
|
||||
if (verifyDeviceTree(mess) == OK)
|
||||
return OK;
|
||||
|
||||
if (checksBeforeCreatingDeviceTree(mess) == FAIL)
|
||||
@ -45,7 +45,7 @@ int loadDeviceTree(char *mess, int *adcDeviceIndex, int *dacDeviceIndex) {
|
||||
if (createDeviceTree(mess) == FAIL)
|
||||
return FAIL;
|
||||
|
||||
if (verifyDeviceTree(mess, adcDeviceIndex, dacDeviceIndex) == FAIL) {
|
||||
if (verifyDeviceTree(mess) == FAIL) {
|
||||
LOG(logERROR, ("Device tree loading failed at verification\n"));
|
||||
return FAIL;
|
||||
}
|
||||
@ -129,10 +129,8 @@ int createDeviceTree(char *mess) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int verifyDeviceTree(char *mess, int *adcDeviceIndex, int *dacDeviceIndex) {
|
||||
int verifyDeviceTree(char *mess) {
|
||||
LOG(logINFOBLUE, ("Verifying Device Tree...\n"));
|
||||
*adcDeviceIndex = 1;
|
||||
*dacDeviceIndex = 2;
|
||||
#ifndef VIRTUAL
|
||||
|
||||
// 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]) !=
|
||||
NULL) {
|
||||
++hardcodedDeviceIndex;
|
||||
*adcDeviceIndex = 4;
|
||||
*dacDeviceIndex = 1;
|
||||
} else {
|
||||
snprintf(
|
||||
mess, MAX_STR_LENGTH,
|
||||
@ -188,9 +184,6 @@ int verifyDeviceTree(char *mess, int *adcDeviceIndex, int *dacDeviceIndex) {
|
||||
hardcodedDeviceIndex = 1;
|
||||
}
|
||||
#endif
|
||||
LOG(logINFOBLUE, ("Device tree verified successfully [temp: 0, adc:%d, "
|
||||
"dac:%d, %d, %d]\n",
|
||||
*adcDeviceIndex, *dacDeviceIndex, *dacDeviceIndex + 1,
|
||||
*dacDeviceIndex + 2));
|
||||
LOG(logINFOBLUE, ("Device tree verified successfully\n"));
|
||||
return OK;
|
||||
}
|
@ -1297,7 +1297,7 @@ int validateAndSetDac(enum dacIndex ind, int val, int mV) {
|
||||
ind, getVLimit());
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
#ifdef CHIPTESTBOARDD
|
||||
|
||||
else if (!isPowerValid(serverDacIndex, val)) {
|
||||
ret = FAIL;
|
||||
sprintf(
|
||||
@ -1306,10 +1306,14 @@ int validateAndSetDac(enum dacIndex ind, int val, int mV) {
|
||||
"should be between %d and %d mV\n",
|
||||
ind,
|
||||
(serverDacIndex == D_PWR_IO ? VIO_MIN_MV : POWER_RGLTR_MIN),
|
||||
#ifdef CHIPTESTBOARDD
|
||||
(VCHIP_MAX_MV - VCHIP_POWER_INCRMNT));
|
||||
#else
|
||||
POWER_RGLTR_MAX);
|
||||
#endif
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
#endif
|
||||
|
||||
else {
|
||||
setPower(serverDacIndex, val);
|
||||
}
|
||||
@ -2022,105 +2026,101 @@ int acquire(int blocking, int file_des) {
|
||||
#if defined(JUNGFRAUD)
|
||||
// chipv1.1 has to be configured before acquisition
|
||||
if (getChipVersion() == 11 && !isChipConfigured()) {
|
||||
ret = FAIL;
|
||||
strcpy(mess,
|
||||
"Could not start acquisition. Chip is not configured. "
|
||||
"Power it on to configure it.\n");
|
||||
LOG(logERROR, (mess));
|
||||
} else
|
||||
ret = FAIL;
|
||||
strcpy(mess, "Could not start acquisition. Chip is not configured. "
|
||||
"Power it on to configure it.\n");
|
||||
LOG(logERROR, (mess));
|
||||
} else
|
||||
#endif
|
||||
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
|
||||
if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
|
||||
getReadoutMode() == ANALOG_ONLY) &&
|
||||
(getNumAnalogSamples() <= 0)) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not start acquisition. Invalid number of analog "
|
||||
"samples: %d.\n",
|
||||
getNumAnalogSamples());
|
||||
LOG(logERROR, (mess));
|
||||
} else if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
|
||||
getReadoutMode() == DIGITAL_ONLY ||
|
||||
getReadoutMode() == DIGITAL_AND_TRANSCEIVER) &&
|
||||
(getNumDigitalSamples() <= 0)) {
|
||||
ret = FAIL;
|
||||
sprintf(
|
||||
mess,
|
||||
if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
|
||||
getReadoutMode() == ANALOG_ONLY) &&
|
||||
(getNumAnalogSamples() <= 0)) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not start acquisition. Invalid number of analog "
|
||||
"samples: %d.\n",
|
||||
getNumAnalogSamples());
|
||||
LOG(logERROR, (mess));
|
||||
} else if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
|
||||
getReadoutMode() == DIGITAL_ONLY ||
|
||||
getReadoutMode() == DIGITAL_AND_TRANSCEIVER) &&
|
||||
(getNumDigitalSamples() <= 0)) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not start acquisition. Invalid number of digital "
|
||||
"samples: %d.\n",
|
||||
getNumDigitalSamples());
|
||||
LOG(logERROR, (mess));
|
||||
} else if ((getReadoutMode() == TRANSCEIVER_ONLY ||
|
||||
getReadoutMode() == DIGITAL_AND_TRANSCEIVER) &&
|
||||
(getNumTransceiverSamples() <= 0)) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not start acquisition. Invalid number of "
|
||||
"transceiver "
|
||||
"samples: %d.\n",
|
||||
getNumTransceiverSamples());
|
||||
LOG(logERROR, (mess));
|
||||
} else
|
||||
LOG(logERROR, (mess));
|
||||
} else if ((getReadoutMode() == TRANSCEIVER_ONLY ||
|
||||
getReadoutMode() == DIGITAL_AND_TRANSCEIVER) &&
|
||||
(getNumTransceiverSamples() <= 0)) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not start acquisition. Invalid number of "
|
||||
"transceiver "
|
||||
"samples: %d.\n",
|
||||
getNumTransceiverSamples());
|
||||
LOG(logERROR, (mess));
|
||||
} else
|
||||
#endif
|
||||
#ifdef EIGERD
|
||||
// check for hardware mac and hardware ip
|
||||
if (udpDetails[0].srcmac != getDetectorMAC()) {
|
||||
ret = FAIL;
|
||||
uint64_t sourcemac = getDetectorMAC();
|
||||
char src_mac[MAC_ADDRESS_SIZE];
|
||||
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac);
|
||||
sprintf(mess,
|
||||
"Invalid udp source mac address for this detector. "
|
||||
"Must be "
|
||||
"same as hardware detector mac address %s\n",
|
||||
src_mac);
|
||||
LOG(logERROR, (mess));
|
||||
} else if (!enableTenGigabitEthernet(GET_FLAG) &&
|
||||
(udpDetails[0].srcip != getDetectorIP())) {
|
||||
ret = FAIL;
|
||||
uint32_t sourceip = getDetectorIP();
|
||||
char src_ip[INET_ADDRSTRLEN];
|
||||
getIpAddressinString(src_ip, sourceip);
|
||||
sprintf(
|
||||
mess,
|
||||
"Invalid udp source ip address for this detector. Must "
|
||||
"be "
|
||||
"same as hardware detector ip address %s in 1G readout "
|
||||
"mode \n",
|
||||
src_ip);
|
||||
LOG(logERROR, (mess));
|
||||
} else
|
||||
// check for hardware mac and hardware ip
|
||||
if (udpDetails[0].srcmac != getDetectorMAC()) {
|
||||
ret = FAIL;
|
||||
uint64_t sourcemac = getDetectorMAC();
|
||||
char src_mac[MAC_ADDRESS_SIZE];
|
||||
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac);
|
||||
sprintf(mess,
|
||||
"Invalid udp source mac address for this detector. "
|
||||
"Must be "
|
||||
"same as hardware detector mac address %s\n",
|
||||
src_mac);
|
||||
LOG(logERROR, (mess));
|
||||
} else if (!enableTenGigabitEthernet(GET_FLAG) &&
|
||||
(udpDetails[0].srcip != getDetectorIP())) {
|
||||
ret = FAIL;
|
||||
uint32_t sourceip = getDetectorIP();
|
||||
char src_ip[INET_ADDRSTRLEN];
|
||||
getIpAddressinString(src_ip, sourceip);
|
||||
sprintf(mess,
|
||||
"Invalid udp source ip address for this detector. Must "
|
||||
"be "
|
||||
"same as hardware detector ip address %s in 1G readout "
|
||||
"mode \n",
|
||||
src_ip);
|
||||
LOG(logERROR, (mess));
|
||||
} else
|
||||
#endif
|
||||
if (configured == FAIL) {
|
||||
ret = FAIL;
|
||||
strcpy(mess, "Could not start acquisition because ");
|
||||
strcat(mess, configureMessage);
|
||||
LOG(logERROR, (mess));
|
||||
} else if (sharedMemory_getScanStatus() == RUNNING) {
|
||||
ret = FAIL;
|
||||
strcpy(mess,
|
||||
"Could not start acquisition because a scan is "
|
||||
"already running!\n");
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
memset(scanErrMessage, 0, MAX_STR_LENGTH);
|
||||
sharedMemory_setScanStop(0);
|
||||
sharedMemory_setScanStatus(IDLE); // if it was error
|
||||
if (pthread_create(&pthread_tid, NULL, &start_state_machine,
|
||||
&blocking)) {
|
||||
ret = FAIL;
|
||||
strcpy(mess, "Could not start acquisition thread!\n");
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
// wait for blocking always (scan or not)
|
||||
// non blocking-no scan also wait (for error message)
|
||||
// non blcoking-scan dont wait (there is
|
||||
// scanErrorMessage)
|
||||
if (blocking || !scan) {
|
||||
pthread_join(pthread_tid, NULL);
|
||||
}
|
||||
}
|
||||
if (configured == FAIL) {
|
||||
ret = FAIL;
|
||||
strcpy(mess, "Could not start acquisition because ");
|
||||
strcat(mess, configureMessage);
|
||||
LOG(logERROR, (mess));
|
||||
} else if (sharedMemory_getScanStatus() == RUNNING) {
|
||||
ret = FAIL;
|
||||
strcpy(mess, "Could not start acquisition because a scan is "
|
||||
"already running!\n");
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
memset(scanErrMessage, 0, MAX_STR_LENGTH);
|
||||
sharedMemory_setScanStop(0);
|
||||
sharedMemory_setScanStatus(IDLE); // if it was error
|
||||
if (pthread_create(&pthread_tid, NULL, &start_state_machine,
|
||||
&blocking)) {
|
||||
ret = FAIL;
|
||||
strcpy(mess, "Could not start acquisition thread!\n");
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
// wait for blocking always (scan or not)
|
||||
// non blocking-no scan also wait (for error message)
|
||||
// non blcoking-scan dont wait (there is
|
||||
// scanErrorMessage)
|
||||
if (blocking || !scan) {
|
||||
pthread_join(pthread_tid, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user