Use new dbLink APIs instead of checking link.type
This commit is contained in:
@@ -78,16 +78,16 @@ static long init_record(aaiRecord *prec)
|
||||
static long read_aai(aaiRecord *prec)
|
||||
{
|
||||
long nRequest = prec->nelm;
|
||||
long status = dbGetLink(prec->simm == menuYesNoYES ? &prec->siol :
|
||||
&prec->inp, prec->ftvl, prec->bptr, 0, &nRequest);
|
||||
|
||||
dbGetLink(prec->simm == menuYesNoYES ? &prec->siol : &prec->inp,
|
||||
prec->ftvl, prec->bptr, 0, &nRequest);
|
||||
if (nRequest > 0) {
|
||||
if (!status && nRequest > 0) {
|
||||
prec->nord = nRequest;
|
||||
prec->udf=FALSE;
|
||||
if (prec->tsel.type == CONSTANT &&
|
||||
prec->udf = FALSE;
|
||||
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ epicsExportAddress(dset,devAaoSoft);
|
||||
|
||||
static long init_record(aaoRecord *prec)
|
||||
{
|
||||
if (prec->out.type == CONSTANT) {
|
||||
if (dbLinkIsConstant(&prec->out)) {
|
||||
prec->nord = 0;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -51,10 +51,9 @@ epicsExportAddress(dset, devAiSoft);
|
||||
|
||||
static long init_record(aiRecord *prec)
|
||||
{
|
||||
if (prec->inp.type == CONSTANT) {
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_DOUBLE, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_DOUBLE, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -62,9 +61,6 @@ static long read_ai(aiRecord *prec)
|
||||
{
|
||||
double val;
|
||||
|
||||
if (prec->inp.type == CONSTANT)
|
||||
return 2;
|
||||
|
||||
if (!dbGetLink(&prec->inp, DBR_DOUBLE, &val, 0, 0)) {
|
||||
|
||||
/* Apply smoothing algorithm */
|
||||
@@ -76,7 +72,7 @@ static long read_ai(aiRecord *prec)
|
||||
prec->udf = FALSE;
|
||||
prec->dpvt = &devAiSoft; /* Any non-zero value */
|
||||
|
||||
if (prec->tsel.type == CONSTANT &&
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
} else {
|
||||
|
||||
@@ -50,16 +50,15 @@ epicsExportAddress(dset, devAiSoftRaw);
|
||||
|
||||
static long init_record(aiRecord *prec)
|
||||
{
|
||||
if (prec->inp.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->inp, DBF_LONG, &prec->rval);
|
||||
}
|
||||
recGblInitConstantLink(&prec->inp, DBF_LONG, &prec->rval);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long read_ai(aiRecord *prec)
|
||||
{
|
||||
if (!dbGetLink(&prec->inp, DBR_LONG, &prec->rval, 0, 0) &&
|
||||
prec->tsel.type == CONSTANT &&
|
||||
dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ static long read_bi(biRecord *prec)
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
|
||||
if (prec->tsel.type == CONSTANT &&
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
|
||||
|
||||
@@ -48,19 +48,16 @@ epicsExportAddress(dset, devBiSoft);
|
||||
|
||||
static long init_record(biRecord *prec)
|
||||
{
|
||||
if (prec->inp.type == CONSTANT) {
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long read_bi(biRecord *prec)
|
||||
{
|
||||
if (!dbGetLink(&prec->inp, DBR_USHORT, &prec->val, 0, 0)) {
|
||||
if (prec->inp.type != CONSTANT)
|
||||
prec->udf = FALSE;
|
||||
if (prec->tsel.type == CONSTANT &&
|
||||
prec->udf = FALSE;
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
}
|
||||
|
||||
@@ -48,16 +48,14 @@ epicsExportAddress(dset, devBiSoftRaw);
|
||||
|
||||
static long init_record(biRecord *prec)
|
||||
{
|
||||
if (prec->inp.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval);
|
||||
}
|
||||
recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long read_bi(biRecord *prec)
|
||||
{
|
||||
if (!dbGetLink(&prec->inp, DBR_ULONG, &prec->rval, 0, 0) &&
|
||||
prec->tsel.type == CONSTANT &&
|
||||
dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
|
||||
|
||||
@@ -48,10 +48,8 @@ epicsExportAddress(dset, devEventSoft);
|
||||
|
||||
static long init_record(eventRecord *prec)
|
||||
{
|
||||
if (prec->inp.type == CONSTANT) {
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_STRING, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_STRING, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -60,7 +58,7 @@ static long read_event(eventRecord *prec)
|
||||
long status;
|
||||
char newEvent[MAX_STRING_SIZE];
|
||||
|
||||
if (prec->inp.type != CONSTANT) {
|
||||
if (!dbLinkIsConstant(&prec->inp)) {
|
||||
status = dbGetLink(&prec->inp, DBR_STRING, newEvent, 0, 0);
|
||||
if (status) return status;
|
||||
if (strcmp(newEvent, prec->val) != 0) {
|
||||
@@ -69,7 +67,7 @@ static long read_event(eventRecord *prec)
|
||||
}
|
||||
}
|
||||
prec->udf = FALSE;
|
||||
if (prec->tsel.type == CONSTANT &&
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
return 0;
|
||||
|
||||
@@ -52,10 +52,9 @@ epicsExportAddress(dset,devHistogramSoft);
|
||||
|
||||
static long init_record(histogramRecord *prec)
|
||||
{
|
||||
if (prec->svl.type == CONSTANT) {
|
||||
if(recGblInitConstantLink(&prec->svl,DBF_DOUBLE,&prec->sgnl))
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
if (recGblInitConstantLink(&prec->svl,DBF_DOUBLE,&prec->sgnl))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,10 +48,9 @@ epicsExportAddress(dset, devLiSoft);
|
||||
|
||||
static long init_record(longinRecord *prec)
|
||||
{
|
||||
if (prec->inp.type == CONSTANT) {
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_LONG, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_LONG, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -61,7 +60,7 @@ static long read_longin(longinRecord *prec)
|
||||
|
||||
status = dbGetLink(&prec->inp, DBR_LONG, &prec->val, 0, 0);
|
||||
if (!status &&
|
||||
prec->tsel.type == CONSTANT &&
|
||||
dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
return status;
|
||||
|
||||
@@ -29,7 +29,7 @@ static long read_string(lsiRecord *prec)
|
||||
long status = dbGetLinkLS(&prec->inp, prec->val, prec->sizv, &prec->len);
|
||||
|
||||
if (!status &&
|
||||
prec->tsel.type == CONSTANT &&
|
||||
dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
|
||||
|
||||
@@ -48,19 +48,17 @@ epicsExportAddress(dset, devMbbiDirectSoft);
|
||||
|
||||
static long init_record(mbbiDirectRecord *prec)
|
||||
{
|
||||
if (prec->inp.type == CONSTANT) {
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long read_mbbi(mbbiDirectRecord *prec)
|
||||
{
|
||||
if (!dbGetLink(&prec->inp, DBR_USHORT, &prec->val, 0, 0)) {
|
||||
if (prec->inp.type != CONSTANT)
|
||||
prec->udf = FALSE;
|
||||
if (prec->tsel.type == CONSTANT &&
|
||||
prec->udf = FALSE;
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
}
|
||||
|
||||
@@ -48,11 +48,12 @@ epicsExportAddress(dset, devMbbiDirectSoftRaw);
|
||||
|
||||
static long init_record(mbbiDirectRecord *prec)
|
||||
{
|
||||
if (prec->inp.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval);
|
||||
}
|
||||
/*to preserve old functionality*/
|
||||
if (prec->nobt == 0) prec->mask = 0xffffffff;
|
||||
recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval);
|
||||
|
||||
/* Preserve old functionality */
|
||||
if (prec->nobt == 0)
|
||||
prec->mask = 0xffffffff;
|
||||
|
||||
prec->mask <<= prec->shft;
|
||||
return 0;
|
||||
}
|
||||
@@ -61,7 +62,7 @@ static long read_mbbi(mbbiDirectRecord *prec)
|
||||
{
|
||||
if (!dbGetLink(&prec->inp, DBR_LONG, &prec->rval, 0, 0)) {
|
||||
prec->rval &= prec->mask;
|
||||
if (prec->tsel.type == CONSTANT &&
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
}
|
||||
|
||||
@@ -48,19 +48,18 @@ epicsExportAddress(dset, devMbbiSoft);
|
||||
|
||||
static long init_record(mbbiRecord *prec)
|
||||
{
|
||||
if (prec->inp.type == CONSTANT) {
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long read_mbbi(mbbiRecord *prec)
|
||||
{
|
||||
if (!dbGetLink(&prec->inp, DBR_USHORT, &prec->val, 0, 0)) {
|
||||
if (prec->inp.type != CONSTANT)
|
||||
prec->udf = FALSE;
|
||||
if (prec->tsel.type == CONSTANT &&
|
||||
prec->udf = FALSE;
|
||||
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
}
|
||||
|
||||
@@ -48,11 +48,12 @@ epicsExportAddress(dset, devMbbiSoftRaw);
|
||||
|
||||
static long init_record(mbbiRecord *prec)
|
||||
{
|
||||
if (prec->inp.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval);
|
||||
}
|
||||
/*to preserve old functionality*/
|
||||
if (prec->nobt == 0) prec->mask = 0xffffffff;
|
||||
recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval);
|
||||
|
||||
/* Preserve old functionality*/
|
||||
if (prec->nobt == 0)
|
||||
prec->mask = 0xffffffff;
|
||||
|
||||
prec->mask <<= prec->shft;
|
||||
return 0;
|
||||
}
|
||||
@@ -61,7 +62,7 @@ static long read_mbbi(mbbiRecord *prec)
|
||||
{
|
||||
if (!dbGetLink(&prec->inp, DBR_LONG, &prec->rval, 0, 0)) {
|
||||
prec->rval &= prec->mask;
|
||||
if (prec->tsel.type == CONSTANT &&
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
}
|
||||
|
||||
@@ -48,10 +48,16 @@ epicsExportAddress(dset, devSASoft);
|
||||
|
||||
static long init_record(subArrayRecord *prec)
|
||||
{
|
||||
if (prec->inp.type == CONSTANT) {
|
||||
prec->nord = 0;
|
||||
long nelm = prec->nelm;
|
||||
long status = dbLoadLinkArray(&prec->inp, prec->ftvl, prec->bptr, &nelm);
|
||||
|
||||
if (!status && nelm > 0) {
|
||||
prec->nord = nelm;
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
return 0;
|
||||
else
|
||||
prec->nord = 0;
|
||||
return status;
|
||||
}
|
||||
|
||||
static long read_sa(subArrayRecord *prec)
|
||||
@@ -62,7 +68,7 @@ static long read_sa(subArrayRecord *prec)
|
||||
if (nRequest > prec->malm)
|
||||
nRequest = prec->malm;
|
||||
|
||||
if (prec->inp.type == CONSTANT)
|
||||
if (dbLinkIsConstant(&prec->inp))
|
||||
nRequest = prec->nord;
|
||||
else
|
||||
dbGetLink(&prec->inp, prec->ftvl, prec->bptr, 0, &nRequest);
|
||||
@@ -81,7 +87,7 @@ static long read_sa(subArrayRecord *prec)
|
||||
prec->nord = ecount;
|
||||
|
||||
if (nRequest > 0 &&
|
||||
prec->tsel.type == CONSTANT &&
|
||||
dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
|
||||
|
||||
@@ -50,10 +50,8 @@ epicsExportAddress(dset, devSiSoft);
|
||||
|
||||
static long init_record(stringinRecord *prec)
|
||||
{
|
||||
if (prec->inp.type == CONSTANT) {
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_STRING, prec->val))
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_STRING, prec->val))
|
||||
prec->udf = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -63,9 +61,9 @@ static long read_stringin(stringinRecord *prec)
|
||||
|
||||
status = dbGetLink(&prec->inp, DBR_STRING, prec->val, 0, 0);
|
||||
if (!status) {
|
||||
if (prec->inp.type != CONSTANT)
|
||||
if (!dbLinkIsConstant(&prec->inp))
|
||||
prec->udf = FALSE;
|
||||
if (prec->tsel.type == CONSTANT &&
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,9 @@ static long read_wf(waveformRecord *prec)
|
||||
|
||||
if (!status && nRequest > 0) {
|
||||
prec->nord = nRequest;
|
||||
if (prec->tsel.type == CONSTANT &&
|
||||
prec->udf = FALSE;
|
||||
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
}
|
||||
|
||||
@@ -121,22 +121,17 @@ static long init_record(aSubRecord *prec, int pass)
|
||||
}
|
||||
|
||||
/* Initialize the Subroutine Name Link */
|
||||
if (prec->subl.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->subl, DBF_STRING, prec->snam);
|
||||
}
|
||||
recGblInitConstantLink(&prec->subl, DBF_STRING, prec->snam);
|
||||
|
||||
/* Initialize Input Links */
|
||||
for (i = 0; i < NUM_ARGS; i++) {
|
||||
struct link *plink = &(&prec->inpa)[i];
|
||||
short dbr = (&prec->fta)[i];
|
||||
long n = (&prec->noa)[i];
|
||||
|
||||
if (plink->type == CONSTANT) {
|
||||
short dbr = (&prec->fta)[i];
|
||||
long n = (&prec->noa)[i];
|
||||
|
||||
dbLoadLinkArray(plink, dbr, (&prec->a)[i], &n);
|
||||
if (n > 0)
|
||||
(&prec->nea)[i] = n;
|
||||
}
|
||||
dbLoadLinkArray(plink, dbr, (&prec->a)[i], &n);
|
||||
if (n > 0)
|
||||
(&prec->nea)[i] = n;
|
||||
}
|
||||
|
||||
/* Call the user initialization routine if there is one */
|
||||
|
||||
@@ -140,9 +140,7 @@ static long init_record(aaiRecord *prec, int pass)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (prec->siml.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm);
|
||||
}
|
||||
recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm);
|
||||
|
||||
/* must have read_aai function defined */
|
||||
if (pdset->number < 5 || pdset->read_aai == NULL) {
|
||||
|
||||
@@ -140,9 +140,7 @@ static long init_record(aaoRecord *prec, int pass)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (prec->siml.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm);
|
||||
}
|
||||
recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm);
|
||||
|
||||
/* must have write_aao function defined */
|
||||
if (pdset->number < 5 || pdset->write_aao == NULL) {
|
||||
|
||||
@@ -111,13 +111,8 @@ static long init_record(void *precord,int pass)
|
||||
|
||||
if (pass==0) return(0);
|
||||
|
||||
if (prec->siml.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm);
|
||||
}
|
||||
|
||||
if (prec->siol.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->siol,DBF_DOUBLE,&prec->sval);
|
||||
}
|
||||
recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm);
|
||||
recGblInitConstantLink(&prec->siol,DBF_DOUBLE,&prec->sval);
|
||||
|
||||
if(!(pdset = (aidset *)(prec->dset))) {
|
||||
recGblRecordError(S_dev_noDSET,(void *)prec,"ai: init_record");
|
||||
|
||||
@@ -110,19 +110,15 @@ static long init_record(aoRecord *prec, int pass)
|
||||
|
||||
if (pass==0) return(0);
|
||||
|
||||
if (prec->siml.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm);
|
||||
}
|
||||
recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm);
|
||||
|
||||
if(!(pdset = (struct aodset *)(prec->dset))) {
|
||||
recGblRecordError(S_dev_noDSET,(void *)prec,"ao: init_record");
|
||||
return(S_dev_noDSET);
|
||||
}
|
||||
/* get the initial value if dol is a constant*/
|
||||
if (prec->dol.type == CONSTANT) {
|
||||
if(recGblInitConstantLink(&prec->dol,DBF_DOUBLE,&prec->val))
|
||||
prec->udf = isnan(prec->val);
|
||||
}
|
||||
if (recGblInitConstantLink(&prec->dol,DBF_DOUBLE,&prec->val))
|
||||
prec->udf = isnan(prec->val);
|
||||
|
||||
/* must have write_ao function defined */
|
||||
if ((pdset->number < 6) || (pdset->write_ao ==NULL)) {
|
||||
@@ -189,8 +185,8 @@ static long process(aoRecord *prec)
|
||||
|
||||
/* fetch value and convert*/
|
||||
if (prec->pact == FALSE) {
|
||||
if ((prec->dol.type != CONSTANT)
|
||||
&& (prec->omsl == menuOmslclosed_loop)) {
|
||||
if (!dbLinkIsConstant(&prec->dol) &&
|
||||
prec->omsl == menuOmslclosed_loop) {
|
||||
status = fetch_value(prec, &value);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -132,43 +132,40 @@ static void myCallbackFunc(CALLBACK *arg)
|
||||
|
||||
static long init_record(boRecord *prec,int pass)
|
||||
{
|
||||
struct bodset *pdset;
|
||||
long status=0;
|
||||
struct bodset *pdset = (struct bodset *) prec->dset;
|
||||
unsigned short ival = 0;
|
||||
long status = 0;
|
||||
myCallback *pcallback;
|
||||
|
||||
if (pass==0) return(0);
|
||||
if (pass == 0)
|
||||
return 0;
|
||||
|
||||
if (prec->siml.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm);
|
||||
recGblInitConstantLink(&prec->siml, DBF_USHORT, &prec->simm);
|
||||
|
||||
if (!pdset) {
|
||||
recGblRecordError(S_dev_noDSET, prec, "bo: init_record");
|
||||
return S_dev_noDSET;
|
||||
}
|
||||
|
||||
if(!(pdset = (struct bodset *)(prec->dset))) {
|
||||
recGblRecordError(S_dev_noDSET,(void *)prec,"bo: init_record");
|
||||
return(S_dev_noDSET);
|
||||
}
|
||||
/* must have write_bo functions defined */
|
||||
if( (pdset->number < 5) || (pdset->write_bo == NULL) ) {
|
||||
recGblRecordError(S_dev_missingSup,(void *)prec,"bo: init_record");
|
||||
return(S_dev_missingSup);
|
||||
if ((pdset->number < 5) || (pdset->write_bo == NULL)) {
|
||||
recGblRecordError(S_dev_missingSup, prec, "bo: init_record");
|
||||
return S_dev_missingSup;
|
||||
}
|
||||
|
||||
/* get the initial value */
|
||||
if (prec->dol.type == CONSTANT) {
|
||||
unsigned short ival = 0;
|
||||
|
||||
if(recGblInitConstantLink(&prec->dol,DBF_USHORT,&ival)) {
|
||||
if (ival == 0) prec->val = 0;
|
||||
else prec->val = 1;
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
if (recGblInitConstantLink(&prec->dol, DBF_USHORT, &ival)) {
|
||||
prec->val = !!ival;
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
|
||||
pcallback = (myCallback *)(calloc(1,sizeof(myCallback)));
|
||||
prec->rpvt = (void *)pcallback;
|
||||
callbackSetCallback(myCallbackFunc,&pcallback->callback);
|
||||
callbackSetUser(pcallback,&pcallback->callback);
|
||||
pcallback->precord = (struct dbCommon *)prec;
|
||||
pcallback = (myCallback *) calloc(1, sizeof(myCallback));
|
||||
prec->rpvt = pcallback;
|
||||
callbackSetCallback(myCallbackFunc, &pcallback->callback);
|
||||
callbackSetUser(pcallback, &pcallback->callback);
|
||||
pcallback->precord = (struct dbCommon *) prec;
|
||||
|
||||
if( pdset->init_record ) {
|
||||
if (pdset->init_record) {
|
||||
status=(*pdset->init_record)(prec);
|
||||
if(status==0) {
|
||||
if(prec->rval==0) prec->val = 0;
|
||||
@@ -202,7 +199,8 @@ static long process(boRecord *prec)
|
||||
return(S_dev_missingSup);
|
||||
}
|
||||
if (!prec->pact) {
|
||||
if ((prec->dol.type != CONSTANT) && (prec->omsl == menuOmslclosed_loop)){
|
||||
if (!dbLinkIsConstant(&prec->dol) &&
|
||||
prec->omsl == menuOmslclosed_loop) {
|
||||
unsigned short val;
|
||||
|
||||
prec->pact = TRUE;
|
||||
|
||||
@@ -100,9 +100,7 @@ static long init_record(calcRecord *prec, int pass)
|
||||
plink = &prec->inpa;
|
||||
pvalue = &prec->a;
|
||||
for (i = 0; i < CALCPERFORM_NARGS; i++, plink++, pvalue++) {
|
||||
if (plink->type == CONSTANT) {
|
||||
recGblInitConstantLink(plink, DBF_DOUBLE, pvalue);
|
||||
}
|
||||
recGblInitConstantLink(plink, DBF_DOUBLE, pvalue);
|
||||
}
|
||||
if (postfix(prec->calc, prec->rpcl, &error_number)) {
|
||||
recGblRecordError(S_db_badField, (void *)prec,
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "dbEvent.h"
|
||||
#include "dbLink.h"
|
||||
#include "dbScan.h"
|
||||
#include "cantProceed.h"
|
||||
#include "epicsMath.h"
|
||||
@@ -141,42 +142,57 @@ static long init_record(calcoutRecord *prec, int pass)
|
||||
epicsEnum16 *plinkValid;
|
||||
short error_number;
|
||||
calcoutDSET *pcalcoutDSET;
|
||||
|
||||
DBADDR dbaddr;
|
||||
DBADDR *pAddr = &dbaddr;
|
||||
rpvtStruct *prpvt;
|
||||
|
||||
if (pass == 0) {
|
||||
prec->rpvt = (rpvtStruct *) callocMustSucceed(1, sizeof(rpvtStruct), "calcoutRecord");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(pcalcoutDSET = (calcoutDSET *)prec->dset)) {
|
||||
recGblRecordError(S_dev_noDSET, (void *)prec, "calcout:init_record");
|
||||
return S_dev_noDSET;
|
||||
}
|
||||
|
||||
/* must have write defined */
|
||||
if ((pcalcoutDSET->number < 5) || (pcalcoutDSET->write ==NULL)) {
|
||||
recGblRecordError(S_dev_missingSup, (void *)prec, "calcout:init_record");
|
||||
return S_dev_missingSup;
|
||||
}
|
||||
|
||||
prpvt = prec->rpvt;
|
||||
plink = &prec->inpa;
|
||||
pvalue = &prec->a;
|
||||
plinkValid = &prec->inav;
|
||||
|
||||
for (i = 0; i <= CALCPERFORM_NARGS; i++, plink++, pvalue++, plinkValid++) {
|
||||
if (plink->type == CONSTANT) {
|
||||
/* Don't InitConstantLink the .OUT link */
|
||||
if (i < CALCPERFORM_NARGS) {
|
||||
recGblInitConstantLink(plink, DBF_DOUBLE, pvalue);
|
||||
}
|
||||
/* Don't InitConstantLink the .OUT link */
|
||||
if (i < CALCPERFORM_NARGS) {
|
||||
recGblInitConstantLink(plink, DBF_DOUBLE, pvalue);
|
||||
}
|
||||
|
||||
if (dbLinkIsConstant(plink)) {
|
||||
*plinkValid = calcoutINAV_CON;
|
||||
} else if (!dbNameToAddr(plink->value.pv_link.pvname, pAddr)) {
|
||||
/* PV resides on this ioc */
|
||||
}
|
||||
else if (dbLinkIsVolatile(plink)) {
|
||||
int conn = dbIsLinkConnected(plink);
|
||||
|
||||
if (conn)
|
||||
*plinkValid = calcoutINAV_EXT;
|
||||
else {
|
||||
/* Monitor for connection */
|
||||
*plinkValid = calcoutINAV_EXT_NC;
|
||||
prpvt->caLinkStat = CA_LINKS_NOT_OK;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* PV must reside on this ioc */
|
||||
*plinkValid = calcoutINAV_LOC;
|
||||
} else {
|
||||
/* pv is not on this ioc. Callback later for connection stat */
|
||||
*plinkValid = calcoutINAV_EXT_NC;
|
||||
prpvt->caLinkStat = CA_LINKS_NOT_OK;
|
||||
|
||||
if (!dbIsLinkConnected(plink)) {
|
||||
errlogPrintf("calcout: %s.INP%c in no-vo disco state\n",
|
||||
prec->name, i+'A');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,8 +314,6 @@ static long special(DBADDR *paddr, int after)
|
||||
{
|
||||
calcoutRecord *prec = (calcoutRecord *)paddr->precord;
|
||||
rpvtStruct *prpvt = prec->rpvt;
|
||||
DBADDR dbaddr;
|
||||
DBADDR *pAddr = &dbaddr;
|
||||
short error_number;
|
||||
int fieldIndex = dbGetFieldIndex(paddr);
|
||||
int lnkIndex;
|
||||
@@ -347,23 +361,35 @@ static long special(DBADDR *paddr, int after)
|
||||
plink = &prec->inpa + lnkIndex;
|
||||
pvalue = &prec->a + lnkIndex;
|
||||
plinkValid = &prec->inav + lnkIndex;
|
||||
if (plink->type == CONSTANT) {
|
||||
if (fieldIndex != calcoutRecordOUT) {
|
||||
recGblInitConstantLink(plink, DBF_DOUBLE, pvalue);
|
||||
db_post_events(prec, pvalue, DBE_VALUE);
|
||||
}
|
||||
|
||||
if (fieldIndex != calcoutRecordOUT)
|
||||
recGblInitConstantLink(plink, DBF_DOUBLE, pvalue);
|
||||
if (dbLinkIsConstant(plink)) {
|
||||
db_post_events(prec, pvalue, DBE_VALUE);
|
||||
*plinkValid = calcoutINAV_CON;
|
||||
} else if (!dbNameToAddr(plink->value.pv_link.pvname, pAddr)) {
|
||||
/* if the PV resides on this ioc */
|
||||
} else if (dbLinkIsVolatile(plink)) {
|
||||
int conn = dbIsLinkConnected(plink);
|
||||
|
||||
if (conn)
|
||||
*plinkValid = calcoutINAV_EXT;
|
||||
else {
|
||||
/* Monitor for connection */
|
||||
*plinkValid = calcoutINAV_EXT_NC;
|
||||
/* DO_CALLBACK, if not already scheduled */
|
||||
if (!prpvt->cbScheduled) {
|
||||
callbackRequestDelayed(&prpvt->checkLinkCb, .5);
|
||||
prpvt->cbScheduled = 1;
|
||||
prpvt->caLinkStat = CA_LINKS_NOT_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* PV must reside on this ioc */
|
||||
*plinkValid = calcoutINAV_LOC;
|
||||
} else {
|
||||
/* pv is not on this ioc. Callback later for connection stat */
|
||||
*plinkValid = calcoutINAV_EXT_NC;
|
||||
/* DO_CALLBACK, if not already scheduled */
|
||||
if (!prpvt->cbScheduled) {
|
||||
callbackRequestDelayed(&prpvt->checkLinkCb, .5);
|
||||
prpvt->cbScheduled = 1;
|
||||
prpvt->caLinkStat = CA_LINKS_NOT_OK;
|
||||
|
||||
if (!dbIsLinkConnected(plink)) {
|
||||
errlogPrintf("calcout: %s.INP%c in no-vo diso state\n",
|
||||
prec->name, lnkIndex);
|
||||
}
|
||||
}
|
||||
db_post_events(prec, plinkValid, DBE_VALUE);
|
||||
@@ -706,9 +732,9 @@ static void checkLinks(calcoutRecord *prec)
|
||||
plinkValid = &prec->inav;
|
||||
|
||||
for (i = 0; i<CALCPERFORM_NARGS+1; i++, plink++, plinkValid++) {
|
||||
if (plink->type == CA_LINK) {
|
||||
if (dbLinkIsVolatile(plink) == 1) {
|
||||
caLink = 1;
|
||||
stat = dbCaIsLinkConnected(plink);
|
||||
stat = dbIsLinkConnected(plink);
|
||||
if (!stat && (*plinkValid == calcoutINAV_EXT_NC)) {
|
||||
caLinkNc = 1;
|
||||
}
|
||||
|
||||
@@ -95,24 +95,27 @@ static void push_values(dfanoutRecord *);
|
||||
|
||||
static long init_record(dfanoutRecord *prec, int pass)
|
||||
{
|
||||
if (pass==0) return(0);
|
||||
if (pass==0)
|
||||
return 0;
|
||||
|
||||
recGblInitConstantLink(&prec->sell, DBF_USHORT, &prec->seln);
|
||||
|
||||
recGblInitConstantLink(&prec->sell,DBF_USHORT,&prec->seln);
|
||||
/* get the initial value dol is a constant*/
|
||||
if(recGblInitConstantLink(&prec->dol,DBF_DOUBLE,&prec->val))
|
||||
prec->udf = isnan(prec->val);
|
||||
return(0);
|
||||
if (recGblInitConstantLink(&prec->dol, DBF_DOUBLE, &prec->val))
|
||||
prec->udf = isnan(prec->val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long process(dfanoutRecord *prec)
|
||||
{
|
||||
long status=0;
|
||||
|
||||
if (!prec->pact
|
||||
&& (prec->dol.type != CONSTANT)
|
||||
&& (prec->omsl == menuOmslclosed_loop)){
|
||||
status = dbGetLink(&(prec->dol),DBR_DOUBLE,&(prec->val),0,0);
|
||||
if(prec->dol.type!=CONSTANT && RTN_SUCCESS(status))
|
||||
if (!prec->pact &&
|
||||
!dbLinkIsConstant(&prec->dol) &&
|
||||
prec->omsl == menuOmslclosed_loop) {
|
||||
status = dbGetLink(&prec->dol, DBR_DOUBLE, &prec->val, 0, 0);
|
||||
if (!dbLinkIsConstant(&prec->dol) && !status)
|
||||
prec->udf = isnan(prec->val);
|
||||
}
|
||||
prec->pact = TRUE;
|
||||
|
||||
@@ -100,13 +100,8 @@ static long init_record(eventRecord *prec, int pass)
|
||||
|
||||
if (pass==0) return(0);
|
||||
|
||||
if (prec->siml.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm);
|
||||
}
|
||||
|
||||
if (prec->siol.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->siol,DBF_STRING,&prec->sval);
|
||||
}
|
||||
recGblInitConstantLink(&prec->siml, DBF_USHORT, &prec->simm);
|
||||
recGblInitConstantLink(&prec->siol, DBF_STRING, &prec->sval);
|
||||
|
||||
prec->epvt = eventNameToHandle(prec->val);
|
||||
|
||||
|
||||
@@ -106,8 +106,7 @@ static long process(fanoutRecord *prec)
|
||||
case fanoutSELM_All:
|
||||
plink = &prec->lnk0;
|
||||
for (i = 0; i < NLINKS; i++, plink++) {
|
||||
if (plink->type != CONSTANT)
|
||||
dbScanFwdLink(plink);
|
||||
dbScanFwdLink(plink);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -134,7 +133,7 @@ static long process(fanoutRecord *prec)
|
||||
break;
|
||||
plink = &prec->lnk0;
|
||||
for (i = 0; i < NLINKS; i++, seln >>= 1, plink++) {
|
||||
if (seln & 1 && plink->type != CONSTANT)
|
||||
if (seln & 1)
|
||||
dbScanFwdLink(plink);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -183,13 +183,8 @@ static long init_record(histogramRecord *prec, int pass)
|
||||
|
||||
wdogInit(prec);
|
||||
|
||||
if (prec->siml.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->siml, DBF_USHORT, &prec->simm);
|
||||
}
|
||||
|
||||
if (prec->siol.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->siol, DBF_DOUBLE, &prec->sval);
|
||||
}
|
||||
recGblInitConstantLink(&prec->siml, DBF_USHORT, &prec->simm);
|
||||
recGblInitConstantLink(&prec->siol, DBF_DOUBLE, &prec->sval);
|
||||
|
||||
/* must have device support defined */
|
||||
pdset = (struct histogramdset *) prec->dset;
|
||||
|
||||
@@ -98,35 +98,36 @@ static long readValue(longinRecord *prec);
|
||||
|
||||
static long init_record(longinRecord *prec, int pass)
|
||||
{
|
||||
struct longindset *pdset;
|
||||
long status;
|
||||
struct longindset *pdset = (struct longindset *) prec->dset;
|
||||
|
||||
if (pass==0) return(0);
|
||||
if (pass==0)
|
||||
return(0);
|
||||
|
||||
if (prec->siml.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm);
|
||||
recGblInitConstantLink(&prec->siml, DBF_USHORT, &prec->simm);
|
||||
recGblInitConstantLink(&prec->siol, DBF_LONG, &prec->sval);
|
||||
|
||||
if (!pdset) {
|
||||
recGblRecordError(S_dev_noDSET, prec, "longin: init_record");
|
||||
return S_dev_noDSET;
|
||||
}
|
||||
|
||||
if (prec->siol.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->siol,DBF_LONG,&prec->sval);
|
||||
}
|
||||
|
||||
if(!(pdset = (struct longindset *)(prec->dset))) {
|
||||
recGblRecordError(S_dev_noDSET,(void *)prec,"longin: init_record");
|
||||
return(S_dev_noDSET);
|
||||
}
|
||||
/* must have read_longin function defined */
|
||||
if( (pdset->number < 5) || (pdset->read_longin == NULL) ) {
|
||||
recGblRecordError(S_dev_missingSup,(void *)prec,"longin: init_record");
|
||||
return(S_dev_missingSup);
|
||||
if ((pdset->number < 5) || (pdset->read_longin == NULL)) {
|
||||
recGblRecordError(S_dev_missingSup, prec, "longin: init_record");
|
||||
return S_dev_missingSup;
|
||||
}
|
||||
if( pdset->init_record ) {
|
||||
if((status=(*pdset->init_record)(prec))) return(status);
|
||||
|
||||
if (pdset->init_record) {
|
||||
long status = pdset->init_record(prec);
|
||||
|
||||
if (status)
|
||||
return status;
|
||||
}
|
||||
|
||||
prec->mlst = prec->val;
|
||||
prec->alst = prec->val;
|
||||
prec->lalm = prec->val;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long process(longinRecord *prec)
|
||||
|
||||
@@ -95,33 +95,38 @@ static void convert(longoutRecord *prec, epicsInt32 value);
|
||||
|
||||
static long init_record(longoutRecord *prec, int pass)
|
||||
{
|
||||
struct longoutdset *pdset;
|
||||
long status=0;
|
||||
struct longoutdset *pdset = (struct longoutdset *) prec->dset;
|
||||
|
||||
if (pass==0) return(0);
|
||||
if (prec->siml.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm);
|
||||
}
|
||||
if(!(pdset = (struct longoutdset *)(prec->dset))) {
|
||||
recGblRecordError(S_dev_noDSET,(void *)prec,"longout: init_record");
|
||||
return(S_dev_noDSET);
|
||||
if (pass==0)
|
||||
return 0;
|
||||
|
||||
recGblInitConstantLink(&prec->siml, DBF_USHORT, &prec->simm);
|
||||
|
||||
if (!pdset) {
|
||||
recGblRecordError(S_dev_noDSET, prec, "longout: init_record");
|
||||
return S_dev_noDSET;
|
||||
}
|
||||
|
||||
/* must have write_longout functions defined */
|
||||
if( (pdset->number < 5) || (pdset->write_longout == NULL) ) {
|
||||
recGblRecordError(S_dev_missingSup,(void *)prec,"longout: init_record");
|
||||
return(S_dev_missingSup);
|
||||
if ((pdset->number < 5) || (pdset->write_longout == NULL)) {
|
||||
recGblRecordError(S_dev_missingSup, prec, "longout: init_record");
|
||||
return S_dev_missingSup;
|
||||
}
|
||||
if (prec->dol.type == CONSTANT) {
|
||||
if(recGblInitConstantLink(&prec->dol,DBF_LONG,&prec->val))
|
||||
prec->udf=FALSE;
|
||||
}
|
||||
if( pdset->init_record ) {
|
||||
if((status=(*pdset->init_record)(prec))) return(status);
|
||||
|
||||
if (recGblInitConstantLink(&prec->dol, DBF_LONG, &prec->val))
|
||||
prec->udf=FALSE;
|
||||
|
||||
if (pdset->init_record) {
|
||||
long status = pdset->init_record(prec);
|
||||
|
||||
if (status)
|
||||
return status;
|
||||
}
|
||||
|
||||
prec->mlst = prec->val;
|
||||
prec->alst = prec->val;
|
||||
prec->lalm = prec->val;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long process(longoutRecord *prec)
|
||||
@@ -137,11 +142,10 @@ static long process(longoutRecord *prec)
|
||||
return(S_dev_missingSup);
|
||||
}
|
||||
if (!prec->pact) {
|
||||
if((prec->dol.type != CONSTANT)
|
||||
&& (prec->omsl == menuOmslclosed_loop)) {
|
||||
status = dbGetLink(&(prec->dol),DBR_LONG,
|
||||
&value,0,0);
|
||||
if (prec->dol.type!=CONSTANT && RTN_SUCCESS(status))
|
||||
if (!dbLinkIsConstant(&prec->dol) &&
|
||||
prec->omsl == menuOmslclosed_loop) {
|
||||
status = dbGetLink(&prec->dol, DBR_LONG, &value, 0, 0);
|
||||
if (!dbLinkIsConstant(&prec->dol) && !status)
|
||||
prec->udf=FALSE;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -114,11 +114,8 @@ static long init_record(mbbiDirectRecord *prec, int pass)
|
||||
return S_dev_missingSup;
|
||||
}
|
||||
|
||||
if (prec->siml.type == CONSTANT)
|
||||
recGblInitConstantLink(&prec->siml, DBF_USHORT, &prec->simm);
|
||||
|
||||
if (prec->siol.type == CONSTANT)
|
||||
recGblInitConstantLink(&prec->siol, DBF_USHORT, &prec->sval);
|
||||
recGblInitConstantLink(&prec->siml, DBF_USHORT, &prec->simm);
|
||||
recGblInitConstantLink(&prec->siol, DBF_USHORT, &prec->sval);
|
||||
|
||||
/* Initialize MASK if the user set NOBT instead */
|
||||
if (prec->mask == 0 && prec->nobt <= 32)
|
||||
|
||||
@@ -131,11 +131,8 @@ static long init_record(mbbiRecord *prec, int pass)
|
||||
return S_dev_missingSup;
|
||||
}
|
||||
|
||||
if (prec->siml.type == CONSTANT)
|
||||
recGblInitConstantLink(&prec->siml, DBF_USHORT, &prec->simm);
|
||||
|
||||
if (prec->siol.type == CONSTANT)
|
||||
recGblInitConstantLink(&prec->siol, DBF_USHORT, &prec->sval);
|
||||
recGblInitConstantLink(&prec->siml, DBF_USHORT, &prec->simm);
|
||||
recGblInitConstantLink(&prec->siol, DBF_USHORT, &prec->sval);
|
||||
|
||||
/* Initialize MASK if the user set NOBT instead */
|
||||
if (prec->mask == 0 && prec->nobt <= 32)
|
||||
|
||||
@@ -116,12 +116,9 @@ static long init_record(mbboDirectRecord *prec, int pass)
|
||||
return S_dev_missingSup;
|
||||
}
|
||||
|
||||
if (prec->siml.type == CONSTANT)
|
||||
recGblInitConstantLink(&prec->siml, DBF_USHORT, &prec->simm);
|
||||
|
||||
if (prec->dol.type == CONSTANT)
|
||||
if (recGblInitConstantLink(&prec->dol, DBF_USHORT, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
recGblInitConstantLink(&prec->siml, DBF_USHORT, &prec->simm);
|
||||
if (recGblInitConstantLink(&prec->dol, DBF_USHORT, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
/* Initialize MASK if the user set NOBT instead */
|
||||
if (prec->mask == 0 && prec->nobt <= 32)
|
||||
@@ -175,7 +172,7 @@ static long process(mbboDirectRecord *prec)
|
||||
}
|
||||
|
||||
if (!pact) {
|
||||
if (prec->dol.type != CONSTANT &&
|
||||
if (!dbLinkIsConstant(&prec->dol) &&
|
||||
prec->omsl == menuOmslclosed_loop) {
|
||||
epicsUInt16 val;
|
||||
|
||||
|
||||
@@ -136,12 +136,9 @@ static long init_record(mbboRecord *prec, int pass)
|
||||
return S_dev_missingSup;
|
||||
}
|
||||
|
||||
if (prec->siml.type == CONSTANT)
|
||||
recGblInitConstantLink(&prec->siml, DBF_USHORT, &prec->simm);
|
||||
|
||||
if (prec->dol.type == CONSTANT)
|
||||
if (recGblInitConstantLink(&prec->dol, DBF_USHORT, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
recGblInitConstantLink(&prec->siml, DBF_USHORT, &prec->simm);
|
||||
if (recGblInitConstantLink(&prec->dol, DBF_USHORT, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
/* Initialize MASK if the user set NOBT instead */
|
||||
if (prec->mask == 0 && prec->nobt <= 32)
|
||||
@@ -206,7 +203,7 @@ static long process(mbboRecord *prec)
|
||||
}
|
||||
|
||||
if (!pact) {
|
||||
if (prec->dol.type != CONSTANT &&
|
||||
if (!dbLinkIsConstant(&prec->dol) &&
|
||||
prec->omsl == menuOmslclosed_loop) {
|
||||
epicsUInt16 val;
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
VALTYPE val; \
|
||||
int ok; \
|
||||
\
|
||||
if (plink->type == CONSTANT) \
|
||||
if (dbLinkIsConstant(plink)) \
|
||||
ok = recGblInitConstantLink(plink++, DBRTYPE, &val); \
|
||||
else \
|
||||
ok = ! dbGetLink(plink++, DBRTYPE, &val, 0, 0); \
|
||||
@@ -113,7 +113,7 @@ static void doPrintf(printfRecord *prec)
|
||||
epicsInt16 i;
|
||||
int ok;
|
||||
|
||||
if (plink->type == CONSTANT)
|
||||
if (dbLinkIsConstant(plink))
|
||||
ok = recGblInitConstantLink(plink++, DBR_SHORT, &i);
|
||||
else
|
||||
ok = ! dbGetLink(plink++, DBR_SHORT, &i, 0, 0);
|
||||
@@ -203,8 +203,8 @@ static void doPrintf(printfRecord *prec)
|
||||
}
|
||||
break;
|
||||
|
||||
case 's':
|
||||
if (flags & F_LONG && plink->type != CONSTANT) {
|
||||
case 's': /* FIXME: const strings are now supported */
|
||||
if (flags & F_LONG && !dbLinkIsConstant(plink)) {
|
||||
long n = vspace + 1;
|
||||
|
||||
if (precision && n > precision)
|
||||
@@ -252,7 +252,7 @@ static void doPrintf(printfRecord *prec)
|
||||
char val[MAX_STRING_SIZE];
|
||||
int ok;
|
||||
|
||||
if (plink->type == CONSTANT)
|
||||
if (dbLinkIsConstant(plink))
|
||||
ok = recGblInitConstantLink(plink++, DBR_STRING, val);
|
||||
else
|
||||
ok = ! dbGetLink(plink++, DBR_STRING, val, 0, 0);
|
||||
|
||||
@@ -92,22 +92,19 @@ static long init_record(selRecord *prec, int pass)
|
||||
int i;
|
||||
double *pvalue;
|
||||
|
||||
if (pass==0) return(0);
|
||||
if (pass==0)
|
||||
return 0;
|
||||
|
||||
/* get seln initial value if nvl is a constant*/
|
||||
if (prec->nvl.type == CONSTANT ) {
|
||||
recGblInitConstantLink(&prec->nvl,DBF_USHORT,&prec->seln);
|
||||
}
|
||||
recGblInitConstantLink(&prec->nvl, DBF_USHORT, &prec->seln);
|
||||
|
||||
plink = &prec->inpa;
|
||||
pvalue = &prec->a;
|
||||
for(i=0; i<SEL_MAX; i++, plink++, pvalue++) {
|
||||
*pvalue = epicsNAN;
|
||||
if (plink->type==CONSTANT) {
|
||||
recGblInitConstantLink(plink,DBF_DOUBLE,pvalue);
|
||||
}
|
||||
for (i=0; i<SEL_MAX; i++, plink++, pvalue++) {
|
||||
*pvalue = epicsNAN;
|
||||
recGblInitConstantLink(plink, DBF_DOUBLE, pvalue);
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long process(selRecord *prec)
|
||||
|
||||
@@ -118,13 +118,11 @@ static long init_record(seqRecord *prec, int pass)
|
||||
callbackSetUser(pseqRecPvt, &pseqRecPvt->callback);
|
||||
prec->dpvt = pseqRecPvt;
|
||||
|
||||
if (prec->sell.type == CONSTANT)
|
||||
recGblInitConstantLink(&prec->sell, DBF_USHORT, &prec->seln);
|
||||
recGblInitConstantLink(&prec->sell, DBF_USHORT, &prec->seln);
|
||||
|
||||
grp = (linkGrp *) &prec->dly0;
|
||||
for (index = 0; index < NUM_LINKS; index++, grp++) {
|
||||
if (grp->dol.type == CONSTANT)
|
||||
recGblInitConstantLink(&grp->dol, DBF_DOUBLE, &grp->dov);
|
||||
recGblInitConstantLink(&grp->dol, DBF_DOUBLE, &grp->dov);
|
||||
}
|
||||
|
||||
prec->oldn = prec->seln;
|
||||
@@ -150,8 +148,7 @@ static long process(seqRecord *prec)
|
||||
lmask = (1 << NUM_LINKS) - 1;
|
||||
else {
|
||||
/* Get SELN value */
|
||||
if (prec->sell.type != CONSTANT)
|
||||
dbGetLink(&prec->sell, DBR_USHORT, &prec->seln, 0, 0);
|
||||
dbGetLink(&prec->sell, DBR_USHORT, &prec->seln, 0, 0);
|
||||
|
||||
if (prec->selm == seqSELM_Specified) {
|
||||
int grpn = prec->seln + prec->offs;
|
||||
@@ -185,7 +182,8 @@ static long process(seqRecord *prec)
|
||||
pgrp = (linkGrp *) &prec->dly0;
|
||||
for (i = 0; lmask; lmask >>= 1) {
|
||||
if ((lmask & 1) &&
|
||||
(pgrp->lnk.type != CONSTANT || pgrp->dol.type != CONSTANT)) {
|
||||
(!dbLinkIsConstant(&pgrp->lnk) ||
|
||||
!dbLinkIsConstant(&pgrp->dol))) {
|
||||
pcb->grps[i++] = pgrp;
|
||||
}
|
||||
pgrp++;
|
||||
|
||||
@@ -95,33 +95,33 @@ static long readValue(stringinRecord *);
|
||||
static long init_record(stringinRecord *prec, int pass)
|
||||
{
|
||||
STATIC_ASSERT(sizeof(prec->oval)==sizeof(prec->val));
|
||||
struct stringindset *pdset;
|
||||
long status;
|
||||
struct stringindset *pdset = (struct stringindset *) prec->dset;
|
||||
|
||||
if (pass==0) return(0);
|
||||
if (pass==0)
|
||||
return 0;
|
||||
|
||||
if (prec->siml.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm);
|
||||
recGblInitConstantLink(&prec->siml, DBF_USHORT, &prec->simm);
|
||||
recGblInitConstantLink(&prec->siol, DBF_STRING, prec->sval);
|
||||
|
||||
if (!pdset) {
|
||||
recGblRecordError(S_dev_noDSET, prec, "stringin: init_record");
|
||||
return S_dev_noDSET;
|
||||
}
|
||||
|
||||
if (prec->siol.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->siol,DBF_STRING,prec->sval);
|
||||
}
|
||||
|
||||
if(!(pdset = (struct stringindset *)(prec->dset))) {
|
||||
recGblRecordError(S_dev_noDSET,(void *)prec,"stringin: init_record");
|
||||
return(S_dev_noDSET);
|
||||
}
|
||||
/* must have read_stringin function defined */
|
||||
if( (pdset->number < 5) || (pdset->read_stringin == NULL) ) {
|
||||
recGblRecordError(S_dev_missingSup,(void *)prec,"stringin: init_record");
|
||||
return(S_dev_missingSup);
|
||||
if ((pdset->number < 5) || (pdset->read_stringin == NULL)) {
|
||||
recGblRecordError(S_dev_missingSup, prec, "stringin: init_record");
|
||||
return S_dev_missingSup;
|
||||
}
|
||||
if( pdset->init_record ) {
|
||||
if((status=(*pdset->init_record)(prec))) return(status);
|
||||
|
||||
if (pdset->init_record) {
|
||||
long status = pdset->init_record(prec);
|
||||
|
||||
if (status)
|
||||
return status;
|
||||
}
|
||||
strcpy(prec->oval,prec->val);
|
||||
return(0);
|
||||
strcpy(prec->oval, prec->val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -97,34 +97,37 @@ static long writeValue(stringoutRecord *);
|
||||
static long init_record(stringoutRecord *prec, int pass)
|
||||
{
|
||||
STATIC_ASSERT(sizeof(prec->oval)==sizeof(prec->val));
|
||||
struct stringoutdset *pdset;
|
||||
long status=0;
|
||||
struct stringoutdset *pdset = (struct stringoutdset *) prec->dset;
|
||||
|
||||
if (pass==0) return(0);
|
||||
if (pass==0)
|
||||
return 0;
|
||||
|
||||
if (prec->siml.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm);
|
||||
recGblInitConstantLink(&prec->siml, DBF_USHORT, &prec->simm);
|
||||
|
||||
if (!pdset) {
|
||||
recGblRecordError(S_dev_noDSET, prec, "stringout: init_record");
|
||||
return S_dev_noDSET;
|
||||
}
|
||||
|
||||
if(!(pdset = (struct stringoutdset *)(prec->dset))) {
|
||||
recGblRecordError(S_dev_noDSET,(void *)prec,"stringout: init_record");
|
||||
return(S_dev_noDSET);
|
||||
}
|
||||
/* must have write_stringout functions defined */
|
||||
if( (pdset->number < 5) || (pdset->write_stringout == NULL) ) {
|
||||
recGblRecordError(S_dev_missingSup,(void *)prec,"stringout: init_record");
|
||||
return(S_dev_missingSup);
|
||||
if ((pdset->number < 5) || (pdset->write_stringout == NULL)) {
|
||||
recGblRecordError(S_dev_missingSup, prec, "stringout: init_record");
|
||||
return S_dev_missingSup;
|
||||
}
|
||||
|
||||
/* get the initial value dol is a constant*/
|
||||
if (prec->dol.type == CONSTANT){
|
||||
if(recGblInitConstantLink(&prec->dol,DBF_STRING,prec->val))
|
||||
prec->udf=FALSE;
|
||||
if (recGblInitConstantLink(&prec->dol, DBF_STRING, prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
if (pdset->init_record) {
|
||||
long status = pdset->init_record(prec);
|
||||
|
||||
if(status)
|
||||
return status;
|
||||
}
|
||||
if( pdset->init_record ) {
|
||||
if((status=(*pdset->init_record)(prec))) return(status);
|
||||
}
|
||||
strcpy(prec->oval,prec->val);
|
||||
return(0);
|
||||
|
||||
strcpy(prec->oval, prec->val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long process(stringoutRecord *prec)
|
||||
@@ -138,13 +141,13 @@ static long process(stringoutRecord *prec)
|
||||
recGblRecordError(S_dev_missingSup,(void *)prec,"write_stringout");
|
||||
return(S_dev_missingSup);
|
||||
}
|
||||
if (!prec->pact
|
||||
&& (prec->dol.type != CONSTANT)
|
||||
&& (prec->omsl == menuOmslclosed_loop)) {
|
||||
status = dbGetLink(&(prec->dol),
|
||||
DBR_STRING,prec->val,0,0);
|
||||
if(prec->dol.type!=CONSTANT && RTN_SUCCESS(status)) prec->udf=FALSE;
|
||||
}
|
||||
if (!prec->pact &&
|
||||
!dbLinkIsConstant(&prec->dol) &&
|
||||
prec->omsl == menuOmslclosed_loop) {
|
||||
status = dbGetLink(&prec->dol, DBR_STRING, prec->val, 0, 0);
|
||||
if (!dbLinkIsConstant(&prec->dol) && !status)
|
||||
prec->udf=FALSE;
|
||||
}
|
||||
|
||||
if(prec->udf == TRUE ){
|
||||
recGblSetSevr(prec,UDF_ALARM,prec->udfs);
|
||||
|
||||
@@ -101,9 +101,7 @@ static long init_record(subRecord *prec, int pass)
|
||||
plink = &prec->inpa;
|
||||
pvalue = &prec->a;
|
||||
for (i = 0; i < INP_ARG_MAX; i++, plink++, pvalue++) {
|
||||
if (plink->type == CONSTANT) {
|
||||
recGblInitConstantLink(plink, DBF_DOUBLE, pvalue);
|
||||
}
|
||||
recGblInitConstantLink(plink, DBF_DOUBLE, pvalue);
|
||||
}
|
||||
|
||||
if (prec->inam[0]) {
|
||||
|
||||
@@ -111,9 +111,7 @@ static long init_record(waveformRecord *prec, int pass)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (prec->siml.type == CONSTANT) {
|
||||
recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm);
|
||||
}
|
||||
recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm);
|
||||
|
||||
/* must have dset defined */
|
||||
if (!(pdset = (struct wfdset *)(prec->dset))) {
|
||||
@@ -313,7 +311,7 @@ static long readValue(waveformRecord *prec)
|
||||
return (*pdset->read_wf)(prec);
|
||||
}
|
||||
|
||||
status = dbGetLink(&(prec->siml), DBR_ENUM, &(prec->simm),0,0);
|
||||
status = dbGetLink(&prec->siml, DBR_ENUM, &prec->simm, 0, 0);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
@@ -329,9 +327,9 @@ static long readValue(waveformRecord *prec)
|
||||
if (prec->simm == menuYesNoYES){
|
||||
long nRequest = prec->nelm;
|
||||
|
||||
status = dbGetLink(&(prec->siol), prec->ftvl, prec->bptr, 0, &nRequest);
|
||||
status = dbGetLink(&prec->siol, prec->ftvl, prec->bptr, 0, &nRequest);
|
||||
/* nord set only for db links: needed for old db_access */
|
||||
if (prec->siol.type != CONSTANT) {
|
||||
if (!dbLinkIsConstant(&prec->siol)) {
|
||||
prec->nord = nRequest;
|
||||
db_post_events(prec, &prec->nord, DBE_VALUE | DBE_LOG);
|
||||
if (status == 0)
|
||||
|
||||
Reference in New Issue
Block a user