11.12.3.4.93. Function Se05x_API_GetFreeMemory

11.12.3.4.93.1. Function Documentation

smStatus_t Se05x_API_GetFreeMemory(pSe05xSession_t session_ctx, SE05x_MemoryType_t memoryType, uint16_t *pfreeMem)

Se05x_API_GetFreeMemory

Gets the amount of free memory. MemoryType indicates the type of memory.

The result indicates the amount of free memory. Note that behavior of the function might not be fully linear and can have a granularity of 16 bytes where the applet will typically report the “worst case” amount. For example, when allocating 2 bytes a time, the first report will show 16 bytes being allocated, which remains the same for the next 7 allocations of 2 bytes.

Command to Applet

Field

Value

Description

CLA

0x80

INS

INS_MGMT

See SE05x_INS_t

P1

P1_DEFAULT

See SE05x_P1_t

P2

P2_MEMORY

See SE05x_P2_t

Lc

#(Payload)

TLV[TAG_1]

SE05x_MemTyp_t

Le

0x04

Expecting TLV with 2-byte data.

R-APDU Body

Value

Description

TLV[TAG_1]

2 bytes indicating the amount of free memory of the requested memory type. 0x7FFF as response means at least 32768 bytes are available.

R-APDU Trailer

SW

Description

SW_NO_ERROR

Data is returned successfully.

Return

The sm status.

Parameters
  • [in] session_ctx: The session context

  • [in] memoryType: The memory type

  • pfreeMem: The pfree memory