Struct typed_dset

Struct Documentation

struct typed_dset

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)