Skip to main content

SecureStorageController Class

Namespace: GHIElectronics.TinyCLR.Devices.SecureStorage · Assembly: GHIElectronics.TinyCLR.Devices.SecureStorage

Reads and writes blocks in one of the chip's secure non-volatile regions. Pick the region in the constructor; subsequent calls operate on that region.

public class SecureStorageController

Constructors

SecureStorageController(SecureStorage secureStorage)

public SecureStorageController(SecureStorage secureStorage)

Opens a controller bound to the given region.

ParameterTypeDescription
secureStorageSecureStorageWhich region to operate on.

Properties

BlockSize

public uint BlockSize { get; }

Block (write) granularity of the region, in bytes.

TotalSize

public uint TotalSize { get; }

Total size of the region, in bytes.

Methods

Write(uint blockIndex, byte[] data)

public int Write(uint blockIndex, byte[] data)

Writes one block at the given block index.

ParameterTypeDescription
blockIndexuintIndex of the block to write (0-based).
databyte[]Block contents. Length must equal BlockSize.

Returns int — Bytes actually written.

Read(uint blockIndex, byte[] data)

public int Read(uint blockIndex, byte[] data)

Reads one block at the given block index.

ParameterTypeDescription
blockIndexuintIndex of the block to read (0-based).
databyte[]Destination buffer. Length must equal BlockSize.

Returns int — Bytes actually read.

Erase()

public void Erase()

Erases the entire region. Not supported for OTP storage.

IsBlank(uint blockIndex)

public bool IsBlank(uint blockIndex)

Returns true if the addressed block is in its erased (all-0xFF) state.

ParameterTypeDescription
blockIndexuint

Returns bool