CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
cdc::core::TropicSlotMap Class Reference

#include <TropicSlotMap.h>

Classes

struct  SlotRange

Public Types

enum class  SlotType : uint8_t { ECC , RMEM }
using RangeCallback = void (*)(const SlotRange& range, void* user)

Public Member Functions

bool isValid () const
const char * errorMessage () const
bool getRangeByName (const char *moduleName, SlotType type, SlotRange *out) const
 Retrieves slot range by module name and slot type.
bool getRangeByModuleId (uint8_t moduleId, SlotType type, SlotRange *out) const
 Retrieves slot range by module id and slot type.
bool isRmemAllowedForModuleId (uint16_t slot, uint8_t moduleId) const
 Checks whether RMEM slot is allowed for given module id.
void forEachRange (SlotType type, RangeCallback cb, void *user) const
 Iterates configured slot ranges of the given type in declaration order.
uint16_t rmemMax () const
 Returns maximum RMEM slot index.
uint32_t computeMapSignature () const
 Computes deterministic signature over static map constants and ranges.

Static Public Member Functions

static TropicSlotMap & instance ()
 Returns singleton Tropic slot-map instance.

Detailed Description

Definition at line 7 of file TropicSlotMap.h.

Member Typedef Documentation

◆ RangeCallback

using cdc::core::TropicSlotMap::RangeCallback = void (*)(const SlotRange& range, void* user)

Definition at line 32 of file TropicSlotMap.h.

Member Enumeration Documentation

◆ SlotType

enum class cdc::core::TropicSlotMap::SlotType : uint8_t
strong
Enumerator
ECC 
RMEM 

Definition at line 9 of file TropicSlotMap.h.

Member Function Documentation

◆ computeMapSignature()

◆ errorMessage()

const char * cdc::core::TropicSlotMap::errorMessage ( ) const
inline

Definition at line 26 of file TropicSlotMap.h.

Referenced by cdc::ui::ui_init().

◆ forEachRange()

◆ getRangeByModuleId()

bool cdc::core::TropicSlotMap::getRangeByModuleId ( uint8_t moduleId,
SlotType type,
SlotRange * out ) const

◆ getRangeByName()

bool cdc::core::TropicSlotMap::getRangeByName ( const char * moduleName,
SlotType type,
SlotRange * out ) const

Retrieves slot range by module name and slot type.

Parameters
moduleNameModule map name.
typeSlot type.
outOutput range descriptor.
Returns
true when range is found.

Definition at line 141 of file TropicSlotMap.cpp.

References cdc::core::TropicSlotMap::SlotRange::end, cdc::core::kSlotMap, cdc::core::kSlotMapCount, cdc::core::TropicSlotMap::SlotRange::moduleId, cdc::core::TropicSlotMap::SlotRange::moduleName, cdc::core::TropicSlotMap::SlotRange::start, cdc::core::TropicSlotMap::SlotRange::type, and cdc::core::TropicSlotMap::SlotRange::valid.

◆ instance()

TropicSlotMap & cdc::core::TropicSlotMap::instance ( )
static

◆ isRmemAllowedForModuleId()

bool cdc::core::TropicSlotMap::isRmemAllowedForModuleId ( uint16_t slot,
uint8_t moduleId ) const

Checks whether RMEM slot is allowed for given module id.

Parameters
slotRMEM slot.
moduleIdModule identifier.
Returns
true if slot is inside module's RMEM range.

Definition at line 207 of file TropicSlotMap.cpp.

References cdc::core::TropicSlotMap::SlotRange::end, getRangeByModuleId(), moduleId, RMEM, and cdc::core::TropicSlotMap::SlotRange::start.

◆ isValid()

bool cdc::core::TropicSlotMap::isValid ( ) const
inline

Definition at line 25 of file TropicSlotMap.h.

◆ rmemMax()

uint16_t cdc::core::TropicSlotMap::rmemMax ( ) const

Returns maximum RMEM slot index.

Returns
Maximum RMEM slot value.

Definition at line 219 of file TropicSlotMap.cpp.

References cdc::tropic_map::RMEM_SLOT_MAX.

Referenced by cdc::core::TropicStorage::cleanup(), and cdc::core::TropicStorage::rebuildVerbose().


The documentation for this class was generated from the following files: