dont know

This commit is contained in:
Dhanya Maliakal 2015-12-09 16:15:23 +01:00
parent b05207221c
commit 532ac38ad5
6 changed files with 37 additions and 32 deletions

View File

@ -535,7 +535,7 @@ int receiveModule(int file_des, sls_detector_module* myMod) {
ts+=receiveData(file_des,myMod->chanregs,sizeof(myMod->nchan),INT32);
ts+=receiveData(file_des,&(myMod->gain), sizeof(myMod->gain),OTHER);
ts+=receiveData(file_des,&(myMod->offset), sizeof(myMod->offset),OTHER);
printf(RED,"ts:%d\n",ts);
myMod->dacs=dacptr;
myMod->adcs=adcptr;
myMod->chipregs=chipptr;

View File

@ -1138,7 +1138,11 @@ u_int32_t testRAM(void) {
}
int getNModBoard() {
#ifdef JUNGFRAU_DHANYA
return 1;
#else
return 32;//nModX;
#endif
}
int setNMod(int n) {
@ -2316,7 +2320,6 @@ u_int32_t* decode_data(int *datain)
int setDynamicRange(int dr) {
if (dr%16==0 && dr>0) {
dynamicRange=16;
nSamples=dr/16;

View File

@ -103,14 +103,12 @@ int initDetector() {
/* dynamicRange=getDynamicRange(); //always 16 not required commented out
nModX=setNMod(-1);*/
//dataBytes=nModX*NCHIP*NCHAN*4;
// dynamicRange=32;
// initChip(0, 0,ALLMOD);
//nModX=n;
//
allocateRAM();
return OK;
}
@ -899,7 +897,7 @@ int setSettings(int i, int imod) {
/* Initialization*/
int initChannelbyNumber(sls_detector_channel myChan) {
int initChannelbyNumber(sls_detector_channel myChan) {printf("in init channel by number\n");
int reg=myChan.reg;
int ft=reg & TRIM_DR;
int cae=(reg>>(NTRIMBITS))&1;
@ -1535,8 +1533,8 @@ int initMCBregisters(int cm, int imod){
int initModulebyNumber(sls_detector_module myMod) {
printf("\ninside initmoduleynumber..\n");
printf("\ninside initmoduleynumberrrr..\n");
printf("000\n");
int nchip,nchan;//int ichip, nchip, ichan, nchan;
int im, modmi,modma;
// int ft, cae, ae, coe, ocoe, counts, chanreg;
@ -1545,7 +1543,7 @@ int initModulebyNumber(sls_detector_module myMod) {
// int ow;
/* int v[NDAC];*/
int retval =-1, idac;
printf("111\n");
nchip=myMod.nchip;
nchan=(myMod.nchan)/nchip;
@ -1567,13 +1565,11 @@ int initModulebyNumber(sls_detector_module myMod) {
modma=sMod+1;
}
printf("222\n");
/*
for (idac=0; idac<NDAC; idac++)
v[idac]=(myMod.dacs)[idac];
*/
/*
v[VDAC0]=(myMod.dacs)[0];
v[VDAC1]=(myMod.dacs)[1];
v[VDAC2]=(myMod.dacs)[2];
@ -1595,30 +1591,29 @@ int initModulebyNumber(sls_detector_module myMod) {
printf("vdac7=%d\n",v[VDAC7]);
#endif
*/
printf("ndac:%d\n",NDAC);
// initDACs(v,imod);
// initMCBregisters(myMod.reg,imod);
for (idac=0; idac<NDAC; idac++){
retval = setDac(idac,(myMod.dacs)[idac]);
if(retval ==(myMod.dacs)[idac])
printf("Setting dac % to %d\n",idac,retval);
cprintf(BLUE,"Setting dac %d to %d\n",idac,retval);
else
printf("Error: Could not set dac %d, wrote %d but read %d\n",idac,(myMod.dacs)[idac],retval);
}
printf("before copy\n");
if (detectorModules) {
for (im=modmi; im<modma; im++) {
for (im=modmi; im<modma; im++) {
#ifdef VERBOSE
printf("im=%d\n",im);
#endif
copyModule(detectorModules+im,&myMod);
}
}
}
printf("after copy\n");
//setting the conf gain and the settings register
setSettings(myMod.reg,imod);
printf("after settings\n");
return thisSettings;
}

View File

@ -7,14 +7,22 @@
// Hardware definitions
#ifdef JUNGFRAU_DHANYA
#define NCHAN (256*256)
#define NCHIP 8
#define NADC 0
#else
#define NCHAN 32
#define NCHIP 1
#define NADC 1
#endif
#define NDAC 16
#define NMAXMODX 1
#define NMAXMODY 1
#define NMAXMOD (NMAXMODX*NMAXMODY)
#define NDAC 16
#define NADC 1
/**when moench readout tested with gotthard module*/
#define GOTTHARDNCHAN 128

View File

@ -121,7 +121,9 @@ int init_detector(int b, int checkType) {
#ifdef MCB_FUNCS
printf("\nBoard Revision:0x%x\n",(bus_r(PCB_REV_REG)&BOARD_REVISION_MASK));
// initDetector();
#ifdef JUNGFRAU_DHANYA
initDetector();
#endif
printf("Initializing Detector\n");
//bus_w16(CONTROL_REG, SYNC_RESET); // reset registers
#endif
@ -222,8 +224,6 @@ int init_detector(int b, int checkType) {
}
#endif
return OK;
}
@ -231,9 +231,9 @@ int init_detector(int b, int checkType) {
int decode_function(int file_des) {
int fnum,n;
int retval=FAIL;
#ifdef VERBOSE
//#ifdef VERBOSE
printf( "receive data\n");
#endif
//#endif
n = receiveDataOnly(file_des,&fnum,sizeof(fnum));
if (n <= 0) {
#ifdef VERBOSE
@ -254,6 +254,7 @@ int decode_function(int file_des) {
retval=(*flist[fnum])(file_des);
if (retval==FAIL)
printf( "Error executing the function = %d \n",fnum);
printf("retval:%d\n",retval);
return retval;
}
@ -1504,7 +1505,7 @@ int set_module(int file_des) {
int ret=OK;
int dr;// ow;
dr=setDynamicRange(-1);
dr=setDynamicRange(-1); cprintf(BLUE,"drr:%d\n",dr);
if (myDac)
myModule.dacs=myDac;
@ -1530,16 +1531,14 @@ int set_module(int file_des) {
sprintf(mess,"could not allocate chans\n");
ret=FAIL;
}
myModule.ndac=NDAC;
myModule.nchip=NCHIP;
myModule.nchan=NCHAN*NCHIP;
myModule.nadc=NADC;
#ifdef VERBOSE
printf("Setting module\n");
#endif
#endif
ret=receiveModule(file_des, &myModule);
if (ret>=0)
@ -1595,8 +1594,8 @@ int set_module(int file_des) {
free(myAdc);
// setDynamicRange(dr); always 16 commented out
printf("freed\n");
return ret;
}