This is Unofficial EPICS BASE Doxygen Site
devSiSoft.c
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * EPICS BASE is distributed subject to a Software License Agreement found
7 * in file LICENSE that is included with this distribution.
8 \*************************************************************************/
9 
10 /*
11  * Author: Janet Anderson
12  * Date: 04-21-91
13  */
14 
15 #include <stdlib.h>
16 #include <stdio.h>
17 #include <string.h>
18 
19 #include "alarm.h"
20 #include "dbDefs.h"
21 #include "dbAccess.h"
22 #include "epicsTime.h"
23 #include "recGbl.h"
24 #include "devSup.h"
25 #include "link.h"
26 #include "stringinRecord.h"
27 #include "epicsExport.h"
28 
29 /* Create the dset for devSiSoft */
30 static long init_record(dbCommon *pcommon);
31 static long read_stringin(stringinRecord *prec);
32 
33 stringindset devSiSoft = {
34  {5, NULL, NULL, init_record, NULL},
35  read_stringin
36 };
38 
39 static long init_record(dbCommon *pcommon)
40 {
41  stringinRecord *prec = (stringinRecord *)pcommon;
42 
43  if (recGblInitConstantLink(&prec->inp, DBF_STRING, prec->val))
44  prec->udf = FALSE;
45 
46  return 0;
47 }
48 
49 static long readLocked(struct link *pinp, void *dummy)
50 {
51  stringinRecord *prec = (stringinRecord *) pinp->precord;
52  long status = dbGetLink(pinp, DBR_STRING, prec->val, 0, 0);
53 
54  if (status) return status;
55 
56  if (dbLinkIsConstant(&prec->tsel) &&
57  prec->tse == epicsTimeEventDeviceTime)
58  dbGetTimeStamp(pinp, &prec->time);
59 
60  return status;
61 }
62 
63 static long read_stringin(stringinRecord *prec)
64 {
65  long status = dbLinkDoLocked(&prec->inp, readLocked, NULL);
66 
67  if (status == S_db_noLSET)
68  status = readLocked(&prec->inp, NULL);
69 
70  if (!status && !dbLinkIsConstant(&prec->inp))
71  prec->udf = FALSE;
72 
73  return status;
74 }
#define DBR_STRING
Definition: db_access.h:69
#define FALSE
Definition: dbDefs.h:32
pvd::Status status
#define init_record
#define NULL
Definition: catime.c:38
Miscellaneous macro definitions.
Device support routines.
Definition: devSup.h:140
#define epicsTimeEventDeviceTime
Definition: epicsTime.h:362
epics::pvData::PVStructurePtr dummy
Definition: pvAccess.cpp:72
stringindset devSiSoft
Definition: devSiSoft.c:33
EPICS time-stamps (epicsTimeStamp), epicsTime C++ class and C functions for handling wall-clock times...
int prec
Definition: reader.c:29
epicsExportAddress(dset, devSiSoft)
Exporting IOC objects.