This is Unofficial EPICS BASE Doxygen Site
devAiSoftRaw.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  * Original Authors: Bob Dalesio and Marty Kraimer
12  * Date: 6-1-90
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 "aiRecord.h"
25 #include "epicsExport.h"
26 
27 /* Create the dset for devAiSoftRaw */
28 static long init_record(dbCommon *pcommon);
29 static long read_ai(aiRecord *prec);
30 
31 aidset devAiSoftRaw = {
32  {6, NULL, NULL, init_record, NULL},
33  read_ai, NULL
34 };
36 
37 static long init_record(dbCommon *pcommon)
38 {
39  aiRecord *prec = (aiRecord *)pcommon;
40 
41  recGblInitConstantLink(&prec->inp, DBF_LONG, &prec->rval);
42 
43  return 0;
44 }
45 
46 static long readLocked(struct link *pinp, void *dummy)
47 {
48  aiRecord *prec = (aiRecord *) pinp->precord;
49  long status = dbGetLink(pinp, DBR_LONG, &prec->rval, 0, 0);
50 
51  if (status) return status;
52 
53  if (dbLinkIsConstant(&prec->tsel) &&
54  prec->tse == epicsTimeEventDeviceTime)
55  dbGetTimeStamp(pinp, &prec->time);
56 
57  return status;
58 }
59 
60 static long read_ai(aiRecord *prec)
61 {
62  long status = dbLinkDoLocked(&prec->inp, readLocked, NULL);
63 
64  if (status == S_db_noLSET)
65  status = readLocked(&prec->inp, NULL);
66 
67  return status;
68 }
epicsExportAddress(dset, devAiSoftRaw)
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
#define DBR_LONG
Definition: db_access.h:75
aidset devAiSoftRaw
Definition: devAiSoftRaw.c:31
int prec
Definition: reader.c:29
Exporting IOC objects.