areaDetector  3-5-0
EPICS areaDetector framework
Classes | Macros | Enumerations | Functions
pixirad.cpp File Reference
#include <stddef.h>
#include <stdlib.h>
#include <stdarg.h>
#include <math.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <epicsTime.h>
#include <epicsThread.h>
#include <epicsEvent.h>
#include <epicsString.h>
#include <epicsStdio.h>
#include <epicsMutex.h>
#include <osiSock.h>
#include <iocsh.h>
#include <asynOctetSyncIO.h>
#include <asynCommonSyncIO.h>
#include "ADDriver.h"
#include "PIXIEII_data_utilities_v2.h"
#include <epicsExport.h>

Classes

class  pixirad
 Driver for PiXirad pixel array detectors using their server server over TCP/IP socket. More...
 

Macros

#define DRIVER_VERSION   2
 
#define DRIVER_REVISION   2
 
#define DRIVER_MODIFICATION   0
 
#define MAX_MESSAGE_SIZE   256
 Messages to/from server. More...
 
#define SERVER_DEFAULT_TIMEOUT   1.0
 
#define DEW_POINT_WARNING   3
 
#define DEW_POINT_ERROR   0
 
#define THOT_WARNING   40
 
#define THOT_ERROR   50
 
#define TCOLD_WARNING   30
 
#define TCOLD_ERROR   40
 
#define DETECTOR_RESET_TIME   5.0
 
#define MAX_UDP_DATA_BUFFER   256217728
 
#define MAX_UDP_PACKET_LEN   1448
 
#define DAQ_PACKET_FRAGMENT   45
 
#define AUTOCAL_DATA   0x40
 
#define PACKET_ID_OFFSET   2
 
#define PACKET_ID_BYTES   2
 
#define PACKET_CRC_BYTES   4
 
#define PACKET_TAG_BYTES   2
 
#define PACKET_TAG_OFFSET   0
 
#define FRAME_HAS_ALIGN_ERRORS   0x20
 
#define PACKET_SENSOR_DATA_OFFSET   (PACKET_TAG_BYTES + PACKET_ID_BYTES)
 
#define PACKET_EXTRA_BYTES   (PACKET_ID_BYTES + PACKET_TAG_BYTES + PACKET_CRC_BYTES)
 
#define PACKET_SENSOR_DATA_BYTES   (MAX_UDP_PACKET_LEN - PACKET_EXTRA_BYTES)
 
#define PIXIEII_MODULES   1
 
#define PIXIE_THDAC_OFFSET   0
 
#define DUMMY_0_OFFSET   0
 
#define PIXIE_THDAC_MASK   0x1f
 
#define PIXIE_THDAC_OFFSET   0
 
#define DUMMY_1_OFFSET   8
 
#define NUM_THRESHOLDS   5
 
#define THRESH_B_COEFF   39.3
 
#define THRESH_A_COEFF   36.6
 
#define EXTDAC_LSB   0.000781
 
#define VAGND   0.6
 
#define VTHMAX_UPPER_LIMIT   2200
 
#define VTHMAX_LOWER_LIMIT   1000
 
#define VTHMAX_DECR_STEP   1
 
#define VTHMAX_MAX_ITERATIONS   2000
 
#define VTH1_ACCURACY   0.001
 
#define INT_DAC_STEPS   32
 
#define INITIAL_HV_VALUE   350
 
#define INITIAL_HV_STATE   HVOn
 
#define INITIAL_HV_MODE   HVAuto
 
#define INITIAL_COOLING_VALUE   15
 
#define INITIAL_COOLING_STATE   CoolingOn
 
#define PIII_P0   494.70
 
#define PIII_P1   19.36
 
#define PixiradSystemResetString   "SYSTEM_RESET"
 
#define PixiradSystemInfoString   "SYSTEM_INFO"
 
#define PixiradColorsCollectedString   "COLORS_COLLECTED"
 
