From 9c86c36534dae5fe0e2e4015ac4e887c849ccfc3 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Tue, 27 Oct 2026 16:57:12 +0100 Subject: [PATCH] fixed new eiger warnings --- slsDetectorServers/eigerDetectorServer/Beb.c | 12 +++++++----- .../eigerDetectorServer/FebControl.c | 15 ++++----------- .../eigerDetectorServer/LocalLinkInterface.c | 2 +- .../eigerDetectorServer/slsDetectorFunctionList.c | 6 +++--- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/slsDetectorServers/eigerDetectorServer/Beb.c b/slsDetectorServers/eigerDetectorServer/Beb.c index d08509a15..a9605c05c 100644 --- a/slsDetectorServers/eigerDetectorServer/Beb.c +++ b/slsDetectorServers/eigerDetectorServer/Beb.c @@ -6,6 +6,7 @@ #include "xparameters.h" #include +#include #include #include #include @@ -127,7 +128,8 @@ int Beb_SetHeaderData(uint64_t src_mac, uint32_t src_ip, uint16_t src_port, } 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; @@ -330,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])); @@ -375,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])); @@ -1125,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; } @@ -1138,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; } diff --git a/slsDetectorServers/eigerDetectorServer/FebControl.c b/slsDetectorServers/eigerDetectorServer/FebControl.c index acd24db2f..0d8094d74 100644 --- a/slsDetectorServers/eigerDetectorServer/FebControl.c +++ b/slsDetectorServers/eigerDetectorServer/FebControl.c @@ -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")); @@ -491,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; } @@ -663,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); } @@ -1999,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]; @@ -2034,7 +2027,7 @@ int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec) { 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; 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/slsDetectorFunctionList.c b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c index 0b22df2be..805dc72b2 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}; @@ -1428,7 +1428,7 @@ int setThresholdEnergy(int ev) { /* parameters - dac, adc, hv */ int validateDACIndex(enum DACINDEX ind, char *mess) { // including E_VTHRESHOLD - if (ind < 0 || ind >= NDAC + 1) { + if (ind >= NDAC + 1) { sprintf(mess, "Could not set DAC. Invalid index %d\n", ind); LOG(logERROR, (mess)); return FAIL;