added headers and some fixes

This commit is contained in:
Janet B. Anderson
1991-06-07 16:57:59 +00:00
parent 96a09018d5
commit e60abd37d5
25 changed files with 830 additions and 742 deletions

View File

@@ -1,27 +1,28 @@
/* share/src/libCom/calcPerform $Id$ */
/*
* Author: Julie Sander and Bob Dalesio
* Date: 7-27-87
* Author: Julie Sander and Bob Dalesio
* Date: 07-27-87
*
* Control System Software for the GTA Project
* Experimental Physics and Industrial Control System (EPICS)
*
* Copyright 1988, 1989, the Regents of the University of California.
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
@@ -84,15 +85,9 @@
#include <stdio.h>
#include <dbDefs.h>
#include <post.h>
#include <math.h>
double random();
/* the floating point math routines need to be declared as doubles */
double sqrt(),log(),log10();
double acos(),asin(),atan();
double cos(),sin(),tan();
double cosh(),sinh(),tanh();
double srand(),rand();
#define NOT_SET 0
#define TRUE_COND 1
#define FALSE_COND 2
@@ -102,11 +97,11 @@ double *parg;
double *presult;
char *post;
{
register double *pstacktop; /* stack of values */
double *pstacktop; /* stack of values */
double stack[80];
register double temp;
double temp;
short temp1;
register short i;
short i;
double *top;
int itop; /* integer top value */
int inexttop; /* ineteger next to top value */
@@ -125,73 +120,61 @@ char *post;
case FETCH_A:
++pstacktop;
*pstacktop = parg[0];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_B:
++pstacktop;
*pstacktop = parg[1];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_C:
++pstacktop;
*pstacktop = parg[2];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_D:
++pstacktop;
*pstacktop = parg[3];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_E:
++pstacktop;
*pstacktop = parg[4];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_F:
++pstacktop;
*pstacktop = parg[5];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_G:
++pstacktop;
*pstacktop = parg[6];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_H:
++pstacktop;
*pstacktop = parg[7];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_I:
++pstacktop;
*pstacktop = parg[8];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_J:
++pstacktop;
*pstacktop = parg[9];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_K:
++pstacktop;
*pstacktop = parg[10];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_L:
++pstacktop;
*pstacktop = parg[11];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
@@ -450,7 +433,7 @@ char *post;
* seed = (multy * seed) + addy Random Number Generator by Knuth
* SemiNumerical Algorithms
* Chapter 1
* randy = 1.0 / (seed & 0xff) To normalize the number between 0 - 1
* randy = seed / 65535.0 To normalize the number between 0 - 1
*/
static unsigned short seed = 0xa3bf;
static unsigned short multy = 191 * 8 + 5; /* 191 % 8 == 5 */
@@ -461,7 +444,7 @@ static double random()
/* random number */
seed = (seed * multy) + addy;
randy = 1.0 / (seed & 0xffff);
randy = seed / 65535.0;
/* between 0 - 1 */
return(randy);

View File

@@ -1,31 +1,30 @@
/* share/src/libCom/postfix.c $Id$ */
/* Subroutines used to convert an infix expression to a postfix expression */
/*
* Author: Bob Dalesio
* Date: 12-12-86
*
* Subroutines used to convert an infix expression to a postfix expression
* Experimental Physics and Industrial Control System (EPICS)
*
* Author: Bob Dalesio
* Date: 12-12-86
* @(#)postfix.c 1.3 12/6/90
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Control System Software for the GTA Project
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Copyright 1988, 1989, the Regents of the University of California.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Andy Kozubal, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-6508
* E-mail: kozubal@k2.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
@@ -132,8 +131,8 @@ static struct expression_element elements[] = {
"ABS", 7, 8, UNARY_OPERATOR, ABS_VAL, /* absolute value */
"NOT", 7, 8, UNARY_OPERATOR, UNARY_NEG, /* unary negate */
"SQR", 7, 8, UNARY_OPERATOR, SQU_RT, /* square root */
"LOG", 7, 8, UNARY_OPERATOR, LOG_10, /* log 10 */
"LOGE", 7, 8, UNARY_OPERATOR, LOG_E, /* log E */
"LOG", 7, 8, UNARY_OPERATOR, LOG_10, /* log 10 */
"ACOS", 7, 8, UNARY_OPERATOR, ACOS, /* arc cosine */
"ASIN", 7, 8, UNARY_OPERATOR, ASIN, /* arc sine */
"ATAN", 7, 8, UNARY_OPERATOR, ATAN, /* arc tangent */

View File

@@ -1,27 +1,28 @@
/* share/src/libCom/calcPerform $Id$ */
/*
* Author: Julie Sander and Bob Dalesio
* Date: 7-27-87
* Author: Julie Sander and Bob Dalesio
* Date: 07-27-87
*
* Control System Software for the GTA Project
* Experimental Physics and Industrial Control System (EPICS)
*
* Copyright 1988, 1989, the Regents of the University of California.
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
@@ -84,15 +85,9 @@
#include <stdio.h>
#include <dbDefs.h>
#include <post.h>
#include <math.h>
double random();
/* the floating point math routines need to be declared as doubles */
double sqrt(),log(),log10();
double acos(),asin(),atan();
double cos(),sin(),tan();
double cosh(),sinh(),tanh();
double srand(),rand();
#define NOT_SET 0
#define TRUE_COND 1
#define FALSE_COND 2
@@ -102,11 +97,11 @@ double *parg;
double *presult;
char *post;
{
register double *pstacktop; /* stack of values */
double *pstacktop; /* stack of values */
double stack[80];
register double temp;
double temp;
short temp1;
register short i;
short i;
double *top;
int itop; /* integer top value */
int inexttop; /* ineteger next to top value */
@@ -125,73 +120,61 @@ char *post;
case FETCH_A:
++pstacktop;
*pstacktop = parg[0];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_B:
++pstacktop;
*pstacktop = parg[1];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_C:
++pstacktop;
*pstacktop = parg[2];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_D:
++pstacktop;
*pstacktop = parg[3];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_E:
++pstacktop;
*pstacktop = parg[4];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_F:
++pstacktop;
*pstacktop = parg[5];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_G:
++pstacktop;
*pstacktop = parg[6];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_H:
++pstacktop;
*pstacktop = parg[7];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_I:
++pstacktop;
*pstacktop = parg[8];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_J:
++pstacktop;
*pstacktop = parg[9];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_K:
++pstacktop;
*pstacktop = parg[10];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
case FETCH_L:
++pstacktop;
*pstacktop = parg[11];
if(*pstacktop>0.0 && *pstacktop<udfDtest) return(-1);
break;
@@ -450,7 +433,7 @@ char *post;
* seed = (multy * seed) + addy Random Number Generator by Knuth
* SemiNumerical Algorithms
* Chapter 1
* randy = 1.0 / (seed & 0xff) To normalize the number between 0 - 1
* randy = seed / 65535.0 To normalize the number between 0 - 1
*/
static unsigned short seed = 0xa3bf;
static unsigned short multy = 191 * 8 + 5; /* 191 % 8 == 5 */
@@ -461,7 +444,7 @@ static double random()
/* random number */
seed = (seed * multy) + addy;
randy = 1.0 / (seed & 0xffff);
randy = seed / 65535.0;
/* between 0 - 1 */
return(randy);

View File

@@ -1,31 +1,32 @@
/* share/src/libCom/post.h $Id$ */
/*
* Author: Bob Dalesio
* Date: 9-21-88
* @(#)post.h @(#)post.h 1.1 12/6/90
* Author: Bob Dalesio
* Date: 9-21-88
*
* Control System Software for the GTA Project
* Experimental Physics and Industrial Control System (EPICS)
*
* Copyright 1988, 1989, the Regents of the University of California.
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Andy Kozubal, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-6508
* E-mail: kozubal@k2.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modifcation Log
* ---------------
* Modification Log:
* -----------------
* .01 01-11-89 lrd add right and left shift
* .02 02-01-89 lrd add trig functions
*/

View File

@@ -1,31 +1,30 @@
/* share/src/libCom/postfix.c $Id$ */
/* Subroutines used to convert an infix expression to a postfix expression */
/*
* Author: Bob Dalesio
* Date: 12-12-86
*
* Subroutines used to convert an infix expression to a postfix expression
* Experimental Physics and Industrial Control System (EPICS)
*
* Author: Bob Dalesio
* Date: 12-12-86
* @(#)postfix.c 1.3 12/6/90
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Control System Software for the GTA Project
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Copyright 1988, 1989, the Regents of the University of California.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Andy Kozubal, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-6508
* E-mail: kozubal@k2.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
@@ -132,8 +131,8 @@ static struct expression_element elements[] = {
"ABS", 7, 8, UNARY_OPERATOR, ABS_VAL, /* absolute value */
"NOT", 7, 8, UNARY_OPERATOR, UNARY_NEG, /* unary negate */
"SQR", 7, 8, UNARY_OPERATOR, SQU_RT, /* square root */
"LOG", 7, 8, UNARY_OPERATOR, LOG_10, /* log 10 */
"LOGE", 7, 8, UNARY_OPERATOR, LOG_E, /* log E */
"LOG", 7, 8, UNARY_OPERATOR, LOG_10, /* log 10 */
"ACOS", 7, 8, UNARY_OPERATOR, ACOS, /* arc cosine */
"ASIN", 7, 8, UNARY_OPERATOR, ASIN, /* arc sine */
"ATAN", 7, 8, UNARY_OPERATOR, ATAN, /* arc tangent */

View File

@@ -1,31 +1,33 @@
/* recAi.c */
/* share/src/rec $Id$ */
/* recAi.c - Record Support Routines for Analog Input records
/* share/src/rec $Id$ */
/* recAi.c - Record Support Routines for Analog Input records */
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 7-14-89
*
* Author: Bob Dalesio
* Date: 7-9-87
* @(#)iocai.c 1.1 9/22/88
* Experimental Physics and Industrial Control System (EPICS)
*
* Control System Software for the GTA Project
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Copyright 1988, 1989, the Regents of the University of California.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
*
* Modification Log:
* -----------------
@@ -122,6 +124,12 @@ struct aidset { /* analog input dset */
DEVSUPFUN special_linconv;
};
/*NOTE FOLLOWING IS TAKEN FROM dbScan.c */
#define E_IO_INTERRUPT 7
/*Following from timing system */
extern unsigned int gts_trigger_counter;
void alarm();
void convert();
void monitor();
@@ -170,6 +178,15 @@ static long process(paddr)
return(S_dev_missingSup);
}
/* event throttling */
if (pai->scan == E_IO_INTERRUPT){
if ((pai->evnt != 0) && (gts_trigger_counter != 0)){
if ((gts_trigger_counter % pai->evnt) != 0){
return(0);
}
}
}
/*pact must not be set true until read_ai is called*/
status=(*pdset->read_ai)(pai); /* read the new value */
pai->pact = TRUE;
@@ -285,9 +302,9 @@ static void alarm(pai)
double ftemp;
double val=pai->val;
if(val>0.0 && val<udfDtest){
if(pai->udf == TRUE ){
if (pai->nsev<VALID_ALARM){
pai->nsta = SOFT_ALARM;
pai->nsta = UDF_ALARM;
pai->nsev = VALID_ALARM;
}
return;
@@ -349,8 +366,7 @@ struct aiRecord *pai;
val = pai->rval + pai->roff;
/* adjust slope and offset */
if(aslo < 0.0 || aslo>udfFtest) val = val * aslo;
if(aoff < 0.0 || aoff>udfFtest) val = val + aoff;
val = val * aslo + aoff;
/* convert raw to engineering units and signal units */
if(pai->linr == 0) {
@@ -411,6 +427,7 @@ struct aiRecord *pai;
}else{
pai->val = val;
}
pai->udf = FALSE;
return;
}

View File

@@ -1,30 +1,32 @@
/* recAo.c */
/* share/src/rec $Id$ */
/* recAo.c - Record Support Routines for Analog Output records
/* share/src/rec $Id$ */
/* recAo.c - Record Support Routines for Analog Output records */
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 7-14-89
*
* Author: Bob Dalesio
* Date: 7-9-87
* Experimental Physics and Industrial Control System (EPICS)
*
* Control System Software for the GTA Project
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Copyright 1988, 1989, the Regents of the University of California.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
@@ -109,7 +111,7 @@ struct aodset { /* analog input dset */
long number;
DEVSUPFUN dev_report;
DEVSUPFUN init;
DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/
DEVSUPFUN init_record; /*returns: (0,2)=>(success,success no convert)*/
DEVSUPFUN get_ioint_info;
DEVSUPFUN write_ao;/*(0,1)=>success and */
/*(continue, don`t continue) */
@@ -140,8 +142,8 @@ static long init_record(pao)
return(S_dev_noDSET);
}
/* get the initial value if dol is a constant*/
if (pao->dol.type == CONSTANT &&
(pao->dol.value.value<=0.0 || pao->dol.value.value>udfFtest)){
if (pao->dol.type == CONSTANT ){
pao->udf = FALSE;
pao->val = pao->dol.value.value;
}
/* must have write_ao function defined */
@@ -151,14 +153,16 @@ static long init_record(pao)
}
if( pdset->init_record ) {
if((status=(*pdset->init_record)(pao,process))) return(status);
if(pao->rval != udfLong) { /* convert */
if(status == 0) { /* convert */
if (pao->linr == LINEAR){
pao->val = (pao->rval + pao->roff)*pao->eslo + pao->egul;
}else{
pao->val = pao->rval;
}
}
pao->udf = FALSE;
}
pao->pval = pao->val;
return(0);
}
@@ -291,9 +295,9 @@ static void alarm(pao)
double ftemp;
double val=pao->val;
if(val>0.0 && val<udfDtest){
if(pao->udf == TRUE ){
if (pao->nsev<VALID_ALARM){
pao->nsta = SOFT_ALARM;
pao->nsta = UDF_ALARM;
pao->nsev = VALID_ALARM;
}
return;
@@ -363,9 +367,7 @@ static int convert(pao)
save_pact = pao->pact;
pao->pact = TRUE;
/* don't allow dbputs to val field */
if(pao->pval<=0.0 || pao->pval>udfDtest){
pao->val=pao->pval;
}
pao->val=pao->pval;
status = dbGetLink(&pao->dol.value.db_link,pao,DBR_DOUBLE,
&value,&options,&nRequest);
pao->pact = save_pact;
@@ -379,14 +381,6 @@ static int convert(pao)
if (pao->oif == OUTPUT_INCREMENTAL) value += pao->val;
} else value = pao->val;
if(value>0.0 && value<udfDtest) {
if(pao->nsev<VALID_ALARM) {
pao->nsta = SOFT_ALARM;
pao->nsev = VALID_ALARM;
}
return(1);
}
/* check drive limits */
if(pao->drvh > pao->drvl) {
if (value > pao->drvh) value = pao->drvh;
@@ -394,11 +388,11 @@ static int convert(pao)
}
pao->val = value;
pao->pval = value;
pao->udf = FALSE;
if(pao->oval>0.0 && pao->oval<udfDtest) pao->oval = value;
/* now set value equal to desired output value */
/* apply the output rate of change */
if ( pao->oroc>=udfDtest){/*must be defined and >0*/
if ( pao->oroc ){/*must be defined and >0*/
float diff;
diff = value - pao->oval;

View File

@@ -1,30 +1,33 @@
/* recBi.c */
/* share/src/rec $Id$ */
/* recBi.c - Record Support Routines for Binary Input records
/* share/src/rec $Id$ */
/* recBi.c - Record Support Routines for Binary Input records */
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 7-14-89
*
* Author: Bob Dalesio
* Date: 7-9-87
* Experimental Physics and Industrial Control System (EPICS)
*
* Control System Software for the GTA Project
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Copyright 1988, 1989, the Regents of the University of California.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
*
* Modification Log:
* -----------------
@@ -150,6 +153,7 @@ static long process(paddr)
if(status==0) { /* convert rval to val */
if(pbi->rval==0) pbi->val =0;
else pbi->val = 1;
pbi->udf = FALSE;
}
/* status is one if an asynchronous record is being processed*/
else if(status==2) status=0;
@@ -223,9 +227,9 @@ static void alarm(pbi)
unsigned short val = pbi->val;
if(val==udfUshort){
if(pbi->udf == TRUE){
if (pbi->nsev<VALID_ALARM){
pbi->nsta = SOFT_ALARM;
pbi->nsta = UDF_ALARM;
pbi->nsev = VALID_ALARM;
}
return;
@@ -246,7 +250,6 @@ static void alarm(pbi)
}
/* check for cos alarm */
if(pbi->lalm==udfUshort) pbi->lalm = val;
if(val == pbi->lalm) return;
if (pbi->nsev<pbi->cosv) {
pbi->nsta = COS_ALARM;

View File

@@ -1,30 +1,32 @@
/* recBo.c */
/* share/src/rec $Id$ */
/* recBo.c - Record Support Routines for Binary Output records
/* share/src/rec $Id$ */
/* recBo.c - Record Support Routines for Binary Output records */
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 7-14-89
*
* Author: Bob Dalesio
* Date: 7-17-87
* Experimental Physics and Industrial Control System (EPICS)
*
* Control System Software for the GTA Project
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Copyright 1988, 1989, the Regents of the University of California.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
@@ -112,9 +114,9 @@ struct bodset { /* binary output dset */
long number;
DEVSUPFUN dev_report;
DEVSUPFUN init;
DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/
DEVSUPFUN init_record; /*returns:(0,2)=>(success,success no convert*/
DEVSUPFUN get_ioint_info;
DEVSUPFUN write_bo;/*(-1,0,1)=>(failure,success,don't Continue*/
DEVSUPFUN write_bo;/*returns: (-1,0,1)=>(failure,success,don't continue)*/
};
@@ -148,7 +150,7 @@ static long init_record(pbo)
struct boRecord *pbo;
{
struct bodset *pdset;
long status;
long status=0;
struct callback *pcallback;
if(!(pdset = (struct bodset *)(pbo->dset))) {
@@ -161,10 +163,10 @@ static long init_record(pbo)
return(S_dev_missingSup);
}
/* get the initial value */
if (pbo->dol.type == CONSTANT
&& (pbo->dol.value.value<=0.0 || pbo->dol.value.value>=udfFtest)){
if (pbo->dol.type == CONSTANT){
if (pbo->dol.value.value == 0) pbo->val = 0;
else pbo->val = 1;
pbo->udf = FALSE;
}
pcallback = (struct callback *)(calloc(1,sizeof(struct callback)));
pbo->dpvt = (caddr_t)pcallback;
@@ -175,13 +177,14 @@ static long init_record(pbo)
exit(1);
}
if( pdset->init_record ) {
if((status=(*pdset->init_record)(pbo,process))) return(status);
if(pbo->rval!=udfUlong) { /* convert*/
if(pbo->rval==0) pbo->val = 0;
else pbo->val = 1;
}
status=(*pdset->init_record)(pbo,process);
if(status==0) {
if(pbo->rval==0) pbo->val = 0;
else pbo->val = 1;
pbo->udf = FALSE;
} else if (status==2) status=0;
}
return(0);
return(status);
}
static long process(paddr)
@@ -209,6 +212,7 @@ static long process(paddr)
pbo->pact = FALSE;
if(status==0){
pbo->val = val;
pbo->udf = FALSE;
}else {
if(pbo->nsev < VALID_ALARM) {
pbo->nsev = VALID_ALARM;
@@ -216,25 +220,19 @@ static long process(paddr)
}
}
}
if(pbo->mask != udfUlong) {
if ( pbo->mask != 0 ) {
if(pbo->val==0) pbo->rval = 0;
else pbo->rval = pbo->mask;
}
}
if(status==0) {
if(pbo->val==udfEnum) {
if(pbo->nsev < VALID_ALARM) {
pbo->nsev = VALID_ALARM;
pbo->nsta = SOFT_ALARM;
}
status = 0;
} else status=(*pdset->write_bo)(pbo); /* write the new value */
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);
tsLocalTime(&pbo->time);
wait_time = (int)(pbo->high) * vxTicksPerSecond; /* seconds to ticks */
wait_time = (int)((pbo->high) * vxTicksPerSecond); /* seconds to ticks */
if(pbo->val==1 && wait_time>0) {
struct callback *pcallback;
@@ -325,7 +323,6 @@ static void alarm(pbo)
}
/* check for cos alarm */
if(pbo->lalm==udfUshort) pbo->lalm = val;
if(val == pbo->lalm) return;
if (pbo->nsev<pbo->cosv) {
pbo->nsta = COS_ALARM;

View File

@@ -1,30 +1,32 @@
/* recCalc.c */
/* share/src/rec $Id$ */
/* recCalc.c - Record Support Routines for Calculation records
/* recCalc.c - Record Support Routines for Calculation records */
/*
* Original Author: Julie Sander and Bob Dalesio
* Current Author: Marty Kraimer
* Date: 7-27-87
*
* Author: Julie Sander and Bob Dalesio
* Date: 7-27-87
* Experimental Physics and Industrial Control System (EPICS)
*
* Control System Software for the GTA Project
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Copyright 1988, 1989, the Regents of the University of California.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
@@ -152,7 +154,7 @@ static long process(paddr)
pcalc->nsta = CALC_ALARM;
pcalc->nsev = VALID_ALARM;
}
}
} else pcalc->udf = FALSE;
}
tsLocalTime(&pcalc->time);
/* check for alarms */
@@ -260,10 +262,10 @@ static void alarm(pcalc)
double ftemp;
double val=pcalc->val;
if(val>0.0 && val<udfDtest) {
if(pcalc->udf == TRUE ) {
if(pcalc->nsev<VALID_ALARM) {
pcalc->nsev = VALID_ALARM;
pcalc->nsta = SOFT_ALARM;
pcalc->nsta = UDF_ALARM;
}
return;
}
@@ -400,13 +402,6 @@ struct calcRecord *pcalc;
}
return(-1);
}
if(*pvalue>0.0 && *pvalue<udfDtest) {
if(pcalc->nsev<VALID_ALARM) {
pcalc->nsev=VALID_ALARM;
pcalc->nsta=SOFT_ALARM;
}
return(-1);
}
}
return(0);

View File

@@ -1,31 +1,32 @@
/* recCompress.c */
/* share/src/rec $Id$ */
/* recCompress.c - Record Support Routines for Compression records
/* recCompress.c - Record Support Routines for Compression records*/
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 7-14-89
*
* Author: Bob Dalesio
* Date: 7-14-89
* Experimental Physics and Industrial Control System (EPICS)
*
* Control System Software for the GTA Project
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Copyright 1988, 1989, the Regents of the University of California.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
@@ -176,6 +177,7 @@ static long process(paddr)
/* check event list */
if(status!=1) {
pcompress->udf=FALSE;
tsLocalTime(&pcompress->time);
monitor(pcompress);
/* process the forward scan link record */
@@ -361,6 +363,7 @@ static void put_value(pcompress,psource,n)
if(nuse>nsam) nuse=nsam;
pcompress->off = offset;
pcompress->nuse = nuse;
return;
}
static int compress_array(pcompress,psource,no_elements)

View File

@@ -1,30 +1,32 @@
/* recFanout.c */
/* share/src/rec $Id$ */
/* recFanout.c - Record Support Routines for Fanout records
/* recFanout.c - Record Support Routines for Fanout records */
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 12-20-88
*
* Author: Bob Dalesio
* Date: 12-20-88
* Experimental Physics and Industrial Control System (EPICS)
*
* Control System Software for the GTA Project
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Copyright 1988, 1989, the Regents of the University of California.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
@@ -126,6 +128,7 @@ static long process(paddr)
pfanout->nsta = SOFT_ALARM;
}
}
pfanout->udf=FALSE;
tsLocalTime(&pfanout->time);
/* check monitors*/
/* get previous stat and sevr and new stat and sevr*/

View File

@@ -1,8 +1,8 @@
/* recHistogram.c */
/* share/src/rec $Id$ */
/* recHistogram.c - Record Support Routines for Histogram records
*
/* recHistogram.c - Record Support Routines for Histogram records */
/*
* Author: Janet Anderson
* Date: 5/20/91
*
@@ -49,6 +49,7 @@
#include <link.h>
#include <special.h>
#include <recSup.h>
#include <histogramRecord.h>
/* Create RSET - Record Support Entry Table*/
#define report NULL
@@ -57,9 +58,9 @@ long init_record();
long process();
#define special NULL
long get_value();
#define cvt_dbaddr NULL
long cvt_dbaddr();
long get_array_info();
long put_array_info();
#define put_array_info NULL
#define get_units NULL
#define get_precision NULL
#define get_enum_str NULL
@@ -89,46 +90,44 @@ struct rset histogramRSET={
get_control_double,
get_alarm_double };
};
void monitor();
static long put_count(phistogram)
struct histogramRecord *phistogram;
{
if(phistogram->aelm<0 || phistogram->aelm>=nelm) {
if (phistogram->nsev<VALID_ALARM) {
phistogram->nsta = SOFT_ALARM;
phistogram->nsev = VALID_ALARM;
double width,temp;
unsigned long *pdest;
int i;
if(phistogram->lreg >= phistogram->ureg) {
if (phistogram->nsev<VALID_ALARM) {
phistogram->stat = SOFT_ALARM;
phistogram->sevr = VALID_ALARM;
return(-1);
}
return(0);
}
if(phistogram->sgnl<phistogram->lreg || phistogram->sgnl >= phistogram->ureg) return(0);
width=(phistogram->ureg-phistogram->lreg)/phistogram->nelm;
temp=phistogram->sgnl-phistogram->lreg;
for (i=1;i<=phistogram->nelm;i++){
if (temp<=(double)i*width) break;
}
if(phistogram->fta == 0) {
if(*(phistogram->aptr+phistogram->aelm== udfUshort) {
if (phistogram->nsev<MAJOR_ALARM) {
phistogram->nsta = SOFT_ALARM;
phistogram->nsev = MAJOR_ALARM;
}
return(0);
} else {
if(*(phistogram->aptr+phistogram->aelm==udfUlong) {
if (phistogram->nsev<MAJOR_ALARM) {
phistogram->nsta = SOFT_ALARM;
phistogram->nsev = MAJOR_ALARM;
}
return(0);
}
*(phistogram->aptr+phistogram->aelm) ++;
pdest=phistogram->bptr+i-1;
if ( *pdest==4294967294) *pdest=0.0;
(*pdest)++;
return(0);
}
static long init_histogram(phistogram)
struct histogramRecord *phistogram;
{
int i;
for (i=0;i<=phistogram->nelm;i++)
*(phistogram->aptr + i)=0;
printf("phistogram->bptr=%x \n",phistogram->bptr);
for (i=0;i<=phistogram->nelm-1;i++)
printf("phistogram->bptr+i=%x \n",phistogram->bptr+i);
*(phistogram->bptr+i)=0.0;
phistogram->init=0;
return(0);
}
}
static long init_record(phistogram)
struct histogramRecord *phistogram;
@@ -140,25 +139,21 @@ static long init_record(phistogram)
/* This routine may get called twice. Once by cvt_dbaddr. Once by iocInit*/
if(phistogram->bptr==NULL) {
if(phistogram->nelm<=0) phistogram->nelm=1;
if(phistogram->fta == 0) {
size=2;
phistogram->bptr = (char *)calloc(phistogram->nelm,size);
} else {
if(phistogram->fta<0|| phistogram->fta>1) phistogram->fta=1;
size=4;
phistogram->bptr = (char *)calloc(phistogram->nelm,size);
}
phistogram->bptr = (unsigned long *)calloc(phistogram->nelm,sizeof(long));
}
/* this initialization may not be necessary*/
/* initialize the array */
init_histogram(phistogram);
/* initialize the array element number */
if (ppid->ael.type == CONSTANT)
ppid->aelm = ppid->ael.value.value;
phistogram->udf = FALSE;
/* increment frequency in array */
put_count(phistogram);
/* initialize the array element number if CONSTANT and nonzero */
if (phistogram->svl.type == CONSTANT && phistogram->svl.value.value != 0.){
phistogram->sgnl = phistogram->svl.value.value;
/* increment frequency in array */
put_count(phistogram);
}
return(0);
}
@@ -167,13 +162,13 @@ static long process(paddr)
{
struct histogramRecord *phistogram=(struct histogramRecord *)(paddr->precord);
struct histogramdset *pdset = (struct histogramdset *)(phistogram->dset);
long status;
long optionsi=0;
long status=0;
long options=0;
long nRequest=1;
/* intialize the histogram array and return when init is nonzero */
/* intialize the histogram array and return if init is nonzero */
if (phistogram->init != 0){
init_histogram(histogram);
init_histogram(phistogram);
tsLocalTime(&phistogram->time);
monitor(phistogram);
return(0);
@@ -182,18 +177,18 @@ static long process(paddr)
phistogram->pact = TRUE;
/* fetch the array element number */
if(phistogram->ael.type == DB_LINK){
if(dbGetLink(&(phistogram->ael.value.db_link),phistogram,DBR_SHORT,
&(phistogram->aelm),&options,&nRequest)!=NULL) {
if(phistogram->svl.type == DB_LINK){
status=dbGetLink(&(phistogram->svl.value.db_link),phistogram,DBR_DOUBLE,
&(phistogram->sgnl),&options,&nRequest);
if(status!=0) {
if (phistogram->nsev<VALID_ALARM) {
phistogram->stat = READ_ALARM;
phistogram->sevr = VALID_ALARM;
return(0);
}
}
}
/* increment frequency in histogram array */
put_count(phistogram);
if(status==0) put_count(phistogram);
tsLocalTime(&phistogram->time);
@@ -204,7 +199,7 @@ static long process(paddr)
if (phistogram->flnk.type==DB_LINK) dbScanPassive(phistogram->flnk.value.db_link.pdbAddr);
phistogram->pact=FALSE;
return(status);
return(0);
}
static void monitor(phistogram)
@@ -247,10 +242,11 @@ static long get_value(phistogram,pvdes)
{
pvdes->no_elements=phistogram->nelm;
pvdes->pvalue = phistogram->bptr;
pvdes->field_type = phistogram->ftvl;
(unsigned long *)(pvdes->pvalue) = phistogram->bptr;
pvdes->field_type = DBF_ULONG;
return(0);
}
static long cvt_dbaddr(paddr)
struct dbAddr *paddr;
@@ -261,10 +257,9 @@ static long cvt_dbaddr(paddr)
if(phistogram->bptr==NULL) init_record(phistogram);
paddr->pfield = (caddr_t)(phistogram->bptr);
paddr->no_elements = phistogram->nelm;
paddr->field_type = phistogram->ftvl;
if(phistogram->ftvl==0) paddr->field_size = MAX_STRING_SIZE;
else paddr->field_size = sizeofTypes[phistogram->ftvl];
paddr->dbr_field_type = phistogram->ftvl;
paddr->field_type = DBF_ULONG;
paddr->field_size = sizeof(long);
paddr->dbr_field_type = DBF_ULONG;
return(0);
}
@@ -279,13 +274,3 @@ static long get_array_info(paddr,no_elements,offset)
*offset = 0;
return(0);
}
static long put_array_info(paddr,nNew)
struct dbAddr *paddr;
long nNew;
{
struct histogramRecord *phistogram=(struct histogramRecord *)paddr->precord;
phistogram->nelm = nNew;
return(0);
}

View File

@@ -1,30 +1,32 @@
/* recMbbi.c */
/* share/src/rec $Id$ */
/* recMbbi.c - Record Support Routines for multi bit binary Input records
/* recMbbi.c - Record Support Routines for multi bit binary Input records */
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 5-9-88
*
* Author: Bob Dalesio
* Date: 5-9-88
* Experimental Physics and Industrial Control System (EPICS)
*
* Control System Software for the GTA Project
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Copyright 1988, 1989, the Regents of the University of California.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
@@ -122,7 +124,7 @@ static void init_common(pmbbi)
pstate_values = &(pmbbi->zrvl);
pmbbi->sdef = FALSE;
for (i=0; i<16; i++) {
if (*(pstate_values+i) != udfUlong) {
if (*(pstate_values+i) != 0) {
pmbbi->sdef = TRUE;
return;
}
@@ -184,19 +186,20 @@ static long process(paddr)
if(pmbbi->shft>0) rval >>= pmbbi->shft;
if (pmbbi->sdef){
pstate_values = &(pmbbi->zrvl);
pmbbi->val = udfUshort;/* initalize to unknown state*/
if(rval!=udfUlong) {
for (i = 0; i < 16; i++){
if (*pstate_values == rval){
pmbbi->val = i;
break;
}
pstate_values++;
}
pmbbi->val = 65535; /* initalize to unknown state*/
pmbbi->udf = TRUE;
for (i = 0; i < 16; i++){
if (*pstate_values == rval){
pmbbi->val = i;
pmbbi->udf = FALSE;
break;
}
pstate_values++;
}
}else{
/* the raw value is the desired value */
pmbbi->val = (unsigned short)rval;
pmbbi->udf = FALSE;
}
}
else if(status == 2) status = 0;
@@ -269,11 +272,15 @@ static long get_enum_strs(paddr,pes)
struct mbbiRecord *pmbbi=(struct mbbiRecord *)paddr->precord;
char *psource;
int i;
short no_str;
pes->no_str = 16;
no_str = 0;
bzero(pes->strs,sizeof(pes->strs));
for(i=0,psource=(pmbbi->zrst); i<pes->no_str; i++, psource += sizeof(pmbbi->zrst) )
for(i=0,psource=(pmbbi->zrst); i<16; i++, psource += sizeof(pmbbi->zrst) ) {
strncpy(pes->strs[i],psource,sizeof(pmbbi->zrst));
if(*psource!=0) no_str=i+1;
}
pes->no_str=no_str;
return(0);
}
static long put_enum_str(paddr,pstring)
@@ -321,7 +328,6 @@ static void alarm(pmbbi)
}
/* check for cos alarm */
if(pmbbi->lalm==udfUshort) pmbbi->lalm = val;
if(val == pmbbi->lalm) return;
if (pmbbi->nsev<pmbbi->cosv){
pmbbi->nsta = COS_ALARM;

View File

@@ -1,30 +1,32 @@
/* recMbbo.c */
/* share/src/rec $Id$ */
/* recMbbo.c - Record Support Routines for multi bit binary Output records
/* recMbbo.c - Record Support Routines for multi bit binary Output records */
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 7-17-87
*
* Author: Bob Dalesio
* Date: 7-17-87
* Experimental Physics and Industrial Control System (EPICS)
*
* Control System Software for the GTA Project
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Copyright 1988, 1989, the Regents of the University of California.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
@@ -105,11 +107,11 @@ struct rset mbboRSET={
get_control_double,
get_alarm_double };
struct mbbodset { /* multi bit binary input dset */
struct mbbodset { /* multi bit binary output dset */
long number;
DEVSUPFUN dev_report;
DEVSUPFUN init;
DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/
DEVSUPFUN init_record; /*returns: (0,2)=>(success,success no convert)*/
DEVSUPFUN get_ioint_info;
DEVSUPFUN write_mbbo;/*(0,1)=>(success,don't Continue*/
};
@@ -129,7 +131,7 @@ static void init_common(pmbbo)
pstate_values = &(pmbbo->zrvl);
pmbbo->sdef = FALSE;
for (i=0; i<16; i++) {
if (*(pstate_values+i)!= udfUlong) {
if (*(pstate_values+i)!= 0) {
pmbbo->sdef = TRUE;
return;
}
@@ -153,9 +155,9 @@ static long init_record(pmbbo)
recGblRecordError(S_dev_missingSup,pmbbo,"mbbo: init_record");
return(S_dev_missingSup);
}
if ((pmbbo->dol.type == CONSTANT)
&& (pmbbo->dol.value.value<=0.0 || pmbbo->dol.value.value>=udfFtest)){
if (pmbbo->dol.type == CONSTANT){
pmbbo->val = pmbbo->dol.value.value;
pmbbo->udf = FALSE;
}
/* initialize mask*/
pmbbo->mask = 0;
@@ -166,30 +168,31 @@ static long init_record(pmbbo)
if( pdset->init_record ) {
unsigned long rval;
if((status=(*pdset->init_record)(pmbbo,process))) return(status);
status=(*pdset->init_record)(pmbbo,process);
/* init_record might set status */
init_common(pmbbo);
rval = pmbbo->rval;
if(rval!=udfUlong) {
if(pmbbo->shft>0) rval >>= pmbbo->shft;
if (pmbbo->sdef){
unsigned long *pstate_values;
short i;
if(status==0){
rval = pmbbo->rval;
if(pmbbo->shft>0) rval >>= pmbbo->shft;
if (pmbbo->sdef){
unsigned long *pstate_values;
short i;
pstate_values = &(pmbbo->zrvl);
pmbbo->val = udfUshort; /* initalize to unknown state*/
for (i = 0; i < 16; i++){
if (*pstate_values == rval){
pmbbo->val = i;
break;
}
pstate_values++;
}
}else{
/* the raw is the desired val */
pmbbo->val = (unsigned short)rval;
}
}
pstate_values = &(pmbbo->zrvl);
pmbbo->val = 65535; /* initalize to unknown state*/
for (i = 0; i < 16; i++){
if (*pstate_values == rval){
pmbbo->val = i;
break;
}
pstate_values++;
}
}else{
/* the raw is the desired val */
pmbbo->val = (unsigned short)rval;
}
pmbbo->udf = FALSE;
} else if (status==2) status==0;
}
init_common(pmbbo);
return(0);
@@ -221,7 +224,8 @@ static long process(paddr)
&val,&options,&nRequest);
pmbbo->pact = FALSE;
if(status==0) {
pmbbo->val=val;
pmbbo->val= val;
pmbbo->udf= FALSE;
} else {
if(pmbbo->nsev < VALID_ALARM) {
pmbbo->nsev = VALID_ALARM;
@@ -230,10 +234,10 @@ static long process(paddr)
goto DONT_WRITE;
}
}
if(pmbbo->val==udfEnum) {
if(pmbbo->udf==TRUE) {
if(pmbbo->nsev < VALID_ALARM) {
pmbbo->nsev = VALID_ALARM;
pmbbo->nsta = SOFT_ALARM;
pmbbo->nsta = UDF_ALARM;
}
goto DONT_WRITE;
}
@@ -323,11 +327,16 @@ static long get_enum_strs(paddr,pes)
struct mbboRecord *pmbbo=(struct mbboRecord *)paddr->precord;
char *psource;
int i;
short no_str;
pes->no_str = 16;
no_str=0;
bzero(pes->strs,sizeof(pes->strs));
for(i=0,psource=(pmbbo->zrst); i<pes->no_str; i++, psource += sizeof(pmbbo->zrst) )
for(i=0,psource=(pmbbo->zrst); i<16; i++, psource += sizeof(pmbbo->zrst) ) {
strncpy(pes->strs[i],psource,sizeof(pmbbo->zrst));
if(*psource!=0)no_str=i+1;
}
pes->no_str = no_str;
return(0);
}
static long put_enum_str(paddr,pstring)
@@ -375,7 +384,6 @@ static void alarm(pmbbo)
}
/* check for cos alarm */
if(pmbbo->lalm==udfUshort) pmbbo->lalm = val;
if(val == pmbbo->lalm) return;
if (pmbbo->nsev<pmbbo->cosv){
pmbbo->nsta = COS_ALARM;

View File

@@ -1,30 +1,32 @@
/* recPermissive.c */
/* share/src/rec $Id$ */
/* recPermissive.c - Record Support Routines for Permissive records
/* recPermissive.c - Record Support Routines for Permissive records */
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 10-10-90
*
* Author: Marty Kraimer
* Date: 10/10/90
* Experimental Physics and Industrial Control System (EPICS)
*
* Control System Software for the GTA Project
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Copyright 1988, 1989, the Regents of the University of California.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
@@ -91,6 +93,7 @@ static long process(paddr)
struct permissiveRecord *ppermissive=(struct permissiveRecord *)(paddr->precord);
ppermissive->pact=TRUE;
ppermissive->udf=FALSE;
tsLocalTime(&ppermissive->time);
monitor(ppermissive);
if (ppermissive->flnk.type==DB_LINK)

View File

@@ -1,30 +1,32 @@
/* recPid.c */
/* share/src/rec $Id$ */
/* recPid.c - Record Support Routines for Pid records
/* recPid.c - Record Support Routines for Pid records */
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 5-19-89
*
* Author: Bob Dalesio
* Date: 05-19-89
* Experimental Physics and Industrial Control System (EPICS)
*
* Control System Software for the GTA Project
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Copyright 1988, 1989, the Regents of the University of California.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
@@ -96,8 +98,10 @@ static long init_record(ppid)
struct pidRecord *ppid;
{
/* initialize the setpoint for constant setpoint */
if (ppid->stpl.type == CONSTANT)
if (ppid->stpl.type == CONSTANT){
ppid->val = ppid->stpl.value.value;
ppid->udf = FALSE;
}
return(0);
}
@@ -384,15 +388,15 @@ struct pidRecord *ppid;
ppid->sevr = VALID_ALARM;
return(0);
}
}
} else ppid->udf=FALSE;
}
val = ppid->val;
if(ppid->val>0.0 && ppid->val<udfFtest) {
if (ppid->nsev<VALID_ALARM) {
ppid->nsta = SOFT_ALARM;
ppid->nsev = VALID_ALARM;
if (ppid->udf == TRUE ) {
if (ppid->nsev<VALID_ALARM) {
ppid->stat = UDF_ALARM;
ppid->sevr = VALID_ALARM;
}
return(0);
return(0);
}
/* compute time difference and make sure it is large enough*/

View File

@@ -1,36 +1,37 @@
/* recSel.c */
/* share/src/rec $Id$ */
/* recSel.c - Record Support Routines for Select records
/* recSel.c - Record Support Routines for Select records */
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 6-2-89
*
* Author: Bob Dalesio
* Date: 06-02-89
* Experimental Physics and Industrial Control System (EPICS)
*
* Control System Software for the GTA Project
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Copyright 1988, 1989, the Regents of the University of California.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
* .01 11-16-89 lrd fixed select algorithms not to compare against
* the previous value
*
* .02 10-12-90 mrk changes for new record support
*/
@@ -105,6 +106,9 @@ static long init_record(psel)
int i;
double *pvalue;
/* get seln initial value if nvl is a constant*/
if (psel->nvl.type == CONSTANT ) psel->seln = psel->nvl.value.value;
plink = &psel->inpa;
pvalue = &psel->a;
for(i=0; i<SEL_MAX; i++, plink++, pvalue++) {
@@ -218,7 +222,14 @@ static void alarm(psel)
double ftemp;
double val=psel->val;
if(val>0.0 && val<udfDtest) return;
/* undefined condition */
if(psel->udf ==TRUE){
if (psel->nsev<VALID_ALARM){
psel->nsta = UDF_ALARM;
psel->nsev = VALID_ALARM;
return;
}
}
/* if difference is not > hysterisis use lalm not val */
ftemp = psel->lalm - psel->val;
if(ftemp<0.0) ftemp = -ftemp;
@@ -345,7 +356,6 @@ struct selRecord *psel; /* pointer to selection record */
case (SELECT_HIGH):
psel->val = *pvalue;
for (i = 0; i < SEL_MAX; i++,pvalue++){
if (*pvalue>0.0 && *pvalue<udfDtest) continue;
if (psel->val < *pvalue)
psel->val = *pvalue;
}
@@ -353,7 +363,6 @@ struct selRecord *psel; /* pointer to selection record */
case (SELECT_LOW):
psel->val = *pvalue;
for (i = 0; i < SEL_MAX; i++,pvalue++){
if (*pvalue>0.0 && *pvalue<udfDtest) continue;
if (psel->val > *pvalue)
psel->val = *pvalue;
}
@@ -363,7 +372,6 @@ struct selRecord *psel; /* pointer to selection record */
plink = &psel->inpa;
order_inx = 0;
for (i = 0; i < SEL_MAX; i++,pvalue++,plink++){
if (*pvalue>0.0 && *pvalue<udfDtest) continue;
if (plink->type == DB_LINK){
j = order_inx;
while ((order[j-1] > *pvalue) && (j > 0)){
@@ -379,7 +387,7 @@ struct selRecord *psel; /* pointer to selection record */
default:
return(-1);
}
psel->udf=FALSE;
/* initialize flag */
return(0);
}
@@ -403,6 +411,20 @@ struct selRecord *psel;
pvalue = &psel->a;
/* If select mechanism is SELECTED only get selected input*/
if(psel->selm == SELECTED) {
/* fetch the select index */
if(psel->nvl.type == DB_LINK ){
options=0;
nRequest=1;
if(dbGetLink(&(psel->nvl.value.db_link),psel,DBR_USHORT,
&(psel->seln),&options,&nRequest)!=NULL) {
if (psel->nsev<VALID_ALARM) {
psel->stat = LINK_ALARM;
psel->sevr = VALID_ALARM;
return(0);
}
return(-1);
}
}
plink += psel->seln;
pvalue += psel->seln;
if(plink->type==DB_LINK) {
@@ -415,13 +437,6 @@ struct selRecord *psel;
}
return(-1);
}
if(*pvalue>0.0 && *pvalue<udfDtest) {
if(psel->nsev<VALID_ALARM) {
psel->nsev=VALID_ALARM;
psel->nsta=SOFT_ALARM;
}
return(-1);
}
}
return(0);
}
@@ -437,13 +452,6 @@ struct selRecord *psel;
}
return(-1);
}
if(*pvalue>0.0 && *pvalue<udfDtest) {
if(psel->nsev<VALID_ALARM) {
psel->nsev=VALID_ALARM;
psel->nsta=SOFT_ALARM;
}
return(-1);
}
}
}
return(0);

View File

@@ -1,30 +1,32 @@
/* recState.c */
/* share/src/rec $Id$ */
/* recState.c - Record Support Routines for State records
/* recState.c - Record Support Routines for State records */
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 10-10-90
*
* Author: Marty Kraimer
* Date: 10/10/90
* Experimental Physics and Industrial Control System (EPICS)
*
* Control System Software for the GTA Project
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Copyright 1988, 1989, the Regents of the University of California.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
@@ -91,6 +93,7 @@ static long process(paddr)
{
struct stateRecord *pstate=(struct stateRecord *)(paddr->precord);
pstate->udf = FALSE;
pstate->pact=TRUE;
tsLocalTime(&pstate->time);
monitor(pstate);

View File

@@ -1,30 +1,32 @@
/* recSteppermotor.c */
/* share/src/rec $Id$ */
/* recSteppermotor.c - Record Support Routines for Steppermotor records
/* recSteppermotor.c - Record Support Routines for Steppermotor records */
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 12-11-89
*
* Author: Bob Dalesio
* Date: 12-11-89
* Experimental Physics and Industrial Control System (EPICS)
*
* Control System Software for the GTA Project
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Copyright 1988, 1989, the Regents of the University of California.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
@@ -38,7 +40,28 @@
* .06 04-20-90 lrd make readback occur before setting MOVN to 0
* .07 07-02-90 lrd make conversion compute in floating point
* .08 10-01-90 lrd modify readbacks to be throttled by delta
* .09 10-15-90 mrk extensible record and device support
* .09 10-23-90 lrd update rbv even when there are no monitors
* .10 10-25-90 lrd change initialization to set all variables to IVAL
* .11 10-26-90 lrd add DMOV to indicate all retries exhausted or
* motor is at position within deadband
* .12 10-31-90 lrd add time stamps
* .13 11-28-90 lrd make initialization work when readbacks are
* from LVDTs, Motor position and encoders.
* Fixed sm_get_position to be aware of the motion
* status before it was set in the record see .06
* .14 11-29-90 lrd conditionally process soft channels
* .15 12-14-90 lrd fixed limit switch monitor notification
* .16 12-17-90 lrd stop motor on overshoot
* .17 12-17-90 lrd fix limits on initialization
* .18 03-15-91 lrd change acceleration and velocity for positional
* motors
* .19 03-21-91 lrd add forward link processing
* .20 06-04-91 lrd apply drive high and low software clamps before
* checking if the setpoint is different
* move the conversion to steps in line
* apply deadband to overshoot checking
* .21 10-15-90 mrk extensible record and device support
*/
#include <vxWorks.h>
@@ -403,15 +426,15 @@ struct steppermotorRecord *psm;
/* limit switches */
if (psm->mcw != psm_data->cw_limit){
psm->mcw = psm_data->cw_limit;
if (psm->mlis.count)
db_post_events(psm,&psm->mcw,DBE_VALUE);
psm->cw = (psm->mcw)?0:1;
if (psm->mlis.count)
db_post_events(psm,&psm->cw,DBE_VALUE);
}
if (psm->mccw != psm_data->ccw_limit){
psm->mccw = psm_data->ccw_limit;
if (psm->mlis.count)
db_post_events(psm,&psm->mccw,DBE_VALUE);
psm->ccw = (psm->mccw)?0:1;
if (psm->mlis.count)
db_post_events(psm,&psm->ccw,DBE_VALUE);
}
/* alarm conditions for limit switches */
@@ -423,7 +446,7 @@ struct steppermotorRecord *psm;
}
/* get the read back value */
sm_get_position(psm);
sm_get_position(psm,psm_data->moving);
/* get previous stat and sevr and new stat and sevr*/
stat=psm->stat;
@@ -454,6 +477,23 @@ struct steppermotorRecord *psm;
if (psm->mlis.count)
db_post_events(psm,&psm->movn,DBE_VALUE|DBE_LOG);
}
/* stop motor on overshoot */
if (psm->movn){
if (psm->posm){ /* moving in the positive direction */
if (psm->rbv > (psm->val + psm->rdbd))
sm_driver(psm->dtyp,
psm->out.value.vmeio.card,
psm->out.value.vmeio.signal,
SM_MOTION,0);
}else{ /* moving in the negative direction */
if (psm->rbv < (psm->val + psm->rdbd) )
sm_driver(psm->dtyp,
psm->out.value.vmeio.card,
psm->out.value.vmeio.signal,
SM_MOTION,0);
}
}
}
psm->pact = FALSE;
dbScanUnlock(psm);
@@ -502,12 +542,14 @@ struct steppermotorRecord *psm;
/* set the velocity */
sm_driver(psm->dtyp,card,channel,SM_VELOCITY,velocity,acceleration);
psm->lvel = psm->velo;
psm->lacc = psm->accl;
/* set the callback routine */
sm_driver(psm->dtyp,card,channel,SM_CALLBACK,smcb_callback,psm);
/* initialize the limit values */
psm->cw = psm->ccw = 1; /* 1 - means not at limit */
psm->cw = psm->ccw = -1;
/* set initial position */
if (psm->mode == POSITION){
@@ -538,29 +580,6 @@ struct steppermotorRecord *psm;
return;
}
/*
* CONVERT_SM
*
*/
static void convert_sm(psm)
struct steppermotorRecord *psm;
{
double temp;
/* check drive limits */
if (psm->dist > 0){
if (psm->val > psm->drvh) psm->val = psm->drvh;
else if (psm->val < psm->drvl) psm->val = psm->drvl;
}else{
if (-psm->val > psm->drvh) psm->val = -psm->drvh;
else if (-psm->val < psm->drvl) psm->val = -psm->drvl;
}
/* convert */
temp = psm->val / psm->dist;
psm->rval = temp;
}
/*
* POSITIONAL_SM
*
@@ -569,7 +588,9 @@ struct steppermotorRecord *psm;
static void positional_sm(psm)
struct steppermotorRecord *psm;
{
short card,channel;
short card,channel,done_move;
int acceleration,velocity;
double temp;
/* only VME stepper motor cards supported */
if (psm->out.type != VME_IO) return;
@@ -590,6 +611,15 @@ struct steppermotorRecord *psm;
if (psm->movn != 0)
return;
/* set the velocity and acceleration */
if ((psm->velo != psm->lvel) || (psm->lacc != psm->accl)){
acceleration = (1/psm->accl) * psm->velo * psm->mres;
velocity = psm->velo * psm->mres;
sm_driver(psm->dtyp,card,channel,SM_VELOCITY,velocity,acceleration);
psm->lvel = psm->velo;
psm->lacc = psm->accl;
}
/* set home when requested */
if (psm->sthm != 0){
psm->sthm = 0; /* reset the set home field */
@@ -618,13 +648,24 @@ struct steppermotorRecord *psm;
psm->nsev = VALID_ALARM;
}
return;
}
} else psm->udf = FALSE;
}
/* check drive limits */
if (psm->dist > 0){
if (psm->val > psm->drvh) psm->val = psm->drvh;
else if (psm->val < psm->drvl) psm->val = psm->drvl;
}else{
if (-psm->val > psm->drvh) psm->val = -psm->drvh;
else if (-psm->val < psm->drvl) psm->val = -psm->drvl;
}
/* Change of desired position */
if (psm->lval != psm->val){
psm->rcnt = 0;
psm->lval = psm->val;
psm->movn = 0; /* start moving to desired location */
if (psm->mlis.count){
db_post_events(psm,&psm->rcnt,DBE_VALUE|DBE_LOG);
db_post_events(psm,&psm->lval,DBE_VALUE|DBE_LOG);
@@ -634,6 +675,10 @@ struct steppermotorRecord *psm;
/* difference between desired position and readback pos */
if ( (psm->rbv < (psm->val - psm->rdbd))
|| (psm->rbv > (psm->val + psm->rdbd)) ){
/* determine direction */
if (psm->rcnt == 0)
psm->posm = (psm->rbv < psm->val);
/* one attempt was made - record the error */
if (psm->rcnt == 1){
psm->miss = (psm->val - psm->rbv);
@@ -643,8 +688,10 @@ struct steppermotorRecord *psm;
/* should we retry */
if (psm->rcnt <= psm->rtry){
/* convert and write the desired value to position */
convert_sm(psm);
/* convert */
temp = psm->val / psm->dist;
psm->rval = temp;
/* move motor */
if (sm_driver(psm->dtyp,card,channel,SM_MOVE,psm->rval-psm->rrbv,0) < 0){
@@ -660,10 +707,24 @@ struct steppermotorRecord *psm;
db_post_events(psm,&psm->movn,DBE_VALUE|DBE_LOG);
db_post_events(psm,&psm->rcnt,DBE_VALUE|DBE_LOG);
}
/* no more retries - put the record in alarm */
}else{
alarm(psm);
}
done_move = 0;
/* no more retries - put the record in alarm */
}else{
done_move = 1;
}
}else{
/* error doesn't exceed deadband - done moving */
done_move = 1;
}
/* there was a move in progress and now it is complete */
if (done_move && (psm->movn == 0)){
psm->movn = 1;
if (psm->mlis.count)
db_post_events(psm,&psm->movn,DBE_VALUE|DBE_LOG);
/* check for deviation from desired value */
alarm(psm);
}
return;
}
@@ -694,7 +755,7 @@ struct steppermotorRecord *psm;
psm->nsev = VALID_ALARM;
}
return;
}
} else psm->udf=FALSE;
}
/* the motor number is the card number */
@@ -760,8 +821,9 @@ struct steppermotorRecord *psm;
*
* get the stepper motor readback position
*/
static void sm_get_position(psm)
static void sm_get_position(psm,moving)
struct steppermotorRecord *psm;
short moving;
{
short reset;
float new_pos,delta;
@@ -773,6 +835,9 @@ struct steppermotorRecord *psm;
/* when readback comes from another field of this record */
/* the fetch will fail if the record is uninitialized */
/* also - prdl (process readback location) should be set */
/* to NO if the readback is from the same record */
reset = psm->init;
if (reset == 0) psm->init = 1;
if(dbGetLink(&(psm->rdbl.value.db_link),psm,DBR_FLOAT,&new_pos,&options,&nRequest)){
@@ -790,16 +855,16 @@ struct steppermotorRecord *psm;
}
/* readback position at initialization */
if ((psm->init == 0) && (psm->movn == 0)){
if (psm->ival == 0){
psm->rbv = psm->val = new_pos;
}else{
if ((psm->init == 0) && (moving == 0)){
if (psm->sthm){
sm_driver(psm->dtyp,
psm->out.value.vmeio.card,
psm->out.value.vmeio.signal,
SM_SET_HOME,0,0);
psm->rbv = new_pos = psm->val = psm->ival;
psm->sthm = 0;
return;
}
psm->rbv = psm->val = psm->ival + new_pos;
psm->rval = psm->rrbv = psm->rbv / psm->dist;
psm->init = 1;
if (psm->mlis.count != 0){
@@ -823,6 +888,8 @@ struct steppermotorRecord *psm;
db_post_events(psm,&psm->rbv,DBE_VALUE|DBE_ALARM);
db_post_events(psm,&psm->rrbv,DBE_VALUE|DBE_ALARM);
}
}else{
psm->rbv = new_pos;
}
}

View File

@@ -1,14 +1,11 @@
/* recStringin.c */
/* share/src/rec $Id$ */
/* recState.c - Record Support Routines for State records
*
/* recStringin.c - Record Support Routines for Stringin records */
/*
* Author: Janet Anderson
* Date: 4/23/91
*
* Author:
* Date: mm-dd-yy
*
* Experimental Physics and Industrial Control System (EPICS)
*
* Copyright 1991, the Regents of the University of California,

View File

@@ -1,8 +1,8 @@
/* recStringout.c */
/* share/src/rec $Id$ */
/* recStringout.c - Record Support Routines for Stringout records
*
/* recStringout.c - Record Support Routines for Stringout records */
/*
* Author: Janet Anderson
* Date: 4/23/91
*
@@ -114,9 +114,9 @@ static long init_record(pstringout)
return(S_dev_missingSup);
}
/* get the initial value dol is a constant*/
if (pstringout->dol.type == CONSTANT
&& (pstringout->dol.value.value<=0.0 || pstringout->dol.value.value>=udfFtest)){
sprintf(pstringout->val,"%-13.6g",pstringout->dol.value.value);
if (pstringout->dol.type == CONSTANT && pstringout->dol.value.value!=0.0 ){
sprintf(pstringout->val,"%-14.7g",pstringout->dol.value.value);
pstringout->udf=FALSE;
}
if( pdset->init_record ) {
if((status=(*pdset->init_record)(pstringout,process))) return(status);

View File

@@ -1,30 +1,32 @@
/* recSub.c */
/* share/src/rec $Id$ */
/* recSub.c - Record Support Routines for Subroutine records
/* recSub.c - Record Support Routines for Subroutine records */
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 01-25-90
*
* Author: Bob Dalesio
* Date: 01-25-90
* Experimental Physics and Industrial Control System (EPICS)
*
* Control System Software for the GTA Project
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Copyright 1988, 1989, the Regents of the University of California.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
@@ -240,7 +242,14 @@ static void alarm(psub)
double ftemp;
double val=psub->val;
if(val>0.0 && val<udfDtest)return;
/* undefined condition */
if(psub->udf == TRUE) {
if (psub->nsev<VALID_ALARM){
psub->nsta = UDF_ALARM;
psub->nsev = VALID_ALARM;
return;
}
}
/* if difference is not > hysterisis use lalm not val */
ftemp = psub->lalm - psub->val;
if(ftemp<0.0) ftemp = -ftemp;
@@ -372,13 +381,6 @@ struct subRecord *psub;
}
return(-1);
}
if(*pvalue>0.0 && *pvalue<udfDtest) {
if(psub->nsev<VALID_ALARM) {
psub->nsev=VALID_ALARM;
psub->nsta=SOFT_ALARM;
}
return(-1);
}
}
return(0);
}
@@ -405,6 +407,6 @@ struct subRecord *psub; /* pointer to subroutine record */
psub->nsta = SOFT_ALARM;
psub->nsev = psub->brsv;
}
}
} else psub->udf = FALSE;
return(status);
}

