areaDetector  3-5-0
EPICS areaDetector framework
Classes | Macros | Enumerations | Functions
marCCD.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 <ctype.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include <tiffio.h>
#include <epicsTime.h>
#include <epicsThread.h>
#include <epicsEvent.h>
#include <epicsTimer.h>
#include <epicsMutex.h>
#include <epicsStdlib.h>
#include <epicsString.h>
#include <epicsStdio.h>
#include <cantProceed.h>
#include <iocsh.h>
#include <epicsExport.h>
#include <asynOctetSyncIO.h>
#include "ADDriver.h"

Classes

class  marCCD
 Driver for marCCD (Rayonix) CCD detector; communicates with the marCCD program over a TCP/IP socket with the marccd_server_socket program that they distribute. More...
 

Macros

#define DRIVER_VERSION   "2.3.0"
 
#define MAX_MESSAGE_SIZE   256
 Messages to/from server. More...
 
#define MAX_FILENAME_LEN   256
 
#define MARCCD_SERVER_TIMEOUT   1.0
 
#define FILE_READ_DELAY   .01
 Time between checking to see if TIFF file is complete. More...
 
#define MARCCD_POLL_DELAY   .01
 
#define TASK_ACQUIRE   0
 Task numbers. More...
 
#define TASK_READ   1
 
#define TASK_CORRECT   2
 
#define TASK_WRITE   3
 
#define TASK_DEZINGER   4
 
#define TASK_SERIES   5
 
#define TASK_STATUS_QUEUED   0x1
 The status bits for each task are: More...
 
#define TASK_STATUS_EXECUTING   0x2
 
#define TASK_STATUS_ERROR   0x4
 
#define TASK_STATUS_RESERVED   0x8
 
#define TASK_STATE_IDLE   0
 These are the "old" states from version 0, but BUSY is also used in version 1. More...
 
#define TASK_STATE_ACQUIRE   1
 
#define TASK_STATE_READOUT   2
 
#define TASK_STATE_CORRECT   3
 
#define TASK_STATE_WRITING   4
 
#define TASK_STATE_ABORTING   5
 
#define TASK_STATE_UNAVAILABLE   6
 
#define TASK_STATE_ERROR   7
 
#define TASK_STATE_BUSY   8
 
#define STATE_MASK   0xf
 These are the definitions of masks for looking at task state bits. More...
 
#define STATUS_MASK   0xf
 
#define TASK_STATUS_MASK(task)   (STATUS_MASK << (4*((task)+1)))
 
#define TASK_STATE(current_status)   ((current_status) & STATE_MASK)
 These are some convenient macros for checking and setting the state of each task. More...
 
#define TASK_STATUS(current_status, task)   (((current_status) & TASK_STATUS_MASK(task)) >> (4*((task) + 1)))
 
#define TEST_TASK_STATUS(current_status, task, status)   (TASK_STATUS(current_status, task) & (status))
 
#define marCCDGateModeString   "MAR_GATE_MODE"
 
#define marCCDReadoutModeString   "MAR_READOUT_MODE"
 
#define marCCDServerModeString   "MAR_SERVER_MODE"
 
#define marCCDTiffTimeoutString   "MAR_TIFF_TIMEOUT"
 
#define marCCDSeriesFileTemplateString   "MAR_SERIES_FILE_TEMPLATE"
 
#define marCCDSeriesFileDigitsString   "MAR_SERIES_FILE_DIGITS"
 
#define marCCDSeriesFileFirstString   "MAR_SERIES_FILE_FIRST"
 
#define marCCDOverlapString   "MAR_OVERLAP"
 
#define marCCDStateString   "MAR_STATE"
 
#define marCCDStatusString   "MAR_STATUS"
 
#define marCCDTaskAcquireStatusString   "MAR_ACQUIRE_STATUS"
 
#define marCCDTaskReadoutStatusString   "MAR_READOUT_STATUS"
 
#define marCCDTaskCorrectStatusString   "MAR_CORRECT_STATUS"
 
#define marCCDTaskWritingStatusString   "MAR_WRITING_STATUS"
 
#define marCCDTaskDezingerStatusString   "MAR_DEZINGER_STATUS"
 
#define marCCDTaskSeriesStatusString   "MAR_SERIES_STATUS"
 
#define marCCDStabilityString   "MAR_STABILITY"
 
#define marCCDFrameShiftString   "MAR_FRAME_SHIFT"
 
#define marCCDDetectorDistanceString   "MAR_DETECTOR_DISTANCE"
 
#define marCCDBeamXString   "MAR_BEAM_X"
 
#define marCCDBeamYString   "MAR_BEAM_Y"
 
#define marCCDStartPhiString   "MAR_START_PHI"
 
#define marCCDRotationAxisString   "MAR_ROTATION_AXIS"
 
#define marCCDRotationRangeString   "MAR_ROTATION_RANGE"
 
#define marCCDTwoThetaString   "MAR_TWO_THETA"
 
#define marCCDWavelengthString   "MAR_WAVELENGTH"
 
