Table of Contents Previous Chapter Chapter 9: Device Support Library

Chapter 9: Device Support Library

1. Overview

Include file devLib.h provides definitions for a library of routines useful for device and driver modules. These are a new addition to EPICS and are not yet used by all device/driver support modules. Until they are, the registration routines will not prevent addressing conflicts caused by multiple device/drivers trying to use the same VME addresses.

2. Registering VME Addresses

Definitions of Address Types

  typedef enum {
    atLast /* atLast must be the last enum in this list */
    } epicsAddressType;
  char  *epicsAddressTypeName[]
    = {
    "VME A16",
    "VME A24",
    "VME A32"
  int EPICStovxWorksAddrType[] 
    = {

Register Address

  long  devRegisterAddress(
    epicsAddressType  addrType,
    void  *baseAddress,
    unsigned  size,
    void  **pLocalAddress);
This routine is called to register a VME address. This routine keeps a list of all VME addresses requested and returns an error message if an attempt is made to register any addresses that are already being used. *pLocalAddress is set equal to the address as seen by the caller.

Unregister Address

  long  devUnregisterAddress(
    epicsAddressType  addrType,
    void  *baseAddress);
This routine releases addresses previously registered by a call to devRegisterAddress.

3. Interrupt Connect Routines

Definitions of Interrupt Types

  typedef enum {intCPU, intVME, intVXI} epicsInterruptType;


  long  devConnectInterrupt(
    epicsInterruptType      intType,
    unsigned  vectorNumber,
    void  (*pFunction)(),
    void  *parameter);


  long  devDisconnectInterrupt(
    epicsInterruptType  intType,
    unsigned  vectorNumber);

Enable Level

  long  devEnableInterruptLevel(
    epicsInterruptType  intType,
    unsigned  level);

Disable Level

  long  devDisableInterruptLevel(
    epicsInterruptType  intType,
    unsigned  level);

4. Macros and Routines for Normalized Analog Values

Normalized GetField

  long  devNormalizedGblGetField(
    long  rawValue,
    unsigned  nbits,
    DBREQUEST  *pdbrequest,
    int  pass,
    CALLBACK  *pcallback);
This routine is just like recGblGetField, except that if the request type is DBR_FLOAT or DBR_DOUBLE, the normalized value of rawValue is obtained, i.e. rawValue is converted to a value in the range 0.0<=value<.1.0

Convert Digital Value to a Normalized Double Value

  #define devCreateMask(NBITS)  ((1<<(NBITS))-1)
  #define devDigToNml(DIGITAL,NBITS) \

Convert Normalized Double Value to a Digital Value

  #define devNmlToDig(NORMAL,NBITS) \
    (((long)(NORMAL)) * devCreateMask(NBITS))
Table of Contents Next Chapter