From 431000a3476984fef419de299525083650329918 Mon Sep 17 00:00:00 2001 From: Nick Karonis Date: Fri, 17 Apr 1992 14:00:20 +0000 Subject: [PATCH] *** empty log message *** --- src/db/dbCaDblink.c | 6 ++-- src/db/dbCaLink.c | 66 ++++++++++++++++++++++++++++++--------- src/dev/devAiSoft.c | 15 +++++++-- src/dev/devAiSoftRaw.c | 13 ++++++++ src/dev/devAoSoft.c | 24 ++++++-------- src/dev/devAoSoftRaw.c | 23 ++++++-------- src/dev/devBiSoft.c | 14 ++++++++- src/dev/devBiSoftRaw.c | 14 ++++++++- src/dev/devBoSoft.c | 26 ++++++++++++++- src/dev/devBoSoftRaw.c | 26 ++++++++++++++- src/dev/devEventSoft.c | 14 ++++++++- src/dev/devLiSoft.c | 14 ++++++++- src/dev/devLoSoft.c | 28 ++++++++++++++++- src/dev/devMbbiSoft.c | 14 +++++++++ src/dev/devMbbiSoftRaw.c | 14 +++++++++ src/dev/devMbboSoft.c | 26 ++++++++++++++- src/dev/devMbboSoftRaw.c | 26 ++++++++++++++- src/dev/devPtSoft.c | 26 ++++++++++++++- src/dev/devSiSoft.c | 13 ++++++++ src/dev/devSoSoft.c | 28 ++++++++++++++++- src/dev/devWfSoft.c | 13 ++++++++ src/rec/recCalc.c | 31 +++++++++--------- src/rec/recFanout.c | 20 ++++++++++++ src/rec/recPid.c | 18 +++++++++++ src/rec/recSel.c | 45 +++++++++++++++++++++++++- src/rec/recSteppermotor.c | 28 +++++++++++++++-- src/rec/recTimer.c | 22 +++++++++++++ 27 files changed, 528 insertions(+), 79 deletions(-) diff --git a/src/db/dbCaDblink.c b/src/db/dbCaDblink.c index e66c6ca3d..825ba2aaa 100644 --- a/src/db/dbCaDblink.c +++ b/src/db/dbCaDblink.c @@ -604,9 +604,11 @@ short old_dbr_type; { case DBR_STRING: old_dbr_type = oldDBR_STRING; break; case DBR_CHAR: old_dbr_type = oldDBR_CHAR; break; - case DBR_UCHAR: old_dbr_type = oldDBR_CHAR; break; + /* case DBR_UCHAR: old_dbr_type = oldDBR_CHAR; break; */ + case DBR_UCHAR: old_dbr_type = oldDBR_SHORT; break; case DBR_SHORT: old_dbr_type = oldDBR_SHORT; break; - case DBR_USHORT: old_dbr_type = oldDBR_ENUM; break; + /* case DBR_USHORT: old_dbr_type = oldDBR_ENUM; break; */ + case DBR_USHORT: old_dbr_type = oldDBR_LONG; break; case DBR_LONG: old_dbr_type = oldDBR_LONG; break; case DBR_ULONG: old_dbr_type = oldDBR_LONG; break; case DBR_FLOAT: old_dbr_type = oldDBR_FLOAT; break; diff --git a/src/db/dbCaLink.c b/src/db/dbCaLink.c index 35dc26354..971c0c59c 100644 --- a/src/db/dbCaLink.c +++ b/src/db/dbCaLink.c @@ -57,6 +57,9 @@ /* needed for spawnTask priority parms */ #include +/* needed for #define memcpy() */ +#include + #include #include @@ -87,7 +90,7 @@ struct input_pvar short dest_old_dbr_sts_type; /* for checking in my_event_handler() */ short revised_dest_new_dbr_type; unsigned short source_severity; - int dest_old_dbr_element_size; /* for calloc() and bcopy() */ + int dest_old_dbr_element_size; /* for calloc() and memcpy() */ FAST_LOCK lock; BOOL maximize_severity; BOOL needs_reading; @@ -946,6 +949,8 @@ BOOL done; if (RTN_SUCCESS(status) && Pvar_disconnectedlist_hdr) { + /* there are nodes on the disconnected list */ + FASTLOCK(&Buffer); if (Pvar_writelist_hdr) @@ -969,6 +974,9 @@ BOOL done; FASTUNLOCK(&Buffer); + /* kludge suggested by Jeff Hill so that we can have reliable */ + /* connection management for vxWorks hosted CA clients */ + process_asynch_events((float) 0.1); } /* endif */ } /* endwhile */ } /* endif */ @@ -1454,9 +1462,13 @@ char print_line[500]; pi->needs_reading = TRUE; pi->last_rcvd_nelements = arg.count; - bcopy( - (char *) ((struct dbr_sts_string *) arg.dbr)->value, +/* bcopy( */ +/* (char *) ((struct dbr_sts_string *) arg.dbr)->value, */ +/* (char *) pi->pvalue, */ +/* (arg.count * pi->dest_old_dbr_element_size)); */ + memcpy( (char *) pi->pvalue, + (char *) ((struct dbr_sts_string *) arg.dbr)->value, (arg.count * pi->dest_old_dbr_element_size)); pi->source_severity = (unsigned short) ((struct dbr_sts_string *) arg.dbr)->severity; @@ -1471,9 +1483,13 @@ char print_line[500]; pi->needs_reading = TRUE; pi->last_rcvd_nelements = arg.count; - bcopy( - (char *) &(((struct dbr_sts_short *) arg.dbr)->value), +/* bcopy( */ +/* (char *) &(((struct dbr_sts_short *) arg.dbr)->value), */ +/* (char *) pi->pvalue, */ +/* (arg.count * pi->dest_old_dbr_element_size)); */ + memcpy( (char *) pi->pvalue, + (char *) &(((struct dbr_sts_short *) arg.dbr)->value), (arg.count * pi->dest_old_dbr_element_size)); pi->source_severity = (unsigned short) ((struct dbr_sts_short *) arg.dbr)->severity; @@ -1487,9 +1503,13 @@ char print_line[500]; pi->needs_reading = TRUE; pi->last_rcvd_nelements = arg.count; - bcopy( - (char *) &(((struct dbr_sts_float *) arg.dbr)->value), +/* bcopy( */ +/* (char *) &(((struct dbr_sts_float *) arg.dbr)->value), */ +/* (char *) pi->pvalue, */ +/* (arg.count * pi->dest_old_dbr_element_size)); */ + memcpy( (char *) pi->pvalue, + (char *) &(((struct dbr_sts_float *) arg.dbr)->value), (arg.count * pi->dest_old_dbr_element_size)); pi->source_severity = (unsigned short) ((struct dbr_sts_float *) arg.dbr)->severity; @@ -1503,9 +1523,13 @@ char print_line[500]; pi->needs_reading = TRUE; pi->last_rcvd_nelements = arg.count; - bcopy( - (char *) &(((struct dbr_sts_enum *) arg.dbr)->value), +/* bcopy( */ +/* (char *) &(((struct dbr_sts_enum *) arg.dbr)->value), */ +/* (char *) pi->pvalue, */ +/* (arg.count * pi->dest_old_dbr_element_size)); */ + memcpy( (char *) pi->pvalue, + (char *) &(((struct dbr_sts_enum *) arg.dbr)->value), (arg.count * pi->dest_old_dbr_element_size)); pi->source_severity = (unsigned short) ((struct dbr_sts_enum *) arg.dbr)->severity; @@ -1519,9 +1543,13 @@ char print_line[500]; pi->needs_reading = TRUE; pi->last_rcvd_nelements = arg.count; - bcopy( - (char *) &(((struct dbr_sts_char *) arg.dbr)->value), +/* bcopy( */ +/* (char *) &(((struct dbr_sts_char *) arg.dbr)->value), */ +/* (char *) pi->pvalue, */ +/* (arg.count * pi->dest_old_dbr_element_size)); */ + memcpy( (char *) pi->pvalue, + (char *) &(((struct dbr_sts_char *) arg.dbr)->value), (arg.count * pi->dest_old_dbr_element_size)); pi->source_severity = (unsigned short) ((struct dbr_sts_char *) arg.dbr)->severity; @@ -1534,9 +1562,13 @@ char print_line[500]; pi->needs_reading = TRUE; pi->last_rcvd_nelements = arg.count; - bcopy( - (char *) &(((struct dbr_sts_long *) arg.dbr)->value), +/* bcopy( */ +/* (char *) &(((struct dbr_sts_long *) arg.dbr)->value), */ +/* (char *) pi->pvalue, */ +/* (arg.count * pi->dest_old_dbr_element_size)); */ + memcpy( (char *) pi->pvalue, + (char *) &(((struct dbr_sts_long *) arg.dbr)->value), (arg.count * pi->dest_old_dbr_element_size)); pi->source_severity = (unsigned short) ((struct dbr_sts_long *) arg.dbr)->severity; @@ -1549,9 +1581,13 @@ char print_line[500]; pi->needs_reading = TRUE; pi->last_rcvd_nelements = arg.count; - bcopy( - (char *) &(((struct dbr_sts_double *) arg.dbr)->value), +/* bcopy( */ +/* (char *) &(((struct dbr_sts_double *) arg.dbr)->value), */ +/* (char *) pi->pvalue, */ +/* (arg.count * pi->dest_old_dbr_element_size)); */ + memcpy( (char *) pi->pvalue, + (char *) &(((struct dbr_sts_double *) arg.dbr)->value), (arg.count * pi->dest_old_dbr_element_size)); pi->source_severity = (unsigned short) ((struct dbr_sts_double *) arg.dbr)->severity; diff --git a/src/dev/devAiSoft.c b/src/dev/devAiSoft.c index e15e3a9f1..7a1ca84fa 100644 --- a/src/dev/devAiSoft.c +++ b/src/dev/devAiSoft.c @@ -50,6 +50,9 @@ #include #include #include +/* Added for Channel Access Links */ +long dbCaAddInlink(); +long dbCaGetLink(); /* Create the dset for devAiSoft */ long init_record(); @@ -76,6 +79,8 @@ static long init_record(pai) struct aiRecord *pai; { char message[100]; +/* Added for Channel Access Links */ +long status; /* ai.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ switch (pai->inp.type) { @@ -84,11 +89,11 @@ static long init_record(pai) pai->udf = FALSE; break; case (PV_LINK) : + status = dbCaAddInlink(&(pai->inp), (void *) pai, "VAL"); + if(status) return(status); break; case (DB_LINK) : break; - case (CA_LINK) : - break; default : strcpy(message,pai->name); strcat(message,": devAiSoft (init_record) Illegal INP field"); @@ -120,6 +125,12 @@ static long read_ai(pai) } else pai->udf = FALSE; break; case (CA_LINK) : + if (dbCaGetLink(&(pai->inp))) + { + recGblSetSevr(pai,LINK_ALARM,VALID_ALARM); + } + else + pai->udf = FALSE; break; default : if(recGblSetSevr(pai,SOFT_ALARM,VALID_ALARM)){ diff --git a/src/dev/devAiSoftRaw.c b/src/dev/devAiSoftRaw.c index f0bfafa84..46e243018 100644 --- a/src/dev/devAiSoftRaw.c +++ b/src/dev/devAiSoftRaw.c @@ -50,6 +50,9 @@ #include #include #include +/* Added for Channel Access Links */ +long dbCaAddInlink(); +long dbCaGetLink(); /* Create the dset for devAiSoftRaw */ long init_record(); @@ -77,6 +80,8 @@ static long init_record(pai) struct aiRecord *pai; { char message[100]; +/* Added for Channel Access Links */ +long status; /* ai.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ switch (pai->inp.type) { @@ -84,6 +89,8 @@ static long init_record(pai) pai->rval = pai->inp.value.value; break; case (PV_LINK) : + status = dbCaAddInlink(&(pai->inp), (void *) pai, "RVAL"); + if(status) return(status); break; case (DB_LINK) : break; @@ -119,6 +126,12 @@ static long read_ai(pai) break; case (CA_LINK) : + if (dbCaGetLink(&(pai->inp))) + { + recGblSetSevr(pai,LINK_ALARM,VALID_ALARM); + } + else + pai->udf = FALSE; break; default : if(recGblSetSevr(pai,SOFT_ALARM,VALID_ALARM)){ diff --git a/src/dev/devAoSoft.c b/src/dev/devAoSoft.c index ba5832bdc..51282797b 100644 --- a/src/dev/devAoSoft.c +++ b/src/dev/devAoSoft.c @@ -1,5 +1,5 @@ /* devAoSoft.c */ -/* share/src/dev $Id$ */ +/* share/src/dev @(#)devAoSoft.c 1.13 4/6/92 */ /* Device Support Routines for soft Analog Output Records*/ /* @@ -51,7 +51,7 @@ #include /* added for Channel Access Links */ -void dbCaAddOutlink(); +long dbCaAddOutlink(); long dbCaPutLink(); long init_record(); @@ -79,20 +79,14 @@ static long init_record(pao) struct aoRecord *pao; { -char source_pvarname[((PVNAME_SZ)+(FLDNAME_SZ)+2)]; -struct dbAddr source_dbaddr; +long status; if (pao->out.type == PV_LINK) - { - sprintf(source_pvarname, "%s.OVAL", pao->name); + status = dbCaAddOutlink(&(pao->out), (void *) pao, "OVAL"); + else + status = 0L; - 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); + return status; } /* end init_record() */ @@ -117,8 +111,8 @@ long nrequest; } break; case (CA_LINK) : - options = (long) 0; - nrequest = (long) 1; + options = 0L; + nrequest = 1L; status = dbCaPutLink(&(pao->out), &options, &nrequest); break; default : diff --git a/src/dev/devAoSoftRaw.c b/src/dev/devAoSoftRaw.c index db57007bc..8986c0899 100644 --- a/src/dev/devAoSoftRaw.c +++ b/src/dev/devAoSoftRaw.c @@ -1,5 +1,5 @@ /* devAoSoftRaw.c */ -/* share/src/dev $Id$ */ +/* share/src/dev @(#)devAoSoftRaw.c 1.6 4/6/92 */ /* Device Support Routines for soft raw Analog Output Records*/ /* @@ -50,7 +50,7 @@ #include /* added for Channel Access Links */ -void dbCaAddOutlink(); +long dbCaAddOutlink(); long dbCaPutLink(); long init_record(); @@ -78,19 +78,14 @@ static long init_record(pao) struct aoRecord *pao; { -char source_pvarname[((PVNAME_SZ)+(FLDNAME_SZ)+2)]; -struct dbAddr source_dbaddr; +long status; 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 */ + status = dbCaAddOutlink(&(pao->out), (void *) pao, "RVAL"); + else + status = 0L; - return ((long) 0); + return status; } /* end init_record() */ @@ -115,8 +110,8 @@ long nrequest; } break; case (CA_LINK) : - options = (long) 0; - nrequest = (long) 1; + options = 0L; + nrequest = 1L; status = dbCaPutLink(&(pao->out), &options, &nrequest); break; default : diff --git a/src/dev/devBiSoft.c b/src/dev/devBiSoft.c index 7f0c14de2..a8fb6b9d4 100644 --- a/src/dev/devBiSoft.c +++ b/src/dev/devBiSoft.c @@ -48,7 +48,9 @@ #include #include #include - +/* Added for Channel Access Links */ +long dbCaAddInlink(); +long dbCaGetLink(); /* Create the dset for devBiSoft */ long init_record(); @@ -74,6 +76,8 @@ static long init_record(pbi) struct biRecord *pbi; { char message[100]; +/* Added for Channel Access Links */ +long status; /* bi.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ switch (pbi->inp.type) { @@ -82,6 +86,8 @@ static long init_record(pbi) pbi->udf = FALSE; break; case (PV_LINK) : + status = dbCaAddInlink(&(pbi->inp), (void *) pbi, "VAL"); + if(status) return(status); break; case (DB_LINK) : break; @@ -116,6 +122,12 @@ static long read_bi(pbi) } else pbi->udf = FALSE; break; case (CA_LINK) : + if (dbCaGetLink(&(pbi->inp))) + { + recGblSetSevr(pbi,LINK_ALARM,VALID_ALARM); + } + else + pbi->udf = FALSE; break; default : if(recGblSetSevr(pbi,SOFT_ALARM,VALID_ALARM)){ diff --git a/src/dev/devBiSoftRaw.c b/src/dev/devBiSoftRaw.c index dc83ff982..50c31ca2a 100644 --- a/src/dev/devBiSoftRaw.c +++ b/src/dev/devBiSoftRaw.c @@ -49,7 +49,9 @@ #include #include #include - +/* Added for Channel Access Links */ +long dbCaAddInlink(); +long dbCaGetLink(); /* Create the dset for devBiSoftRaw */ long init_record(); @@ -75,6 +77,8 @@ static long init_record(pbi) struct biRecord *pbi; { char message[100]; +/* Added for Channel Access Links */ +long status; /* bi.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ switch (pbi->inp.type) { @@ -82,6 +86,8 @@ static long init_record(pbi) pbi->rval = pbi->inp.value.value; break; case (PV_LINK) : + status = dbCaAddInlink(&(pbi->inp), (void *) pbi, "RVAL"); + if(status) return(status); break; case (DB_LINK) : break; @@ -116,6 +122,12 @@ static long read_bi(pbi) } break; case (CA_LINK) : + if (dbCaGetLink(&(pbi->inp))) + { + recGblSetSevr(pbi,LINK_ALARM,VALID_ALARM); + } + else + pbi->udf = FALSE; break; default : if(recGblSetSevr(pbi,SOFT_ALARM,VALID_ALARM)){ diff --git a/src/dev/devBoSoft.c b/src/dev/devBoSoft.c index 3af20378d..78eb7252d 100644 --- a/src/dev/devBoSoft.c +++ b/src/dev/devBoSoft.c @@ -49,6 +49,10 @@ #include #include +/* added for Channel Access Links */ +long dbCaAddOutlink(); +long dbCaPutLink(); +long init_record(); /* Create the dset for devBoSoft */ long write_bo(); @@ -64,16 +68,33 @@ struct { 5, NULL, NULL, - NULL, + init_record, NULL, write_bo}; +static long init_record(pbo) +struct boRecord *pbo; +{ + +long status; + + if (pbo->out.type == PV_LINK) + status = dbCaAddOutlink(&(pbo->out), (void *) pbo, "VAL"); + else + status = 0L; + + return status; + +} /* end init_record() */ static long write_bo(pbo) struct boRecord *pbo; { char message[100]; long status; +/* added for Channel Access Links */ +long options; +long nrequest; /* bo.out must be a CONSTANT or a DB_LINK or a CA_LINK*/ switch (pbo->out.type) { @@ -86,6 +107,9 @@ static long write_bo(pbo) } break; case (CA_LINK) : + options = 0L; + nrequest = 1L; + status = dbCaPutLink(&(pbo->out), &options, &nrequest); break; default : if(recGblSetSevr(pbo,SOFT_ALARM,VALID_ALARM)){ diff --git a/src/dev/devBoSoftRaw.c b/src/dev/devBoSoftRaw.c index 472997e6a..54de17152 100644 --- a/src/dev/devBoSoftRaw.c +++ b/src/dev/devBoSoftRaw.c @@ -47,6 +47,10 @@ #include #include +/* added for Channel Access Links */ +long dbCaAddOutlink(); +long dbCaPutLink(); +long init_record(); /* Create the dset for devBoSoftRaw */ long write_bo(); @@ -62,18 +66,35 @@ struct { 5, NULL, NULL, - NULL, + init_record, NULL, write_bo}; +static long init_record(pbo) +struct boRecord *pbo; +{ + +long status; + + if (pbo->out.type == PV_LINK) + status = dbCaAddOutlink(&(pbo->out), (void *) pbo, "RVAL"); + else + status = 0L; + + return status; + +} /* end init_record() */ static long write_bo(pbo) struct boRecord *pbo; { char message[100]; long status; +/* added for Channel Access Links */ +long options; +long nrequest; /* bo.out must be a CONSTANT or a DB_LINK or a CA_LINK*/ switch (pbo->out.type) { @@ -87,6 +108,9 @@ static long write_bo(pbo) } break; case (CA_LINK) : + options = 0L; + nrequest = 1L; + status = dbCaPutLink(&(pbo->out), &options, &nrequest); break; default : if(recGblSetSevr(pbo,SOFT_ALARM,VALID_ALARM)){ diff --git a/src/dev/devEventSoft.c b/src/dev/devEventSoft.c index 44a6318b2..066657dec 100644 --- a/src/dev/devEventSoft.c +++ b/src/dev/devEventSoft.c @@ -46,7 +46,9 @@ #include #include #include - +/* Added for Channel Access Links */ +long dbCaAddInlink(); +long dbCaGetLink(); /* Create the dset for devEventSoft */ long init_record(); @@ -71,6 +73,8 @@ static long init_record(pevent) struct eventRecord *pevent; { char message[100]; +/* Added for Channel Access Links */ +long status; /* event.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ switch (pevent->inp.type) { @@ -81,6 +85,8 @@ static long init_record(pevent) pevent->udf= FALSE; break; case (PV_LINK) : + status = dbCaAddInlink(&(pevent->inp), (void *) pevent, "VAL"); + if(status) return(status); break; case (DB_LINK) : break; @@ -115,6 +121,12 @@ static long read_event(pevent) } else pevent->udf = FALSE; break; case (CA_LINK) : + if (dbCaGetLink(&(pevent->inp))) + { + recGblSetSevr(pevent,LINK_ALARM,VALID_ALARM); + } + else + pevent->udf = FALSE; break; default : if(recGblSetSevr(pevent,SOFT_ALARM,VALID_ALARM)){ diff --git a/src/dev/devLiSoft.c b/src/dev/devLiSoft.c index a0870f325..e61b5528f 100644 --- a/src/dev/devLiSoft.c +++ b/src/dev/devLiSoft.c @@ -46,7 +46,9 @@ #include #include #include - +/* Added for Channel Access Links */ +long dbCaAddInlink(); +long dbCaGetLink(); /* Create the dset for devLiSoft */ long init_record(); @@ -71,6 +73,8 @@ static long init_record(plongin) struct longinRecord *plongin; { char message[100]; +/* Added for Channel Access Links */ +long status; /* longin.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ switch (plongin->inp.type) { @@ -79,6 +83,8 @@ static long init_record(plongin) plongin->udf = FALSE; break; case (PV_LINK) : + status = dbCaAddInlink(&(plongin->inp), (void *) plongin, "VAL"); + if(status) return(status); break; case (DB_LINK) : break; @@ -113,6 +119,12 @@ static long read_longin(plongin) } else plongin->udf = FALSE; break; case (CA_LINK) : + if (dbCaGetLink(&(plongin->inp))) + { + recGblSetSevr(plongin,LINK_ALARM,VALID_ALARM); + } + else + plongin->udf = FALSE; break; default : if(recGblSetSevr(plongin,SOFT_ALARM,VALID_ALARM)){ diff --git a/src/dev/devLoSoft.c b/src/dev/devLoSoft.c index 7c85bd2c2..76799e914 100644 --- a/src/dev/devLoSoft.c +++ b/src/dev/devLoSoft.c @@ -46,6 +46,11 @@ #include #include +/* added for Channel Access Links */ +long dbCaAddOutlink(); +long dbCaPutLink(); +long init_record(); + /* Create the dset for devLoSoft */ long write_longout(); @@ -60,16 +65,34 @@ struct { 5, NULL, NULL, - NULL, + init_record, NULL, write_longout}; +static long init_record(plongout) +struct longoutRecord *plongout; +{ + +long status; + + if (plongout->out.type == PV_LINK) + status = dbCaAddOutlink(&(plongout->out), (void *) plongout, "VAL"); + else + status = 0L; + + return status; + +} /* end init_record() */ + static long write_longout(plongout) struct longoutRecord *plongout; { char message[100]; long status; +/* added for Channel Access Links */ +long options; +long nrequest; /* longout.out must be a CONSTANT or a DB_LINK or a CA_LINK*/ switch (plongout->out.type) { @@ -83,6 +106,9 @@ static long write_longout(plongout) } break; case (CA_LINK) : + options = 0L; + nrequest = 1L; + status = dbCaPutLink(&(plongout->out), &options, &nrequest); break; default : if(recGblSetSevr(plongout,SOFT_ALARM,VALID_ALARM)){ diff --git a/src/dev/devMbbiSoft.c b/src/dev/devMbbiSoft.c index b2aa85550..e72717add 100644 --- a/src/dev/devMbbiSoft.c +++ b/src/dev/devMbbiSoft.c @@ -48,6 +48,9 @@ #include #include #include +/* Added for Channel Access Links */ +long dbCaAddInlink(); +long dbCaGetLink(); /* Create the dset for devMbbiSoft */ @@ -74,6 +77,9 @@ static long init_record(pmbbi) struct mbbiRecord *pmbbi; { char message[100]; +/* Added for Channel Access Links */ +long status; + /* mbbi.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ switch (pmbbi->inp.type) { case (CONSTANT) : @@ -81,6 +87,8 @@ static long init_record(pmbbi) pmbbi->udf = FALSE; break; case (PV_LINK) : + status = dbCaAddInlink(&(pmbbi->inp), (void *) pmbbi, "VAL"); + if(status) return(status); break; case (DB_LINK) : break; @@ -115,6 +123,12 @@ static long read_mbbi(pmbbi) } else pmbbi->udf = FALSE; break; case (CA_LINK) : + if (dbCaGetLink(&(pmbbi->inp))) + { + recGblSetSevr(pmbbi,LINK_ALARM,VALID_ALARM); + } + else + pmbbi->udf = FALSE; break; default : if(recGblSetSevr(pmbbi,SOFT_ALARM,VALID_ALARM)){ diff --git a/src/dev/devMbbiSoftRaw.c b/src/dev/devMbbiSoftRaw.c index f5832829c..772bcdc28 100644 --- a/src/dev/devMbbiSoftRaw.c +++ b/src/dev/devMbbiSoftRaw.c @@ -49,6 +49,9 @@ #include #include #include +/* Added for Channel Access Links */ +long dbCaAddInlink(); +long dbCaGetLink(); /* Create the dset for devMbbiSoftRaw */ @@ -75,12 +78,17 @@ static long init_record(pmbbi) struct mbbiRecord *pmbbi; { char message[100]; +/* Added for Channel Access Links */ +long status; + /* mbbi.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ switch (pmbbi->inp.type) { case (CONSTANT) : pmbbi->rval = pmbbi->inp.value.value; break; case (PV_LINK) : + status = dbCaAddInlink(&(pmbbi->inp), (void *) pmbbi, "RVAL"); + if(status) return(status); break; case (DB_LINK) : break; @@ -115,6 +123,12 @@ static long read_mbbi(pmbbi) } break; case (CA_LINK) : + if (dbCaGetLink(&(pmbbi->inp))) + { + recGblSetSevr(pmbbi,LINK_ALARM,VALID_ALARM); + } + else + pmbbi->udf = FALSE; break; default : if(recGblSetSevr(pmbbi,SOFT_ALARM,VALID_ALARM)){ diff --git a/src/dev/devMbboSoft.c b/src/dev/devMbboSoft.c index 851a98a06..c195604b2 100644 --- a/src/dev/devMbboSoft.c +++ b/src/dev/devMbboSoft.c @@ -49,6 +49,10 @@ #include #include +/* added for Channel Access Links */ +long dbCaAddOutlink(); +long dbCaPutLink(); +long init_record(); /* Create the dset for devMbboSoft */ long write_mbbo(); @@ -64,18 +68,35 @@ struct { 5, NULL, NULL, - NULL, + init_record, NULL, write_mbbo}; +static long init_record(pmbbo) +struct mbboRecord *pmbbo; +{ + +long status; + + if (pmbbo->out.type == PV_LINK) + status = dbCaAddOutlink(&(pmbbo->out), (void *) pmbbo, "VAL"); + else + status = 0L; + + return status; + +} /* end init_record() */ static long write_mbbo(pmbbo) struct mbboRecord *pmbbo; { char message[100]; long status; +/* added for Channel Access Links */ +long options; +long nrequest; /* mbbo.out must be a CONSTANT or a DB_LINK or a CA_LINK*/ switch (pmbbo->out.type) { @@ -89,6 +110,9 @@ static long write_mbbo(pmbbo) } break; case (CA_LINK) : + options = 0L; + nrequest = 1L; + status = dbCaPutLink(&(pmbbo->out), &options, &nrequest); break; default : if(recGblSetSevr(pmbbo,SOFT_ALARM,VALID_ALARM)){ diff --git a/src/dev/devMbboSoftRaw.c b/src/dev/devMbboSoftRaw.c index f0a0b0931..ba81c4413 100644 --- a/src/dev/devMbboSoftRaw.c +++ b/src/dev/devMbboSoftRaw.c @@ -47,6 +47,10 @@ #include #include +/* added for Channel Access Links */ +long dbCaAddOutlink(); +long dbCaPutLink(); +long init_record(); /* Create the dset for devMbboSoftRaw */ long write_mbbo(); @@ -62,18 +66,35 @@ struct { 5, NULL, NULL, - NULL, + init_record, NULL, write_mbbo}; +static long init_record(pmbbo) +struct mbboRecord *pmbbo; +{ + +long status; + + if (pmbbo->out.type == PV_LINK) + status = dbCaAddOutlink(&(pmbbo->out), (void *) pmbbo, "RVAL"); + else + status = 0L; + + return status; + +} /* end init_record() */ static long write_mbbo(pmbbo) struct mbboRecord *pmbbo; { char message[100]; long status; +/* added for Channel Access Links */ +long options; +long nrequest; /* mbbo.out must be a CONSTANT or a DB_LINK or a CA_LINK*/ switch (pmbbo->out.type) { @@ -87,6 +108,9 @@ static long write_mbbo(pmbbo) } break; case (CA_LINK) : + options = 0L; + nrequest = 1L; + status = dbCaPutLink(&(pmbbo->out), &options, &nrequest); break; default : if(recGblSetSevr(pmbbo,SOFT_ALARM,VALID_ALARM)){ diff --git a/src/dev/devPtSoft.c b/src/dev/devPtSoft.c index 04daadad9..a3b274bc3 100644 --- a/src/dev/devPtSoft.c +++ b/src/dev/devPtSoft.c @@ -48,6 +48,10 @@ #include #include +/* added for Channel Access Links */ +long dbCaAddOutlink(); +long dbCaPutLink(); +long init_record(); /* Create the dset for devPtSoft */ long write_pt(); @@ -63,16 +67,33 @@ struct { 5, NULL, NULL, - NULL, + init_record, NULL, write_pt}; +static long init_record(ppt) +struct pulseTrainRecord *ppt; +{ + +long status; + + if (ppt->out.type == PV_LINK) + status = dbCaAddOutlink(&(ppt->out), (void *) ppt, "VAL"); + else + status = 0L; + + return status; + +} /* end init_record() */ static long write_pt(ppt) struct pulseTrainRecord *ppt; { char message[100]; long status; +/* added for Channel Access Links */ +long options; +long nrequest; /* pt.out must be a CONSTANT or a DB_LINK or a CA_LINK*/ switch (ppt->out.type) { @@ -85,6 +106,9 @@ static long write_pt(ppt) } else ppt->udf=FALSE; break; case (CA_LINK) : + options = 0L; + nrequest = 1L; + status = dbCaPutLink(&(ppt->out), &options, &nrequest); break; default : if(recGblSetSevr(ppt,WRITE_ALARM,VALID_ALARM)){ diff --git a/src/dev/devSiSoft.c b/src/dev/devSiSoft.c index 33c330cf4..fa76dfdfa 100644 --- a/src/dev/devSiSoft.c +++ b/src/dev/devSiSoft.c @@ -46,6 +46,9 @@ #include #include #include +/* Added for Channel Access Links */ +long dbCaAddInlink(); +long dbCaGetLink(); /* Create the dset for devSiSoft */ @@ -71,6 +74,8 @@ static long init_record(pstringin) struct stringinRecord *pstringin; { char message[100]; +/* Added for Channel Access Links */ +long status; /* stringin.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ switch (pstringin->inp.type) { @@ -82,6 +87,8 @@ static long init_record(pstringin) pstringin->udf= FALSE; break; case (PV_LINK) : + status = dbCaAddInlink(&(pstringin->inp), (void *) pstringin, "VAL"); + if(status) return(status); break; case (DB_LINK) : break; @@ -116,6 +123,12 @@ static long read_stringin(pstringin) } else pstringin->udf = FALSE; break; case (CA_LINK) : + if (dbCaGetLink(&(pstringin->inp))) + { + recGblSetSevr(pstringin,LINK_ALARM,VALID_ALARM); + } + else + pstringin->udf = FALSE; break; default : if(recGblSetSevr(pstringin,SOFT_ALARM,VALID_ALARM)){ diff --git a/src/dev/devSoSoft.c b/src/dev/devSoSoft.c index 9cad5be02..788300347 100644 --- a/src/dev/devSoSoft.c +++ b/src/dev/devSoSoft.c @@ -46,6 +46,11 @@ #include #include +/* added for Channel Access Links */ +long dbCaAddOutlink(); +long dbCaPutLink(); +long init_record(); + /* Create the dset for devSoSoft */ long write_stringout(); @@ -60,16 +65,34 @@ struct { 5, NULL, NULL, - NULL, + init_record, NULL, write_stringout}; +static long init_record(pstringout) +struct stringoutRecord *pstringout; +{ + +long status; + + if (pstringout->out.type == PV_LINK) + status = dbCaAddOutlink(&(pstringout->out), (void *) pstringout, "VAL"); + else + status = 0L; + + return status; + +} /* end init_record() */ + static long write_stringout(pstringout) struct stringoutRecord *pstringout; { char message[100]; long status; +/* added for Channel Access Links */ +long options; +long nrequest; /* stringout.out must be a CONSTANT or a DB_LINK or a CA_LINK*/ switch (pstringout->out.type) { @@ -83,6 +106,9 @@ static long write_stringout(pstringout) } break; case (CA_LINK) : + options = 0L; + nrequest = 1L; + status = dbCaPutLink(&(pstringout->out), &options, &nrequest); break; default : if(recGblSetSevr(pstringout,SOFT_ALARM,VALID_ALARM)){ diff --git a/src/dev/devWfSoft.c b/src/dev/devWfSoft.c index 1a52eeb3c..1e063362a 100644 --- a/src/dev/devWfSoft.c +++ b/src/dev/devWfSoft.c @@ -48,6 +48,9 @@ #include #include #include +/* Added for Channel Access Links */ +long dbCaAddInlink(); +long dbCaGetLink(); /* Create the dset for devWfSoft */ long init_record(); @@ -72,6 +75,8 @@ static long init_record(pwf) struct waveformRecord *pwf; { char message[100]; +/* Added for Channel Access Links */ +long status; /* wf.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ switch (pwf->inp.type) { @@ -79,6 +84,8 @@ static long init_record(pwf) pwf->nord = 0; break; case (PV_LINK) : + status = dbCaAddInlink(&(pwf->inp), (void *) pwf, "BPTR"); + if(status) return(status); break; case (DB_LINK) : break; @@ -113,6 +120,12 @@ static long read_wf(pwf) pwf->nord = nRequest; break; case (CA_LINK) : + if (dbCaGetLink(&(pwf->inp))) + { + recGblSetSevr(pwf,LINK_ALARM,VALID_ALARM); + } + else + pwf->udf = FALSE; break; default : if(recGblSetSevr(pwf,SOFT_ALARM,VALID_ALARM)){ diff --git a/src/rec/recCalc.c b/src/rec/recCalc.c index 490113c19..971e65db6 100644 --- a/src/rec/recCalc.c +++ b/src/rec/recCalc.c @@ -1,5 +1,5 @@ /* recCalc.c */ -/* share/src/rec $Id$ */ +/* share/src/rec @(#)recCalc.c 1.15 4/6/92 */ /* recCalc.c - Record Support Routines for Calculation records */ /* @@ -123,10 +123,10 @@ void monitor(); long calcPerform(); long postfix(); int fetch_values(); -#define ARG_MAX 12 -/* Database Channel Access Link Functions */ -void dbCaAddInlink(); +/* 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] = @@ -143,22 +143,16 @@ 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; itype==CONSTANT) *pvalue = plink->value.value; + 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 = dbCaAddInlink(plink, (void *) pcalc, Fldnames[i]); + if(status) return(status); + } /* endif */ } status=postfix(pcalc->calc,rpbuf,&error_number); if(status) return(status); @@ -392,7 +386,10 @@ struct calcRecord *pcalc; if (plink->type == CA_LINK) { if (dbCaGetLink(plink)) - printf("fetch_values() problem in dbCaGetLink()\n"); + { + recGblSetSevr(pcalc,LINK_ALARM,VALID_ALARM); + return(-1); + } /* endif */ } else { diff --git a/src/rec/recFanout.c b/src/rec/recFanout.c index fa9ed4900..9bf95600b 100644 --- a/src/rec/recFanout.c +++ b/src/rec/recFanout.c @@ -99,16 +99,28 @@ struct rset fanoutRSET={ #define SELECT_ALL 0 #define SELECTED 1 #define SELECT_MASK 2 +/* Added for Channel Access Links */ +long dbCaAddInlink(); +long dbCaGetLink(); static long init_record(pfanout) struct fanoutRecord *pfanout; { +/* Added for Channel Access Links */ +long status; + /* get link selection if sell is a constant and nonzero*/ if (pfanout->sell.type==CONSTANT && pfanout->sell.value.value!=0 ){ pfanout->seln = pfanout->sell.value.value; } + if (pfanout->sell.type == PV_LINK) + { + status = dbCaAddInlink(&(pfanout->sell), (void *) pfanout, "SELN"); + if(status) return(status); + } /* endif */ + return(0); } @@ -135,6 +147,14 @@ static long process(pfanout) recGblSetSevr(pfanout,LINK_ALARM,VALID_ALARM); } } + if (pfanout->sell.type == CA_LINK) + { + status = dbCaGetLink(&(pfanout->sell)); + if(status!=0) { + recGblSetSevr(pfanout,LINK_ALARM,VALID_ALARM); + } + } + switch (pfanout->selm){ case (SELECT_ALL): if (pfanout->lnk1.type==DB_LINK) diff --git a/src/rec/recPid.c b/src/rec/recPid.c index 0537d86f5..1568dc66a 100644 --- a/src/rec/recPid.c +++ b/src/rec/recPid.c @@ -96,16 +96,28 @@ struct rset pidRSET={ void alarm(); void monitor(); long do_pid(); +/* Added for Channel Access Links */ +long dbCaAddInlink(); +long dbCaGetLink(); static long init_record(ppid) struct pidRecord *ppid; { +/* Added for Channel Access Links */ +long status; + /* initialize the setpoint for constant setpoint */ if (ppid->stpl.type == CONSTANT){ ppid->val = ppid->stpl.value.value; ppid->udf = FALSE; } + if (ppid->stpl.type == PV_LINK) + { + status = dbCaAddInlink(&(ppid->stpl), (void *) ppid, "VAL"); + if(status) return(status); + } /* endif */ + return(0); } @@ -374,6 +386,12 @@ struct pidRecord *ppid; return(0); } else ppid->udf=FALSE; } + if(ppid->stpl.type == CA_LINK && ppid->smsl == CLOSED_LOOP){ + if(dbCaGetLink(&(ppid->stpl))!=NULL) { + recGblSetSevr(ppid,LINK_ALARM,VALID_ALARM); + return(0); + } else ppid->udf=FALSE; + } val = ppid->val; if (ppid->udf == TRUE ) { recGblSetSevr(ppid,UDF_ALARM,VALID_ALARM); diff --git a/src/rec/recSel.c b/src/rec/recSel.c index c779057da..b3a7473ff 100644 --- a/src/rec/recSel.c +++ b/src/rec/recSel.c @@ -102,6 +102,14 @@ void alarm(); void monitor(); int fetch_values(); int do_sel(); +/* Added for Channel Access Links */ +#define ARG_MAX 12 +long 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(psel) struct selRecord *psel; @@ -109,14 +117,27 @@ static long init_record(psel) struct link *plink; int i; double *pvalue; +/* Added for Channel Access Links */ + long status; /* get seln initial value if nvl is a constant*/ if (psel->nvl.type == CONSTANT ) psel->seln = psel->nvl.value.value; + if (psel->nvl.type == PV_LINK) + { + status = dbCaAddInlink(&(psel->nvl), (void *) psel, "SELN"); + if(status) return(status); + } /* endif */ plink = &psel->inpa; pvalue = &psel->a; for(i=0; itype==CONSTANT) *pvalue = plink->value.value; + if(plink->type==CONSTANT) + *pvalue = plink->value.value; + if (plink->type == PV_LINK) + { + status = dbCaAddInlink(plink, (void *) psel, Fldnames[i]); + if(status) return(status); + } /* endif */ } return(0); } @@ -442,8 +463,22 @@ struct selRecord *psel; return(-1); } } + if(psel->nvl.type == CA_LINK ){ + if(dbCaGetLink(&(psel->nvl)) !=NULL) { + recGblSetSevr(psel,LINK_ALARM,VALID_ALARM); + return(-1); + } + } plink += psel->seln; pvalue += psel->seln; + if (plink->type == CA_LINK) + { + if (dbCaGetLink(plink)) + { + recGblSetSevr(psel,LINK_ALARM,VALID_ALARM); + return(-1); + } /* endif */ + } /* endif */ if(plink->type==DB_LINK) { nRequest=1; status=dbGetLink(&plink->value.db_link,(struct dbCommon *)psel,DBR_DOUBLE, @@ -457,6 +492,14 @@ struct selRecord *psel; } /* fetch all inputs*/ for(i=0; itype == CA_LINK) + { + if (dbCaGetLink(plink)) + { + recGblSetSevr(psel,LINK_ALARM,VALID_ALARM); + return(-1); + } /* endif */ + } /* endif */ if(plink->type==DB_LINK) { nRequest=1; status = dbGetLink(&plink->value.db_link,(struct dbCommon *)psel,DBR_DOUBLE, diff --git a/src/rec/recSteppermotor.c b/src/rec/recSteppermotor.c index 6dd6762ee..328c32941 100644 --- a/src/rec/recSteppermotor.c +++ b/src/rec/recSteppermotor.c @@ -165,6 +165,9 @@ void convert_sm(); void positional_sm(); void velocity_sm(); void sm_get_position(); +/* Added for Channel Access Links */ +long dbCaAddInlink(); +long dbCaGetLink(); @@ -193,6 +196,11 @@ static long init_record(psm) psm->udf = FALSE; psm->val = psm->dol.value.value; } + if (psm->dol.type == PV_LINK) + { + status = dbCaAddInlink(&(psm->dol), (void *) psm, "VAL"); + if(status) return(status); + } /* endif */ init_sm(psm); return(0); } @@ -732,7 +740,8 @@ struct steppermotorRecord *psm; } /* fetch the desired value if there is a database link */ - if (psm->dol.type == DB_LINK && psm->omsl == CLOSED_LOOP){ + if (psm->omsl == CLOSED_LOOP){ + if (psm->dol.type == DB_LINK){ long options=0; long nRequest=1; @@ -741,6 +750,13 @@ struct steppermotorRecord *psm; recGblSetSevr(psm,LINK_ALARM,VALID_ALARM); return; } else psm->udf = FALSE; + } + if (psm->dol.type == CA_LINK){ + if(dbCaGetLink(&(psm->dol))){ + recGblSetSevr(psm,LINK_ALARM,VALID_ALARM); + return; + } else psm->udf = FALSE; + } } /* check drive limits */ @@ -787,7 +803,8 @@ struct steppermotorRecord *psm; int acceleration,velocity; /* fetch the desired value if there is a database link */ - if (psm->dol.type == DB_LINK && psm->omsl == CLOSED_LOOP){ + if (psm->omsl == CLOSED_LOOP){ + if (psm->dol.type == DB_LINK){ long options=0; long nRequest=1; @@ -796,6 +813,13 @@ struct steppermotorRecord *psm; recGblSetSevr(psm,LINK_ALARM,VALID_ALARM); return; } else psm->udf=FALSE; + } + if (psm->dol.type == CA_LINK){ + if(dbCaGetLink(&(psm->dol))){ + recGblSetSevr(psm,LINK_ALARM,VALID_ALARM); + return; + } else psm->udf=FALSE; + } } diff --git a/src/rec/recTimer.c b/src/rec/recTimer.c index 06760c2c9..2f398c10b 100644 --- a/src/rec/recTimer.c +++ b/src/rec/recTimer.c @@ -102,6 +102,10 @@ struct rset timerRSET={ get_control_double, get_alarm_double }; +/* Added for Channel Access Links */ +long dbCaAddInlink(); +long dbCaGetLink(); + /* because the driver does all the work just declare device support here*/ static long get_ioint_info(); struct dset devTmMizar8310={4,NULL,NULL,NULL,get_ioint_info}; @@ -138,10 +142,19 @@ void write_timer(); static long init_record(ptimer) struct timerRecord *ptimer; { + +/* Added for Channel Access Links */ +long status; + /* get the delay initial value if torg is a constant*/ if (ptimer->torg.type == CONSTANT ){ ptimer->trdl = ptimer->torg.value.value; } + if (ptimer->torg.type == PV_LINK ) + { + status = dbCaAddInlink(&(ptimer->torg), (void *) ptimer, "TRDL"); + if(status) return(status); + } /* endif */ /* read to maintain time pulses over a restart */ @@ -288,6 +301,15 @@ struct timerRecord *ptimer; return; } } + if (ptimer->torg.type == CA_LINK) + { + status = dbCaGetLink(&(ptimer->torg)); + if(status!=0) + { + recGblSetSevr(ptimer,LINK_ALARM,VALID_ALARM); + return; + } /* endif */ + } /* endif */ if (ptimer->out.type != VME_IO) { recGblSetSevr(ptimer,WRITE_ALARM,VALID_ALARM); return;