6#include "dawn/dev/descriptor.hxx"
20 if (inst > 0 && (reg.
ptr ==
nullptr || reg.
len == 0))
25 regDesc[inst].ptr = reg.
ptr;
26 regDesc[inst].len = reg.
len;
27#if CONFIG_DAWN_DESC_SLOTS > 1
30 slotWritten[
static_cast<size_t>(inst - 1)] = reg.
len;
44 reg.
ptr = regDesc[inst].ptr;
45 reg.
len = regDesc[inst].len;
52#if CONFIG_DAWN_DESC_SLOTS <= 1
67 if (len > 0 && data ==
nullptr)
72 if (offset > SLOT_SIZE || len > SLOT_SIZE - offset)
77 slot_idx =
static_cast<size_t>(inst - 1);
82 std::memcpy(&slotBuf[slot_idx][offset], data, len);
87 slotWritten[slot_idx] = len;
89 else if (end > slotWritten[slot_idx])
91 slotWritten[slot_idx] = end;
94 regDesc[inst].ptr = slotBuf[slot_idx].data();
95 regDesc[inst].len = slotWritten[slot_idx];
103#if CONFIG_DAWN_DESC_SLOTS <= 1
112 return slotWritten[
static_cast<size_t>(inst - 1)];
118#if CONFIG_DAWN_DESC_SLOTS <= 1
129 slot_idx =
static_cast<size_t>(inst - 1);
130 std::memset(slotBuf[slot_idx].data(), 0, SLOT_SIZE);
131 slotWritten[slot_idx] = 0;
132 regDesc[inst].ptr =
nullptr;
133 regDesc[inst].len = 0;
int resetSlot(int inst)
Reset a RAM slot.
int getDescriptor(int inst, SDescriptorReg ®)
Get registered descriptor data for an instance.
int regDescriptor(int inst, const SDescriptorReg ®)
Register descriptor data for an instance.
int writeSlotData(int inst, const void *data, size_t offset, size_t len)
Write descriptor bytes into a RAM slot.
static int MAX_DESCRIPTORS
Maximum number of descriptors that can be registered.
size_t getSlotWritten(int inst) const
Get valid byte count currently stored in a RAM slot.
Out-of-tree user-extension hooks for Dawn.
Registered descriptor information.
size_t len
Descriptor length in bytes.
void * ptr
Pointer to descriptor data.