diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-08-30 20:47:53 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-08-30 20:47:53 +0000 |
commit | da16248e47901c826a90291d2bb2a7aae78b209a (patch) | |
tree | fcc2a1944dd1b543e21346b46f50252ffc27fb7c | |
parent | a1997c13c168beeb41bf2f5b814115cdd5cb574c (diff) | |
download | rockbox-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
-rw-r--r-- | apps/plugin.c | 29 | ||||
-rw-r--r-- | apps/plugin.h | 38 | ||||
-rw-r--r-- | apps/plugins/beatbox/beatbox.c | 4 | ||||
-rw-r--r-- | apps/plugins/doom/rockdoom.c | 5 | ||||
-rw-r--r-- | apps/plugins/midi/midiplay.c | 4 | ||||
-rw-r--r-- | apps/plugins/mp3_encoder.c | 4 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.c | 5 | ||||
-rw-r--r-- | apps/plugins/pacbox/pacbox.c | 5 | ||||
-rw-r--r-- | apps/plugins/pdbox/pdbox.c | 4 | ||||
-rw-r--r-- | apps/plugins/pitch_detector.c | 6 | ||||
-rw-r--r-- | apps/plugins/plugin_crt0.c | 27 | ||||
-rw-r--r-- | apps/plugins/rockboy/rockboy.c | 5 | ||||
-rw-r--r-- | apps/plugins/test_fps.c | 3 | ||||
-rw-r--r-- | apps/plugins/test_sampr.c | 4 | ||||
-rw-r--r-- | apps/plugins/zxbox/zxbox.c | 6 |
15 files changed, 39 insertions, 110 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index 767c593f57..e0455c51a2 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -109,7 +109,9 @@ static const struct plugin_api rockbox_api = { | |||
109 | lcd_clear_display, | 109 | lcd_clear_display, |
110 | lcd_getstringsize, | 110 | lcd_getstringsize, |
111 | lcd_putsxy, | 111 | lcd_putsxy, |
112 | lcd_putsxyf, | ||
112 | lcd_puts, | 113 | lcd_puts, |
114 | lcd_putsf, | ||
113 | lcd_puts_scroll, | 115 | lcd_puts_scroll, |
114 | lcd_stop_scroll, | 116 | lcd_stop_scroll, |
115 | #ifdef HAVE_LCD_CHARCELLS | 117 | #ifdef HAVE_LCD_CHARCELLS |
@@ -382,8 +384,10 @@ static const struct plugin_api rockbox_api = { | |||
382 | trigger_cpu_boost, | 384 | trigger_cpu_boost, |
383 | cancel_cpu_boost, | 385 | cancel_cpu_boost, |
384 | #endif | 386 | #endif |
385 | #if NUM_CORES > 1 | 387 | #ifdef HAVE_CPUCACHE_FLUSH |
386 | cpucache_flush, | 388 | cpucache_flush, |
389 | #endif | ||
390 | #ifdef HAVE_CPUCACHE_INVALIDATE | ||
387 | cpucache_invalidate, | 391 | cpucache_invalidate, |
388 | #endif | 392 | #endif |
389 | timer_register, | 393 | timer_register, |
@@ -620,9 +624,6 @@ static const struct plugin_api rockbox_api = { | |||
620 | plugin_get_audio_buffer, | 624 | plugin_get_audio_buffer, |
621 | plugin_tsr, | 625 | plugin_tsr, |
622 | plugin_get_current_filename, | 626 | plugin_get_current_filename, |
623 | #ifdef PLUGIN_USE_IRAM | ||
624 | plugin_iram_init, | ||
625 | #endif | ||
626 | #if defined(DEBUG) || defined(SIMULATOR) | 627 | #if defined(DEBUG) || defined(SIMULATOR) |
627 | debugf, | 628 | debugf, |
628 | #endif | 629 | #endif |
@@ -721,9 +722,6 @@ static const struct plugin_api rockbox_api = { | |||
721 | 722 | ||
722 | /* new stuff at the end, sort into place next time | 723 | /* new stuff at the end, sort into place next time |
723 | the API gets incompatible */ | 724 | the API gets incompatible */ |
724 | |||
725 | lcd_putsf, | ||
726 | lcd_putsxyf, | ||
727 | }; | 725 | }; |
728 | 726 | ||
729 | int plugin_load(const char* plugin, const void* parameter) | 727 | int plugin_load(const char* plugin, const void* parameter) |
@@ -919,23 +917,6 @@ void* plugin_get_audio_buffer(size_t *buffer_size) | |||
919 | #endif | 917 | #endif |
920 | } | 918 | } |
921 | 919 | ||
922 | #ifdef PLUGIN_USE_IRAM | ||
923 | /* Initializes plugin IRAM */ | ||
924 | void plugin_iram_init(char *iramstart, char *iramcopy, size_t iram_size, | ||
925 | char *iedata, size_t iedata_size) | ||
926 | { | ||
927 | /* We need to stop audio playback in order to use codec IRAM */ | ||
928 | audio_hard_stop(); | ||
929 | memcpy(iramstart, iramcopy, iram_size); | ||
930 | memset(iedata, 0, iedata_size); | ||
931 | memset(iramcopy, 0, iram_size); | ||
932 | #if NUM_CORES > 1 | ||
933 | /* writeback cleared iedata and iramcopy areas */ | ||
934 | cpucache_flush(); | ||
935 | #endif | ||
936 | } | ||
937 | #endif /* PLUGIN_USE_IRAM */ | ||
938 | |||
939 | /* The plugin wants to stay resident after leaving its main function, e.g. | 920 | /* The plugin wants to stay resident after leaving its main function, e.g. |
940 | runs from timer or own thread. The callback is registered to later | 921 | runs from timer or own thread. The callback is registered to later |
941 | instruct it to free its resources before a new plugin gets loaded. */ | 922 | instruct it to free its resources before a new plugin gets loaded. */ |
diff --git a/apps/plugin.h b/apps/plugin.h index 2f187f120b..422f58fc8a 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -147,12 +147,12 @@ void* plugin_get_buffer(size_t *buffer_size); | |||
147 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 147 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
148 | 148 | ||
149 | /* increase this every time the api struct changes */ | 149 | /* increase this every time the api struct changes */ |
150 | #define PLUGIN_API_VERSION 191 | 150 | #define PLUGIN_API_VERSION 192 |
151 | 151 | ||
152 | /* update this to latest version if a change to the api struct breaks | 152 | /* update this to latest version if a change to the api struct breaks |
153 | backwards compatibility (and please take the opportunity to sort in any | 153 | backwards compatibility (and please take the opportunity to sort in any |
154 | new function which are "waiting" at the end of the function table) */ | 154 | new function which are "waiting" at the end of the function table) */ |
155 | #define PLUGIN_MIN_API_VERSION 191 | 155 | #define PLUGIN_MIN_API_VERSION 192 |
156 | 156 | ||
157 | /* plugin return codes */ | 157 | /* plugin return codes */ |
158 | /* internal returns start at 0x100 to make exit(1..255) work */ | 158 | /* internal returns start at 0x100 to make exit(1..255) work */ |
@@ -183,7 +183,9 @@ struct plugin_api { | |||
183 | void (*lcd_clear_display)(void); | 183 | void (*lcd_clear_display)(void); |
184 | int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h); | 184 | int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h); |
185 | void (*lcd_putsxy)(int x, int y, const unsigned char *string); | 185 | void (*lcd_putsxy)(int x, int y, const unsigned char *string); |
186 | void (*lcd_putsxyf)(int x, int y, const unsigned char *fmt, ...); | ||
186 | void (*lcd_puts)(int x, int y, const unsigned char *string); | 187 | void (*lcd_puts)(int x, int y, const unsigned char *string); |
188 | void (*lcd_putsf)(int x, int y, const unsigned char *fmt, ...); | ||
187 | void (*lcd_puts_scroll)(int x, int y, const unsigned char* string); | 189 | void (*lcd_puts_scroll)(int x, int y, const unsigned char* string); |
188 | void (*lcd_stop_scroll)(void); | 190 | void (*lcd_stop_scroll)(void); |
189 | #ifdef HAVE_LCD_CHARCELLS | 191 | #ifdef HAVE_LCD_CHARCELLS |
@@ -496,8 +498,10 @@ struct plugin_api { | |||
496 | void (*trigger_cpu_boost)(void); | 498 | void (*trigger_cpu_boost)(void); |
497 | void (*cancel_cpu_boost)(void); | 499 | void (*cancel_cpu_boost)(void); |
498 | #endif | 500 | #endif |
499 | #if NUM_CORES > 1 | 501 | #ifdef HAVE_CPUCACHE_FLUSH |
500 | void (*cpucache_flush)(void); | 502 | void (*cpucache_flush)(void); |
503 | #endif | ||
504 | #ifdef HAVE_CPUCACHE_INVALIDATE | ||
501 | void (*cpucache_invalidate)(void); | 505 | void (*cpucache_invalidate)(void); |
502 | #endif | 506 | #endif |
503 | bool (*timer_register)(int reg_prio, void (*unregister_callback)(void), | 507 | bool (*timer_register)(int reg_prio, void (*unregister_callback)(void), |
@@ -769,10 +773,6 @@ struct plugin_api { | |||
769 | void* (*plugin_get_audio_buffer)(size_t *buffer_size); | 773 | void* (*plugin_get_audio_buffer)(size_t *buffer_size); |
770 | void (*plugin_tsr)(bool (*exit_callback)(bool reenter)); | 774 | void (*plugin_tsr)(bool (*exit_callback)(bool reenter)); |
771 | char* (*plugin_get_current_filename)(void); | 775 | char* (*plugin_get_current_filename)(void); |
772 | #ifdef PLUGIN_USE_IRAM | ||
773 | void (*plugin_iram_init)(char *iramstart, char *iramcopy, size_t iram_size, | ||
774 | char *iedata, size_t iedata_size); | ||
775 | #endif | ||
776 | #if defined(DEBUG) || defined(SIMULATOR) | 776 | #if defined(DEBUG) || defined(SIMULATOR) |
777 | void (*debugf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2); | 777 | void (*debugf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2); |
778 | #endif | 778 | #endif |
@@ -894,9 +894,6 @@ struct plugin_api { | |||
894 | 894 | ||
895 | /* new stuff at the end, sort into place next time | 895 | /* new stuff at the end, sort into place next time |
896 | the API gets incompatible */ | 896 | the API gets incompatible */ |
897 | |||
898 | void (*lcd_putsf)(int x, int y, const unsigned char *fmt, ...); | ||
899 | void (*lcd_putsxyf)(int x, int y, const unsigned char *fmt, ...); | ||
900 | }; | 897 | }; |
901 | 898 | ||
902 | /* plugin header */ | 899 | /* plugin header */ |
@@ -928,31 +925,10 @@ extern unsigned char plugin_end_addr[]; | |||
928 | PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ | 925 | PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ |
929 | NULL, NULL, plugin__start, &rb }; | 926 | NULL, NULL, plugin__start, &rb }; |
930 | #endif /* CONFIG_PLATFORM */ | 927 | #endif /* CONFIG_PLATFORM */ |
931 | |||
932 | #ifdef PLUGIN_USE_IRAM | ||
933 | /* Declare IRAM variables */ | ||
934 | #define PLUGIN_IRAM_DECLARE \ | ||
935 | extern char iramcopy[]; \ | ||
936 | extern char iramstart[]; \ | ||
937 | extern char iramend[]; \ | ||
938 | extern char iedata[]; \ | ||
939 | extern char iend[]; | ||
940 | /* Initialize IRAM */ | ||
941 | #define PLUGIN_IRAM_INIT(api) \ | ||
942 | (api)->plugin_iram_init(iramstart, iramcopy, iramend-iramstart, \ | ||
943 | iedata, iend-iedata); | ||
944 | #else | ||
945 | #define PLUGIN_IRAM_DECLARE | ||
946 | #define PLUGIN_IRAM_INIT(api) | ||
947 | #endif /* PLUGIN_USE_IRAM */ | ||
948 | #endif /* PLUGIN */ | 928 | #endif /* PLUGIN */ |
949 | 929 | ||
950 | int plugin_load(const char* plugin, const void* parameter); | 930 | int plugin_load(const char* plugin, const void* parameter); |
951 | void* plugin_get_audio_buffer(size_t *buffer_size); | 931 | void* plugin_get_audio_buffer(size_t *buffer_size); |
952 | #ifdef PLUGIN_USE_IRAM | ||
953 | void plugin_iram_init(char *iramstart, char *iramcopy, size_t iram_size, | ||
954 | char *iedata, size_t iedata_size); | ||
955 | #endif | ||
956 | 932 | ||
957 | /* plugin_tsr, | 933 | /* plugin_tsr, |
958 | callback returns true to allow the new plugin to load, | 934 | callback returns true to allow the new plugin to load, |
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 | ||
30 | PLUGIN_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 | |||
45 | PLUGIN_IRAM_DECLARE | ||
46 | |||
47 | extern boolean timingdemo, singledemo, demoplayback, fastdemo; // killough | 44 | extern boolean timingdemo, singledemo, demoplayback, fastdemo; // killough |
48 | 45 | ||
49 | int filearray[9]; | 46 | int 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 | ||
29 | PLUGIN_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 | ||
18 | PLUGIN_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 | ||
112 | PLUGIN_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 | |||
36 | PLUGIN_IRAM_DECLARE | ||
37 | |||
38 | struct pacman_settings { | 35 | struct 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 | ||
32 | PLUGIN_IRAM_DECLARE | ||
33 | |||
34 | /* Name of the file to open. */ | 32 | /* Name of the file to open. */ |
35 | char* filename; | 33 | char* filename; |
36 | 34 | ||
@@ -159,8 +157,6 @@ void core_thread(void) | |||
159 | /* Plug-in entry point */ | 157 | /* Plug-in entry point */ |
160 | enum plugin_status plugin_start(const void* parameter) | 158 | enum 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 | ||
72 | PLUGIN_IRAM_DECLARE | ||
73 | |||
74 | /* Some fixed point calculation stuff */ | 72 | /* Some fixed point calculation stuff */ |
75 | typedef int32_t fixed_data; | 73 | typedef int32_t fixed_data; |
76 | struct _fixed | 74 | struct _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 | |||
30 | PLUGIN_IRAM_DECLARE | ||
31 | |||
32 | int shut,cleanshut; | 29 | int shut,cleanshut; |
33 | char *errormsg; | 30 | char *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 */ |
381 | enum plugin_status plugin_start(const void* parameter) | 378 | enum 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 | ||
25 | PLUGIN_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 | ||
32 | PLUGIN_IRAM_DECLARE; | ||
33 | |||
34 | static int hw_freq IDATA_ATTR = HW_FREQ_DEFAULT; | 32 | static int hw_freq IDATA_ATTR = HW_FREQ_DEFAULT; |
35 | static unsigned long hw_sampr IDATA_ATTR = HW_SAMPR_DEFAULT; | 33 | static 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 | |||
25 | PLUGIN_IRAM_DECLARE | ||
26 | |||
27 | #include "spkey_p.h" | 23 | #include "spkey_p.h" |
28 | 24 | ||
29 | spkeyboard kb_mkey; | 25 | spkeyboard kb_mkey; |
@@ -61,8 +57,6 @@ long start_time IBSS_ATTR = 0; | |||
61 | 57 | ||
62 | enum plugin_status plugin_start(const void* parameter) | 58 | enum 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 |