--- /dev/null
+@ vim:filetype=armasm
+#include <sys/syscall.h>
+
+
+.global cache_flush_d_inval_i @ const void *start_addr, const void *end_addr
+
+cache_flush_d_inval_i:
+ mov r2, #0
+#ifdef __ARM_EABI__
+ /* EABI version */
+ str r7, [sp, #-4]!
+ mov r7, #(__ARM_NR_cacheflush & 0xff)
+#if (__ARM_NR_cacheflush & 0x00ff00)
+ orr r7, r7, #(__ARM_NR_cacheflush & 0x00ff00)
+#endif
+#if (__ARM_NR_cacheflush & 0xff0000)
+ orr r7, r7, #(__ARM_NR_cacheflush & 0xff0000)
+#endif
+ swi 0
+ ldr r7, [sp], #4
+#else
+ /* OABI */
+ swi __ARM_NR_cacheflush
+#endif
+ bx lr
+
--- /dev/null
+extern void cache_flush_d_inval_i(const void *start_addr, const void *end_addr);
void vidCpyM2_32col(void *dest, void *src);\r
void vidCpyM2_32col_nobord(void *dest, void *src);\r
void spend_cycles(int c); // utility\r
-void flushcache(void *beginning_addr, void *end_addr, unsigned int flags);\r
\r
bx lr\r
\r
\r
-.global flushcache\r
-\r
-flushcache:\r
- swi #0x9f0002\r
- mov pc, lr\r
-\r
-\r
OBJCOPY = $(CROSS)objcopy\r
\r
# frontend\r
-OBJS += main.o menu.o gp2x.o usbjoy.o emu.o squidgehack.o cpuctrl.o asm_utils.o\r
+OBJS += main.o menu.o gp2x.o usbjoy.o emu.o squidgehack.o cpuctrl.o\r
# 940 core control\r
OBJS += 940ctl.o\r
\r
# common\r
OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \\r
- platform/common/arm_utils.o platform/common/readpng.o platform/common/mp3_helix.o\r
+ platform/common/arm_utils.o platform/common/arm_linux.o platform/common/readpng.o \\r
+ platform/common/mp3_helix.o\r
\r
# Pico\r
ifeq "$(amalgamate)" "1"\r
#include "gp2x.h"\r
#include "usbjoy.h"\r
#include "../common/arm_utils.h"\r
+#include "../common/arm_linux.h"\r
\r
volatile unsigned short *gp2x_memregs;\r
//static\r
void gp2x_video_flush_cache(void)\r
{\r
// since we are using the mmu hack, we must flush the cache first\r
- // (the params are most likely wrong, but they seem to work somehow)\r
- //flushcache(addr, addr + 320*240*2, 0);\r
- flushcache(gp2x_screen, (char *)gp2x_screen + 320*240*2, 0);\r
+ cache_flush_d_inval_i(gp2x_screen, (char *)gp2x_screen + 320*240*2);\r
}\r
\r
\r
char path [128];
struct usbjoy * joy = NULL;
struct js_event event;
+#ifdef __GP2X__
static char insmod_done = 0;
-
// notaz: on my system I get unresolved input_* symbols, so have to 'insmod input' too
// also we should insmod only once, not on every joy_open() call.
if (!insmod_done) {
system ("insmod joydev"); // Loads joydev module
insmod_done = 1;
}
+#endif
if (joynumber == 0) {
}
else if (joynumber > 0) {
sprintf (path, "/dev/input/js%d", joynumber-1);
fd = open(path, O_RDONLY, 0);
- if (fd > 0) {
+ if (fd == -1) {
+ sprintf (path, "/dev/js%d", joynumber-1);
+ fd = open(path, O_RDONLY, 0);
+ }
+ if (fd != -1) {
joy = (struct usbjoy *) malloc(sizeof(*joy));
if (joy == NULL) { close(fd); return NULL; }
memset(joy, 0, sizeof(*joy));
\r
# common\r
OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \\r
- platform/common/arm_utils.o platform/common/mp3_helix.o # platform/common/readpng.o\r
+ platform/common/arm_utils.o platform/common/mp3_helix.o platform/common/arm_linux.o\r
+ # platform/common/readpng.o\r
\r
# Pico\r
ifeq "$(amalgamate)" "1"\r
@ vim:filetype=armasm
-.global cache_flush_d_inval_i
-
-cache_flush_d_inval_i:
- mov r2, #0x0 @ must be 0 ???
- swi 0x9f0002
- bx lr
-
-
.global clut_line @ void *dest, void *src, unsigned short *pal, int pixels_mask
clut_line:
defaultConfig.EmuOpt = 0x8f | 0x00600; // | <- confirm_save, cd_leds\r
defaultConfig.s_PicoOpt = 0x0f | POPT_EXT_FM|POPT_EN_MCD_PCM|POPT_EN_MCD_CDDA|POPT_EN_SVP_DRC;\r
defaultConfig.s_PicoOpt |= POPT_ACC_SPRITES|POPT_EN_MCD_GFX;\r
- defaultConfig.s_PicoOpt &= ~POPT_EN_SVP_DRC; // crashes :(\r
+// defaultConfig.s_PicoOpt &= ~POPT_EN_SVP_DRC; // crashes :(\r
defaultConfig.EmuOpt &= ~8; // no save gzip\r
defaultConfig.s_PsndRate = 44100;\r
defaultConfig.s_PicoRegion = 0;\r
\r
if (currentConfig.Frameskip < 0 && tval.tv_usec - lim_time >= 300000) // slowdown detection\r
reset_timing = 1;\r
-/* else if (PsndOut != NULL || currentConfig.Frameskip < 0)\r
+#if 1\r
+ else if (PsndOut != NULL || currentConfig.Frameskip < 0)\r
{\r
// sleep or vsync if we are still too fast\r
// usleep sleeps for ~20ms minimum, so it is not a solution here\r
}\r
}\r
}\r
-*/\r
+#endif\r
blit(fpsbuff, notice);\r
\r
pframes_done++; pframes_shown++;\r
\r
#include "../gp2x/gp2x.h"\r
#include "../gp2x/usbjoy.h"\r
-#include "../common/arm_utils.h"\r
+#include "../common/arm_linux.h"\r
\r
static volatile unsigned int *memregs = MAP_FAILED;\r
//static\r
{\r
}\r
\r
-\r
void gp2x_video_flush_cache(void)\r
{\r
-// flushcache(gp2x_screen, (char *)gp2x_screen + 320*240*2, 0);\r
+// cache_flush_d_inval_i(gp2x_screen, (char *)gp2x_screen + 320*240*2, 0);\r
}\r
\r
-\r
void gp2x_memcpy_buffers(int buffers, void *data, int offset, int len)\r
{\r
}\r
\r
void gp2x_pd_clone_buffer2(void)\r
{\r
+ memset(gp2x_screen, 0, 800*480*2);\r
}\r
\r
\r
}\r
\r
\r
-//static int s_oldrate = 0, s_oldbits = 0, s_oldstereo = 0;\r
+static int s_oldrate = 0, s_oldbits = 0, s_oldstereo = 0;\r
\r
void gp2x_start_sound(int rate, int bits, int stereo)\r
{\r
-#if 0\r
int frag = 0, bsize, buffers;\r
\r
// if no settings change, we don't need to do anything\r
rate, bits, stereo?"stereo":"mono", frag>>16, 1<<(frag&0xffff));\r
\r
s_oldrate = rate; s_oldbits = bits; s_oldstereo = stereo;\r
-#endif\r
}\r
\r
\r
void gp2x_sound_write(void *buff, int len)\r
{\r
-// write(sounddev, buff, len);\r
+ write(sounddev, buff, len);\r
}\r
\r
void gp2x_sound_sync(void)\r