dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pios_heap.c
Go to the documentation of this file.
1 
12 /*
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful, but
19  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  * for more details.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with this program; if not, see <http://www.gnu.org/licenses/>
25  */
26 
27 /* Project Includes */
28 #include "pios.h" /* PIOS_INCLUDE_* */
29 
30 #include "pios_heap.h" /* External API declaration */
31 #include <stdbool.h> /* bool */
32 
33 #define DEBUG_MALLOC_FAILURES 0
34 static volatile bool malloc_failed_flag = false;
35 static void malloc_failed_hook(void)
36 {
37  malloc_failed_flag = true;
38 #if DEBUG_MALLOC_FAILURES
39  static volatile bool wait_here = true;
40  while(wait_here);
41  wait_here = true;
42 #endif
43 }
44 
46 {
47  return malloc_failed_flag;
48 }
49 
50 void * PIOS_malloc(size_t size)
51 {
52  void *buf = malloc(size);
53 
54  if (buf == NULL)
56 
57  return buf;
58 }
59 
60 void * PIOS_malloc_no_dma(size_t size)
61 {
62  return PIOS_malloc(size);
63 }
64 
65 void PIOS_free(void * buf)
66 {
67  free(buf);
68 }
69 
71 {
72 }
73 
75 {
76  return 4096;
77 }
78 
79 size_t PIOS_fastheap_get_free_size(void)
80 {
81  return 0;
82 }
83 
Main PiOS header to include all the compiled in PiOS options.
size_t PIOS_fastheap_get_free_size(void)
Definition: pios_heap.c:221
void * PIOS_malloc(size_t size)
Definition: pios_heap.c:125
void * PIOS_malloc_no_dma(size_t size)
Definition: pios_heap.c:166
static void malloc_failed_hook(void)
Definition: pios_heap.c:35
void PIOS_heap_initialize_blocks(void)
Definition: pios_heap.c:228
void PIOS_free(void *buf)
Definition: pios_heap.c:174
static volatile bool malloc_failed_flag
Definition: pios_heap.c:34
bool PIOS_heap_malloc_failed_p(void)
Definition: pios_heap.c:47
size_t PIOS_heap_get_free_size(void)
Definition: pios_heap.c:74