#include <cfht/cfht.h>#include <cfht/cfp.h>struct cfp_io *cfp_io(name, data, type)char *name;struct cfp_io *data;int type; libcfht.a
Name is a symbolic name used to look up information about a device. The information will be stored in a structure pointed to by data, with a pointer to the structure being returned. Data is allowed to be NULL, in which case cfp_io() uses internal storage space. Type is used to specify that only one kind of device is allowed. If type is set to -1, then any kind is allowed. Possible types are CFP_CAMAC, CFP_HPIB, and CFP_RS232. Most programs will probably specify a particular type. Making a program generic enough to handle multiple types would be quite difficult since the I/O libraries used are so different.
The structure is defined as follows:
struct cfp_io { int type; /* CFP_HPIB, CFP_RS232, or CFP_CAMAC */ char file[80]; /* device node name */ int hpib; /* HP-IB device address, or -1 */ int branch; /* CAMAC branch number, or -1 */ int crate; /* CAMAC crate number, or -1 */ int module; /* CAMAC module number, or -1 */ };
Type will contain the acquired type of device. CFP_RS232 devices should be controlled with standard tty driver calls. CFP_HPIB devices should be controlled with libhh.a calls. CFP_CAMAC devices should be controlled with libcamac.a calls.
File will contain the name of the special file to be used.
If the device is an HP-IB device, or a CAMAC device controlled through HP-IB, then hpib will be set to the HP-IB device address, else hpib will contain -1. (This is how CAMAC control through RS-232 is distinguished from CAMAC control through HP-IB).
If a CAMAC device is to be controlled through a system crate, branch highway system, then branch and crate will contain valid values, else -1 each. If the device is a CAMAC module and not just a crate or non-CAMAC device, then module will contain a valid number, else -1.
Note that the camac and hpib libraries use this function automatically, so that the only time a program should need to call cfp_io() is for acquiring RS-232 device paths.
Note that cfp_getln() is used, and that errno may be set from that internal call.