#ifndef SLS_DETECTOR_DEFS_H #define SLS_DETECTOR_DEFS_H #ifdef __CINT__ #define MYROOT #define __cplusplus #endif //#include #include "sls_receiver_defs.h" /** default maximum string length */ #define MAX_SCAN_STEPS 2000 /** maxmimum number of modules per controller*/ #define MAXMODS 24 /** maxmimum number of detectors ina multidetector structure*/ #define MAXDET 100 /** header length for data :gotthard*/ #define HEADERLENGTH 12 /** maximum rois */ #define MAX_ROIS 100 /** maximum unit size of program sent to detector */ #define MAX_FPGAPROGRAMSIZE (2 * 1024 *1024) #define MAX_SCAN_LEVELS 2 typedef char mystring[MAX_STR_LENGTH]; typedef double mysteps[MAX_SCAN_STEPS]; #ifndef DACS_FLOAT typedef int dacs_t; #else typedef float dacs_t; #endif #define DEFAULT_DET_MAC "00:aa:bb:cc:dd:ee" #define DEFAULT_DET_IP "129.129.202.46" /** \file sls_detector_defs.h This file contains all the basic definitions common to the slsDetector class and to the server programs running on the detector * @author Anna Bergamaschi * @version 0.1alpha (any string) * @see slsDetector $Revision: 824 $ */ /** get flag form most functions */ #define GET_FLAG -1 #ifdef __cplusplus /** @short class containing all the structures, constants and enum definitions */ class slsDetectorDefs: public virtual slsReceiverDefs{ public: slsDetectorDefs(){}; #endif enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript, enCalLog, angCalLog, MAX_ACTIONS}; /** @short structure for a detector channel should not be used by unexperienced users \see ::channelRegisterBit */ typedef struct { int chan; /**< is the channel number */ int chip; /**< is the chip number */ int module; /**< is the module number */ int64_t reg; /**< is the is the channel register (e.g. trimbits, calibration enable, comparator enable...) */ } sls_detector_channel; /** @short structure for a detector chip should not be used by unexperienced users \see ::chipRegisterBit ::channelRegisterBit */ typedef struct { int chip; /**< is the chip number */ int module; /**< is the module number */ int nchan; /**< is the number of channels in the chip */ int reg; /***/ 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 */ }; /** 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) */ }; /** meaning of the channel register bits \see ::sls_detector_channel */ enum channelRegisterBit { TRIMBIT_OFF=0, /**< offset of trimbit value in the channel register */ COMPARATOR_ENABLE=0x100, /**< mask of the comparator enable bit */ ANALOG_SIGNAL_ENABLE=0x200, /**< mask of the analogue output enable bit */ CALIBRATION_ENABLE=0x300, /**< mask of the calibration input enable bit */ }; #define TRIMBITMASK 0x3f /** meaning of the chip register bits \see ::sls_detector_chip */ enum chipRegisterBit { ENABLE_ANALOG_OUTPUT=0x1, /**< mask of the analogue output enable bit */ CHIP_OUTPUT_WIDTH=0x2 /**< mask of the chip output width */ }; /** meaning of the module register bits */ enum moduleRegisterBit { MY_MODULE_REGISTER_BIT, /**< possible module register bit meaning */ MODULE_OUTPUT_WIDTH /**< possibly module dynamic range */ }; /** important speed parameters */ enum speedVariable { CLOCK_DIVIDER, /**< readout clock divider */ WAIT_STATES, /**< wait states for bus read */ TOT_CLOCK_DIVIDER, /**< wait states for bus read */ TOT_DUTY_CYCLE, /**< wait states for bus read */ SET_SIGNAL_LENGTH, /**< set/clear signal length */ PHASE_SHIFT, /**< adds phase shift */ OVERSAMPLING, /**< oversampling for analog detectors */ ADC_CLOCK, /**< adc clock divider */ ADC_PHASE, /**< adc clock phase */ ADC_PIPELINE, /**< adc pipeline */ DBIT_CLOCK, /**< adc clock divider */ DBIT_PHASE, /**< adc clock phase */ DBIT_PIPELINE /**< adc pipeline */ }; /** readout flags */ enum readOutFlags { GET_READOUT_FLAGS=-1, /**< return readout flags */ NORMAL_READOUT=0, /**< no flag */ STORE_IN_RAM=0x1, /**< data are stored in ram and sent only after end of acquisition for faster frame rate */ READ_HITS=0x2, /**< return only the number of the channel which counted ate least one */ ZERO_COMPRESSION=0x4,/**< returned data are 0-compressed */ PUMP_PROBE_MODE=0x8,/**