Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
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 
tlsf_memalign_r
void * tlsf_memalign_r(tlsf_memory_heap_t *heap, size_t align, size_t bytes)
Definition: tlsf_malloc_arch.c:103
tlsf_stat_t::mfree
size_t mfree
free memory available
Definition: tlsf_malloc.h:56
_tlsf_memory_heap_t
Definition: tlsf_malloc_arch.c:33
tlsf_check_r
int tlsf_check_r(tlsf_memory_heap_t *heap)
Definition: tlsf_malloc_arch.c:137
tlsf_init_heaps
void tlsf_init_heaps(void)
Definition: tlsf_malloc_arch.c:74
HEAP_CCM
#define HEAP_CCM
Definition: tlsf_malloc_arch.h:35
tlsf_malloc_r
void * tlsf_malloc_r(tlsf_memory_heap_t *heap, size_t bytes)
Definition: tlsf_malloc_arch.c:95
tlsf_stat_t::mused
size_t mused
used memory
Definition: tlsf_malloc.h:57
tlsf_free_r
void tlsf_free_r(tlsf_memory_heap_t *heap, void *ptr)
Definition: tlsf_malloc_arch.c:119
tlsf_malloc_arch.h
tlsf_get_heap_addr
void * tlsf_get_heap_addr(const tlsf_memory_heap_t *heap)
Definition: tlsf_malloc_arch.c:90
tlsf_stat_t
Definition: tlsf_malloc.h:55
tlsf_stat_r
void tlsf_stat_r(tlsf_memory_heap_t *heap, struct tlsf_stat_t *stat)
Definition: tlsf_malloc_arch.c:127
tlsf_realloc_r
void * tlsf_realloc_r(tlsf_memory_heap_t *heap, void *ptr, size_t size)
Definition: tlsf_malloc_arch.c:111