This is Unofficial EPICS BASE Doxygen Site
devI64inSoft.c
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2016 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  * Original 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 "int64inRecord.h"
25 #include "epicsExport.h"
26 
27 static long init_record(dbCommon *common)
28 {
29  int64inRecord *prec = (int64inRecord *)common;
30  if (recGblInitConstantLink(&prec->inp, DBF_INT64, &prec->val))
31  prec->udf = FALSE;
32 
33  return 0;
34 }
35 
36 static long readLocked(struct link *pinp, void *dummy)
37 {
38  int64inRecord *prec = (int64inRecord *) pinp->precord;
39  long status = dbGetLink(&prec->inp, DBR_INT64, &prec->val, 0, 0);
40 
41  if (status) return status;
42 
43  if (dbLinkIsConstant(&prec->tsel) &&
44  prec->tse == epicsTimeEventDeviceTime)
45  dbGetTimeStamp(pinp, &prec->time);
46 
47  return status;
48 }
49 
50 static long read_int64in(int64inRecord *prec)
51 {
52  long status = dbLinkDoLocked(&prec->inp, readLocked, NULL);
53 
54  if (status == S_db_noLSET)
55  status = readLocked(&prec->inp, NULL);
56 
57  return status;
58 }
59 
60 /* Create the dset for devI64inSoft */
61 
62 int64indset devI64inSoft = {
63  { 5, NULL, NULL, init_record, NULL }, read_int64in
64 };
65 epicsExportAddress(dset, devI64inSoft);
66 
#define FALSE
Definition: dbDefs.h:32
pvd::Status status
#define init_record
#define DBR_INT64
Definition: dbFldTypes.h:83
int64indset devI64inSoft
Definition: devI64inSoft.c:62
#define NULL
Definition: catime.c:38
Miscellaneous macro definitions.
Device support routines.
Definition: devSup.h:140
#define epicsTimeEventDeviceTime
Definition: epicsTime.h:362
epicsExportAddress(dset, devI64inSoft)
epics::pvData::PVStructurePtr dummy
Definition: pvAccess.cpp:72
int prec
Definition: reader.c:29
Exporting IOC objects.