From f1e4620d6519add1bfb877e06fd45eac431799f9 Mon Sep 17 00:00:00 2001 From: "Janet B. Anderson" Date: Fri, 4 Oct 1991 17:14:40 +0000 Subject: [PATCH] *** empty log message *** --- src/db/dbScan.c | 3 ++- src/rec/recAi.c | 63 +++++++++---------------------------------------- 2 files changed, 13 insertions(+), 53 deletions(-) diff --git a/src/db/dbScan.c b/src/db/dbScan.c index 72855c456..90f5c8c80 100644 --- a/src/db/dbScan.c +++ b/src/db/dbScan.c @@ -337,6 +337,7 @@ static RING_ID callbackQ; static int callbackTaskId = 0; struct callback { void (*callback)(); + int priority; /*remainder is callback dependent*/ }; @@ -666,7 +667,7 @@ callbackRequest(pcallback) /* multiple writers are possible so block interrupts*/ lockKey = intLock(); nput = rngBufPut(callbackQ,&pcallback,sizeof(pcallback)); - intUnLock(lockKey); + intUnlock(lockKey); if(nput!=sizeof(pcallback)) logMsg("callbackRequest ring buffer full"); semGive(&callbackSem); } diff --git a/src/rec/recAi.c b/src/rec/recAi.c index e5110a243..339e40b36 100644 --- a/src/rec/recAi.c +++ b/src/rec/recAi.c @@ -54,6 +54,8 @@ * .14 03-21-90 lrd add db_post_event for RVAL * .15 04-11-90 lrd make locals static * .16 04-18-90 mrk extensible record and device support + * .17 09-18-91 jba fixed bug in break point table conversion + * .18 09-30-91 jba Moved break point table conversion to libCom */ #include @@ -62,7 +64,6 @@ #include #include -#include #include #include #include @@ -132,6 +133,7 @@ extern unsigned int gts_trigger_counter; void alarm(); void convert(); +long cvtRawToEngBpt(); void monitor(); static long init_record(pai) @@ -150,18 +152,10 @@ static long init_record(pai) return(S_dev_missingSup); } pai->init = TRUE; + if( pdset->init_record ) { if((status=(*pdset->init_record)(pai,process))) return(status); } - if(pai->linr >= 2) { /*must find breakpoint table*/ - if( !cvtTable || (cvtTable->number < pai->linr) - || (!(cvtTable->papBrkTable[pai->linr]))) { - errMessage(S_db_badField,"Breakpoint Table not Found"); - return(S_db_badField); - } - pai->pbrk = (char *)(cvtTable->papBrkTable[pai->linr]); - pai->lbrk=0; - } return(0); } @@ -377,48 +371,12 @@ struct aiRecord *pai; val = (val * pai->eslo) + pai->egul; } else { /* must use breakpoint table */ - struct brkTable *pbrkTable; - struct brkInt *pInt; - struct brkInt *pnxtInt; - short lbrk; - int number; - - pbrkTable = (struct brkTable *) pai->pbrk; - number = pbrkTable->number; - if(pai->init) lbrk = number/2; /* Just start in the middle */ - else { - lbrk = (pai->lbrk); - /*make sure we dont go off end of table*/ - if( (lbrk+1) >= number ) lbrk--; - } - pInt = pbrkTable->papBrkInt[lbrk]; - pnxtInt = pbrkTable->papBrkInt[lbrk+1]; - /* find entry for increased value */ - while( (pnxtInt->raw) <= val ) { - lbrk++; - pInt = pbrkTable->papBrkInt[lbrk]; - if( lbrk >= number-1) { - if(pai->nsev < VALID_ALARM) { - pai->nsta = SOFT_ALARM; - pai->nsev = VALID_ALARM; - } - break; /* out of while */ - } - pnxtInt = pbrkTable->papBrkInt[lbrk+1]; - } - while( (pInt->raw) > val) { - if(lbrk==0) { - if(pai->nsev < VALID_ALARM) { - pai->nsta = SOFT_ALARM; - pai->nsev = VALID_ALARM; - } - break; /* out of while */ - } - lbrk--; - pInt = pbrkTable->papBrkInt[lbrk]; - } - pai->lbrk = lbrk; - val = pInt->eng + (val - pInt->raw) * pInt->slope; + if (cvtRawToEngBpt(&val,pai->linr,pai->init,&pai->pbrk,&pai->lbrk)!=0) { + if(pai->nsev < VALID_ALARM) { + pai->nsta = SOFT_ALARM; + pai->nsev = VALID_ALARM; + } + } } /* apply smoothing algorithm */ @@ -490,3 +448,4 @@ static void monitor(pai) } return; } +