SH2 drc, dummy soc for GP2X

git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@823 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2009-10-22 09:57:36 +00:00
parent 6ad8f1d686
commit 1eb704b633
10 changed files with 158 additions and 37 deletions

View file

@ -1,38 +1,38 @@
# asm stuff # asm stuff
ifeq "$(asm_render)" "1" ifeq "$(asm_render)" "1"
DEFINC += -D_ASM_DRAW_C DEFINES += _ASM_DRAW_C
OBJS += pico/draw_arm.o pico/draw2_arm.o OBJS += pico/draw_arm.o pico/draw2_arm.o
endif endif
ifeq "$(asm_memory)" "1" ifeq "$(asm_memory)" "1"
DEFINC += -D_ASM_MEMORY_C DEFINES += _ASM_MEMORY_C
OBJS += pico/memory_arm.o OBJS += pico/memory_arm.o
endif endif
ifeq "$(asm_ym2612)" "1" ifeq "$(asm_ym2612)" "1"
DEFINC += -D_ASM_YM2612_C DEFINES += _ASM_YM2612_C
OBJS += pico/sound/ym2612_arm.o OBJS += pico/sound/ym2612_arm.o
endif endif
ifeq "$(asm_misc)" "1" ifeq "$(asm_misc)" "1"
DEFINC += -D_ASM_MISC_C DEFINES += _ASM_MISC_C
OBJS += pico/misc_arm.o OBJS += pico/misc_arm.o
OBJS += pico/cd/misc_arm.o OBJS += pico/cd/misc_arm.o
endif endif
ifeq "$(asm_cdpico)" "1" ifeq "$(asm_cdpico)" "1"
DEFINC += -D_ASM_CD_PICO_C DEFINES += _ASM_CD_PICO_C
OBJS += pico/cd/pico_arm.o OBJS += pico/cd/pico_arm.o
endif endif
ifeq "$(asm_cdmemory)" "1" ifeq "$(asm_cdmemory)" "1"
DEFINC += -D_ASM_CD_MEMORY_C DEFINES += _ASM_CD_MEMORY_C
OBJS += pico/cd/memory_arm.o OBJS += pico/cd/memory_arm.o
endif endif
.c.o: .c.o:
@echo ">>>" $< @echo ">>>" $<
$(CC) $(CFLAGS) $(DEFINC) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
.S.o: .S.o:
@echo ">>>" $< @echo ">>>" $<
$(CC) $(SFLAGS) $(DEFINC) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
../../tools/textfilter: ../../tools/textfilter.c ../../tools/textfilter: ../../tools/textfilter.c
@ -45,8 +45,9 @@ clean_prof:
mkdirs: mkdirs:
mkdir -p $(DIRS) mkdir -p $(DIRS)
# deps # some deps
pico/carthw/svp/compiler.o : ../../pico/carthw/svp/ssp16.o ../../pico/carthw/svp/gen_arm.c pico/carthw/svp/compiler.o : ../../pico/carthw/svp/ssp16.o ../../cpu/drc/emit_arm.c
cpu/sh2/compiler.o : ../../cpu/drc/emit_arm.c
pico/pico.o pico/cd/pico.o : ../../pico/pico_cmn.c ../../pico/pico_int.h pico/pico.o pico/cd/pico.o : ../../pico/pico_cmn.c ../../pico/pico_int.h
pico/memory.o pico/cd/memory.o : ../../pico/pico_int.h ../../pico/memory.h pico/memory.o pico/cd/memory.o : ../../pico/pico_int.h ../../pico/memory.h

View file

