diff --git a/slsDetectorSoftware/jungfrauDetectorServer/slsDetectorFunctionList.c b/slsDetectorSoftware/jungfrauDetectorServer/slsDetectorFunctionList.c index c043d33bc..fe9758c49 100644 --- a/slsDetectorSoftware/jungfrauDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorSoftware/jungfrauDetectorServer/slsDetectorFunctionList.c @@ -1146,6 +1146,24 @@ void configurePll() { +int setNetworkParameter(enum NETWORKINDEX mode, int value) { + if (mode != TXN_FRAME) + return -1;\ + + if (value >= 0) { + printf("\nSetting transmission delay: %d\n", value); + bus_w(CONFIG_REG, ((value << CONFIG_TDMA_TIMESLOT_OFST) & CONFIG_TDMA_TIMESLOT_MSK)); +#ifdef VERBOSE + printf("Transmission delay set to %d\n", ((bus_r(CONFIG_REG) & CONFIG_TDMA_TIMESLOT_MSK) >> CONFIG_TDMA_TIMESLOT_OFST)); +#endif + } + + return ((bus_r(CONFIG_REG) & CONFIG_TDMA_TIMESLOT_MSK) >> CONFIG_TDMA_TIMESLOT_OFST); +} + + + + /* aquisition */ diff --git a/slsDetectorSoftware/jungfrauDetectorServer/slsDetectorServer_defs.h b/slsDetectorSoftware/jungfrauDetectorServer/slsDetectorServer_defs.h index c5830ce0b..351d2a087 100644 --- a/slsDetectorSoftware/jungfrauDetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorSoftware/jungfrauDetectorServer/slsDetectorServer_defs.h @@ -49,13 +49,14 @@ enum DACINDEX {VB_COMP, VDD_PROT, VIN_COM, VREF_PRECH, VB_PIXBUF, VB_DS, VREF 0x1f00, /* FORCESWITCHG1 */ \ 0x3f00 /* FORCESWITCHG2 */ \ }; -#define DEFAULT_SETT_NAMES { "Dynamic Gain", /* DYNAMICGAIN */ \ +#define DEFAULT_SETT_NAMES { "Dynamic Gain", /* DYNAMICGAIN */ \ "Dynamic High Gain 0", /* DYNAMICHG0 */ \ "Fix Gain 1", /* FIXGAIN1 */ \ "Fix Gain 2", /* FIXGAIN2 */ \ "Force Switch Gain 1", /* FORCESWITCHG1*/ \ "Force Switch Gain 2" /* FORCESWITCHG2*/ \ - }; + }; +enum NETWORKINDEX { TXN_FRAME }; @@ -89,6 +90,7 @@ enum DACINDEX {VB_COMP, VDD_PROT, VIN_COM, VREF_PRECH, VB_PIXBUF, VB_DS, VREF /* Defines in the Firmware */ #define FIX_PATT_VAL (0xACDC2014) #define ADC_PORT_INVERT_VAL (0x453b2a9c) +#define MAX_TIMESLOT_VAL (0x1F) #define SAMPLE_ADC_HALF_SPEED (SAMPLE_DECMT_FACTOR_2_VAL + SAMPLE_DGTL_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_0_VAL + SAMPLE_ADC_SAMPLE_0_VAL) /* 0x1000 */ diff --git a/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h b/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h index e789374d2..149a76dbc 100644 --- a/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h +++ b/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h @@ -192,7 +192,9 @@ int setAllTrimbits(int val); int getAllTrimbits(); int getBebFPGATemp(); int activate(int enable); -int setNetworkParameter(enum NETWORKINDEX mode, int value); +#endif +#if defined(JUNGFRAUD) || defined(EIGERD) +int setNetworkParameter(enum NETWORKINDEX mode, int value); #endif diff --git a/slsDetectorSoftware/slsDetectorServer/slsDetectorServer.c b/slsDetectorSoftware/slsDetectorServer/slsDetectorServer.c index 8e1157980..c11201893 100755 --- a/slsDetectorSoftware/slsDetectorServer/slsDetectorServer.c +++ b/slsDetectorSoftware/slsDetectorServer/slsDetectorServer.c @@ -83,8 +83,10 @@ int main(int argc, char *argv[]){ printf("function table assigned \n"); #endif - - printf("\nReady...\n\n"); + if (b) + printf("\nControl Server Ready...\n\n"); + else + printf("\nStop Server Ready...\n\n"); /* waits for connection */ while(retval!=GOODBYE) { diff --git a/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c b/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c index dcb91b293..4b72e2c26 100755 --- a/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c +++ b/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c @@ -4405,7 +4405,7 @@ int set_network_parameter(int file_des) { int retval=-1; sprintf(mess,"set network parameter failed\n"); -#ifndef EIGERD +#if !defined(EIGERD) && !defined(JUNGFRAUD) //to receive any arguments while (n > 0) n = receiveData(file_des,mess,MAX_STR_LENGTH,OTHER); @@ -4426,7 +4426,7 @@ int set_network_parameter(int file_des) { if (n < 0) return printSocketReadError(); // execute action - if (differentClients && lockStatus && value<0) { + if (differentClients && lockStatus && value >= 0) { ret = FAIL; sprintf(mess,"Detector locked by %s\n",lastClientIP); cprintf(RED, "Warning: %s", mess); @@ -4437,17 +4437,27 @@ int set_network_parameter(int file_des) { printf("setting network parameter mode %d to %d\n",(int)mode,value); #endif switch (mode) { + +#ifdef EIGERD + case FLOW_CONTROL_10G: + index = FLOWCTRL_10G; + break; case DETECTOR_TXN_DELAY_LEFT: index = TXN_LEFT; break; case DETECTOR_TXN_DELAY_RIGHT: index = TXN_RIGHT; break; +#endif case DETECTOR_TXN_DELAY_FRAME: index = TXN_FRAME; - break; - case FLOW_CONTROL_10G: - index = FLOWCTRL_10G; +#ifdef JUNGFRAUD + if (value > MAX_TIMESLOT_VAL) { + ret=FAIL; + sprintf(mess,"Transmission delay %d should be in range: 0 - 31\n", value); + cprintf(RED, "Warning: %s", mess); + } +#endif break; default: ret=FAIL;