Dawn Framework 1.0
Universal data acquisition framework for embedded systems
redirect.hxx
1// dawn/include/dawn/prog/redirect.hxx
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#pragma once
7
8#include <vector>
9
10#include "dawn/porting/config.hxx"
11#include "dawn/prog/common.hxx"
12
13namespace dawn
14{
15// Forward declaration
16
17class CIOCommon;
18class io_ddata_t;
19
29{
30public:
31 enum
32 {
33 PROG_REDIRECT_CFG_FIRST = 0,
34 PROG_REDIRECT_CFG_IOBIND = 1,
35 PROG_REDIRECT_CFG_LAST = 31
36 };
37
40 struct
41 {
44 } typedef SProgRedirectIOBind;
45
46 explicit CProgRedirect(CDescObject &desc)
47 : CProgCommon(desc)
48 {
49 }
50
51 ~CProgRedirect() override;
52
53#ifdef CONFIG_DAWN_OBJECT_HAS_NAME
54 const char *getClassNameStr() const override
55 {
56 return "redirect";
57 }
58#endif
59
60 int configure() override;
61 int init() override;
62 int deinit() override;
63 int doStart() override;
64 int doStop() override;
65 bool hasThread() const override;
66
67 constexpr static SObjectId::ObjectId objectId(uint16_t inst)
68 {
71 }
72
73 constexpr static SObjectCfg::ObjectCfgId cfgId(bool rw, uint8_t size, uint8_t id)
74 {
78 rw,
79 size,
80 id);
81 }
82
83 constexpr static SObjectCfg::ObjectCfgId cfgIdIOBind(uint16_t size)
84 {
85 return CProgRedirect::cfgId(false, size, PROG_REDIRECT_CFG_IOBIND);
86 }
87
88private:
89 struct SRedirectBind
90 {
91 SProgRedirectIOBind cfg;
92 CIOCommon *src;
93 CIOCommon *dst;
94 bool active;
95 };
96
97 std::vector<SRedirectBind *> binds;
98
99 int configureDesc(const CDescObject &desc);
100 int allocObject(const SProgRedirectIOBind *cfg);
101
102#ifdef CONFIG_DAWN_IO_NOTIFY
103 static int ioNotifierCb(void *priv, io_ddata_t *data);
104#endif
105};
106} // Namespace dawn
Descriptor wrapper for individual object configuration.
Base class for all PROG (processing) objects.
Definition common.hxx:27
@ PROG_CLASS_REDIRECT
Generic input-to-output routing bridge.
Definition common.hxx:83
Input-to-output routing Program.
Definition redirect.hxx:29
bool hasThread() const
Check if a background thread is active.
Definition redirect.cxx:237
int deinit()
De-initialize object.
Definition redirect.cxx:189
int init()
One-time initialize object after bindings are resolved.
Definition redirect.cxx:140
int doStop()
Stop implementation hook.
Definition redirect.cxx:222
int configure()
Configure object from descriptor data.
Definition redirect.cxx:122
int doStart()
Start implementation hook.
Definition redirect.cxx:204
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
One redirect binding payload (2 uint32_t words).
Definition redirect.hxx:41
@ 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
32-bit encoded object identifier (union with bit field).
Definition objectid.hxx:218