Dawn Framework 1.0
Universal data acquisition framework for embedded systems
common.hxx
1// dawn/include/dawn/prog/common.hxx
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#pragma once
7
8#include <cstdlib>
9
10#include "dawn/common/bindable.hxx"
11#include "dawn/porting/config.hxx"
12
13namespace dawn
14{
15// Forward declaration
16
17class CIOCommon;
18struct io_ddata_t;
19
26
28{
29public:
31
32 enum
33 {
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
101
103
105
107
109
110 PROG_CLASS_BITSPLIT = 20,
111 PROG_CLASS_TOGGLE = 21,
112 PROG_CLASS_COUNTER = 22,
113 PROG_CLASS_SWITCH = 23,
114 PROG_CLASS_EXPRESSION = 24,
115 PROG_CLASS_SELECTOR = 25,
116 PROG_CLASS_BITPACK = 26,
117 PROG_CLASS_CONFIGWRITER = 27,
118 PROG_CLASS_VECPACK = 28,
119 PROG_CLASS_VECSPLIT = 29,
120 PROG_CLASS_MANYTOONE = 30,
121 PROG_CLASS_ONETOMANY = 31,
122 PROG_CLASS_IOMUX = 32,
123 PROG_CLASS_IODEMUX = 33,
124 PROG_CLASS_AHRS = 34,
125 PROG_CLASS_BITMERGE = 35,
126 PROG_CLASS_SATURATE = 36,
127
129
131 PROG_CLASS_LAST
132 } typedef EProgClass;
133
134 static_assert(PROG_CLASS_LAST - 1 <= SObjectId::CLS_MAX);
135
137
138 enum
139 {
140 PROG_CFG_FIRST = 0,
141 PROG_CFG_LAST = 31
142 };
143
151
152 explicit CProgCommon(CDescObject &desc);
153
154protected:
165
166 int prepareWritableTarget(CIOCommon *io, size_t dim, bool notify, size_t batch = 1);
167
181
182 static size_t contiguousCount(io_ddata_t *d, size_t nbatch, size_t nitems);
183};
184} // Namespace dawn
CBindableObject(CDescObject &desc)
Construct a CBindableObject from a descriptor.
Definition bindable.hxx:33
Base class for all I/O objects.
Definition common.hxx:30
int prepareWritableTarget(CIOCommon *io, size_t dim, bool notify, size_t batch=1)
Check a writable output; shape a deferred virt output or check an already shaped one.
Definition common.cxx:45
EProgClass
Program object class types.
Definition common.hxx:33
@ PROG_CLASS_LATEST
Cache latest notified sample for fetch-based readers.
Definition common.hxx:80
@ PROG_CLASS_MOVING_AVG
Moving average filter.
Definition common.hxx:88
@ PROG_CLASS_IIR_FILTER
First-order IIR filter.
Definition common.hxx:92
@ PROG_CLASS_DUMMY
Dummy program (test/helper).
Definition common.hxx:68
@ PROG_CLASS_THRESHOLD_VALUE
Threshold comparator returning gated source value.
Definition common.hxx:100
@ PROG_CLASS_STATS_MAX
Maximum value tracker.
Definition common.hxx:44
@ PROG_CLASS_USER
User-defined PROG types start here.
Definition common.hxx:130
@ PROG_CLASS_STATS_MIN
Minimum value tracker.
Definition common.hxx:40
@ PROG_CLASS_GATEWAY
Protocol-to-protocol IO gateway.
Definition common.hxx:76
@ PROG_CLASS_SEQUENCER
Periodic state sequencer.
Definition common.hxx:108
@ PROG_CLASS_ANY
Generic PROG type.
Definition common.hxx:36
@ PROG_CLASS_STATS_SUM
Sum accumulator.
Definition common.hxx:52
@ PROG_CLASS_BUFFER
Notify-driven history capture buffer.
Definition common.hxx:104
@ PROG_CLASS_SAMPLING
Periodic data sampler.
Definition common.hxx:64
@ PROG_CLASS_THRESHOLD
Threshold and hysteresis comparator.
Definition common.hxx:96
@ PROG_CLASS_REDIRECT
Generic input-to-output routing bridge.
Definition common.hxx:84
@ PROG_CLASS_STATS_RMS
Running RMS (root mean square) calculator.
Definition common.hxx:60
@ PROG_CLASS_ADJUST
Scale/offset adjustment.
Definition common.hxx:72
@ PROG_CLASS_STATS_COUNT
Sample counter.
Definition common.hxx:56
@ PROG_CLASS_STATS_AVG
Running average calculator.
Definition common.hxx:48
CProgCommon(CDescObject &desc)
Constructor.
Definition common.cxx:17
static size_t contiguousCount(io_ddata_t *d, size_t nbatch, size_t nitems)
Count elements of the first nbatch batches stored back to back.
Definition common.cxx:25
Out-of-tree user-extension hooks for Dawn.
Definition bindable.hxx:13
Heap-allocated dynamic I/O data buffer.
Definition ddata.hxx:21