#define marCCDFileCommentsString   "MAR_FILE_COMMENTS"
 
#define marCCDDatasetCommentsString   "MAR_DATASET_COMMENTS"
 
#define FIRST_MARCCD_PARAM   marCCDGateMode
 
#define LAST_MARCCD_PARAM   marCCDDatasetComments
 
#define NUM_MARCCD_PARAMS   ((int)(&LAST_MARCCD_PARAM - &FIRST_MARCCD_PARAM + 1))
 

Enumerations

enum  marCCDFrameType_t { marCCDFrameNormal, marCCDFrameBackground, marCCDFrameRaw, marCCDFrameDoubleCorrelation }
 
enum  marCCDImageMode_t {
  marCCDImageSingle = ADImageSingle, marCCDImageMultiple = ADImageMultiple, marCCDImageContinuous = ADImageContinuous, marCCDImageSeriesTriggered,
  marCCDImageSeriesTimed
}
 
enum  marCCDTriggerMode_t { marCCDTriggerInternal = ADTriggerInternal, marCCDTriggerFrame = ADTriggerExternal, marCCDTriggerBulb, marCCDTriggerTimed }
 
enum  marCCDGateMode_t { marCCDGateNone, marCCDGateGated }
 
enum  marCCDReadoutMode { marCCDReadoutStandard, marCCDReadoutHighGain, marCCDReadoutLowNoise, marCCDReadoutHDR }
 

Functions

void getImageDataTaskC (marCCD *pmarCCD)
 
int marCCDConfig (const char *portName, const char *serverPort, int maxBuffers, size_t maxMemory, int priority, int stackSize)
 
 epicsExportRegistrar (marCCD_ADRegister)
 

Macro Definition Documentation

◆ DRIVER_VERSION

#define DRIVER_VERSION   "2.3.0"

◆ FILE_READ_DELAY

#define FILE_READ_DELAY   .01

Time between checking to see if TIFF file is complete.

◆ FIRST_MARCCD_PARAM

#define FIRST_MARCCD_PARAM   marCCDGateMode

◆ LAST_MARCCD_PARAM

#define LAST_MARCCD_PARAM   marCCDDatasetComments

◆ MARCCD_POLL_DELAY

#define MARCCD_POLL_DELAY   .01

◆ MARCCD_SERVER_TIMEOUT

#define MARCCD_SERVER_TIMEOUT   1.0

◆ marCCDBeamXString

#define marCCDBeamXString   "MAR_BEAM_X"

◆ marCCDBeamYString

#define marCCDBeamYString   "MAR_BEAM_Y"

◆ marCCDDatasetCommentsString

#define marCCDDatasetCommentsString   "MAR_DATASET_COMMENTS"

◆ marCCDDetectorDistanceString

#define marCCDDetectorDistanceString   "MAR_DETECTOR_DISTANCE"

◆ marCCDFileCommentsString

#define marCCDFileCommentsString   "MAR_FILE_COMMENTS"

◆ marCCDFrameShiftString

#define marCCDFrameShiftString   "MAR_FRAME_SHIFT"

◆ marCCDGateModeString

#define marCCDGateModeString   "MAR_GATE_MODE"

◆ marCCDOverlapString

#define marCCDOverlapString   "MAR_OVERLAP"

◆ marCCDReadoutModeString

#define marCCDReadoutModeString   "MAR_READOUT_MODE"

◆ marCCDRotationAxisString

#define marCCDRotationAxisString   "MAR_ROTATION_AXIS"

◆ marCCDRotationRangeString

#define marCCDRotationRangeString   "MAR_ROTATION_RANGE"

◆ marCCDSeriesFileDigitsString

#define marCCDSeriesFileDigitsString   "MAR_SERIES_FILE_DIGITS"

◆ marCCDSeriesFileFirstString

#define marCCDSeriesFileFirstString   "MAR_SERIES_FILE_FIRST"

◆ marCCDSeriesFileTemplateString

#define marCCDSeriesFileTemplateString   "MAR_SERIES_FILE_TEMPLATE"

◆ marCCDServerModeString

#define marCCDServerModeString   "MAR_SERVER_MODE"

◆ marCCDStabilityString

#define marCCDStabilityString   "MAR_STABILITY"

◆ marCCDStartPhiString

#define marCCDStartPhiString   "MAR_START_PHI"

◆ marCCDStateString

#define marCCDStateString   "MAR_STATE"

◆ marCCDStatusString

#define marCCDStatusString   "MAR_STATUS"

◆ marCCDTaskAcquireStatusString

#define marCCDTaskAcquireStatusString   "MAR_ACQUIRE_STATUS"

◆ marCCDTaskCorrectStatusString

#define marCCDTaskCorrectStatusString   "MAR_CORRECT_STATUS"

◆ marCCDTaskDezingerStatusString

#define marCCDTaskDezingerStatusString   "MAR_DEZINGER_STATUS"

◆ marCCDTaskReadoutStatusString

