Dawn Framework 1.0
Universal data acquisition framework for embedded systems
vecsplit.hxx
1// dawn/include/dawn/prog/vecsplit.hxx
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#pragma once
7
8#include <inttypes.h>
9#include <vector>
10
11#include "dawn/io/ddata.hxx"
12#include "dawn/prog/common.hxx"
13
14namespace dawn
15{
16class CIOCommon;
17
26{
27public:
28 enum
29 {
30 PROG_VECSPLIT_CFG_FIRST = 0,
31 PROG_VECSPLIT_CFG_SOURCE = 1,
32 PROG_VECSPLIT_CFG_OUTPUTS = 2,
33 PROG_VECSPLIT_CFG_LAST = 31
34 };
35
36 explicit CProgVecSplit(CDescObject &desc);
37 ~CProgVecSplit() override;
38
39#ifdef CONFIG_DAWN_OBJECT_HAS_NAME
40 const char *getClassNameStr() const override
41 {
42 return "vecsplit";
43 }
44#endif
45
46 int configure() override;
47 int init() override;
48 int deinit() override;
49 int doStart() override;
50 int doStop() override;
51 bool hasThread() const override;
52
53 constexpr static SObjectId::ObjectId objectId(uint16_t inst)
54 {
56 SObjectId::OBJTYPE_PROG, CProgCommon::PROG_CLASS_VECSPLIT, SObjectId::DTYPE_ANY, 0, inst);
57 }
58
59 constexpr static SObjectCfg::ObjectCfgId cfgId(bool rw, uint8_t size, uint8_t id)
60 {
62 CProgCommon::PROG_CLASS_VECSPLIT,
64 rw,
65 size,
66 id);
67 }
68
69 constexpr static SObjectCfg::ObjectCfgId cfgIdSource()
70 {
71 return CProgVecSplit::cfgId(false, 1, PROG_VECSPLIT_CFG_SOURCE);
72 }
73
74 constexpr static SObjectCfg::ObjectCfgId cfgIdOutputs(uint16_t size)
75 {
76 return CProgVecSplit::cfgId(false, size, PROG_VECSPLIT_CFG_OUTPUTS);
77 }
78
79private:
80 struct SVecOutput
81 {
82 CIOCommon *io;
84 io_ddata_t *data;
85 size_t offset;
86 };
87
88 CIOCommon *source;
89 SObjectId::ObjectId sourceId;
90 io_ddata_t *sourceData;
91 std::vector<SVecOutput> outputs;
92 bool active;
93 bool registered;
94
95 static int ioNotifierCb(void *priv, io_ddata_t *data);
96
97 int configureDesc(const CDescObject &desc);
98 int allocOutput(SObjectId::ObjectId ioId);
99 void updateOutputs(io_ddata_t *data);
100};
101} // namespace dawn
Descriptor wrapper for individual object configuration.
Base class for all I/O objects.
Definition common.hxx:27
Base class for all PROG (processing) objects.
Definition common.hxx:27
Vector splitter: splits one vector IO into multiple outputs.
Definition vecsplit.hxx:26
int configure()
Configure object from descriptor data.
Definition vecsplit.cxx:114
int init()
One-time initialize object after bindings are resolved.
Definition vecsplit.cxx:119
int doStart()
Start implementation hook.
Definition vecsplit.cxx:211
int doStop()
Stop implementation hook.
Definition vecsplit.cxx:232
int deinit()
De-initialize object.
Definition vecsplit.cxx:180
bool hasThread() const
Check if a background thread is active.
Definition vecsplit.cxx:244
static ObjectCfgId objectCfg(uint8_t type, uint16_t cls, uint8_t dtype, bool rw, uint16_t size, uint8_t id)
Construct 32-bit ConfigID from component fields.
uint32_t ObjectCfgId
ConfigID type - single 32-bit value.
Definition objectcfg.hxx:60
Out-of-tree user-extension hooks for Dawn.
Definition bindable.hxx:13
@ OBJTYPE_PROG
Program/algorithm object type.
Definition objectid.hxx:202
@ DTYPE_ANY
Wildcard data type (matches any actual type).
Definition objectid.hxx:68
uint32_t ObjectId
ObjectID type - single 32-bit value.
Definition objectid.hxx:44
static ObjectId objectId(uint8_t type, uint16_t cls, uint8_t dtype, uint8_t flags, uint16_t priv)
Construct 32-bit ObjectID from component fields.
Definition objectid.hxx:290
Heap-allocated dynamic I/O data buffer.
Definition ddata.hxx:21