channel access links
This commit is contained in:
@@ -5780,7 +5780,7 @@ long (*put_convert_table[DBR_ENUM+1][DBF_DEVCHOICE+1])() = {
|
||||
putEnumEnum, putEnumEnum, putEnumEnum, putEnumEnum}
|
||||
};
|
||||
|
||||
static long dbPut(paddr,dbrType,pbuffer,nRequest)
|
||||
long dbPut(paddr,dbrType,pbuffer,nRequest)
|
||||
struct dbAddr *paddr;
|
||||
short dbrType;
|
||||
caddr_t pbuffer;
|
||||
|
||||
@@ -1396,13 +1396,13 @@ static void dbprReportLink(pMsgBuff,pfield_name,plink,field_type, tab_size)
|
||||
}
|
||||
dbpr_msgOut(pMsgBuff,tab_size);
|
||||
break;
|
||||
case CA_LINK:
|
||||
sprintf(pmsg,"%4s: CA_LINK pp=%1d ms=%1d Not Yet Implemented",
|
||||
pfield_name,
|
||||
plink->value.ca_link.process_passive,
|
||||
plink->value.ca_link.maximize_sevr);
|
||||
dbpr_msgOut(pMsgBuff,tab_size);
|
||||
break;
|
||||
/* case CA_LINK: */
|
||||
/* sprintf(pmsg,"%4s: CA_LINK pp=%1d ms=%1d Not Yet Implemented", */
|
||||
/* pfield_name, */
|
||||
/* plink->value.ca_link.process_passive, */
|
||||
/* plink->value.ca_link.maximize_sevr); */
|
||||
/* dbpr_msgOut(pMsgBuff,tab_size); */
|
||||
/* break; */
|
||||
default:
|
||||
sprintf(pmsg,"%4s: dbprReportLink: Illegal link.type",
|
||||
pfield_name);
|
||||
|
||||
@@ -207,6 +207,10 @@ static long initRecSup()
|
||||
recSup = calloc(1,nbytes);
|
||||
recSup->number = dbRecType->number;
|
||||
recSup->papRset = (void *)((long)recSup + (long)sizeof(struct recSup));
|
||||
|
||||
/* added for Channel Access Links */
|
||||
dbCaLinkInit((int) 1);
|
||||
|
||||
for(i=0; i< (recSup->number); i++) {
|
||||
if(dbRecType->papName[i] == NULL)continue;
|
||||
strcpy(name,"_");
|
||||
@@ -227,6 +231,10 @@ static long initRecSup()
|
||||
if(status==0) status = rtnval;
|
||||
}
|
||||
}
|
||||
|
||||
/* added for Channel Access Links */
|
||||
dbCaLinkInit((int) 2);
|
||||
|
||||
return(status);
|
||||
}
|
||||
|
||||
@@ -377,16 +385,27 @@ static long initDatabase()
|
||||
*((struct dbAddr *)(plink->value.db_link.pdbAddr))=dbAddr;
|
||||
}
|
||||
else {
|
||||
/*This will be replaced by channel access call*/
|
||||
strncpy(message,precord->name,PVNAME_SZ);
|
||||
message[PVNAME_SZ]=0;
|
||||
strcat(message,".");
|
||||
strncat(message,pfldDes->fldname,FLDNAME_SZ);
|
||||
strcat(message,": link process variable =");
|
||||
strcat(message,name);
|
||||
strcat(message," not found");
|
||||
status = S_db_notFound;
|
||||
errMessage(status,message);
|
||||
/* not a local pvar ... assuming a CA_LINK */
|
||||
/* only supporting NPP, Input MS/NMS, and */
|
||||
/* Output NMS links ... checking here. */
|
||||
|
||||
if (plink->value.db_link.process_passive
|
||||
|| (pfldDes->field_type == DBF_OUTLINK
|
||||
&& plink->value.db_link.maximize_sevr))
|
||||
{
|
||||
/* link PP and/or Outlink MS ... */
|
||||
/* neither supported under CA_LINKs */
|
||||
strncpy(message,precord->name,PVNAME_SZ);
|
||||
message[PVNAME_SZ]=0;
|
||||
strcat(message,".");
|
||||
strncat(message,pfldDes->fldname,FLDNAME_SZ);
|
||||
strcat(message,": link process variable =");
|
||||
strcat(message,name);
|
||||
strcat(message," not found");
|
||||
status = S_db_notFound;
|
||||
errMessage(status,message);
|
||||
if(rtnval==OK) rtnval=status;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,11 @@
|
||||
#include <special.h>
|
||||
#include <aoRecord.h>
|
||||
|
||||
/* added for Channel Access Links */
|
||||
void dbCaAddOutlink();
|
||||
long dbCaPutLink();
|
||||
long init_record();
|
||||
|
||||
/* Create the dset for devAoSoft */
|
||||
long write_ao();
|
||||
struct {
|
||||
@@ -64,17 +69,41 @@ struct {
|
||||
6,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
write_ao,
|
||||
NULL};
|
||||
|
||||
|
||||
static long init_record(pao)
|
||||
struct aoRecord *pao;
|
||||
{
|
||||
|
||||
char source_pvarname[((PVNAME_SZ)+(FLDNAME_SZ)+2)];
|
||||
struct dbAddr source_dbaddr;
|
||||
|
||||
if (pao->out.type == PV_LINK)
|
||||
{
|
||||
sprintf(source_pvarname, "%s.OVAL", pao->name);
|
||||
|
||||
if (dbNameToAddr(source_pvarname, &source_dbaddr))
|
||||
printf("ERROR: devAoSoft.c init_record() problem in dbNameToAddr()\n");
|
||||
else
|
||||
dbCaAddOutlink(&(pao->out), (void *) pao, "OVAL");
|
||||
} /* endif */
|
||||
|
||||
return ((long) 0);
|
||||
|
||||
} /* end init_record() */
|
||||
|
||||
static long write_ao(pao)
|
||||
struct aoRecord *pao;
|
||||
{
|
||||
char message[100];
|
||||
long status;
|
||||
/* added for Channel Access Links */
|
||||
long options;
|
||||
long nrequest;
|
||||
|
||||
/* ao.out must be a CONSTANT or a DB_LINK or a CA_LINK*/
|
||||
switch (pao->out.type) {
|
||||
@@ -88,6 +117,9 @@ static long write_ao(pao)
|
||||
}
|
||||
break;
|
||||
case (CA_LINK) :
|
||||
options = (long) 0;
|
||||
nrequest = (long) 1;
|
||||
status = dbCaPutLink(&(pao->out), &options, &nrequest);
|
||||
break;
|
||||
default :
|
||||
if(recGblSetSevr(pao,SOFT_ALARM,VALID_ALARM)){
|
||||
|
||||
@@ -49,6 +49,11 @@
|
||||
#include <special.h>
|
||||
#include <aoRecord.h>
|
||||
|
||||
/* added for Channel Access Links */
|
||||
void dbCaAddOutlink();
|
||||
long dbCaPutLink();
|
||||
long init_record();
|
||||
|
||||
/* Create the dset for devAoSoftRaw */
|
||||
static long write_ao();
|
||||
static long special_linconv();
|
||||
@@ -64,17 +69,39 @@ struct {
|
||||
6,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
write_ao,
|
||||
special_linconv};
|
||||
|
||||
static long init_record(pao)
|
||||
struct aoRecord *pao;
|
||||
{
|
||||
|
||||
char source_pvarname[((PVNAME_SZ)+(FLDNAME_SZ)+2)];
|
||||
struct dbAddr source_dbaddr;
|
||||
|
||||
if (pao->out.type == PV_LINK)
|
||||
{
|
||||
sprintf(source_pvarname, "%s.RVAL", pao->name);
|
||||
if (dbNameToAddr(source_pvarname, &source_dbaddr))
|
||||
printf("ERROR: devAoSoftRaw.c init_record() problem in dbNameToAddr()\n");
|
||||
else
|
||||
dbCaAddOutlink(&(pao->out), (void *) pao, "RVAL");
|
||||
} /* endif */
|
||||
|
||||
return ((long) 0);
|
||||
|
||||
} /* end init_record() */
|
||||
|
||||
static long write_ao(pao)
|
||||
struct aoRecord *pao;
|
||||
{
|
||||
char message[100];
|
||||
long status;
|
||||
/* added for Channel Access Links */
|
||||
long options;
|
||||
long nrequest;
|
||||
|
||||
/* ao.out must be a CONSTANT or a DB_LINK or a CA_LINK*/
|
||||
switch (pao->out.type) {
|
||||
@@ -88,6 +115,9 @@ static long write_ao(pao)
|
||||
}
|
||||
break;
|
||||
case (CA_LINK) :
|
||||
options = (long) 0;
|
||||
nrequest = (long) 1;
|
||||
status = dbCaPutLink(&(pao->out), &options, &nrequest);
|
||||
break;
|
||||
default :
|
||||
if(recGblSetSevr(pao,SOFT_ALARM,VALID_ALARM)){
|
||||
|
||||
@@ -124,6 +124,14 @@ long calcPerform();
|
||||
long postfix();
|
||||
int fetch_values();
|
||||
#define ARG_MAX 12
|
||||
/* Database Channel Access Link Functions */
|
||||
void dbCaAddInlink();
|
||||
long dbCaGetLink();
|
||||
|
||||
/* 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(pcalc)
|
||||
struct calcRecord *pcalc;
|
||||
@@ -135,10 +143,22 @@ static long init_record(pcalc)
|
||||
short error_number;
|
||||
char rpbuf[80];
|
||||
|
||||
char dest_pvarname[((PVNAME_SZ)+(FLDNAME_SZ)+2)];
|
||||
struct dbAddr dest_dbaddr;
|
||||
|
||||
plink = &pcalc->inpa;
|
||||
pvalue = &pcalc->a;
|
||||
for(i=0; i<ARG_MAX; i++, plink++, pvalue++) {
|
||||
if(plink->type==CONSTANT) *pvalue = plink->value.value;
|
||||
if (plink->type == PV_LINK)
|
||||
{
|
||||
sprintf(dest_pvarname, "%s.%s", pcalc->name, Fldnames[i]);
|
||||
|
||||
if (dbNameToAddr(dest_pvarname, &dest_dbaddr))
|
||||
printf("ERROR: recCalc.c init_record() problem in dbNameToAddr()\n");
|
||||
else
|
||||
dbCaAddInlink(plink, (void *) pcalc, Fldnames[i]);
|
||||
} /* endif */
|
||||
}
|
||||
status=postfix(pcalc->calc,rpbuf,&error_number);
|
||||
if(status) return(status);
|
||||
@@ -369,16 +389,24 @@ struct calcRecord *pcalc;
|
||||
long status;
|
||||
|
||||
for(i=0, plink=&pcalc->inpa, pvalue=&pcalc->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 *)pcalc,DBR_DOUBLE,
|
||||
pvalue,&options,&nRequest);
|
||||
if(status!=0) {
|
||||
recGblSetSevr(pcalc,LINK_ALARM,VALID_ALARM);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (plink->type == CA_LINK)
|
||||
{
|
||||
if (dbCaGetLink(plink))
|
||||
printf("fetch_values() problem in dbCaGetLink()\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(plink->type==DB_LINK)
|
||||
{
|
||||
options=0;
|
||||
nRequest=1;
|
||||
status = dbGetLink(&plink->value.db_link,(struct dbCommon *)pcalc,DBR_DOUBLE, pvalue,&options,&nRequest);
|
||||
if(status!=0) {
|
||||
recGblSetSevr(pcalc,LINK_ALARM,VALID_ALARM);
|
||||
return(-1);
|
||||
}
|
||||
} /* endif */
|
||||
} /* endif */
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user