mrfioc2  2.3.0
Public Member Functions | List of all members
MRMInput Class Reference

#include <drvemInput.h>

Inheritance diagram for MRMInput:
Inheritance graph
[legend]
Collaboration diagram for MRMInput:
Collaboration graph
[legend]

Public Member Functions

 MRMInput (const std::string &n, volatile unsigned char *, size_t)
 
virtual ~MRMInput ()
 
virtual void lock () const OVERRIDE FINAL
 
virtual void unlock () const OVERRIDE FINAL
 
virtual void dbusSet (epicsUInt16) OVERRIDE FINAL
 Set mask of dbus bits are driven by this input. More...
 
virtual epicsUInt16 dbus () const OVERRIDE FINAL
 
virtual void levelHighSet (bool) OVERRIDE FINAL
 Set active high/low when using level trigger mode. More...
 
virtual bool levelHigh () const OVERRIDE FINAL
 
virtual bool state () const OVERRIDE FINAL
 
virtual void edgeRiseSet (bool) OVERRIDE FINAL
 Set active rise/fall when using edge trigger mode. More...
 
virtual bool edgeRise () const OVERRIDE FINAL
 
virtual void extModeSet (TrigMode) OVERRIDE FINAL
 Set external (local) event trigger mode. More...
 
virtual TrigMode extMode () const OVERRIDE FINAL
 
virtual void extEvtSet (epicsUInt32) OVERRIDE FINAL
 Set the event code sent by an externel (local) event. More...
 
virtual epicsUInt32 extEvt () const OVERRIDE FINAL
 
virtual void backModeSet (TrigMode) OVERRIDE FINAL
 Set the backwards event trigger mode. More...
 
virtual TrigMode backMode () const OVERRIDE FINAL
 
virtual void backEvtSet (epicsUInt32) OVERRIDE FINAL
 Set the event code sent by an a backwards event. More...
 
virtual epicsUInt32 backEvt () const OVERRIDE FINAL
 
- Public Member Functions inherited from Input
 Input (const std::string &n)
 
virtual ~Input ()=0
 
void extModeSetraw (epicsUInt16 r)
 
epicsUInt16 extModeraw () const
 
void backModeSetraw (epicsUInt16 r)
 
epicsUInt16 backModeraw () const
 
- Public Member Functions inherited from mrf::ObjectInst< Input >
virtual propertyBasegetPropertyBase (const char *pname, const std::type_info &ptype)
 
virtual void visitProperties (bool(*cb)(propertyBase *, void *), void *arg)
 
- Public Member Functions inherited from mrf::Object
const std::string & name () const
 
const Objectparent () const
 
child_iterator beginChild () const
 
child_iterator endChild () const
 
template<typename P >
mrf::auto_ptr< property< P > > getProperty (const char *pname)
 

Additional Inherited Members

- Public Types inherited from mrf::Object
typedef m_obj_children_t::const_iterator child_iterator
 
typedef std::map< std::string, std::string > create_args_t
 
typedef Object *(* create_factory_t) (const std::string &name, const std::string &klass, const create_args_t &args)
 
- Static Public Member Functions inherited from mrf::ObjectInst< Input >
static int initObject ()
 
- Static Public Member Functions inherited from mrf::Object
static ObjectgetObject (const std::string &name)
 
static ObjectgetCreateObject (const std::string &name, const std::string &klass, const create_args_t &args=create_args_t())
 
static void addFactory (const std::string &klass, create_factory_t fn)
 
static void visitObjects (bool(*)(Object *, void *), void *)
 
- Protected Member Functions inherited from mrf::ObjectInst< Input >
 ObjectInst (const std::string &n)
 
 ObjectInst (const std::string &n, A &a)
 
virtual ~ObjectInst ()
 
- Protected Member Functions inherited from mrf::Object
 Object (const std::string &n, const Object *par=0)
 
virtual ~Object ()=0
 

Detailed Description

Controls only the single output mapping register shared by all (except CML) outputs on MRM EVRs.

This class is reused by other subunits which have identical mapping registers.

Definition at line 24 of file drvemInput.h.

Constructor & Destructor Documentation

◆ MRMInput()

MRMInput::MRMInput ( const std::string &  n,
volatile unsigned char *  b,
size_t  i 
)

