#ifdef MCB_FUNCS #include #include #include #include #include #include "registers_m.h" #ifndef PICASSOD #include "server_defs.h" #else #include "picasso_defs.h" #endif #include "firmware_funcs.h" #include "mcb_funcs.h" /* global variables */ #undef DEBUG #undef DEBUGOUT 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; const int allSelected=-2; const int noneSelected=-1; sls_detector_module *detectorModules=NULL; int *detectorChips=NULL; int *detectorChans=NULL; int *detectorDacs=NULL; int *detectorAdcs=NULL; //int numberOfProbes; ROI rois[MAX_ROIS]; int nROI=0; int initDetector() { int imod; // sls_detector_module *myModule; int n=getNModBoard(); nModX=n; #ifdef VERBOSE printf("Board is for %d modules\n",n); #endif detectorModules=malloc(n*sizeof(sls_detector_module)); detectorChips=malloc(n*NCHIP*sizeof(int)); detectorChans=malloc(n*NCHIP*NCHAN*sizeof(int)); detectorDacs=malloc(n*NDAC*sizeof(int)); detectorAdcs=malloc(n*NADC*sizeof(int)); #ifdef VERBOSE printf("modules from 0x%x to 0x%x\n",(unsigned int)(detectorModules), (unsigned int)(detectorModules+n)); 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("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)); #endif for (imod=0; imoddacs=detectorDacs+imod*NDAC; (detectorModules+imod)->adcs=detectorAdcs+imod*NADC; (detectorModules+imod)->chipregs=detectorChips+imod*NCHIP; (detectorModules+imod)->chanregs=detectorChans+imod*NCHIP*NCHAN; (detectorModules+imod)->ndac=NDAC; (detectorModules+imod)->nadc=NADC; (detectorModules+imod)->nchip=NCHIP; (detectorModules+imod)->nchan=NCHIP*NCHAN; (detectorModules+imod)->module=imod; (detectorModules+imod)->gain=0; (detectorModules+imod)->offset=0; (detectorModules+imod)->reg=0; /* initialize registers, dacs, retrieve sn, adc values etc */ } thisSettings=UNINITIALIZED; sChan=noneSelected; sChip=noneSelected; sMod=noneSelected; sDac=noneSelected; sAdc=noneSelected; /* setCSregister(ALLMOD); //commented out by dhanya setSSregister(ALLMOD); counterClear(ALLMOD); clearSSregister(ALLMOD); putout("0000000000000000",ALLMOD); */ /* initialize dynamic range etc. */ /* 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; } int copyChannel(sls_detector_channel *destChan, sls_detector_channel *srcChan) { destChan->chan=srcChan->chan; destChan->chip=srcChan->chip; destChan->module=srcChan->module; destChan->reg=srcChan->reg; return OK; } int copyChip(sls_detector_chip *destChip, sls_detector_chip *srcChip) { int ichan; int ret=OK; if ((srcChip->nchan)>(destChip->nchan)) { printf("Number of channels of source is larger than number of channels of destination\n"); return FAIL; } destChip->nchan=srcChip->nchan; destChip->reg=srcChip->reg; destChip->chip=srcChip->chip; destChip->module=srcChip->module; for (ichan=0; ichan<(srcChip->nchan); ichan++) { *((destChip->chanregs)+ichan)=*((srcChip->chanregs)+ichan); } return ret; } int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) { int ichip, idac, ichan, iadc; int ret=OK; #ifdef VERBOSE printf("Copying module %x to module %x\n",(unsigned int)(srcMod),(unsigned int)(destMod)); #endif if (srcMod->module>=0) { #ifdef VERBOSE printf("Copying module number %d to module number %d\n",srcMod->module,destMod->module); #endif destMod->module=srcMod->module; } if (srcMod->serialnumber>=0){ /* #ifdef VERBOSE */ /* printf("Copying module serial number %x to module serial number %x\n",srcMod->serialnumber,destMod->serialnumber); */ /* #endif */ destMod->serialnumber=srcMod->serialnumber; } if ((srcMod->nchip)>(destMod->nchip)) { printf("Number of chip of source is larger than number of chips of destination\n"); return FAIL; } if ((srcMod->nchan)>(destMod->nchan)) { printf("Number of channels of source is larger than number of channels of destination\n"); return FAIL; } if ((srcMod->ndac)>(destMod->ndac)) { printf("Number of dacs of source is larger than number of dacs of destination\n"); return FAIL; } if ((srcMod->nadc)>(destMod->nadc)) { printf("Number of dacs of source is larger than number of dacs of destination\n"); return FAIL; } #ifdef VERBOSE printf("DACs: src %d, dest %d\n",srcMod->ndac,destMod->ndac); printf("ADCs: src %d, dest %d\n",srcMod->nadc,destMod->nadc); printf("Chips: src %d, dest %d\n",srcMod->nchip,destMod->nchip); printf("Chans: src %d, dest %d\n",srcMod->nchan,destMod->nchan); #endif destMod->ndac=srcMod->ndac; destMod->nadc=srcMod->nadc; destMod->nchip=srcMod->nchip; destMod->nchan=srcMod->nchan; if (srcMod->reg>=0) destMod->reg=srcMod->reg; #ifdef VERBOSE printf("Copying register %x (%x)\n",destMod->reg,srcMod->reg ); #endif if (srcMod->gain>=0) destMod->gain=srcMod->gain; if (srcMod->offset>=0) destMod->offset=srcMod->offset; // printf("copying gain and offset %f %f to %f %f\n",srcMod->gain,srcMod->offset,destMod->gain,destMod->offset); for (ichip=0; ichip<(srcMod->nchip); ichip++) { if (*((srcMod->chipregs)+ichip)>=0) *((destMod->chipregs)+ichip)=*((srcMod->chipregs)+ichip); } for (ichan=0; ichan<(srcMod->nchan); ichan++) { if (*((srcMod->chanregs)+ichan)>=0) *((destMod->chanregs)+ichan)=*((srcMod->chanregs)+ichan); } for (idac=0; idac<(srcMod->ndac); idac++) { if (*((srcMod->dacs)+idac)>=0) *((destMod->dacs)+idac)=*((srcMod->dacs)+idac); } for (iadc=0; iadc<(srcMod->nadc); iadc++) { if (*((srcMod->adcs)+iadc)>=0) *((destMod->adcs)+iadc)=*((srcMod->adcs)+iadc); } return ret; } /* Register commands */ int clearDACSregister(int imod) { putout("1111111111111111",imod);//reset putout("1111111111111110",imod);//cs down /* commented out by dhanya putout("0000000001000000",imod); putout("0000000101000000",imod); putout("0000000101000000",imod); putout("0000000001000000",imod); */ #ifdef DEBUG fprintf(stdout, "Clearing DAC shiftregister\n"); #endif // sDac=0; sMod=imod; if (imod==ALLMOD) sMod=allSelected; return OK; } int nextDAC(int imod) { putout("1111111111111011",imod);//cs up putout("1111111111111001",imod);//clk down putout("1111111111111111",imod);//reset /*commented out by dhanya putout("0000000001000000",imod); putout("0000000001001000",imod); putout("0000000001000000",imod); */ #ifdef DEBUG fprintf(stdout, "Next DAC\n"); #endif // sDac++; sMod=imod; if (imod==ALLMOD) sMod=allSelected; return OK; } int clearCSregister(int imod) { putout("0000000001000000",imod); putout("0000100001000000",imod); putout("0000100001000000",imod); putout("0000000001000000",imod); #ifdef DEBUG fprintf(stdout, "Clearing CS shiftregister\n"); #endif /* sChan=noneSelected; sMod=noneSelected; sDac=noneSelected; sAdc=noneSelected; */ sChip=noneSelected; sMod=imod; if (imod==ALLMOD) sMod=allSelected; //putout("0000000000000000",imod); return 0; } int setCSregister(int imod){ putout("0000000001000000",imod); putout("0001000001000000",imod); putout("0001000001000000",imod); putout("0000000001000000",imod); #ifdef DEBUG fprintf(stdout, "Setting CS shiftregister\n"); #endif putout("0000000000000000",imod); sChip=allSelected; sMod=imod; if (imod==ALLMOD) sMod=allSelected; return 0; } int nextChip(int imod){ putout("0000000001000000",imod); putout("0010000001000000",imod); putout("0000000001000000",imod); #ifdef DEBUG fprintf(stdout, "Next Chip\n"); #endif sChip++; sMod=imod; if (imod==ALLMOD) sMod=allSelected; return 0; } int firstChip(int imod){ putout("0100000001000000",imod); putout("0110000001000000",imod); putout("0100000001000000",imod); #ifdef DEBUG fprintf(stdout, "First Chip\n"); #endif sChip=0; sMod=imod; if (imod==ALLMOD) sMod=allSelected; return 0; } int clearSSregister(int imod){ int i; putout("0000011000000000",imod); for (i=0; i<10; i++) putout("0000111000000000",imod); putout("0000011000000000",imod); #ifdef DEBUG fprintf(stdout,"Clearing SS shiftregister\n"); #endif putout("0000000000000000",imod); sChan=noneSelected; sMod=imod; if (imod==ALLMOD) sMod=allSelected; return 0; } int setSSregister(int imod){ int i; putout("0000011000000000",imod); for (i=0; i<10; i++) putout("0001011000000000",imod); putout("0000011000000000",imod); #ifdef DEBUG fprintf(stdout,"Setting SS shiftregister\n"); #endif putout("0000000000000000",imod); sChan=allSelected; sMod=imod; if (imod==ALLMOD) sMod=allSelected; return 0; } int nextStrip(int imod){ putout("0000011000000000",imod); putout("0010011000000000",imod); putout("0000011000000000",imod); #ifdef DEBUG fprintf(stdout,"|-"); #endif sChan++; sMod=imod; if (imod==ALLMOD) sMod=allSelected; return 0; } int selChannel(const int strip,int imod) { int istrip; clearSSregister(imod); nextStrip(imod); for (istrip=0; istrip=0 && imod=0) initDAC(ind,val, imod); if (imod>=0 && imodndac) return (detectorDacs[ind+imod*NDAC]); } return FAIL; */ return setDACRegister(ind, -1, imod); } int initDAC(int dac_addr, int value, int imod) { // int i; #ifdef VERBOSE printf("Programming dac %d with value %d\n", dac_addr, value); #endif clearDACSregister(imod); program_one_dac(dac_addr,value,imod); nextDAC(imod); clearDACSregister(imod); return 0; } int getTemperatureByModule(int tempSensor, int imod) { int im; //for the particular module if (imod>=0 && imod=0 && imod=0 && imod=0) { #ifdef VERBOSE fprintf(stdout, "voltage %d\n", *(v+iaddr)); #endif program_one_dac(iaddr, *(v+iaddr),imod); } nextDAC(imod); } clearDACSregister(imod); return 0; } int setSettings(int i, int imod) { #ifdef VERBOSE if(i==-1) printf("\nReading settings of detector...\n"); else printf("\ninside set settings wit settings=%d...\n",i); #endif int confgain[] = CONF_GAIN; int isett=-2,retval; //reading settings if(i==GET_SETTINGS){ retval=initConfGainByModule(i,i,imod); if(retval==i) isett=UNDEFINED; } //writing settings else{ retval=initConfGainByModule(i,confgain[i],imod); if(retval!=i) isett=UNDEFINED; } //if error while read/writing if(isett==UNDEFINED) printf("Error:Weird Value read back from the Gain/Settings Reg\n"); else{ //validating the settings read back if((retval>=HIGHGAIN)&&(retval<=VERYHIGHGAIN)) isett=retval; else{ isett=UNDEFINED; printf("Error:Wrong Settings Read out:%d\n",retval); } } thisSettings=isett; #ifdef VERBOSE printf("detector settings are %d\n",thisSettings); #endif return thisSettings; } /* Initialization*/ int initChannelbyNumber(sls_detector_channel myChan) { int reg=myChan.reg; int ft=reg & TRIM_DR; int cae=(reg>>(NTRIMBITS))&1; int ae=(reg>>(NTRIMBITS+1))&1; int coe=(reg>>(NTRIMBITS+2))&1; int ocoe=(reg>>(NTRIMBITS+3))&1; int counts=(reg>>(NTRIMBITS+4)); #ifdef VERBOSE printf("Initializing channel %d chip %d module %d reg %x\n",myChan.chan,myChan.chip,myChan.module, reg); printf("trim %d, cae %d, ae %d, coe %d, ocoe %d, counts %d\n",ft, cae, ae, coe, ocoe, counts); #endif if (myChan.chip<0) setCSregister(myChan.module); else selChip(myChan.chip,myChan.module); if (myChan.chan<0) setSSregister(myChan.module); else selChannel(myChan.chan,myChan.module); initChannel(ft,cae,ae, coe, ocoe, counts,myChan.module); setDynamicRange(dynamicRange); setCSregister(ALLMOD); clearSSregister(ALLMOD); putout("0000000000000000",ALLMOD); return myChan.reg; } int getChannelbyNumber(sls_detector_channel* myChan) { int imod, ichip, ichan; imod=myChan->module; ichip=myChan->chip; ichan=myChan->chan; if (detectorChans) { if (imod=0) { if (ichip<(detectorModules+imod)->nchip && ichan<(detectorModules+imod)->nchan/(detectorModules+imod)->nchip) myChan->reg=detectorChans[imod*NCHAN*NCHIP+ichip*NCHAN+ichan]; return OK; } } return FAIL; } int getTrimbit(int imod, int ichip, int ichan) { if (detectorChans) { if (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 -1; } int initChannel(int ft,int cae, int ae, int coe, int ocoe, int counts, int imod){ int ibit, bit, i, im, ichip, ichan; int chanmi, chanma, chipmi, chipma, modmi, modma; sMod=imod; // printf("initializing module %d\n",sMod); if (imod==ALLMOD) { sMod=allSelected; // printf("initializing all modules\n"); } 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) { // printf("initializing no channels ft=%d coe=%d\n",ft,coe); chanmi=0; chanma=-1; } else { // printf("initializing channel %d ft=%d coe=%d\n",sChan, ft,coe); chanmi=sChan; chanma=sChan+1; } if (sChip==allSelected) { // printf("initializing all chips\n"); chipmi=0; chipma=NCHIP; } else if (sChip==noneSelected || sChip>NCHIP || sChip<0) { // printf("initializing no chips\n"); chipmi=0; chipma=-1; } else { // printf("initializing chip %d\n",sChip); chipmi=sChip; chipma=sChip+1; } if (sMod==allSelected) { modmi=0; modma=nModX;//getNModBoard(); } else if (sMod==noneSelected || sMod>nModX || sMod<0) {//(sMod==noneSelected || sMod>getNModBoard() || sMod<0) { modmi=0; modma=-1; return 1; } else { modmi=sMod; modma=sMod+1; } if (detectorChans) { for (im=modmi; im63 || ft<0) { fprintf(stdout,"Fine Threshold is %d while should be between 0 and 63!",ft); return 1; } /*cal_enable*/ if (cae) { putout("0100000000000000",imod); putout("0110000000000000",imod); } else { putout("0000000000000000",imod); putout("0010000000000000",imod); } /*n_an_enable*/ if (ae) { putout("0000000000000000",imod); putout("0010000000000000",imod); putout("0000000000000000",imod); } else { putout("0100000000000000",imod); putout("0110000000000000",imod); putout("0100000000000000",imod); } /*trb5*/ ibit=5; bit=ft & (1<>1; int nchan, ichan; int ft, cae, ae, coe, ocoe, counts, chanreg; nchan=myChip.nchan; if (ichip<0) setCSregister(imod); else selChip(ichip,imod); clearSSregister(imod); for (ichan=0; ichan>(NTRIMBITS+1))&1; ae=(chanreg>>(NTRIMBITS+2))&1; coe=((chanreg)>>(NTRIMBITS+3))&1; ocoe=((chanreg)>>(NTRIMBITS+4))&1; counts=((chanreg)>>(NTRIMBITS+5)); nextStrip(imod); initChannel(ft,cae,ae, coe, ocoe, counts,imod); } initChip(obe,ow,imod); return myChip.reg; } int getChipbyNumber(sls_detector_chip* myChip){ int imod, ichip; imod=myChip->module; ichip=myChip->chip; if (detectorChips) { if (imodnchip) { myChip->reg=detectorChips[ichip+imod*NCHIP]; myChip->nchan=NCHAN; myChip->chanregs=detectorChans+imod*NCHAN*NCHIP+ichip*NCHIP; return OK; } } return FAIL; } int initChip(int obe, int ow,int imod){ int i; int im, ichip; int chipmi, chipma, modmi, modma; /* switch (ow) { case 0:; case 1: setDynamicRange(32); break; case 2: setDynamicRange(16); break; case 3: setDynamicRange(8); break; case 4: setDynamicRange(4); break; case 5: setDynamicRange(1); break; default: setDynamicRange(32); break; } */ #ifdef DEBUGOUT printf("Initializing chip\n"); #endif putout("0000000000000000",imod); #ifdef DEBUGOUT printf("Output mode= %d\n", ow); #endif /* clearing shift in register */ for (i=0; i<10; i++) putout("0000100000000000",imod); putout("0000000000000000",imod); if (ow>0) { putout("0100000000000000",imod); putout("0110000000000000",imod); putout("0100000000000000",imod); for (i=0; i<(OUTMUX_OFFSET-1); i++) { putout("0000000000000000",imod); putout("0010000000000000",imod); putout("0000000000000000",imod); } if (ow>1) { putout("0000000000000000",imod); putout("0010000000000000",imod); putout("0000000000000000",imod); } if (ow>2) { putout("0000000000000000",imod); putout("0010000000000000",imod); putout("0000000000000000",imod); } if (ow>3) { putout("0000000000000000",imod); putout("0010000000000000",imod); putout("0000000000000000",imod); } if (ow>4) { putout("0000000000000000",imod); putout("0010000000000000",imod); putout("0000000000000000",imod); } } #ifdef DEBUGOUT printf("Output buffer enable= %d\n", obe); #endif if (obe) { putout("0100000000000000",imod); putout("0110000000000000",imod); putout("0100000000000000",imod); } else { putout("0000000000000000",imod); putout("0010000000000000",imod); putout("0000000000000000",imod); } /*}*/ putout("0000000000000000",imod); sMod=imod; if (imod==ALLMOD) sMod=allSelected; if (sChip==allSelected) { chipmi=0; chipma=NCHIP; } else if (sChip==noneSelected || sChip>NCHIP || sChip<0) { chipmi=0; chipma=-1; } else { chipmi=sChip; chipma=sChip+1; } if (sMod==allSelected) { modmi=0; modma=nModX;//getNModBoard(); } else if (sMod==noneSelected || sMod>nModX || sMod<0) {//(sMod==noneSelected || sMod>getNModBoard() || sMod<0) { modmi=0; modma=-1; } else { modmi=sMod; modma=sMod+1; } if (detectorChips) { for (im=modmi; imNCHIP || sChip<0) { chipmi=0; chipma=-1; } else { chipmi=sChip; chipma=sChip+1; } if (sMod==allSelected) { modmi=0; modma=nModX;//getNModBoard(); } else if (sMod==noneSelected || sMod>nModX || sMod<0) {//(sMod==noneSelected || sMod>getNModBoard() || sMod<0) { modmi=0; modma=-1; } else { modmi=sMod; modma=sMod+1; } if (detectorChips) { for (im=modmi; imnModX || sMod<0) {//(sMod==noneSelected || sMod>getNModBoard() || sMod<0) { modmi=0; modma=-1; } else { modmi=sMod; modma=sMod+1; } if (detectorModules) { for (im=modmi; imreg)=cm; #ifdef VERBOSE printf("imod=%d reg=%d (%x)\n",im,(detectorModules+im)->reg,(unsigned int)((detectorModules+im))); #endif } } return 0; } int initModulebyNumber(sls_detector_module myMod) { printf("\ninside initmoduleynumber..\n"); int nchip,nchan;//int ichip, nchip, ichan, nchan; int im, modmi,modma; // int ft, cae, ae, coe, ocoe, counts, chanreg; int imod; // int obe; // int ow; int v[NDAC]; nchip=myMod.nchip; nchan=(myMod.nchan)/nchip; imod=myMod.module; sMod=imod; if (sMod==ALLMOD) sMod=allSelected; if (sMod==allSelected) { modmi=0; modma=nModX;//getNModBoard(); } else if (sMod==noneSelected || sMod>nModX || sMod<0) {// (sMod==noneSelected || sMod>getNModBoard() || sMod<0) { modmi=0; modma=-1; } else { modmi=sMod; modma=sMod+1; } /* for (idac=0; idacmodule; #ifdef VERBOSE printf("Getting module %d\n",imod); #endif if (detectorModules) { copyModule(myMod,detectorModules+imod); ; } else return FAIL; return OK; } /* To chips */ int clearCounter(int imod){ int i; #ifdef DEBUG printf("Clearing counter with contclear\n"); #endif putout("0000000000000000",imod); for (i=0; i<10; i++) putout("0000000000010000",imod); putout("0000000000000000",imod); return 0; } int clearOutReg(int imod){ int i; #ifdef DEBUG printf("Clearing output register\n"); #endif putout("0000010000000000",imod); for (i=0; i<10; i++) putout("0000110000000000",imod); putout("0000010000000000",imod); return 0; } int setOutReg(int imod){ int i; #ifdef DEBUG printf("Setting output register\n"); #endif putout("0000010000000000",imod); for (i=0; i<10; i++) putout("0001010000000000",imod); putout("0000010000000000",imod); return 0; } int extPulse(int ncal, int imod) { int ical; #ifdef DEBUG printf("Giving a clock pulse to the counter\n"); #endif for (ical=0; ical0 && i%2==0) { printf("Shift in: module %d chip %i bit %d read %d instead of %d \n",k,j,i,val & 1<< j, i%2); result++; } if (i%2>0 && (val & 1<0 && (dum & (1<0) { printf("Shift out: module %d chip %i bit %d read %d instead of %d \n",k,j,i,val & 1<< j, (dum &1<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++; } if (i%2>0 && (val & 1<> 1; putout("0000000000000000",ALLMOD); putout("0010000000000000",ALLMOD); //change mux setting putout("0000000000000000",ALLMOD); } printf("Test FpgaMux module %d : %d errors\n", imod,result); if (result) return 1; else return 0; } int calibration_sensor(int num, int *v, int *dacs) { int ich, ichip, imod; int val[10]; printf("calibrating sensor..."); for (imod=0; imod=0){ if(n==0) adc=-1; else{ //if its for 1 adc or general if ((arg[0].xmin==0) && (arg[0].xmax==GOTTHARDNCHIP*GOTTHARDNCHAN)) adc=-1; else{ //adc = mid value/numchans also for only 1 roi adc = ((((arg[0].xmax)+(arg[0].xmin))/2)/(GOTTHARDNCHAN*NCHIPS_PER_ADC)); if((adc>=0) && (adc<=4)); else { printf("warning:adc value greater than 5. deleting roi\n"); adc=-1; } } } //set rois for just 1 adc - take only 1st roi if(adc!=-1){ rois[0].xmin=adc*(GOTTHARDNCHAN*NCHIPS_PER_ADC); rois[0].xmax=(adc+1)*(GOTTHARDNCHAN*NCHIPS_PER_ADC)-1; rois[0].ymin=-1; rois[0].ymax=-1; nROI = 1; }else nROI = 0; if((arg[0].xmin!=rois[0].xmin)||(arg[0].xmax!=rois[0].xmax)||(arg[0].ymin!=rois[0].ymin)||(arg[0].ymax!=rois[0].ymax)) *ret=FAIL; if(n!=nROI) *ret=FAIL; //set adc of interest setADC(adc); }*/ //#ifdef VERBOSE printf("Rois:\n"); for( i=0;i