View File

@@ -1,30 +1,32 @@
/* recTimer.c */
/* share/src/rec $Id$ */
/* recTimer.c - Record Support Routines for Timer records
/* recTimer.c - Record Support Routines for Timer records */
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 1-9-89
*
* Author: Bob Dalesio
* Date: 1-9-89
* Experimental Physics and Industrial Control System (EPICS)
*
* Control System Software for the GTA Project
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* Copyright 1988, 1989, the Regents of the University of California.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
@@ -125,6 +127,7 @@ static long process(paddr)
/* write the new value */
write_timer(ptimer);
ptimer->udf=FALSE;
tsLocalTime(&ptimer->time);
/* check event list */
@@ -269,6 +272,14 @@ struct timerRecord *ptimer;
}
pvmeio = (struct vmeio *)(&ptimer->out.value);
/* should we maintain through a reboot */
if (ptimer->main && ptimer->rdt1 && ptimer->rpw1){
ptimer->dut1 = ptimer->rdt1 - ptimer->trdl;
ptimer->opw1 = ptimer->rpw1;
ptimer->main = 0; /* only kept on the first write */
}
/* convert the value */
convert_timer(ptimer);
@@ -334,9 +345,7 @@ struct timerRecord *ptimer;
/* timing pulse 1 is currently active */
/* put its parameters into the database so that it will not change */
/* when the timer record is written */
ptimer->dut1 = time_pulse[0] * constant; /* delay to trigger */
ptimer->opw1 = time_pulse[1] * constant; /* pulse width */
ptimer->ptst = ptst; /* pre-trigger state */
ptimer->tsrc = source; /* clock source */
ptimer->rdt1 = time_pulse[0] * constant; /* delay to trigger */
ptimer->rpw1 = time_pulse[1] * constant; /* pulse width */
return;
}

