Merged to developer

This commit is contained in:
2017-06-13 15:30:33 +02:00
98 changed files with 8027 additions and 19952 deletions

View File

@@ -308,7 +308,7 @@ int receiveData(int file_des, void* buf,int length, intType itype){
int ret = receiveDataOnly(file_des, buf, length);
#ifndef PCCOMPILE
#ifdef EIGERD
swapData(buf, length, itype);
if (ret >= 0) swapData(buf, length, itype);
#endif
#endif
return ret;
@@ -316,9 +316,9 @@ int receiveData(int file_des, void* buf,int length, intType itype){
int sendDataOnly(int file_des, void* buf,int length) {
return write(file_des, buf, length);
int ret = write(file_des, buf, length); //value of -1 is other end socket crash as sigpipe is ignored
if (ret < 0) cprintf(BG_RED, "Error writing to socket. Possible socket crash\n");
return ret;
}
@@ -328,37 +328,32 @@ int receiveData(int file_des, void* buf,int length, intType itype){
int nreceiving;
int nreceived;
if (file_des<0) return -1;
<<<<<<< HEAD
#ifdef VERY_VERBOSE
printf("want to receive %d Bytes\n", length);
#endif
=======
#ifdef VERY_VERBOSE
printf("want to receive %d Bytes\n", length);
#endif
>>>>>>> e564542ad33a64e66ad6153066741c69c707f99d
while(length>0){
while(length > 0) {
nreceiving = (length>send_rec_max_size) ? send_rec_max_size:length;
//#ifdef VERY_VERBOSE
// printf("want to receive %d Bytes\n", nreceiving);
//#endif
nreceived = read(file_des,(char*)buf+total_received,nreceiving);
//#ifdef VERY_VERBOSE
// printf("read %d \n", nreceived);
//#endif
if(!nreceived) break;
// if(nreceived<0) break;
if(!nreceived){
if(!total_received) {
return -1; //to handle it
}
break;
}
length-=nreceived;
total_received+=nreceived;
// cout<<"nrec: "<<nreceived<<" waiting for ("<<length<<")"<<endl;
}
//#ifdef VERY_VERBOSE
// printf("received %d Bytes\n", total_received);
//#endif
if (total_received>0)
strcpy(thisClientIP,dummyClientIP);
//if (strcmp(lastClientIP,"none")==0)
//strcpy(lastClientIP,thisClientIP);
if (strcmp(lastClientIP,thisClientIP))
differentClients=1;
else

View File

@@ -19,11 +19,12 @@ using namespace std;
/** Error flags */
/*Assumption: Only upto 63 detectors */
#define CRITICAL_ERROR_MASK 0xFFFFFFFF
#define MULTI_DETECTORS_NOT_ADDED 0x8000000000000000ULL
#define CRITICAL_ERROR_MASK 0xFFFFFFF
// 0xFFFFFFF000000000ULL
#define CANNOT_CONNECT_TO_DETECTOR 0x4000000000000000ULL
#define CANNOT_CONNECT_TO_RECEIVER 0x2000000000000000ULL
#define COULDNOT_SET_CONTROL_PORT 0x1000000000000000ULL
@@ -40,10 +41,12 @@ using namespace std;
#define COULD_NOT_CONFIGURE_MAC 0x0002000000000000ULL
#define COULDNOT_START_RECEIVER 0x0001000000000000ULL // default error like starting threads
#define COULDNOT_STOP_RECEIVER 0x0000800000000000ULL
#define RECEIVER_DET_POSID_NOT_SET 0x0000400000000000ULL
#define RECEIVER_MULTI_DET_SIZE_NOT_SET 0x0000200000000000ULL
// 0xFFFFFFFF00000000ULL
// 0xFFFFFFF000000000ULL
// 0x0000000FFFFFFFFFULL
#define COULDNOT_SET_NETWORK_PARAMETER 0x0000000000000001ULL
#define COULDNOT_SET_ROI 0x0000000000000002ULL
#define RECEIVER_READ_FREQUENCY 0x0000000000000004ULL
@@ -74,8 +77,10 @@ using namespace std;
#define RECEIVER_READ_TIMER 0x0000000008000000ULL
#define RECEIVER_ACQ_TIME_NOT_SET 0x0000000010000000ULL
#define RECEIVER_FLIPPED_DATA_NOT_SET 0x0000000020000000ULL
#define THRESHOLD_NOT_SET 0x0000000040000000ULL
#define RECEIVER_FILE_FORMAT 0x0000000080000000ULL
// 0x0000000FFFFFFFFFULL
// 0x00000000FFFFFFFFULL
/** @short class returning all error messages for error mask */
class errorDefs {
@@ -134,6 +139,12 @@ public:
if(slsErrorMask&DETECTOR_ACTIVATE)
retval.append("Could not activate/deactivate detector\n");
if(slsErrorMask&RECEIVER_DET_POSID_NOT_SET)
retval.append("Could not set detector position id\n");
if(slsErrorMask&RECEIVER_MULTI_DET_SIZE_NOT_SET)
retval.append("Could not set multi detector size\n");
@@ -234,6 +245,13 @@ public:
if(slsErrorMask&RECEIVER_FLIPPED_DATA_NOT_SET)
retval.append("Could not set receiver flipped data/bottom\n");
if(slsErrorMask&THRESHOLD_NOT_SET)
retval.append("Could not set threshold\n");
if(slsErrorMask&RECEIVER_FILE_FORMAT)
retval.append("Could not set receiver file format\n");
//------------------------------------------------------ length of message

View File

@@ -19,9 +19,6 @@
/** 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_IN_10NS 0x1FFFFFFF /** 29 bit register for max subframe exposure value */
/** maximum rois */
#define MAX_ROIS 100
@@ -129,7 +126,7 @@ class slsDetectorDefs: public virtual slsReceiverDefs{
typedef struct {
int module; /**< is the module number */
int serialnumber; /**< is the module serial number */
int nchan; /**< is the number of channels per chip */
int nchan; /**< is the number of channels on the module*/
int nchip; /**< is the number of chips on the module */
int ndac; /**< is the number of dacs on the module */
int nadc; /**< is the number of adcs on the module */

View File

@@ -8,7 +8,7 @@
#ifndef SLS_DETECTOR_FUNCS_H
#define SLS_DETECTOR_FUNCS_H
enum {
enum detFuncs{
// General purpose functions
F_EXEC_COMMAND=0, /**< command is executed */
@@ -109,10 +109,14 @@ enum {
F_PROGRAM_FPGA, /**< program FPGA */
F_RESET_FPGA, /**< reset FPGA */
F_POWER_CHIP, /**< power chip */
F_ACTIVATE, /** < activate */
F_PREPARE_ACQUISITION, /** < prepare acquisition */
F_CLEANUP_ACQUISITION, /** < clean up after acquisition */
/* Always append functions hereafter!!! */
/* Always append functions before!!! */
TOO_MANY_FUNCTIONS_DEFINED=128 //you should get a compilation error if there are already so many functions defined. It conflicts with sls_receiver_funcs.h
NUM_DET_FUNCTIONS,
TOO_MANY_FUNCTIONS_DEFINED=127 //you should get a compilation error if there are already so many functions defined. It conflicts with sls_receiver_funcs.h
};