read attributes of input fields from links
This commit is contained in:
1 parent
dc9e4ccc04
commit
27e80be2e5
4 files changed
+235
-210
No files matched your search
+55
-50
@@ -150,18 +150,25 @@ static long special(DBADDR *paddr, int after)
|
|||||||
|
|
||||||
#define indexof(field) calcRecord##field
|
#define indexof(field) calcRecord##field
|
||||||
|
|
||||||
|
static long get_linkNumber(int fieldIndex) {
|
||||||
|
if (fieldIndex >= indexof(A) && fieldIndex <= indexof(L))
|
||||||
|
return fieldIndex - indexof(A);
|
||||||
|
if (fieldIndex >= indexof(LA) && fieldIndex <= indexof(LL))
|
||||||
|
return fieldIndex - indexof(LA);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static long get_units(DBADDR *paddr, char *units)
|
static long get_units(DBADDR *paddr, char *units)
|
||||||
{
|
{
|
||||||
calcRecord *prec = (calcRecord *)paddr->precord;
|
calcRecord *prec = (calcRecord *)paddr->precord;
|
||||||
int index = dbGetFieldIndex(paddr);
|
int linkNumber;
|
||||||
|
|
||||||
if(paddr->pfldDes->field_type == DBF_DOUBLE) {
|
if(paddr->pfldDes->field_type == DBF_DOUBLE) {
|
||||||
if((index >= indexof(A) && index <= indexof(L))
|
linkNumber = get_linkNumber(dbGetFieldIndex(paddr));
|
||||||
|| (index >= indexof(LA) && index <= indexof(LL))) {
|
if (linkNumber >= 0)
|
||||||
/* We need a way to get units for A-L */;
|
dbGetUnits(&prec->inpa + linkNumber, units, DB_UNITS_SIZE);
|
||||||
} else {
|
else
|
||||||
strncpy(units,prec->egu,DB_UNITS_SIZE);
|
strncpy(units,prec->egu,DB_UNITS_SIZE);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -169,27 +176,32 @@ static long get_units(DBADDR *paddr, char *units)
|
|||||||
static long get_precision(DBADDR *paddr, long *pprecision)
|
static long get_precision(DBADDR *paddr, long *pprecision)
|
||||||
{
|
{
|
||||||
calcRecord *prec = (calcRecord *)paddr->precord;
|
calcRecord *prec = (calcRecord *)paddr->precord;
|
||||||
int index = dbGetFieldIndex(paddr);
|
int fieldIndex = dbGetFieldIndex(paddr);
|
||||||
|
int linkNumber;
|
||||||
|
|
||||||
*pprecision = prec->prec;
|
*pprecision = prec->prec;
|
||||||
if (index == indexof(VAL)) {
|
if (fieldIndex == indexof(VAL)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if((index >= indexof(A) && index <= indexof(L))
|
linkNumber = get_linkNumber(fieldIndex);
|
||||||
|| (index >= indexof(LA) && index <= indexof(LL))) {
|
if (linkNumber >= 0) {
|
||||||
/* We need a way to get precision for A-L */;
|
short precision;
|
||||||
*pprecision=15;
|
if (dbGetPrecision(&prec->inpa + linkNumber, &precision) == 0)
|
||||||
}
|
*pprecision = precision;
|
||||||
recGblGetPrec(paddr, pprecision);
|
else
|
||||||
|
*pprecision = 15;
|
||||||
|
} else
|
||||||
|
recGblGetPrec(paddr, pprecision);
|
||||||
return 0;
|
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 *prec = (calcRecord *)paddr->precord;
|
calcRecord *prec = (calcRecord *)paddr->precord;
|
||||||
int index = dbGetFieldIndex(paddr);
|
int fieldIndex = dbGetFieldIndex(paddr);
|
||||||
|
int linkNumber;
|
||||||
|
|
||||||
switch (index) {
|
switch (fieldIndex) {
|
||||||
case indexof(VAL):
|
case indexof(VAL):
|
||||||
case indexof(HIHI):
|
case indexof(HIHI):
|
||||||
case indexof(HIGH):
|
case indexof(HIGH):
|
||||||
@@ -198,32 +210,26 @@ static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd)
|
|||||||
case indexof(LALM):
|
case indexof(LALM):
|
||||||
case indexof(ALST):
|
case indexof(ALST):
|
||||||
case indexof(MLST):
|
case indexof(MLST):
|
||||||
#ifdef __GNUC__
|
pgd->lower_disp_limit = prec->lopr;
|
||||||
case indexof(A) ... indexof(L):
|
pgd->upper_disp_limit = prec->hopr;
|
||||||
case indexof(LA) ... indexof(LL):
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
#else
|
linkNumber = get_linkNumber(fieldIndex);
|
||||||
break;
|
if (linkNumber >= 0) {
|
||||||
default:
|
dbGetGraphicLimits(&prec->inpa + linkNumber,
|
||||||
if((index >= indexof(A) && index <= indexof(L))
|
&pgd->lower_disp_limit,
|
||||||
|| (index >= indexof(LA) && index <= indexof(LL)))
|
&pgd->upper_disp_limit);
|
||||||
break;
|
} else
|
||||||
#endif
|
recGblGetGraphicDouble(paddr,pgd);
|
||||||
recGblGetGraphicDouble(paddr,pgd);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
pgd->upper_disp_limit = prec->hopr;
|
|
||||||
pgd->lower_disp_limit = prec->lopr;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
|
static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
|
||||||
{
|
{
|
||||||
calcRecord *prec = (calcRecord *)paddr->precord;
|
calcRecord *prec = (calcRecord *)paddr->precord;
|
||||||
int index = dbGetFieldIndex(paddr);
|
|
||||||
|
|
||||||
switch (index) {
|
switch (dbGetFieldIndex(paddr)) {
|
||||||
case indexof(VAL):
|
case indexof(VAL):
|
||||||
case indexof(HIHI):
|
case indexof(HIHI):
|
||||||
case indexof(HIGH):
|
case indexof(HIGH):
|
||||||
@@ -232,37 +238,36 @@ static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
|
|||||||
case indexof(LALM):
|
case indexof(LALM):
|
||||||
case indexof(ALST):
|
case indexof(ALST):
|
||||||
case indexof(MLST):
|
case indexof(MLST):
|
||||||
#ifdef __GNUC__
|
pcd->lower_ctrl_limit = prec->lopr;
|
||||||
case indexof(A) ... indexof(L):
|
pcd->upper_ctrl_limit = prec->hopr;
|
||||||
case indexof(LA) ... indexof(LL):
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
#else
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if((index >= indexof(A) && index <= indexof(L))
|
|
||||||
|| (index >= indexof(LA) && index <= indexof(LL)))
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
recGblGetControlDouble(paddr,pcd);
|
recGblGetControlDouble(paddr,pcd);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
pcd->upper_ctrl_limit = prec->hopr;
|
|
||||||
pcd->lower_ctrl_limit = prec->lopr;
|
|
||||||
return 0;
|
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 *prec = (calcRecord *)paddr->precord;
|
calcRecord *prec = (calcRecord *)paddr->precord;
|
||||||
|
int fieldIndex = dbGetFieldIndex(paddr);
|
||||||
|
int linkNumber;
|
||||||
|
|
||||||
if (dbGetFieldIndex(paddr) == indexof(VAL)) {
|
if (fieldIndex == indexof(VAL)) {
|
||||||
pad->upper_alarm_limit = prec->hhsv ? prec->hihi : epicsNAN;
|
|
||||||
pad->upper_warning_limit = prec->hsv ? prec->high : epicsNAN;
|
|
||||||
pad->lower_warning_limit = prec->lsv ? prec->low : epicsNAN;
|
|
||||||
pad->lower_alarm_limit = prec->llsv ? prec->lolo : epicsNAN;
|
pad->lower_alarm_limit = prec->llsv ? prec->lolo : epicsNAN;
|
||||||
|
pad->lower_warning_limit = prec->lsv ? prec->low : epicsNAN;
|
||||||
|
pad->upper_warning_limit = prec->hsv ? prec->high : epicsNAN;
|
||||||
|
pad->upper_alarm_limit = prec->hhsv ? prec->hihi : epicsNAN;
|
||||||
} else {
|
} else {
|
||||||
recGblGetAlarmDouble(paddr, pad);
|
linkNumber = get_linkNumber(fieldIndex);
|
||||||
|
if (linkNumber >= 0) {
|
||||||
|
dbGetAlarmLimits(&prec->inpa + linkNumber,
|
||||||
|
&pad->lower_alarm_limit,
|
||||||
|
&pad->lower_warning_limit,
|
||||||
|
&pad->upper_warning_limit,
|
||||||
|
&pad->upper_alarm_limit);
|
||||||
|
} else
|
||||||
|
recGblGetAlarmDouble(paddr, pad);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+63
-54
@@ -365,23 +365,31 @@ static long special(DBADDR *paddr, int after)
|
|||||||
|
|
||||||
#define indexof(field) calcoutRecord##field
|
#define indexof(field) calcoutRecord##field
|
||||||
|
|
||||||
|
static long get_linkNumber(int fieldIndex) {
|
||||||
|
if (fieldIndex >= indexof(A) && fieldIndex <= indexof(L))
|
||||||
|
return fieldIndex - indexof(A);
|
||||||
|
if (fieldIndex >= indexof(LA) && fieldIndex <= indexof(LL))
|
||||||
|
return fieldIndex - indexof(LA);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static long get_units(DBADDR *paddr, char *units)
|
static long get_units(DBADDR *paddr, char *units)
|
||||||
{
|
{
|
||||||
calcoutRecord *prec = (calcoutRecord *)paddr->precord;
|
calcoutRecord *prec = (calcoutRecord *)paddr->precord;
|
||||||
int index = dbGetFieldIndex(paddr);
|
int fieldIndex = dbGetFieldIndex(paddr);
|
||||||
|
int linkNumber;
|
||||||
|
|
||||||
if(index == indexof(ODLY)) {
|
if(fieldIndex == indexof(ODLY)) {
|
||||||
strcpy(units, "s");
|
strcpy(units, "s");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(paddr->pfldDes->field_type == DBF_DOUBLE) {
|
if(paddr->pfldDes->field_type == DBF_DOUBLE) {
|
||||||
if((index >= indexof(A) && index <= indexof(L))
|
linkNumber = get_linkNumber(dbGetFieldIndex(paddr));
|
||||||
|| (index >= indexof(LA) && index <= indexof(LL))) {
|
if (linkNumber >= 0)
|
||||||
/* We need a way to get units for A-L */;
|
dbGetUnits(&prec->inpa + linkNumber, units, DB_UNITS_SIZE);
|
||||||
} else {
|
else
|
||||||
strncpy(units,prec->egu,DB_UNITS_SIZE);
|
strncpy(units,prec->egu,DB_UNITS_SIZE);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -389,35 +397,36 @@ static long get_units(DBADDR *paddr, char *units)
|
|||||||
static long get_precision(DBADDR *paddr, long *pprecision)
|
static long get_precision(DBADDR *paddr, long *pprecision)
|
||||||
{
|
{
|
||||||
calcoutRecord *prec = (calcoutRecord *)paddr->precord;
|
calcoutRecord *prec = (calcoutRecord *)paddr->precord;
|
||||||
int index = dbGetFieldIndex(paddr);
|
int fieldIndex = dbGetFieldIndex(paddr);
|
||||||
|
int linkNumber;
|
||||||
|
|
||||||
if(index == indexof(ODLY)) {
|
if(fieldIndex == indexof(ODLY)) {
|
||||||
*pprecision = 2;
|
*pprecision = 2;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
*pprecision = prec->prec;
|
*pprecision = prec->prec;
|
||||||
if (index == indexof(VAL)) {
|
if (fieldIndex == indexof(VAL)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if((index >= indexof(A) && index <= indexof(L))
|
linkNumber = get_linkNumber(fieldIndex);
|
||||||
|| (index >= indexof(LA) && index <= indexof(LL))) {
|
if (linkNumber >= 0) {
|
||||||
/* We need a way to get precision for A-L */;
|
short precision;
|
||||||
*pprecision=15;
|
if (dbGetPrecision(&prec->inpa + linkNumber, &precision) == 0)
|
||||||
}
|
*pprecision = precision;
|
||||||
recGblGetPrec(paddr, pprecision);
|
else
|
||||||
|
*pprecision = 15;
|
||||||
|
} else
|
||||||
|
recGblGetPrec(paddr, pprecision);
|
||||||
return 0;
|
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 *prec = (calcoutRecord *)paddr->precord;
|
calcoutRecord *prec = (calcoutRecord *)paddr->precord;
|
||||||
|
int fieldIndex = dbGetFieldIndex(paddr);
|
||||||
int index = dbGetFieldIndex(paddr);
|
int linkNumber;
|
||||||
|
|
||||||
switch (index) {
|
switch (fieldIndex) {
|
||||||
case indexof(ODLY):
|
|
||||||
return 0;
|
|
||||||
case indexof(VAL):
|
case indexof(VAL):
|
||||||
case indexof(HIHI):
|
case indexof(HIHI):
|
||||||
case indexof(HIGH):
|
case indexof(HIGH):
|
||||||
@@ -426,32 +435,30 @@ static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd)
|
|||||||
case indexof(LALM):
|
case indexof(LALM):
|
||||||
case indexof(ALST):
|
case indexof(ALST):
|
||||||
case indexof(MLST):
|
case indexof(MLST):
|
||||||
#ifdef __GNUC__
|
pgd->lower_disp_limit = prec->lopr;
|
||||||
case indexof(A) ... indexof(L):
|
pgd->upper_disp_limit = prec->hopr;
|
||||||
case indexof(LA) ... indexof(LL):
|
|
||||||
break;
|
break;
|
||||||
default:
|
case indexof(ODLY):
|
||||||
#else
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if((index >= indexof(A) && index <= indexof(L))
|
|
||||||
|| (index >= indexof(LA) && index <= indexof(LL)))
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
recGblGetGraphicDouble(paddr,pgd);
|
recGblGetGraphicDouble(paddr,pgd);
|
||||||
return 0;
|
pgd->lower_disp_limit = 0.0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
linkNumber = get_linkNumber(fieldIndex);
|
||||||
|
if (linkNumber >= 0) {
|
||||||
|
dbGetGraphicLimits(&prec->inpa + linkNumber,
|
||||||
|
&pgd->lower_disp_limit,
|
||||||
|
&pgd->upper_disp_limit);
|
||||||
|
} else
|
||||||
|
recGblGetGraphicDouble(paddr,pgd);
|
||||||
}
|
}
|
||||||
pgd->upper_disp_limit = prec->hopr;
|
|
||||||
pgd->lower_disp_limit = prec->lopr;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
|
static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
|
||||||
{
|
{
|
||||||
calcoutRecord *prec = (calcoutRecord *)paddr->precord;
|
calcoutRecord *prec = (calcoutRecord *)paddr->precord;
|
||||||
int index = dbGetFieldIndex(paddr);
|
|
||||||
|
|
||||||
switch (index) {
|
switch (dbGetFieldIndex(paddr)) {
|
||||||
case indexof(VAL):
|
case indexof(VAL):
|
||||||
case indexof(HIHI):
|
case indexof(HIHI):
|
||||||
case indexof(HIGH):
|
case indexof(HIGH):
|
||||||
@@ -460,38 +467,40 @@ static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
|
|||||||
case indexof(LALM):
|
case indexof(LALM):
|
||||||
case indexof(ALST):
|
case indexof(ALST):
|
||||||
case indexof(MLST):
|
case indexof(MLST):
|
||||||
#ifdef __GNUC__
|
pcd->lower_ctrl_limit = prec->lopr;
|
||||||
case indexof(A) ... indexof(L):
|
pcd->upper_ctrl_limit = prec->hopr;
|
||||||
case indexof(LA) ... indexof(LL):
|
|
||||||
break;
|
break;
|
||||||
|
case indexof(ODLY):
|
||||||
|
pcd->lower_ctrl_limit = 0.0;
|
||||||
|
pcd->upper_ctrl_limit = 10.0;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
#else
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if((index >= indexof(A) && index <= indexof(L))
|
|
||||||
|| (index >= indexof(LA) && index <= indexof(LL)))
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
recGblGetControlDouble(paddr,pcd);
|
recGblGetControlDouble(paddr,pcd);
|
||||||
if (index == indexof(ODLY)) pcd->lower_ctrl_limit = 0.0;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
pcd->upper_ctrl_limit = prec->hopr;
|
|
||||||
pcd->lower_ctrl_limit = prec->lopr;
|
|
||||||
return 0;
|
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 *prec = (calcoutRecord *)paddr->precord;
|
calcoutRecord *prec = (calcoutRecord *)paddr->precord;
|
||||||
|
int fieldIndex = dbGetFieldIndex(paddr);
|
||||||
|
int linkNumber;
|
||||||
|
|
||||||
if (dbGetFieldIndex(paddr) == indexof(VAL)) {
|
if (fieldIndex == indexof(VAL)) {
|
||||||
pad->upper_alarm_limit = prec->hhsv ? prec->hihi : epicsNAN;
|
pad->upper_alarm_limit = prec->hhsv ? prec->hihi : epicsNAN;
|
||||||
pad->upper_warning_limit = prec->hsv ? prec->high : epicsNAN;
|
pad->upper_warning_limit = prec->hsv ? prec->high : epicsNAN;
|
||||||
pad->lower_warning_limit = prec->lsv ? prec->low : epicsNAN;
|
pad->lower_warning_limit = prec->lsv ? prec->low : epicsNAN;
|
||||||
pad->lower_alarm_limit = prec->llsv ? prec->lolo : epicsNAN;
|
pad->lower_alarm_limit = prec->llsv ? prec->lolo : epicsNAN;
|
||||||
} else {
|
} else {
|
||||||
recGblGetAlarmDouble(paddr, pad);
|
linkNumber = get_linkNumber(fieldIndex);
|
||||||
|
if (linkNumber >= 0) {
|
||||||
|
dbGetAlarmLimits(&prec->inpa + linkNumber,
|
||||||
|
&pad->lower_alarm_limit,
|
||||||
|
&pad->lower_warning_limit,
|
||||||
|
&pad->upper_warning_limit,
|
||||||
|
&pad->upper_alarm_limit);
|
||||||
|
} else
|
||||||
|
recGblGetAlarmDouble(paddr, pad);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+67
-60
@@ -58,9 +58,9 @@ static long get_precision(dbAddr *paddr, long *);
|
|||||||
#define get_enum_str NULL
|
#define get_enum_str NULL
|
||||||
#define get_enum_strs NULL
|
#define get_enum_strs NULL
|
||||||
#define put_enum_str NULL
|
#define put_enum_str NULL
|
||||||
#define get_graphic_double NULL
|
static long get_graphic_double(DBADDR *, struct dbr_grDouble *);
|
||||||
static long get_control_double(DBADDR *, struct dbr_ctrlDouble *);
|
static long get_control_double(DBADDR *, struct dbr_ctrlDouble *);
|
||||||
#define get_alarm_double NULL
|
static long get_alarm_double(DBADDR *, struct dbr_alDouble *);
|
||||||
|
|
||||||
rset seqRSET={
|
rset seqRSET={
|
||||||
RSETNUMBER,
|
RSETNUMBER,
|
||||||
@@ -421,39 +421,21 @@ static void processCallback(CALLBACK *arg)
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#define indexof(field) seqRecord##field
|
#define indexof(field) seqRecord##field
|
||||||
|
#define get_dol(prec, fieldOffset) \
|
||||||
|
&((linkDesc*)&prec->dly1)[fieldOffset>>2].dol
|
||||||
|
|
||||||
static long get_units(DBADDR *paddr, char *units)
|
static long get_units(DBADDR *paddr, char *units)
|
||||||
{
|
{
|
||||||
switch (dbGetFieldIndex(paddr)) {
|
seqRecord *prec = (seqRecord *) paddr->precord;
|
||||||
/* we need something for DO1-DOA, either EGU1-EGUA or
|
int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY1);
|
||||||
read EGU from DOL1-DOLA if possible
|
|
||||||
*/
|
if (fieldOffset >= 0) switch (fieldOffset & 2) {
|
||||||
case indexof(DLY1):
|
case 0: /* DLYn */
|
||||||
case indexof(DLY2):
|
|
||||||
case indexof(DLY3):
|
|
||||||
case indexof(DLY4):
|
|
||||||
case indexof(DLY5):
|
|
||||||
case indexof(DLY6):
|
|
||||||
case indexof(DLY7):
|
|
||||||
case indexof(DLY8):
|
|
||||||
case indexof(DLY9):
|
|
||||||
case indexof(DLYA):
|
|
||||||
strcpy(units, "s");
|
strcpy(units, "s");
|
||||||
break;
|
break;
|
||||||
case indexof(DO1):
|
case 2: /* DOn */
|
||||||
case indexof(DO2):
|
dbGetUnits(get_dol(prec, fieldOffset),
|
||||||
case indexof(DO3):
|
units, DB_UNITS_SIZE);
|
||||||
case indexof(DO4):
|
|
||||||
case indexof(DO5):
|
|
||||||
case indexof(DO6):
|
|
||||||
case indexof(DO7):
|
|
||||||
case indexof(DO8):
|
|
||||||
case indexof(DO9):
|
|
||||||
case indexof(DOA):
|
|
||||||
/* we need something here, either EGU1-EGUA or
|
|
||||||
read EGU from DOL1-DOLA if possible
|
|
||||||
*/
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@@ -461,43 +443,68 @@ static long get_units(DBADDR *paddr, char *units)
|
|||||||
static long get_precision(dbAddr *paddr, long *pprecision)
|
static long get_precision(dbAddr *paddr, long *pprecision)
|
||||||
{
|
{
|
||||||
seqRecord *prec = (seqRecord *) paddr->precord;
|
seqRecord *prec = (seqRecord *) paddr->precord;
|
||||||
|
int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY1);
|
||||||
|
short precision;
|
||||||
|
|
||||||
switch (dbGetFieldIndex(paddr)) {
|
if (fieldOffset >= 0) switch (fieldOffset & 2) {
|
||||||
case indexof(DLY1):
|
case 0: /* DLYn */
|
||||||
case indexof(DLY2):
|
|
||||||
case indexof(DLY3):
|
|
||||||
case indexof(DLY4):
|
|
||||||
case indexof(DLY5):
|
|
||||||
case indexof(DLY6):
|
|
||||||
case indexof(DLY7):
|
|
||||||
case indexof(DLY8):
|
|
||||||
case indexof(DLY9):
|
|
||||||
case indexof(DLYA):
|
|
||||||
*pprecision = 2;
|
*pprecision = 2;
|
||||||
return(0);
|
return 0;
|
||||||
/* maybe we need specific PRECs for DO1-DOA
|
case 2: /* DOn */
|
||||||
*/
|
if (dbGetPrecision(get_dol(prec, fieldOffset),
|
||||||
|
&precision) == 0) {
|
||||||
|
*pprecision = precision;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*pprecision = prec->prec;
|
*pprecision = prec->prec;
|
||||||
recGblGetPrec(paddr, pprecision);
|
recGblGetPrec(paddr, pprecision);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd)
|
||||||
|
{
|
||||||
|
seqRecord *prec = (seqRecord *) paddr->precord;
|
||||||
|
int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY1);
|
||||||
|
|
||||||
|
if (fieldOffset >= 0) switch (fieldOffset & 2) {
|
||||||
|
case 0: /* DLYn */
|
||||||
|
pgd->lower_disp_limit = 0.0;
|
||||||
|
pgd->lower_disp_limit = 10.0;
|
||||||
|
return 0;
|
||||||
|
case 2: /* DOn */
|
||||||
|
dbGetGraphicLimits(get_dol(prec, fieldOffset),
|
||||||
|
&pgd->lower_disp_limit,
|
||||||
|
&pgd->upper_disp_limit);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
recGblGetGraphicDouble(paddr,pgd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd)
|
||||||
|
{
|
||||||
|
int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY1);
|
||||||
|
|
||||||
|
recGblGetControlDouble(paddr,pcd);
|
||||||
|
if (fieldOffset >= 0 && (fieldOffset & 2) == 0) /* DLYn */
|
||||||
|
pcd->lower_ctrl_limit = 0.0;
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd)
|
static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad)
|
||||||
{
|
{
|
||||||
recGblGetControlDouble(paddr,pcd);
|
seqRecord *prec = (seqRecord *) paddr->precord;
|
||||||
switch (dbGetFieldIndex(paddr)) {
|
int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY1);
|
||||||
case indexof(DLY1):
|
|
||||||
case indexof(DLY2):
|
if (fieldOffset >= 0 && (fieldOffset & 2) == 2) /* DOn */
|
||||||
case indexof(DLY3):
|
dbGetAlarmLimits(get_dol(prec, fieldOffset),
|
||||||
case indexof(DLY4):
|
&pad->lower_alarm_limit,
|
||||||
case indexof(DLY5):
|
&pad->lower_warning_limit,
|
||||||
case indexof(DLY6):
|
&pad->upper_warning_limit,
|
||||||
case indexof(DLY7):
|
&pad->upper_alarm_limit);
|
||||||
case indexof(DLY8):
|
else
|
||||||
case indexof(DLY9):
|
recGblGetAlarmDouble(paddr, pad);
|
||||||
case indexof(DLYA):
|
return 0;
|
||||||
pcd->lower_ctrl_limit = 0.0;
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+50
-46
@@ -193,18 +193,25 @@ static long special(DBADDR *paddr, int after)
|
|||||||
|
|
||||||
#define indexof(field) subRecord##field
|
#define indexof(field) subRecord##field
|
||||||
|
|
||||||
|
static long get_linkNumber(int fieldIndex) {
|
||||||
|
if (fieldIndex >= indexof(A) && fieldIndex <= indexof(L))
|
||||||
|
return fieldIndex - indexof(A);
|
||||||
|
if (fieldIndex >= indexof(LA) && fieldIndex <= indexof(LL))
|
||||||
|
return fieldIndex - indexof(LA);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static long get_units(DBADDR *paddr, char *units)
|
static long get_units(DBADDR *paddr, char *units)
|
||||||
{
|
{
|
||||||
subRecord *prec = (subRecord *)paddr->precord;
|
subRecord *prec = (subRecord *)paddr->precord;
|
||||||
int index = dbGetFieldIndex(paddr);
|
int linkNumber;
|
||||||
|
|
||||||
if(paddr->pfldDes->field_type == DBF_DOUBLE) {
|
if(paddr->pfldDes->field_type == DBF_DOUBLE) {
|
||||||
if((index >= indexof(A) && index <= indexof(L))
|
linkNumber = get_linkNumber(dbGetFieldIndex(paddr));
|
||||||
|| (index >= indexof(LA) && index <= indexof(LL))) {
|
if (linkNumber >= 0)
|
||||||
/* We need a way to get units for A-L */;
|
dbGetUnits(&prec->inpa + linkNumber, units, DB_UNITS_SIZE);
|
||||||
} else {
|
else
|
||||||
strncpy(units,prec->egu,DB_UNITS_SIZE);
|
strncpy(units,prec->egu,DB_UNITS_SIZE);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -212,27 +219,32 @@ static long get_units(DBADDR *paddr, char *units)
|
|||||||
static long get_precision(DBADDR *paddr, long *pprecision)
|
static long get_precision(DBADDR *paddr, long *pprecision)
|
||||||
{
|
{
|
||||||
subRecord *prec = (subRecord *)paddr->precord;
|
subRecord *prec = (subRecord *)paddr->precord;
|
||||||
int index = dbGetFieldIndex(paddr);
|
int fieldIndex = dbGetFieldIndex(paddr);
|
||||||
|
int linkNumber;
|
||||||
|
|
||||||
*pprecision = prec->prec;
|
*pprecision = prec->prec;
|
||||||
if (index == indexof(VAL)) {
|
if (fieldIndex == indexof(VAL)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if((index >= indexof(A) && index <= indexof(L))
|
linkNumber = get_linkNumber(fieldIndex);
|
||||||
|| (index >= indexof(LA) && index <= indexof(LL))) {
|
if (linkNumber >= 0) {
|
||||||
/* We need a way to get precision for A-L */;
|
short precision;
|
||||||
*pprecision=15;
|
if (dbGetPrecision(&prec->inpa + linkNumber, &precision) == 0)
|
||||||
}
|
*pprecision = precision;
|
||||||
recGblGetPrec(paddr, pprecision);
|
else
|
||||||
|
*pprecision = 15;
|
||||||
|
} else
|
||||||
|
recGblGetPrec(paddr, pprecision);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd)
|
static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd)
|
||||||
{
|
{
|
||||||
subRecord *prec = (subRecord *)paddr->precord;
|
subRecord *prec = (subRecord *)paddr->precord;
|
||||||
int index = dbGetFieldIndex(paddr);
|
int fieldIndex = dbGetFieldIndex(paddr);
|
||||||
|
int linkNumber;
|
||||||
|
|
||||||
switch (index) {
|
switch (fieldIndex) {
|
||||||
case indexof(VAL):
|
case indexof(VAL):
|
||||||
case indexof(HIHI):
|
case indexof(HIHI):
|
||||||
case indexof(HIGH):
|
case indexof(HIGH):
|
||||||
@@ -241,32 +253,26 @@ static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd)
|
|||||||
case indexof(LALM):
|
case indexof(LALM):
|
||||||
case indexof(ALST):
|
case indexof(ALST):
|
||||||
case indexof(MLST):
|
case indexof(MLST):
|
||||||
#ifdef __GNUC__
|
pgd->lower_disp_limit = prec->lopr;
|
||||||
case indexof(A) ... indexof(L):
|
pgd->upper_disp_limit = prec->hopr;
|
||||||
case indexof(LA) ... indexof(LL):
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
#else
|
linkNumber = get_linkNumber(fieldIndex);
|
||||||
break;
|
if (linkNumber >= 0) {
|
||||||
default:
|
dbGetGraphicLimits(&prec->inpa + linkNumber,
|
||||||
if((index >= indexof(A) && index <= indexof(L))
|
&pgd->lower_disp_limit,
|
||||||
|| (index >= indexof(LA) && index <= indexof(LL)))
|
&pgd->upper_disp_limit);
|
||||||
break;
|
} else
|
||||||
#endif
|
recGblGetGraphicDouble(paddr,pgd);
|
||||||
recGblGetGraphicDouble(paddr,pgd);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
pgd->upper_disp_limit = prec->hopr;
|
|
||||||
pgd->lower_disp_limit = prec->lopr;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
|
static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
|
||||||
{
|
{
|
||||||
subRecord *prec = (subRecord *)paddr->precord;
|
subRecord *prec = (subRecord *)paddr->precord;
|
||||||
int index = dbGetFieldIndex(paddr);
|
|
||||||
|
|
||||||
switch (index) {
|
switch (dbGetFieldIndex(paddr)) {
|
||||||
case indexof(VAL):
|
case indexof(VAL):
|
||||||
case indexof(HIHI):
|
case indexof(HIHI):
|
||||||
case indexof(HIGH):
|
case indexof(HIGH):
|
||||||
@@ -275,23 +281,12 @@ static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
|
|||||||
case indexof(LALM):
|
case indexof(LALM):
|
||||||
case indexof(ALST):
|
case indexof(ALST):
|
||||||
case indexof(MLST):
|
case indexof(MLST):
|
||||||
#ifdef __GNUC__
|
pcd->lower_ctrl_limit = prec->lopr;
|
||||||
case indexof(A) ... indexof(L):
|
pcd->upper_ctrl_limit = prec->hopr;
|
||||||
case indexof(LA) ... indexof(LL):
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
#else
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if((index >= indexof(A) && index <= indexof(L))
|
|
||||||
|| (index >= indexof(LA) && index <= indexof(LL)))
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
recGblGetControlDouble(paddr,pcd);
|
recGblGetControlDouble(paddr,pcd);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
pcd->upper_ctrl_limit = prec->hopr;
|
|
||||||
pcd->lower_ctrl_limit = prec->lopr;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,6 +294,7 @@ static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad)
|
|||||||
{
|
{
|
||||||
subRecord *prec = (subRecord *)paddr->precord;
|
subRecord *prec = (subRecord *)paddr->precord;
|
||||||
int fieldIndex = dbGetFieldIndex(paddr);
|
int fieldIndex = dbGetFieldIndex(paddr);
|
||||||
|
int linkNumber;
|
||||||
|
|
||||||
if (fieldIndex == subRecordVAL) {
|
if (fieldIndex == subRecordVAL) {
|
||||||
pad->upper_alarm_limit = prec->hhsv ? prec->hihi : epicsNAN;
|
pad->upper_alarm_limit = prec->hhsv ? prec->hihi : epicsNAN;
|
||||||
@@ -306,7 +302,15 @@ static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad)
|
|||||||
pad->lower_warning_limit = prec->lsv ? prec->low : epicsNAN;
|
pad->lower_warning_limit = prec->lsv ? prec->low : epicsNAN;
|
||||||
pad->lower_alarm_limit = prec->llsv ? prec->lolo : epicsNAN;
|
pad->lower_alarm_limit = prec->llsv ? prec->lolo : epicsNAN;
|
||||||
} else {
|
} else {
|
||||||
recGblGetAlarmDouble(paddr, pad);
|
linkNumber = get_linkNumber(fieldIndex);
|
||||||
|
if (linkNumber >= 0) {
|
||||||
|
dbGetAlarmLimits(&prec->inpa + linkNumber,
|
||||||
|
&pad->lower_alarm_limit,
|
||||||
|
&pad->lower_warning_limit,
|
||||||
|
&pad->upper_warning_limit,
|
||||||
|
&pad->upper_alarm_limit);
|
||||||
|
} else
|
||||||
|
recGblGetAlarmDouble(paddr, pad);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user