diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2006-11-18 02:18:29 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2006-11-18 02:18:29 +0000 |
commit | acc29d95be85c9cfd0d8f74dda813d7d1082e2ec (patch) | |
tree | 81fdd154d122b393d6254968cba5bc90b63e4741 /apps/plugins | |
parent | e2a262ee258769136eadc58c2bc8e3aa53db1a71 (diff) | |
download | rockbox-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.c | 19 | ||||
-rw-r--r-- | apps/plugins/midiplay.c | 15 | ||||
-rw-r--r-- | apps/plugins/mp3_encoder.c | 14 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.c | 14 | ||||
-rw-r--r-- | apps/plugins/pacbox/pacbox.c | 22 | ||||
-rw-r--r-- | apps/plugins/rockboy/rockboy.c | 16 | ||||
-rw-r--r-- | apps/plugins/zxbox/zxbox.c | 17 |
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 | ||
41 | PLUGIN_HEADER | 41 | PLUGIN_HEADER |
42 | 42 | PLUGIN_IRAM_DECLARE | |
43 | #ifdef USE_IRAM | ||
44 | extern char iramcopy[]; | ||
45 | extern char iramstart[]; | ||
46 | extern char iramend[]; | ||
47 | extern char iedata[]; | ||
48 | extern char iend[]; | ||
49 | #endif | ||
50 | 43 | ||
51 | extern boolean timingdemo, singledemo, demoplayback, fastdemo; // killough | 44 | extern 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 | ||
21 | PLUGIN_HEADER | 21 | PLUGIN_HEADER |
22 | 22 | PLUGIN_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; | |||
102 | int quit=0; | 102 | int quit=0; |
103 | struct plugin_api * rb; | 103 | struct plugin_api * rb; |
104 | 104 | ||
105 | #ifdef USE_IRAM | ||
106 | extern char iramcopy[]; | ||
107 | extern char iramstart[]; | ||
108 | extern char iramend[]; | ||
109 | extern char iedata[]; | ||
110 | extern char iend[]; | ||
111 | #endif | ||
112 | |||
113 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 105 | enum 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 | ||
16 | PLUGIN_HEADER | 16 | PLUGIN_HEADER |
17 | PLUGIN_IRAM_DECLARE | ||
17 | 18 | ||
18 | static struct plugin_api* rb; | 19 | static struct plugin_api* rb; |
19 | 20 | ||
20 | #ifdef USE_IRAM | ||
21 | extern char iramcopy[]; | ||
22 | extern char iramstart[]; | ||
23 | extern char iramend[]; | ||
24 | extern char iedata[]; | ||
25 | extern 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 | ||
33 | PLUGIN_HEADER | 33 | PLUGIN_HEADER |
34 | 34 | PLUGIN_IRAM_DECLARE | |
35 | #ifdef USE_IRAM | ||
36 | extern char iramcopy[]; | ||
37 | extern char iramstart[]; | ||
38 | extern char iramend[]; | ||
39 | extern char iedata[]; | ||
40 | extern char iend[]; | ||
41 | #endif | ||
42 | 35 | ||
43 | struct plugin_api* rb; | 36 | struct 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 | ||
31 | PLUGIN_HEADER | 31 | PLUGIN_HEADER |
32 | 32 | PLUGIN_IRAM_DECLARE | |
33 | #ifdef USE_IRAM | ||
34 | extern char iramcopy[]; | ||
35 | extern char iramstart[]; | ||
36 | extern char iramend[]; | ||
37 | extern char iedata[]; | ||
38 | extern char iend[]; | ||
39 | #endif | ||
40 | 33 | ||
41 | struct plugin_api* rb; | 34 | struct plugin_api* rb; |
42 | 35 | ||
@@ -370,21 +363,10 @@ static int gameProc( void ) | |||
370 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 363 | enum 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 | ||
23 | PLUGIN_HEADER | 23 | PLUGIN_HEADER |
24 | 24 | PLUGIN_IRAM_DECLARE | |
25 | #ifdef USE_IRAM | ||
26 | extern char iramcopy[]; | ||
27 | extern char iramstart[]; | ||
28 | extern char iramend[]; | ||
29 | extern char iedata[]; | ||
30 | extern 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 | ||
22 | PLUGIN_HEADER | 22 | PLUGIN_HEADER |
23 | PLUGIN_IRAM_DECLARE | ||
23 | 24 | ||
24 | struct plugin_api* rb; | 25 | struct plugin_api* rb; |
25 | 26 | ||
@@ -37,14 +38,6 @@ int use_shm = 0; | |||
37 | int small_screen,pause_on_iconify; | 38 | int small_screen,pause_on_iconify; |
38 | int vga_pause_bg; | 39 | int vga_pause_bg; |
39 | 40 | ||
40 | #ifdef USE_IRAM | ||
41 | extern char iramcopy[]; | ||
42 | extern char iramstart[]; | ||
43 | extern char iramend[]; | ||
44 | extern char iedata[]; | ||
45 | extern 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 | ||