My Project
evr.h
1 /*************************************************************************\
2 * Copyright (c) 2010 Brookhaven Science Associates, as Operator of
3 * Brookhaven National Laboratory.
4 * Copyright (c) 2015 Paul Scherrer Institute (PSI), Villigen, Switzerland
5 * mrfioc2 is distributed subject to a Software License Agreement found
6 * in file LICENSE that is included with this distribution.
7 \*************************************************************************/
8 /*
9  * Author: Michael Davidsaver <mdavidsaver@gmail.com>
10  */
11 
12 #ifndef EVR_HPP_INC
13 #define EVR_HPP_INC
14 
15 #include <epicsTypes.h>
16 #include <epicsTime.h>
17 #include <callback.h>
18 #include <dbScan.h>
19 
20 #include "evr/output.h"
21 #include "mrf/object.h"
22 
23 #include "configurationInfo.h"
24 
25 class Pulser;
26 class PreScaler;
27 class Input;
28 class CML;
29 class DelayModuleEvr;
30 
31 enum TSSource {
32  TSSourceInternal=0,
33  TSSourceEvent=1,
34  TSSourceDBus4=2
35 };
36 
45 class epicsShareClass EVR : public mrf::ObjectInst<EVR>
46 {
47 public:
48  EVR(const std::string& n, bus_configuration& busConfig) : mrf::ObjectInst<EVR>(n), busConfiguration(busConfig) {}
49 
50  virtual ~EVR()=0;
51 
53  virtual std::string model() const=0;
54 
56  virtual MRFVersion version() const=0;
57  std::string versionStr() const;
59  virtual std::string versionSw() const;
60  virtual std::string getCommitHash() const;
61 
63  virtual std::string position() const;
64  bus_configuration* getBusConfiguration();
65 
69  virtual bool enabled() const=0;
70  virtual void enable(bool)=0;
73  virtual bool mappedOutputState() const=0;
74 
82  virtual bool specialMapped(epicsUInt32 code, epicsUInt32 func) const=0;
83  virtual void specialSetMap(epicsUInt32 code, epicsUInt32 func,bool set)=0;
84 
91 
95  virtual double clock() const=0;
99  virtual void clockSet(double clk)=0;
100 
102  virtual bool pllLocked() const=0;
103 
105  virtual epicsUInt32 uSecDiv() const=0;
109  virtual bool extInhib() const=0;
110  virtual void setExtInhib(bool)=0;
111 
118  virtual void setSourceTS(TSSource)=0;
119  virtual TSSource SourceTS() const=0;
120 
124  virtual double clockTS() const=0;
128  virtual void clockTSSet(double)=0;
129 
131  virtual epicsUInt32 tsDiv() const=0;
132 
136  virtual bool interestedInEvent(epicsUInt32 event,bool set)=0;
137 
138 
139  virtual bool TimeStampValid() const=0;
140  virtual IOSCANPVT TimeStampValidEvent() const=0;
141 
149  virtual bool getTimeStamp(epicsTimeStamp *ts,epicsUInt32 event)=0;
150 
155  virtual bool getTicks(epicsUInt32 *tks)=0;
156 
157  virtual IOSCANPVT eventOccurred(epicsUInt32 event) const=0;
158 
159  typedef void (*eventCallback)(void* userarg, epicsUInt32 event);
160  virtual void eventNotifyAdd(epicsUInt32 event, eventCallback, void*)=0;
161  virtual void eventNotifyDel(epicsUInt32 event, eventCallback, void*)=0;
164  virtual epicsUInt32 irqCount() const=0;
165 
169  virtual bool linkStatus() const=0;
170  virtual IOSCANPVT linkChanged() const=0;
171  virtual epicsUInt32 recvErrorCount() const=0;
174  virtual epicsUInt16 dbus() const=0;
175 
176  virtual epicsUInt32 heartbeatTIMOCount() const=0;
177  virtual IOSCANPVT heartbeatTIMOOccured() const=0;
178 
179  virtual epicsUInt32 FIFOFullCount() const=0;
180  virtual epicsUInt32 FIFOOverRate() const=0;
181  virtual epicsUInt32 FIFOEvtCount() const=0;
182  virtual epicsUInt32 FIFOLoopCount() const=0;
183 
184 
190  void setSourceTSraw(epicsUInt32 r){setSourceTS((TSSource)r);};
191  epicsUInt32 SourceTSraw() const{return (TSSource)SourceTS();};
194 #ifdef DBR_UTAG
200  virtual epicsUTag getUtag(const epicsUInt32 event) const {return 0;};
201  virtual void setUtag(epicsUTag tag, const epicsUInt32 event) {};
203 #endif
204 
205 private:
206  bus_configuration busConfiguration;
207 }; // class EVR
208 
209 #endif // EVR_HPP_INC
Base interface for EVRs.
Definition: evr.h:46
virtual bool pllLocked() const =0
Internal PLL Status.
virtual double clock() const =0
virtual epicsUInt32 uSecDiv() const =0
Approximate divider from event clock period to 1us.
virtual bool getTimeStamp(epicsTimeStamp *ts, epicsUInt32 event)=0
virtual std::string model() const =0
Hardware model.
virtual bool specialMapped(epicsUInt32 code, epicsUInt32 func) const =0
virtual void clockSet(double clk)=0
virtual void clockTSSet(double)=0
virtual epicsUInt32 tsDiv() const =0
When using internal TS source gives the divider from event clock period to TS period.
virtual bool getTicks(epicsUInt32 *tks)=0
virtual MRFVersion version() const =0
Firmware Version.
virtual bool extInhib() const =0
Using external hardware input for inhibit?
virtual bool interestedInEvent(epicsUInt32 event, bool set)=0
virtual void setSourceTS(TSSource)=0
Select source which increments TS counter.
virtual double clockTS() const =0
A programmable delay unit.
Definition: pulser.h:40
User implementation hook.
Definition: object.h:460