sdl: a couple minor fixes
Prevents system SDL from interfering with thread driver selection. Also
adds test code for alignment faults.
Change-Id: I8bc181922c4a9e764429897dbbaa1ffaabd01126
diff --git a/apps/plugins/sdl/include/SDL_config_rockbox.h b/apps/plugins/sdl/include/SDL_config_rockbox.h
index 90e79cc..e268a73 100644
--- a/apps/plugins/sdl/include/SDL_config_rockbox.h
+++ b/apps/plugins/sdl/include/SDL_config_rockbox.h
@@ -163,7 +163,7 @@
#define vsnprintf rb->vsnprintf
#define vsprintf vsprintf_wrapper
-#define M_PI 3.141592
+#define M_PI 3.14159265358979323846
#define EOF 0xff
#define LOAD_XPM
diff --git a/apps/plugins/sdl/main.c b/apps/plugins/sdl/main.c
index 384055e..478debc 100644
--- a/apps/plugins/sdl/main.c
+++ b/apps/plugins/sdl/main.c
@@ -174,10 +174,21 @@
(void) param;
#if defined(CPU_ARM) && !defined(SIMULATOR)
- /* (don't) set alignment trap */
+ /* (don't) set alignment trap. Will generate a data abort
+ * exception on ARM. */
//set_cr(get_cr() | CR_A);
#endif
+#if 0
+ char c = *((char*)NULL);
+
+ /* test alignment trap */
+ unsigned int x = 0x12345678;
+ char *p = ((char*)&x) + 1;
+ unsigned short *p2 = (unsigned short*)p;
+ rb->splashf(HZ, "%04x, %02x%02x", *p2, *(p+1), *p);
+#endif
+
/* don't confuse this with the main SDL thread! */
main_thread_id = rb->thread_self();
diff --git a/apps/plugins/sdl/src/thread/SDL_thread_c.h b/apps/plugins/sdl/src/thread/SDL_thread_c.h
index d0804e9..1cd6835 100644
--- a/apps/plugins/sdl/src/thread/SDL_thread_c.h
+++ b/apps/plugins/sdl/src/thread/SDL_thread_c.h
@@ -24,24 +24,11 @@
#ifndef _SDL_thread_c_h
#define _SDL_thread_c_h
-/* Need the definitions of SYS_ThreadHandle */
-#if SDL_THREADS_DISABLED
-#include "generic/SDL_systhread_c.h"
-#elif SDL_THREAD_BEOS
-#include "beos/SDL_systhread_c.h"
-#elif SDL_THREAD_DC
-#include "dc/SDL_systhread_c.h"
-#elif SDL_THREAD_OS2
-#include "os2/SDL_systhread_c.h"
-#elif SDL_THREAD_PTH
-#include "pth/SDL_systhread_c.h"
-#elif SDL_THREAD_SPROC
-#include "irix/SDL_systhread_c.h"
-#elif SDL_THREAD_WIN32
-#include "win32/SDL_systhread_c.h"
-#elif SDL_THREAD_SYMBIAN
-#include "symbian/SDL_systhread_c.h"
-#elif SDL_THREAD_ROCKBOX
+#ifndef SDL_THREAD_ROCKBOX
+#define SDL_THREAD_ROCKBOX 1
+#endif
+
+#if SDL_THREAD_ROCKBOX
#include "rockbox/SDL_systhread_c.h"
#else
#error Need thread implementation for this platform