#define PixiradUDPBuffersReadString   "UDP_BUFFERS_READ"
 
#define PixiradUDPBuffersMaxString   "UDP_BUFFERS_MAX"
 
#define PixiradUDPBuffersFreeString   "UDP_BUFFERS_FREE"
 
#define PixiradUDPSpeedString   "UDP_SPEED"
 
#define PixiradThresh1String   "THRESHOLD1"
 
#define PixiradThresh2String   "THRESHOLD2"
 
#define PixiradThresh3String   "THRESHOLD3"
 
#define PixiradThresh4String   "THRESHOLD4"
 
#define PixiradHitThreshString   "HIT_THRESHOLD"
 
#define PixiradThreshActual1String   "THRESHOLD_ACTUAL1"
 
#define PixiradThreshActual2String   "THRESHOLD_ACTUAL2"
 
#define PixiradThreshActual3String   "THRESHOLD_ACTUAL3"
 
#define PixiradThreshActual4String   "THRESHOLD_ACTUAL4"
 
#define PixiradHitThreshActualString   "HIT_THRESHOLD_ACTUAL"
 
#define PixiradCountModeString   "COUNT_MODE"
 
#define PixiradAutoCalibrateString   "AUTO_CALIBRATE"
 
#define PixiradHVValueString   "HV_VALUE"
 
#define PixiradHVStateString   "HV_STATE"
 
#define PixiradHVModeString   "HV_MODE"
 
#define PixiradHVActualString   "HV_ACTUAL"
 
#define PixiradHVCurrentString   "HV_CURRENT"
 
#define PixiradSyncInPolarityString   "SYNC_IN_POLARITY"
 
#define PixiradSyncOutPolarityString   "SYNC_OUT_POLARITY"
 
#define PixiradSyncOutFunctionString   "SYNC_OUT_FUNCTION"
 
#define PixiradCoolingStateString   "COOLING_STATE"
 
#define PixiradHotTemperatureString   "HOT_TEMPERATURE"
 
#define PixiradBoxTemperatureString   "BOX_TEMPERATURE"
 
#define PixiradBoxHumidityString   "BOX_HUMIDITY"
 
#define PixiradDewPointString   "DEW_POINT"
 
#define PixiradCoolingStatusString   "COOLING_STATUS"
 
#define PixiradPeltierPowerString   "PELTIER_POWER"
 
#define FIRST_PIXIRAD_PARAM   PixiradSystemReset
 
#define LAST_PIXIRAD_PARAM   PixiradPeltierPower
 
#define NUM_PIXIRAD_PARAMS   ((int)(&LAST_PIXIRAD_PARAM - &FIRST_PIXIRAD_PARAM + 1))
 
#define MAX_STATUS_PARAMS   7
 

Enumerations

enum  PixiradTriggerMode_t { TMInternal, TMExternal, TMBulb }
 Trigger modes. More...
 
enum  PixiradCoolingState_t { CoolingOff, CoolingOn }
 Cooling state. More...
 
enum  PixiradCoolingStatus_t {
  TSOK, TSDewPointWarning, TSDewPointError, TSTHotWarning,
  TSTHotError, TSTColdWarning, TSTColdError
}
 Temperature status. More...
 
enum  PixiradHVState_t { HVOff, HVOn }
 High voltage state. More...
 
enum  PixiradHVMode_t { HVManual, HVAuto }
 High voltage mode. More...
 
enum  PixiradSyncPolarity_t { SyncPos, SyncNeg }
 Sync in/out polarity. More...
 
enum  PixiradSyncOutFunction_t { SyncOutShutter, SyncOutReadoutDone, SyncOutRead }
 Sync out function. More...
 
enum  PixiradFrameType_t {
  FTOneColorLow, FTOneColorHigh, FTTwoColors, FTFourColors,
  FTOneColorDTF, FTTwoColorsDTF
}
 Frame type. More...
 