Definition at line 20 of file drvemInput.cpp.

21  :Input(n)
22  ,base(b)
23  ,idx(i)
24 {
25 }
Input(const std::string &n)
Definition: input.h:27

◆ ~MRMInput()

virtual MRMInput::~MRMInput ( )
inlinevirtual

Definition at line 28 of file drvemInput.h.

28 {};

Member Function Documentation

◆ backEvt()

epicsUInt32 MRMInput::backEvt ( ) const
virtual

Implements Input.

Definition at line 211 of file drvemInput.cpp.

212 {
213  epicsUInt32 val;
214  val = READ32(base, InputMapFP(idx) );
215  val &= InputMapFP_back_mask;
216  val >>= InputMapFP_back_shft;
217  return val;
218 }
#define READ32(base, offset)
Definition: mrfCommonIO.h:114
#define InputMapFP_back_mask
Definition: evrRegMap.h:270
#define InputMapFP_back_shft
Definition: evrRegMap.h:271

◆ backEvtSet()

void MRMInput::backEvtSet ( epicsUInt32  )
virtual

Set the event code sent by an a backwards event.

Implements Input.

Definition at line 193 of file drvemInput.cpp.

194 {
195  if(e>255)
196  throw std::out_of_range("Event code # out of range. Range: 0 - 255");
197 
198  int key=epicsInterruptLock();
199 
200  epicsUInt32 val;
201 
202  val = READ32(base, InputMapFP(idx) );
203  val &= ~InputMapFP_back_mask;
204  val |= e << InputMapFP_back_shft;
205  WRITE32(base, InputMapFP(idx), val);
206 
207  epicsInterruptUnlock(key);
208 }
#define READ32(base, offset)
Definition: mrfCommonIO.h:114
#define InputMapFP_back_mask
Definition: evrRegMap.h:270
#define InputMapFP_back_shft
Definition: evrRegMap.h:271
#define WRITE32(base, offset, value)
Definition: mrfCommonIO.h:119

◆ backMode()

TrigMode MRMInput::backMode ( ) const
virtual

Implements Input.

Definition at line 175 of file drvemInput.cpp.

176 {
177  epicsUInt32 v=READ32(base, InputMapFP(idx));
178 
179  bool e = (v&InputMapFP_bedg) != 0;
180  bool l = (v&InputMapFP_blvl) != 0;
181 
182  if(!e && !l)
183  return TrigNone;
184  else if(e && !l)
185  return TrigEdge;
186  else if(!e && l)
187  return TrigLevel;
188  else
189  throw std::runtime_error("Backwards mode cannot be set to both Edge and Level at the same time.");
190 }
#define READ32(base, offset)
Definition: mrfCommonIO.h:114
#define InputMapFP_bedg
Definition: evrRegMap.h:266
Definition: input.h:21
#define InputMapFP_blvl
Definition: evrRegMap.h:263
Definition: input.h:19

◆ backModeSet()

void MRMInput::backModeSet ( TrigMode  )
virtual

Set the backwards event trigger mode.

Implements Input.

Definition at line 153 of file drvemInput.cpp.

154 {
155  switch(m){
156  case TrigNone:
157  // Disable both level and edge
158  BITCLR(NAT,32, base, InputMapFP(idx), InputMapFP_bedg);
159  BITCLR(NAT,32, base, InputMapFP(idx), InputMapFP_blvl);
160  break;
161  case TrigLevel:
162  // disable edge, enable level
163  BITCLR(NAT,32, base, InputMapFP(idx), InputMapFP_bedg);
164  BITSET(NAT,32, base, InputMapFP(idx), InputMapFP_blvl);
165  break;
166  case TrigEdge:
167  // disable level, enable edge
168  BITSET(NAT,32, base, InputMapFP(idx), InputMapFP_bedg);
169  BITCLR(NAT,32, base, InputMapFP(idx), InputMapFP_blvl);
170  break;
171  }
172 }
#define BITCLR(ord, len, base, offset, mask)
Definition: mrfBitOps.h:26
#define InputMapFP_bedg
Definition: evrRegMap.h:266
Definition: input.h:21
#define InputMapFP_blvl
Definition: evrRegMap.h:263
Definition: input.h:19
#define BITSET(ord, len, base, offset, mask)
Definition: mrfBitOps.h:21

