diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 491fc38e0..375d62d6c 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -61,7 +61,9 @@ class qDefs : public QWidget { } } - template struct NonDeduced { using type = CT; }; + template struct NonDeduced { + using type = CT; + }; template static void HandleExceptions(const std::string emsg, const std::string src, S *s, RT (S::*somefunc)(CT...), diff --git a/slsDetectorServers/eigerDetectorServer/9mhvserial_bf.c b/slsDetectorServers/eigerDetectorServer/9mhvserial_bf.c index d5651ec7b..f67a46dbf 100644 --- a/slsDetectorServers/eigerDetectorServer/9mhvserial_bf.c +++ b/slsDetectorServers/eigerDetectorServer/9mhvserial_bf.c @@ -17,7 +17,7 @@ #define BUFFERSIZE 16 #define I2C_DEVICE_FILE "/dev/i2c-0" #define I2C_DEVICE_ADDRESS 0x4C -//#define I2C_DEVICE_ADDRESS 0x48 +// #define I2C_DEVICE_ADDRESS 0x48 #define I2C_REGISTER_ADDRESS 0x40 int i2c_open(const char *file, unsigned int addr) { diff --git a/slsDetectorServers/eigerDetectorServer/FebRegisterDefs.h b/slsDetectorServers/eigerDetectorServer/FebRegisterDefs.h index b1246db33..785a854af 100644 --- a/slsDetectorServers/eigerDetectorServer/FebRegisterDefs.h +++ b/slsDetectorServers/eigerDetectorServer/FebRegisterDefs.h @@ -98,8 +98,8 @@ // everything at ~200 kHz (200 kHz MHz ddr readout) #define DAQ_CHIP_CONTROLLER_SUPER_SLOW_SPEED 0x000c0000 -//#define DAQ_FIFO_ENABLE 0x00100000 commented out as it -// is not used anywhere +// #define DAQ_FIFO_ENABLE 0x00100000 commented out as it +// is not used anywhere #define DAQ_REG_CHIP_CMDS_INT_TRIGGER 0x00100000 // direct chip commands to the DAQ_REG_CHIP_CMDS register @@ -131,8 +131,9 @@ #define DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING 0x20000000 #define DAQ_NEXPOSURERS_ACTIVATE_RATE_CORRECTION 0x40000000 -//#define DAQ_MASTER_HALF_MODULE 0x80000000 currently not -// used +// #define DAQ_MASTER_HALF_MODULE 0x80000000 currently +// not +// used // chips static bits #define DAQ_STATIC_BIT_PROGRAM 0x00000001 diff --git a/slsDetectorServers/eigerDetectorServer/xfs_types.h b/slsDetectorServers/eigerDetectorServer/xfs_types.h index 1c998bdc4..68d5321f6 100644 --- a/slsDetectorServers/eigerDetectorServer/xfs_types.h +++ b/slsDetectorServers/eigerDetectorServer/xfs_types.h @@ -2,7 +2,7 @@ // Copyright (C) 2021 Contributors to the SLS Detector Package #pragma once -//#include "types.h" +// #include "types.h" #include /******************************************************************************/ /* types */ diff --git a/slsDetectorServers/eigerDetectorServer/xparameters.h b/slsDetectorServers/eigerDetectorServer/xparameters.h index 4b3bf1312..66a4a4396 100644 --- a/slsDetectorServers/eigerDetectorServer/xparameters.h +++ b/slsDetectorServers/eigerDetectorServer/xparameters.h @@ -92,7 +92,7 @@ XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT_BASEADDR #define XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT_HIGHADDR 0xC410FFFF /* Definitions for a new memory */ -//#define XPAR_PLB_LL_NEW_MEMORY 0xD1000000//0xD1000084//0xC4200000 +// #define XPAR_PLB_LL_NEW_MEMORY 0xD1000000//0xD1000084//0xC4200000 /* Definitions for peripheral PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT */ #define XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT_BASEADDR 0xC4110000 diff --git a/slsDetectorServers/gotthardDetectorServer/RegisterDefs.h b/slsDetectorServers/gotthardDetectorServer/RegisterDefs.h index d04e80346..f1ecbf613 100644 --- a/slsDetectorServers/gotthardDetectorServer/RegisterDefs.h +++ b/slsDetectorServers/gotthardDetectorServer/RegisterDefs.h @@ -22,13 +22,13 @@ ((0x1 << GAIN_CONFGAIN_OFST) & GAIN_CONFGAIN_MSK) /** Flow Control register */ -//#define FLOW_CONTROL_REG (0x11 << MEM_MAP_SHIFT) +// #define FLOW_CONTROL_REG (0x11 << MEM_MAP_SHIFT) /** Flow Status register */ -//#define FLOW_STATUS_REG (0x12 << MEM_MAP_SHIFT) +// #define FLOW_STATUS_REG (0x12 << MEM_MAP_SHIFT) /** Frame register */ -//#define FRAME_REG (0x13 << MEM_MAP_SHIFT) +// #define FRAME_REG (0x13 << MEM_MAP_SHIFT) /** Multi Purpose register */ #define MULTI_PURPOSE_REG (0x14 << MEM_MAP_SHIFT) @@ -79,7 +79,7 @@ ((0x0007f << DAQ_PCKT_LNGTH_OFST) & DAQ_PCKT_LNGTH_MSK) /** Time From Start register */ -//#define TIME_FROM_START_REG (0x16 << MEM_MAP_SHIFT) +// #define TIME_FROM_START_REG (0x16 << MEM_MAP_SHIFT) /** DAC Control register */ #define SPI_REG (0x17 << MEM_MAP_SHIFT) @@ -139,7 +139,7 @@ ((0x1b << ADC_SYNC_ENET_DELAY_OFST) & ADC_SYNC_ENET_DELAY_MSK) /** Time From Start register */ -//#define MU_TIME_REG (0x1a << MEM_MAP_SHIFT) +// #define MU_TIME_REG (0x1a << MEM_MAP_SHIFT) /** Temperatre SPI In register */ #define TEMP_SPI_IN_REG (0x1b << MEM_MAP_SHIFT) @@ -171,7 +171,7 @@ #define ENET_CONF_REG (0x1e << MEM_MAP_SHIFT) /** Write TSE Shadow register */ -//#define WRITE_TSE_SHADOW_REG (0x1f << MEM_MAP_SHIFT) +// #define WRITE_TSE_SHADOW_REG (0x1f << MEM_MAP_SHIFT) /** High Voltage register */ #define HV_REG (0x20 << MEM_MAP_SHIFT) @@ -288,10 +288,10 @@ ((0x4 << EXT_SIGNAL_OFST) & EXT_SIGNAL_MSK) /** Look at me register */ -//#define LOOK_AT_ME_REG (0x28 << MEM_MAP_SHIFT) +// #define LOOK_AT_ME_REG (0x28 << MEM_MAP_SHIFT) /** FPGA SVN register */ -//#define FPGA_SVN_REG (0x29 << MEM_MAP_SHIFT) +// #define FPGA_SVN_REG (0x29 << MEM_MAP_SHIFT) /** Chip of Interest register */ #define CHIP_OF_INTRST_REG (0x2a << MEM_MAP_SHIFT) @@ -303,7 +303,7 @@ (0x0000FFFF << CHIP_OF_INTRST_NUM_CHNNLS_OFST) /** Out MUX register */ -//#define OUT_MUX_REG (0x2b << MEM_MAP_SHIFT) +// #define OUT_MUX_REG (0x2b << MEM_MAP_SHIFT) /** Board Version register */ #define BOARD_REVISION_REG (0x2c << MEM_MAP_SHIFT) @@ -312,29 +312,29 @@ #define BOARD_REVISION_MSK (0x0000FFFF << BOARD_REVISION_OFST) #define DETECTOR_TYPE_OFST (16) #define DETECTOR_TYPE_MSK (0x0000000F << DETECTOR_TYPE_OFST) -//#define DETECTOR_TYPE_GOTTHARD_VAL (??) +// #define DETECTOR_TYPE_GOTTHARD_VAL (??) #define DETECTOR_TYPE_MOENCH_VAL (2) /** Memory Test register */ -//#define MEMORY_TEST_REG (0x2d << MEM_MAP_SHIFT) +// #define MEMORY_TEST_REG (0x2d << MEM_MAP_SHIFT) /** Hit Threshold register */ -//#define HIT_THRESHOLD_REG (0x2e << MEM_MAP_SHIFT) +// #define HIT_THRESHOLD_REG (0x2e << MEM_MAP_SHIFT) /** Hit Count register */ -//#define HIT_COUNT_REG (0x2f << MEM_MAP_SHIFT) +// #define HIT_COUNT_REG (0x2f << MEM_MAP_SHIFT) /* 16 bit Fifo Data register */ #define FIFO_DATA_REG (0x50 << MEM_MAP_SHIFT) // Not used in FW and SW (16bit) /** Dacs Set 1 register */ -//#define DACS_SET_1_REG (0x65 << MEM_MAP_SHIFT) +// #define DACS_SET_1_REG (0x65 << MEM_MAP_SHIFT) /** Dacs Set 2 register */ -//#define DACS_SET_2_REG (0x66 << MEM_MAP_SHIFT) +// #define DACS_SET_2_REG (0x66 << MEM_MAP_SHIFT) /** Dacs Set 3 register */ -//#define DACS_SET_3_REG (0x67 << MEM_MAP_SHIFT) +// #define DACS_SET_3_REG (0x67 << MEM_MAP_SHIFT) /* Set Delay 64 bit register */ #define SET_DELAY_LSB_REG (0x68 << MEM_MAP_SHIFT) @@ -377,12 +377,12 @@ #define GET_EXPTIME_MSB_REG (0x7b << MEM_MAP_SHIFT) /* Set Gates 64 bit register */ -//#define SET_GATES_LSB_REG (0x7c << MEM_MAP_SHIFT) -//#define SET_GATES_MSB_REG (0x7d << MEM_MAP_SHIFT) +// #define SET_GATES_LSB_REG (0x7c << MEM_MAP_SHIFT) +// #define SET_GATES_MSB_REG (0x7d << MEM_MAP_SHIFT) /* Set Gates 64 bit register */ -//#define GET_GATES_LSB_REG (0x7e << MEM_MAP_SHIFT) -//#define GET_GATES_MSB_REG (0x7f << MEM_MAP_SHIFT) +// #define GET_GATES_LSB_REG (0x7e << MEM_MAP_SHIFT) +// #define GET_GATES_MSB_REG (0x7f << MEM_MAP_SHIFT) /* Dark Image starting address */ #define DARK_IMAGE_REG (0x81 << MEM_MAP_SHIFT) diff --git a/slsDetectorServers/mythen3DetectorServer/mythen3.c b/slsDetectorServers/mythen3DetectorServer/mythen3.c index 96bf73902..f4dc01871 100644 --- a/slsDetectorServers/mythen3DetectorServer/mythen3.c +++ b/slsDetectorServers/mythen3DetectorServer/mythen3.c @@ -39,8 +39,8 @@ patternParameters *setChipStatusRegisterPattern(int csr) { patword = clearBit(SIGNAL_resCounter, patword); for (int i = 0; i < 8; i++) pat->word[iaddr++] = patword; - //#This version of the serializer pushes in the MSB first (compatible with - // the CSR bit numbering) + // #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); diff --git a/slsDetectorServers/mythen3DetectorServer/mythen3.h b/slsDetectorServers/mythen3DetectorServer/mythen3.h index 1ac9aad21..f7a62e346 100644 --- a/slsDetectorServers/mythen3DetectorServer/mythen3.h +++ b/slsDetectorServers/mythen3DetectorServer/mythen3.h @@ -38,11 +38,11 @@ #define CSR_invpol 4 #define CSR_dpulse 5 #define CSR_interp 6 -#define _CSR_C10pre 7 //#default, negative polarity +#define _CSR_C10pre 7 // #default, negative polarity #define CSR_pumprobe 8 #define CSR_apulse 9 #define CSR_C15sh 10 -#define CSR_C30sh 11 //#default +#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 diff --git a/slsDetectorServers/slsDetectorServer/src/I2C.c b/slsDetectorServers/slsDetectorServer/src/I2C.c index 31efc129a..5c60311ac 100644 --- a/slsDetectorServers/slsDetectorServer/src/I2C.c +++ b/slsDetectorServers/slsDetectorServer/src/I2C.c @@ -106,9 +106,9 @@ (0x0000FFFF << I2C_SDA_HOLD_COUNT_PERIOD_OFST) /** Receive Data Fifo Level register */ -//#define I2C_RX_DATA_FIFO_LVL_OFST (0) -//#define I2C_RX_DATA_FIFO_LVL_MSK (0x000000FF << -// I2C_RX_DATA_FIFO_LVL_OFST) +// #define I2C_RX_DATA_FIFO_LVL_OFST (0) +// #define I2C_RX_DATA_FIFO_LVL_MSK (0x000000FF << +// I2C_RX_DATA_FIFO_LVL_OFST) // defines in the fpga uint32_t I2C_Control_Reg = 0x0; diff --git a/slsDetectorServers/slsDetectorServer/src/communication_funcs.c b/slsDetectorServers/slsDetectorServer/src/communication_funcs.c index bcec87fdc..b53fe078b 100644 --- a/slsDetectorServers/slsDetectorServer/src/communication_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/communication_funcs.c @@ -622,7 +622,7 @@ void getIpAddressinString(char *cip, uint32_t ip) { inet_ntop(AF_INET, &ip, cip, INET_ADDRSTRLEN); #else sprintf(cip, "%d.%d.%d.%d", (ip >> 24) & 0xff, (ip >> 16) & 0xff, - (ip >> 8) & 0xff, (ip)&0xff); + (ip >> 8) & 0xff, (ip) & 0xff); #endif } diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index 5255a22fd..0984eb968 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -2013,102 +2013,106 @@ 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 -#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); + // 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 - pthread_detach(pthread_tid); - } - } +#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); + } else + pthread_detach(pthread_tid); + } + } } return Server_SendResult(file_des, INT32, NULL, 0); } diff --git a/slsDetectorSoftware/src/DetectorImpl.h b/slsDetectorSoftware/src/DetectorImpl.h index 424330043..da56e5a22 100644 --- a/slsDetectorSoftware/src/DetectorImpl.h +++ b/slsDetectorSoftware/src/DetectorImpl.h @@ -79,7 +79,9 @@ class DetectorImpl : public virtual slsDetectorDefs { explicit DetectorImpl(int detector_index = 0, bool verify = true, bool update = true); - template struct NonDeduced { using type = CT; }; + template struct NonDeduced { + using type = CT; + }; template Result Parallel(RT (Module::*somefunc)(CT...), std::vector positions, diff --git a/slsSupportLib/include/sls/md5.h b/slsSupportLib/include/sls/md5.h index a4f0c8364..94d0b90c8 100644 --- a/slsSupportLib/include/sls/md5.h +++ b/slsSupportLib/include/sls/md5.h @@ -130,7 +130,7 @@ extern "C" { ll = (c)->D; \ (void)HOST_l2c(ll, (s)); \ } while (0) -#define ROTATE(a, n) (((a) << (n)) | (((a)&0xffffffff) >> (32 - (n)))) +#define ROTATE(a, n) (((a) << (n)) | (((a) & 0xffffffff) >> (32 - (n)))) #if defined(DATA_ORDER_IS_BIG_ENDIAN) #define HOST_c2l(c, l) \