enum  PixiradCountModeType_t { RM_Normal, RM_NPI, RM_NPI_SUM }
 

Functions

int pixiradConfig (const char *portName, const char *commandPort, int dataPortNumber, int statusPortNumber, int maxDataPortBuffers, int maxSizeX, int maxSizeY, int maxBuffers, size_t maxMemory, int priority, int stackSize)
 
int pixiradAutoCal (const char *portName, int ofs0, int fs0, int ofs2, int fs1, int fs2, int ibias, int vbgMcalDAC)
 
 epicsExportRegistrar (pixiradRegister)
 

Macro Definition Documentation

◆ AUTOCAL_DATA

#define AUTOCAL_DATA   0x40

◆ DAQ_PACKET_FRAGMENT

#define DAQ_PACKET_FRAGMENT   45

◆ DETECTOR_RESET_TIME

#define DETECTOR_RESET_TIME   5.0

◆ DEW_POINT_ERROR

#define DEW_POINT_ERROR   0

◆ DEW_POINT_WARNING

#define DEW_POINT_WARNING   3

◆ DRIVER_MODIFICATION

#define DRIVER_MODIFICATION   0

◆ DRIVER_REVISION

#define DRIVER_REVISION   2

◆ DRIVER_VERSION

#define DRIVER_VERSION   2

◆ DUMMY_0_OFFSET

#define DUMMY_0_OFFSET   0

◆ DUMMY_1_OFFSET

#define DUMMY_1_OFFSET   8

◆ EXTDAC_LSB

#define EXTDAC_LSB   0.000781

◆ FIRST_PIXIRAD_PARAM

#define FIRST_PIXIRAD_PARAM   PixiradSystemReset

◆ FRAME_HAS_ALIGN_ERRORS

#define FRAME_HAS_ALIGN_ERRORS   0x20

◆ INITIAL_COOLING_STATE

#define INITIAL_COOLING_STATE   CoolingOn

◆ INITIAL_COOLING_VALUE

#define INITIAL_COOLING_VALUE   15

◆ INITIAL_HV_MODE

#define INITIAL_HV_MODE   HVAuto

◆ INITIAL_HV_STATE

#define INITIAL_HV_STATE   HVOn

◆ INITIAL_HV_VALUE

#define INITIAL_HV_VALUE   350

◆ INT_DAC_STEPS

#define INT_DAC_STEPS   32

◆ LAST_PIXIRAD_PARAM

#define LAST_PIXIRAD_PARAM   PixiradPeltierPower

◆ MAX_MESSAGE_SIZE

#define MAX_MESSAGE_SIZE   256

Messages to/from server.

◆ MAX_STATUS_PARAMS

#define MAX_STATUS_PARAMS   7

◆ MAX_UDP_DATA_BUFFER

#define MAX_UDP_DATA_BUFFER   256217728

◆ MAX_UDP_PACKET_LEN

#define MAX_UDP_PACKET_LEN   1448

◆ NUM_PIXIRAD_PARAMS

#define NUM_PIXIRAD_PARAMS   ((int)(&LAST_PIXIRAD_PARAM - &FIRST_PIXIRAD_PARAM + 1))

◆ NUM_THRESHOLDS

#define NUM_THRESHOLDS   5

◆ PACKET_CRC_BYTES

#define PACKET_CRC_BYTES   4

◆ PACKET_EXTRA_BYTES

#define PACKET_EXTRA_BYTES   (PACKET_ID_BYTES + PACKET_TAG_BYTES + PACKET_CRC_BYTES)

◆ PACKET_ID_BYTES

#define PACKET_ID_BYTES   2

◆ PACKET_ID_OFFSET

#define PACKET_ID_OFFSET   2

◆ PACKET_SENSOR_DATA_BYTES

#define PACKET_SENSOR_DATA_BYTES   (MAX_UDP_PACKET_LEN - PACKET_EXTRA_BYTES)

