mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-09 03:20:42 +02:00
eiger and jungfrau server, updated virtual versions with start and stop acquisition
This commit is contained in:
parent
cb635d800a
commit
c5262458d5
@ -6,7 +6,7 @@ LDLIBS += -lm -lstdc++ -pthread
|
|||||||
|
|
||||||
DESTDIR ?= bin
|
DESTDIR ?= bin
|
||||||
|
|
||||||
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList_virtual.c
|
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
|
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
|
||||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||||
Repsitory UUID: 0ed82d4ef7a10d8a935b5d075a990509da288e32
|
Repsitory UUID: cb635d800a5e1de6cf3330f03a98ffc382879cf3
|
||||||
Revision: 338
|
Revision: 339
|
||||||
Branch: 32bitoverflow
|
Branch: mergevirtual
|
||||||
Last Changed Author: Dhanya_Thattil
|
Last Changed Author: Dhanya_Thattil
|
||||||
Last Changed Rev: 3831
|
Last Changed Rev: 3832
|
||||||
Last Changed Date: 2018-05-22 18:04:57.000000002 +0200 ./Beb.c
|
Last Changed Date: 2018-05-23 11:11:12.000000002 +0200 ./Makefile.virtual
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||||
#define GITREPUUID "0ed82d4ef7a10d8a935b5d075a990509da288e32"
|
#define GITREPUUID "cb635d800a5e1de6cf3330f03a98ffc382879cf3"
|
||||||
#define GITAUTH "Dhanya_Thattil"
|
#define GITAUTH "Dhanya_Thattil"
|
||||||
#define GITREV 0x3831
|
#define GITREV 0x3832
|
||||||
#define GITDATE 0x20180522
|
#define GITDATE 0x20180523
|
||||||
#define GITBRANCH "32bitoverflow"
|
#define GITBRANCH "mergevirtual"
|
||||||
|
@ -1,16 +1,20 @@
|
|||||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
//#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h> //to gethostname
|
#include <unistd.h> //to gethostname
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "slsDetectorFunctionList.h"
|
#include "slsDetectorFunctionList.h"
|
||||||
|
#ifndef VIRTUAL
|
||||||
#include "gitInfoEiger.h"
|
#include "gitInfoEiger.h"
|
||||||
#include "FebControl.h"
|
#include "FebControl.h"
|
||||||
#include "Beb.h"
|
#include "Beb.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
int default_tau_from_file= -1;
|
int default_tau_from_file= -1;
|
||||||
|
|
||||||
@ -21,8 +25,6 @@ const char* dac_names[16] = {"SvP","Vtr","Vrf","Vrs","SvN","Vtgstv","Vcmp_ll","V
|
|||||||
|
|
||||||
enum{E_PARALLEL, E_NON_PARALLEL, E_SAFE};
|
enum{E_PARALLEL, E_NON_PARALLEL, E_SAFE};
|
||||||
|
|
||||||
//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"};
|
|
||||||
|
|
||||||
sls_detector_module *detectorModules=NULL;
|
sls_detector_module *detectorModules=NULL;
|
||||||
int *detectorChips=NULL;
|
int *detectorChips=NULL;
|
||||||
int *detectorChans=NULL;
|
int *detectorChans=NULL;
|
||||||
@ -47,6 +49,27 @@ int eiger_nexposures = 1;
|
|||||||
int eiger_ncycles = 1;
|
int eiger_ncycles = 1;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
//values for virtual server
|
||||||
|
double eiger_virtual_exptime = 0;
|
||||||
|
int64_t eiger_virtual_subexptime = 0;
|
||||||
|
int64_t eiger_virtual_subperiod = 0;
|
||||||
|
double eiger_virtual_period = 0;
|
||||||
|
int eiger_virtual_counter_bit=1;
|
||||||
|
int eiger_virtual_ratecorrection_variable=0;
|
||||||
|
int64_t eiger_virtual_ratetable_tau_in_ns=-1;
|
||||||
|
int64_t eiger_virtual_ratetable_period_in_ns=-1;
|
||||||
|
int eiger_virtual_transmission_delay_left=0;
|
||||||
|
int eiger_virtual_transmission_delay_right=0;
|
||||||
|
int eiger_virtual_transmission_delay_frame=0;
|
||||||
|
int eiger_virtual_transmission_flowcontrol_10g=0;
|
||||||
|
int eiger_virtual_status=0;
|
||||||
|
int eiger_virtual_activate=1;
|
||||||
|
pthread_t eiger_virtual_tid;
|
||||||
|
int eiger_virtual_stop = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int send_to_ten_gig = 0;
|
int send_to_ten_gig = 0;
|
||||||
int ndsts_in_use=32;
|
int ndsts_in_use=32;
|
||||||
unsigned int nimages_per_request=1;
|
unsigned int nimages_per_request=1;
|
||||||
@ -62,8 +85,9 @@ enum masterFlags masterMode=IS_SLAVE;
|
|||||||
int top = 0;
|
int top = 0;
|
||||||
int master = 0;
|
int master = 0;
|
||||||
int normal = 0;
|
int normal = 0;
|
||||||
|
#ifndef VIRTUAL
|
||||||
uint32_t detid = 0;
|
uint32_t detid = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -72,6 +96,13 @@ uint32_t detid = 0;
|
|||||||
/* basic tests */
|
/* basic tests */
|
||||||
|
|
||||||
void checkFirmwareCompatibility(int flag){
|
void checkFirmwareCompatibility(int flag){
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
cprintf(BLUE,"\n\n"
|
||||||
|
"********************************************************\n"
|
||||||
|
"***************** EIGER Virtual Server *****************\n"
|
||||||
|
"********************************************************\n");
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
uint32_t ipadd = getDetectorIP();
|
uint32_t ipadd = getDetectorIP();
|
||||||
uint64_t macadd = getDetectorMAC();
|
uint64_t macadd = getDetectorMAC();
|
||||||
int64_t fwversion = getDetectorId(DETECTOR_FIRMWARE_VERSION);
|
int64_t fwversion = getDetectorId(DETECTOR_FIRMWARE_VERSION);
|
||||||
@ -91,9 +122,12 @@ void checkFirmwareCompatibility(int flag){
|
|||||||
"F/w-S/w API Version:\t\t %lld\n"
|
"F/w-S/w API Version:\t\t %lld\n"
|
||||||
"Required Firmware Version:\t %d\n\n"
|
"Required Firmware Version:\t %d\n\n"
|
||||||
"********************************************************\n",
|
"********************************************************\n",
|
||||||
ipadd, macadd,
|
(unsigned int)ipadd,
|
||||||
fwversion,swversion,
|
(long long unsigned int)macadd,
|
||||||
sw_fw_apiversion,REQUIRED_FIRMWARE_VERSION);
|
(long long int)fwversion,
|
||||||
|
(long long int)swversion,
|
||||||
|
(long long int)sw_fw_apiversion,
|
||||||
|
REQUIRED_FIRMWARE_VERSION);
|
||||||
|
|
||||||
//cant read versions
|
//cant read versions
|
||||||
if(!fwversion || !sw_fw_apiversion){
|
if(!fwversion || !sw_fw_apiversion){
|
||||||
@ -126,6 +160,9 @@ void checkFirmwareCompatibility(int flag){
|
|||||||
/* Ids */
|
/* Ids */
|
||||||
|
|
||||||
int64_t getDetectorId(enum idMode arg){
|
int64_t getDetectorId(enum idMode arg){
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
int64_t retval = -1;
|
int64_t retval = -1;
|
||||||
|
|
||||||
switch(arg){
|
switch(arg){
|
||||||
@ -143,20 +180,32 @@ int64_t getDetectorId(enum idMode arg){
|
|||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int64_t getFirmwareVersion() {
|
u_int64_t getFirmwareVersion() {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
return Beb_GetFirmwareRevision();
|
return Beb_GetFirmwareRevision();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
u_int32_t getDetectorNumber(){
|
u_int32_t getDetectorNumber(){
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
return detid;
|
return detid;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
u_int64_t getDetectorMAC() {
|
u_int64_t getDetectorMAC() {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
char mac[255]="";
|
char mac[255]="";
|
||||||
u_int64_t res=0;
|
u_int64_t res=0;
|
||||||
|
|
||||||
@ -181,10 +230,14 @@ u_int64_t getDetectorMAC() {
|
|||||||
//printf("mac:%llx\n",res);
|
//printf("mac:%llx\n",res);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
u_int32_t getDetectorIP(){
|
u_int32_t getDetectorIP(){
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
char temp[50]="";
|
char temp[50]="";
|
||||||
u_int32_t res=0;
|
u_int32_t res=0;
|
||||||
//execute and get address
|
//execute and get address
|
||||||
@ -214,6 +267,12 @@ u_int32_t getDetectorIP(){
|
|||||||
/* initialization */
|
/* initialization */
|
||||||
|
|
||||||
void initControlServer(){
|
void initControlServer(){
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
getModuleConfiguration();
|
||||||
|
setupDetector();
|
||||||
|
printf("\n");
|
||||||
|
return;
|
||||||
|
#else
|
||||||
//Feb and Beb Initializations
|
//Feb and Beb Initializations
|
||||||
getModuleConfiguration();
|
getModuleConfiguration();
|
||||||
Feb_Interface_FebInterface();
|
Feb_Interface_FebInterface();
|
||||||
@ -231,22 +290,48 @@ void initControlServer(){
|
|||||||
|
|
||||||
|
|
||||||
setupDetector();
|
setupDetector();
|
||||||
|
#endif
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void initStopServer(){
|
void initStopServer(){
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
getModuleConfiguration();
|
||||||
|
printf("\n");
|
||||||
|
return;
|
||||||
|
#else
|
||||||
getModuleConfiguration();
|
getModuleConfiguration();
|
||||||
Feb_Interface_FebInterface();
|
Feb_Interface_FebInterface();
|
||||||
Feb_Control_FebControl();
|
Feb_Control_FebControl();
|
||||||
Feb_Control_Init(master,top,normal,getDetectorNumber());
|
Feb_Control_Init(master,top,normal,getDetectorNumber());
|
||||||
printf("FEB Initialization done\n");
|
printf("FEB Initialization done\n");
|
||||||
|
#endif
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void getModuleConfiguration(){
|
void getModuleConfiguration(){
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
#ifdef VIRTUAL_MASTER
|
||||||
|
master = 1;
|
||||||
|
top = 1;
|
||||||
|
#else
|
||||||
|
master = 0;
|
||||||
|
top = 1;
|
||||||
|
#endif
|
||||||
|
#ifdef VIRTUAL_9M
|
||||||
|
normal = 0;
|
||||||
|
#else
|
||||||
|
normal = 1;
|
||||||
|
#endif
|
||||||
|
if(top) printf("*************** TOP ***************\n");
|
||||||
|
else printf("*************** BOTTOM ***************\n");
|
||||||
|
if(master) printf("*************** MASTER ***************\n");
|
||||||
|
else printf("*************** SLAVE ***************\n");
|
||||||
|
if(normal) printf("*************** NORMAL ***************\n");
|
||||||
|
else printf("*************** SPECIAL ***************\n");
|
||||||
|
return;
|
||||||
|
#else
|
||||||
int *m=&master;
|
int *m=&master;
|
||||||
int *t=⊤
|
int *t=⊤
|
||||||
int *n=&normal;
|
int *n=&normal;
|
||||||
@ -265,6 +350,7 @@ void getModuleConfiguration(){
|
|||||||
pclose(sysFile);
|
pclose(sysFile);
|
||||||
sscanf(output,"%u",&detid);
|
sscanf(output,"%u",&detid);
|
||||||
printf("detector id: %u\n",detid);
|
printf("detector id: %u\n",detid);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -332,6 +418,7 @@ void setupDetector() {
|
|||||||
setTimer(SUBFRAME_ACQUISITION_TIME, DEFAULT_SUBFRAME_EXPOSURE);
|
setTimer(SUBFRAME_ACQUISITION_TIME, DEFAULT_SUBFRAME_EXPOSURE);
|
||||||
setTimer(SUBFRAME_PERIOD, DEFAULT_SUBFRAME_PERIOD);
|
setTimer(SUBFRAME_PERIOD, DEFAULT_SUBFRAME_PERIOD);
|
||||||
setTimer(FRAME_PERIOD, DEFAULT_PERIOD);
|
setTimer(FRAME_PERIOD, DEFAULT_PERIOD);
|
||||||
|
setTimer(CYCLES_NUMBER, DEFAULT_NUM_CYCLES);
|
||||||
setDynamicRange(DEFAULT_DYNAMIC_RANGE);
|
setDynamicRange(DEFAULT_DYNAMIC_RANGE);
|
||||||
eiger_photonenergy = DEFAULT_PHOTON_ENERGY;
|
eiger_photonenergy = DEFAULT_PHOTON_ENERGY;
|
||||||
setReadOutFlags(DEFAULT_READOUT_MODE);
|
setReadOutFlags(DEFAULT_READOUT_MODE);
|
||||||
@ -344,9 +431,13 @@ void setupDetector() {
|
|||||||
setRateCorrection(DEFAULT_RATE_CORRECTION);
|
setRateCorrection(DEFAULT_RATE_CORRECTION);
|
||||||
int enable[2] = {DEFAULT_EXT_GATING_ENABLE, DEFAULT_EXT_GATING_POLARITY};
|
int enable[2] = {DEFAULT_EXT_GATING_ENABLE, DEFAULT_EXT_GATING_POLARITY};
|
||||||
setExternalGating(enable);//disable external gating
|
setExternalGating(enable);//disable external gating
|
||||||
|
#ifndef VIRTUAL
|
||||||
Feb_Control_SetInTestModeVariable(DEFAULT_TEST_MODE);
|
Feb_Control_SetInTestModeVariable(DEFAULT_TEST_MODE);
|
||||||
|
#endif
|
||||||
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
||||||
|
#ifndef VIRTUAL
|
||||||
Feb_Control_CheckSetup();
|
Feb_Control_CheckSetup();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -354,11 +445,19 @@ void setupDetector() {
|
|||||||
|
|
||||||
/* advanced read/write reg */
|
/* advanced read/write reg */
|
||||||
uint32_t writeRegister(uint32_t offset, uint32_t data) {
|
uint32_t writeRegister(uint32_t offset, uint32_t data) {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
return Feb_Control_WriteRegister(offset, data);
|
return Feb_Control_WriteRegister(offset, data);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t readRegister(uint32_t offset) {
|
uint32_t readRegister(uint32_t offset) {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
return Feb_Control_ReadRegister(offset);
|
return Feb_Control_ReadRegister(offset);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -374,6 +473,13 @@ int getNModBoard(enum dimension arg){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int setDynamicRange(int dr){
|
int setDynamicRange(int dr){
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
if(dr > 0){
|
||||||
|
printf(" Setting dynamic range: %d\n",dr);
|
||||||
|
eiger_dynamicrange = dr;
|
||||||
|
}
|
||||||
|
return eiger_dynamicrange;
|
||||||
|
#else
|
||||||
if(dr > 0){
|
if(dr > 0){
|
||||||
printf(" Setting dynamic range: %d\n",dr);
|
printf(" Setting dynamic range: %d\n",dr);
|
||||||
if(Feb_Control_SetDynamicRange(dr)){
|
if(Feb_Control_SetDynamicRange(dr)){
|
||||||
@ -391,6 +497,7 @@ int setDynamicRange(int dr){
|
|||||||
dr= Feb_Control_GetDynamicRange();
|
dr= Feb_Control_GetDynamicRange();
|
||||||
|
|
||||||
return dr;
|
return dr;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -405,7 +512,9 @@ int setSpeed(enum speedVariable arg, int val){
|
|||||||
|
|
||||||
if(val != -1){
|
if(val != -1){
|
||||||
printf(" Setting Read out Speed: %d\n",val);
|
printf(" Setting Read out Speed: %d\n",val);
|
||||||
|
#ifndef VIRTUAL
|
||||||
if(Feb_Control_SetReadoutSpeed(val))
|
if(Feb_Control_SetReadoutSpeed(val))
|
||||||
|
#endif
|
||||||
eiger_readoutspeed = val;
|
eiger_readoutspeed = val;
|
||||||
}
|
}
|
||||||
return eiger_readoutspeed;
|
return eiger_readoutspeed;
|
||||||
@ -429,9 +538,13 @@ enum readOutFlags setReadOutFlags(enum readOutFlags val){
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
printf(" Setting Read out Flag: %d\n",val);
|
printf(" Setting Read out Flag: %d\n",val);
|
||||||
|
#ifndef VIRTUAL
|
||||||
if(Feb_Control_SetReadoutMode(val))
|
if(Feb_Control_SetReadoutMode(val))
|
||||||
|
#endif
|
||||||
eiger_readoutmode = val;
|
eiger_readoutmode = val;
|
||||||
|
#ifndef VIRTUAL
|
||||||
else return -1;
|
else return -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,9 +557,13 @@ enum readOutFlags setReadOutFlags(enum readOutFlags val){
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
printf(" Setting Read out Flag: %d\n",val);
|
printf(" Setting Read out Flag: %d\n",val);
|
||||||
|
#ifndef VIRTUAL
|
||||||
if(Beb_Set32bitOverflow(val) != -1)
|
if(Beb_Set32bitOverflow(val) != -1)
|
||||||
|
#endif
|
||||||
eiger_overflow32 = val;
|
eiger_overflow32 = val;
|
||||||
|
#ifndef VIRTUAL
|
||||||
else return -1;
|
else return -1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -498,11 +615,11 @@ enum readOutFlags setReadOutFlags(enum readOutFlags val){
|
|||||||
/* parameters - timer */
|
/* parameters - timer */
|
||||||
|
|
||||||
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){
|
||||||
printf(" Setting number of frames: %d * %d\n",(unsigned int)val,eiger_ncycles);
|
printf(" Setting number of frames: %d * %d\n",(unsigned int)val,eiger_ncycles);
|
||||||
|
#ifndef VIRTUAL
|
||||||
if(Feb_Control_SetNExposures((unsigned int)val*eiger_ncycles)){
|
if(Feb_Control_SetNExposures((unsigned int)val*eiger_ncycles)){
|
||||||
eiger_nexposures = val;
|
eiger_nexposures = val;
|
||||||
//SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfCycles());
|
//SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfCycles());
|
||||||
@ -512,39 +629,76 @@ int64_t setTimer(enum timerIndex ind, int64_t val){
|
|||||||
ndsts_in_use = 1;
|
ndsts_in_use = 1;
|
||||||
nimages_per_request = eiger_nexposures * eiger_ncycles;
|
nimages_per_request = eiger_nexposures * eiger_ncycles;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
eiger_nexposures = val;
|
||||||
|
nimages_per_request = eiger_nexposures * eiger_ncycles;
|
||||||
|
#endif
|
||||||
}return eiger_nexposures;
|
}return eiger_nexposures;
|
||||||
|
|
||||||
case ACQUISITION_TIME:
|
case ACQUISITION_TIME:
|
||||||
if(val >= 0){
|
if(val >= 0){
|
||||||
printf(" Setting exp time: %fs\n",val/(1E9));
|
printf(" Setting exp time: %fs\n",val/(1E9));
|
||||||
|
#ifndef VIRTUAL
|
||||||
Feb_Control_SetExposureTime(val/(1E9));
|
Feb_Control_SetExposureTime(val/(1E9));
|
||||||
|
#else
|
||||||
|
eiger_virtual_exptime = (val/(1E9));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifndef VIRTUAL
|
||||||
return (Feb_Control_GetExposureTime()*(1E9));
|
return (Feb_Control_GetExposureTime()*(1E9));
|
||||||
|
#else
|
||||||
|
return eiger_virtual_exptime*1e9;
|
||||||
|
#endif
|
||||||
|
|
||||||
case SUBFRAME_ACQUISITION_TIME:
|
case SUBFRAME_ACQUISITION_TIME:
|
||||||
if(val >= 0){
|
if(val >= 0){
|
||||||
printf(" Setting sub exp time: %lldns\n",(long long int)val/10);
|
printf(" Setting sub exp time: %lldns\n",(long long int)val/10);
|
||||||
|
#ifndef VIRTUAL
|
||||||
Feb_Control_SetSubFrameExposureTime(val/10);
|
Feb_Control_SetSubFrameExposureTime(val/10);
|
||||||
|
#else
|
||||||
|
eiger_virtual_subexptime = (val/(10));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifndef VIRTUAL
|
||||||
return (Feb_Control_GetSubFrameExposureTime());
|
return (Feb_Control_GetSubFrameExposureTime());
|
||||||
|
#else
|
||||||
|
return eiger_virtual_subexptime*10;
|
||||||
|
#endif
|
||||||
|
|
||||||
case SUBFRAME_PERIOD:
|
case SUBFRAME_PERIOD:
|
||||||
if(val >= 0){
|
if(val >= 0){
|
||||||
printf(" Setting sub period: %lldns\n",(long long int)val/10);
|
printf(" Setting sub period: %lldns\n",(long long int)val/10);
|
||||||
|
#ifndef VIRTUAL
|
||||||
Feb_Control_SetSubFramePeriod(val/10);
|
Feb_Control_SetSubFramePeriod(val/10);
|
||||||
|
#else
|
||||||
|
eiger_virtual_subperiod = (val/(1E9));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifndef VIRTUAL
|
||||||
return (Feb_Control_GetSubFramePeriod());
|
return (Feb_Control_GetSubFramePeriod());
|
||||||
|
#else
|
||||||
|
return eiger_virtual_subperiod*1e9;
|
||||||
|
#endif
|
||||||
|
|
||||||
case FRAME_PERIOD:
|
case FRAME_PERIOD:
|
||||||
if(val >= 0){
|
if(val >= 0){
|
||||||
printf(" Setting acq period: %fs\n",val/(1E9));
|
printf(" Setting acq period: %fs\n",val/(1E9));
|
||||||
|
#ifndef VIRTUAL
|
||||||
Feb_Control_SetExposurePeriod(val/(1E9));
|
Feb_Control_SetExposurePeriod(val/(1E9));
|
||||||
|
#else
|
||||||
|
eiger_virtual_period = (val/(1E9));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifndef VIRTUAL
|
||||||
return (Feb_Control_GetExposurePeriod()*(1E9));
|
return (Feb_Control_GetExposurePeriod()*(1E9));
|
||||||
|
#else
|
||||||
|
return eiger_virtual_period*1e9;
|
||||||
|
#endif
|
||||||
|
|
||||||
case CYCLES_NUMBER:
|
case CYCLES_NUMBER:
|
||||||
if(val >= 0){
|
if(val >= 0){
|
||||||
printf(" Setting number of triggers: %d * %d\n",(unsigned int)val,eiger_nexposures);
|
printf(" Setting number of triggers: %d * %d\n",(unsigned int)val,eiger_nexposures);
|
||||||
|
#ifndef VIRTUAL
|
||||||
if(Feb_Control_SetNExposures((unsigned int)val*eiger_nexposures)){
|
if(Feb_Control_SetNExposures((unsigned int)val*eiger_nexposures)){
|
||||||
eiger_ncycles = val;
|
eiger_ncycles = val;
|
||||||
//SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfCycles());
|
//SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfCycles());
|
||||||
@ -553,7 +707,12 @@ int64_t setTimer(enum timerIndex ind, int64_t val){
|
|||||||
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
||||||
nimages_per_request = eiger_nexposures * eiger_ncycles;
|
nimages_per_request = eiger_nexposures * eiger_ncycles;
|
||||||
}
|
}
|
||||||
}return eiger_ncycles;
|
#else
|
||||||
|
eiger_ncycles = val;
|
||||||
|
nimages_per_request = eiger_nexposures * eiger_ncycles;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return eiger_ncycles;
|
||||||
default:
|
default:
|
||||||
cprintf(RED,"Warning: Timer Index not implemented for this detector: %d\n", ind);
|
cprintf(RED,"Warning: Timer Index not implemented for this detector: %d\n", ind);
|
||||||
break;
|
break;
|
||||||
@ -597,6 +756,7 @@ int setModule(sls_detector_module myMod, int delay){
|
|||||||
setDAC((enum DACINDEX)i,myMod.dacs[i],myMod.module,0,retval);
|
setDAC((enum DACINDEX)i,myMod.dacs[i],myMod.module,0,retval);
|
||||||
|
|
||||||
// trimbits
|
// trimbits
|
||||||
|
#ifndef VIRTUAL
|
||||||
if(myMod.nchan==0 && myMod.nchip == 0)
|
if(myMod.nchan==0 && myMod.nchip == 0)
|
||||||
cprintf(BLUE,"Setting module without trimbits\n");
|
cprintf(BLUE,"Setting module without trimbits\n");
|
||||||
else{
|
else{
|
||||||
@ -622,12 +782,14 @@ int setModule(sls_detector_module myMod, int delay){
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return thisSettings;
|
return thisSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int getModule(sls_detector_module *myMod){
|
int getModule(sls_detector_module *myMod){
|
||||||
|
|
||||||
|
#ifndef VIRTUAL
|
||||||
int i;
|
int i;
|
||||||
int retval[2];
|
int retval[2];
|
||||||
|
|
||||||
@ -654,6 +816,7 @@ int getModule(sls_detector_module *myMod){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//copy local module to myMod
|
//copy local module to myMod
|
||||||
if (detectorModules) {
|
if (detectorModules) {
|
||||||
@ -752,6 +915,14 @@ void setDAC(enum DACINDEX ind, int val, int imod, int mV, int retval[]){
|
|||||||
else
|
else
|
||||||
printf("in dac units\n");
|
printf("in dac units\n");
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
if (mV){
|
||||||
|
retval[0] = (int)(((val-0)/(2048-0))*(4096-1) + 0.5);
|
||||||
|
retval[1] = val;
|
||||||
|
}else
|
||||||
|
retval[0] = val;
|
||||||
|
|
||||||
|
#else
|
||||||
if(val >= 0)
|
if(val >= 0)
|
||||||
Feb_Control_SetDAC(iname,val,mV);
|
Feb_Control_SetDAC(iname,val,mV);
|
||||||
int k;
|
int k;
|
||||||
@ -759,7 +930,7 @@ void setDAC(enum DACINDEX ind, int val, int imod, int mV, int retval[]){
|
|||||||
retval[0] = k;
|
retval[0] = k;
|
||||||
Feb_Control_GetDAC(iname,&k,1);
|
Feb_Control_GetDAC(iname,&k,1);
|
||||||
retval[1] = k;
|
retval[1] = k;
|
||||||
|
#endif
|
||||||
(detectorModules)->dacs[ind] = retval[0];
|
(detectorModules)->dacs[ind] = retval[0];
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -767,6 +938,9 @@ void setDAC(enum DACINDEX ind, int val, int imod, int mV, int retval[]){
|
|||||||
|
|
||||||
|
|
||||||
int getADC(enum ADCINDEX ind, int imod){
|
int getADC(enum ADCINDEX ind, int imod){
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
char tempnames[6][20]={"FPGA EXT", "10GE","DCDC", "SODL", "SODR", "FPGA"};
|
char tempnames[6][20]={"FPGA EXT", "10GE","DCDC", "SODL", "SODR", "FPGA"};
|
||||||
char cstore[255];
|
char cstore[255];
|
||||||
@ -799,10 +973,23 @@ int getADC(enum ADCINDEX ind, int imod){
|
|||||||
printf("Temperature %s: %f°C\n",tempnames[ind],(double)retval/1000.00);
|
printf("Temperature %s: %f°C\n",tempnames[ind],(double)retval/1000.00);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int setHighVoltage(int val){
|
int setHighVoltage(int val){
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
if (master) {
|
||||||
|
// set
|
||||||
|
if(val!=-1){
|
||||||
|
eiger_theo_highvoltage = val;
|
||||||
|
}
|
||||||
|
return eiger_theo_highvoltage;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SLAVE_HIGH_VOLTAGE_READ_VAL;
|
||||||
|
#else
|
||||||
|
|
||||||
if (master) {
|
if (master) {
|
||||||
|
|
||||||
// set
|
// set
|
||||||
@ -830,6 +1017,7 @@ int setHighVoltage(int val){
|
|||||||
}
|
}
|
||||||
|
|
||||||
return SLAVE_HIGH_VOLTAGE_READ_VAL;
|
return SLAVE_HIGH_VOLTAGE_READ_VAL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -850,7 +1038,9 @@ enum externalCommunicationMode setTiming( enum externalCommunicationMode arg){
|
|||||||
case GATE_FIX_NUMBER: ret = 3; break;
|
case GATE_FIX_NUMBER: ret = 3; break;
|
||||||
}
|
}
|
||||||
printf(" Setting Triggering Mode: %d\n",(int)ret);
|
printf(" Setting Triggering Mode: %d\n",(int)ret);
|
||||||
|
#ifndef VIRTUAL
|
||||||
if(Feb_Control_SetTriggerMode(ret,1))
|
if(Feb_Control_SetTriggerMode(ret,1))
|
||||||
|
#endif
|
||||||
eiger_triggermode = ret;
|
eiger_triggermode = ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -875,7 +1065,7 @@ enum externalCommunicationMode setTiming( enum externalCommunicationMode arg){
|
|||||||
/* configure mac */
|
/* configure mac */
|
||||||
|
|
||||||
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport, uint32_t udpport2, int ival) {
|
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport, uint32_t udpport2, int ival) {
|
||||||
|
#ifndef VIRTUAL
|
||||||
char src_mac[50], src_ip[50],dst_mac[50], dst_ip[50];
|
char src_mac[50], src_ip[50],dst_mac[50], dst_ip[50];
|
||||||
int src_port = 0xE185;
|
int src_port = 0xE185;
|
||||||
sprintf(src_ip,"%d.%d.%d.%d",(sourceip>>24)&0xff,(sourceip>>16)&0xff,(sourceip>>8)&0xff,(sourceip)&0xff);
|
sprintf(src_ip,"%d.%d.%d.%d",(sourceip>>24)&0xff,(sourceip>>16)&0xff,(sourceip>>8)&0xff,(sourceip)&0xff);
|
||||||
@ -933,14 +1123,18 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
|||||||
|
|
||||||
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
||||||
nimages_per_request=eiger_nexposures * eiger_ncycles;
|
nimages_per_request=eiger_nexposures * eiger_ncycles;
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int setDetectorPosition(int pos[]) {
|
int setDetectorPosition(int pos[]) {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return OK;
|
||||||
|
#else
|
||||||
return Beb_SetDetectorPosition(pos);
|
return Beb_SetDetectorPosition(pos);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -952,7 +1146,9 @@ int setDetectorPosition(int pos[]) {
|
|||||||
int setIODelay(int val, int imod){
|
int setIODelay(int val, int imod){
|
||||||
if(val!=-1){
|
if(val!=-1){
|
||||||
printf(" Setting IO Delay: %d\n",val);
|
printf(" Setting IO Delay: %d\n",val);
|
||||||
|
#ifndef VIRTUAL
|
||||||
if(Feb_Control_SetIDelays(Feb_Control_GetModuleNumber(),val))
|
if(Feb_Control_SetIDelays(Feb_Control_GetModuleNumber(),val))
|
||||||
|
#endif
|
||||||
eiger_iodelay = val;
|
eiger_iodelay = val;
|
||||||
}
|
}
|
||||||
return eiger_iodelay;
|
return eiger_iodelay;
|
||||||
@ -976,35 +1172,92 @@ int enableTenGigabitEthernet(int val){
|
|||||||
|
|
||||||
int setCounterBit(int val){
|
int setCounterBit(int val){
|
||||||
if(val!=-1){
|
if(val!=-1){
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
eiger_virtual_counter_bit = val;
|
||||||
|
#else
|
||||||
Feb_Control_Set_Counter_Bit(val);
|
Feb_Control_Set_Counter_Bit(val);
|
||||||
|
#endif
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("Counter Bit:%d\n",val);
|
printf("Counter Bit:%d\n",val);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return eiger_virtual_counter_bit;
|
||||||
|
#else
|
||||||
return Feb_Control_Get_Counter_Bit();
|
return Feb_Control_Get_Counter_Bit();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int pulsePixel(int n, int x, int y){
|
int pulsePixel(int n, int x, int y){
|
||||||
|
#ifndef VIRTUAL
|
||||||
if(!Feb_Control_Pulse_Pixel(n,x,y))
|
if(!Feb_Control_Pulse_Pixel(n,x,y))
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
#endif
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pulsePixelNMove(int n, int x, int y){
|
int pulsePixelNMove(int n, int x, int y){
|
||||||
|
#ifndef VIRTUAL
|
||||||
if(!Feb_Control_PulsePixelNMove(n,x,y))
|
if(!Feb_Control_PulsePixelNMove(n,x,y))
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
#endif
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pulseChip(int n){
|
int pulseChip(int n){
|
||||||
|
#ifndef VIRTUAL
|
||||||
if(!Feb_Control_PulseChip(n))
|
if(!Feb_Control_PulseChip(n))
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
#endif
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t setRateCorrection(int64_t custom_tau_in_nsec){//in nanosec (will never be -1)
|
int64_t setRateCorrection(int64_t custom_tau_in_nsec){//in nanosec (will never be -1)
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
//deactivating rate correction
|
||||||
|
if(custom_tau_in_nsec==0){
|
||||||
|
eiger_virtual_ratecorrection_variable = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//when dynamic range changes, use old tau
|
||||||
|
else if(custom_tau_in_nsec == -1)
|
||||||
|
custom_tau_in_nsec = eiger_virtual_ratetable_tau_in_ns;
|
||||||
|
|
||||||
|
//get period = subexptime if 32bit , else period = exptime if 16 bit
|
||||||
|
int64_t actual_period = eiger_virtual_subexptime*10; //already in nsec
|
||||||
|
if(eiger_dynamicrange == 16)
|
||||||
|
actual_period = eiger_virtual_exptime;
|
||||||
|
|
||||||
|
int64_t ratetable_period_in_nsec = eiger_virtual_ratetable_period_in_ns;
|
||||||
|
int64_t tau_in_nsec = eiger_virtual_ratetable_tau_in_ns;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//same setting
|
||||||
|
if((tau_in_nsec == custom_tau_in_nsec) && (ratetable_period_in_nsec == actual_period)){
|
||||||
|
if(eiger_dynamicrange == 32)
|
||||||
|
printf("Rate Table already created before: Same Tau %lldns, Same subexptime %lldns\n",
|
||||||
|
(long long int)tau_in_nsec,(long long int)ratetable_period_in_nsec);
|
||||||
|
else
|
||||||
|
printf("Rate Table already created before: Same Tau %lldns, Same exptime %lldns\n",
|
||||||
|
(long long int)tau_in_nsec,(long long int)ratetable_period_in_nsec);
|
||||||
|
}
|
||||||
|
//different setting, calculate table
|
||||||
|
else{
|
||||||
|
eiger_virtual_ratetable_tau_in_ns = custom_tau_in_nsec;
|
||||||
|
double period_in_sec = (double)(eiger_virtual_subexptime*10)/(double)1e9;
|
||||||
|
if(eiger_dynamicrange == 16)
|
||||||
|
period_in_sec = eiger_virtual_exptime;
|
||||||
|
eiger_virtual_ratetable_period_in_ns = period_in_sec*1e9;
|
||||||
|
}
|
||||||
|
//activating rate correction
|
||||||
|
eiger_virtual_ratecorrection_variable = 1;
|
||||||
|
printf("Rate Correction Value set to %lld ns\n",(long long int)eiger_virtual_ratetable_tau_in_ns);
|
||||||
|
|
||||||
|
return eiger_virtual_ratetable_tau_in_ns;
|
||||||
|
#else
|
||||||
|
|
||||||
//deactivating rate correction
|
//deactivating rate correction
|
||||||
if(custom_tau_in_nsec==0){
|
if(custom_tau_in_nsec==0){
|
||||||
@ -1053,10 +1306,15 @@ int64_t setRateCorrection(int64_t custom_tau_in_nsec){//in nanosec (will never b
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Feb_Control_Get_RateTable_Tau_in_nsec();
|
return Feb_Control_Get_RateTable_Tau_in_nsec();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int getRateCorrectionEnable(){
|
int getRateCorrectionEnable(){
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return eiger_virtual_ratecorrection_variable;
|
||||||
|
#else
|
||||||
return Feb_Control_GetRateCorrectionVariable();
|
return Feb_Control_GetRateCorrectionVariable();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int getDefaultSettingsTau_in_nsec(){
|
int getDefaultSettingsTau_in_nsec(){
|
||||||
@ -1072,12 +1330,18 @@ int64_t getCurrentTau(){
|
|||||||
if(!getRateCorrectionEnable())
|
if(!getRateCorrectionEnable())
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
|
#ifndef VIRTUAL
|
||||||
return Feb_Control_Get_RateTable_Tau_in_nsec();
|
return Feb_Control_Get_RateTable_Tau_in_nsec();
|
||||||
|
#else
|
||||||
|
return eiger_virtual_ratetable_tau_in_ns;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void setExternalGating(int enable[]){
|
void setExternalGating(int enable[]){
|
||||||
if(enable>=0){
|
if(enable>=0){
|
||||||
|
#ifndef VIRTUAL
|
||||||
Feb_Control_SetExternalEnableMode(enable[0], enable[1]);//enable = 0 or 1, polarity = 0 or 1 , where 1 is positive
|
Feb_Control_SetExternalEnableMode(enable[0], enable[1]);//enable = 0 or 1, polarity = 0 or 1 , where 1 is positive
|
||||||
|
#endif
|
||||||
eiger_extgating = enable[0];
|
eiger_extgating = enable[0];
|
||||||
eiger_extgatingpolarity = enable[1];
|
eiger_extgatingpolarity = enable[1];
|
||||||
}
|
}
|
||||||
@ -1086,20 +1350,22 @@ void setExternalGating(int enable[]){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int setAllTrimbits(int val){
|
int setAllTrimbits(int val){
|
||||||
int ichan;
|
#ifndef VIRTUAL
|
||||||
if(!Feb_Control_SaveAllTrimbitsTo(val)){
|
if(!Feb_Control_SaveAllTrimbitsTo(val)){
|
||||||
cprintf(RED,"error in setting all trimbits to value\n");
|
cprintf(RED,"error in setting all trimbits to value\n");
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}else{
|
}
|
||||||
|
#endif
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("Copying register %x value %d\n",destMod->reg,val);
|
printf("Copying register %x value %d\n",destMod->reg,val);
|
||||||
#endif
|
#endif
|
||||||
if (detectorModules){
|
if (detectorModules){
|
||||||
|
int ichan;
|
||||||
for (ichan=0; ichan<(detectorModules->nchan); ichan++) {
|
for (ichan=0; ichan<(detectorModules->nchan); ichan++) {
|
||||||
*((detectorModules->chanregs)+ichan)=val;
|
*((detectorModules->chanregs)+ichan)=val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
cprintf(GREEN, "All trimbits have been set to %d\n", val);
|
cprintf(GREEN, "All trimbits have been set to %d\n", val);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -1121,17 +1387,61 @@ int getAllTrimbits(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int getBebFPGATemp(){
|
int getBebFPGATemp(){
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
return Beb_GetBebFPGATemp();
|
return Beb_GetBebFPGATemp();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int activate(int enable){
|
int activate(int enable){
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
if (enable >=0)
|
||||||
|
eiger_virtual_activate = enable;
|
||||||
|
return eiger_virtual_activate;
|
||||||
|
#else
|
||||||
int ret = Beb_Activate(enable);
|
int ret = Beb_Activate(enable);
|
||||||
Feb_Control_activate(ret);
|
Feb_Control_activate(ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int setNetworkParameter(enum NETWORKINDEX mode, int value){
|
int setNetworkParameter(enum NETWORKINDEX mode, int value){
|
||||||
|
#ifndef VIRTUAL
|
||||||
return Beb_SetNetworkParameter(mode, value);
|
return Beb_SetNetworkParameter(mode, value);
|
||||||
|
#else
|
||||||
|
if (value>-1) {
|
||||||
|
switch(mode){
|
||||||
|
case TXN_LEFT:
|
||||||
|
eiger_virtual_transmission_delay_left = value;
|
||||||
|
break;
|
||||||
|
case TXN_RIGHT:
|
||||||
|
eiger_virtual_transmission_delay_right = value;
|
||||||
|
break;
|
||||||
|
case TXN_FRAME:
|
||||||
|
eiger_virtual_transmission_delay_frame = value;
|
||||||
|
break;
|
||||||
|
case FLOWCTRL_10G:
|
||||||
|
eiger_virtual_transmission_flowcontrol_10g = value;
|
||||||
|
if(value>0) value = 1;
|
||||||
|
break;
|
||||||
|
default: cprintf(BG_RED,"Unrecognized mode in network parameter: %d\n",mode);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch(mode){
|
||||||
|
case TXN_LEFT:
|
||||||
|
return eiger_virtual_transmission_delay_left;
|
||||||
|
case TXN_RIGHT:
|
||||||
|
return eiger_virtual_transmission_delay_right;
|
||||||
|
case TXN_FRAME:
|
||||||
|
return eiger_virtual_transmission_delay_frame;
|
||||||
|
case FLOWCTRL_10G:
|
||||||
|
return eiger_virtual_transmission_flowcontrol_10g;
|
||||||
|
default: cprintf(BG_RED,"Unrecognized mode in network parameter: %d\n",mode);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1144,17 +1454,30 @@ int setNetworkParameter(enum NETWORKINDEX mode, int value){
|
|||||||
|
|
||||||
|
|
||||||
int prepareAcquisition(){
|
int prepareAcquisition(){
|
||||||
|
#ifndef VIRTUAL
|
||||||
printf("Going to prepare for acquisition with counter_bit:%d\n",Feb_Control_Get_Counter_Bit());
|
printf("Going to prepare for acquisition with counter_bit:%d\n",Feb_Control_Get_Counter_Bit());
|
||||||
Feb_Control_PrepareForAcquisition();
|
Feb_Control_PrepareForAcquisition();
|
||||||
printf("Going to reset Frame Number\n");
|
printf("Going to reset Frame Number\n");
|
||||||
Beb_ResetFrameNumber();
|
Beb_ResetFrameNumber();
|
||||||
|
#endif
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int startStateMachine(){
|
int startStateMachine(){
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
eiger_virtual_status = 1;
|
||||||
|
eiger_virtual_stop = 0;
|
||||||
|
if(pthread_create(&eiger_virtual_tid, NULL, &start_timer, NULL)) {
|
||||||
|
cprintf(RED,"Could not start Virtual acquisition thread\n");
|
||||||
|
eiger_virtual_status = 0;
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
cprintf(GREEN,"***Virtual Acquisition started\n");
|
||||||
|
return OK;
|
||||||
|
#else
|
||||||
|
|
||||||
int ret = OK,prev_flag;
|
int ret = OK,prev_flag;
|
||||||
//get the DAQ toggle bit
|
//get the DAQ toggle bit
|
||||||
prev_flag = Feb_Control_AcquisitionStartedBit();
|
prev_flag = Feb_Control_AcquisitionStartedBit();
|
||||||
@ -1179,21 +1502,48 @@ int startStateMachine(){
|
|||||||
/*while(getRunStatus() == IDLE){printf("waiting for being not idle anymore\n");}*/
|
/*while(getRunStatus() == IDLE){printf("waiting for being not idle anymore\n");}*/
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
void* start_timer(void* arg) {
|
||||||
|
eiger_virtual_status = 1;
|
||||||
|
int wait_in_s = nimages_per_request * eiger_virtual_period;
|
||||||
|
cprintf(GREEN,"going to wait for %d s\n", wait_in_s);
|
||||||
|
while(!eiger_virtual_stop && (wait_in_s >= 0)) {
|
||||||
|
usleep(1000 * 1000);
|
||||||
|
wait_in_s--;
|
||||||
|
}
|
||||||
|
cprintf(GREEN,"Virtual Timer Done***\n");
|
||||||
|
|
||||||
|
eiger_virtual_status = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int stopStateMachine(){
|
int stopStateMachine(){
|
||||||
cprintf(BG_RED,"Going to stop acquisition\n");
|
cprintf(BG_RED,"Going to stop acquisition\n");
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
eiger_virtual_stop = 0;
|
||||||
|
return OK;
|
||||||
|
#else
|
||||||
|
|
||||||
if((Feb_Control_StopAcquisition() == STATUS_IDLE) & Beb_StopAcquisition())
|
if((Feb_Control_StopAcquisition() == STATUS_IDLE) & Beb_StopAcquisition())
|
||||||
return OK;
|
return OK;
|
||||||
cprintf(BG_RED,"failed to stop acquisition\n");
|
cprintf(BG_RED,"failed to stop acquisition\n");
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int startReadOut(){
|
int startReadOut(){
|
||||||
|
|
||||||
printf("Requesting images...\n");
|
printf("Requesting images...\n");
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return OK;
|
||||||
|
#else
|
||||||
//RequestImages();
|
//RequestImages();
|
||||||
int ret_val = 0;
|
int ret_val = 0;
|
||||||
dst_requested[0] = 1;
|
dst_requested[0] = 1;
|
||||||
@ -1214,10 +1564,20 @@ int startReadOut(){
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
else
|
else
|
||||||
return OK;
|
return OK;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
enum runStatus getRunStatus(){
|
enum runStatus getRunStatus(){
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
if(eiger_virtual_status == 0){
|
||||||
|
printf("Status: IDLE\n");
|
||||||
|
return IDLE;
|
||||||
|
}else{
|
||||||
|
printf("Status: RUNNING...\n");
|
||||||
|
return RUNNING;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
int i = Feb_Control_AcquisitionInProgress();
|
int i = Feb_Control_AcquisitionInProgress();
|
||||||
switch (i) {
|
switch (i) {
|
||||||
@ -1233,11 +1593,22 @@ enum runStatus getRunStatus(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
return IDLE;
|
return IDLE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void readFrame(int *ret, char *mess){
|
void readFrame(int *ret, char *mess){
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
while(eiger_virtual_status) {
|
||||||
|
//cprintf(RED,"Waiting for finished flag\n");
|
||||||
|
usleep(5000);
|
||||||
|
}
|
||||||
|
*ret = (int)FINISHED;
|
||||||
|
strcpy(mess,"acquisition successfully finished\n");
|
||||||
|
return;
|
||||||
|
#else
|
||||||
|
|
||||||
if(Feb_Control_WaitForFinishedFlag(5000) == STATUS_ERROR) {
|
if(Feb_Control_WaitForFinishedFlag(5000) == STATUS_ERROR) {
|
||||||
cprintf(RED,"Error: Waiting for finished flag\n");
|
cprintf(RED,"Error: Waiting for finished flag\n");
|
||||||
*ret = FAIL;
|
*ret = FAIL;
|
||||||
@ -1261,6 +1632,7 @@ void readFrame(int *ret, char *mess){
|
|||||||
printf("*****Done Waiting...\n");
|
printf("*****Done Waiting...\n");
|
||||||
*ret = (int)FINISHED;
|
*ret = (int)FINISHED;
|
||||||
strcpy(mess,"acquisition successfully finished\n");
|
strcpy(mess,"acquisition successfully finished\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1400,4 +1772,4 @@ enum synchronizationMode setSynchronization(enum synchronizationMode arg){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
//#endif
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS += -Wall -DJUNGFRAUD -DVIRTUAL -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSEI #-DVERBOSE
|
CFLAGS += -Wall -DJUNGFRAUD -DVIRTUAL -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSEI #-DVERBOSE
|
||||||
LDLIBS += -lm -lstdc++
|
LDLIBS += -lm -lstdc++ -pthread
|
||||||
|
|
||||||
PROGS = jungfrauDetectorServer_virtual
|
PROGS = jungfrauDetectorServer_virtual
|
||||||
DESTDIR ?= bin
|
DESTDIR ?= bin
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware/jungfrauDetectorServer
|
Path: slsDetectorsPackage/slsDetectorSoftware/jungfrauDetectorServer
|
||||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||||
Repsitory UUID: 3f6120628938fb0820908fb82574418039a3b352
|
Repsitory UUID: cb635d800a5e1de6cf3330f03a98ffc382879cf3
|
||||||
Revision: 150
|
Revision: 151
|
||||||
Branch: developer
|
Branch: mergevirtual
|
||||||
Last Changed Author: Dhanya_Thattil
|
Last Changed Author: Dhanya_Thattil
|
||||||
Last Changed Rev: 3829
|
Last Changed Rev: 3832
|
||||||
Last Changed Date: 2018-05-15 13:48:54.000000002 +0200 ./RegisterDefs.h
|
Last Changed Date: 2018-05-23 14:42:26.000000002 +0200 ./Makefile.virtual
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||||
#define GITREPUUID "3f6120628938fb0820908fb82574418039a3b352"
|
#define GITREPUUID "cb635d800a5e1de6cf3330f03a98ffc382879cf3"
|
||||||
#define GITAUTH "Dhanya_Thattil"
|
#define GITAUTH "Dhanya_Thattil"
|
||||||
#define GITREV 0x3829
|
#define GITREV 0x3832
|
||||||
#define GITDATE 0x20180515
|
#define GITDATE 0x20180523
|
||||||
#define GITBRANCH "developer"
|
#define GITBRANCH "mergevirtual"
|
||||||
|
@ -3,11 +3,14 @@
|
|||||||
|
|
||||||
#include "slsDetectorFunctionList.h"
|
#include "slsDetectorFunctionList.h"
|
||||||
#include "gitInfoJungfrau.h"
|
#include "gitInfoJungfrau.h"
|
||||||
|
|
||||||
|
|
||||||
#include "AD9257.h" // include "commonServerFunctions.h", which in turn includes "blackfin.h"
|
#include "AD9257.h" // include "commonServerFunctions.h", which in turn includes "blackfin.h"
|
||||||
#include "programfpga.h"
|
#include "programfpga.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <time.h>
|
||||||
|
#endif
|
||||||
/* global variables */
|
/* global variables */
|
||||||
//jungfrau doesnt require chips and chans (save memory)
|
//jungfrau doesnt require chips and chans (save memory)
|
||||||
sls_detector_module *detectorModules=NULL;
|
sls_detector_module *detectorModules=NULL;
|
||||||
@ -21,6 +24,11 @@ int highvoltage = 0;
|
|||||||
int dacValues[NDAC];
|
int dacValues[NDAC];
|
||||||
int32_t clkPhase[2] = {0, 0};
|
int32_t clkPhase[2] = {0, 0};
|
||||||
|
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
pthread_t pthread_virtual_tid;
|
||||||
|
int virtual_status = 0;
|
||||||
|
int virtual_stop = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* basic tests */
|
/* basic tests */
|
||||||
@ -77,9 +85,12 @@ void checkFirmwareCompatibility(int flag) {
|
|||||||
"\n"
|
"\n"
|
||||||
"********************************************************\n",
|
"********************************************************\n",
|
||||||
hversion, hsnumber,
|
hversion, hsnumber,
|
||||||
ipadd, macadd,
|
ipadd,
|
||||||
fwversion, swversion,
|
(long long unsigned int)macadd,
|
||||||
sw_fw_apiversion, REQRD_FRMWR_VRSN
|
(long long int)fwversion,
|
||||||
|
(long long int)swversion,
|
||||||
|
(long long int)sw_fw_apiversion,
|
||||||
|
REQRD_FRMWR_VRSN
|
||||||
);
|
);
|
||||||
|
|
||||||
// return if flag is not zero, debug mode
|
// return if flag is not zero, debug mode
|
||||||
@ -254,7 +265,7 @@ u_int32_t getDetectorNumber(){
|
|||||||
u_int64_t getDetectorMAC() {
|
u_int64_t getDetectorMAC() {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#else
|
||||||
char output[255],mac[255]="";
|
char output[255],mac[255]="";
|
||||||
u_int64_t res=0;
|
u_int64_t res=0;
|
||||||
FILE* sysFile = popen("ifconfig eth0 | grep HWaddr | cut -d \" \" -f 11", "r");
|
FILE* sysFile = popen("ifconfig eth0 | grep HWaddr | cut -d \" \" -f 11", "r");
|
||||||
@ -269,6 +280,7 @@ u_int64_t getDetectorMAC() {
|
|||||||
}
|
}
|
||||||
sscanf(mac,"%llx",&res);
|
sscanf(mac,"%llx",&res);
|
||||||
return res;
|
return res;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int32_t getDetectorIP(){
|
u_int32_t getDetectorIP(){
|
||||||
@ -1176,7 +1188,7 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
|||||||
(unsigned int)((sourcemac>>16)&0xFF),
|
(unsigned int)((sourcemac>>16)&0xFF),
|
||||||
(unsigned int)((sourcemac>>8)&0xFF),
|
(unsigned int)((sourcemac>>8)&0xFF),
|
||||||
(unsigned int)((sourcemac>>0)&0xFF),
|
(unsigned int)((sourcemac>>0)&0xFF),
|
||||||
sourcemac);
|
(long long unsigned int)sourcemac);
|
||||||
printf("Source Port : %d \t\t\t(0x%08x)\n",sourceport, sourceport);
|
printf("Source Port : %d \t\t\t(0x%08x)\n",sourceport, sourceport);
|
||||||
|
|
||||||
printf("Dest. IP : %d.%d.%d.%d \t\t(0x%08x)\n",(destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff, destip);
|
printf("Dest. IP : %d.%d.%d.%d \t\t(0x%08x)\n",(destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff, destip);
|
||||||
@ -1187,7 +1199,7 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
|||||||
(unsigned int)((destmac>>16)&0xFF),
|
(unsigned int)((destmac>>16)&0xFF),
|
||||||
(unsigned int)((destmac>>8)&0xFF),
|
(unsigned int)((destmac>>8)&0xFF),
|
||||||
(unsigned int)((destmac>>0)&0xFF),
|
(unsigned int)((destmac>>0)&0xFF),
|
||||||
destmac);
|
(long long unsigned int)destmac);
|
||||||
printf("Dest. Port : %d \t\t\t(0x%08x)\n",udpport, udpport);
|
printf("Dest. Port : %d \t\t\t(0x%08x)\n",udpport, udpport);
|
||||||
|
|
||||||
long int checksum=calcChecksum(sourceip, destip);
|
long int checksum=calcChecksum(sourceip, destip);
|
||||||
@ -1432,6 +1444,14 @@ int setNetworkParameter(enum NETWORKINDEX mode, int value) {
|
|||||||
|
|
||||||
int startStateMachine(){
|
int startStateMachine(){
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
|
virtual_status = 1;
|
||||||
|
virtual_stop = 0;
|
||||||
|
if(pthread_create(&pthread_virtual_tid, NULL, &start_timer, NULL)) {
|
||||||
|
virtual_status = 0;
|
||||||
|
cprintf(RED,"Could not start Virtual acquisition thread\n");
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
cprintf(GREEN,"***Virtual Acquisition started\n");
|
||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
printf("*******Starting State Machine*******\n");
|
printf("*******Starting State Machine*******\n");
|
||||||
@ -1447,12 +1467,30 @@ int startStateMachine(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int stopStateMachine(){
|
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
|
void* start_timer(void* arg) {
|
||||||
|
int wait_in_s = (setTimer(FRAME_NUMBER, -1) *
|
||||||
|
setTimer(CYCLES_NUMBER, -1) *
|
||||||
|
(setTimer(STORAGE_CELL_NUMBER, -1) + 1) *
|
||||||
|
(setTimer(FRAME_PERIOD, -1)/(1E9)));
|
||||||
|
cprintf(GREEN,"going to wait for %d s\n", wait_in_s);
|
||||||
|
while(!virtual_stop && (wait_in_s >= 0)) {
|
||||||
|
usleep(1000 * 1000);
|
||||||
|
wait_in_s--;
|
||||||
|
}
|
||||||
|
cprintf(GREEN,"Virtual Timer Done***\n");
|
||||||
|
|
||||||
|
virtual_status = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int stopStateMachine(){
|
||||||
|
cprintf(BG_RED,"*******Stopping State Machine*******\n");
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
virtual_stop = 0;
|
||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
cprintf(BG_RED,"*******Stopping State Machine*******\n");
|
|
||||||
|
|
||||||
//stop state machine
|
//stop state machine
|
||||||
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STOP_ACQ_MSK);
|
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STOP_ACQ_MSK);
|
||||||
usleep(100);
|
usleep(100);
|
||||||
@ -1468,7 +1506,13 @@ int stopStateMachine(){
|
|||||||
|
|
||||||
enum runStatus getRunStatus(){
|
enum runStatus getRunStatus(){
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
|
if(virtual_status == 0){
|
||||||
|
printf("Status: IDLE\n");
|
||||||
return IDLE;
|
return IDLE;
|
||||||
|
}else{
|
||||||
|
printf("Status: RUNNING...\n");
|
||||||
|
return RUNNING;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("Getting status\n");
|
printf("Getting status\n");
|
||||||
@ -1514,8 +1558,12 @@ enum runStatus getRunStatus(){
|
|||||||
|
|
||||||
void readFrame(int *ret, char *mess){
|
void readFrame(int *ret, char *mess){
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
*ret = (int)FAIL;
|
while(virtual_status) {
|
||||||
sprintf(mess,"virtual detector, no acquisition taken\n");
|
//cprintf(RED,"Waiting for finished flag\n");
|
||||||
|
usleep(5000);
|
||||||
|
}
|
||||||
|
*ret = (int)FINISHED;
|
||||||
|
strcpy(mess,"acquisition successfully finished\n");
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
// wait for status to be done
|
// wait for status to be done
|
||||||
@ -1527,7 +1575,7 @@ void readFrame(int *ret, char *mess){
|
|||||||
int64_t retval = getTimeLeft(FRAME_NUMBER) + 1;
|
int64_t retval = getTimeLeft(FRAME_NUMBER) + 1;
|
||||||
if ( retval > 0) {
|
if ( retval > 0) {
|
||||||
*ret = (int)FAIL;
|
*ret = (int)FAIL;
|
||||||
sprintf(mess,"no data and run stopped: %lld frames left\n",retval);
|
sprintf(mess,"no data and run stopped: %lld frames left\n",(long long int)retval);
|
||||||
cprintf(RED,"%s\n",mess);
|
cprintf(RED,"%s\n",mess);
|
||||||
} else {
|
} else {
|
||||||
*ret = (int)FINISHED;
|
*ret = (int)FINISHED;
|
||||||
@ -1540,7 +1588,7 @@ void readFrame(int *ret, char *mess){
|
|||||||
|
|
||||||
u_int32_t runBusy(void) {
|
u_int32_t runBusy(void) {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return 0;
|
return virtual_status;
|
||||||
#endif
|
#endif
|
||||||
u_int32_t s = ((bus_r(STATUS_REG) & RUN_BUSY_MSK) >> RUN_BUSY_OFST);
|
u_int32_t s = ((bus_r(STATUS_REG) & RUN_BUSY_MSK) >> RUN_BUSY_OFST);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
|
@ -73,7 +73,7 @@ int64_t get64BitReg(int aLSB, int aMSB){
|
|||||||
vMSB=bus_r(aMSB);
|
vMSB=bus_r(aMSB);
|
||||||
v64=vMSB;
|
v64=vMSB;
|
||||||
v64=(v64<<32) | vLSB;
|
v64=(v64<<32) | vLSB;
|
||||||
printf(" reg64(%x,%x) %x %x %llx\n", aLSB, aMSB, vLSB, vMSB, v64);
|
printf(" reg64(%x,%x) %x %x %llx\n", aLSB, aMSB, vLSB, vMSB, (long long unsigned int)v64);
|
||||||
return v64;
|
return v64;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +148,9 @@ int mapCSP0(void) {
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
printf("CSPOBASE mapped from 0x%llx to 0x%llx\n",CSP0BASE, CSP0BASE+MEM_SIZE);
|
printf("CSPOBASE mapped from 0x%llx to 0x%llx\n",
|
||||||
|
(long long unsigned int)CSP0BASE,
|
||||||
|
(long long unsigned int)(CSP0BASE+MEM_SIZE));
|
||||||
printf("Status Register: %08x\n",bus_r(STATUS_REG));
|
printf("Status Register: %08x\n",bus_r(STATUS_REG));
|
||||||
|
|
||||||
}else
|
}else
|
||||||
|
@ -3786,7 +3786,10 @@ int configure_mac(int file_des) {
|
|||||||
// change mac to hardware mac, (for 1 gbe) change ip to hardware ip
|
// change mac to hardware mac, (for 1 gbe) change ip to hardware ip
|
||||||
if (idetectormacadd != getDetectorMAC()){
|
if (idetectormacadd != getDetectorMAC()){
|
||||||
printf("*************************************************\n");
|
printf("*************************************************\n");
|
||||||
printf("WARNING: actual detector mac address %llx does not match the one from client %llx\n",getDetectorMAC(),idetectormacadd);
|
printf("WARNING: actual detector mac address %llx does not match "
|
||||||
|
"the one from client %llx\n",
|
||||||
|
(long long unsigned int)getDetectorMAC(),
|
||||||
|
(long long unsigned int)idetectormacadd);
|
||||||
idetectormacadd = getDetectorMAC();
|
idetectormacadd = getDetectorMAC();
|
||||||
printf("WARNING: Matched detectormac to the hardware mac now\n");
|
printf("WARNING: Matched detectormac to the hardware mac now\n");
|
||||||
printf("*************************************************\n");
|
printf("*************************************************\n");
|
||||||
@ -3844,7 +3847,7 @@ int configure_mac(int file_des) {
|
|||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
char arg[2][50];
|
char arg[2][50];
|
||||||
memset(arg,0,sizeof(arg));
|
memset(arg,0,sizeof(arg));
|
||||||
sprintf(arg[0],"%llx",idetectormacadd);
|
sprintf(arg[0],"%llx",(long long unsigned int)idetectormacadd);
|
||||||
sprintf(arg[1],"%x",detipad);
|
sprintf(arg[1],"%x",detipad);
|
||||||
n += sendData(file_des,arg,sizeof(arg),OTHER);
|
n += sendData(file_des,arg,sizeof(arg),OTHER);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user