aboutsummaryrefslogtreecommitdiff
path: root/02-usart/include/mem.h
diff options
context:
space:
mode:
Diffstat (limited to '02-usart/include/mem.h')
-rw-r--r--02-usart/include/mem.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/02-usart/include/mem.h b/02-usart/include/mem.h
index aa4ce12..f376e7d 100644
--- a/02-usart/include/mem.h
+++ b/02-usart/include/mem.h
@@ -1,4 +1,27 @@
#ifndef MEM_H_
#define MEM_H_
+#include "arch.h"
+#include <stddef.h>
+
+#define MAX_HEAP_SIZE \
+ ((16384 - (DATA_SEGMENT_STOP - DATA_SEGMENT_START)) / 4 * 4)
+
+/* allocates memory on the head, which is stored in sram2 */
+void* halloc(size_t n);
+
+/* Frees the memory allocated by halloc. */
+void hfree(void* mem);
+
+#ifdef FOR_TESTING
+
+void* debug_halloc_get_next_ptr(void* ptr);
+
+void* debug_halloc_get_prev_ptr(void* ptr);
+
+int debug_halloc_assert_consistency(char* error, size_t len);
+
+#endif
+
+
#endif