mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-06 18:10:40 +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 storeInRAM=0;
|
||||
int ROI_flag=0;
|
||||
int adcConfigured=-1;
|
||||
u_int32_t *ram_values=NULL;
|
||||
volatile char *now_ptr=NULL;
|
||||
volatile u_int16_t *values;
|
||||
@ -261,9 +262,9 @@ int cleanFifo(){
|
||||
|
||||
}
|
||||
reg=bus_r(addr);
|
||||
#ifdef DDEBUG
|
||||
printf("\nADC SYNC reg:%x\n",reg);
|
||||
#endif
|
||||
//#ifdef DDEBUG
|
||||
printf("\n***ADC SYNC reg:%x****\n",reg);
|
||||
//#endif
|
||||
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){
|
||||
|
||||
if(runBusy())
|
||||
if(stopStateMachine()==FAIL)
|
||||
return FAIL;
|
||||
|
||||
//update adc configured
|
||||
adcConfigured = adc;
|
||||
|
||||
printf("configuring with adc:%d\n",adc);
|
||||
//setting adc mask
|
||||
int reg;
|
||||
int udpPacketSize=0x050E;
|
||||
@ -1194,6 +1194,8 @@ int configureMAC(int ipad,long long int macad,long long int detectormacad, int d
|
||||
case 3:
|
||||
case 4:
|
||||
ROI_flag=1;
|
||||
//setting daqregister
|
||||
setDAQRegister(adc);
|
||||
reg = (NCHAN*2)<<CHANNEL_OFFSET;
|
||||
reg&=CHANNEL_MASK;
|
||||
int mask =1<<adc;
|
||||
@ -1204,7 +1206,10 @@ int configureMAC(int ipad,long long int macad,long long int detectormacad, int d
|
||||
break;
|
||||
//for all adcs
|
||||
default:
|
||||
adcConfigured=-1;
|
||||
ROI_flag=0;
|
||||
//setting daqregister
|
||||
setDAQRegister(adc);
|
||||
reg = (NCHAN*NCHIP)<<CHANNEL_OFFSET;
|
||||
reg&=CHANNEL_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
|
||||
setDAQRegister(adc);
|
||||
//setDAQRegister(adc);
|
||||
|
||||
#ifdef DDEBUG
|
||||
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);
|
||||
|
||||
#ifdef DDEBUG
|
||||
printf("***Configuring MAC***\n");
|
||||
printf("***Configuring MAC*** adc=%d\n",adc);
|
||||
#endif
|
||||
|
||||
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 s = bus_r(STATUS_REG);
|
||||
|
@ -66,6 +66,7 @@ int initHighVoltage(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 getAdcConfigured();
|
||||
|
||||
u_int64_t getDetectorNumber();
|
||||
u_int32_t getFirmwareVersion();
|
||||
|
@ -2541,88 +2541,92 @@ int update_client(int file_des) {
|
||||
|
||||
int configure_mac(int file_des) {
|
||||
|
||||
int ret=OK;
|
||||
char arg[5][50];
|
||||
int n;
|
||||
int ret=OK;
|
||||
char arg[5][50];
|
||||
int n;
|
||||
|
||||
int imod=0;//should be in future sent from client as -1, arg[2]
|
||||
int ipad;
|
||||
long long int imacadd;
|
||||
long long int idetectormacadd;
|
||||
int udpport;
|
||||
int detipad;
|
||||
int adc=-1;
|
||||
int imod=0;//should be in future sent from client as -1, arg[2]
|
||||
int ipad;
|
||||
long long int imacadd;
|
||||
long long int idetectormacadd;
|
||||
int udpport;
|
||||
int detipad;
|
||||
int adc=-1;
|
||||
int retval=-100;
|
||||
|
||||
sprintf(mess,"Can't configure MAC\n");
|
||||
sprintf(mess,"Can't configure MAC\n");
|
||||
|
||||
|
||||
n = receiveDataOnly(file_des,arg,sizeof(arg));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
n = receiveDataOnly(file_des,arg,sizeof(arg));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
|
||||
sscanf(arg[0], "%x", &ipad);
|
||||
sscanf(arg[1], "%llx", &imacadd);
|
||||
sscanf(arg[2], "%x", &udpport);
|
||||
sscanf(arg[3], "%llx", &idetectormacadd);
|
||||
sscanf(arg[4], "%x", &detipad);
|
||||
sscanf(arg[0], "%x", &ipad);
|
||||
sscanf(arg[1], "%llx", &imacadd);
|
||||
sscanf(arg[2], "%x", &udpport);
|
||||
sscanf(arg[3], "%llx", &idetectormacadd);
|
||||
sscanf(arg[4], "%x", &detipad);
|
||||
|
||||
#ifdef VERBOSE
|
||||
int i;
|
||||
printf("\ndigital_test_bit in server %d\t",digitalTestBit);
|
||||
printf("\nipadd %x\t",ipad);
|
||||
printf("destination ip is %d.%d.%d.%d = 0x%x \n",(ipad>>24)&0xff,(ipad>>16)&0xff,(ipad>>8)&0xff,(ipad)&0xff,ipad);
|
||||
printf("macad:%llx\n",imacadd);
|
||||
for (i=0;i<6;i++)
|
||||
printf("mac adress %d is 0x%x \n",6-i,(unsigned int)(((imacadd>>(8*i))&0xFF)));
|
||||
printf("udp port:0x%x\n",udpport);
|
||||
printf("detector macad:%llx\n",idetectormacadd);
|
||||
for (i=0;i<6;i++)
|
||||
printf("detector mac adress %d is 0x%x \n",6-i,(unsigned int)(((idetectormacadd>>(8*i))&0xFF)));
|
||||
printf("detipad %x\n",detipad);
|
||||
printf("\n");
|
||||
int i;
|
||||
printf("\ndigital_test_bit in server %d\t",digitalTestBit);
|
||||
printf("\nipadd %x\t",ipad);
|
||||
printf("destination ip is %d.%d.%d.%d = 0x%x \n",(ipad>>24)&0xff,(ipad>>16)&0xff,(ipad>>8)&0xff,(ipad)&0xff,ipad);
|
||||
printf("macad:%llx\n",imacadd);
|
||||
for (i=0;i<6;i++)
|
||||
printf("mac adress %d is 0x%x \n",6-i,(unsigned int)(((imacadd>>(8*i))&0xFF)));
|
||||
printf("udp port:0x%x\n",udpport);
|
||||
printf("detector macad:%llx\n",idetectormacadd);
|
||||
for (i=0;i<6;i++)
|
||||
printf("detector mac adress %d is 0x%x \n",6-i,(unsigned int)(((idetectormacadd>>(8*i))&0xFF)));
|
||||
printf("detipad %x\n",detipad);
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
n = receiveDataOnly(file_des,&adc,sizeof(adc));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
n = receiveDataOnly(file_des,&adc,sizeof(adc));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
|
||||
|
||||
if (imod>=getNModBoard())
|
||||
ret=FAIL;
|
||||
if (imod<0)
|
||||
imod=ALLMOD;
|
||||
if (imod>=getNModBoard())
|
||||
ret=FAIL;
|
||||
if (imod<0)
|
||||
imod=ALLMOD;
|
||||
|
||||
//#ifdef VERBOSE
|
||||
printf("Configuring MAC of module %d and adc %d at port %x\n", imod, adc,udpport);
|
||||
//#endif
|
||||
//#ifdef VERBOSE
|
||||
printf("Configuring MAC of module %d and adc %d at port %x\n", imod, adc,udpport);
|
||||
//#endif
|
||||
#ifdef MCB_FUNCS
|
||||
if (ret==OK){
|
||||
ret=configureMAC(ipad,imacadd,idetectormacadd,detipad,digitalTestBit,adc,udpport);
|
||||
if(ret==FAIL)
|
||||
strcpy(mess,"could not stop detector acquisition to configure mac");
|
||||
}
|
||||
if (ret==OK){
|
||||
if(runBusy()){
|
||||
ret=stopStateMachine();
|
||||
strcpy(mess,"could not stop detector acquisition to configure mac");
|
||||
}
|
||||
|
||||
if(ret==OK)
|
||||
configureMAC(ipad,imacadd,idetectormacadd,detipad,digitalTestBit,adc,udpport);
|
||||
retval=getAdcConfigured();
|
||||
}
|
||||
#endif
|
||||
if (ret==FAIL)
|
||||
printf("configuring MAC of mod %d failed\n", imod);
|
||||
if (ret==FAIL)
|
||||
printf("configuring MAC of mod %d failed\n", imod);
|
||||
|
||||
if (differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
|
||||
|
||||
if (differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
|
||||
/* send answer */
|
||||
/* send OK/failed */
|
||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||
if (ret==FAIL) {
|
||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||
}
|
||||
|
||||
/*return ok/fail*/
|
||||
return ret;
|
||||
/* send answer */
|
||||
/* send OK/failed */
|
||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||
if (ret==FAIL)
|
||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||
else
|
||||
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
||||
/*return ok/fail*/
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user