Dawn Framework 1.0
Universal data acquisition framework for embedded systems
dummy.cxx
1// dawn/src/proto/dummy.cxx
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#include "dawn/proto/dummy.hxx"
7
8#include "dawn/debug.hxx"
9
10using namespace dawn;
11
13{
14 const SObjectCfg::SObjectCfgItem *item = nullptr;
15 const SObjectId::UObjectId *ids;
16 size_t offset = 0;
17
18 while (offset < getDesc().getSize())
19 {
20 item = getDesc().objectCfgItemNext(offset);
21
23 {
24 DAWNERR("dummy proto: unsupported cfg 0x%08" PRIx32 "\n", item->cfgid.v);
25 return -EINVAL;
26 }
27
28 switch (item->cfgid.s.id)
29 {
31 {
32 size_t i;
33
34 ids = reinterpret_cast<const SObjectId::UObjectId *>(item->data);
35
36 for (i = 0; i < item->cfgid.s.size; i++)
37 {
38 setObjectMapItem(ids[i].v, nullptr);
39 }
40
41 break;
42 }
43
44 default:
45 {
46 DAWNERR("dummy proto: unsupported cfg 0x%08" PRIx32 "\n", item->cfgid.v);
47 return -EINVAL;
48 }
49 }
50 }
51
52 return OK;
53}
void setObjectMapItem(SObjectId::ObjectId id, CObject *obj)
Set an item in the object map.
Definition bindable.cxx:23
SObjectCfg::SObjectCfgItem * objectCfgItemNext(size_t &offset) const
Get config item at current offset and advance past it.
CDescObject & getDesc()
Get descriptor object for this object.
Definition object.cxx:190
@ PROTO_CLASS_DUMMY
Dummy protocol (test/helper).
Definition common.hxx:43
@ PROTO_DUMMY_CFG_IOBIND
I/O binding configuration.
Definition dummy.hxx:26
int configure()
Configure object from descriptor data.
Definition dummy.cxx:12
Out-of-tree user-extension hooks for Dawn.
Definition bindable.hxx:13
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).
ObjectCfgId v
Raw 32-bit ConfigID value (for storage, comparison).
Definition objectcfg.hxx:82
uint32_t cls
Object class (bits 21-29, max 511).
uint32_t id
Configuration identifier (bits 0-4, max 31).
Definition objectcfg.hxx:94
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.
32-bit encoded object identifier (union with bit field).
Definition objectid.hxx:218