◆ dbus()

epicsUInt16 MRMInput::dbus ( ) const
virtual

Implements Input.

Definition at line 39 of file drvemInput.cpp.

40 {
41  epicsUInt32 val;
42  val = READ32(base, InputMapFP(idx) );
43  val &= InputMapFP_dbus_mask;
44  val >>= InputMapFP_dbus_shft;
45  return val;
46 }
#define READ32(base, offset)
Definition: mrfCommonIO.h:114
#define InputMapFP_dbus_mask
Definition: evrRegMap.h:268
#define InputMapFP_dbus_shft
Definition: evrRegMap.h:269

◆ dbusSet()

void MRMInput::dbusSet ( epicsUInt16  )
virtual

Set mask of dbus bits are driven by this input.

Implements Input.

Definition at line 28 of file drvemInput.cpp.

29 {
30  epicsUInt32 val;
31 
32  val = READ32(base, InputMapFP(idx) );
33  val &= ~InputMapFP_dbus_mask;
34  val |= v << InputMapFP_dbus_shft;
35  WRITE32(base, InputMapFP(idx), val);
36 }
#define READ32(base, offset)
Definition: mrfCommonIO.h:114
#define InputMapFP_dbus_mask
Definition: evrRegMap.h:268
#define InputMapFP_dbus_shft
Definition: evrRegMap.h:269
#define WRITE32(base, offset, value)
Definition: mrfCommonIO.h:119

◆ edgeRise()

bool MRMInput::edgeRise ( ) const
virtual

Implements Input.

Definition at line 79 of file drvemInput.cpp.

80 {
81  return !(READ32(base,InputMapFP(idx)) & InputMapFP_edge);
82 }
#define READ32(base, offset)
Definition: mrfCommonIO.h:114
#define InputMapFP_edge
Definition: evrRegMap.h:265

◆ edgeRiseSet()

void MRMInput::edgeRiseSet ( bool  )
virtual

Set active rise/fall when using edge trigger mode.

Implements Input.

Definition at line 70 of file drvemInput.cpp.

71 {
72  if(v)
73  BITCLR(NAT,32, base, InputMapFP(idx), InputMapFP_edge);
74  else
75  BITSET(NAT,32, base, InputMapFP(idx), InputMapFP_edge);
76 }
#define BITCLR(ord, len, base, offset, mask)
Definition: mrfBitOps.h:26
#define InputMapFP_edge
Definition: evrRegMap.h:265
#define BITSET(ord, len, base, offset, mask)
Definition: mrfBitOps.h:21

◆ extEvt()

epicsUInt32 MRMInput::extEvt ( ) const
virtual

Implements Input.

Definition at line 143 of file drvemInput.cpp.

144 {
145  epicsUInt32 val;
146  val = READ32(base, InputMapFP(idx) );
147  val &= InputMapFP_ext_mask;
148  val >>= InputMapFP_ext_shft;
149  return val;
150 }
#define READ32(base, offset)
Definition: mrfCommonIO.h:114
#define InputMapFP_ext_mask
Definition: evrRegMap.h:272
#define InputMapFP_ext_shft
Definition: evrRegMap.h:273

◆ extEvtSet()

void MRMInput::extEvtSet ( epicsUInt32  )
virtual

Set the event code sent by an externel (local) event.

Implements Input.

Definition at line 125 of file drvemInput.cpp.

126 {
127  if(e>255)
128  throw std::out_of_range("Event code # out of range. Range: 0 - 255");
129 
130  int key=epicsInterruptLock();
131 
132  epicsUInt32 val;
133 
134  val = READ32(base, InputMapFP(idx) );
135  val &= ~InputMapFP_ext_mask;
136  val |= e << InputMapFP_ext_shft;
137  WRITE32(base, InputMapFP(idx), val);
138 
139  epicsInterruptUnlock(key);
140 }
#define READ32(base, offset)
Definition: mrfCommonIO.h:114
#define InputMapFP_ext_mask
Definition: evrRegMap.h:272
#define InputMapFP_ext_shft
Definition: evrRegMap.h:273
#define WRITE32(base, offset, value)
Definition: mrfCommonIO.h:119

