jungfrau server: incorporated transmission delay

This commit is contained in:
Dhanya Maliakal 2018-01-11 11:33:26 +01:00
parent 8fc3d97e78
commit d879379aa4
5 changed files with 44 additions and 10 deletions

View File

@ -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 */

View File

@ -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 */

View File

@ -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

View File

@ -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) {

View File

@ -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;