From 71922db6cf64fde49deb0ce12fc2828ca0129b53 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sun, 7 Jul 2019 21:51:41 -0400 Subject: sdl: a couple minor fixes Prevents system SDL from interfering with thread driver selection. Also adds test code for alignment faults. Change-Id: I8bc181922c4a9e764429897dbbaa1ffaabd01126 --- apps/plugins/sdl/include/SDL_config_rockbox.h | 2 +- apps/plugins/sdl/main.c | 13 ++++++++++++- apps/plugins/sdl/src/thread/SDL_thread_c.h | 23 +++++------------------ 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/apps/plugins/sdl/include/SDL_config_rockbox.h b/apps/plugins/sdl/include/SDL_config_rockbox.h index 90e79ccede..e268a73a8b 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 384055e660..478debc1ad 100644 --- a/apps/plugins/sdl/main.c +++ b/apps/plugins/sdl/main.c @@ -174,10 +174,21 @@ enum plugin_status plugin_start(const void *param) (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 d0804e9a81..1cd6835d6f 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 -- cgit v1.2.3