nRF Connect SDK API 2.8.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 <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
40typedef int (*nrf_compress_init_func_t)(void *inst);
41
51typedef int (*nrf_compress_deinit_func_t)(void *inst);
52
63typedef int (*nrf_compress_reset_func_t)(void *inst);
64
74typedef int (*nrf_compress_compress_func_t)(void *inst);
75
88typedef size_t (*nrf_compress_decompress_bytes_needed_t)(void *inst);
89
113typedef int (*nrf_compress_decompress_func_t)(void *inst, const uint8_t *input, size_t input_size,
114 bool last_part, uint32_t *offset, uint8_t **output,
115 size_t *output_size);
116
131
134 const uint16_t id;
135
139
140#if defined(CONFIG_NRF_COMPRESS_COMPRESSION) || defined(__DOXYGEN__)
142#endif
143
144#if defined(CONFIG_NRF_COMPRESS_DECOMPRESSION) || defined(__DOXYGEN__)
147#endif
148};
149
169#define NRF_COMPRESS_IMPLEMENTATION_DEFINE(name, _id, _init, _deinit, _reset, _compress, \
170 _decompress_bytes_needed, _decompress) \
171 STRUCT_SECTION_ITERABLE(nrf_compress_implementation, name) = { \
172 .id = _id, \
173 .init = _init, \
174 .deinit = _deinit, \
175 .reset = _reset, \
176 COND_CODE_1(CONFIG_NRF_COMPRESS_COMPRESSION, ( \
177 .compress = _compress, \
178 ), ()) \
179 COND_CODE_1(CONFIG_NRF_COMPRESS_DECOMPRESSION, ( \
180 .decompress_bytes_needed = _decompress_bytes_needed, \
181 .decompress = _decompress, \
182 ), ()) \
183 }
184
194
195#ifdef __cplusplus
196}
197#endif
198
201#endif /* NRF_COMPRESS_IMPLEMENTATION_H_ */
int(* nrf_compress_deinit_func_t)(void *inst)
De-initialize compression implementation.
Definition implementation.h:51
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:88
int(* nrf_compress_compress_func_t)(void *inst)
Placeholder function for future use, do not use.
Definition implementation.h:74
int(* nrf_compress_reset_func_t)(void *inst)
Reset compression state function. Used to abort current compression or decompression task before star...
Definition implementation.h:63
nrf_compress_types
Supported compression types.
Definition implementation.h:118
@ NRF_COMPRESS_TYPE_LZMA
Definition implementation.h:120
@ NRF_COMPRESS_TYPE_ARM_THUMB
Definition implementation.h:123
@ NRF_COMPRESS_TYPE_COUNT
Definition implementation.h:126
@ NRF_COMPRESS_TYPE_USER_CUSTOM_START
Definition implementation.h:129
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:113
int(* nrf_compress_init_func_t)(void *inst)
Initialize compression implementation.
Definition implementation.h:40
struct nrf_compress_implementation * nrf_compress_implementation_find(uint16_t id)
Find a compression implementation.
const nrf_compress_decompress_func_t decompress
Definition implementation.h:146
const nrf_compress_reset_func_t reset
Definition implementation.h:138
const nrf_compress_decompress_bytes_needed_t decompress_bytes_needed
Definition implementation.h:145
const nrf_compress_deinit_func_t deinit
Definition implementation.h:137
const nrf_compress_init_func_t init
Definition implementation.h:136
const nrf_compress_compress_func_t compress
Definition implementation.h:141
const uint16_t id
ID of implementation nrf_compress_types.
Definition implementation.h:134
Definition implementation.h:132