6#include "dawn/common/object.hxx"
11#include "dawn/debug.hxx"
12#include "dawn/io/common.hxx"
13#include "dawn/prog/common.hxx"
14#include "dawn/proto/common.hxx"
18#ifdef CONFIG_DAWN_OBJECT_HAS_NAME
23const char *CObject::getName()
const
28 const char *class_name = getClassNameStr();
29 snprintf(name,
sizeof(name),
"%s_%u", class_name, uobjid.
s.
priv);
30 name[
sizeof(name) - 1] =
'\0';
50 if (len < 4 || len %
sizeof(uint32_t))
52 return DESCVALID_ERR_LEN_ALIGN;
57 len = len /
sizeof(uint32_t);
62 return DESCVALID_ERR_NO_OBJSIZE;
70 return static_cast<int>(i);
75 return DESCVALID_ERR_NO_CFG_HEADER;
78 for (
size_t j = 0; j < objsize; j++)
86 if (objcfg.
s.
size == 0 && j == objsize - 1)
91 return DESCVALID_ERR_CFG_TRUNCATED;
94 for (
size_t k = 0; k < objcfg.
s.
size; k++)
101 if (k == (
size_t)(objcfg.
s.
size - 1))
106 return DESCVALID_ERR_CFG_DATA;
115 return DESCVALID_ERR_LEN_ALIGN;
118 return static_cast<int>(i);
137 len -= ret *
sizeof(uint32_t);
142 DAWNERR(
"len=%d i=%d ret=%d\n", (
int)len, (
int)i, ret);
167 return uobjid.
s.
type;
187 return uobjid.
s.
priv;
210 DAWNERR(
"objectCfg is not RW: %" PRIx32
"\n", objcfg);
218 DAWNERR(
"invalid size: %" PRIx32
"\n", objcfg);
236 std::memcpy(&item->
data, data, l *
sizeof(uint32_t));
249 DAWNERR(
"invalid size: %" PRIx32
"\n", objcfg);
260 std::memcpy(data, &item->
data, l *
sizeof(uint32_t));
Descriptor wrapper for individual object configuration.
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 getObjectDtype() const
Get data type field.
uint8_t getType() const
Get object type field.
uint16_t getPriv() const
Get instance/private data field.
uint16_t getCls() const
Get object class field.
uint8_t getFlags() const
Get type-specific flags field.
static int descValidDefault(const uint32_t *data, size_t len)
Default descriptor validation method.
virtual int onSetObjConfig(SObjectCfg::ObjectCfgId objcfg, uint32_t *data, size_t len)
Pre-update hook for runtime configuration writes.
SObjectId::ObjectId getIdV() const
Get object identifier as raw 32-bit value.
CDescObject & getDesc()
Get descriptor object for this object.
size_t getDtypeSize() const
Get size of this object's data type.
int getObjConfig(SObjectCfg::ObjectCfgId objcfg, uint32_t *data, size_t len)
Get object configuration item.
SObjectId::UObjectId getId() const
Get object identifier as union structure.
int setObjConfig(SObjectCfg::ObjectCfgId objcfg, uint32_t *data, size_t len)
Set object configuration item.
uint8_t getDtype() const
Get data type field.
static int validateDesc(const uint32_t *desc, size_t len)
Validate entire descriptor.
bool getCfgFlag() const
Check if configuration flag is set.
uint32_t ObjectCfgId
ConfigID type - single 32-bit value.
static uint16_t objectCfgGetSize(const ObjectCfgId objcfg)
Extract configuration data size from ConfigID.
static bool objectCfgGetRw(const ObjectCfgId objcfg)
Extract read-write access flag from ConfigID.
Out-of-tree user-extension hooks for Dawn.
Single configuration item within object.
ObjectCfgData_t data[]
Configuration data array (flexible, size from cfgid.s.size).
EObjectDataType
Data types supported by Dawn framework.
uint32_t ObjectId
ObjectID type - single 32-bit value.
static int getDtypeSize_(const EObjectDataType dtype)
Get byte size for a specific data type.
32-bit encoded configuration identifier (union with bit field).
ObjectCfgId v
Raw 32-bit ConfigID value (for storage, comparison).
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).
uint32_t priv
Instance/private data field (bits 0-13, max 16383).
ObjectId v
Raw 32-bit ObjectID value (for comparison, hashing, storage).
uint32_t dtype
Data type field (bits 16-19, see EObjectDataType).
uint32_t type
Object type field (bits 30-31, see EObjectIdType).
uint32_t cls
Object class field (bits 21-29, max 511).
uint32_t flags
Type-specific flags (bits 14-15, max 3).
struct dawn::SObjectId::UObjectId::@14 s
Bit-field structure for named member access.