mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-05 06:47:45 -04:00
arm_linux.S for cache ops and random fixes
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@587 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
f11bad75ed
commit
095a240bd9
11 changed files with 50 additions and 35 deletions
26
common/arm_linux.S
Normal file
26
common/arm_linux.S
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
@ 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
|
||||||
|
|
1
common/arm_linux.h
Normal file
1
common/arm_linux.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
extern void cache_flush_d_inval_i(const void *start_addr, const void *end_addr);
|
|
@ -10,5 +10,4 @@ void vidCpyM2_40col(void *dest, void *src);
|
||||||
void vidCpyM2_32col(void *dest, void *src);
|
void vidCpyM2_32col(void *dest, void *src);
|
||||||
void vidCpyM2_32col_nobord(void *dest, void *src);
|
void vidCpyM2_32col_nobord(void *dest, void *src);
|
||||||
void spend_cycles(int c); // utility
|
void spend_cycles(int c); // utility
|
||||||
void flushcache(void *beginning_addr, void *end_addr, unsigned int flags);
|
|
||||||
|
|
||||||
|
|
|
@ -214,10 +214,3 @@ spend_cycles:
|
||||||
bx lr
|
bx lr
|
||||||
|
|
||||||
|
|
||||||
.global flushcache
|
|
||||||
|
|
||||||
flushcache:
|
|
||||||
swi #0x9f0002
|
|
||||||
mov pc, lr
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -54,13 +54,14 @@ LD = $(CROSS)ld
|
||||||
OBJCOPY = $(CROSS)objcopy
|
OBJCOPY = $(CROSS)objcopy
|
||||||
|
|
||||||
# frontend
|
# frontend
|
||||||
OBJS += main.o menu.o gp2x.o usbjoy.o emu.o squidgehack.o cpuctrl.o asm_utils.o
|
OBJS += main.o menu.o gp2x.o usbjoy.o emu.o squidgehack.o cpuctrl.o
|
||||||
# 940 core control
|
# 940 core control
|
||||||
OBJS += 940ctl.o
|
OBJS += 940ctl.o
|
||||||
|
|
||||||
# common
|
# common
|
||||||
OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \
|
OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \
|
||||||
platform/common/arm_utils.o platform/common/readpng.o platform/common/mp3_helix.o
|
platform/common/arm_utils.o platform/common/arm_linux.o platform/common/readpng.o \
|
||||||
|
platform/common/mp3_helix.o
|
||||||
|
|
||||||
# Pico
|
# Pico
|
||||||
ifeq "$(amalgamate)" "1"
|
ifeq "$(amalgamate)" "1"
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "gp2x.h"
|
#include "gp2x.h"
|
||||||
#include "usbjoy.h"
|
#include "usbjoy.h"
|
||||||
#include "../common/arm_utils.h"
|
#include "../common/arm_utils.h"
|
||||||
|
#include "../common/arm_linux.h"
|
||||||
|
|
||||||
volatile unsigned short *gp2x_memregs;
|
volatile unsigned short *gp2x_memregs;
|
||||||
//static
|
//static
|
||||||
|
@ -162,9 +163,7 @@ void gp2x_video_wait_vsync(void)
|
||||||
void gp2x_video_flush_cache(void)
|
void gp2x_video_flush_cache(void)
|
||||||
{
|
{
|
||||||
// since we are using the mmu hack, we must flush the cache first
|
// since we are using the mmu hack, we must flush the cache first
|
||||||
// (the params are most likely wrong, but they seem to work somehow)
|
cache_flush_d_inval_i(gp2x_screen, (char *)gp2x_screen + 320*240*2);
|
||||||
//flushcache(addr, addr + 320*240*2, 0);
|
|
||||||
flushcache(gp2x_screen, (char *)gp2x_screen + 320*240*2, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -57,8 +57,8 @@ struct usbjoy *joy_open(int joynumber)
|
||||||
char path [128];
|
char path [128];
|
||||||
struct usbjoy * joy = NULL;
|
struct usbjoy * joy = NULL;
|
||||||
struct js_event event;
|
struct js_event event;
|
||||||
|
#ifdef __GP2X__
|
||||||
static char insmod_done = 0;
|
static char insmod_done = 0;
|
||||||
|
|
||||||
// notaz: on my system I get unresolved input_* symbols, so have to 'insmod input' too
|
// 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.
|
// also we should insmod only once, not on every joy_open() call.
|
||||||
if (!insmod_done) {
|
if (!insmod_done) {
|
||||||
|
@ -66,13 +66,18 @@ struct usbjoy *joy_open(int joynumber)
|
||||||
system ("insmod joydev"); // Loads joydev module
|
system ("insmod joydev"); // Loads joydev module
|
||||||
insmod_done = 1;
|
insmod_done = 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (joynumber == 0) {
|
if (joynumber == 0) {
|
||||||
}
|
}
|
||||||
else if (joynumber > 0) {
|
else if (joynumber > 0) {
|
||||||
sprintf (path, "/dev/input/js%d", joynumber-1);
|
sprintf (path, "/dev/input/js%d", joynumber-1);
|
||||||
fd = open(path, O_RDONLY, 0);
|
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));
|
joy = (struct usbjoy *) malloc(sizeof(*joy));
|
||||||
if (joy == NULL) { close(fd); return NULL; }
|
if (joy == NULL) { close(fd); return NULL; }
|
||||||
memset(joy, 0, sizeof(*joy));
|
memset(joy, 0, sizeof(*joy));
|
||||||
|
|
|
@ -55,7 +55,8 @@ OBJS += pandora.o main.o emu.o asm_utils.o platform/gp2x/menu.o platform/gp2x/us
|
||||||
|
|
||||||
# common
|
# common
|
||||||
OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \
|
OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \
|
||||||
platform/common/arm_utils.o platform/common/mp3_helix.o # platform/common/readpng.o
|
platform/common/arm_utils.o platform/common/mp3_helix.o platform/common/arm_linux.o
|
||||||
|
# platform/common/readpng.o
|
||||||
|
|
||||||
# Pico
|
# Pico
|
||||||
ifeq "$(amalgamate)" "1"
|
ifeq "$(amalgamate)" "1"
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
@ vim:filetype=armasm
|
@ 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
|
.global clut_line @ void *dest, void *src, unsigned short *pal, int pixels_mask
|
||||||
|
|
||||||
clut_line:
|
clut_line:
|
||||||
|
|
|
@ -139,7 +139,7 @@ void emu_prepareDefaultConfig(void)
|
||||||
defaultConfig.EmuOpt = 0x8f | 0x00600; // | <- confirm_save, cd_leds
|
defaultConfig.EmuOpt = 0x8f | 0x00600; // | <- confirm_save, cd_leds
|
||||||
defaultConfig.s_PicoOpt = 0x0f | POPT_EXT_FM|POPT_EN_MCD_PCM|POPT_EN_MCD_CDDA|POPT_EN_SVP_DRC;
|
defaultConfig.s_PicoOpt = 0x0f | POPT_EXT_FM|POPT_EN_MCD_PCM|POPT_EN_MCD_CDDA|POPT_EN_SVP_DRC;
|
||||||
defaultConfig.s_PicoOpt |= POPT_ACC_SPRITES|POPT_EN_MCD_GFX;
|
defaultConfig.s_PicoOpt |= POPT_ACC_SPRITES|POPT_EN_MCD_GFX;
|
||||||
defaultConfig.s_PicoOpt &= ~POPT_EN_SVP_DRC; // crashes :(
|
// defaultConfig.s_PicoOpt &= ~POPT_EN_SVP_DRC; // crashes :(
|
||||||
defaultConfig.EmuOpt &= ~8; // no save gzip
|
defaultConfig.EmuOpt &= ~8; // no save gzip
|
||||||
defaultConfig.s_PsndRate = 44100;
|
defaultConfig.s_PsndRate = 44100;
|
||||||
defaultConfig.s_PicoRegion = 0;
|
defaultConfig.s_PicoRegion = 0;
|
||||||
|
@ -1001,7 +1001,8 @@ void emu_Loop(void)
|
||||||
|
|
||||||
if (currentConfig.Frameskip < 0 && tval.tv_usec - lim_time >= 300000) // slowdown detection
|
if (currentConfig.Frameskip < 0 && tval.tv_usec - lim_time >= 300000) // slowdown detection
|
||||||
reset_timing = 1;
|
reset_timing = 1;
|
||||||
/* else if (PsndOut != NULL || currentConfig.Frameskip < 0)
|
#if 1
|
||||||
|
else if (PsndOut != NULL || currentConfig.Frameskip < 0)
|
||||||
{
|
{
|
||||||
// sleep or vsync if we are still too fast
|
// sleep or vsync if we are still too fast
|
||||||
// usleep sleeps for ~20ms minimum, so it is not a solution here
|
// usleep sleeps for ~20ms minimum, so it is not a solution here
|
||||||
|
@ -1017,7 +1018,7 @@ void emu_Loop(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
#endif
|
||||||
blit(fpsbuff, notice);
|
blit(fpsbuff, notice);
|
||||||
|
|
||||||
pframes_done++; pframes_shown++;
|
pframes_done++; pframes_shown++;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#include "../gp2x/gp2x.h"
|
#include "../gp2x/gp2x.h"
|
||||||
#include "../gp2x/usbjoy.h"
|
#include "../gp2x/usbjoy.h"
|
||||||
#include "../common/arm_utils.h"
|
#include "../common/arm_linux.h"
|
||||||
|
|
||||||
static volatile unsigned int *memregs = MAP_FAILED;
|
static volatile unsigned int *memregs = MAP_FAILED;
|
||||||
//static
|
//static
|
||||||
|
@ -64,13 +64,11 @@ void gp2x_video_wait_vsync(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gp2x_video_flush_cache(void)
|
void gp2x_video_flush_cache(void)
|
||||||
{
|
{
|
||||||
// flushcache(gp2x_screen, (char *)gp2x_screen + 320*240*2, 0);
|
// cache_flush_d_inval_i(gp2x_screen, (char *)gp2x_screen + 320*240*2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gp2x_memcpy_buffers(int buffers, void *data, int offset, int len)
|
void gp2x_memcpy_buffers(int buffers, void *data, int offset, int len)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -89,6 +87,7 @@ void gp2x_memset_all_buffers(int offset, int byte, int len)
|
||||||
|
|
||||||
void gp2x_pd_clone_buffer2(void)
|
void gp2x_pd_clone_buffer2(void)
|
||||||
{
|
{
|
||||||
|
memset(gp2x_screen, 0, 800*480*2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -140,11 +139,10 @@ int gp2x_touchpad_read(int *x, int *y)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//static int s_oldrate = 0, s_oldbits = 0, s_oldstereo = 0;
|
static int s_oldrate = 0, s_oldbits = 0, s_oldstereo = 0;
|
||||||
|
|
||||||
void gp2x_start_sound(int rate, int bits, int stereo)
|
void gp2x_start_sound(int rate, int bits, int stereo)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
int frag = 0, bsize, buffers;
|
int frag = 0, bsize, buffers;
|
||||||
|
|
||||||
// if no settings change, we don't need to do anything
|
// if no settings change, we don't need to do anything
|
||||||
|
@ -171,13 +169,12 @@ void gp2x_start_sound(int rate, int bits, int stereo)
|
||||||
rate, bits, stereo?"stereo":"mono", frag>>16, 1<<(frag&0xffff));
|
rate, bits, stereo?"stereo":"mono", frag>>16, 1<<(frag&0xffff));
|
||||||
|
|
||||||
s_oldrate = rate; s_oldbits = bits; s_oldstereo = stereo;
|
s_oldrate = rate; s_oldbits = bits; s_oldstereo = stereo;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gp2x_sound_write(void *buff, int len)
|
void gp2x_sound_write(void *buff, int len)
|
||||||
{
|
{
|
||||||
// write(sounddev, buff, len);
|
write(sounddev, buff, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gp2x_sound_sync(void)
|
void gp2x_sound_sync(void)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue