aboutsummaryrefslogtreecommitdiffstats
path: root/src/gos/gos_x_heap.h
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2015-07-16 19:02:59 +1000
committerinmarket <andrewh@inmarket.com.au>2015-07-16 19:02:59 +1000
commitc1d239bbdaef9ae08948ad2b61510ac1cd240947 (patch)
treee7fbe4bc48b618f1f54227ae9dc46d6172a384b1 /src/gos/gos_x_heap.h
parentb3028a78d15a325eee1ec9563047637908cab8f5 (diff)
downloaduGFX-c1d239bbdaef9ae08948ad2b61510ac1cd240947.tar.gz
uGFX-c1d239bbdaef9ae08948ad2b61510ac1cd240947.tar.bz2
uGFX-c1d239bbdaef9ae08948ad2b61510ac1cd240947.zip
Significant improvements in alternative scheduler.
Isolate the generic thread and heap code Tidyup's. Generic threading now working for x86, cortex-m0->m7.
Diffstat (limited to 'src/gos/gos_x_heap.h')
-rw-r--r--src/gos/gos_x_heap.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/gos/gos_x_heap.h b/src/gos/gos_x_heap.h
new file mode 100644
index 00000000..3612989c
--- /dev/null
+++ b/src/gos/gos_x_heap.h
@@ -0,0 +1,62 @@
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+/**
+ * The raw32 GOS implementation supports any 32 bit processor with or without an
+ * underlying operating system. It uses cooperative multi-tasking. Be careful
+ * when writing device drivers not to disturb the assumptions this creates by performing
+ * call-backs to uGFX code unless you define the INTERRUPTS_OFF() and INTERRUPTS_ON() macros.
+ * It still requires some C runtime library support...
+ * enough startup to initialise the stack, interrupts, static data etc and call main().
+ * setjmp() and longjmp() - for threading
+ * memcpy() - for heap and threading
+ * malloc(), realloc and free() - if GFX_OS_HEAP_SIZE == 0
+ *
+ * You must also define the following routines in your own code so that timing functions will work...
+ * systemticks_t gfxSystemTicks(void);
+ * systemticks_t gfxMillisecondsToTicks(delaytime_t ms);
+ */
+#ifndef _GOS_X_HEAP_H
+#define _GOS_X_HEAP_H
+
+#if GOS_NEED_X_HEAP
+
+
+/*===========================================================================*/
+/* Special Macros */
+/*===========================================================================*/
+
+/**
+ * @brief Set the maximum size of the heap.
+ * @note If set to 0 then the C runtime library malloc() and free() are used.
+ */
+#ifndef GFX_OS_HEAP_SIZE
+ #define GFX_OS_HEAP_SIZE 0
+#endif
+
+/*===========================================================================*/
+/* Type definitions */
+/*===========================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ #if GFX_OS_HEAP_SIZE != 0
+ void gfxAddHeapBlock(void *ptr, size_t sz);
+ #endif
+
+ void *gfxAlloc(size_t sz);
+ void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz);
+ void gfxFree(void *ptr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GOS_NEED_X_HEAP */
+#endif /* _GOS_X_HEAP_H */