@ -12,8 +12,8 @@ asm_cdmemory = 1
amalgamate = 0 amalgamate = 0
#profile = 1 #profile = 1
#use_musashi = 1 #use_musashi = 1
use_sh2mame = 1 use_sh2drc = 1
#up = 1 drc_debug = 1
ifeq "$(debug_cyclone)" "1" ifeq "$(debug_cyclone)" "1"
@ -28,8 +28,8 @@ else
use_cyclone = 1 use_cyclone = 1
endif endif
DEFINC = -I../.. -I. -DARM -D__GP2X__ -DIN_GP2X -DIN_EVDEV # -DBENCHMARK DEFINES += ARM __GP2X__ IN_GP2X IN_EVDEV # BENCHMARK
CFLAGS += -Wall -Winline CFLAGS += -Wall -Winline -I../.. -I.
ifeq ($(DEBUG),) ifeq ($(DEBUG),)
CFLAGS += -O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math CFLAGS += -O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math
else else
@ -42,8 +42,9 @@ ifeq "$(profile)" "2"
CFLAGS += -fprofile-use CFLAGS += -fprofile-use
endif endif
CFLAGS += -mcpu=arm920t -mtune=arm920t CFLAGS += -mcpu=arm920t -mtune=arm920t
SFLAGS = $(CFLAGS)
ASFLAGS = -mcpu=arm920t -mfloat-abi=soft ASFLAGS = -mcpu=arm920t -mfloat-abi=soft
LDFLAGS += -lm -lpng
CC = $(CROSS)gcc CC = $(CROSS)gcc
STRIP = $(CROSS)strip STRIP = $(CROSS)strip
AS = $(CROSS)as AS = $(CROSS)as
@ -51,7 +52,7 @@ LD = $(CROSS)ld
OBJCOPY = $(CROSS)objcopy OBJCOPY = $(CROSS)objcopy
# frontend # frontend
OBJS += plat.o warm.o pollux_set.o soc.o soc_mmsp2.o soc_pollux.o emu.o in_gp2x.o OBJS += plat.o warm.o pollux_set.o soc.o soc_mmsp2.o soc_pollux.o soc_dummy.o emu.o in_gp2x.o
# 940 core control # 940 core control
OBJS += 940ctl.o OBJS += 940ctl.o
@ -98,27 +99,39 @@ OBJS += pico/DebugCPU.o cpu/musashi/m68kdasm.o
endif endif
# CPU cores # CPU cores
ifeq "$(use_musashi)" "1" ifeq "$(use_musashi)" "1"
DEFINC += -DEMU_M68K DEFINES += EMU_M68K
OBJS += cpu/musashi/m68kops.o cpu/musashi/m68kcpu.o OBJS += cpu/musashi/m68kops.o cpu/musashi/m68kcpu.o
endif endif
ifeq "$(use_cyclone)" "1" ifeq "$(use_cyclone)" "1"
DEFINC += -DEMU_C68K DEFINES += EMU_C68K
OBJS += pico/m68kif_cyclone.o cpu/Cyclone/proj/Cyclone.o cpu/Cyclone/tools/idle.o OBJS += pico/m68kif_cyclone.o cpu/Cyclone/proj/Cyclone.o cpu/Cyclone/tools/idle.o
endif endif
ifeq "$(mz80)" "1" ifeq "$(mz80)" "1"
DEFINC += -D_USE_MZ80 DEFINES += _USE_MZ80
OBJS += cpu/mz80/mz80.o OBJS += cpu/mz80/mz80.o
else else
DEFINC += -D_USE_DRZ80 DEFINES += _USE_DRZ80
OBJS += cpu/DrZ80/drz80.o OBJS += cpu/DrZ80/drz80.o
endif endif
OBJS += cpu/sh2/sh2.o OBJS += cpu/sh2/sh2.o
ifeq "$(use_sh2mame)" "1" ifeq "$(use_sh2drc)" "1"
DEFINES += DRC_SH2 DRC_TMP
OBJS += cpu/sh2/mame/sh2pico.o OBJS += cpu/sh2/mame/sh2pico.o
OBJS += cpu/sh2/compiler.o
OBJS += cpu/sh2/stub_arm.o
ifeq "$(drc_debug)" "1"
DEFINES += DRC_DEBUG=1
OBJS += cpu/sh2/mame/sh2dasm.o
OBJS += platform/linux/host_dasm.o
LDFLAGS += -lbfd -lopcodes -liberty
endif
else else
OBJS += cpu/sh2/mame/sh2pico.o
endif endif
OBJS += cpu/drc/cmn.o OBJS += cpu/drc/cmn.o
CFLAGS += $(addprefix -D,$(DEFINES))
vpath %.c = ../.. vpath %.c = ../..
vpath %.s = ../.. vpath %.s = ../..
vpath %.S = ../.. vpath %.S = ../..
@ -141,7 +154,7 @@ PicoDrive.o : $(OBJS) ../common/helix/$(CROSS)helix-mp3.a
# also libm on F100 is not compatible # also libm on F100 is not compatible
PicoDrive : PicoDrive.o PicoDrive : PicoDrive.o
@echo ">>>" $@ @echo ">>>" $@
$(CC) -static -o $@ $(CFLAGS) $^ -lm -lpng -Wl,-Map=$@.map $(CC) -static -o $@ $(CFLAGS) $^ $(LDFLAGS) -Wl,-Map=$@.map
ifeq ($(DEBUG),) ifeq ($(DEBUG),)
$(STRIP) $@ $(STRIP) $@
endif endif

