Stage 1 reorganization
Directory moves. src/RTEMS/ => src/libCom/RTEMS/ src/as/ => src/ioc/as/ src/bpt/ => src/ioc/bpt/ src/ca/ => src/ca/client/ src/cap5/ => src/ca/client/perl/ src/cas/ => src/ca/legacy/pcas/ src/catools/ => src/ca/client/tools/ src/db/ => src/ioc/db/ src/dbStatic/ => src/ioc/dbStatic/ src/dbtools/ => src/ioc/dbtemplate/ src/dev/softDev/ => src/std/dev/ src/dev/testDev/ => src/std/test/ src/excas/ => src/ca/legacy/pcas/ex/ src/gdd/ => src/ca/legacy/gdd/ src/makeBaseApp/ => src/template/base/ src/makeBaseExt/ => src/template/ext/ src/misc/ => src/ioc/misc/ src/rec/ => src/std/rec/ src/registry/ => src/ioc/registry/ src/rsrv/ => src/ioc/rsrv/ src/softIoc/ => src/std/softIoc/ src/toolsComm/ => src/libCom/tools/
This commit is contained in:
committed by
Andrew Johnson
parent
4a18db9f99
commit
2a36a3906d
78
src/std/dev/devTimestamp.c
Normal file
78
src/std/dev/devTimestamp.c
Normal file
@@ -0,0 +1,78 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in the file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/* $Revision-Id$ */
|
||||
/*
|
||||
* Device support for EPICS time stamps
|
||||
*
|
||||
* Original Author: Eric Norum
|
||||
*/
|
||||
|
||||
#include "dbDefs.h"
|
||||
#include "epicsTime.h"
|
||||
#include "alarm.h"
|
||||
#include "devSup.h"
|
||||
#include "recGbl.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
#include "aiRecord.h"
|
||||
#include "stringinRecord.h"
|
||||
|
||||
|
||||
/* Extended device support to allow INP field changes */
|
||||
|
||||
static long initAllow(int pass) {
|
||||
if (pass == 0) devExtend(&devSoft_DSXT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* ai record */
|
||||
|
||||
static long read_ai(aiRecord *prec)
|
||||
{
|
||||
recGblGetTimeStamp(prec);
|
||||
prec->val = prec->time.secPastEpoch + (double)prec->time.nsec * 1e-9;
|
||||
prec->udf = FALSE;
|
||||
return 2;
|
||||
}
|
||||
|
||||
struct {
|
||||
dset common;
|
||||
DEVSUPFUN read_write;
|
||||
DEVSUPFUN special_linconv;
|
||||
} devTimestampAI = {
|
||||
{6, NULL, initAllow, NULL, NULL}, read_ai, NULL
|
||||
};
|
||||
epicsExportAddress(dset, devTimestampAI);
|
||||
|
||||
|
||||
/* stringin record */
|
||||
|
||||
static long read_stringin (stringinRecord *prec)
|
||||
{
|
||||
int len;
|
||||
|
||||
recGblGetTimeStamp(prec);
|
||||
len = epicsTimeToStrftime(prec->val, sizeof prec->val,
|
||||
prec->inp.value.instio.string, &prec->time);
|
||||
if (len >= sizeof prec->val) {
|
||||
prec->udf = TRUE;
|
||||
recGblSetSevr(prec, UDF_ALARM, INVALID_ALARM);
|
||||
return -1;
|
||||
}
|
||||
prec->udf = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct {
|
||||
dset common;
|
||||
DEVSUPFUN read_stringin;
|
||||
} devTimestampSI = {
|
||||
{5, NULL, initAllow, NULL, NULL}, read_stringin
|
||||
};
|
||||
epicsExportAddress(dset, devTimestampSI);
|
||||
Reference in New Issue
Block a user