creating a separate receiver

This commit is contained in:
Maliakal Dhanya
2014-05-21 09:44:35 +02:00
parent 4958d198d1
commit 8788a060dd
58 changed files with 459 additions and 7804 deletions

View File

@ -7,10 +7,9 @@
#define __cplusplus
#endif
#include <stdint.h>
//#include <stdint.h>
#include "sls_receiver_defs.h"
/** default maximum string length */
#define MAX_STR_LENGTH 1000
/** default maximum string length */
#define MAX_SCAN_STEPS 2000
/** maxmimum number of modules per controller*/
@ -23,9 +22,7 @@
/** maximum rois */
#define MAX_ROIS 100
typedef double double32_t;
typedef float float32_t;
typedef int int32_t;
typedef char mystring[MAX_STR_LENGTH];
typedef double mysteps[MAX_SCAN_STEPS];
@ -39,10 +36,6 @@ typedef float dacs_t;
#define DEFAULT_DET_MAC "00:aa:bb:cc:dd:ee"
#define DEFAULT_DET_IP "129.129.202.46"
#define MAX_FRAMES_PER_FILE 20000
#define SHORT_MAX_FRAMES_PER_FILE 100000
#define MOENCH_MAX_FRAMES_PER_FILE 1000
/**
\file sls_detector_defs.h
@ -54,7 +47,7 @@ and to the server programs running on the detector
* @version 0.1alpha (any string)
* @see slsDetector
$Revision$
$Revision: 824 $
*/
@ -62,11 +55,11 @@ $Revision$
/** get flag form most functions */
#define GET_FLAG -1
//#if defined(__cplusplus) && !defined(EIGERD)
#ifdef __cplusplus
/** @short class containing all the structures, constants and enum definitions */
class slsDetectorDefs {
class slsDetectorDefs: public virtual slsReceiverDefs{
public:
slsDetectorDefs(){};
@ -78,7 +71,7 @@ class slsDetectorDefs {
/**
/**
@short structure for a detector channel
should not be used by unexperienced users
@ -91,8 +84,8 @@ class slsDetectorDefs {
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
@ -102,17 +95,17 @@ class slsDetectorDefs {
int chip; /**< is the chip number */
int module; /**< is the module number */
int nchan; /**< is the number of channels in the chip */
int reg; /**<is the chip register (e.g. output analogue buffer enable)
int reg; /**<is the chip register (e.g. output analogue buffer enable)
\see ::chipRegisterBit */
int *chanregs; /**< is the pointer to the array of the channel registers
int *chanregs; /**< is the pointer to the array of the channel registers
\see ::channelRegisterBit */
} sls_detector_chip;
/**
/**
@short structure for a detector module
should not be used by unexperienced users
\see :: moduleRegisterBit ::chipRegisterBit :channelRegisterBit
@li reg is the module register (e.g. dynamic range? see moduleRegisterBit)
@ -130,21 +123,21 @@ typedef struct {
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 */
int reg; /**< is the module register (e.g. dynamic range?)
int reg; /**< is the module register (e.g. dynamic range?)
\see moduleRegisterBit */
dacs_t *dacs; /**< is the pointer to the array of the dac values (in V) */
dacs_t *adcs; /**< is the pointer to the array of the adc values (in V) FLAT_FIELD_CORRECTION*/
int *chipregs; /**< is the pointer to the array of the chip registers
int *chipregs; /**< is the pointer to the array of the chip registers
\see ::chipRegisterBit */
int *chanregs; /**< is the pointer to the array of the channel registers
int *chanregs; /**< is the pointer to the array of the channel registers
\see ::channelRegisterBit */
double gain; /**< is the module gain (V/keV) */
double offset; /**< is the module offset (V) */
} sls_detector_module;
/**
/**
@short structure for a region of interest
xmin,xmax,ymin,ymax define the limits of the region
*/
typedef struct {
@ -164,20 +157,7 @@ typedef struct {
/* } iarray ; */
/**
Type of the detector
*/
enum detectorType {
GET_DETECTOR_TYPE=-1, /**< the detector will return its type */
GENERIC, /**< generic sls detector */
MYTHEN, /**< mythen */
PILATUS, /**< pilatus */
EIGER, /**< eiger */
GOTTHARD, /**< gotthard */
PICASSO, /**< picasso */
AGIPD, /**< agipd */
MOENCH /**< moench */
};
/* /\** */
/* Communication protocol (normally TCP) */
@ -187,7 +167,7 @@ enum detectorType {
/* UDP /\**< UDP *\/ */
/* }; */
/**
/**
network parameters
*/
@ -211,7 +191,7 @@ enum {GET_ONLINE_FLAG=-1, /**< returns wether the detector is in online or offli
ONLINE_FLAG =1/**< detector in online state (i.e. communication to the detector updating the local structure) */
};
/**
/**
flags to get (or set) the size of the detector
*/
enum numberOf {
@ -225,7 +205,7 @@ enum numberOf {
NCHIPSY /**<number of chips in Y direction */
};
/**
/**
dimension indexes
*/
enum dimension {
@ -234,17 +214,7 @@ enum dimension {
Z=2 /**< Z dimension */
};
/**
return values
*/
enum {
OK, /**< function succeeded */
FAIL, /**< function failed */
FINISHED, /**< acquisition finished */
FORCE_UPDATE
};
/**
/**
enable/disable flags
*/
enum {
@ -253,7 +223,7 @@ enum {
};
/**
/**
use of the external signals
*/
enum externalSignalFlag {
@ -276,7 +246,7 @@ enum externalSignalFlag {
MASTER_SLAVE_SYNCHRONIZATION /**< reserved for master/slave synchronization in multi detector systems */
};
/**
/**
communication mode using external signals
*/
enum externalCommunicationMode{
@ -287,7 +257,7 @@ enum externalCommunicationMode{
GATE_FIX_NUMBER, /**< gated and reads out after a fixed number of gates */
GATE_WITH_START_TRIGGER /**< gated with start trigger */
};
/**
/**
detector IDs/versions
*/
enum idMode{
@ -299,7 +269,7 @@ enum idMode{
THIS_SOFTWARE_VERSION, /**<return this software version */
RECEIVER_VERSION /**<return receiver software version */
};
/**
/**
detector digital test modes
*/
enum digitalTestMode {
@ -311,7 +281,7 @@ enum digitalTestMode {
DETECTOR_SOFTWARE_TEST, /**< test detector system software */
DIGITAL_BIT_TEST /**< gotthard digital bit test */
};
/**
/**
detector analogue test modes
*/
enum analogTestMode {
@ -319,7 +289,7 @@ enum analogTestMode {
MY_ANALOG_TEST_MODE /**< other possible test modes */
};
/**
/**
detector dacs indexes
*/
enum dacIndex {
@ -339,12 +309,12 @@ enum dacIndex {
VIO_POT, /**< chiptest board power supply va */
HV_POT, /**< gotthard, chiptest board high voltage */
G_VREF_DS, /**< gotthard */
G_VCASCN_PB, /**< gotthard */
G_VCASCP_PB, /**< gotthard */
G_VOUT_CM, /**< gotthard */
G_VCASC_OUT, /**< gotthard */
G_VCASCN_PB, /**< gotthard */
G_VCASCP_PB, /**< gotthard */
G_VOUT_CM, /**< gotthard */
G_VCASC_OUT, /**< gotthard */
G_VIN_CM, /**< gotthard */
G_VREF_COMP, /**< gotthard */
G_VREF_COMP, /**< gotthard */
G_IB_TESTC, /**< gotthard */
V_DAC0, /**< moench */
V_DAC1, /**< moench */
@ -372,10 +342,10 @@ enum dacIndex {
E_Vis /**< eiger */
};
/**
/**
detector settings indexes
*/
enum detectorSettings{
enum detectorSettings{
GET_SETTINGS=-1, /**< return current detector settings */
STANDARD, /**< standard settings */
FAST, /**< fast settings */
@ -388,7 +358,7 @@ enum detectorSettings{
UNDEFINED, /**< undefined or custom settings */
UNINITIALIZED /**< uninitialiazed (status at startup) */
};
/**
/**
meaning of the channel register bits
\see ::sls_detector_channel
*/
@ -400,7 +370,7 @@ enum channelRegisterBit {
};
#define TRIMBITMASK 0x3f
/**
/**
meaning of the chip register bits
\see ::sls_detector_chip
*/
@ -408,7 +378,7 @@ 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 {
@ -416,25 +386,8 @@ enum moduleRegisterBit {
MODULE_OUTPUT_WIDTH /**< possibly module dynamic range */
};
/**
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) */
PROBES_NUMBER, /**< number of probe types in pump-probe 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
};
/**
/**
important speed parameters
*/
enum speedVariable {
@ -447,19 +400,8 @@ enum speedVariable {
OVERSAMPLING /**< oversampling for analog detectors */
};
/**
staus mask
*/
enum runStatus {
IDLE, /**< detector ready to start acquisition - no data in memory */
ERROR, /**< error i.e. normally fifo full */
WAITING, /**< waiting for trigger or gate signal */
RUN_FINISHED, /**< acquisition not running but data in memory */
TRANSMITTING, /**< acquisition running and data in memory */
RUNNING /**< acquisition running, no data in memory */
};
/**
/**
readout flags
*/
enum readOutFlags {
@ -473,7 +415,7 @@ enum readOutFlags {
TOT_MODE=0x2000,/**<pump-probe mode */
CONTINOUS_RO=0x4000/**<pump-probe mode */
};
/**
/**
trimming modes
*/
enum trimMode {
@ -483,7 +425,7 @@ enum trimMode {
FIXEDSETTINGS_TRIMMING,/**< trim without optimizing the threshold and the trimbit size */
OFFLINE_TRIMMING /**< trimming is performed offline */
};
/**
/**
data correction flags
*/
enum correctionFlags {
@ -498,10 +440,10 @@ enum correctionFlags {
};
/** port type */
enum portType {
CONTROL_PORT, /**< control port */
CONTROL_PORT, /**< control port */
STOP_PORT, /**<stop port */
DATA_PORT /**< receiver tcp port with client*/
};
};
/** hierarchy in multi-detector structure, if any */
enum masterFlags {
@ -509,7 +451,7 @@ enum masterFlags {
NO_MASTER, /**< no master/slave hierarchy defined */
IS_MASTER, /**<is master */
IS_SLAVE /**< is slave */
};
};
/** synchronization in a multidetector structure, if any */
enum synchronizationMode {
@ -550,7 +492,7 @@ enum angleConversionParameter {
MOVE_FLAG, /**< wether the detector moves with the motor or not in a multi detector system */
SAMPLE_X, /**< sample displacement in the beam direction */
SAMPLE_Y /**< sample displacement orthogonal to the beam */
};
};
@ -575,6 +517,7 @@ enum angleConversionParameter {
#ifndef MYROOT
#include "sls_detector_funcs.h"
//#include "sls_receiver_funcs.h"
#endif

View File

@ -21,9 +21,7 @@ enum {
F_SET_EXTERNAL_SIGNAL_FLAG, /**< set/get flag for external signal */
F_SET_EXTERNAL_COMMUNICATION_MODE, /**< set/get external communication mode (obsolete) */
// Tests and identification
F_GET_ID, /**< get detector id of version */
F_DIGITAL_TEST, /**< digital test of the detector */
F_ANALOG_TEST, /**<analog test of the detector */
@ -38,7 +36,6 @@ enum {
F_WRITE_MEMORY, /**< write to memory */
F_READ_MEMORY, /**< read memory */
F_SET_CHANNEL, /**< initialize channel */
F_GET_CHANNEL, /**< get channel register */
F_SET_ALL_CHANNELS, /**< initialize all channels */
@ -51,12 +48,10 @@ enum {
F_GET_MODULE, /**< get module status */
F_SET_ALL_MODULES, /**< initialize all modules */
F_SET_SETTINGS, /**< set detector settings */
F_GET_THRESHOLD_ENERGY, /**< get detector threshold (in eV) */
F_SET_THRESHOLD_ENERGY, /**< set detector threshold (in eV) */
// Acquisition functions
F_START_ACQUISITION, /**< start acquisition */
F_STOP_ACQUISITION, /**< stop acquisition */
@ -70,77 +65,30 @@ enum {
F_SET_TIMER, /**< set/get timer value */
F_GET_TIME_LEFT, /**< get current value of the timer (time left) */
F_SET_DYNAMIC_RANGE, /**< set/get detector dynamic range */
F_SET_READOUT_FLAGS, /**< set/get readout flags */
F_SET_ROI, /**< set/get region of interest */
F_SET_SPEED, /**< set/get readout speed parameters */
//Trimming
F_EXECUTE_TRIMMING, /**< execute trimming */
F_EXIT_SERVER, /**< turn off detector server */
F_LOCK_SERVER, /**< Locks/Unlocks server communication to the given client */
F_GET_LAST_CLIENT_IP, /**< returns the IP of the client last connected to the detector */
F_SET_PORT, /**< Changes communication port of the server */
F_UPDATE_CLIENT, /**< Returns all the important parameters to update the shared memory of the client */
F_CONFIGURE_MAC, /**< Configures MAC for Gotthard readout */
F_LOAD_IMAGE, /**< Loads Dark/Gain image to the Gotthard detector */
// multi detector structures
F_SET_MASTER, /**< sets master/slave flag for multi detector structures */
F_SET_SYNCHRONIZATION_MODE, /**< sets master/slave synchronization mode for multidetector structures */
F_READ_COUNTER_BLOCK, /**< reads the counter block memory for gotthard */
F_RESET_COUNTER_BLOCK, /**< resets the counter block memory for gotthard */
F_CALIBRATE_PEDESTAL /**< starts acquistion, calibrates pedestal and write back to fpga */
//receiver
F_SET_FILE_PATH, /**< sets receiver file directory */
F_SET_FILE_NAME, /**< sets receiver file name */
F_SET_FILE_INDEX, /**< sets receiver file index */
F_START_RECEIVER, /**< starts the receiver listening mode */
F_STOP_RECEIVER, /**< stops the receiver listening mode */
F_GET_RECEIVER_STATUS, /**< gets the status of receiver listening mode */
F_GET_FRAMES_CAUGHT, /**< gets the number of frames caught by receiver */
F_GET_FRAME_INDEX, /**< gets the frame index */
F_RESET_FRAMES_CAUGHT, /**< resets the frames caught */
F_SETUP_UDP, /**< sets the receiver udp connection and returns receiver mac address */
F_ENABLE_FILE_WRITE, /**< sets the receiver file write */
F_SET_FRAME_INDEX, /**< sets the receiver frame index */
F_CALIBRATE_PEDESTAL, /**< starts acquistion, calibrates pedestal and write back to fpga */
F_READ_RECEIVER_FREQUENCY, /**< sets the frequency of receiver sending frames to gui */
F_ENABLE_COMPRESSION, /**< enable compression in receiver */
F_SET_DETECTOR_HOSTNAME, /**< set detector hostname in receiver */
F_ENABLE_OVERWRITE /**< set overwrite flag in receiver */
/* Always append functions hereafter!!! */
};