diff --git a/slsSupportLib/include/sls_detector_defs.h b/slsSupportLib/include/sls_detector_defs.h index 1c3e69552..e98796e60 100755 --- a/slsSupportLib/include/sls_detector_defs.h +++ b/slsSupportLib/include/sls_detector_defs.h @@ -1,19 +1,20 @@ #pragma once /************************************************ * @file sls_detector_defs.h - * @short contains all the constants, enum definitions and enum-string conversions + * @short contains all the constants, enum definitions and enum-string + *conversions ***********************************************/ /** - *@short contains all the constants, enum definitions and enum-string conversions + *@short contains all the constants, enum definitions and enum-string + *conversions */ - #ifdef __CINT__ #define MYROOT #define __cplusplus #endif -#include +#include #ifdef __cplusplus #include "sls_detector_exceptions.h" #include @@ -22,19 +23,18 @@ #endif #include "ansi.h" - /** default ports */ -#define DEFAULT_PORTNO 1952 -#define DEFAULT_UDP_PORTNO 50001 -#define DEFAULT_GUI_PORTNO 65001 -#define DEFAULT_ZMQ_CL_PORTNO 30001 -#define DEFAULT_ZMQ_RX_PORTNO 30001 +#define DEFAULT_PORTNO 1952 +#define DEFAULT_UDP_PORTNO 50001 +#define DEFAULT_GUI_PORTNO 65001 +#define DEFAULT_ZMQ_CL_PORTNO 30001 +#define DEFAULT_ZMQ_RX_PORTNO 30001 -#define SLS_DETECTOR_HEADER_VERSION 0x2 -#define SLS_DETECTOR_JSON_HEADER_VERSION 0x3 +#define SLS_DETECTOR_HEADER_VERSION 0x2 +#define SLS_DETECTOR_JSON_HEADER_VERSION 0x3 // ctb/ moench 1g udp (read from fifo) -#define UDP_PACKET_DATA_BYTES (1344) +#define UDP_PACKET_DATA_BYTES (1344) /** maximum rois */ #define MAX_ROIS 100 @@ -43,887 +43,1108 @@ #define MAX_TRIMEN 100 /** maximum unit size of program sent to detector */ -#define MAX_FPGAPROGRAMSIZE (2 * 1024 *1024) +#define MAX_FPGAPROGRAMSIZE (2 * 1024 * 1024) /** get flag form most functions */ #define GET_FLAG -1 -#define DEFAULT_DET_MAC "00:aa:bb:cc:dd:ee" -#define DEFAULT_DET_IP "129.129.202.45" -#define DEFAULT_DET_MAC2 "00:aa:bb:cc:dd:ff" -#define DEFAULT_DET_IP2 "129.129.202.46" +#define DEFAULT_DET_MAC "00:aa:bb:cc:dd:ee" +#define DEFAULT_DET_IP "129.129.202.45" +#define DEFAULT_DET_MAC2 "00:aa:bb:cc:dd:ff" +#define DEFAULT_DET_IP2 "129.129.202.46" /** default maximum string length */ #define MAX_STR_LENGTH 1000 -#define MAX_FRAMES_PER_FILE 20000 -#define SHORT_MAX_FRAMES_PER_FILE 100000 -#define MOENCH_MAX_FRAMES_PER_FILE 100000 -#define EIGER_MAX_FRAMES_PER_FILE 10000 -#define JFRAU_MAX_FRAMES_PER_FILE 10000 -#define CTB_MAX_FRAMES_PER_FILE 20000 +#define MAX_FRAMES_PER_FILE 20000 +#define SHORT_MAX_FRAMES_PER_FILE 100000 +#define MOENCH_MAX_FRAMES_PER_FILE 100000 +#define EIGER_MAX_FRAMES_PER_FILE 10000 +#define JFRAU_MAX_FRAMES_PER_FILE 10000 +#define CTB_MAX_FRAMES_PER_FILE 20000 #define DEFAULT_STREAMING_TIMER_IN_MS 200 - typedef char mystring[MAX_STR_LENGTH]; - #ifdef __cplusplus class slsDetectorDefs { -public: - slsDetectorDefs(){}; + public: + slsDetectorDefs(){}; #endif - /** - Type of the detector - */ - enum detectorType { - GET_DETECTOR_TYPE=-1, /**< the detector will return its type */ - GENERIC, /**< generic sls detector */ - EIGER, /**< eiger */ - GOTTHARD, /**< gotthard */ - JUNGFRAU, /**< jungfrau */ - CHIPTESTBOARD, /**< CTB */ - MOENCH /**< moench */ - }; + /** + Type of the detector + */ + enum detectorType { + GET_DETECTOR_TYPE = -1, /**< the detector will return its type */ + GENERIC, /**< generic sls detector */ + EIGER, /**< eiger */ + GOTTHARD, /**< gotthard */ + JUNGFRAU, /**< jungfrau */ + CHIPTESTBOARD, /**< CTB */ + MOENCH /**< moench */ + }; + /** + return values + */ + enum { + OK, /**< function succeeded */ + FAIL, /**< function failed */ + FORCE_UPDATE + }; - /** - return values - */ - enum { - OK, /**< function succeeded */ - FAIL, /**< function failed */ - FORCE_UPDATE - }; + /** + indexes for the acquisition timers + */ + enum timerIndex { + FRAME_NUMBER, /**< number of real time frames: total number of + acquisitions is number or frames*number of cycles */ + ACQUISITION_TIME, /**< exposure time */ + FRAME_PERIOD, /**< period between exposures */ + DELAY_AFTER_TRIGGER, /**< delay between trigger and start of exposure or + readout (in triggered mode) */ + GATES_NUMBER, /**< number of gates per frame (in gated mode) */ + CYCLES_NUMBER, /**< number of cycles: total number of acquisitions is + number or frames*number of cycles */ + ACTUAL_TIME, /**< Actual time of the detector's internal timer */ + MEASUREMENT_TIME, /**< Time of the measurement from the detector (fifo) + */ + PROGRESS, /**< fraction of measurement elapsed - only get! */ + MEASUREMENTS_NUMBER, + FRAMES_FROM_START, + FRAMES_FROM_START_PG, + SAMPLES, + SUBFRAME_ACQUISITION_TIME, /**< subframe exposure time */ + STORAGE_CELL_NUMBER, /** sls_bitset; + typedef std::bitset sls_bitset; - typedef struct { - sls_detector_header detHeader; /**< is the detector header */ - sls_bitset packetsMask; /**< is the packets caught bit mask */ - } sls_receiver_header; + typedef struct { + sls_detector_header detHeader; /**< is the detector header */ + sls_bitset packetsMask; /**< is the packets caught bit mask */ + } sls_receiver_header; - typedef uint8_t bitset_storage[MAX_NUM_PACKETS/8]; + typedef uint8_t bitset_storage[MAX_NUM_PACKETS / 8]; #endif - /** - * frameDiscardPolicy - */ - enum frameDiscardPolicy { - GET_FRAME_DISCARD_POLICY = -1, /**< to get the missing packet mode */ - NO_DISCARD, /**< pad incomplete packets with -1, default mode */ - DISCARD_EMPTY_FRAMES, /**< discard incomplete frames, fastest mode, save space, not suitable for multiple modules */ - DISCARD_PARTIAL_FRAMES, /**< ignore missing packets, must check with packetsMask for data integrity, fast mode and suitable for multiple modules */ - NUM_DISCARD_POLICIES - }; - - - /** - format + /** + * frameDiscardPolicy */ - enum fileFormat { - GET_FILE_FORMAT=-1,/**< the receiver will return its file format */ - BINARY, /**< binary format */ - HDF5, /**< hdf5 format */ - NUM_FILE_FORMATS - }; + enum frameDiscardPolicy { + GET_FRAME_DISCARD_POLICY = -1, /**< to get the missing packet mode */ + NO_DISCARD, /**< pad incomplete packets with -1, default mode */ + DISCARD_EMPTY_FRAMES, /**< discard incomplete frames, fastest mode, save + space, not suitable for multiple modules */ + DISCARD_PARTIAL_FRAMES, /**< ignore missing packets, must check with + packetsMask for data integrity, fast mode and + suitable for multiple modules */ + NUM_DISCARD_POLICIES + }; + /** +format + */ + enum fileFormat { + GET_FILE_FORMAT = -1, /**< the receiver will return its file format */ + BINARY, /**< binary format */ + HDF5, /**< hdf5 format */ + NUM_FILE_FORMATS + }; - /** - @short structure for a region of interest - xmin,xmax,ymin,ymax define the limits of the region - */ - typedef struct { - int xmin; /**< is the roi xmin (in channel number) */ - int xmax; /**< is the roi xmax (in channel number)*/ - int ymin; /**< is the roi ymin (in channel number)*/ - int ymax; /**< is the roi ymax (in channel number)*/ - } ROI ; + /** + @short structure for a region of interest + xmin,xmax,ymin,ymax define the limits of the region + */ + typedef struct { + int xmin; /**< is the roi xmin (in channel number) */ + int xmax; /**< is the roi xmax (in channel number)*/ + int ymin; /**< is the roi ymin (in channel number)*/ + int ymax; /**< is the roi ymax (in channel number)*/ + } ROI; + /** + network parameters + */ + enum networkParameter { + DETECTOR_MAC, /**< detector MAC */ + DETECTOR_IP, /**< detector IP */ + RECEIVER_HOSTNAME, /**< receiver IP/hostname */ + RECEIVER_UDP_IP, /**< receiever UDP IP */ + RECEIVER_UDP_PORT, /**< receiever UDP Port */ + RECEIVER_UDP_MAC, /**< receiever UDP MAC */ + RECEIVER_UDP_PORT2, /**< receiever UDP Port of second half module for + eiger */ + DETECTOR_TXN_DELAY_LEFT, /**< transmission delay on the (left) port for + next frame */ + DETECTOR_TXN_DELAY_RIGHT, /**< transmission delay on the right port for + next frame */ + DETECTOR_TXN_DELAY_FRAME, /**< transmission delay of a whole frame for + all the ports */ + FLOW_CONTROL_10G, /**< flow control for 10GbE */ + FLOW_CONTROL_WR_PTR, /**< memory write pointer for flow control */ + FLOW_CONTROL_RD_PTR, /**< memory read pointer for flow control */ + RECEIVER_STREAMING_PORT, /**< receiever streaming TCP(ZMQ) port */ + CLIENT_STREAMING_PORT, /**< client streaming TCP(ZMQ) port */ + RECEIVER_STREAMING_SRC_IP, /**< receiever streaming TCP(ZMQ) ip */ + CLIENT_STREAMING_SRC_IP, /**< client streaming TCP(ZMQ) ip */ + ADDITIONAL_JSON_HEADER, /**< additional json header (ZMQ) */ + RECEIVER_UDP_SCKT_BUF_SIZE, /**< UDP socket buffer size */ + RECEIVER_REAL_UDP_SCKT_BUF_SIZE /**< real UDP socket buffer size */ + }; + /** + type of action performed (for text client) + */ + enum { GET_ACTION, PUT_ACTION, READOUT_ACTION, HELP_ACTION }; - /** - network parameters - */ + /** online flags enum \sa setOnline*/ + enum { + GET_ONLINE_FLAG = -1, /**< returns wether the detector is in online or + offline state */ + OFFLINE_FLAG = 0, /**< detector in offline state (i.e. no communication + to the detector - using only local structure - no + data acquisition possible!) */ + ONLINE_FLAG = 1 /**< detector in online state (i.e. communication to the + detector updating the local structure) */ + }; - enum networkParameter { - DETECTOR_MAC, /**< detector MAC */ - DETECTOR_IP, /**< detector IP */ - RECEIVER_HOSTNAME, /**< receiver IP/hostname */ - RECEIVER_UDP_IP, /**< receiever UDP IP */ - RECEIVER_UDP_PORT, /**< receiever UDP Port */ - RECEIVER_UDP_MAC, /**< receiever UDP MAC */ - RECEIVER_UDP_PORT2, /**< receiever UDP Port of second half module for eiger */ - DETECTOR_TXN_DELAY_LEFT, /**< transmission delay on the (left) port for next frame */ - DETECTOR_TXN_DELAY_RIGHT, /**< transmission delay on the right port for next frame */ - DETECTOR_TXN_DELAY_FRAME, /**< transmission delay of a whole frame for all the ports */ - FLOW_CONTROL_10G, /**< flow control for 10GbE */ - FLOW_CONTROL_WR_PTR, /**< memory write pointer for flow control */ - FLOW_CONTROL_RD_PTR, /**< memory read pointer for flow control */ - RECEIVER_STREAMING_PORT, /**< receiever streaming TCP(ZMQ) port */ - CLIENT_STREAMING_PORT, /**< client streaming TCP(ZMQ) port */ - RECEIVER_STREAMING_SRC_IP,/**< receiever streaming TCP(ZMQ) ip */ - CLIENT_STREAMING_SRC_IP, /**< client streaming TCP(ZMQ) ip */ - ADDITIONAL_JSON_HEADER, /**< additional json header (ZMQ) */ - RECEIVER_UDP_SCKT_BUF_SIZE, /**< UDP socket buffer size */ - RECEIVER_REAL_UDP_SCKT_BUF_SIZE /**< real UDP socket buffer size */ - }; + /** + flags to get (or set) the size of the detector + */ + enum numberOf { + MAXMODX, /***/ + M_vIbias, /**< mythen 3 >*/ + M_vIinSh, /**< mythen 3 >*/ + M_VdcSh, /**< mythen 3 >*/ + M_Vth2, /**< mythen 3 >*/ + M_VPL, /**< mythen 3 >*/ + M_Vth3, /**< mythen 3 >*/ + M_casSh, /**< mythen 3 >*/ + M_cas, /**< mythen 3 >*/ + M_vIbiasSh, /**< mythen 3 >*/ + M_vIcin, /**< mythen 3 >*/ + M_vIpreOut, /**< mythen 3 >*/ + V_POWER_A = 100, /**new chiptest board */ + V_POWER_B = 101, /**new chiptest board */ + V_POWER_C = 102, /**new chiptest board */ + V_POWER_D = 103, /**new chiptest board */ + V_POWER_IO = 104, /**new chiptest board */ + V_POWER_CHIP = 105, /**new chiptest board */ + I_POWER_A = 106, /**new chiptest board */ + I_POWER_B = 107, /**new chiptest board */ + I_POWER_C = 108, /**new chiptest board */ + I_POWER_D = 109, /**new chiptest board */ + I_POWER_IO = 110, /**new chiptest board */ + V_LIMIT = 111, /**new chiptest board */ + SLOW_ADC0 = 1000, + SLOW_ADC1, + SLOW_ADC2, + SLOW_ADC3, + SLOW_ADC4, + SLOW_ADC5, + SLOW_ADC6, + SLOW_ADC7, + SLOW_ADC_TEMP + }; + /** + detector settings indexes + */ + enum detectorSettings { + GET_SETTINGS = -1, /**< return current detector settings */ + STANDARD, /**< standard settings */ + FAST, /**< fast settings */ + HIGHGAIN, /**< highgain settings */ + DYNAMICGAIN, /**< dynamic gain settings */ + LOWGAIN, /**< low gain settings */ + MEDIUMGAIN, /**< medium gain settings */ + VERYHIGHGAIN, /**< very high gain settings */ + LOWNOISE, /**< low noise settings */ + DYNAMICHG0, /**< dynamic high gain 0 */ + FIXGAIN1, /**< fix gain 1 */ + FIXGAIN2, /**< fix gain 2 */ + FORCESWITCHG1, /**< force switch gain 1 */ + FORCESWITCHG2, /**< force switch gain 2 */ + VERYLOWGAIN, /**< very low gain settings */ + UNDEFINED = 200, /**< undefined or custom settings */ + UNINITIALIZED /**< uninitialiazed (status at startup) */ + }; - /** - use of the external signals - */ - enum externalSignalFlag { - GET_EXTERNAL_SIGNAL_FLAG=-1, /***/ - M_vIbias, /**< mythen 3 >*/ - M_vIinSh, /**< mythen 3 >*/ - M_VdcSh, /**< mythen 3 >*/ - M_Vth2, /**< mythen 3 >*/ - M_VPL, /**< mythen 3 >*/ - M_Vth3, /**< mythen 3 >*/ - M_casSh, /**< mythen 3 >*/ - M_cas, /**< mythen 3 >*/ - M_vIbiasSh, /**< mythen 3 >*/ - M_vIcin, /**< mythen 3 >*/ - M_vIpreOut, /**< mythen 3 >*/ - V_POWER_A = 100, /**new chiptest board */ - V_POWER_B = 101, /**new chiptest board */ - V_POWER_C = 102, /**new chiptest board */ - V_POWER_D = 103, /**new chiptest board */ - V_POWER_IO =104, /**new chiptest board */ - V_POWER_CHIP=105 ,/**new chiptest board */ - I_POWER_A=106 , /**new chiptest board */ - I_POWER_B=107 , /**new chiptest board */ - I_POWER_C=108 , /**new chiptest board */ - I_POWER_D=109 , /**new chiptest board */ - I_POWER_IO=110 , /**new chiptest board */ - V_LIMIT=111, /**new chiptest board */ - SLOW_ADC0=1000, - SLOW_ADC1, - SLOW_ADC2, - SLOW_ADC3, - SLOW_ADC4, - SLOW_ADC5, - SLOW_ADC6, - SLOW_ADC7, - SLOW_ADC_TEMP - }; + /** port type */ + enum portType { + CONTROL_PORT, /**< control port */ + STOP_PORT, /**