aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2014-07-29 12:00:47 +1000
committerinmarket <andrewh@inmarket.com.au>2014-07-29 12:00:47 +1000
commit9826378b9608362c4ad6efa3271e6f6de1e2b30e (patch)
treea0e4bc643f420dda032f90bf6423ee64728209d2 /src
parent4ce658b022bbafe129d5ed3a571017c7d34b3892 (diff)
downloaduGFX-9826378b9608362c4ad6efa3271e6f6de1e2b30e.tar.gz
uGFX-9826378b9608362c4ad6efa3271e6f6de1e2b30e.tar.bz2
uGFX-9826378b9608362c4ad6efa3271e6f6de1e2b30e.zip
Operating System initialisation can now be turned off in gfxconf.h
Diffstat (limited to 'src')
-rw-r--r--src/gos/chibios.c27
-rw-r--r--src/gos/ecos.c7
-rw-r--r--src/gos/freertos.c8
-rw-r--r--src/gos/linux.c1
-rw-r--r--src/gos/osx.c1
-rw-r--r--src/gos/raw32.c6
-rw-r--r--src/gos/rawrtos.c6
-rw-r--r--src/gos/sys_options.h14
-rw-r--r--src/gos/win32.c2
9 files changed, 54 insertions, 18 deletions
diff --git a/src/gos/chibios.c b/src/gos/chibios.c
index 468c012c..9d1a86da 100644
--- a/src/gos/chibios.c
+++ b/src/gos/chibios.c
@@ -33,18 +33,21 @@
void _gosInit(void)
{
- /* Don't initialise if the user already has */
-
- #if CH_KERNEL_MAJOR == 2
- if (!chThdSelf()) {
- halInit();
- chSysInit();
- }
- #elif CH_KERNEL_MAJOR == 3
- if (!chThdGetSelfX()) {
- halInit();
- chSysInit();
- }
+ #if !GFX_NO_OS_INIT
+ /* Don't Initialize if the user already has */
+ #if CH_KERNEL_MAJOR == 2
+ if (!chThdSelf()) {
+ halInit();
+ chSysInit();
+ }
+ #elif CH_KERNEL_MAJOR == 3
+ if (!chThdGetSelfX()) {
+ halInit();
+ chSysInit();
+ }
+ #endif
+ #else
+ #warning "GOS: Operating System initialization has been turned off. Make sure you call halInit() and chSysInit() before gfxInit() in your application!"
#endif
}
diff --git a/src/gos/ecos.c b/src/gos/ecos.c
index 5b94497a..16ce821b 100644
--- a/src/gos/ecos.c
+++ b/src/gos/ecos.c
@@ -11,8 +11,11 @@
void _gosInit(void)
{
- /* Don't initialise if the user already has */
- //cyg_scheduler_start();
+ #if !GFX_NO_OS_INIT
+ #error "GOS: Operating System initialization for eCos is not yet implemented in uGFX. Please set GFX_NO_OS_INIT to TRUE in your gfxconf.h"
+ #else
+ #warning "GOS: Operating System initialization has been turned off. Make sure you call cyg_scheduler_start() before gfxInit() in your application!"
+ #endif
}
void _gosDeinit(void)
diff --git a/src/gos/freertos.c b/src/gos/freertos.c
index f2c03eec..dbdfd22e 100644
--- a/src/gos/freertos.c
+++ b/src/gos/freertos.c
@@ -18,13 +18,17 @@
#error "GOS: configUSE_MUTEXES must be defined in FreeRTOSConfig.h"
#endif
-#if configUSE_COUNTING_SEMAPHORES != 1
+#if configUSE_COUNTING_SEMAPHORES != 1
#error "GOS: configUSE_COUNTING_SEMAPHORES must be defined in FreeRTOSConfig.h"
#endif
void _gosInit(void)
{
- // The user must call vTaskStartScheduler() himself before he calls gfxInit().
+ #if !GFX_NO_OS_INIT
+ #error "GOS: Operating System initialization for FreeRTOS is not yet implemented in uGFX. Please set GFX_NO_OS_INIT to TRUE in your gfxconf.h"
+ #else
+ #warning "GOS: Operating System initialization has been turned off. Make sure you call vTaskStartScheduler() before gfxInit() in your application!"
+ #endif
}
void _gosDeinit(void)
diff --git a/src/gos/linux.c b/src/gos/linux.c
index d127fbe1..59b7f9c8 100644
--- a/src/gos/linux.c
+++ b/src/gos/linux.c
@@ -18,6 +18,7 @@ static gfxMutex SystemMutex;
void _gosInit(void)
{
+ /* No initialization of the operating system itself is needed */
gfxMutexInit(&SystemMutex);
}
diff --git a/src/gos/osx.c b/src/gos/osx.c
index dccd49c9..50b06530 100644
--- a/src/gos/osx.c
+++ b/src/gos/osx.c
@@ -35,6 +35,7 @@ void get_ticks(mach_timespec_t *mts){
void _gosInit(void)
{
+ /* No initialization of the operating system itself is needed */
gfxMutexInit(&SystemMutex);
}
diff --git a/src/gos/raw32.c b/src/gos/raw32.c
index c75342d4..22c753aa 100644
--- a/src/gos/raw32.c
+++ b/src/gos/raw32.c
@@ -24,6 +24,12 @@ static void _gosThreadsInit(void);
void _gosInit(void)
{
+ /* No initialization of the operating system itself is needed as there isn't one.
+ * On the other hand the C runtime should still already be initialized before
+ * getting here!
+ */
+ #warning "GOS: Raw32 - Make sure you initialize your hardware and the C runtime before calling gfxInit() in your application!"
+
// Set up the heap allocator
_gosHeapInit();
diff --git a/src/gos/rawrtos.c b/src/gos/rawrtos.c
index 688828c9..cd684208 100644
--- a/src/gos/rawrtos.c
+++ b/src/gos/rawrtos.c
@@ -17,7 +17,11 @@
void _gosInit(void)
{
- // The user must call raw_os_start() himself before he calls gfxInit().
+ #if !GFX_NO_OS_INIT
+ #error "GOS: Operating System initialization for RawRTOS is not yet implemented in uGFX. Please set GFX_NO_OS_INIT to TRUE in your gfxconf.h"
+ #else
+ #warning "GOS: Operating System initialization has been turned off. Make sure you call raw_os_start() before gfxInit() in your application!"
+ #endif
}
void _gosDeinit(void)
diff --git a/src/gos/sys_options.h b/src/gos/sys_options.h
index 7937e082..ead1f3f7 100644
--- a/src/gos/sys_options.h
+++ b/src/gos/sys_options.h
@@ -76,6 +76,20 @@
* @{
*/
/**
+ * @brief Should uGFX avoid initializing the operating system
+ * @details Defaults to FALSE
+ * @note This is not relevant to all operating systems eg Win32 never initializes the
+ * operating system as uGFX runs as an application outside the boot process.
+ * @note Operating system initialization is not necessarily implemented for all
+ * operating systems yet even when it is relevant. These operating systems
+ * will display a compile warning reminding you to initialize the operating
+ * system in your application code. Note that on these operating systems the
+ * demo applications will not work without modification.
+ */
+ #ifndef GFX_NO_OS_INIT
+ #define GFX_NO_OS_INIT FALSE
+ #endif
+ /**
* @brief Should uGFX stuff be added to the FreeRTOS+Tracer
* @details Defaults to FALSE
*/
diff --git a/src/gos/win32.c b/src/gos/win32.c
index 3a3f2517..ffa7fac5 100644
--- a/src/gos/win32.c
+++ b/src/gos/win32.c
@@ -19,7 +19,7 @@ static HANDLE SystemMutex;
void _gosInit(void)
{
-
+ /* No initialization of the operating system itself is needed */
}
void _gosDeinit(void)