57 #if __cplusplus>=201103L
59 using auto_ptr = std::unique_ptr<T>;
60 #define PTRMOVE(AUTO) std::move(AUTO)
63 #define PTRMOVE(AUTO) (AUTO)
73 #include <epicsVersion.h>
74 #include <epicsTypes.h>
75 #include <epicsTime.h>
76 #include <epicsMath.h>
77 #include <epicsInterrupt.h>
78 #include <epicsStdlib.h>
79 #include <epicsThread.h>
86 #include <menuYesNo.h>
96 #define MRF_NUM_EVENTS 256
97 #define MRF_EVENT_FIFO_SIZE 512
98 #define MRF_MAX_DATA_BUFFER 2048
99 #define MRF_FRAC_SYNTH_REF 24.0
100 #define MRF_DEF_CLOCK_SPEED 125.0
101 #define MRF_SN_BYTES 6
102 #define MRF_SN_STRING_SIZE 18
103 #define MRF_DESCRIPTION_SIZE 80
109 #define MRF_EVENT_NULL 0x00
113 #define MRF_EVENT_TS_SHIFT_0 0x70
114 #define MRF_EVENT_TS_SHIFT_1 0x71
116 #define MRF_EVENT_HEARTBEAT 0x7A
118 #define MRF_EVENT_RST_PRESCALERS 0x7B
120 #define MRF_EVENT_TS_COUNTER_INC 0x7C
124 #define MRF_EVENT_TS_COUNTER_RST 0x7D
126 #define MRF_EVENT_END_OF_SEQUENCE 0x7F
131 #define ER_PROVIDER_PRIORITY 50
137 #define MRF_BUS_COMPACT_PCI 0
138 #define MRF_BUS_PMC 1
139 #define MRF_BUS_VME 2
146 #define MRF_CARD_TYPE_EVR 1
147 #define MRF_CARD_TYPE_EVG 2
154 #define MRF_SERIES_200 0x000000C8
155 #define MRF_SERIES_220 0x000000DC
156 #define MRF_SERIES_230 0x000000E6
167 #ifdef EVENT_CLOCK_FREQ
168 #define EVENT_CLOCK_DEFAULT EVENT_CLOCK_FREQ
170 #define EVENT_CLOCK_DEFAULT 0.00
190 # if __cplusplus>=201103L
197 # if __cplusplus>=201103L
198 # define OVERRIDE override
204 template<
class Mutex>
210 scopedLock(Mutex& mutex,
bool lock=
true) : m(mutex), locked(lock)
218 inline void lock(){
if (!locked) m.lock();locked=
true;}
219 inline void unlock(){
if (locked) m.unlock();locked=
false;}
221 #define SCOPED_LOCK2(m, name) scopedLock<epicsMutex> name(m)
222 #define SCOPED_LOCK(m) SCOPED_LOCK2(m, m##_guard)
229 :key(epicsInterruptLock())
232 { epicsInterruptUnlock(key); }
239 std::ostringstream strm;
241 operator std::string()
const {
return strm.str(); }
243 SB& operator<<(T i) { strm<<i;
return *
this; }
259 class epicsShareClass MRFVersion
261 const epicsUInt16 m_major;
262 const epicsUInt8 m_minor;
265 explicit MRFVersion(epicsUInt32 regval)
266 :m_major(regval&0xffff) ,m_minor((regval>>16)&0xff)
268 inline MRFVersion(
unsigned fw,
unsigned rev,
unsigned sub=0)
269 :m_major((fw<<8)|rev), m_minor(sub)
272 inline unsigned firmware()
const {
return m_major>>8; }
273 inline unsigned revision()
const {
return m_major&0xff; }
274 inline unsigned subrelease()
const {
return m_minor; }
276 int compare(
const MRFVersion& o)
const;
277 inline bool operator>(
const MRFVersion& o)
const {
return compare(o)==1; }
278 inline bool operator<(
const MRFVersion& o)
const {
return compare(o)==-1; }
279 inline bool operator==(
const MRFVersion& o)
const {
return compare(o)==0; }
280 inline bool operator>=(
const MRFVersion& o)
const {
return compare(o)!=-1; }
281 inline bool operator<=(
const MRFVersion& o)
const {
return compare(o)!=1; }
283 std::string str()
const;
287 std::ostream& operator<<(std::ostream& strm,
const MRFVersion& ver);
291 template<
class C,
void (C::*Method)()>
292 class epicsShareClass epicsThreadRunableMethod :
public epicsThreadRunable
296 explicit epicsThreadRunableMethod(C& o)
299 virtual ~epicsThreadRunableMethod(){}
317 # define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P))
318 # define EPICS_VERSION_INT VERSION_INT(EPICS_VERSION, EPICS_REVISION, EPICS_MODIFICATION, EPICS_PATCH_LEVEL)
326 # define isfinite finite
333 epicsShareFunc epicsUInt32 roundToUInt(
double val, epicsUInt32 maxresult=0xffffffff);
335 epicsShareFunc
char *allocSNPrintf(
size_t N,
const char *fmt, ...) EPICS_PRINTF_STYLE(2,3);
347 #if (EPICS_VERSION_INT < VERSION_INT(3,15,0,2))
348 #if (__STDC_VERSION__ < 19990L) || (EPICS_VERSION_INT < VERSION_INT(3,14,9,0))
354 # if __STDC_VERSION__ >= 1990L
355 # include <inttypes.h>
356 typedef int64_t epicsInt64;
357 typedef uint64_t epicsUInt64;
363 # elif LONG_MAX > 0x7fffffffL
364 typedef long epicsInt64;
365 typedef unsigned long epicsUInt64;
367 typedef long long epicsInt64;
368 typedef unsigned long long epicsUInt64;
373 #define M_stdlib (527 <<16)
375 #define S_stdlib_noConversion (M_stdlib | 1)
376 #define S_stdlib_extraneous (M_stdlib | 2)
377 #define S_stdlib_underflow (M_stdlib | 3)
378 #define S_stdlib_overflow (M_stdlib | 4)
379 #define S_stdlib_badBase (M_stdlib | 5)
385 epicsParseUInt32(
const char *str, epicsUInt32 *to,
int base,
char **units);