Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Andor SDK 2.102.30034.0 #14

Merged
merged 11 commits into from Dec 13, 2017
Merged
31 changes: 30 additions & 1 deletion andorApp/src/shamrock.cpp
Expand Up @@ -20,6 +20,7 @@

#include <asynPortDriver.h>

#include "atmcdLXd.h"
#include <ShamrockCIF.h>

#include <epicsExport.h>
Expand Down Expand Up @@ -125,7 +126,7 @@ extern "C" int shamrockConfig(const char *portName, int shamrockId, const char *
* \param[in] stackSize The size of the stack for the EPICS port thread. 0=use asyn default.
*/
shamrock::shamrock(const char *portName, int shamrockID, const char *iniPath, int priority, int stackSize)
: asynPortDriver(portName, MAX_ADDR, NUM_SR_PARAMS,
: asynPortDriver(portName, MAX_ADDR,
asynInt32Mask | asynFloat64Mask | asynFloat32ArrayMask | asynDrvUserMask,
asynInt32Mask | asynFloat64Mask | asynFloat32ArrayMask,
ASYN_CANBLOCK | ASYN_MULTIDEVICE, 1, priority, stackSize),
Expand All @@ -140,6 +141,8 @@ shamrock::shamrock(const char *portName, int shamrockID, const char *iniPath, in
float pixelWidth;
int i;
int numFlipperStatus;
int width, height;
float xSize, ySize;

createParam(SRWavelengthString, asynParamFloat64, &SRWavelength_);
createParam(SRMinWavelengthString, asynParamFloat64, &SRMinWavelength_);
Expand All @@ -166,6 +169,32 @@ shamrock::shamrock(const char *portName, int shamrockID, const char *iniPath, in
driverName, functionName, numDevices);
return;
}

//Get Detector dimensions
error = GetDetector(&width, &height);
if (error != DRV_SUCCESS) {
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
"%s:%s: GetDetector() status = %d\n",
driverName, functionName, error);
return;
}

//Sets the number of pixels for calibration purposes
error = ShamrockSetNumberPixels(shamrockId_, width);
status = checkError(error, functionName, "ShamrockSetNumberPixels");

//Get Detector pixel size
error = GetPixelSize(&xSize, &ySize);
if (error != DRV_SUCCESS) {
asynPrint(pasynUserSelf, ASYN_TRACE_ERROR,
"%s:%s: GetPixelSize() status = %d\n",
driverName, functionName, error);
return;
}

//Set the pixel width in microns for calibration purposes.
error = ShamrockSetPixelWidth(shamrockId_, xSize);
status = checkError(error, functionName, "ShamrockSetPixelWidth");

// Determine the number of pixels on the attached CCD and the pixel size
error = ShamrockGetNumberPixels(shamrockId_, &numPixels_);
Expand Down
22 changes: 19 additions & 3 deletions andorSupport/ShamrockCIF.h 100755 → 100644
@@ -1,4 +1,6 @@
/* #pragma hdrstop */
#ifndef __linux__
#pragma hdrstop
#endif

#define SHAMROCK_COMMUNICATION_ERROR 20201
#define SHAMROCK_SUCCESS 20202
Expand All @@ -10,8 +12,8 @@
#define SHAMROCK_NOT_INITIALIZED 20275
#define SHAMROCK_NOT_AVAILABLE 20292

#define SHAMROCK_ACCESSORYMIN 1
#define SHAMROCK_ACCESSORYMAX 2
#define SHAMROCK_ACCESSORYMIN 0
#define SHAMROCK_ACCESSORYMAX 1
#define SHAMROCK_FILTERMIN 1
#define SHAMROCK_FILTERMAX 6
#define SHAMROCK_TURRETMIN 1
Expand Down Expand Up @@ -66,6 +68,7 @@ unsigned int WINAPI ShamrockGetNumberDevices(int *nodevices);
unsigned int WINAPI ShamrockGetFunctionReturnDescription(int error,char *description, int MaxDescStrLen);
//sdkeeprom functions
unsigned int WINAPI ShamrockGetSerialNumber(int device,char *serial);
unsigned int WINAPI ShamrockEepromSetOpticalParams(int device, float FocalLength, float AngularDeviation, float FocalTilt);
unsigned int WINAPI ShamrockEepromGetOpticalParams(int device,float *FocalLength,float *AngularDeviation,float *FocalTilt);
//sdkgrating functions
unsigned int WINAPI ShamrockSetGrating(int device,int grating);
Expand Down Expand Up @@ -101,6 +104,10 @@ unsigned int WINAPI ShamrockAutoSlitIsPresent(int device, int index, int *presen
unsigned int WINAPI ShamrockSetAutoSlitCoefficients(int device, int index, int x1, int y1, int x2, int y2);
unsigned int WINAPI ShamrockGetAutoSlitCoefficients(int device, int index, int &x1, int &y1, int &x2, int &y2);

// new new Slit functions.
unsigned int WINAPI ShamrockSetSlitZeroPosition(int device, int index, int offset);
unsigned int WINAPI ShamrockGetSlitZeroPosition(int device, int index, int *offset);

///// Deprecated Slit Functions
// Deprecated Input Slit Functions
unsigned int WINAPI ShamrockSetSlit(int device,float width);
Expand Down Expand Up @@ -138,6 +145,9 @@ unsigned int WINAPI ShamrockGetFlipperMirror(int device, int flipper, int * port
unsigned int WINAPI ShamrockFlipperMirrorReset(int device, int flipper);
unsigned int WINAPI ShamrockFlipperMirrorIsPresent(int device, int flipper, int *present);
unsigned int WINAPI ShamrockGetCCDLimits(int device, int port, float *Low, float *High);
unsigned int WINAPI ShamrockSetFlipperMirrorPosition(int device, int flipper, int position);
unsigned int WINAPI ShamrockGetFlipperMirrorPosition(int device, int flipper, int *position);
unsigned int WINAPI ShamrockGetFlipperMirrorMaxPosition(int device, int flipper, int *max);

// Deprecated
unsigned int WINAPI ShamrockSetPort(int device,int port);
Expand All @@ -164,6 +174,12 @@ unsigned int WINAPI ShamrockGetPixelWidth(int device, float* Width);
unsigned int WINAPI ShamrockGetNumberPixels(int device, int* NumberPixels);
unsigned int WINAPI ShamrockGetCalibration(int device, float* CalibrationValues, int NumberPixels);
unsigned int WINAPI ShamrockGetPixelCalibrationCoefficients(int device, float* A, float* B, float* C, float* D);

//SDK iris functions
unsigned int WINAPI ShamrockIrisIsPresent(int device, int iris, int *present);
unsigned int WINAPI ShamrockSetIris(int device, int iris, int value);
unsigned int WINAPI ShamrockGetIris(int device, int iris, int *value);

#ifdef __cplusplus
}
#endif
27 changes: 23 additions & 4 deletions andorSupport/atmcdLXd.h
Expand Up @@ -115,6 +115,7 @@ typedef struct ANDORCAPS
at_u32 ulPCICard;
at_u32 ulEMGainCapability;
at_u32 ulFTReadModes;
at_u32 ulFeatures2;
} AndorCapabilities;


Expand Down Expand Up @@ -165,6 +166,7 @@ unsigned int GetAvailableCameras(at_32 * totalCameras);
unsigned int GetBackground(at_32 * arr, at_u32 size);
unsigned int GetBaselineClamp(int * state);
unsigned int GetBitDepth(int channel, int * depth);
unsigned int GetBitsPerPixel(int readout_index, int index, int * value);
unsigned int GetCameraEventStatus(at_u32 * camStatus);
unsigned int GetCameraHandle(at_32 cameraIndex, at_32 * cameraHandle);
unsigned int GetCameraInformation(int index, at_32 * information);
Expand Down Expand Up @@ -209,6 +211,7 @@ unsigned int GetDICameraInfo(void * info);
unsigned int GetEMAdvanced(int * state);
unsigned int GetEMCCDGain(int * gain);
unsigned int GetEMGainRange(int * low, int * high);
unsigned int GetESDEventStatus(at_u32 * camStatus);
unsigned int GetExternalTriggerTermination(at_u32 * puiTermination);
unsigned int GetFastestRecommendedVSSpeed(int * index, float * speed);
unsigned int GetFIFOUsage(int * FIFOusage);
Expand Down Expand Up @@ -275,6 +278,7 @@ unsigned int GetPhysicalDMAAddress(at_u32 * Address1, at_u32 * Address2);
unsigned int GetPixelSize(float * xSize, float * ySize);
unsigned int GetPreAmpGain(int index, float * gain);
unsigned int GetPreAmpGainText(int index, char * name, int length);
unsigned int GetCurrentPreAmpGain(int * index, char * name, int length);
unsigned int GetDualExposureTimes(float * exposure1, float * exposure2);
unsigned int GetQE(char * sensor, float wavelength, unsigned int mode, float * QE);
unsigned int GetReadOutTime(float * ReadOutTime);
Expand Down Expand Up @@ -329,6 +333,7 @@ unsigned int Merge(const at_32 * arr, at_32 nOrder, at_32 nPoint, at_32 nPixel,
unsigned int OutAuxPort(int port, int state);
unsigned int PrepareAcquisition();
unsigned int SaveAsBmp(const char * path, const char * palette, at_32 ymin, at_32 ymax);
unsigned int SaveAsCalibratedSif(char * path, int x_data_type, int x_unit, float * x_cal, float rayleighWavelength);
unsigned int SaveAsCommentedSif(char * path, char * comment);
unsigned int SaveAsEDF(char * szPath, int iMode);
unsigned int SaveAsFITS(char * szFileTitle, int typ);
Expand All @@ -346,12 +351,14 @@ unsigned int SetAccumulationCycleTime(float time);
unsigned int SetAcquisitionMode(int mode);
unsigned int SetSensorPortMode(int mode);
unsigned int SelectSensorPort(int port);
unsigned int SelectDualSensorPort(int port);
unsigned int SetAcquisitionType(int typ);
unsigned int SetADChannel(int channel);
unsigned int SetAdvancedTriggerModeState(int iState);
unsigned int SetBackground(at_32 * arr, at_u32 size);
unsigned int SetBaselineClamp(int state);
unsigned int SetBaselineOffset(int offset);
unsigned int SetBitsPerPixel(int state);
unsigned int SetCameraLinkMode(int mode);
unsigned int SetCameraStatusEnable(unsigned long Enable);
unsigned int SetChargeShifting(unsigned int NumberRows, unsigned int NumberRepeats);
Expand Down Expand Up @@ -400,6 +407,7 @@ unsigned int SetDDGVariableGateStep(int mode, double p1, double p2);
unsigned int SetDelayGenerator(int board, short address, int typ);
unsigned int SetDMAParameters(int MaxImagesPerDMA, float SecondsPerDMA);
// unsigned int SetDriverEvent(HANDLE driverEvent);
// unsigned int SetESDEvent(HANDLE esdEvent);
unsigned int SetEMAdvanced(int state);
unsigned int SetEMCCDGain(int gain);
unsigned int SetEMClockCompensation(int EMClockCompensationFlag);
Expand All @@ -410,8 +418,8 @@ unsigned int SetFanMode(int mode);
unsigned int SetFastExtTrigger(int mode);
unsigned int SetFastKinetics(int exposedRows, int seriesLength, float time, int mode, int hbin, int vbin);
unsigned int SetFastKineticsEx(int exposedRows, int seriesLength, float time, int mode, int hbin, int vbin, int offset);
unsigned int SetSuperKinetics(int exposedRows, int seriesLength, float time, int mode, int hbin, int vbin, int offset);
unsigned int SetTimeScan(int rows, int tracks, int mode);
unsigned int SetFastKineticsStorageMode(int mode);
unsigned int SetFastKineticsTimeScanMode(int rows, int tracks, int mode);
unsigned int SetFilterMode(int mode);
unsigned int SetFilterParameters(int width, float sensitivity, int range, float accept, int smooth, int noise);
unsigned int SetFKVShiftSpeed(int index);
Expand All @@ -431,6 +439,7 @@ unsigned int SetImageFlip(int iHFlip, int iVFlip);
unsigned int SetImageRotate(int iRotate);
unsigned int SetIsolatedCropMode(int active, int cropheight, int cropwidth, int vbin, int hbin);
unsigned int SetIsolatedCropModeEx(int active, int cropheight, int cropwidth, int vbin, int hbin, int cropleft, int cropbottom);
unsigned int SetIsolatedCropModeType(int type);
unsigned int SetKineticCycleTime(float time);
unsigned int SetMCPGain(int gain);
unsigned int SetMCPGating(int gating);
Expand Down Expand Up @@ -498,6 +507,7 @@ unsigned int WaitForAcquisitionTimeOut(int iTimeOutMs);
unsigned int WhiteBalance(unsigned short * wRed, unsigned short * wGreen, unsigned short * wBlue, float * fRelR, float * fRelB, WhiteBalanceInfo * info);

unsigned int OA_Initialize(const char * const pcFilename, unsigned int uiFileNameLen);
unsigned int OA_IsPreSetModeAvailable(const char * const pcModeName);
unsigned int OA_EnableMode(const char * const pcModeName);
unsigned int OA_GetModeAcqParams(const char * const pcModeName, char * const pcListOfParams);
unsigned int OA_GetUserModeNames(char * pcListOfModes);
Expand Down Expand Up @@ -626,6 +636,7 @@ unsigned int PostProcessDataAveraging(at_32 * pInputImage, at_32 * pOutputImage,
#define DRV_BINNING_ERROR 20099
#define DRV_INVALID_AMPLIFIER 20100
#define DRV_INVALID_COUNTCONVERT_MODE 20101
#define DRV_USB_INTERRUPT_ENDPOINT_TIMEOUT 20102

#define DRV_ERROR_NOCAMERA 20990
#define DRV_NOT_SUPPORTED 20991
Expand Down Expand Up @@ -672,6 +683,7 @@ unsigned int PostProcessDataAveraging(at_32 * pInputImage, at_32 * pOutputImage,
#define DRV_OA_MODE_DOES_NOT_EXIST 20193
#define DRV_OA_CAMERA_NOT_SUPPORTED 20194
#define DRV_OA_FAILED_TO_GET_MODE 20195
#define DRV_OA_CAMERA_NOT_AVAILABLE 20196

#define DRV_PROCESSING_FAILED 20211

Expand All @@ -682,8 +694,7 @@ unsigned int PostProcessDataAveraging(at_32 * pInputImage, at_32 * pOutputImage,
#define AC_ACQMODE_FRAMETRANSFER 16
#define AC_ACQMODE_FASTKINETICS 32
#define AC_ACQMODE_OVERLAP 64
#define AC_ACQMODE_SUPERKINETICS 128
#define AC_ACQMODE_TIMESCAN 256
#define AC_ACQMODE_TDI 0x80

#define AC_READMODE_FULLIMAGE 1
#define AC_READMODE_SUBIMAGE 2
Expand Down Expand Up @@ -735,6 +746,8 @@ unsigned int PostProcessDataAveraging(at_32 * pInputImage, at_32 * pOutputImage,
#define AC_CAMERATYPE_ALTAF 27
#define AC_CAMERATYPE_IKONXL 28
#define AC_CAMERATYPE_RES1 29
#define AC_CAMERATYPE_ISTAR_SCMOS 30
#define AC_CAMERATYPE_IKONLR 31

#define AC_PIXELMODE_8BIT 1
#define AC_PIXELMODE_14BIT 2
Expand Down Expand Up @@ -775,6 +788,9 @@ unsigned int PostProcessDataAveraging(at_32 * pInputImage, at_32 * pOutputImage,
#define AC_SETFUNCTION_PRESCANS 0x4000000
#define AC_SETFUNCTION_GATEWIDTHSTEP 0x8000000
#define AC_SETFUNCTION_EXTENDED_CROP_MODE 0x10000000
#define AC_SETFUNCTION_SUPERKINETICS 0x20000000
#define AC_SETFUNCTION_TIMESCAN 0x40000000
#define AC_SETFUNCTION_CROPMODETYPE 0x80000000

// Deprecated for AC_SETFUNCTION_MCPGAIN
#define AC_SETFUNCTION_GAIN 8
Expand Down Expand Up @@ -841,6 +857,9 @@ unsigned int PostProcessDataAveraging(at_32 * pInputImage, at_32 * pOutputImage,
#define AC_EMGAIN_LINEAR12 4
#define AC_EMGAIN_REAL12 8

#define AC_FEATURES2_ESD_EVENTS 1
#define AC_FEATURES2_DUAL_PORT_CONFIGURATION 2

#ifdef __cplusplus
}
#endif
Expand Down
46 changes: 46 additions & 0 deletions andorSupport/ftdi_table.c
@@ -0,0 +1,46 @@
/*
This is a simple method to enable users to configure their own table of
VID and PIDs.
Just overwrite entries in the table or add/subract as many as you want.
There may be a performance drop when using FT_Open, FT_OpenEx or
FT_ListDevices when using this method. Therefore it is advised to avoid
excessive used of these functions.

Compile with:
$ gcc -fpic -shared -Wl,-soname,libd2xx_table.so -o libd2xx_table.so ftdi_table.c

This is Andor Shamrock 500i:
Bus 001 Device 073: ID 0403:d493 Future Technology Devices International, Ltd

*/


#define SIZE(x) (sizeof(x)/sizeof(x[0]))

static int id_table[][2] = {
{ 0x0403, 0x6010 }, /* 2232C */
{ 0x0403, 0x6001 }, /* AM or BM */
{ 0x0403, 0x6006 }, /* Direct Driver PID */
{ 0x0403, 0xD493 } /* Andor Shamrock 500i */
};

/*
int lib_check_device(int vendor, int product)

Description: Check the VID and PID against our table
Arguments: vendor (device to check VID), product (device to check PID)
Return: 0 if no match, 1 if match
*/
int lib_check_device(int vendor, int product)
{
int i;

for(i = 0; i < SIZE(id_table); i++) {
if ((id_table[i][0] == vendor) && (id_table[i][1] == product)) {
return 1;
}
}
return 0; /* no match */
}


Binary file not shown.
1 change: 1 addition & 0 deletions andorSupport/os/linux-x86/libUSBI2C.so
1 change: 1 addition & 0 deletions andorSupport/os/linux-x86/libUSBI2C.so.2
Binary file not shown.
2 changes: 1 addition & 1 deletion andorSupport/os/linux-x86/libandor.so.2
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion andorSupport/os/linux-x86/libshamrockcif.so.2
Binary file not shown.
1 change: 1 addition & 0 deletions andorSupport/os/linux-x86_64/libUSBI2C.so
1 change: 1 addition & 0 deletions andorSupport/os/linux-x86_64/libUSBI2C.so.2
Binary file not shown.
2 changes: 1 addition & 1 deletion andorSupport/os/linux-x86_64/libandor.so.2
Binary file not shown.
Binary file added andorSupport/os/linux-x86_64/libd2xx_table.so
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion andorSupport/os/linux-x86_64/libshamrockcif.so.2
16 changes: 16 additions & 0 deletions documentation/andorDoc.html
Expand Up @@ -94,6 +94,22 @@ <h2 id="Introduction" style="text-align: left">
<p>
This is a rather strange requirement of the Andor Shamrock SDK, which will hopefully
be fixed by them in a future release.</p>
<p>
NOTE: When using SDK version >= 2.102.30000.0 on Linux one must make sure that
libUSBI2C-[ARCH].so.[VERSION] is installed as part of support into libUSBI2C.so and libUSBI2C.so.2.
</p>
<p>
Also libd2xx_table.so might be needed to get Shamrock communicating. See andorSupport/ftdi_table.c for more.
</p>
<p>
Compile with:
</p>
<p><pre>
$ gcc -fpic -shared -Wl,-soname,libd2xx_table.so -o libd2xx_table.so ftdi_table.c
</pre></p>
<p>
Place the libd2xx_table.so into the folder with the rest of SDK support libraries.
</p>
<h2 id="StandardNotes" style="text-align: left">
Implementation of standard driver parameters</h2>
<p>
Expand Down