mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 23:10:02 +02:00
Merge branch 'master' of gitorious.psi.ch:sls_det_software/sls_detector_software
This commit is contained in:
commit
7f168e3a70
@ -10,6 +10,8 @@
|
||||
//#include <stdint.h>
|
||||
#include "sls_receiver_defs.h"
|
||||
|
||||
#define REQUIRED_FIRMWARE_VERSION 10
|
||||
|
||||
/** default maximum string length */
|
||||
#define MAX_SCAN_STEPS 2000
|
||||
/** maxmimum number of modules per controller*/
|
||||
@ -19,6 +21,9 @@
|
||||
/** header length for data :gotthard*/
|
||||
#define HEADERLENGTH 12
|
||||
|
||||
#define DEFAULT_SUBFRAME_EXPOSURE_VAL 2621440 /** default value for sub frame value 2.6ms*/
|
||||
#define MAX_SUBFRAME_EXPOSURE_VAL 0x1FFFFFFF /** 29 bit register for max subframe exposure value */
|
||||
|
||||
/** maximum rois */
|
||||
#define MAX_ROIS 100
|
||||
|
||||
|
@ -154,7 +154,7 @@ void Beb_GetModuleCopnfiguration(int* master, int* top){
|
||||
//open file pointer
|
||||
int fd = Beb_open(XPAR_PLB_GPIO_SYS_BASEADDR,&baseaddr);
|
||||
if(fd < 0){
|
||||
cprintf(RED,"Module Configuration FAIL\n");
|
||||
cprintf(BG_RED,"Module Configuration FAIL\n");
|
||||
}else{
|
||||
//read data
|
||||
ret = Beb_Read32(baseaddr, MODULE_CONFIGURATION_MASK);
|
||||
@ -177,21 +177,21 @@ u_int32_t Beb_GetFirmwareRevision(){
|
||||
//open file pointer
|
||||
int fd = Beb_open(XPAR_VERSION,&baseaddr);
|
||||
if(fd < 0)
|
||||
cprintf(RED,"Firmware Revision Read FAIL\n");
|
||||
cprintf(BG_RED,"Firmware Revision Read FAIL\n");
|
||||
|
||||
else{
|
||||
//read revision existing bit
|
||||
value = Beb_Read32(baseaddr, REVISION_EXISTING_OFFSET);
|
||||
printf("Firmware Revision Read OK\n");
|
||||
//printf("Firmware Revision Read OK\n");
|
||||
//error reading
|
||||
if(!(value&REVISION_EXISTING_BIT)){
|
||||
cprintf(RED,"Firmware Revision Number does not exist in this version\n");
|
||||
cprintf(BG_RED,"Firmware Revision Number does not exist in this version\n");
|
||||
value = 0;
|
||||
}else{
|
||||
//read revision number
|
||||
value = Beb_Read32(baseaddr, 0);
|
||||
printf("Firmware Revision Number Read OK\n");
|
||||
printf("Rev: 0x%x.%x\n\n",value & REVISION_MASK,value & SUB_REVISION_MASK);
|
||||
//printf("Firmware Revision Number Read OK\n");
|
||||
//printf("Rev: 0x%x.%x\n\n",value & REVISION_MASK,value & SUB_REVISION_MASK);
|
||||
value &= REVISION_MASK;
|
||||
}
|
||||
}
|
||||
@ -203,6 +203,27 @@ u_int32_t Beb_GetFirmwareRevision(){
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
void Beb_ResetFrameNumber(){
|
||||
//mapping new memory to read master top module configuration
|
||||
u_int32_t baseaddr;
|
||||
//open file pointer
|
||||
int fd = Beb_open(XPAR_PLB_GPIO_SYS_BASEADDR,&baseaddr);
|
||||
if(fd < 0){
|
||||
cprintf(BG_RED,"Reset Frame Number FAIL\n");
|
||||
}else{
|
||||
//write a 1
|
||||
Beb_Write32(baseaddr, FRAME_NUM_RESET_OFFSET, 1);
|
||||
usleep(100000); //100ms
|
||||
//write a 0
|
||||
Beb_Write32(baseaddr, FRAME_NUM_RESET_OFFSET, 0);
|
||||
printf("Frame Number Reset OK\n");
|
||||
//close file pointer
|
||||
Beb_close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Beb_ClearBebInfos(){
|
||||
//unsigned int i;
|
||||
//for(i=0;i<bebInfoSize;i++) free(beb_infos[i]);
|
||||
@ -582,7 +603,7 @@ int Beb_StopAcquisition()
|
||||
//open file pointer
|
||||
int fd = Beb_open(XPAR_CMD_GENERATOR,&baseaddr);
|
||||
if(fd < 0){
|
||||
cprintf(RED,"Beb Stop Acquisition FAIL\n");
|
||||
cprintf(BG_RED,"Beb Stop Acquisition FAIL\n");
|
||||
return 0;
|
||||
}else{
|
||||
//find value
|
||||
@ -657,7 +678,7 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
|
||||
//open file pointer
|
||||
int fd = Beb_open(XPAR_CMD_GENERATOR,&baseaddr);
|
||||
if(fd < 0){
|
||||
cprintf(RED,"Beb Request N Images FAIL\n");
|
||||
cprintf(BG_RED,"Beb Request N Images FAIL\n");
|
||||
return 0;
|
||||
}else{
|
||||
|
||||
@ -790,14 +811,14 @@ int Beb_open(u_int32_t baseaddr, u_int32_t* csp0base){
|
||||
|
||||
int fd = open("/dev/mem", O_RDWR | O_SYNC, 0);
|
||||
if (fd == -1)
|
||||
cprintf(RED,"\nCan't find /dev/mem!\n");
|
||||
cprintf(BG_RED,"\nCan't find /dev/mem!\n");
|
||||
else{
|
||||
#ifdef VERBOSE
|
||||
printf("/dev/mem opened\n");
|
||||
#endif
|
||||
*csp0base = (u_int32_t)mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, baseaddr);
|
||||
if (*csp0base == (u_int32_t)MAP_FAILED) {
|
||||
cprintf(RED,"\nCan't map memmory area!!\n");
|
||||
cprintf(BG_RED,"\nCan't map memmory area!!\n");
|
||||
fd = -1;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
|
@ -49,6 +49,7 @@ struct BebInfo{
|
||||
|
||||
void Beb_GetModuleCopnfiguration(int* master, int* top);
|
||||
u_int32_t Beb_GetFirmwareRevision();
|
||||
void Beb_ResetFrameNumber();
|
||||
|
||||
int Beb_WriteTo(unsigned int index);
|
||||
|
||||
|
@ -46,8 +46,9 @@ unsigned int Feb_Control_subFrameMode;
|
||||
unsigned int Feb_Control_photon_energy_eV;
|
||||
|
||||
unsigned int Feb_Control_nimages;
|
||||
double Feb_Control_exposure_time_in_sec;
|
||||
double Feb_Control_exposure_period_in_sec;
|
||||
double Feb_Control_exposure_time_in_sec;
|
||||
int Feb_Control_subframe_exposure_time_in_10nsec;
|
||||
double Feb_Control_exposure_period_in_sec;
|
||||
|
||||
unsigned int Feb_Control_trimbit_size;
|
||||
unsigned int* Feb_Control_last_downloaded_trimbits;
|
||||
@ -1398,6 +1399,13 @@ int Feb_Control_SetExposureTime(double the_exposure_time_in_sec){
|
||||
}
|
||||
double Feb_Control_GetExposureTime(){return Feb_Control_exposure_time_in_sec;}
|
||||
|
||||
int Feb_Control_SetSubFrameExposureTime(int the_subframe_exposure_time_in_10nsec){
|
||||
Feb_Control_subframe_exposure_time_in_10nsec = the_subframe_exposure_time_in_10nsec;
|
||||
printf("Sub Frame Exposure time set to: %d\n",Feb_Control_subframe_exposure_time_in_10nsec);
|
||||
return 1;
|
||||
}
|
||||
int Feb_Control_GetSubFrameExposureTime(){return Feb_Control_subframe_exposure_time_in_10nsec;}
|
||||
|
||||
int Feb_Control_SetExposurePeriod(double the_exposure_period_in_sec){
|
||||
Feb_Control_exposure_period_in_sec = the_exposure_period_in_sec;
|
||||
printf("Exposure period set to: %f\n",Feb_Control_exposure_period_in_sec);
|
||||
@ -1560,129 +1568,40 @@ int Feb_Control_PrepareForAcquisition(){//return 1;
|
||||
reg_vals[3]=Feb_Control_ConvertTimeToRegister(Feb_Control_exposure_period_in_sec);
|
||||
reg_nums[4]=DAQ_REG_CHIP_CMDS;
|
||||
reg_vals[4]=(Feb_Control_acquireNReadoutMode|Feb_Control_triggerMode|Feb_Control_externalEnableMode|Feb_Control_subFrameMode);
|
||||
|
||||
reg_nums[5]=DAQ_REG_SUBFRAME_EXPOSURES;
|
||||
reg_vals[5]= Feb_Control_subframe_exposure_time_in_10nsec; //(1 means 10ns, 100 means 1000ns)
|
||||
// if(!Feb_Interface_WriteRegisters((Module_GetTopLeftAddress(&modules[1])|Module_GetTopRightAddress(&modules[1])),20,reg_nums,reg_vals,0,0)){
|
||||
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),5,reg_nums,reg_vals,0,0)){
|
||||
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),6,reg_nums,reg_vals,0,0)){
|
||||
printf("Trouble starting acquisition....\n");;
|
||||
return 0;
|
||||
}
|
||||
//*/
|
||||
|
||||
/* if(!Feb_Control_am_i_master)
|
||||
Feb_Control_StartAcquisition();*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Feb_Control_StartAcquisition(){printf("****** starting acquisition********* \n");
|
||||
int Feb_Control_StartAcquisition(){
|
||||
printf("****** starting acquisition********* \n");
|
||||
|
||||
static unsigned int reg_nums[20];
|
||||
static unsigned int reg_vals[20];
|
||||
/*
|
||||
Feb_Control_PrintAcquisitionSetup();
|
||||
|
||||
// if(!Reset()||!ResetDataStream()){
|
||||
if(!Feb_Control_Reset()){
|
||||
printf("Trouble reseting daq or data stream...\n");;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!Feb_Control_SetStaticBits1(Feb_Control_staticBits&(DAQ_STATIC_BIT_M4|DAQ_STATIC_BIT_M8))){
|
||||
printf("Trouble setting static bits ...\n");;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!Feb_Control_SendBitModeToBebServer()){
|
||||
printf("Trouble sending static bits to server ...\n");;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!Feb_Control_ResetChipCompletely()){
|
||||
printf("Trouble resetting chips ...\n");;
|
||||
return 0;
|
||||
}
|
||||
static unsigned int reg_nums[20];
|
||||
static unsigned int reg_vals[20];
|
||||
|
||||
|
||||
reg_nums[0]=DAQ_REG_CTRL;
|
||||
reg_vals[0]=0;
|
||||
reg_nums[1]=DAQ_REG_NEXPOSURES;
|
||||
reg_vals[1]=Feb_Control_nimages;
|
||||
reg_nums[2]=DAQ_REG_EXPOSURE_TIMER;
|
||||
reg_vals[2]=Feb_Control_ConvertTimeToRegister(Feb_Control_exposure_time_in_sec);
|
||||
reg_nums[3]=DAQ_REG_EXPOSURE_REPEAT_TIMER;
|
||||
reg_vals[3]=Feb_Control_ConvertTimeToRegister(Feb_Control_exposure_period_in_sec);
|
||||
*/
|
||||
int i;
|
||||
for(i=0;i<14;i++){
|
||||
reg_nums[i]=DAQ_REG_CTRL;
|
||||
reg_vals[i]=0;
|
||||
}
|
||||
reg_nums[14]=DAQ_REG_CTRL;
|
||||
reg_vals[14]=ACQ_CTRL_START;
|
||||
|
||||
/*
|
||||
reg_nums[4]=DAQ_REG_CHIP_CMDS;
|
||||
reg_vals[4]=(Feb_Control_acquireNReadoutMode|Feb_Control_triggerMode|Feb_Control_externalEnableMode|Feb_Control_subFrameMode);
|
||||
*/
|
||||
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),15,reg_nums,reg_vals,0,0)){
|
||||
printf("Trouble starting acquisition....\n");;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),4,reg_nums,reg_vals,0,0)){
|
||||
printf("Trouble starting acquisition....\n");;
|
||||
return 0;
|
||||
}
|
||||
unsigned int masterHalfModuleMode = 0;
|
||||
reg_nums[0]=DAQ_REG_CHIP_CMDS;
|
||||
reg_vals[0]=(masterHalfModuleMode|Feb_Control_acquireNReadoutMode|Feb_Control_triggerMode|Feb_Control_externalEnableMode|Feb_Control_subFrameMode);
|
||||
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),1,reg_nums,reg_vals,0,0)){
|
||||
printf("Trouble writing commands....\n");;
|
||||
return 0;
|
||||
}
|
||||
masterHalfModuleMode = 0x80000000;
|
||||
reg_nums[0]=DAQ_REG_CHIP_CMDS;
|
||||
reg_vals[0]=(masterHalfModuleMode|Feb_Control_acquireNReadoutMode|Feb_Control_triggerMode|Feb_Control_externalEnableMode|Feb_Control_subFrameMode);
|
||||
if(!Feb_Interface_WriteRegisters((Module_GetTopLeftAddress(&modules[1])|Module_GetTopRightAddress(&modules[1])),1,reg_nums,reg_vals,0,0)){
|
||||
printf("Trouble writing commands....\n");;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int i;
|
||||
for(i=0;i<14;i++){
|
||||
reg_nums[i]=DAQ_REG_CTRL;
|
||||
reg_vals[i]=0;
|
||||
}
|
||||
reg_nums[14]=DAQ_REG_CTRL;
|
||||
reg_vals[14]=ACQ_CTRL_START;
|
||||
|
||||
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),15,reg_nums,reg_vals,0,0)){
|
||||
printf("Trouble starting acquisition....\n");;
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
///*
|
||||
int i;
|
||||
for(i=0;i<14;i++){
|
||||
reg_nums[i]=DAQ_REG_CTRL;
|
||||
reg_vals[i]=0;
|
||||
}
|
||||
reg_nums[14]=DAQ_REG_CTRL;
|
||||
reg_vals[14]=ACQ_CTRL_START;
|
||||
|
||||
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),15,reg_nums,reg_vals,0,0)){
|
||||
printf("Trouble starting acquisition....\n");;
|
||||
return 0;
|
||||
}
|
||||
//*/
|
||||
/*
|
||||
int i;
|
||||
for(i=5;i<19;i++){
|
||||
reg_nums[i]=DAQ_REG_CTRL;
|
||||
reg_vals[i]=0;
|
||||
}
|
||||
reg_nums[19]=DAQ_REG_CTRL;
|
||||
reg_vals[19]=ACQ_CTRL_START;
|
||||
|
||||
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),20,reg_nums,reg_vals,0,0)){
|
||||
printf("Trouble starting acquisition....\n");;
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
//*/
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Feb_Control_StopAcquisition(){
|
||||
|
@ -155,23 +155,21 @@ int Feb_Control_GetModuleNumber();
|
||||
int Feb_Control_WaitForStartedFlag(int sleep_time_us, int prev_flag);
|
||||
|
||||
//functions for setting up exposure
|
||||
void Feb_Control_PrintAcquisitionSetup();
|
||||
int Feb_Control_SetNExposures(unsigned int n_images);
|
||||
unsigned int Feb_Control_GetNExposures();
|
||||
int Feb_Control_SetExposureTime(double the_exposure_time_in_sec);
|
||||
double Feb_Control_GetExposureTime();
|
||||
int Feb_Control_SetExposurePeriod(double the_exposure_period_in_sec);
|
||||
double Feb_Control_GetExposurePeriod();
|
||||
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
|
||||
unsigned int Feb_Control_GetDynamicRange();
|
||||
/*int Feb_Control_SetReadoutSpeed(unsigned int readout_speed=0); //0->full,1->half,2->quarter or 3->super_slow*/
|
||||
int Feb_Control_SetReadoutSpeed(unsigned int readout_speed); //0->full,1->half,2->quarter or 3->super_slow
|
||||
/* int Feb_Control_SetReadoutMode(unsigned int readout_mode=0); //0->parallel,1->non-parallel,2-> safe_mode*/
|
||||
int Feb_Control_SetReadoutMode(unsigned int readout_mode); //0->parallel,1->non-parallel,2-> safe_mode
|
||||
/* int Feb_Control_SetTriggerMode(unsigned int trigger_mode=0, int polarity=1);*/
|
||||
int Feb_Control_SetTriggerMode(unsigned int trigger_mode, int polarity);
|
||||
/*int Feb_Control_SetExternalEnableMode(int use_external_enable=0, int polarity=1);*/
|
||||
int Feb_Control_SetExternalEnableMode(int use_external_enable, int polarity);
|
||||
void Feb_Control_PrintAcquisitionSetup();
|
||||
int Feb_Control_SetNExposures(unsigned int n_images);
|
||||
unsigned int Feb_Control_GetNExposures();
|
||||
int Feb_Control_SetExposureTime(double the_exposure_time_in_sec);
|
||||
double Feb_Control_GetExposureTime();
|
||||
int Feb_Control_SetSubFrameExposureTime(int the_subframe_exposure_time_in_10nsec);
|
||||
int Feb_Control_GetSubFrameExposureTime();
|
||||
int Feb_Control_SetExposurePeriod(double the_exposure_period_in_sec);
|
||||
double Feb_Control_GetExposurePeriod();
|
||||
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
|
||||
unsigned int Feb_Control_GetDynamicRange();
|
||||
int Feb_Control_SetReadoutSpeed(unsigned int readout_speed); //0 was default, 0->full,1->half,2->quarter or 3->super_slow
|
||||
int Feb_Control_SetReadoutMode(unsigned int readout_mode); ///0 was default,0->parallel,1->non-parallel,2-> safe_mode
|
||||
int Feb_Control_SetTriggerMode(unsigned int trigger_mode, int polarity);//0 and 1 was default,
|
||||
int Feb_Control_SetExternalEnableMode(int use_external_enable, int polarity);//0 and 1 was default,
|
||||
|
||||
//functions for testing
|
||||
/*int Feb_Control_SetTestModeVariable(int on=1);*/
|
||||
|
@ -17,7 +17,8 @@
|
||||
#define DAQ_REG_NEXPOSURES 3
|
||||
#define DAQ_REG_EXPOSURE_TIMER 4 // == (31 downto 3) * 10^(2 downto 0)
|
||||
#define DAQ_REG_EXPOSURE_REPEAT_TIMER 5 // == (31 downto 3) * 10^(2 downto 0)
|
||||
#define DAQ_REG_STATUS 6 //also pg and fifo status register
|
||||
#define DAQ_REG_SUBFRAME_EXPOSURES 6
|
||||
#define DAQ_REG_STATUS 7 //also pg and fifo status register
|
||||
|
||||
#define DAQ_CTRL_RESET 0x80000000
|
||||
#define DAQ_CTRL_START 0x40000000
|
||||
@ -136,3 +137,5 @@
|
||||
#define REVISION_MASK 0x0FFFFFFF
|
||||
#define SUB_REVISION_MASK 0xF0000000
|
||||
|
||||
#define FRAME_NUM_RESET_OFFSET 0xA0
|
||||
|
||||
|
Binary file not shown.
@ -40,12 +40,10 @@ int eiger_extgating = 0;
|
||||
int eiger_extgatingpolarity = 0;
|
||||
|
||||
|
||||
|
||||
int eiger_nexposures = 1;
|
||||
int eiger_ncycles = 1;
|
||||
|
||||
|
||||
|
||||
int send_to_ten_gig = 0;
|
||||
int ndsts_in_use=32;
|
||||
unsigned int nimages_per_request=1;
|
||||
@ -65,14 +63,13 @@ int master = 0;
|
||||
#define TEN_GIGA_BUFFER_SIZE 4112
|
||||
#define ONE_GIGA_BUFFER_SIZE 1040
|
||||
|
||||
|
||||
int initDetector(){
|
||||
int imod,i,n;
|
||||
n = getNModBoard(1);
|
||||
|
||||
printf("This is the EIGER Server of revision %llx\n", getDetectorId(DETECTOR_SOFTWARE_VERSION));
|
||||
|
||||
//#ifdef VERBOSE
|
||||
printf("Board is for %d half modules\n",n);
|
||||
printf("This Server is for 1 Eiger half module\n");
|
||||
//#endif
|
||||
|
||||
|
||||
@ -131,6 +128,7 @@ int initDetector(){
|
||||
//setting default measurement parameters
|
||||
setTimer(FRAME_NUMBER,1);
|
||||
setTimer(ACQUISITION_TIME,1E9);
|
||||
setTimer(SUBFRAME_ACQUISITION_TIME,DEFAULT_SUBFRAME_EXPOSURE_VAL);
|
||||
setTimer(FRAME_PERIOD,1E9);
|
||||
setDynamicRange(16);
|
||||
setThresholdEnergy(8000,0);
|
||||
@ -483,6 +481,11 @@ enum detectorSettings setSettings(enum detectorSettings sett, int imod){
|
||||
|
||||
|
||||
int startReceiver(int d){
|
||||
|
||||
//reset frame number
|
||||
printf("Going to reset Frame Number\n");
|
||||
Beb_ResetFrameNumber();
|
||||
|
||||
//if(master)
|
||||
Feb_Control_PrepareForAcquisition();
|
||||
return OK;
|
||||
@ -615,12 +618,22 @@ int64_t setTimer(enum timerIndex ind, int64_t val){
|
||||
nimages_per_request = eiger_nexposures * eiger_ncycles;
|
||||
}
|
||||
}return eiger_nexposures;
|
||||
|
||||
case ACQUISITION_TIME:
|
||||
if(val >= 0){
|
||||
printf(" Setting exp time: %fs\n",val/(1E9));
|
||||
Feb_Control_SetExposureTime(val/(1E9));
|
||||
}
|
||||
return (Feb_Control_GetExposureTime()*(1E9));
|
||||
|
||||
case SUBFRAME_ACQUISITION_TIME:
|
||||
if(val >= 0){
|
||||
printf(" Setting sub exp time: %dns\n",(int)val/10);
|
||||
Feb_Control_SetSubFrameExposureTime(val/10);
|
||||
}
|
||||
return (Feb_Control_GetSubFrameExposureTime()*10);
|
||||
|
||||
|
||||
case FRAME_PERIOD:
|
||||
if(val >= 0){
|
||||
printf(" Setting acq period: %fs\n",val/(1E9));
|
||||
|
@ -3220,6 +3220,11 @@ int slsDetector::updateDetectorNoWait() {
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[ACQUISITION_TIME]=retval;
|
||||
|
||||
if(thisDetector->myDetectorType!= EIGER){
|
||||
//retval=setSubFrameExposureTime(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]=retval;
|
||||
}
|
||||
//retval=setPeriod(tns);
|
||||
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[FRAME_PERIOD]=retval;
|
||||
|
@ -369,6 +369,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
*/
|
||||
virtual int64_t setTimer(timerIndex index, int64_t t=-1)=0;
|
||||
int64_t setExposureTime(int64_t t=-1){return setTimer(ACQUISITION_TIME,t);};
|
||||
int64_t setSubFrameExposureTime(int64_t t=-1){return setTimer(SUBFRAME_ACQUISITION_TIME,t);};
|
||||
int64_t setExposurePeriod(int64_t t=-1){return setTimer(FRAME_PERIOD,t);};
|
||||
int64_t setDelayAfterTrigger(int64_t t=-1){return setTimer(DELAY_AFTER_TRIGGER,t);};
|
||||
int64_t setNumberOfGates(int64_t t=-1){return setTimer(GATES_NUMBER,t);};
|
||||
|
@ -733,6 +733,10 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="subexptime"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="period"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
||||
i++;
|
||||
@ -3783,6 +3787,8 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
|
||||
|
||||
if (cmd=="exptime")
|
||||
index=ACQUISITION_TIME;
|
||||
else if (cmd=="subexptime")
|
||||
index=SUBFRAME_ACQUISITION_TIME;
|
||||
else if (cmd=="period")
|
||||
index=FRAME_PERIOD;
|
||||
else if (cmd=="delay")
|
||||
@ -3806,7 +3812,7 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
|
||||
;
|
||||
else
|
||||
return string("cannot scan timer value ")+string(args[1]);
|
||||
if (index==ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER)
|
||||
if (index==ACQUISITION_TIME || index==SUBFRAME_ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER)
|
||||
t=(int64_t)(val*1E+9);
|
||||
else t=(int64_t)val;
|
||||
}
|
||||
@ -3815,7 +3821,7 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
|
||||
ret=myDet->setTimer(index,t);
|
||||
if (index==ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER)
|
||||
if (index==ACQUISITION_TIME || index==SUBFRAME_ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER)
|
||||
rval=(double)ret*1E-9;
|
||||
else rval=ret;
|
||||
|
||||
@ -3843,6 +3849,7 @@ string slsDetectorCommand::helpTimer(int narg, char *args[], int action) {
|
||||
ostringstream os;
|
||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||
os << "exptime t \t sets the exposure time in s" << std::endl;
|
||||
os << "subexptime t \t sets the exposure time of subframe in s" << std::endl;
|
||||
os << "period t \t sets the frame period in s" << std::endl;
|
||||
os << "delay t \t sets the delay after trigger in s" << std::endl;
|
||||
os << "frames t \t sets the number of frames per cycle (e.g. after each trigger)" << std::endl;
|
||||
@ -3855,6 +3862,7 @@ string slsDetectorCommand::helpTimer(int narg, char *args[], int action) {
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
|
||||
os << "exptime \t gets the exposure time in s" << std::endl;
|
||||
os << "subexptime \t gets the exposure time of subframe in s" << std::endl;
|
||||
os << "period \t gets the frame period in s" << std::endl;
|
||||
os << "delay \t gets the delay after trigger in s" << std::endl;
|
||||
os << "frames \t gets the number of frames per cycle (e.g. after each trigger)" << std::endl;
|
||||
|
@ -37,7 +37,7 @@ using namespace std;
|
||||
#include "slsDetectorActions.h"
|
||||
#include "postProcessing.h"
|
||||
|
||||
#define MAX_TIMERS 11
|
||||
//#define MAX_TIMERS 11
|
||||
#define MAXPOS 50
|
||||
|
||||
#define DEFAULT_HOSTNAME "localhost"
|
||||
|
@ -22,6 +22,9 @@ int main(int argc, char *argv[]){
|
||||
int portno, b;
|
||||
int retval=OK;
|
||||
int sd, fd;
|
||||
|
||||
checkFirmwareCompatibility();
|
||||
|
||||
#ifdef STOP_SERVER
|
||||
char cmd[100];
|
||||
#endif
|
||||
|
@ -42,6 +42,24 @@ int dataBytes = 10;
|
||||
|
||||
|
||||
|
||||
void checkFirmwareCompatibility(){
|
||||
cprintf(BLUE,"\n\n********************************************************\n"
|
||||
"**********************EIGER Server**********************\n"
|
||||
"********************************************************\n");
|
||||
cprintf(BLUE,"\nFirmware Version: %llx\nSoftware Version: %llx\n\n",
|
||||
getDetectorId(DETECTOR_FIRMWARE_VERSION), getDetectorId(DETECTOR_SOFTWARE_VERSION));
|
||||
|
||||
//check for firmware version compatibility
|
||||
if(getDetectorId(DETECTOR_FIRMWARE_VERSION) < REQUIRED_FIRMWARE_VERSION){
|
||||
cprintf(RED,"FATAL ERROR: This firmware version is incompatible.\n"
|
||||
"Please update it to v%d to be compatible with this server\n\n",
|
||||
REQUIRED_FIRMWARE_VERSION);
|
||||
|
||||
cprintf(RED,"Exiting Server. Goodbye!\n\n");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int init_detector(int b) {
|
||||
#ifdef VIRTUAL
|
||||
@ -401,6 +419,10 @@ int send_update(int file_des) {
|
||||
retval=setTimer(ACQUISITION_TIME,GET_FLAG);
|
||||
#endif
|
||||
n += sendData(file_des,&retval,sizeof(int64_t),INT64);
|
||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||
retval=setTimer(SUBFRAME_ACQUISITION_TIME,GET_FLAG);
|
||||
#endif
|
||||
n += sendData(file_des,&retval,sizeof(int64_t),INT64);
|
||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||
retval=setTimer(FRAME_PERIOD,GET_FLAG);
|
||||
#endif
|
||||
@ -2428,6 +2450,16 @@ int set_timer(int file_des) {
|
||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||
} else {
|
||||
switch(ind) {
|
||||
#ifdef EIGERD
|
||||
case SUBFRAME_ACQUISITION_TIME:
|
||||
if (tns > MAX_SUBFRAME_EXPOSURE_VAL ){
|
||||
ret=FAIL;
|
||||
strcpy(mess,"Sub Frame exposure time should not exceed 5.368 seconds\n");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
retval = setTimer(ind,tns);
|
||||
break;
|
||||
case PROBES_NUMBER:
|
||||
#ifndef MYTHEND
|
||||
ret=FAIL;
|
||||
@ -2444,7 +2476,7 @@ int set_timer(int file_des) {
|
||||
break;
|
||||
default:
|
||||
ret=FAIL;
|
||||
sprintf(mess,"timer index unknown %d\n",ind);
|
||||
sprintf(mess,"timer index unknown for this detector %d\n",ind);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
|
||||
//basic server functions
|
||||
void checkFirmwareCompatibility();
|
||||
int init_detector(int);
|
||||
int decode_function(int);
|
||||
int function_table();
|
||||
|
Loading…
x
Reference in New Issue
Block a user