ACQ400_XRM (xrmIoc)
Loading...
Searching...
No Matches
acq400_asynPortDriver.h
Go to the documentation of this file.
1/** @file acq400_asynPortDriver.h
2 * @brief common base class connects all acq400 PortDriver implementations
3 *
4 * Created on: 6 Mar 2026
5 * Author: pgm
6 */
7
8#ifndef XRMIOCAPP_SRC_ACQ400_ASYNPORTDRIVER_H_
9#define XRMIOCAPP_SRC_ACQ400_ASYNPORTDRIVER_H_
10
11#include "acq400_asyn_common.h"
12
13#define PS_RUNSTOP "RUNSTOP" /* asynInt32, r/w */
14#define PS_UPDATES "UPDATES" /* asynInt32, r/c */
15#define PS_TS_USEC "TS_USEC" /* asynInt32, ro */
16#define PS_MON_RL "MON_RL" /* asynInt32, r/w, "Monitor Rate Limit" */
17
18/**
19 * common base class connects all acq400 PortDriver implementations
20 */
21class acq400_asynPortDriver: public asynPortDriver {
22protected:
23 /**
24 * get integer parameter
25 * @param pnum: parameter number
26 * @param pram: outputs value
27 * @return: asynStatus
28 */
29 asynStatus gip(int pnum, int* pram);
30 /**
31 * get integer parameter
32 * @param addr: address number .. for objects with address dimension (typical: CH)
33 * @param pnum: parameter number
34 * @param pram: outputs value
35 * @return: asynStatus
36 */
37 asynStatus gip(int addr, int pnum, int* pram);
38 /**
39 * set integer parameter
40 * @param addr: address number .. for objects with address dimension (typical: CH)
41 * @param pnum: parameter number
42 * @param pram: outputs value
43 * @return: asynStatus
44 */
45 asynStatus sip(int addr, int pnum, int pram);
46 asynStatus sip(int addr, int pnum, unsigned pram);
47 asynStatus sip(int addr, int pnum, epicsInt64 pram);
48 asynStatus sip(int addr, int pnum, double pram);
49
50 /**
51 * get string parameter
52 * @param pnum: parameter number
53 * @param maxchar: maximum length of client buffer
54 * @param str: buffer holds client copy of string on success
55 * @return: asynStatus
56 */
57 asynStatus gsp(int pnum, int maxchar, char* str);
58 asynStatus ssp(int pnum, const char* str);
59
60 epicsEventId eventId; /**< synchronize main thread with task */
61
62 int P_RUNSTOP; /**< RUNSTOP button. Either UI or set on boot */
63 int P_UPDATES; /**< reports number of updates eg task loops */
64 int P_TS_USEC; /**< reports TimeStamp in USEC */
65 int P_MON_RL; /**< controls Monitor Rate Limit, mbbi with MRL values */
66
67 /**
68 * controls update rate and hence cpu consumption per object.
69 */
70 class MonitorRateLimit {
71 epicsTimeStamp et0;
72 bool go_ahead;
73 public:
74 enum MRL {
75 DIS_MON, /**< DISable MONitor, ie no output */
76 LIM_1Hz, /**< LIMit output to 1Hz. */
77 LIM_2Hz, /**< LIMit output to 2Hz. */
78 LIM_5Hz, /**< LIMit output to 5Hz. */
79 LIM_10Hz, /**< LIMit output to 10Hz. */
80 LIM_NOLIM /**< NO LIMIT, update at incoming rate */
81 };
82
84 /** ratelimit allows client to proceed with update */
85 bool goAhead() {
86 return go_ahead;
87 }
88 /** client calls this to signal new data has arrived;
89 * whether the client should process it or not depends on goAhead()
90 */
91 void newData(int mrl);
92 };
93 int mrl_param; // MUST be explicitly set by client ::writeInt32()
94 unsigned update;
95public:
96 /** single public constructor */
97 acq400_asynPortDriver(const char *portName, int maxAddr, int interfaceMask, int interruptMask,
98 int asynFlags, int autoConnect, int priority, int stackSize);
99 /** virtual destructor allows subclass override; default is a null function */
101};
102
103
104#endif /* XRMIOCAPP_SRC_ACQ400_ASYNPORTDRIVER_H_ */
Definition acq400_asynPortDriver.h:70
void newData(int mrl)
Definition acq400_asynPortDriver.cpp:119
bool goAhead()
Definition acq400_asynPortDriver.h:85
MRL
Definition acq400_asynPortDriver.h:74
@ LIM_NOLIM
Definition acq400_asynPortDriver.h:80
@ LIM_2Hz
Definition acq400_asynPortDriver.h:77
@ DIS_MON
Definition acq400_asynPortDriver.h:75
@ LIM_5Hz
Definition acq400_asynPortDriver.h:78
@ LIM_10Hz
Definition acq400_asynPortDriver.h:79
@ LIM_1Hz
Definition acq400_asynPortDriver.h:76
int P_UPDATES
Definition acq400_asynPortDriver.h:63
int P_MON_RL
Definition acq400_asynPortDriver.h:65
int P_RUNSTOP
Definition acq400_asynPortDriver.h:62
asynStatus sip(int addr, int pnum, int pram)
Definition acq400_asynPortDriver.cpp:52
epicsEventId eventId
Definition acq400_asynPortDriver.h:60
acq400_asynPortDriver(const char *portName, int maxAddr, int interfaceMask, int interruptMask, int asynFlags, int autoConnect, int priority, int stackSize)
Definition acq400_asynPortDriver.cpp:16
asynStatus gsp(int pnum, int maxchar, char *str)
Definition acq400_asynPortDriver.cpp:94
int P_TS_USEC
Definition acq400_asynPortDriver.h:64
virtual ~acq400_asynPortDriver()
Definition acq400_asynPortDriver.h:100
asynStatus gip(int pnum, int *pram)
Definition acq400_asynPortDriver.cpp:31