Changes for udf and other problems discovered while looking at udf
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
/* devAiSoft.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devAiSoft.c - Device Support Routines for soft Analog Input Records*/
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
@@ -35,14 +33,10 @@
|
||||
* .11 10-10-92 jba replaced code with recGblGetLinkValue call
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <cvtTable.h>
|
||||
#include <dbDefs.h>
|
||||
@@ -51,7 +45,6 @@
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <aiRecord.h>
|
||||
|
||||
/* Create the dset for devAiSoft */
|
||||
static long init_record();
|
||||
static long read_ai();
|
||||
@@ -70,9 +63,9 @@ struct {
|
||||
init_record,
|
||||
NULL,
|
||||
read_ai,
|
||||
NULL };
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
static long init_record(pai)
|
||||
struct aiRecord *pai;
|
||||
{
|
||||
@@ -81,8 +74,8 @@ static long init_record(pai)
|
||||
/* ai.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/
|
||||
switch (pai->inp.type) {
|
||||
case (CONSTANT) :
|
||||
if(recGblInitConstantLink(&pai->inp,DBF_DOUBLE,&pai->val))
|
||||
pai->udf = FALSE;
|
||||
if(recGblInitConstantLink(&pai->inp,DBF_DOUBLE,&pai->val))
|
||||
pai->udf = FALSE;
|
||||
break;
|
||||
case (PV_LINK) :
|
||||
case (DB_LINK) :
|
||||
@@ -98,16 +91,13 @@ static long init_record(pai)
|
||||
pai->linr = 0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long read_ai(pai)
|
||||
struct aiRecord *pai;
|
||||
{
|
||||
long status;
|
||||
|
||||
status = dbGetLink(&(pai->inp),DBR_DOUBLE, &(pai->val),0,0);
|
||||
|
||||
if (pai->inp.type!=CONSTANT && RTN_SUCCESS(status))
|
||||
pai->udf = FALSE;
|
||||
|
||||
if (pai->inp.type!=CONSTANT && RTN_SUCCESS(status)) pai->udf = FALSE;
|
||||
return(2); /*don't convert*/
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devAiSoftRaw.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devAiSoftRaw.c - Device Support Routines for soft Analog Input Records*/
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
@@ -36,13 +34,10 @@
|
||||
* .04 10-10-92 jba replaced code with recGblGetLinkValue call
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <cvtTable.h>
|
||||
#include <dbDefs.h>
|
||||
@@ -51,7 +46,6 @@
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <aiRecord.h>
|
||||
|
||||
/* Create the dset for devAiSoftRaw */
|
||||
static long init_record();
|
||||
static long read_ai();
|
||||
@@ -71,9 +65,9 @@ struct {
|
||||
init_record,
|
||||
NULL,
|
||||
read_ai,
|
||||
special_linconv};
|
||||
special_linconv
|
||||
};
|
||||
|
||||
|
||||
static long init_record(pai)
|
||||
struct aiRecord *pai;
|
||||
{
|
||||
@@ -95,14 +89,13 @@ static long init_record(pai)
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long read_ai(pai)
|
||||
struct aiRecord *pai;
|
||||
{
|
||||
long status;
|
||||
|
||||
status = dbGetLink(&(pai->inp),DBR_LONG,&(pai->rval),0,0);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -110,8 +103,5 @@ static long special_linconv(pai,after)
|
||||
struct aiRecord *pai;
|
||||
int after;
|
||||
{
|
||||
|
||||
if(!after) return(0);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devBiSoft.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devBiSoft.c - Device Support Routines for Soft Binary Input*/
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
@@ -35,13 +33,10 @@
|
||||
* .03 10-10-92 jba replaced code with recGblGetLinkValue call
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
@@ -49,11 +44,9 @@
|
||||
#include <devSup.h>
|
||||
#include <module_types.h>
|
||||
#include <biRecord.h>
|
||||
|
||||
/* Create the dset for devBiSoft */
|
||||
static long init_record();
|
||||
static long read_bi();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
@@ -67,9 +60,9 @@ struct {
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_bi};
|
||||
read_bi
|
||||
};
|
||||
|
||||
|
||||
static long init_record(pbi)
|
||||
struct biRecord *pbi;
|
||||
{
|
||||
@@ -78,8 +71,8 @@ static long init_record(pbi)
|
||||
/* bi.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK */
|
||||
switch (pbi->inp.type) {
|
||||
case (CONSTANT) :
|
||||
if(recGblInitConstantLink(&pbi->inp,DBF_ENUM,&pbi->val))
|
||||
pbi->udf = FALSE;
|
||||
if(recGblInitConstantLink(&pbi->inp,DBF_ENUM,&pbi->val))
|
||||
pbi->udf = FALSE;
|
||||
break;
|
||||
case (DB_LINK) :
|
||||
case (PV_LINK) :
|
||||
@@ -92,15 +85,13 @@ static long init_record(pbi)
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long read_bi(pbi)
|
||||
struct biRecord *pbi;
|
||||
{
|
||||
long status;
|
||||
|
||||
status = dbGetLink(&pbi->inp, DBR_USHORT, &pbi->val,0,0);
|
||||
|
||||
if(pbi->inp.type!=CONSTANT && RTN_SUCCESS(status)) pbi->udf=FALSE;
|
||||
|
||||
return(2);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devBiSoftRaw.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devBiSoftRaw.c - Device Support Routines for Soft Binary Input*/
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
@@ -36,13 +34,10 @@
|
||||
* .04 10-10-92 jba replaced code with recGblGetLinkValue call
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
@@ -50,11 +45,9 @@
|
||||
#include <devSup.h>
|
||||
#include <module_types.h>
|
||||
#include <biRecord.h>
|
||||
|
||||
/* Create the dset for devBiSoftRaw */
|
||||
static long init_record();
|
||||
static long read_bi();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
@@ -68,9 +61,9 @@ struct {
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_bi};
|
||||
read_bi
|
||||
};
|
||||
|
||||
|
||||
static long init_record(pbi)
|
||||
struct biRecord *pbi;
|
||||
{
|
||||
@@ -92,13 +85,12 @@ static long init_record(pbi)
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long read_bi(pbi)
|
||||
struct biRecord *pbi;
|
||||
{
|
||||
long status;
|
||||
|
||||
status = dbGetLink(&pbi->inp, DBR_ULONG, &pbi->rval,0,0);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devEventSoft.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devEventSoft.c - Device Support Routines for Soft Event Input */
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 04-21-91
|
||||
@@ -34,13 +32,10 @@
|
||||
* .03 10-10-92 jba replaced code with recGblGetLinkValue call
|
||||
* .04 03-03-94 mrk Move constant link value to val only if val is zero
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
@@ -52,7 +47,6 @@
|
||||
/* Create the dset for devEventSoft */
|
||||
static long init_record();
|
||||
static long read_event();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
@@ -66,7 +60,8 @@ struct {
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_event};
|
||||
read_event
|
||||
};
|
||||
|
||||
static long init_record(pevent)
|
||||
struct eventRecord *pevent;
|
||||
@@ -76,8 +71,8 @@ static long init_record(pevent)
|
||||
/* event.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/
|
||||
switch (pevent->inp.type) {
|
||||
case (CONSTANT) :
|
||||
if(recGblInitConstantLink(&pevent->inp,DBF_USHORT,&pevent->val))
|
||||
pevent->udf = FALSE;
|
||||
if(recGblInitConstantLink(&pevent->inp,DBF_USHORT,&pevent->val))
|
||||
pevent->udf = FALSE;
|
||||
break;
|
||||
case (PV_LINK) :
|
||||
case (DB_LINK) :
|
||||
@@ -90,11 +85,11 @@ static long init_record(pevent)
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long read_event(pevent)
|
||||
struct eventRecord *pevent;
|
||||
{
|
||||
long status,options=0,nRequest=1;
|
||||
long status;
|
||||
|
||||
status = dbGetLink(&pevent->inp,DBR_USHORT,&pevent->val,0,0);
|
||||
if(pevent->inp.type!=CONSTANT && RTN_SUCCESS(status)) pevent->udf=FALSE;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devEventTestIoEvent.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devEventTestIoEvent.c - Device Support Routines for ioEvent*/
|
||||
/*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 01/09/92
|
||||
@@ -39,7 +37,6 @@
|
||||
#include <stdioLib.h>
|
||||
#include <wdLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <dbScan.h>
|
||||
@@ -63,11 +60,11 @@ struct {
|
||||
init,
|
||||
NULL,
|
||||
get_ioint_info,
|
||||
read_event};
|
||||
read_event
|
||||
};
|
||||
|
||||
static IOSCANPVT ioscanpvt;
|
||||
WDOG_ID wd_id=NULL;
|
||||
|
||||
|
||||
static long init(after)
|
||||
int after;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devHistogramSoft.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devHistogramSoft.c - Device Support Routines for soft Histogram Input */
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 07/02/91
|
||||
@@ -34,14 +32,10 @@
|
||||
* .03 03-13-92 jba ANSI C changes
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <cvtTable.h>
|
||||
#include <dbDefs.h>
|
||||
@@ -50,7 +44,6 @@
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <histogramRecord.h>
|
||||
|
||||
/* Create the dset for devHistogramSoft */
|
||||
static long init_record();
|
||||
static long read_histogram();
|
||||
@@ -69,9 +62,9 @@ struct {
|
||||
init_record,
|
||||
NULL,
|
||||
read_histogram,
|
||||
NULL};
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
static long init_record(phistogram)
|
||||
struct histogramRecord *phistogram;
|
||||
{
|
||||
@@ -80,8 +73,8 @@ static long init_record(phistogram)
|
||||
/* histogram.svl must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/
|
||||
switch (phistogram->svl.type) {
|
||||
case (CONSTANT) :
|
||||
if(recGblInitConstantLink(&phistogram->svl,DBF_DOUBLE,&phistogram->sgnl))
|
||||
phistogram->udf = FALSE;
|
||||
if(recGblInitConstantLink(&phistogram->svl,DBF_DOUBLE,&phistogram->sgnl))
|
||||
phistogram->udf = FALSE;
|
||||
break;
|
||||
case (PV_LINK) :
|
||||
case (DB_LINK) :
|
||||
@@ -94,13 +87,12 @@ static long init_record(phistogram)
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
static long read_histogram(phistogram)
|
||||
struct histogramRecord *phistogram;
|
||||
{
|
||||
long status;
|
||||
|
||||
status = dbGetLink(&phistogram->svl,DBR_DOUBLE, &phistogram->sgnl,0,0);
|
||||
|
||||
return(0); /*add count*/
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devHistogramTestAsyn.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devHistogramTestAsyn.c - Device Support Routines for testing asynchronous processing*/
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 07/02/91
|
||||
@@ -37,14 +35,12 @@
|
||||
* .06 04-05-94 mrk ANSI changes to callback routines
|
||||
* ...
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
#include <wdLib.h>
|
||||
#include <memLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <callback.h>
|
||||
#include <cvtTable.h>
|
||||
@@ -55,7 +51,7 @@
|
||||
#include <link.h>
|
||||
#include <dbCommon.h>
|
||||
#include <histogramRecord.h>
|
||||
|
||||
|
||||
/* Create the dset for devHistogramTestAsyn */
|
||||
static long init_record();
|
||||
static long read_histogram();
|
||||
@@ -107,8 +103,8 @@ static long init_record(phistogram)
|
||||
callbackSetCallback(myCallback,&pcallback->callback);
|
||||
pcallback->precord = (struct dbCommon *)phistogram;
|
||||
pcallback->wd_id = wdCreate();
|
||||
if(recGblInitConstantLink(&phistogram->svl,DBF_DOUBLE,&phistogram->sgnl))
|
||||
phistogram->udf = FALSE;
|
||||
if(recGblInitConstantLink(&phistogram->svl,DBF_DOUBLE,&phistogram->sgnl))
|
||||
phistogram->udf = FALSE;
|
||||
break;
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)phistogram,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devLiSoft.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devLiSoft.c - Device Support Routines for Soft Longin Input */
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 09-23-91
|
||||
@@ -33,8 +31,6 @@
|
||||
* .02 03-13-92 jba ANSI C changes
|
||||
* .03 10-10-92 jba replaced code with recGblGetLinkValue call
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
@@ -65,7 +61,8 @@ struct {
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_longin};
|
||||
read_longin
|
||||
};
|
||||
|
||||
static long init_record(plongin)
|
||||
struct longinRecord *plongin;
|
||||
@@ -75,8 +72,8 @@ static long init_record(plongin)
|
||||
/* longin.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/
|
||||
switch (plongin->inp.type) {
|
||||
case (CONSTANT) :
|
||||
if(recGblInitConstantLink(&plongin->inp,DBF_LONG,&plongin->val))
|
||||
plongin->udf = FALSE;
|
||||
if(recGblInitConstantLink(&plongin->inp,DBF_LONG,&plongin->val))
|
||||
plongin->udf = FALSE;
|
||||
break;
|
||||
case (PV_LINK) :
|
||||
case (DB_LINK) :
|
||||
@@ -89,7 +86,7 @@ static long init_record(plongin)
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long read_longin(plongin)
|
||||
struct longinRecord *plongin;
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devLoSoft.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devLoSoft.c - Device Support Routines for Soft Longout Output */
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 09-23-91
|
||||
@@ -33,7 +31,6 @@
|
||||
* .02 03-13-92 jba ANSI C changes
|
||||
* .03 10-10-92 jba replaced code with recGblGetLinkValue call
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
@@ -46,12 +43,9 @@
|
||||
#include <devSup.h>
|
||||
#include <module_types.h>
|
||||
#include <longoutRecord.h>
|
||||
|
||||
static long init_record();
|
||||
|
||||
/* Create the dset for devLoSoft */
|
||||
static long init_record();
|
||||
static long write_longout();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
@@ -65,8 +59,8 @@ struct {
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
write_longout};
|
||||
|
||||
write_longout
|
||||
};
|
||||
|
||||
static long init_record(plongout)
|
||||
struct longoutRecord *plongout;
|
||||
@@ -80,6 +74,5 @@ static long write_longout(plongout)
|
||||
long status;
|
||||
|
||||
status = dbPutLink(&plongout->out,DBR_LONG, &plongout->val,1);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devMbbiDirectSoft.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devMbbiDirectSoft.c - Device Support for Soft Direct Multibit Binary Input*/
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Matthew Needes
|
||||
@@ -33,8 +31,6 @@
|
||||
* (Modification log in devMbbiSoft.c applies)
|
||||
* .01 10-08-93 mcn (created) support for direct mbbi records
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
@@ -47,11 +43,9 @@
|
||||
#include <devSup.h>
|
||||
#include <module_types.h>
|
||||
#include <mbbiDirectRecord.h>
|
||||
|
||||
/* Create the dset for devMbbiSoft */
|
||||
static long init_record();
|
||||
static long read_mbbi();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
@@ -65,9 +59,9 @@ struct {
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_mbbi};
|
||||
read_mbbi
|
||||
};
|
||||
|
||||
|
||||
static long init_record(pmbbi)
|
||||
struct mbbiDirectRecord *pmbbi;
|
||||
{
|
||||
@@ -76,8 +70,8 @@ static long init_record(pmbbi)
|
||||
/* mbbi.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/
|
||||
switch (pmbbi->inp.type) {
|
||||
case (CONSTANT) :
|
||||
if(recGblInitConstantLink(&pmbbi->inp,DBF_ENUM,&pmbbi->val))
|
||||
pmbbi->udf = FALSE;
|
||||
if(recGblInitConstantLink(&pmbbi->inp,DBF_ENUM,&pmbbi->val))
|
||||
pmbbi->udf = FALSE;
|
||||
break;
|
||||
case (DB_LINK) :
|
||||
case (PV_LINK) :
|
||||
@@ -90,7 +84,7 @@ static long init_record(pmbbi)
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long read_mbbi(pmbbi)
|
||||
struct mbbiDirectRecord *pmbbi;
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devMbbiDirectSoftRaw.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devMbbiDirectSoftRaw.c - Device Support for Direct Soft MBBI */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Matthew Needes
|
||||
@@ -33,7 +31,6 @@
|
||||
* (modification log of devMbbiDirectSoftRaw applies)
|
||||
* .01 10-08-93 mcn device support for direct mbbi records.
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
@@ -46,11 +43,9 @@
|
||||
#include <devSup.h>
|
||||
#include <module_types.h>
|
||||
#include <mbbiDirectRecord.h>
|
||||
|
||||
/* Create the dset for devMbbiDirectSoftRaw */
|
||||
static long init_record();
|
||||
static long read_mbbi();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
@@ -64,9 +59,9 @@ struct {
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_mbbi};
|
||||
read_mbbi
|
||||
};
|
||||
|
||||
|
||||
static long init_record(pmbbi)
|
||||
struct mbbiDirectRecord *pmbbi;
|
||||
{
|
||||
@@ -88,13 +83,12 @@ static long init_record(pmbbi)
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long read_mbbi(pmbbi)
|
||||
struct mbbiDirectRecord *pmbbi;
|
||||
{
|
||||
long status;
|
||||
|
||||
status = dbGetLink(&pmbbi->inp,DBR_LONG,&pmbbi->rval,0,0);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devMbbiSoft.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devMbbiSoft.c - Device Support Routines for Soft Multibit Binary Input*/
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
@@ -35,13 +33,10 @@
|
||||
* .03 10-10-92 jba replaced code with recGblGetLinkValue call
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
@@ -49,12 +44,9 @@
|
||||
#include <devSup.h>
|
||||
#include <module_types.h>
|
||||
#include <mbbiRecord.h>
|
||||
|
||||
|
||||
/* Create the dset for devMbbiSoft */
|
||||
static long init_record();
|
||||
static long read_mbbi();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
@@ -68,21 +60,21 @@ struct {
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_mbbi};
|
||||
read_mbbi
|
||||
};
|
||||
|
||||
|
||||
static long init_record(pmbbi)
|
||||
struct mbbiRecord *pmbbi;
|
||||
{
|
||||
long status;
|
||||
|
||||
if (pmbbi->inp.type == CONSTANT) {
|
||||
if(recGblInitConstantLink(&pmbbi->inp,DBF_ENUM,&pmbbi->val))
|
||||
pmbbi->udf = FALSE;
|
||||
if(recGblInitConstantLink(&pmbbi->inp,DBF_ENUM,&pmbbi->val))
|
||||
pmbbi->udf = FALSE;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long read_mbbi(pmbbi)
|
||||
struct mbbiRecord *pmbbi;
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devMbbiSoftRaw.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devMbbiSoftRaw.c - Device Support Routines for Soft Multibit Binary Input*/
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
@@ -36,8 +34,6 @@
|
||||
* .04 10-10-92 jba replaced code with recGblGetLinkValue call
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
@@ -50,11 +46,9 @@
|
||||
#include <devSup.h>
|
||||
#include <module_types.h>
|
||||
#include <mbbiRecord.h>
|
||||
|
||||
/* Create the dset for devMbbiSoftRaw */
|
||||
static long init_record();
|
||||
static long read_mbbi();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
@@ -68,9 +62,9 @@ struct {
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_mbbi};
|
||||
read_mbbi
|
||||
};
|
||||
|
||||
|
||||
static long init_record(pmbbi)
|
||||
struct mbbiRecord *pmbbi;
|
||||
{
|
||||
@@ -81,7 +75,7 @@ static long init_record(pmbbi)
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long read_mbbi(pmbbi)
|
||||
struct mbbiRecord *pmbbi;
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devMbboDirectSoft.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devMbboDirectSoft.c - Device Support for Soft mbbo Direct */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Matthew Needes
|
||||
@@ -33,8 +31,6 @@
|
||||
* (log for devMbboSoft applies)
|
||||
* 1. 10-08-93 mcn (created) dev support for MbboDirect records
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
@@ -47,12 +43,9 @@
|
||||
#include <devSup.h>
|
||||
#include <module_types.h>
|
||||
#include <mbboDirectRecord.h>
|
||||
|
||||
static long init_record();
|
||||
|
||||
/* Create the dset for devMbboSoft */
|
||||
static long init_record();
|
||||
static long write_mbbo();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
@@ -66,14 +59,12 @@ struct {
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
write_mbbo};
|
||||
|
||||
|
||||
write_mbbo
|
||||
};
|
||||
|
||||
static long init_record(pmbbo)
|
||||
struct mbboDirectRecord *pmbbo;
|
||||
{
|
||||
|
||||
long status = 0;
|
||||
|
||||
/* dont convert */
|
||||
@@ -88,6 +79,5 @@ static long write_mbbo(pmbbo)
|
||||
long status;
|
||||
|
||||
status = dbPutLink(&pmbbo->out,DBR_USHORT,&pmbbo->val,1);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devMbboDirectSoftRaw.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devMbboDirectSoftRaw.c - Device Support SoftRaw Direct mbbo */
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Current Author: Matthew Needes
|
||||
@@ -33,8 +31,6 @@
|
||||
* (log for devMbboSoftRaw.c applies)
|
||||
* .01 10-08-93 mcn (created) device support for devMbboDirect records
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
@@ -48,11 +44,9 @@
|
||||
#include <module_types.h>
|
||||
#include <mbboDirectRecord.h>
|
||||
|
||||
static long init_record();
|
||||
|
||||
/* Create the dset for devMbboDirectSoftRaw */
|
||||
static long init_record();
|
||||
static long write_mbbo();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
@@ -66,9 +60,8 @@ struct {
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
write_mbbo};
|
||||
|
||||
|
||||
write_mbbo
|
||||
};
|
||||
|
||||
static long init_record(pmbbo)
|
||||
struct mbboDirectRecord *pmbbo;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devMbboSoft.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devMbboSoft.c - Device Support Routines for Soft Multibit Binary Output*/
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
@@ -36,8 +34,6 @@
|
||||
* .04 10-10-92 jba replaced code with recGblGetLinkValue call
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
@@ -50,12 +46,9 @@
|
||||
#include <devSup.h>
|
||||
#include <module_types.h>
|
||||
#include <mbboRecord.h>
|
||||
|
||||
static long init_record();
|
||||
|
||||
/* Create the dset for devMbboSoft */
|
||||
static long init_record();
|
||||
static long write_mbbo();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
@@ -69,9 +62,8 @@ struct {
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
write_mbbo};
|
||||
|
||||
|
||||
write_mbbo
|
||||
};
|
||||
|
||||
static long init_record(pmbbo)
|
||||
struct mbboRecord *pmbbo;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devMbboSoftRaw.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devMbboSoftRaw.c - Device Support Routines for SoftRaw Multibit Binary Output*/
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 3-28-92
|
||||
@@ -33,8 +31,6 @@
|
||||
* .02 10-10-92 jba replaced code with recGblGetLinkValue call
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
@@ -47,12 +43,9 @@
|
||||
#include <devSup.h>
|
||||
#include <module_types.h>
|
||||
#include <mbboRecord.h>
|
||||
|
||||
static long init_record();
|
||||
|
||||
/* Create the dset for devMbboSoftRaw */
|
||||
static long init_record();
|
||||
static long write_mbbo();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
@@ -66,9 +59,8 @@ struct {
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
write_mbbo};
|
||||
|
||||
|
||||
write_mbbo
|
||||
};
|
||||
|
||||
static long init_record(pmbbo)
|
||||
struct mbboRecord *pmbbo;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devPtSoft.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devPtSoft.c - Device Support Routines for Soft Pulse Generator Output */
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 6-1-91
|
||||
@@ -34,8 +32,6 @@
|
||||
* .03 10-10-92 jba replaced code with recGblGetLinkValue call
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
@@ -52,7 +48,6 @@
|
||||
/* Create the dset for devPtSoft */
|
||||
static long init_record();
|
||||
static long write_pt();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
@@ -66,7 +61,8 @@ struct {
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
write_pt};
|
||||
write_pt
|
||||
};
|
||||
|
||||
static long init_record(ppt)
|
||||
struct pulseTrainRecord *ppt;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devSiSoft.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devSiSoft.c - Device Support Routines for Soft String Input */
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 04-21-91
|
||||
@@ -51,7 +49,6 @@
|
||||
/* Create the dset for devSiSoft */
|
||||
static long init_record();
|
||||
static long read_stringin();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
@@ -65,7 +62,8 @@ struct {
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_stringin};
|
||||
read_stringin
|
||||
};
|
||||
|
||||
static long init_record(pstringin)
|
||||
struct stringinRecord *pstringin;
|
||||
@@ -89,7 +87,7 @@ static long init_record(pstringin)
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long read_stringin(pstringin)
|
||||
struct stringinRecord *pstringin;
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* devSoSoft.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devSoSoft.c - Device Support Routines for Soft String Output */
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 04-21-91
|
||||
@@ -50,7 +48,6 @@
|
||||
/* Create the dset for devSoSoft */
|
||||
static long init_record();
|
||||
static long write_stringout();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
@@ -64,8 +61,8 @@ struct {
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
write_stringout};
|
||||
|
||||
write_stringout
|
||||
};
|
||||
|
||||
static long init_record(pstringout)
|
||||
struct stringoutRecord *pstringout;
|
||||
@@ -79,6 +76,5 @@ static long write_stringout(pstringout)
|
||||
long status;
|
||||
|
||||
status = dbPutLink(&pstringout->out,DBR_STRING,pstringout->val,1);
|
||||
|
||||
return(status);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
@@ -56,7 +56,7 @@
|
||||
#define GEN_SIZE_OFFSET
|
||||
#include <aaiRecord.h>
|
||||
#undef GEN_SIZE_OFFSET
|
||||
|
||||
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
@@ -124,12 +124,7 @@ static long init_record(paai,pass)
|
||||
if(paai->nelm<=0) paai->nelm=1;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* aai.siml must be a CONSTANT or a PV_LINK or a DB_LINK */
|
||||
if (paai->siml.type == CONSTANT) {
|
||||
recGblInitConstantLink(&paai->siml,DBF_USHORT,&paai->simm);
|
||||
}
|
||||
|
||||
recGblInitConstantLink(&paai->siml,DBF_USHORT,&paai->simm);
|
||||
/* must have dset defined */
|
||||
if(!(pdset = (struct aaidset *)(paai->dset))) {
|
||||
recGblRecordError(S_dev_noDSET,(void *)paai,"aai: init_record");
|
||||
@@ -283,7 +278,7 @@ static void monitor(paai)
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static long readValue(paai)
|
||||
struct aaiRecord *paai;
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
@@ -56,7 +56,7 @@
|
||||
#define GEN_SIZE_OFFSET
|
||||
#include <aaoRecord.h>
|
||||
#undef GEN_SIZE_OFFSET
|
||||
|
||||
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
@@ -124,12 +124,7 @@ static long init_record(paao,pass)
|
||||
if(paao->nelm<=0) paao->nelm=1;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* aao.siml must be a CONSTANT or a PV_LINK or a DB_LINK */
|
||||
if (paao->siml.type == CONSTANT) {
|
||||
recGblInitConstantLink(&paao->siml,DBF_USHORT,&paao->simm);
|
||||
}
|
||||
|
||||
recGblInitConstantLink(&paao->siml,DBF_USHORT,&paao->simm);
|
||||
/* must have dset defined */
|
||||
if(!(pdset = (struct aaodset *)(paao->dset))) {
|
||||
recGblRecordError(S_dev_noDSET,(void *)paao,"aao: init_record");
|
||||
@@ -280,7 +275,7 @@ static void monitor(paao)
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static long writeValue(paao)
|
||||
struct aaoRecord *paao;
|
||||
{
|
||||
|
||||
@@ -132,16 +132,8 @@ static long init_record(pbi,pass)
|
||||
|
||||
if (pass==0) return(0);
|
||||
|
||||
/* bi.siml must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/
|
||||
if (pbi->siml.type == CONSTANT) {
|
||||
recGblInitConstantLink(&pbi->siml,DBF_USHORT,&pbi->simm);
|
||||
}
|
||||
|
||||
/* bi.siol must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/
|
||||
if (pbi->siol.type == CONSTANT) {
|
||||
recGblInitConstantLink(&pbi->siol,DBF_USHORT,&pbi->sval);
|
||||
}
|
||||
|
||||
recGblInitConstantLink(&pbi->siml,DBF_USHORT,&pbi->simm);
|
||||
recGblInitConstantLink(&pbi->siol,DBF_USHORT,&pbi->sval);
|
||||
if(!(pdset = (struct bidset *)(pbi->dset))) {
|
||||
recGblRecordError(S_dev_noDSET,(void *)pbi,"bi: init_record");
|
||||
return(S_dev_noDSET);
|
||||
@@ -275,7 +267,7 @@ static void alarm(pbi)
|
||||
pbi->lalm = val;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static void monitor(pbi)
|
||||
struct biRecord *pbi;
|
||||
{
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long special();
|
||||
static long get_value();
|
||||
#define get_value NULL
|
||||
static long cvt_dbaddr();
|
||||
static long get_array_info();
|
||||
static long put_array_info();
|
||||
@@ -114,217 +114,19 @@ struct rset compressRSET={
|
||||
put_enum_str,
|
||||
get_graphic_double,
|
||||
get_control_double,
|
||||
get_alarm_double };
|
||||
|
||||
#define compressNTO1LOW 0
|
||||
#define compressNTO1HIGH 1
|
||||
#define compressNTO1AVG 2
|
||||
#define AVERAGE 3
|
||||
#define CIRBUF 4
|
||||
|
||||
static void monitor();
|
||||
static void put_value();
|
||||
static int compress_array();
|
||||
static int compress_scalar();
|
||||
static int array_average();
|
||||
|
||||
get_alarm_double
|
||||
};
|
||||
|
||||
static long init_record(pcompress,pass)
|
||||
struct compressRecord *pcompress;
|
||||
int pass;
|
||||
static void reset(compressRecord *pcompress)
|
||||
{
|
||||
|
||||
if (pass==0){
|
||||
pcompress->bptr = (double *)calloc(pcompress->nsam,sizeof(double));
|
||||
/* allocate memory for the summing buffer for conversions requiring it */
|
||||
if (pcompress->alg == AVERAGE){
|
||||
pcompress->sptr = (double *)calloc(pcompress->nsam,sizeof(double));
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
if(pcompress->wptr==NULL && pcompress->inp.type==DB_LINK) {
|
||||
struct dbAddr *pdbAddr =
|
||||
(struct dbAddr *)(pcompress->inp.value.pv_link.pvt);
|
||||
|
||||
pcompress->wptr = (double *)calloc(pdbAddr->no_elements,sizeof(double));
|
||||
}
|
||||
return(0);
|
||||
pcompress->nuse = 0;
|
||||
pcompress->off= 0;
|
||||
pcompress->inx = 0;
|
||||
pcompress->cvb = 0.0;
|
||||
pcompress->res = 0;
|
||||
}
|
||||
|
||||
|
||||
static long process(pcompress)
|
||||
struct compressRecord *pcompress;
|
||||
{
|
||||
long status=0;
|
||||
|
||||
pcompress->pact = TRUE;
|
||||
|
||||
if (pcompress->inp.type == CONSTANT) {
|
||||
status=0;
|
||||
}else if (pcompress->wptr == NULL) {
|
||||
recGblSetSevr(pcompress,READ_ALARM,INVALID_ALARM);
|
||||
status=0;
|
||||
} else {
|
||||
struct dbAddr *pdbAddr =
|
||||
(struct dbAddr *)(pcompress->inp.value.pv_link.pvt);
|
||||
long no_elements=pdbAddr->no_elements;
|
||||
int alg=pcompress->alg;
|
||||
|
||||
if(dbGetLink(&pcompress->inp,DBF_DOUBLE,
|
||||
pcompress->wptr,0,&no_elements)!=0){
|
||||
recGblSetSevr(pcompress,LINK_ALARM,INVALID_ALARM);
|
||||
}
|
||||
|
||||
if(alg==AVERAGE) {
|
||||
status = array_average(pcompress,pcompress->wptr,no_elements);
|
||||
} else if(alg==CIRBUF) {
|
||||
(void)put_value(pcompress,pcompress->wptr,no_elements);
|
||||
status = 0;
|
||||
} else if(pdbAddr->no_elements>1) {
|
||||
status = compress_array(pcompress,pcompress->wptr,no_elements);
|
||||
}else if(no_elements==1){
|
||||
status = compress_scalar(pcompress,pcompress->wptr);
|
||||
}else status=1;
|
||||
}
|
||||
|
||||
/* check event list */
|
||||
if(status!=1) {
|
||||
pcompress->udf=FALSE;
|
||||
recGblGetTimeStamp(pcompress);
|
||||
monitor(pcompress);
|
||||
/* process the forward scan link record */
|
||||
recGblFwdLink(pcompress);
|
||||
}
|
||||
pcompress->pact=FALSE;
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long special(paddr,after)
|
||||
struct dbAddr *paddr;
|
||||
int after;
|
||||
{
|
||||
struct compressRecord *pcompress = (struct compressRecord *)(paddr->precord);
|
||||
int special_type = paddr->special;
|
||||
|
||||
if(!after) return(0);
|
||||
switch(special_type) {
|
||||
case(SPC_RESET):
|
||||
pcompress->nuse = 0;
|
||||
pcompress->off= 0;
|
||||
pcompress->inx = 0;
|
||||
pcompress->cvb = 0.0;
|
||||
pcompress->res = 0;
|
||||
return(0);
|
||||
default:
|
||||
recGblDbaddrError(S_db_badChoice,paddr,"compress: special");
|
||||
return(S_db_badChoice);
|
||||
}
|
||||
}
|
||||
|
||||
static long get_value(pcompress,pvdes)
|
||||
struct compressRecord *pcompress;
|
||||
struct valueDes *pvdes;
|
||||
{
|
||||
pvdes->field_type = DBF_DOUBLE;
|
||||
pvdes->no_elements=pcompress->nuse;
|
||||
(double *)(pvdes->pvalue) = pcompress->bptr;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long cvt_dbaddr(paddr)
|
||||
struct dbAddr *paddr;
|
||||
{
|
||||
struct compressRecord *pcompress=(struct compressRecord *)paddr->precord;
|
||||
|
||||
paddr->pfield = (void *)(pcompress->bptr);
|
||||
paddr->no_elements = pcompress->nsam;
|
||||
paddr->field_type = DBF_DOUBLE;
|
||||
paddr->field_size = sizeof(double);
|
||||
paddr->dbr_field_type = DBF_DOUBLE;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_array_info(paddr,no_elements,offset)
|
||||
struct dbAddr *paddr;
|
||||
long *no_elements;
|
||||
long *offset;
|
||||
{
|
||||
struct compressRecord *pcompress=(struct compressRecord *)paddr->precord;
|
||||
|
||||
*no_elements = pcompress->nuse;
|
||||
if(pcompress->nuse==pcompress->nsam) *offset = pcompress->off;
|
||||
else *offset = 0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long put_array_info(paddr,nNew)
|
||||
struct dbAddr *paddr;
|
||||
long nNew;
|
||||
{
|
||||
struct compressRecord *pcompress=(struct compressRecord *)paddr->precord;
|
||||
|
||||
pcompress->off = (pcompress->off + nNew) % (pcompress->nsam);
|
||||
pcompress->nuse = (pcompress->nuse + nNew);
|
||||
if(pcompress->nuse > pcompress->nsam) pcompress->nuse = pcompress->nsam;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_units(paddr,units)
|
||||
struct dbAddr *paddr;
|
||||
char *units;
|
||||
{
|
||||
struct compressRecord *pcompress=(struct compressRecord *)paddr->precord;
|
||||
|
||||
strncpy(units,pcompress->egu,DB_UNITS_SIZE);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_precision(paddr,precision)
|
||||
struct dbAddr *paddr;
|
||||
long *precision;
|
||||
{
|
||||
struct compressRecord *pcompress=(struct compressRecord *)paddr->precord;
|
||||
|
||||
*precision = pcompress->prec;
|
||||
if(paddr->pfield == (void *)pcompress->bptr) return(0);
|
||||
recGblGetPrec(paddr,precision);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_graphic_double(paddr,pgd)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_grDouble *pgd;
|
||||
{
|
||||
struct compressRecord *pcompress=(struct compressRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)pcompress->bptr
|
||||
|| paddr->pfield==(void *)&pcompress->ihil
|
||||
|| paddr->pfield==(void *)&pcompress->ilil){
|
||||
pgd->upper_disp_limit = pcompress->hopr;
|
||||
pgd->lower_disp_limit = pcompress->lopr;
|
||||
} else recGblGetGraphicDouble(paddr,pgd);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_control_double(paddr,pcd)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_ctrlDouble *pcd;
|
||||
{
|
||||
struct compressRecord *pcompress=(struct compressRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)pcompress->bptr
|
||||
|| paddr->pfield==(void *)&pcompress->ihil
|
||||
|| paddr->pfield==(void *)&pcompress->ilil){
|
||||
pcd->upper_ctrl_limit = pcompress->hopr;
|
||||
pcd->lower_ctrl_limit = pcompress->lopr;
|
||||
} else recGblGetControlDouble(paddr,pcd);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static void monitor(pcompress)
|
||||
struct compressRecord *pcompress;
|
||||
static void monitor(compressRecord *pcompress)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
|
||||
@@ -333,11 +135,8 @@ static void monitor(pcompress)
|
||||
if(monitor_mask) db_post_events(pcompress,pcompress->bptr,monitor_mask);
|
||||
return;
|
||||
}
|
||||
|
||||
static void put_value(pcompress,psource,n)
|
||||
struct compressRecord *pcompress;
|
||||
double *psource;
|
||||
long n;
|
||||
|
||||
static void put_value(compressRecord *pcompress,double *psource, long n)
|
||||
{
|
||||
/* treat bptr as pointer to a circular buffer*/
|
||||
double *pdest;
|
||||
@@ -362,10 +161,8 @@ static void put_value(pcompress,psource,n)
|
||||
return;
|
||||
}
|
||||
|
||||
static int compress_array(pcompress,psource,no_elements)
|
||||
struct compressRecord *pcompress;
|
||||
double *psource;
|
||||
long no_elements;
|
||||
static int compress_array(compressRecord *pcompress,
|
||||
double *psource,long no_elements)
|
||||
{
|
||||
long i,j;
|
||||
long nnew;
|
||||
@@ -391,7 +188,7 @@ long no_elements;
|
||||
|
||||
/* compress according to specified algorithm */
|
||||
switch (pcompress->alg){
|
||||
case (compressNTO1LOW):
|
||||
case (compressALG_N_to_1_Low_Value):
|
||||
/* compress N to 1 keeping the lowest value */
|
||||
for (i = 0; i < nnew; i++){
|
||||
value = *psource++;
|
||||
@@ -401,7 +198,7 @@ long no_elements;
|
||||
put_value(pcompress,&value,1);
|
||||
}
|
||||
break;
|
||||
case (compressNTO1HIGH):
|
||||
case (compressALG_N_to_1_High_Value):
|
||||
/* compress N to 1 keeping the highest value */
|
||||
for (i = 0; i < nnew; i++){
|
||||
value = *psource++;
|
||||
@@ -411,7 +208,7 @@ long no_elements;
|
||||
put_value(pcompress,&value,1);
|
||||
}
|
||||
break;
|
||||
case (compressNTO1AVG):
|
||||
case (compressALG_N_to_1_Average):
|
||||
/* compress N to 1 keeping the average value */
|
||||
for (i = 0; i < nnew; i++){
|
||||
value = 0;
|
||||
@@ -425,10 +222,8 @@ long no_elements;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int array_average(pcompress,psource,no_elements)
|
||||
struct compressRecord *pcompress;
|
||||
double *psource;
|
||||
long no_elements;
|
||||
static int array_average(compressRecord *pcompress,
|
||||
double *psource,long no_elements)
|
||||
{
|
||||
long i;
|
||||
long nnow;
|
||||
@@ -436,12 +231,10 @@ long no_elements;
|
||||
double *psum;
|
||||
double multiplier;
|
||||
long inx=pcompress->inx;
|
||||
struct dbAddr *pdbAddr = (struct dbAddr *)(pcompress->inp.value.pv_link.pvt);
|
||||
long ninp=pdbAddr->no_elements;
|
||||
long nuse,n;
|
||||
|
||||
nuse = nsam;
|
||||
if(nuse>ninp) nuse = ninp;
|
||||
if(nuse>no_elements) nuse = no_elements;
|
||||
nnow=nuse;
|
||||
if(nnow>no_elements) nnow=no_elements;
|
||||
psum = (double *)pcompress->sptr;
|
||||
@@ -475,9 +268,7 @@ long no_elements;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int compress_scalar(pcompress,psource)
|
||||
struct compressRecord *pcompress;
|
||||
double *psource;
|
||||
static int compress_scalar(struct compressRecord *pcompress,double *psource)
|
||||
{
|
||||
double value = *psource;
|
||||
double *pdest=&pcompress->cvb;
|
||||
@@ -485,15 +276,15 @@ double *psource;
|
||||
|
||||
/* compress according to specified algorithm */
|
||||
switch (pcompress->alg){
|
||||
case (compressNTO1LOW):
|
||||
case (compressALG_N_to_1_Low_Value):
|
||||
if ((value < *pdest) || (inx == 0))
|
||||
*pdest = value;
|
||||
break;
|
||||
case (compressNTO1HIGH):
|
||||
case (compressALG_N_to_1_High_Value):
|
||||
if ((value > *pdest) || (inx == 0))
|
||||
*pdest = value;
|
||||
break;
|
||||
case (compressNTO1AVG):
|
||||
case (compressALG_N_to_1_Average):
|
||||
if (inx == 0)
|
||||
*pdest = value;
|
||||
else {
|
||||
@@ -512,3 +303,175 @@ double *psource;
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
|
||||
/*Beginning of record support routines*/
|
||||
static long init_record(pcompress,pass)
|
||||
compressRecord *pcompress;
|
||||
int pass;
|
||||
{
|
||||
if (pass==0){
|
||||
if(pcompress->nsam<1) pcompress->nsam = 1;
|
||||
pcompress->bptr = (double *)calloc(pcompress->nsam,sizeof(double));
|
||||
/* allocate memory for the summing buffer for conversions requiring it */
|
||||
if (pcompress->alg == compressALG_Average){
|
||||
pcompress->sptr = (double *)calloc(pcompress->nsam,sizeof(double));
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long process(pcompress)
|
||||
compressRecord *pcompress;
|
||||
{
|
||||
long status=0;
|
||||
long nelements = 0;
|
||||
int alg = pcompress->alg;
|
||||
|
||||
pcompress->pact = TRUE;
|
||||
if(!dbIsLinkConnected(&pcompress->inp)
|
||||
|| !dbGetNelements(&pcompress->inp,&nelements)
|
||||
|| nelements<=0) {
|
||||
recGblSetSevr(pcompress,READ_ALARM,INVALID_ALARM);
|
||||
} else {
|
||||
if(!pcompress->wptr || nelements!=pcompress->inpn) {
|
||||
free(pcompress->wptr);
|
||||
pcompress->wptr = (double *)dbCalloc(nelements,sizeof(double));
|
||||
pcompress->inpn = nelements;
|
||||
reset(pcompress);
|
||||
}
|
||||
status = dbGetLink(&pcompress->inp,DBF_DOUBLE,pcompress->wptr,0,&nelements);
|
||||
if(status || nelements<=0) {
|
||||
recGblSetSevr(pcompress,LINK_ALARM,INVALID_ALARM);
|
||||
status = 0;
|
||||
} else {
|
||||
if(alg==compressALG_Average) {
|
||||
status = array_average(pcompress,pcompress->wptr,nelements);
|
||||
} else if(alg==compressALG_Circular_Buffer) {
|
||||
(void)put_value(pcompress,pcompress->wptr,nelements);
|
||||
status = 0;
|
||||
} else if(nelements>1) {
|
||||
status = compress_array(pcompress,pcompress->wptr,nelements);
|
||||
}else if(nelements==1){
|
||||
status = compress_scalar(pcompress,pcompress->wptr);
|
||||
}else status=1;
|
||||
}
|
||||
}
|
||||
/* check event list */
|
||||
if(status!=1) {
|
||||
pcompress->udf=FALSE;
|
||||
recGblGetTimeStamp(pcompress);
|
||||
monitor(pcompress);
|
||||
/* process the forward scan link record */
|
||||
recGblFwdLink(pcompress);
|
||||
}
|
||||
pcompress->pact=FALSE;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long special(paddr,after)
|
||||
struct dbAddr *paddr;
|
||||
int after;
|
||||
{
|
||||
compressRecord *pcompress = (compressRecord *)(paddr->precord);
|
||||
int special_type = paddr->special;
|
||||
|
||||
if(!after) return(0);
|
||||
switch(special_type) {
|
||||
case(SPC_RESET):
|
||||
reset(pcompress);
|
||||
return(0);
|
||||
default:
|
||||
recGblDbaddrError(S_db_badChoice,paddr,"compress: special");
|
||||
return(S_db_badChoice);
|
||||
}
|
||||
}
|
||||
|
||||
static long cvt_dbaddr(paddr)
|
||||
struct dbAddr *paddr;
|
||||
{
|
||||
compressRecord *pcompress=(compressRecord *)paddr->precord;
|
||||
|
||||
paddr->pfield = (void *)(pcompress->bptr);
|
||||
paddr->no_elements = pcompress->nsam;
|
||||
paddr->field_type = DBF_DOUBLE;
|
||||
paddr->field_size = sizeof(double);
|
||||
paddr->dbr_field_type = DBF_DOUBLE;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_array_info(paddr,no_elements,offset)
|
||||
struct dbAddr *paddr;
|
||||
long *no_elements;
|
||||
long *offset;
|
||||
{
|
||||
compressRecord *pcompress=(compressRecord *)paddr->precord;
|
||||
|
||||
*no_elements = pcompress->nuse;
|
||||
if(pcompress->nuse==pcompress->nsam) *offset = pcompress->off;
|
||||
else *offset = 0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long put_array_info(paddr,nNew)
|
||||
struct dbAddr *paddr;
|
||||
long nNew;
|
||||
{
|
||||
compressRecord *pcompress=(compressRecord *)paddr->precord;
|
||||
|
||||
pcompress->off = (pcompress->off + nNew) % (pcompress->nsam);
|
||||
pcompress->nuse = (pcompress->nuse + nNew);
|
||||
if(pcompress->nuse > pcompress->nsam) pcompress->nuse = pcompress->nsam;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_units(paddr,units)
|
||||
struct dbAddr *paddr;
|
||||
char *units;
|
||||
{
|
||||
compressRecord *pcompress=(compressRecord *)paddr->precord;
|
||||
|
||||
strncpy(units,pcompress->egu,DB_UNITS_SIZE);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_precision(paddr,precision)
|
||||
struct dbAddr *paddr;
|
||||
long *precision;
|
||||
{
|
||||
compressRecord *pcompress=(compressRecord *)paddr->precord;
|
||||
|
||||
*precision = pcompress->prec;
|
||||
if(paddr->pfield == (void *)pcompress->bptr) return(0);
|
||||
recGblGetPrec(paddr,precision);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_graphic_double(paddr,pgd)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_grDouble *pgd;
|
||||
{
|
||||
compressRecord *pcompress=(compressRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)pcompress->bptr
|
||||
|| paddr->pfield==(void *)&pcompress->ihil
|
||||
|| paddr->pfield==(void *)&pcompress->ilil){
|
||||
pgd->upper_disp_limit = pcompress->hopr;
|
||||
pgd->lower_disp_limit = pcompress->lopr;
|
||||
} else recGblGetGraphicDouble(paddr,pgd);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_control_double(paddr,pcd)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_ctrlDouble *pcd;
|
||||
{
|
||||
compressRecord *pcompress=(compressRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)pcompress->bptr
|
||||
|| paddr->pfield==(void *)&pcompress->ihil
|
||||
|| paddr->pfield==(void *)&pcompress->ilil){
|
||||
pcd->upper_ctrl_limit = pcompress->hopr;
|
||||
pcd->lower_ctrl_limit = pcompress->lopr;
|
||||
} else recGblGetControlDouble(paddr,pcd);
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -107,6 +107,11 @@ recordtype(compress) {
|
||||
size(4)
|
||||
extra("double *wptr")
|
||||
}
|
||||
field(INPN,DBF_LONG) {
|
||||
prompt("Number of elements in Working Buffer")
|
||||
special(SPC_NOMOD)
|
||||
interest(4)
|
||||
}
|
||||
field(CVB,DBF_DOUBLE) {
|
||||
prompt("Compress Value Buffer")
|
||||
special(SPC_NOMOD)
|
||||
|
||||
@@ -93,38 +93,28 @@ static long init_record(pdfanout,pass)
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long process(pdfanout)
|
||||
struct dfanoutRecord *pdfanout;
|
||||
{
|
||||
long status=0;
|
||||
unsigned char pact=pdfanout->pact;
|
||||
|
||||
if (!pdfanout->pact && pdfanout->omsl == CLOSED_LOOP){
|
||||
status = dbGetLink(&(pdfanout->dol),
|
||||
DBR_LONG,&(pdfanout->val),0,0);
|
||||
if(pdfanout->dol.type!=CONSTANT && RTN_SUCCESS(status)) pdfanout->udf=FALSE;
|
||||
}
|
||||
|
||||
pdfanout->pact = TRUE;
|
||||
|
||||
recGblGetTimeStamp(pdfanout);
|
||||
long status=0;
|
||||
unsigned char pact=pdfanout->pact;
|
||||
|
||||
if (!pdfanout->pact && pdfanout->omsl == CLOSED_LOOP){
|
||||
status = dbGetLink(&(pdfanout->dol),DBR_LONG,&(pdfanout->val),0,0);
|
||||
if(pdfanout->dol.type!=CONSTANT && RTN_SUCCESS(status)) pdfanout->udf=FALSE;
|
||||
}
|
||||
pdfanout->pact = TRUE;
|
||||
recGblGetTimeStamp(pdfanout);
|
||||
/* Push out the data to all the forward links */
|
||||
status = push_values(pdfanout);
|
||||
/* check for alarms */
|
||||
alarm(pdfanout);
|
||||
/* check event list */
|
||||
monitor(pdfanout);
|
||||
|
||||
/* process the forward scan link record */
|
||||
recGblFwdLink(pdfanout);
|
||||
|
||||
|
||||
pdfanout->pact=FALSE;
|
||||
return(status);
|
||||
status = push_values(pdfanout);
|
||||
alarm(pdfanout);
|
||||
monitor(pdfanout);
|
||||
recGblFwdLink(pdfanout);
|
||||
pdfanout->pact=FALSE;
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
static long get_value(pdfanout,pvdes)
|
||||
struct dfanoutRecord *pdfanout;
|
||||
struct valueDes *pvdes;
|
||||
@@ -134,7 +124,7 @@ static long get_value(pdfanout,pvdes)
|
||||
(long *)(pvdes->pvalue) = &pdfanout->val;
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long get_units(paddr,units)
|
||||
struct dbAddr *paddr;
|
||||
char *units;
|
||||
@@ -204,34 +194,35 @@ static void alarm(pdfanout)
|
||||
recGblSetSevr(pdfanout,UDF_ALARM,INVALID_ALARM);
|
||||
return;
|
||||
}
|
||||
hihi = pdfanout->hihi; lolo = pdfanout->lolo; high = pdfanout->high; low = pdfanout->low;
|
||||
hhsv = pdfanout->hhsv; llsv = pdfanout->llsv; hsv = pdfanout->hsv; lsv = pdfanout->lsv;
|
||||
hihi = pdfanout->hihi; lolo = pdfanout->lolo;
|
||||
high = pdfanout->high; low = pdfanout->low;
|
||||
hhsv = pdfanout->hhsv; llsv = pdfanout->llsv;
|
||||
hsv = pdfanout->hsv; lsv = pdfanout->lsv;
|
||||
val = pdfanout->val; hyst = pdfanout->hyst; lalm = pdfanout->lalm;
|
||||
|
||||
/* alarm condition hihi */
|
||||
if (hhsv && (val >= hihi || ((lalm==hihi) && (val >= hihi-hyst)))){
|
||||
if (recGblSetSevr(pdfanout,HIHI_ALARM,pdfanout->hhsv)) pdfanout->lalm = hihi;
|
||||
return;
|
||||
if(recGblSetSevr(pdfanout,HIHI_ALARM,pdfanout->hhsv))
|
||||
pdfanout->lalm = hihi;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition lolo */
|
||||
if (llsv && (val <= lolo || ((lalm==lolo) && (val <= lolo+hyst)))){
|
||||
if (recGblSetSevr(pdfanout,LOLO_ALARM,pdfanout->llsv)) pdfanout->lalm = lolo;
|
||||
return;
|
||||
if(recGblSetSevr(pdfanout,LOLO_ALARM,pdfanout->llsv))
|
||||
pdfanout->lalm = lolo;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition high */
|
||||
if (hsv && (val >= high || ((lalm==high) && (val >= high-hyst)))){
|
||||
if (recGblSetSevr(pdfanout,HIGH_ALARM,pdfanout->hsv)) pdfanout->lalm = high;
|
||||
return;
|
||||
if(recGblSetSevr(pdfanout,HIGH_ALARM,pdfanout->hsv))
|
||||
pdfanout->lalm = high;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition low */
|
||||
if (lsv && (val <= low || ((lalm==low) && (val <= low+hyst)))){
|
||||
if (recGblSetSevr(pdfanout,LOW_ALARM,pdfanout->lsv)) pdfanout->lalm = low;
|
||||
return;
|
||||
if(recGblSetSevr(pdfanout,LOW_ALARM,pdfanout->lsv))
|
||||
pdfanout->lalm = low;
|
||||
return;
|
||||
}
|
||||
|
||||
/* we get here only if val is out of alarm by at least hyst */
|
||||
pdfanout->lalm = val;
|
||||
return;
|
||||
@@ -270,7 +261,7 @@ static void monitor(pdfanout)
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static long push_values(pdfanout)
|
||||
struct dfanoutRecord *pdfanout;
|
||||
{
|
||||
|
||||
@@ -101,35 +101,46 @@ struct rset fanoutRSET={
|
||||
put_enum_str,
|
||||
get_graphic_double,
|
||||
get_control_double,
|
||||
get_alarm_double };
|
||||
|
||||
#define SELECT_ALL 0
|
||||
#define SELECTED 1
|
||||
#define SELECT_MASK 2
|
||||
|
||||
get_alarm_double
|
||||
};
|
||||
|
||||
static long init_record(pfanout,pass)
|
||||
struct fanoutRecord *pfanout;
|
||||
int pass;
|
||||
{
|
||||
/* Added for Channel Access Links */
|
||||
long status;
|
||||
|
||||
if (pass==0) return(0);
|
||||
|
||||
/* get link selection if sell is a constant and nonzero*/
|
||||
if (pfanout->sell.type == CONSTANT) {
|
||||
recGblInitConstantLink(&pfanout->sell,DBF_USHORT,&pfanout->seln);
|
||||
}
|
||||
recGblInitConstantLink(&pfanout->sell,DBF_USHORT,&pfanout->seln);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void scanLink(fanoutRecord *pfanout,struct link *plink)
|
||||
{
|
||||
/*This routine pokes into private db stuff */
|
||||
void *precord = (void *)pfanout;
|
||||
struct pv_link *pvlink;
|
||||
short fwdLinkValue;
|
||||
|
||||
if(plink->type==CONSTANT) return;
|
||||
if(plink->type==DB_LINK) {
|
||||
DBADDR *paddr = (DBADDR *)plink->value.pv_link.pvt;
|
||||
dbScanPassive(precord,paddr->precord);
|
||||
return;
|
||||
}
|
||||
if(plink->type!=CA_LINK) return;
|
||||
pvlink = &plink->value.pv_link;
|
||||
if(!(pvlink->pvlMask & pvlOptFWD)) return;
|
||||
fwdLinkValue = 1;
|
||||
dbCaPutLink(plink,DBR_SHORT,&fwdLinkValue,1);
|
||||
return;
|
||||
}
|
||||
|
||||
static long process(pfanout)
|
||||
struct fanoutRecord *pfanout;
|
||||
{
|
||||
unsigned short stat,sevr,nsta,nsev;
|
||||
|
||||
|
||||
struct link *plink;
|
||||
unsigned short state;
|
||||
short i;
|
||||
@@ -141,21 +152,15 @@ static long process(pfanout)
|
||||
/* fetch link selection */
|
||||
dbGetLink(&(pfanout->sell),DBR_USHORT,&(pfanout->seln),0,0);
|
||||
switch (pfanout->selm){
|
||||
case (SELECT_ALL):
|
||||
if (pfanout->lnk1.type!=CONSTANT)
|
||||
dbScanPassive((void *)pfanout,((struct dbAddr *)pfanout->lnk1.value.pv_link.pvt)->precord);
|
||||
if (pfanout->lnk2.type!=CONSTANT)
|
||||
dbScanPassive((void *)pfanout,((struct dbAddr *)pfanout->lnk2.value.pv_link.pvt)->precord);
|
||||
if (pfanout->lnk3.type!=CONSTANT)
|
||||
dbScanPassive((void *)pfanout,((struct dbAddr *)pfanout->lnk3.value.pv_link.pvt)->precord);
|
||||
if (pfanout->lnk4.type!=CONSTANT)
|
||||
dbScanPassive((void *)pfanout,((struct dbAddr *)pfanout->lnk4.value.pv_link.pvt)->precord);
|
||||
if (pfanout->lnk5.type!=CONSTANT)
|
||||
dbScanPassive((void *)pfanout,((struct dbAddr *)pfanout->lnk5.value.pv_link.pvt)->precord);
|
||||
if (pfanout->lnk6.type!=CONSTANT)
|
||||
dbScanPassive((void *)pfanout,((struct dbAddr *)pfanout->lnk6.value.pv_link.pvt)->precord);
|
||||
case (fanoutSELM_All):
|
||||
if (pfanout->lnk1.type!=CONSTANT) scanLink(pfanout,&pfanout->lnk1);
|
||||
if (pfanout->lnk2.type!=CONSTANT) scanLink(pfanout,&pfanout->lnk2);
|
||||
if (pfanout->lnk3.type!=CONSTANT) scanLink(pfanout,&pfanout->lnk3);
|
||||
if (pfanout->lnk4.type!=CONSTANT) scanLink(pfanout,&pfanout->lnk4);
|
||||
if (pfanout->lnk5.type!=CONSTANT) scanLink(pfanout,&pfanout->lnk5);
|
||||
if (pfanout->lnk6.type!=CONSTANT) scanLink(pfanout,&pfanout->lnk6);
|
||||
break;
|
||||
case (SELECTED):
|
||||
case (fanoutSELM_Specified):
|
||||
if(pfanout->seln>6) {
|
||||
recGblSetSevr(pfanout,SOFT_ALARM,INVALID_ALARM);
|
||||
break;
|
||||
@@ -165,9 +170,9 @@ static long process(pfanout)
|
||||
}
|
||||
plink=&(pfanout->lnk1);
|
||||
plink += (pfanout->seln-1);
|
||||
dbScanPassive((void *)pfanout,((struct dbAddr *)plink->value.pv_link.pvt)->precord);
|
||||
scanLink(pfanout,plink);
|
||||
break;
|
||||
case (SELECT_MASK):
|
||||
case (fanoutSELM_Mask):
|
||||
if(pfanout->seln==0) {
|
||||
break;
|
||||
}
|
||||
@@ -178,8 +183,7 @@ static long process(pfanout)
|
||||
plink=&(pfanout->lnk1);
|
||||
state=pfanout->seln;
|
||||
for ( i=0; i<6; i++, state>>=1, plink++) {
|
||||
if(state & 1 && plink->type!=CONSTANT)
|
||||
dbScanPassive((void *)pfanout,((struct dbAddr *)plink->value.pv_link.pvt)->precord);
|
||||
if(state & 1 && plink->type!=CONSTANT) scanLink(pfanout,plink);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -192,7 +196,6 @@ static long process(pfanout)
|
||||
monitor_mask = recGblResetAlarms(pfanout);
|
||||
/* process the forward scan link record */
|
||||
recGblFwdLink(pfanout);
|
||||
|
||||
pfanout->pact=FALSE;
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* recLongout.c */
|
||||
/* base/src/rec $Id$ */
|
||||
|
||||
/* recLongout.c - Record Support Routines for Longout records */
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 9/23/91
|
||||
@@ -45,8 +43,6 @@
|
||||
* .14 09-18-92 jba pact now set in recGblGetLinkValue
|
||||
* .15 03-29-94 mcn converted to fast links
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
@@ -71,7 +67,7 @@
|
||||
static long init_record();
|
||||
static long process();
|
||||
#define special NULL
|
||||
static long get_value();
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
#define put_array_info NULL
|
||||
@@ -126,12 +122,9 @@ static long init_record(plongout,pass)
|
||||
long status=0;
|
||||
|
||||
if (pass==0) return(0);
|
||||
|
||||
/* longout.siml must be a CONSTANT or a PV_LINK or a DB_LINK */
|
||||
if (plongout->siml.type == CONSTANT) {
|
||||
recGblInitConstantLink(&plongout->siml,DBF_USHORT,&plongout->simm);
|
||||
}
|
||||
|
||||
if(!(pdset = (struct longoutdset *)(plongout->dset))) {
|
||||
recGblRecordError(S_dev_noDSET,(void *)plongout,"longout: init_record");
|
||||
return(S_dev_noDSET);
|
||||
@@ -141,12 +134,10 @@ static long init_record(plongout,pass)
|
||||
recGblRecordError(S_dev_missingSup,(void *)plongout,"longout: init_record");
|
||||
return(S_dev_missingSup);
|
||||
}
|
||||
/* get the initial value dol is a constant*/
|
||||
if (plongout->dol.type == CONSTANT) {
|
||||
if(recGblInitConstantLink(&plongout->dol,DBF_LONG,&plongout->val))
|
||||
plongout->udf=FALSE;
|
||||
}
|
||||
|
||||
if( pdset->init_record ) {
|
||||
if((status=(*pdset->init_record)(plongout))) return(status);
|
||||
}
|
||||
@@ -215,16 +206,6 @@ static long process(plongout)
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long get_value(plongout,pvdes)
|
||||
struct longoutRecord *plongout;
|
||||
struct valueDes *pvdes;
|
||||
{
|
||||
pvdes->field_type = DBF_LONG;
|
||||
pvdes->no_elements=1;
|
||||
(long *)(pvdes->pvalue) = &plongout->val;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_units(paddr,units)
|
||||
struct dbAddr *paddr;
|
||||
char *units;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* recMbbi.c */
|
||||
/* base/src/rec $Id$ */
|
||||
|
||||
/* recMbbi.c - Record Support Routines for multi bit binary Input records */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
@@ -62,7 +60,6 @@
|
||||
#include <stdioLib.h>
|
||||
#include <lstLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
@@ -80,7 +77,7 @@
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long special();
|
||||
static long get_value();
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
#define put_array_info NULL
|
||||
@@ -92,7 +89,6 @@ static long put_enum_str();
|
||||
#define get_graphic_double NULL
|
||||
#define get_control_double NULL
|
||||
#define get_alarm_double NULL
|
||||
|
||||
struct rset mbbiRSET={
|
||||
RSETNUMBER,
|
||||
report,
|
||||
@@ -124,7 +120,6 @@ struct mbbidset { /* multi bit binary input dset */
|
||||
static void alarm();
|
||||
static void monitor();
|
||||
static long readValue();
|
||||
|
||||
|
||||
static void init_common(pmbbi)
|
||||
struct mbbiRecord *pmbbi;
|
||||
@@ -155,16 +150,12 @@ static long init_record(pmbbi,pass)
|
||||
|
||||
if (pass==0) return(0);
|
||||
|
||||
/* mbbi.siml must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/
|
||||
if (pmbbi->siml.type == CONSTANT) {
|
||||
recGblInitConstantLink(&pmbbi->siml,DBF_USHORT,&pmbbi->simm);
|
||||
}
|
||||
|
||||
/* mbbi.siol must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/
|
||||
if (pmbbi->siol.type == CONSTANT) {
|
||||
recGblInitConstantLink(&pmbbi->siol,DBF_USHORT,&pmbbi->sval);
|
||||
}
|
||||
|
||||
if(!(pdset = (struct mbbidset *)(pmbbi->dset))) {
|
||||
recGblRecordError(S_dev_noDSET,(void *)pmbbi,"mbbi: init_record");
|
||||
return(S_dev_noDSET);
|
||||
@@ -264,16 +255,6 @@ static long special(paddr,after)
|
||||
}
|
||||
}
|
||||
|
||||
static long get_value(pmbbi,pvdes)
|
||||
struct mbbiRecord *pmbbi;
|
||||
struct valueDes *pvdes;
|
||||
{
|
||||
pvdes->field_type = DBF_ENUM;
|
||||
pvdes->no_elements=1;
|
||||
(unsigned short *)(pvdes->pvalue) = &pmbbi->val;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_enum_str(paddr,pstring)
|
||||
struct dbAddr *paddr;
|
||||
char *pstring;
|
||||
@@ -310,6 +291,7 @@ static long get_enum_strs(paddr,pes)
|
||||
pes->no_str=no_str;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long put_enum_str(paddr,pstring)
|
||||
struct dbAddr *paddr;
|
||||
char *pstring;
|
||||
@@ -331,7 +313,7 @@ static long put_enum_str(paddr,pstring)
|
||||
}
|
||||
return(S_db_badChoice);
|
||||
}
|
||||
|
||||
|
||||
static void alarm(pmbbi)
|
||||
struct mbbiRecord *pmbbi;
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ unsigned long tickGet();
|
||||
static long init_record();
|
||||
static long process();
|
||||
#define special NULL
|
||||
static long get_value();
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
#define put_array_info NULL
|
||||
@@ -111,20 +111,15 @@ static long init_record(ppid,pass)
|
||||
struct pidRecord *ppid;
|
||||
int pass;
|
||||
{
|
||||
/* Added for Channel Access Links */
|
||||
long status;
|
||||
|
||||
if (pass==0) return(0);
|
||||
|
||||
/* initialize the setpoint for constant setpoint */
|
||||
if (ppid->stpl.type == CONSTANT){
|
||||
if(recGblInitConstantLink(&ppid->stpl,DBF_FLOAT,&ppid->val))
|
||||
ppid->udf = FALSE;
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long process(ppid)
|
||||
struct pidRecord *ppid;
|
||||
{
|
||||
@@ -136,31 +131,13 @@ static long process(ppid)
|
||||
ppid->pact = FALSE;
|
||||
return(0);
|
||||
}
|
||||
|
||||
recGblGetTimeStamp(ppid);
|
||||
/* check for alarms */
|
||||
alarm(ppid);
|
||||
|
||||
|
||||
/* check event list */
|
||||
monitor(ppid);
|
||||
|
||||
/* process the forward scan link record */
|
||||
recGblFwdLink(ppid);
|
||||
|
||||
ppid->pact=FALSE;
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long get_value(ppid,pvdes)
|
||||
struct pidRecord *ppid;
|
||||
struct valueDes *pvdes;
|
||||
{
|
||||
pvdes->field_type = DBF_FLOAT;
|
||||
pvdes->no_elements=1;
|
||||
(float *)(pvdes->pvalue) = &ppid->val;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_units(paddr,units)
|
||||
struct dbAddr *paddr;
|
||||
|
||||
@@ -188,35 +188,21 @@ static long process(ppd)
|
||||
|
||||
}
|
||||
|
||||
if (status==0) status=(*pdset->write_pd)(ppd); /* write the new value */
|
||||
if (status==0) status=(*pdset->write_pd)(ppd); /* write the new value */
|
||||
|
||||
/* reset field causing processing parameter */
|
||||
/* used to be set to zero, use a bit to detect val field change */
|
||||
ppd->pfld&=0x0f00;
|
||||
/* reset field causing processing parameter */
|
||||
/* used to be set to zero, use a bit to detect val field change */
|
||||
ppd->pfld&=0x0f00;
|
||||
|
||||
/* check if device support set pact */
|
||||
if ( !pact && ppd->pact ) return(0);
|
||||
ppd->pact = TRUE;
|
||||
|
||||
ppd->udf=FALSE;
|
||||
recGblGetTimeStamp(ppd);
|
||||
|
||||
/* check event list */
|
||||
monitor(ppd);
|
||||
|
||||
/* process the forward scan link record */
|
||||
recGblFwdLink(ppd);
|
||||
|
||||
ppd->pact=FALSE;
|
||||
|
||||
if(status)
|
||||
{
|
||||
recGblSetSevr(ppd,READ_ALARM,INVALID_ALARM);
|
||||
}
|
||||
|
||||
return(0);
|
||||
/* return(status); if card missing, causing error on console for
|
||||
db_get */
|
||||
/* check if device support set pact */
|
||||
if ( !pact && ppd->pact ) return(0);
|
||||
ppd->pact = TRUE;
|
||||
ppd->udf=FALSE;
|
||||
recGblGetTimeStamp(ppd);
|
||||
monitor(ppd);
|
||||
recGblFwdLink(ppd);
|
||||
ppd->pact=FALSE;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_value(ppd,pvdes)
|
||||
|
||||
@@ -208,7 +208,7 @@ static long process(ppt)
|
||||
recGblFwdLink(ppt);
|
||||
|
||||
ppt->pact=FALSE;
|
||||
return(status);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_value(ppt,pvdes)
|
||||
|
||||
@@ -78,14 +78,13 @@
|
||||
#define GEN_SIZE_OFFSET
|
||||
#include <waveformRecord.h>
|
||||
#undef GEN_SIZE_OFFSET
|
||||
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
#define special NULL
|
||||
static long get_value();
|
||||
#define get_value NULL
|
||||
static long cvt_dbaddr();
|
||||
static long get_array_info();
|
||||
static long put_array_info();
|
||||
@@ -97,7 +96,6 @@ static long get_precision();
|
||||
static long get_graphic_double();
|
||||
static long get_control_double();
|
||||
#define get_alarm_double NULL
|
||||
|
||||
struct rset waveformRSET={
|
||||
RSETNUMBER,
|
||||
report,
|
||||
@@ -117,7 +115,6 @@ struct rset waveformRSET={
|
||||
get_graphic_double,
|
||||
get_control_double,
|
||||
get_alarm_double };
|
||||
|
||||
struct wfdset { /* waveform dset */
|
||||
long number;
|
||||
DEVSUPFUN dev_report;
|
||||
@@ -126,18 +123,10 @@ struct wfdset { /* waveform dset */
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_wf; /*returns: (-1,0)=>(failure,success)*/
|
||||
};
|
||||
|
||||
/*sizes of field types*/
|
||||
static int sizeofTypes[] = {0,1,1,2,2,4,4,4,8,2};
|
||||
|
||||
static void monitor();
|
||||
static long readValue();
|
||||
|
||||
/*Following from timing system */
|
||||
/*
|
||||
extern unsigned int gts_trigger_counter;
|
||||
*/
|
||||
|
||||
|
||||
static long init_record(pwf,pass)
|
||||
struct waveformRecord *pwf;
|
||||
@@ -214,17 +203,6 @@ static long process(pwf)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_value(pwf,pvdes)
|
||||
struct waveformRecord *pwf;
|
||||
struct valueDes *pvdes;
|
||||
{
|
||||
|
||||
pvdes->no_elements=pwf->nord;
|
||||
pvdes->pvalue = pwf->bptr;
|
||||
pvdes->field_type = pwf->ftvl;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long cvt_dbaddr(paddr)
|
||||
struct dbAddr *paddr;
|
||||
{
|
||||
@@ -238,7 +216,7 @@ static long cvt_dbaddr(paddr)
|
||||
paddr->dbr_field_type = pwf->ftvl;
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long get_array_info(paddr,no_elements,offset)
|
||||
struct dbAddr *paddr;
|
||||
long *no_elements;
|
||||
@@ -261,7 +239,7 @@ static long put_array_info(paddr,nNew)
|
||||
if(pwf->nord > pwf->nelm) pwf->nord = pwf->nelm;
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long get_units(paddr,units)
|
||||
struct dbAddr *paddr;
|
||||
char *units;
|
||||
@@ -283,7 +261,7 @@ static long get_precision(paddr,precision)
|
||||
recGblGetPrec(paddr,precision);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long get_graphic_double(paddr,pgd)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_grDouble *pgd;
|
||||
@@ -308,7 +286,7 @@ static long get_control_double(paddr,pcd)
|
||||
} else recGblGetControlDouble(paddr,pcd);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static void monitor(pwf)
|
||||
struct waveformRecord *pwf;
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user