a check in gotthard server to ensure that it is really gotthard and not moench module

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@529 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2013-04-26 12:07:10 +00:00
parent fb47f3d4fc
commit 679a7dfd7e
3 changed files with 12 additions and 96 deletions

View File

@ -1226,9 +1226,9 @@ int setADC(int adc){
reg|=(ACTIVE_ADC_MASK & mask);
bus_w(CHIP_OF_INTRST_REG,reg);
#ifdef DDEBUG
printf("Chip of Intrst Reg:%x\n",bus_r(CHIP_OF_INTRST_REG));
#endif
//#ifdef DDEBUG
printf("Chip of Interest:%x\n",bus_r(CHIP_OF_INTRST_REG));
//#endif
adcConfigured = adc;
@ -1460,22 +1460,15 @@ u_int32_t runState(void) {
int startStateMachine(){
//#ifdef VERBOSE
printf("*******Starting State Machine***************\n");
printf("*******Starting State Machine*******\n");
//#endif
cleanFifo();
// fifoReset(); printf("Starting State Machine\n");
// fifoReset();
now_ptr=(char*)ram_values;
#ifdef SHAREDMEMORY
write_stop_sm(0);
write_status_sm("Started");
#endif
/*
#ifdef MCB_FUNCS
setCSregister(ALLMOD);
clearSSregister(ALLMOD);
#endif
*/
//putout("0000000000000000",ALLMOD);
bus_w16(CONTROL_REG, START_ACQ_BIT | START_EXPOSURE_BIT);
bus_w16(CONTROL_REG, 0x0);
printf("statusreg=%08x\n",bus_r(STATUS_REG));
@ -1487,9 +1480,9 @@ int startStateMachine(){
int stopStateMachine(){
#ifdef VERBOSE
printf("Stopping State Machine\n");
#endif
//#ifdef VERBOSE
printf("*******Stopping State Machine*******\n");
//#endif
#ifdef SHAREDMEMORY
write_stop_sm(1);
write_status_sm("Stopped");
@ -1693,39 +1686,6 @@ u_int32_t* decode_data(int *datain)
int setDynamicRange(int dr) {
/*
int ow;
int nm;
u_int32_t np=getProbes();
#ifdef VERYVERBOSE
printf("probes==%02x\n",np);
#endif
if (dr>0) {
nm=setNMod(-1);
if (dr==1) {
dynamicRange=1;
ow=5;
} else if (dr<=4) {
dynamicRange=4;
ow=4;
} else if (dr<=8) {
dynamicRange=8;
ow=3;
} else if (dr<=16) {
dynamicRange=16;
ow=2;
} else {
dynamicRange=32;
ow=0; //or 1?
}
setCSregister(ALLMOD);
initChipWithProbes(0, ow,np, ALLMOD);
putout("0000000000000000",ALLMOD);
setNMod(nm);
}
*/
return getDynamicRange();
}
@ -1735,46 +1695,6 @@ int setDynamicRange(int dr) {
int getDynamicRange() {
/*
int dr;
u_int32_t shiftin=bus_r(GET_SHIFT_IN_REG);
u_int32_t outmux=(shiftin >> OUTMUX_OFF) & OUTMUX_MASK;
u_int32_t probes=(shiftin >> PROBES_OFF) & PROBES_MASK;
#ifdef VERYVERBOSE
printf("%08x ",shiftin);
printf("outmux=%02x probes=%d\n",outmux,probes);
#endif
switch (outmux) {
case 2:
dr=16;
break;
case 4:
dr=8;
break;
case 8:
dr=4;
break;
case 16:
dr=1;
break;
default:
dr=32;
}
dynamicRange=dr;
if (probes==0) {
dataBytes=nModX*nModY*NCHIP*NCHAN*dynamicRange/8;
} else {
dataBytes=nModX*nModY*NCHIP*NCHAN*4;///
}
#ifdef VERBOSE
printf("Number of data bytes %d - probes %d dr %d\n", dataBytes, probes, dr);
#endif
if (allocateRAM()==OK) {
;
} else
printf("ram not allocated\n");
*/
dynamicRange=16;
return dynamicRange;

View File

@ -62,29 +62,26 @@ int init_detector( int b) {
//confirm if it is really gotthard
if (((bus_r(PCB_REV_REG) & DETECTOR_TYPE_MASK)>> DETECTOR_TYPE_OFFSET) == MOENCH_MODULE){
printf("This is a MOENCH detector. Exiting Gotthard Server.\n");
printf("This is a MOENCH detector. Exiting Gotthard Server.\n\n");
exit(-1);
}
if (b) {
printf("***This is a GOTTHARD detector with %d chips per module***\n", NCHIP);
printf("\nBoard Revision:0x%x\n",(bus_r(PCB_REV_REG)&BOARD_REVISION_MASK));
#ifdef MCB_FUNCS
initDetector();
printf("Initializing Detector\n");
#endif
testFpga();
testRAM();
//gotthard specific
setPhaseShiftOnce();
prepareADC();
setADC(-1); //already does setdaqreg and clean fifo
printf("Chip of interest:0x%x\n",bus_r(CHIP_OF_INTRST_REG));
int reg = (NCHAN*NCHIP)<<CHANNEL_OFFSET;
reg&=CHANNEL_MASK;
reg|=ACTIVE_ADC_MASK;
bus_w(CHIP_OF_INTRST_REG,reg);
printf("Chip of interest:0x%x\n",bus_r(CHIP_OF_INTRST_REG));
setSettings(GET_SETTINGS,-1);
//Initialization
setFrames(1);
setTrains(1);
@ -92,7 +89,6 @@ int init_detector( int b) {
setPeriod(1e9);
setDelay(0);
setGates(0);
setTiming(GET_EXTERNAL_COMMUNICATION_MODE);
setMaster(GET_MASTER);
setSynchronization(GET_SYNCHRONIZATION_MODE);