add USE_TYPED_DRVET and USE_TYPED_DSET options

This commit is contained in:
Michael Davidsaver
2018-05-14 19:51:27 -07:00
parent 2b1d5ae4e3
commit 1893cb4f54
2 changed files with 37 additions and 29 deletions
+22 -16
View File
@@ -24,22 +24,6 @@ struct devSup;
struct ioscan_head; /* aka IOSCANPVT */
struct link; /* aka DBLINK */
#ifdef __cplusplus
extern "C" {
typedef long (*DEVSUPFUN)(void *); /* ptr to device support function*/
#else
typedef long (*DEVSUPFUN)(); /* ptr to device support function*/
#endif
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;
/** Type safe alternative to 'struct dset'
*
* Recommended usage
@@ -113,6 +97,28 @@ typedef struct dsxt { /* device support extension table */
/* Recordtypes are *not* allowed to extend this table */
} dsxt;
#ifdef __cplusplus
extern "C" {
typedef long (*DEVSUPFUN)(void *); /* ptr to device support function*/
#else
typedef long (*DEVSUPFUN)(); /* ptr to device support function*/
#endif
#ifndef USE_TYPED_DSET
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;
#else
typedef typed_dset dset;
#endif /* USE_TYPED_DSET */
/** Fetch INP or OUT link (or NULL if record type has neither).
*
* Recommended for use in device support init_record()
+15 -13
View File
@@ -18,7 +18,19 @@
#include "errMdef.h"
typedef long (*DRVSUPFUN) (); /* ptr to driver support function*/
typedef struct typed_drvet {
/** Number of function pointers which follow. Must be >=2 */
long number;
/** Called from dbior() */
long (*report)(int lvl);
/** Called during iocInit() */
long (*init)(void);
/*other functions are device dependent*/
} typed_drvet;
typedef long (*DRVSUPFUN) (); /* ptr to driver support function for use with plain/untyped drvet */
#ifndef USE_TYPED_DRVET
typedef struct drvet { /* driver entry table */
long number; /*number of support routines*/
@@ -28,19 +40,9 @@ typedef struct drvet { /* driver entry table */
}drvet;
#define DRVETNUMBER ( (sizeof(struct drvet) -sizeof(long))/sizeof(DRVSUPFUN) )
typedef struct typed_drvet {
/** Number of function pointers which follow. Must be >=2 */
long number;
/** Called from dbior() */
long (*report)(int lvl);
/** Called during iocInit() */
#ifdef __cplusplus
long (*init)();
#else
long (*init)(void);
#endif
/*other functions are device dependent*/
} typed_drvet;
typedef typed_drvet drvet;
#endif /* USE_TYPED_DRVET */
#define S_drv_noDrvSup (M_drvSup| 1) /*SDR_DRVSUP: Driver support missing*/
#define S_drv_noDrvet (M_drvSup| 3) /*Missing driver support entry table*/