mrfioc2  2.3.0
devMbboDirectSoft.c
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2002 The University of Chicago, 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 Versions 3.13.7
7 * and higher are distributed subject to a Software License Agreement found
8 * in file LICENSE that is included with this distribution.
9 \*************************************************************************/
10 /* devMbboDirectSoft.c */
11 /* base/src/dev $Revision-Id$ */
12 /*
13  * Original Author: Bob Dalesio
14  * Current Author: Matthew Needes
15  * Date: 10-08-93
16  *
17  * Revised for mrfioc2 to restore B* fields from VAL in init_record
18  */
19 #include <stdlib.h>
20 #include <stdio.h>
21 #include <string.h>
22 
23 #include "alarm.h"
24 #include "dbDefs.h"
25 #include "dbAccess.h"
26 #include "recGbl.h"
27 #include "recSup.h"
28 #include "devSup.h"
29 #include "mbboDirectRecord.h"
30 #include "epicsExport.h"
31 
32 /* Create the dset for devMbboSoft */
33 static long init_record(mbboDirectRecord *prec);
34 static long write_mbbo(mbboDirectRecord *prec);
35 struct {
36  long number;
37  DEVSUPFUN report;
38  DEVSUPFUN init;
39  DEVSUPFUN init_record;
40  DEVSUPFUN get_ioint_info;
41  DEVSUPFUN write_mbbo;
43  5,
44  NULL,
45  NULL,
47  NULL,
49 };
51 
52 static long init_record(mbboDirectRecord *prec)
53 {
54  unsigned int i;
55  epicsUInt8 *B=&prec->b0;
56  epicsUInt16 mask=1;
57 
58  for(i=0; i<16; i++, mask<<=1)
59  B[i] = !!(prec->val & mask);
60 
61  return 2; /* dont convert */
62 
63 } /* end init_record() */
64 
65 static long write_mbbo(mbboDirectRecord *prec)
66 {
67  long status;
68  prec->rval=prec->val;
69  prec->rval <<= prec->shft;
70 
71  status = dbPutLink(&prec->out,DBR_ULONG,&prec->rval,1);
72  if(status) {
73  recGblSetSevr(prec, WRITE_ALARM, INVALID_ALARM);
74  }
75  return(0);
76 }
epicsExportAddress(dset, devMbboDirectRestore)
long number
DEVSUPFUN write_mbbo
DEVSUPFUN init
DEVSUPFUN get_ioint_info
DEVSUPFUN report
struct @0 devMbboDirectRestore
DEVSUPFUN init_record