aboutsummaryrefslogtreecommitdiffstats
path: root/src/gos
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@seriouslyembedded.com>2015-11-27 20:39:23 +0100
committerJoel Bodenmann <joel@seriouslyembedded.com>2015-11-27 20:39:23 +0100
commiteaf0b19fb8428b9e2e47798294d6ba83a56d186e (patch)
treed5e17609f052e189347e9f503147196f354f8534 /src/gos
parent870901880b30a7f81b2d95a815e89542746d62ab (diff)
downloaduGFX-eaf0b19fb8428b9e2e47798294d6ba83a56d186e.tar.gz
uGFX-eaf0b19fb8428b9e2e47798294d6ba83a56d186e.tar.bz2
uGFX-eaf0b19fb8428b9e2e47798294d6ba83a56d186e.zip
Adding support for NIOS-II platform
Diffstat (limited to 'src/gos')
-rw-r--r--src/gos/gos.h2
-rw-r--r--src/gos/gos.mk1
-rw-r--r--src/gos/gos_mk.c1
-rw-r--r--src/gos/gos_nios.c64
-rw-r--r--src/gos/gos_nios.h44
-rw-r--r--src/gos/gos_options.h7
-rw-r--r--src/gos/gos_rules.h4
7 files changed, 121 insertions, 2 deletions
diff --git a/src/gos/gos.h b/src/gos/gos.h
index 445e4b3a..c3cdca50 100644
--- a/src/gos/gos.h
+++ b/src/gos/gos.h
@@ -478,6 +478,8 @@
#include "gos_cmsis.h"
#elif GFX_USE_OS_KEIL
#include "gos_keil.h"
+#elif GFX_USE_OS_NIOS
+ #include "gos_nios.h"
#else
#error "Your operating system is not supported yet"
#endif
diff --git a/src/gos/gos.mk b/src/gos/gos.mk
index 048e687f..80d832d9 100644
--- a/src/gos/gos.mk
+++ b/src/gos/gos.mk
@@ -13,6 +13,7 @@ GFXSRC += $(GFXLIB)/src/gos/gos_chibios.c \
$(GFXLIB)/src/gos/gos_rawrtos.c \
$(GFXLIB)/src/gos/gos_arduino.c \
$(GFXLIB)/src/gos/gos_cmsis.c \
+ $(GFXLIB)/src/gos/gos_nios.c \
$(GFXLIB)/src/gos/gos_x_threads.c \
$(GFXLIB)/src/gos/gos_x_heap.c
diff --git a/src/gos/gos_mk.c b/src/gos/gos_mk.c
index 49d6efb9..c1c566f7 100644
--- a/src/gos/gos_mk.c
+++ b/src/gos/gos_mk.c
@@ -15,5 +15,6 @@
#include "gos_rawrtos.c"
#include "gos_win32.c"
#include "gos_cmsis.c"
+#include "gos_nios.c"
#include "gos_x_threads.c"
#include "gos_x_heap.c"
diff --git a/src/gos/gos_nios.c b/src/gos/gos_nios.c
new file mode 100644
index 00000000..36e3b19b
--- /dev/null
+++ b/src/gos/gos_nios.c
@@ -0,0 +1,64 @@
+/*
+ * 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
+ */
+
+#include "../../gfx.h"
+
+#if GFX_USE_OS_NIOS
+
+void _gosHeapInit(void);
+void _gosThreadsInit(void);
+
+/*********************************************************
+ * Initialise
+ *********************************************************/
+
+void _gosInit(void)
+{
+ // Set up the heap allocator
+ _gosHeapInit();
+
+ // Start the scheduler
+ _gosThreadsInit();
+}
+
+void _gosDeinit(void)
+{
+}
+
+void gfxHalt(const char *msg)
+{
+ volatile uint32_t dummy;
+
+ (void)msg;
+
+ while(1) {
+ dummy++;
+ }
+}
+
+void gfxExit(void) {
+ volatile uint32_t dummy;
+
+ while(1) {
+ dummy++;
+ }
+}
+#include <stdio.h>
+systemticks_t gfxSystemTicks(void)
+{
+ volatile alt_u32 ticks = alt_nticks();
+
+ printf("Ticks: %d\r\n", ticks);
+ return ticks;
+}
+
+systemticks_t gfxMillisecondsToTicks(delaytime_t ms)
+{
+ return ms;
+}
+
+#endif /* GFX_USE_OS_NIOS */
diff --git a/src/gos/gos_nios.h b/src/gos/gos_nios.h
new file mode 100644
index 00000000..4aadc45d
--- /dev/null
+++ b/src/gos/gos_nios.h
@@ -0,0 +1,44 @@
+/*
+ * 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
+ */
+
+#ifndef _GOS_NIOS_H
+#define _GOS_NIOS_H
+
+#if GFX_USE_OS_NIOS
+
+#include <stdint.h>
+#include <stddef.h>
+#include <stdbool.h>
+#include <sys/alt_alarm.h>
+
+typedef alt_u32 systemticks_t;
+typedef alt_u32 delaytime_t;
+typedef unsigned char bool_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void gfxHalt(const char* msg);
+void gfxExit(void);
+systemticks_t gfxSystemTicks(void);
+systemticks_t gfxMillisecondsToTicks(delaytime_t ms);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+// Use the generic thread handling and heap handling
+#define GOS_NEED_X_THREADS TRUE
+#define GOS_NEED_X_HEAP TRUE
+
+#include "gos_x_threads.h"
+#include "gos_x_heap.h"
+
+#endif /* GFX_USE_OS_NIOS */
+#endif /* _GOS_NIOS_H */
diff --git a/src/gos/gos_options.h b/src/gos/gos_options.h
index 8a724e12..4b33f5ac 100644
--- a/src/gos/gos_options.h
+++ b/src/gos/gos_options.h
@@ -97,6 +97,13 @@
#ifndef GFX_USE_OS_KEIL
#define GFX_USE_OS_KEIL FALSE
#endif
+ /**
+ * @brief Use NIOS-II
+ * @details Defaults to FALSE
+ */
+ #ifndef GFX_USE_OS_NIOS
+ #define GFX_USE_OS_NIOS FALSE
+ #endif
/**
* @}
*
diff --git a/src/gos/gos_rules.h b/src/gos/gos_rules.h
index 0f0f6596..b0184eb0 100644
--- a/src/gos/gos_rules.h
+++ b/src/gos/gos_rules.h
@@ -16,7 +16,7 @@
#ifndef _GOS_RULES_H
#define _GOS_RULES_H
-#if !GFX_USE_OS_CHIBIOS && !GFX_USE_OS_WIN32 && !GFX_USE_OS_LINUX && !GFX_USE_OS_OSX && !GFX_USE_OS_RAW32 && !GFX_USE_OS_FREERTOS && !GFX_USE_OS_ECOS && !GFX_USE_OS_RAWRTOS && !GFX_USE_OS_ARDUINO && !GFX_USE_OS_CMSIS && !GFX_USE_OS_KEIL
+#if !GFX_USE_OS_CHIBIOS && !GFX_USE_OS_WIN32 && !GFX_USE_OS_LINUX && !GFX_USE_OS_OSX && !GFX_USE_OS_RAW32 && !GFX_USE_OS_FREERTOS && !GFX_USE_OS_ECOS && !GFX_USE_OS_RAWRTOS && !GFX_USE_OS_ARDUINO && !GFX_USE_OS_CMSIS && !GFX_USE_OS_KEIL && !GFX_USE_OS_NIOS
#if GFX_DISPLAY_RULE_WARNINGS
#warning "GOS: No Operating System has been defined. ChibiOS (GFX_USE_OS_CHIBIOS) has been turned on for you."
#endif
@@ -24,7 +24,7 @@
#define GFX_USE_OS_CHIBIOS TRUE
#endif
-#if GFX_USE_OS_CHIBIOS + GFX_USE_OS_WIN32 + GFX_USE_OS_LINUX + GFX_USE_OS_OSX + GFX_USE_OS_RAW32 + GFX_USE_OS_FREERTOS + GFX_USE_OS_ECOS + GFX_USE_OS_RAWRTOS + GFX_USE_OS_ARDUINO + GFX_USE_OS_CMSIS + GFX_USE_OS_KEIL != 1 * TRUE
+#if GFX_USE_OS_CHIBIOS + GFX_USE_OS_WIN32 + GFX_USE_OS_LINUX + GFX_USE_OS_OSX + GFX_USE_OS_RAW32 + GFX_USE_OS_FREERTOS + GFX_USE_OS_ECOS + GFX_USE_OS_RAWRTOS + GFX_USE_OS_ARDUINO + GFX_USE_OS_CMSIS + GFX_USE_OS_KEIL + GFX_USE_OS_NIOS != 1 * TRUE
#error "GOS: More than one operation system has been defined as TRUE."
#endif