mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
implemented getting ids for eiger. also id ret should be int64_t
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@630 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
cf30612701
commit
8720f960e7
Binary file not shown.
@ -1,6 +1,7 @@
|
||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||
|
||||
#include "slsDetectorFunctionList.h"
|
||||
#include "svnInfoEiger.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -84,7 +85,7 @@ int mapCSP0(void) {
|
||||
|
||||
|
||||
int initializeDetectorStructure(){
|
||||
printf("EIGER 9\n");
|
||||
printf("EIGER 10\n");
|
||||
int imod;
|
||||
int n=getNModBoard(X)*getNModBoard(Y);
|
||||
#ifdef VERBOSE
|
||||
@ -172,23 +173,69 @@ int getNModBoard(enum dimension arg){
|
||||
|
||||
|
||||
int64_t getModuleId(enum idMode arg, int imod){
|
||||
//DETECTOR_SERIAL_NUMBER
|
||||
//DETECTOR_FIRMWARE_VERSION
|
||||
return 0;
|
||||
switch(arg){
|
||||
case MODULE_SERIAL_NUMBER:
|
||||
return getDetectorNumber();
|
||||
case MODULE_FIRMWARE_VERSION:
|
||||
return FIRMWAREREV;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int64_t getDetectorId(enum idMode arg){
|
||||
//DETECTOR_SOFTWARE_VERSION defined in slsDetector_defs.h?
|
||||
return 0;
|
||||
int64_t retval = -1;
|
||||
switch(arg){
|
||||
case DETECTOR_SERIAL_NUMBER:
|
||||
retval = getDetectorMAC();
|
||||
break;
|
||||
case DETECTOR_FIRMWARE_VERSION:
|
||||
return FIRMWAREREV;
|
||||
case DETECTOR_SOFTWARE_VERSION:
|
||||
retval= SVNREV;
|
||||
retval= (retval <<32) | SVNDATE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int getDetectorNumber(){
|
||||
char output[255]="";
|
||||
int res=0;
|
||||
FILE* sysFile = popen("hostname", "r");
|
||||
fgets(output, sizeof(output), sysFile);
|
||||
pclose(sysFile);
|
||||
sscanf(output,"%x",&res);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
u_int64_t getDetectorMAC() {
|
||||
char output[255],mac[255]="";
|
||||
u_int64_t res=0;
|
||||
FILE* sysFile = popen("ifconfig eth0 | grep HWaddr | cut -d \" \" -f 11", "r");
|
||||
fgets(output, sizeof(output), sysFile);
|
||||
pclose(sysFile);
|
||||
//getting rid of ":"
|
||||
char * pch;
|
||||
pch = strtok (output,":");
|
||||
while (pch != NULL){
|
||||
strcat(mac,pch);
|
||||
pch = strtok (NULL, ":");
|
||||
}
|
||||
sscanf(mac,"%llx",&res);
|
||||
printf("mac:%llx\n",res);
|
||||
return res;
|
||||
}
|
||||
|
||||
int moduleTest( enum digitalTestMode arg, int imod){
|
||||
//template testShiftIn from mcb_funcs.c
|
||||
|
||||
@ -258,7 +305,7 @@ int setModule(sls_detector_module myMod){
|
||||
for(i=0;i<myMod.ndac;i++)
|
||||
setDAC(i,myMod.dacs[i],myMod.module);
|
||||
|
||||
|
||||
thisSettings = myMod.reg;
|
||||
|
||||
|
||||
return OK;
|
||||
@ -292,7 +339,7 @@ enum detDacIndex setSettings(enum detDacIndex sett, int imod){
|
||||
//template setSettings() from mcb_funcs.c
|
||||
//reads the dac registers from fpga to confirm which settings, if weird, undefined
|
||||
|
||||
return OK;
|
||||
return thisSettings;
|
||||
}
|
||||
|
||||
int startStateMachine(){
|
||||
|
@ -14,6 +14,9 @@
|
||||
#define GOODBYE -200
|
||||
|
||||
|
||||
#define MODULESERIALNUM 0xbeb045 //temporary should be in firmware
|
||||
#define FIRMWAREREV 0xcaba //temporary should be in firmware
|
||||
|
||||
/* examples*/
|
||||
#define NCHAN 256*256
|
||||
#define NCHIP 4*1
|
||||
|
@ -3585,7 +3585,8 @@ int multiSlsDetector::decodeNMod(int i, int &id, int &im) {
|
||||
|
||||
int64_t multiSlsDetector::getId(idMode mode, int imod) {
|
||||
|
||||
int id, im, ret;
|
||||
int id, im;
|
||||
int64_t ret;
|
||||
|
||||
if (decodeNMod(imod, id, im)>=0) {
|
||||
if (detectors[id]) {
|
||||
|
@ -2879,6 +2879,14 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
|
||||
//create file names
|
||||
switch(thisDetector->myDetectorType){
|
||||
case EIGER:
|
||||
//settings is saved in myMod.reg
|
||||
myMod->reg=thisDetector->currentSettings;
|
||||
ostfn << thisDetector->settingsDir << ssettings <<"/settings.sn"<< setw(6) << hex << getId(MODULE_SERIAL_NUMBER, im) << setbase(10);
|
||||
oscfn << thisDetector->calDir << ssettings << "/calibration.sn"<<setw(6) << hex << getId(MODULE_SERIAL_NUMBER, im) << setbase(10);
|
||||
#ifdef VERBOSE
|
||||
std::cout<< thisDetector->settingsDir<<endl<< thisDetector->calDir <<endl;
|
||||
#endif
|
||||
break;
|
||||
case MOENCH:
|
||||
case GOTTHARD:
|
||||
//settings is saved in myMod.reg
|
||||
|
@ -45,6 +45,9 @@ int getNModBoard(enum dimension arg);
|
||||
|
||||
int64_t getModuleId(enum idMode arg, int imod);
|
||||
int64_t getDetectorId(enum idMode arg);
|
||||
u_int64_t getDetectorMAC();
|
||||
int getDetectorNumber();
|
||||
|
||||
int moduleTest( enum digitalTestMode arg, int imod);
|
||||
int detectorTest( enum digitalTestMode arg);
|
||||
|
||||
|
@ -1871,6 +1871,7 @@ int set_settings(int file_des) {
|
||||
}
|
||||
imod=arg[1];
|
||||
isett=arg[0];
|
||||
printf("isett:%d, imod =%d\n",isett,imod);
|
||||
|
||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||
if (imod>=getTotalNumberOfModules()) {
|
||||
@ -1882,11 +1883,11 @@ int set_settings(int file_des) {
|
||||
printf("Changing settings of module %d to %d\n", imod, isett);
|
||||
#endif
|
||||
|
||||
if (differentClients==1 && lockStatus==1 && arg[0]!=GET_SETTINGS) {
|
||||
if (differentClients==1 && lockStatus==1 && isett!=GET_SETTINGS) {
|
||||
ret=FAIL;
|
||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||
} else {
|
||||
retval=setSettings(arg[0], imod);
|
||||
retval=setSettings(isett, imod);
|
||||
#ifdef VERBOSE
|
||||
printf("Settings changed to %d\n", isett);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user