mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-31 23:20:41 +02:00
removed JUNGFRAU_DHANYA completely from Makefile, used N_CHAN instead of NCHAN macro since it isnot constant, and corrected registerdefs
This commit is contained in:
parent
1fae912cb2
commit
03fc676b7e
@ -6,7 +6,7 @@
|
||||
CROSS = bfin-uclinux-
|
||||
CC = $(CROSS)gcc
|
||||
|
||||
CFLAGS += -Wall -DMOENCHD -DMCB_FUNCS -DDACS_INT -DDEBUG -DV1 -DJUNGFRAU_DHANYA #-DVERBOSE #-DVERYVERBOSE #-DVIRTUAL #-DDACS_INT_CSERVER
|
||||
CFLAGS += -Wall -DMOENCHD -DMCB_FUNCS -DDACS_INT -DDEBUG -DV1 #-DVERBOSE #-DVERYVERBOSE #-DVIRTUAL #-DDACS_INT_CSERVER
|
||||
|
||||
|
||||
PROGS= jungfrauDetectorServerTest
|
||||
|
@ -110,22 +110,20 @@ enum externalSignalFlag signals[4]={EXT_SIG_OFF, EXT_SIG_OFF, EXT_SIG_OFF, EXT_
|
||||
|
||||
int withGotthard = 0;
|
||||
|
||||
#ifdef MCB_FUNCS
|
||||
extern const int nChans;
|
||||
extern const int nChips;
|
||||
//extern const int nDacs;
|
||||
//extern const int nAdcs;
|
||||
#endif
|
||||
#ifndef MCB_FUNCS
|
||||
|
||||
const int nChans=NCHAN;
|
||||
const int nChips=NCHIP;
|
||||
const int nDacs=NDAC;
|
||||
const int nAdcs=NADC;
|
||||
#endif
|
||||
/**is not const because this value will change after initDetector, is removed from mcb_funcs.c cuz its not used anywhere
|
||||
* why is this used anywhere instead of macro*/
|
||||
int nChans=NCHAN;
|
||||
int nChips=NCHIP;
|
||||
int nDacs=NDAC;
|
||||
int nAdcs=NADC;
|
||||
|
||||
extern enum detectorType myDetectorType;
|
||||
|
||||
/** for jungfrau reinitializing macro later in server_funcs.c in initDetector*/
|
||||
extern int N_CHAN;
|
||||
extern int N_CHIP;
|
||||
extern int N_DAC;
|
||||
extern int N_ADC;
|
||||
extern int N_CHANS;
|
||||
|
||||
int mapCSP0(void) {
|
||||
printf("Mapping memory\n");
|
||||
@ -1360,7 +1358,7 @@ ROI *setROI(int nroi,ROI* arg,int *retvalsize, int *ret) {
|
||||
for (i=0; i<nroi; i++) {
|
||||
printf("iroi: %d - %d %d %d %d\n",i, arg[i].xmin, arg[i].xmax, arg[i].ymin, arg[i].ymax);
|
||||
for (ich=arg[i].xmin; ich<=arg[i].xmax; ich++) {
|
||||
if (ich>=0 && ich<NCHAN)
|
||||
if (ich>=0 && ich<N_CHAN)
|
||||
adcDisableMask&=~(1<<ich);
|
||||
else
|
||||
break;
|
||||
@ -1379,7 +1377,7 @@ ROI *setROI(int nroi,ROI* arg,int *retvalsize, int *ret) {
|
||||
*retvalsize=0;
|
||||
retval[0].xmin=0;
|
||||
retval[0].xmax=0;
|
||||
for (ich=0 ; ich<NCHAN ; ich++) {
|
||||
for (ich=0 ; ich<N_CHAN ; ich++) {
|
||||
if ((~adcDisableMask)&(1<<ich)) {
|
||||
if (ich==0) {
|
||||
*retvalsize+=1;
|
||||
@ -1636,8 +1634,8 @@ int setADC(int adc){
|
||||
ipPacketSize= DEFAULT_IP_PACKETSIZE;
|
||||
udpPacketSize=DEFAULT_UDP_PACKETSIZE;
|
||||
//set channel mask
|
||||
nchips = NCHIP;
|
||||
nchans = NCHANS;
|
||||
nchips = N_CHIP;
|
||||
nchans = N_CHANS;
|
||||
mask = ACTIVE_ADC_MASK;
|
||||
}/*
|
||||
//with moench module 1 adc -- NOT IMPLEMENTED
|
||||
@ -2353,7 +2351,7 @@ int getDynamicRange() {
|
||||
|
||||
nSamples=bus_r(NSAMPLES_REG);
|
||||
getChannels();
|
||||
dataBytes=nModX*NCHIP*getChannels()*2;
|
||||
dataBytes=nModX*N_CHIP*getChannels()*2;
|
||||
return dynamicRange*bus_r(NSAMPLES_REG);//nSamples;
|
||||
}
|
||||
|
||||
@ -2402,7 +2400,7 @@ int setStoreInRAM(int b) {
|
||||
int getChannels() {
|
||||
int nch=32;
|
||||
int i;
|
||||
for (i=0; i<NCHAN; i++) {
|
||||
for (i=0; i<N_CHAN; i++) {
|
||||
if (adcDisableMask & (1<<i)) nch--;
|
||||
}
|
||||
return nch;
|
||||
|
Binary file not shown.
@ -23,10 +23,6 @@
|
||||
extern int nModX;
|
||||
//extern int dataBytes;
|
||||
extern int dynamicRange;
|
||||
const int nChans=NCHAN;
|
||||
const int nChips=NCHIP;
|
||||
const int nDacs=NDAC;
|
||||
const int nAdcs=NADC;
|
||||
enum detectorSettings thisSettings;
|
||||
|
||||
int sChan, sChip, sMod, sDac, sAdc;
|
||||
@ -45,6 +41,17 @@ ROI rois[MAX_ROIS];
|
||||
int nROI=0;
|
||||
extern enum detectorType myDetectorType;
|
||||
|
||||
/** for jungfrau reinitializing macro later in server_funcs.c in initDetector*/
|
||||
extern int N_CHAN;
|
||||
extern int N_CHIP;
|
||||
extern int N_DAC;
|
||||
extern int N_ADC;
|
||||
extern int N_CHANS;
|
||||
|
||||
extern int nChans;
|
||||
extern int nChips;
|
||||
extern int nDacs;
|
||||
extern int nAdcs;
|
||||
|
||||
int initDetector() {
|
||||
|
||||
@ -57,39 +64,52 @@ int initDetector() {
|
||||
printf("Board is for %d modules\n",n);
|
||||
#endif
|
||||
|
||||
if(myDetectorType == JUNGFRAU){
|
||||
N_CHAN=JUNGFRAU_NCHAN;
|
||||
N_CHIP=JUNGFRAU_NCHIP;
|
||||
N_DAC=JUNGFRAU_NDAC;
|
||||
N_ADC=JUNGFRAU_NADC;
|
||||
N_CHANS=JUNGFRAU_NCHANS;
|
||||
|
||||
nChans=N_CHAN;
|
||||
nChips=N_CHIP;
|
||||
nDacs=N_DAC;
|
||||
nAdcs=N_ADC;
|
||||
}
|
||||
|
||||
detectorModules=malloc(n*sizeof(sls_detector_module));
|
||||
detectorDacs=malloc(n*NDAC*sizeof(int));
|
||||
detectorAdcs=malloc(n*NADC*sizeof(int));
|
||||
detectorDacs=malloc(n*N_DAC*sizeof(int));
|
||||
detectorAdcs=malloc(n*N_ADC*sizeof(int));
|
||||
detectorChips=NULL;
|
||||
detectorChans=NULL;
|
||||
detectorAdcs=NULL;
|
||||
if(myDetectorType != JUNGFRAU){
|
||||
detectorChips=malloc(n*NCHIP*sizeof(int));
|
||||
detectorChans=malloc(n*NCHIP*NCHAN*sizeof(int));
|
||||
detectorChips=malloc(n*N_CHIP*sizeof(int));
|
||||
detectorChans=malloc(n*N_CHIP*N_CHAN*sizeof(int));
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("modules from 0x%x to 0x%x\n",(unsigned int)(detectorModules), (unsigned int)(detectorModules+n));
|
||||
printf("dacs from 0x%x to 0x%x\n",(unsigned int)(detectorDacs), (unsigned int)(detectorDacs+n*NDAC));
|
||||
printf("adcs from 0x%x to 0x%x\n",(unsigned int)(detectorAdcs), (unsigned int)(detectorAdcs+n*NADC));
|
||||
printf("dacs from 0x%x to 0x%x\n",(unsigned int)(detectorDacs), (unsigned int)(detectorDacs+n*N_DAC));
|
||||
printf("adcs from 0x%x to 0x%x\n",(unsigned int)(detectorAdcs), (unsigned int)(detectorAdcs+n*N_ADC));
|
||||
if(myDetectorType != JUNGFRAU){
|
||||
printf("chips from 0x%x to 0x%x\n",(unsigned int)(detectorChips), (unsigned int)(detectorChips+n*NCHIP));
|
||||
printf("chans from 0x%x to 0x%x\n",(unsigned int)(detectorChans), (unsigned int)(detectorChans+n*NCHIP*NCHAN));
|
||||
printf("chips from 0x%x to 0x%x\n",(unsigned int)(detectorChips), (unsigned int)(detectorChips+n*N_CHIP));
|
||||
printf("chans from 0x%x to 0x%x\n",(unsigned int)(detectorChans), (unsigned int)(detectorChans+n*N_CHIP*N_CHAN));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
for (imod=0; imod<n; imod++) {
|
||||
(detectorModules+imod)->dacs=detectorDacs+imod*NDAC;
|
||||
(detectorModules+imod)->adcs=detectorAdcs+imod*NADC;
|
||||
(detectorModules+imod)->dacs=detectorDacs+imod*N_DAC;
|
||||
(detectorModules+imod)->adcs=detectorAdcs+imod*N_ADC;
|
||||
if(myDetectorType != JUNGFRAU){
|
||||
(detectorModules+imod)->chipregs=detectorChips+imod*NCHIP;
|
||||
(detectorModules+imod)->chanregs=detectorChans+imod*NCHIP*NCHAN;
|
||||
(detectorModules+imod)->chipregs=detectorChips+imod*N_CHIP;
|
||||
(detectorModules+imod)->chanregs=detectorChans+imod*N_CHIP*N_CHAN;
|
||||
}
|
||||
(detectorModules+imod)->ndac=NDAC;
|
||||
(detectorModules+imod)->nadc=NADC;
|
||||
(detectorModules+imod)->nchip=NCHIP;
|
||||
(detectorModules+imod)->nchan=NCHIP*NCHAN;
|
||||
(detectorModules+imod)->ndac=N_DAC;
|
||||
(detectorModules+imod)->nadc=N_ADC;
|
||||
(detectorModules+imod)->nchip=N_CHIP;
|
||||
(detectorModules+imod)->nchan=N_CHIP*N_CHAN;
|
||||
(detectorModules+imod)->module=imod;
|
||||
(detectorModules+imod)->gain=0;
|
||||
(detectorModules+imod)->offset=0;
|
||||
@ -495,15 +515,15 @@ int selChip(const int chip,int imod) {
|
||||
/* sMod=allSelected; */
|
||||
|
||||
/* if (imod>=0 && imod<nModX) { */
|
||||
/* detectorDacs[idac+NDAC*imod]=v; */
|
||||
/* detectorDacs[idac+N_DAC*imod]=v; */
|
||||
/* #ifdef VERBOSE */
|
||||
/* printf("module=%d index=%d, val=%d addr=%x\n",imod, idac, v, (unsigned int)(detectorDacs+idac+NDAC*imod)); */
|
||||
/* printf("module=%d index=%d, val=%d addr=%x\n",imod, idac, v, (unsigned int)(detectorDacs+idac+N_DAC*imod)); */
|
||||
/* #endif */
|
||||
|
||||
/* setDACRegister(idac,v,imod); */
|
||||
/* } else if (imod==ALLMOD) { */
|
||||
/* for (im=0; im<nModX; im++) { */
|
||||
/* detectorDacs[idac+NDAC*im]=v; */
|
||||
/* detectorDacs[idac+N_DAC*im]=v; */
|
||||
/* setDACRegister(idac,v,im); */
|
||||
/* } */
|
||||
/* } */
|
||||
@ -559,9 +579,9 @@ int selChip(const int chip,int imod) {
|
||||
|
||||
/* int initDACbyIndex(int ind,int val, int imod) { */
|
||||
/* int v; */
|
||||
/* const int partref[NDAC]=PARTREF; */
|
||||
/* const int partr1[NDAC]=PARTR1; */
|
||||
/* const int partr2[NDAC]=PARTR2; */
|
||||
/* const int partref[N_DAC]=PARTREF; */
|
||||
/* const int partr1[N_DAC]=PARTR1; */
|
||||
/* const int partr2[N_DAC]=PARTR2; */
|
||||
|
||||
/* int ref=partref[ind]; */
|
||||
/* int r1=partr1[ind]; */
|
||||
@ -576,8 +596,8 @@ int selChip(const int chip,int imod) {
|
||||
|
||||
/* int initDACbyIndexDACU(int ind, int val, int imod) { */
|
||||
|
||||
/* // const double daccs[NDAC]=DACCS; */
|
||||
/* // const double dacaddr[NDAC]=DACADDR; */
|
||||
/* // const double daccs[N_DAC]=DACCS; */
|
||||
/* // const double dacaddr[N_DAC]=DACADDR; */
|
||||
|
||||
/* // int cs=daccs[ind]; */
|
||||
/* // int addr=dacaddr[ind]; */
|
||||
@ -588,7 +608,7 @@ int selChip(const int chip,int imod) {
|
||||
/* initDAC(ind,val, imod); */
|
||||
|
||||
/* if (imod>=0 && imod<nModX) { */
|
||||
/* // return detectorDacs[ind+imod*NDAC]; */
|
||||
/* // return detectorDacs[ind+imod*N_DAC]; */
|
||||
/* return setDACRegister(ind, -1, imod); */
|
||||
/* } */
|
||||
/* else { */
|
||||
@ -600,7 +620,7 @@ int selChip(const int chip,int imod) {
|
||||
/* #ifdef VERBOSE */
|
||||
/* printf("mod %d dac %d val %d\n",im,ind,setDACRegister(ind, -1, im)); */
|
||||
/* #endif */
|
||||
/* //if (detectorDacs[ind+im*NDAC]!=detectorDacs[ind]) { */
|
||||
/* //if (detectorDacs[ind+im*N_DAC]!=detectorDacs[ind]) { */
|
||||
|
||||
/* if (setDACRegister(ind, -1, im)!=setDACRegister(ind, -1, 0)) { */
|
||||
/* #ifdef VERBOSE */
|
||||
@ -651,7 +671,7 @@ int selChip(const int chip,int imod) {
|
||||
/* } */
|
||||
|
||||
/* if (myg>0 && myo>0) { */
|
||||
/* //ethr=(myo-detectorDacs[VTHRESH+imod*NDAC])*1000/myg; */
|
||||
/* //ethr=(myo-detectorDacs[VTHRESH+imod*N_DAC])*1000/myg; */
|
||||
|
||||
/* ethr=(myo-setDACRegister(VDAC0,-1,imod))*1000/myg;//edited by dhanya */
|
||||
/* // else */
|
||||
@ -659,7 +679,7 @@ int selChip(const int chip,int imod) {
|
||||
|
||||
/* } */
|
||||
/* #ifdef VERBOSE */
|
||||
/* //printf("module=%d gain=%f, offset=%f, dacu=%f\n",imod, myg, myo, detectorDacs[VTHRESH+imod*NDAC]); */
|
||||
/* //printf("module=%d gain=%f, offset=%f, dacu=%f\n",imod, myg, myo, detectorDacs[VTHRESH+imod*N_DAC]); */
|
||||
/* printf("module=%d gain=%f, offset=%f, dacu=%d\n",imod, myg, myo,(int)(setDACRegister(VDAC0,-1,imod)));//edited by dhanya */
|
||||
/* printf("Threshold energy of module %d is %d eV\n", imod, ethr); */
|
||||
/* #endif */
|
||||
@ -737,7 +757,7 @@ int selChip(const int chip,int imod) {
|
||||
/* if (detectorDacs) { */
|
||||
/* if (imod<getNModBoard()) */
|
||||
/* if (ind<(detectorModules+imod)->ndac) */
|
||||
/* return (detectorDacs[ind+imod*NDAC]); */
|
||||
/* return (detectorDacs[ind+imod*N_DAC]); */
|
||||
/* } */
|
||||
/* return FAIL; */
|
||||
/* *\/ */
|
||||
@ -958,7 +978,7 @@ int getChannelbyNumber(sls_detector_channel* myChan) {
|
||||
if (detectorChans) {
|
||||
if (imod<nModX && imod>=0) {
|
||||
if (ichip<(detectorModules+imod)->nchip && ichan<(detectorModules+imod)->nchan/(detectorModules+imod)->nchip)
|
||||
myChan->reg=detectorChans[imod*NCHAN*NCHIP+ichip*NCHAN+ichan];
|
||||
myChan->reg=detectorChans[imod*N_CHAN*N_CHIP+ichip*N_CHAN+ichan];
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
@ -970,7 +990,7 @@ int getTrimbit(int imod, int ichip, int ichan) {
|
||||
if (detectorChans) {
|
||||
if (imod<getNModBoard() && imod>=0)
|
||||
if (ichip<(detectorModules+imod)->nchip && ichan<(detectorModules+imod)->nchan/(detectorModules+imod)->nchip)
|
||||
return (detectorChans[imod*NCHAN*NCHIP+ichip*NCHAN+ichan] & TRIM_DR);
|
||||
return (detectorChans[imod*N_CHAN*N_CHIP+ichip*N_CHAN+ichan] & TRIM_DR);
|
||||
}
|
||||
|
||||
return -1;
|
||||
@ -994,8 +1014,8 @@ int initChannel(int ft,int cae, int ae, int coe, int ocoe, int counts, int imod)
|
||||
if (sChan==allSelected) {
|
||||
// printf("initializing all channels ft=%d coe=%d\n",ft,coe);
|
||||
chanmi=0;
|
||||
chanma=NCHAN;
|
||||
} else if (sChan==noneSelected || sChan>NCHAN || sChan<0) {
|
||||
chanma=N_CHAN;
|
||||
} else if (sChan==noneSelected || sChan>N_CHAN || sChan<0) {
|
||||
// printf("initializing no channels ft=%d coe=%d\n",ft,coe);
|
||||
chanmi=0;
|
||||
chanma=-1;
|
||||
@ -1008,8 +1028,8 @@ int initChannel(int ft,int cae, int ae, int coe, int ocoe, int counts, int imod)
|
||||
if (sChip==allSelected) {
|
||||
// printf("initializing all chips\n");
|
||||
chipmi=0;
|
||||
chipma=NCHIP;
|
||||
} else if (sChip==noneSelected || sChip>NCHIP || sChip<0) {
|
||||
chipma=N_CHIP;
|
||||
} else if (sChip==noneSelected || sChip>N_CHIP || sChip<0) {
|
||||
// printf("initializing no chips\n");
|
||||
chipmi=0;
|
||||
chipma=-1;
|
||||
@ -1037,12 +1057,12 @@ int initChannel(int ft,int cae, int ae, int coe, int ocoe, int counts, int imod)
|
||||
for (ichip=chipmi; ichip<chipma; ichip++) {
|
||||
for (ichan=chanmi; ichan<chanma; ichan++) {
|
||||
#ifdef VERBOSE
|
||||
// printf("im=%d ichi=%d icha=%d tot=%d reg=%x\n",im,ichip, ichan, im*NCHAN*NCHIP+ichip*NCHAN+ichan,detectorChans[im*NCHAN*NCHIP+ichip*NCHAN+ichan]);
|
||||
// printf("im=%d ichi=%d icha=%d tot=%d reg=%x\n",im,ichip, ichan, im*N_CHAN*N_CHIP+ichip*N_CHAN+ichan,detectorChans[im*N_CHAN*N_CHIP+ichip*N_CHAN+ichan]);
|
||||
#endif
|
||||
detectorChans[im*NCHAN*NCHIP+ichip*NCHAN+ichan]= ft | (cae<<(NTRIMBITS+1)) | (ae<<(NTRIMBITS+2)) | (coe<<(NTRIMBITS+3)) | (ocoe<<(NTRIMBITS+4)) | (counts<<(NTRIMBITS+5));
|
||||
detectorChans[im*N_CHAN*N_CHIP+ichip*N_CHAN+ichan]= ft | (cae<<(NTRIMBITS+1)) | (ae<<(NTRIMBITS+2)) | (coe<<(NTRIMBITS+3)) | (ocoe<<(NTRIMBITS+4)) | (counts<<(NTRIMBITS+5));
|
||||
#ifdef VERBOSE
|
||||
//printf("imod=%d ichip=%d ichan=%d addr=%x reg=%x\n",im,ichip,ichan,detectorChans+im*NCHAN*NCHIP+ichip*NCHAN+ichan, detectorChans[im*NCHAN*NCHIP+ichip*NCHAN+ichan]);
|
||||
// printf("imod=%d ichip=%d ichan=%d addr=%x reg=%x\n",im,ichip,ichan,detectorChans+im*NCHAN*NCHIP+ichip*NCHAN+ichan, detectorChans[im*NCHAN*NCHIP+ichip*NCHAN+ichan]);
|
||||
//printf("imod=%d ichip=%d ichan=%d addr=%x reg=%x\n",im,ichip,ichan,detectorChans+im*N_CHAN*N_CHIP+ichip*N_CHAN+ichan, detectorChans[im*N_CHAN*N_CHIP+ichip*N_CHAN+ichan]);
|
||||
// printf("imod=%d ichip=%d ichan=%d addr=%x reg=%x\n",im,ichip,ichan,detectorChans+im*N_CHAN*N_CHIP+ichip*N_CHAN+ichan, detectorChans[im*N_CHAN*N_CHIP+ichip*N_CHAN+ichan]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -1242,9 +1262,9 @@ int getChipbyNumber(sls_detector_chip* myChip){
|
||||
if (detectorChips) {
|
||||
if (imod<nModX)
|
||||
if (ichip<(detectorModules+imod)->nchip) {
|
||||
myChip->reg=detectorChips[ichip+imod*NCHIP];
|
||||
myChip->nchan=NCHAN;
|
||||
myChip->chanregs=detectorChans+imod*NCHAN*NCHIP+ichip*NCHIP;
|
||||
myChip->reg=detectorChips[ichip+imod*N_CHIP];
|
||||
myChip->nchan=N_CHAN;
|
||||
myChip->chanregs=detectorChans+imod*N_CHAN*N_CHIP+ichip*N_CHIP;
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
@ -1350,8 +1370,8 @@ int initChip(int obe, int ow,int imod){
|
||||
|
||||
if (sChip==allSelected) {
|
||||
chipmi=0;
|
||||
chipma=NCHIP;
|
||||
} else if (sChip==noneSelected || sChip>NCHIP || sChip<0) {
|
||||
chipma=N_CHIP;
|
||||
} else if (sChip==noneSelected || sChip>N_CHIP || sChip<0) {
|
||||
chipmi=0;
|
||||
chipma=-1;
|
||||
} else {
|
||||
@ -1375,9 +1395,9 @@ int initChip(int obe, int ow,int imod){
|
||||
for (im=modmi; im<modma; im++) {
|
||||
for (ichip=chipmi; ichip<chipma; ichip++) {
|
||||
// printf("imod %d ichip %d\n",im,ichip);
|
||||
detectorChips[im*NCHIP+ichip]=obe | (ow<<1);
|
||||
detectorChips[im*N_CHIP+ichip]=obe | (ow<<1);
|
||||
#ifdef VERBOSE
|
||||
//printf("imod=%d ichip=%d reg=%d (%x)\n",im,ichip,detectorChips[im*NCHIP+ichip],detectorChips+im*NCHIP+ichip);
|
||||
//printf("imod=%d ichip=%d reg=%d (%x)\n",im,ichip,detectorChips[im*N_CHIP+ichip],detectorChips+im*N_CHIP+ichip);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -1450,8 +1470,8 @@ int initChipWithProbes(int obe, int ow,int nprobes, int imod){
|
||||
|
||||
if (sChip==allSelected) {
|
||||
chipmi=0;
|
||||
chipma=NCHIP;
|
||||
} else if (sChip==noneSelected || sChip>NCHIP || sChip<0) {
|
||||
chipma=N_CHIP;
|
||||
} else if (sChip==noneSelected || sChip>N_CHIP || sChip<0) {
|
||||
chipmi=0;
|
||||
chipma=-1;
|
||||
} else {
|
||||
@ -1475,9 +1495,9 @@ int initChipWithProbes(int obe, int ow,int nprobes, int imod){
|
||||
for (im=modmi; im<modma; im++) {
|
||||
for (ichip=chipmi; ichip<chipma; ichip++) {
|
||||
// printf("imod %d ichip %d\n",im,ichip);
|
||||
detectorChips[im*NCHIP+ichip]=obe | (ow<<1);
|
||||
detectorChips[im*N_CHIP+ichip]=obe | (ow<<1);
|
||||
#ifdef VERBOSE
|
||||
//printf("imod=%d ichip=%d reg=%d (%x)\n",im,ichip,detectorChips[im*NCHIP+ichip],detectorChips+im*NCHIP+ichip);
|
||||
//printf("imod=%d ichip=%d reg=%d (%x)\n",im,ichip,detectorChips[im*N_CHIP+ichip],detectorChips+im*N_CHIP+ichip);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -1558,7 +1578,7 @@ int initModulebyNumber(sls_detector_module myMod) {
|
||||
int imod;
|
||||
// int obe;
|
||||
// int ow;
|
||||
/* int v[NDAC];*/
|
||||
/* int v[N_DAC];*/
|
||||
int retval =-1, idac;
|
||||
|
||||
|
||||
@ -1584,7 +1604,7 @@ int initModulebyNumber(sls_detector_module myMod) {
|
||||
|
||||
printf("222\n");
|
||||
/*
|
||||
for (idac=0; idac<NDAC; idac++)
|
||||
for (idac=0; idac<N_DAC; idac++)
|
||||
v[idac]=(myMod.dacs)[idac];
|
||||
|
||||
v[VDAC0]=(myMod.dacs)[0];
|
||||
@ -1608,10 +1628,10 @@ int initModulebyNumber(sls_detector_module myMod) {
|
||||
printf("vdac7=%d\n",v[VDAC7]);
|
||||
#endif
|
||||
*/
|
||||
printf("ndac:%d\n",NDAC);
|
||||
printf("ndac:%d\n",N_DAC);
|
||||
// initDACs(v,imod);
|
||||
// initMCBregisters(myMod.reg,imod);
|
||||
for (idac=0; idac<NDAC; idac++){
|
||||
for (idac=0; idac<N_DAC; idac++){
|
||||
retval = setDac(idac,(myMod.dacs)[idac]);
|
||||
if(retval ==(myMod.dacs)[idac])
|
||||
printf("Setting dac %d to %d\n",idac,retval);
|
||||
@ -1771,11 +1791,11 @@ int readOutChan(int *val) {
|
||||
for (k=0; k<nModX; k++) {
|
||||
v=readin(k);
|
||||
//v=bus_r(MCB_DOUT_REG_OFF+(k<<SHIFTMOD)) & 0x3ff;
|
||||
for (j=0; j<NCHIP; j++) {
|
||||
for (j=0; j<N_CHIP; j++) {
|
||||
if (i==0)
|
||||
*(val+j+k*NCHIP)=0;
|
||||
*(val+j+k*N_CHIP)=0;
|
||||
if (v & (1<<j)) {
|
||||
*(val+j+k*NCHIP)= *(val+j+k*NCHIP) | (1 << i);
|
||||
*(val+j+k*N_CHIP)= *(val+j+k*N_CHIP) | (1 << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1909,7 +1929,7 @@ int testShiftStSel(int imod) {
|
||||
int val,i,j,k;
|
||||
printf("testing shift stsel for module %d\n", imod);
|
||||
setCSregister(ALLMOD);
|
||||
for (i=0; i<NCHAN; i++) {
|
||||
for (i=0; i<N_CHAN; i++) {
|
||||
if (i%2) {
|
||||
putout("0100011000000000",ALLMOD);
|
||||
putout("0110011000000000",ALLMOD);
|
||||
@ -1921,7 +1941,7 @@ int testShiftStSel(int imod) {
|
||||
}
|
||||
}
|
||||
putout("0010011000000000",ALLMOD);
|
||||
for (i=0; i<NCHAN; i++) {
|
||||
for (i=0; i<N_CHAN; i++) {
|
||||
putout("0000011000000000",ALLMOD);
|
||||
|
||||
|
||||
@ -1929,7 +1949,7 @@ int testShiftStSel(int imod) {
|
||||
//for (k=0; k<nModX; k++) {
|
||||
val=readin(k);
|
||||
//val=bus_r(MCB_DOUT_REG_OFF+(k<<SHIFTMOD)) & 0x3ff;
|
||||
for (j=0; j<NCHIP; j++) {
|
||||
for (j=0; j<N_CHIP; j++) {
|
||||
if ( (val & 1<<j)>0 && i%2==0) {
|
||||
printf("Shift stsel: module %d chip %i bit %d read %d instead of %d \n",k,j,i,val & 1<< j, i%2);
|
||||
result++;
|
||||
@ -1958,7 +1978,7 @@ int testShiftStSel(int imod) {
|
||||
|
||||
|
||||
int testDataInOut(int num, int imod) {
|
||||
int val[NCHIP*nModX], result=OK;
|
||||
int val[N_CHIP*nModX], result=OK;
|
||||
int ich, ichip;
|
||||
setCSregister(ALLMOD);
|
||||
printf("Testing data in out for module %d pattern 0x%x\n", imod, num);
|
||||
@ -1968,14 +1988,14 @@ int testDataInOut(int num, int imod) {
|
||||
setCSregister(ALLMOD);
|
||||
initChip(0, 0,ALLMOD);
|
||||
clearSSregister(ALLMOD);
|
||||
for (ich=0; ich<NCHAN; ich++) {
|
||||
for (ich=0; ich<N_CHAN; ich++) {
|
||||
nextStrip(ALLMOD);
|
||||
readOutChan(val);
|
||||
//imod=0;
|
||||
//for (imod=0; imod<nModX; imod++) {
|
||||
for (ichip=0; ichip<NCHIP; ichip++) {
|
||||
if (val[ichip+imod*NCHIP]!=num) {
|
||||
printf("Test datain out: Channel %d read %x instead of %x\n", (imod*NCHIP+ichip)*NCHAN+ich, val[ichip+NCHIP*imod], num);
|
||||
for (ichip=0; ichip<N_CHIP; ichip++) {
|
||||
if (val[ichip+imod*N_CHIP]!=num) {
|
||||
printf("Test datain out: Channel %d read %x instead of %x\n", (imod*N_CHIP+ichip)*N_CHAN+ich, val[ichip+N_CHIP*imod], num);
|
||||
result++;
|
||||
}
|
||||
}
|
||||
@ -2002,7 +2022,7 @@ int testExtPulse(int imod) {
|
||||
putout("0000000000000000",ALLMOD);
|
||||
putout("0000100000000000",ALLMOD);
|
||||
putout("0000000000000000",ALLMOD);
|
||||
for (i=0; i<NCHAN; i++) {
|
||||
for (i=0; i<N_CHAN; i++) {
|
||||
putout("0000000000000000",ALLMOD);
|
||||
putout("0000000000001000",ALLMOD);
|
||||
putout("0000000000000000",ALLMOD);
|
||||
@ -2021,11 +2041,11 @@ int testExtPulse(int imod) {
|
||||
// val1=fifo_read_event();
|
||||
//imod=0;
|
||||
//for (imod=0; imod<nModX; imod++) {
|
||||
for (ichip=0; ichip<NCHIP; ichip++) {
|
||||
for (ichan=0; ichan<NCHAN; ichan++) {//
|
||||
if ((*(val1+ichan+(ichip+imod*NCHIP)*NCHAN))!=ichan) {
|
||||
for (ichip=0; ichip<N_CHIP; ichip++) {
|
||||
for (ichan=0; ichan<N_CHAN; ichan++) {//
|
||||
if ((*(val1+ichan+(ichip+imod*N_CHIP)*N_CHAN))!=ichan) {
|
||||
result++;
|
||||
printf("Counter test: channel %d read %d instead of %d\n",ichan+(ichip+imod*NCHIP)*NCHAN, val1[ichan+(ichip+imod*NCHIP)*NCHAN], ichan);
|
||||
printf("Counter test: channel %d read %d instead of %d\n",ichan+(ichip+imod*N_CHIP)*N_CHAN, val1[ichan+(ichip+imod*N_CHIP)*N_CHAN], ichan);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2067,9 +2087,9 @@ int testExtPulseMux(int imod, int ow) {
|
||||
counterClear(ALLMOD);
|
||||
initChipWithProbes(0, ow,0,ALLMOD);
|
||||
// initChip(0, ow,ALLMOD);
|
||||
for (ichip=0; ichip<NCHIP; ichip++) {
|
||||
for (ichip=0; ichip<N_CHIP; ichip++) {
|
||||
setSSregister(ALLMOD);
|
||||
for (i=0; i<NCHAN; i++) {
|
||||
for (i=0; i<N_CHAN; i++) {
|
||||
putout("0000000000000000",ALLMOD);
|
||||
putout("0000000000001000",ALLMOD);
|
||||
putout("0000000000000000",ALLMOD);
|
||||
@ -2093,16 +2113,16 @@ int testExtPulseMux(int imod, int ow) {
|
||||
printf("no data found in fifos\n");
|
||||
return 1;
|
||||
}
|
||||
for (ichip=0; ichip<NCHIP; ichip++) {
|
||||
for (ichip=0; ichip<N_CHIP; ichip++) {
|
||||
chipr=0;
|
||||
for (ichan=0; ichan<NCHAN; ichan++) {
|
||||
ind=ichan+(ichip+imod*NCHIP)*NCHAN;
|
||||
for (ichan=0; ichan<N_CHAN; ichan++) {
|
||||
ind=ichan+(ichip+imod*N_CHIP)*N_CHAN;
|
||||
v=values[ind];
|
||||
vright=(ichan*(ichip+1))&nbit_mask;
|
||||
if (v!=vright) {
|
||||
result++;
|
||||
chipr++;
|
||||
printf("Counter test mux %d mode: channel %d chip %d read %d instead of %d\n",ow, ichan+(ichip+imod*NCHIP)*NCHAN, ichip, v, vright);
|
||||
printf("Counter test mux %d mode: channel %d chip %d read %d instead of %d\n",ow, ichan+(ichip+imod*N_CHIP)*N_CHAN, ichip, v, vright);
|
||||
//break;
|
||||
}
|
||||
//printf("\n");
|
||||
@ -2168,15 +2188,15 @@ int testDataInOutMux(int imod, int ow, int num) {
|
||||
printf("no data found in fifos\n");
|
||||
return 1;
|
||||
}
|
||||
for (ichip=0; ichip<NCHIP; ichip++) {
|
||||
for (ichip=0; ichip<N_CHIP; ichip++) {
|
||||
chipr=0;
|
||||
for (ichan=0; ichan<NCHAN; ichan++) {
|
||||
ind=ichan+(ichip+imod*NCHIP)*NCHAN;
|
||||
for (ichan=0; ichan<N_CHAN; ichan++) {
|
||||
ind=ichan+(ichip+imod*N_CHIP)*N_CHAN;
|
||||
v=values[ind];
|
||||
if (v!=vright) {
|
||||
result++;
|
||||
chipr++;
|
||||
printf("DataInOut test mux %d mode: channel %d chip %d read %d instead of %d\n",ow, ichan+(ichip+imod*NCHIP)*NCHAN, ichip, v, vright);
|
||||
printf("DataInOut test mux %d mode: channel %d chip %d read %d instead of %d\n",ow, ichan+(ichip+imod*N_CHIP)*N_CHAN, ichip, v, vright);
|
||||
//break;
|
||||
}
|
||||
//printf("\n");
|
||||
@ -2263,7 +2283,7 @@ int testOutMux(int imod) {
|
||||
#ifdef DEBUGOUT
|
||||
printf("%d %x\n",i*dist,val);
|
||||
#endif
|
||||
for (j=0; j<NCHIP; j++) {
|
||||
for (j=0; j<N_CHIP; j++) {
|
||||
v=val & 1<< j;
|
||||
if (pat & (1<<(i*dist))) {
|
||||
if (v==0) {
|
||||
@ -2291,7 +2311,7 @@ int testOutMux(int imod) {
|
||||
#ifdef DEBUGOUT
|
||||
printf("%d %x\n",i*dist, val);
|
||||
#endif
|
||||
for (j=0; j<NCHIP; j++) {
|
||||
for (j=0; j<N_CHIP; j++) {
|
||||
v=val & 1<< j;
|
||||
if (pat & (1<<(i*dist))) {
|
||||
if (v==0) {
|
||||
@ -2324,7 +2344,7 @@ int testOutMux(int imod) {
|
||||
#ifdef DEBUGOUT
|
||||
printf("%d %x\n",i*dist, val);
|
||||
#endif
|
||||
for (j=0; j<NCHIP; j++) {
|
||||
for (j=0; j<N_CHIP; j++) {
|
||||
v=val & 1<< j;
|
||||
if (pat & (1<<(i*dist))) {
|
||||
if (v==0) {
|
||||
@ -2352,7 +2372,7 @@ int testOutMux(int imod) {
|
||||
#ifdef DEBUGOUT
|
||||
printf("%d %x\n",i*dist, val);
|
||||
#endif
|
||||
for (j=0; j<NCHIP; j++) {
|
||||
for (j=0; j<N_CHIP; j++) {
|
||||
v=val & 1<< j;
|
||||
if (pat & (1<<(i*dist))) {
|
||||
if (v==0) {
|
||||
@ -2520,9 +2540,9 @@ int calibration_sensor(int num, int *v, int *dacs) {
|
||||
selChip(ichip,imod);
|
||||
for (ich=0; ich<128; ich++){
|
||||
selChannel(ich,imod);
|
||||
initChannel(*(dacs+ichip*NCHAN+ich),0,0,0,0,0,imod); //disable channel;
|
||||
initChannel(*(dacs+ichip*N_CHAN+ich),0,0,0,0,0,imod); //disable channel;
|
||||
clearCounter(imod);
|
||||
//initChannel(*(dacs+ichip*NCHAN+ich),FALSE,FALSE,TRUE,FALSE,0); //disable channel;
|
||||
//initChannel(*(dacs+ichip*N_CHAN+ich),FALSE,FALSE,TRUE,FALSE,0); //disable channel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2530,11 +2550,11 @@ int calibration_sensor(int num, int *v, int *dacs) {
|
||||
for (imod=0; imod<nModX; imod++) {
|
||||
//selMod(imod);
|
||||
initMCBregisters(1,imod);
|
||||
for (ich=0; ich<NCHAN; ich++){
|
||||
for (ichip=0; ichip<NCHIP; ichip++) {
|
||||
for (ich=0; ich<N_CHAN; ich++){
|
||||
for (ichip=0; ichip<N_CHIP; ichip++) {
|
||||
selChip(ichip,imod); // select channel
|
||||
selChannel(ich,imod); // select channel
|
||||
initChannel(*(dacs+imod*NCHAN*NCHIP+ichip*NCHAN+ich),0,0,1,0,0,imod); // enable channel
|
||||
initChannel(*(dacs+imod*N_CHAN*N_CHIP+ichip*N_CHAN+ich),0,0,1,0,0,imod); // enable channel
|
||||
clearCounter(imod);
|
||||
}
|
||||
setCSregister(imod);
|
||||
@ -2548,11 +2568,11 @@ int calibration_sensor(int num, int *v, int *dacs) {
|
||||
}
|
||||
readOutChan(val); // readout channel
|
||||
for (imod=0; imod<nModX; imod++) {
|
||||
for (ichip=0; ichip<NCHIP; ichip++) {
|
||||
*(v+(ichip+imod*NCHIP)*NCHAN+ich)=val[ichip+imod*NCHIP];
|
||||
for (ichip=0; ichip<N_CHIP; ichip++) {
|
||||
*(v+(ichip+imod*N_CHIP)*N_CHAN+ich)=val[ichip+imod*N_CHIP];
|
||||
selChip(ichip,imod); // select channel
|
||||
selChannel(ich,imod); // select channel
|
||||
initChannel(*(dacs+ichip*NCHAN+ich),0,0,0,0,0,imod); //disable channel;
|
||||
initChannel(*(dacs+ichip*N_CHAN+ich),0,0,0,0,0,imod); //disable channel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2574,17 +2594,17 @@ int calibration_chip(int num, int *v, int *dacs) {
|
||||
for (ich=0; ich<128; ich++){
|
||||
selChannel(ich,imod);
|
||||
clearCounter(imod);
|
||||
initChannel(*(dacs+ichip*NCHAN+ich),0,0,0,0,0,imod); //disable channel;
|
||||
initChannel(*(dacs+ichip*N_CHAN+ich),0,0,0,0,0,imod); //disable channel;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (ich=0; ich<NCHAN; ich++){
|
||||
for (ich=0; ich<N_CHAN; ich++){
|
||||
for (imod=0; imod<nModX; imod++) {
|
||||
//selMod(imod);
|
||||
for (ichip=0; ichip<NCHIP; ichip++) {
|
||||
for (ichip=0; ichip<N_CHIP; ichip++) {
|
||||
selChip(ichip,imod); // select channel
|
||||
selChannel(ich,imod); // select channel
|
||||
initChannel(*(dacs+imod*NCHAN*NCHIP+ichip*NCHAN+ich),1,0,1,0,0,imod); // enable channel
|
||||
initChannel(*(dacs+imod*N_CHAN*N_CHIP+ichip*N_CHAN+ich),1,0,1,0,0,imod); // enable channel
|
||||
clearCounter(imod);
|
||||
}
|
||||
}
|
||||
@ -2600,10 +2620,10 @@ int calibration_chip(int num, int *v, int *dacs) {
|
||||
for (imod=0; imod<nModX; imod++) {
|
||||
//selMod(imod);
|
||||
for (ichip=0; ichip<10; ichip++) {
|
||||
*(v+(ichip+imod*NCHIP)*NCHAN+ich)=val[ichip+imod*NCHIP];
|
||||
*(v+(ichip+imod*N_CHIP)*N_CHAN+ich)=val[ichip+imod*N_CHIP];
|
||||
selChip(ichip,imod); // select chip
|
||||
selChannel(ich,imod); // select channel
|
||||
initChannel(*(dacs+imod*NCHAN*NCHIP+ichip*NCHAN+ich),0,0,0,0,0,imod); //disable channel;
|
||||
initChannel(*(dacs+imod*N_CHAN*N_CHIP+ichip*N_CHAN+ich),0,0,0,0,0,imod); //disable channel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,20 +7,22 @@
|
||||
|
||||
|
||||
// Hardware definitions
|
||||
#ifdef JUNGFRAU_DHANYA
|
||||
#define NCHAN (256*256)
|
||||
#define NCHIP 8
|
||||
#define NADC 0
|
||||
#else
|
||||
#define NMAXMODY 1
|
||||
#define NMAXMOD (NMAXMODX*NMAXMODY)
|
||||
|
||||
#define NCHAN 32
|
||||
#define NCHIP 1
|
||||
#define NADC 1
|
||||
#endif
|
||||
|
||||
#define NDAC 16
|
||||
#define NMAXMODX 1
|
||||
#define NMAXMODY 1
|
||||
#define NMAXMOD (NMAXMODX*NMAXMODY)
|
||||
#define NCHANS (NCHAN*NCHIP*NMAXMOD)
|
||||
#define NDACS (NDAC*NMAXMOD)
|
||||
|
||||
#define JUNGFRAU_NCHAN (256*256)
|
||||
#define JUNGFRAU_NCHIP 8
|
||||
#define JUNGFRAU_NADC 0
|
||||
#define JUNGFRAU_NDAC 16
|
||||
#define JUNGFRAU_NCHANS (JUNGFRAU_NCHAN*JUNGFRAU_NCHIP*NMAXMOD)
|
||||
|
||||
|
||||
|
||||
@ -29,11 +31,6 @@
|
||||
#define GOTTHARDNCHIP 10
|
||||
|
||||
|
||||
|
||||
|
||||
#define NCHANS (NCHAN*NCHIP*NMAXMOD)
|
||||
#define NDACS (NDAC*NMAXMOD)
|
||||
|
||||
#define NTRIMBITS 6
|
||||
#define NCOUNTBITS 24
|
||||
|
||||
|
@ -55,6 +55,14 @@ extern int withGotthard;
|
||||
|
||||
int adcvpp=0x4;
|
||||
|
||||
/** for jungfrau reinitializing macro later */
|
||||
int N_CHAN=NCHAN;
|
||||
int N_CHIP=NCHIP;
|
||||
int N_DAC=NDAC;
|
||||
int N_ADC=NADC;
|
||||
int N_CHANS=NCHANS;
|
||||
|
||||
|
||||
int init_detector(int b, int checkType) {
|
||||
|
||||
int i;
|
||||
@ -118,6 +126,7 @@ int init_detector(int b, int checkType) {
|
||||
printf("\nBoard Revision:0x%x\n",(bus_r(PCB_REV_REG)&BOARD_REVISION_MASK));
|
||||
if(myDetectorType == JUNGFRAU)
|
||||
initDetector(); /*allocating detectorModules, detectorsDacs etc for "settings", also does allocate RAM*/
|
||||
dataBytes=NMAXMOD*N_CHIP*N_CHAN*2; /**Nchip and Nchan real values get assigned in initDetector()*/
|
||||
printf("Initializing Detector\n");
|
||||
//bus_w16(CONTROL_REG, SYNC_RESET); // reset registers
|
||||
#endif
|
||||
@ -135,6 +144,14 @@ int init_detector(int b, int checkType) {
|
||||
initDac(0); initDac(8); //initializes the two dacs
|
||||
|
||||
if(myDetectorType==JUNGFRAU){
|
||||
/** for jungfrau reinitializing macro */
|
||||
N_CHAN=JUNGFRAU_NCHAN;
|
||||
N_CHIP=JUNGFRAU_NCHIP;
|
||||
N_DAC=JUNGFRAU_NDAC;
|
||||
N_ADC=JUNGFRAU_NADC;
|
||||
N_CHANS=JUNGFRAU_NCHANS;
|
||||
|
||||
|
||||
//set dacs
|
||||
int retval = -1;
|
||||
int dacvalues[14][2]={
|
||||
@ -1242,13 +1259,13 @@ int set_channel(int file_des) {
|
||||
#ifdef VERBOSE
|
||||
printf("channel number is %d, chip number is %d, module number is %d, register is %lld\n", myChan.chan,myChan.chip, myChan.module, myChan.reg);
|
||||
#endif
|
||||
|
||||
|
||||
if (ret==OK) {
|
||||
if (myChan.module>=getNModBoard())
|
||||
ret=FAIL;
|
||||
if (myChan.chip>=NCHIP)
|
||||
if (myChan.chip>=N_CHIP)
|
||||
ret=FAIL;
|
||||
if (myChan.chan>=NCHAN)
|
||||
if (myChan.chan>=N_CHAN)
|
||||
ret=FAIL;
|
||||
if (myChan.module<0)
|
||||
myChan.module=ALLMOD;
|
||||
@ -1322,13 +1339,13 @@ int get_channel(int file_des) {
|
||||
}
|
||||
if (ret==OK) {
|
||||
ret=FAIL;
|
||||
if (ichip>=0 && ichip<NCHIP) {
|
||||
if (ichip>=0 && ichip<N_CHIP) {
|
||||
ret=OK;
|
||||
}
|
||||
}
|
||||
if (ret==OK) {
|
||||
ret=FAIL;
|
||||
if (ichan>=0 && ichan<NCHAN) {
|
||||
if (ichan>=0 && ichan<N_CHAN) {
|
||||
ret=OK;
|
||||
}
|
||||
}
|
||||
@ -1368,12 +1385,12 @@ int get_channel(int file_des) {
|
||||
int set_chip(int file_des) {
|
||||
|
||||
sls_detector_chip myChip;
|
||||
int ch[NCHAN];
|
||||
int ch[N_CHAN];
|
||||
int n, retval;
|
||||
int ret=OK;
|
||||
|
||||
|
||||
myChip.nchan=NCHAN;
|
||||
myChip.nchan=N_CHAN;
|
||||
myChip.chanregs=ch;
|
||||
|
||||
|
||||
@ -1400,7 +1417,7 @@ int set_chip(int file_des) {
|
||||
ret=FAIL;
|
||||
if (myChip.module<0)
|
||||
myChip.module=ALLMOD;
|
||||
if (myChip.chip>=NCHIP)
|
||||
if (myChip.chip>=N_CHIP)
|
||||
ret=FAIL;
|
||||
}
|
||||
if (differentClients==1 && lockStatus==1) {
|
||||
@ -1456,7 +1473,7 @@ int get_chip(int file_des) {
|
||||
}
|
||||
if (ret==OK) {
|
||||
ret=FAIL;
|
||||
if (ichip>=0 && ichip<NCHIP) {
|
||||
if (ichip>=0 && ichip<N_CHIP) {
|
||||
ret=OK;
|
||||
}
|
||||
}
|
||||
@ -1499,14 +1516,14 @@ int set_module(int file_des) {
|
||||
int ret=OK;
|
||||
int dr;
|
||||
sls_detector_module myModule;
|
||||
int *myDac=malloc(NDAC*sizeof(int));
|
||||
int *myAdc=malloc(NADC*sizeof(int));
|
||||
int *myDac=malloc(N_DAC*sizeof(int));
|
||||
int *myAdc=malloc(N_ADC*sizeof(int));
|
||||
int *myChip=NULL;
|
||||
int *myChan=NULL;
|
||||
/*not required for jungfrau. so save memory*/
|
||||
if(myDetectorType != JUNGFRAU){
|
||||
myChip=malloc(NCHIP*sizeof(int));
|
||||
myChan=malloc(NCHIP*NCHAN*sizeof(int));
|
||||
myChip=malloc(N_CHIP*sizeof(int));
|
||||
myChan=malloc(N_CHIP*N_CHAN*sizeof(int));
|
||||
}
|
||||
|
||||
dr=setDynamicRange(-1); /* move this down to after initialization?*/
|
||||
@ -1543,10 +1560,10 @@ int set_module(int file_des) {
|
||||
}
|
||||
}
|
||||
|
||||
myModule.ndac=NDAC;
|
||||
myModule.nchip=NCHIP;
|
||||
myModule.nchan=NCHAN*NCHIP;
|
||||
myModule.nadc=NADC;
|
||||
myModule.ndac=N_DAC;
|
||||
myModule.nchip=N_CHIP;
|
||||
myModule.nchan=N_CHAN*N_CHIP;
|
||||
myModule.nadc=N_ADC;
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("Setting module\n");
|
||||
@ -1626,16 +1643,16 @@ int get_module(int file_des) {
|
||||
int imod;
|
||||
int n;
|
||||
sls_detector_module myModule;
|
||||
int *myDac=malloc(NDAC*sizeof(int));
|
||||
int *myDac=malloc(N_DAC*sizeof(int));
|
||||
int *myChip=NULL;
|
||||
int *myChan=NULL;
|
||||
int *myAdc=NULL;
|
||||
|
||||
/*not required for jungfrau. so save memory*/
|
||||
if(myDetectorType != JUNGFRAU){
|
||||
myChip=malloc(NCHIP*sizeof(int));
|
||||
myChan=malloc(NCHIP*NCHAN*sizeof(int));
|
||||
myAdc=malloc(NADC*sizeof(int));
|
||||
myChip=malloc(N_CHIP*sizeof(int));
|
||||
myChan=malloc(N_CHIP*N_CHAN*sizeof(int));
|
||||
myAdc=malloc(N_ADC*sizeof(int));
|
||||
}
|
||||
|
||||
|
||||
@ -1672,10 +1689,10 @@ int get_module(int file_des) {
|
||||
}
|
||||
}
|
||||
|
||||
myModule.ndac=NDAC;
|
||||
myModule.nchip=NCHIP;
|
||||
myModule.nchan=NCHAN*NCHIP;
|
||||
myModule.nadc=NADC;
|
||||
myModule.ndac=N_DAC;
|
||||
myModule.nchip=N_CHIP;
|
||||
myModule.nchan=N_CHAN*N_CHIP;
|
||||
myModule.nadc=N_ADC;
|
||||
|
||||
|
||||
|
||||
@ -2901,7 +2918,7 @@ int load_image(int file_des) {
|
||||
int ret=OK;
|
||||
int n;
|
||||
enum imageType index;
|
||||
short int ImageVals[NCHAN*NCHIP];
|
||||
short int ImageVals[N_CHAN*N_CHIP];
|
||||
|
||||
sprintf(mess,"Loading image failed\n");
|
||||
|
||||
@ -3066,7 +3083,7 @@ int read_counter_block(int file_des) {
|
||||
int n;
|
||||
int startACQ;
|
||||
//char *retval=NULL;
|
||||
short int CounterVals[NCHAN*NCHIP];
|
||||
short int CounterVals[N_CHAN*N_CHIP];
|
||||
|
||||
sprintf(mess,"Read counter block failed\n");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user