mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-19 18:53:13 +01:00
dont know
This commit is contained in:
@@ -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->chanregs,sizeof(myMod->nchan),INT32);
|
||||||
ts+=receiveData(file_des,&(myMod->gain), sizeof(myMod->gain),OTHER);
|
ts+=receiveData(file_des,&(myMod->gain), sizeof(myMod->gain),OTHER);
|
||||||
ts+=receiveData(file_des,&(myMod->offset), sizeof(myMod->offset),OTHER);
|
ts+=receiveData(file_des,&(myMod->offset), sizeof(myMod->offset),OTHER);
|
||||||
|
printf(RED,"ts:%d\n",ts);
|
||||||
myMod->dacs=dacptr;
|
myMod->dacs=dacptr;
|
||||||
myMod->adcs=adcptr;
|
myMod->adcs=adcptr;
|
||||||
myMod->chipregs=chipptr;
|
myMod->chipregs=chipptr;
|
||||||
|
|||||||
@@ -1138,7 +1138,11 @@ u_int32_t testRAM(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int getNModBoard() {
|
int getNModBoard() {
|
||||||
|
#ifdef JUNGFRAU_DHANYA
|
||||||
|
return 1;
|
||||||
|
#else
|
||||||
return 32;//nModX;
|
return 32;//nModX;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int setNMod(int n) {
|
int setNMod(int n) {
|
||||||
@@ -2316,7 +2320,6 @@ u_int32_t* decode_data(int *datain)
|
|||||||
|
|
||||||
|
|
||||||
int setDynamicRange(int dr) {
|
int setDynamicRange(int dr) {
|
||||||
|
|
||||||
if (dr%16==0 && dr>0) {
|
if (dr%16==0 && dr>0) {
|
||||||
dynamicRange=16;
|
dynamicRange=16;
|
||||||
nSamples=dr/16;
|
nSamples=dr/16;
|
||||||
|
|||||||
Binary file not shown.
@@ -103,14 +103,12 @@ int initDetector() {
|
|||||||
/* dynamicRange=getDynamicRange(); //always 16 not required commented out
|
/* dynamicRange=getDynamicRange(); //always 16 not required commented out
|
||||||
nModX=setNMod(-1);*/
|
nModX=setNMod(-1);*/
|
||||||
|
|
||||||
//dataBytes=nModX*NCHIP*NCHAN*4;
|
|
||||||
// dynamicRange=32;
|
// dynamicRange=32;
|
||||||
// initChip(0, 0,ALLMOD);
|
// initChip(0, 0,ALLMOD);
|
||||||
//nModX=n;
|
//nModX=n;
|
||||||
//
|
//
|
||||||
allocateRAM();
|
allocateRAM();
|
||||||
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -899,7 +897,7 @@ int setSettings(int i, int imod) {
|
|||||||
|
|
||||||
/* Initialization*/
|
/* 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 reg=myChan.reg;
|
||||||
int ft=reg & TRIM_DR;
|
int ft=reg & TRIM_DR;
|
||||||
int cae=(reg>>(NTRIMBITS))&1;
|
int cae=(reg>>(NTRIMBITS))&1;
|
||||||
@@ -1535,8 +1533,8 @@ int initMCBregisters(int cm, int imod){
|
|||||||
|
|
||||||
int initModulebyNumber(sls_detector_module myMod) {
|
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 nchip,nchan;//int ichip, nchip, ichan, nchan;
|
||||||
int im, modmi,modma;
|
int im, modmi,modma;
|
||||||
// int ft, cae, ae, coe, ocoe, counts, chanreg;
|
// int ft, cae, ae, coe, ocoe, counts, chanreg;
|
||||||
@@ -1545,7 +1543,7 @@ int initModulebyNumber(sls_detector_module myMod) {
|
|||||||
// int ow;
|
// int ow;
|
||||||
/* int v[NDAC];*/
|
/* int v[NDAC];*/
|
||||||
int retval =-1, idac;
|
int retval =-1, idac;
|
||||||
|
printf("111\n");
|
||||||
|
|
||||||
nchip=myMod.nchip;
|
nchip=myMod.nchip;
|
||||||
nchan=(myMod.nchan)/nchip;
|
nchan=(myMod.nchan)/nchip;
|
||||||
@@ -1567,13 +1565,11 @@ int initModulebyNumber(sls_detector_module myMod) {
|
|||||||
modma=sMod+1;
|
modma=sMod+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("222\n");
|
||||||
/*
|
/*
|
||||||
for (idac=0; idac<NDAC; idac++)
|
for (idac=0; idac<NDAC; idac++)
|
||||||
v[idac]=(myMod.dacs)[idac];
|
v[idac]=(myMod.dacs)[idac];
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
v[VDAC0]=(myMod.dacs)[0];
|
v[VDAC0]=(myMod.dacs)[0];
|
||||||
v[VDAC1]=(myMod.dacs)[1];
|
v[VDAC1]=(myMod.dacs)[1];
|
||||||
v[VDAC2]=(myMod.dacs)[2];
|
v[VDAC2]=(myMod.dacs)[2];
|
||||||
@@ -1595,18 +1591,17 @@ int initModulebyNumber(sls_detector_module myMod) {
|
|||||||
printf("vdac7=%d\n",v[VDAC7]);
|
printf("vdac7=%d\n",v[VDAC7]);
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
printf("ndac:%d\n",NDAC);
|
||||||
// initDACs(v,imod);
|
// initDACs(v,imod);
|
||||||
// initMCBregisters(myMod.reg,imod);
|
// initMCBregisters(myMod.reg,imod);
|
||||||
|
|
||||||
for (idac=0; idac<NDAC; idac++){
|
for (idac=0; idac<NDAC; idac++){
|
||||||
retval = setDac(idac,(myMod.dacs)[idac]);
|
retval = setDac(idac,(myMod.dacs)[idac]);
|
||||||
if(retval ==(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
|
else
|
||||||
printf("Error: Could not set dac %d, wrote %d but read %d\n",idac,(myMod.dacs)[idac],retval);
|
printf("Error: Could not set dac %d, wrote %d but read %d\n",idac,(myMod.dacs)[idac],retval);
|
||||||
}
|
}
|
||||||
|
printf("before copy\n");
|
||||||
if (detectorModules) {
|
if (detectorModules) {
|
||||||
for (im=modmi; im<modma; im++) {
|
for (im=modmi; im<modma; im++) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@@ -1615,10 +1610,10 @@ int initModulebyNumber(sls_detector_module myMod) {
|
|||||||
copyModule(detectorModules+im,&myMod);
|
copyModule(detectorModules+im,&myMod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
printf("after copy\n");
|
||||||
//setting the conf gain and the settings register
|
//setting the conf gain and the settings register
|
||||||
setSettings(myMod.reg,imod);
|
setSettings(myMod.reg,imod);
|
||||||
|
printf("after settings\n");
|
||||||
return thisSettings;
|
return thisSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,14 +7,22 @@
|
|||||||
|
|
||||||
|
|
||||||
// Hardware definitions
|
// Hardware definitions
|
||||||
|
#ifdef JUNGFRAU_DHANYA
|
||||||
|
#define NCHAN (256*256)
|
||||||
|
#define NCHIP 8
|
||||||
|
#define NADC 0
|
||||||
|
#else
|
||||||
#define NCHAN 32
|
#define NCHAN 32
|
||||||
#define NCHIP 1
|
#define NCHIP 1
|
||||||
|
#define NADC 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define NDAC 16
|
||||||
#define NMAXMODX 1
|
#define NMAXMODX 1
|
||||||
#define NMAXMODY 1
|
#define NMAXMODY 1
|
||||||
#define NMAXMOD (NMAXMODX*NMAXMODY)
|
#define NMAXMOD (NMAXMODX*NMAXMODY)
|
||||||
#define NDAC 16
|
|
||||||
#define NADC 1
|
|
||||||
|
|
||||||
/**when moench readout tested with gotthard module*/
|
/**when moench readout tested with gotthard module*/
|
||||||
#define GOTTHARDNCHAN 128
|
#define GOTTHARDNCHAN 128
|
||||||
|
|||||||
@@ -121,7 +121,9 @@ int init_detector(int b, int checkType) {
|
|||||||
|
|
||||||
#ifdef MCB_FUNCS
|
#ifdef MCB_FUNCS
|
||||||
printf("\nBoard Revision:0x%x\n",(bus_r(PCB_REV_REG)&BOARD_REVISION_MASK));
|
printf("\nBoard Revision:0x%x\n",(bus_r(PCB_REV_REG)&BOARD_REVISION_MASK));
|
||||||
// initDetector();
|
#ifdef JUNGFRAU_DHANYA
|
||||||
|
initDetector();
|
||||||
|
#endif
|
||||||
printf("Initializing Detector\n");
|
printf("Initializing Detector\n");
|
||||||
//bus_w16(CONTROL_REG, SYNC_RESET); // reset registers
|
//bus_w16(CONTROL_REG, SYNC_RESET); // reset registers
|
||||||
#endif
|
#endif
|
||||||
@@ -222,8 +224,6 @@ int init_detector(int b, int checkType) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,9 +231,9 @@ int init_detector(int b, int checkType) {
|
|||||||
int decode_function(int file_des) {
|
int decode_function(int file_des) {
|
||||||
int fnum,n;
|
int fnum,n;
|
||||||
int retval=FAIL;
|
int retval=FAIL;
|
||||||
#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
printf( "receive data\n");
|
printf( "receive data\n");
|
||||||
#endif
|
//#endif
|
||||||
n = receiveDataOnly(file_des,&fnum,sizeof(fnum));
|
n = receiveDataOnly(file_des,&fnum,sizeof(fnum));
|
||||||
if (n <= 0) {
|
if (n <= 0) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@@ -254,6 +254,7 @@ int decode_function(int file_des) {
|
|||||||
retval=(*flist[fnum])(file_des);
|
retval=(*flist[fnum])(file_des);
|
||||||
if (retval==FAIL)
|
if (retval==FAIL)
|
||||||
printf( "Error executing the function = %d \n",fnum);
|
printf( "Error executing the function = %d \n",fnum);
|
||||||
|
printf("retval:%d\n",retval);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1504,7 +1505,7 @@ int set_module(int file_des) {
|
|||||||
int ret=OK;
|
int ret=OK;
|
||||||
int dr;// ow;
|
int dr;// ow;
|
||||||
|
|
||||||
dr=setDynamicRange(-1);
|
dr=setDynamicRange(-1); cprintf(BLUE,"drr:%d\n",dr);
|
||||||
|
|
||||||
if (myDac)
|
if (myDac)
|
||||||
myModule.dacs=myDac;
|
myModule.dacs=myDac;
|
||||||
@@ -1530,13 +1531,11 @@ int set_module(int file_des) {
|
|||||||
sprintf(mess,"could not allocate chans\n");
|
sprintf(mess,"could not allocate chans\n");
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
myModule.ndac=NDAC;
|
myModule.ndac=NDAC;
|
||||||
myModule.nchip=NCHIP;
|
myModule.nchip=NCHIP;
|
||||||
myModule.nchan=NCHAN*NCHIP;
|
myModule.nchan=NCHAN*NCHIP;
|
||||||
myModule.nadc=NADC;
|
myModule.nadc=NADC;
|
||||||
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("Setting module\n");
|
printf("Setting module\n");
|
||||||
#endif
|
#endif
|
||||||
@@ -1595,7 +1594,7 @@ int set_module(int file_des) {
|
|||||||
free(myAdc);
|
free(myAdc);
|
||||||
|
|
||||||
// setDynamicRange(dr); always 16 commented out
|
// setDynamicRange(dr); always 16 commented out
|
||||||
|
printf("freed\n");
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user