nRF Connect SDK API 3.3.99
Loading...
Searching...
No Matches
implementation.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
12#ifndef NRF_COMPRESS_IMPLEMENTATION_H_
13#define NRF_COMPRESS_IMPLEMENTATION_H_
14
15#include "lzma_types.h"
16#include <stdint.h>
17#include <stdlib.h>
18#include <zephyr/kernel.h>
19#include <zephyr/types.h>
20#include <zephyr/sys/iterable_sections.h>
21
28#ifdef __cplusplus
29extern "C" {
30#endif
31
46typedef int (*nrf_compress_init_func_t)(void *inst, size_t decompressed_size);
47
58typedef int (*nrf_compress_deinit_func_t)(void *inst);
59
75typedef int (*nrf_compress_reset_func_t)(void *inst, size_t decompressed_size);
76
87typedef int (*nrf_compress_compress_func_t)(void *inst);
88
102typedef size_t (*nrf_compress_decompress_bytes_needed_t)(void *inst);
103
132typedef int (*nrf_compress_decompress_func_t)(void *inst, const uint8_t *input, size_t input_size,
133 bool last_part, uint32_t *offset, uint8_t **output,
134 size_t *output_size);
135
150
153 const uint16_t id;
154
158
159#if defined(CONFIG_NRF_COMPRESS_COMPRESSION) || defined(__DOXYGEN__)
161#endif
162
163#if defined(CONFIG_NRF_COMPRESS_DECOMPRESSION) || defined(__DOXYGEN__)
166#endif
167};
168
188#define NRF_COMPRESS_IMPLEMENTATION_DEFINE(name, _id, _init, _deinit, _reset, _compress, \
189 _decompress_bytes_needed, _decompress) \
190 STRUCT_SECTION_ITERABLE(nrf_compress_implementation, name) = { \
191 .id = _id, \
192 .init = _init, \
193 .deinit = _deinit, \
194 .reset = _reset, \
195 COND_CODE_1(CONFIG_NRF_COMPRESS_COMPRESSION, ( \
196 .compress = _compress, \
197 ), ()) \
198 COND_CODE_1(CONFIG_NRF_COMPRESS_DECOMPRESSION, ( \
199 .decompress_bytes_needed = _decompress_bytes_needed, \
200 .decompress = _decompress, \
201 ), ()) \
202 }
203
213
214#ifdef __cplusplus
215}
216#endif
217
220#endif /* NRF_COMPRESS_IMPLEMENTATION_H_ */
int(* nrf_compress_deinit_func_t)(void *inst)
De-initialize compression implementation.
Definition implementation.h:58
size_t(* nrf_compress_decompress_bytes_needed_t)(void *inst)
Return chunk size of data to provide to next call of nrf_compress_decompress_func_t function....
Definition implementation.h:102
int(* nrf_compress_compress_func_t)(void *inst)
Placeholder function for future use, do not use.
Definition implementation.h:87
int(* nrf_compress_reset_func_t)(void *inst, size_t decompressed_size)
Reset compression state function. Used to abort current compression or decompression task before star...
Definition implementation.h:75
int(* nrf_compress_init_func_t)(void *inst, size_t decompressed_size)
Initialize compression implementation.
Definition implementation.h:46
nrf_compress_types
Supported compression types.
Definition implementation.h:137
@ NRF_COMPRESS_TYPE_LZMA
Definition implementation.h:139
@ NRF_COMPRESS_TYPE_ARM_THUMB
Definition implementation.h:142
@ NRF_COMPRESS_TYPE_COUNT
Definition implementation.h:145
@ NRF_COMPRESS_TYPE_USER_CUSTOM_START
Definition implementation.h:148
int(* nrf_compress_decompress_func_t)(void *inst, const uint8_t *input, size_t input_size, bool last_part, uint32_t *offset, uint8_t **output, size_t *output_size)
Decompress portion of compressed data. This function will need to be called one or more times with co...
Definition implementation.h:132
struct nrf_compress_implementation * nrf_compress_implementation_find(uint16_t id)
Find a compression implementation.
LZMA API types for compression/decompression subsystem.
const nrf_compress_decompress_func_t decompress
Definition implementation.h:165
const nrf_compress_reset_func_t reset
Definition implementation.h:157
const nrf_compress_decompress_bytes_needed_t decompress_bytes_needed
Definition implementation.h:164
const nrf_compress_deinit_func_t deinit
Definition implementation.h:156
const nrf_compress_init_func_t init
Definition implementation.h:155
const nrf_compress_compress_func_t compress
Definition implementation.h:160
const uint16_t id
ID of implementation nrf_compress_types.
Definition implementation.h:153
Definition implementation.h:151