diff --git a/modules/database/src/std/dev/Makefile b/modules/database/src/std/dev/Makefile index 40f68b8f1..bd1add3ee 100644 --- a/modules/database/src/std/dev/Makefile +++ b/modules/database/src/std/dev/Makefile @@ -15,7 +15,9 @@ DBD += devSoft.dbd dbRecStd_SRCS += devAaiSoft.c dbRecStd_SRCS += devAaoSoft.c +devAiSoft_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAiSoft.c +devAiSoftRaw_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAiSoftRaw.c dbRecStd_SRCS += devAoSoft.c dbRecStd_SRCS += devAoSoftRaw.c @@ -52,8 +54,8 @@ dbRecStd_SRCS += devSASoft.c dbRecStd_SRCS += devSiSoft.c dbRecStd_SRCS += devSoSoft.c dbRecStd_SRCS += devWfSoft.c -dbRecStd_SRCS += devGeneralTime.c +devAiSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devAiSoftCallback.c dbRecStd_SRCS += devBiSoftCallback.c devI64inSoftCallback_CFLAGS += -DUSE_TYPED_DSET @@ -77,6 +79,9 @@ devPrintfSoftCallback_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devPrintfSoftCallback.c dbRecStd_SRCS += devSoSoftCallback.c +devGeneralTime_CFLAGS += -DUSE_TYPED_DSET +dbRecStd_SRCS += devGeneralTime.c +devTimestamp_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devTimestamp.c devStdio_CFLAGS += -DUSE_TYPED_DSET dbRecStd_SRCS += devStdio.c diff --git a/modules/database/src/std/dev/devAiSoft.c b/modules/database/src/std/dev/devAiSoft.c index 0ecc1b13f..136c7f5fe 100644 --- a/modules/database/src/std/dev/devAiSoft.c +++ b/modules/database/src/std/dev/devAiSoft.c @@ -26,30 +26,19 @@ #include "epicsExport.h" /* Create the dset for devAiSoft */ -static long init_record(aiRecord *prec); +static long init_record(dbCommon *pcommon); static long read_ai(aiRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_ai; - DEVSUPFUN special_linconv; -} devAiSoft = { - 6, - NULL, - NULL, - init_record, - NULL, - read_ai, - NULL +aidset devAiSoft = { + {6, NULL, NULL, init_record, NULL}, + read_ai, NULL }; epicsExportAddress(dset, devAiSoft); -static long init_record(aiRecord *prec) +static long init_record(dbCommon *pcommon) { + aiRecord *prec = (aiRecord *)pcommon; + if (recGblInitConstantLink(&prec->inp, DBF_DOUBLE, &prec->val)) prec->udf = FALSE; diff --git a/modules/database/src/std/dev/devAiSoftCallback.c b/modules/database/src/std/dev/devAiSoftCallback.c index 8bf6385e1..4eca6b562 100644 --- a/modules/database/src/std/dev/devAiSoftCallback.c +++ b/modules/database/src/std/dev/devAiSoftCallback.c @@ -153,8 +153,10 @@ static long init(int pass) return 0; } -static long init_record(aiRecord *prec) +static long init_record(dbCommon *pcommon) { + aiRecord *prec = (aiRecord *)pcommon; + if (recGblInitConstantLink(&prec->inp, DBF_DOUBLE, &prec->val)) prec->udf = FALSE; @@ -213,14 +215,8 @@ static long read_ai(aiRecord *prec) return 2; } -/* Create the dset for devAiSoftCallback */ -struct { - dset common; - DEVSUPFUN read_ai; - DEVSUPFUN special_linconv; -} devAiSoftCallback = { +aidset devAiSoftCallback = { {6, NULL, init, init_record, NULL}, - read_ai, - NULL + read_ai, NULL }; epicsExportAddress(dset, devAiSoftCallback); diff --git a/modules/database/src/std/dev/devAiSoftRaw.c b/modules/database/src/std/dev/devAiSoftRaw.c index f2cfd5df5..39bf6b956 100644 --- a/modules/database/src/std/dev/devAiSoftRaw.c +++ b/modules/database/src/std/dev/devAiSoftRaw.c @@ -25,30 +25,19 @@ #include "epicsExport.h" /* Create the dset for devAiSoftRaw */ -static long init_record(aiRecord *prec); +static long init_record(dbCommon *pcommon); static long read_ai(aiRecord *prec); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_ai; - DEVSUPFUN special_linconv; -} devAiSoftRaw = { - 6, - NULL, - NULL, - init_record, - NULL, - read_ai, - NULL +aidset devAiSoftRaw = { + {6, NULL, NULL, init_record, NULL}, + read_ai, NULL }; epicsExportAddress(dset, devAiSoftRaw); -static long init_record(aiRecord *prec) +static long init_record(dbCommon *pcommon) { + aiRecord *prec = (aiRecord *)pcommon; + recGblInitConstantLink(&prec->inp, DBF_LONG, &prec->rval); return 0; diff --git a/modules/database/src/std/dev/devGeneralTime.c b/modules/database/src/std/dev/devGeneralTime.c index 1b821d582..c424fb772 100644 --- a/modules/database/src/std/dev/devGeneralTime.c +++ b/modules/database/src/std/dev/devGeneralTime.c @@ -50,8 +50,9 @@ static struct ai_channel { {"TIME", getCurrentTime}, }; -static long init_ai(aiRecord *prec) +static long init_ai(dbCommon *pcommon) { + aiRecord *prec = (aiRecord *)pcommon; int i; if (prec->inp.type != INST_IO) { @@ -91,12 +92,9 @@ static long read_ai(aiRecord *prec) return -1; } -struct { - dset common; - DEVSUPFUN read_write; - DEVSUPFUN special_linconv; -} devAiGeneralTime = { - {6, NULL, NULL, init_ai, NULL}, read_ai, NULL +aidset devAiGeneralTime = { + {6, NULL, NULL, init_ai, NULL}, + read_ai, NULL }; epicsExportAddress(dset, devAiGeneralTime); @@ -114,8 +112,9 @@ static struct bo_channel { {"RSTERRCNT", resetErrors}, }; -static long init_bo(boRecord *prec) +static long init_bo(dbCommon *pcommon) { + boRecord *prec = (boRecord *)pcommon; int i; if (prec->out.type != INST_IO) { @@ -173,8 +172,9 @@ static struct li_channel { {"GETERRCNT", errorCount}, }; -static long init_li(longinRecord *prec) +static long init_li(dbCommon *pcommon) { + longinRecord *prec = (longinRecord *)pcommon; int i; if (prec->inp.type != INST_IO) { @@ -243,8 +243,9 @@ static struct si_channel { {"BESTTEP", eventProvider}, }; -static long init_si(stringinRecord *prec) +static long init_si(dbCommon *pcommon) { + stringinRecord *prec = (stringinRecord *)pcommon; int i; if (prec->inp.type != INST_IO) { diff --git a/modules/database/src/std/dev/devTimestamp.c b/modules/database/src/std/dev/devTimestamp.c index 936d7767d..bcab26629 100644 --- a/modules/database/src/std/dev/devTimestamp.c +++ b/modules/database/src/std/dev/devTimestamp.c @@ -40,12 +40,9 @@ static long read_ai(aiRecord *prec) return 2; } -struct { - dset common; - DEVSUPFUN read_write; - DEVSUPFUN special_linconv; -} devTimestampAI = { - {6, NULL, initAllow, NULL, NULL}, read_ai, NULL +aidset devTimestampAI = { + {6, NULL, initAllow, NULL, NULL}, + read_ai, NULL }; epicsExportAddress(dset, devTimestampAI); @@ -72,6 +69,7 @@ struct { dset common; DEVSUPFUN read_stringin; } devTimestampSI = { - {5, NULL, initAllow, NULL, NULL}, read_stringin + {5, NULL, initAllow, NULL, NULL}, + read_stringin }; epicsExportAddress(dset, devTimestampSI); diff --git a/modules/database/src/std/rec/Makefile b/modules/database/src/std/rec/Makefile index 2d1cfe67b..e6277fb49 100644 --- a/modules/database/src/std/rec/Makefile +++ b/modules/database/src/std/rec/Makefile @@ -13,6 +13,7 @@ SRC_DIRS += $(STDDIR)/rec stdRecords += aaiRecord stdRecords += aaoRecord +aiRecord_CFLAGS += -DUSE_TYPED_DSET stdRecords += aiRecord stdRecords += aoRecord stdRecords += aSubRecord diff --git a/modules/database/src/std/rec/aiRecord.c b/modules/database/src/std/rec/aiRecord.c index 0e3593282..512a01287 100644 --- a/modules/database/src/std/rec/aiRecord.c +++ b/modules/database/src/std/rec/aiRecord.c @@ -86,17 +86,6 @@ rset aiRSET={ }; epicsExportAddress(rset,aiRSET); -typedef struct aidset { /* analog input dset */ - long number; - DEVSUPFUN dev_report; - DEVSUPFUN init; - DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/ - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_ai;/*(0,2)=> success and convert,don't convert)*/ - /* if convert then raw value stored in rval */ - DEVSUPFUN special_linconv; -}aidset; - static void checkAlarms(aiRecord *prec, epicsTimeStamp *lastTime); static void convert(aiRecord *prec); static void monitor(aiRecord *prec); @@ -118,7 +107,7 @@ static long init_record(struct dbCommon *pcommon, int pass) return(S_dev_noDSET); } /* must have read_ai function defined */ - if( (pdset->number < 6) || (pdset->read_ai == NULL) ) { + if ((pdset->common.number < 6) || (pdset->read_ai == NULL)) { recGblRecordError(S_dev_missingSup,(void *)prec,"ai: init_record"); return(S_dev_missingSup); } @@ -128,8 +117,8 @@ static long init_record(struct dbCommon *pcommon, int pass) prec->eoff = prec->egul; } - if( pdset->init_record ) { - long status=(*pdset->init_record)(prec); + if (pdset->common.init_record) { + long status = pdset->common.init_record(pcommon); if (prec->linr == menuConvertSLOPE) { prec->eoff = eoff; prec->eslo = eslo; @@ -190,7 +179,7 @@ static long special(DBADDR *paddr,int after) switch(special_type) { case(SPC_LINCONV): - if(pdset->number<6) { + if (pdset->common.number < 6) { recGblDbaddrError(S_db_noMod,paddr,"ai: special"); return(S_db_noMod); } diff --git a/modules/database/src/std/rec/aiRecord.dbd.pod b/modules/database/src/std/rec/aiRecord.dbd.pod index 3b53b7a24..440d16c0c 100644 --- a/modules/database/src/std/rec/aiRecord.dbd.pod +++ b/modules/database/src/std/rec/aiRecord.dbd.pod @@ -215,6 +215,16 @@ monitoring functionality. =cut include "dbCommon.dbd" + % + %/* Declare Device Support Entry Table */ + %struct aiRecord; + %typedef struct aidset { + % dset common; + % long (*read_ai)(struct aiRecord *prec); + % long (*special_linconv)(struct aiRecord *prec, int after); + %} aidset; + %#define HAS_aidset + % field(VAL,DBF_DOUBLE) { prompt("Current EGU Value") promptgroup("40 - Input")