View File

@@ -1,29 +1,32 @@
/* recWaveform.c - Record Support Routines for Waveform records
/* recWaveform.c */
/* share/src/rec $Id$ */
/*
* Author: Bob Dalesio
* Date: 7-14-89
/* recWaveform.c - Record Support Routines for Waveform records */
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 7-14-89
*
* Control System Software for the GTA Project
* Experimental Physics and Industrial Control System (EPICS)
*
* Copyright 1988, 1989, the Regents of the University of California.
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Bob Dalesio, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-3414
* E-mail: dalesio@luke.lanl.gov
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log:
* -----------------
@@ -115,6 +118,12 @@ struct wfdset { /* waveform dset */
static int sizeofTypes[] = {0,1,1,2,2,4,4,4,8,2};
void monitor();
/* The following is taken from dbScan.c */
#define E_IO_INTERRUPT 7
/*Following from timing system */
extern unsigned int gts_trigger_counter;
static long init_record(pwf)
struct waveformRecord *pwf;
@@ -161,11 +170,21 @@ static long process(paddr)
recGblRecordError(S_dev_missingSup,pwf,"read_wf");
return(S_dev_missingSup);
}
/* event throttling */
if (pwf->scan == E_IO_INTERRUPT){
if ((pwf->evnt != 0) && (gts_trigger_counter != 0)){
if ((gts_trigger_counter % pwf->evnt) != 0){
return(0);
}
}
}
/*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);
pwf->udf=FALSE;
tsLocalTime(&pwf->time);
monitor(pwf);