Skip to content
Snippets Groups Projects
Commit 71079ede authored by Andrew Johnson's avatar Andrew Johnson
Browse files

rec/aSub: Fixes from Michael Davidsaver

* Changing the number of elements in a VALx array triggers monitors
* Post monitors on the NEVx fields, following EFLG
* Remove artificial limit on array sizes
parent 26173c1e
No related branches found
No related tags found
No related merge requests found
......@@ -85,13 +85,12 @@ rset aSubRSET = {
epicsExportAddress(rset, aSubRSET);
static long initFields(epicsEnum16 *pft, epicsUInt32 *pno, epicsUInt32 *pne,
const char **fldnames, void **pval, void **povl);
epicsUInt32 *pon, const char **fldnames, void **pval, void **povl);
static long fetch_values(aSubRecord *prec);
static void monitor(aSubRecord *);
static long do_sub(aSubRecord *);
#define NUM_ARGS 21
#define MAX_ARRAY_SIZE 10000000
/* These are the names of the Input fields */
static const char *Ifldnames[] = {
......@@ -117,10 +116,10 @@ static long init_record(aSubRecord *prec, int pass)
status = 0;
if (pass == 0) {
/* Allocate memory for arrays */
initFields(&prec->fta, &prec->noa, &prec->nea, Ifldnames,
&prec->a, NULL);
initFields(&prec->ftva, &prec->nova, &prec->neva, Ofldnames,
&prec->vala, &prec->ovla);
initFields(&prec->fta, &prec->noa, &prec->nea, NULL,
Ifldnames, &prec->a, NULL);
initFields(&prec->ftva, &prec->nova, &prec->neva, &prec->onva,
Ofldnames, &prec->vala, &prec->ovla);
return 0;
}
......@@ -146,12 +145,8 @@ static long init_record(aSubRecord *prec, int pass)
struct link *plink = &(&prec->inpa)[i];
switch (plink->type) {
case CONSTANT:
if ((&prec->noa)[i] < 2) {
if (recGblInitConstantLink(plink, (&prec->fta)[i], (&prec->a)[i])) {
prec->udf = FALSE;
} else
prec->udf = TRUE;
}
if ((&prec->noa)[i] < 2)
recGblInitConstantLink(plink, (&prec->fta)[i], (&prec->a)[i]);
break;
case PV_LINK:
......@@ -218,7 +213,7 @@ static long init_record(aSubRecord *prec, int pass)
static long initFields(epicsEnum16 *pft, epicsUInt32 *pno, epicsUInt32 *pne,
const char **fldnames, void **pval, void **povl)
epicsUInt32 *pon, const char **fldnames, void **pval, void **povl)
{
int i;
long status = 0;
......@@ -235,22 +230,16 @@ static long initFields(epicsEnum16 *pft, epicsUInt32 *pno, epicsUInt32 *pne,
flen = dbValueSize(*pft);
num = *pno * flen;
if (num > MAX_ARRAY_SIZE) {
epicsPrintf("Link %s - Array too large! %d Bytes\n", fldnames[i], num);
*pno = num = 0;
status = S_db_errArg;
} else
*pval = (char *)callocMustSucceed(*pno, flen,
"aSubRecord::init_record");
*pval = callocMustSucceed(*pno, flen, "aSubRecord::init_record");
*pne = *pno;
if (povl) {
if (num)
*povl = (char *)callocMustSucceed(*pno, flen,
*povl = callocMustSucceed(*pno, flen,
"aSubRecord::init_record");
povl++;
*pon++ = *pne;
}
}
return status;
......@@ -281,6 +270,7 @@ static long process(aSubRecord *prec)
/* Push the output link values */
if (!status) {
int i;
for (i = 0; i < NUM_ARGS; i++)
dbPutLink(&(&prec->outa)[i], (&prec->ftva)[i], (&prec->vala)[i],
(&prec->neva)[i]);
......@@ -359,18 +349,29 @@ static void monitor(aSubRecord *prec)
break;
case aSubEFLG_ON_CHANGE:
for (i = 0; i < NUM_ARGS; i++) {
epicsUInt32 alen = dbValueSize((&prec->ftva)[i]) * (&prec->neva)[i];
void *povl = (&prec->ovla)[i];
void *pval = (&prec->vala)[i];
if (memcmp(povl, pval, alen)) {
epicsUInt32 *ponv = &(&prec->onva)[i];
epicsUInt32 *pnev = &(&prec->neva)[i];
epicsUInt32 onv = *ponv; /* Num Elements in OVLx */
epicsUInt32 nev = *pnev; /* Num Elements in VALx */
epicsUInt32 alen = dbValueSize((&prec->ftva)[i]) * nev;
if (nev != onv || memcmp(povl, pval, alen)) {
memcpy(povl, pval, alen);
db_post_events(prec, pval, monitor_mask);
if (nev != onv) {
*ponv = nev;
db_post_events(prec, pnev, monitor_mask);
}
}
}
break;
case aSubEFLG_ALWAYS:
for (i = 0; i < NUM_ARGS; i++)
for (i = 0; i < NUM_ARGS; i++) {
db_post_events(prec, (&prec->vala)[i], monitor_mask);
db_post_events(prec, &(&prec->neva)[i], monitor_mask);
}
break;
}
return;
......
......@@ -1049,127 +1049,148 @@ recordtype(aSub) {
prompt("Old Output A")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovla")
interest(4)
extra("void *ovla")
}
field(OVLB,DBF_NOACCESS) {
prompt("Old Output B")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovlb")
interest(4)
extra("void *ovlb")
}
field(OVLC,DBF_NOACCESS) {
prompt("Old Output C")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovlc")
interest(4)
extra("void *ovlc")
}
field(OVLD,DBF_NOACCESS) {
prompt("Old Output D")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovld")
interest(4)
extra("void *ovld")
}
field(OVLE,DBF_NOACCESS) {
prompt("Old Output E")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovle")
interest(4)
extra("void *ovle")
}
field(OVLF,DBF_NOACCESS) {
prompt("Old Output F")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovlf")
interest(4)
extra("void *ovlf")
}
field(OVLG,DBF_NOACCESS) {
prompt("Old Output G")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovlg")
interest(4)
extra("void *ovlg")
}
field(OVLH,DBF_NOACCESS) {
prompt("Old Output H")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovlh")
interest(4)
extra("void *ovlh")
}
field(OVLI,DBF_NOACCESS) {
prompt("Old Output I")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovli")
interest(4)
extra("void *ovli")
}
field(OVLJ,DBF_NOACCESS) {
prompt("Old Output J")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovlj")
interest(4)
extra("void *ovlj")
}
field(OVLK,DBF_NOACCESS) {
prompt("Old Output K")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovlk")
interest(4)
extra("void *ovlk")
}
field(OVLL,DBF_NOACCESS) {
prompt("Old Output L")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovll")
interest(4)
extra("void *ovll")
}
field(OVLM,DBF_NOACCESS) {
prompt("Old Output M")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovlm")
interest(4)
extra("void *ovlm")
}
field(OVLN,DBF_NOACCESS) {
prompt("Old Output N")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovln")
interest(4)
extra("void *ovln")
}
field(OVLO,DBF_NOACCESS) {
prompt("Old Output O")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovlo")
interest(4)
extra("void *ovlo")
}
field(OVLP,DBF_NOACCESS) {
prompt("Old Output P")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovlp")
interest(4)
extra("void *ovlp")
}
field(OVLQ,DBF_NOACCESS) {
prompt("Old Output Q")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovlq")
interest(4)
extra("void *ovlq")
}
field(OVLR,DBF_NOACCESS) {
prompt("Old Output R")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovlr")
interest(4)
extra("void *ovlr")
}
field(OVLS,DBF_NOACCESS) {
prompt("Old Output S")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovls")
interest(4)
extra("void *ovls")
}
field(OVLT,DBF_NOACCESS) {
prompt("Old Output T")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovlt")
interest(4)
extra("void *ovlt")
}
field(OVLU,DBF_NOACCESS) {
prompt("Old Output U")
asl(ASL0)
special(SPC_NOMOD)
interest(4) extra("void *ovlu")
interest(4)
extra("void *ovlu")
}
field(FTVA,DBF_MENU) {
prompt("Type of VALA")
......@@ -1488,149 +1509,254 @@ recordtype(aSub) {
}
field(NEVA,DBF_ULONG) {
prompt("Num. elements in VALA")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVB,DBF_ULONG) {
prompt("Num. elements in VALB")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVC,DBF_ULONG) {
prompt("Num. elements in VALC")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVD,DBF_ULONG) {
prompt("Num. elements in VALD")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVE,DBF_ULONG) {
prompt("Num. elements in VALE")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVF,DBF_ULONG) {
prompt("Num. elements in VALF")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVG,DBF_ULONG) {
prompt("Num. elements in VALG")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVH,DBF_ULONG) {
prompt("Num. elements in VAlH")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVI,DBF_ULONG) {
prompt("Num. elements in VALI")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVJ,DBF_ULONG) {
prompt("Num. elements in VALJ")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVK,DBF_ULONG) {
prompt("Num. elements in VALK")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVL,DBF_ULONG) {
prompt("Num. elements in VALL")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVM,DBF_ULONG) {
prompt("Num. elements in VALM")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVN,DBF_ULONG) {
prompt("Num. elements in VALN")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVO,DBF_ULONG) {
prompt("Num. elements in VALO")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVP,DBF_ULONG) {
prompt("Num. elements in VALP")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVQ,DBF_ULONG) {
prompt("Num. elements in VALQ")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVR,DBF_ULONG) {
prompt("Num. elements in VALR")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVS,DBF_ULONG) {
prompt("Num. elements in VALS")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVT,DBF_ULONG) {
prompt("Num. elements in VALT")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(NEVU,DBF_ULONG) {
prompt("Num. elements in VALU")
promptgroup(GUI_WAVE)
special(SPC_NOMOD)
interest(3)
initial("1")
}
field(ONVA,DBF_ULONG) {
prompt("Num. elements in OVLA")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVB,DBF_ULONG) {
prompt("Num. elements in OVLB")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVC,DBF_ULONG) {
prompt("Num. elements in OVLC")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVD,DBF_ULONG) {
prompt("Num. elements in OVLD")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVE,DBF_ULONG) {
prompt("Num. elements in OVLE")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVF,DBF_ULONG) {
prompt("Num. elements in OVLF")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVG,DBF_ULONG) {
prompt("Num. elements in OVLG")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVH,DBF_ULONG) {
prompt("Num. elements in VAlH")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVI,DBF_ULONG) {
prompt("Num. elements in OVLI")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVJ,DBF_ULONG) {
prompt("Num. elements in OVLJ")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVK,DBF_ULONG) {
prompt("Num. elements in OVLK")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVL,DBF_ULONG) {
prompt("Num. elements in OVLL")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVM,DBF_ULONG) {
prompt("Num. elements in OVLM")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVN,DBF_ULONG) {
prompt("Num. elements in OVLN")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVO,DBF_ULONG) {
prompt("Num. elements in OVLO")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVP,DBF_ULONG) {
prompt("Num. elements in OVLP")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVQ,DBF_ULONG) {
prompt("Num. elements in OVLQ")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVR,DBF_ULONG) {
prompt("Num. elements in OVLR")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVS,DBF_ULONG) {
prompt("Num. elements in OVLS")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVT,DBF_ULONG) {
prompt("Num. elements in OVLT")
special(SPC_NOMOD)
interest(4)
initial("1")
}
field(ONVU,DBF_ULONG) {
prompt("Num. elements in OVLU")
special(SPC_NOMOD)
interest(4)
initial("1")
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment