6#include "dawn/io/common.hxx"
13int CIOCommon::configureDesc(
const CDescObject &desc)
18 for (
size_t i = 0; i < desc.
getSize(); i++)
32 if (item->
data[0] > INT_MAX)
37 devno =
static_cast<int>(item->
data[0]);
47 reinterpret_cast<const uint32_t *
>(&item->
data[0])) < 0)
61 reinterpret_cast<const uint32_t *
>(&item->
data[0])) < 0)
75 reinterpret_cast<const uint32_t *
>(&item->
data[0])) < 0)
86#ifdef CONFIG_DAWN_IO_NOTIFY
87 notifyType =
static_cast<uint8_t
>(item->
data[0]);
88 notifyPrio =
static_cast<int>(item->
data[1]);
89 notifyBatch =
static_cast<size_t>(item->
data[2]);
101 DAWNERR(
"Unsupported common config 0x%08" PRIx32
"\n", item->
cfgid.
v);
118#ifdef CONFIG_DAWN_IO_NOTIFY
127#ifdef CONFIG_DAWN_IO_HAS_STATS
130 stats.read_count = 0;
131 stats.write_count = 0;
132 stats.error_count = 0;
171 DAWNERR(
"unsupported common cfg 0x08%" PRIx32
"\n", cfg->
cfgid.
v);
181 DAWNERR(
"unsupported common cfg 0x08%" PRIx32
"\n", cfg->
cfgid.
v);
196#if defined(CONFIG_DAWN_IO_TIMESTAMP) || defined(CONFIG_DAWN_IO_TIMESTAMPIO)
199 clock_systime_timespec(&ts);
200 return 1000000ull * ts.tv_sec + ts.tv_nsec / 1000;
206#ifdef CONFIG_DAWN_IO_NOTIFY
209 DAWNASSERT(n,
"notifier is nullptr");
222 DAWNERR(
"notifier=NULL!\n");
233 return notifier->regNotifier(n);
243 return notifier->notifyData(
this, data);
252#ifdef CONFIG_DAWN_IO_SEEKABLE
261 DAWNERR(
"ddata_alloc: seekable IO requires chunk_size > 0\n");
265 chunk = dsize > 0 && chunk_size < dsize ? chunk_size : dsize;
272 if (data ==
nullptr || !data->isAllocated())
293 DAWNERR(
"tsize == 0");
298 if (data ==
nullptr || !data->isAllocated())
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.
SObjectId::UObjectId & getObjectId() const
Get object identifier as union structure.
CIOCommon(CDescObject &desc)
Construct CIOCommon from descriptor.
@ IO_CFG_LIMIT_STEP
Step limit words.
@ IO_CFG_NOTIFY
Notifier configuration (type + priority)
@ IO_CFG_LIMIT_MIN
Minimum limit words.
@ IO_CFG_LIMIT_MAX
Maximum limit words.
@ IO_CFG_DEVNO
Device number configuration.
uint64_t getTimestamp()
Get current timestamp.
virtual bool isSeekable() const
Check if IO supports partial (seekable) access.
bool isTimestamp() const
Check if I/O supports timestamp.
@ IO_NOTIFY_POLL
Poll-based notifier (default)
virtual size_t getDataDim() const =0
Get data vector dimension.
io_ddata_t * ddata_alloc(size_t batch, size_t chunk_size=0)
Allocate data buffer for this I/O.
virtual size_t getDataSize() const =0
Get data size in bytes.
@ IO_FLAGS_TS
Timestamp support flag.
size_t cfgCmnOffset(const SObjectCfg::SObjectCfgItem *cfg)
Get offset of configuration item in descriptor.
@ IO_CLASS_ANY
Any I/O class.
@ IO_CLASS_LAST
Last I/O class marker.
@ CFG_LIMIT_STEP
Step limit words.
@ CFG_LIMIT_MIN
Minimum limit words.
@ CFG_LIMIT_MAX
Maximum limit words.
int bind(uint8_t id, uint8_t dtype, size_t words, const uint32_t *data)
Bind one limit config item.
void reset()
Reset all configured limits.
Base class for all Dawn objects (IOs, Programs, Protocols).
uint16_t getPriv() const
Get instance/private data field.
uint8_t getFlags() const
Get type-specific flags field.
uint8_t getDtype() const
Get data type field.
Abstract interface for registering asynchronous I/O notification.
int(* notifier_cb_t)(void *priv, io_ddata_t *data)
Notifier callback function type.
Out-of-tree user-extension hooks for Dawn.
Notifier registration structure.
CIOCommon * io
I/O object pointer.
int(* cb)(void *priv, io_ddata_t *data)
Notifier callback function type.
void * priv
Private context pointer.
int prio
Notification callback priority.
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).
@ DTYPE_UINT8
Unsigned 8-bit integer (0 to 255).
Heap-allocated dynamic I/O data buffer.
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).
uint32_t dtype
Configuration data type (bits 16-19).
struct dawn::SObjectCfg::UObjectCfgId::@10 s
Bit-field structure for named member access.
uint32_t cls
Object class field (bits 21-29, max 511).
struct dawn::SObjectId::UObjectId::@14 s
Bit-field structure for named member access.