X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fgp2x%2F940ctl.c;h=f6073d0edf68d63afedde228d968dedf4d84f022;hb=093b8a420ef1834c75b2cb86c3fce9784789c638;hp=ee250f8a14476d63e1e6c37226b1a4ef27ec5dc4;hpb=52250671ae14d00dfcb52d137f73c9b565493279;p=picodrive.git diff --git a/platform/gp2x/940ctl.c b/platform/gp2x/940ctl.c index ee250f8..f6073d0 100644 --- a/platform/gp2x/940ctl.c +++ b/platform/gp2x/940ctl.c @@ -11,22 +11,16 @@ #include #include "code940/940shared.h" -#include "gp2x.h" -#include "emu.h" -#include "menu.h" +#include "soc_mmsp2.h" +#include "soc.h" #include "../common/mp3.h" #include "../common/arm_utils.h" #include "../common/menu.h" #include "../common/emu.h" -#include "../../Pico/PicoInt.h" -#include "../../Pico/sound/ym2612.h" -#include "../../Pico/sound/mix.h" +#include "../../pico/pico_int.h" +#include "../../pico/sound/ym2612.h" +#include "../../pico/sound/mix.h" -/* we will need some gp2x internals here */ -extern volatile unsigned short *gp2x_memregs; /* from minimal library rlyeh */ -extern volatile unsigned long *gp2x_memregl; - -extern int reset_timing; static unsigned char *shared_mem = 0; static _940_data_t *shared_data = 0; _940_ctl_t *shared_ctl = 0; @@ -150,7 +144,7 @@ static void wait_busy_940(int job) gp2x_memregs[0x3b46>>1], gp2x_memregl[0x4500>>2], gp2x_memregl[0x4510>>2]); printf("last lr: %08x, lastjob: %i\n", shared_ctl->last_lr, shared_ctl->lastjob); - strcpy(menuErrorMsg, "940 crashed, too much overclock?"); + me_update_msg("940 crashed, too much overclock?"); engineState = PGS_Menu; crashed_940 = 1; } @@ -247,7 +241,7 @@ static void internal_reset(void) /* this must be called after mmu hack, the allocated regions must not get cached */ -void sharedmem_init(void) +void sharedmem940_init(void) { if (shared_mem != NULL) return; @@ -270,7 +264,7 @@ void sharedmem_init(void) } -void sharedmem_deinit(void) +void sharedmem940_finish(void) { munmap(shared_mem, 0x210000); munmap(mp3_mem, MP3_SIZE_MAX); @@ -287,8 +281,8 @@ void YM2612Init_940(int baseclock, int rate) printf("YM2612Init_940()\n"); printf("Mem usage: shared_data: %i, shared_ctl: %i\n", sizeof(*shared_data), sizeof(*shared_ctl)); - Reset940(1, 2); - Pause940(1); + reset940(1, 2); + pause940(1); gp2x_memregs[0x3B40>>1] = 0; // disable DUALCPU interrupts for 920 gp2x_memregs[0x3B42>>1] = 1; // enable DUALCPU interrupts for 940 @@ -313,7 +307,7 @@ void YM2612Init_940(int baseclock, int rate) fp = fopen(binpath, "rb"); if(!fp) { - memset(gp2x_screen, 0, 320*240*2); + memset(g_screen_ptr, 0, 320*240*2); text_out16(10, 100, "failed to open required file:"); text_out16(10, 110, CODE940_FILE); gp2x_video_flip2(); @@ -348,8 +342,8 @@ void YM2612Init_940(int baseclock, int rate) gp2x_memregl[0x4510>>2] = 0xffffffff; // clear pending IRQs in INTPND /* start the 940 */ - Reset940(0, 2); - Pause940(0); + reset940(0, 2); + pause940(0); // YM2612ResetChip_940(); // will be done on JOB940_YM2612INIT @@ -508,7 +502,7 @@ void mp3_start_play(FILE *f, int pos) // pos is 0-1023 shared_ctl->mp3_len = ftell(f); loaded_mp3 = f; - if (PicoOpt&0x200) { + if (PicoOpt & POPT_EXT_FM) { // as we are going to change 940's cacheable area, we must invalidate it's cache.. if (CHECK_BUSY(JOB940_MP3DECODE)) wait_busy_940(JOB940_MP3DECODE); add_job_940(JOB940_INVALIDATE_DCACHE); @@ -522,7 +516,7 @@ void mp3_start_play(FILE *f, int pos) // pos is 0-1023 byte_offs *= pos; byte_offs >>= 6; } - // printf("mp3 pos1024: %i, byte_offs %i/%i\n", pos, byte_offs, shared_ctl->mp3_len); + printf(" mp3 pos1024: %i, byte_offs %i/%i\n", pos, byte_offs, shared_ctl->mp3_len); shared_ctl->mp3_offs = byte_offs; @@ -531,7 +525,13 @@ void mp3_start_play(FILE *f, int pos) // pos is 0-1023 mp3_job_started = 0; shared_ctl->mp3_buffsel = 1; // will change to 0 on first decode - if (!(PicoOpt&0x200)) mp3_start_local(); + if (PicoOpt & POPT_EXT_FM) + { + add_job_940(JOB940_MP3RESET); + if (CHECK_BUSY(JOB940_MP3RESET)) wait_busy_940(JOB940_MP3RESET); + } + else + mp3_start_local(); }