areaDetector
3-13
EPICS areaDetector framework
|
This is areaDetector plug-in support for firewire cameras that comply with the IIDC DCAM protocol. More...
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <epicsString.h>
#include <epicsTime.h>
#include <epicsThread.h>
#include <epicsEvent.h>
#include <epicsMutex.h>
#include <epicsEndian.h>
#include <ADDriver.h>
#include <dc1394/dc1394.h>
Classes | |
class | FirewireDCAM |
Main driver class inherited from areaDetectors ADDriver class. More... | |
struct | camList_t |
class | BusManager |
A singleton class that keep a list of the (configured) cameras on the bus. More... | |
struct | camNode_t |
struct | pix_lookup |
Macros | |
#define | REG_CAMERA_TRIGGER_MODE 0x830U |
#define | ERR(errCode) if (errCode != 0) fprintf(stderr, "ERROR [%s:%d]: dc1394 code: %d\n", __FILE__, __LINE__, errCode) |
Print an errorcode to stderr. More... | |
#define | PERR(pasynUser, errCode) this->err(pasynUser, errCode, __LINE__) |
Convenience macro to be used inside the firewireDCAM class. More... | |
#define | FDC_DC1394_NUM_BUFFERS 15 |
Number of image buffers the dc1394 library will use internally. More... | |
#define | FIRST_FDC_PARAM FDC_feat_val |
Feature value (int32 read/write) addr: 0-17. More... | |
#define | LAST_FDC_PARAM FDC_bandwidth |
Read back the current bandwidth (int32, read) More... | |
#define | FDC_feat_valString "FDC_FEAT_VAL" |
Specific asyn commands for this support module. More... | |
#define | FDC_feat_val_maxString "FDC_FEAT_VAL_MAX" |
#define | FDC_feat_val_minString "FDC_FEAT_VAL_MIN" |
#define | FDC_feat_val_absString "FDC_FEAT_VAL_ABS" |
#define | FDC_feat_val_abs_maxString "FDC_FEAT_VAL_ABS_MAX" |
#define | FDC_feat_val_abs_minString "FDC_FEAT_VAL_ABS_MIN" |
#define | FDC_feat_modeString "FDC_FEAT_MODE" |
#define | FDC_feat_availableString "FDC_FEAT_AVAILABLE" |
#define | FDC_feat_absoluteString "FDC_FEAT_ABSOLUTE" |
#define | FDC_framerateString "FDC_FRAMERATE" |
#define | FDC_videomodeString "FDC_VIDEOMODE" |
#define | FDC_bandwidthString "FDC_BANDWIDTH" |
#define | NUM_FDC_PARAMS (&LAST_FDC_PARAM - &FIRST_FDC_PARAM + 1) |
Number of asyn parameters (asyn commands) this driver supports. More... | |
#define | FDC_DC1394_FEATOFFSET DC1394_FEATURE_MIN |
Feature mapping from DC1394 library enums to a local driver enum The local driver identifies a feature based on the address of the asyn request. More... | |
Typedefs | |
typedef struct camList_t | camList_t |
typedef struct camNode_t | camNode_t |
Functions | |
void | reset_bus () |
int | FDC_InitBus (void) |
Initialise the firewire bus. More... | |
int | FDC_Config (const char *portName, const char *camid, int speed, int maxBuffers, size_t maxMemory, int disableScalable) |
Configuration function to configure one camera. More... | |
void | FDC_ResetBus () |
This is areaDetector plug-in support for firewire cameras that comply with the IIDC DCAM protocol.
This implements the FirewireDCAM class which inherits from the areaDetector ADDriver class.
The driver uses the Linux libraries dc1394 and raw1394.
Author: Ulrik Kofoed Pedersen Diamond Light Source Ltd, UK. Created: November 2008
#define ERR | ( | errCode | ) | if (errCode != 0) fprintf(stderr, "ERROR [%s:%d]: dc1394 code: %d\n", __FILE__, __LINE__, errCode) |
Print an errorcode to stderr.
Convenience macro to be used when an asynUser is not yet available.
#define FDC_bandwidthString "FDC_BANDWIDTH" |
#define FDC_DC1394_FEATOFFSET DC1394_FEATURE_MIN |
Feature mapping from DC1394 library enums to a local driver enum The local driver identifies a feature based on the address of the asyn request.
The address range is [0..DC1394_FEATURE_NUM-1] and the dc1394 feature enum starts at an offset of DC1394_FEATURE_MIN...
#define FDC_DC1394_NUM_BUFFERS 15 |
Number of image buffers the dc1394 library will use internally.
#define FDC_feat_absoluteString "FDC_FEAT_ABSOLUTE" |
#define FDC_feat_availableString "FDC_FEAT_AVAILABLE" |
#define FDC_feat_modeString "FDC_FEAT_MODE" |
#define FDC_feat_val_abs_maxString "FDC_FEAT_VAL_ABS_MAX" |
#define FDC_feat_val_abs_minString "FDC_FEAT_VAL_ABS_MIN" |
#define FDC_feat_val_absString "FDC_FEAT_VAL_ABS" |
#define FDC_feat_val_maxString "FDC_FEAT_VAL_MAX" |
#define FDC_feat_val_minString "FDC_FEAT_VAL_MIN" |
#define FDC_feat_valString "FDC_FEAT_VAL" |
Specific asyn commands for this support module.
These will be used and managed by the parameter library (part of areaDetector).
#define FDC_framerateString "FDC_FRAMERATE" |
#define FDC_videomodeString "FDC_VIDEOMODE" |
#define FIRST_FDC_PARAM FDC_feat_val |
Feature value (int32 read/write) addr: 0-17.
#define LAST_FDC_PARAM FDC_bandwidth |
Read back the current bandwidth (int32, read)
#define NUM_FDC_PARAMS (&LAST_FDC_PARAM - &FIRST_FDC_PARAM + 1) |
Number of asyn parameters (asyn commands) this driver supports.
#define PERR | ( | pasynUser, | |
errCode | |||
) | this->err(pasynUser, errCode, __LINE__) |
Convenience macro to be used inside the firewireDCAM class.
#define REG_CAMERA_TRIGGER_MODE 0x830U |
int FDC_Config | ( | const char * | portName, |
const char * | camid, | ||
int | speed, | ||
int | maxBuffers, | ||
size_t | maxMemory, | ||
int | disableScalable | ||
) |
Configuration function to configure one camera.
This function need to be called once for each camera to be used by the IOC. A call to this function instanciates one object from the FirewireDCAM class.
portName | Asyn port name to assign to the camera. |
camid | The camera ID or serial number in a hexadecimal string. Lower case and upper case letters can be used. This is used to identify a specific camera on the bus. For instance: "0x00b09d01007139d0". |
speed | The bus speed to be used. This indicates whether to use the bus in 1394A or 1394B mode. Valid values are: 400 or 800. If an invalid value is entered the function will always default to 400 (legacy mode). |
maxBuffers | Maxiumum number of NDArray objects (image buffers) this driver is allowed to allocate. This driver requires 2 buffers, and each queue element in a plugin can require one buffer which will all need to be added up in this parameter. |
maxMemory | Maximum memory (in bytes) that this driver is allowed to allocate. So if max. size = 1024x768 (8bpp) and maxBuffers is, say 14. maxMemory = 1024x768x14 = 11010048 bytes (~11MB) |
disableScalable | Disable scalable modes if this is 1 |
int FDC_InitBus | ( | void | ) |
Initialise the firewire bus.
This function need to be called only once to initialise the firewire bus before FDC_Config() can be called. The bus will be first be reset, then scanned for cameras and the number of cameras and their hexadecimal ID will be printed to stdout.
void FDC_ResetBus | ( | ) |
void reset_bus | ( | ) |