mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-18 15:57:13 +02:00
some jctb changes
This commit is contained in:
@ -99,6 +99,7 @@ int udpPacketSize=DEFAULT_UDP_PACKETSIZE;
|
|||||||
u_int32_t clkDivider[2]={32,16};
|
u_int32_t clkDivider[2]={32,16};
|
||||||
int32_t clkPhase[2]={0,0};
|
int32_t clkPhase[2]={0,0};
|
||||||
|
|
||||||
|
u_int32_t adcDisableMask=0;
|
||||||
|
|
||||||
int ififostart, ififostop, ififostep, ififo;
|
int ififostart, ififostop, ififostep, ififo;
|
||||||
|
|
||||||
@ -1137,10 +1138,31 @@ u_int32_t testRAM(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int getNModBoard() {
|
int getNModBoard() {
|
||||||
return nModX;
|
return 32;//nModX;
|
||||||
}
|
}
|
||||||
|
|
||||||
int setNMod(int n) {
|
int setNMod(int n) {
|
||||||
|
|
||||||
|
/* printf("Writin ADC disable register %08x\n",n); */
|
||||||
|
/* bus_w(ADC_LATCH_DISABLE_REG,n); */
|
||||||
|
return getNMod();
|
||||||
|
}
|
||||||
|
|
||||||
|
int getNMod() {
|
||||||
|
/* u_int32_t reg; */
|
||||||
|
/* int i; */
|
||||||
|
/* reg=bus_r(ADC_LATCH_DISABLE_REG); */
|
||||||
|
|
||||||
|
/* printf("Read ADC disable register %08x\n",reg); */
|
||||||
|
/* nModX=32; */
|
||||||
|
/* for (i=0; i<32; i++) { */
|
||||||
|
/* if (reg & (1<<i)) { */
|
||||||
|
/* nModX--; */
|
||||||
|
/* printf("ADC %d is disabled\n",i); */
|
||||||
|
/* } */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
|
||||||
return nModX;
|
return nModX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1314,6 +1336,65 @@ int64_t getFramesFromStart(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ROI *setROI(int nroi,ROI* arg,int *retvalsize, int *ret) {
|
||||||
|
ROI retval[MAX_ROIS];
|
||||||
|
int i, ich;
|
||||||
|
|
||||||
|
adcDisableMask=0xfffffffff;
|
||||||
|
|
||||||
|
printf("Setting ROI\n");
|
||||||
|
if (nroi>=0) {
|
||||||
|
if (nroi==0) {
|
||||||
|
adcDisableMask=0;
|
||||||
|
} else {
|
||||||
|
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)
|
||||||
|
adcDisableMask&=~(1<<ich);
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
printf("%d write adc disable mask %08x\n",ich , adcDisableMask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("write adc disable mask %08x\n",adcDisableMask);
|
||||||
|
bus_w(ADC_LATCH_DISABLE_REG,adcDisableMask);
|
||||||
|
}
|
||||||
|
*ret=OK;
|
||||||
|
|
||||||
|
adcDisableMask=bus_r(ADC_LATCH_DISABLE_REG);
|
||||||
|
|
||||||
|
printf("read adc disable mask %08x\n",adcDisableMask);
|
||||||
|
*retvalsize=0;
|
||||||
|
retval[0].xmin=0;
|
||||||
|
retval[0].xmax=0;
|
||||||
|
for (ich=0 ; ich<NCHAN ; ich++) {
|
||||||
|
if ((~adcDisableMask)&(1<<ich)) {
|
||||||
|
if (ich==0) {
|
||||||
|
*retvalsize+=1;
|
||||||
|
if (*retvalsize>MAX_ROIS) {
|
||||||
|
*retvalsize-=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
retval[*retvalsize-1].xmin=ich;
|
||||||
|
retval[*retvalsize-1].xmax=ich;
|
||||||
|
} else {
|
||||||
|
if ((adcDisableMask)&(1<<(ich-1))) {
|
||||||
|
*retvalsize+=1;
|
||||||
|
if (*retvalsize>MAX_ROIS) {
|
||||||
|
*retvalsize-=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
retval[*retvalsize-1].xmin=ich;
|
||||||
|
}
|
||||||
|
retval[*retvalsize-1].xmax=ich;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getDynamicRange();
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int loadImage(int index, short int ImageVals[]){
|
int loadImage(int index, short int ImageVals[]){
|
||||||
@ -1878,7 +1959,7 @@ u_int32_t runState(void) {
|
|||||||
// State Machine
|
// State Machine
|
||||||
|
|
||||||
int startStateMachine(){
|
int startStateMachine(){
|
||||||
int i;
|
//int i;
|
||||||
//#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
printf("*******Starting State Machine*******\n");
|
printf("*******Starting State Machine*******\n");
|
||||||
//#endif
|
//#endif
|
||||||
@ -1896,23 +1977,24 @@ int i;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
for(i=0;i<100;i++){
|
// for(i=0;i<100;i++){
|
||||||
//start state machine
|
//start state machine
|
||||||
bus_w16(CONTROL_REG, FIFO_RESET_BIT);
|
bus_w16(CONTROL_REG, FIFO_RESET_BIT);
|
||||||
bus_w16(CONTROL_REG, 0x0);
|
bus_w16(CONTROL_REG, 0x0);
|
||||||
bus_w16(CONTROL_REG, START_ACQ_BIT | START_EXPOSURE_BIT);
|
bus_w16(CONTROL_REG, START_ACQ_BIT | START_EXPOSURE_BIT);
|
||||||
|
usleep(20);
|
||||||
bus_w16(CONTROL_REG, 0x0);
|
bus_w16(CONTROL_REG, 0x0);
|
||||||
//verify
|
//verify
|
||||||
if(bus_r(STATUS_REG) & RUN_BUSY_BIT)
|
/* if(bus_r(STATUS_REG) & RUN_BUSY_BIT) */
|
||||||
break;
|
/* break; */
|
||||||
else {
|
/* else { */
|
||||||
printf("status: %08x\n",bus_r(STATUS_REG));
|
/* printf("status: %08x\n",bus_r(STATUS_REG)); */
|
||||||
usleep(5000);
|
/* usleep(5000); */
|
||||||
}
|
/* } */
|
||||||
}
|
/* } */
|
||||||
|
|
||||||
if(i!=0)
|
/* if(i!=0) */
|
||||||
printf("tried to start state machine %d times\n",i);
|
/* printf("tried to start state machine %d times\n",i); */
|
||||||
|
|
||||||
if(i==100){
|
if(i==100){
|
||||||
printf("\n***********COULD NOT START STATE MACHINE***************\n");
|
printf("\n***********COULD NOT START STATE MACHINE***************\n");
|
||||||
@ -1935,15 +2017,16 @@ int stopStateMachine(){
|
|||||||
write_stop_sm(1);
|
write_stop_sm(1);
|
||||||
write_status_sm("Stopped");
|
write_status_sm("Stopped");
|
||||||
#endif
|
#endif
|
||||||
for(i=0;i<100;i++){
|
// for(i=0;i<100;i++){
|
||||||
//stop state machine
|
//stop state machine
|
||||||
bus_w16(CONTROL_REG, STOP_ACQ_BIT);
|
bus_w16(CONTROL_REG, STOP_ACQ_BIT);
|
||||||
|
usleep(100);
|
||||||
bus_w16(CONTROL_REG, 0x0);
|
bus_w16(CONTROL_REG, 0x0);
|
||||||
usleep(5000);
|
/* usleep(5000); */
|
||||||
//verify
|
/* //verify */
|
||||||
if(!(bus_r(STATUS_REG)&RUNMACHINE_BUSY_BIT))
|
/* if(!(bus_r(STATUS_REG)&RUNMACHINE_BUSY_BIT)) */
|
||||||
break;
|
/* break; */
|
||||||
}
|
/* } */
|
||||||
if(i!=0)
|
if(i!=0)
|
||||||
printf("tried to stop state machine %d times\n",i);
|
printf("tried to stop state machine %d times\n",i);
|
||||||
if(i==100){
|
if(i==100){
|
||||||
@ -1974,6 +2057,7 @@ int startReadOut(){
|
|||||||
printf("State machine status is %08x\n",bus_r(STATUS_REG));
|
printf("State machine status is %08x\n",bus_r(STATUS_REG));
|
||||||
#endif
|
#endif
|
||||||
bus_w16(CONTROL_REG, START_ACQ_BIT |START_READOUT_BIT); // start readout
|
bus_w16(CONTROL_REG, START_ACQ_BIT |START_READOUT_BIT); // start readout
|
||||||
|
usleep(100);
|
||||||
bus_w16(CONTROL_REG, 0x0);
|
bus_w16(CONTROL_REG, 0x0);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -2019,6 +2103,7 @@ u_int16_t* fifo_read_event(int ns)
|
|||||||
int i=0;//, j=0;
|
int i=0;//, j=0;
|
||||||
/* volatile u_int16_t volatile *dum; */
|
/* volatile u_int16_t volatile *dum; */
|
||||||
volatile u_int16_t a;
|
volatile u_int16_t a;
|
||||||
|
volatile u_int32_t val;
|
||||||
// volatile u_int32_t volatile *dum;
|
// volatile u_int32_t volatile *dum;
|
||||||
// volatile u_int32_t a;
|
// volatile u_int32_t a;
|
||||||
|
|
||||||
@ -2060,9 +2145,22 @@ u_int16_t* fifo_read_event(int ns)
|
|||||||
/* #else */
|
/* #else */
|
||||||
|
|
||||||
bus_w16(DUMMY_REG,1<<8); // read strobe to all fifos
|
bus_w16(DUMMY_REG,1<<8); // read strobe to all fifos
|
||||||
// bus_w16(DUMMY_REG,0);
|
bus_w16(DUMMY_REG,0);
|
||||||
// for (i=0; i<32; i++) {
|
// i=0;//
|
||||||
bus_w16(DUMMY_REG,0); //
|
/* for (i=0; i<32; i++) { */
|
||||||
|
|
||||||
|
/* /\* while (((adcDisableMask&(3<<((i)*2)))>>((i)*2))==3) { *\/ */
|
||||||
|
/* /\* i++; *\/ */
|
||||||
|
/* /\* if (i>15) *\/ */
|
||||||
|
/* /\* break; *\/ */
|
||||||
|
/* /\* } *\/ */
|
||||||
|
/* /\* if (i<16) { *\/ */
|
||||||
|
/* bus_w16(DUMMY_REG,i); */
|
||||||
|
/* } */
|
||||||
|
/* val=*values; */
|
||||||
|
|
||||||
|
|
||||||
|
// bus_w16(DUMMY_REG,0); //
|
||||||
for (i=0; i<16; i++) {
|
for (i=0; i<16; i++) {
|
||||||
|
|
||||||
|
|
||||||
@ -2074,7 +2172,7 @@ u_int16_t* fifo_read_event(int ns)
|
|||||||
//dum=(((u_int32_t*)(now_ptr))+i);
|
//dum=(((u_int32_t*)(now_ptr))+i);
|
||||||
|
|
||||||
// a=*values;//bus_r(FIFO_DATA_REG);
|
// a=*values;//bus_r(FIFO_DATA_REG);
|
||||||
|
// if ((adcDisableMask&(3<<(i*2)))==0) {
|
||||||
*((u_int32_t*)now_ptr)=*values;//bus_r(FIFO_DATA_REG);
|
*((u_int32_t*)now_ptr)=*values;//bus_r(FIFO_DATA_REG);
|
||||||
|
|
||||||
|
|
||||||
@ -2088,12 +2186,19 @@ u_int16_t* fifo_read_event(int ns)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
now_ptr+=4;
|
now_ptr+=4;
|
||||||
|
// }
|
||||||
|
/* while (((adcDisableMask&(3<<((i+1)*2)))>>((i+1)*2))==3) { */
|
||||||
|
/* i++; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
// if (((adcDisableMask&(3<<((i+1)*2)))>>((i+1)*2))!=3) {
|
||||||
|
|
||||||
bus_w16(DUMMY_REG,i+1);
|
bus_w16(DUMMY_REG,i+1);
|
||||||
|
// }
|
||||||
// *(((u_int16_t*)(now_ptr))+i)=bus_r16(FIFO_DATA_REG);
|
// *(((u_int16_t*)(now_ptr))+i)=bus_r16(FIFO_DATA_REG);
|
||||||
}
|
}
|
||||||
bus_w16(DUMMY_REG,0); //
|
// bus_w16(DUMMY_REG,0); //
|
||||||
/* #ifdef TIMEDBG */
|
/* #ifdef TIMEDBG */
|
||||||
|
|
||||||
/* gettimeofday(&tss,NULL); */
|
/* gettimeofday(&tss,NULL); */
|
||||||
@ -2229,8 +2334,8 @@ int setDynamicRange(int dr) {
|
|||||||
dynamicRange=16;
|
dynamicRange=16;
|
||||||
nSamples=dr/16;
|
nSamples=dr/16;
|
||||||
bus_w(NSAMPLES_REG,nSamples);
|
bus_w(NSAMPLES_REG,nSamples);
|
||||||
dataBytes=NMAXMOD*NCHIP*NCHAN*2;
|
|
||||||
}
|
}
|
||||||
|
getDynamicRange();
|
||||||
allocateRAM();
|
allocateRAM();
|
||||||
printf("Setting dataBytes to %d: dr %d; samples %d\n",dataBytes, dynamicRange, nSamples);
|
printf("Setting dataBytes to %d: dr %d; samples %d\n",dataBytes, dynamicRange, nSamples);
|
||||||
return getDynamicRange();
|
return getDynamicRange();
|
||||||
@ -2244,6 +2349,8 @@ int setDynamicRange(int dr) {
|
|||||||
int getDynamicRange() {
|
int getDynamicRange() {
|
||||||
// dynamicRange=16;
|
// dynamicRange=16;
|
||||||
nSamples=bus_r(NSAMPLES_REG);
|
nSamples=bus_r(NSAMPLES_REG);
|
||||||
|
getChannels();
|
||||||
|
dataBytes=nModX*NCHIP*getChannels()*2;
|
||||||
return dynamicRange*bus_r(NSAMPLES_REG);//nSamples;
|
return dynamicRange*bus_r(NSAMPLES_REG);//nSamples;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2290,11 +2397,20 @@ int setStoreInRAM(int b) {
|
|||||||
return allocateRAM();
|
return allocateRAM();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getChannels() {
|
||||||
|
int nch=32;
|
||||||
|
int i;
|
||||||
|
for (i=0; i<NCHAN; i++) {
|
||||||
|
if (adcDisableMask & (1<<i)) nch--;
|
||||||
|
}
|
||||||
|
return nch;
|
||||||
|
}
|
||||||
|
|
||||||
int allocateRAM() {
|
int allocateRAM() {
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
getDynamicRange();
|
getDynamicRange();
|
||||||
|
|
||||||
|
//adcDisableMask
|
||||||
size=dataBytes*nSamples;
|
size=dataBytes*nSamples;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
|
@ -169,6 +169,9 @@ uint64_t setPatternWaitTime(int level, uint64_t t);
|
|||||||
void initDac(int dacnum);
|
void initDac(int dacnum);
|
||||||
int setDac(int dacnum,int dacvalue);
|
int setDac(int dacnum,int dacvalue);
|
||||||
|
|
||||||
|
ROI *setROI(int nroi,ROI* arg,int *retvalsize, int *ret);
|
||||||
|
int getChannels();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
u_int32_t setNBits(u_int32_t);
|
u_int32_t setNBits(u_int32_t);
|
||||||
|
@ -2581,68 +2581,68 @@ int calibration_chip(int num, int *v, int *dacs) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ROI* setROI(int n, ROI arg[], int *retvalsize, int *ret){
|
/* ROI* setROI(int n, ROI arg[], int *retvalsize, int *ret){ */
|
||||||
|
|
||||||
int i,adc;
|
/* int i,adc; */
|
||||||
ROI temp;
|
/* ROI temp; */
|
||||||
|
|
||||||
if(n>=0){
|
/* if(n>=0){ */
|
||||||
|
|
||||||
//clear rois
|
/* //clear rois */
|
||||||
for(i=0;i<MAX_ROIS;i++)
|
/* for(i=0;i<MAX_ROIS;i++) */
|
||||||
rois[i]=temp;
|
/* rois[i]=temp; */
|
||||||
|
|
||||||
/*ideal way to set roi
|
/* /\*ideal way to set roi */
|
||||||
for(i=0;i<n;i++)
|
/* for(i=0;i<n;i++) */
|
||||||
rois[i]=arg[i];
|
/* rois[i]=arg[i]; */
|
||||||
nROI = n;
|
/* nROI = n; */
|
||||||
*/
|
/* *\/ */
|
||||||
|
|
||||||
if(n==0)
|
/* if(n==0) */
|
||||||
adc=-1;
|
/* adc=-1; */
|
||||||
else{
|
/* else{ */
|
||||||
//if its for 1 adc or general
|
/* //if its for 1 adc or general */
|
||||||
if ((arg[0].xmin==0) && (arg[0].xmax==GOTTHARDNCHIP*GOTTHARDNCHAN))
|
/* if ((arg[0].xmin==0) && (arg[0].xmax==GOTTHARDNCHIP*GOTTHARDNCHAN)) */
|
||||||
adc=-1;
|
/* adc=-1; */
|
||||||
else{
|
/* else{ */
|
||||||
//adc = mid value/numchans also for only 1 roi
|
/* //adc = mid value/numchans also for only 1 roi */
|
||||||
adc = ((((arg[0].xmax)+(arg[0].xmin))/2)/(GOTTHARDNCHAN*NCHIPS_PER_ADC));
|
/* adc = ((((arg[0].xmax)+(arg[0].xmin))/2)/(GOTTHARDNCHAN*NCHIPS_PER_ADC)); */
|
||||||
if((adc>=0) && (adc<=4));
|
/* if((adc>=0) && (adc<=4)); */
|
||||||
else {
|
/* else { */
|
||||||
printf("warning:adc value greater than 5. deleting roi\n");
|
/* printf("warning:adc value greater than 5. deleting roi\n"); */
|
||||||
adc=-1;
|
/* adc=-1; */
|
||||||
}
|
/* } */
|
||||||
}
|
/* } */
|
||||||
}
|
/* } */
|
||||||
|
|
||||||
|
|
||||||
//set rois for just 1 adc - take only 1st roi
|
/* //set rois for just 1 adc - take only 1st roi */
|
||||||
if(adc!=-1){
|
/* if(adc!=-1){ */
|
||||||
rois[0].xmin=adc*(GOTTHARDNCHAN*NCHIPS_PER_ADC);
|
/* rois[0].xmin=adc*(GOTTHARDNCHAN*NCHIPS_PER_ADC); */
|
||||||
rois[0].xmax=(adc+1)*(GOTTHARDNCHAN*NCHIPS_PER_ADC)-1;
|
/* rois[0].xmax=(adc+1)*(GOTTHARDNCHAN*NCHIPS_PER_ADC)-1; */
|
||||||
rois[0].ymin=-1;
|
/* rois[0].ymin=-1; */
|
||||||
rois[0].ymax=-1;
|
/* rois[0].ymax=-1; */
|
||||||
nROI = 1;
|
/* nROI = 1; */
|
||||||
}else
|
/* }else */
|
||||||
nROI = 0;
|
/* 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))
|
/* 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;
|
/* *ret=FAIL; */
|
||||||
if(n!=nROI)
|
/* if(n!=nROI) */
|
||||||
*ret=FAIL;
|
/* *ret=FAIL; */
|
||||||
|
|
||||||
//set adc of interest
|
/* //set adc of interest */
|
||||||
setADC(adc);
|
/* setADC(adc); */
|
||||||
}
|
/* } */
|
||||||
|
|
||||||
//#ifdef VERBOSE
|
/* //#ifdef VERBOSE */
|
||||||
printf("Rois:\n");
|
/* printf("Rois:\n"); */
|
||||||
for( i=0;i<nROI;i++)
|
/* for( i=0;i<nROI;i++) */
|
||||||
printf("%d\t%d\t%d\t%d\n",rois[i].xmin,rois[i].xmax,rois[i].ymin,rois[i].ymax);
|
/* printf("%d\t%d\t%d\t%d\n",rois[i].xmin,rois[i].xmax,rois[i].ymin,rois[i].ymax); */
|
||||||
//#endif
|
/* //#endif */
|
||||||
*retvalsize = nROI;
|
/* *retvalsize = nROI; */
|
||||||
return rois;
|
/* return rois; */
|
||||||
}
|
/* } */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ int calibration_chip(int num, int *values, int *dacs);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ROI* setROI(int n, ROI arg[], int *retvalsize, int *ret);
|
//ROI* setROI(int n, ROI arg[], int *retvalsize, int *ret);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ int adcvpp=0x4;
|
|||||||
int init_detector(int b, int checkType) {
|
int init_detector(int b, int checkType) {
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
int retvalsize,ret;
|
||||||
if (mapCSP0()==FAIL) { printf("Could not map memory\n");
|
if (mapCSP0()==FAIL) { printf("Could not map memory\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -157,6 +158,7 @@ int init_detector(int b, int checkType) {
|
|||||||
strcpy(thisClientIP,"none1");
|
strcpy(thisClientIP,"none1");
|
||||||
lockStatus=0;
|
lockStatus=0;
|
||||||
// getDynamicRange();
|
// getDynamicRange();
|
||||||
|
setROI(-1,NULL,&retvalsize,&ret);
|
||||||
allocateRAM();
|
allocateRAM();
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -2286,38 +2288,43 @@ int set_roi(int file_des) {
|
|||||||
int retvalsize=0;
|
int retvalsize=0;
|
||||||
ROI arg[MAX_ROIS];
|
ROI arg[MAX_ROIS];
|
||||||
ROI* retval=0;
|
ROI* retval=0;
|
||||||
|
int iroi;
|
||||||
strcpy(mess,"Could not set/get roi\n");
|
strcpy(mess,"Could not set/get roi\n");
|
||||||
|
|
||||||
|
|
||||||
|
// u_int32_t disable_reg=0;
|
||||||
|
|
||||||
|
|
||||||
n = receiveDataOnly(file_des,&nroi,sizeof(nroi));
|
n = receiveDataOnly(file_des,&nroi,sizeof(nroi));
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
sprintf(mess,"Error reading from socket\n");
|
sprintf(mess,"Error reading from socket\n");
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nroi!=-1){
|
if(nroi>=0){
|
||||||
n = receiveDataOnly(file_des,arg,nroi*sizeof(ROI));
|
n = receiveDataOnly(file_des,arg,nroi*sizeof(ROI));
|
||||||
if (n != (nroi*sizeof(ROI))) {
|
if (n != (nroi*sizeof(ROI))) {
|
||||||
sprintf(mess,"Received wrong number of bytes for ROI\n");
|
sprintf(mess,"Received wrong number of bytes for ROI\n");
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
//#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
/*
|
|
||||||
printf("Setting ROI to:");
|
printf("Setting ROI to:");
|
||||||
for( i=0;i<nroi;i++)
|
for( i=0;i<nroi;i++)
|
||||||
printf("%d\t%d\t%d\t%d\n",arg[i].xmin,arg[i].xmax,arg[i].ymin,arg[i].ymax);
|
printf("%d\t%d\t%d\t%d\n",arg[i].xmin,arg[i].xmax,arg[i].ymin,arg[i].ymax);
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
printf("Error: Function 41 or Setting ROI is not yet implemented in Moench!\n");
|
printf("Error: Function 41 or Setting ROI is not yet implemented in Moench!\n");
|
||||||
//#endif
|
//#endif
|
||||||
}
|
}
|
||||||
/* execute action if the arguments correctly arrived*/
|
/* execute action if the arguments correctly arrived*/
|
||||||
|
|
||||||
|
|
||||||
ret = FAIL;
|
|
||||||
/* NOT IMPLEMENTED
|
|
||||||
#ifdef MCB_FUNCS
|
|
||||||
if (lockStatus==1 && differentClients==1){//necessary???
|
if (lockStatus==1 && differentClients==1){//necessary???
|
||||||
sprintf(mess,"Detector locked by %s\n", lastClientIP);
|
sprintf(mess,"Detector locked by %s\n", lastClientIP);
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
@ -2331,8 +2338,7 @@ int set_roi(int file_des) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
if(ret==OK && differentClients){
|
if(ret==OK && differentClients){
|
||||||
printf("Force update\n");
|
printf("Force update\n");
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
|
@ -896,8 +896,8 @@ slsDetectorDefs::sls_detector_module* slsDetector::createModule(detectorType t)
|
|||||||
na=1;
|
na=1;
|
||||||
break;
|
break;
|
||||||
case JUNGFRAUCTB:
|
case JUNGFRAUCTB:
|
||||||
nch=32;
|
nch=1//32;
|
||||||
nm=1;
|
nm=32;
|
||||||
nc=1;
|
nc=1;
|
||||||
nd=8; // dacs+adcs
|
nd=8; // dacs+adcs
|
||||||
na=1;
|
na=1;
|
||||||
@ -1560,7 +1560,6 @@ int slsDetector::setNumberOfModules(int n, dimension d){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::getMaxNumberOfModules(dimension d){
|
int slsDetector::getMaxNumberOfModules(dimension d){
|
||||||
|
|
||||||
int retval;
|
int retval;
|
||||||
|
@ -684,6 +684,9 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
*/
|
*/
|
||||||
int setNumberOfModules(int n=GET_FLAG, dimension d=X); // if n=GET_FLAG returns the number of installed modules
|
int setNumberOfModules(int n=GET_FLAG, dimension d=X); // if n=GET_FLAG returns the number of installed modules
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
returns the instrinsic size of the detector (maxmodx, maxmody, nchans, nchips, ndacs
|
returns the instrinsic size of the detector (maxmodx, maxmody, nchans, nchips, ndacs
|
||||||
enum numberOf {
|
enum numberOf {
|
||||||
|
@ -402,6 +402,10 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
|||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="roimask"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
|
|
||||||
@ -2904,6 +2908,10 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
|||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
if (cmd=="maxmod")
|
if (cmd=="maxmod")
|
||||||
return string("cannot put!");
|
return string("cannot put!");
|
||||||
|
else if (cmd=="roimask"){
|
||||||
|
if (!sscanf(args[1],"%d",&val))
|
||||||
|
return string("could not scan ")+string(args[0])+string(" ")+string(args[1]);
|
||||||
|
}
|
||||||
else if (!sscanf(args[1],"%d",&val))
|
else if (!sscanf(args[1],"%d",&val))
|
||||||
return string("could not scan ")+string(args[0])+string(" ")+string(args[1]);
|
return string("could not scan ")+string(args[0])+string(" ")+string(args[1]);
|
||||||
|
|
||||||
@ -2929,9 +2937,10 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
|||||||
if ((narg > 2) && (sscanf(args[2],"%d",&val)) && (val>0))
|
if ((narg > 2) && (sscanf(args[2],"%d",&val)) && (val>0))
|
||||||
myDet->setMaxNumberOfChannelsPerDetector(Y,val);
|
myDet->setMaxNumberOfChannelsPerDetector(Y,val);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd=="nmod") {
|
if (cmd=="nmod" || cmd=="roimask") {
|
||||||
ret=myDet->setNumberOfModules(val);
|
ret=myDet->setNumberOfModules(val);
|
||||||
} else if (cmd=="maxmod") {
|
} else if (cmd=="maxmod") {
|
||||||
ret=myDet->getMaxNumberOfModules();
|
ret=myDet->getMaxNumberOfModules();
|
||||||
@ -2949,8 +2958,11 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
|||||||
else
|
else
|
||||||
return string("unknown detector size ")+cmd;
|
return string("unknown detector size ")+cmd;
|
||||||
|
|
||||||
|
if (cmd=="roimask")
|
||||||
|
sprintf(ans,"%x",ret);
|
||||||
|
else
|
||||||
sprintf(ans,"%d",ret);
|
sprintf(ans,"%d",ret);
|
||||||
|
|
||||||
return string(ans);
|
return string(ans);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user