View file

@ -146,8 +146,8 @@ void plat_early_init(void)
default_cpu_clock = 533; default_cpu_clock = 533;
break; break;
default: default:
fprintf(stderr, "could not recognize SoC, bailing out.\n"); printf("could not recognize SoC, running in dummy mode.\n");
exit(1); break;
} }
} }
@ -167,6 +167,7 @@ void plat_init(void)
menu_plat_setup(1); menu_plat_setup(1);
break; break;
default: default:
dummy_init();
break; break;
} }
@ -193,6 +194,9 @@ void plat_finish(void)
case SOCID_POLLUX: case SOCID_POLLUX:
pollux_finish(); pollux_finish();
break; break;
default:
dummy_finish();
break;
} }
sndout_oss_exit(); sndout_oss_exit();

View file

@ -33,13 +33,13 @@ gp2x_soc_t soc_detect(void)
{ {
volatile unsigned short *memregs; volatile unsigned short *memregs;
volatile unsigned int *memregl; volatile unsigned int *memregl;
static gp2x_soc_t ret = -1; static gp2x_soc_t ret = -2;
int pollux_chipname[0x30/4 + 1]; int pollux_chipname[0x30/4 + 1];
char *pollux_chipname_c = (char *)pollux_chipname; char *pollux_chipname_c = (char *)pollux_chipname;
int memdev; int memdev;
int i; int i;
if (ret != -1) if (ret != -2)
/* already detected */ /* already detected */
return ret; return ret;
@ -47,6 +47,7 @@ gp2x_soc_t soc_detect(void)
if (memdev == -1) if (memdev == -1)
{ {
perror("open(/dev/mem)"); perror("open(/dev/mem)");
ret = -1;
return -1; return -1;
} }
@ -55,6 +56,7 @@ gp2x_soc_t soc_detect(void)
{ {
perror("mmap(memregs)"); perror("mmap(memregs)");
close(memdev); close(memdev);
ret = -1;
return -1; return -1;
} }
memregl = (volatile void *)memregs; memregl = (volatile void *)memregs;

View file

@ -11,6 +11,9 @@ void mmsp2_finish(void);
void pollux_init(void); void pollux_init(void);
void pollux_finish(void); void pollux_finish(void);
void dummy_init(void);
void dummy_finish(void);
/* SoC specific functions */ /* SoC specific functions */
extern void (*gp2x_video_flip)(void); extern void (*gp2x_video_flip)(void);
extern void (*gp2x_video_flip2)(void); extern void (*gp2x_video_flip2)(void);

102
gp2x/soc_dummy.c Normal file
View file

@ -0,0 +1,102 @@
/* dummy code for qemu testing, etc */
#include <stdlib.h>
#include "soc.h"
#include "../common/emu.h"
extern void *gp2x_screens[4];
extern unsigned int plat_get_ticks_ms_good(void);
extern unsigned int plat_get_ticks_us_good(void);
/* video stuff */
static void gp2x_video_flip_(void)
{
}
/* doulblebuffered flip */
static void gp2x_video_flip2_(void)
{
}
static void gp2x_video_changemode_ll_(int bpp)
{
}
static void gp2x_video_setpalette_(int *pal, int len)
{
}
static void gp2x_video_RGB_setscaling_(int ln_offs, int W, int H)
{
}
static void gp2x_video_wait_vsync_(void)
{
}
/* CPU clock */
static void gp2x_set_cpuclk_(unsigned int mhz)
{
}
/* RAM timings */
static void set_ram_timings_(void)
{
}
static void unset_ram_timings_(void)
{
}
/* LCD refresh */
static void set_lcd_custom_rate_(int is_pal)
{
}
static void unset_lcd_custom_rate_(void)
{
}
static void set_lcd_gamma_(int g100, int A_SNs_curve)
{
}
static int gp2x_read_battery_(void)
{
return 0;
}
void dummy_init(void)
{
int i;
g_screen_ptr = malloc(320 * 240 * 2);
for (i = 0; i < array_size(gp2x_screens); i++)
gp2x_screens[i] = g_screen_ptr;
gp2x_video_flip = gp2x_video_flip_;
gp2x_video_flip2 = gp2x_video_flip2_;
gp2x_video_changemode_ll = gp2x_video_changemode_ll_;
gp2x_video_setpalette = gp2x_video_setpalette_;
gp2x_video_RGB_setscaling = gp2x_video_RGB_setscaling_;
gp2x_video_wait_vsync = gp2x_video_wait_vsync_;
gp2x_set_cpuclk = gp2x_set_cpuclk_;
set_lcd_custom_rate = set_lcd_custom_rate_;
unset_lcd_custom_rate = unset_lcd_custom_rate_;
set_lcd_gamma = set_lcd_gamma_;
set_ram_timings = set_ram_timings_;
unset_ram_timings = unset_ram_timings_;
gp2x_read_battery = gp2x_read_battery_;
gp2x_get_ticks_ms = plat_get_ticks_ms_good;
gp2x_get_ticks_us = plat_get_ticks_us_good;
}
void dummy_finish(void)
{
free(gp2x_screens[0]);
}

View file

@ -41,8 +41,8 @@ static unsigned short gp2x_screenaddr_old[4];
static unsigned short memtimex_old[2]; static unsigned short memtimex_old[2];
static unsigned short reg0910; static unsigned short reg0910;
extern unsigned int plat_get_ticks_ms_gtod(void); extern unsigned int plat_get_ticks_ms_good(void);
extern unsigned int plat_get_ticks_us_gtod(void); extern unsigned int plat_get_ticks_us_good(void);
/* video stuff */ /* video stuff */
static void gp2x_video_flip_(void) static void gp2x_video_flip_(void)
@ -512,8 +512,8 @@ void mmsp2_init(void)
unset_ram_timings = unset_ram_timings_; unset_ram_timings = unset_ram_timings_;
gp2x_read_battery = gp2x_read_battery_; gp2x_read_battery = gp2x_read_battery_;
gp2x_get_ticks_ms = plat_get_ticks_ms_gtod; gp2x_get_ticks_ms = plat_get_ticks_ms_good;
gp2x_get_ticks_us = plat_get_ticks_us_gtod; gp2x_get_ticks_us = plat_get_ticks_us_good;
} }
void mmsp2_finish(void) void mmsp2_finish(void)

