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

#include <evgMxc.h>

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

Public Member Functions

 evgMxc (const std::string &, const epicsUInt32, evgMrm *const)
 
 ~evgMxc ()
 
virtual void lock () const
 
virtual void unlock () const
 
bool getStatus () const
 
void setPolarity (bool)
 
bool getPolarity () const
 
void setPrescaler (epicsUInt32)
 
epicsUInt32 getPrescaler () const
 
void setFrequency (epicsFloat64)
 
epicsFloat64 getFrequency () const
 
void setTrigEvtMap (epicsUInt16, bool)
 
bool getTrigEvtMap (epicsUInt16) const
 
- Public Member Functions inherited from mrf::ObjectInst< evgMxc >
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< evgMxc >
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< evgMxc >
 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

Definition at line 9 of file evgMxc.h.

Constructor & Destructor Documentation

◆ evgMxc()

evgMxc::evgMxc ( const std::string &  name,
const epicsUInt32  id,
evgMrm * const  owner 
)

Definition at line 21 of file evgMxc.cpp.

22  :
24 m_id(id),
25 m_owner(owner),
26 m_pReg(owner->getRegAddr()) {
27 }
volatile epicsUInt8 * getRegAddr() const
Definition: evgMrm.cpp:219
const std::string & name() const
Definition: object.h:393

◆ ~evgMxc()

evgMxc::~evgMxc ( )

Definition at line 29 of file evgMxc.cpp.

29  {
30 }

Member Function Documentation

◆ getFrequency()

epicsFloat64 evgMxc::getFrequency ( ) const

Definition at line 74 of file evgMxc.cpp.

74  {
75  epicsFloat64 clkSpeed = (epicsFloat64)m_owner->getFrequency()
76  * pow(10.0, 6);
77  epicsFloat64 preScaler = (epicsFloat64)getPrescaler();
78  return clkSpeed/preScaler;
79 }
epicsUInt32 getPrescaler() const
Definition: evgMxc.cpp:59
epicsFloat64 getFrequency() const
Definition: evgEvtClk.cpp:15

◆ getPolarity()

bool evgMxc::getPolarity ( ) const

Definition at line 46 of file evgMxc.cpp.

46  {
47  return (READ32(m_pReg, MuxControl(m_id)) & MuxControl_Pol) != 0;
48 }
#define READ32(base, offset)
Definition: mrfCommonIO.h:114
#define MuxControl_Pol
Definition: evgRegMap.h:183

◆ getPrescaler()

epicsUInt32 evgMxc::getPrescaler ( ) const

Definition at line 59 of file evgMxc.cpp.

59  {
60  return READ32(m_pReg, MuxPrescaler(m_id));
61 }
#define READ32(base, offset)
Definition: mrfCommonIO.h:114

◆ getStatus()

bool evgMxc::getStatus ( ) const

Definition at line 33 of file evgMxc.cpp.

33  {
34  return (READ32(m_pReg, MuxControl(m_id)) & MuxControl_Sts) != 0;
35 }
#define READ32(base, offset)
Definition: mrfCommonIO.h:114
#define MuxControl_Sts
Definition: evgRegMap.h:184

◆ getTrigEvtMap()

bool evgMxc::getTrigEvtMap ( epicsUInt16  trigEvt) const

Definition at line 94 of file evgMxc.cpp.

94  {
95  if(trigEvt > 7)
96  throw std::runtime_error("EVG Mxc Trig Event ID too large. Max: 7");
97 
98  epicsUInt32 mask = 1 << (trigEvt+MuxControl_TrigMap_SHIFT);
99  return READ32(m_pReg, MuxControl(m_id))&mask;
100 }
#define READ32(base, offset)
Definition: mrfCommonIO.h:114
#define MuxControl_TrigMap_SHIFT
Definition: evgRegMap.h:186

◆ lock()

virtual void evgMxc::lock ( ) const
inlinevirtual

Implements mrf::Object.

Definition at line 15 of file evgMxc.h.

15 {};

◆ setFrequency()

void evgMxc::setFrequency ( epicsFloat64  freq)

Definition at line 65 of file evgMxc.cpp.

65  {
66  epicsUInt32 clkSpeed = (epicsUInt32)(getFrequency() *
67  pow(10.0, 6));
68  epicsUInt32 preScaler = (epicsUInt32)((epicsFloat64)clkSpeed / freq);
69 
70  setPrescaler(preScaler);
71 }
void setPrescaler(epicsUInt32)
Definition: evgMxc.cpp:51
epicsFloat64 getFrequency() const
Definition: evgMxc.cpp:74

◆ setPolarity()

void evgMxc::setPolarity ( bool  polarity)

Definition at line 38 of file evgMxc.cpp.

38  {
39  if(polarity)
40  BITSET32(m_pReg, MuxControl(m_id), MuxControl_Pol);
41  else
42  BITCLR32(m_pReg, MuxControl(m_id), MuxControl_Pol);
43 }
#define BITSET32(base, offset, mask)
Definition: mrfCommonIO.h:124
#define BITCLR32(base, offset, mask)
Definition: mrfCommonIO.h:129
#define MuxControl_Pol
Definition: evgRegMap.h:183

◆ setPrescaler()

void evgMxc::setPrescaler ( epicsUInt32  preScaler)

Definition at line 51 of file evgMxc.cpp.

51  {
52  if(preScaler == 0 || preScaler == 1)
53  throw std::runtime_error("Invalid preScaler value in Multiplexed Counter. Value should not be 0 or 1.");
54 
55  WRITE32(m_pReg, MuxPrescaler(m_id), preScaler);
56 }
#define WRITE32(base, offset, value)
Definition: mrfCommonIO.h:119

◆ setTrigEvtMap()

void evgMxc::setTrigEvtMap ( epicsUInt16  trigEvt,
bool  ena 
)

Definition at line 82 of file evgMxc.cpp.

82  {
83  if(trigEvt > 7)
84  throw std::runtime_error("EVG Mxc Trig Event ID too large. Max: 7");
85 
86  epicsUInt32 mask = 1 << (trigEvt+MuxControl_TrigMap_SHIFT);
87  if(ena)
88  BITSET32(m_pReg, MuxControl(m_id), mask);
89  else
90  BITCLR32(m_pReg, MuxControl(m_id), mask);
91 }
#define BITSET32(base, offset, mask)
Definition: mrfCommonIO.h:124
#define MuxControl_TrigMap_SHIFT
Definition: evgRegMap.h:186
#define BITCLR32(base, offset, mask)
Definition: mrfCommonIO.h:129

◆ unlock()

virtual void evgMxc::unlock ( ) const
inlinevirtual

Implements mrf::Object.

Definition at line 16 of file evgMxc.h.

16 {};

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