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