nRF Connect SDK API 0.1.0
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 <stdint.h>
16#include <stdlib.h>
17#include <zephyr/kernel.h>
18#include <zephyr/types.h>
19#include <zephyr/sys/iterable_sections.h>
20
27#ifdef __cplusplus
28extern "C" {
29#endif
30
37typedef int (*nrf_compress_init_deinit_func_t)(void *inst);
38typedef int (*nrf_compress_reset_func_t)(void *inst);
40typedef int (*nrf_compress_compress_func_t)(void *inst);
41typedef size_t (*nrf_compress_decompress_bytes_needed_t)(void *inst);
42typedef int (*nrf_compress_decompress_func_t)(void *inst, const uint8_t *input, size_t input_size,
43 bool last_part, uint32_t *offset, uint8_t **output,
44 size_t *output_size);
45
54
57
59};
60
63 const uint16_t id;
64
73 const nrf_compress_init_deinit_func_t init;
74
83 const nrf_compress_init_deinit_func_t deinit;
84
94 const nrf_compress_reset_func_t reset;
95
96#if defined(CONFIG_NRF_COMPRESS_COMPRESSION) || defined(__DOXYGEN__)
98 const nrf_compress_compress_func_t compress;
99#endif
100
101#if defined(CONFIG_NRF_COMPRESS_DECOMPRESSION) || defined(__DOXYGEN__)
114 const nrf_compress_decompress_bytes_needed_t decompress_bytes_needed;
115
141 const nrf_compress_decompress_func_t decompress;
142#endif
143};
144
164#define NRF_COMPRESS_IMPLEMENTATION_DEFINE(name, _id, _init, _deinit, _reset, _compress, \
165 _decompress_bytes_needed, _decompress) \
166 STRUCT_SECTION_ITERABLE(nrf_compress_implementation, name) = { \
167 .id = _id, \
168 .init = _init, \
169 .deinit = _deinit, \
170 .reset = _reset, \
171 COND_CODE_1(CONFIG_NRF_COMPRESS_COMPRESSION, ( \
172 .compress = _compress, \
173 ), ()) \
174 COND_CODE_1(CONFIG_NRF_COMPRESS_DECOMPRESSION, ( \
175 .decompress_bytes_needed = _decompress_bytes_needed, \
176 .decompress = _decompress, \
177 ), ()) \
178 }
188
189#ifdef __cplusplus
190}
191#endif
192
195#endif /* NRF_COMPRESS_IMPLEMENTATION_H_ */
nrf_compress_types
Supported compression types.
Definition: implementation.h:51
@ NRF_COMPRESS_TYPE_LZMA
Definition: implementation.h:53
@ NRF_COMPRESS_TYPE_ARM_THUMB
Definition: implementation.h:56
@ NRF_COMPRESS_TYPE_COUNT
Definition: implementation.h:58
struct nrf_compress_implementation * nrf_compress_implementation_find(uint16_t id)
Find a compression implementation.
const nrf_compress_decompress_func_t decompress
Decompress portion of compressed data. This function will need to be called one or more times with co...
Definition: implementation.h:141
const nrf_compress_init_deinit_func_t init
Initialize compression implementation.
Definition: implementation.h:73
const nrf_compress_init_deinit_func_t deinit
Deinitialize compression implementation.
Definition: implementation.h:83
const nrf_compress_reset_func_t reset
Reset compression state function. Used to abort current compression or decompression task before star...
Definition: implementation.h:94
const nrf_compress_decompress_bytes_needed_t decompress_bytes_needed
Return chunk size of data to provide to next call of nrf_compress_decompress_func_t function....
Definition: implementation.h:114
const nrf_compress_compress_func_t compress
Placeholder function for future use, do not use.
Definition: implementation.h:98
const uint16_t id
Definition: implementation.h:63
Definition: implementation.h:61