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

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

View file

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

View file

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

View file

@ -11,6 +11,9 @@ void mmsp2_finish(void);
void pollux_init(void);
void pollux_finish(void);
void dummy_init(void);
void dummy_finish(void);
/* SoC specific functions */
extern void (*gp2x_video_flip)(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 reg0910;
extern unsigned int plat_get_ticks_ms_gtod(void);
extern unsigned int plat_get_ticks_us_gtod(void);
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)
@ -512,8 +512,8 @@ void mmsp2_init(void)
unset_ram_timings = unset_ram_timings_;
gp2x_read_battery = gp2x_read_battery_;
gp2x_get_ticks_ms = plat_get_ticks_ms_gtod;
gp2x_get_ticks_us = plat_get_ticks_us_gtod;
gp2x_get_ticks_ms = plat_get_ticks_ms_good;
gp2x_get_ticks_us = plat_get_ticks_us_good;
}
void mmsp2_finish(void)