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.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'apps/plugin.c') diff --git a/apps/plugin.c b/apps/plugin.c index 90b3837cf8..a00a54e4ec 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -471,6 +471,9 @@ static const struct plugin_api rockbox_api = { lcd_set_backdrop, #endif +#ifdef IRAM_STEAL + plugin_iram_init, +#endif }; int plugin_load(const char* plugin, void* parameter) @@ -683,9 +686,20 @@ void* plugin_get_audio_buffer(int* buffer_size) audio_stop(); talk_buffer_steal(); /* we use the mp3 buffer, need to tell */ *buffer_size = audiobufend - audiobuf; -#endif return audiobuf; +#endif +} + +#ifdef IRAM_STEAL +/* Initializes plugin IRAM */ +void plugin_iram_init(char *iramstart, char *iramcopy, size_t iram_size, + char *iedata, size_t iedata_size) +{ + audio_iram_steal(); + memcpy(iramstart, iramcopy, iram_size); + memset(iedata, 0, iedata_size); } +#endif /* IRAM_STEAL */ /* The plugin wants to stay resident after leaving its main function, e.g. runs from timer or own thread. The callback is registered to later -- cgit v1.2.3