devSup.h

Device support routines.

Defines

S_dev_noDevSup
S_dev_noDSET
S_dev_missingSup
S_dev_badInpType
S_dev_badOutType
S_dev_badInitRet
S_dev_badBus
S_dev_badCard
S_dev_badSignal
S_dev_NoInit
S_dev_Conflict
S_dev_noDeviceFound

Typedefs

typedef struct ioscan_head *IOSCANPVT
typedef long (*DEVSUPFUN)(void*)
typedef dset unambiguous_dset

Functions

struct link *dbGetDevLink(struct dbCommon *prec)

Fetch INP or OUT link (or NULL if record type has neither).

Recommended for use in device support init_record()

void devExtend(dsxt *pdsxt)
void dbInitDevSup(struct devSup *pdevSup, dset *pdset)

Variables

dsxt devSoft_DSXT
struct typed_dset
#include <devSup.h>

Type safe version of ‘struct dset’

Recommended usage:

In Makefile:

USR_CPPFLAGS += -DUSE_TYPED_RSET -DUSE_TYPED_DSET

In C source file:

#include <devSup.h>
#include <dbScan.h>      // For IOCSCANPVT
...
#include <epicsExport.h> // defines epicsExportSharedSymbols
...
static long init_record(dbCommon *prec);
static long get_iointr_info(int detach, dbCommon *prec, IOCSCANPVT* pscan);
static long longin_read(longinRecord *prec);

longindset devLiDevName = {
    {
     5, // 4 from dset + 1 from longinRecord
        NULL,
        NULL,
        &init_record,
        &get_iointr_info
    },
    &longin_read
};
epicsExportAddress(dset, devLiDevName);

Public Members

long number

Number of function pointers which follow. The value depends on the recordtype, but must be >=4

long (*report)(int lvl)

Called from dbior()

long (*init)(int after)

Called twice during iocInit(). First with after = 0 before init_record() or array field allocation. Again with after = 1 after init_record() has finished.

long (*init_record)(struct dbCommon *prec)

Called once per record instance

long (*get_ioint_info)(int detach, struct dbCommon *prec, IOSCANPVT *pscan)

Called when SCAN=”I/O Intr” on startup, or after SCAN is changed.

Caller must assign the third argument (IOCSCANPVT*). eg.

struct mpvt {
   IOSCANPVT drvlist;
};
...
   // init_record() routine calls
   scanIoInit(&pvt->drvlist);
...
static long get_ioint_info(int detach, struct dbCommon *prec, IOCSCANPVT* pscan) {
   if(prec->dpvt)
       *pscan = &((mypvt*)prec->dpvt)->drvlist;

When a particular record instance can/will only used a single scan list, the detach argument can be ignored.

If this is not the case, then the following should be noted.

  • get_ioint_info() is called with detach = 0 to fetch the scan list to which this record will be added.

  • get_ioint_info() is called later with detach = 1 to fetch the scan list from which this record should be removed.

  • Calls will be balanced, so a call with detach = 0 will be followed by one with detach = 1.

Note

get_ioint_info() will be called during IOC shutdown if the dsxt::del_record() extended callback is defined. (from 3.15.0.1)

struct dsxt
#include <devSup.h>

Device support extension table.

Optional routines to allow run-time address modifications to be communicated to device support, which must register a struct dsxt by calling devExtend() from its init() routine.

Public Members

long (*add_record)(struct dbCommon *precord)

Optional, called to offer device support a new record to control.

Routine may return a non-zero error code to refuse record.

long (*del_record)(struct dbCommon *precord)

Optional, called to remove record from device support control.

Routine return a non-zero error code to refuse record removal.

struct dset

Public Members

long number
DEVSUPFUN report
DEVSUPFUN init
DEVSUPFUN init_record
DEVSUPFUN get_ioint_info