diff --git a/src/rec/recAi.c b/src/rec/recAi.c index 33e19d296..e764997c8 100644 --- a/src/rec/recAi.c +++ b/src/rec/recAi.c @@ -77,16 +77,17 @@ long init_record(); long process(); long special(); -long get_precision(); long get_value(); #define cvt_dbaddr NULL #define get_array_info NULL #define put_array_info NULL -#define get_enum_str NULL long get_units(); +long get_precision(); +#define get_enum_str NULL +#define get_enum_strs NULL long get_graphic_double(); long get_control_double(); -#define get_enum_strs NULL +long get_alarm_double(); struct rset aiRSET={ RSETNUMBER, @@ -95,16 +96,17 @@ struct rset aiRSET={ init_record, process, special, - get_precision, get_value, cvt_dbaddr, get_array_info, put_array_info, - get_enum_str, get_units, + get_precision, + get_enum_str, + get_enum_strs, get_graphic_double, get_control_double, - get_enum_strs }; + get_alarm_double}; struct aidset { /* analog input dset */ long number; @@ -118,8 +120,8 @@ struct aidset { /* analog input dset */ DEVSUPFUN special_linconv; }; -void convert(); void alarm(); +void convert(); void monitor(); static long init_record(pai) @@ -212,16 +214,6 @@ static long special(paddr,after) } } -static long get_precision(paddr,precision) - struct dbAddr *paddr; - long *precision; -{ - struct aiRecord *pai=(struct aiRecord *)paddr->precord; - - *precision = pai->prec; - return(0); -} - static long get_value(pai,pvdes) struct aiRecord *pai; struct valueDes *pvdes; @@ -242,6 +234,16 @@ static long get_units(paddr,units) return(0); } +static long get_precision(paddr,precision) + struct dbAddr *paddr; + long *precision; +{ + struct aiRecord *pai=(struct aiRecord *)paddr->precord; + + *precision = pai->prec; + return(0); +} + static long get_graphic_double(paddr,pgd) struct dbAddr *paddr; struct dbr_grDouble *pgd; @@ -250,10 +252,6 @@ static long get_graphic_double(paddr,pgd) pgd->upper_disp_limit = pai->hopr; pgd->lower_disp_limit = pai->lopr; - pgd->upper_alarm_limit = pai->hihi; - pgd->upper_warning_limit = pai->high; - pgd->lower_warning_limit = pai->low; - pgd->lower_alarm_limit = pai->lolo; return(0); } @@ -267,21 +265,35 @@ static long get_control_double(paddr,pcd) pcd->lower_ctrl_limit = pai->lopr; return(0); } + +static long get_alarm_double(paddr,pad) + struct dbAddr *paddr; + struct dbr_alDouble *pad; +{ + struct aiRecord *pai=(struct aiRecord *)paddr->precord; + + pad->upper_alarm_limit = pai->hihi; + pad->upper_warning_limit = pai->high; + pad->lower_warning_limit = pai->low; + pad->lower_alarm_limit = pai->lolo; + return(0); +} static void alarm(pai) struct aiRecord *pai; { float ftemp; + float val=pai->val; - /* if difference is not > hysterisis don't bother */ + /* if difference is not > hysterisis use lalm not val */ ftemp = pai->lalm - pai->val; if(ftemp<0.0) ftemp = -ftemp; - if (ftemp < pai->hyst) return; + if (ftemp < pai->hyst) val=pai->lalm; /* alarm condition hihi */ if (pai->nsevhhsv){ - if (pai->val > pai->hihi){ - pai->lalm = pai->val; + if (val > pai->hihi){ + pai->lalm = val; pai->nsta = HIHI_ALARM; pai->nsev = pai->hhsv; return; @@ -290,8 +302,8 @@ static void alarm(pai) /* alarm condition lolo */ if (pai->nsevllsv){ - if (pai->val < pai->lolo){ - pai->lalm = pai->val; + if (val < pai->lolo){ + pai->lalm = val; pai->nsta = LOLO_ALARM; pai->nsev = pai->llsv; return; @@ -300,8 +312,8 @@ static void alarm(pai) /* alarm condition high */ if (pai->nsevhsv){ - if (pai->val > pai->high){ - pai->lalm = pai->val; + if (val > pai->high){ + pai->lalm = val; pai->nsta = HIGH_ALARM; pai->nsev =pai->hsv; return; @@ -310,8 +322,8 @@ static void alarm(pai) /* alarm condition lolo */ if (pai->nsevlsv){ - if (pai->val < pai->low){ - pai->lalm = pai->val; + if (val < pai->low){ + pai->lalm = val; pai->nsta = LOW_ALARM; pai->nsev = pai->lsv; return; @@ -320,69 +332,6 @@ static void alarm(pai) return; } -static void monitor(pai) - struct aiRecord *pai; -{ - unsigned short monitor_mask; - float delta; - short stat,sevr,nsta,nsev; - - /* get previous stat and sevr and new stat and sevr*/ - stat=pai->stat; - sevr=pai->sevr; - nsta=pai->nsta; - nsev=pai->nsev; - /*set current stat and sevr*/ - pai->stat = nsta; - pai->sevr = nsev; - pai->nsta = 0; - pai->nsev = 0; - - /* anyone waiting for an event on this record */ - if (pai->mlis.count == 0) return; - - /* Flags which events to fire on the value field */ - monitor_mask = 0; - - /* alarm condition changed this scan */ - if (stat!=nsta || sevr!=nsev) { - /* post events for alarm condition change*/ - monitor_mask = DBE_ALARM; - /* post stat and nsev fields */ - db_post_events(pai,&pai->stat,DBE_VALUE); - db_post_events(pai,&pai->sevr,DBE_VALUE); - } - /* check for value change */ - delta = pai->mlst - pai->val; - if(delta<0.0) delta = -delta; - if (delta > pai->mdel) { - /* post events for value change */ - monitor_mask |= DBE_VALUE; - /* update last value monitored */ - pai->mlst = pai->val; - } - - /* check for archive change */ - delta = pai->alst - pai->val; - if(delta<0.0) delta = 0.0; - if (delta > pai->adel) { - /* post events on value field for archive change */ - monitor_mask |= DBE_LOG; - /* update last archive value monitored */ - pai->alst = pai->val; - } - - /* send out monitors connected to the value field */ - if (monitor_mask){ - db_post_events(pai,&pai->val,monitor_mask); - if(pai->oraw != pai->rval) { - db_post_events(pai,&pai->rval,monitor_mask); - pai->oraw = pai->rval; - } - } - return; -} - static void convert(pai) struct aiRecord *pai; { @@ -454,3 +403,66 @@ struct aiRecord *pai; } return; } + +static void monitor(pai) + struct aiRecord *pai; +{ + unsigned short monitor_mask; + float delta; + short stat,sevr,nsta,nsev; + + /* get previous stat and sevr and new stat and sevr*/ + stat=pai->stat; + sevr=pai->sevr; + nsta=pai->nsta; + nsev=pai->nsev; + /*set current stat and sevr*/ + pai->stat = nsta; + pai->sevr = nsev; + pai->nsta = 0; + pai->nsev = 0; + + /* anyone waiting for an event on this record */ + if (pai->mlis.count == 0) return; + + /* Flags which events to fire on the value field */ + monitor_mask = 0; + + /* alarm condition changed this scan */ + if (stat!=nsta || sevr!=nsev) { + /* post events for alarm condition change*/ + monitor_mask = DBE_ALARM; + /* post stat and nsev fields */ + db_post_events(pai,&pai->stat,DBE_VALUE); + db_post_events(pai,&pai->sevr,DBE_VALUE); + } + /* check for value change */ + delta = pai->mlst - pai->val; + if(delta<0.0) delta = -delta; + if (delta > pai->mdel) { + /* post events for value change */ + monitor_mask |= DBE_VALUE; + /* update last value monitored */ + pai->mlst = pai->val; + } + + /* check for archive change */ + delta = pai->alst - pai->val; + if(delta<0.0) delta = 0.0; + if (delta > pai->adel) { + /* post events on value field for archive change */ + monitor_mask |= DBE_LOG; + /* update last archive value monitored */ + pai->alst = pai->val; + } + + /* send out monitors connected to the value field */ + if (monitor_mask){ + db_post_events(pai,&pai->val,monitor_mask); + if(pai->oraw != pai->rval) { + db_post_events(pai,&pai->rval,monitor_mask); + pai->oraw = pai->rval; + } + } + return; +} diff --git a/src/rec/recAo.c b/src/rec/recAo.c index a16681563..6efea5b33 100644 --- a/src/rec/recAo.c +++ b/src/rec/recAo.c @@ -72,16 +72,17 @@ long init_record(); long process(); long special(); -long get_precision(); long get_value(); #define cvt_dbaddr NULL #define get_array_info NULL #define put_array_info NULL -#define get_enum_str NULL long get_units(); +long get_precision(); +#define get_enum_str NULL +#define get_enum_strs NULL long get_graphic_double(); long get_control_double(); -#define get_enum_strs NULL +long get_alarm_double(); struct rset aoRSET={ RSETNUMBER, @@ -90,16 +91,17 @@ struct rset aoRSET={ init_record, process, special, - get_precision, get_value, cvt_dbaddr, get_array_info, put_array_info, - get_enum_str, get_units, + get_precision, + get_enum_str, + get_enum_strs, get_graphic_double, get_control_double, - get_enum_strs }; + get_alarm_double }; struct aodset { /* analog input dset */ long number; @@ -169,10 +171,9 @@ static long process(paddr) } if(pao->pact == FALSE) { convert(pao); - if(pao->oraw != pao->oval) status=(*pdset->write_ao)(pao); - else status=0; + status=(*pdset->write_ao)(pao); } else { - status=(*pdset->write_ao)(pao); /* write the new value */ + status=(*pdset->write_ao)(pao); pao->pact = TRUE; } @@ -214,16 +215,6 @@ static long special(paddr,after) } } -static long get_precision(paddr,precision) - struct dbAddr *paddr; - long *precision; -{ - struct aoRecord *pao=(struct aoRecord *)paddr->precord; - - *precision = pao->prec; - return(0); -} - static long get_value(pao,pvdes) struct aoRecord *pao; struct valueDes *pvdes; @@ -244,6 +235,16 @@ static long get_units(paddr,units) return(0); } +static long get_precision(paddr,precision) + struct dbAddr *paddr; + long *precision; +{ + struct aoRecord *pao=(struct aoRecord *)paddr->precord; + + *precision = pao->prec; + return(0); +} + static long get_graphic_double(paddr,pgd) struct dbAddr *paddr; struct dbr_grDouble *pgd; @@ -252,10 +253,6 @@ static long get_graphic_double(paddr,pgd) pgd->upper_disp_limit = pao->hopr; pgd->lower_disp_limit = pao->lopr; - pgd->upper_alarm_limit = pao->hihi; - pgd->upper_warning_limit = pao->high; - pgd->lower_warning_limit = pao->low; - pgd->lower_alarm_limit = pao->lolo; return(0); } @@ -269,21 +266,35 @@ static long get_control_double(paddr,pcd) pcd->lower_ctrl_limit = pao->lopr; return(0); } +static long get_alarm_double(paddr,pad) + struct dbAddr *paddr; + struct dbr_alDouble *pad; +{ + struct aoRecord *pao=(struct aoRecord *)paddr->precord; + + pad->upper_alarm_limit = pao->hihi; + pad->upper_warning_limit = pao->high; + pad->lower_warning_limit = pao->low; + pad->lower_alarm_limit = pao->lolo; + return(0); +} + static void alarm(pao) struct aoRecord *pao; { float ftemp; + float val=pao->val; - /* if difference is not > hysterisis don't bother */ + /* if difference is not > hysterisis use lalm not val */ ftemp = pao->lalm - pao->val; if(ftemp<0.0) ftemp = -ftemp; - if (ftemp < pao->hyst) return; + if (ftemp < pao->hyst) val=pao->lalm; /* alarm condition hihi */ if (pao->nsevhhsv){ - if (pao->val > pao->hihi){ - pao->lalm = pao->val; + if (val > pao->hihi){ + pao->lalm = val; pao->nsta = HIHI_ALARM; pao->nsev = pao->hhsv; return; @@ -292,8 +303,8 @@ static void alarm(pao) /* alarm condition lolo */ if (pao->nsevllsv){ - if (pao->val < pao->lolo){ - pao->lalm = pao->val; + if (val < pao->lolo){ + pao->lalm = val; pao->nsta = LOLO_ALARM; pao->nsev = pao->llsv; return; @@ -302,8 +313,8 @@ static void alarm(pao) /* alarm condition high */ if (pao->nsevhsv){ - if (pao->val > pao->high){ - pao->lalm = pao->val; + if (val > pao->high){ + pao->lalm = val; pao->nsta = HIGH_ALARM; pao->nsev =pao->hsv; return; @@ -312,8 +323,8 @@ static void alarm(pao) /* alarm condition lolo */ if (pao->nsevlsv){ - if (pao->val < pao->low){ - pao->lalm = pao->val; + if (val < pao->low){ + pao->lalm = val; pao->nsta = LOW_ALARM; pao->nsev = pao->lsv; return; @@ -321,6 +332,65 @@ static void alarm(pao) } return; } + + +static void convert(pao) + struct aoRecord *pao; +{ + float value; + + /* fetch the desired output if there is a database link */ + if ((pao->dol.type == DB_LINK) && (pao->omsl == CLOSED_LOOP)){ + long nRequest; + long options; + short save_pact; + long status; + + options=0; + nRequest=1; + save_pact = pao->pact; + pao->pact = TRUE; + status = dbGetLink(&pao->dol.value,DBR_FLOAT,&value,&options,&nRequest); + pao->pact = save_pact; + if(status) { + if(pao->nsevnsta = LINK_ALARM; + pao->nsev=VALID_ALARM; + } + return; + } + if (pao->oif == OUTPUT_INCREMENTAL) value += pao->val; + } else value = pao->val; + + /* check drive limits */ + if(pao->drvh > pao->drvl) { + if (value > pao->drvh) value = pao->drvh; + else if (value < pao->drvl) value = pao->drvl; + } + pao->val = value; + + /* now set value equal to desired output value */ + /* apply the output rate of change */ + if (pao->oroc){ + float diff; + + diff = value - pao->oval; + if (diff < 0){ + if (pao->oroc < -diff) value = pao->oval - pao->oroc; + }else if (pao->oroc < diff) value = pao->oval + pao->oroc; + } + pao->oval = value; + + + /* convert */ + if (pao->linr == LINEAR){ + if (pao->eslo == 0) pao->rval = 0; + else pao->rval = (value - pao->egul) / pao->eslo; + }else{ + pao->rval = value; + } +} + static void monitor(pao) struct aoRecord *pao; @@ -391,61 +461,3 @@ static void monitor(pao) } return; } - -static void convert(pao) -struct aoRecord *pao; -{ - float value; - - /* fetch the desired output if there is a database link */ - if ((pao->dol.type == DB_LINK) && (pao->omsl == CLOSED_LOOP)){ - long nRequest; - long options; - short save_pact; - long status; - - options=0; - nRequest=1; - save_pact = pao->pact; - pao->pact = TRUE; - status = dbGetLink(&pao->dol.value,DBR_FLOAT,&value,&options,&nRequest); - pao->pact = save_pact; - if(status) { - if(pao->nsevnsta = LINK_ALARM; - pao->nsev=VALID_ALARM; - } - return; - } - if (pao->oif == OUTPUT_INCREMENTAL) value += pao->val; - } else value = pao->val; - - /* check drive limits */ - if(pao->drvh > pao->drvl) { - if (value > pao->drvh) value = pao->drvh; - else if (value < pao->drvl) value = pao->drvl; - } - pao->val = value; - - /* now set value equal to desired output value */ - /* apply the output rate of change */ - if (pao->oroc){ - float diff; - - diff = value - pao->oval; - if (diff < 0){ - if (pao->oroc < -diff) value = pao->oval - pao->oroc; - }else if (pao->oroc < diff) value = pao->oval + pao->oroc; - } - pao->oval = value; - - - /* convert */ - if (pao->linr == LINEAR){ - if (pao->eslo == 0) pao->rval = 0; - else pao->rval = (value - pao->egul) / pao->eslo; - }else{ - pao->rval = value; - } -} - diff --git a/src/rec/recBi.c b/src/rec/recBi.c index 02788bdd3..0022aa702 100644 --- a/src/rec/recBi.c +++ b/src/rec/recBi.c @@ -65,16 +65,17 @@ long init_record(); long process(); #define special NULL -#define get_precision NULL long get_value(); #define cvt_dbaddr NULL #define get_array_info NULL #define put_array_info NULL -long get_enum_str(); #define get_units NULL +#define get_precision NULL +long get_enum_str(); +long get_enum_strs(); #define get_graphic_double NULL #define get_control_double NULL -long get_enum_strs(); +#define get_alarm_double NULL struct rset biRSET={ RSETNUMBER, report, @@ -82,16 +83,17 @@ struct rset biRSET={ init_record, process, special, - get_precision, get_value, cvt_dbaddr, get_array_info, put_array_info, - get_enum_str, get_units, + get_precision, + get_enum_str, + get_enum_strs, get_graphic_double, get_control_double, - get_enum_strs }; + get_alarm_double }; struct bidset { /* binary input dset */ long number; DEVSUPFUN dev_report; @@ -122,7 +124,6 @@ static long init_record(pbi) if((status=(*pdset->init_record)(pbi,process))) return(status); } pbi->mlst = -1; - pbi->lalm = -1; return(0); } @@ -201,10 +202,6 @@ static void alarm(pbi) struct biRecord *pbi; { - if (pbi->val == pbi->lalm) return; - - /* set last alarmed value */ - pbi->lalm = pbi->val; /* check for state alarm */ if (pbi->val == 0){ diff --git a/src/rec/recBo.c b/src/rec/recBo.c index b52643b19..2e357b57c 100644 --- a/src/rec/recBo.c +++ b/src/rec/recBo.c @@ -75,16 +75,17 @@ long init_record(); long process(); #define special NULL -#define get_precision NULL long get_value(); #define cvt_dbaddr NULL #define get_array_info NULL #define put_array_info NULL -long get_enum_str(); #define get_units NULL +#define get_precision NULL +long get_enum_str(); +long get_enum_strs(); #define get_graphic_double NULL #define get_control_double NULL -long get_enum_strs(); +#define get_alarm_double NULL struct rset boRSET={ RSETNUMBER, @@ -93,16 +94,17 @@ struct rset boRSET={ init_record, process, special, - get_precision, get_value, cvt_dbaddr, get_array_info, put_array_info, - get_enum_str, get_units, + get_precision, + get_enum_str, + get_enum_strs, get_graphic_double, get_control_double, - get_enum_strs }; + get_alarm_double }; struct bodset { /* binary output dset */ long number; @@ -167,10 +169,9 @@ static long init_record(pbo) pbo->dpvt = (caddr_t)pcallback; pcallback->callback = myCallback; if(dbNameToAddr(pbo->name,&(pcallback->dbAddr))) { - logMsg("dbNameToAddr failed in init_record for devAiTestAsyn\n"); + logMsg("dbNameToAddr failed in init_record for recBo\n"); exit(1); } - pbo->lalm = -1; pbo->mlst = -1; return(0); } @@ -202,22 +203,21 @@ static long process(paddr) pbo->pact = savepact; } - if(pbo->lalm != pbo->val) {/*we have a change */ - status=(*pdset->write_bo)(pbo); /* write the new value */ - pbo->pact = TRUE; + status=(*pdset->write_bo)(pbo); /* write the new value */ + pbo->pact = TRUE; - /* status is one if an asynchronous record is being processed*/ - if(status==1) return(0); + /* status is one if an asynchronous record is being processed*/ + if(status==1) return(0); - wait_time = (int)(pbo->high) * vxTicksPerSecond; /* seconds to ticks */ - if(pbo->val==1 && wait_time>0) { - struct callback *pcallback; + wait_time = (int)(pbo->high) * vxTicksPerSecond; /* seconds to ticks */ + if(pbo->val==1 && wait_time>0) { + struct callback *pcallback; + + pcallback = (struct callback *)(pbo->dpvt); + if(pcallback->wd_id==NULL) pcallback->wd_id = wdCreate(); + wdStart(pcallback->wd_id,wait_time,callbackRequest,pcallback); + } - pcallback = (struct callback *)(pbo->dpvt); - if(pcallback->wd_id==NULL) pcallback->wd_id = wdCreate(); - wdStart(pcallback->wd_id,wait_time,callbackRequest,pcallback); - } - } else pbo->pact = TRUE; /* check for alarms */ alarm(pbo); @@ -275,10 +275,6 @@ static void alarm(pbo) struct boRecord *pbo; { - if (pbo->val == pbo->lalm) return; - - /* set last alarmed value */ - pbo->lalm = pbo->val; /* check for state alarm */ if (pbo->val == 0){ diff --git a/src/rec/recCalc.c b/src/rec/recCalc.c index ef7eda6eb..7c1da80e3 100644 --- a/src/rec/recCalc.c +++ b/src/rec/recCalc.c @@ -79,16 +79,17 @@ long init_record(); long process(); long special(); -long get_precision(); long get_value(); #define cvt_dbaddr NULL #define get_array_info NULL #define put_array_info NULL -#define get_enum_str NULL long get_units(); +long get_precision(); +#define get_enum_str NULL +#define get_enum_strs NULL long get_graphic_double(); long get_control_double(); -#define get_enum_strs NULL +long get_alarm_double(); struct rset calcRSET={ RSETNUMBER, @@ -97,16 +98,17 @@ struct rset calcRSET={ init_record, process, special, - get_precision, get_value, cvt_dbaddr, get_array_info, put_array_info, - get_enum_str, get_units, + get_precision, + get_enum_str, + get_enum_strs, get_graphic_double, get_control_double, - get_enum_strs }; + get_alarm_double }; void alarm(); void monitor(); @@ -138,85 +140,6 @@ static long init_record(pcalc) return(0); } -static long special(paddr,after) - struct dbAddr *paddr; - int after; -{ - long status; - struct calcRecord *pcalc = (struct calcRecord *)(paddr->precord); - int special_type = paddr->special; - short error_number; - char rpbuf[80]; - - if(!after) return(0); - switch(special_type) { - case(SPC_CALC): - status=postfix(pcalc->calc,rpbuf,&error_number); - if(status) return(status); - bcopy(rpbuf,pcalc->rpcl,sizeof(pcalc->rpcl)); - return(0); - default: - recGblDbaddrError(S_db_badChoice,paddr,"calc: special"); - return(S_db_badChoice); - } -} - -static long get_precision(paddr,precision) - struct dbAddr *paddr; - long *precision; -{ - struct calcRecord *pcalc=(struct calcRecord *)paddr->precord; - - *precision = pcalc->prec; - return(0); -} - -static long get_value(pcalc,pvdes) - struct calcRecord *pcalc; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_FLOAT; - pvdes->no_elements=1; - (float *)(pvdes->pvalue) = &pcalc->val; - return(0); -} - -static long get_units(paddr,units) - struct dbAddr *paddr; - char *units; -{ - struct calcRecord *pcalc=(struct calcRecord *)paddr->precord; - - strncpy(units,pcalc->egu,sizeof(pcalc->egu)); - return(0); -} - -static long get_graphic_double(paddr,pgd) - struct dbAddr *paddr; - struct dbr_grDouble *pgd; -{ - struct calcRecord *pcalc=(struct calcRecord *)paddr->precord; - - pgd->upper_disp_limit = pcalc->hopr; - pgd->lower_disp_limit = pcalc->lopr; - pgd->upper_alarm_limit = pcalc->hihi; - pgd->upper_warning_limit = pcalc->high; - pgd->lower_warning_limit = pcalc->low; - pgd->lower_alarm_limit = pcalc->lolo; - return(0); -} - -static long get_control_double(paddr,pcd) - struct dbAddr *paddr; - struct dbr_ctrlDouble *pcd; -{ - struct calcRecord *pcalc=(struct calcRecord *)paddr->precord; - - pcd->upper_ctrl_limit = pcalc->hopr; - pcd->lower_ctrl_limit = pcalc->lopr; - return(0); -} - static long process(paddr) struct dbAddr *paddr; { @@ -239,21 +162,110 @@ static long process(paddr) pcalc->pact = FALSE; return(0); } + +static long special(paddr,after) + struct dbAddr *paddr; + int after; +{ + long status; + struct calcRecord *pcalc = (struct calcRecord *)(paddr->precord); + int special_type = paddr->special; + short error_number; + char rpbuf[80]; + + if(!after) return(0); + switch(special_type) { + case(SPC_CALC): + status=postfix(pcalc->calc,rpbuf,&error_number); + if(status) return(status); + bcopy(rpbuf,pcalc->rpcl,sizeof(pcalc->rpcl)); + return(0); + default: + recGblDbaddrError(S_db_badChoice,paddr,"calc: special"); + return(S_db_badChoice); + } +} + +static long get_value(pcalc,pvdes) + struct calcRecord *pcalc; + struct valueDes *pvdes; +{ + pvdes->field_type = DBF_FLOAT; + pvdes->no_elements=1; + (float *)(pvdes->pvalue) = &pcalc->val; + return(0); +} + +static long get_units(paddr,units) + struct dbAddr *paddr; + char *units; +{ + struct calcRecord *pcalc=(struct calcRecord *)paddr->precord; + + strncpy(units,pcalc->egu,sizeof(pcalc->egu)); + return(0); +} + +static long get_precision(paddr,precision) + struct dbAddr *paddr; + long *precision; +{ + struct calcRecord *pcalc=(struct calcRecord *)paddr->precord; + + *precision = pcalc->prec; + return(0); +} + +static long get_graphic_double(paddr,pgd) + struct dbAddr *paddr; + struct dbr_grDouble *pgd; +{ + struct calcRecord *pcalc=(struct calcRecord *)paddr->precord; + + pgd->upper_disp_limit = pcalc->hopr; + pgd->lower_disp_limit = pcalc->lopr; + return(0); +} + +static long get_control_double(paddr,pcd) + struct dbAddr *paddr; + struct dbr_ctrlDouble *pcd; +{ + struct calcRecord *pcalc=(struct calcRecord *)paddr->precord; + + pcd->upper_ctrl_limit = pcalc->hopr; + pcd->lower_ctrl_limit = pcalc->lopr; + return(0); +} +static long get_alarm_double(paddr,pad) + struct dbAddr *paddr; + struct dbr_alDouble *pad; +{ + struct calcRecord *pcalc=(struct calcRecord *)paddr->precord; + + pad->upper_alarm_limit = pcalc->hihi; + pad->upper_warning_limit = pcalc->high; + pad->lower_warning_limit = pcalc->low; + pad->lower_alarm_limit = pcalc->lolo; + return(0); +} + static void alarm(pcalc) struct calcRecord *pcalc; { float ftemp; + float val=pcalc->val; /* if difference is not > hysterisis don't bother */ ftemp = pcalc->lalm - pcalc->val; if(ftemp<0.0) ftemp = -ftemp; - if (ftemp < pcalc->hyst) return; + if (ftemp < pcalc->hyst) val=pcalc->lalm; /* alarm condition hihi */ if (pcalc->nsevhhsv){ - if (pcalc->val > pcalc->hihi){ - pcalc->lalm = pcalc->val; + if (val > pcalc->hihi){ + pcalc->lalm = val; pcalc->nsta = HIHI_ALARM; pcalc->nsev = pcalc->hhsv; return; @@ -262,8 +274,8 @@ static void alarm(pcalc) /* alarm condition lolo */ if (pcalc->nsevllsv){ - if (pcalc->val < pcalc->lolo){ - pcalc->lalm = pcalc->val; + if (val < pcalc->lolo){ + pcalc->lalm = val; pcalc->nsta = LOLO_ALARM; pcalc->nsev = pcalc->llsv; return; @@ -272,8 +284,8 @@ static void alarm(pcalc) /* alarm condition high */ if (pcalc->nsevhsv){ - if (pcalc->val > pcalc->high){ - pcalc->lalm = pcalc->val; + if (val > pcalc->high){ + pcalc->lalm = val; pcalc->nsta = HIGH_ALARM; pcalc->nsev =pcalc->hsv; return; @@ -282,8 +294,8 @@ static void alarm(pcalc) /* alarm condition lolo */ if (pcalc->nsevlsv){ - if (pcalc->val < pcalc->low){ - pcalc->lalm = pcalc->val; + if (val < pcalc->low){ + pcalc->lalm = val; pcalc->nsta = LOW_ALARM; pcalc->nsev = pcalc->lsv; return; diff --git a/src/rec/recCompress.c b/src/rec/recCompress.c index 0ea58e126..f67b7123b 100644 --- a/src/rec/recCompress.c +++ b/src/rec/recCompress.c @@ -71,16 +71,17 @@ long init_record(); long process(); long special(); -long get_precision(); long get_value(); long cvt_dbaddr(); long get_array_info(); long put_array_info(); -#define get_enum_str NULL long get_units(); +long get_precision(); +#define get_enum_str NULL +#define get_enum_strs NULL long get_graphic_double(); long get_control_double(); -#define get_enum_strs NULL +#define get_alarm_double NULL struct rset compressRSET={ RSETNUMBER, @@ -89,16 +90,17 @@ struct rset compressRSET={ init_record, process, special, - get_precision, get_value, cvt_dbaddr, get_array_info, put_array_info, - get_enum_str, get_units, + get_precision, + get_enum_str, + get_enum_strs, get_graphic_double, get_control_double, - get_enum_strs }; + get_alarm_double }; #define NTO1LOW 0 #define NTO1HIGH 1 @@ -138,6 +140,56 @@ static long init_record(pcompress) return(0); } + +static long process(paddr) + struct dbAddr *paddr; +{ + struct compressRecord *pcompress=(struct compressRecord *)(paddr->precord); + long status=0; + + pcompress->pact = TRUE; + + if (pcompress->inp.type != DB_LINK) { + status=0; + }else if (pcompress->wptr == NULL) { + if(pcompress->nsevnsta = READ_ALARM; + pcompress->nsev = MAJOR_ALARM; + } + status=0; + } else { + struct dbAddr *pdbAddr = + (struct dbAddr *)(pcompress->inp.value.db_link.pdbAddr); + long options=0; + long no_elements=pdbAddr->no_elements; + int alg=pcompress->alg; + + (void)dbGetLink(&pcompress->inp.value.db_link,pcompress,DBR_FLOAT,pcompress->wptr, + &options,&no_elements); + if(alg==AVERAGE) { + status = array_average(pcompress,pcompress->wptr,no_elements); + } else if(alg==CIRBUF) { + (void)put_value(pcompress,pcompress->wptr,no_elements); + status = 0; + } else if(pdbAddr->no_elements>1) { + status = compress_array(pcompress,pcompress->wptr,no_elements); + }else if(no_elements==1){ + status = compress_value(pcompress,pcompress->wptr); + }else status=1; + } + + /* check event list */ + if(status!=1) { + monitor(pcompress); + /* process the forward scan link record */ + if (pcompress->flnk.type==DB_LINK) dbScanPassive(pcompress->flnk.value.db_link.pdbAddr); + } + + pcompress->pact=FALSE; + return(0); +} + + static long special(paddr,after) struct dbAddr *paddr; int after; @@ -160,16 +212,6 @@ static long special(paddr,after) } } -static long get_precision(paddr,precision) - struct dbAddr *paddr; - long *precision; -{ - struct compressRecord *pcompress=(struct compressRecord *)paddr->precord; - - *precision = pcompress->prec; - return(0); -} - static long get_value(pcompress,pvdes) struct compressRecord *pcompress; struct valueDes *pvdes; @@ -230,6 +272,16 @@ static long get_units(paddr,units) return(0); } +static long get_precision(paddr,precision) + struct dbAddr *paddr; + long *precision; +{ + struct compressRecord *pcompress=(struct compressRecord *)paddr->precord; + + *precision = pcompress->prec; + return(0); +} + static long get_graphic_double(paddr,pgd) struct dbAddr *paddr; struct dbr_grDouble *pgd; @@ -238,12 +290,9 @@ static long get_graphic_double(paddr,pgd) pgd->upper_disp_limit = pcompress->hopr; pgd->lower_disp_limit = pcompress->lopr; - pgd->upper_alarm_limit = 0.0; - pgd->upper_warning_limit = 0.0; - pgd->lower_warning_limit = 0.0; - pgd->lower_alarm_limit = 0.0; return(0); } + static long get_control_double(paddr,pcd) struct dbAddr *paddr; struct dbr_ctrlDouble *pcd; @@ -254,54 +303,7 @@ static long get_control_double(paddr,pcd) pcd->lower_ctrl_limit = pcompress->lopr; return(0); } - -static long process(paddr) - struct dbAddr *paddr; -{ - struct compressRecord *pcompress=(struct compressRecord *)(paddr->precord); - long status; - pcompress->pact = TRUE; - - if (pcompress->inp.type != DB_LINK) { - status=0; - }else if (pcompress->wptr == NULL) { - if(pcompress->nsevnsta = READ_ALARM; - pcompress->nsev = MAJOR_ALARM; - } - status=0; - } else { - struct dbAddr *pdbAddr = - (struct dbAddr *)(pcompress->inp.value.db_link.pdbAddr); - long options=0; - long no_elements=pdbAddr->no_elements; - int alg=pcompress->alg; - - (void)dbGetLink(&pcompress->inp.value.db_link,pcompress,DBR_FLOAT,pcompress->wptr, - &options,&no_elements); - if(alg==AVERAGE) { - status = array_average(pcompress,pcompress->wptr,no_elements); - } else if(alg==CIRBUF) { - (void)put_value(pcompress,pcompress->wptr,no_elements); - status = 0; - } else if(pdbAddr->no_elements>1) { - status = compress_array(pcompress,pcompress->wptr,no_elements); - }else if(no_elements==1){ - status = compress_value(pcompress,pcompress->wptr); - }else status=1; - } - - /* check event list */ - if(status!=1) { - monitor(pcompress); - /* process the forward scan link record */ - if (pcompress->flnk.type==DB_LINK) dbScanPassive(pcompress->flnk.value.db_link.pdbAddr); - } - - pcompress->pact=FALSE; - return(0); -} static void monitor(pcompress) struct compressRecord *pcompress; diff --git a/src/rec/recFanout.c b/src/rec/recFanout.c index b3e1cb140..de0cf9a91 100644 --- a/src/rec/recFanout.c +++ b/src/rec/recFanout.c @@ -57,16 +57,17 @@ #define init_record NULL long process(); #define special NULL -#define get_precision NULL #define get_value NULL #define cvt_dbaddr NULL #define get_array_info NULL #define put_array_info NULL -#define get_enum_str NULL #define get_units NULL +#define get_precision NULL +#define get_enum_str NULL +#define get_enum_strs NULL #define get_graphic_double NULL #define get_control_double NULL -#define get_enum_strs NULL +#define get_alarm_double NULL struct rset fanoutRSET={ RSETNUMBER, @@ -75,16 +76,17 @@ struct rset fanoutRSET={ init_record, process, special, - get_precision, get_value, cvt_dbaddr, get_array_info, put_array_info, - get_enum_str, get_units, + get_precision, + get_enum_str, + get_enum_strs, get_graphic_double, get_control_double, - get_enum_strs }; + get_alarm_double }; static long process(paddr) struct dbAddr *paddr; diff --git a/src/rec/recMbbi.c b/src/rec/recMbbi.c index c1d1f201a..d4b331884 100644 --- a/src/rec/recMbbi.c +++ b/src/rec/recMbbi.c @@ -68,16 +68,18 @@ long init_record(); long process(); long special(); -#define get_precision NULL long get_value(); #define cvt_dbaddr NULL #define get_array_info NULL #define put_array_info NULL -long get_enum_str(); #define get_units NULL +#define get_precision NULL +long get_enum_str(); +long get_enum_strs(); #define get_graphic_double NULL #define get_control_double NULL -long get_enum_strs(); +#define get_alarm_double NULL + struct rset mbbiRSET={ RSETNUMBER, report, @@ -85,16 +87,18 @@ struct rset mbbiRSET={ init_record, process, special, - get_precision, get_value, cvt_dbaddr, get_array_info, put_array_info, - get_enum_str, get_units, + get_precision, + get_enum_str, + get_enum_strs, get_graphic_double, get_control_double, - get_enum_strs }; + get_alarm_double }; + struct mbbidset { /* multi bit binary input dset */ long number; DEVSUPFUN dev_report; @@ -147,67 +151,6 @@ static long init_record(pmbbi) } return(0); } - -static long special(paddr,after) - struct dbAddr *paddr; - int after; -{ - struct mbbiRecord *pmbbi = (struct mbbiRecord *)(paddr->precord); - int special_type = paddr->special; - - if(!after) return(0); - switch(special_type) { - case(SPC_MOD): - init_common(pmbbi); - return(0); - default: - recGblDbaddrError(S_db_badChoice,paddr,"mbbi: special"); - return(S_db_badChoice); - } -} - -static long get_value(pmbbi,pvdes) - struct mbbiRecord *pmbbi; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_ENUM; - pvdes->no_elements=1; - (unsigned short *)(pvdes->pvalue) = &pmbbi->val; - return(0); -} - -static long get_enum_str(paddr,pstring) - struct dbAddr *paddr; - char *pstring; -{ - struct mbbiRecord *pmbbi=(struct mbbiRecord *)paddr->precord; - char *psource; - unsigned short val=pmbbi->val; - - if(val<= 15) { - psource = (pmbbi->zrst); - psource += (val * sizeof(pmbbi->zrst)); - strncpy(pstring,psource,sizeof(pmbbi->zrst)); - } else { - strcpy(pstring,"Illegal Value"); - } - return(0); -} - -static long get_enum_strs(paddr,pes) - struct dbAddr *paddr; - struct dbr_enumStrs *pes; -{ - struct mbbiRecord *pmbbi=(struct mbbiRecord *)paddr->precord; - char *psource; - int i; - - pes->no_str = 16; - bzero(pes->strs,sizeof(pes->strs)); - for(i=0,psource=(pmbbi->zrst); i<15; i++, psource += sizeof(pmbbi->zrst) ) - strncpy(pes->strs[i],psource,sizeof(pmbbi->zrst)); - return(0); -} static long process(paddr) struct dbAddr *paddr; @@ -260,6 +203,68 @@ static long process(paddr) pmbbi->pact=FALSE; return(status); } + + +static long special(paddr,after) + struct dbAddr *paddr; + int after; +{ + struct mbbiRecord *pmbbi = (struct mbbiRecord *)(paddr->precord); + int special_type = paddr->special; + + if(!after) return(0); + switch(special_type) { + case(SPC_MOD): + init_common(pmbbi); + return(0); + default: + recGblDbaddrError(S_db_badChoice,paddr,"mbbi: special"); + return(S_db_badChoice); + } +} + +static long get_value(pmbbi,pvdes) + struct mbbiRecord *pmbbi; + struct valueDes *pvdes; +{ + pvdes->field_type = DBF_ENUM; + pvdes->no_elements=1; + (unsigned short *)(pvdes->pvalue) = &pmbbi->val; + return(0); +} + +static long get_enum_str(paddr,pstring) + struct dbAddr *paddr; + char *pstring; +{ + struct mbbiRecord *pmbbi=(struct mbbiRecord *)paddr->precord; + char *psource; + unsigned short val=pmbbi->val; + + if(val<= 15) { + psource = (pmbbi->zrst); + psource += (val * sizeof(pmbbi->zrst)); + strncpy(pstring,psource,sizeof(pmbbi->zrst)); + } else { + strcpy(pstring,"Illegal Value"); + } + return(0); +} + +static long get_enum_strs(paddr,pes) + struct dbAddr *paddr; + struct dbr_enumStrs *pes; +{ + struct mbbiRecord *pmbbi=(struct mbbiRecord *)paddr->precord; + char *psource; + int i; + + pes->no_str = 16; + bzero(pes->strs,sizeof(pes->strs)); + for(i=0,psource=(pmbbi->zrst); i<15; i++, psource += sizeof(pmbbi->zrst) ) + strncpy(pes->strs[i],psource,sizeof(pmbbi->zrst)); + return(0); +} static void alarm(pmbbi) struct mbbiRecord *pmbbi; @@ -267,8 +272,6 @@ static void alarm(pmbbi) unsigned short *severities; short val=pmbbi->val; - if(val == pmbbi->lalm) return; - pmbbi->lalm = val; /* check for state alarm */ /* unknown state */ diff --git a/src/rec/recMbbo.c b/src/rec/recMbbo.c index c0dae2b91..6955eac79 100644 --- a/src/rec/recMbbo.c +++ b/src/rec/recMbbo.c @@ -72,16 +72,17 @@ long init_record(); long process(); long special(); -#define get_precision NULL long get_value(); #define cvt_dbaddr NULL #define get_array_info NULL #define put_array_info NULL -long get_enum_str(); #define get_units NULL +#define get_precision NULL +long get_enum_str(); +long get_enum_strs(); #define get_graphic_double NULL #define get_control_double NULL -long get_enum_strs(); +#define get_alarm_double NULL struct rset mbboRSET={ RSETNUMBER, @@ -90,16 +91,17 @@ struct rset mbboRSET={ init_record, process, special, - get_precision, get_value, cvt_dbaddr, get_array_info, put_array_info, - get_enum_str, get_units, + get_precision, + get_enum_str, + get_enum_strs, get_graphic_double, get_control_double, - get_enum_strs }; + get_alarm_double }; struct mbbodset { /* multi bit binary input dset */ long number; @@ -113,6 +115,7 @@ struct mbbodset { /* multi bit binary input dset */ void alarm(); void monitor(); + static void init_common(pmbbo) struct mbboRecord *pmbbo; @@ -142,7 +145,6 @@ static long init_record(pmbbo) init_common(pmbbo); pmbbo->mlst = -1; - pmbbo->lalm = -1; if(!(pdset = (struct mbbodset *)(pmbbo->dset))) { recGblRecordError(S_dev_noDSET,pmbbo,"mbbo: init_record"); @@ -175,6 +177,67 @@ static long init_record(pmbbo) return(0); } +static long process(paddr) + struct dbAddr *paddr; +{ + struct mbboRecord *pmbbo=(struct mbboRecord *)(paddr->precord); + struct mbbodset *pdset = (struct mbbodset *)(pmbbo->dset); + long status; + unsigned long *pstate_values; + short i,rbv; + + if( (pdset==NULL) || (pdset->write_mbbo==NULL) ) { + pmbbo->pact=TRUE; + recGblRecordError(S_dev_missingSup,pmbbo,"write_mbbo"); + return(S_dev_missingSup); + } + + /* fetch the desired output if there is a database link */ + if (!pmbbo->pact && pmbbo->dol.type==DB_LINK && pmbbo->omsl==CLOSED_LOOP){ + long options=0; + long nRequest=1; + short savepact=pmbbo->pact; + + pmbbo->pact = TRUE; + (void)dbGetLink(&pmbbo->dol.value.db_link,pmbbo,DBR_ENUM, + &(pmbbo->val),&options,&nRequest); + pmbbo->pact = savepact; + } + + status=(*pdset->write_mbbo)(pmbbo); /* write the new value */ + pmbbo->pact = TRUE; + + /* status is one if an asynchronous record is being processed*/ + if(status==1) return(0); + + /* convert the value */ + if (pmbbo->sdef){ + pstate_values = &(pmbbo->zrvl); + rbv = -1; /* initalize to unknown state*/ + for (i = 0; i < 16; i++){ + if (*pstate_values == pmbbo->rval){ + rbv = i; + break; + } + pstate_values++; + } + }else{ + /* the raw value is the desired value */ + rbv = (unsigned short)(pmbbo->rval); + } + pmbbo->rbv = rbv; + + /* check for alarms */ + alarm(pmbbo); + /* check event list */ + monitor(pmbbo); + /* process the forward scan link record */ + if (pmbbo->flnk.type==DB_LINK) dbScanPassive(pmbbo->flnk.value.db_link.pdbAddr); + + pmbbo->pact=FALSE; + return(status); +} + static long special(paddr,after) struct dbAddr *paddr; int after; @@ -236,77 +299,12 @@ static long get_enum_strs(paddr,pes) return(0); } -static long process(paddr) - struct dbAddr *paddr; -{ - struct mbboRecord *pmbbo=(struct mbboRecord *)(paddr->precord); - struct mbbodset *pdset = (struct mbbodset *)(pmbbo->dset); - long status; - unsigned long *pstate_values; - short i,rbv; - - if( (pdset==NULL) || (pdset->write_mbbo==NULL) ) { - pmbbo->pact=TRUE; - recGblRecordError(S_dev_missingSup,pmbbo,"write_mbbo"); - return(S_dev_missingSup); - } - - /* fetch the desired output if there is a database link */ - if (!pmbbo->pact && pmbbo->dol.type==DB_LINK && pmbbo->omsl==CLOSED_LOOP){ - long options=0; - long nRequest=1; - short savepact=pmbbo->pact; - - pmbbo->pact = TRUE; - (void)dbGetLink(&pmbbo->dol.value.db_link,pmbbo,DBR_ENUM, - &(pmbbo->val),&options,&nRequest); - pmbbo->pact = savepact; - } - - if(pmbbo->lalm != pmbbo->val) { /*we have a change*/ - status=(*pdset->write_mbbo)(pmbbo); /* write the new value */ - pmbbo->pact = TRUE; - - /* status is one if an asynchronous record is being processed*/ - if(status==1) return(0); - - /* convert the value */ - if (pmbbo->sdef){ - pstate_values = &(pmbbo->zrvl); - rbv = -1; /* initalize to unknown state*/ - for (i = 0; i < 16; i++){ - if (*pstate_values == pmbbo->rval){ - rbv = i; - break; - } - pstate_values++; - } - }else{ - /* the raw value is the desired value */ - rbv = (unsigned short)(pmbbo->rval); - } - pmbbo->rbv = rbv; - } else pmbbo->pact = TRUE; - - /* check for alarms */ - alarm(pmbbo); - /* check event list */ - monitor(pmbbo); - /* process the forward scan link record */ - if (pmbbo->flnk.type==DB_LINK) dbScanPassive(pmbbo->flnk.value.db_link.pdbAddr); - - pmbbo->pact=FALSE; - return(status); -} - static void alarm(pmbbo) struct mbboRecord *pmbbo; { unsigned short *severities; short val=pmbbo->val; - if(val == pmbbo->lalm) return; - pmbbo->lalm = val; /* check for state alarm */ /* unknown state */ diff --git a/src/rec/recPermissive.c b/src/rec/recPermissive.c index a47a66fdd..3fa0cb048 100644 --- a/src/rec/recPermissive.c +++ b/src/rec/recPermissive.c @@ -50,16 +50,17 @@ #define init_record NULL long process(); #define special NULL -#define get_precision NULL long get_value(); #define cvt_dbaddr NULL #define get_array_info NULL #define put_array_info NULL -#define get_enum_str NULL #define get_units NULL +#define get_precision NULL +#define get_enum_str NULL +#define get_enum_strs NULL #define get_graphic_double NULL #define get_control_double NULL -#define get_enum_strs NULL +#define get_alarm_double NULL struct rset permissiveRSET={ RSETNUMBER, @@ -68,27 +69,18 @@ struct rset permissiveRSET={ init_record, process, special, - get_precision, get_value, cvt_dbaddr, get_array_info, put_array_info, - get_enum_str, get_units, + get_precision, + get_enum_str, + get_enum_strs, get_graphic_double, get_control_double, - get_enum_strs }; + get_alarm_double }; -static long get_value(ppermissive,pvdes) - struct permissiveRecord *ppermissive; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_SHORT; - pvdes->no_elements=1; - (short *)(pvdes->pvalue) = &(ppermissive->val); - return(0); -} - static long process(paddr) struct dbAddr *paddr; { @@ -100,3 +92,13 @@ static long process(paddr) ppermissive->pact=FALSE; return(0); } +static long get_value(ppermissive,pvdes) + struct permissiveRecord *ppermissive; + struct valueDes *pvdes; +{ + pvdes->field_type = DBF_SHORT; + pvdes->no_elements=1; + (short *)(pvdes->pvalue) = &(ppermissive->val); + return(0); +} + diff --git a/src/rec/recPid.c b/src/rec/recPid.c index ce6113853..a3c0e688c 100644 --- a/src/rec/recPid.c +++ b/src/rec/recPid.c @@ -53,16 +53,17 @@ unsigned long tickGet(); long init_record(); long process(); #define special NULL -long get_precision(); long get_value(); #define cvt_dbaddr NULL #define get_array_info NULL #define put_array_info NULL -#define get_enum_str NULL long get_units(); +long get_precision(); +#define get_enum_str NULL +#define get_enum_strs NULL long get_graphic_double(); long get_control_double(); -#define get_enum_strs NULL +long get_alarm_double(); struct rset pidRSET={ RSETNUMBER, @@ -71,16 +72,17 @@ struct rset pidRSET={ init_record, process, special, - get_precision, get_value, cvt_dbaddr, get_array_info, put_array_info, get_enum_str, + get_enum_strs, get_units, + get_precision, get_graphic_double, get_control_double, - get_enum_strs }; + get_alarm_double }; void alarm(); @@ -101,62 +103,6 @@ static long init_record(ppid) ppid->val = ppid->stpl.value.value; return(0); } - -static long get_precision(paddr,precision) - struct dbAddr *paddr; - long *precision; -{ - struct pidRecord *ppid=(struct pidRecord *)paddr->precord; - - *precision = ppid->prec; - return(0); -} - -static long get_value(ppid,pvdes) - struct pidRecord *ppid; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_FLOAT; - pvdes->no_elements=1; - (float *)(pvdes->pvalue) = &ppid->val; - return(0); -} - -static long get_units(paddr,units) - struct dbAddr *paddr; - char *units; -{ - struct pidRecord *ppid=(struct pidRecord *)paddr->precord; - - strncpy(units,ppid->egu,sizeof(ppid->egu)); - return(0); -} - -static long get_graphic_double(paddr,pgd) - struct dbAddr *paddr; - struct dbr_grDouble *pgd; -{ - struct pidRecord *ppid=(struct pidRecord *)paddr->precord; - - pgd->upper_disp_limit = ppid->hopr; - pgd->lower_disp_limit = ppid->lopr; - pgd->upper_alarm_limit = ppid->hihi; - pgd->upper_warning_limit = ppid->high; - pgd->lower_warning_limit = ppid->low; - pgd->lower_alarm_limit = ppid->lolo; - return(0); -} - -static long get_control_double(paddr,pcd) - struct dbAddr *paddr; - struct dbr_ctrlDouble *pcd; -{ - struct pidRecord *ppid=(struct pidRecord *)paddr->precord; - - pcd->upper_ctrl_limit = ppid->hopr; - pcd->lower_ctrl_limit = ppid->lopr; - return(0); -} static long process(paddr) struct dbAddr *paddr; @@ -184,21 +130,88 @@ static long process(paddr) ppid->pact=FALSE; return(status); } + +static long get_value(ppid,pvdes) + struct pidRecord *ppid; + struct valueDes *pvdes; +{ + pvdes->field_type = DBF_FLOAT; + pvdes->no_elements=1; + (float *)(pvdes->pvalue) = &ppid->val; + return(0); +} + +static long get_units(paddr,units) + struct dbAddr *paddr; + char *units; +{ + struct pidRecord *ppid=(struct pidRecord *)paddr->precord; + + strncpy(units,ppid->egu,sizeof(ppid->egu)); + return(0); +} + +static long get_precision(paddr,precision) + struct dbAddr *paddr; + long *precision; +{ + struct pidRecord *ppid=(struct pidRecord *)paddr->precord; + + *precision = ppid->prec; + return(0); +} + + +static long get_graphic_double(paddr,pgd) + struct dbAddr *paddr; + struct dbr_grDouble *pgd; +{ + struct pidRecord *ppid=(struct pidRecord *)paddr->precord; + + pgd->upper_disp_limit = ppid->hopr; + pgd->lower_disp_limit = ppid->lopr; + return(0); +} + +static long get_control_double(paddr,pcd) + struct dbAddr *paddr; + struct dbr_ctrlDouble *pcd; +{ + struct pidRecord *ppid=(struct pidRecord *)paddr->precord; + + pcd->upper_ctrl_limit = ppid->hopr; + pcd->lower_ctrl_limit = ppid->lopr; + return(0); +} +static long get_alarm_double(paddr,pad) + struct dbAddr *paddr; + struct dbr_alDouble *pad; +{ + struct pidRecord *ppid=(struct pidRecord *)paddr->precord; + + pad->upper_alarm_limit = ppid->hihi; + pad->upper_warning_limit = ppid->high; + pad->lower_warning_limit = ppid->low; + pad->lower_alarm_limit = ppid->lolo; + return(0); +} + static void alarm(ppid) struct pidRecord *ppid; { float ftemp; + float val=ppid->val; - /* if difference is not > hysterisis don't bother */ + /* if difference is not > hysterisis use lalm not val */ ftemp = ppid->lalm - ppid->val; if(ftemp<0.0) ftemp = -ftemp; - if (ftemp < ppid->hyst) return; + if (ftemp < ppid->hyst) val=ppid->lalm; /* alarm condition hihi */ if (ppid->nsevhhsv){ - if (ppid->val > ppid->hihi){ - ppid->lalm = ppid->val; + if (val > ppid->hihi){ + ppid->lalm = val; ppid->nsta = HIHI_ALARM; ppid->nsev = ppid->hhsv; return; @@ -207,8 +220,8 @@ static void alarm(ppid) /* alarm condition lolo */ if (ppid->nsevllsv){ - if (ppid->val < ppid->lolo){ - ppid->lalm = ppid->val; + if (val < ppid->lolo){ + ppid->lalm = val; ppid->nsta = LOLO_ALARM; ppid->nsev = ppid->llsv; return; @@ -217,8 +230,8 @@ static void alarm(ppid) /* alarm condition high */ if (ppid->nsevhsv){ - if (ppid->val > ppid->high){ - ppid->lalm = ppid->val; + if (val > ppid->high){ + ppid->lalm = val; ppid->nsta = HIGH_ALARM; ppid->nsev =ppid->hsv; return; @@ -227,8 +240,8 @@ static void alarm(ppid) /* alarm condition lolo */ if (ppid->nsevlsv){ - if (ppid->val < ppid->low){ - ppid->lalm = ppid->val; + if (val < ppid->low){ + ppid->lalm = val; ppid->nsta = LOW_ALARM; ppid->nsev = ppid->lsv; return; diff --git a/src/rec/recSel.c b/src/rec/recSel.c index 90ba107f9..df820c65b 100644 --- a/src/rec/recSel.c +++ b/src/rec/recSel.c @@ -54,16 +54,17 @@ long init_record(); long process(); #define special NULL -long get_precision(); long get_value(); #define cvt_dbaddr NULL #define get_array_info NULL #define put_array_info NULL -#define get_enum_str NULL long get_units(); +long get_precision(); +#define get_enum_str NULL +#define get_enum_strs NULL long get_graphic_double(); long get_control_double(); -#define get_enum_strs NULL +long get_alarm_double(); struct rset selRSET={ RSETNUMBER, @@ -72,16 +73,17 @@ struct rset selRSET={ init_record, process, special, - get_precision, get_value, cvt_dbaddr, get_array_info, put_array_info, - get_enum_str, get_units, + get_precision, + get_enum_str, + get_enum_strs, get_graphic_double, get_control_double, - get_enum_strs }; + get_alarm_double }; #define SEL_MAX 6 #define SELECTED 0 @@ -110,62 +112,6 @@ static long init_record(psel) if(psel->inpf.type==CONSTANT) psel->f = psel->inpf.value.value; return(0); } - -static long get_precision(paddr,precision) - struct dbAddr *paddr; - long *precision; -{ - struct selRecord *psel=(struct selRecord *)paddr->precord; - - *precision = psel->prec; - return(0); -} - -static long get_value(psel,pvdes) - struct selRecord *psel; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_FLOAT; - pvdes->no_elements=1; - (float *)(pvdes->pvalue) = &psel->val; - return(0); -} - -static long get_units(paddr,units) - struct dbAddr *paddr; - char *units; -{ - struct selRecord *psel=(struct selRecord *)paddr->precord; - - strncpy(units,psel->egu,sizeof(psel->egu)); - return(0); -} - -static long get_graphic_double(paddr,pgd) - struct dbAddr *paddr; - struct dbr_grDouble *pgd; -{ - struct selRecord *psel=(struct selRecord *)paddr->precord; - - pgd->upper_disp_limit = psel->hopr; - pgd->lower_disp_limit = psel->lopr; - pgd->upper_alarm_limit = psel->hihi; - pgd->upper_warning_limit = psel->high; - pgd->lower_warning_limit = psel->low; - pgd->lower_alarm_limit = psel->lolo; - return(0); -} - -static long get_control_double(paddr,pcd) - struct dbAddr *paddr; - struct dbr_ctrlDouble *pcd; -{ - struct selRecord *psel=(struct selRecord *)paddr->precord; - - pcd->upper_ctrl_limit = psel->hopr; - pcd->lower_ctrl_limit = psel->lopr; - return(0); -} static long process(paddr) struct dbAddr *paddr; @@ -174,7 +120,7 @@ static long process(paddr) psel->pact = TRUE; fetch_values(psel); - if(!do_sel(psel)) { + if(do_sel(psel)!=0) { if(psel->nsevnsta = CALC_ALARM; psel->nsev = MAJOR_ALARM; @@ -194,21 +140,90 @@ static long process(paddr) psel->pact=FALSE; return(0); } + + +static long get_value(psel,pvdes) + struct selRecord *psel; + struct valueDes *pvdes; +{ + pvdes->field_type = DBF_FLOAT; + pvdes->no_elements=1; + (float *)(pvdes->pvalue) = &psel->val; + return(0); +} + +static long get_units(paddr,units) + struct dbAddr *paddr; + char *units; +{ + struct selRecord *psel=(struct selRecord *)paddr->precord; + + strncpy(units,psel->egu,sizeof(psel->egu)); + return(0); +} + +static long get_precision(paddr,precision) + struct dbAddr *paddr; + long *precision; +{ + struct selRecord *psel=(struct selRecord *)paddr->precord; + + *precision = psel->prec; + return(0); +} + + +static long get_graphic_double(paddr,pgd) + struct dbAddr *paddr; + struct dbr_grDouble *pgd; +{ + struct selRecord *psel=(struct selRecord *)paddr->precord; + + pgd->upper_disp_limit = psel->hopr; + pgd->lower_disp_limit = psel->lopr; + return(0); +} + +static long get_control_double(paddr,pcd) + struct dbAddr *paddr; + struct dbr_ctrlDouble *pcd; +{ + struct selRecord *psel=(struct selRecord *)paddr->precord; + + pcd->upper_ctrl_limit = psel->hopr; + pcd->lower_ctrl_limit = psel->lopr; + return(0); +} + +static long get_alarm_double(paddr,pgd) + struct dbAddr *paddr; + struct dbr_alDouble *pgd; +{ + struct selRecord *psel=(struct selRecord *)paddr->precord; + + pgd->upper_alarm_limit = psel->hihi; + pgd->upper_warning_limit = psel->high; + pgd->lower_warning_limit = psel->low; + pgd->lower_alarm_limit = psel->lolo; + return(0); +} + static void alarm(psel) struct selRecord *psel; { float ftemp; + float val=psel->val; - /* if difference is not > hysterisis don't bother */ + /* if difference is not > hysterisis use lalm not val */ ftemp = psel->lalm - psel->val; if(ftemp<0.0) ftemp = -ftemp; - if (ftemp < psel->hyst) return; + if (ftemp < psel->hyst) val=psel->lalm; /* alarm condition hihi */ if (psel->nsevhhsv){ - if (psel->val > psel->hihi){ - psel->lalm = psel->val; + if (val > psel->hihi){ + psel->lalm = val; psel->nsta = HIHI_ALARM; psel->nsev = psel->hhsv; return; @@ -216,8 +231,8 @@ static void alarm(psel) } /* alarm condition lolo */ if (psel->nsevllsv){ - if (psel->val < psel->lolo){ - psel->lalm = psel->val; + if (val < psel->lolo){ + psel->lalm = val; psel->nsta = LOLO_ALARM; psel->nsev = psel->llsv; return; @@ -225,8 +240,8 @@ static void alarm(psel) } /* alarm condition high */ if (psel->nsevhsv){ - if (psel->val > psel->high){ - psel->lalm = psel->val; + if (val > psel->high){ + psel->lalm = val; psel->nsta = HIGH_ALARM; psel->nsev =psel->hsv; return; @@ -234,8 +249,8 @@ static void alarm(psel) } /* alarm condition lolo */ if (psel->nsevlsv){ - if (psel->val < psel->low){ - psel->lalm = psel->val; + if (val < psel->low){ + psel->lalm = val; psel->nsta = LOW_ALARM; psel->nsev = psel->lsv; return; @@ -330,6 +345,7 @@ struct selRecord *psel; /* pointer to selection record */ case (SELECT_HIGH): psel->val = *pvalue; for (i = 0; i < SEL_MAX; i++,pvalue++){ + if (*pvalue == udfFloat) continue; if (psel->val < *pvalue) psel->val = *pvalue; } @@ -337,6 +353,7 @@ struct selRecord *psel; /* pointer to selection record */ case (SELECT_LOW): psel->val = *pvalue; for (i = 0; i < SEL_MAX; i++,pvalue++){ + if (*pvalue == udfFloat) continue; if (psel->val > *pvalue) psel->val = *pvalue; } @@ -346,6 +363,7 @@ struct selRecord *psel; /* pointer to selection record */ plink = &psel->inpa; order_inx = 0; for (i = 0; i < SEL_MAX; i++,pvalue++,plink++){ + if (*pvalue == udfFloat) continue; if (plink->type == DB_LINK){ j = order_inx; while ((order[j-1] > *pvalue) && (j > 0)){ diff --git a/src/rec/recState.c b/src/rec/recState.c index 0637ea36f..ccc957a92 100644 --- a/src/rec/recState.c +++ b/src/rec/recState.c @@ -51,16 +51,17 @@ #define init_record NULL long process(); #define special NULL -#define get_precision NULL long get_value(); #define cvt_dbaddr NULL #define get_array_info NULL #define put_array_info NULL -#define get_enum_str NULL #define get_units NULL +#define get_precision NULL +#define get_enum_str NULL +#define get_enum_strs NULL #define get_graphic_double NULL #define get_control_double NULL -#define get_enum_strs NULL +#define get_alarm_double NULL struct rset stateRSET={ RSETNUMBER, @@ -69,28 +70,18 @@ struct rset stateRSET={ init_record, process, special, - get_precision, get_value, cvt_dbaddr, get_array_info, put_array_info, - get_enum_str, get_units, + get_precision, + get_enum_str, + get_enum_strs, get_graphic_double, get_control_double, - get_enum_strs }; + get_alarm_double }; -static long get_value(pstate,pvdes) - struct stateRecord *pstate; - struct valueDes *pvdes; -{ - pvdes->field_type = DBF_STRING; - pvdes->no_elements=1; - pvdes->pvalue = (caddr_t)(&pstate->val[0]); - return(0); -} - - static long process(paddr) struct dbAddr *paddr; { @@ -107,3 +98,14 @@ static long process(paddr) 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 = (caddr_t)(&pstate->val[0]); + return(0); +} + diff --git a/src/rec/recSub.c b/src/rec/recSub.c index d1a8cab08..4d0348ddd 100644 --- a/src/rec/recSub.c +++ b/src/rec/recSub.c @@ -54,16 +54,17 @@ long init_record(); long process(); #define special NULL -long get_precision(); long get_value(); #define cvt_dbaddr NULL #define get_array_info NULL #define put_array_info NULL -#define get_enum_str NULL long get_units(); +long get_precision(); +#define get_enum_str NULL +#define get_enum_strs NULL long get_graphic_double(); long get_control_double(); -#define get_enum_strs NULL +long get_alarm_double(); struct rset subRSET={ RSETNUMBER, @@ -72,16 +73,17 @@ struct rset subRSET={ init_record, process, special, - get_precision, get_value, cvt_dbaddr, get_array_info, put_array_info, - get_enum_str, get_units, + get_precision, + get_enum_str, + get_enum_strs, get_graphic_double, get_control_double, - get_enum_strs }; + get_alarm_double }; void alarm(); void monitor(); @@ -122,7 +124,7 @@ static long init_record(psub) status = psubroutine(psub,process); /* convert the subroutine name to an address and type */ - /* convert the initialization subroutine name */ + /* convert the processing subroutine name */ temp[0] = 0; /* all global variables start with _ */ if (psub->snam[0] != '_'){ strcpy(temp,"_"); @@ -137,62 +139,6 @@ static long init_record(psub) return(0); } -static long get_precision(paddr,precision) - struct dbAddr *paddr; - long *precision; -{ - struct subRecord *psub=(struct subRecord *)paddr->precord; - - *precision = psub->prec; - return(0); -} - -static long get_value(psub,pvdes) - struct subRecord *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; -{ - struct subRecord *psub=(struct subRecord *)paddr->precord; - - strncpy(units,psub->egu,sizeof(psub->egu)); - return(0); -} - -static long get_graphic_double(paddr,pgd) - struct dbAddr *paddr; - struct dbr_grDouble *pgd; -{ - struct subRecord *psub=(struct subRecord *)paddr->precord; - - pgd->upper_disp_limit = psub->hopr; - pgd->lower_disp_limit = psub->lopr; - pgd->upper_alarm_limit = psub->hihi; - pgd->upper_warning_limit = psub->high; - pgd->lower_warning_limit = psub->low; - pgd->lower_alarm_limit = psub->lolo; - return(0); -} - -static long get_control_double(paddr,pcd) - struct dbAddr *paddr; - struct dbr_ctrlDouble *pcd; -{ - struct subRecord *psub=(struct subRecord *)paddr->precord; - - pcd->upper_ctrl_limit = psub->hopr; - pcd->lower_ctrl_limit = psub->lopr; - return(0); -} - static long process(paddr) struct dbAddr *paddr; { @@ -216,21 +162,88 @@ static long process(paddr) psub->pact = FALSE; return(0); } + +static long get_value(psub,pvdes) + struct subRecord *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; +{ + struct subRecord *psub=(struct subRecord *)paddr->precord; + + strncpy(units,psub->egu,sizeof(psub->egu)); + return(0); +} + +static long get_precision(paddr,precision) + struct dbAddr *paddr; + long *precision; +{ + struct subRecord *psub=(struct subRecord *)paddr->precord; + + *precision = psub->prec; + return(0); +} + + +static long get_graphic_double(paddr,pgd) + struct dbAddr *paddr; + struct dbr_grDouble *pgd; +{ + struct subRecord *psub=(struct subRecord *)paddr->precord; + + pgd->upper_disp_limit = psub->hopr; + pgd->lower_disp_limit = psub->lopr; + return(0); +} + +static long get_control_double(paddr,pcd) + struct dbAddr *paddr; + struct dbr_ctrlDouble *pcd; +{ + struct subRecord *psub=(struct subRecord *)paddr->precord; + + pcd->upper_ctrl_limit = psub->hopr; + pcd->lower_ctrl_limit = psub->lopr; + return(0); +} +static long get_alarm_double(paddr,pad) + struct dbAddr *paddr; + struct dbr_alDouble *pad; +{ + struct subRecord *psub=(struct subRecord *)paddr->precord; + + pad->upper_alarm_limit = psub->hihi; + pad->upper_warning_limit = psub->high; + pad->lower_warning_limit = psub->low; + pad->lower_alarm_limit = psub->lolo; + return(0); +} + static void alarm(psub) struct subRecord *psub; { float ftemp; + float val=psub->val; - /* if difference is not > hysterisis don't bother */ + /* if difference is not > hysterisis use lalm not val */ ftemp = psub->lalm - psub->val; if(ftemp<0.0) ftemp = -ftemp; - if (ftemp < psub->hyst) return; + if (ftemp < psub->hyst) val=psub->lalm; /* alarm condition hihi */ if (psub->nsevhhsv){ - if (psub->val > psub->hihi){ - psub->lalm = psub->val; + if (val > psub->hihi){ + psub->lalm = val; psub->nsta = HIHI_ALARM; psub->nsev = psub->hhsv; return; @@ -239,8 +252,8 @@ static void alarm(psub) /* alarm condition lolo */ if (psub->nsevllsv){ - if (psub->val < psub->lolo){ - psub->lalm = psub->val; + if (val < psub->lolo){ + psub->lalm = val; psub->nsta = LOLO_ALARM; psub->nsev = psub->llsv; return; @@ -249,8 +262,8 @@ static void alarm(psub) /* alarm condition high */ if (psub->nsevhsv){ - if (psub->val > psub->high){ - psub->lalm = psub->val; + if (val > psub->high){ + psub->lalm = val; psub->nsta = HIGH_ALARM; psub->nsev =psub->hsv; return; @@ -258,8 +271,8 @@ static void alarm(psub) } /* alarm condition lolo */ if (psub->nsevlsv){ - if (psub->val < psub->low){ - psub->lalm = psub->val; + if (val < psub->low){ + psub->lalm = val; psub->nsta = LOW_ALARM; psub->nsev = psub->lsv; return; diff --git a/src/rec/recTimer.c b/src/rec/recTimer.c index 53fa47e06..e0d6d3977 100644 --- a/src/rec/recTimer.c +++ b/src/rec/recTimer.c @@ -62,16 +62,17 @@ long init_record(); long process(); #define special NULL -#define get_precision NULL long get_value(); #define cvt_dbaddr NULL #define get_array_info NULL #define put_array_info NULL -#define get_enum_str NULL #define get_units NULL +#define get_precision NULL +#define get_enum_str NULL +#define get_enum_strs NULL #define get_graphic_double NULL #define get_control_double NULL -#define get_enum_strs NULL +#define get_alarm_double NULL struct rset timerRSET={ RSETNUMBER, @@ -80,16 +81,17 @@ struct rset timerRSET={ init_record, process, special, - get_precision, get_value, cvt_dbaddr, get_array_info, put_array_info, - get_enum_str, get_units, + get_precision, + get_enum_str, + get_enum_strs, get_graphic_double, get_control_double, - get_enum_strs }; + get_alarm_double }; /* because the driver does all the work just declare device support here*/ struct dset devTmMizar8310={4,NULL,NULL,NULL,NULL}; @@ -112,15 +114,6 @@ static long init_record(ptimer) return(0); } -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 long process(paddr) struct dbAddr *paddr; @@ -141,8 +134,18 @@ static long process(paddr) return(0); } +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; + struct timerRecord *ptimer; { unsigned short monitor_mask; short stat,sevr,nsta,nsev; diff --git a/src/rec/recWaveform.c b/src/rec/recWaveform.c index ac058b594..1b454d756 100644 --- a/src/rec/recWaveform.c +++ b/src/rec/recWaveform.c @@ -68,16 +68,17 @@ long init_record(); long process(); #define special NULL -long get_precision(); long get_value(); long cvt_dbaddr(); long get_array_info(); long put_array_info(); -#define get_enum_str NULL long get_units(); +long get_precision(); +#define get_enum_str NULL +#define get_enum_strs NULL long get_graphic_double(); long get_control_double(); -#define get_enum_strs NULL +long get_alarm_double(); struct rset waveformRSET={ RSETNUMBER, @@ -86,16 +87,18 @@ struct rset waveformRSET={ init_record, process, special, - get_precision, get_value, cvt_dbaddr, get_array_info, put_array_info, - get_enum_str, get_units, + get_precision, + get_enum_str, + get_enum_strs, get_graphic_double, get_control_double, - get_enum_strs }; + get_alarm_double }; + struct wfdset { /* waveform dset */ long number; DEVSUPFUN dev_report; @@ -143,15 +146,31 @@ static long init_record(pwf) } return(0); } - -static long get_precision(paddr,precision) - struct dbAddr *paddr; - long *precision; + +static long process(paddr) + struct dbAddr *paddr; { - struct waveformRecord *pwf=(struct waveformRecord *)paddr->precord; + struct waveformRecord *pwf=(struct waveformRecord *)(paddr->precord); + struct wfdset *pdset = (struct wfdset *)(pwf->dset); + long status; - *precision = pwf->prec; - return(0); + if( (pdset==NULL) || (pdset->read_wf==NULL) ) { + pwf->pact=TRUE; + recGblRecordError(S_dev_missingSup,pwf,"read_wf"); + return(S_dev_missingSup); + } + /*pact must not be set true until read_wf completes*/ + status=(*pdset->read_wf)(pwf); /* read the new value */ + pwf->pact = TRUE; + /* status is one if an asynchronous record is being processed*/ + if(status==1) return(0); + + monitor(pwf); + /* process the forward scan link record */ + if (pwf->flnk.type==DB_LINK) dbScanPassive(pwf->flnk.value.db_link.pdbAddr); + + pwf->pact=FALSE; + return(0); } static long get_value(pwf,pvdes) @@ -199,7 +218,7 @@ static long put_array_info(paddr,nNew) { struct waveformRecord *pwf=(struct waveformRecord *)paddr->precord; - pwf->nord = (pwf->nord + nNew); + pwf->nord = nNew; if(pwf->nord > pwf->nelm) pwf->nord = pwf->nelm; return(0); } @@ -214,6 +233,16 @@ static long get_units(paddr,units) return(0); } +static long get_precision(paddr,precision) + struct dbAddr *paddr; + long *precision; +{ + struct waveformRecord *pwf=(struct waveformRecord *)paddr->precord; + + *precision = pwf->prec; + return(0); +} + static long get_graphic_double(paddr,pgd) struct dbAddr *paddr; struct dbr_grDouble *pgd; @@ -222,10 +251,6 @@ static long get_graphic_double(paddr,pgd) pgd->upper_disp_limit = pwf->hopr; pgd->lower_disp_limit = pwf->lopr; - pgd->upper_alarm_limit = 0.0; - pgd->upper_warning_limit = 0.0; - pgd->lower_warning_limit = 0.0; - pgd->lower_alarm_limit = 0.0; return(0); } static long get_control_double(paddr,pcd) @@ -238,31 +263,17 @@ static long get_control_double(paddr,pcd) pcd->lower_ctrl_limit = pwf->lopr; return(0); } - -static long process(paddr) - struct dbAddr *paddr; +static long get_alarm_double(paddr,pgd) + struct dbAddr *paddr; + struct dbr_alDouble *pgd; { - struct waveformRecord *pwf=(struct waveformRecord *)(paddr->precord); - struct wfdset *pdset = (struct wfdset *)(pwf->dset); - long status; + struct waveformRecord *pwf=(struct waveformRecord *)paddr->precord; - if( (pdset==NULL) || (pdset->read_wf==NULL) ) { - pwf->pact=TRUE; - recGblRecordError(S_dev_missingSup,pwf,"read_wf"); - return(S_dev_missingSup); - } - /*pact must not be set true until read_wf completes*/ - status=(*pdset->read_wf)(pwf); /* read the new value */ - pwf->pact = TRUE; - /* status is one if an asynchronous record is being processed*/ - if(status==1) return(0); - - monitor(pwf); - /* process the forward scan link record */ - if (pwf->flnk.type==DB_LINK) dbScanPassive(pwf->flnk.value.db_link.pdbAddr); - - pwf->pact=FALSE; - return(0); + pgd->upper_alarm_limit = 0.0; + pgd->upper_warning_limit = 0.0; + pgd->lower_warning_limit = 0.0; + pgd->lower_alarm_limit = 0.0; + return(0); } static void monitor(pwf)