jba: fixed pass test karonis: added PV_LINK code

This commit is contained in:
Janet B. Anderson
1992-04-23 09:55:42 +00:00
parent f4a0af7478
commit fa1cd87e78
5 changed files with 112 additions and 13 deletions

View File

@@ -103,6 +103,10 @@ struct longoutdset { /* longout input dset */
void alarm();
int convert();
void monitor();
/* Added for Channel Access Links */
long dbCaAddInlink();
long dbCaGetLink();
static long init_record(plongout,pass)
struct longoutRecord *plongout;
@@ -111,7 +115,7 @@ static long init_record(plongout,pass)
struct longoutdset *pdset;
long status=0;
if (pass!=0) return(0);
if (pass==0) return(0);
if(!(pdset = (struct longoutdset *)(plongout->dset))) {
recGblRecordError(S_dev_noDSET,plongout,"longout: init_record");
@@ -127,6 +131,12 @@ static long init_record(plongout,pass)
plongout->val = plongout->dol.value.value;
plongout->udf=FALSE;
}
if (plongout->dol.type == PV_LINK)
{
status = dbCaAddInlink(&(plongout->dol), (void *) plongout, "VAL");
if(status) return(status);
} /* endif */
if( pdset->init_record ) {
if((status=(*pdset->init_record)(plongout))) return(status);
}
@@ -158,6 +168,14 @@ static long process(plongout)
recGblSetSevr(plongout,LINK_ALARM,VALID_ALARM);
} else plongout->udf=FALSE;
}
if((plongout->dol.type == CA_LINK) && (plongout->omsl == CLOSED_LOOP)){
plongout->pact = TRUE;
status = dbCaGetLink(&(plongout->dol));
plongout->pact = FALSE;
if(status!=0){
recGblSetSevr(plongout,LINK_ALARM,VALID_ALARM);
} else plongout->udf=FALSE;
}
}
if(status==0) {

View File

@@ -111,6 +111,10 @@ struct pcdset { /* pulseCounter input dset */
#define CTR_SETUP 4
void monitor();
/* Added for Channel Access Links */
long dbCaAddInlink();
long dbCaGetLink();
static long init_record(ppc,pass)
struct pulseCounterRecord *ppc;
@@ -119,7 +123,7 @@ static long init_record(ppc,pass)
struct pcdset *pdset;
long status=0;
if (pass!=0) return(0);
if (pass==0) return(0);
/* must have device support */
if(!(pdset = (struct pcdset *)(ppc->dset))) {
@@ -131,6 +135,12 @@ static long init_record(ppc,pass)
ppc->sgv = ppc->sgl.value.value;
}
if (ppc->sgl.type == PV_LINK && ppc->gsrc == SOFTWARE)
{
status = dbCaAddInlink(&(ppc->sgl), (void *) ppc, "SGV");
if(status) return(status);
} /* endif */
/* must have cmd_pc functions defined */
if( (pdset->number < 5) || (pdset->cmd_pc == NULL) ) {
recGblRecordError(S_dev_missingSup,ppc,"pc: cmd_pc");
@@ -172,6 +182,14 @@ static long process(ppc)
recGblSetSevr(ppc,LINK_ALARM,VALID_ALARM);
}
}
if (ppc->sgl.type == CA_LINK){
ppc->pact = TRUE;
status=dbCaGetLink(&(ppc->sgl));
ppc->pact = FALSE;
if(status!=0) {
recGblSetSevr(ppc,LINK_ALARM,VALID_ALARM);
}
}
if(status=0){
if(ppc->sgv != ppc->osgv){ /* soft gate changed */
save=ppc->cmd;

View File

@@ -113,6 +113,10 @@ struct ptdset { /* pulseTrain input dset */
#define CTR_SETUP 4
void monitor();
/* Added for Channel Access Links */
long dbCaAddInlink();
long dbCaGetLink();
static long init_record(ppt,pass)
struct pulseTrainRecord *ppt;
@@ -121,7 +125,7 @@ static long init_record(ppt,pass)
struct ptdset *pdset;
long status=0;
if (pass!=0) return(0);
if (pass==0) return(0);
/* must have device support */
if(!(pdset = (struct ptdset *)(ppt->dset))) {
@@ -133,6 +137,12 @@ static long init_record(ppt,pass)
ppt->gate = ppt->sgl.value.value;
}
if (ppt->sgl.type == PV_LINK )
{
status = dbCaAddInlink(&(ppt->sgl), (void *) ppt, "SGV");
if(status) return(status);
} /* endif */
/* must have write_pt functions defined */
if( (pdset->number < 5) || (pdset->write_pt == NULL) ) {
recGblRecordError(S_dev_missingSup,ppt,"pt: write_pt");
@@ -175,6 +185,14 @@ static long process(ppt)
recGblSetSevr(ppt,LINK_ALARM,VALID_ALARM);
}
}
if (ppt->sgl.type == CA_LINK){
ppt->pact = TRUE;
status=dbCaGetLink(&(ppt->sgl));
ppt->pact = FALSE;
if(status!=0) {
recGblSetSevr(ppt,LINK_ALARM,VALID_ALARM);
}
}
if(status=0){
/* gate changed */
if(ppt->sgv != ppt->osgv){

View File

@@ -101,6 +101,10 @@ struct stringoutdset { /* stringout input dset */
DEVSUPFUN write_stringout;/*(-1,0)=>(failure,success)*/
};
void monitor();
/* Added for Channel Access Links */
long dbCaAddInlink();
long dbCaGetLink();
static long init_record(pstringout,pass)
struct stringoutRecord *pstringout;
@@ -109,7 +113,7 @@ static long init_record(pstringout,pass)
struct stringoutdset *pdset;
long status=0;
if (pass!=0) return(0);
if (pass==0) return(0);
if(!(pdset = (struct stringoutdset *)(pstringout->dset))) {
recGblRecordError(S_dev_noDSET,pstringout,"stringout: init_record");
@@ -127,6 +131,12 @@ static long init_record(pstringout,pass)
}
pstringout->udf=FALSE;
}
if (pstringout->dol.type == PV_LINK)
{
status = dbCaAddInlink(&(pstringout->dol), (void *) pstringout, "VAL");
if(status) return(status);
pstringout->udf=FALSE;
} /* endif */
if( pdset->init_record ) {
if((status=(*pdset->init_record)(pstringout))) return(status);
}
@@ -159,6 +169,14 @@ static long process(pstringout)
recGblSetSevr(pstringout,LINK_ALARM,VALID_ALARM);
} else pstringout->udf=FALSE;
}
if((pstringout->dol.type == CA_LINK) && (pstringout->omsl == CLOSED_LOOP)){
pstringout->pact = TRUE;
status = dbCaGetLink(&(pstringout->dol));
pstringout->pact = FALSE;
if(!status==0){
recGblSetSevr(pstringout,LINK_ALARM,VALID_ALARM);
} else pstringout->udf=FALSE;
} /* endif */
}
if(status==0) {

View File

@@ -100,6 +100,15 @@ void alarm();
void monitor();
long do_sub();
long fetch_values();
/* Added for Channel Access Links */
long dbCaAddInlink();
long dbCaGetLink();
#define ARG_MAX 12
/* Fldnames should have as many as ARG_MAX */
static char Fldnames[ARG_MAX][FLDNAME_SZ] =
{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"};
static long init_record(psub,pass)
struct subRecord *psub;
@@ -114,12 +123,17 @@ static long init_record(psub,pass)
int i;
double *pvalue;
if (pass!=0) return(0);
if (pass==0) return(0);
plink = &psub->inpa;
pvalue = &psub->a;
for(i=0; i<ARG_MAX; i++, plink++, pvalue++) {
if(plink->type==CONSTANT) *pvalue = plink->value.value;
if (plink->type == PV_LINK)
{
status = dbCaAddInlink(plink, (void *) psub, Fldnames[i]);
if(status) return(status);
} /* endif */
}
/* convert the initialization subroutine name */
@@ -356,15 +370,28 @@ struct subRecord *psub;
long status;
for(i=0, plink=&psub->inpa, pvalue=&psub->a; i<ARG_MAX; i++, plink++, pvalue++) {
if(plink->type!=DB_LINK) continue;
options=0;
nRequest=1;
status=dbGetLink(&plink->value.db_link,(struct dbCommon *)psub,DBR_DOUBLE,
pvalue,&options,&nRequest);
if(status!=0) {
recGblSetSevr(psub,LINK_ALARM,VALID_ALARM);
if (plink->type==CA_LINK)
{
if (dbCaGetLink(plink))
{
recGblSetSevr(psub,LINK_ALARM,VALID_ALARM);
return(-1);
}
} /* endif */
}
else
{
if(plink->type==DB_LINK)
{
options=0;
nRequest=1;
status=dbGetLink(&plink->value.db_link,(struct dbCommon *)psub,DBR_DOUBLE,
pvalue,&options,&nRequest);
if(status!=0) {
recGblSetSevr(psub,LINK_ALARM,VALID_ALARM);
return(-1);
}
} /* endif */
} /* endif */
}
return(0);
}