add utag demo

This commit is contained in:
Michael Davidsaver
2022-06-27 20:12:13 -07:00
parent bb85647a12
commit b9ce6cbd6e
6 changed files with 54 additions and 0 deletions

5
iocBoot/iocutag/Makefile Normal file
View File

@ -0,0 +1,5 @@
TOP = ../..
include $(TOP)/configure/CONFIG
ARCH = linux-x86_64-debug
TARGETS = envPaths
include $(TOP)/configure/RULES.ioc

5
iocBoot/iocutag/st.cmd Executable file
View File

@ -0,0 +1,5 @@
#!../../bin/linux-x86_64-debug/softIocPVA
dbLoadRecords("utag.db","N=TST:")
iocInit()

23
iocBoot/iocutag/utag.db Normal file
View File

@ -0,0 +1,23 @@
record(calc, "$(N)Cnt-I") {
field(SCAN, "1 second")
field(CALC, "(VAL+1)%10")
field(FLNK, "$(N)Cnt:T-I")
}
record(calc, "$(N)Cnt:T-I") {
field(INPA, "$(N)Cnt-I NPP")
field(CALC, "A%2")
field(FLNK, "$(N)UTag-I")
}
record(longin, "$(N)UTag-I") {
field(DTYP, "QSRV Set UTag")
field(INP , "$(N)Cnt:T-I")
field(FLNK, "$(N)Val-I")
}
record(longin, "$(N)Val-I") {
field(INP , "$(N)Cnt-I")
field(TSEL, "$(N)UTag-I.TIME")
}

View File

@ -2,9 +2,11 @@
#include <epicsMath.h>
#include <dbAccess.h>
#include <dbScan.h>
#include <dbLink.h>
#include <recGbl.h>
#include <alarm.h>
#include <longinRecord.h>
#include <waveformRecord.h>
#include <menuFtype.h>
@ -48,9 +50,24 @@ long process_spin(waveformRecord *prec)
prec->nord = prec->nelm;
#ifdef DBRutag
prec->utag = (prec->utag+1u)&0x7fffffff;
#endif
return 0;
}
long process_utag(longinRecord *prec)
{
long status = dbGetLink(&prec->inp, DBR_LONG, &prec->val, 0, 0);
#ifdef DBRutag
prec->utag = prec->val;
#else
(void)recGblSetSevr(prec, COMM_ALARM, INVALID_ALARM);
#endif
return status;
}
template<typename REC>
struct dset5
{
@ -63,9 +80,11 @@ struct dset5
};
dset5<waveformRecord> devWfPDBDemo = {5,0,0,&init_spin,0,&process_spin};
dset5<longinRecord> devLoPDBUTag = {5,0,0,0,0,&process_utag};
} // namespace
extern "C" {
epicsExportAddress(dset, devWfPDBDemo);
epicsExportAddress(dset, devLoPDBUTag);
}

View File

@ -7,6 +7,7 @@ link("pva", "lsetPVA")
# from demo.cpp
device(waveform, CONSTANT, devWfPDBDemo, "QSRV Demo")
device(longin, CONSTANT, devLoPDBUTag, "QSRV Set UTag")
# from imagedemo.c
function(QSRV_image_demo)
# from pdb.cpp

View File

@ -6,6 +6,7 @@ registrar(installPVAAddLinkHook)
# from demo.cpp
device(waveform, CONSTANT, devWfPDBDemo, "QSRV Demo")
device(longin, CONSTANT, devLoPDBUTag, "QSRV Set UTag")
# from imagedemo.c
function(QSRV_image_demo)
# from pdb.cpp