spec

Software for Diffraction

PC-DIG

Coreco Imaging (ITI) PC-DIG Frame Grabber

INTRODUCTION

spec supports the PC-DIG frame grabber on Linux platforms by way of the itifg driver available for download at the ftp.gom.com site. Currently, release 7.2 of the driver is supported by spec. Before attempting to use spec with the PC-DIG frame grabber, make sure the driver installation is correct by ensuring the test_itifg program included with the driver package can obtain images.

spec currently does not load the camera-specific FPGA firmware into the frame-grabber cards, nor does spec initialize all the driver parameters for a particular camera. Thus, you should ensure that the config_pcdig program is run to load the FPGA files and the test_itifg program is run to initialize the driver parameters after rebooting the computer (or inserting the itifg.o module into the kernel) and before running spec.

The frame grabber is selected in the spec edconf configuration editor on the Acquisition devices screen as follows:

Image         DEVICE                                <>TYPE
 0  YES  /dev/ic0idI  ITI PC-DIG Frame Grabber (read mode)
 1  YES  /dev/ic0idI  ITI PC-DIG Frame Grabber (mmap mode)

Up to four PC-DIG frame grabbers can be configured at a time. Two acquisition modes (read and memory-mapped) are supported, although read mode seems to be the most useful.

In read mode, spec supplies a memory buffer that is filled by the driver. The buffer can contain room for multiple frames. After acquisition is started, the frame grabber will run until all the frames are filled. If a data array of the appropriate size is assigned to the acquisition device with the "livebuffer" option to image_par(), the associated memory will be used by the driver. Otherwise, spec allocates temporary memory from the system with a malloc() call.

In memory-mapped mode, the driver allocates kernel memory in a ring buffer and continually fills the memory with images.

FUNCTIONS

The image_get() functions copies the images associated with the current frame (see below) from the memory buffer used by the frame grabber to the array provided as argument. In live-buffer mode (see below), the frames are written directly to the provided data array, so it is not necessary to use image_get() to copy the images.

The image_par() function controls the detector interface behavior as follows. The sel parameter is the image-device number from the config file.

image_get(sel, arr)
Copies data from the current frame into the array arr. Use the "frame" option of image_par() below to set the current frame, if the number of frames is greater than one. Note, the frame grabber must be started with the "run" command before an image is available.
image_par(sel, "run")
Starts acquisition.
image_par(sel, "halt")
Stops acquisition.
image_par(sel, "poll")
Returns the number of frames acquired during the current (or most recent) acquisition.
image_par(sel, "livebuffer" [, arg])
When arg is the name a suitably sized data array, that array will be used for the read-mode buffer. If arg is absent, returns the name of the current live-buffer array, or "?" if none is set.
image_par(sel, "stats")
Displays acquisition statistics obtained from the driver.
image_par(sel, "frame" [, arg])
Sets the frame number used for the next image_get() call and for retrieving the time stamp (see below).
image_par(sel, "frames" [, arg])
Sets the number of frames in the kernel buffer to use for acquisition. The frame grabber will allocate the needed kernel memory and fill it during acquisition.
image_par(sel, "frame_count")
During acquisition, returns the current frame number using the lseek() system call to the driver.
image_par(sel, "timestamp")
Returns the time stamp associated with the current frame.
image_par(sel, "hoff" [, arg])
Sets or gets the camera horizontal offset parameter.
image_par(sel, "voff" [, arg])
Sets or gets the camera vertical offset parameter.
image_par(sel, "rotime" [, arg])
Sets or gets and returns the read-out time.
image_par(sel, "extime" [, arg])
Sets or gets and returns the exposure time using the HIOC_PCD_SET_EXTIME and HIOC_PCD_GET_EXTIME ioctl() system calls, respectively.

USAGE

The following commands should be sufficient to perform a quick test of the frame grabber.

SPEC.1> rows = image_par(0, "rows")

SPEC.2> cols = image_par(0, "cols")

SPEC.3> ushort array image[rows][cols]

SPEC.4> image_par(0, "run")

SPEC.5> image_get(0, image)

SPEC.6> fmt_write("some_file", "pgm", image)

SPEC.7> u xv some_file

The fmt_write() function here writes the data in pgm format to a file. The last command spawns the xv image viewing program (available at www.trilon.com if not already installed).