From 7cde4f8f2b6211ec2992b9154c4f45b96e0d9f79 Mon Sep 17 00:00:00 2001 From: Marty Kraimer Date: Wed, 30 Apr 1997 19:20:01 +0000 Subject: [PATCH] Fixed most compiler warning messages --- src/rec/Makefile.Vx | 2 + src/rec/aaiRecord.c | 1 + src/rec/aaoRecord.c | 1 + src/rec/aiRecord.c | 1 + src/rec/aoRecord.c | 13 +- src/rec/biRecord.c | 13 +- src/rec/boRecord.c | 19 +- src/rec/calcRecord.c | 17 +- src/rec/calcoutRecord.c | 791 +++++++++++++++++++++++++++++++++++ src/rec/calcoutRecord.dbd | 577 +++++++++++++++++++++++++ src/rec/compressRecord.c | 2 + src/rec/dfanoutRecord.c | 14 +- src/rec/egRecord.c | 17 +- src/rec/egeventRecord.c | 18 +- src/rec/erRecord.c | 19 +- src/rec/ereventRecord.c | 17 +- src/rec/eventRecord.c | 1 + src/rec/fanoutRecord.c | 5 +- src/rec/gsubRecord.c | 17 +- src/rec/histogramRecord.c | 17 +- src/rec/longinRecord.c | 14 +- src/rec/longoutRecord.c | 1 + src/rec/mbbiDirectRecord.c | 15 +- src/rec/mbbiRecord.c | 1 + src/rec/mbboDirectRecord.c | 17 +- src/rec/mbboRecord.c | 15 +- src/rec/palRecord.c | 33 +- src/rec/permissiveRecord.c | 14 +- src/rec/pidRecord.c | 1 + src/rec/pulseCounterRecord.c | 33 +- src/rec/pulseDelayRecord.c | 14 +- src/rec/pulseTrainRecord.c | 12 +- src/rec/recDynLink.c | 8 +- src/rec/recWaitCa.c | 6 +- src/rec/scanRecord.c | 71 ++-- src/rec/selRecord.c | 19 +- src/rec/seqRecord.c | 12 +- src/rec/stateRecord.c | 14 +- src/rec/steppermotorRecord.c | 14 +- src/rec/stringinRecord.c | 15 +- src/rec/stringoutRecord.c | 14 +- src/rec/subArrayRecord.c | 2 +- src/rec/subRecord.c | 17 +- src/rec/timerRecord.c | 16 +- src/rec/waitRecord.c | 33 +- src/rec/waveformRecord.c | 1 + 46 files changed, 1522 insertions(+), 452 deletions(-) create mode 100644 src/rec/calcoutRecord.c create mode 100644 src/rec/calcoutRecord.dbd diff --git a/src/rec/Makefile.Vx b/src/rec/Makefile.Vx index 752d08465..41fbfb53d 100644 --- a/src/rec/Makefile.Vx +++ b/src/rec/Makefile.Vx @@ -16,6 +16,7 @@ RECTYPES += aoRecord.h RECTYPES += biRecord.h RECTYPES += boRecord.h RECTYPES += calcRecord.h +RECTYPES += calcoutRecord.h RECTYPES += compressRecord.h RECTYPES += dfanoutRecord.h RECTYPES += egRecord.h @@ -59,6 +60,7 @@ SRCS.c += ../aoRecord.c SRCS.c += ../biRecord.c SRCS.c += ../boRecord.c SRCS.c += ../calcRecord.c +SRCS.c += ../calcoutRecord.c SRCS.c += ../compressRecord.c SRCS.c += ../dfanoutRecord.c SRCS.c += ../egRecord.c diff --git a/src/rec/aaiRecord.c b/src/rec/aaiRecord.c index d302b0cb8..3dd0c77b5 100644 --- a/src/rec/aaiRecord.c +++ b/src/rec/aaiRecord.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include diff --git a/src/rec/aaoRecord.c b/src/rec/aaoRecord.c index 4b0a12126..6504dded1 100644 --- a/src/rec/aaoRecord.c +++ b/src/rec/aaoRecord.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include diff --git a/src/rec/aiRecord.c b/src/rec/aiRecord.c index c902c3c2d..2e81309a7 100644 --- a/src/rec/aiRecord.c +++ b/src/rec/aiRecord.c @@ -83,6 +83,7 @@ #include #include #include +#include #include #include #include diff --git a/src/rec/aoRecord.c b/src/rec/aoRecord.c index 1cc801624..bcd6a1181 100644 --- a/src/rec/aoRecord.c +++ b/src/rec/aoRecord.c @@ -80,6 +80,7 @@ #include #include #include +#include #include #include #include @@ -96,7 +97,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 @@ -306,16 +307,6 @@ static long special(paddr,after) } } -static long get_value(pao,pvdes) - struct aoRecord *pao; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_DOUBLE; - pvdes->no_elements=1; - (double *)(pvdes->pvalue) = &pao->val; - return(0); -} - static long get_units(paddr,units) struct dbAddr *paddr; char *units; diff --git a/src/rec/biRecord.c b/src/rec/biRecord.c index 6edf7e2f0..fe314702b 100644 --- a/src/rec/biRecord.c +++ b/src/rec/biRecord.c @@ -66,6 +66,7 @@ #include #include #include +#include #include #include #include @@ -79,7 +80,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 @@ -185,16 +186,6 @@ static long process(pbi) return(status); } -static long get_value(pbi,pvdes) - struct biRecord *pbi; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_ENUM; - pvdes->no_elements=1; - (unsigned short *)(pvdes->pvalue) = &pbi->val; - return(0); -} - static long get_enum_str(paddr,pstring) struct dbAddr *paddr; char *pstring; diff --git a/src/rec/boRecord.c b/src/rec/boRecord.c index b552a5589..633f0f3b2 100644 --- a/src/rec/boRecord.c +++ b/src/rec/boRecord.c @@ -79,6 +79,7 @@ #include #include #include +#include #include #include #include @@ -95,7 +96,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 @@ -156,7 +157,6 @@ static void myCallback(pcallback) { struct boRecord *pbo=(struct boRecord *)pcallback->precord; - struct rset *prset=(struct rset *)(pbo->rset); int wait_time; dbScanLock((struct dbCommon *)pbo); @@ -224,6 +224,11 @@ static long init_record(pbo,pass) pbo->udf = FALSE; } else if (status==2) status=0; } + /* convert val to rval */ + if ( pbo->mask != 0 ) { + if(pbo->val==0) pbo->rval = 0; + else pbo->rval = pbo->mask; + } else pbo->rval = (unsigned long)pbo->val; return(status); } @@ -314,16 +319,6 @@ static long process(pbo) return(status); } -static long get_value(pbo,pvdes) - struct boRecord *pbo; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_ENUM; - pvdes->no_elements=1; - (unsigned short *)(pvdes->pvalue) = &pbo->val; - return(0); -} - static long get_precision(paddr,precision) struct dbAddr *paddr; long *precision; diff --git a/src/rec/calcRecord.c b/src/rec/calcRecord.c index e66529d65..2f2f68ce5 100644 --- a/src/rec/calcRecord.c +++ b/src/rec/calcRecord.c @@ -81,6 +81,7 @@ #include #include #include +#include #include #include #include @@ -95,7 +96,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 @@ -134,10 +135,6 @@ static int fetch_values(); #define ARG_MAX 12 - /* Fldnames should have as many as ARG_MAX */ - static char *Fldnames[ARG_MAX] = - {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"}; - static long init_record(pcalc,pass) struct calcRecord *pcalc; @@ -217,16 +214,6 @@ static long special(paddr,after) return(S_db_badChoice); } } - -static long get_value(pcalc,pvdes) - struct calcRecord *pcalc; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_DOUBLE; - pvdes->no_elements=1; - (double *)(pvdes->pvalue) = &pcalc->val; - return(0); -} static long get_units(paddr,units) struct dbAddr *paddr; diff --git a/src/rec/calcoutRecord.c b/src/rec/calcoutRecord.c new file mode 100644 index 000000000..3e9661e64 --- /dev/null +++ b/src/rec/calcoutRecord.c @@ -0,0 +1,791 @@ +/* calcout.c - Record Support Routines for calc with output records */ +/* + * Author : Ned Arnold + * Based on recCalc.c, by ... + * Original Author: Julie Sander and Bob Dalesio + * Current Author: Marty Kraimer + * Date: 7-27-87 + * + * Experimental Physics and Industrial Control System (EPICS) + * + * Copyright 1991, the Regents of the University of California, + * and the University of Chicago Board of Governors. + * + * This software was produced under U.S. Government contracts: + * (W-7405-ENG-36) at the Los Alamos National Laboratory, + * and (W-31-109-ENG-38) at Argonne National Laboratory. + * + * Initial development by: + * The Controls and Automation Group (AT-8) + * Ground Test Accelerator + * Accelerator Technology Division + * Los Alamos National Laboratory + * + * Co-developed with + * The Controls and Computing Group + * Accelerator Systems Division + * Advanced Photon Source + * Argonne National Laboratory + * + * Modification Log: + * ----------------- + * .01 08-29-96 nda Created from calcoutRecord.c for EPICS R3.13 + * .02 09-13-96 nda Original release for EPICS R3.13beta3 + * + * + */ + + + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define GEN_SIZE_OFFSET +#include +#undef GEN_SIZE_OFFSET +#include + +/* Create RSET - Record Support Entry Table*/ +#define report NULL +#define initialize NULL +static long init_record(); +static long process(); +static long special(); +#define get_value NULL +#define cvt_dbaddr NULL +#define get_array_info NULL +#define put_array_info NULL +static long get_units(); +static long get_precision(); +#define get_enum_str NULL +#define get_enum_strs NULL +#define put_enum_str NULL +static long get_graphic_double(); +static long get_control_double(); +static long get_alarm_double(); + +struct rset calcoutRSET={ + RSETNUMBER, + report, + initialize, + init_record, + process, + special, + get_value, + cvt_dbaddr, + get_array_info, + put_array_info, + get_units, + get_precision, + get_enum_str, + get_enum_strs, + put_enum_str, + get_graphic_double, + get_control_double, + get_alarm_double +}; + + +/* To provide feedback to the user as to the connection status of the + * links (.INxV and .OUTV), the following algorithm has been implemented ... + * + * A new PV_LINK [either in init() or special()] is searched for using + * dbNameToAddr. If local, it is so indicated. If not, a checkLinkCb + * callback is scheduled to check the connectivity later using + * dbCaIsLinkConnected(). Anytime there are unconnected CA_LINKs, another + * callback is scheduled. Once all connections are established, the CA_LINKs + * are checked whenever the record processes. + * + */ + +#define NO_CA_LINKS 0 +#define CA_LINKS_ALL_OK 1 +#define CA_LINKS_NOT_OK 2 + +struct rpvtStruct { + CALLBACK doOutCb; + WDOG_ID wd_id_0; + CALLBACK checkLinkCb; + WDOG_ID wd_id_1; + short wd_id_1_LOCK; + short caLinkStat; /* NO_CA_LINKS,CA_LINKS_ALL_OK,CA_LINKS_NOT_OK */ +}; + +static void alarm(); +static void monitor(); +static int fetch_values(); +static void execOutput(); +static void doOutputCallback(); +static void checkLinks(); +static void checkLinksCallback(); + +int calcoutRecDebug; + +#define ARG_MAX 12 + + +static long init_record(pcalc,pass) + struct calcoutRecord *pcalc; + int pass; +{ + struct link *plink; + int i; + double *pvalue; + unsigned short *plinkValid; + short error_number; + char rpbuf[184]; + + struct dbAddr *pAddr = 0; + struct rpvtStruct *prpvt; + + if (pass==0) { + pcalc->rpvt = (void *)calloc(1, sizeof(struct rpvtStruct)); + return(0); + } + + prpvt = (struct rpvtStruct *)pcalc->rpvt; + + plink = &pcalc->inpa; + pvalue = &pcalc->a; + plinkValid = &pcalc->inav; + for(i=0; i<(ARG_MAX+1); i++, plink++, pvalue++, plinkValid++) { + if (plink->type == CONSTANT) { + /* Don't InitConstantLink the .OUT link */ + if(ivalue.pv_link.pvname, pAddr)) { + *plinkValid = calcoutINAV_LOC; + } + /* pv is not on this ioc. Callback later for connection stat */ + else { + *plinkValid = calcoutINAV_EXT_NC; + prpvt->caLinkStat = CA_LINKS_NOT_OK; + } + db_post_events(pcalc,plinkValid,DBE_VALUE); + } + + pcalc->clcv=postfix(pcalc->calc,rpbuf,&error_number); + if(pcalc->clcv){ + recGblRecordError(S_db_badField,(void *)pcalc, + "calcout: init_record: Illegal CALC field"); + return(S_db_badField); + } + else { + memcpy(pcalc->rpcl,rpbuf,sizeof(pcalc->rpcl)); + } + db_post_events(pcalc,&pcalc->clcv,DBE_VALUE); + + pcalc->oclv=postfix(pcalc->ocal,rpbuf,&error_number); + if(pcalc->oclv){ + recGblRecordError(S_db_badField,(void *)pcalc, + "calcout: init_record: Illegal OCAL field"); + return(S_db_badField); + } + else { + memcpy(pcalc->orpc,rpbuf,sizeof(pcalc->orpc)); + } + db_post_events(pcalc,&pcalc->oclv,DBE_VALUE); + + prpvt = (struct rpvtStruct *)pcalc->rpvt; + callbackSetCallback(doOutputCallback, &prpvt->doOutCb); + callbackSetPriority(pcalc->prio, &prpvt->doOutCb); + callbackSetUser(pcalc, &prpvt->doOutCb); + callbackSetCallback(checkLinksCallback, &prpvt->checkLinkCb); + callbackSetPriority(0, &prpvt->checkLinkCb); + callbackSetUser(pcalc, &prpvt->checkLinkCb); + prpvt->wd_id_0 = wdCreate(); + prpvt->wd_id_1 = wdCreate(); + prpvt->wd_id_1_LOCK = 0; + + if(prpvt->caLinkStat == CA_LINKS_NOT_OK) { + wdStart(prpvt->wd_id_1, 60, (FUNCPTR)callbackRequest, + (int)(&prpvt->checkLinkCb)); + prpvt->wd_id_1_LOCK = 1; + } + + return(0); +} + +static long process(pcalc) + struct calcoutRecord *pcalc; +{ + struct rpvtStruct *prpvt = (struct rpvtStruct *)pcalc->rpvt; + int wdDelay; + short doOutput = 0; + + + if(!pcalc->pact) { + pcalc->pact = TRUE; + + /* if some links are CA, check connections */ + if(prpvt->caLinkStat != NO_CA_LINKS) { + checkLinks(pcalc); + } + + if(fetch_values(pcalc)==0) { + if((pcalc->clcv) || + (pcalc->clcv) || + calcPerform(&pcalc->a,&pcalc->val,pcalc->rpcl)) { + recGblSetSevr(pcalc,CALC_ALARM,INVALID_ALARM); + } else pcalc->udf = FALSE; + } + recGblGetTimeStamp(pcalc); + /* check for alarms */ + alarm(pcalc); + + /* check for output link execution */ + switch(pcalc->oopt) { + case calcoutOOPT_Every_Time: + doOutput = 1; + break; + case calcoutOOPT_On_Change: + if(fabs(pcalc->pval - pcalc->val) > pcalc->mdel) { + doOutput = 1; + } + break; + case calcoutOOPT_Transition_To_Zero: + if((pcalc->pval != 0) && (pcalc->val == 0)) { + doOutput = 1; + } + break; + case calcoutOOPT_Transition_To_Non_zero: + if((pcalc->pval == 0) && (pcalc->val != 0)) { + doOutput = 1; + } + break; + case calcoutOOPT_When_Zero: + if(!pcalc->val) { + doOutput = 1; + } + break; + case calcoutOOPT_When_Non_zero: + if(pcalc->val) { + doOutput = 1; + } + break; + default: + break; + } + pcalc->pval = pcalc->val; + + if(doOutput) { + if(pcalc->odly > 0.0) { + pcalc->dlya = 1; + db_post_events(pcalc,&pcalc->dlya,DBE_VALUE); + wdDelay = pcalc->odly * sysClkRateGet(); + callbackSetPriority(pcalc->prio, &prpvt->doOutCb); + wdStart(prpvt->wd_id_0, wdDelay, (FUNCPTR)callbackRequest, + (int)(&prpvt->doOutCb)); + } + else { + execOutput(pcalc); + } + } + + /* check event list */ + monitor(pcalc); + + /* if no delay requested, finish processing */ + if(!pcalc->dlya) { + /* process the forward scan link record */ + recGblFwdLink(pcalc); + pcalc->pact = FALSE; + } + } + else { + execOutput(pcalc); + pcalc->dlya = 0; + db_post_events(pcalc,&pcalc->dlya,DBE_VALUE); + + /* process the forward scan link record */ + recGblFwdLink(pcalc); + + pcalc->pact = FALSE; + } + + return(0); +} + +static long special(paddr,after) + struct dbAddr *paddr; + int after; +{ + struct calcoutRecord *pcalc = (struct calcoutRecord *)(paddr->precord); + struct rpvtStruct *prpvt = (struct rpvtStruct *)pcalc->rpvt; + struct dbAddr *pAddr = 0; + short error_number; + char rpbuf[184]; + int fieldIndex = dbGetFieldIndex(paddr); + int lnkIndex; + struct link *plink; + double *pvalue; + unsigned short *plinkValid; + + if(!after) return(0); + switch(fieldIndex) { + case(calcoutRecordCALC): + pcalc->clcv=postfix(pcalc->calc,rpbuf,&error_number); + if(pcalc->clcv){ + recGblRecordError(S_db_badField,(void *)pcalc, + "calcout: special(): Illegal CALC field"); + } + else { + memcpy(pcalc->rpcl,rpbuf,sizeof(pcalc->rpcl)); + } + db_post_events(pcalc,&pcalc->clcv,DBE_VALUE); + return(0); + break; + + case(calcoutRecordOCAL): + pcalc->oclv=postfix(pcalc->ocal,rpbuf,&error_number); + if(pcalc->oclv){ + recGblRecordError(S_db_badField,(void *)pcalc, + "calcout: special(): Illegal OCAL field"); + } + else { + memcpy(pcalc->orpc,rpbuf,sizeof(pcalc->orpc)); + } + db_post_events(pcalc,&pcalc->oclv,DBE_VALUE); + + return(0); + break; + + case(calcoutRecordINPA): + case(calcoutRecordINPB): + case(calcoutRecordINPC): + case(calcoutRecordINPD): + case(calcoutRecordINPE): + case(calcoutRecordINPF): + case(calcoutRecordINPG): + case(calcoutRecordINPH): + case(calcoutRecordINPI): + case(calcoutRecordINPJ): + case(calcoutRecordINPK): + case(calcoutRecordINPL): + case(calcoutRecordOUT): + lnkIndex = fieldIndex - calcoutRecordINPA; + plink = &pcalc->inpa + lnkIndex; + pvalue = &pcalc->a + lnkIndex; + plinkValid = &pcalc->inav + lnkIndex; + + if (plink->type == CONSTANT) { + if(fieldIndex != calcoutRecordOUT) { + recGblInitConstantLink(plink,DBF_DOUBLE,pvalue); + db_post_events(pcalc,pvalue,DBE_VALUE); + } + *plinkValid = calcoutINAV_CON; + } + /* see if the PV resides on this ioc */ + else if(!dbNameToAddr(plink->value.pv_link.pvname, pAddr)) { + *plinkValid = calcoutINAV_LOC; + } + /* pv is not on this ioc. Callback later for connection stat */ + else { + *plinkValid = calcoutINAV_EXT_NC; + /* DO_CALLBACK, if not already scheduled */ + if(!prpvt->wd_id_1_LOCK) { + wdStart(prpvt->wd_id_1, 30, (FUNCPTR)callbackRequest, + (int)(&prpvt->checkLinkCb)); + prpvt->wd_id_1_LOCK = 1; + prpvt->caLinkStat = CA_LINKS_NOT_OK; + } + } + db_post_events(pcalc,plinkValid,DBE_VALUE); + + + return(0); + break; + + default: + recGblDbaddrError(S_db_badChoice,paddr,"calc: special"); + return(S_db_badChoice); + } +} + +static long get_units(paddr,units) + struct dbAddr *paddr; + char *units; +{ + struct calcoutRecord *pcalc=(struct calcoutRecord *)paddr->precord; + + strncpy(units,pcalc->egu,DB_UNITS_SIZE); + return(0); +} + +static long get_precision(paddr,precision) + struct dbAddr *paddr; + long *precision; +{ + struct calcoutRecord *pcalc=(struct calcoutRecord *)paddr->precord; + + *precision = pcalc->prec; + if(paddr->pfield == (void *)&pcalc->val) return(0); + recGblGetPrec(paddr,precision); + return(0); +} + +static long get_graphic_double(paddr,pgd) + struct dbAddr *paddr; + struct dbr_grDouble *pgd; +{ + struct calcoutRecord *pcalc=(struct calcoutRecord *)paddr->precord; + + if(paddr->pfield==(void *)&pcalc->val + || paddr->pfield==(void *)&pcalc->hihi + || paddr->pfield==(void *)&pcalc->high + || paddr->pfield==(void *)&pcalc->low + || paddr->pfield==(void *)&pcalc->lolo){ + pgd->upper_disp_limit = pcalc->hopr; + pgd->lower_disp_limit = pcalc->lopr; + return(0); + } + + if(paddr->pfield>=(void *)&pcalc->a && paddr->pfield<=(void *)&pcalc->l){ + pgd->upper_disp_limit = pcalc->hopr; + pgd->lower_disp_limit = pcalc->lopr; + return(0); + } + if(paddr->pfield>=(void *)&pcalc->la && paddr->pfield<=(void *)&pcalc->ll){ + pgd->upper_disp_limit = pcalc->hopr; + pgd->lower_disp_limit = pcalc->lopr; + return(0); + } + return(0); +} + +static long get_control_double(paddr,pcd) + struct dbAddr *paddr; + struct dbr_ctrlDouble *pcd; +{ + struct calcoutRecord *pcalc=(struct calcoutRecord *)paddr->precord; + + if(paddr->pfield==(void *)&pcalc->val + || paddr->pfield==(void *)&pcalc->hihi + || paddr->pfield==(void *)&pcalc->high + || paddr->pfield==(void *)&pcalc->low + || paddr->pfield==(void *)&pcalc->lolo){ + pcd->upper_ctrl_limit = pcalc->hopr; + pcd->lower_ctrl_limit = pcalc->lopr; + return(0); + } + + if(paddr->pfield>=(void *)&pcalc->a && paddr->pfield<=(void *)&pcalc->l){ + pcd->upper_ctrl_limit = pcalc->hopr; + pcd->lower_ctrl_limit = pcalc->lopr; + return(0); + } + if(paddr->pfield>=(void *)&pcalc->la && paddr->pfield<=(void *)&pcalc->ll){ + pcd->upper_ctrl_limit = pcalc->hopr; + pcd->lower_ctrl_limit = pcalc->lopr; + return(0); + } + return(0); +} +static long get_alarm_double(paddr,pad) + struct dbAddr *paddr; + struct dbr_alDouble *pad; +{ + struct calcoutRecord *pcalc=(struct calcoutRecord *)paddr->precord; + + if(paddr->pfield==(void *)&pcalc->val){ + pad->upper_alarm_limit = pcalc->hihi; + pad->upper_warning_limit = pcalc->high; + pad->lower_warning_limit = pcalc->low; + pad->lower_alarm_limit = pcalc->lolo; + } else recGblGetAlarmDouble(paddr,pad); + return(0); +} + + +static void alarm(pcalc) + struct calcoutRecord *pcalc; +{ + double val; + float hyst, lalm, hihi, high, low, lolo; + unsigned short hhsv, llsv, hsv, lsv; + + if(pcalc->udf == TRUE ){ + recGblSetSevr(pcalc,UDF_ALARM,INVALID_ALARM); + return; + } + hihi = pcalc->hihi; + lolo = pcalc->lolo; + high = pcalc->high; + low = pcalc->low; + hhsv = pcalc->hhsv; + llsv = pcalc->llsv; + hsv = pcalc->hsv; + lsv = pcalc->lsv; + val = pcalc->val; + hyst = pcalc->hyst; + lalm = pcalc->lalm; + + /* alarm condition hihi */ + if (hhsv && (val >= hihi || ((lalm==hihi) && (val >= hihi-hyst)))){ + if (recGblSetSevr(pcalc,HIHI_ALARM,pcalc->hhsv)) + pcalc->lalm = hihi; + return; + } + + /* alarm condition lolo */ + if (llsv && (val <= lolo || ((lalm==lolo) && (val <= lolo+hyst)))){ + if (recGblSetSevr(pcalc,LOLO_ALARM,pcalc->llsv)) + pcalc->lalm = lolo; + return; + } + + /* alarm condition high */ + if (hsv && (val >= high || ((lalm==high) && (val >= high-hyst)))){ + if (recGblSetSevr(pcalc,HIGH_ALARM,pcalc->hsv)) + pcalc->lalm = high; + return; + } + + /* alarm condition low */ + if (lsv && (val <= low || ((lalm==low) && (val <= low+hyst)))){ + if (recGblSetSevr(pcalc,LOW_ALARM,pcalc->lsv)) + pcalc->lalm = low; + return; + } + + /* we get here only if val is out of alarm by at least hyst */ + pcalc->lalm = val; + return; +} + +static void doOutputCallback(pcallback) + struct callback *pcallback; +{ + + dbCommon *pcalc; + struct rset *prset; + + callbackGetUser(pcalc, pcallback); + prset = (struct rset *)pcalc->rset; + dbScanLock((struct dbCommon *)pcalc); + (*prset->process)(pcalc); + dbScanUnlock((struct dbCommon *)pcalc); +} + + + +static void execOutput(pcalc) + struct calcoutRecord *pcalc; +{ + long status; + + /* Determine output data */ + switch(pcalc->dopt) { + case(calcoutDOPT_Use_VAL): + pcalc->oval = pcalc->val; + break; + case(calcoutDOPT_Use_OVAL): + if(!pcalc->oclv) { + if(calcPerform(&pcalc->a,&pcalc->oval,pcalc->orpc)) { + recGblSetSevr(pcalc,CALC_ALARM,INVALID_ALARM); + } + } + else + recGblSetSevr(pcalc,CALC_ALARM,INVALID_ALARM); + break; + } + + /* Check to see what to do if INVALID */ + if (pcalc->sevr < INVALID_ALARM ) { + /* Output the value */ + status=dbPutLink(&(pcalc->out), DBR_DOUBLE,&(pcalc->oval),1); + /* post event if output event != 0 */ + if(pcalc->oevt > 0) { + post_event((int)pcalc->oevt); + } + } + else { + switch (pcalc->ivoa) { + case (menuIvoaContinue_normally) : + /* write the new value */ + status=dbPutLink(&(pcalc->out), DBR_DOUBLE, + &(pcalc->oval),1); + /* post event if output event != 0 */ + if(pcalc->oevt > 0) { + post_event((int)pcalc->oevt); + } + break; + case (menuIvoaDon_t_drive_outputs) : + break; + case (menuIvoaSet_output_to_IVOV) : + pcalc->oval=pcalc->ivov; + status=dbPutLink(&(pcalc->out), DBR_DOUBLE, + &(pcalc->oval),1); + /* post event if output event != 0 */ + if(pcalc->oevt > 0) { + post_event((int)pcalc->oevt); + } + break; + default : + status=-1; + recGblRecordError(S_db_badField,(void *)pcalc, + "calcout:process Illegal IVOA field"); + } + } +} + +static void monitor(pcalc) + struct calcoutRecord *pcalc; +{ + unsigned short monitor_mask; + double delta; + double *pnew; + double *pprev; + int i; + + monitor_mask = recGblResetAlarms(pcalc); + /* check for value change */ + delta = pcalc->mlst - pcalc->val; + if(delta<0.0) delta = -delta; + if (delta > pcalc->mdel) { + /* post events for value change */ + monitor_mask |= DBE_VALUE; + /* update last value monitored */ + pcalc->mlst = pcalc->val; + } + /* check for archive change */ + delta = pcalc->alst - pcalc->val; + if(delta<0.0) delta = -delta; + if (delta > pcalc->adel) { + /* post events on value field for archive change */ + monitor_mask |= DBE_LOG; + /* update last archive value monitored */ + pcalc->alst = pcalc->val; + } + + /* send out monitors connected to the value field */ + if (monitor_mask){ + db_post_events(pcalc,&pcalc->val,monitor_mask); + } + /* check all input fields for changes*/ + for(i=0, pnew=&pcalc->a, pprev=&pcalc->la; ipovl != pcalc->oval) { + db_post_events(pcalc,&pcalc->oval, monitor_mask|DBE_VALUE|DBE_LOG); + pcalc->povl = pcalc->oval; + } + return; +} + +static int fetch_values(pcalc) + struct calcoutRecord *pcalc; +{ + struct link *plink; /* structure of the link field */ + double *pvalue; + long status = 0; + int i; + + for(i=0, plink=&pcalc->inpa, pvalue=&pcalc->a; irpvt; + + dbScanLock((struct dbCommon *)pcalc); + prpvt->wd_id_1_LOCK = 0; + checkLinks(pcalc); + dbScanUnlock((struct dbCommon *)pcalc); + +} + + + +static void checkLinks(pcalc) + struct calcoutRecord *pcalc; +{ + + struct link *plink; + struct rpvtStruct *prpvt = (struct rpvtStruct *)pcalc->rpvt; + int i; + int stat; + int caLink = 0; + int caLinkNc = 0; + unsigned short *plinkValid; + + if(calcoutRecDebug) printf("checkLinks() for %p\n", pcalc); + + plink = &pcalc->inpa; + plinkValid = &pcalc->inav; + + for(i=0; itype == CA_LINK) { + caLink = 1; + stat = dbCaIsLinkConnected(plink); + if(!stat && (*plinkValid == calcoutINAV_EXT_NC)) { + caLinkNc = 1; + } + else if(!stat && (*plinkValid == calcoutINAV_EXT)) { + *plinkValid = calcoutINAV_EXT_NC; + db_post_events(pcalc,plinkValid,DBE_VALUE); + caLinkNc = 1; + } + else if(stat && (*plinkValid == calcoutINAV_EXT_NC)) { + *plinkValid = calcoutINAV_EXT; + db_post_events(pcalc,plinkValid,DBE_VALUE); + } + } + + } + if(caLinkNc) + prpvt->caLinkStat = CA_LINKS_NOT_OK; + else if(caLink) + prpvt->caLinkStat = CA_LINKS_ALL_OK; + else + prpvt->caLinkStat = NO_CA_LINKS; + + if(!prpvt->wd_id_1_LOCK && caLinkNc) { + /* Schedule another CALLBACK */ + prpvt->wd_id_1_LOCK = 1; + wdStart(prpvt->wd_id_1, 30, (FUNCPTR)callbackRequest, + (int)(&prpvt->checkLinkCb)); + } +} + diff --git a/src/rec/calcoutRecord.dbd b/src/rec/calcoutRecord.dbd new file mode 100644 index 000000000..8103a2ebe --- /dev/null +++ b/src/rec/calcoutRecord.dbd @@ -0,0 +1,577 @@ +menu(calcoutOOPT) { + choice(calcoutOOPT_Every_Time,"Every Time") + choice(calcoutOOPT_On_Change,"On Change") + choice(calcoutOOPT_When_Zero,"When Zero") + choice(calcoutOOPT_When_Non_zero,"When Non-zero") + choice(calcoutOOPT_Transition_To_Zero,"Transition To Zero") + choice(calcoutOOPT_Transition_To_Non_zero,"Transition To Non-zero") +} +menu(calcoutDOPT) { + choice(calcoutDOPT_Use_VAL,"Use CALC") + choice(calcoutDOPT_Use_OVAL,"Use OCAL") +} +menu(calcoutINAP) { + choice(calcoutINAP_No,"No PROC on Change") + choice(calcoutINAP_Yes,"PROC on Change") +} +menu(calcoutINAV) { + choice(calcoutINAV_EXT_NC,"Ext PV NC") + choice(calcoutINAV_EXT,"Ext PV OK") + choice(calcoutINAV_LOC,"Local PV") + choice(calcoutINAV_CON,"Constant") +} +recordtype(calcout) { + include "dbCommon.dbd" + field(VERS,DBF_FLOAT) { + prompt("Code Version") + special(SPC_NOMOD) + initial("1") + } + field(RPVT,DBF_NOACCESS) { + prompt("Record Private") + special(SPC_NOMOD) + interest(4) + size(4) + extra("void * rpvt") + } + field(VAL,DBF_DOUBLE) { + prompt("Result") + asl(ASL0) + } + field(PVAL,DBF_DOUBLE) { + prompt("Previous Value") + } + field(CALC,DBF_STRING) { + prompt("Calculation") + promptgroup(GUI_CALC) + special(SPC_CALC) + pp(TRUE) + size(36) + } + field(CLCV,DBF_LONG) { + prompt("CALC Valid") + interest(1) + } + field(INPA,DBF_INLINK) { + prompt("Input A") + special(SPC_MOD) + promptgroup(GUI_CALC) + interest(1) + } + field(INPB,DBF_INLINK) { + prompt("Input B") + special(SPC_MOD) + promptgroup(GUI_CALC) + interest(1) + } + field(INPC,DBF_INLINK) { + prompt("Input C") + special(SPC_MOD) + promptgroup(GUI_CALC) + interest(1) + } + field(INPD,DBF_INLINK) { + prompt("Input D") + special(SPC_MOD) + promptgroup(GUI_CALC) + interest(1) + } + field(INPE,DBF_INLINK) { + prompt("Input E") + special(SPC_MOD) + promptgroup(GUI_CALC) + interest(1) + } + field(INPF,DBF_INLINK) { + prompt("Input F") + special(SPC_MOD) + promptgroup(GUI_CALC) + interest(1) + } + field(INPG,DBF_INLINK) { + prompt("Input G") + special(SPC_MOD) + promptgroup(GUI_CALC) + interest(1) + } + field(INPH,DBF_INLINK) { + prompt("Input H") + special(SPC_MOD) + promptgroup(GUI_CALC) + interest(1) + } + field(INPI,DBF_INLINK) { + prompt("Input I") + special(SPC_MOD) + promptgroup(GUI_CALC) + interest(1) + } + field(INPJ,DBF_INLINK) { + prompt("Input J") + special(SPC_MOD) + promptgroup(GUI_CALC) + interest(1) + } + field(INPK,DBF_INLINK) { + prompt("Input K") + special(SPC_MOD) + promptgroup(GUI_CALC) + interest(1) + } + field(INPL,DBF_INLINK) { + prompt("Input L") + special(SPC_MOD) + promptgroup(GUI_CALC) + interest(1) + } + field(OUT,DBF_OUTLINK) { + prompt("Output Specification") + special(SPC_MOD) + promptgroup(GUI_OUTPUT) + interest(1) + } + field(INAV,DBF_MENU) { + prompt("INPA PV Status") + special(SPC_NOMOD) + interest(1) + menu(calcoutINAV) + initial("1") + } + field(INBV,DBF_MENU) { + prompt("INPB PV Status") + special(SPC_NOMOD) + interest(1) + menu(calcoutINAV) + initial("1") + } + field(INCV,DBF_MENU) { + prompt("INPC PV Status") + special(SPC_NOMOD) + interest(1) + menu(calcoutINAV) + initial("1") + } + field(INDV,DBF_MENU) { + prompt("INPD PV Status") + special(SPC_NOMOD) + interest(1) + menu(calcoutINAV) + initial("1") + } + field(INEV,DBF_MENU) { + prompt("INPE PV Status") + special(SPC_NOMOD) + interest(1) + menu(calcoutINAV) + initial("1") + } + field(INFV,DBF_MENU) { + prompt("INPF PV Status") + special(SPC_NOMOD) + interest(1) + menu(calcoutINAV) + initial("1") + } + field(INGV,DBF_MENU) { + prompt("INPG PV Status") + special(SPC_NOMOD) + interest(1) + menu(calcoutINAV) + initial("1") + } + field(INHV,DBF_MENU) { + prompt("INPH PV Status") + special(SPC_NOMOD) + interest(1) + menu(calcoutINAV) + initial("1") + } + field(INIV,DBF_MENU) { + prompt("INPI PV Status") + special(SPC_NOMOD) + interest(1) + menu(calcoutINAV) + initial("1") + } + field(INJV,DBF_MENU) { + prompt("INPJ PV Status") + special(SPC_NOMOD) + interest(1) + menu(calcoutINAV) + initial("1") + } + field(INKV,DBF_MENU) { + prompt("INPK PV Status") + special(SPC_NOMOD) + interest(1) + menu(calcoutINAV) + initial("1") + } + field(INLV,DBF_MENU) { + prompt("INPL PV Status") + special(SPC_NOMOD) + interest(1) + menu(calcoutINAV) + initial("1") + } + field(OUTV,DBF_MENU) { + prompt("OUT PV Status") + special(SPC_NOMOD) + interest(1) + menu(calcoutINAV) + } +# Haven't figured out how to do this yet ... +# field(INAP,DBF_MENU) { +# prompt("INPA causes PROC") +# promptgroup(GUI_CALC) +# interest(1) +# menu(calcoutINAP) +# initial("0") +# } +# field(INBP,DBF_MENU) { +# prompt("INPB causes PROC") +# promptgroup(GUI_CALC) +# interest(1) +# menu(calcoutINAP) +# initial("0") +# } +# field(INCP,DBF_MENU) { +# prompt("INPC causes PROC") +# promptgroup(GUI_CALC) +# interest(1) +# menu(calcoutINAP) +# initial("0") +# } +# field(INDP,DBF_MENU) { +# prompt("INPD causes PROC") +# promptgroup(GUI_CALC) +# interest(1) +# menu(calcoutINAP) +# initial("0") +# } +# field(INEP,DBF_MENU) { +# prompt("INPE causes PROC") +# promptgroup(GUI_CALC) +# interest(1) +# menu(calcoutINAP) +# initial("0") +# } +# field(INFP,DBF_MENU) { +# prompt("INPF causes PROC") +# promptgroup(GUI_CALC) +# interest(1) +# menu(calcoutINAP) +# initial("0") +# } +# field(INGP,DBF_MENU) { +# prompt("INPG causes PROC") +# promptgroup(GUI_CALC) +# interest(1) +# menu(calcoutINAP) +# initial("0") +# } +# field(INHP,DBF_MENU) { +# prompt("INPH causes PROC") +# promptgroup(GUI_CALC) +# interest(1) +# menu(calcoutINAP) +# initial("0") +# } +# field(INIP,DBF_MENU) { +# prompt("INPI causes PROC") +# promptgroup(GUI_CALC) +# interest(1) +# menu(calcoutINAP) +# initial("0") +# } +# field(INJP,DBF_MENU) { +# prompt("INPJ causes PROC") +# promptgroup(GUI_CALC) +# interest(1) +# menu(calcoutINAP) +# initial("0") +# } + field(OOPT,DBF_MENU) { + prompt("Output Execute Opt") + promptgroup(GUI_CALC) + interest(1) + menu(calcoutOOPT) + } + field(ODLY,DBF_FLOAT) { + prompt("Output Execute Delay") + promptgroup(GUI_ALARMS) + asl(ASL0) + interest(1) + } + field(DLYA,DBF_USHORT) { + prompt("Output Delay Active") + special(SPC_NOMOD) + asl(ASL0) + } + field(DOPT,DBF_MENU) { + prompt("Output Data Opt") + promptgroup(GUI_CALC) + interest(1) + menu(calcoutDOPT) + } + field(OCAL,DBF_STRING) { + prompt("Output Calculation") + promptgroup(GUI_CALC) + special(SPC_CALC) + pp(TRUE) + size(36) + } + field(OCLV,DBF_LONG) { + prompt("OCAL Valid") + interest(1) + } + field(OEVT,DBF_USHORT) { + prompt("Event To Issue") + promptgroup(GUI_CLOCK) + asl(ASL0) + } + field(IVOA,DBF_MENU) { + prompt("INVALID output action") + promptgroup(GUI_OUTPUT) + interest(2) + menu(menuIvoa) + } + field(IVOV,DBF_DOUBLE) { + prompt("INVALID output value") + promptgroup(GUI_OUTPUT) + interest(2) + } + field(EGU,DBF_STRING) { + prompt("Units Name") + promptgroup(GUI_DISPLAY) + interest(1) + size(16) + } + field(PREC,DBF_SHORT) { + prompt("Display Precision") + promptgroup(GUI_DISPLAY) + interest(1) + } + field(HOPR,DBF_FLOAT) { + prompt("High Operating Rng") + promptgroup(GUI_DISPLAY) + interest(1) + } + field(LOPR,DBF_FLOAT) { + prompt("Low Operating Range") + promptgroup(GUI_DISPLAY) + interest(1) + } + field(HIHI,DBF_FLOAT) { + prompt("Hihi Alarm Limit") + promptgroup(GUI_ALARMS) + pp(TRUE) + interest(1) + } + field(LOLO,DBF_FLOAT) { + prompt("Lolo Alarm Limit") + promptgroup(GUI_ALARMS) + pp(TRUE) + interest(1) + } + field(HIGH,DBF_FLOAT) { + prompt("High Alarm Limit") + promptgroup(GUI_ALARMS) + pp(TRUE) + interest(1) + } + field(LOW,DBF_FLOAT) { + prompt("Low Alarm Limit") + promptgroup(GUI_ALARMS) + pp(TRUE) + interest(1) + } + field(HHSV,DBF_MENU) { + prompt("Hihi Severity") + promptgroup(GUI_ALARMS) + pp(TRUE) + interest(1) + menu(menuAlarmSevr) + } + field(LLSV,DBF_MENU) { + prompt("Lolo Severity") + promptgroup(GUI_ALARMS) + pp(TRUE) + interest(1) + menu(menuAlarmSevr) + } + field(HSV,DBF_MENU) { + prompt("High Severity") + promptgroup(GUI_ALARMS) + pp(TRUE) + interest(1) + menu(menuAlarmSevr) + } + field(LSV,DBF_MENU) { + prompt("Low Severity") + promptgroup(GUI_ALARMS) + pp(TRUE) + interest(1) + menu(menuAlarmSevr) + } + field(HYST,DBF_DOUBLE) { + prompt("Alarm Deadband") + promptgroup(GUI_ALARMS) + interest(1) + } + field(ADEL,DBF_DOUBLE) { + prompt("Archive Deadband") + promptgroup(GUI_DISPLAY) + interest(1) + } + field(MDEL,DBF_DOUBLE) { + prompt("Monitor Deadband") + promptgroup(GUI_DISPLAY) + interest(1) + } + field(A,DBF_DOUBLE) { + prompt("Value of Input A") + pp(TRUE) + } + field(B,DBF_DOUBLE) { + prompt("Value of Input B") + pp(TRUE) + } + field(C,DBF_DOUBLE) { + prompt("Value of Input C") + pp(TRUE) + } + field(D,DBF_DOUBLE) { + prompt("Value of Input D") + pp(TRUE) + } + field(E,DBF_DOUBLE) { + prompt("Value of Input E") + pp(TRUE) + } + field(F,DBF_DOUBLE) { + prompt("Value of Input F") + pp(TRUE) + } + field(G,DBF_DOUBLE) { + prompt("Value of Input G") + pp(TRUE) + } + field(H,DBF_DOUBLE) { + prompt("Value of Input H") + pp(TRUE) + } + field(I,DBF_DOUBLE) { + prompt("Value of Input I") + pp(TRUE) + } + field(J,DBF_DOUBLE) { + prompt("Value of Input J") + pp(TRUE) + } + field(K,DBF_DOUBLE) { + prompt("Value of Input K") + pp(TRUE) + } + field(L,DBF_DOUBLE) { + prompt("Value of Input L") + pp(TRUE) + } + field(OVAL,DBF_DOUBLE) { + prompt("Output Value") + asl(ASL0) + } + field(LA,DBF_DOUBLE) { + prompt("Prev Value of A") + special(SPC_NOMOD) + interest(3) + } + field(LB,DBF_DOUBLE) { + prompt("Prev Value of B") + special(SPC_NOMOD) + interest(3) + } + field(LC,DBF_DOUBLE) { + prompt("Prev Value of C") + special(SPC_NOMOD) + interest(3) + } + field(LD,DBF_DOUBLE) { + prompt("Prev Value of D") + special(SPC_NOMOD) + interest(3) + } + field(LE,DBF_DOUBLE) { + prompt("Prev Value of E") + special(SPC_NOMOD) + interest(3) + } + field(LF,DBF_DOUBLE) { + prompt("Prev Value of F") + special(SPC_NOMOD) + interest(3) + } + field(LG,DBF_DOUBLE) { + prompt("Prev Value of G") + special(SPC_NOMOD) + interest(3) + } + field(LH,DBF_DOUBLE) { + prompt("Prev Value of H") + special(SPC_NOMOD) + interest(3) + } + field(LI,DBF_DOUBLE) { + prompt("Prev Value of I") + special(SPC_NOMOD) + interest(3) + } + field(LJ,DBF_DOUBLE) { + prompt("Prev Value of J") + special(SPC_NOMOD) + interest(3) + } + field(LK,DBF_DOUBLE) { + prompt("Prev Value of K") + special(SPC_NOMOD) + interest(3) + } + field(LL,DBF_DOUBLE) { + prompt("Prev Value of L") + special(SPC_NOMOD) + interest(3) + } + field(POVL,DBF_DOUBLE) { + prompt("Prev Value of OVAL") + asl(ASL0) + } + field(LALM,DBF_DOUBLE) { + prompt("Last Value Alarmed") + special(SPC_NOMOD) + interest(3) + } + field(ALST,DBF_DOUBLE) { + prompt("Last Value Archived") + special(SPC_NOMOD) + interest(3) + } + field(MLST,DBF_DOUBLE) { + prompt("Last Val Monitored") + special(SPC_NOMOD) + interest(3) + } + field(RPCL,DBF_NOACCESS) { + prompt("Reverse Polish Calc") + special(SPC_NOMOD) + interest(4) + size(184) + extra("char rpcl[184]") + } + field(ORPC,DBF_NOACCESS) { + prompt("Reverse Polish OCalc") + special(SPC_NOMOD) + interest(4) + size(184) + extra("char orpc[184]") + } +} diff --git a/src/rec/compressRecord.c b/src/rec/compressRecord.c index edd640d31..0330223e0 100644 --- a/src/rec/compressRecord.c +++ b/src/rec/compressRecord.c @@ -66,7 +66,9 @@ #include #include +#include #include +#include #include #include #include diff --git a/src/rec/dfanoutRecord.c b/src/rec/dfanoutRecord.c index c54e00e5e..423326aa1 100644 --- a/src/rec/dfanoutRecord.c +++ b/src/rec/dfanoutRecord.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -37,7 +38,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 @@ -96,7 +97,6 @@ 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); @@ -112,16 +112,6 @@ static long process(pdfanout) pdfanout->pact=FALSE; return(status); } - -static long get_value(pdfanout,pvdes) - struct dfanoutRecord *pdfanout; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_LONG; - pvdes->no_elements=1; - (long *)(pvdes->pvalue) = &pdfanout->val; - return(0); -} static long get_units(paddr,units) struct dbAddr *paddr; diff --git a/src/rec/egRecord.c b/src/rec/egRecord.c index b1215d802..9200728d7 100644 --- a/src/rec/egRecord.c +++ b/src/rec/egRecord.c @@ -62,6 +62,7 @@ DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000). #include #include #include +#include #include #include #include @@ -83,7 +84,7 @@ STATIC void EgMonitor(struct egRecord *pRec); STATIC long EgInitRec(struct egRecord *, int); STATIC long EgProc(struct egRecord *); #define special NULL -STATIC long EgGetValue(); +#define get_value NULL #define cvt_dbaddr NULL #define get_array_info NULL #define put_array_info NULL @@ -103,7 +104,7 @@ struct rset egRSET={ EgInitRec, EgProc, special, - EgGetValue, + get_value, cvt_dbaddr, get_array_info, put_array_info, @@ -172,18 +173,6 @@ STATIC long EgProc(struct egRecord *pRec) pRec->pact=FALSE; return(0); } -/****************************************************************************** - * - * Value fields are worthless. - * - ******************************************************************************/ -STATIC long EgGetValue(struct egRecord *pRec, struct valueDes *pvdes) -{ - pvdes->field_type = DBF_CHAR; - pvdes->no_elements=1; - (char *)(pvdes->pvalue) = pRec->val; - return(0); -} /****************************************************************************** * diff --git a/src/rec/egeventRecord.c b/src/rec/egeventRecord.c index 371f2f4e6..df79241bb 100644 --- a/src/rec/egeventRecord.c +++ b/src/rec/egeventRecord.c @@ -61,6 +61,7 @@ DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000). #include #include #include +#include #include #include #include @@ -82,7 +83,7 @@ STATIC void EgEventMonitor(struct egeventRecord *pRec); STATIC long EgEventInitRec(struct egeventRecord *, int); STATIC long EgEventProc(struct egeventRecord *); #define special NULL -STATIC long EgEventGetValue(); +#define get_value NULL #define cvt_dbaddr NULL #define get_array_info NULL #define put_array_info NULL @@ -102,7 +103,7 @@ struct rset egeventRSET={ EgEventInitRec, EgEventProc, special, - EgEventGetValue, + get_value, cvt_dbaddr, get_array_info, put_array_info, @@ -168,18 +169,6 @@ STATIC long EgEventProc(struct egeventRecord *pRec) pRec->pact=FALSE; return(0); } -/****************************************************************************** - * - * Value fields are worthless. - * - ******************************************************************************/ -STATIC long EgEventGetValue(struct egeventRecord *pRec, struct valueDes *pvdes) -{ - pvdes->field_type = DBF_CHAR; - pvdes->no_elements=1; - (char *)(pvdes->pvalue) = pRec->val; - return(0); -} /****************************************************************************** * @@ -253,7 +242,6 @@ static long get_control_double(struct dbAddr *paddr, struct dbr_ctrlDouble *pcd) static long get_alarm_double(struct dbAddr *paddr, struct dbr_alDouble *pad) { - struct egeventRecord *pRec=(struct egeventRecord *)paddr->precord; #if 0 { pad->upper_alarm_limit = 2; diff --git a/src/rec/erRecord.c b/src/rec/erRecord.c index 11033ee49..8d1059911 100644 --- a/src/rec/erRecord.c +++ b/src/rec/erRecord.c @@ -61,6 +61,7 @@ DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000). #include #include #include +#include #include #include #include @@ -82,7 +83,7 @@ STATIC void ErMonitor(struct erRecord *pRec); STATIC long ErInitRec(struct erRecord *, int); STATIC long ErProc(struct erRecord *); #define ErSpecial NULL -STATIC long ErGetValue(); +#define get_value NULL #define cvt_dbaddr NULL #define get_array_info NULL #define put_array_info NULL @@ -102,7 +103,7 @@ struct rset erRSET={ ErInitRec, ErProc, ErSpecial, - ErGetValue, + get_value, cvt_dbaddr, get_array_info, put_array_info, @@ -208,19 +209,6 @@ STATIC long ErSpecial(struct dbAddr *paddr, int after) return(0); } #endif -/****************************************************************************** - * - * Value fields are worthless. - * - ******************************************************************************/ -STATIC long ErGetValue(struct erRecord *pRec, struct valueDes *pvdes) -{ - pvdes->field_type = DBF_CHAR; - pvdes->no_elements=1; - (char *)(pvdes->pvalue) = pRec->val; - return(0); -} - /****************************************************************************** * * Post any events for fields that might have changed while processing. @@ -293,7 +281,6 @@ static long get_control_double(struct dbAddr *paddr, struct dbr_ctrlDouble *pcd) static long get_alarm_double(struct dbAddr *paddr, struct dbr_alDouble *pad) { - struct erRecord *pRec=(struct erRecord *)paddr->precord; #if 0 { pad->upper_alarm_limit = 2; diff --git a/src/rec/ereventRecord.c b/src/rec/ereventRecord.c index 1dd6447aa..6a2f00f23 100644 --- a/src/rec/ereventRecord.c +++ b/src/rec/ereventRecord.c @@ -61,6 +61,7 @@ DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000). #include #include #include +#include #include #include #include @@ -81,7 +82,7 @@ STATIC void ErEventMonitor(struct ereventRecord *pRec); STATIC long ErEventInitRec(struct ereventRecord *, int); STATIC long ErEventProc(struct ereventRecord *); #define special NULL -STATIC long ErEventGetValue(); +#define get_value NULL #define cvt_dbaddr NULL #define get_array_info NULL #define put_array_info NULL @@ -101,7 +102,7 @@ struct rset ereventRSET={ ErEventInitRec, ErEventProc, special, - ErEventGetValue, + get_value, cvt_dbaddr, get_array_info, put_array_info, @@ -166,18 +167,6 @@ STATIC long ErEventProc(struct ereventRecord *pRec) pRec->pact=FALSE; return(0); } -/****************************************************************************** - * - * Value fields are worthless. - * - ******************************************************************************/ -STATIC long ErEventGetValue(struct ereventRecord *pRec, struct valueDes *pvdes) -{ - pvdes->field_type = DBF_CHAR; - pvdes->no_elements=1; - (char *)(pvdes->pvalue) = pRec->val; - return(0); -} /****************************************************************************** * diff --git a/src/rec/eventRecord.c b/src/rec/eventRecord.c index 37110f9d8..f736a2061 100644 --- a/src/rec/eventRecord.c +++ b/src/rec/eventRecord.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include diff --git a/src/rec/fanoutRecord.c b/src/rec/fanoutRecord.c index 98c5032f7..5997da3a2 100644 --- a/src/rec/fanoutRecord.c +++ b/src/rec/fanoutRecord.c @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -107,7 +108,6 @@ static long init_record(pfanout,pass) struct fanoutRecord *pfanout; int pass; { - long status; if (pass==0) return(0); recGblInitConstantLink(&pfanout->sell,DBF_USHORT,&pfanout->seln); @@ -117,12 +117,9 @@ static long init_record(pfanout,pass) static long process(pfanout) struct fanoutRecord *pfanout; { - unsigned short stat,sevr,nsta,nsev; - struct link *plink; unsigned short state; short i; - long status=0; unsigned short monitor_mask; pfanout->pact = TRUE; diff --git a/src/rec/gsubRecord.c b/src/rec/gsubRecord.c index a21e93f75..3734092ff 100644 --- a/src/rec/gsubRecord.c +++ b/src/rec/gsubRecord.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -59,7 +60,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 @@ -98,10 +99,6 @@ static long fetch_values(); static void monitor(); #define ARG_MAX 6 - /* Fldnames should have as many as ARG_MAX */ - static char *Fldnames[ARG_MAX] = - {"A", "B", "C", "D", "E", "F"}; - static long init_record(psub,pass) struct gsubRecord *psub; @@ -183,16 +180,6 @@ static long process(psub) return(0); } -static long get_value(psub,pvdes) - struct gsubRecord *psub; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_FLOAT; - pvdes->no_elements=1; - (float *)(pvdes->pvalue) = &psub->val; - return(0); -} - static long get_units(paddr,units) struct dbAddr *paddr; char *units; diff --git a/src/rec/histogramRecord.c b/src/rec/histogramRecord.c index 507d0f760..f0796d37a 100644 --- a/src/rec/histogramRecord.c +++ b/src/rec/histogramRecord.c @@ -54,6 +54,8 @@ #include #include #include +#include +#include #include #include #include @@ -69,7 +71,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(); #define put_array_info NULL @@ -184,7 +186,7 @@ static long init_record(phistogram,pass) pcallback->callback = wdCallback; pcallback->priority = priorityLow; if(dbNameToAddr(phistogram->name,&(pcallback->dbAddr))) { - logMsg("dbNameToAddr failed in init_record for recHistogram\n"); + epicsPrintf("dbNameToAddr failed in init_record for recHistogram\n"); exit(1); } pcallback->wd_id = wdCreate(); @@ -306,17 +308,6 @@ static void monitor(phistogram) return; } -static long get_value(phistogram,pvdes) - struct histogramRecord *phistogram; - struct valueDes *pvdes; -{ - - pvdes->no_elements=phistogram->nelm; - (unsigned long *)(pvdes->pvalue) = phistogram->bptr; - pvdes->field_type = DBF_ULONG; - return(0); -} - static long cvt_dbaddr(paddr) struct dbAddr *paddr; { diff --git a/src/rec/longinRecord.c b/src/rec/longinRecord.c index f87bc4463..7835166fa 100644 --- a/src/rec/longinRecord.c +++ b/src/rec/longinRecord.c @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -68,7 +69,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 @@ -179,17 +180,6 @@ static long process(plongin) plongin->pact=FALSE; return(status); } - -static long get_value(plongin,pvdes) - struct longinRecord *plongin; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_LONG; - pvdes->no_elements=1; - (long *)(pvdes->pvalue) = &plongin->val; - return(0); -} - static long get_units(paddr,units) struct dbAddr *paddr; diff --git a/src/rec/longoutRecord.c b/src/rec/longoutRecord.c index 74a9d10e7..ae6c91b95 100644 --- a/src/rec/longoutRecord.c +++ b/src/rec/longoutRecord.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include diff --git a/src/rec/mbbiDirectRecord.c b/src/rec/mbbiDirectRecord.c index 38ef1650d..4b24dfda4 100644 --- a/src/rec/mbbiDirectRecord.c +++ b/src/rec/mbbiDirectRecord.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -58,7 +59,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 @@ -111,7 +112,7 @@ static void refresh_bits(pmbbiDirect) struct mbbiDirectRecord *pmbbiDirect; { int i, mask = 1; - char *bit; + unsigned char *bit; bit = &(pmbbiDirect->b0); for (i=0; ifield_type = DBF_USHORT; - pvdes->no_elements=1; - (unsigned short *)(pvdes->pvalue) = &pmbbiDirect->val; - return(0); -} - static void monitor(pmbbiDirect) struct mbbiDirectRecord *pmbbiDirect; { diff --git a/src/rec/mbbiRecord.c b/src/rec/mbbiRecord.c index 27e4f46f3..85c8d3374 100644 --- a/src/rec/mbbiRecord.c +++ b/src/rec/mbbiRecord.c @@ -63,6 +63,7 @@ #include #include #include +#include #include #include #include diff --git a/src/rec/mbboDirectRecord.c b/src/rec/mbboDirectRecord.c index 45563707a..93eff98ec 100644 --- a/src/rec/mbboDirectRecord.c +++ b/src/rec/mbboDirectRecord.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -58,7 +59,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 @@ -206,7 +207,7 @@ static long special(paddr,after) { struct mbboDirectRecord *pmbboDirect = (struct mbboDirectRecord *)(paddr->precord); int special_type = paddr->special, offset = 1, i; - char *bit; + unsigned char *bit; if(!after) return(0); switch(special_type) { @@ -254,16 +255,6 @@ static long special(paddr,after) } } -static long get_value(pmbboDirect,pvdes) - struct mbboDirectRecord *pmbboDirect; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_USHORT; - pvdes->no_elements=1; - (unsigned short *)(pvdes->pvalue) = &pmbboDirect->val; - return(0); -} - static void monitor(pmbboDirect) struct mbboDirectRecord *pmbboDirect; { @@ -272,7 +263,7 @@ static void monitor(pmbboDirect) monitor_mask = recGblResetAlarms(pmbboDirect); monitor_mask |= (DBE_LOG|DBE_VALUE); if(monitor_mask) - db_post_events(pmbboDirect,pmbboDirect->val,monitor_mask); + db_post_events(pmbboDirect,&pmbboDirect->val,monitor_mask); /* check for value change */ if (pmbboDirect->mlst != pmbboDirect->val){ diff --git a/src/rec/mbboRecord.c b/src/rec/mbboRecord.c index 1af882c00..e5e032b3d 100644 --- a/src/rec/mbboRecord.c +++ b/src/rec/mbboRecord.c @@ -70,6 +70,7 @@ #include #include #include +#include #include #include #include @@ -86,7 +87,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 @@ -219,6 +220,8 @@ static long init_record(pmbbo,pass) } else if (status==2) status=0; } init_common(pmbbo); + /* convert val to rval */ + convert(pmbbo); return(0); } @@ -315,16 +318,6 @@ static long special(paddr,after) } } -static long get_value(pmbbo,pvdes) - struct mbboRecord *pmbbo; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_ENUM; - pvdes->no_elements=1; - (unsigned short *)(pvdes->pvalue) = &pmbbo->val; - return(0); -} - static long get_enum_str(paddr,pstring) struct dbAddr *paddr; char *pstring; diff --git a/src/rec/palRecord.c b/src/rec/palRecord.c index 8ef2d47c2..b76bcd703 100644 --- a/src/rec/palRecord.c +++ b/src/rec/palRecord.c @@ -41,9 +41,11 @@ #include #include #include +#include #include #include #include +#include #include #define GEN_SIZE_OFFSET #include @@ -55,7 +57,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 @@ -94,9 +96,6 @@ struct pal * palinit(); #define ARG_MAX 12 - /* Fldnames should have as many as ARG_MAX */ - static char *Fldnames[ARG_MAX] = - {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"}; #define OUT_MAX 12 @@ -104,12 +103,9 @@ static long init_record(ppal,pass) struct palRecord *ppal; int pass; { - long status; struct link *plink; int i; double *pvalue; - short error_number; - char rpbuf[184]; if (pass==0) return(0); @@ -130,14 +126,15 @@ static long process(ppal) { unsigned char *temp; int i; - double *tptr; + unsigned int result = 0; ppal->pact = TRUE; if (fetch_values(ppal)==0) { - if(pal(ppal->pptr,&ppal->a,12,&ppal->val)) - printf("palrec - error, pptr = %x\n",ppal->pptr); + if(pal(ppal->pptr,&ppal->a,12,&result)) + printf("palrec - error, pptr = %p\n",ppal->pptr); + ppal->val = result; ppal->udf = FALSE; } for (i = 0, temp = &ppal->q0; i < OUT_MAX; i++, temp++) @@ -155,16 +152,6 @@ static long process(ppal) return(0); } -static long get_value(ppal,pvdes) - struct palRecord *ppal; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_ULONG; - pvdes->no_elements=1; - (double *)(pvdes->pvalue) = &ppal->val; - return(0); -} - static long get_units(paddr,units) struct dbAddr *paddr; char *units; @@ -191,8 +178,6 @@ static void monitor(ppal) struct palRecord *ppal; { unsigned short monitor_mask; - double delta; - short stat,sevr,nsta,nsev; double *pnew; double *pprev; int i; @@ -229,9 +214,9 @@ static int fetch_values(ppal) struct palRecord *ppal; { struct link *plink; /* structure of the link field */ - double *pvalue,sval; + double *pvalue; long status; - int i,j; + int i; for(i=0, plink=&ppal->inpa, pvalue=&ppal->a; i #include +#include #include #include #include @@ -57,7 +58,7 @@ #define init_record NULL 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 @@ -104,17 +105,6 @@ static long process(ppermissive) ppermissive->pact=FALSE; return(0); } - - -static long get_value(ppermissive,pvdes) - struct permissiveRecord *ppermissive; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_USHORT; - pvdes->no_elements=1; - (unsigned short *)(pvdes->pvalue) = &(ppermissive->val); - return(0); -} static void monitor(ppermissive) struct permissiveRecord *ppermissive; diff --git a/src/rec/pidRecord.c b/src/rec/pidRecord.c index d5e6ef9d8..c96f7b79d 100644 --- a/src/rec/pidRecord.c +++ b/src/rec/pidRecord.c @@ -55,6 +55,7 @@ unsigned long tickGet(); #include #include #include +#include #include #include #include diff --git a/src/rec/pulseCounterRecord.c b/src/rec/pulseCounterRecord.c index 71303f91a..3438581aa 100644 --- a/src/rec/pulseCounterRecord.c +++ b/src/rec/pulseCounterRecord.c @@ -39,13 +39,15 @@ */ #include -#include -#include +#include +#include +#include #include #include #include #include +#include #include #include #include @@ -61,7 +63,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 @@ -124,12 +126,15 @@ struct callback { void callbackRequest(); -static void myCallback(struct callback *pcallback) +static void myCallback(CALLBACK *p) { + struct callback *pcallback; + struct pulseCounterRecord *pc; + struct rset *prset; - struct pulseCounterRecord *pc=(struct pulseCounterRecord *)pcallback->precord; - struct rset *prset=(struct rset *)(pc->rset); - + callbackGetUser(pcallback,p); + pc=(struct pulseCounterRecord *)pcallback->precord; + prset=(struct rset *)(pc->rset); dbScanLock((struct dbCommon *)pc); (*prset->process)(pc); dbScanUnlock((struct dbCommon *)pc); @@ -163,7 +168,9 @@ static long init_record(struct pulseCounterRecord *ppc, int pass) } pcallback=(struct callback *)malloc(sizeof(struct callback)); - callbackSetCallback(myCallback,(CALLBACK *)pcallback); + callbackSetCallback(myCallback,&pcallback->callback); + callbackSetPriority(ppc->prio,&pcallback->callback); + callbackSetUser(pcallback,&pcallback->callback); pcallback->precord=(struct dbCommon *)ppc; /* call device support init_record */ @@ -217,7 +224,7 @@ static long process(struct pulseCounterRecord *ppc) if(ppc->pact==TRUE) { - callbackRequest((CALLBACK *)pcallback); + callbackRequest(&pcallback->callback); return(0); } } @@ -258,14 +265,6 @@ static long process(struct pulseCounterRecord *ppc) return(status); } -static long get_value(struct pulseCounterRecord *ppc, struct valueDes *pvdes) -{ - pvdes->field_type = DBF_ULONG; - pvdes->no_elements=1; - (short *)pvdes->pvalue = &ppc->val; - return(0); -} - static long get_graphic_double(struct dbAddr *paddr, struct dbr_grDouble *pgd) { struct pulseCounterRecord *ppc=(struct pulseCounterRecord *)paddr->precord; diff --git a/src/rec/pulseDelayRecord.c b/src/rec/pulseDelayRecord.c index 9dafce017..6aa1cd03c 100644 --- a/src/rec/pulseDelayRecord.c +++ b/src/rec/pulseDelayRecord.c @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -71,7 +72,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 @@ -205,15 +206,6 @@ static long process(ppd) return(0); } -static long get_value(ppd,pvdes) - struct pulseDelayRecord *ppd; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_SHORT; - pvdes->no_elements=1; - (short *)pvdes->pvalue = &ppd->val; - return(0); -} static long get_precision(paddr,precision) struct dbAddr *paddr; long *precision; @@ -321,7 +313,7 @@ static long put_enum_str(struct dbAddr *paddr,char *p) if(paddr->pfield==(void *)&ppd->hts) { - if(sscanf(p,"%i",&ppd->hts)<=0) + if(sscanf(p,"%hu",&ppd->hts)<=0) return(S_db_badChoice); } else diff --git a/src/rec/pulseTrainRecord.c b/src/rec/pulseTrainRecord.c index f49e6e7cc..98489b3a8 100644 --- a/src/rec/pulseTrainRecord.c +++ b/src/rec/pulseTrainRecord.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -66,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 @@ -211,15 +212,6 @@ static long process(ppt) return(0); } -static long get_value(ppt,pvdes) - struct pulseTrainRecord *ppt; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_SHORT; - pvdes->no_elements=1; - (short *)pvdes->pvalue = &ppt->val; - return(0); -} static long get_precision(paddr,precision) struct dbAddr *paddr; long *precision; diff --git a/src/rec/recDynLink.c b/src/rec/recDynLink.c index 24a5d76a1..2ec2055f3 100644 --- a/src/rec/recDynLink.c +++ b/src/rec/recDynLink.c @@ -21,6 +21,7 @@ of this distribution. #include #include +#include #include #include #include @@ -58,9 +59,6 @@ of this distribution. #define newDBR_DOUBLE newDBF_DOUBLE #define newDBR_ENUM newDBF_ENUM #define VALID_newDB_REQ(x) ((x >= 0) && (x <= newDBR_ENUM)) -static short mapOldToNew[DBF_DOUBLE+1] = { - newDBR_STRING,newDBR_SHORT,newDBR_FLOAT,newDBR_ENUM, - newDBR_CHAR,newDBR_LONG,newDBR_DOUBLE}; static short mapNewToOld[newDBR_ENUM+1] = { DBF_STRING,DBF_CHAR,DBF_CHAR,DBF_SHORT,DBF_SHORT, DBF_LONG,DBF_LONG,DBF_FLOAT,DBF_DOUBLE,DBF_ENUM}; @@ -71,8 +69,8 @@ int recDynLinkQsize = 256; LOCAL int inpTaskId=0; LOCAL int outTaskId=0; -LOCAL RING_ID inpRingQ;; -LOCAL RING_ID outRingQ;; +LOCAL RING_ID inpRingQ; +LOCAL RING_ID outRingQ; LOCAL SEM_ID wakeUpSem; typedef enum{cmdSearch,cmdClear,cmdPut} cmdType; diff --git a/src/rec/recWaitCa.c b/src/rec/recWaitCa.c index 3a472e222..0e09a703f 100644 --- a/src/rec/recWaitCa.c +++ b/src/rec/recWaitCa.c @@ -27,7 +27,7 @@ extern int interruptAccept; int recWaitCaQsize = 256; LOCAL int taskid=0; -LOCAL RING_ID ringQ;; +LOCAL RING_ID ringQ; LOCAL FAST_LOCK lock; typedef enum {cmdNone,cmdAdd,cmdRemove} COMMAND; @@ -45,7 +45,7 @@ void recWaitCaTask(void); LOCAL void eventCallback(struct event_handler_args eha) { - struct dbr_sts_double *pdata = eha.dbr; + const struct dbr_sts_double *pdata = eha.dbr; CAPVT *pcapvt; RECWAITCA *pcamonitor; @@ -84,6 +84,7 @@ long recWaitCaAdd(RECWAITCA *pcamonitor) if(rngBufPut(ringQ,(void *)&pcapvt,sizeof(pcapvt)) !=sizeof(pcamonitor)) errMessage(0,"recWaitCaAdd: rngBufPut error"); FASTUNLOCK(&lock); + return(0); } long recWaitCaDelete(RECWAITCA *pcamonitor) @@ -95,6 +96,7 @@ long recWaitCaDelete(RECWAITCA *pcamonitor) if(rngBufPut(ringQ,(void *)&pcapvt,sizeof(pcapvt)) !=sizeof(pcamonitor)) errMessage(0,"recWaitCaDelete: rngBufPut error"); FASTUNLOCK(&lock); + return(0); } /*LOCAL */ diff --git a/src/rec/scanRecord.c b/src/rec/scanRecord.c index f61f0139d..c199858fb 100644 --- a/src/rec/scanRecord.c +++ b/src/rec/scanRecord.c @@ -124,10 +124,12 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -229,7 +231,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(); @@ -397,7 +399,6 @@ static void previewScan(struct scanRecord *pscan); static void lookupPV(struct scanRecord *pscan, unsigned short i); static void checkConnections(struct scanRecord *pscan); static void pvSearchCallback(recDynLink *precDynLink); -static void pvMonitorCallback(recDynLink *precDynLink); static void posMonCallback(recDynLink *precDynLink); static void restorePosParms(struct scanRecord *pscan, unsigned short i); static void savePosParms(struct scanRecord *pscan, unsigned short i); @@ -416,7 +417,6 @@ static long init_record(pscan,pass) recPvtStruct *precPvt = (recPvtStruct *)pscan->rpvt; posFields *pPosFields; detFields *pDetFields; - long status = 0; char *ppvn[PVN_SIZE]; unsigned short *pPvStat; @@ -638,7 +638,7 @@ static long special(paddr,after) /* postpone the scan for 5 seconds via watchdog */ pscan->alrt = 1; db_post_events(pscan,&pscan->alrt,DBE_VALUE); - sprintf(pscan->smsg,"Some PV's not connected ..."); + strcpy(pscan->smsg,"Some PV's not connected ..."); db_post_events(pscan,&pscan->smsg,DBE_VALUE); precPvt->phase = SCAN_PENDING; wdStart(precPvt->wd_id,(3 * sysClkRateGet()), @@ -656,7 +656,7 @@ static long special(paddr,after) if(pscan->cmnd == CLEAR_MSG) { pscan->alrt = 0; db_post_events(pscan,&pscan->alrt,DBE_VALUE); - sprintf(pscan->smsg,""); + strcpy(pscan->smsg,""); db_post_events(pscan,&pscan->smsg,DBE_VALUE); } else if((pscan->cmnd == CHECK_LIMITS) && !(pscan->exsc)) { @@ -703,8 +703,8 @@ static long special(paddr,after) for(i=0; icaLinkStruct[i].puserPvt; if((pscan->cmnd == CLEAR_RECORD) || - (pscan->cmnd == CLEAR_POSITIONERS) && - (puserPvt->linkType == POSITIONER)) { + ((pscan->cmnd == CLEAR_POSITIONERS) && + (puserPvt->linkType == POSITIONER))) { /* clear this PV */ pPvStat = &pscan->p1nv + i; /* pointer arithmetic */ oldStat = *pPvStat; @@ -809,7 +809,7 @@ static long special(paddr,after) /* resolve linear scan parameters affected by this fields change */ prevAlrt = pscan->alrt; pscan->alrt = 0; - sprintf(pscan->smsg,""); + strcpy(pscan->smsg,""); adjLinParms(paddr); db_post_events(pscan,&pscan->smsg,DBE_VALUE); if(pscan->alrt != prevAlrt) { @@ -828,7 +828,7 @@ static long special(paddr,after) } prevAlrt = pscan->alrt; pscan->alrt = 0; - sprintf(pscan->smsg,""); + strcpy(pscan->smsg,""); precPvt->nptsCause = -1; /* resolve all positioner parameters */ changedNpts(pscan); db_post_events(pscan,&pscan->smsg,DBE_VALUE); @@ -912,7 +912,6 @@ static long cvt_dbaddr(paddr) { struct scanRecord *pscan=(struct scanRecord *)paddr->precord; - recPvtStruct *precPvt = (recPvtStruct *)pscan->rpvt; posFields *pPosFields = (posFields *)&pscan->p1pp; detFields *pDetFields = (detFields *)&pscan->d1hr; short fieldOffset; @@ -1029,7 +1028,6 @@ static long put_array_info(paddr,nNew) recPvtStruct *precPvt = (recPvtStruct *)pscan->rpvt; posFields *pPosFields = (posFields *)&pscan->p1pp; short fieldOffset; - unsigned short *pPvStat; unsigned short i; /* This routine is called because someone wrote a table to the @@ -1049,7 +1047,7 @@ static long put_array_info(paddr,nNew) db_post_events(pscan,&pscan->alrt,DBE_VALUE); } } else { - sprintf(pscan->smsg,""); + strcpy(pscan->smsg,""); db_post_events(pscan,&pscan->smsg,DBE_VALUE); if(pscan->alrt) { pscan->alrt = 0; @@ -1109,7 +1107,7 @@ static long put_enum_str(paddr,pstring) if(paddr->pfield==(void *)&pscan->cmnd) { - if(sscanf(pstring,"%i",&pscan->cmnd)<=0) + if(sscanf(pstring,"%hu",&pscan->cmnd)<=0) return(S_db_badChoice); } else @@ -1120,17 +1118,6 @@ static long put_enum_str(paddr,pstring) return(0); } - -static long get_value(pscan,pvdes) - struct scanRecord *pscan; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_DOUBLE; - pvdes->no_elements=1; - (double *)(pvdes->pvalue) = &pscan->p1dv; - return(0); -} - static long get_units(paddr,units) struct dbAddr *paddr; char *units; @@ -1579,7 +1566,7 @@ LOCAL void pvSearchCallback(recDynLink *precDynLink) /* if(puserPvt->nelem) { printf("Freeing memory for dynLink %d \n", index); - /* free(pDetFields->d_da); + free(pDetFields->d_da); } */ @@ -1625,8 +1612,7 @@ LOCAL void posMonCallback(recDynLink *precDynLink) unsigned short index = puserPvt->linkIndex; posFields *pPosFields = (posFields *)&pscan->p1pp + index; long status; - long nRequest = 1; - long options = 0; + size_t nRequest = 1; /* update p_cv with current positioner value */ @@ -1682,11 +1668,8 @@ static long initScan(pscan) struct scanRecord *pscan; { recPvtStruct *precPvt = (recPvtStruct *)pscan->rpvt; - recDynLinkPvt *puserPvt; posFields *pPosFields; long status; - long nRequest = 1; - long options = 0; unsigned short *pPvStat; int i; @@ -1811,8 +1794,7 @@ struct scanRecord *pscan; unsigned short *pPvStatPos; unsigned short i; long status; - long nRequest = 1; - long options = 0; + size_t nRequest = 1; switch (precPvt->phase) { case TRIG_DETCTRS: @@ -1838,7 +1820,7 @@ struct scanRecord *pscan; } else { status = dbGet(puserPvt->pAddr,DBR_DOUBLE, &pPosFields->r_cv, - &options, &nRequest,NULL); + 0,0,NULL); } if((pPosFields->r_dl > 0) && @@ -1885,7 +1867,7 @@ struct scanRecord *pscan; } else { status = dbGet(puserPvt->pAddr,DBR_DOUBLE, &pPosFields->r_cv, - &options, &nRequest,NULL); + 0,0,NULL); } precPvt->posBufPtr[i].pFill[pscan->cpt] = pPosFields->r_cv; @@ -1935,7 +1917,7 @@ struct scanRecord *pscan; } else { status |= dbGet(puserPvt->pAddr, DBR_FLOAT, &pDetFields->d_cv, - &options, &nRequest, NULL); + 0,0, NULL); } } else { @@ -2008,7 +1990,6 @@ struct scanRecord *pscan; int counter; unsigned short *pPvStat, i; detFields *pDetFields; - posFields *pPosFields; /* Done with scan. Do we want to fill the remainder of the @@ -2106,7 +2087,6 @@ void doPuts(precPvt) unsigned short *pPvStat; int i; long status; - long nRequest = 1; switch (precPvt->phase) { case MOVE_MOTORS: @@ -2281,7 +2261,7 @@ void doPuts(precPvt) if(pscan->exsc && !precPvt->badOutputPv && !precPvt->badInputPv) { pscan->alrt = 0; db_post_events(pscan,&pscan->alrt,DBE_VALUE); - sprintf(pscan->smsg,""); + strcpy(pscan->smsg,""); db_post_events(pscan,&pscan->smsg,DBE_VALUE); scanOnce(pscan); if(recScanDebug) printf("scanPending - start scan\n"); @@ -2294,8 +2274,8 @@ void doPuts(precPvt) if(recScanDebug) printf("scanPending - end scan\n"); } break; - default: + break; } } @@ -2831,8 +2811,7 @@ static long checkScanLimits(pscan) /* for each valid positioner, fetch control limits */ long status; - long nRequest = 1; - long options = 0; + size_t nRequest = 1; int i,j; double value; @@ -2863,7 +2842,7 @@ static long checkScanLimits(pscan) } else { status |= dbGet(puserPvt->pAddr, DBR_DOUBLE, &pPosFields->p_pp, - &options, &nRequest, NULL); + 0,0, NULL); } db_post_events(pscan,&pPosFields->p_pp,DBE_VALUE); } @@ -2973,8 +2952,7 @@ static void previewScan(pscan) float value; int i,j; long status; - long nRequest = 1; - long options = 0; + size_t nRequest = 1; /* Update "previous position" of positioners to use in relative mode */ pPvStat = &pscan->p1nv; @@ -2988,7 +2966,7 @@ static void previewScan(pscan) } else { status |= dbGet(puserPvt->pAddr, DBR_DOUBLE, &pPosFields->p_pp, - &options, &nRequest, NULL); + 0,0, NULL); } db_post_events(pscan,&pPosFields->p_pp,DBE_VALUE); } @@ -3099,7 +3077,6 @@ static void savePosParms(struct scanRecord *pscan, unsigned short i) static void zeroPosParms(struct scanRecord *pscan, unsigned short i) { - recPvtStruct *precPvt = (recPvtStruct *)pscan->rpvt; posFields *pPosFields = (posFields *)&pscan->p1pp + i; /* set them to 0 */ @@ -3120,7 +3097,6 @@ static void resetFrzFlags(pscan) struct scanRecord *pscan; { - recPvtStruct *precPvt = (recPvtStruct *)pscan->rpvt; posFields *pPosFields = (posFields *)&pscan->p1pp; int i; @@ -3330,3 +3306,4 @@ SIECW (Start,Incr,End,Center,Width freeze-switch states; '1' = 'frozen') */ + diff --git a/src/rec/selRecord.c b/src/rec/selRecord.c index 36d631206..e21b3a140 100644 --- a/src/rec/selRecord.c +++ b/src/rec/selRecord.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -70,7 +71,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 @@ -115,10 +116,6 @@ static int fetch_values(); static void monitor(); #define ARG_MAX 12 - /* Fldnames should have as many as ARG_MAX */ - static char *Fldnames[ARG_MAX] = - {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"}; - static long init_record(psel,pass) struct selRecord *psel; @@ -127,8 +124,6 @@ static long init_record(psel,pass) struct link *plink; int i; double *pvalue; -/* Added for Channel Access Links */ - long status; if (pass==0) return(0); @@ -175,16 +170,6 @@ static long process(psel) } -static long get_value(psel,pvdes) - struct selRecord *psel; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_DOUBLE; - pvdes->no_elements=1; - (double *)(pvdes->pvalue) = &psel->val; - return(0); -} - static long get_units(paddr,units) struct dbAddr *paddr; char *units; diff --git a/src/rec/seqRecord.c b/src/rec/seqRecord.c index 0915a7331..142e01637 100644 --- a/src/rec/seqRecord.c +++ b/src/rec/seqRecord.c @@ -31,16 +31,19 @@ * .01 09-21-92 jrw created */ #include -#include -#include +#include +#include +#include #include #include #include #include +#include #include #include #include +#include #include #include #include @@ -99,6 +102,8 @@ struct callbackSeq { struct linkDesc *plinks[NUM_LINKS+1]; /* Pointers to links to process */ int index; }; + +int processNextLink(); /***************************************************************************** * * Initialize a sequence record. @@ -144,7 +149,6 @@ int pass; index = 0; while (index < NUM_LINKS) { - char DumbCaString[10]; if (plink->dol.type == CONSTANT) recGblInitConstantLink(&plink->dol,DBF_DOUBLE,&plink->dov); @@ -293,7 +297,7 @@ struct seqRecord *pseq; * dbScanLock is already held for pseq before this function is called. * ******************************************************************************/ -processNextLink(pseq) +int processNextLink(pseq) struct seqRecord *pseq; { struct callbackSeq *pcb = (struct callbackSeq *) (pseq->dpvt); diff --git a/src/rec/stateRecord.c b/src/rec/stateRecord.c index b5590ce62..56f8d5d51 100644 --- a/src/rec/stateRecord.c +++ b/src/rec/stateRecord.c @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -59,7 +60,7 @@ #define init_record NULL 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 @@ -107,17 +108,6 @@ static long process(pstate) pstate->pact=FALSE; return(0); } - -static long get_value(pstate,pvdes) - struct stateRecord *pstate; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_STRING; - pvdes->no_elements=1; - pvdes->pvalue = (void *)(&pstate->val[0]); - return(0); -} - static void monitor(pstate) struct stateRecord *pstate; diff --git a/src/rec/steppermotorRecord.c b/src/rec/steppermotorRecord.c index 56e09fe34..5753e5d40 100644 --- a/src/rec/steppermotorRecord.c +++ b/src/rec/steppermotorRecord.c @@ -109,6 +109,7 @@ #include #include #include +#include #include #include #include @@ -126,7 +127,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 @@ -259,16 +260,6 @@ static long process(psm) return(0); } -static long get_value(psm,pvdes) - struct steppermotorRecord *psm; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_FLOAT; - pvdes->no_elements=1; - (float *)(pvdes->pvalue) = &psm->val; - return(0); -} - static long special(paddr,after) struct dbAddr *paddr; int after; @@ -447,7 +438,6 @@ struct motor_data *psm_data; struct steppermotorRecord *psm; { struct smdset *pdset = (struct smdset *)(psm->dset); - unsigned short stat,sevr,nsta,nsev; int intAccept=interruptAccept; short post_events; double temp; diff --git a/src/rec/stringinRecord.c b/src/rec/stringinRecord.c index 597ec80b9..95ea6b533 100644 --- a/src/rec/stringinRecord.c +++ b/src/rec/stringinRecord.c @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -63,7 +64,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 @@ -169,18 +170,6 @@ static long process(pstringin) pstringin->pact=FALSE; return(status); } - - -static long get_value(pstringin,pvdes) - struct stringinRecord *pstringin; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_STRING; - pvdes->no_elements=1; - pvdes->pvalue = (void *)(&pstringin->val[0]); - return(0); -} - static void monitor(pstringin) struct stringinRecord *pstringin; diff --git a/src/rec/stringoutRecord.c b/src/rec/stringoutRecord.c index b5f12b339..9e41f1abf 100644 --- a/src/rec/stringoutRecord.c +++ b/src/rec/stringoutRecord.c @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -69,7 +70,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 @@ -202,17 +203,6 @@ finish: pstringout->pact=FALSE; return(status); } - -static long get_value(pstringout,pvdes) - struct stringoutRecord *pstringout; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_STRING; - pvdes->no_elements=1; - pvdes->pvalue = (void *)(&pstringout->val[0]); - return(0); -} - static void monitor(pstringout) struct stringoutRecord *pstringout; diff --git a/src/rec/subArrayRecord.c b/src/rec/subArrayRecord.c index cc20a633d..e911932c0 100644 --- a/src/rec/subArrayRecord.c +++ b/src/rec/subArrayRecord.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -298,7 +299,6 @@ static void monitor(psa) struct subArrayRecord *psa; { unsigned short monitor_mask; - short stat,sevr,nsta,nsev; /* get previous stat and sevr and new stat and sevr*/ monitor_mask = recGblResetAlarms(psa); diff --git a/src/rec/subRecord.c b/src/rec/subRecord.c index 3b02240fa..6a8c81096 100644 --- a/src/rec/subRecord.c +++ b/src/rec/subRecord.c @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -72,7 +73,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 @@ -111,10 +112,6 @@ static long fetch_values(); static void monitor(); #define ARG_MAX 12 - /* Fldnames should have as many as ARG_MAX */ - static char *Fldnames[ARG_MAX] = - {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"}; - static long init_record(psub,pass) struct subRecord *psub; @@ -199,16 +196,6 @@ static long process(psub) return(0); } -static long get_value(psub,pvdes) - struct subRecord *psub; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_DOUBLE; - pvdes->no_elements=1; - (double *)(pvdes->pvalue) = &psub->val; - return(0); -} - static long get_units(paddr,units) struct dbAddr *paddr; char *units; diff --git a/src/rec/timerRecord.c b/src/rec/timerRecord.c index 2b2db65b8..e8ee0d1be 100644 --- a/src/rec/timerRecord.c +++ b/src/rec/timerRecord.c @@ -62,6 +62,7 @@ #include #include #include +#include #include #include #include @@ -77,7 +78,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 @@ -135,8 +136,6 @@ static long init_record(ptimer, pass) struct timerRecord *ptimer; int pass; { - long status; -/* Added for Channel Access Links */ if (pass==0) return(0); @@ -169,16 +168,6 @@ static long process(ptimer) ptimer->pact=FALSE; return status; } - -static long get_value(ptimer,pvdes) - struct timerRecord *ptimer; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_SHORT; - pvdes->no_elements=1; - (short *)(pvdes->pvalue) = &ptimer->val; - return(0); -} static void monitor(ptimer) struct timerRecord *ptimer; @@ -255,7 +244,6 @@ struct timerRecord *ptimer; static long read_timer(struct timerRecord *ptimer) { struct tmdset *pdset; - double constant; /* initiate the write */ if (ptimer->out.type != VME_IO) { diff --git a/src/rec/waitRecord.c b/src/rec/waitRecord.c index e894ceda6..68c4d2496 100644 --- a/src/rec/waitRecord.c +++ b/src/rec/waitRecord.c @@ -75,10 +75,12 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -103,7 +105,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 @@ -214,7 +216,6 @@ struct qStruct { int recWaitDebug=0; int recWaitCacheMode=0; -static unsigned long tickStart; static void schedOutput(struct waitRecord *pwait); static void execOutput(struct cbStruct *pcbst); static int fetch_values(struct waitRecord *pwait); @@ -223,7 +224,6 @@ static long initSiml(); static void ioIntProcess(CALLBACK *pioProcCb); static void pvSearchCallback(recDynLink *precDynLink); -static void pvMonitorCallback(recDynLink *precDynLink); static void inputChanged(recDynLink *precDynLink); @@ -237,7 +237,6 @@ static long init_record(pwait,pass) char *ppvn[PVN_SIZE]; unsigned short *pPvStat; - unsigned short *piointInc; /* include for IO_INT ? */ recDynLinkPvt *puserPvt; @@ -419,10 +418,8 @@ static long special(paddr,after) int special_type = paddr->special; char *ppvn[PVN_SIZE]; unsigned short *pPvStat; - unsigned short *piointInc; /* include for IO_INT ? */ unsigned short oldStat; int index; - long status; short error_number; char rpbuf[184]; @@ -495,16 +492,6 @@ static long special(paddr,after) return(0); } } - -static long get_value(pwait,pvdes) - struct waitRecord *pwait; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_DOUBLE; - pvdes->no_elements=1; - (double *)(pvdes->pvalue) = &pwait->val; - return(0); -} static long get_precision(paddr,precision) struct dbAddr *paddr; @@ -592,7 +579,6 @@ static void monitor(pwait) static long initSiml(pwait) struct waitRecord *pwait; { - long status; /* wait.siml must be a CONSTANT or a PV_LINK or a DB_LINK */ if (pwait->siml.type == CONSTANT) { @@ -614,7 +600,8 @@ struct waitRecord *pwait; double *pvalue; unsigned short *pPvStat; unsigned short *piointInc; /* include for IO_INT ? */ - long status=0,options=0,nRequest=1; + long status=0; + size_t nRequest=1; int i; piointInc = &pwait->inap; @@ -680,8 +667,7 @@ void execOutput(pcbst) struct cbStruct *pcbst; { long status; -long nRequest = 1; -long options = 0; +size_t nRequest = 1; double oldDold; /* if output link is valid , decide between VAL and DOL */ @@ -732,8 +718,7 @@ static void inputChanged(recDynLink *precDynLink) struct waitRecord *pwait = ((recDynLinkPvt *)precDynLink->puserPvt)->pwait; struct cbStruct *pcbst = (struct cbStruct *)pwait->cbst; double monData; - unsigned long nRequest; - long status; + size_t nRequest; char index; unsigned short *piointInc; @@ -747,7 +732,7 @@ static void inputChanged(recDynLink *precDynLink) /* put input index and monitored data on processing queue */ recDynLinkGet(precDynLink, &monData, &nRequest, 0, 0, 0); if(recWaitDebug>5) - printf("queuing monitor on %d = %lf\n",index,monData); + printf("queuing monitor on %d = %f\n",index,monData); if(rngBufPut(pcbst->monitorQ, (void *)&index, sizeof(char)) != sizeof(char)) errMessage(0,"recWait rngBufPut error"); if(rngBufPut(pcbst->monitorQ, (void *)&monData, sizeof(double)) @@ -783,7 +768,7 @@ static void ioIntProcess(CALLBACK *pioProcCb) != sizeof(double)) errMessage(0, "recWait: rngBufGet error"); if(recWaitDebug>=5) - printf("processing on %d = %lf (%lf)\n", + printf("processing on %d = %f (%f)\n", inputIndex, monData,pwait->val); pInput += inputIndex; /* pointer arithmetic for appropriate input */ diff --git a/src/rec/waveformRecord.c b/src/rec/waveformRecord.c index bffe69630..e6ec15f88 100644 --- a/src/rec/waveformRecord.c +++ b/src/rec/waveformRecord.c @@ -70,6 +70,7 @@ #include #include #include +#include #include #include #include