mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-07 10:30:41 +02:00
server should be up to date
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@442 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
1ee23e21d5
commit
2176620ca4
@ -30,6 +30,7 @@ int dynamicRange=16;//32;
|
|||||||
int dataBytes=NMAXMOD*NCHIP*NCHAN*2;
|
int dataBytes=NMAXMOD*NCHIP*NCHAN*2;
|
||||||
int storeInRAM=0;
|
int storeInRAM=0;
|
||||||
int ROI_flag=0;
|
int ROI_flag=0;
|
||||||
|
int adcConfigured=-1;
|
||||||
u_int32_t *ram_values=NULL;
|
u_int32_t *ram_values=NULL;
|
||||||
volatile char *now_ptr=NULL;
|
volatile char *now_ptr=NULL;
|
||||||
volatile u_int16_t *values;
|
volatile u_int16_t *values;
|
||||||
@ -261,9 +262,9 @@ int cleanFifo(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
reg=bus_r(addr);
|
reg=bus_r(addr);
|
||||||
#ifdef DDEBUG
|
//#ifdef DDEBUG
|
||||||
printf("\nADC SYNC reg:%x\n",reg);
|
printf("\n***ADC SYNC reg:%x****\n",reg);
|
||||||
#endif
|
//#endif
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1178,11 +1179,10 @@ int initConfGain(int isettings,int val,int imod){
|
|||||||
|
|
||||||
int configureMAC(int ipad,long long int macad,long long int detectormacad, int detipad, int ival, int adc,int udpport){
|
int configureMAC(int ipad,long long int macad,long long int detectormacad, int detipad, int ival, int adc,int udpport){
|
||||||
|
|
||||||
if(runBusy())
|
//update adc configured
|
||||||
if(stopStateMachine()==FAIL)
|
adcConfigured = adc;
|
||||||
return FAIL;
|
|
||||||
|
|
||||||
|
|
||||||
|
printf("configuring with adc:%d\n",adc);
|
||||||
//setting adc mask
|
//setting adc mask
|
||||||
int reg;
|
int reg;
|
||||||
int udpPacketSize=0x050E;
|
int udpPacketSize=0x050E;
|
||||||
@ -1194,6 +1194,8 @@ int configureMAC(int ipad,long long int macad,long long int detectormacad, int d
|
|||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
ROI_flag=1;
|
ROI_flag=1;
|
||||||
|
//setting daqregister
|
||||||
|
setDAQRegister(adc);
|
||||||
reg = (NCHAN*2)<<CHANNEL_OFFSET;
|
reg = (NCHAN*2)<<CHANNEL_OFFSET;
|
||||||
reg&=CHANNEL_MASK;
|
reg&=CHANNEL_MASK;
|
||||||
int mask =1<<adc;
|
int mask =1<<adc;
|
||||||
@ -1204,7 +1206,10 @@ int configureMAC(int ipad,long long int macad,long long int detectormacad, int d
|
|||||||
break;
|
break;
|
||||||
//for all adcs
|
//for all adcs
|
||||||
default:
|
default:
|
||||||
|
adcConfigured=-1;
|
||||||
ROI_flag=0;
|
ROI_flag=0;
|
||||||
|
//setting daqregister
|
||||||
|
setDAQRegister(adc);
|
||||||
reg = (NCHAN*NCHIP)<<CHANNEL_OFFSET;
|
reg = (NCHAN*NCHIP)<<CHANNEL_OFFSET;
|
||||||
reg&=CHANNEL_MASK;
|
reg&=CHANNEL_MASK;
|
||||||
reg|=ACTIVE_ADC_MASK;
|
reg|=ACTIVE_ADC_MASK;
|
||||||
@ -1214,7 +1219,7 @@ int configureMAC(int ipad,long long int macad,long long int detectormacad, int d
|
|||||||
|
|
||||||
|
|
||||||
//setting daqregister
|
//setting daqregister
|
||||||
setDAQRegister(adc);
|
//setDAQRegister(adc);
|
||||||
|
|
||||||
#ifdef DDEBUG
|
#ifdef DDEBUG
|
||||||
printf("Chip of Intrst Reg:%x\n",bus_r(CHIP_OF_INTRST_REG));
|
printf("Chip of Intrst Reg:%x\n",bus_r(CHIP_OF_INTRST_REG));
|
||||||
@ -1236,7 +1241,7 @@ int configureMAC(int ipad,long long int macad,long long int detectormacad, int d
|
|||||||
tse_conf_regs=(tse_conf*)(CSP0BASE+offset2*2);
|
tse_conf_regs=(tse_conf*)(CSP0BASE+offset2*2);
|
||||||
|
|
||||||
#ifdef DDEBUG
|
#ifdef DDEBUG
|
||||||
printf("***Configuring MAC***\n");
|
printf("***Configuring MAC*** adc=%d\n",adc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(ival)
|
if(ival)
|
||||||
@ -1397,11 +1402,13 @@ int configureMAC(int ipad,long long int macad,long long int detectormacad, int d
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
return OK;
|
return adcConfigured;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int getAdcConfigured(){
|
||||||
|
return adcConfigured;
|
||||||
|
}
|
||||||
|
|
||||||
u_int32_t runBusy(void) {
|
u_int32_t runBusy(void) {
|
||||||
u_int32_t s = bus_r(STATUS_REG);
|
u_int32_t s = bus_r(STATUS_REG);
|
||||||
|
@ -66,6 +66,7 @@ int initHighVoltage(int val,int imod);
|
|||||||
int initConfGain(int isettings,int val,int imod);
|
int initConfGain(int isettings,int val,int imod);
|
||||||
|
|
||||||
int configureMAC(int ipad, long long int macad, long long int detectormacadd, int detipad, int ival, int adc,int udpport);
|
int configureMAC(int ipad, long long int macad, long long int detectormacadd, int detipad, int ival, int adc,int udpport);
|
||||||
|
int getAdcConfigured();
|
||||||
|
|
||||||
u_int64_t getDetectorNumber();
|
u_int64_t getDetectorNumber();
|
||||||
u_int32_t getFirmwareVersion();
|
u_int32_t getFirmwareVersion();
|
||||||
|
@ -2552,6 +2552,7 @@ int configure_mac(int file_des) {
|
|||||||
int udpport;
|
int udpport;
|
||||||
int detipad;
|
int detipad;
|
||||||
int adc=-1;
|
int adc=-1;
|
||||||
|
int retval=-100;
|
||||||
|
|
||||||
sprintf(mess,"Can't configure MAC\n");
|
sprintf(mess,"Can't configure MAC\n");
|
||||||
|
|
||||||
@ -2596,31 +2597,34 @@ int configure_mac(int file_des) {
|
|||||||
if (imod<0)
|
if (imod<0)
|
||||||
imod=ALLMOD;
|
imod=ALLMOD;
|
||||||
|
|
||||||
//#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
printf("Configuring MAC of module %d and adc %d at port %x\n", imod, adc,udpport);
|
printf("Configuring MAC of module %d and adc %d at port %x\n", imod, adc,udpport);
|
||||||
//#endif
|
//#endif
|
||||||
#ifdef MCB_FUNCS
|
#ifdef MCB_FUNCS
|
||||||
if (ret==OK){
|
if (ret==OK){
|
||||||
ret=configureMAC(ipad,imacadd,idetectormacadd,detipad,digitalTestBit,adc,udpport);
|
if(runBusy()){
|
||||||
if(ret==FAIL)
|
ret=stopStateMachine();
|
||||||
strcpy(mess,"could not stop detector acquisition to configure mac");
|
strcpy(mess,"could not stop detector acquisition to configure mac");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ret==OK)
|
||||||
|
configureMAC(ipad,imacadd,idetectormacadd,detipad,digitalTestBit,adc,udpport);
|
||||||
|
retval=getAdcConfigured();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (ret==FAIL)
|
if (ret==FAIL)
|
||||||
printf("configuring MAC of mod %d failed\n", imod);
|
printf("configuring MAC of mod %d failed\n", imod);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (differentClients)
|
if (differentClients)
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
|
|
||||||
/* send answer */
|
/* send answer */
|
||||||
/* send OK/failed */
|
/* send OK/failed */
|
||||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
if (ret==FAIL) {
|
if (ret==FAIL)
|
||||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
}
|
else
|
||||||
|
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
||||||
/*return ok/fail*/
|
/*return ok/fail*/
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user