Dawn Framework 1.0
Universal data acquisition framework for embedded systems
descobject.cxx
1// dawn/src/common/descobject.cxx
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#include "dawn/common/descobject.hxx"
7
8#include "dawn/debug.hxx"
9
10using namespace dawn;
11
13{
14 return cfgobj.objid;
15}
16
18{
19 return cfgobj.objid.v;
20}
21
23{
24 return cfgobj.objid.s.cls;
25}
26
28{
29 return cfgobj.objid.s.type;
30}
31
33{
34 return cfgobj.objid.s.dtype;
35}
36
38{
39 return &cfgobj;
40}
41
43{
44 // NOTE: offset starts from cfg.items
45 return reinterpret_cast<SObjectCfg::SObjectCfgItem *>(
46 (reinterpret_cast<uint32_t *>(&cfgobj.items)) + offset);
47};
48
50{
52 offset += 1 + item->cfgid.s.size;
53 return item;
54}
55
60
62{
63 return cfgobj.size;
64}
65
67{
68 return size;
69}
70
71uint32_t CDescObject::getAtOffset(size_t offset) const
72{
73 // NOTE: offset starts from the beginning of descriptor
74 return (reinterpret_cast<uint32_t *>(&cfgobj))[offset];
75}
size_t getSizeBytes() const
Get total size in bytes for this object definition.
size_t getSize() const
Get number of configuration items for this object.
SObjectCfg::SObjectCfgItem * objectCfgItemId(SObjectCfg::ObjectCfgId id) const
Get configuration item with specified ConfigID.
uint8_t getObjectType() const
Get object type field.
SObjectCfg::SObjectCfgItem * objectCfgItemAtOffset(size_t offset) const
Get configuration item at specified offset.
uint32_t getAtOffset(size_t offset) const
Get 32-bit word at specified offset.
SObjectCfg::SObjectCfgItem * objectCfgItemNext(size_t &offset) const
Get config item at current offset and advance past it.
uint16_t getObjectCls() const
Get object class field.
SObjectId::ObjectId getObjectIdV() const
Get object identifier as raw 32-bit value.
uint8_t getObjectDtype() const
Get data type field.
SObjectCfg::SObjectCfgData * getCfg() const
Get underlying descriptor data structure.
SObjectId::UObjectId & getObjectId() const
Get object identifier as union structure.
uint32_t ObjectCfgId
ConfigID type - single 32-bit value.
Definition objectcfg.hxx:60
static SObjectCfgItem * objectCfgFromCfgId(const SObjectCfgData &cfg, ObjectCfgId id)
Get item from configuration ID.
Definition objectcfg.cxx:12
Out-of-tree user-extension hooks for Dawn.
Definition bindable.hxx:13
Object configuration data container.
SObjectId::UObjectId objid
Object identifier (type, class, dtype, instance).
SObjectCfgItem items
First configuration item (array continues in memory).
uint32_t size
Number of configuration items for this object (0-32).
Single configuration item within object.
UObjectCfgId cfgid
Configuration ID header (type, class, id, size, rw, dtype).
uint32_t ObjectId
ObjectID type - single 32-bit value.
Definition objectid.hxx:44
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
ObjectId v
Raw 32-bit ObjectID value (for comparison, hashing, storage).
Definition objectid.hxx:221
uint32_t dtype
Data type field (bits 16-19, see EObjectDataType).
Definition objectid.hxx:249
uint32_t type
Object type field (bits 30-31, see EObjectIdType).
Definition objectid.hxx:273
uint32_t cls
Object class field (bits 21-29, max 511).
Definition objectid.hxx:265
struct dawn::SObjectId::UObjectId::@14 s
Bit-field structure for named member access.