◆ extMode()

TrigMode MRMInput::extMode ( ) const
virtual

Implements Input.

Definition at line 107 of file drvemInput.cpp.

108 {
109  epicsUInt32 v=READ32(base, InputMapFP(idx));
110 
111  bool e = (v&InputMapFP_eedg) != 0;
112  bool l = (v&InputMapFP_elvl) != 0;
113 
114  if(!e && !l)
115  return TrigNone;
116  else if(e && !l)
117  return TrigEdge;
118  else if(!e && l)
119  return TrigLevel;
120  else
121  throw std::runtime_error("External mode cannot be set to both Edge and Level at the same time.");
122 }
#define READ32(base, offset)
Definition: mrfCommonIO.h:114
#define InputMapFP_elvl
Definition: evrRegMap.h:264
#define InputMapFP_eedg
Definition: evrRegMap.h:267
Definition: input.h:21
Definition: input.h:19

◆ extModeSet()

void MRMInput::extModeSet ( TrigMode  )
virtual

Set external (local) event trigger mode.

Implements Input.

Definition at line 85 of file drvemInput.cpp.

86 {
87  switch(m){
88  case TrigNone:
89  // Disable both level and edge
90  BITCLR(NAT,32, base, InputMapFP(idx), InputMapFP_eedg);
91  BITCLR(NAT,32, base, InputMapFP(idx), InputMapFP_elvl);
92  break;
93  case TrigLevel:
94  // disable edge, enable level
95  BITCLR(NAT,32, base, InputMapFP(idx), InputMapFP_eedg);
96  BITSET(NAT,32, base, InputMapFP(idx), InputMapFP_elvl);
97  break;
98  case TrigEdge:
99  // disable level, enable edge
100  BITSET(NAT,32, base, InputMapFP(idx), InputMapFP_eedg);
101  BITCLR(NAT,32, base, InputMapFP(idx), InputMapFP_elvl);
102  break;
103  }
104 }
#define BITCLR(ord, len, base, offset, mask)
Definition: mrfBitOps.h:26
#define InputMapFP_elvl
Definition: evrRegMap.h:264
#define InputMapFP_eedg
Definition: evrRegMap.h:267
Definition: input.h:21
Definition: input.h:19
#define BITSET(ord, len, base, offset, mask)
Definition: mrfBitOps.h:21

◆ levelHigh()

bool MRMInput::levelHigh ( ) const
virtual

Implements Input.

Definition at line 58 of file drvemInput.cpp.

59 {
60  return !(READ32(base,InputMapFP(idx)) & InputMapFP_lvl);
61 }
#define READ32(base, offset)
Definition: mrfCommonIO.h:114
#define InputMapFP_lvl
Definition: evrRegMap.h:262

◆ levelHighSet()

void MRMInput::levelHighSet ( bool  )
virtual

Set active high/low when using level trigger mode.

Implements Input.

Definition at line 49 of file drvemInput.cpp.

50 {
51  if(v)
52  BITCLR(NAT,32, base, InputMapFP(idx), InputMapFP_lvl);
53  else
54  BITSET(NAT,32, base, InputMapFP(idx), InputMapFP_lvl);
55 }
#define BITCLR(ord, len, base, offset, mask)
Definition: mrfBitOps.h:26
#define BITSET(ord, len, base, offset, mask)
Definition: mrfBitOps.h:21
#define InputMapFP_lvl
Definition: evrRegMap.h:262

◆ lock()

virtual void MRMInput::lock ( ) const
inlinevirtual

Implements mrf::Object.

Definition at line 31 of file drvemInput.h.

31 {};

◆ state()

bool MRMInput::state ( ) const
virtual

Implements Input.

Definition at line 64 of file drvemInput.cpp.

65 {
66  return (READ32(base,InputMapFP(idx)) & InputMapFP_state);
67 }
#define READ32(base, offset)
Definition: mrfCommonIO.h:114
#define InputMapFP_state
Definition: evrRegMap.h:261

◆ unlock()

virtual void MRMInput::unlock ( ) const
inlinevirtual

Implements mrf::Object.

Definition at line 32 of file drvemInput.h.

32 {};

The documentation for this class was generated from the following files: