mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
make gp2x mp3 playback functional (need to unpack and compile helix decoder separately in platform/common/helix)
This commit is contained in:
parent
c79d0bb90f
commit
340e528ff8
13 changed files with 274 additions and 59 deletions
4
Makefile
4
Makefile
|
@ -159,8 +159,10 @@ endif
|
||||||
|
|
||||||
endif # USE_FRONTEND
|
endif # USE_FRONTEND
|
||||||
|
|
||||||
OBJS += platform/common/mp3.o
|
OBJS += platform/common/mp3.o platform/common/mp3_sync.o
|
||||||
ifeq "$(PLATFORM_MP3)" "1"
|
ifeq "$(PLATFORM_MP3)" "1"
|
||||||
|
platform/common/mp3_helix.o: CFLAGS += -Iplatform/libpicofe
|
||||||
|
OBJS += platform/common/mp3_helix.o
|
||||||
else ifeq "$(HAVE_LIBAVCODEC)" "1"
|
else ifeq "$(HAVE_LIBAVCODEC)" "1"
|
||||||
OBJS += platform/common/mp3_libavcodec.o
|
OBJS += platform/common/mp3_libavcodec.o
|
||||||
else
|
else
|
||||||
|
|
42
platform/common/helix/Makefile
Normal file
42
platform/common/helix/Makefile
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
CROSS ?= arm-linux-gnueabi-
|
||||||
|
|
||||||
|
CC = $(CROSS)gcc
|
||||||
|
AS = $(CROSS)as
|
||||||
|
AR = $(CROSS)ar
|
||||||
|
TOOLCHAIN = $(notdir $(CROSS))
|
||||||
|
|
||||||
|
CFLAGS += -Ipub -O2 -Wall -fstrict-aliasing -ffast-math
|
||||||
|
ifneq ($(findstring arm-,$(TOOLCHAIN)),)
|
||||||
|
CFLAGS += -mcpu=arm940t -mtune=arm940t -mfloat-abi=soft -mfpu=fpa -mabi=apcs-gnu -mno-thumb-interwork
|
||||||
|
ASFLAGS = -mcpu=arm940t -mfloat-abi=soft -mfpu=fpa -mabi=apcs-gnu
|
||||||
|
OBJS += real/arm/asmpoly_gcc.o
|
||||||
|
else
|
||||||
|
CFLAGS += -m32
|
||||||
|
ASFLAGS += -m32
|
||||||
|
OBJS += real/polyphase.o
|
||||||
|
endif
|
||||||
|
|
||||||
|
LIB = $(TOOLCHAIN)helix_mp3.a
|
||||||
|
SHLIB = $(TOOLCHAIN)helix_mp3.so
|
||||||
|
|
||||||
|
all: $(LIB) $(SHLIB)
|
||||||
|
|
||||||
|
|
||||||
|
OBJS += mp3dec.o mp3tabs.o
|
||||||
|
#OBJS += ipp/bitstream.o ipp/buffers.o ipp/dequant.o ipp/huffman.o ipp/imdct.o ipp/subband.o
|
||||||
|
OBJS += real/bitstream.o real/buffers.o real/dct32.o real/dequant.o real/dqchan.o real/huffman.o
|
||||||
|
OBJS += real/hufftabs.o real/imdct.o real/scalfact.o real/stproc.o real/subband.o real/trigtabs.o
|
||||||
|
|
||||||
|
OBJS += lib.o
|
||||||
|
|
||||||
|
real/arm/asmpoly_gcc.o: real/arm/asmpoly_gcc.s
|
||||||
|
$(CC) -o $@ $(ASFLAGS) -c $<
|
||||||
|
|
||||||
|
$(LIB) : $(OBJS)
|
||||||
|
$(AR) r $@ $^
|
||||||
|
$(SHLIB) : $(OBJS) /home/build/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/gcc/arm-open2x-linux/4.1.1/libgcc.a
|
||||||
|
$(CC) -o $@ -nostdlib -shared $(CFLAGS) $^
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) -f $(OBJS)
|
||||||
|
|
122
platform/common/helix/lib.c
Normal file
122
platform/common/helix/lib.c
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
// libgcc has this with gcc 4.x
|
||||||
|
void raise(int sig)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// very limited heap functions for helix decoder
|
||||||
|
|
||||||
|
static char heap[65000] __attribute__((aligned(16)));
|
||||||
|
static long heap_offs;
|
||||||
|
|
||||||
|
void __malloc_init(void)
|
||||||
|
{
|
||||||
|
heap_offs = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *malloc(size_t size)
|
||||||
|
{
|
||||||
|
void *chunk = heap + heap_offs;
|
||||||
|
size = (size+15) & ~15;
|
||||||
|
if (heap_offs + size > sizeof(heap))
|
||||||
|
return NULL;
|
||||||
|
else {
|
||||||
|
heap_offs += size;
|
||||||
|
return chunk;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void free(void *chunk)
|
||||||
|
{
|
||||||
|
if (chunk == heap)
|
||||||
|
heap_offs = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
void *memcpy (void *dest, const void *src, size_t n)
|
||||||
|
{
|
||||||
|
char *_dest = dest;
|
||||||
|
const char *_src = src;
|
||||||
|
while (n--) *_dest++ = *_src++;
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *memmove (void *dest, const void *src, size_t n)
|
||||||
|
{
|
||||||
|
char *_dest = dest+n;
|
||||||
|
const char *_src = src+n;
|
||||||
|
if (dest <= src || dest >= _src)
|
||||||
|
return memcpy(dest, src, n);
|
||||||
|
while (n--) *--_dest = *--_src;
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/* memcpy/memmove in C with some simple optimizations.
|
||||||
|
* ATTN does dirty aliasing tricks with undefined behaviour by standard.
|
||||||
|
* (this works fine with gcc, though...)
|
||||||
|
*/
|
||||||
|
void *memcpy(void *dest, const void *src, size_t n)
|
||||||
|
{
|
||||||
|
struct _16 { uint32_t a[4]; };
|
||||||
|
union { const void *v; char *c; uint64_t *l; struct _16 *s; }
|
||||||
|
ss = { src }, ds = { dest };
|
||||||
|
const int lm = sizeof(uint32_t)-1;
|
||||||
|
|
||||||
|
if ((((unsigned)ss.c ^ (unsigned)ds.c) & lm) == 0) {
|
||||||
|
/* fast copy if pointers have the same aligment */
|
||||||
|
while (((unsigned)ss.c & lm) && n > 0) /* align to word */
|
||||||
|
*ds.c++ = *ss.c++, n--;
|
||||||
|
while (n >= sizeof(struct _16)) /* copy 16 bytes blocks */
|
||||||
|
*ds.s++ = *ss.s++, n -= sizeof(struct _16);
|
||||||
|
if (n >= sizeof(uint64_t)) /* copy leftover 8 byte block */
|
||||||
|
*ds.l++ = *ss.l++, n -= sizeof(uint64_t);
|
||||||
|
} else {
|
||||||
|
/* byte copy if pointers are unaligned */
|
||||||
|
while (n >= 8) { /* copy 8 byte blocks */
|
||||||
|
*ds.c++ = *ss.c++, n--; *ds.c++ = *ss.c++, n--;
|
||||||
|
*ds.c++ = *ss.c++, n--; *ds.c++ = *ss.c++, n--;
|
||||||
|
*ds.c++ = *ss.c++, n--; *ds.c++ = *ss.c++, n--;
|
||||||
|
*ds.c++ = *ss.c++, n--; *ds.c++ = *ss.c++, n--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* copy max. 8 leftover bytes */
|
||||||
|
while (n > 0)
|
||||||
|
*ds.c++ = *ss.c++, n--;
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *memmove (void *dest, const void *src, size_t n)
|
||||||
|
{
|
||||||
|
struct _16 { uint32_t a[4]; };
|
||||||
|
union { const void *v; char *c; uint64_t *l; struct _16 *s; }
|
||||||
|
ss = { src+n }, ds = { dest+n };
|
||||||
|
const int lm = sizeof(uint32_t)-1;
|
||||||
|
|
||||||
|
if (dest <= src || dest >= src+n)
|
||||||
|
return memcpy(dest, src, n);
|
||||||
|
|
||||||
|
if ((((unsigned)ss.c ^ (unsigned)ds.c) & lm) == 0) {
|
||||||
|
/* fast copy if pointers have the same aligment */
|
||||||
|
while (((unsigned)ss.c & lm) && n > 0)
|
||||||
|
*--ds.c = *--ss.c, n--;
|
||||||
|
while (n >= sizeof(struct _16))
|
||||||
|
*--ds.s = *--ss.s, n -= sizeof(struct _16);
|
||||||
|
if (n >= sizeof(uint64_t))
|
||||||
|
*--ds.l = *--ss.l, n -= sizeof(uint64_t);
|
||||||
|
} else {
|
||||||
|
/* byte copy if pointers are unaligned */
|
||||||
|
while (n >= 8) {
|
||||||
|
*--ds.c = *--ss.c, n--; *--ds.c = *--ss.c, n--;
|
||||||
|
*--ds.c = *--ss.c, n--; *--ds.c = *--ss.c, n--;
|
||||||
|
*--ds.c = *--ss.c, n--; *--ds.c = *--ss.c, n--;
|
||||||
|
*--ds.c = *--ss.c, n--; *--ds.c = *--ss.c, n--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* copy max. 8 leftover bytes */
|
||||||
|
while (n > 0)
|
||||||
|
*--ds.c = *--ss.c, n--;
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -21,33 +21,6 @@ unsigned short mpeg1_l3_bitrates[16] = {
|
||||||
0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320
|
0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320
|
||||||
};
|
};
|
||||||
|
|
||||||
int mp3_find_sync_word(const unsigned char *buf, int size)
|
|
||||||
{
|
|
||||||
const unsigned char *p, *pe;
|
|
||||||
|
|
||||||
/* find byte-aligned syncword - need 12 (MPEG 1,2) or 11 (MPEG 2.5) matching bits */
|
|
||||||
for (p = buf, pe = buf + size - 3; p <= pe; p++)
|
|
||||||
{
|
|
||||||
int pn;
|
|
||||||
if (p[0] != 0xff)
|
|
||||||
continue;
|
|
||||||
pn = p[1];
|
|
||||||
if ((pn & 0xf8) != 0xf8 || // currently must be MPEG1
|
|
||||||
(pn & 6) == 0) { // invalid layer
|
|
||||||
p++; continue;
|
|
||||||
}
|
|
||||||
pn = p[2];
|
|
||||||
if ((pn & 0xf0) < 0x20 || (pn & 0xf0) == 0xf0 || // bitrates
|
|
||||||
(pn & 0x0c) != 0) { // not 44kHz
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
return p - buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int try_get_bitrate(unsigned char *buf, int buf_size)
|
static int try_get_bitrate(unsigned char *buf, int buf_size)
|
||||||
{
|
{
|
||||||
int offs1, offs = 0;
|
int offs1, offs = 0;
|
||||||
|
|
|
@ -12,8 +12,8 @@ int mp3dec_decode(FILE *f, int *file_pos, int file_len);
|
||||||
extern unsigned short mpeg1_l3_bitrates[16];
|
extern unsigned short mpeg1_l3_bitrates[16];
|
||||||
|
|
||||||
#ifdef __GP2X__
|
#ifdef __GP2X__
|
||||||
void mp3_update_local(int *buffer, int length, int stereo);
|
int _mp3dec_start(FILE *f, int fpos_start);
|
||||||
void mp3_start_play_local(void *f, int pos);
|
int _mp3dec_decode(FILE *f, int *file_pos, int file_len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // __COMMON_MP3_H__
|
#endif // __COMMON_MP3_H__
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
#include <pico/pico_int.h>
|
#include <pico/pico_int.h>
|
||||||
#include <pico/sound/mix.h>
|
#include <pico/sound/mix.h>
|
||||||
|
@ -20,10 +21,15 @@ static HMP3Decoder mp3dec;
|
||||||
static unsigned char mp3_input_buffer[2 * 1024];
|
static unsigned char mp3_input_buffer[2 * 1024];
|
||||||
|
|
||||||
#ifdef __GP2X__
|
#ifdef __GP2X__
|
||||||
#define mp3_update mp3_update_local
|
#define mp3dec_decode _mp3dec_decode
|
||||||
#define mp3_start_play mp3_start_play_local
|
#define mp3dec_start _mp3dec_start
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void *libhelix;
|
||||||
|
HMP3Decoder (*p_MP3InitDecoder)(void);
|
||||||
|
void (*p_MP3FreeDecoder)(HMP3Decoder);
|
||||||
|
int (*p_MP3Decode)(HMP3Decoder, unsigned char **, int *, short *, int);
|
||||||
|
|
||||||
int mp3dec_decode(FILE *f, int *file_pos, int file_len)
|
int mp3dec_decode(FILE *f, int *file_pos, int file_len)
|
||||||
{
|
{
|
||||||
unsigned char *readPtr;
|
unsigned char *readPtr;
|
||||||
|
@ -51,7 +57,7 @@ int mp3dec_decode(FILE *f, int *file_pos, int file_len)
|
||||||
bytesLeft -= offset;
|
bytesLeft -= offset;
|
||||||
|
|
||||||
had_err = err;
|
had_err = err;
|
||||||
err = MP3Decode(mp3dec, &readPtr, &bytesLeft, cdda_out_buffer, 0);
|
err = p_MP3Decode(mp3dec, &readPtr, &bytesLeft, cdda_out_buffer, 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
if (err == ERR_MP3_MAINDATA_UNDERFLOW && !had_err) {
|
if (err == ERR_MP3_MAINDATA_UNDERFLOW && !had_err) {
|
||||||
// just need another frame
|
// just need another frame
|
||||||
|
@ -86,10 +92,31 @@ int mp3dec_decode(FILE *f, int *file_pos, int file_len)
|
||||||
|
|
||||||
int mp3dec_start(FILE *f, int fpos_start)
|
int mp3dec_start(FILE *f, int fpos_start)
|
||||||
{
|
{
|
||||||
|
if (libhelix == NULL) {
|
||||||
|
libhelix = dlopen("./libhelix.so", RTLD_NOW);
|
||||||
|
if (libhelix == NULL) {
|
||||||
|
lprintf("mp3dec: load libhelix.so: %s\n", dlerror());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
p_MP3InitDecoder = dlsym(libhelix, "MP3InitDecoder");
|
||||||
|
p_MP3FreeDecoder = dlsym(libhelix, "MP3FreeDecoder");
|
||||||
|
p_MP3Decode = dlsym(libhelix, "MP3Decode");
|
||||||
|
|
||||||
|
if (p_MP3InitDecoder == NULL || p_MP3FreeDecoder == NULL
|
||||||
|
|| p_MP3Decode == NULL)
|
||||||
|
{
|
||||||
|
lprintf("mp3dec: missing symbol(s) in libhelix.so\n");
|
||||||
|
dlclose(libhelix);
|
||||||
|
libhelix = NULL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// must re-init decoder for new track
|
// must re-init decoder for new track
|
||||||
if (mp3dec)
|
if (mp3dec)
|
||||||
MP3FreeDecoder(mp3dec);
|
p_MP3FreeDecoder(mp3dec);
|
||||||
mp3dec = MP3InitDecoder();
|
mp3dec = p_MP3InitDecoder();
|
||||||
|
|
||||||
return (mp3dec == 0) ? -1 : 0;
|
return (mp3dec == 0) ? -1 : 0;
|
||||||
}
|
}
|
||||||
|
|
27
platform/common/mp3_sync.c
Normal file
27
platform/common/mp3_sync.c
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
|
||||||
|
int mp3_find_sync_word(const unsigned char *buf, int size)
|
||||||
|
{
|
||||||
|
const unsigned char *p, *pe;
|
||||||
|
|
||||||
|
/* find byte-aligned syncword - need 12 (MPEG 1,2) or 11 (MPEG 2.5) matching bits */
|
||||||
|
for (p = buf, pe = buf + size - 3; p <= pe; p++)
|
||||||
|
{
|
||||||
|
int pn;
|
||||||
|
if (p[0] != 0xff)
|
||||||
|
continue;
|
||||||
|
pn = p[1];
|
||||||
|
if ((pn & 0xf8) != 0xf8 || // currently must be MPEG1
|
||||||
|
(pn & 6) == 0) { // invalid layer
|
||||||
|
p++; continue;
|
||||||
|
}
|
||||||
|
pn = p[2];
|
||||||
|
if ((pn & 0xf0) < 0x20 || (pn & 0xf0) == 0xf0 || // bitrates
|
||||||
|
(pn & 0x0c) != 0) { // not 44kHz
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return p - buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
|
@ -425,8 +425,7 @@ int YM2612UpdateOne_940(int *buffer, int length, int stereo, int is_buf_empty)
|
||||||
int mp3dec_decode(FILE *f, int *file_pos, int file_len)
|
int mp3dec_decode(FILE *f, int *file_pos, int file_len)
|
||||||
{
|
{
|
||||||
if (!(PicoIn.opt & POPT_EXT_FM)) {
|
if (!(PicoIn.opt & POPT_EXT_FM)) {
|
||||||
//mp3_update_local(buffer, length, stereo);
|
return _mp3dec_decode(f, file_pos, file_len);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if playback was started, track not ended
|
// check if playback was started, track not ended
|
||||||
|
@ -457,8 +456,7 @@ int mp3dec_decode(FILE *f, int *file_pos, int file_len)
|
||||||
int mp3dec_start(FILE *f, int fpos_start)
|
int mp3dec_start(FILE *f, int fpos_start)
|
||||||
{
|
{
|
||||||
if (!(PicoIn.opt & POPT_EXT_FM)) {
|
if (!(PicoIn.opt & POPT_EXT_FM)) {
|
||||||
//mp3_start_play_local(f, pos);
|
return _mp3dec_start(f, fpos_start);
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loaded_mp3 != f)
|
if (loaded_mp3 != f)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// (c) Copyright 2006-2007, Grazvydas "notaz" Ignotas
|
// (c) Copyright 2006-2007, Grazvydas "notaz" Ignotas
|
||||||
|
|
||||||
#include "940shared.h"
|
#include "940shared.h"
|
||||||
#include "../../common/mp3.h"
|
#include "../../common/helix/pub/mp3dec.h"
|
||||||
|
|
||||||
static _940_data_t *shared_data = (_940_data_t *) 0x00100000;
|
static _940_data_t *shared_data = (_940_data_t *) 0x00100000;
|
||||||
static _940_ctl_t *shared_ctl = (_940_ctl_t *) 0x00200000;
|
static _940_ctl_t *shared_ctl = (_940_ctl_t *) 0x00200000;
|
||||||
|
@ -19,7 +19,7 @@ void drain_wb(void);
|
||||||
// is changed by other core just before we update it
|
// is changed by other core just before we update it
|
||||||
void set_if_not_changed(int *val, int oldval, int newval);
|
void set_if_not_changed(int *val, int oldval, int newval);
|
||||||
|
|
||||||
void _memcpy(void *dst, const void *src, int count);
|
extern void *memcpy(void *dest, const void *src, unsigned long n);
|
||||||
|
|
||||||
// asm volatile ("mov r0, #0" ::: "r0");
|
// asm volatile ("mov r0, #0" ::: "r0");
|
||||||
// asm volatile ("mcr p15, 0, r0, c7, c6, 0" ::: "r0"); /* flush dcache */
|
// asm volatile ("mcr p15, 0, r0, c7, c6, 0" ::: "r0"); /* flush dcache */
|
||||||
|
@ -153,6 +153,8 @@ void Main940(void)
|
||||||
int job = 0;
|
int job = 0;
|
||||||
ym2612_940 = &shared_data->ym2612;
|
ym2612_940 = &shared_data->ym2612;
|
||||||
|
|
||||||
|
// extern unsigned __bss_start__, __bss_end__;
|
||||||
|
// memset(&__bss_start__, 0, &__bss_end__ - &__bss_start__);
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@ -167,6 +169,7 @@ void Main940(void)
|
||||||
shared_ctl->writebuff0[0] = shared_ctl->writebuff1[0] = 0xffff;
|
shared_ctl->writebuff0[0] = shared_ctl->writebuff1[0] = 0xffff;
|
||||||
YM2612Init_(shared_ctl->baseclock, shared_ctl->rate);
|
YM2612Init_(shared_ctl->baseclock, shared_ctl->rate);
|
||||||
/* Helix mp3 decoder */
|
/* Helix mp3 decoder */
|
||||||
|
__malloc_init();
|
||||||
shared_data->mp3dec = MP3InitDecoder();
|
shared_data->mp3dec = MP3InitDecoder();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -185,7 +188,7 @@ void Main940(void)
|
||||||
|
|
||||||
case JOB940_PICOSTATESAVE2:
|
case JOB940_PICOSTATESAVE2:
|
||||||
YM2612PicoStateSave2(0, 0);
|
YM2612PicoStateSave2(0, 0);
|
||||||
_memcpy(shared_ctl->writebuff0, ym2612_940->REGS, 0x200);
|
memcpy(shared_ctl->writebuff0, ym2612_940->REGS, 0x200);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JOB940_PICOSTATELOAD2_PREP:
|
case JOB940_PICOSTATELOAD2_PREP:
|
||||||
|
@ -193,7 +196,7 @@ void Main940(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JOB940_PICOSTATELOAD2:
|
case JOB940_PICOSTATELOAD2:
|
||||||
_memcpy(ym2612_940->REGS, shared_ctl->writebuff0, 0x200);
|
memcpy(ym2612_940->REGS, shared_ctl->writebuff0, 0x200);
|
||||||
YM2612PicoStateLoad2(0, 0);
|
YM2612PicoStateLoad2(0, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -207,6 +210,7 @@ void Main940(void)
|
||||||
|
|
||||||
case JOB940_MP3RESET:
|
case JOB940_MP3RESET:
|
||||||
if (shared_data->mp3dec) MP3FreeDecoder(shared_data->mp3dec);
|
if (shared_data->mp3dec) MP3FreeDecoder(shared_data->mp3dec);
|
||||||
|
__malloc_init();
|
||||||
shared_data->mp3dec = MP3InitDecoder();
|
shared_data->mp3dec = MP3InitDecoder();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -215,4 +219,3 @@ void Main940(void)
|
||||||
dcache_clean();
|
dcache_clean();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,23 @@
|
||||||
# you may or may not need to change this
|
# you may or may not need to change this
|
||||||
#devkit_path = x:/stuff/dev/devkitgp2x/
|
#devkit_path ?= $(HOME)/opt/devkitGP2X/
|
||||||
devkit_path ?= $(HOME)/opt/devkitGP2X/
|
#lgcc_path = $(devkit_path)lib/gcc/arm-linux/4.0.3/
|
||||||
lgcc_path = $(devkit_path)lib/gcc/arm-linux/4.0.3/
|
|
||||||
CROSS = arm-linux-
|
|
||||||
#CROSS = $(devkit_path)bin/arm-linux-
|
#CROSS = $(devkit_path)bin/arm-linux-
|
||||||
|
#devkit_path ?= $(HOME)/opt/open2x
|
||||||
|
#lgcc_path = $(devkit_path)/gcc-4.1.1-glibc-2.3.6/lib/gcc/arm-open2x-linux/4.1.1/
|
||||||
|
#CROSS ?= $(devkit_path)/gcc-4.1.1-glibc-2.3.6/bin/arm-open2x-linux-
|
||||||
|
#devkit_path ?= $(HOME)/opt/arm-unknown-linux-gnu
|
||||||
|
#lgcc_path = $(HOME)/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/gcc/arm-open2x-linux/4.1.1/
|
||||||
|
#CROSS ?= $(devkit_path)/bin/arm-unknown-linux-gnu-
|
||||||
|
lgcc_path = $(HOME)/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/gcc/arm-open2x-linux/4.1.1/
|
||||||
|
CROSS ?= arm-linux-gnueabi-
|
||||||
|
|
||||||
# settings
|
# settings
|
||||||
#up = 1
|
#up = 1
|
||||||
|
|
||||||
CFLAGS += -O2 -Wall -fomit-frame-pointer -fstrict-aliasing -ffast-math
|
CFLAGS += -O2 -Wall -mno-thumb-interwork -fstrict-aliasing -ffast-math
|
||||||
CFLAGS += -I../.. -I. -D__GP2X__ -DARM
|
CFLAGS += -I../../common/helix/pub -I../../.. -I. -D__GP2X__ -DARM
|
||||||
CFLAGS += -mcpu=arm940t -mtune=arm940t
|
CFLAGS += -mcpu=arm940t -mtune=arm940t -mabi=apcs-gnu -mfloat-abi=soft -mfpu=fpa
|
||||||
LDFLAGS = -static -s -e code940 -Ttext 0x0 -L$(lgcc_path) -lgcc
|
LDFLAGS = -static -e code940 -Ttext 0x0 -L$(lgcc_path) -lgcc
|
||||||
|
|
||||||
GCC = $(CROSS)gcc
|
GCC = $(CROSS)gcc
|
||||||
STRIP = $(CROSS)strip
|
STRIP = $(CROSS)strip
|
||||||
|
@ -36,7 +42,9 @@ all: $(BIN)
|
||||||
# stuff for 940 core
|
# stuff for 940 core
|
||||||
|
|
||||||
# init, emu_control, emu
|
# init, emu_control, emu
|
||||||
OBJS940 += 940init.o 940.o 940ym2612.o memcpy.o misc_arm.o mp3.o
|
OBJS940 += 940init.o 940.o 940ym2612.o misc_arm.o mp3_sync.o
|
||||||
|
# the asm memcpy code crashes job LOAD2 on 940. Possibly a globbered reg?
|
||||||
|
# OBJS940 += memcpy.o
|
||||||
# the asm code seems to be faster when run on 920, but not on 940 for some reason
|
# the asm code seems to be faster when run on 920, but not on 940 for some reason
|
||||||
# OBJS940 += ../../Pico/sound/ym2612_asm.o
|
# OBJS940 += ../../Pico/sound/ym2612_asm.o
|
||||||
|
|
||||||
|
@ -44,12 +52,13 @@ OBJS940 += 940init.o 940.o 940ym2612.o memcpy.o misc_arm.o mp3.o
|
||||||
OBJS940 += uClibc/memset.o uClibc/s_floor.o uClibc/e_pow.o uClibc/e_sqrt.o uClibc/s_fabs.o
|
OBJS940 += uClibc/memset.o uClibc/s_floor.o uClibc/e_pow.o uClibc/e_sqrt.o uClibc/s_fabs.o
|
||||||
OBJS940 += uClibc/s_scalbn.o uClibc/s_copysign.o uClibc/k_sin.o uClibc/k_cos.o uClibc/s_sin.o
|
OBJS940 += uClibc/s_scalbn.o uClibc/s_copysign.o uClibc/k_sin.o uClibc/k_cos.o uClibc/s_sin.o
|
||||||
OBJS940 += uClibc/e_rem_pio2.o uClibc/k_rem_pio2.o uClibc/e_log.o uClibc/wrappers.o
|
OBJS940 += uClibc/e_rem_pio2.o uClibc/k_rem_pio2.o uClibc/e_log.o uClibc/wrappers.o
|
||||||
|
LIBHELIX ?= ../../common/helix/$(notdir $(CROSS))helix_mp3.a
|
||||||
|
|
||||||
$(BIN) : code940.elf
|
$(BIN) : code940.elf
|
||||||
@echo ">>>" $@
|
@echo ">>>" $@
|
||||||
$(OBJCOPY) -O binary $< $@
|
$(OBJCOPY) -O binary $< $@
|
||||||
|
|
||||||
code940.elf : $(OBJS940) ../../common/helix/$(CROSS)helix-mp3.a
|
code940.elf : $(OBJS940) $(LIBHELIX)
|
||||||
@echo ">>>" $@
|
@echo ">>>" $@
|
||||||
$(LD) $^ $(LDFLAGS) -o $@ -Map code940.map
|
$(LD) $^ $(LDFLAGS) -o $@ -Map code940.map
|
||||||
|
|
||||||
|
@ -64,8 +73,12 @@ misc_arm.o : ../../../pico/misc_arm.s
|
||||||
@echo ">>>" $@
|
@echo ">>>" $@
|
||||||
$(GCC) $(CFLAGS) -DEXTERNAL_YM2612 -c $< -o $@
|
$(GCC) $(CFLAGS) -DEXTERNAL_YM2612 -c $< -o $@
|
||||||
|
|
||||||
../../common/helix/helix_mp3.a:
|
mp3_sync.o: ../../common/mp3_sync.c
|
||||||
@make -C ../../common/helix/
|
@echo ">>>" $@
|
||||||
|
$(GCC) $(CFLAGS) -Os -DCODE940 -c $< -o $@
|
||||||
|
|
||||||
|
$(LIBHELIX):
|
||||||
|
@$(MAKE) -C ../../common/helix/ CROSS=$(CROSS)
|
||||||
|
|
||||||
|
|
||||||
up: $(BIN)
|
up: $(BIN)
|
||||||
|
@ -82,7 +95,7 @@ tidy:
|
||||||
##
|
##
|
||||||
OBJSMP3T = mp3test.o ../gp2x.o ../asmutils.o ../usbjoy.o
|
OBJSMP3T = mp3test.o ../gp2x.o ../asmutils.o ../usbjoy.o
|
||||||
|
|
||||||
mp3test.gpe : $(OBJSMP3T) ../helix/helix_mp3.a
|
mp3test.gpe : $(OBJSMP3T) $(LIBHELIX)
|
||||||
$(GCC) -static -o $@ $^
|
$(GCC) -static -o $@ $^
|
||||||
$(STRIP) $@
|
$(STRIP) $@
|
||||||
@cp -v $@ /mnt/gp2x/mnt/sd
|
@cp -v $@ /mnt/gp2x/mnt/sd
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
//#include "emu.h"
|
//#include "emu.h"
|
||||||
//#include "menu.h"
|
//#include "menu.h"
|
||||||
#include "../asmutils.h"
|
#include "../asmutils.h"
|
||||||
#include "../helix/pub/mp3dec.h"
|
#include "../../helix/pub/mp3dec.h"
|
||||||
|
|
||||||
/* we will need some gp2x internals here */
|
/* we will need some gp2x internals here */
|
||||||
extern volatile unsigned short *gp2x_memregs; /* from minimal library rlyeh */
|
extern volatile unsigned short *gp2x_memregs; /* from minimal library rlyeh */
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
.text
|
.text
|
||||||
.global memset
|
.global memset
|
||||||
.type memset,%function
|
.type memset,%function
|
||||||
.align 4
|
.align 2
|
||||||
|
|
||||||
memset:
|
memset:
|
||||||
mov a4, a1
|
mov a4, a1
|
||||||
|
|
|
@ -4,9 +4,17 @@ double pow(double x, double y)
|
||||||
{
|
{
|
||||||
return __ieee754_pow(x, y);
|
return __ieee754_pow(x, y);
|
||||||
}
|
}
|
||||||
|
double __pow_finite(double x, double y)
|
||||||
|
{
|
||||||
|
return __ieee754_pow(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
double log(double x)
|
double log(double x)
|
||||||
{
|
{
|
||||||
return __ieee754_log(x);
|
return __ieee754_log(x);
|
||||||
}
|
}
|
||||||
|
double __log_finite(double x)
|
||||||
|
{
|
||||||
|
return __ieee754_log(x);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue