summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2006-11-18 02:18:29 +0000
committerMichael Sevakis <jethead71@rockbox.org>2006-11-18 02:18:29 +0000
commitacc29d95be85c9cfd0d8f74dda813d7d1082e2ec (patch)
tree81fdd154d122b393d6254968cba5bc90b63e4741 /apps/plugins
parente2a262ee258769136eadc58c2bc8e3aa53db1a71 (diff)
downloadrockbox-acc29d95be85c9cfd0d8f74dda813d7d1082e2ec.tar.gz
rockbox-acc29d95be85c9cfd0d8f74dda813d7d1082e2ec.zip
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
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/doom/rockdoom.c19
-rw-r--r--apps/plugins/midiplay.c15
-rw-r--r--apps/plugins/mp3_encoder.c14
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c14
-rw-r--r--apps/plugins/pacbox/pacbox.c22
-rw-r--r--apps/plugins/rockboy/rockboy.c16
-rw-r--r--apps/plugins/zxbox/zxbox.c17
7 files changed, 17 insertions, 100 deletions
diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c
index 2b42322daa..8b73a5bb96 100644
--- a/apps/plugins/doom/rockdoom.c
+++ b/apps/plugins/doom/rockdoom.c
@@ -39,14 +39,7 @@
39#include "st_stuff.h" 39#include "st_stuff.h"
40 40
41PLUGIN_HEADER 41PLUGIN_HEADER
42 42PLUGIN_IRAM_DECLARE
43#ifdef USE_IRAM
44extern char iramcopy[];
45extern char iramstart[];
46extern char iramend[];
47extern char iedata[];
48extern char iend[];
49#endif
50 43
51extern boolean timingdemo, singledemo, demoplayback, fastdemo; // killough 44extern boolean timingdemo, singledemo, demoplayback, fastdemo; // killough
52 45
@@ -785,13 +778,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
785 rb->cpu_boost(true); 778 rb->cpu_boost(true);
786#endif 779#endif
787 780
788#ifdef USE_IRAM 781 PLUGIN_IRAM_INIT(rb)
789 /* We need to stop audio playback in order to use IRAM */
790 rb->audio_stop();
791
792 memcpy(iramstart, iramcopy, iramend-iramstart);
793 memset(iedata, 0, iend - iedata);
794#endif
795 782
796 rb->lcd_setfont(0); 783 rb->lcd_setfont(0);
797 784
@@ -830,7 +817,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
830 if (result < 0) 817 if (result < 0)
831 { 818 {
832#ifdef HAVE_ADJUSTABLE_CPU_FREQ 819#ifdef HAVE_ADJUSTABLE_CPU_FREQ
833 rb->cpu_boost(false); 820 rb->cpu_boost(false);
834#endif 821#endif
835 if( result == -1 ) return PLUGIN_OK; // Quit was selected 822 if( result == -1 ) return PLUGIN_OK; // Quit was selected
836 else if( result == -2 ) return PLUGIN_ERROR; // Missing base wads 823 else if( result == -2 ) return PLUGIN_ERROR; // Missing base wads
diff --git a/apps/plugins/midiplay.c b/apps/plugins/midiplay.c
index 585c7eec25..a0e7d0e3c2 100644
--- a/apps/plugins/midiplay.c
+++ b/apps/plugins/midiplay.c
@@ -19,7 +19,7 @@
19#include "../../plugin.h" 19#include "../../plugin.h"
20 20
21PLUGIN_HEADER 21PLUGIN_HEADER
22 22PLUGIN_IRAM_DECLARE
23 23
24/* variable button definitions */ 24/* variable button definitions */
25#if CONFIG_KEYPAD == RECORDER_PAD 25#if CONFIG_KEYPAD == RECORDER_PAD
@@ -102,14 +102,6 @@ short gmbuf[BUF_SIZE*NBUF] IBSS_ATTR;
102int quit=0; 102int quit=0;
103struct plugin_api * rb; 103struct plugin_api * rb;
104 104
105#ifdef USE_IRAM
106extern char iramcopy[];
107extern char iramstart[];
108extern char iramend[];
109extern char iedata[];
110extern char iend[];
111#endif
112
113enum plugin_status plugin_start(struct plugin_api* api, void* parameter) 105enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
114{ 106{
115 int retval = 0; 107 int retval = 0;
@@ -122,10 +114,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
122 } 114 }
123 rb->lcd_setfont(0); 115 rb->lcd_setfont(0);
124 116
125#ifdef USE_IRAM 117 PLUGIN_IRAM_INIT(rb)
126 rb->memcpy(iramstart, iramcopy, iramend-iramstart);
127 rb->memset(iedata, 0, iend - iedata);
128#endif
129 118
130#if defined(HAVE_ADJUSTABLE_CPU_FREQ) 119#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
131 rb->cpu_boost(true); 120 rb->cpu_boost(true);
diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c
index 6d66111d16..5bfd384349 100644
--- a/apps/plugins/mp3_encoder.c
+++ b/apps/plugins/mp3_encoder.c
@@ -14,17 +14,10 @@
14#include "plugin.h" 14#include "plugin.h"
15 15
16PLUGIN_HEADER 16PLUGIN_HEADER
17PLUGIN_IRAM_DECLARE
17 18
18static struct plugin_api* rb; 19static struct plugin_api* rb;
19 20
20#ifdef USE_IRAM
21extern char iramcopy[];
22extern char iramstart[];
23extern char iramend[];
24extern char iedata[];
25extern char iend[];
26#endif
27
28#define SAMP_PER_FRAME 1152 21#define SAMP_PER_FRAME 1152
29#define SAMPL2 576 22#define SAMPL2 576
30#define SBLIMIT 32 23#define SBLIMIT 32
@@ -2377,10 +2370,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
2377 asm volatile ("move.l #0, %macsr"); /* integer mode */ 2370 asm volatile ("move.l #0, %macsr"); /* integer mode */
2378#endif 2371#endif
2379 2372
2380#ifdef USE_IRAM 2373 PLUGIN_IRAM_INIT(rb)
2381 memcpy(iramstart, iramcopy, iramend - iramstart);
2382 memset(iedata, 0, iend - iedata);
2383#endif
2384 2374
2385 rb->lcd_setfont(FONT_SYSFIXED); 2375 rb->lcd_setfont(FONT_SYSFIXED);
2386 2376
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 980061f050..0fbd0f01e6 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -31,14 +31,7 @@
31#include "video_out.h" 31#include "video_out.h"
32 32
33PLUGIN_HEADER 33PLUGIN_HEADER
34 34PLUGIN_IRAM_DECLARE
35#ifdef USE_IRAM
36extern char iramcopy[];
37extern char iramstart[];
38extern char iramend[];
39extern char iedata[];
40extern char iend[];
41#endif
42 35
43struct plugin_api* rb; 36struct plugin_api* rb;
44 37
@@ -319,10 +312,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
319 if (buffer == NULL) 312 if (buffer == NULL)
320 return PLUGIN_ERROR; 313 return PLUGIN_ERROR;
321 314
322#ifdef USE_IRAM 315 PLUGIN_IRAM_INIT(rb)
323 rb->memcpy(iramstart, iramcopy, iramend-iramstart);
324 rb->memset(iedata, 0, iend - iedata);
325#endif
326 316
327 rb->lcd_set_backdrop(NULL); 317 rb->lcd_set_backdrop(NULL);
328 318
diff --git a/apps/plugins/pacbox/pacbox.c b/apps/plugins/pacbox/pacbox.c
index 7c2d1e21ca..62f5bcd413 100644
--- a/apps/plugins/pacbox/pacbox.c
+++ b/apps/plugins/pacbox/pacbox.c
@@ -29,14 +29,7 @@
29#include "lib/configfile.h" 29#include "lib/configfile.h"
30 30
31PLUGIN_HEADER 31PLUGIN_HEADER
32 32PLUGIN_IRAM_DECLARE
33#ifdef USE_IRAM
34extern char iramcopy[];
35extern char iramstart[];
36extern char iramend[];
37extern char iedata[];
38extern char iend[];
39#endif
40 33
41struct plugin_api* rb; 34struct plugin_api* rb;
42 35
@@ -370,21 +363,10 @@ static int gameProc( void )
370enum plugin_status plugin_start(struct plugin_api* api, void* parameter) 363enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
371{ 364{
372 (void)parameter; 365 (void)parameter;
373#ifdef USE_IRAM
374 void* audiobuf;
375 int audiosize;
376#endif
377 366
378 rb = api; 367 rb = api;
379 368
380#ifdef USE_IRAM 369 PLUGIN_IRAM_INIT(rb)
381 /* We need to stop audio playback in order to use IRAM, so we grab
382 the audio buffer - but we don't use it. */
383 audiobuf = rb->plugin_get_audio_buffer(&audiosize);
384
385 rb->memcpy(iramstart, iramcopy, iramend-iramstart);
386 rb->memset(iedata, 0, iend - iedata);
387#endif
388 370
389#ifdef HAVE_ADJUSTABLE_CPU_FREQ 371#ifdef HAVE_ADJUSTABLE_CPU_FREQ
390 rb->cpu_boost(true); 372 rb->cpu_boost(true);
diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c
index f82b0c283a..6a72856bbb 100644
--- a/apps/plugins/rockboy/rockboy.c
+++ b/apps/plugins/rockboy/rockboy.c
@@ -21,14 +21,7 @@
21#include "rockmacros.h" 21#include "rockmacros.h"
22 22
23PLUGIN_HEADER 23PLUGIN_HEADER
24 24PLUGIN_IRAM_DECLARE
25#ifdef USE_IRAM
26extern char iramcopy[];
27extern char iramstart[];
28extern char iramend[];
29extern char iedata[];
30extern char iend[];
31#endif
32 25
33/* here is a global api struct pointer. while not strictly necessary, 26/* here is a global api struct pointer. while not strictly necessary,
34 it's nice not to have to pass the api pointer in all function calls 27 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)
187 audio_buffer_free = plugin_start_addr - (unsigned char *)audio_bufferbase; 180 audio_buffer_free = plugin_start_addr - (unsigned char *)audio_bufferbase;
188#endif 181#endif
189 setoptions(); 182 setoptions();
190#ifdef USE_IRAM 183
191 memcpy(iramstart, iramcopy, iramend-iramstart); 184 PLUGIN_IRAM_INIT(rb)
192 memset(iedata, 0, iend - iedata); 185
193#endif
194 shut=0; 186 shut=0;
195 cleanshut=0; 187 cleanshut=0;
196 188
diff --git a/apps/plugins/zxbox/zxbox.c b/apps/plugins/zxbox/zxbox.c
index 54a11d010e..753fb1ff5b 100644
--- a/apps/plugins/zxbox/zxbox.c
+++ b/apps/plugins/zxbox/zxbox.c
@@ -20,6 +20,7 @@
20#include "zxconfig.h" 20#include "zxconfig.h"
21 21
22PLUGIN_HEADER 22PLUGIN_HEADER
23PLUGIN_IRAM_DECLARE
23 24
24struct plugin_api* rb; 25struct plugin_api* rb;
25 26
@@ -37,14 +38,6 @@ int use_shm = 0;
37int small_screen,pause_on_iconify; 38int small_screen,pause_on_iconify;
38int vga_pause_bg; 39int vga_pause_bg;
39 40
40#ifdef USE_IRAM
41extern char iramcopy[];
42extern char iramstart[];
43extern char iramend[];
44extern char iedata[];
45extern char iend[];
46#endif
47
48#include "keymaps.h" 41#include "keymaps.h"
49#include "zxvid_com.h" 42#include "zxvid_com.h"
50#include "spmain.h" 43#include "spmain.h"
@@ -75,13 +68,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
75 rb->lcd_set_backdrop(NULL); 68 rb->lcd_set_backdrop(NULL);
76 rb->splash(HZ, true, "Welcome to ZXBox"); 69 rb->splash(HZ, true, "Welcome to ZXBox");
77 70
78#ifdef USE_IRAM 71 PLUGIN_IRAM_INIT(rb)
79 /* We need to stop audio playback in order to use IRAM */
80 rb->audio_stop();
81
82 rb->memcpy(iramstart, iramcopy, iramend-iramstart);
83 rb->memset(iedata, 0, iend - iedata);
84#endif
85 72
86 sp_init(); 73 sp_init();
87 74