6#include "dawn/io/rand.hxx"
14#define RAND_DEVPATH "/dev/urandom"
22 for (i = 0; i < desc.
getSize(); i++)
34 const uint32_t *tmp = &item->
data[0];
46 DAWNERR(
"unsupported rand objectCfg 0x%" PRIx32
"\n", item->
cfgid.
v);
47 DAWNERR(
"Unsupported random source type\n");
63 DAWNERR(
"unsupported rand cfg 0x08%" PRIx32
"\n", item->
cfgid.
v);
81 val =
new (std::nothrow) uint8_t[
sizeof(tlen)]();
84 DAWNERR(
"new failed\n");
96 fd = open(RAND_DEVPATH, O_RDONLY);
99 DAWNERR(
"failed to open %s\n",
"/dev/urandom");
124 for (
size_t i = 0; i < len; i++)
131 DAWNERR(
"rand read failed %d\n", -errno);
134#ifdef CONFIG_DAWN_IO_RAND
151#ifdef CONFIG_DAWN_IO_NOTIFY
160 return timfd_start();
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.
virtual int getFd() const
Get file descriptor for notifications.
uint64_t getTimestamp()
Get current timestamp.
size_t cfgCmnOffset(const SObjectCfg::SObjectCfgItem *cfg)
Get offset of configuration item in descriptor.
@ IO_CLASS_ANY
Any I/O class.
@ IO_CLASS_RAND
Random number generator.
int getDataImpl(IODataCmn &data, size_t len)
Get data implementation (override in derived classes).
@ IO_RAND_CFG_INTERVAL
Interval configuration in microseconds.
size_t getDataSize() const
Get data size in bytes.
int configure()
Configure object from descriptor data.
size_t getDataDim() const
Get data vector dimension.
int doStart()
Start implementation hook.
int doStop()
Stop implementation hook.
int deinit()
De-initialize object.
CDescObject & getDesc()
Get descriptor object for this object.
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).
virtual uint64_t & getTs(size_t batch=0)=0
Get timestamp reference for batch.
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).
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.