Export and use aidset, set USE_TYPED_DSET
I did ai so I can use it as an example in the Release Notes.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -13,6 +13,7 @@ SRC_DIRS += $(STDDIR)/rec
|
||||
|
||||
stdRecords += aaiRecord
|
||||
stdRecords += aaoRecord
|
||||
aiRecord_CFLAGS += -DUSE_TYPED_DSET
|
||||
stdRecords += aiRecord
|
||||
stdRecords += aoRecord
|
||||
stdRecords += aSubRecord
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user