Software APIs
lz4.h
1
// Copyright lowRISC contributors (OpenTitan project).
2
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3
// SPDX-License-Identifier: Apache-2.0
4
5
#ifndef OPENTITAN_SW_DEVICE_LIB_BASE_LZ4_H_
6
#define OPENTITAN_SW_DEVICE_LIB_BASE_LZ4_H_
7
8
#include <stddef.h>
9
10
#ifdef __cplusplus
11
extern
"C"
{
12
#endif
13
14
/**
15
* Decompresses a raw LZ4 block into a destination buffer.
16
*
17
* This implementation is designed specifically for constrained embedded
18
* environments. It performs no dynamic allocation and requires no
19
* framing metadata.
20
*
21
* @param src Pointer to the compressed data.
22
* @param dst Pointer to the destination buffer.
23
* @param compressed_size The exact size of the compressed data.
24
* @param dst_capacity The maximum capacity of the destination buffer.
25
* @return The number of bytes decompressed, or a negative value on error.
26
*/
27
int
LZ4_decompress(
const
char
*src,
char
*dst,
int
compressed_size,
28
int
dst_capacity);
29
30
#ifdef __cplusplus
31
}
32
#endif
33
34
#endif
// OPENTITAN_SW_DEVICE_LIB_BASE_LZ4_H_
sw
device
lib
base
lz4.h
Return to
OpenTitan Documentation