12#include "dawn/common/thread.hxx"
13#include "dawn/porting/config.hxx"
14#include "dawn/prog/common.hxx"
33 constexpr static uint32_t INTERVAL_DEFAULT = CONFIG_DAWN_PROG_SAMPLING_INTERVAL;
37 PROG_SAMPLING_CFG_FIRST = 0,
42 PROG_SAMPLING_CFG_LAST = 31
52 , interval(INTERVAL_DEFAULT)
58 sem_init(&wakeup, 0, 0);
61 ~CProgSampling()
override;
63#ifdef CONFIG_DAWN_OBJECT_HAS_NAME
64 const char *getClassNameStr()
const override
77 int trigger(uint8_t cmd)
override;
120 class CIOCommon *src;
121 class CIOCommon *target;
125 std::vector<SSamplingBind *> binds;
126 std::atomic<uint32_t> interval;
129 std::atomic<bool> active;
130 std::atomic<bool> stopping;
132 CThreadedObject threadCtl;
134 int configureDesc(
const CDescObject &desc);
Descriptor wrapper for individual object configuration.
Base class for all I/O objects.
Base class for all PROG (processing) objects.
@ PROG_CLASS_SAMPLING
Periodic data sampler.
CProgCommon(CDescObject &desc)
Constructor.
Periodic data sampling and buffering Program.
int trigger(uint8_t cmd)
Execute a trigger command.
int doStart()
Start implementation hook.
bool hasThread() const
Check if a background thread is active.
@ FLAG_AUTO_START
Sample from start, without a trigger.
int configure()
Configure object from descriptor data.
int onSetObjConfig(SObjectCfg::ObjectCfgId objcfg, uint32_t *data, size_t len)
Pre-update hook for runtime configuration writes.
int init()
One-time initialize object after bindings are resolved.
int doStop()
Stop implementation hook.
int deinit()
De-initialize object.
@ PROG_SAMPLING_CFG_INTERVAL
Sampling interval (microseconds).
@ PROG_SAMPLING_CFG_IOBIND
I/O binding configuration.
@ PROG_SAMPLING_CFG_PRIORITY
Sampling thread priority (0 = default).
@ PROG_SAMPLING_CFG_FLAGS
Behavior flags.
Portable thread owner abstraction for Dawn components.
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.
Out-of-tree user-extension hooks for Dawn.
@ OBJTYPE_PROG
Program/algorithm object type.
@ DTYPE_ANY
Wildcard data type (matches any actual type).
uint32_t ObjectId
ObjectID type - single 32-bit value.
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.
Heap-allocated dynamic I/O data buffer.