changes to field names to make easier to understand and operate
This commit is contained in:
@@ -102,7 +102,7 @@ struct pcdset { /* pulseCounter input dset */
|
||||
DEVSUPFUN cmd_pc;/*(-1,0)=>(failure,success*/
|
||||
};
|
||||
|
||||
/* def for gsrc field */
|
||||
/* def for gtyp field */
|
||||
#define SOFTWARE 1
|
||||
|
||||
/* defs for counter commands */
|
||||
@@ -129,12 +129,12 @@ static long init_record(ppc,pass)
|
||||
recGblRecordError(S_dev_noDSET,(void *)ppc,"pc: init_record");
|
||||
return(S_dev_noDSET);
|
||||
}
|
||||
/* get the gate value if sgl is a constant*/
|
||||
if (ppc->sgl.type == CONSTANT && ppc->gsrc == SOFTWARE){
|
||||
/* get the igv value if sgl is a constant*/
|
||||
if (ppc->sgl.type == CONSTANT && ppc->gtyp == SOFTWARE){
|
||||
ppc->sgv = ppc->sgl.value.value;
|
||||
}
|
||||
|
||||
if (ppc->sgl.type == PV_LINK && ppc->gsrc == SOFTWARE)
|
||||
if (ppc->sgl.type == PV_LINK && ppc->gtyp == SOFTWARE)
|
||||
{
|
||||
status = dbCaAddInlink(&(ppc->sgl), (void *) ppc, "SGV");
|
||||
if(status) return(status);
|
||||
@@ -168,8 +168,8 @@ static long process(ppc)
|
||||
return(S_dev_missingSup);
|
||||
}
|
||||
|
||||
/* get soft gate value when sgl is a DB_LINK and gsrc from Software */
|
||||
if (!ppc->pact && ppc->gsrc == SOFTWARE){
|
||||
/* get soft igv value when sgl is a DB_LINK and gtyp from Software */
|
||||
if (!ppc->pact && ppc->gtyp == SOFTWARE){
|
||||
if (ppc->sgl.type == DB_LINK){
|
||||
options=0;
|
||||
nRequest=1;
|
||||
@@ -190,7 +190,7 @@ static long process(ppc)
|
||||
}
|
||||
}
|
||||
if(status==0){
|
||||
if(ppc->sgv != ppc->osgv){ /* soft gate changed */
|
||||
if(ppc->sgv != ppc->osgv){ /* soft igv changed */
|
||||
save=ppc->cmd;
|
||||
if(ppc->sgv!=0){
|
||||
ppc->cmd=CTR_START;
|
||||
|
||||
+119
-1
@@ -59,7 +59,7 @@
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
#define special NULL
|
||||
static long special();
|
||||
static long get_value();
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
@@ -124,6 +124,31 @@ static long init_record(ppd,pass)
|
||||
recGblRecordError(S_dev_missingSup,(void *)ppd,"pd: write_pd");
|
||||
return(S_dev_missingSup);
|
||||
}
|
||||
|
||||
/* get the soft trigger value if stl is a constant*/
|
||||
if(ppd->stl.type==CONSTANT)
|
||||
{
|
||||
ppd->stv=ppd->stl.value.value;
|
||||
}
|
||||
|
||||
if(ppd->stl.type==PV_LINK)
|
||||
{
|
||||
status = dbCaAddInlink(&(ppd->stl), (void *) ppd, "STV");
|
||||
if(status) return(status);
|
||||
}
|
||||
|
||||
/* get the soft gate value if glnk is a constant*/
|
||||
if(ppd->glnk.type==CONSTANT)
|
||||
{
|
||||
ppd->gate=ppd->glnk.value.value;
|
||||
}
|
||||
|
||||
if(ppd->glnk.type==PV_LINK)
|
||||
{
|
||||
status = dbCaAddInlink(&(ppd->glnk), (void *) ppd, "GLNK");
|
||||
if(status) return(status);
|
||||
}
|
||||
|
||||
/* call device support init_record */
|
||||
if( pdset->init_record ) {
|
||||
if((status=(*pdset->init_record)(ppd))) return(status);
|
||||
@@ -137,6 +162,7 @@ static long process(ppd)
|
||||
struct pddset *pdset = (struct pddset *)(ppd->dset);
|
||||
long status=0;
|
||||
unsigned char pact=ppd->pact;
|
||||
long nRequest,options;
|
||||
|
||||
/* must have write_pd functions defined */
|
||||
if( (pdset==NULL) || (pdset->write_pd==NULL) ) {
|
||||
@@ -145,8 +171,66 @@ static long process(ppd)
|
||||
return(S_dev_missingSup);
|
||||
}
|
||||
|
||||
if(!ppd->pact)
|
||||
{
|
||||
/* get soft trigger value when stl is DB_LINK */
|
||||
switch(ppd->stl.type)
|
||||
{
|
||||
case DB_LINK:
|
||||
options=0;
|
||||
nRequest=1;
|
||||
ppd->pact = TRUE;
|
||||
status=dbGetLink(&ppd->stl.value.db_link,
|
||||
(struct dbCommon *)ppd,DBR_SHORT,
|
||||
&ppd->stv,&options,&nRequest);
|
||||
ppd->pact = FALSE;
|
||||
|
||||
if(status!=0) recGblSetSevr(ppd,LINK_ALARM,INVALID_ALARM);
|
||||
|
||||
break;
|
||||
|
||||
case CA_LINK:
|
||||
ppd->pact = TRUE;
|
||||
status=dbCaGetLink(&(ppd->stl));
|
||||
ppd->pact = FALSE;
|
||||
|
||||
if(status!=0) recGblSetSevr(ppd,LINK_ALARM,INVALID_ALARM);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* get soft gate value when glnk is DB_LINK */
|
||||
switch(ppd->glnk.type)
|
||||
{
|
||||
case DB_LINK:
|
||||
options=0;
|
||||
nRequest=1;
|
||||
ppd->pact = TRUE;
|
||||
status=dbGetLink(&ppd->glnk.value.db_link,
|
||||
(struct dbCommon *)ppd,DBR_SHORT,
|
||||
&ppd->gate,&options,&nRequest);
|
||||
ppd->pact = FALSE;
|
||||
|
||||
if(status!=0) recGblSetSevr(ppd,LINK_ALARM,INVALID_ALARM);
|
||||
|
||||
break;
|
||||
|
||||
case CA_LINK:
|
||||
ppd->pact = TRUE;
|
||||
status=dbCaGetLink(&(ppd->glnk));
|
||||
ppd->pact = FALSE;
|
||||
|
||||
if(status!=0) recGblSetSevr(ppd,LINK_ALARM,INVALID_ALARM);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (status==0) status=(*pdset->write_pd)(ppd); /* write the new value */
|
||||
|
||||
/* reset field causing processing parameter */
|
||||
ppd->pfld=0;
|
||||
|
||||
/* check if device support set pact */
|
||||
if ( !pact && ppd->pact ) return(0);
|
||||
ppd->pact = TRUE;
|
||||
@@ -185,6 +269,40 @@ static long get_precision(paddr,precision)
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
This routine is used to set the pfld element to true if
|
||||
the field causing the processing is dly, hts, or stv.
|
||||
-----------------------------------------------------------------------*/
|
||||
|
||||
#define DLY_FIELD 0x0001
|
||||
#define WIDE_FIELD 0x0002
|
||||
#define STV_FIELD 0x0004
|
||||
#define GATE_FIELD 0x0008
|
||||
#define HTS_FIELD 0x0010
|
||||
|
||||
static long special(paddr,after)
|
||||
struct dbAddr *paddr;
|
||||
int after;
|
||||
{
|
||||
struct pulseDelayRecord *pd=(struct pulseDelayRecord *)paddr->precord;
|
||||
|
||||
/* pre-processing mode */
|
||||
if(!after) return(0);
|
||||
|
||||
if(paddr->pfield==&(pd->dly))
|
||||
pd->pfld|=DLY_FIELD;
|
||||
else if(paddr->pfield==&(pd->wide))
|
||||
pd->pfld|=WIDE_FIELD;
|
||||
else if(paddr->pfield==&(pd->stv))
|
||||
pd->pfld|=STV_FIELD;
|
||||
else if(paddr->pfield==&(pd->hts))
|
||||
pd->pfld|=HTS_FIELD;
|
||||
else if(paddr->pfield==&(pd->gate))
|
||||
pd->pfld|=GATE_FIELD;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_graphic_double(paddr,pgd)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_grDouble *pgd;
|
||||
|
||||
+17
-28
@@ -39,6 +39,8 @@
|
||||
* .08 06-02-92 jba changed graphic/control limits for per,oper
|
||||
* .09 07-15-92 jba changed VALID_ALARM to INVALID alarm
|
||||
* .10 07-16-92 jba added invalid alarm fwd link test and chngd fwd lnk to macro
|
||||
* .11 09-10-92 jba replaced get of igv value with call to recGblGetLinkvalue
|
||||
* .12 10-10-92 jba replaced code with recGblGetLinkValue call
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
@@ -105,7 +107,7 @@ struct ptdset { /* pulseTrain input dset */
|
||||
DEVSUPFUN write_pt;/*(-1,0)=>(failure,success)*/
|
||||
};
|
||||
|
||||
/* def for gsrc field */
|
||||
/* def for gtyp field */
|
||||
#define SOFTWARE 1
|
||||
|
||||
/* defs for counter commands */
|
||||
@@ -132,9 +134,9 @@ static long init_record(ppt,pass)
|
||||
recGblRecordError(S_dev_noDSET,(void *)ppt,"pt: init_record");
|
||||
return(S_dev_noDSET);
|
||||
}
|
||||
/* get the gate value if sgl is a constant*/
|
||||
/* get the igv value if sgl is a constant*/
|
||||
if (ppt->sgl.type == CONSTANT ){
|
||||
ppt->gate = ppt->sgl.value.value;
|
||||
ppt->igv = ppt->sgl.value.value;
|
||||
}
|
||||
|
||||
if (ppt->sgl.type == PV_LINK )
|
||||
@@ -172,30 +174,17 @@ static long process(ppt)
|
||||
return(S_dev_missingSup);
|
||||
}
|
||||
|
||||
/* get soft gate value when sgl is a DB_LINK and gsrc from Software */
|
||||
if (!ppt->pact && ppt->gsrc == SOFTWARE){
|
||||
if (ppt->sgl.type == DB_LINK){
|
||||
options=0;
|
||||
nRequest=1;
|
||||
ppt->pact = TRUE;
|
||||
status=dbGetLink(&ppt->sgl.value.db_link,(struct dbCommon *)ppt,DBR_SHORT,
|
||||
&ppt->sgv,&options,&nRequest);
|
||||
ppt->pact = FALSE;
|
||||
if(status!=0) {
|
||||
recGblSetSevr(ppt,LINK_ALARM,INVALID_ALARM);
|
||||
}
|
||||
}
|
||||
if (ppt->sgl.type == CA_LINK){
|
||||
ppt->pact = TRUE;
|
||||
status=dbCaGetLink(&(ppt->sgl));
|
||||
ppt->pact = FALSE;
|
||||
if(status!=0) {
|
||||
recGblSetSevr(ppt,LINK_ALARM,INVALID_ALARM);
|
||||
}
|
||||
}
|
||||
if(status=0){
|
||||
/* gate changed */
|
||||
if(ppt->sgv != ppt->osgv){
|
||||
/* get soft igv value when sgl is a DB_LINK and gtyp from Software */
|
||||
if (!ppt->pact && ppt->gtyp == SOFTWARE){
|
||||
options=0;
|
||||
nRequest=1;
|
||||
ppt->pact = TRUE;
|
||||
status=recGblGetLinkValue(&(ppt->sgl),(void *)ppt,DBR_SHORT,
|
||||
&(ppt->sgv),&options,&nRequest);
|
||||
ppt->pact = FALSE;
|
||||
|
||||
if(status==0){
|
||||
if(ppt->sgv != ppt->osgv){ /* igv changed */
|
||||
if(ppt->sgv==0){
|
||||
save=ppt->dcy;
|
||||
ppt->dcy=0.0;
|
||||
@@ -210,7 +199,7 @@ static long process(ppt)
|
||||
}
|
||||
}
|
||||
|
||||
if (status==0 && (ppt->gsrc!=SOFTWARE || ppt->sgv!=0))
|
||||
if (status==0 && (ppt->gtyp!=SOFTWARE || ppt->sgv!=0))
|
||||
status=(*pdset->write_pt)(ppt);
|
||||
|
||||
/* check if device support set pact */
|
||||
|
||||
Reference in New Issue
Block a user