6#include "dawn/io/control.hxx"
10#include "dawn/debug.hxx"
11#include "dawn/io/common.hxx"
15int CIOControl::configureDesc(
const CDescObject &desc)
21 for (i = 0; i < desc.
getSize(); i++)
27 DAWNERR(
"unsupported control cfg 0x%" PRIx32
"\n", item->
cfgid.
v);
33 case IO_CONTROL_CFG_ALLOCOBJ:
37 for (
size_t j = 0; j < item->
cfgid.
s.
size; j++)
49 case IO_CONTROL_CFG_ALLOWED:
51 const uint32_t *tmp =
reinterpret_cast<const uint32_t *
>(&item->
data);
60 DAWNERR(
"unsupported control cfg 0x%" PRIx32
"\n", item->
cfgid.
v);
69CIOControl::~CIOControl()
102 DAWNERR(
"no bound targets\n");
106 tmp =
reinterpret_cast<uint8_t *
>(data.
getDataPtr());
107 *tmp =
static_cast<uint8_t
>(targets[0]->getState());
115 uint8_t cmd = *
reinterpret_cast<const uint8_t *
>(data.
getDataPtr());
123 DAWNERR(
"stop command not allowed\n");
127 for (
CObject *target : targets)
129 int r = target->stop();
133 DAWNERR(
"stop failed %d\n", r);
144 DAWNERR(
"start command not allowed\n");
148 for (
CObject *target : targets)
150 int r = target->start();
154 DAWNERR(
"start failed %d\n", r);
161 DAWNERR(
"invalid control command %d\n", cmd);
170 return sizeof(uint8_t);
178int CIOControl::bind(
CObject *obj)
180 targets.push_back(obj);
Descriptor wrapper for individual object configuration.
size_t getSize() const
Get number of configuration items for this object.
SObjectCfg::SObjectCfgItem * objectCfgItemAtOffset(size_t offset) const
Get configuration item at specified offset.
@ IO_CLASS_CONTROL
Control I/O.
size_t getDataDim() const
Get data vector dimension.
int setDataImpl(IODataCmn &data)
Set data implementation (override in derived classes).
int configure()
Configure object from descriptor data.
@ CTRL_ALLOW_STOP
Allow stop command.
@ CTRL_ALLOW_START
Allow start command.
int getDataImpl(IODataCmn &data, size_t len)
Get data implementation (override in derived classes).
std::vector< SObjectId::ObjectId > ids
Object IDs to resolve; populated during configure().
size_t getDataSize() const
Get data size in bytes.
int deinit()
De-initialize object.
Base class for all Dawn objects (IOs, Programs, Protocols).
CDescObject & getDesc()
Get descriptor object for this object.
Out-of-tree user-extension hooks for Dawn.
Base interface for I/O data buffers (static and dynamic).
virtual void * getDataPtr(size_t batch=0)=0
Get pointer to data only (skips timestamp if present).
Single configuration item within object.
ObjectCfgData_t data[]
Configuration data array (flexible, size from cfgid.s.size).
UObjectCfgId cfgid
Configuration ID header (type, class, id, size, rw, dtype).
uint32_t ObjectId
ObjectID type - single 32-bit value.
ObjectCfgId v
Raw 32-bit ConfigID value (for storage, comparison).
uint32_t cls
Object class (bits 21-29, max 511).
uint32_t id
Configuration identifier (bits 0-4, max 31).
uint32_t size
Configuration data size in 32-bit words (bits 5-14, max 1023).
struct dawn::SObjectCfg::UObjectCfgId::@10 s
Bit-field structure for named member access.