diff --git a/src/dev/softDev/Makefile b/src/dev/softDev/Makefile index 8e6eb0d63..5f87eae4a 100644 --- a/src/dev/softDev/Makefile +++ b/src/dev/softDev/Makefile @@ -47,6 +47,8 @@ LIBSRCS += devMbboSoftCallback.c LIBSRCS += devMbboDirectSoftCallback.c LIBSRCS += devSoSoftCallback.c +LIBSRCS += devTimestampSI.c + LIBRARY_IOC += softDevIoc softDevIoc_LIBS += recIoc asIoc dbIoc registryIoc dbStaticIoc ca Com softDevIoc_RCS_WIN32 = softDevIoc.rc diff --git a/src/dev/softDev/devSoft.dbd b/src/dev/softDev/devSoft.dbd index 305894e7d..a717efe3c 100644 --- a/src/dev/softDev/devSoft.dbd +++ b/src/dev/softDev/devSoft.dbd @@ -32,3 +32,4 @@ device(mbbo,CONSTANT,devMbboSoftCallback,"Async Soft Channel") device(mbboDirect,CONSTANT,devMbboDirectSoftCallback,"Async Soft Channel") device(stringout,CONSTANT,devSoSoftCallback,"Async Soft Channel") +device(stringin,INST_IO,devTimestampSI,"Soft Timestamp") diff --git a/src/dev/softDev/devTimestampSI.c b/src/dev/softDev/devTimestampSI.c new file mode 100644 index 000000000..e9f167d4b --- /dev/null +++ b/src/dev/softDev/devTimestampSI.c @@ -0,0 +1,46 @@ +/* + * Stringin device support for EPICS time stamps + * + * $Id$ + */ + +#include +#include +#include +#include +#include +#include +#include + +static long +read_stringin (struct stringinRecord *psi) +{ + int l; + + recGblGetTimeStamp(psi); + l = epicsTimeToStrftime(psi->val, sizeof psi->val, psi->inp.value.instio.string, &psi->time); + if (l >= sizeof psi->val) { + psi->udf = 1; + recGblSetSevr(psi,UDF_ALARM,INVALID_ALARM); + return -1; + } + psi->udf = 0; + return 0; +} + +struct { + long number; + DEVSUPFUN dev_report; + DEVSUPFUN init; + DEVSUPFUN init_record; /*returns: (0,2)=>(success,success no convert)*/ + DEVSUPFUN get_ioint_info; + DEVSUPFUN read_stringin;/*(0)=>(success ) */ +} devTimestampSI = { + 6, + NULL, + NULL, + NULL, + NULL, + read_stringin +}; +epicsExportAddress(dset,devTimestampSI);