From a69a2aa8ae5042c20bef5ebc7d9be99938bdf478 Mon Sep 17 00:00:00 2001 From: "Janet B. Anderson" Date: Thu, 5 Dec 1991 13:40:07 +0000 Subject: [PATCH] jba Moved set of alarm stat and sevr to macros --- src/dev/devAiSoft.c | 13 +++----- src/dev/devAiSoftRaw.c | 13 +++----- src/dev/devAiTestAsyn.c | 23 ++++--------- src/dev/devAiXy566Di.c | 15 +++------ src/dev/devAiXy566Se.c | 14 +++----- src/dev/devAoSoft.c | 13 +++----- src/dev/devAoSoftRaw.c | 13 +++----- src/dev/devAoTestAsyn.c | 24 +++++--------- src/dev/devAoVmiVme4100.c | 14 +++----- src/dev/devBiMpv910.c | 9 ++---- src/dev/devBiSoft.c | 13 +++----- src/dev/devBiSoftRaw.c | 13 +++----- src/dev/devBiTestAsyn.c | 23 +++++-------- src/dev/devBiXVme210.c | 9 ++---- src/dev/devBoMpv902.c | 9 ++---- src/dev/devBoSoft.c | 13 +++----- src/dev/devBoTestAsyn.c | 24 +++++--------- src/dev/devBoXVme220.c | 9 ++---- src/dev/devHistogramTestAsyn.c | 27 ++++++---------- src/dev/devLiSoft.c | 12 +++---- src/dev/devLoSoft.c | 12 +++---- src/dev/devMbbiMpv910.c | 9 ++---- src/dev/devMbbiSoft.c | 13 +++----- src/dev/devMbbiSoftRaw.c | 13 +++----- src/dev/devMbbiTestAsyn.c | 24 +++++--------- src/dev/devMbbiXVme210.c | 9 ++---- src/dev/devMbboMpv902.c | 14 +++----- src/dev/devMbboSoft.c | 13 +++----- src/dev/devMbboTestAsyn.c | 24 +++++--------- src/dev/devMbboXVme220.c | 14 +++----- src/dev/devMz8310.c | 59 ++++++++++++---------------------- src/dev/devPtSoft.c | 13 +++----- src/dev/devSiSoft.c | 12 +++---- src/dev/devSiTestAsyn.c | 24 +++++--------- src/dev/devSoSoft.c | 12 +++---- src/dev/devSoTestAsyn.c | 24 +++++--------- src/dev/devWfSoft.c | 13 +++----- src/dev/devWfTestAsyn.c | 25 ++++++-------- src/dev/devWfXy566Sc.c | 16 +++------ 39 files changed, 207 insertions(+), 439 deletions(-) diff --git a/src/dev/devAiSoft.c b/src/dev/devAiSoft.c index d936f46ef..dd359cbc2 100644 --- a/src/dev/devAiSoft.c +++ b/src/dev/devAiSoft.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -45,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -114,18 +114,13 @@ static long read_ai(pai) status = dbGetLink(&(pai->inp.value.db_link),pai,DBR_DOUBLE, &(pai->val),&options,&nRequest); if(status!=0) { - if(pai->nsevnsev = VALID_ALARM; - pai->nsta = LINK_ALARM; - } + recGblSetSevr(pai,LINK_ALARM,VALID_ALARM); } else pai->udf = FALSE; break; case (CA_LINK) : break; default : - if(pai->nsevnsev = VALID_ALARM; - pai->nsta = SOFT_ALARM; + if(recGblSetSevr(pai,SOFT_ALARM,VALID_ALARM)){ if(pai->stat!=SOFT_ALARM) { strcpy(message,pai->name); strcat(message,": devAiSoft (read_ai) Illegal INP field"); diff --git a/src/dev/devAiSoftRaw.c b/src/dev/devAiSoftRaw.c index 2c11f8d30..37ecf2144 100644 --- a/src/dev/devAiSoftRaw.c +++ b/src/dev/devAiSoftRaw.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -44,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -110,19 +110,14 @@ static long read_ai(pai) status = dbGetLink(&(pai->inp.value.db_link),pai,DBR_LONG, &(pai->rval),&options,&nRequest); if(status!=0) { - if(pai->nsevnsev = VALID_ALARM; - pai->nsta = LINK_ALARM; - } + recGblSetSevr(pai,LINK_ALARM,VALID_ALARM); } break; case (CA_LINK) : break; default : - if(pai->nsevnsev = VALID_ALARM; - pai->nsta = SOFT_ALARM; + if(recGblSetSevr(pai,SOFT_ALARM,VALID_ALARM)){ if(pai->stat!=SOFT_ALARM) { strcpy(message,pai->name); strcat(message,": devAiSoftRaw (read_ai) Illegal INP field"); diff --git a/src/dev/devAiTestAsyn.c b/src/dev/devAiTestAsyn.c index 34a63b48c..0402fc515 100644 --- a/src/dev/devAiTestAsyn.c +++ b/src/dev/devAiTestAsyn.c @@ -30,8 +30,6 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment * ... */ @@ -73,9 +71,8 @@ struct { struct callback { void (*callback)(); int priority; - struct dbAddr dbAddr; + struct dbCommon *prec; WDOG_ID wd_id; - void (*process)(); }; void callbackRequest(); @@ -83,18 +80,18 @@ void callbackRequest(); static void myCallback(pcallback) struct callback *pcallback; { - struct aiRecord *pai=(struct aiRecord *)(pcallback->dbAddr.precord); + struct aiRecord *pai=(struct aiRecord *)(pcallback->prec); + struct rset *prset=(struct rset *)(pai->rset); dbScanLock(pai); - (pcallback->process)(&pcallback->dbAddr); + (*prset->process)(pai->pdba); dbScanUnlock(pai); } -static long init_record(pai,process) +static long init_record(pai) struct aiRecord *pai; - void (*process)(); { char message[100]; struct callback *pcallback; @@ -106,12 +103,8 @@ static long init_record(pai,process) pai->dpvt = (caddr_t)pcallback; pcallback->callback = myCallback; pcallback->priority = priorityLow; - if(dbNameToAddr(pai->name,&(pcallback->dbAddr))) { - logMsg("dbNameToAddr failed in init_record for devAiTestAsyn\n"); - exit(1); - } + pcallback->prec = (struct dbCommon *)pai; pcallback->wd_id = wdCreate(); - pcallback->process = process; pai->val = pai->inp.value.value; pai->udf = FALSE; break; @@ -146,9 +139,7 @@ static long read_ai(pai) return(1); } default : - if(pai->nsevnsev = VALID_ALARM; - pai->nsta = SOFT_ALARM; + if(recGblSetSevr(pai,SOFT_ALARM,VALID_ALARM)){ if(pai->stat!=SOFT_ALARM) { strcpy(message,pai->name); strcat(message,": devAiTestAsyn (read_ai) Illegal INP field"); diff --git a/src/dev/devAiXy566Di.c b/src/dev/devAiXy566Di.c index d841221fe..07f42cf0d 100644 --- a/src/dev/devAiXy566Di.c +++ b/src/dev/devAiXy566Di.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -43,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -116,18 +116,11 @@ static long read_ai(pai) status=ai_driver(pvmeio->card,pvmeio->signal,XY566DI,&value); if(status==-1) { status = 2; /* don't convert*/ - if(pai->nsevnsta = READ_ALARM; - pai->nsev = VALID_ALARM; - - } + recGblSetSevr(pai,READ_ALARM,VALID_ALARM); return(status); }else if(status==-2) { status=0; - if(pai->nsevnsta = HW_LIMIT_ALARM; - pai->nsev = VALID_ALARM; - } + recGblSetSevr(pai,HW_LIMIT_ALARM,VALID_ALARM); } if(status!=0) return(status); /*read into hardware as -0x7ff to +0x7ff */ diff --git a/src/dev/devAiXy566Se.c b/src/dev/devAiXy566Se.c index 863d339dd..cc03e4a74 100644 --- a/src/dev/devAiXy566Se.c +++ b/src/dev/devAiXy566Se.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -43,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -115,17 +115,11 @@ static long read_ai(pai) status=ai_driver(pvmeio->card,pvmeio->signal,XY566SE,&value); if(status==-1) { status = 2; /*don't convert*/ - if(pai->nsevnsta = READ_ALARM; - pai->nsev = VALID_ALARM; - } + recGblSetSevr(pai,READ_ALARM,VALID_ALARM); return(status); }else if(status==-2) { status=0; - if(pai->nsevnsta = HW_LIMIT_ALARM; - pai->nsev = VALID_ALARM; - } + recGblSetSevr(pai,HW_LIMIT_ALARM,VALID_ALARM); } if(status!=0) return(status); pai->rval = value & 0xfff; diff --git a/src/dev/devAoSoft.c b/src/dev/devAoSoft.c index b4800d8ea..7409dc61b 100644 --- a/src/dev/devAoSoft.c +++ b/src/dev/devAoSoft.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -42,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -81,18 +81,13 @@ static long write_ao(pao) status = dbPutLink(&pao->out.value.db_link,pao,DBR_DOUBLE, &pao->oval,1L); if(status!=0) { - if(pao->nsevnsev = VALID_ALARM; - pao->nsta = LINK_ALARM; - } + recGblSetSevr(pao,LINK_ALARM,VALID_ALARM); } break; case (CA_LINK) : break; default : - if(pao->nsevnsev = VALID_ALARM; - pao->nsta = SOFT_ALARM; + if(recGblSetSevr(pao,SOFT_ALARM,VALID_ALARM)){ if(pao->stat!=SOFT_ALARM) { strcpy(message,pao->name); strcat(message,": devAoSoft (write_ao) Illegal OUT field"); diff --git a/src/dev/devAoSoftRaw.c b/src/dev/devAoSoftRaw.c index 8d6a9d29b..5ace5de95 100644 --- a/src/dev/devAoSoftRaw.c +++ b/src/dev/devAoSoftRaw.c @@ -29,8 +29,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -41,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -80,18 +80,13 @@ static long write_ao(pao) status = dbPutLink(&pao->out.value.db_link,pao,DBR_LONG, &pao->rval,1L); if(status!=0) { - if(pao->nsevnsev = VALID_ALARM; - pao->nsta = LINK_ALARM; - } + recGblSetSevr(pao,LINK_ALARM,VALID_ALARM); } break; case (CA_LINK) : break; default : - if(pao->nsevnsev = VALID_ALARM; - pao->nsta = SOFT_ALARM; + if(recGblSetSevr(pao,SOFT_ALARM,VALID_ALARM)){ if(pao->stat!=SOFT_ALARM) { strcpy(message,pao->name); strcat(message,": devAoSoftRaw (write_ao) Illegal OUT field"); diff --git a/src/dev/devAoTestAsyn.c b/src/dev/devAoTestAsyn.c index 0fbf176ca..06cc0f717 100644 --- a/src/dev/devAoTestAsyn.c +++ b/src/dev/devAoTestAsyn.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -74,27 +73,26 @@ struct { struct callback { void (*callback)(); int priority; - struct dbAddr dbAddr; + struct dbCommon *prec; WDOG_ID wd_id; - void (*process)(); }; void callbackRequest(); static void myCallback(pcallback) struct callback *pcallback; { - struct aoRecord *pao=(struct aoRecord *)(pcallback->dbAddr.precord); + struct aoRecord *pao=(struct aoRecord *)(pcallback->prec); + struct rset *prset=(struct rset *)(pao->rset); dbScanLock(pao); - (pcallback->process)(&pcallback->dbAddr); + (*prset->process)(pao->pdba); dbScanUnlock(pao); } -static long init_record(pao,process) +static long init_record(pao) struct aoRecord *pao; - void (*process)(); { char message[100]; struct callback *pcallback; @@ -106,12 +104,8 @@ static long init_record(pao,process) pao->dpvt = (caddr_t)pcallback; pcallback->callback = myCallback; pcallback->priority = priorityLow; - if(dbNameToAddr(pao->name,&(pcallback->dbAddr))) { - logMsg("dbNameToAddr failed in init_record for devAoTestAsyn\n"); - exit(1); - } + pcallback->prec = (struct dbComm *)pao; pcallback->wd_id = wdCreate(); - pcallback->process = process; break; default : strcpy(message,pao->name); @@ -144,9 +138,7 @@ static long write_ao(pao) return(1); } default : - if(pao->nsevnsev = VALID_ALARM; - pao->nsta = SOFT_ALARM; + if(recGblSetSevr(pao,SOFT_ALARM,VALID_ALARM)){ if(pao->stat!=SOFT_ALARM) { strcpy(message,pao->name); strcat(message,": devAoTestAsyn (read_ao) Illegal OUT field"); diff --git a/src/dev/devAoVmiVme4100.c b/src/dev/devAoVmiVme4100.c index 53d618123..25353cce4 100644 --- a/src/dev/devAoVmiVme4100.c +++ b/src/dev/devAoVmiVme4100.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -43,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -114,16 +114,10 @@ static long write_ao(pao) status = ao_driver(pvmeio->card,pvmeio->signal,VMI4100,&value,&rbvalue); if(status==0 || status==-2) pao->rbv = rbvalue; if(status==-1) { - if(pao->nsevnsta = WRITE_ALARM; - pao->nsev = VALID_ALARM; - } + recGblSetSevr(pao,WRITE_ALARM,VALID_ALARM); }else if(status==-2) { status=0; - if(pao->nsevnsta = HW_LIMIT_ALARM; - pao->nsev = VALID_ALARM; - } + recGblSetSevr(pao,HW_LIMIT_ALARM,VALID_ALARM); } return(status); } diff --git a/src/dev/devBiMpv910.c b/src/dev/devBiMpv910.c index d88c24205..33ecc1196 100644 --- a/src/dev/devBiMpv910.c +++ b/src/dev/devBiMpv910.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -43,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -104,10 +104,7 @@ static long read_bi(pbi) pbi->rval = value; return(0); } else { - if(pbi->nsevnsta = READ_ALARM; - pbi->nsev = VALID_ALARM; - } + recGblSetSevr(pbi,READ_ALARM,VALID_ALARM); return(2); } } diff --git a/src/dev/devBiSoft.c b/src/dev/devBiSoft.c index c7520a133..6b700e89c 100644 --- a/src/dev/devBiSoft.c +++ b/src/dev/devBiSoft.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -43,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -111,18 +111,13 @@ static long read_bi(pbi) status = dbGetLink(&(pbi->inp.value.db_link),pbi,DBR_USHORT, &pbi->val,&options,&nRequest); if(status!=0) { - if(pbi->nsevnsev = VALID_ALARM; - pbi->nsta = LINK_ALARM; - } + recGblSetSevr(pbi,LINK_ALARM,VALID_ALARM); } else pbi->udf = FALSE; break; case (CA_LINK) : break; default : - if(pbi->nsevnsev = VALID_ALARM; - pbi->nsta = SOFT_ALARM; + if(recGblSetSevr(pbi,SOFT_ALARM,VALID_ALARM)){ if(pbi->stat!=SOFT_ALARM) { strcpy(message,pbi->name); strcat(message,": devBiSoft (read_bi) Illegal INP field"); diff --git a/src/dev/devBiSoftRaw.c b/src/dev/devBiSoftRaw.c index 5e866e6b7..b0f731723 100644 --- a/src/dev/devBiSoftRaw.c +++ b/src/dev/devBiSoftRaw.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -43,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -110,18 +110,13 @@ static long read_bi(pbi) status = dbGetLink(&(pbi->inp.value.db_link),pbi,DBR_ULONG, &pbi->rval,&options,&nRequest); if(status!=0) { - if(pbi->nsevnsev = VALID_ALARM; - pbi->nsta = LINK_ALARM; - } + recGblSetSevr(pbi,LINK_ALARM,VALID_ALARM); } break; case (CA_LINK) : break; default : - if(pbi->nsevnsev = VALID_ALARM; - pbi->nsta = SOFT_ALARM; + if(recGblSetSevr(pbi,SOFT_ALARM,VALID_ALARM)){ if(pbi->stat!=SOFT_ALARM) { strcpy(message,pbi->name); strcat(message,": devBiSoftRaw (read_bi) Illegal INP field"); diff --git a/src/dev/devBiTestAsyn.c b/src/dev/devBiTestAsyn.c index 6ddb31206..422842d7a 100644 --- a/src/dev/devBiTestAsyn.c +++ b/src/dev/devBiTestAsyn.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -73,7 +72,7 @@ struct { struct callback { void (*callback)(); int priority; - struct dbAddr dbAddr; + struct dbCommon *prec; WDOG_ID wd_id; void (*process)(); }; @@ -83,18 +82,18 @@ void callbackRequest(); static void myCallback(pcallback) struct callback *pcallback; { - struct biRecord *pbi=(struct biRecord *)(pcallback->dbAddr.precord); + struct biRecord *pbi=(struct biRecord *)(pcallback->prec); + struct rset *prset=(struct rset *)(pbi->rset); dbScanLock(pbi); - (pcallback->process)(&pcallback->dbAddr); + (*prset->process)(pbi->pdba); dbScanUnlock(pbi); } -static long init_record(pbi,process) +static long init_record(pbi) struct biRecord *pbi; - void (*process)(); { char message[100]; struct callback *pcallback; @@ -106,12 +105,8 @@ static long init_record(pbi,process) pbi->dpvt = (caddr_t)pcallback; pcallback->callback = myCallback; pcallback->priority = priorityLow; - if(dbNameToAddr(pbi->name,&(pcallback->dbAddr))) { - logMsg("dbNameToAddr failed in init_record for devBiTestAsyn\n"); - exit(1); - } + pcallback->prec = (struct dbCommon *)pbi; pcallback->wd_id = wdCreate(); - pcallback->process = process; pbi->val = pbi->inp.value.value; pbi->udf = FALSE; break; @@ -146,9 +141,7 @@ static long read_bi(pbi) return(1); } default : - if(pbi->nsevnsev = VALID_ALARM; - pbi->nsta = SOFT_ALARM; + if(recGblSetSevr(pbi,SOFT_ALARM,VALID_ALARM)){ if(pbi->stat!=SOFT_ALARM) { strcpy(message,pbi->name); strcat(message,": devBiTestAsyn (read_bi) Illegal INP field"); diff --git a/src/dev/devBiXVme210.c b/src/dev/devBiXVme210.c index 26da4aa44..fbd774d59 100644 --- a/src/dev/devBiXVme210.c +++ b/src/dev/devBiXVme210.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -43,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -104,10 +104,7 @@ static long read_bi(pbi) pbi->rval = value; return(0); } else { - if(pbi->nsevnsta = READ_ALARM; - pbi->nsev = VALID_ALARM; - } + recGblSetSevr(pbi,READ_ALARM,VALID_ALARM); return(2); } return(status); diff --git a/src/dev/devBoMpv902.c b/src/dev/devBoMpv902.c index 447ef3b4c..ab179b125 100644 --- a/src/dev/devBoMpv902.c +++ b/src/dev/devBoMpv902.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -43,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -116,10 +116,7 @@ static long write_bo(pbo) pvmeio = (struct vmeio *)&(pbo->out.value); status = bo_driver(pvmeio->card,pbo->rval,pbo->mask,BB902); if(status!=0) { - if(pbo->nsevnsta = WRITE_ALARM; - pbo->nsev = VALID_ALARM; - } + recGblSetSevr(pbo,WRITE_ALARM,VALID_ALARM); } return(status); } diff --git a/src/dev/devBoSoft.c b/src/dev/devBoSoft.c index 182e27b99..73f5ef6a0 100644 --- a/src/dev/devBoSoft.c +++ b/src/dev/devBoSoft.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -43,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -81,18 +81,13 @@ static long write_bo(pbo) case (DB_LINK) : status = dbPutLink(&pbo->out.value.db_link,pbo,DBR_USHORT,&pbo->val,1L); if(status!=0) { - if(pbo->nsevnsev = VALID_ALARM; - pbo->nsta = LINK_ALARM; - } + recGblSetSevr(pbo,LINK_ALARM,VALID_ALARM); } break; case (CA_LINK) : break; default : - if(pbo->nsevnsev = VALID_ALARM; - pbo->nsta = SOFT_ALARM; + if(recGblSetSevr(pbo,SOFT_ALARM,VALID_ALARM)){ if(pbo->stat!=SOFT_ALARM) { strcpy(message,pbo->name); strcat(message,": devBoSoft (write_bo) Illegal OUT field"); diff --git a/src/dev/devBoTestAsyn.c b/src/dev/devBoTestAsyn.c index d9d773fad..30c66854a 100644 --- a/src/dev/devBoTestAsyn.c +++ b/src/dev/devBoTestAsyn.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -75,27 +74,26 @@ struct { struct callback { void (*callback)(); int priority; - struct dbAddr dbAddr; + struct dbCommon *prec; WDOG_ID wd_id; - void (*process)(); }; void callbackRequest(); static void myCallback(pcallback) struct callback *pcallback; { - struct boRecord *pbo=(struct boRecord *)(pcallback->dbAddr.precord); + struct boRecord *pbo=(struct boRecord *)(pcallback->prec); + struct rset *prset=(struct rset *)(pbo->rset); dbScanLock(pbo); - (pcallback->process)(&pcallback->dbAddr); + (*prset->process)(pbo->pdba); dbScanUnlock(pbo); } -static long init_record(pbo,process) +static long init_record(pbo) struct boRecord *pbo; - void (*process)(); { char message[100]; struct callback *pcallback; @@ -107,12 +105,8 @@ static long init_record(pbo,process) pbo->dpvt = (caddr_t)pcallback; pcallback->callback = myCallback; pcallback->priority = priorityLow; - if(dbNameToAddr(pbo->name,&(pcallback->dbAddr))) { - logMsg("dbNameToAddr failed in init_record for devBoTestAsyn\n"); - exit(1); - } + pcallback->prec = (struct dbCommon *)pbo; pcallback->wd_id = wdCreate(); - pcallback->process = process; break; default : strcpy(message,pbo->name); @@ -145,9 +139,7 @@ static long write_bo(pbo) return(1); } default : - if(pbo->nsevnsev = VALID_ALARM; - pbo->nsta = SOFT_ALARM; + if(recGblSetSevr(pbo,SOFT_ALARM,VALID_ALARM)){ if(pbo->stat!=SOFT_ALARM) { strcpy(message,pbo->name); strcat(message,": devBoTestAsyn (read_bo) Illegal OUT field"); diff --git a/src/dev/devBoXVme220.c b/src/dev/devBoXVme220.c index 9cc661488..8646f5cb8 100644 --- a/src/dev/devBoXVme220.c +++ b/src/dev/devBoXVme220.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -43,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -116,10 +116,7 @@ static long write_bo(pbo) pvmeio = (struct vmeio *)&(pbo->out.value); status = bo_driver(pvmeio->card,pbo->rval,pbo->mask,XY220); if(status!=0) { - if(pbo->nsevnsta = WRITE_ALARM; - pbo->nsev = VALID_ALARM; - } + recGblSetSevr(pbo,WRITE_ALARM,VALID_ALARM); } return(status); } diff --git a/src/dev/devHistogramTestAsyn.c b/src/dev/devHistogramTestAsyn.c index 7b0c9f6aa..7d808615c 100644 --- a/src/dev/devHistogramTestAsyn.c +++ b/src/dev/devHistogramTestAsyn.c @@ -29,8 +29,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -72,9 +71,8 @@ struct { struct callback { void (*callback)(); int priority; - struct dbAddr dbAddr; + struct dbCommon *prec; WDOG_ID wd_id; - void (*process)(); }; void callbackRequest(); @@ -82,18 +80,17 @@ void callbackRequest(); static void myCallback(pcallback) struct callback *pcallback; { - struct histogramRecord *phistogram=(struct histogramRecord *)(pcallback->dbAddr.precord); + struct histogramRecord *phistogram=(struct histogramRecord *)(pcallback->prec); + struct rset *prset=(struct rset *)(phistogram->rset); dbScanLock(phistogram); - (pcallback->process)(&pcallback->dbAddr); + (*prset->process)(phistogram->pdba); dbScanUnlock(phistogram); + return; } - - -static long init_record(phistogram,process) +static long init_record(phistogram) struct histogramRecord *phistogram; - void (*process)(); { char message[100]; struct callback *pcallback; @@ -105,12 +102,8 @@ static long init_record(phistogram,process) phistogram->dpvt = (caddr_t)pcallback; pcallback->callback = myCallback; pcallback->priority = priorityLow; - if(dbNameToAddr(phistogram->name,&(pcallback->dbAddr))) { - logMsg("dbNameToAddr failed in init_record for devHistogramTestAsyn\n"); - exit(1); - } + pcallback->prec = (struct dbCommon *)phistogram; pcallback->wd_id = wdCreate(); - pcallback->process = process; phistogram->sgnl = phistogram->svl.value.value; break; default : @@ -144,9 +137,7 @@ static long read_histogram(phistogram) return(1); } default : - if(phistogram->nsevnsev = VALID_ALARM; - phistogram->nsta = SOFT_ALARM; + if(recGblSetSevr(phistogram,SOFT_ALARM,VALID_ALARM)){ if(phistogram->stat!=SOFT_ALARM) { strcpy(message,phistogram->name); strcat(message,": devHistogramTestAsyn (read_histogram) Illegal SVL field"); diff --git a/src/dev/devLiSoft.c b/src/dev/devLiSoft.c index c6b149c4e..2d4b7b62b 100644 --- a/src/dev/devLiSoft.c +++ b/src/dev/devLiSoft.c @@ -29,7 +29,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros */ @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -107,18 +108,13 @@ static long read_longin(plongin) status = dbGetLink(&(plongin->inp.value.db_link),plongin,DBR_LONG, &plongin->val,&options,&nRequest); if(status!=0) { - if(plongin->nsevnsev = VALID_ALARM; - plongin->nsta = LINK_ALARM; - } + recGblSetSevr(plongin,LINK_ALARM,VALID_ALARM); } else plongin->udf = FALSE; break; case (CA_LINK) : break; default : - if(plongin->nsevnsev = VALID_ALARM; - plongin->nsta = SOFT_ALARM; + if(recGblSetSevr(plongin,SOFT_ALARM,VALID_ALARM)){ if(plongin->stat!=SOFT_ALARM) { strcpy(message,plongin->name); strcat(message,": devLiSoft (read_longin) Illegal INP field"); diff --git a/src/dev/devLoSoft.c b/src/dev/devLoSoft.c index ebaf47c02..0bb9b0aec 100644 --- a/src/dev/devLoSoft.c +++ b/src/dev/devLoSoft.c @@ -29,7 +29,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros */ #include @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -77,18 +78,13 @@ static long write_longout(plongout) status = dbPutLink(&plongout->out.value.db_link,plongout,DBR_LONG, &plongout->val,1L); if(status!=0) { - if(plongout->nsevnsev = VALID_ALARM; - plongout->nsta = LINK_ALARM; - } + recGblSetSevr(plongout,LINK_ALARM,VALID_ALARM); } break; case (CA_LINK) : break; default : - if(plongout->nsevnsev = VALID_ALARM; - plongout->nsta = SOFT_ALARM; + if(recGblSetSevr(plongout,SOFT_ALARM,VALID_ALARM)){ if(plongout->stat!=SOFT_ALARM) { strcpy(message,plongout->name); strcat(message,": devLoSoft (write_longout) Illegal OUT field"); diff --git a/src/dev/devMbbiMpv910.c b/src/dev/devMbbiMpv910.c index b9b204639..2568b93fa 100644 --- a/src/dev/devMbbiMpv910.c +++ b/src/dev/devMbbiMpv910.c @@ -31,8 +31,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -44,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -102,10 +102,7 @@ static long read_mbbi(pmbbi) if(status==0) { pmbbi->rval = value; } else { - if(pmbbi->nsevnsta = READ_ALARM; - pmbbi->nsev = VALID_ALARM; - } + recGblSetSevr(pmbbi,READ_ALARM,VALID_ALARM); } return(status); } diff --git a/src/dev/devMbbiSoft.c b/src/dev/devMbbiSoft.c index 4a0ea759e..052d9708a 100644 --- a/src/dev/devMbbiSoft.c +++ b/src/dev/devMbbiSoft.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -43,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -110,18 +110,13 @@ static long read_mbbi(pmbbi) status = dbGetLink(&(pmbbi->inp.value.db_link),pmbbi,DBR_USHORT, &(pmbbi->val),&options,&nRequest); if(status!=0) { - if(pmbbi->nsevnsev = VALID_ALARM; - pmbbi->nsta = LINK_ALARM; - } + recGblSetSevr(pmbbi,LINK_ALARM,VALID_ALARM); } else pmbbi->udf = FALSE; break; case (CA_LINK) : break; default : - if(pmbbi->nsevnsev = VALID_ALARM; - pmbbi->nsta = SOFT_ALARM; + if(recGblSetSevr(pmbbi,SOFT_ALARM,VALID_ALARM)){ if(pmbbi->stat!=SOFT_ALARM) { strcpy(message,pmbbi->name); strcat(message,": devMbbiSoft (read_mbbi) Illegal INP field"); diff --git a/src/dev/devMbbiSoftRaw.c b/src/dev/devMbbiSoftRaw.c index ce038632d..4c91898eb 100644 --- a/src/dev/devMbbiSoftRaw.c +++ b/src/dev/devMbbiSoftRaw.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -43,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -109,18 +109,13 @@ static long read_mbbi(pmbbi) status = dbGetLink(&(pmbbi->inp.value.db_link),pmbbi,DBR_ULONG, &(pmbbi->rval),&options,&nRequest); if(status!=0) { - if(pmbbi->nsevnsev = VALID_ALARM; - pmbbi->nsta = LINK_ALARM; - } + recGblSetSevr(pmbbi,LINK_ALARM,VALID_ALARM); } break; case (CA_LINK) : break; default : - if(pmbbi->nsevnsev = VALID_ALARM; - pmbbi->nsta = SOFT_ALARM; + if(recGblSetSevr(pmbbi,SOFT_ALARM,VALID_ALARM)){ if(pmbbi->stat!=SOFT_ALARM) { strcpy(message,pmbbi->name); strcat(message,": devMbbiSoftRaw (read_mbbi) Illegal INP field"); diff --git a/src/dev/devMbbiTestAsyn.c b/src/dev/devMbbiTestAsyn.c index 150735d9e..38ffa7421 100644 --- a/src/dev/devMbbiTestAsyn.c +++ b/src/dev/devMbbiTestAsyn.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -73,9 +72,8 @@ struct { struct callback { void (*callback)(); int priority; - struct dbAddr dbAddr; + struct dbCommon *prec; WDOG_ID wd_id; - void (*process)(); }; void callbackRequest(); @@ -83,18 +81,18 @@ void callbackRequest(); static void myCallback(pcallback) struct callback *pcallback; { - struct mbbiRecord *pmbbi=(struct mbbiRecord *)(pcallback->dbAddr.precord); + struct mbbiRecord *pmbbi=(struct mbbiRecord *)(pcallback->prec); + struct rset *prset=(struct rset *)(pmbbi->rset); dbScanLock(pmbbi); - (pcallback->process)(&pcallback->dbAddr); + (*prset->process)(pmbbi->pdba); dbScanUnlock(pmbbi); } -static long init_record(pmbbi,process) +static long init_record(pmbbi) struct mbbiRecord *pmbbi; - void (*process)(); { char message[100]; struct callback *pcallback; @@ -106,12 +104,8 @@ static long init_record(pmbbi,process) pmbbi->dpvt = (caddr_t)pcallback; pcallback->callback = myCallback; pcallback->priority = priorityLow; - if(dbNameToAddr(pmbbi->name,&(pcallback->dbAddr))) { - logMsg("dbNameToAddr failed in init_record for devMbbiTestAsyn\n"); - exit(1); - } + pcallback->prec = (struct dbCommon *)pmbbi; pcallback->wd_id = wdCreate(); - pcallback->process = process; pmbbi->val = pmbbi->inp.value.value; pmbbi->udf = FALSE; break; @@ -146,9 +140,7 @@ static long read_mbbi(pmbbi) return(1); } default : - if(pmbbi->nsevnsev = VALID_ALARM; - pmbbi->nsta = SOFT_ALARM; + if(recGblSetSevr(pmbbi,SOFT_ALARM,VALID_ALARM)){ if(pmbbi->stat!=SOFT_ALARM) { strcpy(message,pmbbi->name); strcat(message,": devMbbiTestAsyn (read_mbbi) Illegal INP field"); diff --git a/src/dev/devMbbiXVme210.c b/src/dev/devMbbiXVme210.c index 93f893855..faa39caa6 100644 --- a/src/dev/devMbbiXVme210.c +++ b/src/dev/devMbbiXVme210.c @@ -31,8 +31,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -44,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -102,10 +102,7 @@ static long read_mbbi(pmbbi) if(status==0) { pmbbi->rval = value; } else { - if(pmbbi->nsevnsta = READ_ALARM; - pmbbi->nsev = VALID_ALARM; - } + recGblSetSevr(pmbbi,READ_ALARM,VALID_ALARM); } return(status); } diff --git a/src/dev/devMbboMpv902.c b/src/dev/devMbboMpv902.c index 1e16871e6..bffdd0339 100644 --- a/src/dev/devMbboMpv902.c +++ b/src/dev/devMbboMpv902.c @@ -31,8 +31,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -44,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -109,15 +109,9 @@ static long write_mbbo(pmbbo) if(status==0) { status = bo_read(pvmeio->card,pmbbo->mask,&value,BB902); if(status==0) pmbbo->rbv = value; - else if(pmbbo->nsevnsta = READ_ALARM; - pmbbo->nsev = VALID_ALARM; - } + else recGblSetSevr(pmbbo,READ_ALARM,VALID_ALARM); } else { - if(pmbbo->nsevnsta = WRITE_ALARM; - pmbbo->nsev = VALID_ALARM; - } + recGblSetSevr(pmbbo,WRITE_ALARM,VALID_ALARM); } return(status); } diff --git a/src/dev/devMbboSoft.c b/src/dev/devMbboSoft.c index a9a9cafaa..058451bcb 100644 --- a/src/dev/devMbboSoft.c +++ b/src/dev/devMbboSoft.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -43,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -84,18 +84,13 @@ static long write_mbbo(pmbbo) status = dbPutLink(&pmbbo->out.value.db_link,pmbbo,DBR_USHORT, &pmbbo->val,1L); if(status!=0) { - if(pmbbo->nsevnsev = VALID_ALARM; - pmbbo->nsta = LINK_ALARM; - } + recGblSetSevr(pmbbo,LINK_ALARM,VALID_ALARM); } break; case (CA_LINK) : break; default : - if(pmbbo->nsevnsev = VALID_ALARM; - pmbbo->nsta = SOFT_ALARM; + if(recGblSetSevr(pmbbo,SOFT_ALARM,VALID_ALARM)){ if(pmbbo->stat!=SOFT_ALARM) { strcpy(message,pmbbo->name); strcat(message,": devMbboSoft (write_mbbo) Illegal OUT field"); diff --git a/src/dev/devMbboTestAsyn.c b/src/dev/devMbboTestAsyn.c index 68085cc53..0e546ba22 100644 --- a/src/dev/devMbboTestAsyn.c +++ b/src/dev/devMbboTestAsyn.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -74,27 +73,26 @@ struct { struct callback { void (*callback)(); int priority; - struct dbAddr dbAddr; + struct dbCommon *prec; WDOG_ID wd_id; - void (*process)(); }; void callbackRequest(); static void myCallback(pcallback) struct callback *pcallback; { - struct mbboRecord *pmbbo=(struct mbboRecord *)(pcallback->dbAddr.precord); + struct mbboRecord *pmbbo=(struct mbboRecord *)(pcallback->prec); + struct rset *prset=(struct rset *)(pmbbo->rset); dbScanLock(pmbbo); - (pcallback->process)(&pcallback->dbAddr); + (*prset->process)(pmbbo->pdba); dbScanUnlock(pmbbo); } -static long init_record(pmbbo,process) +static long init_record(pmbbo) struct mbboRecord *pmbbo; - void (*process)(); { char message[100]; struct callback *pcallback; @@ -106,12 +104,8 @@ static long init_record(pmbbo,process) pmbbo->dpvt = (caddr_t)pcallback; pcallback->callback = myCallback; pcallback->priority = priorityLow; - if(dbNameToAddr(pmbbo->name,&(pcallback->dbAddr))) { - logMsg("dbNameToAddr failed in init_record for devMbboTestAsyn\n"); - exit(1); - } + pcallback->prec = (struct dbCommon *)pmbbo; pcallback->wd_id = wdCreate(); - pcallback->process = process; break; default : strcpy(message,pmbbo->name); @@ -144,9 +138,7 @@ static long write_mbbo(pmbbo) return(1); } default : - if(pmbbo->nsevnsev = VALID_ALARM; - pmbbo->nsta = SOFT_ALARM; + if(recGblSetSevr(pmbbo,SOFT_ALARM,VALID_ALARM)){ if(pmbbo->stat!=SOFT_ALARM) { strcpy(message,pmbbo->name); strcat(message,": devMbboTestAsyn (read_mbbo) Illegal OUT field"); diff --git a/src/dev/devMbboXVme220.c b/src/dev/devMbboXVme220.c index 00e18b178..6950e772c 100644 --- a/src/dev/devMbboXVme220.c +++ b/src/dev/devMbboXVme220.c @@ -31,8 +31,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -44,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -108,15 +108,9 @@ static long write_mbbo(pmbbo) if(status==0) { status = bo_read(pvmeio->card,pmbbo->mask,&value,XY220); if(status==0) pmbbo->rbv = value; - else if(pmbbo->nsevnsta = READ_ALARM; - pmbbo->nsev = VALID_ALARM; - } + else recGblSetSevr(pmbbo,READ_ALARM,VALID_ALARM); } else { - if(pmbbo->nsevnsta = WRITE_ALARM; - pmbbo->nsev = VALID_ALARM; - } + recGblSetSevr(pmbbo,WRITE_ALARM,VALID_ALARM); } return(status); } diff --git a/src/dev/devMz8310.c b/src/dev/devMz8310.c index 29ade1d5c..189aa8eaf 100644 --- a/src/dev/devMz8310.c +++ b/src/dev/devMz8310.c @@ -30,6 +30,8 @@ * Modification Log: * ----------------- * .01 10-22-91 mrk Initial Implementation + * .02 11-26-91 jba Initialized clockDiv to 0 + * .03 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -48,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -204,7 +207,8 @@ getData(preg,pdata) if(mz8310Debug) printf("mz8310:getData: preg=%x data=%x %d\n",preg,*pdata,*pdata); } -static long init() +static long init(after) + short after; { int card,chip,channel; /*volatile*/ @@ -214,6 +218,7 @@ static long init() unsigned short data; int dummy; + if(after)return(0); if(sysBusToLocalAdrs(VME_AM_USR_SHORT_IO, 0, &shortaddr)) { logMsg("devMz8310: sysBusToLocalAdrs failed\n"); exit(1); @@ -244,7 +249,7 @@ static long init() } } } - return OK; + return(0); } static long report(fp,interest) @@ -413,10 +418,7 @@ static long cmd_pc(pr) } /*set count source selection*/ if(pr->clks<0 || pr->clks>15) { - if(pr->nsevnsta = WRITE_ALARM; - pr->nsev = VALID_ALARM; - } + recGblSetSevr(pr,WRITE_ALARM,VALID_ALARM); recGblRecordError(S_db_badField,pr, "devMz8310 : illegal clks value"); return(1); @@ -435,15 +437,12 @@ static long cmd_pc(pr) pr->udf = FALSE; break; default: - if(pr->nsevnsta = WRITE_ALARM; - pr->nsev = MAJOR_ALARM; - } + recGblSetSevr(pr,WRITE_ALARM,MAJOR_ALARM); recGblRecordError(S_db_badField,pr, "devMz8310 : illegal command"); return(0); } - return(OK); + return(0); } static long write_pd(pr) @@ -457,7 +456,7 @@ static long write_pd(pr) int card,chip,channel,signal; unsigned short load,hold,mode; double clockRate,holdCount,loadCount; - int clockDiv; + int clockDiv=0; if(!pr->dpvt) return(S_dev_NoInit); pvmeio = (struct vmeio *)&(pr->out.value); @@ -471,10 +470,7 @@ static long write_pd(pr) /* compute hold count and load count */ clockRate = (pr->csrc==INTERNAL ? INT_CLOCK_RATE : pr->clkr); if(clockRate<=0 || clockRate>MAX_CLOCK_RATE) { - if(pr->nsevnsta = WRITE_ALARM; - pr->nsev = VALID_ALARM; - } + recGblSetSevr(pr,WRITE_ALARM,VALID_ALARM); recGblRecordError(S_db_badField,pr, "devMz8310 : computed illegal clock rate"); return(1); @@ -494,10 +490,7 @@ static long write_pd(pr) } } if(loadCount>65536.0 || holdCount>65535.0) { - if(pr->nsevnsta = WRITE_ALARM; - pr->nsev = VALID_ALARM; - } + recGblSetSevr(pr,WRITE_ALARM,VALID_ALARM); recGblRecordError(S_db_badField,pr, "devMz8310 : computed illegal clock rate"); return(1); @@ -515,10 +508,7 @@ static long write_pd(pr) mode |= internalCountSource[clockDiv]; } else {/*external clock. Determine source*/ if(pr->clks<0 || pr->clks>15) { - if(pr->nsevnsta = WRITE_ALARM; - pr->nsev = VALID_ALARM; - } + recGblSetSevr(pr,WRITE_ALARM,VALID_ALARM); recGblRecordError(S_db_badField,pr, "devMz8310 : illegal clks value"); return(1); @@ -546,7 +536,7 @@ static long write_pd(pr) putCmd(pcmd,(STEP | (channel+1))); putCmd(pcmd,(ARM | (1<udf = FALSE; - return(OK); + return(0); } static long write_pt(pr) @@ -560,7 +550,7 @@ static long write_pt(pr) int card,chip,channel,signal; unsigned short load,hold,mode; double clockRate,periodInClockUnits,holdCount,loadCount; - int clockDiv; + int clockDiv=0; if(!pr->dpvt) return(S_dev_NoInit); pvmeio = (struct vmeio *)&(pr->out.value); @@ -591,10 +581,7 @@ static long write_pt(pr) clockRate = (pr->csrc==INTERNAL ? INT_CLOCK_RATE : pr->clkr); periodInClockUnits = pr->per * clockRate; if(clockRate<=0 || clockRate>MAX_CLOCK_RATE || periodInClockUnits<=1) { - if(pr->nsevnsta = WRITE_ALARM; - pr->nsev = VALID_ALARM; - } + recGblSetSevr(pr,WRITE_ALARM,VALID_ALARM); recGblRecordError(S_db_badField,pr, "devMz8310 : computed illegal clock rate"); return(1); @@ -613,10 +600,7 @@ static long write_pt(pr) } } if(loadCount>65536.0 || holdCount>65535.0) { - if(pr->nsevnsta = WRITE_ALARM; - pr->nsev = VALID_ALARM; - } + recGblSetSevr(pr,WRITE_ALARM,VALID_ALARM); recGblRecordError(S_db_badField,pr, "devMz8310 : computed illegal clock rate"); return(1); @@ -640,10 +624,7 @@ static long write_pt(pr) mode |= internalCountSource[clockDiv]; } else {/*external clock. Determine source*/ if(pr->clks<0 || pr->clks>15) { - if(pr->nsevnsta = WRITE_ALARM; - pr->nsev = VALID_ALARM; - } + recGblSetSevr(pr,WRITE_ALARM,VALID_ALARM); recGblRecordError(S_db_badField,pr, "devMz8310 : illegal clks value"); return(1); @@ -669,5 +650,5 @@ static long write_pt(pr) /* Load and arm counter*/ putCmd(pcmd,(LOADARM | (1<udf = FALSE; - return(OK); + return(0); } diff --git a/src/dev/devPtSoft.c b/src/dev/devPtSoft.c index 49b2417c1..6bb3d1dd5 100644 --- a/src/dev/devPtSoft.c +++ b/src/dev/devPtSoft.c @@ -29,8 +29,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -42,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -80,18 +80,13 @@ static long write_pt(ppt) case (DB_LINK) : status = dbPutLink(&ppt->out.value.db_link,ppt,DBR_SHORT,&ppt->val,1L); if(status!=0) { - if(ppt->nsevnsev = VALID_ALARM; - ppt->nsta = LINK_ALARM; - } + recGblSetSevr(ppt,LINK_ALARM,VALID_ALARM); } else ppt->udf=FALSE; break; case (CA_LINK) : break; default : - if(ppt->nsevnsev = VALID_ALARM; - ppt->nsta = SOFT_ALARM; + if(recGblSetSevr(ppt,WRITE_ALARM,VALID_ALARM)){ if(ppt->stat!=SOFT_ALARM) { strcpy(message,ppt->name); strcat(message,": devPtSoft (write_pt) Illegal OUT field"); diff --git a/src/dev/devSiSoft.c b/src/dev/devSiSoft.c index 1f1d7b17d..c7d07e545 100644 --- a/src/dev/devSiSoft.c +++ b/src/dev/devSiSoft.c @@ -29,7 +29,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros */ @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -111,18 +112,13 @@ static long read_stringin(pstringin) status = dbGetLink(&(pstringin->inp.value.db_link),pstringin,DBR_STRING, pstringin->val,&options,&nRequest); if(status!=0) { - if(pstringin->nsevnsev = VALID_ALARM; - pstringin->nsta = LINK_ALARM; - } + recGblSetSevr(pstringin,LINK_ALARM,VALID_ALARM); } else pstringin->udf = FALSE; break; case (CA_LINK) : break; default : - if(pstringin->nsevnsev = VALID_ALARM; - pstringin->nsta = SOFT_ALARM; + if(recGblSetSevr(pstringin,SOFT_ALARM,VALID_ALARM)){ if(pstringin->stat!=SOFT_ALARM) { strcpy(message,pstringin->name); strcat(message,": devSiSoft (read_stringin) Illegal INP field"); diff --git a/src/dev/devSiTestAsyn.c b/src/dev/devSiTestAsyn.c index e9efc77b4..425e04fba 100644 --- a/src/dev/devSiTestAsyn.c +++ b/src/dev/devSiTestAsyn.c @@ -29,8 +29,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -72,9 +71,8 @@ struct { struct callback { void (*callback)(); int priority; - struct dbAddr dbAddr; + struct dbCommon *prec; WDOG_ID wd_id; - void (*process)(); }; void callbackRequest(); @@ -82,18 +80,18 @@ void callbackRequest(); static void myCallback(pcallback) struct callback *pcallback; { - struct stringinRecord *pstringin=(struct stringinRecord *)(pcallback->dbAddr.precord); + struct stringinRecord *pstringin=(struct stringinRecord *)(pcallback->prec); + struct rset *prset=(struct rset *)(pstringin->rset); dbScanLock(pstringin); - (pcallback->process)(&pcallback->dbAddr); + (*prset->process)(pstringin->pdba); dbScanUnlock(pstringin); } -static long init_record(pstringin,process) +static long init_record(pstringin) struct stringinRecord *pstringin; - void (*process)(); { char message[100]; struct callback *pcallback; @@ -105,12 +103,8 @@ static long init_record(pstringin,process) pstringin->dpvt = (caddr_t)pcallback; pcallback->callback = myCallback; pcallback->priority = priorityLow; - if(dbNameToAddr(pstringin->name,&(pcallback->dbAddr))) { - logMsg("dbNameToAddr failed in init_record for devSiTestAsyn\n"); - exit(1); - } + pcallback->prec = (struct dbCommon *)pstringin; pcallback->wd_id = wdCreate(); - pcallback->process = process; if (pstringin->inp.value.value!=0.0) { sprintf(pstringin->val,"%-14.7g",pstringin->inp.value.value); pstringin->udf = FALSE; @@ -147,9 +141,7 @@ static long read_stringin(pstringin) return(1); } default : - if(pstringin->nsevnsev = VALID_ALARM; - pstringin->nsta = SOFT_ALARM; + if(recGblSetSevr(pstringin,SOFT_ALARM,VALID_ALARM)){ if(pstringin->stat!=SOFT_ALARM) { strcpy(message,pstringin->name); strcat(message,": devSiTestAsyn (read_stringin) Illegal INP field"); diff --git a/src/dev/devSoSoft.c b/src/dev/devSoSoft.c index aa9abf571..2f8cf071c 100644 --- a/src/dev/devSoSoft.c +++ b/src/dev/devSoSoft.c @@ -29,7 +29,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros */ #include @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -77,18 +78,13 @@ static long write_stringout(pstringout) status = dbPutLink(&pstringout->out.value.db_link,pstringout,DBR_STRING, pstringout->val,1L); if(status!=0) { - if(pstringout->nsevnsev = VALID_ALARM; - pstringout->nsta = LINK_ALARM; - } + recGblSetSevr(pstringout,LINK_ALARM,VALID_ALARM); } break; case (CA_LINK) : break; default : - if(pstringout->nsevnsev = VALID_ALARM; - pstringout->nsta = SOFT_ALARM; + if(recGblSetSevr(pstringout,SOFT_ALARM,VALID_ALARM)){ if(pstringout->stat!=SOFT_ALARM) { strcpy(message,pstringout->name); strcat(message,": devSoSoft (write_stringout) Illegal OUT field"); diff --git a/src/dev/devSoTestAsyn.c b/src/dev/devSoTestAsyn.c index 7701f780c..0155697b3 100644 --- a/src/dev/devSoTestAsyn.c +++ b/src/dev/devSoTestAsyn.c @@ -29,8 +29,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -73,27 +72,26 @@ struct { struct callback { void (*callback)(); int priority; - struct dbAddr dbAddr; + struct dbCommon *prec; WDOG_ID wd_id; - void (*process)(); }; void callbackRequest(); static void myCallback(pcallback) struct callback *pcallback; { - struct stringoutRecord *pstringout=(struct stringoutRecord *)(pcallback->dbAddr.precord); + struct stringoutRecord *pstringout=(struct stringoutRecord *)(pcallback->prec); + struct rset *prset=(struct rset *)(pstringout->rset); dbScanLock(pstringout); - (pcallback->process)(&pcallback->dbAddr); + (*prset->process)(pstringout->pdba); dbScanUnlock(pstringout); } -static long init_record(pstringout,process) +static long init_record(pstringout) struct stringoutRecord *pstringout; - void (*process)(); { char message[100]; struct callback *pcallback; @@ -105,12 +103,8 @@ static long init_record(pstringout,process) pstringout->dpvt = (caddr_t)pcallback; pcallback->callback = myCallback; pcallback->priority = priorityLow; - if(dbNameToAddr(pstringout->name,&(pcallback->dbAddr))) { - logMsg("dbNameToAddr failed in init_record for devSoTestAsyn\n"); - exit(1); - } + pcallback->prec = (struct dbCommon *)pstringout; pcallback->wd_id = wdCreate(); - pcallback->process = process; break; default : strcpy(message,pstringout->name); @@ -143,9 +137,7 @@ static long write_stringout(pstringout) return(1); } default : - if(pstringout->nsevnsev = VALID_ALARM; - pstringout->nsta = SOFT_ALARM; + if(recGblSetSevr(pstringout,SOFT_ALARM,VALID_ALARM)){ if(pstringout->stat!=SOFT_ALARM) { strcpy(message,pstringout->name); strcat(message,": devSoTestAsyn (read_stringout) Illegal OUT field"); diff --git a/src/dev/devWfSoft.c b/src/dev/devWfSoft.c index 2c7a7bdc1..55ad95dc9 100644 --- a/src/dev/devWfSoft.c +++ b/src/dev/devWfSoft.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -43,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -106,19 +106,14 @@ static long read_wf(pwf) nRequest=pwf->nelm; if(dbGetLink(&(pwf->inp.value.db_link),pwf,pwf->ftvl, pwf->bptr,&options,&nRequest)!=0){ - if(pwf->nsev < VALID_ALARM) { - pwf->nsev = VALID_ALARM; - pwf->nsta = LINK_ALARM; - } + recGblSetSevr(pwf,LINK_ALARM,VALID_ALARM); } pwf->nord = nRequest; break; case (CA_LINK) : break; default : - if(pwf->nsevnsev = VALID_ALARM; - pwf->nsta = SOFT_ALARM; + if(recGblSetSevr(pwf,SOFT_ALARM,VALID_ALARM)){ if(pwf->stat!=SOFT_ALARM) { strcpy(message,pwf->name); strcat(message,": devWfSoft (read_wf) Illegal INP field"); diff --git a/src/dev/devWfTestAsyn.c b/src/dev/devWfTestAsyn.c index 2a7a14183..8af87fd28 100644 --- a/src/dev/devWfTestAsyn.c +++ b/src/dev/devWfTestAsyn.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -44,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -72,24 +72,23 @@ struct { struct callback { void (*callback)(); int priority; - struct dbAddr dbAddr; + struct dbCommon *prec; WDOG_ID wd_id; - void (*process)(); }; void callbackRequest(); static void myCallback(pcallback) struct callback *pcallback; { - struct wfRecord *pwf=(struct wfRecord *)(pcallback->dbAddr.precord); + struct waveformRecord *pwf=(struct waveformRecord *)(pcallback->prec); + struct rset *prset=(struct rset *)(pwf->rset); dbScanLock(pwf); - (pcallback->process)(&pcallback->dbAddr); + (*prset->process)(pwf->pdba); dbScanUnlock(pwf); } -static long init_record(pwf,process) +static long init_record(pwf) struct waveformRecord *pwf; - void (*process)(); { char message[100]; struct callback *pcallback; @@ -101,12 +100,8 @@ static long init_record(pwf,process) pwf->dpvt = (caddr_t)pcallback; pcallback->callback = myCallback; pcallback->priority = priorityLow; - if(dbNameToAddr(pwf->name,&(pcallback->dbAddr))) { - logMsg("dbNameToAddr failed in init_record for devWfTestAsyn\n"); - exit(1); - } + pcallback->prec = (struct dbCommon *)pwf; pcallback->wd_id = wdCreate(); - pcallback->process = process; pwf->nord = 0; break; default : @@ -140,9 +135,7 @@ static long read_wf(pwf) return(1); } default : - if(pwf->nsevnsev = VALID_ALARM; - pwf->nsta = SOFT_ALARM; + if(recGblSetSevr(pwf,SOFT_ALARM,VALID_ALARM)){ if(pwf->stat!=SOFT_ALARM) { strcpy(message,pwf->name); strcat(message,": devWfTestAsyn (read_wf) Illegal INP field"); diff --git a/src/dev/devWfXy566Sc.c b/src/dev/devWfXy566Sc.c index 403bea54c..c8563426f 100644 --- a/src/dev/devWfXy566Sc.c +++ b/src/dev/devWfXy566Sc.c @@ -30,8 +30,7 @@ * * Modification Log: * ----------------- - * .01 mm-dd-yy iii Comment - * .02 mm-dd-yy iii Comment + * .01 11-11-91 jba Moved set of alarm stat and sevr to macros * ... */ @@ -43,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -92,11 +92,7 @@ static void myCallback(pcallback,no_read,pdata) } else { recGblRecSupError(S_db_badField,&pcallback->dbAddr, "read_wf - illegal ftvl"); - if(pwf->nsevnsta = READ_ALARM; - pwf->nsev = VALID_ALARM; - - } + recGblSetSevr(pwf,READ_ALARM,VALID_ALARM); } (pcallback->process)(&pcallback->dbAddr); dbScanUnlock(pwf); @@ -159,11 +155,7 @@ struct waveformRecord *pwf; pwf->busy = TRUE; if(wf_driver(XY566WF,pvmeio->card,myCallback,pwf->dpvt)<0) { - if(pwf->nsevnsta = READ_ALARM; - pwf->nsev = VALID_ALARM; - - } + recGblSetSevr(pwf,READ_ALARM,VALID_ALARM); pwf->busy = FALSE; return(0); }