#define marCCDTaskReadoutStatusString   "MAR_READOUT_STATUS"

◆ marCCDTaskSeriesStatusString

#define marCCDTaskSeriesStatusString   "MAR_SERIES_STATUS"

◆ marCCDTaskWritingStatusString

#define marCCDTaskWritingStatusString   "MAR_WRITING_STATUS"

◆ marCCDTiffTimeoutString

#define marCCDTiffTimeoutString   "MAR_TIFF_TIMEOUT"

◆ marCCDTwoThetaString

#define marCCDTwoThetaString   "MAR_TWO_THETA"

◆ marCCDWavelengthString

#define marCCDWavelengthString   "MAR_WAVELENGTH"

◆ MAX_FILENAME_LEN

#define MAX_FILENAME_LEN   256

◆ MAX_MESSAGE_SIZE

#define MAX_MESSAGE_SIZE   256

Messages to/from server.

◆ NUM_MARCCD_PARAMS

#define NUM_MARCCD_PARAMS   ((int)(&LAST_MARCCD_PARAM - &FIRST_MARCCD_PARAM + 1))

◆ STATE_MASK

#define STATE_MASK   0xf

These are the definitions of masks for looking at task state bits.

◆ STATUS_MASK

#define STATUS_MASK   0xf

◆ TASK_ACQUIRE

#define TASK_ACQUIRE   0

Task numbers.

◆ TASK_CORRECT

#define TASK_CORRECT   2

◆ TASK_DEZINGER

#define TASK_DEZINGER   4

◆ TASK_READ

#define TASK_READ   1

◆ TASK_SERIES

#define TASK_SERIES   5

◆ TASK_STATE

#define TASK_STATE (   current_status)    ((current_status) & STATE_MASK)

These are some convenient macros for checking and setting the state of each task.

They are used in the marccd code and can be used in the client code

◆ TASK_STATE_ABORTING

#define TASK_STATE_ABORTING   5

◆ TASK_STATE_ACQUIRE

#define TASK_STATE_ACQUIRE   1

◆ TASK_STATE_BUSY

#define TASK_STATE_BUSY   8

◆ TASK_STATE_CORRECT

#define TASK_STATE_CORRECT   3

◆ TASK_STATE_ERROR

#define TASK_STATE_ERROR   7

◆ TASK_STATE_IDLE

#define TASK_STATE_IDLE   0

These are the "old" states from version 0, but BUSY is also used in version 1.

◆ TASK_STATE_READOUT

#define TASK_STATE_READOUT   2

◆ TASK_STATE_UNAVAILABLE

#define TASK_STATE_UNAVAILABLE   6

◆ TASK_STATE_WRITING

#define TASK_STATE_WRITING   4

◆ TASK_STATUS

#define TASK_STATUS (   current_status,
  task 
)    (((current_status) & TASK_STATUS_MASK(task)) >> (4*((task) + 1)))

◆ TASK_STATUS_ERROR

#define TASK_STATUS_ERROR   0x4

◆ TASK_STATUS_EXECUTING

#define TASK_STATUS_EXECUTING   0x2

◆ TASK_STATUS_MASK

#define TASK_STATUS_MASK (   task)    (STATUS_MASK << (4*((task)+1)))

◆ TASK_STATUS_QUEUED

#define TASK_STATUS_QUEUED   0x1

The status bits for each task are:

Task Status bits

◆ TASK_STATUS_RESERVED

#define TASK_STATUS_RESERVED   0x8

◆ TASK_WRITE

#define TASK_WRITE   3

◆ TEST_TASK_STATUS

#define TEST_TASK_STATUS (   current_status,
  task,
  status 
)    (TASK_STATUS(current_status, task) & (status))

Enumeration Type Documentation

◆ marCCDFrameType_t

Enumerator
marCCDFrameNormal 
marCCDFrameBackground 
marCCDFrameRaw 
marCCDFrameDoubleCorrelation 

◆ marCCDGateMode_t

Enumerator
marCCDGateNone 
marCCDGateGated 

◆ marCCDImageMode_t

Enumerator
marCCDImageSingle 
marCCDImageMultiple 
marCCDImageContinuous 
marCCDImageSeriesTriggered 
marCCDImageSeriesTimed 

◆ marCCDReadoutMode

Enumerator
marCCDReadoutStandard 
marCCDReadoutHighGain 
marCCDReadoutLowNoise 
marCCDReadoutHDR 

◆ marCCDTriggerMode_t

Enumerator
marCCDTriggerInternal 
marCCDTriggerFrame 
marCCDTriggerBulb 
marCCDTriggerTimed 

Function Documentation

◆ epicsExportRegistrar()

epicsExportRegistrar ( marCCD_ADRegister  )

◆ getImageDataTaskC()

void getImageDataTaskC ( marCCD pmarCCD)

◆ marCCDConfig()

int marCCDConfig ( const char *  portName,
const char *  serverPort,
int  maxBuffers,
size_t  maxMemory,
int  priority,
int  stackSize 
)