6#include "dawn/io/trigger.hxx"
10#include "dawn/debug.hxx"
11#include "dawn/io/common.hxx"
15int CIOTrigger::configureDesc(
const CDescObject &desc)
21 for (i = 0; i < desc.
getSize(); i++)
27 DAWNERR(
"unsupported trigger cfg 0x%" PRIx32
"\n", item->
cfgid.
v);
37 for (
size_t j = 0; j < item->
cfgid.
s.
size; j++)
51 const uint32_t *tmp =
reinterpret_cast<const uint32_t *
>(&item->
data);
60 DAWNERR(
"unsupported trigger cfg 0x%" PRIx32
"\n", item->
cfgid.
v);
69CIOTrigger::~CIOTrigger()
103 uint8_t cmd = *
reinterpret_cast<const uint8_t *
>(data.
getDataPtr());
135 DAWNERR(
"invalid trigger command %d\n", cmd);
140 if (!(allowed & mask))
142 DAWNERR(
"trigger command %d not allowed\n", cmd);
148 DAWNERR(
"no bound targets\n");
152 for (
CObject *target : targets)
154 int r = target->trigger(cmd);
156 if (r < 0 && r != -ENOTSUP)
158 DAWNERR(
"trigger failed %d\n", r);
168 return sizeof(uint8_t);
176int CIOTrigger::bind(
CObject *obj)
178 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_TRIGGER
Trigger I/O.
int configure()
Configure object from descriptor data.
size_t getDataDim() const
Get data vector dimension.
@ IO_TRIGGER_CFG_ALLOCOBJ
Bound object ID list.
@ IO_TRIGGER_CFG_ALLOWED
Allowed commands bitmask.
int setDataImpl(IODataCmn &data)
Set data implementation (override in derived classes).
std::vector< SObjectId::ObjectId > ids
Object IDs to resolve; populated during configure().
int getDataImpl(IODataCmn &data, size_t len)
Get data implementation (override in derived classes).
int deinit()
De-initialize object.
@ TRIG_ALLOW_TRIGGER3
Allow CMD_TRIGGER3 command.
@ TRIG_ALLOW_TRIGGER1
Allow CMD_TRIGGER1 command.
@ TRIG_ALLOW_RESET
Allow CMD_RESET command.
@ TRIG_ALLOW_TRIGGER2
Allow CMD_TRIGGER2 command.
size_t getDataSize() const
Get data size in bytes.
Base class for all Dawn objects (IOs, Programs, Protocols).
CDescObject & getDesc()
Get descriptor object for this object.
@ CMD_RESET
Reset object internal state.
@ CMD_TRIGGER3
Object-specific trigger slot 3.
@ CMD_TRIGGER2
Object-specific trigger slot 2.
@ CMD_TRIGGER1
Object-specific trigger slot 1.
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.