This is Unofficial EPICS BASE Doxygen Site
devLiSoft.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: 09-23-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 "recGbl.h"
23 #include "devSup.h"
24 #include "longinRecord.h"
25 #include "epicsExport.h"
26 
27 /* Create the dset for devLiSoft */
28 static long init_record(dbCommon *pcommon);
29 static long read_longin(longinRecord *prec);
30 
31 longindset devLiSoft = {
32  {5, NULL, NULL, init_record, NULL},
33  read_longin
34 };
36 
37 static long init_record(dbCommon *pcommon)
38 {
39  longinRecord *prec = (longinRecord *)pcommon;
40 
41  if (recGblInitConstantLink(&prec->inp, DBF_LONG, &prec->val))
42  prec->udf = FALSE;
43 
44  return 0;
45 }
46 
47 static long readLocked(struct link *pinp, void *dummy)
48 {
49  longinRecord *prec = (longinRecord *) pinp->precord;
50  long status = dbGetLink(pinp, DBR_LONG, &prec->val, 0, 0);
51 
52  if (status) return status;
53 
54  if (dbLinkIsConstant(&prec->tsel) &&
55  prec->tse == epicsTimeEventDeviceTime)
56  dbGetTimeStamp(pinp, &prec->time);
57 
58  return status;
59 }
60 
61 static long read_longin(longinRecord *prec)
62 {
63  long status = dbLinkDoLocked(&prec->inp, readLocked, NULL);
64 
65  if (status == S_db_noLSET)
66  status = readLocked(&prec->inp, NULL);
67 
68  return status;
69 }
#define FALSE
Definition: dbDefs.h:32
epicsExportAddress(dset, devLiSoft)
pvd::Status status
longindset devLiSoft
Definition: devLiSoft.c:31
#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
#define DBR_LONG
Definition: db_access.h:75
int prec
Definition: reader.c:29
Exporting IOC objects.