enum for idac works now..

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@618 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2013-06-20 08:45:43 +00:00
parent 8081580441
commit dc06c6e40e
3 changed files with 72 additions and 20 deletions

View File

@ -4,6 +4,7 @@
#define SLS_DETECTOR_FUNCTION_LIST_H
#include "sls_detector_defs.h"
#include "slsDetectorServer_defs.h"
#include <stdlib.h>
@ -33,6 +34,8 @@ Here are the definitions, but the actual implementation should be done for each
****************************************************/
int mapCSP0(void);
int initializeDetectorStructure();
int setupDetector();
@ -46,8 +49,8 @@ int moduleTest( enum digitalTestMode arg, int imod);
int detectorTest( enum digitalTestMode arg);
double setDAC(enum dacIndex ind, double val, int imod);
double getADC(enum dacIndex ind, int imod);
int setDAC(enum detDacIndex ind, int val, int imod);
int getADC(enum detDacIndex ind, int imod);
#if defined(MYTHEND) || defined(GOTTHARDD)
u_int32_t writeRegister(u_int32_t offset, u_int32_t data);
@ -64,7 +67,7 @@ int getChip(sls_detector_chip *myChip);
int setModule(sls_detector_module myChan);
int getModule(sls_detector_module *myChan);
enum detectorSettings setSettings(enum detectorSettings sett, int imod);
enum detDacIndex setSettings(enum detDacIndex sett, int imod);
#if defined(MYTHEND) || defined(EIGERD)
int getThresholdEnergy(int imod);

View File

@ -5,7 +5,6 @@
#include "slsDetectorServer_funcs.h"
#include "slsDetectorFunctionList.h"
#include "slsDetectorServer_defs.h"
#include "communication_funcs.h"
@ -30,13 +29,8 @@ const enum detectorType myDetectorType=PICASSO;
#else
const enum detectorType myDetectorType=GENERIC;
#endif
//define in communication_funcs
/*
extern int lockStatus;
extern char lastClientIP[INET_ADDRSTRLEN];
extern char thisClientIP[INET_ADDRSTRLEN];
extern int differentClients;
*/
//global variables for optimized readout
char mess[1000];
char *dataretval=NULL;
@ -997,6 +991,7 @@ int set_dac(int file_des) {
int imod;
int n;
int val;
enum detDacIndex idac=0;
sprintf(mess,"Can't set DAC\n");
@ -1015,9 +1010,6 @@ int set_dac(int file_des) {
ret=FAIL;
}
#ifdef VERBOSE
printf("Setting DAC %d of module %d to %f V\n", ind, imod, val);
#endif
#ifdef SLS_DETECTOR_FUNCTION_LIST
if (imod>=getTotalNumberOfModules()) {
ret=FAIL;
@ -1060,6 +1052,56 @@ int set_dac(int file_des) {
break;
case HV_POT:
break;
#endif
#ifdef EIGERD
case E_SvP:
ind = SVP;
break;
case E_SvN:
ind = SVN;
break;
case E_Vtr:
idac = VTR;
break;
case E_Vrf:
idac = VRF;
break;
case E_Vrs:
idac = VRS;
break;
case E_Vtgstv:
idac = VTGSTV;
break;
case E_Vcmp_ll:
idac = VCMP_LL;
break;
case E_Vcmp_lr:
idac = VCMP_LR;
break;
case E_cal:
idac = CAL;
break;
case E_Vcmp_rl:
idac = VCMP_RL;
break;
case E_Vcmp_rr:
idac = VCMP_RR;
break;
case E_rxb_rb:
idac = RXB_RB;
break;
case E_rxb_lb:
idac = RXB_LB;
break;
case E_Vcp:
idac = VCP;
break;
case E_Vcn:
idac = VCN;
break;
case E_Vis:
idac = VIS;
break;
#endif
default:
printf("Unknown DAC index %d\n",ind);
@ -1067,17 +1109,22 @@ int set_dac(int file_des) {
ret=FAIL;
break;
}
#ifdef VERBOSE
printf("Setting DAC %d of module %d to %d V\n", idac, imod, val);
#endif
#ifdef SLS_DETECTOR_FUNCTION_LIST
if (ret==OK) {
if (differentClients==1 && lockStatus==1 && val!=-1) {
ret=FAIL;
sprintf(mess,"Detector locked by %s\n",lastClientIP);
} else
retval=setDAC(ind,val,imod);
} else{
printf("idac:%d val:%d, imod:%d\n",(int)idac,val,imod);
retval=setDAC(idac,val,imod);
}
}
#endif
#ifdef VERBOSE
printf("DAC set to %f V\n", retval);
printf("DAC set to %d V\n", retval);
#endif
if (retval==val || val==-1) {
ret=OK;
@ -1085,7 +1132,7 @@ int set_dac(int file_des) {
ret=FORCE_UPDATE;
} else {
ret=FAIL;
printf("Setting dac %d of module %d: wrote %d but read %d\n", ind, imod, val, retval);
printf("Setting dac %d of module %d: wrote %d but read %d\n", idac, imod, val, retval);
}
@ -1647,9 +1694,9 @@ int set_module(int file_des) {
ret=FAIL;
}
myModule.ndac=getNumberOfDACsPerModule();
myModule.nchip=getNumberOfChipsPerModule();
myModule.nchan=getNumberOfChannelsPerModule();
myModule.ndac=getNumberOfDACsPerModule();
myModule.nadc=getNumberOfADCsPerModule();

View File

@ -2,6 +2,7 @@
#define SERVER_FUNCS_H
#include "sls_detector_defs.h"
#include "slsDetectorServer_defs.h"
#include <stdlib.h>
@ -9,6 +10,7 @@
int sockfd;
//basic server functions
int init_detector(int);
int decode_function(int);