diff --git a/slsDetectorServers/ctbDetectorServer/Makefile b/slsDetectorServers/ctbDetectorServer/Makefile index aa6c43fce..711a15a21 100755 --- a/slsDetectorServers/ctbDetectorServer/Makefile +++ b/slsDetectorServers/ctbDetectorServer/Makefile @@ -10,8 +10,10 @@ script_dir = ../../etc/ CROSS = bfin-uclinux- CC = $(CROSS)gcc -CFLAGS += -Wall -std=gnu99 -DCHIPTESTBOARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(det_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE +CFLAGS += -O2 -Wall -Wextra -Wno-unused-parameter -Wformat=2 -Wredundant-decls -Werror=return-type -std=gnu99 -DCHIPTESTBOARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(det_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE LDLIBS += -lm -lrt -pthread +# FLAT stack size: elf2flt defaults to 4 KB, the update and startup paths need more than 8 KB +LDLIBS += -Wl,-elf2flt=-s262144 PROGS = ctbDetectorServer DESTDIR ?= bin INSTMODE = 0777 diff --git a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer index f29a19c37..364a066f5 100755 Binary files a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer and b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer differ diff --git a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c index c5d5a9462..7d65e52cd 100644 --- a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c @@ -2013,7 +2013,7 @@ int validatePhaseinDegrees(enum CLKINDEX ind, int val, int retval) { } int setFrequency(enum CLKINDEX ind, int val) { - if (ind < 0 || ind >= NUM_CLOCKS) { + if (ind >= NUM_CLOCKS) { LOG(logERROR, ("Unknown clock index %d to set frequency\n", ind)); return FAIL; } @@ -2063,7 +2063,7 @@ int setFrequency(enum CLKINDEX ind, int val) { } int getFrequency(enum CLKINDEX ind) { - if (ind < 0 || ind >= NUM_CLOCKS) { + if (ind >= NUM_CLOCKS) { LOG(logERROR, ("Unknown clock index %d to get frequency\n", ind)); return -1; } diff --git a/slsDetectorServers/eigerDetectorServer/Beb.c b/slsDetectorServers/eigerDetectorServer/Beb.c index 9299340b9..a9605c05c 100644 --- a/slsDetectorServers/eigerDetectorServer/Beb.c +++ b/slsDetectorServers/eigerDetectorServer/Beb.c @@ -6,6 +6,7 @@ #include "xparameters.h" #include +#include #include #include #include @@ -14,20 +15,8 @@ extern int isControlServer; #define MAX(x, y) (((x) > (y)) ? (x) : (y)) -struct LocalLinkInterface ll_beb_local, *ll_beb; - struct udp_header_type udp_header; -int Beb_send_ndata; -unsigned int Beb_send_buffer_size; -unsigned int *Beb_send_data_raw; -unsigned int *Beb_send_data; - -int Beb_recv_ndata; -unsigned int Beb_recv_buffer_size; -unsigned int *Beb_recv_data_raw; -unsigned int *Beb_recv_data; - short Beb_bit_mode; int BEB_MMAP_SIZE = 0x1000; @@ -47,28 +36,6 @@ int Beb_deactivated_right_datastream = 1; int Beb_deactivated_num_destinations = 1; int Beb_Beb() { - Beb_send_ndata = 0; - Beb_send_buffer_size = 1026; - - Beb_send_data_raw = - malloc((Beb_send_buffer_size + 1) * sizeof(unsigned int)); - if (Beb_send_data_raw == NULL) { - LOG(logERROR, ("Could not allocate memory for beb (send_data_raw)\n")); - return 0; - } - Beb_send_data = &Beb_send_data_raw[1]; - - Beb_recv_ndata = 0; - Beb_recv_buffer_size = 1026; - - Beb_recv_data_raw = - malloc((Beb_recv_buffer_size + 1) * sizeof(unsigned int)); - if (Beb_recv_data_raw == NULL) { - LOG(logERROR, ("Could not allocate memory for beb (recv_data_raw)\n")); - return 0; - } - Beb_recv_data = &Beb_recv_data_raw[1]; - udp_header = (struct udp_header_type){ {0x00, 0x50, 0xc5, 0xb2, 0xcb, 0x46}, // DST MAC {0x00, 0x50, 0xc2, 0x46, 0xd9, 0x02}, // SRC MAC @@ -157,19 +124,12 @@ int Beb_SetHeaderData(uint64_t src_mac, uint32_t src_ip, uint16_t src_port, memcpy(&(udp_header.dst_port[0]), &dst_port, sizeof(udp_header.dst_port)); Beb_AdjustIPChecksum(&udp_header); - - unsigned int *base_ptr = (unsigned int *)&udp_header; - unsigned int num_words = (sizeof(struct udp_header_type) + 3) / 4; - for (unsigned int i = 0; i < num_words; i++) - Beb_send_data[i + 2] = base_ptr[i]; - for (unsigned int i = num_words; i < 16; i++) - Beb_send_data[i + 2] = 0; - return 1; } void Beb_AdjustIPChecksum(struct udp_header_type *ip) { - unsigned char *cptr = (unsigned char *)ip->ver_headerlen; + unsigned char *cptr = + (unsigned char *)ip + offsetof(struct udp_header_type, ver_headerlen); ip->ip_header_checksum[0] = 0; ip->ip_header_checksum[1] = 0; @@ -372,7 +332,7 @@ int Beb_SetTop(enum TOPINDEX ind) { } char *top_names[] = {TOP_NAMES}; - int newval = Beb_Write32(csp0base, BEB_CONFIG_WR_OFST, value); + u_int32_t newval = Beb_Write32(csp0base, BEB_CONFIG_WR_OFST, value); if (newval != value) { LOG(logERROR, ("Could not set Top flag to %s in Beb\n", top_names[ind])); @@ -417,7 +377,7 @@ int Beb_SetMaster(enum MASTERINDEX ind) { } char *master_names[] = {MASTER_NAMES}; - int newval = Beb_Write32(csp0base, BEB_CONFIG_WR_OFST, value); + u_int32_t newval = Beb_Write32(csp0base, BEB_CONFIG_WR_OFST, value); if (newval != value) { LOG(logERROR, ("Could not set Master flag to %s in Beb\n", master_names[ind])); @@ -1167,7 +1127,7 @@ int Beb_SetDetectorPosition(int pos[]) { value | ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK)); value = Beb_Read32(csp0base, UDP_HEADER_B_LEFT_OFST); if ((value & UDP_HEADER_Y_MSK) != - ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK)) { + (uint32_t)((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK)) { LOG(logERROR, ("Could not set column position for left port\n")); ret = FAIL; } @@ -1180,7 +1140,7 @@ int Beb_SetDetectorPosition(int pos[]) { value | ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK)); value = Beb_Read32(csp0base, UDP_HEADER_B_RIGHT_OFST); if ((value & UDP_HEADER_Y_MSK) != - ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK)) { + (uint32_t)((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK)) { LOG(logERROR, ("Could not set column position for right port\n")); ret = FAIL; } @@ -1379,9 +1339,7 @@ int Beb_open(u_int32_t **csp0base, u_int32_t offset) { } u_int32_t Beb_Read32(u_int32_t *baseaddr, u_int32_t offset) { - volatile u_int32_t value; - value = *(u_int32_t *)(baseaddr + offset / (sizeof(u_int32_t))); - return value; + return *(volatile u_int32_t *)(baseaddr + offset / sizeof(u_int32_t)); } u_int32_t Beb_Write32(u_int32_t *baseaddr, u_int32_t offset, u_int32_t data) { diff --git a/slsDetectorServers/eigerDetectorServer/FebControl.c b/slsDetectorServers/eigerDetectorServer/FebControl.c index f0b96d487..424fb0cc2 100644 --- a/slsDetectorServers/eigerDetectorServer/FebControl.c +++ b/slsDetectorServers/eigerDetectorServer/FebControl.c @@ -4,6 +4,7 @@ #include "Beb.h" #include "FebRegisterDefs.h" #include "clogger.h" +#include "common.h" #include "sharedMemory.h" #include "slsDetectorServer_defs.h" @@ -45,7 +46,6 @@ int64_t Feb_Control_RateTable_Tau_in_nsec = -1; int64_t Feb_Control_RateTable_Period_in_nsec = -1; unsigned int Feb_Control_rate_correction_table[1024] = {}; double Feb_Control_rate_meas[16384] = {}; -double ratemax = -1; // setup void Feb_Control_activate(int activate) { Feb_Control_activated = activate; } @@ -137,13 +137,6 @@ void Feb_Control_CloseSerialCommunication() { int Feb_Control_CheckSetup(int master) { LOG(logDEBUG1, ("Checking Set up\n")); - - for (unsigned int j = 0; j < 4; j++) { - if (Feb_Control_idelay[j] < 0) { - LOG(logERROR, ("idelay chip %d not set.\n", j)); - return 0; - } - } int value = 0; if ((Feb_Control_master) && (!Feb_Control_GetHighVoltage(&value))) { LOG(logERROR, ("high voltage not set.\n")); @@ -403,13 +396,14 @@ int Feb_Control_ReceiveHighVoltage(unsigned int *value) { // normal if (Feb_Control_normal) { + int retval = 0; if (readParameterFromFile(NORMAL_HIGHVOLTAGE_INPUTPORT, "high voltage", - value) == FAIL) { + &retval) == FAIL) { LOG(logERROR, ("Could not get high voltage\n")); return 0; } - *value /= 10; - LOG(logINFO, ("High Voltage: %d\n", (*value))); + *value = retval / 10; + LOG(logINFO, ("High Voltage: %u\n", (*value))); } // 9m @@ -490,7 +484,7 @@ float Feb_Control_DACToVoltage(unsigned int digital, unsigned int nsteps, int Feb_Control_SetDAC(unsigned int ch, int value) { unsigned int dst_num = Feb_Control_rightAddress; - if (ch < 0 || ch > 15) { + if (ch > 15) { LOG(logERROR, ("invalid ch for SetDAC.\n")); return 0; } @@ -662,7 +656,7 @@ int Feb_Control_SetTrimbits(unsigned int *trimbits, int top) { int Feb_Control_SaveAllTrimbitsTo(int value, int top) { unsigned int chanregs[Feb_Control_trimbit_size]; - for (int i = 0; i < Feb_Control_trimbit_size; i++) + for (int i = 0; i < (int)Feb_Control_trimbit_size; i++) chanregs[i] = value; return Feb_Control_SetTrimbits(chanregs, top); } @@ -1980,6 +1974,7 @@ int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec) { unsigned int np = 16384; // max slope 16 * 1024 double b0[1024]; double m[1024]; + double ratemax = -1; if (tau_in_sec < 0 || period_in_sec < 0) { if (dr == 32) { @@ -1997,7 +1992,7 @@ int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec) { LOG(logINFO, ("Changing Rate Correction Table tau:%0.8f sec, period:%f sec", tau_in_sec, period_in_sec)); LOG(logINFO, ("\tCalculating table for tau of %lld ns.\n", tau_in_Nsec)); - for (int i = 0; i < np; i++) { + for (int i = 0; i < (int)np; i++) { Feb_Control_rate_meas[i] = i * exp(-i / period_in_sec * tau_in_sec); if (Feb_Control_rate_meas[i] > ratemax) ratemax = Feb_Control_rate_meas[i]; @@ -2020,7 +2015,7 @@ int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec) { */ int next_i = 0; - double beforemax; + double beforemax = 0; b0[0] = 0; m[0] = 1; @@ -2030,8 +2025,9 @@ int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec) { for (int b = 1; b < 1024; b++) { if (m[b - 1] < 15) { double s = 0, sx = 0, sy = 0, sxx = 0, sxy = 0; + int filled = 0; for (;; next_i++) { - if (next_i >= np) { + if (next_i >= (int)np) { for (; b < 1024; b++) { if (beforemax > ratemax) b0[b] = beforemax; @@ -2042,7 +2038,7 @@ int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec) { (((int)(m[b] + 0.5) & 0xf) << 14) | ((int)(b0[b] + 0.5) & 0x3fff); } - b = 1024; + filled = 1; break; } @@ -2067,6 +2063,8 @@ int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec) { Feb_Control_rate_meas[next_i]: %f\n", x, y, s, sx, sy, sxx, sxy, next_i, b, Feb_Control_rate_meas[next_i]));*/ } + if (filled) + break; double delta = s * sxx - sx * sx; b0[b] = (sxx * sy - sx * sxy) / delta; m[b] = (s * sxy - sx * sy) / delta; diff --git a/slsDetectorServers/eigerDetectorServer/FebControl.h b/slsDetectorServers/eigerDetectorServer/FebControl.h index 63025554f..52908e79f 100644 --- a/slsDetectorServers/eigerDetectorServer/FebControl.h +++ b/slsDetectorServers/eigerDetectorServer/FebControl.h @@ -119,6 +119,7 @@ int Feb_Control_PrintCorrectedValues(); // adcs int Feb_Control_GetLeftFPGATemp(); int Feb_Control_GetRightFPGATemp(); +int Feb_Control_GetFPGAHardwareVersion(int *retval); int64_t Feb_Control_GetFrontLeftFirmwareVersion(); int64_t Feb_Control_GetFrontRightFirmwareVersion(); int64_t Feb_Control_GetMeasuredPeriod(); diff --git a/slsDetectorServers/eigerDetectorServer/HardwareIO.c b/slsDetectorServers/eigerDetectorServer/HardwareIO.c index 7e783d5d2..6ee3b3576 100644 --- a/slsDetectorServers/eigerDetectorServer/HardwareIO.c +++ b/slsDetectorServers/eigerDetectorServer/HardwareIO.c @@ -8,7 +8,10 @@ xfs_u8 HWIO_xfs_in8(xfs_u32 InAddress) { */ xfs_u8 IoContents; - __asm__ volatile("eieio; lbz %0,0(%1)" : "=r"(IoContents) : "b"(InAddress)); + __asm__ volatile("eieio; lbz %0,0(%1)" + : "=r"(IoContents) + : "b"(InAddress) + : "memory"); return IoContents; } @@ -20,7 +23,10 @@ xfs_u16 HWIO_xfs_in16(xfs_u32 InAddress) { */ xfs_u16 IoContents; - __asm__ volatile("eieio; lhz %0,0(%1)" : "=r"(IoContents) : "b"(InAddress)); + __asm__ volatile("eieio; lhz %0,0(%1)" + : "=r"(IoContents) + : "b"(InAddress) + : "memory"); return IoContents; } @@ -32,7 +38,10 @@ xfs_u32 HWIO_xfs_in32(xfs_u32 InAddress) { */ xfs_u32 IoContents; - __asm__ volatile("eieio; lwz %0,0(%1)" : "=r"(IoContents) : "b"(InAddress)); + __asm__ volatile("eieio; lwz %0,0(%1)" + : "=r"(IoContents) + : "b"(InAddress) + : "memory"); return IoContents; } @@ -43,7 +52,8 @@ void HWIO_xfs_out8(xfs_u32 OutAddress, xfs_u8 Value) { * such that the I/O operation completes before proceeding on */ - __asm__ volatile("stb %0,0(%1); eieio" ::"r"(Value), "b"(OutAddress)); + __asm__ volatile("stb %0,0(%1); eieio" ::"r"(Value), "b"(OutAddress) + : "memory"); } /*****************************************************************************/ @@ -52,7 +62,8 @@ void HWIO_xfs_out16(xfs_u32 OutAddress, xfs_u16 Value) { * such that the I/O operation completes before proceeding on */ - __asm__ volatile("sth %0,0(%1); eieio" ::"r"(Value), "b"(OutAddress)); + __asm__ volatile("sth %0,0(%1); eieio" ::"r"(Value), "b"(OutAddress) + : "memory"); } /*****************************************************************************/ @@ -62,5 +73,6 @@ void HWIO_xfs_out32(xfs_u32 OutAddress, xfs_u32 Value) { * such that the I/O operation completes before proceeding on */ - __asm__ volatile("stw %0,0(%1); eieio" ::"r"(Value), "b"(OutAddress)); + __asm__ volatile("stw %0,0(%1); eieio" ::"r"(Value), "b"(OutAddress) + : "memory"); } diff --git a/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.c b/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.c index c9252cf55..310d6df75 100644 --- a/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.c +++ b/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.c @@ -95,7 +95,7 @@ int Local_Write(struct LocalLinkInterface *ll, unsigned int buffer_len, LOG(logDEBUG1, ("LL Write - Len: %2d - If: %X - Data: ", buffer_len, ll->ll_fifo_base)); - for (int i = 0; i < buffer_len / 4; i++) + for (int i = 0; i < (int)buffer_len / 4; i++) LOG(logDEBUG1, ("%.8X ", *(((unsigned *)buffer) + i))); while (words_send <= last_word) { diff --git a/slsDetectorServers/eigerDetectorServer/Makefile b/slsDetectorServers/eigerDetectorServer/Makefile index 57f8e0b16..f4061b01f 100755 --- a/slsDetectorServers/eigerDetectorServer/Makefile +++ b/slsDetectorServers/eigerDetectorServer/Makefile @@ -10,7 +10,7 @@ script_dir = ../../etc/ BLACKFIN_CC = bfin-uclinux-gcc CROSS = powerpc-4xx-softfloat- CC = $(CROSS)gcc -CFLAGS += -Wall -std=gnu99 -DEIGERD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE +CFLAGS += -O2 -Wall -Wextra -Wno-unused-parameter -Wformat=2 -Wredundant-decls -Werror=return-type -std=gnu99 -DEIGERD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE LDLIBS += -lm -lrt -pthread PROGS = eigerDetectorServer DESTDIR = bin diff --git a/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer b/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer new file mode 100755 index 000000000..c7b451b14 Binary files /dev/null and b/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer differ diff --git a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c index f2290afbe..68c48ff26 100644 --- a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c @@ -890,7 +890,7 @@ int getDefaultDac(enum DACINDEX index, enum detectorSettings sett, if (sett != UNDEFINED) { return FAIL; } - if (index < 0 || index >= NDAC) + if (index >= NDAC) return FAIL; *retval = defaultDacValues[index]; return OK; @@ -900,7 +900,7 @@ int setDefaultDac(enum DACINDEX index, enum detectorSettings sett, int value) { if (sett != UNDEFINED) { return FAIL; } - if (index < 0 || index >= NDAC) + if (index >= NDAC) return FAIL; char *dac_names[] = {DAC_NAMES}; @@ -1441,7 +1441,7 @@ void setDAC(enum DACINDEX ind, int val, int mV) { } // validate index - if (ind < 0 || ind >= NDAC) { + if (ind >= NDAC) { LOG(logERROR, ("\tDac index %d is out of bounds (0 to %d)\n", ind, NDAC - 1)); return; diff --git a/slsDetectorServers/gotthard2DetectorServer/Makefile b/slsDetectorServers/gotthard2DetectorServer/Makefile index 47659ccbe..a5fdbae8b 100755 --- a/slsDetectorServers/gotthard2DetectorServer/Makefile +++ b/slsDetectorServers/gotthard2DetectorServer/Makefile @@ -9,7 +9,7 @@ script_dir = ../../etc/ CROSS = nios2-buildroot-linux-gnu- CC = $(CROSS)gcc -CFLAGS += -Wall -std=gnu99 -DGOTTHARD2D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE +CFLAGS += -O2 -Wall -Wextra -Wno-unused-parameter -Wformat=2 -Wredundant-decls -Werror=return-type -std=gnu99 -DGOTTHARD2D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE LDLIBS += -lm -lrt -pthread PROGS = gotthard2DetectorServer DESTDIR ?= bin diff --git a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer new file mode 100755 index 000000000..0f9b4d701 Binary files /dev/null and b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer differ diff --git a/slsDetectorServers/jungfrauDetectorServer/Makefile b/slsDetectorServers/jungfrauDetectorServer/Makefile index b131b6340..d811eeb9a 100755 --- a/slsDetectorServers/jungfrauDetectorServer/Makefile +++ b/slsDetectorServers/jungfrauDetectorServer/Makefile @@ -9,8 +9,10 @@ script_dir = ../../etc/ CROSS = bfin-uclinux- CC = $(CROSS)gcc -CFLAGS += -Wall -std=gnu99 -DJUNGFRAUD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DVERBOSEI #-DVERBOSE +CFLAGS += -O2 -Wall -Wextra -Wno-unused-parameter -Wformat=2 -Wredundant-decls -Werror=return-type -std=gnu99 -DJUNGFRAUD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DVERBOSEI #-DVERBOSE LDLIBS += -lm -lrt -pthread +# FLAT stack size: elf2flt defaults to 4 KB, the update and startup paths need more than 8 KB +LDLIBS += -Wl,-elf2flt=-s262144 PROGS = jungfrauDetectorServer DESTDIR ?= bin INSTMODE = 0777 diff --git a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer new file mode 100755 index 000000000..a856ddc6e Binary files /dev/null and b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer differ diff --git a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c index c3c5987a8..09db13a8d 100644 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c @@ -405,7 +405,7 @@ int setChipIndex(enum CHIPINDEX ind, char *mess) { } int validateChipIndex(enum CHIPINDEX ind, char *mess) { - if (ind < 0 || ind >= NUM_CHIP_INDICES) { + if (ind >= NUM_CHIP_INDICES) { sprintf(mess, "Invalid chip index %d. Options: %s\n", (int)ind, CHIP_VALS_HELP); LOG(logERROR, (mess)); @@ -833,7 +833,7 @@ int getDefaultDac(enum DACINDEX index, enum detectorSettings sett, return FAIL; } - if (index < 0 || index >= NDAC) + if (index >= NDAC) return FAIL; *retval = defaultDacValues[index]; return OK; @@ -869,7 +869,7 @@ int setDefaultDac(enum DACINDEX index, enum detectorSettings sett, int value) { // not a special dac return FAIL; } - if (index < 0 || index >= NDAC) + if (index >= NDAC) return FAIL; LOG(logINFO, ("Setting Default Dac [%d - %s]: %d\n", (int)index, dac_names[index], value)); diff --git a/slsDetectorServers/moenchDetectorServer/Makefile b/slsDetectorServers/moenchDetectorServer/Makefile index 9578f2139..2fa63072e 100755 --- a/slsDetectorServers/moenchDetectorServer/Makefile +++ b/slsDetectorServers/moenchDetectorServer/Makefile @@ -9,8 +9,10 @@ script_dir = ../../etc/ CROSS = bfin-uclinux- CC = $(CROSS)gcc -CFLAGS += -Wall -std=gnu99 -DMOENCHD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DVERBOSEI #-DVERBOSE +CFLAGS += -O2 -Wall -Wextra -Wno-unused-parameter -Wformat=2 -Wredundant-decls -Werror=return-type -std=gnu99 -DMOENCHD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DVERBOSEI #-DVERBOSE LDLIBS += -lm -lrt -pthread +# FLAT stack size: elf2flt defaults to 4 KB, the update and startup paths need more than 8 KB +LDLIBS += -Wl,-elf2flt=-s262144 PROGS = moenchDetectorServer DESTDIR ?= bin INSTMODE = 0777 diff --git a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer new file mode 100755 index 000000000..6d4ac74fd Binary files /dev/null and b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer differ diff --git a/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c index bebb87f8f..4e1601d01 100644 --- a/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c @@ -546,7 +546,7 @@ int resetToDefaultDacs(int hardReset) { int getDefaultDac(enum DACINDEX index, enum detectorSettings sett, int *retval) { - if (index < 0 || index >= NDAC) + if (index >= NDAC) return FAIL; *retval = defaultDacValues[index]; return OK; @@ -554,7 +554,7 @@ int getDefaultDac(enum DACINDEX index, enum detectorSettings sett, int setDefaultDac(enum DACINDEX index, enum detectorSettings sett, int value) { char *dac_names[] = {DAC_NAMES}; - if (index < 0 || index >= NDAC) + if (index >= NDAC) return FAIL; LOG(logINFO, ("Setting Default Dac [%d - %s]: %d\n", (int)index, dac_names[index], value)); diff --git a/slsDetectorServers/mythen3DetectorServer/Makefile b/slsDetectorServers/mythen3DetectorServer/Makefile index a08c71cde..4597d429a 100755 --- a/slsDetectorServers/mythen3DetectorServer/Makefile +++ b/slsDetectorServers/mythen3DetectorServer/Makefile @@ -10,7 +10,7 @@ script_dir = ../../etc/ CROSS = nios2-buildroot-linux-gnu- CC = $(CROSS)gcc -CFLAGS += -Wall -std=gnu99 -DMYTHEN3D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(det_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE +CFLAGS += -O2 -Wall -Wextra -Wno-unused-parameter -Wformat=2 -Wredundant-decls -Werror=return-type -std=gnu99 -DMYTHEN3D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(det_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE LDLIBS += -lm -lrt -pthread PROGS = mythen3DetectorServer DESTDIR ?= bin diff --git a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer new file mode 100755 index 000000000..1d18a3048 Binary files /dev/null and b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer differ diff --git a/slsDetectorServers/xilinx_ctbDetectorServer/Makefile b/slsDetectorServers/xilinx_ctbDetectorServer/Makefile index 363871131..78e0b8ccd 100755 --- a/slsDetectorServers/xilinx_ctbDetectorServer/Makefile +++ b/slsDetectorServers/xilinx_ctbDetectorServer/Makefile @@ -16,7 +16,7 @@ else endif CC = $(CROSS)gcc #TODO: allow these warnings and fix code -CFLAGS += -Wall -std=gnu99 -Wno-format-overflow -Wno-format-truncation -DXILINX_CHIPTESTBOARDD -DARMPROCESSOR -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(det_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE +CFLAGS += -O2 -Wall -Wextra -Wno-unused-parameter -Wformat=2 -Wredundant-decls -Werror=return-type -std=gnu99 -Wno-format-overflow -Wno-format-truncation -DXILINX_CHIPTESTBOARDD -DARMPROCESSOR -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(det_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE #CFLAGS += -Wall -std=gnu99 -DXILINX_CHIPTESTBOARDD -DARMPROCESSOR -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(det_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE LDLIBS += -lm -lrt -pthread PROGS = xilinx_ctbDetectorServer diff --git a/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer b/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer index dc3031386..70a982232 100755 Binary files a/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer and b/slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServer_developer differ diff --git a/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c index 7eb731c98..817c19584 100644 --- a/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c @@ -143,7 +143,7 @@ void basictests() { } // check for API compatibility - old server - if (sw_fw_apiversion > requiredfwversion) { + if ((uint64_t)sw_fw_apiversion > requiredfwversion) { sprintf(initErrorMessage, "This firmware-software api version (0x%lx) is incompatible " "with the software's minimum required firmware version " @@ -156,7 +156,7 @@ void basictests() { } // check for firmware compatibility - old firmware - if (requiredfwversion > fwversion) { + if (requiredfwversion > (uint64_t)fwversion) { sprintf(initErrorMessage, "This firmware version (0x%lx) is incompatible.\n" "Please update firmware (min. 0x%lx) to be compatible with " diff --git a/slsSupportLib/include/sls/versionAPI.h b/slsSupportLib/include/sls/versionAPI.h index 1199bfb5f..62315c168 100644 --- a/slsSupportLib/include/sls/versionAPI.h +++ b/slsSupportLib/include/sls/versionAPI.h @@ -3,10 +3,10 @@ /** API versions */ #define APILIB "10.1.0 0x260806" #define APIRECEIVER "10.1.0 0x260806" -#define APICTB "10.0.0 0x250828" -#define APIGOTTHARD2 "10.0.0 0x250828" -#define APIMOENCH "10.0.0 0x250828" -#define APIEIGER "10.1.0 0x260807" -#define APIXILINXCTB "10.0.0 0x250828" -#define APIJUNGFRAU "10.1.0 0x261002" -#define APIMYTHEN3 "10.1.0 0x261022" +#define APICTB "10.1.0 0x261028" +#define APIGOTTHARD2 "10.1.0 0x261028" +#define APIMOENCH "10.1.0 0x261028" +#define APIEIGER "10.1.0 0x261028" +#define APIXILINXCTB "10.1.0 0x261028" +#define APIJUNGFRAU "10.1.0 0x261028" +#define APIMYTHEN3 "10.1.0 0x261028"