mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
eiger basic functionalities implemented
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@776 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -2,36 +2,32 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
#include "slsDetectorFunctionList.h"
|
#include "slsDetectorFunctionList.h"
|
||||||
#include "svnInfoEiger.h"
|
#include "svnInfoEiger.h"
|
||||||
#include "Eiger.h"
|
|
||||||
#include "EigerHighLevelFunctions.c"
|
#include "EigerHighLevelFunctions.c"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
enum detectorSettings thisSettings = STANDARD;
|
enum detectorSettings thisSettings = STANDARD;
|
||||||
//static const string dacNames[16] = {"Svp","Svn","Vtr","Vrf","Vrs","Vtgstv","Vcmp_ll","Vcmp_lr","Cal","Vcmp_rl","Vcmp_rr","Rxb_rb","Rxb_lb","Vcp","Vcn","Vis"};
|
//static const string dacNames[16] = {"Svp","Svn","Vtr","Vrf","Vrs","Vtgstv","Vcmp_ll","Vcmp_lr","Cal","Vcmp_rl","Vcmp_rr","Rxb_rb","Rxb_lb","Vcp","Vcn","Vis"};
|
||||||
|
|
||||||
static Eiger* eiger = new Eiger();
|
|
||||||
|
|
||||||
int initDetector(){
|
int initDetector(){
|
||||||
printf("EIGER 10\n");
|
printf("EIGER 10\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//int reInitDetector(){ eiger->Init() ? 1:0; }
|
|
||||||
|
|
||||||
int setNMod(int nm, enum dimension dim){
|
int setNMod(int nm, enum dimension dim){
|
||||||
return eiger->GetNModules();
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int getNModBoard(enum dimension arg){
|
int getNModBoard(enum dimension arg){
|
||||||
return eiger->GetNModules();
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -145,17 +141,15 @@ int detectorTest( enum digitalTestMode arg){
|
|||||||
|
|
||||||
|
|
||||||
int setDAC(enum detDacIndex ind, int val, int imod){
|
int setDAC(enum detDacIndex ind, int val, int imod){
|
||||||
string iname;
|
char iname[10];
|
||||||
float v = val/0.001;
|
strcpy(iname,EigerGetDACName((int)ind));
|
||||||
if(!eiger->GetDACName((unsigned int) ind,iname)) return -1;
|
|
||||||
//#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
printf("Setting dac %d: %s to %d mV\n",ind, iname.c_str(),val);
|
printf("Setting dac %d: %s to %d mV\n",ind, iname,val);
|
||||||
//#endif
|
//#endif
|
||||||
if(val>=0) eiger->SetDAC(iname,v);
|
if(val >= 0)
|
||||||
|
EigerSetDAC(iname,val/1000);
|
||||||
|
|
||||||
if(!eiger->GetDAC(iname,v)) v=-1;
|
return (EigerGetDAC(iname)*1000);
|
||||||
|
|
||||||
return int(v*1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -198,16 +192,15 @@ int getModule(sls_detector_module *myMod){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int getThresholdEnergy(int imod){
|
int getThresholdEnergy(int imod){
|
||||||
//template getThresholdEnergy() from mcb_funcs.c
|
printf("Threshold energy: %d\n",EigerGetPhotonEnergy());
|
||||||
//depending on settings
|
return EigerGetPhotonEnergy();
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int setThresholdEnergy(int thr, int imod){
|
int setThresholdEnergy(int thr, int imod){
|
||||||
//template getThresholdEnergy() from mcb_funcs.c
|
printf("Setting threshold energy:%d\n",thr);
|
||||||
//depending on settings
|
EigerSetPhotonEnergy(thr);
|
||||||
return 0;
|
return EigerGetPhotonEnergy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -220,20 +213,15 @@ enum detectorSettings setSettings(enum detectorSettings sett, int imod){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int startStateMachine(){
|
int startStateMachine(){
|
||||||
//template startStateMachine() from firmware_funcs.c
|
printf("Going to start acquisition\n");
|
||||||
/*
|
EigerStartAcquisition();
|
||||||
fifoReset();
|
|
||||||
now_ptr=(char*)ram_values;
|
|
||||||
//send start acquisition to fpga
|
|
||||||
*/
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int stopStateMachine(){
|
int stopStateMachine(){
|
||||||
//template stopStateMachine() from firmware_funcs.c
|
printf("Going to stop acquisition\n");
|
||||||
// send stop to fpga
|
EigerStopAcquisition();
|
||||||
//if status = busy after 500us, return FAIL
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,9 +234,15 @@ int startReadOut(){
|
|||||||
|
|
||||||
|
|
||||||
enum runStatus getRunStatus(){
|
enum runStatus getRunStatus(){
|
||||||
//template runState() from firmware_funcs.c
|
int i = EigerRunStatus();
|
||||||
//get status from fpga
|
printf("Status:%d ",i);
|
||||||
return ERROR;
|
if(i== 0){
|
||||||
|
printf(" returning %d\n",IDLE);
|
||||||
|
return IDLE;
|
||||||
|
}else{
|
||||||
|
printf(" returning %d\n",RUNNING);
|
||||||
|
return RUNNING;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -262,41 +256,45 @@ char *readFrame(int *ret, char *mess){
|
|||||||
|
|
||||||
|
|
||||||
int64_t setTimer(enum timerIndex ind, int64_t val){
|
int64_t setTimer(enum timerIndex ind, int64_t val){
|
||||||
/*
|
|
||||||
switch(ind){
|
switch(ind){
|
||||||
case FRAME_NUMBER:
|
case FRAME_NUMBER:
|
||||||
if(val >= 0)
|
if(val >= 0){
|
||||||
framenum = val;
|
printf(" Setting number of frames: %d\n",(unsigned int)val);
|
||||||
return framenum;
|
EigerSetNumberOfExposures((unsigned int)val);
|
||||||
|
}return EigerGetNumberOfExposures();
|
||||||
case ACQUISITION_TIME:
|
case ACQUISITION_TIME:
|
||||||
if(val >= 0)
|
if(val >= 0){
|
||||||
exposureTime = val;
|
printf(" Setting exp time: %fs\n",val/(1E9));
|
||||||
return exposureTime;
|
EigerSetExposureTime(val/(1E9));
|
||||||
|
}return EigerGetExposureTime();
|
||||||
case FRAME_PERIOD:
|
case FRAME_PERIOD:
|
||||||
|
if(val >= 0){
|
||||||
|
printf(" Setting acq period: %fs\n",val/(1E9));
|
||||||
|
EigerSetExposurePeriod(val/(1E9));
|
||||||
|
}return (EigerGetExposurePeriod()*(1E9));
|
||||||
|
/* case DELAY_AFTER_TRIGGER:
|
||||||
if(val >= 0)
|
if(val >= 0)
|
||||||
period = val;
|
EigerSetNumberOfExposures((unsigned int)val);
|
||||||
return period;
|
return EigerGetNumberOfExposures();
|
||||||
case DELAY_AFTER_TRIGGER:
|
|
||||||
if(val >= 0)
|
|
||||||
delay = val;
|
|
||||||
return delay;
|
|
||||||
case GATES_NUMBER:
|
case GATES_NUMBER:
|
||||||
if(val >= 0)
|
if(val >= 0)
|
||||||
gates = val;
|
EigerSetNumberOfExposures((unsigned int)val);
|
||||||
return gates;
|
return EigerGetNumberOfExposures();
|
||||||
case PROBES_NUMBER:
|
case PROBES_NUMBER:
|
||||||
if(val >= 0)
|
if(val >= 0)
|
||||||
framenum = val;
|
EigerSetNumberOfExposures((unsigned int)val);
|
||||||
return framenum;
|
return EigerGetNumberOfExposures();*/
|
||||||
case CYCLES_NUMBER:
|
case CYCLES_NUMBER:
|
||||||
if(val >= 0)
|
if(val >= 0){
|
||||||
trains = val;
|
printf(" Setting number of triggers: %d\n",(unsigned int)val);
|
||||||
return trains;
|
EigerSetNumberOfExposureSeries((unsigned int)val);
|
||||||
|
}return EigerGetNumberOfExposureSeries();
|
||||||
default:
|
default:
|
||||||
printf("unknown timer index: %d\n",ind);
|
printf("unknown timer index: %d\n",ind);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,9 +314,10 @@ int64_t getTimeLeft(enum timerIndex ind){
|
|||||||
|
|
||||||
|
|
||||||
int setDynamicRange(int dr){
|
int setDynamicRange(int dr){
|
||||||
//template setDynamicRange() from firmware_funcs.c
|
if(dr > 0){
|
||||||
// return DYNAMIC_RANGE;
|
printf(" Setting dynamic range: %d\n",dr);
|
||||||
return 0;
|
EigerSetDynamicRange(dr);
|
||||||
|
}return EigerGetDynamicRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user