38 #define GEN_SIZE_OFFSET 39 #include "mbbiDirectRecord.h" 40 #undef GEN_SIZE_OFFSET 45 #define initialize NULL 47 static long process(
struct dbCommon *);
48 static long special(DBADDR *,
int);
49 #define get_value NULL 50 #define cvt_dbaddr NULL 51 #define get_array_info NULL 52 #define put_array_info NULL 53 #define get_units NULL 55 #define get_enum_str NULL 56 #define get_enum_strs NULL 57 #define put_enum_str NULL 58 #define get_graphic_double NULL 59 #define get_control_double NULL 60 #define get_alarm_double NULL 84 static void monitor(mbbiDirectRecord *);
85 static long readValue(mbbiDirectRecord *);
89 static long init_record(
struct dbCommon *pcommon,
int pass)
91 struct mbbiDirectRecord *
prec = (
struct mbbiDirectRecord *)pcommon;
92 mbbidirectdset *pdset = (mbbidirectdset *) prec->dset;
95 if (pass == 0)
return 0;
98 recGblRecordError(
S_dev_noDSET, prec,
"mbbiDirect: init_record");
102 if ((pdset->common.number < 5) || (pdset->read_mbbi ==
NULL)) {
107 recGblInitSimm(pcommon, &prec->sscn, &prec->oldsimm, &prec->simm, &prec->siml);
108 recGblInitConstantLink(&prec->siol,
DBF_ULONG, &prec->sval);
111 if (prec->mask == 0 && prec->nobt <= 32)
114 if (pdset->common.init_record) {
115 status = pdset->common.init_record(pcommon);
122 for (i = 0; i < NUM_BITS; i++, pBn++, val >>= 1)
127 prec->mlst = prec->val;
128 prec->oraw = prec->rval;
132 static long process(
struct dbCommon *pcommon)
134 struct mbbiDirectRecord *
prec = (
struct mbbiDirectRecord *)pcommon;
135 mbbidirectdset *pdset = (mbbidirectdset *) prec->dset;
137 int pact = prec->pact;
139 if ((pdset ==
NULL) || (pdset->read_mbbi ==
NULL)) {
148 if (!pact && prec->pact)
152 recGblGetTimeStampSimm(prec, prec->simm, &prec->siol);
178 static long special(DBADDR *paddr,
int after)
180 mbbiDirectRecord *
prec = (mbbiDirectRecord *)(paddr->precord);
181 int special_type = paddr->special;
183 switch(special_type) {
185 if (dbGetFieldIndex(paddr) == mbbiDirectRecordSIMM) {
187 recGblSaveSimm(prec->sscn, &prec->oldsimm, prec->simm);
189 recGblCheckSimm((dbCommon *)prec, &prec->sscn, prec->oldsimm, prec->simm);
193 recGblDbaddrError(S_db_badChoice, paddr,
"mbbiDirect: special");
194 return(S_db_badChoice);
198 static long get_precision(
const DBADDR *paddr,
long *precision)
200 mbbiDirectRecord *
prec=(mbbiDirectRecord *)paddr->precord;
201 if(dbGetFieldIndex(paddr)==mbbiDirectRecordVAL)
202 *precision = prec->nobt;
204 recGblGetPrec(paddr,precision);
208 static void monitor(mbbiDirectRecord *
prec)
217 for (i = 0; i < NUM_BITS; i++, pBn++, val >>= 1) {
222 db_post_events(prec, pBn, vl_events);
224 db_post_events(prec, pBn, events);
227 if (prec->mlst != prec->val) {
229 prec->mlst = prec->val;
232 db_post_events(prec, &prec->val, events);
234 if (prec->oraw != prec->rval) {
235 db_post_events(prec, &prec->rval, vl_events);
236 prec->oraw = prec->rval;
240 static long readValue(mbbiDirectRecord *
prec)
242 mbbidirectdset *pdset = (mbbidirectdset *) prec->dset;
246 status = recGblGetSimm((dbCommon *)prec, &prec->sscn, &prec->oldsimm, &prec->simm, &prec->siml);
250 switch (prec->simm) {
252 status = pdset->read_mbbi(prec);
258 if (prec->pact || (prec->sdly < 0.)) {
261 if (prec->simm == menuSimmYES) {
262 prec->val = prec->sval;
265 prec->rval = prec->sval;
271 epicsCallback *pvt = prec->simpvt;
273 pvt = calloc(1,
sizeof(epicsCallback));
276 if (pvt) callbackRequestProcessCallbackDelayed(pvt, prec->prio, prec, prec->sdly);
unsigned short epicsUInt16
#define get_graphic_double
#define get_control_double
Miscellaneous macro definitions.
unsigned long long epicsUInt64
epicsExportAddress(rset, mbbiDirectRSET)