From acc29d95be85c9cfd0d8f74dda813d7d1082e2ec Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sat, 18 Nov 2006 02:18:29 +0000 Subject: 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 --- apps/plugin.h | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'apps/plugin.h') diff --git a/apps/plugin.h b/apps/plugin.h index e9a6cfdaed..608009d549 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -107,7 +107,7 @@ #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 35 +#define PLUGIN_API_VERSION 36 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any @@ -582,6 +582,11 @@ struct plugin_api { #if LCD_DEPTH > 1 void (*lcd_set_backdrop)(fb_data* backdrop); #endif + +#ifdef IRAM_STEAL + void (*plugin_iram_init)(char *iramstart, char *iramcopy, size_t iram_size, + char *iedata, size_t iedata_size); +#endif }; /* plugin header */ @@ -593,6 +598,7 @@ struct plugin_header { unsigned char *end_addr; enum plugin_status(*entry_point)(struct plugin_api*, void*); }; + #ifdef PLUGIN #ifndef SIMULATOR extern unsigned char plugin_start_addr[]; @@ -607,12 +613,33 @@ extern unsigned char plugin_end_addr[]; const struct plugin_header __header = { \ PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ NULL, NULL, plugin_start }; -#endif -#endif +#endif /* SIMULATOR */ + +#ifdef USE_IRAM +/* Declare IRAM variables */ +#define PLUGIN_IRAM_DECLARE \ + extern char iramcopy[]; \ + extern char iramstart[]; \ + extern char iramend[]; \ + extern char iedata[]; \ + extern char iend[]; +/* Initialize IRAM */ +#define PLUGIN_IRAM_INIT(api) \ + (api)->plugin_iram_init(iramstart, iramcopy, iramend-iramstart, \ + iedata, iend-iedata); +#else +#define PLUGIN_IRAM_DECLARE +#define PLUGIN_IRAM_INIT(api) +#endif /* USE_IRAM */ +#endif /* PLUGIN */ int plugin_load(const char* plugin, void* parameter); void* plugin_get_buffer(int *buffer_size); void* plugin_get_audio_buffer(int *buffer_size); +#ifdef IRAM_STEAL +void plugin_iram_init(char *iramstart, char *iramcopy, size_t iram_size, + char *iedata, size_t iedata_size); +#endif /* plugin_tsr, callback returns true to allow the new plugin to load, -- cgit v1.2.3