VERSION @(#)drvEpvxi.nr 1.9 8/13/93
NAME
epvxiMsgLib.c - the VXI message based device interface
library
SYNOPSIS
epvxiCmd - deliver a command to a message based device
epvxiQuery - fetch a response from a message based device
epvxiCmdQuery - send a command and fetch a response
epvxiRead - read a string of bytes from a device
epvxiWrite - write a string of bytes to a device
epvxiSetTimeout - change the message based transfer timeout
epvxiSetTraceEnable - turn trace mode on or off
int epvxiCmd (la, command)
int epvxiQuery (la, presponse)
int epvxiCmdQuery (la, command, presponse)
int epvxiRead (la, pbuffer, count, pactual_count, option)
int epvxiWrite (la, pbuffer, pcount, pactual_count, option)
int epvxiSetTimeout (la, timeout)
int epvxiSetTraceEnable(la, enable)
DESCRIPTION
This library provides a vendor independent interface to VXI
message based devices. Device drivers which use this library
may optionally open devices accessed by this library using
epvxiOpen() prior to use. Opening a device prevents other
drivers from using it.
RETURNS
less than zero- operation failed
greater than zero- operation successful
#define VXI_SUCCESS 0 /* successful completion */
#define VXI_NO_DEVICE (-1) /* device does not exist */
#define VXI_NOT_SLOT0 (-2) /* not a slot zero device */
#define VXI_UKN_DEVICE (-3) /* device not supported */
#define VXI_BAD_TRIGGER (-4) /* no such trigger */
#define VXI_BAD_TRIG_IO (-5) /* no such trigger io */
#define VXI_DEVICE_OPEN (-6) /* device already open */
#define VXI_NOT_OWNER (-7) /* dev in use by another drv */
#define VXI_NO_MEMORY (-8) /* failed to allocate memory */
#define VXI_NOT_OPEN (-9) /* device not open */
#define VXI_NOT_MSG_DEVICE (-10) /* must be a message based dev*/
#define VXI_MSG_DEVICE_TMO (-11) /* message based dev timed out */
#define VXI_MSG_DEVICE_FAILURE (-12) /* message based dev failed */
#define VXI_BAD_LA (-13) /* logical addr out of range */
#define VXI_MULTIPLE_QUERIES (-14) /* serial protocol error */
#define VXI_UNSUPPORTED_CMD (-15) /* serial protocol error */
#define VXI_DIR_VIOLATION (-16) /* serial protocol error */
#define VXI_DOR_VIOLATION (-17) /* serial protocol error */
#define VXI_RR_VIOLATION (-18) /* serial protocol error */
#define VXI_WR_VIOLATION (-19) /* serial protocol error */
#define VXI_ERR_FETCH_FAIL (-20) /* ukn serial protocol error */
#define VXI_SELF_TEST_FAILED (-21) /* self test failed */
INCLUDES
epvxiLib.h
NAME
epvxiCmd - deliver a command to a message based device
SYNOPSIS
#include <epvxiLib.h>
int epvxiCmd (la, command)
unsigned la; /* logical address */
unsigned long command; /* command */
DESCRIPTION
Delivers a command to a message based device.
RETURNS
See epvxiMsgLib(1) for a description of the return codes
from this library.
SEE ALSO
epvxiMsgLib(1), epvxiLib(1)
NAME
epvxiQuery - fetch a response from a message based device
SYNOPSIS
#include <epvxiLib.h>
int epvxiQuery (la, presponse)
unsigned la; /* logical address */
unsigned long *presponse; /* response pointer */
DESCRIPTION
Fetch a response from a message based device.
RETURNS
See epvxiMsgLib(1) for a description of the returns from
this library.
SEE ALSO
epvxiMsgLib(1), epvxiLib(1)
NAME
epvxiCmdQuery - send a command and fetch a response from a
message based device
SYNOPSIS
#include <epvxiLib.h>
int epvxiCmdQuery (la, command, presponse)
unsigned la; /* logical address */
unsigned long command; /* command */
unsigned long *presponse; /* response pointer */
DESCRIPTION
Send a command and fetch a response from a message based
device.
RETURNS
See epvxiMsgLib(1) for a description of the return codes
from this library.
SEE ALSO
epvxiMsgLib(1), epvxiLib(1)
NAME
epvxiRead - read a string of bytes from a device
SYNOPSIS
#include <epvxiLib.h>
int epvxiRead (
unsigned la, /* logical address */
char *pbuffer, /* pointer to supplied buffer */
unsigned long count, /* number of bytes to read */
unsigned long *pactual_count, /* number of bytes read */
unsigned long option /* read options */
)
DESCRIPTION
Read a string of bytes from a message based device using the
byte transfer protocol. Copy bytes into the supplied buffer
until the end of string terminator is received from the dev-
ice or the end of the buffer is reached as determined by the
supplied count. Returns the number of bytes read in
*pactual_count. The options argument is a mask with each
bit potentially representing a different option. If you need
to specify more than one option then you must bit or
together the option constants which apply. Currently, no
read options are supported. The option argument should be
set to epvxiReadOptNone.
Option Bit Mask Purpose
--------------- -------
epvxiReadOptNon no options
RETURNS
See epvxiMsgLib(1) for a description of the return codes
from this library.
SEE ALSO
epvxiMsgLib(1), epvxiLib(1)
NAME
epvxiWrite - write a string of bytes to a device
SYNOPSIS
#include <epvxiLib.h>
int epvxiWrite (
unsigned la, /* logical address */
char *pbuffer, /* pointer to supplied buffer */
unsigned long count, /* number of bytes to write */
unsigned long *pactual_count, /* number of bytes written */
unsigned long option /* write options */
)
DESCRIPTION
Write a string of bytes to a message based device using the
byte transfer protocol. Copy count bytes from the supplied
buffer to the device. Returns the number of bytes written in
*pactual_count. The options argument is a mask with each
bit potentially representing a different option. If you need
to specify more than one option then you must bit or
together the option constants which apply. Or in the con-
stant epvxiWriteOptPartialMsg if the string sent is part of
a larger message and it is not the last segment of the
larger message.
Option Bit Mask Purpose
--------------- -------
epvxiWriteOptNone no options
epvxiWriteOptPartialMsg message continues after this transfer
RETURNS
See epvxiMsgLib(1) for an description of the return codes
from this library.
SEE ALSO
epvxiMsgLib(1), epvxiLib(1)
NAME
epvxiSetTimeout - change the message based transfer timeout
SYNOPSIS
#include <epvxiLib.h>
int epvxiSetTimeout (la, timeout)
unsigned la; /* logical address */
unsigned long timeout; /* milli-seconds prior to timeout */
DESCRIPTION
Set the delay prior to timeout for each portion of a message
based VXI transfer. The default timeout is 10 seconds.
RETURNS
See epvxiMsgLib(1) for a description of the return codes
from this library.
SEE ALSO
epvxiMsgLib(1), epvxiLib(1)
NAME
epvxiSetTraceEnable - set trace mode on or off
SYNOPSIS
#include <epvxiLib.h>
int epvxiSetTraceEnable(la, enable)
unsigned la; /* logical address */
int enable; /* T=trace on, F=trace off */
DESCRIPTION
Set trace mode on or off. If "enable" is true then trace
mode is enabled. If "enable" is false then trace mode is
turned off. Trace mode is enable for each VXI message based
device independently.
RETURNS
See epvxiMsgLib(1) for a description of the return codes
from this library.
SEE ALSO
epvxiMsgLib(1), epvxiLib(1)
NAME
epvxiLib.c - the VXI driver support library
SYNOPSIS
epvxiLookupLA - find all devices matching a pattern
epvxiUniqueDriverID - return a non zero unique identification for a VXI driver
epvxiOpen - open a VXI device
epvxiClose - close a VXI device
epvxiPConfig - MACRO which returns a pointer to the drivers private structure
epvxiFetchPConfig - similar to epvxiPConfig but with status
epvxiRouteTriggerECL - route an ECL trigger to/from the front panel
epvxiRouteTriggerTTL - route an TTL trigger to/from the front panel
epvxiResman - perform VXI resource management and setup the MXI bus
epvxiDeviceList - list which drivers own which devices
epvxiCrateList - list all slot zero devices
epvxiExtenderList - list all extender devices and there windows
epvxiIOReport - list all VXI hardware in the system
int epvxiLookupLA(pmatch_structure, pcallback, pargument)
int epvxiUniqueDriverID()
int epvxiOpen(la, driverID, structure_size, pioReportFunction)
int epvxiClose(la, driverID)
(<structure declaration> *) epvxiPConfig(la, driverID, <structure declaration>)
int epvxiFetchPConfig(la, driverID, pConfig)
int epvxiRouteTriggerECL (la, trigger, io)
int epvxiRouteTriggerTTL(la, trigger, io)
int epvxiResman()
int epvxiDeviceList()
int epvxiCrateList()
int epvxiExtenderList()
int epvxiIOReport(level)
This is the structure used to specify search patterns for
epvxiLookupLA(). Set a bit in the flags member for each
item that is to be a constraint on the search. All other
items are ignored during the search. The call back routine
will be called for all devices which exactly match all items
specified in the flags field
#define VXI_DSP_make (1<<0)
#define VXI_DSP_model (1<<1)
#define VXI_DSP_class (1<<2)
#define VXI_DSP_slot (1<<3)
#define VXI_DSP_slot_zero_la (1<<4)
#define VXI_DSP_commander_la (1<<5)
#define VXI_DSP_extender_la (1<<6) /* id crates that have one */
typedef struct {
long flags; /* one bit enabling each field */
unsigned short make; /* manufacture identification */
unsigned short model; /* model code for the device */
unsigned short class; /* VXI device class */
unsigned char slot; /* slot where the device resides */
unsigned char slot_zero_la; /* logical address of slot 0 device */
unsigned char commander_la /* logical address of commander */
unsigned char extender_la /* logical address of bus repeater */
}epvxiDeviceSearchPattern;
DESCRIPTION
Low level support needed if you are writing a VXI driver:
* Determine the logical address of all devices in a particular slot
* Determine the logical address of all devices of a particular make or model
* Prevent two drivers from accessing the same card
* Prevent a driver from accessing a nonexistent card
* Return a pointer to the driver's private variables given a logical address
* Device independent front panel trigger routing on the slot zero device
The message based device interface library epvxiMsgLib(1) is
an example of a VXI driver which utilizes this core VXI
driver support.
INCLUDES
epvxiLib.h
RETURNS
less than zero- operation failed
greater than zero- operation successful
#define VXI_SUCCESS 0 /* successful completion */
#define VXI_NO_DEVICE (-1) /* device does not exist */
#define VXI_NOT_SLOT0 (-2) /* not a slot zero device */
#define VXI_UKN_DEVICE (-3) /* device not supported */
#define VXI_BAD_TRIGGER (-4) /* no such trigger */
#define VXI_BAD_TRIG_IO (-5) /* no such trigger io */
#define VXI_DEVICE_OPEN (-6) /* device already open */
#define VXI_NOT_OWNER (-7) /* dev in use by another drv */
#define VXI_NO_MEMORY (-8) /* failed to allocate memory */
#define VXI_NOT_OPEN (-9) /* device not open */
#define VXI_NOT_MSG_DEVICE (-10) /* must be a message based dev */
#define VXI_MSG_DEVICE_TMO (-11) /* message based dev timed out */
#define VXI_MSG_DEVICE_FAILURE (-12) /* message based dev failed */
#define VXI_BAD_LA (-13) /* logical addr out of range */
#define VXI_MULTIPLE_QUERIES (-14) /* serial protocol error */
#define VXI_UNSUPPORTED_CMD (-15) /* serial protocol error */
#define VXI_DIR_VIOLATION (-16) /* serial protocol error */
#define VXI_DOR_VIOLATION (-17) /* serial protocol error */
#define VXI_RR_VIOLATION (-18) /* serial protocol error */
#define VXI_WR_VIOLATION (-19) /* serial protocol error */
#define VXI_ERR_FETCH_FAIL (-20) /* ukn serial protocol error */
#define VXI_SELF_TEST_FAILED (-21) /* self test failed */
#define VXI_TIMEOUT_TO_LARGE (-22) /* supplied timeout to long */
#define VXI_PROTOCOL_ERROR (-23) /* protocol error */
SEE ALSO
epvxiMsgLib(1)
NAME
epvxiLookupLA - find all of the devices matching a search
pattern
SYNOPSIS
#include <epvxiLib.h>
int epvxiLookupLA(pmatch_structure, pcallback, pargument)
epvxiDeviceSearchPattern *pmatch_structure;
void (*pcallback)();
void *pargument;
/*
* your call back
*/
void callback(la, pargument)
unsigned la;
void *pargument;
{
}
DESCRIPTION
Find all devices in the system matching the search pattern
and call the specified call back for each of them. The
search pattern is specified by filling fields in the struc-
ture epvxiDeviceSearchPattern and setting the flags field of
the same structure to match. For example:
epvxiDeviceSearchPattern dsp;
dsp.make = VXI_MAKE_HP;
dsp.model = 0xffc;
dsp.flags = VXI_DSP_make | VXI_DSP_model;
epvxiLookupLA(&dsp, pcallback, pargument);
A list of these constants can be found in epvxiLib.h and
device make codes can be found in epvxi.h
This is the structure used to specify search patterns for
epvxiLookupLA(). Set a bit in the flags member for each
item that is to be a constraint on the search. All other
items are ignored during the search. The call back routine
will be called for all devices which exactly match all items
specified in the flags field
#define VXI_DSP_make (1<<0)
#define VXI_DSP_model (1<<1)
#define VXI_DSP_class (1<<2)
#define VXI_DSP_slot (1<<3)
#define VXI_DSP_slot_zero_la (1<<4)
#define VXI_DSP_commander_la (1<<5)
typedef struct {
long flags; /* one bit enabling each field */
unsigned short make; /* manufacture identification */
unsigned short model; /* model code for the device */
unsigned short class; /* VXI device class */
unsigned char slot; /* slot where the device resides */
unsigned char slot_zero_la; /* logical address of slot 0 device */
unsigned char commander_la /* logical address of commander */
}epvxiDeviceSearchPattern;
RETURNS
Returns a non zero unique constant to be used as a driver
identification.
SEE ALSO
epvxiLib(1),
NAME
epvxiUniqueDriverID - return a non zero unique identifica-
tion for a VXI driver
SYNOPSIS
#include <epvxiLib.h>
int epvxiUniqueDriverID ()
DESCRIPTION
Should be called once only by each type of VXI driver to
uniquely identify itself. The routines in epvxiDrvLib.c use
this constant to prevent a VXI device from being accessed by
the wrong driver.
RETURNS
SEE ALSO
epvxiLib(1),
NAME
epvxiOpen - open a VXI device for a VXI driver
SYNOPSIS
#include <epvxiLib.h>
int epvxiOpen (la, epvxiDriverID, structureSize, pio_report_func)
unsigned la;
int epvxiDriverID;
unsigned long structureSize;
void (*pio_report_func)();
void pio_report_func(la, level)
unsigned la;
int level;
{
}
DESCRIPTION
Records this driver as the owner of the device at the speci-
fied logical address la and verifies that the device has
passed it's self test. Allocates memory of size struc-
tureSize and saves a pointer to this memory with the logical
address for future use by the driver with identification
epvxiDriverID for its private configuration. Installs call
back routine pio_report_func as an io report function to be
called each time the user requests the status of VXI dev-
ices. This routine is called with the logical address and an
integer specifying the detail level of the report as the
first and second arguments respectively. The macro epvxi-
FetchPConfig returns a pointer to this block if the speci-
fied device has been opened by the specified driver.
RETURNS
SEE ALSO
epvxiUniqueDriverID() epvxiFetchPConfig() epvxiLib(1),
NAME
epvxiClose - close a VXI device for a VXI driver
SYNOPSIS
#include <epvxiLib.h>
int epvxiClose (la, vxiDriverID)
unsigned la;
int vxiDriverID;
DESCRIPTION
Releases driver ownership of the device at the specified
logical address la. Deallocates memory in use for the
driver's private configuration.
RETURNS
SEE ALSO
epvxiLib(1),
NAME
epvxiFetchPConfig - macro which loads a pointer to the
drivers private structure
SYNOPSIS
#include <epvxiLib.h>
int evxiFetchPConfig (la, vxiDriverID, pConfig)
unsigned la;
int vxiDriverID;
stuct XXXXXX *pConfig;
DESCRIPTION
epvxiFetchPConfig() is a MACRO which loads a pointer to the
devices private configuration block (ie pConfig above). This
macro replaces the macro epvxiPConfig() which didnt return
status.
This routine performs two functions:
1) Loads a pointer to the device's configuration block.
2) Informs your driver if the specified device does not exist or has
been opened by another driver.
RETURNS
SEE ALSO
epvxiLib(1),
NAME
epvxiRouteTriggerECL - route an ECL trigger to/from the
front panel of a supported VXI device
SYNOPSIS
#include <epvxiLib.h>
int epvxiRouteTriggerECL (la, trigger, io)
unsigned la; /* logical address */
unsigned enable_map; /* bits 0-5 correspond to trig 0-5 */
/* a 1 enables a trigger */
/* a 0 disables a trigger */
unsigned io_map; /* bits 0-5 correspond to trig 0-5 */
/* a 1 sources the front panel */
/* a 0 sources the back plane */
DESCRIPTION
Route a VXI backplane trigger to or from the front panel of
a slot zero device. The bits in argument enable_map
correspond to an enable for triggers 0-5 (1 enables the
trigger and 0 disables the trigger). The bits in argument
io_map set the direction for triggers 0-5 (1 sources the
front panel and 0 sources the backplane).
Most VXI slot zero devices have one trigger output and one
trigger input connector. The trigger input connector can
drive multiple VXI backplane triggers. The trigger output
connector should be driven by only one of the backplane
triggers at a time.
RETURNS
SEE ALSO
epvxiLib(1),
NAME
epvxiRouteTriggerTTL - route an TTL trigger to/from the
front panel of a supported VXI device
SYNOPSIS
#include <epvxiLib.h>
int epvxiRouteTriggerTTL (la, trigger, io)
unsigned la; /* logical address */
unsigned enable_map; /* bits 0-5 correspond to trig 0-5 */
/* a 1 enables a trigger */
/* a 0 disables a trigger */
unsigned io_map; /* bits 0-5 correspond to trig 0-5 */
/* a 1 sources the front panel */
/* a 0 sources the back plane */
DESCRIPTION
Route a VXI backplane trigger to or from the front panel of
a slot zero device. The bits in argument enable_map
correspond to an enable for triggers 0-5 (1 enables the
trigger and 0 disables the trigger). The bits in argument
io_map set the direction for triggers 0-5 (1 sources the
front panel and 0 sources the backplane).
Most VXI slot zero devices have one trigger output and one
trigger input connector. The trigger input connector can
drive multiple VXI backplane triggers. The trigger output
connector should be driven by only one of the backplane
triggers at a time.
RETURNS
SEE ALSO
epvxiLib(1),
NAME
epvxiResman - perform VXI resource management and MXI bus
setup
SYNOPSIS
#include <epvxiLib.h>
int epvxiResman ()
MXI bus background information
o A MXI bus extender facilitates bus communication between
a VME bus master and a VME bus slave that are installed
in different crates. MXI bus extenders can be joined
together in a hierarchy interconnected by the MXI bus.
o A MXI bus extender's LA window determines the VXI LA range
over which local VME bus master initiated requests are
extended onto the MXI bus.
o A MXI bus extender's LA window also determines the MXI
LA range over which MXI extended bus master requests
are allowed to be further extended into the local VXI bus.
o MXI bus extenders are always SC devices. A MXI bus
extenders are always accessible from the MXI bus
invariant of the location of its LA window.
Conclusion: the LA of a MXI does not constrain the
location of its LA window.
o Each MXI's LA window must be large enough to contain all
of the MXI bus extender LA windows beneath it in the
hierarchy. A MXI's LA window may not overlap the windows of
any other MXI'at the same level in the hierarchy.
o SC devices within one crate must be within a block
which does not overlap the LA windows of other
MXI bus extenders at the same level in the
hierarchy. Likewise SC devices within one crate
must not overlap the LA windows of MXI bus
extenders at a lower level in the hierarchy.
EPICS VXI resource manager background information
o The EPICS VXI resource manager will always successfully
allocate all DC devices in a DC MXI bus system if
the available LA address range is large enough and
if all devices other than the resource manager and
the MXIs are DC.
o Otherwise if some of the devices in the system
(other than the MXIs and the resource manager) are
SC then the burden is placed on the project
engineer to guarantee that SC devices are located
such that nonoverlapping MXI LA windows can
be allocated by the resource manager. Additionally
the project engineer must locate the SC devices
so that there is sufficient space to allocate the LAs
of DC devices into nonoverlapping MXI LA windows.
If the project engineer locates SC devices
correctly the resource manager will always find the
corresponding window hierarchy that provides
access to all devices. If the project engineer
improperly locates SC devices the resource manager
will detect it and print a message.
o The CPU running the EPICS VXI resource manager is at the
root of the MXI hierarchy.
o The resource manager will never allocate a DC device
at a LA overlapping an interrupt vector already
allocated to another device (use "veclist()" to
determine what vectors are in use).
Resource manager DC device allocation rules
o When DC devices are allocated they will be placed between
existing SC devices (in the same extender) first.
Next they will be placed after existing DC devices
(in the same extender). If there isn't room above existing
DC devices then the resource manager will attempt to
allocate DC device beneath the existing SC devices.
If devices in other extenders (the limits of other windows)
bracket the upper and lower limits of an extender's
window there may not be enough space to allocate
all of the DC devices present in a crate.
If so, a warning message will be printed and the DC
device will not be allocated a valid LA.
o If the only SC device in a crate is the MXI granting access
to the crate then the resource manager will be free to place
any DC devices found in a contiguous block where there is room.
The resource manager requires block allocation because the MXI
address window must contain only the DC device LA assignments
for the current crate. This contiguous block will be placed
at the highest open LA block available. If a contiguous block
of sufficient size is not found then none of the DC devices will
be allocated (assigned) valid LAs and a warning message
will be printed. This block will not be anchored in any way
to the SC LA of the extender that provides access to the
DC devices in the crate.
Man(1) output converted with
man2html