CTS-SAT-1-OBC-Firmware
Toggle main menu visibility
Loading...
Searching...
No Matches
firmware
Core
Inc
compression
heatshrink_lib
heatshrink_config.h
Go to the documentation of this file.
1
#ifndef HEATSHRINK_CONFIG_H
2
#define HEATSHRINK_CONFIG_H
3
4
/* Should functionality assuming dynamic allocation be used? */
5
#ifndef HEATSHRINK_DYNAMIC_ALLOC
6
#define HEATSHRINK_DYNAMIC_ALLOC 1
7
#endif
8
9
#if HEATSHRINK_DYNAMIC_ALLOC
10
/* Optional replacement of malloc/free */
11
// #define HEATSHRINK_MALLOC(SZ) malloc(SZ)
12
// #define HEATSHRINK_FREE(P, SZ) free(P)
13
14
#include "FreeRTOS.h"
15
#include <stddef.h>
16
17
static
inline
void
*
heatshrink_port_impl_malloc
(
size_t
size) {
18
// Note: When investigated, the allocated size for the main operation (opening a file)
19
// is 2048 bytes (LFS_CACHE_SIZE).
20
// HEATSHRINK_debug_malloc_total_count++;
21
void
*ptr = pvPortMalloc(size);
22
if
(ptr == NULL) {
23
// HEATSHRINK_debug_malloc_failed_count++;
24
}
25
return
ptr;
26
}
27
28
static
inline
void
heatshrink_port_impl_free
(
void
*ptr) {
29
// HEATSHRINK_debug_free_total_count++;
30
vPortFree(ptr);
31
}
32
33
// Route allocations to FreeRTOS heap.
34
#define HEATSHRINK_MALLOC(size) heatshrink_port_impl_malloc(size)
35
#define HEATSHRINK_FREE(ptr, size) heatshrink_port_impl_free(ptr)
36
37
#else
38
/* Required parameters for static configuration */
39
#define HEATSHRINK_STATIC_INPUT_BUFFER_SIZE 32
40
#define HEATSHRINK_STATIC_WINDOW_BITS 8
41
#define HEATSHRINK_STATIC_LOOKAHEAD_BITS 4
42
#endif
43
44
/* Turn on logging for debugging. */
45
#define HEATSHRINK_DEBUGGING_LOGS 0
46
47
/* Use indexing for faster compression. (This requires additional space.) */
48
#define HEATSHRINK_USE_INDEX 1
49
50
#endif
heatshrink_port_impl_malloc
static void * heatshrink_port_impl_malloc(size_t size)
Definition
heatshrink_config.h:17
heatshrink_port_impl_free
static void heatshrink_port_impl_free(void *ptr)
Definition
heatshrink_config.h:28
Generated by
1.17.0