SWCODEC/IRAM: Save voice IRAM when a plugin initializes its IRAM. Defines two macros for declaring and initializing IRAM. Plugins should use these instead. See mp3_encoder, doom, etc. for details. Further tweaks in buffer restoration after other use. Hiding of some interfaces that should only be used by buffer management.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11544 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2006-11-18 02:18:29 +00:00
parent e2a262ee25
commit acc29d95be
15 changed files with 204 additions and 125 deletions

View file

@ -39,14 +39,7 @@
#include "st_stuff.h"
PLUGIN_HEADER
#ifdef USE_IRAM
extern char iramcopy[];
extern char iramstart[];
extern char iramend[];
extern char iedata[];
extern char iend[];
#endif
PLUGIN_IRAM_DECLARE
extern boolean timingdemo, singledemo, demoplayback, fastdemo; // killough
@ -785,13 +778,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->cpu_boost(true);
#endif
#ifdef USE_IRAM
/* We need to stop audio playback in order to use IRAM */
rb->audio_stop();
memcpy(iramstart, iramcopy, iramend-iramstart);
memset(iedata, 0, iend - iedata);
#endif
PLUGIN_IRAM_INIT(rb)
rb->lcd_setfont(0);
@ -830,7 +817,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
if (result < 0)
{
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(false);
rb->cpu_boost(false);
#endif
if( result == -1 ) return PLUGIN_OK; // Quit was selected
else if( result == -2 ) return PLUGIN_ERROR; // Missing base wads

View file

@ -19,7 +19,7 @@
#include "../../plugin.h"
PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
@ -102,14 +102,6 @@ short gmbuf[BUF_SIZE*NBUF] IBSS_ATTR;
int quit=0;
struct plugin_api * rb;
#ifdef USE_IRAM
extern char iramcopy[];
extern char iramstart[];
extern char iramend[];
extern char iedata[];
extern char iend[];
#endif
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
int retval = 0;
@ -122,10 +114,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
}
rb->lcd_setfont(0);
#ifdef USE_IRAM
rb->memcpy(iramstart, iramcopy, iramend-iramstart);
rb->memset(iedata, 0, iend - iedata);
#endif
PLUGIN_IRAM_INIT(rb)
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
rb->cpu_boost(true);

View file

@ -14,17 +14,10 @@
#include "plugin.h"
PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
static struct plugin_api* rb;
#ifdef USE_IRAM
extern char iramcopy[];
extern char iramstart[];
extern char iramend[];
extern char iedata[];
extern char iend[];
#endif
#define SAMP_PER_FRAME 1152
#define SAMPL2 576
#define SBLIMIT 32
@ -2377,10 +2370,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
asm volatile ("move.l #0, %macsr"); /* integer mode */
#endif
#ifdef USE_IRAM
memcpy(iramstart, iramcopy, iramend - iramstart);
memset(iedata, 0, iend - iedata);
#endif
PLUGIN_IRAM_INIT(rb)
rb->lcd_setfont(FONT_SYSFIXED);

View file

@ -31,14 +31,7 @@
#include "video_out.h"
PLUGIN_HEADER
#ifdef USE_IRAM
extern char iramcopy[];
extern char iramstart[];
extern char iramend[];
extern char iedata[];
extern char iend[];
#endif
PLUGIN_IRAM_DECLARE
struct plugin_api* rb;
@ -319,10 +312,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
if (buffer == NULL)
return PLUGIN_ERROR;
#ifdef USE_IRAM
rb->memcpy(iramstart, iramcopy, iramend-iramstart);
rb->memset(iedata, 0, iend - iedata);
#endif
PLUGIN_IRAM_INIT(rb)
rb->lcd_set_backdrop(NULL);

View file

@ -29,14 +29,7 @@
#include "lib/configfile.h"
PLUGIN_HEADER
#ifdef USE_IRAM
extern char iramcopy[];
extern char iramstart[];
extern char iramend[];
extern char iedata[];
extern char iend[];
#endif
PLUGIN_IRAM_DECLARE
struct plugin_api* rb;
@ -370,21 +363,10 @@ static int gameProc( void )
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
(void)parameter;
#ifdef USE_IRAM
void* audiobuf;
int audiosize;
#endif
rb = api;
#ifdef USE_IRAM
/* We need to stop audio playback in order to use IRAM, so we grab
the audio buffer - but we don't use it. */
audiobuf = rb->plugin_get_audio_buffer(&audiosize);
rb->memcpy(iramstart, iramcopy, iramend-iramstart);
rb->memset(iedata, 0, iend - iedata);
#endif
PLUGIN_IRAM_INIT(rb)
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(true);

View file

@ -21,14 +21,7 @@
#include "rockmacros.h"
PLUGIN_HEADER
#ifdef USE_IRAM
extern char iramcopy[];
extern char iramstart[];
extern char iramend[];
extern char iedata[];
extern char iend[];
#endif
PLUGIN_IRAM_DECLARE
/* here is a global api struct pointer. while not strictly necessary,
it's nice not to have to pass the api pointer in all function calls
@ -187,10 +180,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
audio_buffer_free = plugin_start_addr - (unsigned char *)audio_bufferbase;
#endif
setoptions();
#ifdef USE_IRAM
memcpy(iramstart, iramcopy, iramend-iramstart);
memset(iedata, 0, iend - iedata);
#endif
PLUGIN_IRAM_INIT(rb)
shut=0;
cleanshut=0;

View file

@ -20,6 +20,7 @@
#include "zxconfig.h"
PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
struct plugin_api* rb;
@ -37,14 +38,6 @@ int use_shm = 0;
int small_screen,pause_on_iconify;
int vga_pause_bg;
#ifdef USE_IRAM
extern char iramcopy[];
extern char iramstart[];
extern char iramend[];
extern char iedata[];
extern char iend[];
#endif
#include "keymaps.h"
#include "zxvid_com.h"
#include "spmain.h"
@ -75,13 +68,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->lcd_set_backdrop(NULL);
rb->splash(HZ, true, "Welcome to ZXBox");
#ifdef USE_IRAM
/* We need to stop audio playback in order to use IRAM */
rb->audio_stop();
rb->memcpy(iramstart, iramcopy, iramend-iramstart);
rb->memset(iedata, 0, iend - iedata);
#endif
PLUGIN_IRAM_INIT(rb)
sp_init();