This is Unofficial EPICS BASE Doxygen Site
devBiSoft.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 "biRecord.h"
25 #include "epicsExport.h"
26 
27 /* Create the dset for devBiSoft */
28 static long init_record(dbCommon *pcommon);
29 static long read_bi(biRecord *prec);
30 
31 bidset devBiSoft = {
32  {5, NULL, NULL, init_record, NULL},
33  read_bi
34 };
36 
37 static long init_record(dbCommon *pcommon)
38 {
39  biRecord *prec = (biRecord *)pcommon;
40 
41  if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val))
42  prec->udf = FALSE;
43  return 0;
44 }
45 
46 static long readLocked(struct link *pinp, void *dummy)
47 {
48  biRecord *prec = (biRecord *) pinp->precord;
49  long status = dbGetLink(pinp, DBR_USHORT, &prec->val, 0, 0);
50 
51  if (status) return status;
52 
53  prec->udf = FALSE;
54  if (dbLinkIsConstant(&prec->tsel) &&
55  prec->tse == epicsTimeEventDeviceTime)
56  dbGetTimeStamp(pinp, &prec->time);
57 
58  return 2;
59 }
60 
61 static long read_bi(biRecord *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
bidset devBiSoft
Definition: devBiSoft.c:31
pvd::Status status
#define DBR_USHORT
Definition: dbFldTypes.h:80
#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
epicsExportAddress(dset, devBiSoft)
int prec
Definition: reader.c:29
Exporting IOC objects.