Modules#

Lz4Context_t

LZ4 Decompressor#

LZ4 decompressor LZ4 is a lossless data compression algorithm that is focused on compression and decompression speed.

It belongs to the LZ77 family of byte-oriented compression schemes.

Typedefs#

typedef int32_t(*
Lz4DataWrite_t)(uint8_t *data, size_t length)

Function to output data from LZ4 decompressor.

typedef int32_t(*
Lz4DataRead_t)(size_t backtrackOffset, uint8_t *data, size_t length)

Function to read data into LZ4 decompressor.

Functions#

int32_t
lz4_init(Lz4Context_t *ctx, Lz4DataRead_t readFunction)

Initialize the LZ4 decompressor.

int32_t
lz4_decompress(Lz4Context_t *ctx, void *inputData, size_t inputLength, Lz4DataWrite_t writeFunction)

Decompress a chunk of data.

int32_t
lz4_finish(Lz4Context_t *ctx)

Finish decompressing data.

Macros#

#define

LZ4 state machine: Token byte.

#define

LZ4 state machine: Literal length byte.

#define

LZ4 state machine: Literal value byte.

#define

LZ4 state machine: LSB of match offset.

#define

LZ4 state machine: MSB of match offset.

#define

LZ4 state machine: Match length.

#define

LZ4 state machine: Backtracking to get matched data.

Typedef Documentation#

Lz4DataWrite_t#

typedef int32_t(* Lz4DataWrite_t) (uint8_t *data, size_t length) )(uint8_t *data, size_t length)

Function to output data from LZ4 decompressor.


Definition at line 59 of file platform/bootloader/parser/compression/btl_decompress_lz4.h

Lz4DataRead_t#

typedef int32_t(* Lz4DataRead_t) (size_t backtrackOffset, uint8_t *data, size_t length) )(size_t backtrackOffset, uint8_t *data, size_t length)

Function to read data into LZ4 decompressor.


Definition at line 61 of file platform/bootloader/parser/compression/btl_decompress_lz4.h

Function Documentation#

lz4_init#

int32_t lz4_init (Lz4Context_t * ctx, Lz4DataRead_t readFunction)

Initialize the LZ4 decompressor.

Parameters
N/Actx

Decompressor context

N/AreadFunction

Function pointer to read back previously written data

Returns

  • Error code


Definition at line 84 of file platform/bootloader/parser/compression/btl_decompress_lz4.h

lz4_decompress#

int32_t lz4_decompress (Lz4Context_t * ctx, void * inputData, size_t inputLength, Lz4DataWrite_t writeFunction)

Decompress a chunk of data.

Parameters
N/Actx

Decompressor context

N/AinputData

Compressed input data

N/AinputLength

Length of inputData in bytes

N/AwriteFunction

Function pointer that is called with decompressed data

Returns

  • Error code


Definition at line 95 of file platform/bootloader/parser/compression/btl_decompress_lz4.h

lz4_finish#

int32_t lz4_finish (Lz4Context_t * ctx)

Finish decompressing data.

Parameters
N/Actx

Decompressor context

Returns

  • Error code indicating success or failure

Return values

  • BOOTLOADER_OK: on success

  • BOOTLOADER_ERROR_COMPRESSION_STATE: if the last block wasn't completed


Definition at line 109 of file platform/bootloader/parser/compression/btl_decompress_lz4.h

Macro Definition Documentation#

LZ4_STATE_TOKEN#

#define LZ4_STATE_TOKEN
Value:
00U

LZ4 state machine: Token byte.


Definition at line 44 of file platform/bootloader/parser/compression/btl_decompress_lz4.h

LZ4_STATE_LITERAL_LENGTH#

#define LZ4_STATE_LITERAL_LENGTH
Value:
10U

LZ4 state machine: Literal length byte.


Definition at line 46 of file platform/bootloader/parser/compression/btl_decompress_lz4.h

LZ4_STATE_LITERAL_VALUE#

#define LZ4_STATE_LITERAL_VALUE
Value:
20U

LZ4 state machine: Literal value byte.


Definition at line 48 of file platform/bootloader/parser/compression/btl_decompress_lz4.h

LZ4_STATE_OFFSET_LSB#

#define LZ4_STATE_OFFSET_LSB
Value:
30U

LZ4 state machine: LSB of match offset.


Definition at line 50 of file platform/bootloader/parser/compression/btl_decompress_lz4.h

LZ4_STATE_OFFSET_MSB#

#define LZ4_STATE_OFFSET_MSB
Value:
35U

LZ4 state machine: MSB of match offset.


Definition at line 52 of file platform/bootloader/parser/compression/btl_decompress_lz4.h

LZ4_STATE_MATCH_LENGTH#

#define LZ4_STATE_MATCH_LENGTH
Value:
40U

LZ4 state machine: Match length.


Definition at line 54 of file platform/bootloader/parser/compression/btl_decompress_lz4.h

LZ4_STATE_BACKTRACKING#

#define LZ4_STATE_BACKTRACKING
Value:
50U

LZ4 state machine: Backtracking to get matched data.


Definition at line 56 of file platform/bootloader/parser/compression/btl_decompress_lz4.h