Fixes for IOCs on 64-bit platforms.
empty string to char conversions now produce 0, not '0'. Record types ANSIfied by John Hammonds.
This commit is contained in:
@@ -338,16 +338,9 @@ static void getOptions(DBADDR *paddr,char **poriginal,long *options,void *pflin)
|
||||
pbuffer += dbr_units_size;
|
||||
}
|
||||
if( (*options) & DBR_PRECISION ) {
|
||||
struct dbr_precision *pdbr_precision=
|
||||
(struct dbr_precision *)pbuffer;
|
||||
|
||||
memset(pbuffer,'\0',dbr_precision_size);
|
||||
if((field_type==DBF_FLOAT || field_type==DBF_DOUBLE)
|
||||
&& prset && prset->get_precision ){
|
||||
(*prset->get_precision)(paddr,pbuffer);
|
||||
if(pdbr_precision->field_width<=0)
|
||||
pdbr_precision->field_width =
|
||||
pdbr_precision->precision + 5;
|
||||
} else {
|
||||
*options ^= DBR_PRECISION; /*Turn off DBR_PRECISION*/
|
||||
}
|
||||
@@ -735,16 +728,16 @@ long epicsShareAPI dbValueSize(
|
||||
{
|
||||
/* sizes for value associated with each DBR request type */
|
||||
static long size[] = {
|
||||
MAX_STRING_SIZE, /* STRING */
|
||||
sizeof(char), /* CHAR */
|
||||
sizeof(unsigned char), /* UCHAR */
|
||||
sizeof(short), /* SHORT */
|
||||
sizeof(unsigned short), /* USHORT */
|
||||
sizeof(long), /* LONG */
|
||||
sizeof(unsigned long), /* ULONG */
|
||||
sizeof(float), /* FLOAT */
|
||||
sizeof(double), /* DOUBLE */
|
||||
sizeof(unsigned short)}; /* ENUM */
|
||||
MAX_STRING_SIZE, /* STRING */
|
||||
sizeof(epicsInt8), /* CHAR */
|
||||
sizeof(epicsUInt8), /* UCHAR */
|
||||
sizeof(epicsInt16), /* SHORT */
|
||||
sizeof(epicsUInt16), /* USHORT */
|
||||
sizeof(epicsInt32), /* LONG */
|
||||
sizeof(epicsUInt32), /* ULONG */
|
||||
sizeof(epicsFloat32), /* FLOAT */
|
||||
sizeof(epicsFloat64), /* DOUBLE */
|
||||
sizeof(epicsEnum16)}; /* ENUM */
|
||||
|
||||
return(size[dbr_type]);
|
||||
}
|
||||
|
||||
@@ -108,8 +108,10 @@ epicsShareExtern volatile int interruptAccept;
|
||||
#define DBRunits \
|
||||
char units[DB_UNITS_SIZE]; /* units */
|
||||
#define DBRprecision \
|
||||
epicsInt32 precision; /* number of decimal places*/\
|
||||
epicsInt32 field_width; /* field width */
|
||||
long precision; /* number of decimal places*/
|
||||
/* The above type must match the pointer arguments to
|
||||
* RSET->get_precision() and recGblGetPrec(), which it's
|
||||
* too late to change now... */
|
||||
#define DBRtime \
|
||||
epicsTimeStamp time; /* time stamp*/
|
||||
#define DBRenumStrs \
|
||||
@@ -177,7 +179,7 @@ struct dbr_alDouble {DBRalDouble};
|
||||
#define S_db_badField (M_dbAccess|15) /*Illegal field value*/
|
||||
#define S_db_lsetLogic (M_dbAccess|17) /*Logic error generating lock sets*/
|
||||
#define S_db_noRSET (M_dbAccess|31) /*missing record support entry table*/
|
||||
#define S_db_noSupport (M_dbAccess|33) /*RSET routine not defined*/
|
||||
#define S_db_noSupport (M_dbAccess|33) /*RSET or DSXT routine not defined*/
|
||||
#define S_db_BadSub (M_dbAccess|35) /*Subroutine not found*/
|
||||
/*!!!! Do not change next line without changing src/rsrv/server.h!!!!!!!!*/
|
||||
#define S_db_Pending (M_dbAccess|37) /*Request is pending*/
|
||||
|
||||
@@ -83,7 +83,7 @@ static long getStringChar(
|
||||
*pbuffer = (char)value;
|
||||
return(0);
|
||||
} else if(strlen(psrc) == 0) {
|
||||
*pbuffer = '0';
|
||||
*pbuffer = 0;
|
||||
return(0);
|
||||
} else {
|
||||
return(-1);
|
||||
@@ -94,7 +94,7 @@ static long getStringChar(
|
||||
if(sscanf(psrc,"%hd",&value) == 1) {
|
||||
*pbuffer = (char)value;
|
||||
} else if(strlen(psrc) == 0) {
|
||||
*pbuffer = '0';
|
||||
*pbuffer = 0;
|
||||
} else {
|
||||
return(-1);
|
||||
}
|
||||
@@ -120,7 +120,7 @@ static long getStringUchar(
|
||||
*pbuffer = (unsigned char)value;
|
||||
return(0);
|
||||
} else if(strlen(psrc) == 0) {
|
||||
*pbuffer = '0';
|
||||
*pbuffer = 0;
|
||||
return(0);
|
||||
} else {
|
||||
return(-1);
|
||||
@@ -131,7 +131,7 @@ static long getStringUchar(
|
||||
if(sscanf(psrc,"%hu",&value) == 1) {
|
||||
*pbuffer = (unsigned char)value;
|
||||
} else if(strlen(psrc) == 0) {
|
||||
*pbuffer = '0';
|
||||
*pbuffer = 0;
|
||||
} else {
|
||||
return(-1);
|
||||
}
|
||||
@@ -2331,7 +2331,7 @@ static long putStringLong(
|
||||
DBADDR *paddr,const void *pfrom,long nRequest,long no_elements,long offset)
|
||||
{
|
||||
const char *pbuffer = (const char *)pfrom;
|
||||
long *pdest=(long *)paddr->pfield;
|
||||
epicsInt32 *pdest=(epicsInt32 *)paddr->pfield;
|
||||
long value;
|
||||
|
||||
if(nRequest==1 && offset==0) {
|
||||
@@ -2362,14 +2362,14 @@ static long putStringUlong(
|
||||
DBADDR *paddr,const void *pfrom,long nRequest,long no_elements,long offset)
|
||||
{
|
||||
const char *pbuffer = (const char *)pfrom;
|
||||
unsigned long *pdest=(unsigned long *)paddr->pfield;
|
||||
epicsUInt32 *pdest=(epicsUInt32 *)paddr->pfield;
|
||||
double value;
|
||||
|
||||
/*Convert to double first so that numbers like 1.0e3 convert properly*/
|
||||
/*Problem was old database access said to get unsigned long as double*/
|
||||
if(nRequest==1 && offset==0) {
|
||||
if(epicsScanDouble(pbuffer, &value) == 1) {
|
||||
*pdest = (unsigned long)value;
|
||||
*pdest = (epicsUInt32)value;
|
||||
return(0);
|
||||
}
|
||||
else return(-1);
|
||||
@@ -2377,7 +2377,7 @@ static long putStringUlong(
|
||||
pdest += offset;
|
||||
while (nRequest) {
|
||||
if(epicsScanDouble(pbuffer, &value) == 1) {
|
||||
*pdest = (unsigned long)value;
|
||||
*pdest = (epicsUInt32)value;
|
||||
} else {
|
||||
return(-1);
|
||||
}
|
||||
@@ -2674,7 +2674,7 @@ static long putCharLong(
|
||||
DBADDR *paddr,const void *pfrom,long nRequest,long no_elements,long offset)
|
||||
{
|
||||
const char *pbuffer = (const char *)pfrom;
|
||||
long *pdest=(long *)(paddr->pfield);
|
||||
epicsInt32 *pdest=(epicsInt32 *)(paddr->pfield);
|
||||
|
||||
if(nRequest==1 && offset==0) {
|
||||
*pdest = *pbuffer;
|
||||
@@ -2683,7 +2683,7 @@ static long putCharLong(
|
||||
pdest += offset;
|
||||
while (nRequest) {
|
||||
*pdest++ = *pbuffer++;
|
||||
if(++offset==no_elements) pdest=(long *)paddr->pfield;
|
||||
if(++offset==no_elements) pdest=(epicsInt32 *)paddr->pfield;
|
||||
nRequest--;
|
||||
}
|
||||
return(0);
|
||||
@@ -2693,7 +2693,7 @@ static long putCharUlong(
|
||||
DBADDR *paddr,const void *pfrom,long nRequest,long no_elements,long offset)
|
||||
{
|
||||
const char *pbuffer = (const char *)pfrom;
|
||||
unsigned long *pdest=(unsigned long *)(paddr->pfield);
|
||||
epicsUInt32 *pdest=(epicsUInt32 *)(paddr->pfield);
|
||||
|
||||
if(nRequest==1 && offset==0) {
|
||||
*pdest = *pbuffer;
|
||||
@@ -2702,7 +2702,7 @@ static long putCharUlong(
|
||||
pdest += offset;
|
||||
while (nRequest) {
|
||||
*pdest++ = *pbuffer++;
|
||||
if(++offset==no_elements) pdest=(unsigned long *)paddr->pfield;
|
||||
if(++offset==no_elements) pdest=(epicsUInt32 *)paddr->pfield;
|
||||
nRequest--;
|
||||
}
|
||||
return(0);
|
||||
@@ -2870,7 +2870,7 @@ static long putUcharLong(
|
||||
DBADDR *paddr,const void *pfrom,long nRequest,long no_elements,long offset)
|
||||
{
|
||||
const unsigned char *pbuffer = (const unsigned char *)pfrom;
|
||||
long *pdest=(long *)(paddr->pfield);
|
||||
epicsInt32 *pdest=(epicsInt32 *)(paddr->pfield);
|
||||
|
||||
if(nRequest==1 && offset==0) {
|
||||
*pdest = *pbuffer;
|
||||
@@ -2879,7 +2879,7 @@ static long putUcharLong(
|
||||
pdest += offset;
|
||||
while (nRequest) {
|
||||
*pdest++ = *pbuffer++;
|
||||
if(++offset==no_elements) pdest=(long *)paddr->pfield;
|
||||
if(++offset==no_elements) pdest=(epicsInt32 *)paddr->pfield;
|
||||
nRequest--;
|
||||
}
|
||||
return(0);
|
||||
@@ -2889,7 +2889,7 @@ static long putUcharUlong(
|
||||
DBADDR *paddr,const void *pfrom,long nRequest,long no_elements,long offset)
|
||||
{
|
||||
const unsigned char *pbuffer = (const unsigned char *)pfrom;
|
||||
unsigned long *pdest=(unsigned long *)(paddr->pfield);
|
||||
epicsUInt32 *pdest=(epicsUInt32 *)(paddr->pfield);
|
||||
|
||||
if(nRequest==1 && offset==0) {
|
||||
*pdest = *pbuffer;
|
||||
@@ -2898,7 +2898,7 @@ static long putUcharUlong(
|
||||
pdest += offset;
|
||||
while (nRequest) {
|
||||
*pdest++ = *pbuffer++;
|
||||
if(++offset==no_elements) pdest=(unsigned long *)paddr->pfield;
|
||||
if(++offset==no_elements) pdest=(epicsUInt32 *)paddr->pfield;
|
||||
nRequest--;
|
||||
}
|
||||
return(0);
|
||||
@@ -3066,7 +3066,7 @@ static long putShortLong(
|
||||
DBADDR *paddr,const void *pfrom,long nRequest,long no_elements,long offset)
|
||||
{
|
||||
const short *pbuffer = (const short *)pfrom;
|
||||
long *pdest=(long *)(paddr->pfield);
|
||||
epicsInt32 *pdest=(epicsInt32 *)(paddr->pfield);
|
||||
|
||||
if(nRequest==1 && offset==0) {
|
||||
*pdest = *pbuffer;
|
||||
@@ -3075,7 +3075,7 @@ static long putShortLong(
|
||||
pdest += offset;
|
||||
while (nRequest) {
|
||||
*pdest++ = *pbuffer++;
|
||||
if(++offset==no_elements) pdest=(long *)paddr->pfield;
|
||||
if(++offset==no_elements) pdest=(epicsInt32 *)paddr->pfield;
|
||||
nRequest--;
|
||||
}
|
||||
return(0);
|
||||
@@ -3085,7 +3085,7 @@ static long putShortUlong(
|
||||
DBADDR *paddr,const void *pfrom,long nRequest,long no_elements,long offset)
|
||||
{
|
||||
const short *pbuffer = (const short *)pfrom;
|
||||
unsigned long *pdest=(unsigned long *)(paddr->pfield);
|
||||
epicsUInt32 *pdest=(epicsUInt32 *)(paddr->pfield);
|
||||
|
||||
if(nRequest==1 && offset==0) {
|
||||
*pdest = *pbuffer;
|
||||
@@ -3094,7 +3094,7 @@ static long putShortUlong(
|
||||
pdest += offset;
|
||||
while (nRequest) {
|
||||
*pdest++ = *pbuffer++;
|
||||
if(++offset==no_elements) pdest=(unsigned long *)paddr->pfield;
|
||||
if(++offset==no_elements) pdest=(epicsUInt32 *)paddr->pfield;
|
||||
nRequest--;
|
||||
}
|
||||
return(0);
|
||||
|
||||
@@ -50,14 +50,14 @@
|
||||
* type y and z are the same, it merely copies.
|
||||
*
|
||||
* where st - string
|
||||
* c - char
|
||||
* uc - unsigned char
|
||||
* s - short
|
||||
* us - unsigned short
|
||||
* l - long
|
||||
* ul - unsigned long
|
||||
* f - float
|
||||
* d - double
|
||||
* c - epicsInt8
|
||||
* uc - epicsUInt8
|
||||
* s - epicsInt16
|
||||
* us - epicsUInt16
|
||||
* l - epicsInt32
|
||||
* ul - epicsUInt32
|
||||
* f - epicsFloat32
|
||||
* d - epicsFloat64
|
||||
* e - enum
|
||||
*
|
||||
* These functions are _single_ value functions,
|
||||
@@ -74,97 +74,102 @@ static long cvt_st_st(
|
||||
char *from,
|
||||
char *to,
|
||||
struct dbAddr *paddr)
|
||||
{
|
||||
char size;
|
||||
{
|
||||
size_t size;
|
||||
|
||||
if(paddr && paddr->field_size<MAX_STRING_SIZE) {
|
||||
size = paddr->field_size - 1;
|
||||
if (paddr && paddr->field_size < MAX_STRING_SIZE) {
|
||||
size = paddr->field_size - 1;
|
||||
} else {
|
||||
size = MAX_STRING_SIZE - 1;
|
||||
size = MAX_STRING_SIZE - 1;
|
||||
}
|
||||
strncpy(to, from, size);
|
||||
*(to+size) = '\000';
|
||||
return(0);
|
||||
}
|
||||
to[size] = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Convert String to Char */
|
||||
static long cvt_st_c(
|
||||
char *from,
|
||||
char *to,
|
||||
epicsInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{
|
||||
short value;
|
||||
{
|
||||
char *end;
|
||||
long value;
|
||||
|
||||
if (sscanf(from, "%hd", &value) == 1) {
|
||||
*to = (char) value;
|
||||
return(0);
|
||||
if (*from == 0) {
|
||||
*to = 0;
|
||||
return 0;
|
||||
}
|
||||
if(strlen(from) == 0) {
|
||||
*to = '0';
|
||||
return(0);
|
||||
value = strtol(from, &end, 10);
|
||||
if (end > from) {
|
||||
*to = (epicsInt8) value;
|
||||
return 0;
|
||||
}
|
||||
return(-1); /* Change to SYMBOL */
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Convert String to Unsigned Char */
|
||||
static long cvt_st_uc(
|
||||
char *from,
|
||||
unsigned char *to,
|
||||
epicsUInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{
|
||||
unsigned short value;
|
||||
{
|
||||
char *end;
|
||||
unsigned long value;
|
||||
|
||||
if (sscanf(from, "%hu", &value) == 1) {
|
||||
*to = value;
|
||||
return(0);
|
||||
if (*from == 0) {
|
||||
*to = 0;
|
||||
return 0;
|
||||
}
|
||||
if(strlen(from) == 0) {
|
||||
*to = '0';
|
||||
return(0);
|
||||
value = strtoul(from, &end, 10);
|
||||
if (end > from) {
|
||||
*to = (epicsUInt8) value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return(-1); /* Change to SYMBOL */
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Convert String to Short */
|
||||
static long cvt_st_s(
|
||||
char *from,
|
||||
short *to,
|
||||
epicsInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{
|
||||
short value;
|
||||
{
|
||||
char *end;
|
||||
long value;
|
||||
|
||||
if (sscanf(from, "%hd", &value) == 1) {
|
||||
*to = value;
|
||||
return(0);
|
||||
}
|
||||
if(strlen(from) == 0) {
|
||||
if (*from == 0) {
|
||||
*to = 0;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return(-1); /* Change to SYMBOL */
|
||||
}
|
||||
value = strtol(from, &end, 10);
|
||||
if (end > from) {
|
||||
*to = (epicsInt16) value;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Convert String to Unsigned Short */
|
||||
static long cvt_st_us(
|
||||
char *from,
|
||||
unsigned short *to,
|
||||
epicsUInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{
|
||||
unsigned short value;
|
||||
{
|
||||
char *end;
|
||||
unsigned long value;
|
||||
|
||||
if (sscanf(from, "%hu", &value) == 1) {
|
||||
*to = value;
|
||||
return(0);
|
||||
}
|
||||
if(strlen(from) == 0) {
|
||||
if (*from == 0) {
|
||||
*to = 0;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return(-1); /* Change to SYMBOL */
|
||||
}
|
||||
value = strtoul(from, &end, 10);
|
||||
if (end > from) {
|
||||
*to = (epicsUInt16) value;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Convert String to Long */
|
||||
static long cvt_st_l(
|
||||
@@ -172,18 +177,19 @@ static long cvt_st_l(
|
||||
epicsInt32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{
|
||||
epicsInt32 value;
|
||||
char *end;
|
||||
long value;
|
||||
|
||||
if (sscanf(from, "%d", &value) == 1) {
|
||||
*to = value;
|
||||
return(0);
|
||||
}
|
||||
if(strlen(from) == 0) {
|
||||
if (*from == 0) {
|
||||
*to = 0;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return(-1); /* Change to SYMBOL */
|
||||
value = strtol(from, &end, 10);
|
||||
if (end > from) {
|
||||
*to = (epicsInt32) value;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Convert String to Unsigned Long */
|
||||
@@ -194,58 +200,55 @@ static long cvt_st_ul(
|
||||
{
|
||||
double value;
|
||||
|
||||
/*Convert to double first so that numbers like 1.0e3 convert properly*/
|
||||
if (*from == 0) {
|
||||
*to = 0;
|
||||
return 0;
|
||||
}
|
||||
/*Convert via double so that numbers like 1.0e3 convert properly*/
|
||||
/*Problem was old database access said to get unsigned long as double*/
|
||||
if (epicsScanDouble(from, &value) == 1) {
|
||||
*to = (epicsUInt32)value;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
if(strlen(from) == 0) {
|
||||
*to = 0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
return(-1); /* Change to SYMBOL */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Convert String to Float */
|
||||
static long cvt_st_f(
|
||||
char *from,
|
||||
float *to,
|
||||
epicsFloat32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{
|
||||
float value;
|
||||
|
||||
if (*from == 0) {
|
||||
*to = 0.0;
|
||||
return 0;
|
||||
}
|
||||
if (epicsScanFloat(from, &value) == 1) {
|
||||
*to = value;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
if(strlen(from) == 0) {
|
||||
*to = 0.0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
return(-1); /* Change to SYMBOL */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Convert String to Double */
|
||||
static long cvt_st_d(
|
||||
char *from,
|
||||
double *to,
|
||||
epicsFloat64 *to,
|
||||
struct dbAddr *paddr)
|
||||
{
|
||||
double value;
|
||||
|
||||
if (*from == 0) {
|
||||
*to = 0.0;
|
||||
return 0;
|
||||
}
|
||||
if (epicsScanDouble(from, &value) == 1) {
|
||||
*to = value;
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
if(strlen(from) == 0) {
|
||||
*to = 0.0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
return(-1); /* Change to SYMBOL */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Convert String to Enumerated */
|
||||
@@ -356,281 +359,281 @@ static long cvt_st_device(
|
||||
|
||||
/* Convert Char to String */
|
||||
static long cvt_c_st(
|
||||
char *from,
|
||||
epicsInt8 *from,
|
||||
char *to,
|
||||
struct dbAddr *paddr)
|
||||
{ cvtCharToString(*from, to); return(0); }
|
||||
|
||||
/* Convert Char to Char */
|
||||
static long cvt_c_c(
|
||||
char *from,
|
||||
char *to,
|
||||
epicsInt8 *from,
|
||||
epicsInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Char to Unsigned Char */
|
||||
static long cvt_c_uc(
|
||||
char *from,
|
||||
unsigned char *to,
|
||||
epicsInt8 *from,
|
||||
epicsUInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Char to Short */
|
||||
static long cvt_c_s(
|
||||
char *from,
|
||||
short *to,
|
||||
epicsInt8 *from,
|
||||
epicsInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Char to Unsigned Short */
|
||||
static long cvt_c_us(
|
||||
char *from,
|
||||
unsigned short *to,
|
||||
epicsInt8 *from,
|
||||
epicsUInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Char to Long */
|
||||
static long cvt_c_l(
|
||||
char *from,
|
||||
epicsInt8 *from,
|
||||
epicsInt32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Char to Unsigned Long */
|
||||
static long cvt_c_ul(
|
||||
char *from,
|
||||
epicsInt8 *from,
|
||||
epicsUInt32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Char to Float */
|
||||
static long cvt_c_f(
|
||||
char *from,
|
||||
float *to,
|
||||
epicsInt8 *from,
|
||||
epicsFloat32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Char to Double */
|
||||
static long cvt_c_d(
|
||||
char *from,
|
||||
double *to,
|
||||
epicsInt8 *from,
|
||||
epicsFloat64 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Char to Enumerated */
|
||||
static long cvt_c_e(
|
||||
char *from,
|
||||
epicsInt8 *from,
|
||||
epicsEnum16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Char to String */
|
||||
static long cvt_uc_st(
|
||||
unsigned char *from,
|
||||
epicsUInt8 *from,
|
||||
char *to,
|
||||
struct dbAddr *paddr)
|
||||
{ cvtUcharToString(*from, to); return(0); }
|
||||
|
||||
/* Convert Unsigned Char to Char */
|
||||
static long cvt_uc_c(
|
||||
unsigned char *from,
|
||||
char *to,
|
||||
epicsUInt8 *from,
|
||||
epicsInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Char to Unsigned Char */
|
||||
static long cvt_uc_uc(
|
||||
unsigned char *from,
|
||||
unsigned char *to,
|
||||
epicsUInt8 *from,
|
||||
epicsUInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Char to Short */
|
||||
static long cvt_uc_s(
|
||||
unsigned char *from,
|
||||
short *to,
|
||||
epicsUInt8 *from,
|
||||
epicsInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Char to Unsigned Short */
|
||||
static long cvt_uc_us(
|
||||
unsigned char *from,
|
||||
unsigned short *to,
|
||||
epicsUInt8 *from,
|
||||
epicsUInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Char to Long */
|
||||
static long cvt_uc_l(
|
||||
unsigned char *from,
|
||||
epicsUInt8 *from,
|
||||
epicsInt32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Char to Unsigned Long */
|
||||
static long cvt_uc_ul(
|
||||
unsigned char *from,
|
||||
epicsUInt8 *from,
|
||||
epicsUInt32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Char to Float */
|
||||
static long cvt_uc_f(
|
||||
unsigned char *from,
|
||||
float *to,
|
||||
epicsUInt8 *from,
|
||||
epicsFloat32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Char to Double */
|
||||
static long cvt_uc_d(
|
||||
unsigned char *from,
|
||||
double *to,
|
||||
epicsUInt8 *from,
|
||||
epicsFloat64 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Char to Enumerated */
|
||||
static long cvt_uc_e(
|
||||
unsigned char *from,
|
||||
epicsUInt8 *from,
|
||||
epicsEnum16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Short to String */
|
||||
static long cvt_s_st(
|
||||
short *from,
|
||||
epicsInt16 *from,
|
||||
char *to,
|
||||
struct dbAddr *paddr)
|
||||
{ cvtShortToString(*from, to); return(0); }
|
||||
|
||||
/* Convert Short to Char */
|
||||
static long cvt_s_c(
|
||||
short *from,
|
||||
char *to,
|
||||
epicsInt16 *from,
|
||||
epicsInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Short to Unsigned Char */
|
||||
static long cvt_s_uc(
|
||||
short *from,
|
||||
unsigned char *to,
|
||||
epicsInt16 *from,
|
||||
epicsUInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Short to Short */
|
||||
static long cvt_s_s(
|
||||
short *from,
|
||||
short *to,
|
||||
epicsInt16 *from,
|
||||
epicsInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Short to Unsigned Short */
|
||||
static long cvt_s_us(
|
||||
short *from,
|
||||
unsigned short *to,
|
||||
epicsInt16 *from,
|
||||
epicsUInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Short to Long */
|
||||
static long cvt_s_l(
|
||||
short *from,
|
||||
epicsInt16 *from,
|
||||
epicsInt32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Short to Unsigned Long */
|
||||
static long cvt_s_ul(
|
||||
short *from,
|
||||
epicsInt16 *from,
|
||||
epicsUInt32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Short to Float */
|
||||
static long cvt_s_f(
|
||||
short *from,
|
||||
float *to,
|
||||
epicsInt16 *from,
|
||||
epicsFloat32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Short to Double */
|
||||
static long cvt_s_d(
|
||||
short *from,
|
||||
double *to,
|
||||
epicsInt16 *from,
|
||||
epicsFloat64 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Short to Enumerated */
|
||||
static long cvt_s_e(
|
||||
short *from,
|
||||
epicsInt16 *from,
|
||||
epicsEnum16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Short to String */
|
||||
static long cvt_us_st(
|
||||
unsigned short *from,
|
||||
epicsUInt16 *from,
|
||||
char *to,
|
||||
struct dbAddr *paddr)
|
||||
{ cvtUshortToString(*from, to); return(0); }
|
||||
|
||||
/* Convert Unsigned Short to Char */
|
||||
static long cvt_us_c(
|
||||
unsigned short *from,
|
||||
char *to,
|
||||
epicsUInt16 *from,
|
||||
epicsInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Short to Unsigned Char */
|
||||
static long cvt_us_uc(
|
||||
unsigned short *from,
|
||||
unsigned char *to,
|
||||
epicsUInt16 *from,
|
||||
epicsUInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Short to Short */
|
||||
static long cvt_us_s(
|
||||
unsigned short *from,
|
||||
short *to,
|
||||
epicsUInt16 *from,
|
||||
epicsInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Short to Unsigned Short */
|
||||
static long cvt_us_us(
|
||||
unsigned short *from,
|
||||
unsigned short *to,
|
||||
epicsUInt16 *from,
|
||||
epicsUInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Short to Long */
|
||||
static long cvt_us_l(
|
||||
unsigned short *from,
|
||||
epicsUInt16 *from,
|
||||
epicsInt32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Short to Unsigned Long */
|
||||
static long cvt_us_ul(
|
||||
unsigned short *from,
|
||||
epicsUInt16 *from,
|
||||
epicsUInt32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Short to Float */
|
||||
static long cvt_us_f(
|
||||
unsigned short *from,
|
||||
float *to,
|
||||
epicsUInt16 *from,
|
||||
epicsFloat32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Short to Double */
|
||||
static long cvt_us_d(
|
||||
unsigned short *from,
|
||||
double *to,
|
||||
epicsUInt16 *from,
|
||||
epicsFloat64 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Short to Enumerated */
|
||||
static long cvt_us_e(
|
||||
unsigned short *from,
|
||||
unsigned short *to,
|
||||
epicsUInt16 *from,
|
||||
epicsUInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
@@ -644,28 +647,28 @@ static long cvt_l_st(
|
||||
/* Convert Long to Char */
|
||||
static long cvt_l_c(
|
||||
epicsInt32 *from,
|
||||
char *to,
|
||||
epicsInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Long to Unsigned Char */
|
||||
static long cvt_l_uc(
|
||||
epicsInt32 *from,
|
||||
unsigned char *to,
|
||||
epicsUInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Long to Short */
|
||||
static long cvt_l_s(
|
||||
epicsInt32 *from,
|
||||
short *to,
|
||||
epicsInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Long to Unsigned Short */
|
||||
static long cvt_l_us(
|
||||
epicsInt32 *from,
|
||||
unsigned short *to,
|
||||
epicsUInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
@@ -686,14 +689,14 @@ static long cvt_l_ul(
|
||||
/* Convert Long to Float */
|
||||
static long cvt_l_f(
|
||||
epicsInt32 *from,
|
||||
float *to,
|
||||
epicsFloat32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Long to Double */
|
||||
static long cvt_l_d(
|
||||
epicsInt32 *from,
|
||||
double *to,
|
||||
epicsFloat64 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
@@ -714,28 +717,28 @@ static long cvt_ul_st(
|
||||
/* Convert Unsigned Long to Char */
|
||||
static long cvt_ul_c(
|
||||
epicsUInt32 *from,
|
||||
char *to,
|
||||
epicsInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Long to Unsigned Char */
|
||||
static long cvt_ul_uc(
|
||||
epicsUInt32 *from,
|
||||
unsigned char *to,
|
||||
epicsUInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Long to Short */
|
||||
static long cvt_ul_s(
|
||||
epicsUInt32 *from,
|
||||
short *to,
|
||||
epicsInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Long to Unsigned Short */
|
||||
static long cvt_ul_us(
|
||||
epicsUInt32 *from,
|
||||
unsigned short *to,
|
||||
epicsUInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
@@ -756,14 +759,14 @@ static long cvt_ul_ul(
|
||||
/* Convert Unsigned Long to Float */
|
||||
static long cvt_ul_f(
|
||||
epicsUInt32 *from,
|
||||
float *to,
|
||||
epicsFloat32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Unsigned Long to Double */
|
||||
static long cvt_ul_d(
|
||||
epicsUInt32 *from,
|
||||
double *to,
|
||||
epicsFloat64 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
@@ -776,7 +779,7 @@ static long cvt_ul_e(
|
||||
|
||||
/* Convert Float to String */
|
||||
static long cvt_f_st(
|
||||
float *from,
|
||||
epicsFloat32 *from,
|
||||
char *to,
|
||||
struct dbAddr *paddr)
|
||||
{
|
||||
@@ -794,70 +797,70 @@ static long cvt_f_st(
|
||||
|
||||
/* Convert Float to Char */
|
||||
static long cvt_f_c(
|
||||
float *from,
|
||||
char *to,
|
||||
epicsFloat32 *from,
|
||||
epicsInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Float to Unsigned Char */
|
||||
static long cvt_f_uc(
|
||||
float *from,
|
||||
unsigned char *to,
|
||||
epicsFloat32 *from,
|
||||
epicsUInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Float to Short */
|
||||
static long cvt_f_s(
|
||||
float *from,
|
||||
short *to,
|
||||
epicsFloat32 *from,
|
||||
epicsInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Float to Unsigned Short */
|
||||
static long cvt_f_us(
|
||||
float *from,
|
||||
unsigned short *to,
|
||||
epicsFloat32 *from,
|
||||
epicsUInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Float to Long */
|
||||
static long cvt_f_l(
|
||||
float *from,
|
||||
epicsFloat32 *from,
|
||||
epicsInt32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Float to Unsigned Long */
|
||||
static long cvt_f_ul(
|
||||
float *from,
|
||||
epicsFloat32 *from,
|
||||
epicsUInt32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Float to Float */
|
||||
static long cvt_f_f(
|
||||
float *from,
|
||||
float *to,
|
||||
epicsFloat32 *from,
|
||||
epicsFloat32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Float to Double */
|
||||
static long cvt_f_d(
|
||||
float *from,
|
||||
double *to,
|
||||
epicsFloat32 *from,
|
||||
epicsFloat64 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Float to Enumerated */
|
||||
static long cvt_f_e(
|
||||
float *from,
|
||||
epicsFloat32 *from,
|
||||
epicsEnum16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Double to String */
|
||||
static long cvt_d_st(
|
||||
double *from,
|
||||
epicsFloat64 *from,
|
||||
char *to,
|
||||
struct dbAddr *paddr)
|
||||
{
|
||||
@@ -875,63 +878,63 @@ static long cvt_d_st(
|
||||
|
||||
/* Convert Double to Char */
|
||||
static long cvt_d_c(
|
||||
double *from,
|
||||
char *to,
|
||||
epicsFloat64 *from,
|
||||
epicsInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Double to Unsigned Char */
|
||||
static long cvt_d_uc(
|
||||
double *from,
|
||||
unsigned char *to,
|
||||
epicsFloat64 *from,
|
||||
epicsUInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Double to Short */
|
||||
static long cvt_d_s(
|
||||
double *from,
|
||||
short *to,
|
||||
epicsFloat64 *from,
|
||||
epicsInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Double to Unsigned Short */
|
||||
static long cvt_d_us(
|
||||
double *from,
|
||||
unsigned short *to,
|
||||
epicsFloat64 *from,
|
||||
epicsUInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Double to Long */
|
||||
static long cvt_d_l(
|
||||
double *from,
|
||||
epicsFloat64 *from,
|
||||
epicsInt32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Double to Unsigned Long */
|
||||
static long cvt_d_ul(
|
||||
double *from,
|
||||
epicsFloat64 *from,
|
||||
epicsUInt32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Double to Float */
|
||||
static long cvt_d_f(
|
||||
double *from,
|
||||
float *to,
|
||||
epicsFloat64 *from,
|
||||
epicsFloat32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to = epicsConvertDoubleToFloat(*from); return 0;}
|
||||
|
||||
/* Convert Double to Double */
|
||||
static long cvt_d_d(
|
||||
double *from,
|
||||
double *to,
|
||||
epicsFloat64 *from,
|
||||
epicsFloat64 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Double to Enumerated */
|
||||
static long cvt_d_e(
|
||||
double *from,
|
||||
epicsFloat64 *from,
|
||||
epicsEnum16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
@@ -939,28 +942,28 @@ static long cvt_d_e(
|
||||
/* Convert Enumerated to Char */
|
||||
static long cvt_e_c(
|
||||
epicsEnum16 *from,
|
||||
char *to,
|
||||
epicsInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Enumerated to Unsigned Char */
|
||||
static long cvt_e_uc(
|
||||
epicsEnum16 *from,
|
||||
unsigned char *to,
|
||||
epicsUInt8 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Enumerated to Short */
|
||||
static long cvt_e_s(
|
||||
epicsEnum16 *from,
|
||||
short *to,
|
||||
epicsInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Enumerated to Unsigned Short */
|
||||
static long cvt_e_us(
|
||||
epicsEnum16 *from,
|
||||
unsigned short *to,
|
||||
epicsUInt16 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
@@ -981,14 +984,14 @@ static long cvt_e_ul(
|
||||
/* Convert Enumerated to Float */
|
||||
static long cvt_e_f(
|
||||
epicsEnum16 *from,
|
||||
float *to,
|
||||
epicsFloat32 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
/* Convert Enumerated to Double */
|
||||
static long cvt_e_d(
|
||||
epicsEnum16 *from,
|
||||
double *to,
|
||||
epicsFloat64 *to,
|
||||
struct dbAddr *paddr)
|
||||
{ *to=*from; return(0); }
|
||||
|
||||
|
||||
1304
src/db/dbTest.c
1304
src/db/dbTest.c
File diff suppressed because it is too large
Load Diff
@@ -153,56 +153,56 @@ int main(int argc,char **argv)
|
||||
name[strlen(pdbFldDes->name)] = 0;
|
||||
switch(pdbFldDes->field_type) {
|
||||
case DBF_STRING :
|
||||
fprintf(outFile,"\tchar\t\t%s[%d]; /*%s*/\n",
|
||||
name,pdbFldDes->size,pdbFldDes->prompt);
|
||||
fprintf(outFile, "\tchar\t\t%s[%d];\t/* %s */\n",
|
||||
name, pdbFldDes->size, pdbFldDes->prompt);
|
||||
break;
|
||||
case DBF_CHAR :
|
||||
fprintf(outFile,"\tchar\t\t%s;\t/*%s*/\n",
|
||||
name,pdbFldDes->prompt);
|
||||
fprintf(outFile, "\tepicsInt8\t%s;\t/* %s */\n",
|
||||
name, pdbFldDes->prompt);
|
||||
break;
|
||||
case DBF_UCHAR :
|
||||
fprintf(outFile,"\tunsigned char\t%s;\t/*%s*/\n",
|
||||
name,pdbFldDes->prompt);
|
||||
fprintf(outFile, "\tepicsUInt8\t%s;\t/* %s */\n",
|
||||
name, pdbFldDes->prompt);
|
||||
break;
|
||||
case DBF_SHORT :
|
||||
fprintf(outFile,"\tshort\t\t%s;\t/*%s*/\n",
|
||||
name,pdbFldDes->prompt);
|
||||
fprintf(outFile, "\tepicsInt16\t%s;\t/* %s */\n",
|
||||
name, pdbFldDes->prompt);
|
||||
break;
|
||||
case DBF_USHORT :
|
||||
fprintf(outFile,"\tunsigned short\t%s;\t/*%s*/\n",
|
||||
name,pdbFldDes->prompt);
|
||||
fprintf(outFile, "\tepicsUInt16\t%s;\t/* %s */\n",
|
||||
name, pdbFldDes->prompt);
|
||||
break;
|
||||
case DBF_LONG :
|
||||
fprintf(outFile,"\tepicsInt32\t\t%s;\t/*%s*/\n",
|
||||
name,pdbFldDes->prompt);
|
||||
fprintf(outFile, "\tepicsInt32\t%s;\t/* %s */\n",
|
||||
name, pdbFldDes->prompt);
|
||||
break;
|
||||
case DBF_ULONG :
|
||||
fprintf(outFile,"\tunsigned long\t%s;\t/*%s*/\n",
|
||||
name,pdbFldDes->prompt);
|
||||
fprintf(outFile, "\tepicsUInt32\t%s;\t/* %s */\n",
|
||||
name, pdbFldDes->prompt);
|
||||
break;
|
||||
case DBF_FLOAT :
|
||||
fprintf(outFile,"\tfloat\t\t%s;\t/*%s*/\n",
|
||||
name,pdbFldDes->prompt);
|
||||
fprintf(outFile, "\tepicsFloat32\t%s;\t/* %s */\n",
|
||||
name, pdbFldDes->prompt);
|
||||
break;
|
||||
case DBF_DOUBLE :
|
||||
fprintf(outFile,"\tdouble\t\t%s;\t/*%s*/\n",
|
||||
name,pdbFldDes->prompt);
|
||||
fprintf(outFile, "\tepicsFloat64\t%s;\t/* %s */\n",
|
||||
name, pdbFldDes->prompt);
|
||||
break;
|
||||
case DBF_ENUM :
|
||||
case DBF_MENU :
|
||||
case DBF_DEVICE :
|
||||
fprintf(outFile,"\tepicsEnum16\t%s;\t/*%s*/\n",
|
||||
name,pdbFldDes->prompt);
|
||||
fprintf(outFile, "\tepicsEnum16\t%s;\t/* %s */\n",
|
||||
name, pdbFldDes->prompt);
|
||||
break;
|
||||
case DBF_INLINK :
|
||||
case DBF_OUTLINK :
|
||||
case DBF_FWDLINK :
|
||||
fprintf(outFile,"\tDBLINK\t\t%s;\t/*%s*/\n",
|
||||
name,pdbFldDes->prompt);
|
||||
fprintf(outFile, "\tDBLINK\t\t%s;\t/* %s */\n",
|
||||
name, pdbFldDes->prompt);
|
||||
break;
|
||||
case DBF_NOACCESS:
|
||||
fprintf(outFile,"\t%s;\t/*%s*/\n",
|
||||
pdbFldDes->extra,pdbFldDes->prompt);
|
||||
fprintf(outFile, "\t%s;\t/* %s */\n",
|
||||
pdbFldDes->extra, pdbFldDes->prompt);
|
||||
break;
|
||||
default:
|
||||
fprintf(outFile,"ILLEGAL FIELD TYPE\n");
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 Southeastern Universities Research Association, as
|
||||
* Operator of Thomas Jefferson National Accelerator Facility.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* recAai.c */
|
||||
@@ -10,7 +9,6 @@
|
||||
/* recAai.c - Record Support Routines for Array Analog In records */
|
||||
/*
|
||||
* Original Author: Dave Barker
|
||||
* Current Author: Dave Barker
|
||||
* Date: 10/24/93
|
||||
*
|
||||
* C E B A F
|
||||
@@ -47,20 +45,20 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long init_record(aaiRecord *, int);
|
||||
static long process(aaiRecord *);
|
||||
#define special NULL
|
||||
static long get_value();
|
||||
static long cvt_dbaddr();
|
||||
static long get_array_info();
|
||||
static long put_array_info();
|
||||
static long get_units();
|
||||
static long get_precision();
|
||||
static long get_value(aaiRecord *, struct valueDes *);
|
||||
static long cvt_dbaddr(DBADDR *);
|
||||
static long get_array_info(DBADDR *, long *, long *);
|
||||
static long put_array_info(DBADDR *, long);
|
||||
static long get_units(DBADDR *, char *);
|
||||
static long get_precision(DBADDR *, long *);
|
||||
#define get_enum_str NULL
|
||||
#define get_enum_strs NULL
|
||||
#define put_enum_str NULL
|
||||
static long get_graphic_double();
|
||||
static long get_control_double();
|
||||
static long get_graphic_double(DBADDR *, struct dbr_grDouble *);
|
||||
static long get_control_double(DBADDR *, struct dbr_ctrlDouble *);
|
||||
#define get_alarm_double NULL
|
||||
|
||||
rset aaiRSET={
|
||||
@@ -97,14 +95,12 @@ struct aaidset { /* aai dset */
|
||||
/*sizes of field types*/
|
||||
static int sizeofTypes[] = {0,1,1,2,2,4,4,4,8,2};
|
||||
|
||||
static void monitor();
|
||||
static long readValue();
|
||||
static void monitor(aaiRecord *);
|
||||
static long readValue(aaiRecord *);
|
||||
|
||||
|
||||
|
||||
static long init_record(paai,pass)
|
||||
struct aaiRecord *paai;
|
||||
int pass;
|
||||
static long init_record(aaiRecord *paai, int pass)
|
||||
{
|
||||
struct aaidset *pdset;
|
||||
long status;
|
||||
@@ -131,8 +127,7 @@ static long init_record(paai,pass)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long process(paai)
|
||||
struct aaiRecord *paai;
|
||||
static long process(aaiRecord *paai)
|
||||
{
|
||||
struct aaidset *pdset = (struct aaidset *)(paai->dset);
|
||||
long status;
|
||||
@@ -162,9 +157,7 @@ static long process(paai)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_value(paai,pvdes)
|
||||
struct aaiRecord *paai;
|
||||
struct valueDes *pvdes;
|
||||
static long get_value(aaiRecord *paai,struct valueDes *pvdes)
|
||||
{
|
||||
|
||||
pvdes->no_elements=paai->nelm;
|
||||
@@ -173,10 +166,9 @@ static long get_value(paai,pvdes)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long cvt_dbaddr(paddr)
|
||||
struct dbAddr *paddr;
|
||||
static long cvt_dbaddr(DBADDR *paddr)
|
||||
{
|
||||
struct aaiRecord *paai=(struct aaiRecord *)paddr->precord;
|
||||
aaiRecord *paai=(aaiRecord *)paddr->precord;
|
||||
|
||||
paddr->pfield = (void *)(paai->bptr);
|
||||
paddr->no_elements = paai->nelm;
|
||||
@@ -187,43 +179,34 @@ static long cvt_dbaddr(paddr)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_array_info(paddr,no_elements,offset)
|
||||
struct dbAddr *paddr;
|
||||
long *no_elements;
|
||||
long *offset;
|
||||
static long get_array_info(DBADDR *paddr, long *no_elements, long *offset)
|
||||
{
|
||||
struct aaiRecord *paai=(struct aaiRecord *)paddr->precord;
|
||||
aaiRecord *paai=(aaiRecord *)paddr->precord;
|
||||
|
||||
*no_elements = paai->nelm;
|
||||
*offset = 0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long put_array_info(paddr,nNew)
|
||||
struct dbAddr *paddr;
|
||||
long nNew;
|
||||
static long put_array_info(DBADDR *paddr, long nNew)
|
||||
{
|
||||
struct aaiRecord *paai=(struct aaiRecord *)paddr->precord;
|
||||
aaiRecord *paai=(aaiRecord *)paddr->precord;
|
||||
|
||||
paai->nelm = nNew;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_units(paddr,units)
|
||||
struct dbAddr *paddr;
|
||||
char *units;
|
||||
static long get_units(DBADDR *paddr,char *units)
|
||||
{
|
||||
struct aaiRecord *paai=(struct aaiRecord *)paddr->precord;
|
||||
aaiRecord *paai=(aaiRecord *)paddr->precord;
|
||||
|
||||
strncpy(units,paai->egu,DB_UNITS_SIZE);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_precision(paddr,precision)
|
||||
struct dbAddr *paddr;
|
||||
long *precision;
|
||||
static long get_precision(DBADDR *paddr, long *precision)
|
||||
{
|
||||
struct aaiRecord *paai=(struct aaiRecord *)paddr->precord;
|
||||
aaiRecord *paai=(aaiRecord *)paddr->precord;
|
||||
|
||||
*precision = paai->prec;
|
||||
if(paddr->pfield==(void *)paai->bptr) return(0);
|
||||
@@ -231,11 +214,9 @@ static long get_precision(paddr,precision)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_graphic_double(paddr,pgd)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_grDouble *pgd;
|
||||
static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd)
|
||||
{
|
||||
struct aaiRecord *paai=(struct aaiRecord *)paddr->precord;
|
||||
aaiRecord *paai=(aaiRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)paai->bptr){
|
||||
pgd->upper_disp_limit = paai->hopr;
|
||||
@@ -243,11 +224,9 @@ static long get_graphic_double(paddr,pgd)
|
||||
} else recGblGetGraphicDouble(paddr,pgd);
|
||||
return(0);
|
||||
}
|
||||
static long get_control_double(paddr,pcd)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_ctrlDouble *pcd;
|
||||
static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
|
||||
{
|
||||
struct aaiRecord *paai=(struct aaiRecord *)paddr->precord;
|
||||
aaiRecord *paai=(aaiRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)paai->bptr){
|
||||
pcd->upper_ctrl_limit = paai->hopr;
|
||||
@@ -256,8 +235,7 @@ static long get_control_double(paddr,pcd)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void monitor(paai)
|
||||
struct aaiRecord *paai;
|
||||
static void monitor(aaiRecord *paai)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
|
||||
@@ -268,8 +246,7 @@ static void monitor(paai)
|
||||
|
||||
}
|
||||
|
||||
static long readValue(paai)
|
||||
struct aaiRecord *paai;
|
||||
static long readValue(aaiRecord *paai)
|
||||
{
|
||||
long status;
|
||||
struct aaidset *pdset = (struct aaidset *) (paai->dset);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 Southeastern Universities Research Association, as
|
||||
* Operator of Thomas Jefferson National Accelerator Facility.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* recAao.c */
|
||||
@@ -10,7 +9,6 @@
|
||||
/* recAao.c - Record Support Routines for Array Analog Out records */
|
||||
/*
|
||||
* Original Author: Dave Barker
|
||||
* Current Author: Dave Barker
|
||||
* Date: 10/28/93
|
||||
*
|
||||
* C E B A F
|
||||
@@ -47,20 +45,20 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long init_record(aaoRecord *, int);
|
||||
static long process(aaoRecord *);
|
||||
#define special NULL
|
||||
static long get_value();
|
||||
static long cvt_dbaddr();
|
||||
static long get_array_info();
|
||||
static long put_array_info();
|
||||
static long get_units();
|
||||
static long get_precision();
|
||||
static long get_value(aaoRecord *, struct valueDes *);
|
||||
static long cvt_dbaddr(DBADDR *);
|
||||
static long get_array_info(DBADDR *, long *, long *);
|
||||
static long put_array_info(DBADDR *, long);
|
||||
static long get_units(DBADDR *, char *);
|
||||
static long get_precision(DBADDR *, long *);
|
||||
#define get_enum_str NULL
|
||||
#define get_enum_strs NULL
|
||||
#define put_enum_str NULL
|
||||
static long get_graphic_double();
|
||||
static long get_control_double();
|
||||
static long get_graphic_double(DBADDR *, struct dbr_grDouble *);
|
||||
static long get_control_double(DBADDR *, struct dbr_ctrlDouble *);
|
||||
#define get_alarm_double NULL
|
||||
|
||||
rset aaoRSET={
|
||||
@@ -97,14 +95,12 @@ struct aaodset { /* aao dset */
|
||||
/*sizes of field types*/
|
||||
static int sizeofTypes[] = {0,1,1,2,2,4,4,4,8,2};
|
||||
|
||||
static void monitor();
|
||||
static long writeValue();
|
||||
static void monitor(aaoRecord *);
|
||||
static long writeValue(aaoRecord *);
|
||||
|
||||
|
||||
|
||||
static long init_record(paao,pass)
|
||||
struct aaoRecord *paao;
|
||||
int pass;
|
||||
static long init_record(aaoRecord *paao, int pass)
|
||||
{
|
||||
struct aaodset *pdset;
|
||||
long status;
|
||||
@@ -131,8 +127,7 @@ static long init_record(paao,pass)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long process(paao)
|
||||
struct aaoRecord *paao;
|
||||
static long process(aaoRecord *paao)
|
||||
{
|
||||
struct aaodset *pdset = (struct aaodset *)(paao->dset);
|
||||
long status;
|
||||
@@ -159,9 +154,7 @@ static long process(paao)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_value(paao,pvdes)
|
||||
struct aaoRecord *paao;
|
||||
struct valueDes *pvdes;
|
||||
static long get_value(aaoRecord *paao, struct valueDes *pvdes)
|
||||
{
|
||||
|
||||
pvdes->no_elements=paao->nelm;
|
||||
@@ -170,10 +163,9 @@ static long get_value(paao,pvdes)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long cvt_dbaddr(paddr)
|
||||
struct dbAddr *paddr;
|
||||
static long cvt_dbaddr(DBADDR *paddr)
|
||||
{
|
||||
struct aaoRecord *paao=(struct aaoRecord *)paddr->precord;
|
||||
aaoRecord *paao=(aaoRecord *)paddr->precord;
|
||||
|
||||
paddr->pfield = (void *)(paao->bptr);
|
||||
paddr->no_elements = paao->nelm;
|
||||
@@ -184,43 +176,34 @@ static long cvt_dbaddr(paddr)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_array_info(paddr,no_elements,offset)
|
||||
struct dbAddr *paddr;
|
||||
long *no_elements;
|
||||
long *offset;
|
||||
static long get_array_info(DBADDR *paddr, long *no_elements, long *offset)
|
||||
{
|
||||
struct aaoRecord *paao=(struct aaoRecord *)paddr->precord;
|
||||
aaoRecord *paao=(aaoRecord *)paddr->precord;
|
||||
|
||||
*no_elements = paao->nelm;
|
||||
*offset = 0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long put_array_info(paddr,nNew)
|
||||
struct dbAddr *paddr;
|
||||
long nNew;
|
||||
static long put_array_info(DBADDR *paddr, long nNew)
|
||||
{
|
||||
struct aaoRecord *paao=(struct aaoRecord *)paddr->precord;
|
||||
aaoRecord *paao=(aaoRecord *)paddr->precord;
|
||||
|
||||
paao->nelm = nNew;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_units(paddr,units)
|
||||
struct dbAddr *paddr;
|
||||
char *units;
|
||||
static long get_units(DBADDR *paddr, char *units)
|
||||
{
|
||||
struct aaoRecord *paao=(struct aaoRecord *)paddr->precord;
|
||||
aaoRecord *paao=(aaoRecord *)paddr->precord;
|
||||
|
||||
strncpy(units,paao->egu,DB_UNITS_SIZE);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_precision(paddr,precision)
|
||||
struct dbAddr *paddr;
|
||||
long *precision;
|
||||
static long get_precision(DBADDR *paddr, long *precision)
|
||||
{
|
||||
struct aaoRecord *paao=(struct aaoRecord *)paddr->precord;
|
||||
aaoRecord *paao=(aaoRecord *)paddr->precord;
|
||||
|
||||
*precision = paao->prec;
|
||||
if(paddr->pfield==(void *)paao->bptr) return(0);
|
||||
@@ -228,11 +211,9 @@ static long get_precision(paddr,precision)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_graphic_double(paddr,pgd)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_grDouble *pgd;
|
||||
static long get_graphic_double(DBADDR *paddr,struct dbr_grDouble *pgd)
|
||||
{
|
||||
struct aaoRecord *paao=(struct aaoRecord *)paddr->precord;
|
||||
aaoRecord *paao=(aaoRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)paao->bptr){
|
||||
pgd->upper_disp_limit = paao->hopr;
|
||||
@@ -240,11 +221,9 @@ static long get_graphic_double(paddr,pgd)
|
||||
} else recGblGetGraphicDouble(paddr,pgd);
|
||||
return(0);
|
||||
}
|
||||
static long get_control_double(paddr,pcd)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_ctrlDouble *pcd;
|
||||
static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd)
|
||||
{
|
||||
struct aaoRecord *paao=(struct aaoRecord *)paddr->precord;
|
||||
aaoRecord *paao=(aaoRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)paao->bptr){
|
||||
pcd->upper_ctrl_limit = paao->hopr;
|
||||
@@ -253,8 +232,7 @@ static long get_control_double(paddr,pcd)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void monitor(paao)
|
||||
struct aaoRecord *paao;
|
||||
static void monitor(aaoRecord *paao)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
|
||||
@@ -265,8 +243,7 @@ static void monitor(paao)
|
||||
|
||||
}
|
||||
|
||||
static long writeValue(paao)
|
||||
struct aaoRecord *paao;
|
||||
static long writeValue(aaoRecord *paao)
|
||||
{
|
||||
long status;
|
||||
struct aaodset *pdset = (struct aaodset *) (paao->dset);
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* base/src/rec $Id$ */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* aiRecord.c - Record Support Routines for Analog Input records */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
* Date: 7-14-89
|
||||
*
|
||||
*/
|
||||
@@ -46,21 +44,21 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long special();
|
||||
static long init_record(void *, int);
|
||||
static long process(void *);
|
||||
static long special(DBADDR *, int);
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
#define put_array_info NULL
|
||||
static long get_units();
|
||||
static long get_precision();
|
||||
static long get_units(DBADDR *, char *);
|
||||
static long get_precision(DBADDR *, long *);
|
||||
#define get_enum_str NULL
|
||||
#define get_enum_strs NULL
|
||||
#define put_enum_str NULL
|
||||
static long get_graphic_double();
|
||||
static long get_control_double();
|
||||
static long get_alarm_double();
|
||||
static long get_graphic_double(DBADDR *, struct dbr_grDouble *);
|
||||
static long get_control_double(DBADDR *, struct dbr_ctrlDouble *);
|
||||
static long get_alarm_double(DBADDR *, struct dbr_alDouble *);
|
||||
|
||||
rset aiRSET={
|
||||
RSETNUMBER,
|
||||
@@ -281,47 +279,60 @@ static long get_alarm_double(DBADDR *paddr,struct dbr_alDouble *pad)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void checkAlarms(aiRecord *pai)
|
||||
static void checkAlarms(aiRecord *prec)
|
||||
{
|
||||
double val;
|
||||
double hyst, lalm, hihi, high, low, lolo;
|
||||
unsigned short hhsv, llsv, hsv, lsv;
|
||||
double val, hyst, lalm;
|
||||
double alev;
|
||||
epicsEnum16 asev;
|
||||
|
||||
if (pai->udf) {
|
||||
recGblSetSevr(pai,UDF_ALARM,INVALID_ALARM);
|
||||
return;
|
||||
}
|
||||
hihi = pai->hihi; lolo = pai->lolo; high = pai->high; low = pai->low;
|
||||
hhsv = pai->hhsv; llsv = pai->llsv; hsv = pai->hsv; lsv = pai->lsv;
|
||||
val = pai->val; hyst = pai->hyst; lalm = pai->lalm;
|
||||
if (prec->udf) {
|
||||
recGblSetSevr(prec, UDF_ALARM, INVALID_ALARM);
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition hihi */
|
||||
if (hhsv && (val >= hihi || ((lalm==hihi) && (val >= hihi-hyst)))){
|
||||
if (recGblSetSevr(pai,HIHI_ALARM,pai->hhsv)) pai->lalm = hihi;
|
||||
return;
|
||||
}
|
||||
val = prec->val;
|
||||
hyst = prec->hyst;
|
||||
lalm = prec->lalm;
|
||||
|
||||
/* alarm condition lolo */
|
||||
if (llsv && (val <= lolo || ((lalm==lolo) && (val <= lolo+hyst)))){
|
||||
if (recGblSetSevr(pai,LOLO_ALARM,pai->llsv)) pai->lalm = lolo;
|
||||
return;
|
||||
}
|
||||
/* alarm condition hihi */
|
||||
asev = prec->hhsv;
|
||||
alev = prec->hihi;
|
||||
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIHI_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition high */
|
||||
if (hsv && (val >= high || ((lalm==high) && (val >= high-hyst)))){
|
||||
if (recGblSetSevr(pai,HIGH_ALARM,pai->hsv)) pai->lalm = high;
|
||||
return;
|
||||
}
|
||||
/* alarm condition lolo */
|
||||
asev = prec->llsv;
|
||||
alev = prec->lolo;
|
||||
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOLO_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition low */
|
||||
if (lsv && (val <= low || ((lalm==low) && (val <= low+hyst)))){
|
||||
if (recGblSetSevr(pai,LOW_ALARM,pai->lsv)) pai->lalm = low;
|
||||
return;
|
||||
}
|
||||
/* alarm condition high */
|
||||
asev = prec->hsv;
|
||||
alev = prec->high;
|
||||
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIGH_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* we get here only if val is out of alarm by at least hyst */
|
||||
pai->lalm = val;
|
||||
return;
|
||||
/* alarm condition low */
|
||||
asev = prec->lsv;
|
||||
alev = prec->low;
|
||||
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOW_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* we get here only if val is out of alarm by at least hyst */
|
||||
prec->lalm = val;
|
||||
return;
|
||||
}
|
||||
|
||||
static void convert(aiRecord *pai)
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* base/src/rec $Id$ */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* aoRecord.c - Record Support Routines for Analog Output records */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
* Date: 7-14-89
|
||||
*
|
||||
*/
|
||||
@@ -47,21 +45,21 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record(struct aoRecord *pao, int pass);
|
||||
static long process();
|
||||
static long special();
|
||||
static long init_record(aoRecord *pao, int pass);
|
||||
static long process(aoRecord *);
|
||||
static long special(DBADDR *, int);
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
#define put_array_info NULL
|
||||
static long get_units();
|
||||
static long get_precision();
|
||||
static long get_units(DBADDR *, char *);
|
||||
static long get_precision(DBADDR *, long *);
|
||||
#define get_enum_str NULL
|
||||
#define get_enum_strs NULL
|
||||
#define put_enum_str NULL
|
||||
static long get_graphic_double();
|
||||
static long get_control_double();
|
||||
static long get_alarm_double();
|
||||
static long get_graphic_double(DBADDR *, struct dbr_grDouble *);
|
||||
static long get_control_double(DBADDR *, struct dbr_ctrlDouble *);
|
||||
static long get_alarm_double(DBADDR *, struct dbr_alDouble *);
|
||||
|
||||
rset aoRSET={
|
||||
RSETNUMBER,
|
||||
@@ -96,13 +94,13 @@ epicsExportAddress(rset,aoRSET);
|
||||
|
||||
|
||||
|
||||
static void checkAlarms();
|
||||
static long fetch_value();
|
||||
static void convert();
|
||||
static void monitor();
|
||||
static long writeValue();
|
||||
static void checkAlarms(aoRecord *);
|
||||
static long fetch_value(aoRecord *, double *);
|
||||
static void convert(aoRecord *, double);
|
||||
static void monitor(aoRecord *);
|
||||
static long writeValue(aoRecord *);
|
||||
|
||||
static long init_record(struct aoRecord *pao, int pass)
|
||||
static long init_record(aoRecord *pao, int pass)
|
||||
{
|
||||
struct aodset *pdset;
|
||||
double eoff = pao->eoff, eslo = pao->eslo;
|
||||
@@ -170,8 +168,7 @@ static long init_record(struct aoRecord *pao, int pass)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long process(pao)
|
||||
struct aoRecord *pao;
|
||||
static long process(aoRecord *pao)
|
||||
{
|
||||
struct aodset *pdset = (struct aodset *)(pao->dset);
|
||||
long status=0;
|
||||
@@ -241,11 +238,9 @@ static long process(pao)
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long special(paddr,after)
|
||||
struct dbAddr *paddr;
|
||||
int after;
|
||||
static long special(DBADDR *paddr, int after)
|
||||
{
|
||||
struct aoRecord *pao = (struct aoRecord *)(paddr->precord);
|
||||
aoRecord *pao = (aoRecord *)(paddr->precord);
|
||||
struct aodset *pdset = (struct aodset *) (pao->dset);
|
||||
int special_type = paddr->special;
|
||||
|
||||
@@ -275,21 +270,17 @@ static long special(paddr,after)
|
||||
}
|
||||
}
|
||||
|
||||
static long get_units(paddr,units)
|
||||
struct dbAddr *paddr;
|
||||
char *units;
|
||||
static long get_units(DBADDR * paddr,char *units)
|
||||
{
|
||||
struct aoRecord *pao=(struct aoRecord *)paddr->precord;
|
||||
aoRecord *pao=(aoRecord *)paddr->precord;
|
||||
|
||||
strncpy(units,pao->egu,DB_UNITS_SIZE);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_precision(paddr,precision)
|
||||
struct dbAddr *paddr;
|
||||
long *precision;
|
||||
static long get_precision(DBADDR *paddr,long *precision)
|
||||
{
|
||||
struct aoRecord *pao=(struct aoRecord *)paddr->precord;
|
||||
aoRecord *pao=(aoRecord *)paddr->precord;
|
||||
|
||||
*precision = pao->prec;
|
||||
if(paddr->pfield == (void *)&pao->val
|
||||
@@ -299,11 +290,9 @@ static long get_precision(paddr,precision)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_graphic_double(paddr,pgd)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_grDouble *pgd;
|
||||
static long get_graphic_double(DBADDR *paddr,struct dbr_grDouble *pgd)
|
||||
{
|
||||
struct aoRecord *pao=(struct aoRecord *)paddr->precord;
|
||||
aoRecord *pao=(aoRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)&pao->val
|
||||
|| paddr->pfield==(void *)&pao->hihi
|
||||
@@ -318,11 +307,9 @@ static long get_graphic_double(paddr,pgd)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_control_double(paddr,pcd)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_ctrlDouble *pcd;
|
||||
static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
|
||||
{
|
||||
struct aoRecord *pao=(struct aoRecord *)paddr->precord;
|
||||
aoRecord *pao=(aoRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)&pao->val
|
||||
|| paddr->pfield==(void *)&pao->hihi
|
||||
@@ -336,11 +323,9 @@ static long get_control_double(paddr,pcd)
|
||||
} else recGblGetControlDouble(paddr,pcd);
|
||||
return(0);
|
||||
}
|
||||
static long get_alarm_double(paddr,pad)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_alDouble *pad;
|
||||
static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad)
|
||||
{
|
||||
struct aoRecord *pao=(struct aoRecord *)paddr->precord;
|
||||
aoRecord *pao=(aoRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)&pao->val){
|
||||
pad->upper_alarm_limit = pao->hihi;
|
||||
@@ -351,53 +336,63 @@ static long get_alarm_double(paddr,pad)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void checkAlarms(pao)
|
||||
struct aoRecord *pao;
|
||||
static void checkAlarms(aoRecord *prec)
|
||||
{
|
||||
double val;
|
||||
double hyst, lalm, hihi, high, low, lolo;
|
||||
unsigned short hhsv, llsv, hsv, lsv;
|
||||
double val, hyst, lalm;
|
||||
double alev;
|
||||
epicsEnum16 asev;
|
||||
|
||||
if (pao->udf) {
|
||||
recGblSetSevr(pao,UDF_ALARM,INVALID_ALARM);
|
||||
return;
|
||||
}
|
||||
hihi = pao->hihi; lolo = pao->lolo; high = pao->high; low = pao->low;
|
||||
hhsv = pao->hhsv; llsv = pao->llsv; hsv = pao->hsv; lsv = pao->lsv;
|
||||
val = pao->val; hyst = pao->hyst; lalm = pao->lalm;
|
||||
if (prec->udf) {
|
||||
recGblSetSevr(prec, UDF_ALARM, INVALID_ALARM);
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition hihi */
|
||||
if (hhsv && (val >= hihi || ((lalm==hihi) && (val >= hihi-hyst)))){
|
||||
if (recGblSetSevr(pao,HIHI_ALARM,pao->hhsv)) pao->lalm = hihi;
|
||||
return;
|
||||
}
|
||||
val = prec->val;
|
||||
hyst = prec->hyst;
|
||||
lalm = prec->lalm;
|
||||
|
||||
/* alarm condition lolo */
|
||||
if (llsv && (val <= lolo || ((lalm==lolo) && (val <= lolo+hyst)))){
|
||||
if (recGblSetSevr(pao,LOLO_ALARM,pao->llsv)) pao->lalm = lolo;
|
||||
return;
|
||||
}
|
||||
/* alarm condition hihi */
|
||||
asev = prec->hhsv;
|
||||
alev = prec->hihi;
|
||||
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIHI_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition high */
|
||||
if (hsv && (val >= high || ((lalm==high) && (val >= high-hyst)))){
|
||||
if (recGblSetSevr(pao,HIGH_ALARM,pao->hsv)) pao->lalm = high;
|
||||
return;
|
||||
}
|
||||
/* alarm condition lolo */
|
||||
asev = prec->llsv;
|
||||
alev = prec->lolo;
|
||||
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOLO_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition low */
|
||||
if (lsv && (val <= low || ((lalm==low) && (val <= low+hyst)))){
|
||||
if (recGblSetSevr(pao,LOW_ALARM,pao->lsv)) pao->lalm = low;
|
||||
return;
|
||||
}
|
||||
/* alarm condition high */
|
||||
asev = prec->hsv;
|
||||
alev = prec->high;
|
||||
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIGH_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* we get here only if val is out of alarm by at least hyst */
|
||||
pao->lalm = val;
|
||||
return;
|
||||
/* alarm condition low */
|
||||
asev = prec->lsv;
|
||||
alev = prec->low;
|
||||
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOW_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* we get here only if val is out of alarm by at least hyst */
|
||||
prec->lalm = val;
|
||||
return;
|
||||
}
|
||||
|
||||
static long fetch_value(pao,pvalue)
|
||||
struct aoRecord *pao;
|
||||
double *pvalue;
|
||||
static long fetch_value(aoRecord *pao,double *pvalue)
|
||||
{
|
||||
short save_pact;
|
||||
long status;
|
||||
@@ -422,9 +417,7 @@ static long fetch_value(pao,pvalue)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void convert(pao,value)
|
||||
struct aoRecord *pao;
|
||||
double value;
|
||||
static void convert(aoRecord *pao, double value)
|
||||
{
|
||||
/* check drive limits */
|
||||
if(pao->drvh > pao->drvl) {
|
||||
@@ -469,8 +462,7 @@ static void convert(pao,value)
|
||||
}
|
||||
|
||||
|
||||
static void monitor(pao)
|
||||
struct aoRecord *pao;
|
||||
static void monitor(aoRecord *pao)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
double delta;
|
||||
@@ -518,8 +510,7 @@ static void monitor(pao)
|
||||
return;
|
||||
}
|
||||
|
||||
static long writeValue(pao)
|
||||
struct aoRecord *pao;
|
||||
static long writeValue(aoRecord *pao)
|
||||
{
|
||||
long status;
|
||||
struct aodset *pdset = (struct aodset *) (pao->dset);
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* recBi.c */
|
||||
/* base/src/rec $Id$ */
|
||||
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* recBi.c - Record Support Routines for Binary Input records */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
* Date: 7-14-89
|
||||
*
|
||||
*/
|
||||
@@ -43,8 +41,8 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long init_record(biRecord *, int);
|
||||
static long process(biRecord *);
|
||||
#define special NULL
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
@@ -52,9 +50,9 @@ static long process();
|
||||
#define put_array_info NULL
|
||||
#define get_units NULL
|
||||
#define get_precision NULL
|
||||
static long get_enum_str();
|
||||
static long get_enum_strs();
|
||||
static long put_enum_str();
|
||||
static long get_enum_str(DBADDR *, char *);
|
||||
static long get_enum_strs(DBADDR *, struct dbr_enumStrs *);
|
||||
static long put_enum_str(DBADDR *, char *);
|
||||
#define get_graphic_double NULL
|
||||
#define get_control_double NULL
|
||||
#define get_alarm_double NULL
|
||||
@@ -87,13 +85,11 @@ struct bidset { /* binary input dset */
|
||||
/* if convert then raw value stored in rval */
|
||||
};
|
||||
epicsExportAddress(rset,biRSET);
|
||||
static void checkAlarms();
|
||||
static void monitor();
|
||||
static long readValue();
|
||||
static void checkAlarms(biRecord *);
|
||||
static void monitor(biRecord *);
|
||||
static long readValue(biRecord *);
|
||||
|
||||
static long init_record(pbi,pass)
|
||||
struct biRecord *pbi;
|
||||
int pass;
|
||||
static long init_record(biRecord *pbi, int pass)
|
||||
{
|
||||
struct bidset *pdset;
|
||||
long status;
|
||||
@@ -117,8 +113,7 @@ static long init_record(pbi,pass)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long process(pbi)
|
||||
struct biRecord *pbi;
|
||||
static long process(biRecord *pbi)
|
||||
{
|
||||
struct bidset *pdset = (struct bidset *)(pbi->dset);
|
||||
long status;
|
||||
@@ -153,11 +148,9 @@ static long process(pbi)
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long get_enum_str(paddr,pstring)
|
||||
struct dbAddr *paddr;
|
||||
char *pstring;
|
||||
static long get_enum_str(DBADDR *paddr, char *pstring)
|
||||
{
|
||||
struct biRecord *pbi=(struct biRecord *)paddr->precord;
|
||||
biRecord *pbi=(biRecord *)paddr->precord;
|
||||
int index;
|
||||
unsigned short *pfield = (unsigned short *)paddr->pfield;
|
||||
|
||||
@@ -177,11 +170,9 @@ static long get_enum_str(paddr,pstring)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_enum_strs(paddr,pes)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_enumStrs *pes;
|
||||
static long get_enum_strs(DBADDR *paddr,struct dbr_enumStrs *pes)
|
||||
{
|
||||
struct biRecord *pbi=(struct biRecord *)paddr->precord;
|
||||
biRecord *pbi=(biRecord *)paddr->precord;
|
||||
|
||||
pes->no_str = 2;
|
||||
memset(pes->strs,'\0',sizeof(pes->strs));
|
||||
@@ -192,11 +183,9 @@ static long get_enum_strs(paddr,pes)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long put_enum_str(paddr,pstring)
|
||||
struct dbAddr *paddr;
|
||||
char *pstring;
|
||||
static long put_enum_str(DBADDR *paddr, char *pstring)
|
||||
{
|
||||
struct biRecord *pbi=(struct biRecord *)paddr->precord;
|
||||
biRecord *pbi=(biRecord *)paddr->precord;
|
||||
|
||||
if(strncmp(pstring,pbi->znam,sizeof(pbi->znam))==0) pbi->val = 0;
|
||||
else if(strncmp(pstring,pbi->onam,sizeof(pbi->onam))==0) pbi->val = 1;
|
||||
@@ -206,8 +195,7 @@ static long put_enum_str(paddr,pstring)
|
||||
}
|
||||
|
||||
|
||||
static void checkAlarms(pbi)
|
||||
struct biRecord *pbi;
|
||||
static void checkAlarms(biRecord *pbi)
|
||||
{
|
||||
unsigned short val = pbi->val;
|
||||
|
||||
@@ -232,8 +220,7 @@ static void checkAlarms(pbi)
|
||||
return;
|
||||
}
|
||||
|
||||
static void monitor(pbi)
|
||||
struct biRecord *pbi;
|
||||
static void monitor(biRecord *pbi)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
|
||||
@@ -258,8 +245,7 @@ static void monitor(pbi)
|
||||
return;
|
||||
}
|
||||
|
||||
static long readValue(pbi)
|
||||
struct biRecord *pbi;
|
||||
static long readValue(biRecord *pbi)
|
||||
{
|
||||
long status;
|
||||
struct bidset *pdset = (struct bidset *) (pbi->dset);
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* recBo.c */
|
||||
/* base/src/rec $Id$ */
|
||||
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* recBo.c - Record Support Routines for Binary Output records */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
* Date: 7-14-89
|
||||
*/
|
||||
|
||||
@@ -45,18 +43,18 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long init_record(boRecord *, int);
|
||||
static long process(boRecord *);
|
||||
#define special NULL
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
#define put_array_info NULL
|
||||
#define get_units NULL
|
||||
static long get_precision();
|
||||
static long get_enum_str();
|
||||
static long get_enum_strs();
|
||||
static long put_enum_str();
|
||||
static long get_precision(DBADDR *, long *);
|
||||
static long get_enum_str(DBADDR *, char *);
|
||||
static long get_enum_strs(DBADDR *, struct dbr_enumStrs *);
|
||||
static long put_enum_str(DBADDR *, char *);
|
||||
#define get_graphic_double NULL
|
||||
#define get_control_double NULL
|
||||
#define get_alarm_double NULL
|
||||
@@ -99,17 +97,17 @@ typedef struct myCallback {
|
||||
struct dbCommon *precord;
|
||||
}myCallback;
|
||||
|
||||
static void checkAlarms();
|
||||
static void monitor();
|
||||
static long writeValue();
|
||||
static void checkAlarms(boRecord *);
|
||||
static void monitor(boRecord *);
|
||||
static long writeValue(boRecord *);
|
||||
|
||||
static void myCallbackFunc(CALLBACK *arg)
|
||||
{
|
||||
myCallback *pcallback;
|
||||
struct boRecord *pbo;
|
||||
boRecord *pbo;
|
||||
|
||||
callbackGetUser(pcallback,arg);
|
||||
pbo=(struct boRecord *)pcallback->precord;
|
||||
pbo=(boRecord *)pcallback->precord;
|
||||
dbScanLock((struct dbCommon *)pbo);
|
||||
if(pbo->pact) {
|
||||
if((pbo->val==1) && (pbo->high>0)){
|
||||
@@ -125,9 +123,7 @@ static void myCallbackFunc(CALLBACK *arg)
|
||||
dbScanUnlock((struct dbCommon *)pbo);
|
||||
}
|
||||
|
||||
static long init_record(pbo,pass)
|
||||
struct boRecord *pbo;
|
||||
int pass;
|
||||
static long init_record(boRecord *pbo,int pass)
|
||||
{
|
||||
struct bodset *pdset;
|
||||
long status=0;
|
||||
@@ -178,12 +174,11 @@ static long init_record(pbo,pass)
|
||||
if ( pbo->mask != 0 ) {
|
||||
if(pbo->val==0) pbo->rval = 0;
|
||||
else pbo->rval = pbo->mask;
|
||||
} else pbo->rval = (unsigned long)pbo->val;
|
||||
} else pbo->rval = (epicsUInt32)pbo->val;
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long process(pbo)
|
||||
struct boRecord *pbo;
|
||||
static long process(boRecord *pbo)
|
||||
{
|
||||
struct bodset *pdset = (struct bodset *)(pbo->dset);
|
||||
long status=0;
|
||||
@@ -213,7 +208,7 @@ static long process(pbo)
|
||||
if ( pbo->mask != 0 ) {
|
||||
if(pbo->val==0) pbo->rval = 0;
|
||||
else pbo->rval = pbo->mask;
|
||||
} else pbo->rval = (unsigned long)pbo->val;
|
||||
} else pbo->rval = (epicsUInt32)pbo->val;
|
||||
}
|
||||
|
||||
/* check for alarms */
|
||||
@@ -235,7 +230,7 @@ static long process(pbo)
|
||||
if ( pbo->mask != 0 ) {
|
||||
if(pbo->val==0) pbo->rval = 0;
|
||||
else pbo->rval = pbo->mask;
|
||||
} else pbo->rval = (unsigned long)pbo->val;
|
||||
} else pbo->rval = (epicsUInt32)pbo->val;
|
||||
}
|
||||
status=writeValue(pbo); /* write the new value */
|
||||
break;
|
||||
@@ -266,22 +261,18 @@ static long process(pbo)
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long get_precision(paddr,precision)
|
||||
struct dbAddr *paddr;
|
||||
long *precision;
|
||||
static long get_precision(DBADDR *paddr, long *precision)
|
||||
{
|
||||
struct boRecord *pbo=(struct boRecord *)paddr->precord;
|
||||
boRecord *pbo=(boRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield == (void *)&pbo->high) *precision=2;
|
||||
else recGblGetPrec(paddr,precision);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_enum_str(paddr,pstring)
|
||||
struct dbAddr *paddr;
|
||||
char *pstring;
|
||||
static long get_enum_str(DBADDR *paddr, char *pstring)
|
||||
{
|
||||
struct boRecord *pbo=(struct boRecord *)paddr->precord;
|
||||
boRecord *pbo=(boRecord *)paddr->precord;
|
||||
int index;
|
||||
unsigned short *pfield = (unsigned short *)paddr->pfield;
|
||||
|
||||
@@ -301,11 +292,9 @@ static long get_enum_str(paddr,pstring)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_enum_strs(paddr,pes)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_enumStrs *pes;
|
||||
static long get_enum_strs(DBADDR *paddr,struct dbr_enumStrs *pes)
|
||||
{
|
||||
struct boRecord *pbo=(struct boRecord *)paddr->precord;
|
||||
boRecord *pbo=(boRecord *)paddr->precord;
|
||||
|
||||
/*SETTING no_str=0 breaks channel access clients*/
|
||||
pes->no_str = 2;
|
||||
@@ -316,11 +305,9 @@ static long get_enum_strs(paddr,pes)
|
||||
if(*pbo->onam!=0) pes->no_str=2;
|
||||
return(0);
|
||||
}
|
||||
static long put_enum_str(paddr,pstring)
|
||||
struct dbAddr *paddr;
|
||||
char *pstring;
|
||||
static long put_enum_str(DBADDR *paddr, char *pstring)
|
||||
{
|
||||
struct boRecord *pbo=(struct boRecord *)paddr->precord;
|
||||
boRecord *pbo=(boRecord *)paddr->precord;
|
||||
|
||||
if(strncmp(pstring,pbo->znam,sizeof(pbo->znam))==0) pbo->val = 0;
|
||||
else if(strncmp(pstring,pbo->onam,sizeof(pbo->onam))==0) pbo->val = 1;
|
||||
@@ -329,8 +316,7 @@ static long put_enum_str(paddr,pstring)
|
||||
}
|
||||
|
||||
|
||||
static void checkAlarms(pbo)
|
||||
struct boRecord *pbo;
|
||||
static void checkAlarms(boRecord *pbo)
|
||||
{
|
||||
unsigned short val = pbo->val;
|
||||
|
||||
@@ -353,8 +339,7 @@ static void checkAlarms(pbo)
|
||||
return;
|
||||
}
|
||||
|
||||
static void monitor(pbo)
|
||||
struct boRecord *pbo;
|
||||
static void monitor(boRecord *pbo)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
|
||||
@@ -384,8 +369,7 @@ static void monitor(pbo)
|
||||
return;
|
||||
}
|
||||
|
||||
static long writeValue(pbo)
|
||||
struct boRecord *pbo;
|
||||
static long writeValue(boRecord *pbo)
|
||||
{
|
||||
long status;
|
||||
struct bodset *pdset = (struct bodset *) (pbo->dset);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* Record Support Routines for Calculation records */
|
||||
@@ -42,19 +43,19 @@
|
||||
#define initialize NULL
|
||||
static long init_record(calcRecord *pcalc, int pass);
|
||||
static long process(calcRecord *pcalc);
|
||||
static long special(dbAddr *paddr, int after);
|
||||
static long special(DBADDR *paddr, int after);
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
#define put_array_info NULL
|
||||
static long get_units(dbAddr *paddr, char *units);
|
||||
static long get_precision(dbAddr *paddr, long *precision);
|
||||
static long get_units(DBADDR *paddr, char *units);
|
||||
static long get_precision(DBADDR *paddr, long *precision);
|
||||
#define get_enum_str NULL
|
||||
#define get_enum_strs NULL
|
||||
#define put_enum_str NULL
|
||||
static long get_graphic_double(dbAddr *paddr, struct dbr_grDouble *pgd);
|
||||
static long get_ctrl_double(dbAddr *paddr, struct dbr_ctrlDouble *pcd);
|
||||
static long get_alarm_double(dbAddr *paddr, struct dbr_alDouble *pad);
|
||||
static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd);
|
||||
static long get_ctrl_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd);
|
||||
static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad);
|
||||
|
||||
rset calcRSET={
|
||||
RSETNUMBER,
|
||||
@@ -127,7 +128,7 @@ static long process(calcRecord *pcalc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long special(dbAddr *paddr, int after)
|
||||
static long special(DBADDR *paddr, int after)
|
||||
{
|
||||
calcRecord *pcalc = (calcRecord *)paddr->precord;
|
||||
short error_number;
|
||||
@@ -147,7 +148,7 @@ static long special(dbAddr *paddr, int after)
|
||||
return S_db_badChoice;
|
||||
}
|
||||
|
||||
static long get_units(dbAddr *paddr, char *units)
|
||||
static long get_units(DBADDR *paddr, char *units)
|
||||
{
|
||||
calcRecord *pcalc = (calcRecord *)paddr->precord;
|
||||
|
||||
@@ -155,7 +156,7 @@ static long get_units(dbAddr *paddr, char *units)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long get_precision(dbAddr *paddr, long *pprecision)
|
||||
static long get_precision(DBADDR *paddr, long *pprecision)
|
||||
{
|
||||
calcRecord *pcalc = (calcRecord *)paddr->precord;
|
||||
|
||||
@@ -167,7 +168,7 @@ static long get_precision(dbAddr *paddr, long *pprecision)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long get_graphic_double(dbAddr *paddr, struct dbr_grDouble *pgd)
|
||||
static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd)
|
||||
{
|
||||
calcRecord *pcalc = (calcRecord *)paddr->precord;
|
||||
|
||||
@@ -197,7 +198,7 @@ static long get_graphic_double(dbAddr *paddr, struct dbr_grDouble *pgd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long get_ctrl_double(dbAddr *paddr, struct dbr_ctrlDouble *pcd)
|
||||
static long get_ctrl_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
|
||||
{
|
||||
calcRecord *pcalc = (calcRecord *)paddr->precord;
|
||||
|
||||
@@ -227,7 +228,7 @@ static long get_ctrl_double(dbAddr *paddr, struct dbr_ctrlDouble *pcd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long get_alarm_double(dbAddr *paddr, struct dbr_alDouble *pad)
|
||||
static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad)
|
||||
{
|
||||
calcRecord *pcalc = (calcRecord *)paddr->precord;
|
||||
|
||||
@@ -242,51 +243,59 @@ static long get_alarm_double(dbAddr *paddr, struct dbr_alDouble *pad)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void checkAlarms(calcRecord *pcalc)
|
||||
static void checkAlarms(calcRecord *prec)
|
||||
{
|
||||
double val = pcalc->val;
|
||||
double hyst = pcalc->hyst;
|
||||
double lalm = pcalc->lalm;
|
||||
double hihi = pcalc->hihi;
|
||||
double high = pcalc->high;
|
||||
double low = pcalc->low;
|
||||
double lolo = pcalc->lolo;
|
||||
unsigned short hhsv = pcalc->hhsv;
|
||||
unsigned short hsv = pcalc->hsv;
|
||||
unsigned short lsv = pcalc->lsv;
|
||||
unsigned short llsv = pcalc->llsv;
|
||||
double val, hyst, lalm;
|
||||
double alev;
|
||||
epicsEnum16 asev;
|
||||
|
||||
if (pcalc->udf) {
|
||||
recGblSetSevr(pcalc, UDF_ALARM, INVALID_ALARM);
|
||||
return;
|
||||
if (prec->udf) {
|
||||
recGblSetSevr(prec, UDF_ALARM, INVALID_ALARM);
|
||||
return;
|
||||
}
|
||||
|
||||
val = prec->val;
|
||||
hyst = prec->hyst;
|
||||
lalm = prec->lalm;
|
||||
|
||||
/* alarm condition hihi */
|
||||
if (hhsv && (val >= hihi || ((lalm == hihi) && (val >= hihi - hyst)))) {
|
||||
if (recGblSetSevr(pcalc, HIHI_ALARM, pcalc->hhsv)) pcalc->lalm = hihi;
|
||||
return;
|
||||
asev = prec->hhsv;
|
||||
alev = prec->hihi;
|
||||
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIHI_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition lolo */
|
||||
if (llsv && (val <= lolo || ((lalm == lolo) && (val <= lolo + hyst)))) {
|
||||
if (recGblSetSevr(pcalc, LOLO_ALARM, pcalc->llsv)) pcalc->lalm = lolo;
|
||||
return;
|
||||
asev = prec->llsv;
|
||||
alev = prec->lolo;
|
||||
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOLO_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition high */
|
||||
if (hsv && (val >= high || ((lalm == high) && (val >= high - hyst)))) {
|
||||
if (recGblSetSevr(pcalc, HIGH_ALARM, pcalc->hsv)) pcalc->lalm = high;
|
||||
return;
|
||||
asev = prec->hsv;
|
||||
alev = prec->high;
|
||||
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIGH_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition low */
|
||||
if (lsv && (val <= low || ((lalm == low) && (val <= low + hyst)))) {
|
||||
if (recGblSetSevr(pcalc, LOW_ALARM, pcalc->lsv)) pcalc->lalm = low;
|
||||
return;
|
||||
asev = prec->lsv;
|
||||
alev = prec->low;
|
||||
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOW_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* we get here only if val is out of alarm by at least hyst */
|
||||
pcalc->lalm = val;
|
||||
prec->lalm = val;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2007 UChicago Argonne LLC, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/* calcout.c - Record Support Routines for calc with output records */
|
||||
/*
|
||||
* Author : Ned Arnold
|
||||
* Based on recCalc.c, by ...
|
||||
* Original Author: Julie Sander and Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
* Based on recCalc.c by Julie Sander and Bob Dalesio
|
||||
* Date: 7-27-87
|
||||
*/
|
||||
|
||||
@@ -46,41 +45,41 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long special();
|
||||
static long init_record(calcoutRecord *, int);
|
||||
static long process(calcoutRecord *);
|
||||
static long special(DBADDR *, int);
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
#define put_array_info NULL
|
||||
static long get_units();
|
||||
static long get_precision();
|
||||
static long get_units(DBADDR *, char *);
|
||||
static long get_precision(DBADDR *, long *);
|
||||
#define get_enum_str NULL
|
||||
#define get_enum_strs NULL
|
||||
#define put_enum_str NULL
|
||||
static long get_graphic_double();
|
||||
static long get_ctrl_double();
|
||||
static long get_alarm_double();
|
||||
static long get_graphic_double(DBADDR *, struct dbr_grDouble *);
|
||||
static long get_ctrl_double(DBADDR *, struct dbr_ctrlDouble *);
|
||||
static long get_alarm_double(DBADDR *, struct dbr_alDouble *);
|
||||
|
||||
rset calcoutRSET={
|
||||
RSETNUMBER,
|
||||
report,
|
||||
initialize,
|
||||
init_record,
|
||||
process,
|
||||
special,
|
||||
get_value,
|
||||
cvt_dbaddr,
|
||||
get_array_info,
|
||||
put_array_info,
|
||||
get_units,
|
||||
get_precision,
|
||||
get_enum_str,
|
||||
get_enum_strs,
|
||||
put_enum_str,
|
||||
get_graphic_double,
|
||||
get_ctrl_double,
|
||||
get_alarm_double
|
||||
rset calcoutRSET = {
|
||||
RSETNUMBER,
|
||||
report,
|
||||
initialize,
|
||||
init_record,
|
||||
process,
|
||||
special,
|
||||
get_value,
|
||||
cvt_dbaddr,
|
||||
get_array_info,
|
||||
put_array_info,
|
||||
get_units,
|
||||
get_precision,
|
||||
get_enum_str,
|
||||
get_enum_strs,
|
||||
put_enum_str,
|
||||
get_graphic_double,
|
||||
get_ctrl_double,
|
||||
get_alarm_double
|
||||
};
|
||||
epicsExportAddress(rset, calcoutRSET);
|
||||
|
||||
@@ -111,10 +110,10 @@ typedef struct calcoutDSET {
|
||||
#define CA_LINKS_NOT_OK 2
|
||||
|
||||
typedef struct rpvtStruct {
|
||||
CALLBACK doOutCb;
|
||||
CALLBACK checkLinkCb;
|
||||
short cbScheduled;
|
||||
short caLinkStat; /* NO_CA_LINKS, CA_LINKS_ALL_OK, CA_LINKS_NOT_OK */
|
||||
CALLBACK doOutCb;
|
||||
CALLBACK checkLinkCb;
|
||||
short cbScheduled;
|
||||
short caLinkStat; /* NO_CA_LINKS, CA_LINKS_ALL_OK, CA_LINKS_NOT_OK */
|
||||
} rpvtStruct;
|
||||
|
||||
static void checkAlarms(calcoutRecord *pcalc);
|
||||
@@ -133,62 +132,62 @@ static long init_record(calcoutRecord *pcalc, int pass)
|
||||
DBLINK *plink;
|
||||
int i;
|
||||
double *pvalue;
|
||||
unsigned short *plinkValid;
|
||||
epicsEnum16 *plinkValid;
|
||||
short error_number;
|
||||
calcoutDSET *pcalcoutDSET;
|
||||
|
||||
dbAddr dbaddr;
|
||||
dbAddr *pAddr = &dbaddr;
|
||||
rpvtStruct *prpvt;
|
||||
DBADDR dbaddr;
|
||||
DBADDR *pAddr = &dbaddr;
|
||||
rpvtStruct *prpvt;
|
||||
|
||||
if (pass==0) {
|
||||
pcalc->rpvt = (rpvtStruct *) callocMustSucceed(1, sizeof(rpvtStruct), "calcoutRecord");
|
||||
return 0;
|
||||
if (pass == 0) {
|
||||
pcalc->rpvt = (rpvtStruct *) callocMustSucceed(1, sizeof(rpvtStruct), "calcoutRecord");
|
||||
return 0;
|
||||
}
|
||||
if (!(pcalcoutDSET = (calcoutDSET *)pcalc->dset)) {
|
||||
recGblRecordError(S_dev_noDSET, (void *)pcalc, "calcout:init_record");
|
||||
return S_dev_noDSET;
|
||||
recGblRecordError(S_dev_noDSET, (void *)pcalc, "calcout:init_record");
|
||||
return S_dev_noDSET;
|
||||
}
|
||||
/* must have write defined */
|
||||
if ((pcalcoutDSET->number < 5) || (pcalcoutDSET->write ==NULL)) {
|
||||
recGblRecordError(S_dev_missingSup, (void *)pcalc, "calcout:init_record");
|
||||
return S_dev_missingSup;
|
||||
recGblRecordError(S_dev_missingSup, (void *)pcalc, "calcout:init_record");
|
||||
return S_dev_missingSup;
|
||||
}
|
||||
prpvt = pcalc->rpvt;
|
||||
plink = &pcalc->inpa;
|
||||
pvalue = &pcalc->a;
|
||||
plinkValid = &pcalc->inav;
|
||||
for (i=0; i <= CALCPERFORM_NARGS; i++, plink++, pvalue++, plinkValid++) {
|
||||
if (plink->type == CONSTANT) {
|
||||
/* Don't InitConstantLink the .OUT link */
|
||||
if (i < CALCPERFORM_NARGS) {
|
||||
recGblInitConstantLink(plink, DBF_DOUBLE, pvalue);
|
||||
}
|
||||
*plinkValid = calcoutINAV_CON;
|
||||
} else if (!dbNameToAddr(plink->value.pv_link.pvname, pAddr)) {
|
||||
/* PV resides on this ioc */
|
||||
*plinkValid = calcoutINAV_LOC;
|
||||
} else {
|
||||
/* pv is not on this ioc. Callback later for connection stat */
|
||||
*plinkValid = calcoutINAV_EXT_NC;
|
||||
prpvt->caLinkStat = CA_LINKS_NOT_OK;
|
||||
}
|
||||
for (i = 0; i <= CALCPERFORM_NARGS; i++, plink++, pvalue++, plinkValid++) {
|
||||
if (plink->type == CONSTANT) {
|
||||
/* Don't InitConstantLink the .OUT link */
|
||||
if (i < CALCPERFORM_NARGS) {
|
||||
recGblInitConstantLink(plink, DBF_DOUBLE, pvalue);
|
||||
}
|
||||
*plinkValid = calcoutINAV_CON;
|
||||
} else if (!dbNameToAddr(plink->value.pv_link.pvname, pAddr)) {
|
||||
/* PV resides on this ioc */
|
||||
*plinkValid = calcoutINAV_LOC;
|
||||
} else {
|
||||
/* pv is not on this ioc. Callback later for connection stat */
|
||||
*plinkValid = calcoutINAV_EXT_NC;
|
||||
prpvt->caLinkStat = CA_LINKS_NOT_OK;
|
||||
}
|
||||
}
|
||||
|
||||
pcalc->clcv=postfix(pcalc->calc, pcalc->rpcl, &error_number);
|
||||
pcalc->clcv = postfix(pcalc->calc, pcalc->rpcl, &error_number);
|
||||
if (pcalc->clcv){
|
||||
recGblRecordError(S_db_badField, (void *)pcalc,
|
||||
"calcout: init_record: Illegal CALC field");
|
||||
errlogPrintf("%s.CALC: %s in expression \"%s\"\n",
|
||||
pcalc->name, calcErrorStr(error_number), pcalc->calc);
|
||||
recGblRecordError(S_db_badField, (void *)pcalc,
|
||||
"calcout: init_record: Illegal CALC field");
|
||||
errlogPrintf("%s.CALC: %s in expression \"%s\"\n",
|
||||
pcalc->name, calcErrorStr(error_number), pcalc->calc);
|
||||
}
|
||||
|
||||
pcalc->oclv=postfix(pcalc->ocal, pcalc->orpc, &error_number);
|
||||
pcalc->oclv = postfix(pcalc->ocal, pcalc->orpc, &error_number);
|
||||
if (pcalc->dopt == calcoutDOPT_Use_OVAL && pcalc->oclv){
|
||||
recGblRecordError(S_db_badField, (void *)pcalc,
|
||||
"calcout: init_record: Illegal OCAL field");
|
||||
errlogPrintf("%s.OCAL: %s in expression \"%s\"\n",
|
||||
pcalc->name, calcErrorStr(error_number), pcalc->ocal);
|
||||
recGblRecordError(S_db_badField, (void *)pcalc,
|
||||
"calcout: init_record: Illegal OCAL field");
|
||||
errlogPrintf("%s.OCAL: %s in expression \"%s\"\n",
|
||||
pcalc->name, calcErrorStr(error_number), pcalc->ocal);
|
||||
}
|
||||
|
||||
prpvt = pcalc->rpvt;
|
||||
@@ -207,69 +206,69 @@ static long process(calcoutRecord *pcalc)
|
||||
int doOutput = 0;
|
||||
|
||||
if (!pcalc->pact) {
|
||||
pcalc->pact = TRUE;
|
||||
/* if some links are CA, check connections */
|
||||
if (prpvt->caLinkStat != NO_CA_LINKS) {
|
||||
checkLinks(pcalc);
|
||||
}
|
||||
if (fetch_values(pcalc) == 0) {
|
||||
if (calcPerform(&pcalc->a, &pcalc->val, pcalc->rpcl)) {
|
||||
recGblSetSevr(pcalc, CALC_ALARM, INVALID_ALARM);
|
||||
} else {
|
||||
pcalc->udf = isnan(pcalc->val);
|
||||
}
|
||||
}
|
||||
checkAlarms(pcalc);
|
||||
/* check for output link execution */
|
||||
switch (pcalc->oopt) {
|
||||
case calcoutOOPT_Every_Time:
|
||||
doOutput = 1;
|
||||
break;
|
||||
case calcoutOOPT_On_Change:
|
||||
if (fabs(pcalc->pval - pcalc->val) > pcalc->mdel) doOutput = 1;
|
||||
break;
|
||||
case calcoutOOPT_Transition_To_Zero:
|
||||
if ((pcalc->pval != 0.0) && (pcalc->val == 0.0)) doOutput = 1;
|
||||
break;
|
||||
case calcoutOOPT_Transition_To_Non_zero:
|
||||
if ((pcalc->pval == 0.0) && (pcalc->val != 0.0)) doOutput = 1;
|
||||
break;
|
||||
case calcoutOOPT_When_Zero:
|
||||
if (pcalc->val==0.0) doOutput = 1;
|
||||
break;
|
||||
case calcoutOOPT_When_Non_zero:
|
||||
if (pcalc->val != 0.0) doOutput = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
pcalc->pval = pcalc->val;
|
||||
if (doOutput) {
|
||||
if (pcalc->odly > 0.0) {
|
||||
pcalc->dlya = 1;
|
||||
db_post_events(pcalc, &pcalc->dlya, DBE_VALUE);
|
||||
callbackRequestProcessCallbackDelayed(&prpvt->doOutCb,
|
||||
pcalc->prio, pcalc, (double)pcalc->odly);
|
||||
return 0;
|
||||
} else {
|
||||
pcalc->pact = FALSE;
|
||||
execOutput(pcalc);
|
||||
if (pcalc->pact) return 0;
|
||||
pcalc->pact = TRUE;
|
||||
}
|
||||
}
|
||||
} else { /*pact==TRUE*/
|
||||
if(pcalc->dlya) {
|
||||
pcalc->dlya = 0;
|
||||
db_post_events(pcalc, &pcalc->dlya, DBE_VALUE);
|
||||
/* Make pact FALSE for asynchronous device support*/
|
||||
pcalc->pact = FALSE;
|
||||
execOutput(pcalc);
|
||||
if (pcalc->pact) return 0;
|
||||
pcalc->pact = TRUE;
|
||||
} else {/*Device Support is asynchronous*/
|
||||
writeValue(pcalc);
|
||||
}
|
||||
pcalc->pact = TRUE;
|
||||
/* if some links are CA, check connections */
|
||||
if (prpvt->caLinkStat != NO_CA_LINKS) {
|
||||
checkLinks(pcalc);
|
||||
}
|
||||
if (fetch_values(pcalc) == 0) {
|
||||
if (calcPerform(&pcalc->a, &pcalc->val, pcalc->rpcl)) {
|
||||
recGblSetSevr(pcalc, CALC_ALARM, INVALID_ALARM);
|
||||
} else {
|
||||
pcalc->udf = isnan(pcalc->val);
|
||||
}
|
||||
}
|
||||
checkAlarms(pcalc);
|
||||
/* check for output link execution */
|
||||
switch (pcalc->oopt) {
|
||||
case calcoutOOPT_Every_Time:
|
||||
doOutput = 1;
|
||||
break;
|
||||
case calcoutOOPT_On_Change:
|
||||
if (fabs(pcalc->pval - pcalc->val) > pcalc->mdel) doOutput = 1;
|
||||
break;
|
||||
case calcoutOOPT_Transition_To_Zero:
|
||||
if ((pcalc->pval != 0.0) && (pcalc->val == 0.0)) doOutput = 1;
|
||||
break;
|
||||
case calcoutOOPT_Transition_To_Non_zero:
|
||||
if ((pcalc->pval == 0.0) && (pcalc->val != 0.0)) doOutput = 1;
|
||||
break;
|
||||
case calcoutOOPT_When_Zero:
|
||||
if (pcalc->val == 0.0) doOutput = 1;
|
||||
break;
|
||||
case calcoutOOPT_When_Non_zero:
|
||||
if (pcalc->val != 0.0) doOutput = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
pcalc->pval = pcalc->val;
|
||||
if (doOutput) {
|
||||
if (pcalc->odly > 0.0) {
|
||||
pcalc->dlya = 1;
|
||||
db_post_events(pcalc, &pcalc->dlya, DBE_VALUE);
|
||||
callbackRequestProcessCallbackDelayed(&prpvt->doOutCb,
|
||||
pcalc->prio, pcalc, (double)pcalc->odly);
|
||||
return 0;
|
||||
} else {
|
||||
pcalc->pact = FALSE;
|
||||
execOutput(pcalc);
|
||||
if (pcalc->pact) return 0;
|
||||
pcalc->pact = TRUE;
|
||||
}
|
||||
}
|
||||
} else { /* pact == TRUE */
|
||||
if (pcalc->dlya) {
|
||||
pcalc->dlya = 0;
|
||||
db_post_events(pcalc, &pcalc->dlya, DBE_VALUE);
|
||||
/* Make pact FALSE for asynchronous device support*/
|
||||
pcalc->pact = FALSE;
|
||||
execOutput(pcalc);
|
||||
if (pcalc->pact) return 0;
|
||||
pcalc->pact = TRUE;
|
||||
} else {/*Device Support is asynchronous*/
|
||||
writeValue(pcalc);
|
||||
}
|
||||
}
|
||||
recGblGetTimeStamp(pcalc);
|
||||
monitor(pcalc);
|
||||
@@ -278,28 +277,28 @@ static long process(calcoutRecord *pcalc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long special(dbAddr *paddr, int after)
|
||||
static long special(DBADDR *paddr, int after)
|
||||
{
|
||||
calcoutRecord *pcalc = (calcoutRecord *)paddr->precord;
|
||||
rpvtStruct *prpvt = pcalc->rpvt;
|
||||
dbAddr dbaddr;
|
||||
dbAddr *pAddr = &dbaddr;
|
||||
short error_number;
|
||||
int fieldIndex = dbGetFieldIndex(paddr);
|
||||
int lnkIndex;
|
||||
DBLINK *plink;
|
||||
double *pvalue;
|
||||
unsigned short *plinkValid;
|
||||
rpvtStruct *prpvt = pcalc->rpvt;
|
||||
DBADDR dbaddr;
|
||||
DBADDR *pAddr = &dbaddr;
|
||||
short error_number;
|
||||
int fieldIndex = dbGetFieldIndex(paddr);
|
||||
int lnkIndex;
|
||||
DBLINK *plink;
|
||||
double *pvalue;
|
||||
epicsEnum16 *plinkValid;
|
||||
|
||||
if(!after) return 0;
|
||||
if (!after) return 0;
|
||||
switch(fieldIndex) {
|
||||
case(calcoutRecordCALC):
|
||||
pcalc->clcv = postfix(pcalc->calc, pcalc->rpcl, &error_number);
|
||||
if (pcalc->clcv){
|
||||
recGblRecordError(S_db_badField, (void *)pcalc,
|
||||
"calcout: special(): Illegal CALC field");
|
||||
errlogPrintf("%s.CALC: %s in expression \"%s\"\n",
|
||||
pcalc->name, calcErrorStr(error_number), pcalc->calc);
|
||||
errlogPrintf("%s.CALC: %s in expression \"%s\"\n",
|
||||
pcalc->name, calcErrorStr(error_number), pcalc->calc);
|
||||
}
|
||||
db_post_events(pcalc, &pcalc->clcv, DBE_VALUE);
|
||||
return 0;
|
||||
@@ -309,8 +308,8 @@ static long special(dbAddr *paddr, int after)
|
||||
if (pcalc->dopt == calcoutDOPT_Use_OVAL && pcalc->oclv){
|
||||
recGblRecordError(S_db_badField, (void *)pcalc,
|
||||
"calcout: special(): Illegal OCAL field");
|
||||
errlogPrintf("%s.OCAL: %s in expression \"%s\"\n",
|
||||
pcalc->name, calcErrorStr(error_number), pcalc->ocal);
|
||||
errlogPrintf("%s.OCAL: %s in expression \"%s\"\n",
|
||||
pcalc->name, calcErrorStr(error_number), pcalc->ocal);
|
||||
}
|
||||
db_post_events(pcalc, &pcalc->oclv, DBE_VALUE);
|
||||
return 0;
|
||||
@@ -332,19 +331,19 @@ static long special(dbAddr *paddr, int after)
|
||||
pvalue = &pcalc->a + lnkIndex;
|
||||
plinkValid = &pcalc->inav + lnkIndex;
|
||||
if (plink->type == CONSTANT) {
|
||||
if(fieldIndex != calcoutRecordOUT) {
|
||||
if (fieldIndex != calcoutRecordOUT) {
|
||||
recGblInitConstantLink(plink, DBF_DOUBLE, pvalue);
|
||||
db_post_events(pcalc, pvalue, DBE_VALUE);
|
||||
}
|
||||
*plinkValid = calcoutINAV_CON;
|
||||
} else if(!dbNameToAddr(plink->value.pv_link.pvname, pAddr)) {
|
||||
} else if (!dbNameToAddr(plink->value.pv_link.pvname, pAddr)) {
|
||||
/* if the PV resides on this ioc */
|
||||
*plinkValid = calcoutINAV_LOC;
|
||||
} else {
|
||||
/* pv is not on this ioc. Callback later for connection stat */
|
||||
*plinkValid = calcoutINAV_EXT_NC;
|
||||
/* DO_CALLBACK, if not already scheduled */
|
||||
if(!prpvt->cbScheduled) {
|
||||
if (!prpvt->cbScheduled) {
|
||||
callbackRequestDelayed(&prpvt->checkLinkCb, .5);
|
||||
prpvt->cbScheduled = 1;
|
||||
prpvt->caLinkStat = CA_LINKS_NOT_OK;
|
||||
@@ -353,12 +352,12 @@ static long special(dbAddr *paddr, int after)
|
||||
db_post_events(pcalc, plinkValid, DBE_VALUE);
|
||||
return 0;
|
||||
default:
|
||||
recGblDbaddrError(S_db_badChoice, paddr, "calc: special");
|
||||
return(S_db_badChoice);
|
||||
recGblDbaddrError(S_db_badChoice, paddr, "calc: special");
|
||||
return(S_db_badChoice);
|
||||
}
|
||||
}
|
||||
|
||||
static long get_units(dbAddr *paddr, char *units)
|
||||
static long get_units(DBADDR *paddr, char *units)
|
||||
{
|
||||
calcoutRecord *pcalc = (calcoutRecord *)paddr->precord;
|
||||
|
||||
@@ -366,138 +365,146 @@ static long get_units(dbAddr *paddr, char *units)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long get_precision(dbAddr *paddr, long *pprecision)
|
||||
static long get_precision(DBADDR *paddr, long *pprecision)
|
||||
{
|
||||
calcoutRecord *pcalc = (calcoutRecord *)paddr->precord;
|
||||
|
||||
if (paddr->pfield == (void *)&pcalc->val) {
|
||||
*pprecision = pcalc->prec;
|
||||
*pprecision = pcalc->prec;
|
||||
} else {
|
||||
recGblGetPrec(paddr, pprecision);
|
||||
recGblGetPrec(paddr, pprecision);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long get_graphic_double(dbAddr *paddr, struct dbr_grDouble *pgd)
|
||||
static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd)
|
||||
{
|
||||
calcoutRecord *pcalc = (calcoutRecord *)paddr->precord;
|
||||
|
||||
if (paddr->pfield == (void *)&pcalc->val ||
|
||||
paddr->pfield == (void *)&pcalc->hihi ||
|
||||
paddr->pfield == (void *)&pcalc->high ||
|
||||
paddr->pfield == (void *)&pcalc->low ||
|
||||
paddr->pfield == (void *)&pcalc->lolo) {
|
||||
pgd->upper_disp_limit = pcalc->hopr;
|
||||
pgd->lower_disp_limit = pcalc->lopr;
|
||||
return 0;
|
||||
paddr->pfield == (void *)&pcalc->hihi ||
|
||||
paddr->pfield == (void *)&pcalc->high ||
|
||||
paddr->pfield == (void *)&pcalc->low ||
|
||||
paddr->pfield == (void *)&pcalc->lolo) {
|
||||
pgd->upper_disp_limit = pcalc->hopr;
|
||||
pgd->lower_disp_limit = pcalc->lopr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (paddr->pfield >= (void *)&pcalc->a &&
|
||||
paddr->pfield <= (void *)&pcalc->l) {
|
||||
pgd->upper_disp_limit = pcalc->hopr;
|
||||
pgd->lower_disp_limit = pcalc->lopr;
|
||||
return 0;
|
||||
paddr->pfield <= (void *)&pcalc->l) {
|
||||
pgd->upper_disp_limit = pcalc->hopr;
|
||||
pgd->lower_disp_limit = pcalc->lopr;
|
||||
return 0;
|
||||
}
|
||||
if (paddr->pfield >= (void *)&pcalc->la &&
|
||||
paddr->pfield <= (void *)&pcalc->ll) {
|
||||
pgd->upper_disp_limit = pcalc->hopr;
|
||||
pgd->lower_disp_limit = pcalc->lopr;
|
||||
return 0;
|
||||
paddr->pfield <= (void *)&pcalc->ll) {
|
||||
pgd->upper_disp_limit = pcalc->hopr;
|
||||
pgd->lower_disp_limit = pcalc->lopr;
|
||||
return 0;
|
||||
}
|
||||
recGblGetGraphicDouble(paddr, pgd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long get_ctrl_double(dbAddr *paddr, struct dbr_ctrlDouble *pcd)
|
||||
static long get_ctrl_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
|
||||
{
|
||||
calcoutRecord *pcalc = (calcoutRecord *)paddr->precord;
|
||||
|
||||
if (paddr->pfield == (void *)&pcalc->val ||
|
||||
paddr->pfield == (void *)&pcalc->hihi ||
|
||||
paddr->pfield == (void *)&pcalc->high ||
|
||||
paddr->pfield == (void *)&pcalc->low ||
|
||||
paddr->pfield == (void *)&pcalc->lolo) {
|
||||
pcd->upper_ctrl_limit = pcalc->hopr;
|
||||
pcd->lower_ctrl_limit = pcalc->lopr;
|
||||
return 0;
|
||||
paddr->pfield == (void *)&pcalc->hihi ||
|
||||
paddr->pfield == (void *)&pcalc->high ||
|
||||
paddr->pfield == (void *)&pcalc->low ||
|
||||
paddr->pfield == (void *)&pcalc->lolo) {
|
||||
pcd->upper_ctrl_limit = pcalc->hopr;
|
||||
pcd->lower_ctrl_limit = pcalc->lopr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (paddr->pfield >= (void *)&pcalc->a &&
|
||||
paddr->pfield <= (void *)&pcalc->l) {
|
||||
pcd->upper_ctrl_limit = pcalc->hopr;
|
||||
pcd->lower_ctrl_limit = pcalc->lopr;
|
||||
return 0;
|
||||
paddr->pfield <= (void *)&pcalc->l) {
|
||||
pcd->upper_ctrl_limit = pcalc->hopr;
|
||||
pcd->lower_ctrl_limit = pcalc->lopr;
|
||||
return 0;
|
||||
}
|
||||
if (paddr->pfield >= (void *)&pcalc->la &&
|
||||
paddr->pfield <= (void *)&pcalc->ll) {
|
||||
pcd->upper_ctrl_limit = pcalc->hopr;
|
||||
pcd->lower_ctrl_limit = pcalc->lopr;
|
||||
return 0;
|
||||
paddr->pfield <= (void *)&pcalc->ll) {
|
||||
pcd->upper_ctrl_limit = pcalc->hopr;
|
||||
pcd->lower_ctrl_limit = pcalc->lopr;
|
||||
return 0;
|
||||
}
|
||||
recGblGetControlDouble(paddr, pcd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long get_alarm_double(dbAddr *paddr, struct dbr_alDouble *pad)
|
||||
static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad)
|
||||
{
|
||||
calcoutRecord *pcalc = (calcoutRecord *)paddr->precord;
|
||||
|
||||
if (paddr->pfield == (void *)&pcalc->val) {
|
||||
pad->upper_alarm_limit = pcalc->hihi;
|
||||
pad->upper_warning_limit = pcalc->high;
|
||||
pad->lower_warning_limit = pcalc->low;
|
||||
pad->lower_alarm_limit = pcalc->lolo;
|
||||
pad->upper_alarm_limit = pcalc->hihi;
|
||||
pad->upper_warning_limit = pcalc->high;
|
||||
pad->lower_warning_limit = pcalc->low;
|
||||
pad->lower_alarm_limit = pcalc->lolo;
|
||||
} else {
|
||||
recGblGetAlarmDouble(paddr, pad);
|
||||
recGblGetAlarmDouble(paddr, pad);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void checkAlarms(calcoutRecord *pcalc)
|
||||
static void checkAlarms(calcoutRecord *prec)
|
||||
{
|
||||
double val = pcalc->val;
|
||||
double hyst = pcalc->hyst;
|
||||
double lalm = pcalc->lalm;
|
||||
double hihi = pcalc->hihi;
|
||||
double high = pcalc->high;
|
||||
double low = pcalc->low;
|
||||
double lolo = pcalc->lolo;
|
||||
unsigned short hhsv = pcalc->hhsv;
|
||||
unsigned short hsv = pcalc->hsv;
|
||||
unsigned short lsv = pcalc->lsv;
|
||||
unsigned short llsv = pcalc->llsv;
|
||||
double val, hyst, lalm;
|
||||
double alev;
|
||||
epicsEnum16 asev;
|
||||
|
||||
if (pcalc->udf){
|
||||
recGblSetSevr(pcalc, UDF_ALARM, INVALID_ALARM);
|
||||
return;
|
||||
if (prec->udf) {
|
||||
recGblSetSevr(prec, UDF_ALARM, INVALID_ALARM);
|
||||
return;
|
||||
}
|
||||
|
||||
val = prec->val;
|
||||
hyst = prec->hyst;
|
||||
lalm = prec->lalm;
|
||||
|
||||
/* alarm condition hihi */
|
||||
if (hhsv && (val >= hihi || ((lalm == hihi) && (val >= hihi - hyst)))) {
|
||||
if (recGblSetSevr(pcalc, HIHI_ALARM, pcalc->hhsv)) pcalc->lalm = hihi;
|
||||
return;
|
||||
asev = prec->hhsv;
|
||||
alev = prec->hihi;
|
||||
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIHI_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition lolo */
|
||||
if (llsv && (val <= lolo || ((lalm == lolo) && (val <= lolo + hyst)))) {
|
||||
if (recGblSetSevr(pcalc, LOLO_ALARM, pcalc->llsv)) pcalc->lalm = lolo;
|
||||
return;
|
||||
asev = prec->llsv;
|
||||
alev = prec->lolo;
|
||||
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOLO_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition high */
|
||||
if (hsv && (val >= high || ((lalm == high) && (val >= high - hyst)))) {
|
||||
if (recGblSetSevr(pcalc, HIGH_ALARM, pcalc->hsv)) pcalc->lalm = high;
|
||||
return;
|
||||
asev = prec->hsv;
|
||||
alev = prec->high;
|
||||
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIGH_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition low */
|
||||
if (lsv && (val <= low || ((lalm == low) && (val <= low + hyst)))) {
|
||||
if (recGblSetSevr(pcalc, LOW_ALARM, pcalc->lsv)) pcalc->lalm = low;
|
||||
return;
|
||||
asev = prec->lsv;
|
||||
alev = prec->low;
|
||||
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOW_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* we get here only if val is out of alarm by at least hyst */
|
||||
pcalc->lalm = val;
|
||||
prec->lalm = val;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -508,65 +515,65 @@ static void execOutput(calcoutRecord *pcalc)
|
||||
/* Determine output data */
|
||||
switch(pcalc->dopt) {
|
||||
case calcoutDOPT_Use_VAL:
|
||||
pcalc->oval = pcalc->val;
|
||||
break;
|
||||
pcalc->oval = pcalc->val;
|
||||
break;
|
||||
case calcoutDOPT_Use_OVAL:
|
||||
if (calcPerform(&pcalc->a, &pcalc->oval, pcalc->orpc)) {
|
||||
recGblSetSevr(pcalc, CALC_ALARM, INVALID_ALARM);
|
||||
} else {
|
||||
pcalc->udf = isnan(pcalc->oval);
|
||||
}
|
||||
break;
|
||||
if (calcPerform(&pcalc->a, &pcalc->oval, pcalc->orpc)) {
|
||||
recGblSetSevr(pcalc, CALC_ALARM, INVALID_ALARM);
|
||||
} else {
|
||||
pcalc->udf = isnan(pcalc->oval);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (pcalc->udf){
|
||||
recGblSetSevr(pcalc, UDF_ALARM, INVALID_ALARM);
|
||||
recGblSetSevr(pcalc, UDF_ALARM, INVALID_ALARM);
|
||||
}
|
||||
|
||||
/* Check to see what to do if INVALID */
|
||||
if (pcalc->nsev < INVALID_ALARM ) {
|
||||
/* Output the value */
|
||||
status = writeValue(pcalc);
|
||||
/* post event if output event != 0 */
|
||||
if(pcalc->oevt > 0) {
|
||||
post_event((int)pcalc->oevt);
|
||||
}
|
||||
/* Output the value */
|
||||
status = writeValue(pcalc);
|
||||
/* post event if output event != 0 */
|
||||
if (pcalc->oevt > 0) {
|
||||
post_event((int)pcalc->oevt);
|
||||
}
|
||||
} else switch (pcalc->ivoa) {
|
||||
case menuIvoaContinue_normally:
|
||||
status = writeValue(pcalc);
|
||||
/* post event if output event != 0 */
|
||||
if(pcalc->oevt > 0) {
|
||||
post_event((int)pcalc->oevt);
|
||||
}
|
||||
break;
|
||||
case menuIvoaDon_t_drive_outputs:
|
||||
break;
|
||||
case menuIvoaSet_output_to_IVOV:
|
||||
pcalc->oval=pcalc->ivov;
|
||||
status = writeValue(pcalc);
|
||||
/* post event if output event != 0 */
|
||||
if(pcalc->oevt > 0) {
|
||||
post_event((int)pcalc->oevt);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
status=-1;
|
||||
recGblRecordError(S_db_badField, (void *)pcalc,
|
||||
"calcout:process Illegal IVOA field");
|
||||
case menuIvoaContinue_normally:
|
||||
status = writeValue(pcalc);
|
||||
/* post event if output event != 0 */
|
||||
if (pcalc->oevt > 0) {
|
||||
post_event((int)pcalc->oevt);
|
||||
}
|
||||
break;
|
||||
case menuIvoaDon_t_drive_outputs:
|
||||
break;
|
||||
case menuIvoaSet_output_to_IVOV:
|
||||
pcalc->oval = pcalc->ivov;
|
||||
status = writeValue(pcalc);
|
||||
/* post event if output event != 0 */
|
||||
if (pcalc->oevt > 0) {
|
||||
post_event((int)pcalc->oevt);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
status = -1;
|
||||
recGblRecordError(S_db_badField, (void *)pcalc,
|
||||
"calcout:process Illegal IVOA field");
|
||||
}
|
||||
}
|
||||
|
||||
static void monitor(calcoutRecord *pcalc)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
double delta;
|
||||
double *pnew;
|
||||
double *pprev;
|
||||
int i;
|
||||
unsigned monitor_mask;
|
||||
double delta;
|
||||
double *pnew;
|
||||
double *pprev;
|
||||
int i;
|
||||
|
||||
monitor_mask = recGblResetAlarms(pcalc);
|
||||
/* check for value change */
|
||||
delta = pcalc->mlst - pcalc->val;
|
||||
if(delta<0.0) delta = -delta;
|
||||
if (delta<0.0) delta = -delta;
|
||||
if (delta > pcalc->mdel) {
|
||||
/* post events for value change */
|
||||
monitor_mask |= DBE_VALUE;
|
||||
@@ -575,7 +582,7 @@ static void monitor(calcoutRecord *pcalc)
|
||||
}
|
||||
/* check for archive change */
|
||||
delta = pcalc->alst - pcalc->val;
|
||||
if(delta<0.0) delta = -delta;
|
||||
if (delta<0.0) delta = -delta;
|
||||
if (delta > pcalc->adel) {
|
||||
/* post events on value field for archive change */
|
||||
monitor_mask |= DBE_LOG;
|
||||
@@ -588,15 +595,15 @@ static void monitor(calcoutRecord *pcalc)
|
||||
db_post_events(pcalc, &pcalc->val, monitor_mask);
|
||||
}
|
||||
/* check all input fields for changes*/
|
||||
for(i=0, pnew=&pcalc->a, pprev=&pcalc->la; i<CALCPERFORM_NARGS;
|
||||
for (i = 0, pnew = &pcalc->a, pprev = &pcalc->la; i<CALCPERFORM_NARGS;
|
||||
i++, pnew++, pprev++) {
|
||||
if((*pnew != *pprev) || (monitor_mask&DBE_ALARM)) {
|
||||
if ((*pnew != *pprev) || (monitor_mask&DBE_ALARM)) {
|
||||
db_post_events(pcalc, pnew, monitor_mask|DBE_VALUE|DBE_LOG);
|
||||
*pprev = *pnew;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Check OVAL field */
|
||||
if(pcalc->povl != pcalc->oval) {
|
||||
if (pcalc->povl != pcalc->oval) {
|
||||
db_post_events(pcalc, &pcalc->oval, monitor_mask|DBE_VALUE|DBE_LOG);
|
||||
pcalc->povl = pcalc->oval;
|
||||
}
|
||||
@@ -605,19 +612,19 @@ static void monitor(calcoutRecord *pcalc)
|
||||
|
||||
static int fetch_values(calcoutRecord *pcalc)
|
||||
{
|
||||
DBLINK *plink; /* structure of the link field */
|
||||
double *pvalue;
|
||||
long status = 0;
|
||||
int i;
|
||||
DBLINK *plink; /* structure of the link field */
|
||||
double *pvalue;
|
||||
long status = 0;
|
||||
int i;
|
||||
|
||||
for(i=0, plink=&pcalc->inpa, pvalue=&pcalc->a; i<CALCPERFORM_NARGS;
|
||||
for (i = 0, plink = &pcalc->inpa, pvalue = &pcalc->a; i<CALCPERFORM_NARGS;
|
||||
i++, plink++, pvalue++) {
|
||||
int newStatus;
|
||||
|
||||
newStatus = dbGetLink(plink, DBR_DOUBLE, pvalue, 0, 0);
|
||||
if(status==0) status = newStatus;
|
||||
}
|
||||
return(status);
|
||||
if (!status) status = newStatus;
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
static void checkLinksCallback(CALLBACK *arg)
|
||||
@@ -628,7 +635,7 @@ static void checkLinksCallback(CALLBACK *arg)
|
||||
|
||||
callbackGetUser(pcalc, arg);
|
||||
prpvt = pcalc->rpvt;
|
||||
|
||||
|
||||
dbScanLock((dbCommon *)pcalc);
|
||||
prpvt->cbScheduled = 0;
|
||||
checkLinks(pcalc);
|
||||
@@ -640,45 +647,44 @@ static void checkLinks(calcoutRecord *pcalc)
|
||||
{
|
||||
|
||||
DBLINK *plink;
|
||||
rpvtStruct *prpvt = pcalc->rpvt;
|
||||
rpvtStruct *prpvt = pcalc->rpvt;
|
||||
int i;
|
||||
int stat;
|
||||
int caLink = 0;
|
||||
int caLinkNc = 0;
|
||||
unsigned short *plinkValid;
|
||||
epicsEnum16 *plinkValid;
|
||||
|
||||
if(calcoutRecDebug) printf("checkLinks() for %p\n", pcalc);
|
||||
if (calcoutRecDebug) printf("checkLinks() for %p\n", pcalc);
|
||||
|
||||
plink = &pcalc->inpa;
|
||||
plinkValid = &pcalc->inav;
|
||||
|
||||
for(i=0; i<CALCPERFORM_NARGS+1; i++, plink++, plinkValid++) {
|
||||
for (i = 0; i<CALCPERFORM_NARGS+1; i++, plink++, plinkValid++) {
|
||||
if (plink->type == CA_LINK) {
|
||||
caLink = 1;
|
||||
stat = dbCaIsLinkConnected(plink);
|
||||
if(!stat && (*plinkValid == calcoutINAV_EXT_NC)) {
|
||||
if (!stat && (*plinkValid == calcoutINAV_EXT_NC)) {
|
||||
caLinkNc = 1;
|
||||
}
|
||||
else if(!stat && (*plinkValid == calcoutINAV_EXT)) {
|
||||
else if (!stat && (*plinkValid == calcoutINAV_EXT)) {
|
||||
*plinkValid = calcoutINAV_EXT_NC;
|
||||
db_post_events(pcalc, plinkValid, DBE_VALUE);
|
||||
caLinkNc = 1;
|
||||
}
|
||||
else if(stat && (*plinkValid == calcoutINAV_EXT_NC)) {
|
||||
}
|
||||
else if (stat && (*plinkValid == calcoutINAV_EXT_NC)) {
|
||||
*plinkValid = calcoutINAV_EXT;
|
||||
db_post_events(pcalc, plinkValid, DBE_VALUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(caLinkNc)
|
||||
if (caLinkNc)
|
||||
prpvt->caLinkStat = CA_LINKS_NOT_OK;
|
||||
else if(caLink)
|
||||
else if (caLink)
|
||||
prpvt->caLinkStat = CA_LINKS_ALL_OK;
|
||||
else
|
||||
prpvt->caLinkStat = NO_CA_LINKS;
|
||||
|
||||
if(!prpvt->cbScheduled && caLinkNc) {
|
||||
if (!prpvt->cbScheduled && caLinkNc) {
|
||||
/* Schedule another CALLBACK */
|
||||
prpvt->cbScheduled = 1;
|
||||
callbackRequestDelayed(&prpvt->checkLinkCb, .5);
|
||||
@@ -690,7 +696,7 @@ static long writeValue(calcoutRecord *pcalc)
|
||||
calcoutDSET *pcalcoutDSET = (calcoutDSET *)pcalc->dset;
|
||||
|
||||
|
||||
if(!pcalcoutDSET || !pcalcoutDSET->write) {
|
||||
if (!pcalcoutDSET || !pcalcoutDSET->write) {
|
||||
errlogPrintf("%s DSET write does not exist\n", pcalc->name);
|
||||
recGblSetSevr(pcalc, SOFT_ALARM, INVALID_ALARM);
|
||||
pcalc->pact = TRUE;
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* compressRecord.c */
|
||||
/* base/src/rec $Id$ */
|
||||
|
||||
/* $Id$ */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
* Date: 7-14-89
|
||||
*/
|
||||
|
||||
@@ -41,20 +39,20 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long special();
|
||||
static long init_record(compressRecord *, int);
|
||||
static long process(compressRecord *);
|
||||
static long special(DBADDR *, int);
|
||||
#define get_value NULL
|
||||
static long cvt_dbaddr();
|
||||
static long get_array_info();
|
||||
static long put_array_info();
|
||||
static long get_units();
|
||||
static long get_precision();
|
||||
static long cvt_dbaddr(DBADDR *);
|
||||
static long get_array_info(DBADDR *, long *, long *);
|
||||
static long put_array_info(DBADDR *, long);
|
||||
static long get_units(DBADDR *, char *);
|
||||
static long get_precision(DBADDR *, long *);
|
||||
#define get_enum_str NULL
|
||||
#define get_enum_strs NULL
|
||||
#define put_enum_str NULL
|
||||
static long get_graphic_double();
|
||||
static long get_control_double();
|
||||
static long get_graphic_double(DBADDR *, struct dbr_grDouble *);
|
||||
static long get_control_double(DBADDR *, struct dbr_ctrlDouble *);
|
||||
#define get_alarm_double NULL
|
||||
|
||||
rset compressRSET={
|
||||
@@ -98,14 +96,14 @@ static void monitor(compressRecord *pcompress)
|
||||
return;
|
||||
}
|
||||
|
||||
static void put_value(compressRecord *pcompress,double *psource, long n)
|
||||
static void put_value(compressRecord *pcompress,double *psource, epicsInt32 n)
|
||||
{
|
||||
/* treat bptr as pointer to a circular buffer*/
|
||||
double *pdest;
|
||||
long offset=pcompress->off;
|
||||
long nuse=pcompress->nuse;
|
||||
long nsam=pcompress->nsam;
|
||||
long i;
|
||||
epicsInt32 offset=pcompress->off;
|
||||
epicsInt32 nuse=pcompress->nuse;
|
||||
epicsInt32 nsam=pcompress->nsam;
|
||||
epicsInt32 i;
|
||||
|
||||
pdest = pcompress->bptr + offset;
|
||||
for(i=0; i<n; i++, psource++) {
|
||||
@@ -135,13 +133,13 @@ static int compare(const void *arg1, const void *arg2)
|
||||
}
|
||||
|
||||
static int compress_array(compressRecord *pcompress,
|
||||
double *psource,long no_elements)
|
||||
double *psource,epicsInt32 no_elements)
|
||||
{
|
||||
long i,j;
|
||||
long nnew;
|
||||
long nsam=pcompress->nsam;
|
||||
epicsInt32 i,j;
|
||||
epicsInt32 nnew;
|
||||
epicsInt32 nsam=pcompress->nsam;
|
||||
double value;
|
||||
long n;
|
||||
epicsInt32 n;
|
||||
|
||||
/* skip out of limit data */
|
||||
if (pcompress->ilil < pcompress->ihil){
|
||||
@@ -204,16 +202,16 @@ static int compress_array(compressRecord *pcompress,
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int array_average(compressRecord *pcompress,
|
||||
double *psource,long no_elements)
|
||||
static int array_average(compressRecord *pcompress,
|
||||
double *psource,epicsInt32 no_elements)
|
||||
{
|
||||
long i;
|
||||
long nnow;
|
||||
long nsam=pcompress->nsam;
|
||||
epicsInt32 i;
|
||||
epicsInt32 nnow;
|
||||
epicsInt32 nsam=pcompress->nsam;
|
||||
double *psum;
|
||||
double multiplier;
|
||||
long inx=pcompress->inx;
|
||||
long nuse,n;
|
||||
epicsInt32 inx=pcompress->inx;
|
||||
epicsInt32 nuse,n;
|
||||
|
||||
nuse = nsam;
|
||||
if(nuse>no_elements) nuse = no_elements;
|
||||
@@ -254,7 +252,7 @@ static int compress_scalar(struct compressRecord *pcompress,double *psource)
|
||||
{
|
||||
double value = *psource;
|
||||
double *pdest=&pcompress->cvb;
|
||||
long inx = pcompress->inx;
|
||||
epicsInt32 inx = pcompress->inx;
|
||||
|
||||
/* compress according to specified algorithm */
|
||||
switch (pcompress->alg){
|
||||
@@ -289,9 +287,7 @@ static int compress_scalar(struct compressRecord *pcompress,double *psource)
|
||||
}
|
||||
|
||||
/*Beginning of record support routines*/
|
||||
static long init_record(pcompress,pass)
|
||||
compressRecord *pcompress;
|
||||
int pass;
|
||||
static long init_record(compressRecord *pcompress, int pass)
|
||||
{
|
||||
if (pass==0){
|
||||
if(pcompress->nsam<1) pcompress->nsam = 1;
|
||||
@@ -305,8 +301,7 @@ static long init_record(pcompress,pass)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long process(pcompress)
|
||||
compressRecord *pcompress;
|
||||
static long process(compressRecord *pcompress)
|
||||
{
|
||||
long status=0;
|
||||
long nelements = 0;
|
||||
@@ -355,9 +350,7 @@ static long process(pcompress)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long special(paddr,after)
|
||||
struct dbAddr *paddr;
|
||||
int after;
|
||||
static long special(DBADDR *paddr, int after)
|
||||
{
|
||||
compressRecord *pcompress = (compressRecord *)(paddr->precord);
|
||||
int special_type = paddr->special;
|
||||
@@ -373,8 +366,7 @@ static long special(paddr,after)
|
||||
}
|
||||
}
|
||||
|
||||
static long cvt_dbaddr(paddr)
|
||||
struct dbAddr *paddr;
|
||||
static long cvt_dbaddr(DBADDR *paddr)
|
||||
{
|
||||
compressRecord *pcompress=(compressRecord *)paddr->precord;
|
||||
|
||||
@@ -386,10 +378,7 @@ static long cvt_dbaddr(paddr)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_array_info(paddr,no_elements,offset)
|
||||
struct dbAddr *paddr;
|
||||
long *no_elements;
|
||||
long *offset;
|
||||
static long get_array_info(DBADDR *paddr,long *no_elements, long *offset)
|
||||
{
|
||||
compressRecord *pcompress=(compressRecord *)paddr->precord;
|
||||
|
||||
@@ -399,9 +388,7 @@ static long get_array_info(paddr,no_elements,offset)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long put_array_info(paddr,nNew)
|
||||
struct dbAddr *paddr;
|
||||
long nNew;
|
||||
static long put_array_info(DBADDR *paddr, long nNew)
|
||||
{
|
||||
compressRecord *pcompress=(compressRecord *)paddr->precord;
|
||||
|
||||
@@ -411,9 +398,7 @@ static long put_array_info(paddr,nNew)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_units(paddr,units)
|
||||
struct dbAddr *paddr;
|
||||
char *units;
|
||||
static long get_units(DBADDR *paddr,char *units)
|
||||
{
|
||||
compressRecord *pcompress=(compressRecord *)paddr->precord;
|
||||
|
||||
@@ -421,9 +406,7 @@ static long get_units(paddr,units)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_precision(paddr,precision)
|
||||
struct dbAddr *paddr;
|
||||
long *precision;
|
||||
static long get_precision(DBADDR *paddr, long *precision)
|
||||
{
|
||||
compressRecord *pcompress=(compressRecord *)paddr->precord;
|
||||
|
||||
@@ -433,9 +416,7 @@ static long get_precision(paddr,precision)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_graphic_double(paddr,pgd)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_grDouble *pgd;
|
||||
static long get_graphic_double(DBADDR *paddr,struct dbr_grDouble *pgd)
|
||||
{
|
||||
compressRecord *pcompress=(compressRecord *)paddr->precord;
|
||||
|
||||
@@ -448,9 +429,7 @@ static long get_graphic_double(paddr,pgd)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_control_double(paddr,pcd)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_ctrlDouble *pcd;
|
||||
static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
|
||||
{
|
||||
compressRecord *pcompress=(compressRecord *)paddr->precord;
|
||||
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 Southeastern Universities Research Association, as
|
||||
* Operator of Thomas Jefferson National Accelerator Facility.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* recDfanout.c */
|
||||
/* share/src/rec @(#)recDfanout.c 1.16 6/4/93 */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* recDfanout.c - Record Support Routines for Dfanout records */
|
||||
/*
|
||||
* Original Author: Matt Bickley (Sometime in 1994)
|
||||
* Current Author: Johnny Tang
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
@@ -48,21 +46,21 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long init_record(dfanoutRecord *, int);
|
||||
static long process(dfanoutRecord *);
|
||||
#define special NULL
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
#define put_array_info NULL
|
||||
static long get_units();
|
||||
static long get_precision();
|
||||
static long get_units(DBADDR *, char *);
|
||||
static long get_precision(DBADDR *, long *);
|
||||
#define get_enum_str NULL
|
||||
#define get_enum_strs NULL
|
||||
#define put_enum_str NULL
|
||||
static long get_graphic_double();
|
||||
static long get_control_double();
|
||||
static long get_alarm_double();
|
||||
static long get_graphic_double(DBADDR *,struct dbr_grDouble *);
|
||||
static long get_control_double(DBADDR *,struct dbr_ctrlDouble *);
|
||||
static long get_alarm_double(DBADDR *,struct dbr_alDouble *);
|
||||
|
||||
rset dfanoutRSET={
|
||||
RSETNUMBER,
|
||||
@@ -87,14 +85,14 @@ rset dfanoutRSET={
|
||||
epicsExportAddress(rset,dfanoutRSET);
|
||||
|
||||
|
||||
static void checkAlarms();
|
||||
static void monitor();
|
||||
static void push_values();
|
||||
static void checkAlarms(dfanoutRecord *);
|
||||
static void monitor(dfanoutRecord *);
|
||||
static void push_values(dfanoutRecord *);
|
||||
|
||||
#define OUT_ARG_MAX 8
|
||||
|
||||
|
||||
static long init_record(struct dfanoutRecord *pdfanout, int pass)
|
||||
static long init_record(dfanoutRecord *pdfanout, int pass)
|
||||
{
|
||||
if (pass==0) return(0);
|
||||
|
||||
@@ -105,7 +103,7 @@ static long init_record(struct dfanoutRecord *pdfanout, int pass)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long process(struct dfanoutRecord *pdfanout)
|
||||
static long process(dfanoutRecord *pdfanout)
|
||||
{
|
||||
long status=0;
|
||||
|
||||
@@ -128,17 +126,17 @@ static long process(struct dfanoutRecord *pdfanout)
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long get_units(struct dbAddr *paddr,char *units)
|
||||
static long get_units(DBADDR *paddr,char *units)
|
||||
{
|
||||
struct dfanoutRecord *pdfanout=(struct dfanoutRecord *)paddr->precord;
|
||||
dfanoutRecord *pdfanout=(dfanoutRecord *)paddr->precord;
|
||||
|
||||
strncpy(units,pdfanout->egu,DB_UNITS_SIZE);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_precision(struct dbAddr *paddr,long *precision)
|
||||
static long get_precision(DBADDR *paddr,long *precision)
|
||||
{
|
||||
struct dfanoutRecord *pdfanout=(struct dfanoutRecord *)paddr->precord;
|
||||
dfanoutRecord *pdfanout=(dfanoutRecord *)paddr->precord;
|
||||
int fieldIndex = dbGetFieldIndex(paddr);
|
||||
|
||||
if(fieldIndex == dfanoutRecordVAL
|
||||
@@ -155,9 +153,9 @@ static long get_precision(struct dbAddr *paddr,long *precision)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_graphic_double(struct dbAddr *paddr,struct dbr_grDouble *pgd)
|
||||
static long get_graphic_double(DBADDR *paddr,struct dbr_grDouble *pgd)
|
||||
{
|
||||
struct dfanoutRecord *pdfanout=(struct dfanoutRecord *)paddr->precord;
|
||||
dfanoutRecord *pdfanout=(dfanoutRecord *)paddr->precord;
|
||||
int fieldIndex = dbGetFieldIndex(paddr);
|
||||
|
||||
if(fieldIndex == dfanoutRecordVAL
|
||||
@@ -173,9 +171,9 @@ static long get_graphic_double(struct dbAddr *paddr,struct dbr_grDouble *pgd)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_control_double(struct dbAddr *paddr,struct dbr_ctrlDouble *pcd)
|
||||
static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd)
|
||||
{
|
||||
struct dfanoutRecord *pdfanout=(struct dfanoutRecord *)paddr->precord;
|
||||
dfanoutRecord *pdfanout=(dfanoutRecord *)paddr->precord;
|
||||
int fieldIndex = dbGetFieldIndex(paddr);
|
||||
|
||||
if(fieldIndex == dfanoutRecordVAL
|
||||
@@ -188,9 +186,9 @@ static long get_control_double(struct dbAddr *paddr,struct dbr_ctrlDouble *pcd)
|
||||
} else recGblGetControlDouble(paddr,pcd);
|
||||
return(0);
|
||||
}
|
||||
static long get_alarm_double(struct dbAddr *paddr,struct dbr_alDouble *pad)
|
||||
static long get_alarm_double(DBADDR *paddr,struct dbr_alDouble *pad)
|
||||
{
|
||||
struct dfanoutRecord *pdfanout=(struct dfanoutRecord *)paddr->precord;
|
||||
dfanoutRecord *pdfanout=(dfanoutRecord *)paddr->precord;
|
||||
int fieldIndex = dbGetFieldIndex(paddr);
|
||||
|
||||
|
||||
@@ -203,51 +201,63 @@ static long get_alarm_double(struct dbAddr *paddr,struct dbr_alDouble *pad)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void checkAlarms(struct dfanoutRecord *pdfanout)
|
||||
static void checkAlarms(dfanoutRecord *prec)
|
||||
{
|
||||
double val;
|
||||
double hyst, lalm, hihi, high, low, lolo;
|
||||
unsigned short hhsv, llsv, hsv, lsv;
|
||||
double val, hyst, lalm;
|
||||
double alev;
|
||||
epicsEnum16 asev;
|
||||
|
||||
if (pdfanout->udf) {
|
||||
recGblSetSevr(pdfanout,UDF_ALARM,INVALID_ALARM);
|
||||
return;
|
||||
}
|
||||
hihi = pdfanout->hihi; lolo = pdfanout->lolo;
|
||||
high = pdfanout->high; low = pdfanout->low;
|
||||
hhsv = pdfanout->hhsv; llsv = pdfanout->llsv;
|
||||
hsv = pdfanout->hsv; lsv = pdfanout->lsv;
|
||||
val = pdfanout->val; hyst = pdfanout->hyst; lalm = pdfanout->lalm;
|
||||
/* alarm condition hihi */
|
||||
if (hhsv && (val >= hihi || ((lalm==hihi) && (val >= hihi-hyst)))){
|
||||
if(recGblSetSevr(pdfanout,HIHI_ALARM,pdfanout->hhsv))
|
||||
pdfanout->lalm = hihi;
|
||||
return;
|
||||
}
|
||||
/* alarm condition lolo */
|
||||
if (llsv && (val <= lolo || ((lalm==lolo) && (val <= lolo+hyst)))){
|
||||
if(recGblSetSevr(pdfanout,LOLO_ALARM,pdfanout->llsv))
|
||||
pdfanout->lalm = lolo;
|
||||
return;
|
||||
}
|
||||
/* alarm condition high */
|
||||
if (hsv && (val >= high || ((lalm==high) && (val >= high-hyst)))){
|
||||
if(recGblSetSevr(pdfanout,HIGH_ALARM,pdfanout->hsv))
|
||||
pdfanout->lalm = high;
|
||||
return;
|
||||
}
|
||||
/* alarm condition low */
|
||||
if (lsv && (val <= low || ((lalm==low) && (val <= low+hyst)))){
|
||||
if(recGblSetSevr(pdfanout,LOW_ALARM,pdfanout->lsv))
|
||||
pdfanout->lalm = low;
|
||||
return;
|
||||
}
|
||||
/* we get here only if val is out of alarm by at least hyst */
|
||||
pdfanout->lalm = val;
|
||||
return;
|
||||
if (prec->udf) {
|
||||
recGblSetSevr(prec, UDF_ALARM, INVALID_ALARM);
|
||||
return;
|
||||
}
|
||||
|
||||
val = prec->val;
|
||||
hyst = prec->hyst;
|
||||
lalm = prec->lalm;
|
||||
|
||||
/* alarm condition hihi */
|
||||
asev = prec->hhsv;
|
||||
alev = prec->hihi;
|
||||
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIHI_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition lolo */
|
||||
asev = prec->llsv;
|
||||
alev = prec->lolo;
|
||||
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOLO_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition high */
|
||||
asev = prec->hsv;
|
||||
alev = prec->high;
|
||||
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIGH_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition low */
|
||||
asev = prec->lsv;
|
||||
alev = prec->low;
|
||||
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOW_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* we get here only if val is out of alarm by at least hyst */
|
||||
prec->lalm = val;
|
||||
return;
|
||||
}
|
||||
|
||||
static void monitor(struct dfanoutRecord *pdfanout)
|
||||
static void monitor(dfanoutRecord *pdfanout)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
|
||||
@@ -280,7 +290,7 @@ static void monitor(struct dfanoutRecord *pdfanout)
|
||||
return;
|
||||
}
|
||||
|
||||
static void push_values(struct dfanoutRecord *pdfanout)
|
||||
static void push_values(dfanoutRecord *pdfanout)
|
||||
{
|
||||
struct link *plink; /* structure of the link field */
|
||||
int i;
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* recEvent.c */
|
||||
/* base/src/rec $Id$ */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* recEvent.c - Record Support Routines for Event records */
|
||||
/*
|
||||
@@ -41,10 +40,10 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long init_record(eventRecord *, int);
|
||||
static long process(eventRecord *);
|
||||
#define special NULL
|
||||
static long get_value();
|
||||
static long get_value(eventRecord *, struct valueDes *);
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
#define put_array_info NULL
|
||||
@@ -87,13 +86,11 @@ struct eventdset { /* event input dset */
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_event;/*(0)=> success */
|
||||
};
|
||||
static void monitor();
|
||||
static long readValue();
|
||||
static void monitor(eventRecord *);
|
||||
static long readValue(eventRecord *);
|
||||
|
||||
|
||||
static long init_record(pevent,pass)
|
||||
struct eventRecord *pevent;
|
||||
int pass;
|
||||
static long init_record(eventRecord *pevent, int pass)
|
||||
{
|
||||
struct eventdset *pdset;
|
||||
long status=0;
|
||||
@@ -113,8 +110,7 @@ static long init_record(pevent,pass)
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long process(pevent)
|
||||
struct eventRecord *pevent;
|
||||
static long process(eventRecord *pevent)
|
||||
{
|
||||
struct eventdset *pdset = (struct eventdset *)(pevent->dset);
|
||||
long status=0;
|
||||
@@ -141,9 +137,7 @@ static long process(pevent)
|
||||
}
|
||||
|
||||
|
||||
static long get_value(pevent,pvdes)
|
||||
struct eventRecord *pevent;
|
||||
struct valueDes *pvdes;
|
||||
static long get_value(eventRecord *pevent, struct valueDes *pvdes)
|
||||
{
|
||||
pvdes->field_type = DBF_USHORT;
|
||||
pvdes->no_elements=1;
|
||||
@@ -152,8 +146,7 @@ static long get_value(pevent,pvdes)
|
||||
}
|
||||
|
||||
|
||||
static void monitor(pevent)
|
||||
struct eventRecord *pevent;
|
||||
static void monitor(eventRecord *pevent)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
|
||||
@@ -163,8 +156,7 @@ static void monitor(pevent)
|
||||
return;
|
||||
}
|
||||
|
||||
static long readValue(pevent)
|
||||
struct eventRecord *pevent;
|
||||
static long readValue(eventRecord *pevent)
|
||||
{
|
||||
long status;
|
||||
struct eventdset *pdset = (struct eventdset *) (pevent->dset);
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* fanoutRecord.c */
|
||||
/* base/src/rec $Id$ */
|
||||
|
||||
/* $Id$ */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
* Date: 12-20-88
|
||||
*/
|
||||
|
||||
@@ -39,8 +37,8 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long init_record(fanoutRecord *, int);
|
||||
static long process(fanoutRecord *);
|
||||
#define special NULL
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
@@ -77,9 +75,7 @@ rset fanoutRSET={
|
||||
};
|
||||
epicsExportAddress(rset,fanoutRSET);
|
||||
|
||||
static long init_record(pfanout,pass)
|
||||
struct fanoutRecord *pfanout;
|
||||
int pass;
|
||||
static long init_record(fanoutRecord *pfanout, int pass)
|
||||
{
|
||||
|
||||
if (pass==0) return(0);
|
||||
@@ -87,8 +83,7 @@ static long init_record(pfanout,pass)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long process(pfanout)
|
||||
struct fanoutRecord *pfanout;
|
||||
static long process(fanoutRecord *pfanout)
|
||||
{
|
||||
struct link *plink;
|
||||
unsigned short state;
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* recHistogram.c */
|
||||
/* base/src/rec $Id$ */
|
||||
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* recHistogram.c - Record Support Routines for Histogram records */
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
@@ -45,21 +44,21 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long special();
|
||||
static long init_record(histogramRecord *, int);
|
||||
static long process(histogramRecord *);
|
||||
static long special(DBADDR *, int);
|
||||
#define get_value NULL
|
||||
static long cvt_dbaddr();
|
||||
static long get_array_info();
|
||||
static long cvt_dbaddr(DBADDR *);
|
||||
static long get_array_info(DBADDR *, long *, long *);
|
||||
#define put_array_info NULL
|
||||
#define get_units NULL
|
||||
static long get_precision(struct dbAddr *paddr,long *precision);
|
||||
static long get_precision(DBADDR *paddr,long *precision);
|
||||
#define get_enum_str NULL
|
||||
#define get_enum_strs NULL
|
||||
#define put_enum_str NULL
|
||||
#define get_alarm_double NULL
|
||||
static long get_graphic_double(struct dbAddr *paddr,struct dbr_grDouble *pgd);
|
||||
static long get_control_double(struct dbAddr *paddr,struct dbr_ctrlDouble *pcd);
|
||||
static long get_graphic_double(DBADDR *paddr,struct dbr_grDouble *pgd);
|
||||
static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd);
|
||||
|
||||
rset histogramRSET={
|
||||
RSETNUMBER,
|
||||
@@ -100,15 +99,15 @@ typedef struct myCallback {
|
||||
histogramRecord *phistogram;
|
||||
}myCallback;
|
||||
|
||||
static long add_count();
|
||||
static long clear_histogram();
|
||||
static void monitor();
|
||||
static long readValue();
|
||||
static long add_count(histogramRecord *);
|
||||
static long clear_histogram(histogramRecord *);
|
||||
static void monitor(histogramRecord *);
|
||||
static long readValue(histogramRecord *);
|
||||
|
||||
static void wdogCallback(CALLBACK *arg)
|
||||
{
|
||||
myCallback *pcallback;
|
||||
struct histogramRecord *phistogram;
|
||||
histogramRecord *phistogram;
|
||||
|
||||
callbackGetUser(pcallback,arg);
|
||||
phistogram = pcallback->phistogram;
|
||||
@@ -128,8 +127,7 @@ static void wdogCallback(CALLBACK *arg)
|
||||
|
||||
return;
|
||||
}
|
||||
static long wdogInit(phistogram)
|
||||
struct histogramRecord *phistogram;
|
||||
static long wdogInit(histogramRecord *phistogram)
|
||||
{
|
||||
myCallback *pcallback;
|
||||
|
||||
@@ -154,9 +152,7 @@ static long wdogInit(phistogram)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long init_record(phistogram,pass)
|
||||
struct histogramRecord *phistogram;
|
||||
int pass;
|
||||
static long init_record(histogramRecord *phistogram, int pass)
|
||||
{
|
||||
struct histogramdset *pdset;
|
||||
long status;
|
||||
@@ -166,7 +162,7 @@ static long init_record(phistogram,pass)
|
||||
/* allocate space for histogram array */
|
||||
if(phistogram->bptr==NULL) {
|
||||
if(phistogram->nelm<=0) phistogram->nelm=1;
|
||||
phistogram->bptr = (unsigned long *)calloc(phistogram->nelm,sizeof(long));
|
||||
phistogram->bptr = (epicsUInt32 *)calloc(phistogram->nelm,sizeof(epicsUInt32));
|
||||
}
|
||||
|
||||
/* calulate width of array element */
|
||||
@@ -202,8 +198,7 @@ static long init_record(phistogram,pass)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long process(phistogram)
|
||||
struct histogramRecord *phistogram;
|
||||
static long process(histogramRecord *phistogram)
|
||||
{
|
||||
struct histogramdset *pdset = (struct histogramdset *)(phistogram->dset);
|
||||
long status;
|
||||
@@ -235,11 +230,9 @@ static long process(phistogram)
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long special(paddr,after)
|
||||
struct dbAddr *paddr;
|
||||
int after;
|
||||
static long special(DBADDR *paddr,int after)
|
||||
{
|
||||
struct histogramRecord *phistogram = (struct histogramRecord *)(paddr->precord);
|
||||
histogramRecord *phistogram = (histogramRecord *)(paddr->precord);
|
||||
int special_type = paddr->special;
|
||||
int fieldIndex = dbGetFieldIndex(paddr);
|
||||
|
||||
@@ -276,8 +269,7 @@ static long special(paddr,after)
|
||||
}
|
||||
}
|
||||
|
||||
static void monitor(phistogram)
|
||||
struct histogramRecord *phistogram;
|
||||
static void monitor(histogramRecord *phistogram)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
|
||||
@@ -295,36 +287,31 @@ static void monitor(phistogram)
|
||||
return;
|
||||
}
|
||||
|
||||
static long cvt_dbaddr(paddr)
|
||||
struct dbAddr *paddr;
|
||||
static long cvt_dbaddr(DBADDR *paddr)
|
||||
{
|
||||
struct histogramRecord *phistogram=(struct histogramRecord *)paddr->precord;
|
||||
histogramRecord *phistogram=(histogramRecord *)paddr->precord;
|
||||
|
||||
paddr->pfield = (void *)(phistogram->bptr);
|
||||
paddr->no_elements = phistogram->nelm;
|
||||
paddr->field_type = DBF_ULONG;
|
||||
paddr->field_size = sizeof(unsigned long);
|
||||
paddr->field_size = sizeof(epicsUInt32);
|
||||
paddr->dbr_field_type = DBF_ULONG;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_array_info(paddr,no_elements,offset)
|
||||
struct dbAddr *paddr;
|
||||
long *no_elements;
|
||||
long *offset;
|
||||
static long get_array_info(DBADDR *paddr, long *no_elements, long *offset)
|
||||
{
|
||||
struct histogramRecord *phistogram=(struct histogramRecord *)paddr->precord;
|
||||
histogramRecord *phistogram=(histogramRecord *)paddr->precord;
|
||||
|
||||
*no_elements = phistogram->nelm;
|
||||
*offset = 0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long add_count(phistogram)
|
||||
struct histogramRecord *phistogram;
|
||||
static long add_count(histogramRecord *phistogram)
|
||||
{
|
||||
double temp;
|
||||
unsigned long *pdest;
|
||||
epicsUInt32 *pdest;
|
||||
int i;
|
||||
|
||||
if(phistogram->csta==FALSE) return(0);
|
||||
@@ -343,15 +330,14 @@ static long add_count(phistogram)
|
||||
if (temp<=(double)i*phistogram->wdth) break;
|
||||
}
|
||||
pdest=phistogram->bptr+i-1;
|
||||
if ( *pdest==ULONG_MAX) *pdest=0.0;
|
||||
if (*pdest == (epicsUInt32) ULONG_MAX) *pdest=0.0;
|
||||
(*pdest)++;
|
||||
phistogram->mcnt++;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long clear_histogram(phistogram)
|
||||
struct histogramRecord *phistogram;
|
||||
static long clear_histogram(histogramRecord *phistogram)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -363,8 +349,7 @@ static long clear_histogram(phistogram)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long readValue(phistogram)
|
||||
struct histogramRecord *phistogram;
|
||||
static long readValue(histogramRecord *phistogram)
|
||||
{
|
||||
long status;
|
||||
struct histogramdset *pdset = (struct histogramdset *) (phistogram->dset);
|
||||
@@ -399,9 +384,10 @@ static long readValue(phistogram)
|
||||
|
||||
return(status);
|
||||
}
|
||||
static long get_precision(struct dbAddr *paddr,long *precision)
|
||||
|
||||
static long get_precision(DBADDR *paddr,long *precision)
|
||||
{
|
||||
struct histogramRecord *phistogram=(struct histogramRecord *)paddr->precord;
|
||||
histogramRecord *phistogram=(histogramRecord *)paddr->precord;
|
||||
int fieldIndex = dbGetFieldIndex(paddr);
|
||||
|
||||
*precision = phistogram->prec;
|
||||
@@ -416,9 +402,9 @@ static long get_precision(struct dbAddr *paddr,long *precision)
|
||||
recGblGetPrec(paddr,precision);
|
||||
return(0);
|
||||
}
|
||||
static long get_graphic_double(struct dbAddr *paddr,struct dbr_grDouble *pgd)
|
||||
static long get_graphic_double(DBADDR *paddr,struct dbr_grDouble *pgd)
|
||||
{
|
||||
struct histogramRecord *phistogram=(struct histogramRecord *)paddr->precord;
|
||||
histogramRecord *phistogram=(histogramRecord *)paddr->precord;
|
||||
int fieldIndex = dbGetFieldIndex(paddr);
|
||||
|
||||
if(fieldIndex == histogramRecordBPTR){
|
||||
@@ -427,9 +413,9 @@ static long get_graphic_double(struct dbAddr *paddr,struct dbr_grDouble *pgd)
|
||||
} else recGblGetGraphicDouble(paddr,pgd);
|
||||
return(0);
|
||||
}
|
||||
static long get_control_double(struct dbAddr *paddr,struct dbr_ctrlDouble *pcd)
|
||||
static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd)
|
||||
{
|
||||
struct histogramRecord *phistogram=(struct histogramRecord *)paddr->precord;
|
||||
histogramRecord *phistogram=(histogramRecord *)paddr->precord;
|
||||
int fieldIndex = dbGetFieldIndex(paddr);
|
||||
|
||||
if(fieldIndex == histogramRecordBPTR){
|
||||
|
||||
@@ -76,7 +76,7 @@ recordtype(histogram) {
|
||||
prompt("Buffer Pointer")
|
||||
special(SPC_NOMOD)
|
||||
interest(4)
|
||||
extra("unsigned long *bptr")
|
||||
extra("epicsUInt32 *bptr")
|
||||
}
|
||||
field(WDOG,DBF_NOACCESS) {
|
||||
prompt("Watchdog callback")
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* recLongin.c */
|
||||
/* base/src/rec $Id$ */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* recLongin.c - Record Support Routines for Longin records */
|
||||
/*
|
||||
@@ -40,21 +39,21 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long init_record(longinRecord *, int);
|
||||
static long process(longinRecord *);
|
||||
#define special NULL
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
#define put_array_info NULL
|
||||
static long get_units();
|
||||
static long get_units(DBADDR *, char *);
|
||||
#define get_precision NULL
|
||||
#define get_enum_str NULL
|
||||
#define get_enum_strs NULL
|
||||
#define put_enum_str NULL
|
||||
static long get_graphic_double();
|
||||
static long get_control_double();
|
||||
static long get_alarm_double();
|
||||
static long get_graphic_double(DBADDR *, struct dbr_grDouble *);
|
||||
static long get_control_double(DBADDR *, struct dbr_ctrlDouble *);
|
||||
static long get_alarm_double(DBADDR *, struct dbr_alDouble *);
|
||||
|
||||
rset longinRSET={
|
||||
RSETNUMBER,
|
||||
@@ -87,14 +86,12 @@ struct longindset { /* longin input dset */
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_longin; /*returns: (-1,0)=>(failure,success)*/
|
||||
};
|
||||
static void checkAlarms();
|
||||
static void monitor();
|
||||
static long readValue();
|
||||
static void checkAlarms(longinRecord *plongin);
|
||||
static void monitor(longinRecord *plongin);
|
||||
static long readValue(longinRecord *plongin);
|
||||
|
||||
|
||||
static long init_record(plongin,pass)
|
||||
struct longinRecord *plongin;
|
||||
int pass;
|
||||
static long init_record(longinRecord *plongin, int pass)
|
||||
{
|
||||
struct longindset *pdset;
|
||||
long status;
|
||||
@@ -126,8 +123,7 @@ static long init_record(plongin,pass)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long process(plongin)
|
||||
struct longinRecord *plongin;
|
||||
static long process(longinRecord *plongin)
|
||||
{
|
||||
struct longindset *pdset = (struct longindset *)(plongin->dset);
|
||||
long status;
|
||||
@@ -158,22 +154,18 @@ static long process(plongin)
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long get_units(paddr,units)
|
||||
struct dbAddr *paddr;
|
||||
char *units;
|
||||
static long get_units(DBADDR *paddr,char *units)
|
||||
{
|
||||
struct longinRecord *plongin=(struct longinRecord *)paddr->precord;
|
||||
longinRecord *plongin=(longinRecord *)paddr->precord;
|
||||
|
||||
strncpy(units,plongin->egu,DB_UNITS_SIZE);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long get_graphic_double(paddr,pgd)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_grDouble *pgd;
|
||||
static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd)
|
||||
{
|
||||
struct longinRecord *plongin=(struct longinRecord *)paddr->precord;
|
||||
longinRecord *plongin=(longinRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)&plongin->val
|
||||
|| paddr->pfield==(void *)&plongin->hihi
|
||||
@@ -186,11 +178,9 @@ static long get_graphic_double(paddr,pgd)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_control_double(paddr,pcd)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_ctrlDouble *pcd;
|
||||
static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
|
||||
{
|
||||
struct longinRecord *plongin=(struct longinRecord *)paddr->precord;
|
||||
longinRecord *plongin=(longinRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)&plongin->val
|
||||
|| paddr->pfield==(void *)&plongin->hihi
|
||||
@@ -203,11 +193,9 @@ static long get_control_double(paddr,pcd)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_alarm_double(paddr,pad)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_alDouble *pad;
|
||||
static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad)
|
||||
{
|
||||
struct longinRecord *plongin=(struct longinRecord *)paddr->precord;
|
||||
longinRecord *plongin=(longinRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)&plongin->val){
|
||||
pad->upper_alarm_limit = plongin->hihi;
|
||||
@@ -218,55 +206,66 @@ static long get_alarm_double(paddr,pad)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void checkAlarms(plongin)
|
||||
struct longinRecord *plongin;
|
||||
static void checkAlarms(longinRecord *prec)
|
||||
{
|
||||
long val;
|
||||
long hyst, lalm, hihi, high, low, lolo;
|
||||
unsigned short hhsv, llsv, hsv, lsv;
|
||||
epicsInt32 val, hyst, lalm;
|
||||
epicsInt32 alev;
|
||||
epicsEnum16 asev;
|
||||
|
||||
if(plongin->udf == TRUE ){
|
||||
recGblSetSevr(plongin,UDF_ALARM,INVALID_ALARM);
|
||||
return;
|
||||
}
|
||||
hihi = plongin->hihi; lolo = plongin->lolo; high = plongin->high; low = plongin->low;
|
||||
hhsv = plongin->hhsv; llsv = plongin->llsv; hsv = plongin->hsv; lsv = plongin->lsv;
|
||||
val = plongin->val; hyst = plongin->hyst; lalm = plongin->lalm;
|
||||
if (prec->udf) {
|
||||
recGblSetSevr(prec, UDF_ALARM, INVALID_ALARM);
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition hihi */
|
||||
if (hhsv && (val >= hihi || ((lalm==hihi) && (val >= hihi-hyst)))){
|
||||
if (recGblSetSevr(plongin,HIHI_ALARM,plongin->hhsv)) plongin->lalm = hihi;
|
||||
return;
|
||||
}
|
||||
val = prec->val;
|
||||
hyst = prec->hyst;
|
||||
lalm = prec->lalm;
|
||||
|
||||
/* alarm condition lolo */
|
||||
if (llsv && (val <= lolo || ((lalm==lolo) && (val <= lolo+hyst)))){
|
||||
if (recGblSetSevr(plongin,LOLO_ALARM,plongin->llsv)) plongin->lalm = lolo;
|
||||
return;
|
||||
}
|
||||
/* alarm condition hihi */
|
||||
asev = prec->hhsv;
|
||||
alev = prec->hihi;
|
||||
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIHI_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition high */
|
||||
if (hsv && (val >= high || ((lalm==high) && (val >= high-hyst)))){
|
||||
if (recGblSetSevr(plongin,HIGH_ALARM,plongin->hsv)) plongin->lalm = high;
|
||||
return;
|
||||
}
|
||||
/* alarm condition lolo */
|
||||
asev = prec->llsv;
|
||||
alev = prec->lolo;
|
||||
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOLO_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition low */
|
||||
if (lsv && (val <= low || ((lalm==low) && (val <= low+hyst)))){
|
||||
if (recGblSetSevr(plongin,LOW_ALARM,plongin->lsv)) plongin->lalm = low;
|
||||
return;
|
||||
}
|
||||
/* alarm condition high */
|
||||
asev = prec->hsv;
|
||||
alev = prec->high;
|
||||
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIGH_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* we get here only if val is out of alarm by at least hyst */
|
||||
plongin->lalm = val;
|
||||
return;
|
||||
/* alarm condition low */
|
||||
asev = prec->lsv;
|
||||
alev = prec->low;
|
||||
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOW_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* we get here only if val is out of alarm by at least hyst */
|
||||
prec->lalm = val;
|
||||
return;
|
||||
}
|
||||
|
||||
static void monitor(plongin)
|
||||
struct longinRecord *plongin;
|
||||
static void monitor(longinRecord *plongin)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
long delta;
|
||||
epicsInt32 delta;
|
||||
|
||||
/* get previous stat and sevr and new stat and sevr*/
|
||||
monitor_mask = recGblResetAlarms(plongin);
|
||||
@@ -297,8 +296,7 @@ static void monitor(plongin)
|
||||
return;
|
||||
}
|
||||
|
||||
static long readValue(plongin)
|
||||
struct longinRecord *plongin;
|
||||
static long readValue(longinRecord *plongin)
|
||||
{
|
||||
long status;
|
||||
struct longindset *pdset = (struct longindset *) (plongin->dset);
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* recLongout.c */
|
||||
/* base/src/rec $Id$ */
|
||||
|
||||
/* $Id$ */
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 9/23/91
|
||||
@@ -39,21 +38,21 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long init_record(longoutRecord *, int);
|
||||
static long process(longoutRecord *);
|
||||
#define special NULL
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
#define put_array_info NULL
|
||||
static long get_units();
|
||||
static long get_units(DBADDR *, char *);
|
||||
#define get_precision NULL
|
||||
#define get_enum_str NULL
|
||||
#define get_enum_strs NULL
|
||||
#define put_enum_str NULL
|
||||
static long get_graphic_double();
|
||||
static long get_control_double();
|
||||
static long get_alarm_double();
|
||||
static long get_graphic_double(DBADDR *, struct dbr_grDouble *);
|
||||
static long get_control_double(DBADDR *, struct dbr_ctrlDouble *);
|
||||
static long get_alarm_double(DBADDR *, struct dbr_alDouble *);
|
||||
|
||||
rset longoutRSET={
|
||||
RSETNUMBER,
|
||||
@@ -86,15 +85,13 @@ struct longoutdset { /* longout input dset */
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_longout;/*(-1,0)=>(failure,success*/
|
||||
};
|
||||
static void checkAlarms();
|
||||
static void monitor();
|
||||
static long writeValue();
|
||||
static void convert();
|
||||
static void checkAlarms(longoutRecord *plongout);
|
||||
static void monitor(longoutRecord *plongout);
|
||||
static long writeValue(longoutRecord *plongout);
|
||||
static void convert(longoutRecord *plongout, epicsInt32 value);
|
||||
|
||||
|
||||
static long init_record(plongout,pass)
|
||||
struct longoutRecord *plongout;
|
||||
int pass;
|
||||
static long init_record(longoutRecord *plongout, int pass)
|
||||
{
|
||||
struct longoutdset *pdset;
|
||||
long status=0;
|
||||
@@ -122,12 +119,11 @@ static long init_record(plongout,pass)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long process(plongout)
|
||||
struct longoutRecord *plongout;
|
||||
static long process(longoutRecord *plongout)
|
||||
{
|
||||
struct longoutdset *pdset = (struct longoutdset *)(plongout->dset);
|
||||
long status=0;
|
||||
long value;
|
||||
epicsInt32 value;
|
||||
unsigned char pact=plongout->pact;
|
||||
|
||||
if( (pdset==NULL) || (pdset->write_longout==NULL) ) {
|
||||
@@ -180,8 +176,6 @@ static long process(plongout)
|
||||
|
||||
recGblGetTimeStamp(plongout);
|
||||
|
||||
/* check for alarms */
|
||||
checkAlarms(plongout);
|
||||
/* check event list */
|
||||
monitor(plongout);
|
||||
|
||||
@@ -192,21 +186,17 @@ static long process(plongout)
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long get_units(paddr,units)
|
||||
struct dbAddr *paddr;
|
||||
char *units;
|
||||
static long get_units(DBADDR *paddr,char *units)
|
||||
{
|
||||
struct longoutRecord *plongout=(struct longoutRecord *)paddr->precord;
|
||||
longoutRecord *plongout=(longoutRecord *)paddr->precord;
|
||||
|
||||
strncpy(units,plongout->egu,DB_UNITS_SIZE);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_graphic_double(paddr,pgd)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_grDouble *pgd;
|
||||
static long get_graphic_double(DBADDR *paddr,struct dbr_grDouble *pgd)
|
||||
{
|
||||
struct longoutRecord *plongout=(longoutRecord *)paddr->precord;
|
||||
longoutRecord *plongout=(longoutRecord *)paddr->precord;
|
||||
int fieldIndex = dbGetFieldIndex(paddr);
|
||||
|
||||
if(fieldIndex == longoutRecordVAL
|
||||
@@ -221,11 +211,9 @@ static long get_graphic_double(paddr,pgd)
|
||||
}
|
||||
|
||||
|
||||
static long get_control_double(paddr,pcd)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_ctrlDouble *pcd;
|
||||
static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd)
|
||||
{
|
||||
struct longoutRecord *plongout=(longoutRecord *)paddr->precord;
|
||||
longoutRecord *plongout=(longoutRecord *)paddr->precord;
|
||||
int fieldIndex = dbGetFieldIndex(paddr);
|
||||
|
||||
if(fieldIndex == longoutRecordVAL
|
||||
@@ -244,9 +232,7 @@ static long get_control_double(paddr,pcd)
|
||||
} else recGblGetControlDouble(paddr,pcd);
|
||||
return(0);
|
||||
}
|
||||
static long get_alarm_double(paddr,pad)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_alDouble *pad;
|
||||
static long get_alarm_double(DBADDR *paddr,struct dbr_alDouble *pad)
|
||||
{
|
||||
longoutRecord *plongout=(longoutRecord *)paddr->precord;
|
||||
int fieldIndex = dbGetFieldIndex(paddr);
|
||||
@@ -260,55 +246,66 @@ static long get_alarm_double(paddr,pad)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void checkAlarms(plongout)
|
||||
struct longoutRecord *plongout;
|
||||
static void checkAlarms(longoutRecord *prec)
|
||||
{
|
||||
long val;
|
||||
long hyst, lalm, hihi, high, low, lolo;
|
||||
unsigned short hhsv, llsv, hsv, lsv;
|
||||
epicsInt32 val, hyst, lalm;
|
||||
epicsInt32 alev;
|
||||
epicsEnum16 asev;
|
||||
|
||||
if(plongout->udf == TRUE ){
|
||||
recGblSetSevr(plongout,UDF_ALARM,INVALID_ALARM);
|
||||
return;
|
||||
}
|
||||
hihi = plongout->hihi; lolo = plongout->lolo; high = plongout->high; low = plongout->low;
|
||||
hhsv = plongout->hhsv; llsv = plongout->llsv; hsv = plongout->hsv; lsv = plongout->lsv;
|
||||
val = plongout->val; hyst = plongout->hyst; lalm = plongout->lalm;
|
||||
if (prec->udf) {
|
||||
recGblSetSevr(prec, UDF_ALARM, INVALID_ALARM);
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition hihi */
|
||||
if (hhsv && (val >= hihi || ((lalm==hihi) && (val >= hihi-hyst)))){
|
||||
if (recGblSetSevr(plongout,HIHI_ALARM,plongout->hhsv)) plongout->lalm = hihi;
|
||||
return;
|
||||
}
|
||||
val = prec->val;
|
||||
hyst = prec->hyst;
|
||||
lalm = prec->lalm;
|
||||
|
||||
/* alarm condition lolo */
|
||||
if (llsv && (val <= lolo || ((lalm==lolo) && (val <= lolo+hyst)))){
|
||||
if (recGblSetSevr(plongout,LOLO_ALARM,plongout->llsv)) plongout->lalm = lolo;
|
||||
return;
|
||||
}
|
||||
/* alarm condition hihi */
|
||||
asev = prec->hhsv;
|
||||
alev = prec->hihi;
|
||||
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIHI_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition high */
|
||||
if (hsv && (val >= high || ((lalm==high) && (val >= high-hyst)))){
|
||||
if (recGblSetSevr(plongout,HIGH_ALARM,plongout->hsv)) plongout->lalm = high;
|
||||
return;
|
||||
}
|
||||
/* alarm condition lolo */
|
||||
asev = prec->llsv;
|
||||
alev = prec->lolo;
|
||||
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOLO_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition low */
|
||||
if (lsv && (val <= low || ((lalm==low) && (val <= low+hyst)))){
|
||||
if (recGblSetSevr(plongout,LOW_ALARM,plongout->lsv)) plongout->lalm = low;
|
||||
return;
|
||||
}
|
||||
/* alarm condition high */
|
||||
asev = prec->hsv;
|
||||
alev = prec->high;
|
||||
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIGH_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* we get here only if val is out of alarm by at least hyst */
|
||||
plongout->lalm = val;
|
||||
return;
|
||||
/* alarm condition low */
|
||||
asev = prec->lsv;
|
||||
alev = prec->low;
|
||||
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOW_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* we get here only if val is out of alarm by at least hyst */
|
||||
prec->lalm = val;
|
||||
return;
|
||||
}
|
||||
|
||||
static void monitor(plongout)
|
||||
struct longoutRecord *plongout;
|
||||
static void monitor(longoutRecord *plongout)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
long delta;
|
||||
epicsInt32 delta;
|
||||
|
||||
monitor_mask = recGblResetAlarms(plongout);
|
||||
/* check for value change */
|
||||
@@ -337,11 +334,10 @@ static void monitor(plongout)
|
||||
return;
|
||||
}
|
||||
|
||||
static long writeValue(plongout)
|
||||
struct longoutRecord *plongout;
|
||||
static long writeValue(longoutRecord *plongout)
|
||||
{
|
||||
long status;
|
||||
struct longoutdset *pdset = (struct longoutdset *) (plongout->dset);
|
||||
long status;
|
||||
struct longoutdset *pdset = (struct longoutdset *) (plongout->dset);
|
||||
|
||||
if (plongout->pact == TRUE){
|
||||
status=(*pdset->write_longout)(plongout);
|
||||
@@ -368,9 +364,7 @@ static long writeValue(plongout)
|
||||
return(status);
|
||||
}
|
||||
|
||||
static void convert(plongout,value)
|
||||
struct longoutRecord *plongout;
|
||||
long value;
|
||||
static void convert(longoutRecord *plongout, epicsInt32 value)
|
||||
{
|
||||
/* check drive limits */
|
||||
if(plongout->drvh > plongout->drvl) {
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* Copyright (c) 2002 Southeastern Universities Research Association, as
|
||||
* Operator of Thomas Jefferson National Accelerator Facility.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* recMbbiDirect.c */
|
||||
/* share/src/rec @(#)recMbbiDirect.c 1.2 1/4/94 */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* recMbbiDirect.c - Record Support routines for mbboDirect records */
|
||||
/*
|
||||
* Original Author: Bob Dalesio and Matthew Needes 10-07-93
|
||||
* Current Author: Johnny Tang
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
@@ -44,8 +42,8 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long init_record(mbbiDirectRecord *, int);
|
||||
static long process(mbbiDirectRecord *);
|
||||
#define special NULL
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
@@ -91,18 +89,17 @@ struct mbbidset { /* multi bit binary input dset */
|
||||
DEVSUPFUN read_mbbi;/*(0,2)=>(success, success no convert)*/
|
||||
};
|
||||
|
||||
static void refresh_bits();
|
||||
static void monitor();
|
||||
static long readValue();
|
||||
static void refresh_bits(mbbiDirectRecord *, unsigned short);
|
||||
static void monitor(mbbiDirectRecord *);
|
||||
static long readValue(mbbiDirectRecord *);
|
||||
|
||||
#define NUM_BITS 16
|
||||
|
||||
/* refreshes all the bit fields based on a hardware value
|
||||
and sends monitors if the bit's value or the record's
|
||||
severity/status have changed */
|
||||
static void refresh_bits(pmbbiDirect, monitor_mask)
|
||||
struct mbbiDirectRecord *pmbbiDirect;
|
||||
unsigned short monitor_mask;
|
||||
static void refresh_bits(mbbiDirectRecord *pmbbiDirect,
|
||||
unsigned short monitor_mask)
|
||||
{
|
||||
unsigned short i;
|
||||
unsigned short mask = 1;
|
||||
@@ -128,9 +125,7 @@ static void refresh_bits(pmbbiDirect, monitor_mask)
|
||||
}
|
||||
}
|
||||
|
||||
static long init_record(pmbbiDirect,pass)
|
||||
struct mbbiDirectRecord *pmbbiDirect;
|
||||
int pass;
|
||||
static long init_record(mbbiDirectRecord *pmbbiDirect, int pass)
|
||||
{
|
||||
struct mbbidset *pdset;
|
||||
long status;
|
||||
@@ -166,8 +161,7 @@ static long init_record(pmbbiDirect,pass)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long process(pmbbiDirect)
|
||||
struct mbbiDirectRecord *pmbbiDirect;
|
||||
static long process(mbbiDirectRecord *pmbbiDirect)
|
||||
{
|
||||
struct mbbidset *pdset = (struct mbbidset *)(pmbbiDirect->dset);
|
||||
long status;
|
||||
@@ -187,7 +181,7 @@ static long process(pmbbiDirect)
|
||||
recGblGetTimeStamp(pmbbiDirect);
|
||||
|
||||
if(status==0) { /* convert the value */
|
||||
unsigned long rval = pmbbiDirect->rval;
|
||||
epicsUInt32 rval = pmbbiDirect->rval;
|
||||
|
||||
if(pmbbiDirect->shft>0) rval >>= pmbbiDirect->shft;
|
||||
pmbbiDirect->val = (unsigned short)rval;
|
||||
@@ -206,8 +200,7 @@ static long process(pmbbiDirect)
|
||||
return(status);
|
||||
}
|
||||
|
||||
static void monitor(pmbbiDirect)
|
||||
struct mbbiDirectRecord *pmbbiDirect;
|
||||
static void monitor(mbbiDirectRecord *pmbbiDirect)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
|
||||
@@ -235,8 +228,7 @@ static void monitor(pmbbiDirect)
|
||||
return;
|
||||
}
|
||||
|
||||
static long readValue(pmbbiDirect)
|
||||
struct mbbiDirectRecord *pmbbiDirect;
|
||||
static long readValue(mbbiDirectRecord *pmbbiDirect)
|
||||
{
|
||||
long status;
|
||||
struct mbbidset *pdset = (struct mbbidset *) (pmbbiDirect->dset);
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* mbbiRecord.c */
|
||||
/* base/src/rec $Id$ */
|
||||
|
||||
/* $Id$ */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
* Date: 5-9-88
|
||||
*/
|
||||
|
||||
@@ -40,18 +38,18 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long special();
|
||||
static long init_record(mbbiRecord *, int);
|
||||
static long process(mbbiRecord *);
|
||||
static long special(DBADDR *, int);
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
#define put_array_info NULL
|
||||
#define get_units NULL
|
||||
#define get_precision NULL
|
||||
static long get_enum_str();
|
||||
static long get_enum_strs();
|
||||
static long put_enum_str();
|
||||
static long get_enum_str(DBADDR *, char *);
|
||||
static long get_enum_strs(DBADDR *, struct dbr_enumStrs *);
|
||||
static long put_enum_str(DBADDR *, char *);
|
||||
#define get_graphic_double NULL
|
||||
#define get_control_double NULL
|
||||
#define get_alarm_double NULL
|
||||
@@ -85,14 +83,13 @@ struct mbbidset { /* multi bit binary input dset */
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_mbbi;/*(0,2)=>(success, success no convert)*/
|
||||
};
|
||||
static void checkAlarms();
|
||||
static void monitor();
|
||||
static long readValue();
|
||||
static void checkAlarms(mbbiRecord *);
|
||||
static void monitor(mbbiRecord *);
|
||||
static long readValue(mbbiRecord *);
|
||||
|
||||
static void init_common(pmbbi)
|
||||
struct mbbiRecord *pmbbi;
|
||||
static void init_common(mbbiRecord *pmbbi)
|
||||
{
|
||||
unsigned long *pstate_values;
|
||||
epicsUInt32 *pstate_values;
|
||||
char *pstate_string;
|
||||
short i;
|
||||
|
||||
@@ -108,9 +105,7 @@ static void init_common(pmbbi)
|
||||
return;
|
||||
}
|
||||
|
||||
static long init_record(pmbbi,pass)
|
||||
struct mbbiRecord *pmbbi;
|
||||
int pass;
|
||||
static long init_record(mbbiRecord *pmbbi, int pass)
|
||||
{
|
||||
struct mbbidset *pdset;
|
||||
long status;
|
||||
@@ -142,8 +137,7 @@ static long init_record(pmbbi,pass)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long process(pmbbi)
|
||||
struct mbbiRecord *pmbbi;
|
||||
static long process(mbbiRecord *pmbbi)
|
||||
{
|
||||
struct mbbidset *pdset = (struct mbbidset *)(pmbbi->dset);
|
||||
long status;
|
||||
@@ -162,9 +156,9 @@ static long process(pmbbi)
|
||||
|
||||
recGblGetTimeStamp(pmbbi);
|
||||
if(status==0) { /* convert the value */
|
||||
unsigned long *pstate_values;
|
||||
epicsUInt32 *pstate_values;
|
||||
short i;
|
||||
unsigned long rval = pmbbi->rval;
|
||||
epicsUInt32 rval = pmbbi->rval;
|
||||
|
||||
pmbbi->udf = FALSE;
|
||||
if(pmbbi->shft>0) rval >>= pmbbi->shft;
|
||||
@@ -199,11 +193,9 @@ static long process(pmbbi)
|
||||
}
|
||||
|
||||
|
||||
static long special(paddr,after)
|
||||
struct dbAddr *paddr;
|
||||
int after;
|
||||
static long special(DBADDR *paddr,int after)
|
||||
{
|
||||
struct mbbiRecord *pmbbi = (struct mbbiRecord *)(paddr->precord);
|
||||
mbbiRecord *pmbbi = (mbbiRecord *)(paddr->precord);
|
||||
int special_type = paddr->special;
|
||||
|
||||
if(!after) return(0);
|
||||
@@ -217,11 +209,9 @@ static long special(paddr,after)
|
||||
}
|
||||
}
|
||||
|
||||
static long get_enum_str(paddr,pstring)
|
||||
struct dbAddr *paddr;
|
||||
char *pstring;
|
||||
static long get_enum_str(DBADDR *paddr,char* pstring)
|
||||
{
|
||||
struct mbbiRecord *pmbbi=(struct mbbiRecord *)paddr->precord;
|
||||
mbbiRecord *pmbbi=(mbbiRecord *)paddr->precord;
|
||||
char *psource;
|
||||
int index;
|
||||
unsigned short *pfield = (unsigned short *)paddr->pfield;
|
||||
@@ -240,11 +230,9 @@ static long get_enum_str(paddr,pstring)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_enum_strs(paddr,pes)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_enumStrs *pes;
|
||||
static long get_enum_strs(DBADDR *paddr, struct dbr_enumStrs *pes)
|
||||
{
|
||||
struct mbbiRecord *pmbbi=(struct mbbiRecord *)paddr->precord;
|
||||
mbbiRecord *pmbbi=(mbbiRecord *)paddr->precord;
|
||||
char *psource;
|
||||
int i;
|
||||
short no_str;
|
||||
@@ -259,11 +247,9 @@ static long get_enum_strs(paddr,pes)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long put_enum_str(paddr,pstring)
|
||||
struct dbAddr *paddr;
|
||||
char *pstring;
|
||||
static long put_enum_str(DBADDR *paddr, char *pstring)
|
||||
{
|
||||
struct mbbiRecord *pmbbi=(struct mbbiRecord *)paddr->precord;
|
||||
mbbiRecord *pmbbi=(mbbiRecord *)paddr->precord;
|
||||
char *pstate_name;
|
||||
short i;
|
||||
|
||||
@@ -281,8 +267,7 @@ static long put_enum_str(paddr,pstring)
|
||||
return(S_db_badChoice);
|
||||
}
|
||||
|
||||
static void checkAlarms(pmbbi)
|
||||
struct mbbiRecord *pmbbi;
|
||||
static void checkAlarms(mbbiRecord *pmbbi)
|
||||
{
|
||||
unsigned short *severities;
|
||||
unsigned short val=pmbbi->val;
|
||||
@@ -309,8 +294,7 @@ static void checkAlarms(pmbbi)
|
||||
return;
|
||||
}
|
||||
|
||||
static void monitor(pmbbi)
|
||||
struct mbbiRecord *pmbbi;
|
||||
static void monitor(mbbiRecord *pmbbi)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
|
||||
@@ -333,8 +317,7 @@ static void monitor(pmbbi)
|
||||
return;
|
||||
}
|
||||
|
||||
static long readValue(pmbbi)
|
||||
struct mbbiRecord *pmbbi;
|
||||
static long readValue(mbbiRecord *pmbbi)
|
||||
{
|
||||
long status;
|
||||
struct mbbidset *pdset = (struct mbbidset *) (pmbbi->dset);
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* recMbboDirect.c */
|
||||
/* share/src/rec @(#)recMbboDirect.c 1.2 1/4/94 */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* recMbboDirect.c - Record Support for mbboDirect records */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Matthew Needes
|
||||
* Date: 10-06-93
|
||||
*/
|
||||
|
||||
@@ -44,9 +42,9 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long special();
|
||||
static long init_record(mbboDirectRecord *, int);
|
||||
static long process(mbboDirectRecord *);
|
||||
static long special(DBADDR *, int);
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
@@ -92,15 +90,13 @@ struct mbbodset { /* multi bit binary output dset */
|
||||
};
|
||||
|
||||
|
||||
static void convert();
|
||||
static void monitor();
|
||||
static long writeValue();
|
||||
static void convert(mbboDirectRecord *);
|
||||
static void monitor(mbboDirectRecord *);
|
||||
static long writeValue(mbboDirectRecord *);
|
||||
|
||||
#define NUM_BITS 16
|
||||
|
||||
static long init_record(pmbboDirect,pass)
|
||||
struct mbboDirectRecord *pmbboDirect;
|
||||
int pass;
|
||||
static long init_record(mbboDirectRecord *pmbboDirect, int pass)
|
||||
{
|
||||
struct mbbodset *pdset;
|
||||
long status = 0;
|
||||
@@ -133,7 +129,7 @@ static long init_record(pmbboDirect,pass)
|
||||
pmbboDirect->mask |= 1; /* set low order bit*/
|
||||
}
|
||||
if(pdset->init_record) {
|
||||
unsigned long rval;
|
||||
epicsUInt32 rval;
|
||||
|
||||
status=(*pdset->init_record)(pmbboDirect);
|
||||
/* init_record might set status */
|
||||
@@ -147,8 +143,7 @@ static long init_record(pmbboDirect,pass)
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long process(pmbboDirect)
|
||||
struct mbboDirectRecord *pmbboDirect;
|
||||
static long process(mbboDirectRecord *pmbboDirect)
|
||||
{
|
||||
struct mbbodset *pdset = (struct mbbodset *)(pmbboDirect->dset);
|
||||
long status=0;
|
||||
@@ -232,11 +227,9 @@ CONTINUE:
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long special(paddr,after)
|
||||
struct dbAddr *paddr;
|
||||
int after;
|
||||
static long special(DBADDR *paddr, int after)
|
||||
{
|
||||
struct mbboDirectRecord *pmbboDirect = (struct mbboDirectRecord *)(paddr->precord);
|
||||
mbboDirectRecord *pmbboDirect = (mbboDirectRecord *)(paddr->precord);
|
||||
int special_type = paddr->special, offset = 1, i;
|
||||
unsigned char *bit;
|
||||
|
||||
@@ -288,8 +281,7 @@ static long special(paddr,after)
|
||||
}
|
||||
}
|
||||
|
||||
static void monitor(pmbboDirect)
|
||||
struct mbboDirectRecord *pmbboDirect;
|
||||
static void monitor(mbboDirectRecord *pmbboDirect)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
|
||||
@@ -319,19 +311,17 @@ static void monitor(pmbboDirect)
|
||||
return;
|
||||
}
|
||||
|
||||
static void convert(pmbboDirect)
|
||||
struct mbboDirectRecord *pmbboDirect;
|
||||
static void convert(mbboDirectRecord *pmbboDirect)
|
||||
{
|
||||
/* convert val to rval */
|
||||
pmbboDirect->rval = (unsigned long)(pmbboDirect->val);
|
||||
pmbboDirect->rval = (epicsUInt32)(pmbboDirect->val);
|
||||
if(pmbboDirect->shft>0)
|
||||
pmbboDirect->rval <<= pmbboDirect->shft;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static long writeValue(pmbboDirect)
|
||||
struct mbboDirectRecord *pmbboDirect;
|
||||
static long writeValue(mbboDirectRecord *pmbboDirect)
|
||||
{
|
||||
long status;
|
||||
struct mbbodset *pdset = (struct mbbodset *) (pmbboDirect->dset);
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* recMbbo.c */
|
||||
/* base/src/rec $Id$ */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* recMbbo.c - Record Support Routines for multi bit binary Output records */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
* Date: 7-17-87
|
||||
*/
|
||||
|
||||
@@ -44,18 +42,18 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long special();
|
||||
static long init_record(mbboRecord *, int);
|
||||
static long process(mbboRecord *);
|
||||
static long special(DBADDR *, int);
|
||||
#define get_value NULL
|
||||
static long cvt_dbaddr();
|
||||
static long cvt_dbaddr(DBADDR *);
|
||||
#define get_array_info NULL
|
||||
#define put_array_info NULL
|
||||
#define get_units NULL
|
||||
#define get_precision NULL
|
||||
static long get_enum_str();
|
||||
static long get_enum_strs();
|
||||
static long put_enum_str();
|
||||
static long get_enum_str(DBADDR *, char *);
|
||||
static long get_enum_strs(DBADDR *, struct dbr_enumStrs *);
|
||||
static long put_enum_str(DBADDR *, char *);
|
||||
#define get_graphic_double NULL
|
||||
#define get_control_double NULL
|
||||
#define get_alarm_double NULL
|
||||
@@ -92,16 +90,15 @@ struct mbbodset { /* multi bit binary output dset */
|
||||
};
|
||||
|
||||
|
||||
static void checkAlarms();
|
||||
static void convert();
|
||||
static void monitor();
|
||||
static void checkAlarms(mbboRecord *);
|
||||
static void convert(mbboRecord *);
|
||||
static void monitor(mbboRecord *);
|
||||
static long writeValue();
|
||||
|
||||
|
||||
static void init_common(pmbbo)
|
||||
struct mbboRecord *pmbbo;
|
||||
static void init_common(mbboRecord *pmbbo)
|
||||
{
|
||||
unsigned long *pstate_values;
|
||||
epicsUInt32 *pstate_values;
|
||||
char *pstate_string;
|
||||
short i;
|
||||
|
||||
@@ -117,9 +114,7 @@ static void init_common(pmbbo)
|
||||
return;
|
||||
}
|
||||
|
||||
static long init_record(pmbbo,pass)
|
||||
struct mbboRecord *pmbbo;
|
||||
int pass;
|
||||
static long init_record(mbboRecord *pmbbo, int pass)
|
||||
{
|
||||
struct mbbodset *pdset;
|
||||
long status;
|
||||
@@ -156,7 +151,7 @@ static long init_record(pmbbo,pass)
|
||||
pmbbo->mask |= 1; /* set low order bit*/
|
||||
}
|
||||
if( pdset->init_record ) {
|
||||
unsigned long rval;
|
||||
epicsUInt32 rval;
|
||||
|
||||
status=(*pdset->init_record)(pmbbo);
|
||||
/* init_record might set status */
|
||||
@@ -165,7 +160,7 @@ static long init_record(pmbbo,pass)
|
||||
rval = pmbbo->rval;
|
||||
if(pmbbo->shft>0) rval >>= pmbbo->shft;
|
||||
if (pmbbo->sdef){
|
||||
unsigned long *pstate_values;
|
||||
epicsUInt32 *pstate_values;
|
||||
short i;
|
||||
|
||||
pstate_values = &(pmbbo->zrvl);
|
||||
@@ -190,8 +185,7 @@ static long init_record(pmbbo,pass)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long process(pmbbo)
|
||||
struct mbboRecord *pmbbo;
|
||||
static long process(mbboRecord *pmbbo)
|
||||
{
|
||||
struct mbbodset *pdset = (struct mbbodset *)(pmbbo->dset);
|
||||
long status=0;
|
||||
@@ -265,11 +259,9 @@ CONTINUE:
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long special(paddr,after)
|
||||
struct dbAddr *paddr;
|
||||
int after;
|
||||
static long special(DBADDR *paddr, int after)
|
||||
{
|
||||
struct mbboRecord *pmbbo = (struct mbboRecord *)(paddr->precord);
|
||||
mbboRecord *pmbbo = (mbboRecord *)(paddr->precord);
|
||||
int special_type = paddr->special;
|
||||
|
||||
if(!after) return(0);
|
||||
@@ -283,10 +275,9 @@ static long special(paddr,after)
|
||||
}
|
||||
}
|
||||
|
||||
static long cvt_dbaddr(paddr)
|
||||
struct dbAddr *paddr;
|
||||
static long cvt_dbaddr(DBADDR *paddr)
|
||||
{
|
||||
struct mbboRecord *pmbbo=(struct mbboRecord *)paddr->precord;
|
||||
mbboRecord *pmbbo=(mbboRecord *)paddr->precord;
|
||||
int index;
|
||||
|
||||
index = dbGetFieldIndex(paddr);
|
||||
@@ -301,11 +292,9 @@ static long cvt_dbaddr(paddr)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_enum_str(paddr,pstring)
|
||||
struct dbAddr *paddr;
|
||||
char *pstring;
|
||||
static long get_enum_str(DBADDR *paddr, char *pstring)
|
||||
{
|
||||
struct mbboRecord *pmbbo=(struct mbboRecord *)paddr->precord;
|
||||
mbboRecord *pmbbo=(mbboRecord *)paddr->precord;
|
||||
char *psource;
|
||||
int index;
|
||||
unsigned short *pfield = (unsigned short *)paddr->pfield;
|
||||
@@ -324,11 +313,9 @@ static long get_enum_str(paddr,pstring)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_enum_strs(paddr,pes)
|
||||
struct dbAddr *paddr;
|
||||
struct dbr_enumStrs *pes;
|
||||
static long get_enum_strs(DBADDR *paddr, struct dbr_enumStrs *pes)
|
||||
{
|
||||
struct mbboRecord *pmbbo=(struct mbboRecord *)paddr->precord;
|
||||
mbboRecord *pmbbo=(mbboRecord *)paddr->precord;
|
||||
char *psource;
|
||||
int i;
|
||||
short no_str;
|
||||
@@ -343,11 +330,9 @@ static long get_enum_strs(paddr,pes)
|
||||
|
||||
return(0);
|
||||
}
|
||||
static long put_enum_str(paddr,pstring)
|
||||
struct dbAddr *paddr;
|
||||
char *pstring;
|
||||
static long put_enum_str(DBADDR *paddr,char *pstring)
|
||||
{
|
||||
struct mbboRecord *pmbbo=(struct mbboRecord *)paddr->precord;
|
||||
mbboRecord *pmbbo=(mbboRecord *)paddr->precord;
|
||||
char *pstate_name;
|
||||
short i;
|
||||
|
||||
@@ -364,8 +349,7 @@ static long put_enum_str(paddr,pstring)
|
||||
return(S_db_badChoice);
|
||||
}
|
||||
|
||||
static void checkAlarms(pmbbo)
|
||||
struct mbboRecord *pmbbo;
|
||||
static void checkAlarms(mbboRecord *pmbbo)
|
||||
{
|
||||
unsigned short *severities;
|
||||
unsigned short val=pmbbo->val;
|
||||
@@ -388,8 +372,7 @@ static void checkAlarms(pmbbo)
|
||||
return;
|
||||
}
|
||||
|
||||
static void monitor(pmbbo)
|
||||
struct mbboRecord *pmbbo;
|
||||
static void monitor(mbboRecord *pmbbo)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
|
||||
@@ -416,10 +399,9 @@ static void monitor(pmbbo)
|
||||
return;
|
||||
}
|
||||
|
||||
static void convert(pmbbo)
|
||||
struct mbboRecord *pmbbo;
|
||||
static void convert(mbboRecord *pmbbo)
|
||||
{
|
||||
unsigned long *pvalues = &(pmbbo->zrvl);
|
||||
epicsUInt32 *pvalues = &(pmbbo->zrvl);
|
||||
|
||||
/* convert val to rval */
|
||||
if(pmbbo->sdef) {
|
||||
@@ -429,7 +411,7 @@ static void convert(pmbbo)
|
||||
return;
|
||||
}
|
||||
pmbbo->rval = pvalues[pmbbo->val];
|
||||
} else pmbbo->rval = (unsigned long)(pmbbo->val);
|
||||
} else pmbbo->rval = (epicsUInt32)(pmbbo->val);
|
||||
if(pmbbo->shft>0) pmbbo->rval <<= pmbbo->shft;
|
||||
|
||||
return;
|
||||
@@ -437,8 +419,7 @@ static void convert(pmbbo)
|
||||
|
||||
|
||||
|
||||
static long writeValue(pmbbo)
|
||||
struct mbboRecord *pmbbo;
|
||||
static long writeValue(mbboRecord *pmbbo)
|
||||
{
|
||||
long status;
|
||||
struct mbbodset *pdset = (struct mbbodset *) (pmbbo->dset);
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* recPermissive.c */
|
||||
/* base/src/rec $Id$ */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* recPermissive.c - Record Support Routines for Permissive records */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
* Date: 10-10-90
|
||||
*/
|
||||
|
||||
@@ -40,7 +38,7 @@
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
#define init_record NULL
|
||||
static long process();
|
||||
static long process(permissiveRecord *);
|
||||
#define special NULL
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
@@ -77,10 +75,9 @@ rset permissiveRSET={
|
||||
};
|
||||
epicsExportAddress(rset,permissiveRSET);
|
||||
|
||||
static void monitor();
|
||||
static void monitor(permissiveRecord *);
|
||||
|
||||
static long process(ppermissive)
|
||||
struct permissiveRecord *ppermissive;
|
||||
static long process(permissiveRecord *ppermissive)
|
||||
{
|
||||
|
||||
ppermissive->pact=TRUE;
|
||||
@@ -92,8 +89,7 @@ static long process(ppermissive)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void monitor(ppermissive)
|
||||
struct permissiveRecord *ppermissive;
|
||||
static void monitor(permissiveRecord *ppermissive)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
unsigned short val,oval,wflg,oflg;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2007 UChicago Argonne LLC, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* selRecord.c - Record Support Routines for Select records */
|
||||
@@ -38,21 +39,21 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long init_record(selRecord *, int);
|
||||
static long process(selRecord *);
|
||||
#define special NULL
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
#define put_array_info NULL
|
||||
static long get_units();
|
||||
static long get_precision();
|
||||
static long get_units(DBADDR *, char *);
|
||||
static long get_precision(DBADDR *, long *);
|
||||
#define get_enum_str NULL
|
||||
#define get_enum_strs NULL
|
||||
#define put_enum_str NULL
|
||||
static long get_graphic_double();
|
||||
static long get_control_double();
|
||||
static long get_alarm_double();
|
||||
static long get_graphic_double(DBADDR *, struct dbr_grDouble *);
|
||||
static long get_control_double(DBADDR *, struct dbr_ctrlDouble *);
|
||||
static long get_alarm_double(DBADDR *, struct dbr_alDouble *);
|
||||
|
||||
rset selRSET={
|
||||
RSETNUMBER,
|
||||
@@ -78,24 +79,28 @@ epicsExportAddress(rset,selRSET);
|
||||
|
||||
#define SEL_MAX 12
|
||||
|
||||
static void checkAlarms();
|
||||
static void do_sel();
|
||||
static int fetch_values();
|
||||
static void monitor();
|
||||
static void checkAlarms(selRecord *);
|
||||
static void do_sel(selRecord *);
|
||||
static int fetch_values(selRecord *);
|
||||
static void monitor(selRecord *);
|
||||
|
||||
/* This needed to prevent the MS optimizer from barfing */
|
||||
static double divide(double num, double den) { return num / den; }
|
||||
|
||||
static double NaN, Inf;
|
||||
|
||||
|
||||
static long init_record(struct selRecord *psel, int pass)
|
||||
static long init_record(selRecord *psel, int pass)
|
||||
{
|
||||
struct link *plink;
|
||||
int i;
|
||||
double *pvalue;
|
||||
double NaN = divide(0.0, 0.0);
|
||||
|
||||
if (pass==0) return(0);
|
||||
|
||||
NaN = divide(0.0, 0.0);
|
||||
Inf = divide(1.0, 0.0);
|
||||
|
||||
/* get seln initial value if nvl is a constant*/
|
||||
if (psel->nvl.type == CONSTANT ) {
|
||||
recGblInitConstantLink(&psel->nvl,DBF_USHORT,&psel->seln);
|
||||
@@ -112,7 +117,7 @@ static long init_record(struct selRecord *psel, int pass)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long process(struct selRecord *psel)
|
||||
static long process(selRecord *psel)
|
||||
{
|
||||
psel->pact = TRUE;
|
||||
if ( RTN_SUCCESS(fetch_values(psel)) ) {
|
||||
@@ -135,17 +140,17 @@ static long process(struct selRecord *psel)
|
||||
}
|
||||
|
||||
|
||||
static long get_units(struct dbAddr *paddr, char *units)
|
||||
static long get_units(DBADDR *paddr, char *units)
|
||||
{
|
||||
struct selRecord *psel=(struct selRecord *)paddr->precord;
|
||||
selRecord *psel=(selRecord *)paddr->precord;
|
||||
|
||||
strncpy(units,psel->egu,DB_UNITS_SIZE);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_precision(struct dbAddr *paddr, long *precision)
|
||||
static long get_precision(DBADDR *paddr, long *precision)
|
||||
{
|
||||
struct selRecord *psel=(struct selRecord *)paddr->precord;
|
||||
selRecord *psel=(selRecord *)paddr->precord;
|
||||
double *pvalue,*plvalue;
|
||||
int i;
|
||||
|
||||
@@ -166,9 +171,9 @@ static long get_precision(struct dbAddr *paddr, long *precision)
|
||||
}
|
||||
|
||||
|
||||
static long get_graphic_double(struct dbAddr *paddr, struct dbr_grDouble *pgd)
|
||||
static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd)
|
||||
{
|
||||
struct selRecord *psel=(struct selRecord *)paddr->precord;
|
||||
selRecord *psel=(selRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)&psel->val
|
||||
|| paddr->pfield==(void *)&psel->hihi
|
||||
@@ -196,7 +201,7 @@ static long get_graphic_double(struct dbAddr *paddr, struct dbr_grDouble *pgd)
|
||||
|
||||
static long get_control_double(struct dbAddr *paddr, struct dbr_ctrlDouble *pcd)
|
||||
{
|
||||
struct selRecord *psel=(struct selRecord *)paddr->precord;
|
||||
selRecord *psel=(selRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)&psel->val
|
||||
|| paddr->pfield==(void *)&psel->hihi
|
||||
@@ -222,9 +227,9 @@ static long get_control_double(struct dbAddr *paddr, struct dbr_ctrlDouble *pcd)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_alarm_double(struct dbAddr *paddr, struct dbr_alDouble *pad)
|
||||
static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad)
|
||||
{
|
||||
struct selRecord *psel=(struct selRecord *)paddr->precord;
|
||||
selRecord *psel=(selRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)&psel->val ){
|
||||
pad->upper_alarm_limit = psel->hihi;
|
||||
@@ -235,50 +240,63 @@ static long get_alarm_double(struct dbAddr *paddr, struct dbr_alDouble *pad)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void checkAlarms(struct selRecord *psel)
|
||||
static void checkAlarms(selRecord *prec)
|
||||
{
|
||||
double val;
|
||||
double hyst, lalm, hihi, high, low, lolo;
|
||||
unsigned short hhsv, llsv, hsv, lsv;
|
||||
double val, hyst, lalm;
|
||||
double alev;
|
||||
epicsEnum16 asev;
|
||||
|
||||
if (psel->udf){
|
||||
recGblSetSevr(psel,UDF_ALARM,INVALID_ALARM);
|
||||
return;
|
||||
if (prec->udf) {
|
||||
recGblSetSevr(prec, UDF_ALARM, INVALID_ALARM);
|
||||
return;
|
||||
}
|
||||
hihi = psel->hihi; lolo = psel->lolo; high = psel->high; low = psel->low;
|
||||
hhsv = psel->hhsv; llsv = psel->llsv; hsv = psel->hsv; lsv = psel->lsv;
|
||||
val = psel->val; hyst = psel->hyst; lalm = psel->lalm;
|
||||
|
||||
val = prec->val;
|
||||
hyst = prec->hyst;
|
||||
lalm = prec->lalm;
|
||||
|
||||
/* alarm condition hihi */
|
||||
if (hhsv && (val >= hihi || ((lalm==hihi) && (val >= hihi-hyst)))){
|
||||
if (recGblSetSevr(psel,HIHI_ALARM,psel->hhsv)) psel->lalm = hihi;
|
||||
return;
|
||||
asev = prec->hhsv;
|
||||
alev = prec->hihi;
|
||||
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIHI_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition lolo */
|
||||
if (llsv && (val <= lolo || ((lalm==lolo) && (val <= lolo+hyst)))){
|
||||
if (recGblSetSevr(psel,LOLO_ALARM,psel->llsv)) psel->lalm = lolo;
|
||||
return;
|
||||
asev = prec->llsv;
|
||||
alev = prec->lolo;
|
||||
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOLO_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition high */
|
||||
if (hsv && (val >= high || ((lalm==high) && (val >= high-hyst)))){
|
||||
if (recGblSetSevr(psel,HIGH_ALARM,psel->hsv)) psel->lalm = high;
|
||||
return;
|
||||
asev = prec->hsv;
|
||||
alev = prec->high;
|
||||
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIGH_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition low */
|
||||
if (lsv && (val <= low || ((lalm==low) && (val <= low+hyst)))){
|
||||
if (recGblSetSevr(psel,LOW_ALARM,psel->lsv)) psel->lalm = low;
|
||||
return;
|
||||
asev = prec->lsv;
|
||||
alev = prec->low;
|
||||
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOW_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* we get here only if val is out of alarm by at least hyst */
|
||||
psel->lalm = val;
|
||||
prec->lalm = val;
|
||||
return;
|
||||
}
|
||||
|
||||
static void monitor(struct selRecord *psel)
|
||||
static void monitor(selRecord *psel)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
double delta;
|
||||
@@ -328,12 +346,11 @@ static void monitor(struct selRecord *psel)
|
||||
return;
|
||||
}
|
||||
|
||||
static void do_sel(struct selRecord *psel)
|
||||
static void do_sel(selRecord *psel)
|
||||
{
|
||||
double *pvalue;
|
||||
struct link *plink;
|
||||
double order[SEL_MAX];
|
||||
unsigned short order_inx;
|
||||
unsigned short count;
|
||||
unsigned short i,j;
|
||||
double val;
|
||||
|
||||
@@ -348,7 +365,7 @@ static void do_sel(struct selRecord *psel)
|
||||
val = *(pvalue+psel->seln);
|
||||
break;
|
||||
case (selSELM_High_Signal):
|
||||
val = divide(-1.0, 0.0); /* Start at -Inf */
|
||||
val = -Inf;
|
||||
for (i = 0; i < SEL_MAX; i++,pvalue++){
|
||||
if (!isnan(*pvalue) && val < *pvalue) {
|
||||
val = *pvalue;
|
||||
@@ -357,7 +374,7 @@ static void do_sel(struct selRecord *psel)
|
||||
}
|
||||
break;
|
||||
case (selSELM_Low_Signal):
|
||||
val = divide(1.0, 0.0); /* Start at +Inf */
|
||||
val = Inf;
|
||||
for (i = 0; i < SEL_MAX; i++,pvalue++){
|
||||
if (!isnan(*pvalue) && val > *pvalue) {
|
||||
val = *pvalue;
|
||||
@@ -366,21 +383,22 @@ static void do_sel(struct selRecord *psel)
|
||||
}
|
||||
break;
|
||||
case (selSELM_Median_Signal):
|
||||
plink = &psel->inpa;
|
||||
order_inx = 0;
|
||||
for (i = 0; i < SEL_MAX; i++,pvalue++,plink++){
|
||||
count = 0;
|
||||
order[0] = NaN;
|
||||
for (i = 0; i < SEL_MAX; i++,pvalue++){
|
||||
if (!isnan(*pvalue)){
|
||||
j = order_inx;
|
||||
while ((order[j-1] > *pvalue) && (j > 0)){
|
||||
/* Insertion sort */
|
||||
j = count;
|
||||
while ((j > 0) && (order[j-1] > *pvalue)){
|
||||
order[j] = order[j-1];
|
||||
j--;
|
||||
}
|
||||
order[j] = *pvalue;
|
||||
order_inx++;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
psel->seln = order_inx/2;
|
||||
val = order[psel->seln];
|
||||
psel->seln = count;
|
||||
val = order[count / 2];
|
||||
break;
|
||||
default:
|
||||
recGblSetSevr(psel,CALC_ALARM,INVALID_ALARM);
|
||||
@@ -401,7 +419,7 @@ static void do_sel(struct selRecord *psel)
|
||||
*
|
||||
* fetch the values for the variables from which to select
|
||||
*/
|
||||
static int fetch_values(struct selRecord *psel)
|
||||
static int fetch_values(selRecord *psel)
|
||||
{
|
||||
struct link *plink;
|
||||
double *pvalue;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* recState.c */
|
||||
/* base/src/rec $Id$ */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* recState.c - Record Support Routines for State records */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
* Date: 10-10-90
|
||||
*/
|
||||
|
||||
@@ -41,7 +39,7 @@
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
#define init_record NULL
|
||||
static long process();
|
||||
static long process(stateRecord *);
|
||||
#define special NULL
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
@@ -78,10 +76,9 @@ rset stateRSET={
|
||||
};
|
||||
epicsExportAddress(rset,stateRSET);
|
||||
|
||||
static void monitor();
|
||||
static void monitor(stateRecord *);
|
||||
|
||||
static long process(pstate)
|
||||
struct stateRecord *pstate;
|
||||
static long process(stateRecord *pstate)
|
||||
{
|
||||
|
||||
pstate->udf = FALSE;
|
||||
@@ -94,8 +91,7 @@ static long process(pstate)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void monitor(pstate)
|
||||
struct stateRecord *pstate;
|
||||
static void monitor(stateRecord *pstate)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* recStringin.c */
|
||||
/* base/src/rec $Id$ */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* recStringin.c - Record Support Routines for Stringin records */
|
||||
/*
|
||||
@@ -41,8 +40,8 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long init_record(stringinRecord *, int);
|
||||
static long process(stringinRecord *);
|
||||
#define special NULL
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
@@ -87,13 +86,11 @@ struct stringindset { /* stringin input dset */
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_stringin; /*returns: (-1,0)=>(failure,success)*/
|
||||
};
|
||||
static void monitor();
|
||||
static long readValue();
|
||||
static void monitor(stringinRecord *);
|
||||
static long readValue(stringinRecord *);
|
||||
|
||||
|
||||
static long init_record(pstringin,pass)
|
||||
struct stringinRecord *pstringin;
|
||||
int pass;
|
||||
static long init_record(stringinRecord *pstringin, int pass)
|
||||
{
|
||||
struct stringindset *pdset;
|
||||
long status;
|
||||
@@ -124,8 +121,9 @@ static long init_record(pstringin,pass)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long process(pstringin)
|
||||
struct stringinRecord *pstringin;
|
||||
/*
|
||||
*/
|
||||
static long process(stringinRecord *pstringin)
|
||||
{
|
||||
struct stringindset *pdset = (struct stringindset *)(pstringin->dset);
|
||||
long status;
|
||||
@@ -153,8 +151,7 @@ static long process(pstringin)
|
||||
return(status);
|
||||
}
|
||||
|
||||
static void monitor(pstringin)
|
||||
struct stringinRecord *pstringin;
|
||||
static void monitor(stringinRecord *pstringin)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
|
||||
@@ -172,8 +169,7 @@ static void monitor(pstringin)
|
||||
return;
|
||||
}
|
||||
|
||||
static long readValue(pstringin)
|
||||
struct stringinRecord *pstringin;
|
||||
static long readValue(stringinRecord *pstringin)
|
||||
{
|
||||
long status;
|
||||
struct stringindset *pdset = (struct stringindset *) (pstringin->dset);
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* recStringout.c */
|
||||
/* base/src/rec $Id$ */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* recStringout.c - Record Support Routines for Stringout records */
|
||||
/*
|
||||
@@ -43,8 +42,8 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long init_record(stringoutRecord *, int);
|
||||
static long process(stringoutRecord *);
|
||||
#define special NULL
|
||||
#define get_value NULL
|
||||
#define cvt_dbaddr NULL
|
||||
@@ -89,13 +88,11 @@ struct stringoutdset { /* stringout input dset */
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_stringout;/*(-1,0)=>(failure,success)*/
|
||||
};
|
||||
static void monitor();
|
||||
static long writeValue();
|
||||
static void monitor(stringoutRecord *);
|
||||
static long writeValue(stringoutRecord *);
|
||||
|
||||
|
||||
static long init_record(pstringout,pass)
|
||||
struct stringoutRecord *pstringout;
|
||||
int pass;
|
||||
static long init_record(stringoutRecord *pstringout, int pass)
|
||||
{
|
||||
struct stringoutdset *pdset;
|
||||
long status=0;
|
||||
@@ -126,8 +123,7 @@ static long init_record(pstringout,pass)
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long process(pstringout)
|
||||
struct stringoutRecord *pstringout;
|
||||
static long process(stringoutRecord *pstringout)
|
||||
{
|
||||
struct stringoutdset *pdset = (struct stringoutdset *)(pstringout->dset);
|
||||
long status=0;
|
||||
@@ -184,8 +180,7 @@ finish:
|
||||
return(status);
|
||||
}
|
||||
|
||||
static void monitor(pstringout)
|
||||
struct stringoutRecord *pstringout;
|
||||
static void monitor(stringoutRecord *pstringout)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
|
||||
@@ -203,8 +198,7 @@ static void monitor(pstringout)
|
||||
return;
|
||||
}
|
||||
|
||||
static long writeValue(pstringout)
|
||||
struct stringoutRecord *pstringout;
|
||||
static long writeValue(stringoutRecord *pstringout)
|
||||
{
|
||||
long status;
|
||||
struct stringoutdset *pdset = (struct stringoutdset *) (pstringout->dset);
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 Lawrence Berkeley Laboratory,The Control Systems
|
||||
* Group, Systems Engineering Department
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* recSubArray.c */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* recSubArray.c - Record Support Routines for SubArray records
|
||||
*
|
||||
*
|
||||
|
||||
@@ -283,8 +283,8 @@ static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad)
|
||||
static void checkAlarms(subRecord *prec)
|
||||
{
|
||||
double val, hyst, lalm;
|
||||
double hihi, high, low, lolo;
|
||||
epicsEnum16 hhsv, llsv, hsv, lsv;
|
||||
double alev;
|
||||
epicsEnum16 asev;
|
||||
|
||||
if (prec->udf) {
|
||||
recGblSetSevr(prec, UDF_ALARM, INVALID_ALARM);
|
||||
@@ -296,38 +296,38 @@ static void checkAlarms(subRecord *prec)
|
||||
lalm = prec->lalm;
|
||||
|
||||
/* alarm condition hihi */
|
||||
hhsv = prec->hhsv;
|
||||
hihi = prec->hihi;
|
||||
if (hhsv && (val >= hihi || ((lalm == hihi) && (val >= hihi - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIHI_ALARM, prec->hhsv))
|
||||
prec->lalm = hihi;
|
||||
asev = prec->hhsv;
|
||||
alev = prec->hihi;
|
||||
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIHI_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition lolo */
|
||||
llsv = prec->llsv;
|
||||
lolo = prec->lolo;
|
||||
if (llsv && (val <= lolo || ((lalm == lolo) && (val <= lolo + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOLO_ALARM, prec->llsv))
|
||||
prec->lalm = lolo;
|
||||
asev = prec->llsv;
|
||||
alev = prec->lolo;
|
||||
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOLO_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition high */
|
||||
hsv = prec->hsv;
|
||||
high = prec->high;
|
||||
if (hsv && (val >= high || ((lalm == high) && (val >= high - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIGH_ALARM, prec->hsv))
|
||||
prec->lalm = high;
|
||||
asev = prec->hsv;
|
||||
alev = prec->high;
|
||||
if (asev && (val >= alev || ((lalm == alev) && (val >= alev - hyst)))) {
|
||||
if (recGblSetSevr(prec, HIGH_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
/* alarm condition low */
|
||||
lsv = prec->lsv;
|
||||
low = prec->low;
|
||||
if (lsv && (val <= low || ((lalm == low) && (val <= low + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOW_ALARM, prec->lsv))
|
||||
prec->lalm = low;
|
||||
asev = prec->lsv;
|
||||
alev = prec->low;
|
||||
if (asev && (val <= alev || ((lalm == alev) && (val <= alev + hyst)))) {
|
||||
if (recGblSetSevr(prec, LOW_ALARM, asev))
|
||||
prec->lalm = alev;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* recWaveform.c */
|
||||
/* base/src/rec $Id$ */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/* recWaveform.c - Record Support Routines for Waveform records */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
* Date: 7-14-89
|
||||
*/
|
||||
|
||||
@@ -41,20 +39,20 @@
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
static long init_record();
|
||||
static long process();
|
||||
static long init_record(waveformRecord *, int);
|
||||
static long process(waveformRecord *);
|
||||
#define special NULL
|
||||
#define get_value NULL
|
||||
static long cvt_dbaddr();
|
||||
static long get_array_info();
|
||||
static long put_array_info();
|
||||
static long get_units();
|
||||
static long get_precision();
|
||||
static long cvt_dbaddr(DBADDR *);
|
||||
static long get_array_info(DBADDR *, long *, long *);
|
||||
static long put_array_info(DBADDR *, long);
|
||||
static long get_units(DBADDR *, char *);
|
||||
static long get_precision(DBADDR *, long *);
|
||||
#define get_enum_str NULL
|
||||
#define get_enum_strs NULL
|
||||
#define put_enum_str NULL
|
||||
static long get_graphic_double();
|
||||
static long get_control_double();
|
||||
static long get_graphic_double(DBADDR *, struct dbr_grDouble *);
|
||||
static long get_control_double(DBADDR *, struct dbr_ctrlDouble *);
|
||||
#define get_alarm_double NULL
|
||||
rset waveformRSET={
|
||||
RSETNUMBER,
|
||||
@@ -87,8 +85,8 @@ struct wfdset { /* waveform dset */
|
||||
};
|
||||
/*sizes of field types*/
|
||||
static int sizeofTypes[] = {MAX_STRING_SIZE,1,1,2,2,4,4,4,8,2};
|
||||
static void monitor();
|
||||
static long readValue();
|
||||
static void monitor(waveformRecord *);
|
||||
static long readValue(waveformRecord *);
|
||||
|
||||
static long init_record(waveformRecord *pwf, int pass)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user