summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-08-30 20:47:53 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-08-30 20:47:53 +0000
commitda16248e47901c826a90291d2bb2a7aae78b209a (patch)
treefcc2a1944dd1b543e21346b46f50252ffc27fb7c /apps/plugins
parenta1997c13c168beeb41bf2f5b814115cdd5cb574c (diff)
downloadrockbox-da16248e47901c826a90291d2bb2a7aae78b209a.tar.gz
rockbox-da16248e47901c826a90291d2bb2a7aae78b209a.zip
Plugins: modify IRAM copying code
Move to plugin_crt0.c, plugins don't need PLUGIN_IRAM_* macros anymore IRAM is no longered zeroed before copying (as it is at the same address than BSS) -> Fix FS#11581 Use cpucache_invalidate() (and not cpucache_flush), needed for self-modifying code on cached IRAM git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27948 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/beatbox/beatbox.c4
-rw-r--r--apps/plugins/doom/rockdoom.c5
-rw-r--r--apps/plugins/midi/midiplay.c4
-rw-r--r--apps/plugins/mp3_encoder.c4
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c5
-rw-r--r--apps/plugins/pacbox/pacbox.c5
-rw-r--r--apps/plugins/pdbox/pdbox.c4
-rw-r--r--apps/plugins/pitch_detector.c6
-rw-r--r--apps/plugins/plugin_crt0.c27
-rw-r--r--apps/plugins/rockboy/rockboy.c5
-rw-r--r--apps/plugins/test_fps.c3
-rw-r--r--apps/plugins/test_sampr.c4
-rw-r--r--apps/plugins/zxbox/zxbox.c6
13 files changed, 27 insertions, 55 deletions
diff --git a/apps/plugins/beatbox/beatbox.c b/apps/plugins/beatbox/beatbox.c
index 9cb7dd4465..34c72570e3 100644
--- a/apps/plugins/beatbox/beatbox.c
+++ b/apps/plugins/beatbox/beatbox.c
@@ -27,8 +27,6 @@
27#include "midi/midifile.h" 27#include "midi/midifile.h"
28 28
29 29
30PLUGIN_IRAM_DECLARE
31
32/* variable button definitions */ 30/* variable button definitions */
33#if CONFIG_KEYPAD == RECORDER_PAD 31#if CONFIG_KEYPAD == RECORDER_PAD
34#define BTN_QUIT BUTTON_OFF 32#define BTN_QUIT BUTTON_OFF
@@ -249,8 +247,6 @@ enum plugin_status plugin_start(const void* parameter)
249{ 247{
250 int retval = 0; 248 int retval = 0;
251 249
252 PLUGIN_IRAM_INIT(rb)
253
254 rb->lcd_setfont(0); 250 rb->lcd_setfont(0);
255 251
256#if defined(HAVE_ADJUSTABLE_CPU_FREQ) 252#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c
index 324cb24d51..4267a613c7 100644
--- a/apps/plugins/doom/rockdoom.c
+++ b/apps/plugins/doom/rockdoom.c
@@ -41,9 +41,6 @@
41#include "st_stuff.h" 41#include "st_stuff.h"
42#include "lib/helper.h" 42#include "lib/helper.h"
43 43
44
45PLUGIN_IRAM_DECLARE
46
47extern boolean timingdemo, singledemo, demoplayback, fastdemo; // killough 44extern boolean timingdemo, singledemo, demoplayback, fastdemo; // killough
48 45
49int filearray[9]; 46int filearray[9];
@@ -663,8 +660,6 @@ enum plugin_status plugin_start(const void* parameter)
663 /* Disable all talking before initializing IRAM */ 660 /* Disable all talking before initializing IRAM */
664 rb->talk_disable(true); 661 rb->talk_disable(true);
665 662
666 PLUGIN_IRAM_INIT(rb)
667
668 (void)parameter; 663 (void)parameter;
669 664
670 doomexit=0; 665 doomexit=0;
diff --git a/apps/plugins/midi/midiplay.c b/apps/plugins/midi/midiplay.c
index 442a747d89..5a3c461bdc 100644
--- a/apps/plugins/midi/midiplay.c
+++ b/apps/plugins/midi/midiplay.c
@@ -26,8 +26,6 @@
26#include "midifile.h" 26#include "midifile.h"
27 27
28 28
29PLUGIN_IRAM_DECLARE
30
31/* variable button definitions */ 29/* variable button definitions */
32#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD) 30#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
33#define BTN_QUIT BUTTON_OFF 31#define BTN_QUIT BUTTON_OFF
@@ -451,8 +449,6 @@ enum plugin_status plugin_start(const void* parameter)
451{ 449{
452 int retval; 450 int retval;
453 451
454 PLUGIN_IRAM_INIT(rb)
455
456 if (parameter == NULL) 452 if (parameter == NULL)
457 { 453 {
458 rb->splash(HZ*2, " Play .MID file "); 454 rb->splash(HZ*2, " Play .MID file ");
diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c
index d26500819b..392fc36d31 100644
--- a/apps/plugins/mp3_encoder.c
+++ b/apps/plugins/mp3_encoder.c
@@ -15,8 +15,6 @@
15#include "plugin.h" 15#include "plugin.h"
16 16
17 17
18PLUGIN_IRAM_DECLARE
19
20#define SAMP_PER_FRAME 1152 18#define SAMP_PER_FRAME 1152
21#define SAMPL2 576 19#define SAMPL2 576
22#define SBLIMIT 32 20#define SBLIMIT 32
@@ -2504,8 +2502,6 @@ enum plugin_status plugin_start(const void* parameter)
2504 if (parameter == NULL) 2502 if (parameter == NULL)
2505 return PLUGIN_ERROR; 2503 return PLUGIN_ERROR;
2506 2504
2507 PLUGIN_IRAM_INIT(rb)
2508
2509 enc_buffer = rb->plugin_get_audio_buffer(&enc_buffer_size); 2505 enc_buffer = rb->plugin_get_audio_buffer(&enc_buffer_size);
2510 2506
2511#ifdef CPU_COLDFIRE 2507#ifdef CPU_COLDFIRE
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 8142c6f43e..5b333c33f7 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -109,8 +109,6 @@
109#include "stream_mgr.h" 109#include "stream_mgr.h"
110 110
111 111
112PLUGIN_IRAM_DECLARE
113
114/* button definitions */ 112/* button definitions */
115#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD) 113#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
116#define MPEG_MENU BUTTON_MODE 114#define MPEG_MENU BUTTON_MODE
@@ -1761,9 +1759,6 @@ enum plugin_status plugin_start(const void* parameter)
1761 /* Disable all talking before initializing IRAM */ 1759 /* Disable all talking before initializing IRAM */
1762 rb->talk_disable(true); 1760 rb->talk_disable(true);
1763 1761
1764 /* Initialize IRAM - stops audio and voice as well */
1765 PLUGIN_IRAM_INIT(rb)
1766
1767#ifdef HAVE_LCD_COLOR 1762#ifdef HAVE_LCD_COLOR
1768 rb->lcd_set_backdrop(NULL); 1763 rb->lcd_set_backdrop(NULL);
1769 rb->lcd_set_foreground(LCD_WHITE); 1764 rb->lcd_set_foreground(LCD_WHITE);
diff --git a/apps/plugins/pacbox/pacbox.c b/apps/plugins/pacbox/pacbox.c
index e942841a19..5165ff3047 100644
--- a/apps/plugins/pacbox/pacbox.c
+++ b/apps/plugins/pacbox/pacbox.c
@@ -32,9 +32,6 @@
32#include "lib/configfile.h" 32#include "lib/configfile.h"
33#include "lib/playback_control.h" 33#include "lib/playback_control.h"
34 34
35
36PLUGIN_IRAM_DECLARE
37
38struct pacman_settings { 35struct pacman_settings {
39 int difficulty; 36 int difficulty;
40 int numlives; 37 int numlives;
@@ -493,8 +490,6 @@ enum plugin_status plugin_start(const void* parameter)
493{ 490{
494 (void)parameter; 491 (void)parameter;
495 492
496 PLUGIN_IRAM_INIT(rb)
497
498#ifdef HAVE_ADJUSTABLE_CPU_FREQ 493#ifdef HAVE_ADJUSTABLE_CPU_FREQ
499 rb->cpu_boost(true); 494 rb->cpu_boost(true);
500#endif 495#endif
diff --git a/apps/plugins/pdbox/pdbox.c b/apps/plugins/pdbox/pdbox.c
index 7f4a7ac6dc..3ba6f4e2cb 100644
--- a/apps/plugins/pdbox/pdbox.c
+++ b/apps/plugins/pdbox/pdbox.c
@@ -29,8 +29,6 @@
29 29
30/* Welcome to the PDBox plugin */ 30/* Welcome to the PDBox plugin */
31 31
32PLUGIN_IRAM_DECLARE
33
34/* Name of the file to open. */ 32/* Name of the file to open. */
35char* filename; 33char* filename;
36 34
@@ -159,8 +157,6 @@ void core_thread(void)
159/* Plug-in entry point */ 157/* Plug-in entry point */
160enum plugin_status plugin_start(const void* parameter) 158enum plugin_status plugin_start(const void* parameter)
161{ 159{
162 PLUGIN_IRAM_INIT(rb)
163
164 /* Memory pool variables. */ 160 /* Memory pool variables. */
165 size_t mem_size; 161 size_t mem_size;
166 void* mem_pool; 162 void* mem_pool;
diff --git a/apps/plugins/pitch_detector.c b/apps/plugins/pitch_detector.c
index 22e8f75a7b..2b80f5c089 100644
--- a/apps/plugins/pitch_detector.c
+++ b/apps/plugins/pitch_detector.c
@@ -69,8 +69,6 @@
69#include "pluginbitmaps/pitch_notes.h" 69#include "pluginbitmaps/pitch_notes.h"
70 70
71 71
72PLUGIN_IRAM_DECLARE
73
74/* Some fixed point calculation stuff */ 72/* Some fixed point calculation stuff */
75typedef int32_t fixed_data; 73typedef int32_t fixed_data;
76struct _fixed 74struct _fixed
@@ -1056,12 +1054,10 @@ static void init_everything(void)
1056 /* Disable all talking before initializing IRAM */ 1054 /* Disable all talking before initializing IRAM */
1057 rb->talk_disable(true); 1055 rb->talk_disable(true);
1058 1056
1059 PLUGIN_IRAM_INIT(rb);
1060
1061 load_settings(); 1057 load_settings();
1062 rb->storage_sleep(); 1058 rb->storage_sleep();
1063 1059
1064 /* Stop all playback (if no IRAM, otherwise IRAM_INIT would have) */ 1060 /* Stop all playback */
1065 rb->plugin_get_audio_buffer(NULL); 1061 rb->plugin_get_audio_buffer(NULL);
1066 1062
1067 /* --------- Init the audio recording ----------------- */ 1063 /* --------- Init the audio recording ----------------- */
diff --git a/apps/plugins/plugin_crt0.c b/apps/plugins/plugin_crt0.c
index e34124c5a2..1db9d6a81a 100644
--- a/apps/plugins/plugin_crt0.c
+++ b/apps/plugins/plugin_crt0.c
@@ -63,10 +63,35 @@ enum plugin_status plugin__start(const void *param)
63 int exit_ret; 63 int exit_ret;
64 enum plugin_status ret; 64 enum plugin_status ret;
65 65
66 /* zero out the bss section */
67#if (CONFIG_PLATFORM & PLATFORM_NATIVE) 66#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
67
68/* IRAM must be copied before clearing the BSS ! */
69#ifdef PLUGIN_USE_IRAM
70 extern char iramcopy[], iramstart[], iramend[], iedata[], iend[];
71 size_t iram_size = iramend - iramstart;
72 size_t ibss_size = iend - iedata;
73 if (iram_size > 0 || ibss_size > 0)
74 {
75 /* We need to stop audio playback in order to use codec IRAM */
76 rb->audio_stop();
77 rb->memcpy(iramstart, iramcopy, iram_size);
78 rb->memset(iedata, 0, ibss_size);
79#ifdef HAVE_CPUCACHE_INVALIDATE
80 /* make the icache (if it exists) up to date with the new code */
81 rb->cpucache_invalidate();
82#endif /* HAVE_CPUCACHE_INVALIDATE */
83
84 /* barrier to prevent reordering iram copy and BSS clearing,
85 * because the BSS segment alias the IRAM copy.
86 */
87 asm volatile ("" ::: "memory");
88 }
89#endif /* PLUGIN_USE_IRAM */
90
91 /* zero out the bss section */
68 rb->memset(plugin_bss_start, 0, plugin_end_addr - plugin_bss_start); 92 rb->memset(plugin_bss_start, 0, plugin_end_addr - plugin_bss_start);
69#endif 93#endif
94
70 /* we come back here if exit() was called or the plugin returned normally */ 95 /* we come back here if exit() was called or the plugin returned normally */
71 exit_ret = setjmp(__exit_env); 96 exit_ret = setjmp(__exit_env);
72 if (exit_ret == 0) 97 if (exit_ret == 0)
diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c
index 7fc919912e..e7d56b5755 100644
--- a/apps/plugins/rockboy/rockboy.c
+++ b/apps/plugins/rockboy/rockboy.c
@@ -26,9 +26,6 @@
26#include "hw.h" 26#include "hw.h"
27#include "pcm.h" 27#include "pcm.h"
28 28
29
30PLUGIN_IRAM_DECLARE
31
32int shut,cleanshut; 29int shut,cleanshut;
33char *errormsg; 30char *errormsg;
34 31
@@ -380,8 +377,6 @@ static int gnuboy_main(const char *rom)
380/* this is the plugin entry point */ 377/* this is the plugin entry point */
381enum plugin_status plugin_start(const void* parameter) 378enum plugin_status plugin_start(const void* parameter)
382{ 379{
383 PLUGIN_IRAM_INIT(rb)
384
385 rb->lcd_setfont(0); 380 rb->lcd_setfont(0);
386 381
387 rb->lcd_clear_display(); 382 rb->lcd_clear_display();
diff --git a/apps/plugins/test_fps.c b/apps/plugins/test_fps.c
index f57f45b000..c03adc49a6 100644
--- a/apps/plugins/test_fps.c
+++ b/apps/plugins/test_fps.c
@@ -22,8 +22,6 @@
22#include "lib/helper.h" 22#include "lib/helper.h"
23#include "lib/grey.h" 23#include "lib/grey.h"
24 24
25PLUGIN_IRAM_DECLARE
26
27#if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \ 25#if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \
28 (CONFIG_KEYPAD == IPOD_1G2G_PAD) 26 (CONFIG_KEYPAD == IPOD_1G2G_PAD)
29#define FPS_QUIT BUTTON_MENU 27#define FPS_QUIT BUTTON_MENU
@@ -344,7 +342,6 @@ enum plugin_status plugin_start(const void* parameter)
344#endif 342#endif
345 343
346 /* standard stuff */ 344 /* standard stuff */
347 PLUGIN_IRAM_INIT(rb)
348 (void)parameter; 345 (void)parameter;
349 346
350 log_init(); 347 log_init();
diff --git a/apps/plugins/test_sampr.c b/apps/plugins/test_sampr.c
index 85525c543b..db8301bba6 100644
--- a/apps/plugins/test_sampr.c
+++ b/apps/plugins/test_sampr.c
@@ -29,8 +29,6 @@
29 */ 29 */
30 30
31 31
32PLUGIN_IRAM_DECLARE;
33
34static int hw_freq IDATA_ATTR = HW_FREQ_DEFAULT; 32static int hw_freq IDATA_ATTR = HW_FREQ_DEFAULT;
35static unsigned long hw_sampr IDATA_ATTR = HW_SAMPR_DEFAULT; 33static unsigned long hw_sampr IDATA_ATTR = HW_SAMPR_DEFAULT;
36 34
@@ -298,8 +296,6 @@ enum plugin_status plugin_start(const void *parameter)
298 /* Disable all talking before initializing IRAM */ 296 /* Disable all talking before initializing IRAM */
299 rb->talk_disable(true); 297 rb->talk_disable(true);
300 298
301 PLUGIN_IRAM_INIT(rb);
302
303 while (!exit) 299 while (!exit)
304 { 300 {
305 int result = rb->do_menu(&menu, &selected, NULL, false); 301 int result = rb->do_menu(&menu, &selected, NULL, false);
diff --git a/apps/plugins/zxbox/zxbox.c b/apps/plugins/zxbox/zxbox.c
index 459e0625b9..edaa7cfbaa 100644
--- a/apps/plugins/zxbox/zxbox.c
+++ b/apps/plugins/zxbox/zxbox.c
@@ -20,10 +20,6 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22#include "zxconfig.h" 22#include "zxconfig.h"
23
24
25PLUGIN_IRAM_DECLARE
26
27#include "spkey_p.h" 23#include "spkey_p.h"
28 24
29spkeyboard kb_mkey; 25spkeyboard kb_mkey;
@@ -61,8 +57,6 @@ long start_time IBSS_ATTR = 0;
61 57
62enum plugin_status plugin_start(const void* parameter) 58enum plugin_status plugin_start(const void* parameter)
63{ 59{
64 PLUGIN_IRAM_INIT(rb)
65
66#if LCD_DEPTH > 1 60#if LCD_DEPTH > 1
67 rb->lcd_set_backdrop(NULL); 61 rb->lcd_set_backdrop(NULL);
68#endif 62#endif