ACQ400_XRM (xrmIoc)
Loading...
Searching...
No Matches
acq400_FMT_rx.h
Go to the documentation of this file.
1/** @file acq400_FMT_rx.h
2 * @brief define FMT receiver class
3 *
4 * Created on: 18 Feb 2026
5 * Author: pgm
6 */
7
8#ifndef XRMIOCAPP_SRC_ACQ400_FMT_RX_H_
9#define XRMIOCAPP_SRC_ACQ400_FMT_RX_H_
10
11#include <deque>
12#include "acq400_FMT.h"
13
14#define PS_FMT_PM_TRG_EVT "FMT_PM_TRG_EVT" /* asynInt32, rw */
15#define PS_FMT_PM_TRG_EVT_ACTION "FMT_PM_TRG_EVT_ACTION" /* asynInt32, ro */
16
17#define PS_NULL_FMT_COUNT "NULL_FMT_COUNT" /* asynInt32, rw */
18
19#define NO_TRG_EVT 0
20
21/** FMT receiver
22 * - singleton - must bind to port.
23 */
24class acq400_FMT_rx: public acq400_FMT_abc {
25
26 virtual void update_fmt(FMT& fmt, bool first_time = false);
27 /**< basic housekeeping and instrumentation */
28 int packet_count;
29 epicsInt64 ts;
30 int fmt_pm_trg_evt;
31
32 int get_empty();
33 FMT& receive(MultiCast& multicast);
34protected:
35 static int maxq;
36 FMT* fmt_cache; /* fmt_cache[maxq] possible store for short list of FMT instances */
37 std::deque<int> empties; /* indexes fmt_cache .. avoid copy */
38 std::deque<int> filled; /* indexes fmt_cache .. avoid copy; push from front, [0] is latest */
39
40 virtual void task();
41 virtual void process_fmt(FMT& fmt, bool first_time);
42 /**< main processing here */
43
44 acq400_FMT_rx(const char* portName);
45
46 epicsEventId rx_event;
47
48 int P_FMT_PM_TRG_EVT;
49 int P_FMT_PM_TRG_EVT_ACTION;
50 int P_NULL_FMT_COUNT;
51
52 int null_fmt_count;
53
54 static FMT null_fmt;
55public:
56
57 virtual ~acq400_FMT_rx();
58
59 const FMT& get_fmt(unsigned icache);
60 const epicsUInt16 getFMT_pm_trg_evt();
61 /**< returns true it pm_trg_evt is selected */
62
63 int waitFMT(unsigned timeout_ms);
64 /**< clients block for FMT arrival. */
65
66 asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
67
68 static acq400_FMT_rx* instance(const char* portName = 0);
69 /**< singleton factory: first caller MUST set portName */
70
71 void onPM_trg_evt();
72 /**< called if PM_trg_evt detected */
73
74 inline static bool isNull(const FMT& fmt){
75 const FMT_ROW row = fmt[0];
76 return row.event == 0 && row.timestamp == 0;
77 }
78 inline static bool hasEvent(const FMT& fmt){
79 const FMT_ROW row = fmt[0];
80 return row.event !=0 && row.timestamp != 0;
81 }
82};
83
84
85
86#endif /* XRMIOCAPP_SRC_ACQ400_FMT_RX_H_ */
Fermi Multicast Table Abstract Base Class Created on: 16 Feb 2026 Author: pgm.
Definition Multicast.h:11
static acq400_FMT_rx * instance(const char *portName=0)
Definition acq400_FMT_rx.cpp:261
const epicsUInt16 getFMT_pm_trg_evt()
Definition acq400_FMT_rx.cpp:151
int waitFMT(unsigned timeout_ms)
Definition acq400_FMT_rx.cpp:231
void onPM_trg_evt()
Definition acq400_FMT_rx.cpp:191
virtual void process_fmt(FMT &fmt, bool first_time)
Definition acq400_FMT_rx.cpp:100
FMT_ROW defines a row of FMT:
Definition xrm_structs.h:20
epicsInt64 timestamp
Definition xrm_structs.h:24
epicsUInt16 event
Definition xrm_structs.h:21
struct FMT_ROW FMT[FMT_ROWS]
FMT : FNAL Multicast Table.
Definition xrm_structs.h:57