Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
tlsf_malloc.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Alexandre Bustico, Gautier Hattenberger
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
31 #pragma once
32 
34 
35 #if defined(__cplusplus)
36 extern "C" {
37 #endif
38 
39 struct _tlsf_memory_heap_t;
41 
42 #ifdef HEAP_CCM
44 #endif
45 
46 #ifdef HEAP_SRAM
47 extern tlsf_memory_heap_t HEAP_SRAM;
48 #endif
49 
50 #ifdef HEAP_EXTERN
51 extern tlsf_memory_heap_t HEAP_EXTERN;
52 #endif
53 
54 
55 struct tlsf_stat_t {
56  size_t mfree;
57  size_t mused;
58 };
59 
60 
61 /* Create/destroy a memory pool. */
62 extern void tlsf_init_heaps(void);
63 
64 
65 /* malloc/memalign/realloc/free replacements. */
66 extern void *tlsf_malloc_r(tlsf_memory_heap_t *heap, size_t bytes);
67 extern void *tlsf_memalign_r(tlsf_memory_heap_t *heap, size_t align, size_t bytes);
68 extern void *tlsf_realloc_r(tlsf_memory_heap_t *heap, void *ptr, size_t size);
69 extern void tlsf_free_r(tlsf_memory_heap_t *heap, void *ptr);
70 
71 
72 /* Debugging. */
73 extern void tlsf_stat_r(tlsf_memory_heap_t *heap, struct tlsf_stat_t *stat);
74 
75 /* get memory heap base addr*/
76 extern void *tlsf_get_heap_addr(const tlsf_memory_heap_t *heap);
77 
78 /* Returns nonzero if any internal consistency check fails. */
80 
81 #if defined(__cplusplus)
82 };
83 #endif
84 
void * tlsf_memalign_r(tlsf_memory_heap_t *heap, size_t align, size_t bytes)
size_t mfree
free memory available
Definition: tlsf_malloc.h:56
#define HEAP_CCM
Dynamic memory allocation based on TLSF library.
void * tlsf_malloc_r(tlsf_memory_heap_t *heap, size_t bytes)
size_t mused
used memory
Definition: tlsf_malloc.h:57
int tlsf_check_r(tlsf_memory_heap_t *heap)
void tlsf_init_heaps(void)
void tlsf_free_r(tlsf_memory_heap_t *heap, void *ptr)
void tlsf_stat_r(tlsf_memory_heap_t *heap, struct tlsf_stat_t *stat)
void * tlsf_realloc_r(tlsf_memory_heap_t *heap, void *ptr, size_t size)
void * tlsf_get_heap_addr(const tlsf_memory_heap_t *heap)