28 if (start > end || start == 0 || end == 0) {
69 if (!slotOut)
return false;
71 uint32_t slot =
static_cast<uint32_t
>(
rmemStart_) + logicalIndex;
73 *slotOut =
static_cast<uint16_t
>(slot);
84 if (!logicalIndexOut)
return false;
86 if (slot < rmemStart_ || slot >
rmemEnd_)
return false;
87 *logicalIndexOut =
static_cast<uint16_t
>(slot -
rmemStart_);
97 if (!slotOut)
return false;
101 if (cap == 0)
return false;
102 auto used = std::unique_ptr<bool[]>(
new (std::nothrow)
bool[cap]);
103 if (!used)
return false;
104 std::memset(used.get(), 0, cap *
sizeof(
bool));
113 auto* c =
static_cast<Ctx*
>(user);
114 if (slot < c->base)
return;
115 uint16_t idx = slot - c->base;
124 for (uint16_t i = 0; i < cap; i++) {
126 uint16_t candidate =
static_cast<uint16_t
>(
rmemStart_ + i);
128 *slotOut = candidate;
Manages logical-to-physical RMEM slot mapping for module storage layers.
uint16_t rmemStart() const
Returns configured RMEM start slot.
bool toLogicalSlot(uint16_t slot, uint16_t *logicalIndexOut) const
Converts physical RMEM slot to logical index.
uint16_t capacity() const
Returns available entry capacity from configured slot range.
bool findFreeSlot(uint16_t *slotOut) const
Finds first free physical slot in configured range.
void setSlotRange(const IModule::SlotRange &range)
Configures logical-to-physical slot mapping from a SlotRange struct.
uint8_t moduleId() const
Returns configured owning module identifier.
uint16_t rmemEnd() const
Returns configured RMEM end slot.
bool hasSlotRange() const
Returns whether a valid slot range is configured.
bool toPhysicalSlot(uint16_t logicalIndex, uint16_t *slotOut) const
Converts logical index to physical RMEM slot.
void setSlotRange(uint16_t start, uint16_t end, uint8_t moduleId)
Configures logical-to-physical slot mapping using raw values.
static TropicStorage & instance()
Returns singleton instance of TROPIC metadata cache manager.
bool forEachSlot(uint8_t moduleId, SlotCallback cb, void *ctx)
Iterates all cached slots for one module across its allowed range.