6#include "dawn/dev/descriptor.hxx"
22 if (inst > 0 && (reg.
ptr ==
nullptr || reg.
len == 0))
27 regDesc[inst].
ptr = reg.
ptr;
28 regDesc[inst].
len = reg.
len;
29#if CONFIG_DAWN_DESC_SLOTS > 1
32 slotWritten[
static_cast<size_t>(inst - 1)] = reg.
len;
46 reg.
ptr = regDesc[inst].
ptr;
47 reg.
len = regDesc[inst].
len;
54#if CONFIG_DAWN_DESC_SLOTS <= 1
69 if (len > 0 && data ==
nullptr)
74 if (offset > SLOT_SIZE || len > SLOT_SIZE - offset)
79 slot_idx =
static_cast<size_t>(inst - 1);
84 std::memcpy(&slotBuf[slot_idx][offset], data, len);
89 slotWritten[slot_idx] = len;
91 else if (end > slotWritten[slot_idx])
93 slotWritten[slot_idx] = end;
96 regDesc[inst].
ptr = slotBuf[slot_idx].data();
97 regDesc[inst].
len = slotWritten[slot_idx];
105#if CONFIG_DAWN_DESC_SLOTS <= 1
114 return slotWritten[
static_cast<size_t>(inst - 1)];
120#if CONFIG_DAWN_DESC_SLOTS <= 1
131 slot_idx =
static_cast<size_t>(inst - 1);
132 std::memset(slotBuf[slot_idx].data(), 0, SLOT_SIZE);
133 slotWritten[slot_idx] = 0;
134 regDesc[inst].
ptr =
nullptr;
135 regDesc[inst].
len = 0;
Descriptor interface available for IO.
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.