◆ PACKET_SENSOR_DATA_OFFSET

#define PACKET_SENSOR_DATA_OFFSET   (PACKET_TAG_BYTES + PACKET_ID_BYTES)

◆ PACKET_TAG_BYTES

#define PACKET_TAG_BYTES   2

◆ PACKET_TAG_OFFSET

#define PACKET_TAG_OFFSET   0

◆ PIII_P0

#define PIII_P0   494.70

◆ PIII_P1

#define PIII_P1   19.36

◆ PIXIE_THDAC_MASK

#define PIXIE_THDAC_MASK   0x1f

◆ PIXIE_THDAC_OFFSET [1/2]

#define PIXIE_THDAC_OFFSET   0

◆ PIXIE_THDAC_OFFSET [2/2]

#define PIXIE_THDAC_OFFSET   0

◆ PIXIEII_MODULES

#define PIXIEII_MODULES   1

◆ PixiradAutoCalibrateString

#define PixiradAutoCalibrateString   "AUTO_CALIBRATE"

◆ PixiradBoxHumidityString

#define PixiradBoxHumidityString   "BOX_HUMIDITY"

◆ PixiradBoxTemperatureString

#define PixiradBoxTemperatureString   "BOX_TEMPERATURE"

◆ PixiradColorsCollectedString

#define PixiradColorsCollectedString   "COLORS_COLLECTED"

◆ PixiradCoolingStateString

#define PixiradCoolingStateString   "COOLING_STATE"

◆ PixiradCoolingStatusString

#define PixiradCoolingStatusString   "COOLING_STATUS"

◆ PixiradCountModeString

#define PixiradCountModeString   "COUNT_MODE"

◆ PixiradDewPointString

#define PixiradDewPointString   "DEW_POINT"

◆ PixiradHitThreshActualString

#define PixiradHitThreshActualString   "HIT_THRESHOLD_ACTUAL"

◆ PixiradHitThreshString

#define PixiradHitThreshString   "HIT_THRESHOLD"

◆ PixiradHotTemperatureString

#define PixiradHotTemperatureString   "HOT_TEMPERATURE"

◆ PixiradHVActualString

#define PixiradHVActualString   "HV_ACTUAL"

◆ PixiradHVCurrentString

#define PixiradHVCurrentString   "HV_CURRENT"

◆ PixiradHVModeString

#define PixiradHVModeString   "HV_MODE"

◆ PixiradHVStateString

#define PixiradHVStateString   "HV_STATE"

◆ PixiradHVValueString

#define PixiradHVValueString   "HV_VALUE"

◆ PixiradPeltierPowerString

#define PixiradPeltierPowerString   "PELTIER_POWER"

◆ PixiradSyncInPolarityString

#define PixiradSyncInPolarityString   "SYNC_IN_POLARITY"

◆ PixiradSyncOutFunctionString

#define PixiradSyncOutFunctionString   "SYNC_OUT_FUNCTION"

◆ PixiradSyncOutPolarityString

#define PixiradSyncOutPolarityString   "SYNC_OUT_POLARITY"

◆ PixiradSystemInfoString

#define PixiradSystemInfoString   "SYSTEM_INFO"

◆ PixiradSystemResetString

#define PixiradSystemResetString   "SYSTEM_RESET"

◆ PixiradThresh1String

#define PixiradThresh1String   "THRESHOLD1"

◆ PixiradThresh2String

#define PixiradThresh2String   "THRESHOLD2"

◆ PixiradThresh3String

#define PixiradThresh3String   "THRESHOLD3"

◆ PixiradThresh4String

#define PixiradThresh4String   "THRESHOLD4"

◆ PixiradThreshActual1String

#define PixiradThreshActual1String   "THRESHOLD_ACTUAL1"

◆ PixiradThreshActual2String

#define PixiradThreshActual2String   "THRESHOLD_ACTUAL2"

