25 #include <epicsTime.h> 26 #include <epicsThread.h> 27 #include <epicsMessageQueue.h> 29 #include <epicsMutex.h> 62 typedef std::set<EVRMRMTSBuffer*>
tbufs_t;
67 typedef std::list<std::pair<EVR::eventCallback,void*> >
notifiees_t;
75 ,last_evt(0), waitingfor(0), again(false)
103 size_t nOFP, nOFPUV,
nORB, nOBack;
114 volatile unsigned char*,epicsUInt32);
121 virtual void lock() const OVERRIDE FINAL {evrLock.lock();}
122 virtual void unlock() const OVERRIDE FINAL {evrLock.unlock();};
124 virtual std::string model()
const OVERRIDE FINAL;
125 epicsUInt32 fpgaFirmware();
127 std::string formFactorStr();
128 virtual MRFVersion version()
const OVERRIDE FINAL;
131 virtual bool enabled()
const OVERRIDE FINAL;
132 virtual void enable(
bool v) OVERRIDE FINAL;
134 virtual bool mappedOutputState()
const OVERRIDE FINAL;
138 virtual bool specialMapped(epicsUInt32
code, epicsUInt32 func)
const OVERRIDE FINAL;
139 virtual void specialSetMap(epicsUInt32 code, epicsUInt32 func,
bool) OVERRIDE FINAL;
141 virtual double clock() const OVERRIDE FINAL
142 {SCOPED_LOCK(evrLock);
return eventClock;}
143 virtual void clockSet(
double) OVERRIDE FINAL;
145 epicsUInt16 clockMode()
const;
146 void clockModeSet(epicsUInt16 mode);
148 virtual bool pllLocked()
const OVERRIDE FINAL;
150 virtual epicsUInt32
irqCount() const OVERRIDE FINAL {
return count_hardware_irq;}
152 virtual bool linkStatus()
const OVERRIDE FINAL;
153 virtual IOSCANPVT
linkChanged() const OVERRIDE FINAL{
return IRQrxError;}
154 virtual epicsUInt32
recvErrorCount() const OVERRIDE FINAL{
return count_recv_error;}
156 virtual epicsUInt32 uSecDiv()
const OVERRIDE FINAL;
159 virtual bool extInhib()
const OVERRIDE FINAL;
160 virtual void setExtInhib(
bool) OVERRIDE FINAL;
162 virtual epicsUInt32
tsDiv() const OVERRIDE FINAL
163 {SCOPED_LOCK(evrLock);
return shadowCounterPS;}
165 virtual void setSourceTS(
TSSource) OVERRIDE FINAL;
167 {SCOPED_LOCK(evrLock);
return shadowSourceTS;}
168 virtual double clockTS()
const OVERRIDE FINAL;
169 virtual void clockTSSet(
double) OVERRIDE FINAL;
170 virtual bool interestedInEvent(epicsUInt32 event,
bool set) OVERRIDE FINAL;
172 virtual bool TimeStampValid()
const OVERRIDE FINAL;
175 virtual bool getTimeStamp(epicsTimeStamp *ts,epicsUInt32 event) OVERRIDE FINAL;
176 virtual bool getTicks(epicsUInt32 *tks) OVERRIDE FINAL;
177 virtual IOSCANPVT eventOccurred(epicsUInt32 event)
const OVERRIDE FINAL;
178 virtual void eventNotifyAdd(epicsUInt32, eventCallback,
void*) OVERRIDE FINAL;
179 virtual void eventNotifyDel(epicsUInt32, eventCallback,
void*) OVERRIDE FINAL;
181 bool convertTS(epicsTimeStamp* ts);
183 virtual epicsUInt16 dbus()
const OVERRIDE FINAL;
189 {SCOPED_LOCK(evrLock);
return count_FIFO_overflow;}
191 {SCOPED_LOCK(evrLock);
return count_FIFO_sw_overrate;}
192 virtual epicsUInt32
FIFOEvtCount() const OVERRIDE FINAL {
return count_fifo_events;}
193 virtual epicsUInt32
FIFOLoopCount() const OVERRIDE FINAL {
return count_fifo_loops;}
195 void enableIRQ(
void);
197 bool dcEnabled()
const;
198 void dcEnable(
bool v);
199 double dcTarget()
const;
200 void dcTargetSet(
double);
204 double dcInternal()
const;
205 epicsUInt32 dcStatusRaw()
const;
206 epicsUInt32 topId()
const;
208 epicsUInt32
dummy()
const {
return 0; }
209 void setEvtCode(epicsUInt32 code) OVERRIDE FINAL;
211 epicsUInt32 timeSrc()
const;
212 void setTimeSrc(epicsUInt32 mode);
214 static void isr(
EVRMRM *evr,
bool pci);
215 static void isr_pci(
void*);
216 static void isr_vme(
void*);
217 static void isr_poll(
void*);
218 #if defined(__linux__) || defined(_WIN32) 219 const void *isrLinuxPvt;
223 volatile unsigned char *
const base;
231 volatile epicsUInt32 count_recv_error;
232 volatile epicsUInt32 count_hardware_irq;
233 volatile epicsUInt32 count_heartbeat;
234 volatile epicsUInt32 count_fifo_events;
235 volatile epicsUInt32 count_fifo_loops;
237 epicsUInt32 shadowIRQEna;
240 epicsUInt32 count_FIFO_overflow;
243 IOSCANPVT IRQmappedEvent;
244 IOSCANPVT IRQheartbeat;
245 IOSCANPVT IRQrxError;
246 IOSCANPVT IRQfifofull;
249 IOSCANPVT timestampValidChange;
253 typedef std::vector<MRMInput*> inputs_t;
256 typedef std::map<std::pair<OutputType,epicsUInt32>,
MRMOutput*> outputs_t;
259 std::vector<DelayModule*> delays;
261 typedef std::vector<MRMPreScaler*> prescalers_t;
262 prescalers_t prescalers;
264 typedef std::vector<MRMPulser*> pulsers_t;
267 typedef std::vector<MRMCML*> shortcmls_t;
268 shortcmls_t shortcmls;
272 mrf::auto_ptr<EvrSeqManager> seq;
276 epicsThreadRunableMethod<EVRMRM, &EVRMRM::drain_fifo> drain_fifo_method;
277 epicsThread drain_fifo_task;
278 epicsMessageQueue drain_fifo_wakeup;
279 static void sentinel_done(CALLBACK*);
281 epicsUInt32 count_FIFO_sw_overrate;
289 CALLBACK poll_link_cb;
290 static void poll_link(CALLBACK*);
306 epicsUInt32 shadowCounterPS;
309 epicsUInt32 timestampValid;
310 epicsUInt32 lastInvalidTimestamp;
311 epicsUInt32 lastValidTimestamp;
312 static void seconds_tick(
void*, epicsUInt32);
316 epicsUInt32 _mapped[256];
318 void _map(epicsUInt8 evt, epicsUInt8 func) { _mapped[evt] |= 1<<(func); }
319 void _unmap(epicsUInt8 evt, epicsUInt8 func) { _mapped[evt] &= ~( 1<<(func) );}
320 bool _ismap(epicsUInt8 evt, epicsUInt8 func)
const {
return (_mapped[evt] & 1<<(func)) != 0; }
325 #endif // EVRMRML_H_INC
virtual IOSCANPVT TimeStampValidEvent() const OVERRIDE FINAL
epicsUInt32 dummy() const
std::set< EVRMRMTSBuffer * > tbufs_t
virtual epicsUInt32 recvErrorCount() const OVERRIDE FINAL
virtual double clock() const OVERRIDE FINAL
virtual epicsUInt32 FIFOOverRate() const OVERRIDE FINAL
virtual epicsUInt32 irqCount() const OVERRIDE FINAL
volatile unsigned char *const base
std::list< std::pair< EVR::eventCallback, void * > > notifiees_t
virtual epicsUInt32 heartbeatTIMOCount() const OVERRIDE FINAL
Modular Register Map Event Receivers.
virtual TSSource SourceTS() const OVERRIDE FINAL
virtual epicsUInt32 tsDiv() const OVERRIDE FINAL
When using internal TS source gives the divider from event clock period to TS period.
virtual void lock() const OVERRIDE FINAL
virtual epicsUInt32 FIFOLoopCount() const OVERRIDE FINAL
User implementation hook.
virtual epicsUInt32 FIFOEvtCount() const OVERRIDE FINAL
virtual epicsUInt32 FIFOFullCount() const OVERRIDE FINAL
virtual IOSCANPVT linkChanged() const OVERRIDE FINAL
epicsMutex evrLock
Guards access to instance All callers must take this lock before any operations on this object...
virtual IOSCANPVT heartbeatTIMOOccured() const OVERRIDE FINAL
virtual void unlock() const OVERRIDE FINAL