View file

@ -99,7 +99,7 @@ ifeq "$(drc_debug)" "1"
DEFINES += DRC_DEBUG=1 DEFINES += DRC_DEBUG=1
OBJS += cpu/sh2/mame/sh2dasm.o OBJS += cpu/sh2/mame/sh2dasm.o
OBJS += host_dasm.o OBJS += host_dasm.o
LDFLAGS += -lbfd -lopcodes LDFLAGS += -lbfd -lopcodes -liberty
endif endif
else else
OBJS += cpu/sh2/mame/sh2pico.o OBJS += cpu/sh2/mame/sh2pico.o

View file

@ -21,10 +21,6 @@ static struct disassemble_info di;
#define BFD_MACH bfd_mach_i386_i386_intel_syntax #define BFD_MACH bfd_mach_i386_i386_intel_syntax
#endif #endif
/* hacks for ARM */
int floatformat_to_double;
int floatformat_ieee_single_little;
/* symbols */ /* symbols */
static asymbol **symbols; static asymbol **symbols;
static long symcount; static long symcount;

View file

@ -19,8 +19,8 @@ int plat_is_dir(const char *path)
#ifdef __GP2X__ #ifdef __GP2X__
/* Wiz has a borked gettimeofday().. */ /* Wiz has a borked gettimeofday().. */
#define plat_get_ticks_ms plat_get_ticks_ms_gtod #define plat_get_ticks_ms plat_get_ticks_ms_good
#define plat_get_ticks_us plat_get_ticks_us_gtod #define plat_get_ticks_us plat_get_ticks_us_good
#endif #endif
unsigned int plat_get_ticks_ms(void) unsigned int plat_get_ticks_ms(void)