◆ PixiradThreshActual3String

#define PixiradThreshActual3String   "THRESHOLD_ACTUAL3"

◆ PixiradThreshActual4String

#define PixiradThreshActual4String   "THRESHOLD_ACTUAL4"

◆ PixiradUDPBuffersFreeString

#define PixiradUDPBuffersFreeString   "UDP_BUFFERS_FREE"

◆ PixiradUDPBuffersMaxString

#define PixiradUDPBuffersMaxString   "UDP_BUFFERS_MAX"

◆ PixiradUDPBuffersReadString

#define PixiradUDPBuffersReadString   "UDP_BUFFERS_READ"

◆ PixiradUDPSpeedString

#define PixiradUDPSpeedString   "UDP_SPEED"

◆ SERVER_DEFAULT_TIMEOUT

#define SERVER_DEFAULT_TIMEOUT   1.0

◆ TCOLD_ERROR

#define TCOLD_ERROR   40

◆ TCOLD_WARNING

#define TCOLD_WARNING   30

◆ THOT_ERROR

#define THOT_ERROR   50

◆ THOT_WARNING

#define THOT_WARNING   40

◆ THRESH_A_COEFF

#define THRESH_A_COEFF   36.6

◆ THRESH_B_COEFF

#define THRESH_B_COEFF   39.3

◆ VAGND

#define VAGND   0.6

◆ VTH1_ACCURACY

#define VTH1_ACCURACY   0.001

◆ VTHMAX_DECR_STEP

#define VTHMAX_DECR_STEP   1

◆ VTHMAX_LOWER_LIMIT

#define VTHMAX_LOWER_LIMIT   1000

◆ VTHMAX_MAX_ITERATIONS

#define VTHMAX_MAX_ITERATIONS   2000

◆ VTHMAX_UPPER_LIMIT

#define VTHMAX_UPPER_LIMIT   2200

Enumeration Type Documentation

◆ PixiradCoolingState_t

Cooling state.

Enumerator
CoolingOff 
CoolingOn 

◆ PixiradCoolingStatus_t

Temperature status.

Enumerator
TSOK 
TSDewPointWarning 
TSDewPointError 
TSTHotWarning 
TSTHotError 
TSTColdWarning 
TSTColdError 

◆ PixiradCountModeType_t

Enumerator
RM_Normal 
RM_NPI 
RM_NPI_SUM 

◆ PixiradFrameType_t

Frame type.

Enumerator
FTOneColorLow 
FTOneColorHigh 
FTTwoColors 
FTFourColors 
FTOneColorDTF 
FTTwoColorsDTF 

◆ PixiradHVMode_t

High voltage mode.

Enumerator
HVManual 
HVAuto 

◆ PixiradHVState_t

High voltage state.

Enumerator
HVOff 
HVOn 

◆ PixiradSyncOutFunction_t

Sync out function.

Enumerator
SyncOutShutter 
SyncOutReadoutDone 
SyncOutRead 

◆ PixiradSyncPolarity_t

Sync in/out polarity.

Enumerator
SyncPos 
SyncNeg 

◆ PixiradTriggerMode_t

Trigger modes.

Enumerator
TMInternal 
TMExternal 
TMBulb 

Function Documentation

◆ epicsExportRegistrar()

epicsExportRegistrar ( pixiradRegister  )

◆ pixiradAutoCal()

int pixiradAutoCal ( const char *  portName,
int  ofs0,
int  fs0,
int  ofs2,
int  fs1,
int  fs2,
int  ibias,
int  vbgMcalDAC 
)

◆ pixiradConfig()

int pixiradConfig ( const char *  portName,
const char *  commandPort,
int  dataPortNumber,
int  statusPortNumber,
int  maxDataPortBuffers,
int  maxSizeX,
int  maxSizeY,
int  maxBuffers,
size_t  maxMemory,
int  priority,
int  stackSize 
)