forked from len0rd/rockbox
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:
parent
e2a262ee25
commit
acc29d95be
15 changed files with 204 additions and 125 deletions
|
|
@ -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,10 +686,21 @@ 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
|
||||
instruct it to free its resources before a new plugin gets loaded. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue