support armv5 build
authornotaz <notasas@gmail.com>
Fri, 23 Sep 2011 16:29:03 +0000 (19:29 +0300)
committernotaz <notasas@gmail.com>
Fri, 23 Sep 2011 16:29:03 +0000 (19:29 +0300)
16 files changed:
Makefile
frontend/cspace.c [new file with mode: 0644]
frontend/cspace.h [moved from frontend/arm_utils.h with 100% similarity]
frontend/cspace_neon.s [moved from frontend/arm_utils.s with 100% similarity]
frontend/menu.c
frontend/plat_dummy.c
libpcsxcore/new_dynarec/emu_if.c
libpcsxcore/new_dynarec/emu_if.h
libpcsxcore/new_dynarec/linkage_arm.s
plugins/dfsound/spu.c
plugins/dfxvideo/draw_fb.c
plugins/dfxvideo/soft.c
plugins/gpu_neon/Makefile
plugins/gpu_neon/vout_fb.c
plugins/gpu_unai/Makefile
plugins/gpu_unai/gpu.cpp

index 2b57053..5a7b278 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,26 +3,39 @@ AS = $(CROSS_COMPILE)as
 CC = $(CROSS_COMPILE)gcc
 LD = $(CROSS_COMPILE)ld
 
+ARM926 ?= 0
+ARM_CORTEXA8 ?= 1
+USE_OSS ?= 1
+#USE_ALSA = 1
+#DRC_DBG = 1
+#PCNT = 1
+TARGET = pcsx
+
+-include Makefile.local
+
 ARCH = $(shell $(CC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-' '{print $$1}')
 
-CFLAGS += -Wall -ggdb -Ifrontend
+CFLAGS += -Wall -ggdb -Ifrontend -ffast-math
 LDFLAGS += -lz -lpthread -ldl -lpng -lbz2
-ifeq "$(ARCH)" "arm"
-CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp -ffast-math
-ASFLAGS += -mcpu=cortex-a8 -mfpu=neon
-endif
 ifndef DEBUG
 CFLAGS += -O2 -DNDEBUG
 endif
 CFLAGS += $(EXTRA_CFLAGS)
 
-USE_OSS ?= 1
-#USE_ALSA = 1
-#DRC_DBG = 1
-#PCNT = 1
-TARGET = pcsx
+ifeq "$(ARCH)" "arm"
+ifeq "$(ARM_CORTEXA8)" "1"
+CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
+ASFLAGS += -mcpu=cortex-a8 -mfpu=neon
+endif
+ifeq "$(ARM926)" "1"
+CFLAGS += -mcpu=arm926ej-s -mtune=arm926ej-s
+ASFLAGS += -mcpu=arm926ej-s
+endif
+endif
 
--include Makefile.local
+# detect armv7 and NEON from the specified CPU
+HAVE_NEON = $(shell $(CC) -E -dD $(CFLAGS) frontend/config.h | grep -q '__ARM_NEON__ 1' && echo 1)
+HAVE_ARMV7 = $(shell $(CC) -E -dD $(CFLAGS) frontend/config.h | grep -q '__ARM_ARCH_7A__ 1' && echo 1)
 
 all: $(TARGET)
 
@@ -33,7 +46,7 @@ OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore
        libpcsxcore/psxcommon.o libpcsxcore/psxcounters.o libpcsxcore/psxdma.o libpcsxcore/psxhle.o \
        libpcsxcore/psxhw.o libpcsxcore/psxinterpreter.o libpcsxcore/psxmem.o libpcsxcore/r3000a.o \
        libpcsxcore/sio.o libpcsxcore/socket.o libpcsxcore/spu.o
-ifeq "$(ARCH)" "arm"
+ifeq "$(HAVE_NEON)" "1"
 OBJS += libpcsxcore/gte_neon.o
 endif
 libpcsxcore/cdrom.o libpcsxcore/misc.o: CFLAGS += -Wno-pointer-sign
@@ -41,6 +54,7 @@ libpcsxcore/misc.o libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull
 
 # dynarec
 ifndef NO_NEW_DRC
+libpcsxcore/new_dynarec/linkage_arm.o: ASFLAGS += --defsym HAVE_ARMV7=$(HAVE_ARMV7)
 OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o
 OBJS += libpcsxcore/new_dynarec/pcsxmem.o
 endif
@@ -58,7 +72,7 @@ OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \
        plugins/dfsound/registers.o plugins/dfsound/spu.o
 plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \
        plugins/dfsound/xa.c
-ifeq "$(ARCH)" "arm"
+ifeq "$(HAVE_NEON)" "1"
 OBJS += plugins/dfsound/arm_utils.o
 endif
 ifeq "$(USE_OSS)" "1"
@@ -109,8 +123,11 @@ else
 OBJS += frontend/plat_dummy.o
 endif
 endif # !USE_GTK
-ifeq "$(ARCH)" "arm"
-OBJS += frontend/arm_utils.o
+
+ifeq "$(HAVE_NEON)" "1"
+OBJS += frontend/cspace_neon.o
+else
+OBJS += frontend/cspace.o
 endif
 ifdef X11
 frontend/%.o: CFLAGS += -DX11
@@ -136,7 +153,7 @@ frontend/revision.h: FORCE
 $(TARGET): $(OBJS)
        $(CC) -o $@ $^ $(LDFLAGS) -Wl,-Map=$@.map
 
-PLUGINS = plugins/spunull/spunull.so plugins/gpu_unai/gpuPCSX4ALL.so \
+PLUGINS ?= plugins/spunull/spunull.so plugins/gpu_unai/gpuPCSX4ALL.so \
        plugins/gpu-gles/gpuGLES.so plugins/gpu_neon/gpu_neon.so
 
 $(PLUGINS):
diff --git a/frontend/cspace.c b/frontend/cspace.c
new file mode 100644 (file)
index 0000000..f5f8d35
--- /dev/null
@@ -0,0 +1,7 @@
+#include "cspace.h"
+
+// TODO?
+void bgr555_to_rgb565(void *dst, const void *src, int bytes) {}
+void bgr888_to_rgb888(void *dst, const void *src, int bytes) {}
+void bgr888_to_rgb565(void *dst, const void *src, int bytes) {}
+
similarity index 100%
rename from frontend/arm_utils.h
rename to frontend/cspace.h
similarity index 100%
rename from frontend/arm_utils.s
rename to frontend/cspace_neon.s
index cdba3ad..01b568e 100644 (file)
@@ -22,7 +22,7 @@
 #include "omap.h"
 #include "pandora.h"
 #include "pcnt.h"
-#include "arm_utils.h"
+#include "cspace.h"
 #include "common/plat.h"
 #include "common/input.h"
 #include "linux/in_evdev.h"
index 44ba4a8..bafb184 100644 (file)
@@ -43,18 +43,6 @@ void plat_finish(void)
 {
 }
 
-void bgr555_to_rgb565(void *d, void *s, int len)
-{
-}
-
-void bgr888_to_rgb888(void *d, void *s, int len)
-{
-}
-
-void bgr888_to_rgb565(void *d, void *s, int len)
-{
-}
-
 void in_update_analogs(void)
 {
 }
index 5821650..8a068ea 100644 (file)
@@ -161,11 +161,13 @@ static int ari64_init()
        for (i = 0; i < ARRAY_SIZE(gte_handlers); i++)
                if (psxCP2[i] != psxNULL)
                        gte_handlers[i] = psxCP2[i];
-#if defined(__arm__) && !defined(DRC_DBG)
+#ifndef DRC_DBG
+#ifdef __ARM_NEON__
        gte_handlers[0x01] = gteRTPS_neon;
        gte_handlers[0x30] = gteRTPT_neon;
        gte_handlers[0x12] = gteMVMVA_neon;
        gte_handlers[0x06] = gteNCLIP_neon;
+#endif
 #endif
        psxH_ptr = psxH;
 
index 128d431..8acd1f5 100644 (file)
@@ -1,6 +1,10 @@
 #include "new_dynarec.h"
 #include "../r3000a.h"
 
+#ifndef __ARM_ARCH_7A__
+#define ARMv5_ONLY
+#endif
+
 extern char invalid_code[0x100000];
 
 /* weird stuff */
index c545ed3..f5af0f5 100644 (file)
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-.equiv HAVE_ARMV7, 1
+/* .equiv HAVE_ARMV7, 1 */
 
-.if HAVE_ARMV7
-       .cpu cortex-a8
-       .fpu vfp
-.else
-       .cpu arm9tdmi
-       .fpu softvfp
-.endif 
        .global rdram
 rdram = 0x80000000
        .global dynarec_local
index 06cc476..f84ef77 100644 (file)
@@ -37,7 +37,7 @@
 #define N_(x) (x)
 #endif
 
-#ifdef __arm__
+#ifdef __ARM_ARCH_7A__
  #define ssat32_to_16(v) \
   asm("ssat %0,#16,%1" : "=r" (v) : "r" (v))
 #else
@@ -620,7 +620,7 @@ static int do_samples_noise(int ch, int ns, int ns_to)
  return -1;
 }
 
-#ifdef __arm__
+#ifdef __ARM_ARCH_7A__
 // asm code
 extern void mix_chan(int start, int count, int lv, int rv);
 extern void mix_chan_rvb(int start, int count, int lv, int rv);
index f40063e..7f80724 100644 (file)
@@ -10,7 +10,7 @@
 #include "gpu.h"
 
 #include "../../frontend/plugin_lib.h"
-#include "../../frontend/arm_utils.h"
+#include "../../frontend/cspace.h"
 #include "../../frontend/pcnt.h"
 
 // misc globals
index 1b24624..160b0c4 100644 (file)
@@ -1077,7 +1077,7 @@ static int left_B, delta_left_B, right_B, delta_right_B;
 // USE_NASM
 static inline int shl10idiv(int x, int y)
 {
-#ifdef __arm__
+#ifdef __ARM_ARCH_7A__
  // rearmed: let's use VFP divider instead
  float r = 1024.0f * (float)x / (float)y;
  return (int)r;
index 09c47d3..adb5097 100644 (file)
@@ -10,7 +10,7 @@ SRC += gpu.c
 ifeq "$(ARCH)" "arm"
 TARGET = gpu_neon.so
 CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
-SRC += vout_fb.c ../../frontend/arm_utils.s
+SRC += vout_fb.c ../../frontend/cspace_neon.s
 else
 TARGET = gpu_neon.so.x86
 CFLAGS += `sdl-config --cflags` -m32
index 6b687b3..bda8d4a 100644 (file)
@@ -10,7 +10,7 @@
 
 #include "gpu.h"
 #include "../../frontend/plugin_lib.h"
-#include "../../frontend/arm_utils.h"
+#include "../../frontend/cspace.h"
 
 static const struct rearmed_cbs *cbs;
 static void *screen_buf;
index 026d950..80f82ae 100644 (file)
@@ -16,7 +16,7 @@ LDFLAGS += -shared -Wl,-soname,$(TARGET)
 
 all: $(TARGET)
 
-$(TARGET): gpu.cpp ../../frontend/arm_utils.s
+$(TARGET): gpu.cpp ../../frontend/cspace_neon.s
        $(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
 
 # $(TARGET): *.h
index 3342d1e..fa176d5 100644 (file)
@@ -820,7 +820,7 @@ void  GPU_updateLace(void)
 #else
 
 #include "../../frontend/plugin_lib.h"
-#include "../../frontend/arm_utils.h"
+#include "../../frontend/cspace.h"
 
 extern "C" {