camac - Generic CAMAC Record

Mark Rivers

Contents

Overview

The CAMAC record is designed to perform generic CAMAC I/O. The CAMAC Branch (B), Crate (C), Slot (N), Subaddress (A), Function code (F) and transfer mode are all controlled by record fields which can be modified at run time. Applications for this record include accessing CAMAC modules for which no device support exists, and for performing CAMAC diagnostics.

The CAMAC record is intended only for this specialized CAMAC I/O function. The CAMAC record directly calls the ESONE compatible CAMAC library, without an intermediate device support layer.

The CAMAC record supports array operations, i.e. CAMAC block transfer operations. The VAL field contains the data to be written or the data read. Depending upon the CAMAC hardware being used this may use DMA from the CAMAC controller to the VME bus memory.

This record requires the use of an underlying ESONE compatible CAMAC library. Such libraries are currently available from Eric Bjorkland at Los Alamos for serial highway drivers, and for the Kinetic Systems 2917/3922 parallel bus crate controller.

If a CAMAC operation returns Q=0 it will be reflected in the Q field of the record, but will not raise an alarm. X=0 will raise a minor alarm. Any other errors detected in the CAMAC library will raise a major alarm.

Record Field Descriptions

Name Access PromptData type Description
VAL R/W* "Current value" DBF_LONG (array) The data to be written to CAMAC or the data read from CAMAC. This is always an array of LONGS. The maximum array length is determined by NMAX at IOC initialization. The actual array length is equal to NACT.
Q R "Q response" DBF_LONG The CAMAC Q response of the previous operation. This field is only guaranteed to be valid if TMOD=SNGL.
X R "X response" DBF_LONG The CAMAC X response of the previous operation. This field is only guaranteed to be valid if TMOD=SNGL.
INHB R "Inhibit status" DBF_LONG The status of the crate Inhibit signal (0=clear, 1=set).
B R/W "Branch" DBF_LONG The CAMAC Branch to use for the operation. Branch numbers start at 0.
C R/W "Crate" DBF_LONG The CAMAC Crate to use for the operation. Crate numbers start at 0 or 1 depending upon the hardware type.
N R/W "Station" DBF_LONG The CAMAC station (or slot) to use for the operation. Valid station numbers are typically 1-23 and 30.
A R/W "Subaddress" DBF_LONG The CAMAC subaddress to use for the operation. Valid subadresses are 0-15.
F R/W "Function" DBF_LONG The CAMAC function code to use for the operation. Valid function are codes 0-31. Function codes in the range 0-7 are CAMAC read operations, function codes in the range 16-23 are CAMAC write operations, and function codes in the range 8-15 and 24-31 are CAMAC control operations.
TMOD R/W "Transfer mode" DBF_RECCHOICE The data transfer mode. The choices are:
"Single" Single-cycle CAMAC transfer. NUSE is ignorred.
"Q Stop" Q-stop block mode transfer. The record attempts to perform NUSE CAMAC cycles, but stops if there is a Q=0 response.
"Q Repeat" Q-repeat block mode transfer. The record attempts to perform NUSE CAMAC cycles. It repeats any operations which have Q=0 response (up to some hardware-dependent timeout).
"Q Scan" Q-scan block mode transfer. The record attempts to perform NUSE CAMAC cycles, automatically incrementing the subaddress and station number. The operation will terminate if the last slot is reached before NUSE successful cycles have completed.
NMAX R "Max. number of values" DBF_LONG The maximum length of the VAL array. It cannot be modified after the IOC is initialized.
NUSE R/W "Number of values to R/W" DBF_LONG The number of values to attempt to transfer when the record processes. This number is ignorred if TMOD is SNGL. It must be less than or equal to NMAX.
NACT R "Actual number of values R/W" DBF_LONG The actual number of values which were transferred in the last CAMAC operation. This number may be less than NUSE if a Q Stop, Q Repeat or Q Scan operation terminated prematurely due to a Q=0 or timeout.
CCMD R/W* "Crate Command" DBF_RECCHOICE A crate controller command. The choices are:
"None" This is the default. No crate controller command is executed.
"Clear Inhibit" Clears the crate Inhibit signal.
"Set Inhibit" Sets the crate Inhibit signal.
"Clear (C)" Executes a crate Clear (C) cycle
"Initialize (Z)" Executes a crate Initialize (Z) cycle
Note: If the CCMD field is set to any value except "None" then the following occurs: the record processes, the appropriate crate controller command is executed, and CCMD is set back to "None". The record processing only performs the crate controller command, i.e. it does not also perform the CAMAC operation indicated by B, C, N, A, F.
Private Fields
BPTR N "Buffer Pointer" DBF_NOACCESS The pointer to the buffer for the VAL field.
Note: In the Access column above:
R Read only
R/W Read and write are allowed
R/W* Read and write are allowed; write triggers record processing if the record's SCAN field is set to "Passive".
N No access allowed


Files

The following table briefly describes all of the files required to implement the CAMAC record. The reader is assumed to be familiar with the EPICS Application Source/Release Control document which describes how to build an EPICS application tree into which these files are to be placed, and how to run "makesdr" and "gnumake" to build the record support. These files can all be obtained in a compressed tar file. This file should be untarred in a <top>/<app>App/ directory.

Files to be placed in <top>/<app>App/src/
recCamac.c The source file for the record
Makefile.Vx This file is not included in the distribution. However, the user must edit this file and add lines similar to the following:
CAMAC_SRCS      = ../recCamac.c

SRCS.c = $(CAMAC_SRCS) $(other sources here)
CAMAC_OBJS       = recCamac.o
LIBNAME = mylib.o
LIBOBJS = $(CAMAC_OBJS) $(other objects here)

USR_CFLAGS = -I$(EPICS)/replace_ascii -I$(EPICS)/cat_ascii \
             -I$(EPICS)/sdrH/rec -I$(EPICS)/include/rec \
             -I$(EPICS_EXTENSIONS_INCLUDE)
Files to be placed in <top>/cat_ascii/
camacRecord.ascii This file defines all of the fields for the CAMAC record.
choiceRecCAMAC.ascii This file defines all of the choice values for the CAMAC record.
choiceCAMAC.h This file is included by choiceRecCAMAC.ascii and by recCamac.c.
choiceRec.ascii This file is not included in the distribution. However, the user must edit this file and add the line:
#include <choiceRecCAMAC.ascii>
dbRecType.ascii This file is not included in the distribution. However, the user must edit this file and add the line:
"camac"
Files to be placed in <top>/<app>App/op/adl/
CAMAC_IO.adl This file builds an medm screen to access the CAMAC record. To use it from the command line, type the following:
cars1> medm -x -macro REC=my_camac_record CAMAC_IO.adl

where my_camac_record is the name of a CAMAC record in an IOC.

This file can also be used as a related display from other medm screens by passing the argument REC=my_camac_record.


Suggestions and comments to: Mark Rivers : (rivers@cars.uchicago.edu)
Last modified: March 28, 1996