Solve extended device support registration issue across shared libraries.
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include "dbBase.h"
|
||||
#include "dbStaticLib.h"
|
||||
#include "dbStaticPvt.h"
|
||||
#include "devSup.h"
|
||||
#include "special.h"
|
||||
|
||||
|
||||
@@ -157,6 +158,38 @@ static void doubleToString(double value,char *preturn)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static long do_nothing(struct dbCommon *precord) { return 0; }
|
||||
|
||||
/* Dummy DSXT used for soft device supports */
|
||||
struct dsxt devSoft_DSXT = {
|
||||
do_nothing,
|
||||
do_nothing
|
||||
};
|
||||
|
||||
static devSup *pthisDevSup = NULL;
|
||||
|
||||
void dbInitDevSup(devSup *pdevSup, dset *pdset)
|
||||
{
|
||||
pdevSup->pdset = pdset;
|
||||
if (pdevSup->link_type == CONSTANT)
|
||||
pdevSup->pdsxt = &devSoft_DSXT;
|
||||
|
||||
if (pdset->init) {
|
||||
pthisDevSup = pdevSup;
|
||||
pdset->init(0);
|
||||
pthisDevSup = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void devExtend(dsxt *pdsxt)
|
||||
{
|
||||
if (!pthisDevSup)
|
||||
errlogPrintf("devExtend() called outside of dbInitDevSup()\n");
|
||||
else {
|
||||
pthisDevSup->pdsxt = pdsxt;
|
||||
}
|
||||
}
|
||||
|
||||
long dbAllocRecord(DBENTRY *pdbentry,const char *precordName)
|
||||
{
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devSup.h Device Support */
|
||||
@@ -19,29 +18,38 @@
|
||||
|
||||
#include "shareLib.h"
|
||||
|
||||
/* structures defined elsewhere */
|
||||
struct dbCommon;
|
||||
struct devSup;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
typedef long (*DEVSUPFUN)(void*); /* ptr to device support function*/
|
||||
typedef long (*DEVSUPFUN)(void *); /* ptr to device support function*/
|
||||
#else
|
||||
typedef long (*DEVSUPFUN)(); /* ptr to device support function*/
|
||||
typedef long (*DEVSUPFUN)(); /* ptr to device support function*/
|
||||
#endif
|
||||
|
||||
typedef struct dset { /* device support entry table */
|
||||
typedef struct dset { /* device support entry table */
|
||||
long number; /*number of support routines*/
|
||||
DEVSUPFUN report; /*print report*/
|
||||
DEVSUPFUN init; /*init support layer*/
|
||||
DEVSUPFUN init_record; /*init device for particular record*/
|
||||
DEVSUPFUN get_ioint_info; /* get io interrupt information*/
|
||||
/*other functions are record dependent*/
|
||||
}dset;
|
||||
} dset;
|
||||
|
||||
struct dbCommon;
|
||||
typedef struct dsxt { /* device support extension table */
|
||||
long (*add_record)(struct dbCommon *precord);
|
||||
long (*del_record)(struct dbCommon *precord);
|
||||
/* Recordtypes are *not* allowed to extend this table */
|
||||
} dsxt;
|
||||
|
||||
epicsShareExtern dsxt devSoft_DSXT; /* Allow anything table */
|
||||
|
||||
epicsShareFunc void devExtend(dsxt *pdsxt);
|
||||
epicsShareFunc void dbInitDevSup(struct devSup *pdevSup, dset *pdset);
|
||||
|
||||
|
||||
#define S_dev_noDevSup (M_devSup| 1) /*SDR_DEVSUP: Device support missing*/
|
||||
#define S_dev_noDSET (M_devSup| 3) /*Missing device support entry table*/
|
||||
#define S_dev_missingSup (M_devSup| 5) /*Missing device support routine*/
|
||||
@@ -55,12 +63,6 @@ typedef struct dsxt { /* device support extension table */
|
||||
#define S_dev_Conflict (M_devSup|21) /*Multiple records accessing same signal*/
|
||||
#define S_dev_noDeviceFound (M_devSup|23) /*No device found at specified address*/
|
||||
|
||||
|
||||
/* These are defined in src/misc/iocInit.c */
|
||||
|
||||
epicsShareExtern struct dsxt devSoft_DSXT;
|
||||
epicsShareFunc void devExtend(dsxt *pdsxt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
@@ -246,16 +246,6 @@ static void initRecSup(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static long do_nothing(struct dbCommon *precord) { return 0; }
|
||||
|
||||
/* Dummy DSXT used for soft device supports */
|
||||
struct dsxt devSoft_DSXT = {
|
||||
do_nothing,
|
||||
do_nothing
|
||||
};
|
||||
|
||||
static devSup *pthisDevSup = NULL;
|
||||
|
||||
static void initDevSup(void)
|
||||
{
|
||||
@@ -264,45 +254,35 @@ static void initDevSup(void)
|
||||
for (pdbRecordType = (dbRecordType *)ellFirst(&pdbbase->recordTypeList);
|
||||
pdbRecordType;
|
||||
pdbRecordType = (dbRecordType *)ellNext(&pdbRecordType->node)) {
|
||||
for (pthisDevSup = (devSup *)ellFirst(&pdbRecordType->devList);
|
||||
pthisDevSup;
|
||||
pthisDevSup = (devSup *)ellNext(&pthisDevSup->node)) {
|
||||
struct dset *pdset = registryDeviceSupportFind(pthisDevSup->name);
|
||||
devSup *pdevSup;
|
||||
|
||||
for (pdevSup = (devSup *)ellFirst(&pdbRecordType->devList);
|
||||
pdevSup;
|
||||
pdevSup = (devSup *)ellNext(&pdevSup->node)) {
|
||||
struct dset *pdset = registryDeviceSupportFind(pdevSup->name);
|
||||
|
||||
if (!pdset) {
|
||||
errlogPrintf("device support %s not found\n",pthisDevSup->name);
|
||||
errlogPrintf("device support %s not found\n",pdevSup->name);
|
||||
continue;
|
||||
}
|
||||
if (pthisDevSup->link_type == CONSTANT)
|
||||
pthisDevSup->pdsxt = &devSoft_DSXT;
|
||||
pthisDevSup->pdset = pdset;
|
||||
if (pdset->init) {
|
||||
pdset->init(0);
|
||||
}
|
||||
dbInitDevSup(pdevSup, pdset); /* Calls pdset->init(0) */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
epicsShareFunc void devExtend(dsxt *pdsxt)
|
||||
{
|
||||
if (!pthisDevSup)
|
||||
errlogPrintf("devExtend() called outside of initDevSup()\n");
|
||||
else {
|
||||
pthisDevSup->pdsxt = pdsxt;
|
||||
}
|
||||
}
|
||||
|
||||
static void finishDevSup(void)
|
||||
static void finishDevSup(void)
|
||||
{
|
||||
dbRecordType *pdbRecordType;
|
||||
|
||||
for (pdbRecordType = (dbRecordType *)ellFirst(&pdbbase->recordTypeList);
|
||||
pdbRecordType;
|
||||
pdbRecordType = (dbRecordType *)ellNext(&pdbRecordType->node)) {
|
||||
for (pthisDevSup = (devSup *)ellFirst(&pdbRecordType->devList);
|
||||
pthisDevSup;
|
||||
pthisDevSup = (devSup *)ellNext(&pthisDevSup->node)) {
|
||||
struct dset *pdset = pthisDevSup->pdset;
|
||||
devSup *pdevSup;
|
||||
|
||||
for (pdevSup = (devSup *)ellFirst(&pdbRecordType->devList);
|
||||
pdevSup;
|
||||
pdevSup = (devSup *)ellNext(&pdevSup->node)) {
|
||||
struct dset *pdset = pdevSup->pdset;
|
||||
|
||||
if (pdset && pdset->init)
|
||||
pdset->init(1);
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* iocInit.h ioc initialization */
|
||||
@@ -23,8 +22,6 @@ epicsShareFunc int iocBuild(void);
|
||||
epicsShareFunc int iocRun(void);
|
||||
epicsShareFunc int iocPause(void);
|
||||
|
||||
epicsShareExtern struct dsxt devSoft_DSXT;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user