This is Unofficial EPICS BASE Doxygen Site
stateRecord.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 /* recState.c - Record Support Routines for State records */
11 /*
12  * Original Author: Bob Dalesio
13  * Date: 10-10-90
14  */
15 
16 #include <stddef.h>
17 #include <stdlib.h>
18 #include <stdarg.h>
19 #include <stdio.h>
20 #include <string.h>
21 
22 #include "dbDefs.h"
23 #include "epicsPrint.h"
24 #include "dbAccess.h"
25 #include "dbEvent.h"
26 #include "dbFldTypes.h"
27 #include "devSup.h"
28 #include "errMdef.h"
29 #include "recSup.h"
30 #include "recGbl.h"
31 #include "errlog.h"
32 
33 #define GEN_SIZE_OFFSET
34 #include "stateRecord.h"
35 #undef GEN_SIZE_OFFSET
36 #include "epicsExport.h"
37 
38 /* Create RSET - Record Support Entry Table*/
39 #define report NULL
40 #define initialize NULL
41 static long init_record(struct dbCommon *prec, int pass);
42 static long process(struct dbCommon *);
43 #define special NULL
44 #define get_value NULL
45 #define cvt_dbaddr NULL
46 #define get_array_info NULL
47 #define put_array_info NULL
48 #define get_units NULL
49 #define get_precision NULL
50 #define get_enum_str NULL
51 #define get_enum_strs NULL
52 #define put_enum_str NULL
53 #define get_graphic_double NULL
54 #define get_control_double NULL
55 #define get_alarm_double NULL
56 
58  RSETNUMBER,
59  report,
60  initialize,
62  process,
63  special,
64  get_value,
65  cvt_dbaddr,
68  get_units,
76 };
77 epicsExportAddress(rset,stateRSET);
78 
79 static void monitor(stateRecord *);
80 
81 static long init_record(struct dbCommon *prec, int pass)
82 {
83  if(pass == 0) {
85  "WARNING: Using deprecated record type \"state\" for record "
86  "\"%s\".\nThis record type will be removed beginning with EPICS "
87  "7.1. Please replace it\nby a stringin record.\n",
88  prec->name
89  );
90  }
91  return 0;
92 }
93 
94 static long process(struct dbCommon *pcommon)
95 {
96  struct stateRecord *prec = (struct stateRecord *)pcommon;
97 
98  prec->udf = FALSE;
99  prec->pact=TRUE;
100  recGblGetTimeStamp(prec);
101  monitor(prec);
102  /* process the forward scan link record */
103  recGblFwdLink(prec);
104  prec->pact=FALSE;
105  return(0);
106 }
107 
108 static void monitor(stateRecord *prec)
109 {
110  unsigned short monitor_mask;
111 
112  /* get previous stat and sevr and new stat and sevr*/
113  monitor_mask = recGblResetAlarms(prec);
114  if(strncmp(prec->oval,prec->val,sizeof(prec->val))) {
115  db_post_events(prec,&(prec->val[0]),monitor_mask|DBE_VALUE|DBE_LOG);
116  strncpy(prec->oval,prec->val,sizeof(prec->oval));
117  }
118  return;
119 }
#define get_alarm_double
Definition: stateRecord.c:55
#define RSETNUMBER
Definition: recSup.h:92
#define FALSE
Definition: dbDefs.h:32
#define get_precision
Definition: stateRecord.c:49
#define get_enum_str
Definition: stateRecord.c:50
#define get_units
Definition: stateRecord.c:48
#define init_record
#define put_array_info
Definition: stateRecord.c:47
#define get_array_info
Definition: stateRecord.c:46
Miscellaneous macro definitions.
#define initialize
Definition: stateRecord.c:40
#define DBE_VALUE
Definition: caeventmask.h:38
#define put_enum_str
Definition: stateRecord.c:52
#define cvt_dbaddr
Definition: stateRecord.c:45
Device support routines.
#define DBE_LOG
Definition: caeventmask.h:40
rset stateRSET
Definition: stateRecord.c:57
#define get_value
Definition: stateRecord.c:44
int errlogPrintf(const char *pFormat,...)
Definition: errlog.c:105
#define report
Definition: stateRecord.c:39
#define TRUE
Definition: dbDefs.h:27
#define get_graphic_double
Definition: stateRecord.c:53
Definition: recSup.h:67
#define special
Definition: stateRecord.c:43
#define get_enum_strs
Definition: stateRecord.c:51
int prec
Definition: reader.c:29
epicsExportAddress(rset, stateRSET)
#define get_control_double
Definition: stateRecord.c:54
Exporting IOC objects.