diff options
author | Nils Wallménius <nils@rockbox.org> | 2007-06-13 15:35:07 +0000 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2007-06-13 15:35:07 +0000 |
commit | c7f9ca4067f26ba3d0471d50ed3f06b047171b50 (patch) | |
tree | 9bfaf2d5019c075ad97540a2beed8d68277ca021 | |
parent | f50bd1151a65b1aeefaeab545187fba29881b800 (diff) | |
download | rockbox-c7f9ca4067f26ba3d0471d50ed3f06b047171b50.tar.gz rockbox-c7f9ca4067f26ba3d0471d50ed3f06b047171b50.zip |
Accept FS#7264 'Build with -Os switch for coldfire targets'.
Introduces MEM_FUNCTION_WRAPPERS(api) macro which adds wrappers
functions to a plugin to make plugins link correctly when gcc
calls mem* functions directly.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13625 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/playback.c | 16 | ||||
-rw-r--r-- | apps/plugin.h | 6 | ||||
-rw-r--r-- | apps/plugins/battery_bench.c | 2 | ||||
-rw-r--r-- | apps/plugins/blackjack.c | 5 | ||||
-rw-r--r-- | apps/plugins/chessclock.c | 3 | ||||
-rw-r--r-- | apps/plugins/chip8.c | 2 | ||||
-rw-r--r-- | apps/plugins/jpeg.c | 2 | ||||
-rw-r--r-- | apps/plugins/lib/mem_function_wrappers.h | 44 | ||||
-rw-r--r-- | apps/plugins/lib/playback_control.c | 10 | ||||
-rw-r--r-- | apps/plugins/mazezam.c | 3 | ||||
-rw-r--r-- | apps/plugins/metronome.c | 5 | ||||
-rw-r--r-- | apps/plugins/mp3_encoder.c | 3 | ||||
-rw-r--r-- | apps/plugins/properties.c | 4 | ||||
-rw-r--r-- | apps/plugins/rockpaint.c | 3 | ||||
-rw-r--r-- | apps/plugins/video.c | 2 | ||||
-rw-r--r-- | apps/plugins/xobox.c | 5 | ||||
-rw-r--r-- | apps/talk.c | 4 | ||||
-rw-r--r-- | firmware/export/mp3_playback.h | 2 | ||||
-rw-r--r-- | firmware/mp3_playback.c | 6 | ||||
-rw-r--r-- | firmware/mpeg.c | 2 | ||||
-rwxr-xr-x | tools/configure | 5 |
21 files changed, 105 insertions, 29 deletions
diff --git a/apps/playback.c b/apps/playback.c index ca88b5f5e3..329e8b856b 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -332,7 +332,7 @@ static struct mutex mutex_codecthread NOCACHEBSS_ATTR; | |||
332 | static volatile bool voice_thread_start = false; /* Triggers voice playback (A/V) */ | 332 | static volatile bool voice_thread_start = false; /* Triggers voice playback (A/V) */ |
333 | static volatile bool voice_is_playing NOCACHEBSS_ATTR = false; /* Is voice currently playing? (V) */ | 333 | static volatile bool voice_is_playing NOCACHEBSS_ATTR = false; /* Is voice currently playing? (V) */ |
334 | static volatile bool voice_codec_loaded NOCACHEBSS_ATTR = false; /* Is voice codec loaded (V/A-) */ | 334 | static volatile bool voice_codec_loaded NOCACHEBSS_ATTR = false; /* Is voice codec loaded (V/A-) */ |
335 | static char *voicebuf = NULL; | 335 | static unsigned char *voicebuf = NULL; |
336 | static size_t voice_remaining = 0; | 336 | static size_t voice_remaining = 0; |
337 | 337 | ||
338 | #ifdef IRAM_STEAL | 338 | #ifdef IRAM_STEAL |
@@ -340,12 +340,12 @@ static size_t voice_remaining = 0; | |||
340 | static bool voice_iram_stolen = false; | 340 | static bool voice_iram_stolen = false; |
341 | #endif | 341 | #endif |
342 | 342 | ||
343 | static void (*voice_getmore)(unsigned char** start, int* size) = NULL; | 343 | static void (*voice_getmore)(unsigned char** start, size_t* size) = NULL; |
344 | 344 | ||
345 | struct voice_info { | 345 | struct voice_info { |
346 | void (*callback)(unsigned char **start, int *size); | 346 | void (*callback)(unsigned char **start, size_t* size); |
347 | int size; | 347 | size_t size; |
348 | char *buf; | 348 | unsigned char *buf; |
349 | }; | 349 | }; |
350 | static void voice_thread(void); | 350 | static void voice_thread(void); |
351 | static void voice_stop(void); | 351 | static void voice_stop(void); |
@@ -355,12 +355,12 @@ static void voice_stop(void); | |||
355 | /* --- External interfaces --- */ | 355 | /* --- External interfaces --- */ |
356 | 356 | ||
357 | void mp3_play_data(const unsigned char* start, int size, | 357 | void mp3_play_data(const unsigned char* start, int size, |
358 | void (*get_more)(unsigned char** start, int* size)) | 358 | void (*get_more)(unsigned char** start, size_t* size)) |
359 | { | 359 | { |
360 | #ifdef PLAYBACK_VOICE | 360 | #ifdef PLAYBACK_VOICE |
361 | static struct voice_info voice_clip; | 361 | static struct voice_info voice_clip; |
362 | voice_clip.callback = get_more; | 362 | voice_clip.callback = get_more; |
363 | voice_clip.buf = (char *)start; | 363 | voice_clip.buf = (unsigned char*)start; |
364 | voice_clip.size = size; | 364 | voice_clip.size = size; |
365 | LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); | 365 | LOGFQUEUE("mp3 > voice Q_VOICE_STOP"); |
366 | queue_post(&voice_queue, Q_VOICE_STOP, 0); | 366 | queue_post(&voice_queue, Q_VOICE_STOP, 0); |
@@ -1238,7 +1238,7 @@ voice_play_clip: | |||
1238 | if (voice_remaining == 0 || voicebuf == NULL) | 1238 | if (voice_remaining == 0 || voicebuf == NULL) |
1239 | { | 1239 | { |
1240 | if (voice_getmore) | 1240 | if (voice_getmore) |
1241 | voice_getmore((unsigned char **)&voicebuf, (int *)&voice_remaining); | 1241 | voice_getmore((unsigned char **)&voicebuf, &voice_remaining); |
1242 | 1242 | ||
1243 | /* If this clip is done */ | 1243 | /* If this clip is done */ |
1244 | if (voice_remaining == 0) | 1244 | if (voice_remaining == 0) |
diff --git a/apps/plugin.h b/apps/plugin.h index bc6adffab2..11bb80de66 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -114,12 +114,12 @@ | |||
114 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 114 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
115 | 115 | ||
116 | /* increase this every time the api struct changes */ | 116 | /* increase this every time the api struct changes */ |
117 | #define PLUGIN_API_VERSION 57 | 117 | #define PLUGIN_API_VERSION 58 |
118 | 118 | ||
119 | /* update this to latest version if a change to the api struct breaks | 119 | /* update this to latest version if a change to the api struct breaks |
120 | backwards compatibility (and please take the opportunity to sort in any | 120 | backwards compatibility (and please take the opportunity to sort in any |
121 | new function which are "waiting" at the end of the function table) */ | 121 | new function which are "waiting" at the end of the function table) */ |
122 | #define PLUGIN_MIN_API_VERSION 56 | 122 | #define PLUGIN_MIN_API_VERSION 58 |
123 | 123 | ||
124 | /* plugin return codes */ | 124 | /* plugin return codes */ |
125 | enum plugin_status { | 125 | enum plugin_status { |
@@ -417,7 +417,7 @@ struct plugin_api { | |||
417 | int (*sound_min)(int setting); | 417 | int (*sound_min)(int setting); |
418 | int (*sound_max)(int setting); | 418 | int (*sound_max)(int setting); |
419 | #ifndef SIMULATOR | 419 | #ifndef SIMULATOR |
420 | void (*mp3_play_data)(const unsigned char* start, int size, void (*get_more)(unsigned char** start, int* size)); | 420 | void (*mp3_play_data)(const unsigned char* start, int size, void (*get_more)(unsigned char** start, size_t* size)); |
421 | void (*mp3_play_pause)(bool play); | 421 | void (*mp3_play_pause)(bool play); |
422 | void (*mp3_play_stop)(void); | 422 | void (*mp3_play_stop)(void); |
423 | bool (*mp3_is_playing)(void); | 423 | bool (*mp3_is_playing)(void); |
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c index 13ce172f67..fef3f36db2 100644 --- a/apps/plugins/battery_bench.c +++ b/apps/plugins/battery_bench.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #ifndef SIMULATOR /* not for the simulator */ | 20 | #ifndef SIMULATOR /* not for the simulator */ |
21 | 21 | ||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | #include "mem_function_wrappers.h" | ||
23 | PLUGIN_HEADER | 24 | PLUGIN_HEADER |
24 | 25 | ||
25 | #define BATTERY_LOG "/battery_bench.txt" | 26 | #define BATTERY_LOG "/battery_bench.txt" |
@@ -98,6 +99,7 @@ PLUGIN_HEADER | |||
98 | 99 | ||
99 | /****************************** Plugin Entry Point ****************************/ | 100 | /****************************** Plugin Entry Point ****************************/ |
100 | static struct plugin_api* rb; | 101 | static struct plugin_api* rb; |
102 | MEM_FUNCTION_WRAPPERS(rb); | ||
101 | int main(void); | 103 | int main(void); |
102 | bool exit_tsr(bool); | 104 | bool exit_tsr(bool); |
103 | void thread(void); | 105 | void thread(void); |
diff --git a/apps/plugins/blackjack.c b/apps/plugins/blackjack.c index f987eeb3b5..07af984a80 100644 --- a/apps/plugins/blackjack.c +++ b/apps/plugins/blackjack.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include "plugin.h" | 20 | #include "plugin.h" |
21 | #include "card_deck.h" | 21 | #include "card_deck.h" |
22 | #include "card_back.h" | 22 | #include "card_back.h" |
23 | #include "mem_function_wrappers.h" | ||
23 | 24 | ||
24 | PLUGIN_HEADER | 25 | PLUGIN_HEADER |
25 | 26 | ||
@@ -213,6 +214,8 @@ extern const fb_data card_back[]; | |||
213 | /* global rockbox api */ | 214 | /* global rockbox api */ |
214 | static struct plugin_api* rb; | 215 | static struct plugin_api* rb; |
215 | 216 | ||
217 | MEM_FUNCTION_WRAPPERS(rb); | ||
218 | |||
216 | /* dealer and player card positions */ | 219 | /* dealer and player card positions */ |
217 | unsigned int dealer_x, dealer_y, player_x, player_y; | 220 | unsigned int dealer_x, dealer_y, player_x, player_y; |
218 | 221 | ||
@@ -1399,7 +1402,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { | |||
1399 | 1402 | ||
1400 | (void)parameter; | 1403 | (void)parameter; |
1401 | rb = api; | 1404 | rb = api; |
1402 | 1405 | ||
1403 | #if LCD_DEPTH > 1 | 1406 | #if LCD_DEPTH > 1 |
1404 | rb->lcd_set_backdrop(NULL); | 1407 | rb->lcd_set_backdrop(NULL); |
1405 | #endif | 1408 | #endif |
diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c index f1482df990..3dfb0fef6c 100644 --- a/apps/plugins/chessclock.c +++ b/apps/plugins/chessclock.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #include "plugin.h" | 19 | #include "plugin.h" |
20 | #include "mem_function_wrappers.h" | ||
20 | 21 | ||
21 | PLUGIN_HEADER | 22 | PLUGIN_HEADER |
22 | 23 | ||
@@ -153,6 +154,7 @@ PLUGIN_HEADER | |||
153 | it's nice not to have to pass the api pointer in all function calls | 154 | it's nice not to have to pass the api pointer in all function calls |
154 | in the plugin */ | 155 | in the plugin */ |
155 | static struct plugin_api* rb; | 156 | static struct plugin_api* rb; |
157 | MEM_FUNCTION_WRAPPERS(rb); | ||
156 | #define MAX_PLAYERS 10 | 158 | #define MAX_PLAYERS 10 |
157 | 159 | ||
158 | static struct { | 160 | static struct { |
@@ -192,7 +194,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
192 | 194 | ||
193 | (void)parameter; | 195 | (void)parameter; |
194 | rb=api; | 196 | rb=api; |
195 | |||
196 | rb->memset(&settings, 0, sizeof(settings)); | 197 | rb->memset(&settings, 0, sizeof(settings)); |
197 | 198 | ||
198 | /* now go ahead and have fun! */ | 199 | /* now go ahead and have fun! */ |
diff --git a/apps/plugins/chip8.c b/apps/plugins/chip8.c index c38a5fd0bb..f76379e5f4 100644 --- a/apps/plugins/chip8.c +++ b/apps/plugins/chip8.c | |||
@@ -1062,7 +1062,7 @@ static unsigned char beep[]={255, | |||
1062 | 111,181,184,144, 17,148, 21,101,166,227,100, 86, 85, 85, 85}; | 1062 | 111,181,184,144, 17,148, 21,101,166,227,100, 86, 85, 85, 85}; |
1063 | 1063 | ||
1064 | /* callback to request more mp3 data */ | 1064 | /* callback to request more mp3 data */ |
1065 | void callback(unsigned char** start, int* size) | 1065 | void callback(unsigned char** start, size_t* size) |
1066 | { | 1066 | { |
1067 | *start = beep; /* give it the same frame again */ | 1067 | *start = beep; /* give it the same frame again */ |
1068 | *size = sizeof(beep); | 1068 | *size = sizeof(beep); |
diff --git a/apps/plugins/jpeg.c b/apps/plugins/jpeg.c index ff6df6d4e3..cd364f4d51 100644 --- a/apps/plugins/jpeg.c +++ b/apps/plugins/jpeg.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "plugin.h" | 27 | #include "plugin.h" |
28 | #include "playback_control.h" | 28 | #include "playback_control.h" |
29 | #include "oldmenuapi.h" | 29 | #include "oldmenuapi.h" |
30 | #include "mem_function_wrappers.h" | ||
30 | 31 | ||
31 | #ifdef HAVE_LCD_BITMAP | 32 | #ifdef HAVE_LCD_BITMAP |
32 | #include "gray.h" | 33 | #include "gray.h" |
@@ -186,6 +187,7 @@ PLUGIN_HEADER | |||
186 | /******************************* Globals ***********************************/ | 187 | /******************************* Globals ***********************************/ |
187 | 188 | ||
188 | static struct plugin_api* rb; | 189 | static struct plugin_api* rb; |
190 | MEM_FUNCTION_WRAPPERS(rb); | ||
189 | 191 | ||
190 | /* for portability of below JPEG code */ | 192 | /* for portability of below JPEG code */ |
191 | #define MEMSET(p,v,c) rb->memset(p,v,c) | 193 | #define MEMSET(p,v,c) rb->memset(p,v,c) |
diff --git a/apps/plugins/lib/mem_function_wrappers.h b/apps/plugins/lib/mem_function_wrappers.h new file mode 100644 index 0000000000..ec3872c4c1 --- /dev/null +++ b/apps/plugins/lib/mem_function_wrappers.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 Nils Wallménius | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef __MEM_FUNCTION_WRAPPERS_H__ | ||
20 | #define __MEM_FUNCTION_WRAPPERS_H__ | ||
21 | |||
22 | /* Use this macro in plugins where gcc tries to optimize by calling | ||
23 | * these functions directly */ | ||
24 | |||
25 | #define MEM_FUNCTION_WRAPPERS(api) \ | ||
26 | void *memcpy(void *dest, const void *src, size_t n) \ | ||
27 | { \ | ||
28 | return (api)->memcpy(dest, src, n); \ | ||
29 | } \ | ||
30 | void *memset(void *dest, int c, size_t n) \ | ||
31 | { \ | ||
32 | return (api)->memset(dest, c, n); \ | ||
33 | } \ | ||
34 | void *memmove(void *dest, const void *src, size_t n) \ | ||
35 | { \ | ||
36 | return (api)->memmove(dest, src, n); \ | ||
37 | } \ | ||
38 | int memcmp(const void *s1, const void *s2, size_t n) \ | ||
39 | { \ | ||
40 | return (api)->memcmp(s1, s2, n); \ | ||
41 | } | ||
42 | |||
43 | #endif /* __MEM_FUNCTION_WRAPPERS_H__ */ | ||
44 | |||
diff --git a/apps/plugins/lib/playback_control.c b/apps/plugins/lib/playback_control.c index 34401e1d4f..177f26a417 100644 --- a/apps/plugins/lib/playback_control.c +++ b/apps/plugins/lib/playback_control.c | |||
@@ -65,10 +65,12 @@ static bool volume(void) | |||
65 | 65 | ||
66 | static bool shuffle(void) | 66 | static bool shuffle(void) |
67 | { | 67 | { |
68 | struct opt_items names[] = { | 68 | struct opt_items names[2]; |
69 | { "No", -1 }, | 69 | names[0].string = "No"; |
70 | { "Yes", -1 } | 70 | names[0].voice_id = -1; |
71 | }; | 71 | names[1].string = "Yes"; |
72 | names[1].voice_id = -1; | ||
73 | |||
72 | return api->set_option("Shuffle", &api->global_settings->playlist_shuffle, | 74 | return api->set_option("Shuffle", &api->global_settings->playlist_shuffle, |
73 | BOOL, names, 2,NULL); | 75 | BOOL, names, 2,NULL); |
74 | } | 76 | } |
diff --git a/apps/plugins/mazezam.c b/apps/plugins/mazezam.c index 607348e91c..ee93d10024 100644 --- a/apps/plugins/mazezam.c +++ b/apps/plugins/mazezam.c | |||
@@ -20,12 +20,15 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | #include "configfile.h" | 22 | #include "configfile.h" |
23 | #include "mem_function_wrappers.h" | ||
23 | 24 | ||
24 | /* Include standard plugin macro */ | 25 | /* Include standard plugin macro */ |
25 | PLUGIN_HEADER | 26 | PLUGIN_HEADER |
26 | 27 | ||
27 | static struct plugin_api* rb; | 28 | static struct plugin_api* rb; |
28 | 29 | ||
30 | MEM_FUNCTION_WRAPPERS(rb); | ||
31 | |||
29 | #if CONFIG_KEYPAD == RECORDER_PAD | 32 | #if CONFIG_KEYPAD == RECORDER_PAD |
30 | #define MAZEZAM_UP BUTTON_UP | 33 | #define MAZEZAM_UP BUTTON_UP |
31 | #define MAZEZAM_DOWN BUTTON_DOWN | 34 | #define MAZEZAM_DOWN BUTTON_DOWN |
diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c index 19a37a580a..daf3294b75 100644 --- a/apps/plugins/metronome.c +++ b/apps/plugins/metronome.c | |||
@@ -18,6 +18,7 @@ | |||
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #include "plugin.h" | 19 | #include "plugin.h" |
20 | #include "pluginlib_actions.h" | 20 | #include "pluginlib_actions.h" |
21 | #include "mem_function_wrappers.h" | ||
21 | 22 | ||
22 | PLUGIN_HEADER | 23 | PLUGIN_HEADER |
23 | 24 | ||
@@ -70,6 +71,8 @@ static const struct button_mapping iriver_syncaction[] = | |||
70 | 71 | ||
71 | static struct plugin_api* rb; | 72 | static struct plugin_api* rb; |
72 | 73 | ||
74 | MEM_FUNCTION_WRAPPERS(rb); | ||
75 | |||
73 | static int bpm = 120; | 76 | static int bpm = 120; |
74 | static int period = 0; | 77 | static int period = 0; |
75 | static int minitick = 0; | 78 | static int minitick = 0; |
@@ -159,7 +162,7 @@ static unsigned char sound[] = { | |||
159 | 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, | 162 | 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, |
160 | 85, 85, 85}; | 163 | 85, 85, 85}; |
161 | 164 | ||
162 | void callback(unsigned char** start, int* size){ | 165 | void callback(unsigned char** start, size_t* size){ |
163 | (void)start; /* unused parameter, avoid warning */ | 166 | (void)start; /* unused parameter, avoid warning */ |
164 | *size = NULL; /* end of data */ | 167 | *size = NULL; /* end of data */ |
165 | sound_active = false; | 168 | sound_active = false; |
diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c index 70372933e0..d1ef2e0a7c 100644 --- a/apps/plugins/mp3_encoder.c +++ b/apps/plugins/mp3_encoder.c | |||
@@ -12,12 +12,15 @@ | |||
12 | * Library General Public License for more details. */ | 12 | * Library General Public License for more details. */ |
13 | 13 | ||
14 | #include "plugin.h" | 14 | #include "plugin.h" |
15 | #include "mem_function_wrappers.h" | ||
15 | 16 | ||
16 | PLUGIN_HEADER | 17 | PLUGIN_HEADER |
17 | PLUGIN_IRAM_DECLARE | 18 | PLUGIN_IRAM_DECLARE |
18 | 19 | ||
19 | static struct plugin_api* rb; | 20 | static struct plugin_api* rb; |
20 | 21 | ||
22 | MEM_FUNCTION_WRAPPERS(rb); | ||
23 | |||
21 | #define SAMP_PER_FRAME 1152 | 24 | #define SAMP_PER_FRAME 1152 |
22 | #define SAMPL2 576 | 25 | #define SAMPL2 576 |
23 | #define SBLIMIT 32 | 26 | #define SBLIMIT 32 |
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c index ee7ff86cb7..2e2e057b64 100644 --- a/apps/plugins/properties.c +++ b/apps/plugins/properties.c | |||
@@ -17,11 +17,14 @@ | |||
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #include "plugin.h" | 19 | #include "plugin.h" |
20 | #include "mem_function_wrappers.h" | ||
20 | 21 | ||
21 | PLUGIN_HEADER | 22 | PLUGIN_HEADER |
22 | 23 | ||
23 | static struct plugin_api* rb; | 24 | static struct plugin_api* rb; |
24 | 25 | ||
26 | MEM_FUNCTION_WRAPPERS(rb); | ||
27 | |||
25 | bool its_a_dir = false; | 28 | bool its_a_dir = false; |
26 | 29 | ||
27 | char str_filename[MAX_PATH]; | 30 | char str_filename[MAX_PATH]; |
@@ -247,7 +250,6 @@ char * get_props(int selected_item, void* data, char *buffer) | |||
247 | enum plugin_status plugin_start(struct plugin_api* api, void* file) | 250 | enum plugin_status plugin_start(struct plugin_api* api, void* file) |
248 | { | 251 | { |
249 | rb = api; | 252 | rb = api; |
250 | |||
251 | struct gui_synclist properties_lists; | 253 | struct gui_synclist properties_lists; |
252 | int button; | 254 | int button; |
253 | bool prev_show_statusbar; | 255 | bool prev_show_statusbar; |
diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c index da8f8052cb..29296ac1b6 100644 --- a/apps/plugins/rockpaint.c +++ b/apps/plugins/rockpaint.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include "errno.h" | 30 | #include "errno.h" |
31 | #include "lib/bmp.h" | 31 | #include "lib/bmp.h" |
32 | #include "lib/rgb_hsv.h" | 32 | #include "lib/rgb_hsv.h" |
33 | #include "mem_function_wrappers.h" | ||
33 | 34 | ||
34 | PLUGIN_HEADER | 35 | PLUGIN_HEADER |
35 | 36 | ||
@@ -224,6 +225,8 @@ int errno; | |||
224 | 225 | ||
225 | static struct plugin_api* rb; | 226 | static struct plugin_api* rb; |
226 | 227 | ||
228 | MEM_FUNCTION_WRAPPERS(rb); | ||
229 | |||
227 | static int drawcolor=0; /* Current color (in palette) */ | 230 | static int drawcolor=0; /* Current color (in palette) */ |
228 | static int bgdrawcolor=9; /* Current background color (in palette) */ | 231 | static int bgdrawcolor=9; /* Current background color (in palette) */ |
229 | bool isbg = false; /* gruik ugly hack alert */ | 232 | bool isbg = false; /* gruik ugly hack alert */ |
diff --git a/apps/plugins/video.c b/apps/plugins/video.c index f049974023..b56a9d0612 100644 --- a/apps/plugins/video.c +++ b/apps/plugins/video.c | |||
@@ -423,7 +423,7 @@ void timer4_isr(void) | |||
423 | 423 | ||
424 | 424 | ||
425 | /* ISR function to get more mp3 data */ | 425 | /* ISR function to get more mp3 data */ |
426 | void GetMoreMp3(unsigned char** start, int* size) | 426 | void GetMoreMp3(unsigned char** start, size_t* size) |
427 | { | 427 | { |
428 | int available; | 428 | int available; |
429 | int advance; | 429 | int advance; |
diff --git a/apps/plugins/xobox.c b/apps/plugins/xobox.c index 33ef4d04e9..0d1bdc4f72 100644 --- a/apps/plugins/xobox.c +++ b/apps/plugins/xobox.c | |||
@@ -19,6 +19,7 @@ | |||
19 | ****************************************************************************/ | 19 | ****************************************************************************/ |
20 | 20 | ||
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | #include "mem_function_wrappers.h" | ||
22 | 23 | ||
23 | PLUGIN_HEADER | 24 | PLUGIN_HEADER |
24 | 25 | ||
@@ -204,6 +205,9 @@ static int difficulty = 75; /* Percentage of screen that needs to be filled | |||
204 | * in order to win the game */ | 205 | * in order to win the game */ |
205 | 206 | ||
206 | static struct plugin_api *rb; | 207 | static struct plugin_api *rb; |
208 | |||
209 | MEM_FUNCTION_WRAPPERS(rb); | ||
210 | |||
207 | static bool quit = false; | 211 | static bool quit = false; |
208 | 212 | ||
209 | static unsigned int board[BOARD_H][BOARD_W]; | 213 | static unsigned int board[BOARD_H][BOARD_W]; |
@@ -295,7 +299,6 @@ static inline void emptyStack (void) | |||
295 | 299 | ||
296 | /*********************** END OF STACK STUFF *********************/ | 300 | /*********************** END OF STACK STUFF *********************/ |
297 | 301 | ||
298 | |||
299 | /* calculate the new x coordinate of the ball according to angle and speed */ | 302 | /* calculate the new x coordinate of the ball according to angle and speed */ |
300 | static inline int get_newx (int x, int len, int deg) | 303 | static inline int get_newx (int x, int len, int deg) |
301 | { | 304 | { |
diff --git a/apps/talk.c b/apps/talk.c index 1f1eefd51d..1610fa95ec 100644 --- a/apps/talk.c +++ b/apps/talk.c | |||
@@ -132,7 +132,7 @@ static int talk_menu_disable; /* if non-zero, temporarily disable voice UI (not | |||
132 | /***************** Private prototypes *****************/ | 132 | /***************** Private prototypes *****************/ |
133 | 133 | ||
134 | static void load_voicefile(void); | 134 | static void load_voicefile(void); |
135 | static void mp3_callback(unsigned char** start, int* size); | 135 | static void mp3_callback(unsigned char** start, size_t* size); |
136 | static int shutup(void); | 136 | static int shutup(void); |
137 | static int queue_clip(unsigned char* buf, long size, bool enqueue); | 137 | static int queue_clip(unsigned char* buf, long size, bool enqueue); |
138 | static int open_voicefile(void); | 138 | static int open_voicefile(void); |
@@ -262,7 +262,7 @@ load_err: | |||
262 | 262 | ||
263 | 263 | ||
264 | /* called in ISR context if mp3 data got consumed */ | 264 | /* called in ISR context if mp3 data got consumed */ |
265 | static void mp3_callback(unsigned char** start, int* size) | 265 | static void mp3_callback(unsigned char** start, size_t* size) |
266 | { | 266 | { |
267 | queue[queue_read].len -= sent; /* we completed this */ | 267 | queue[queue_read].len -= sent; /* we completed this */ |
268 | queue[queue_read].buf += sent; | 268 | queue[queue_read].buf += sent; |
diff --git a/firmware/export/mp3_playback.h b/firmware/export/mp3_playback.h index 772eafe971..d766608aec 100644 --- a/firmware/export/mp3_playback.h +++ b/firmware/export/mp3_playback.h | |||
@@ -39,7 +39,7 @@ void demand_irq_enable(bool on); | |||
39 | /* new functions, exported to plugin API */ | 39 | /* new functions, exported to plugin API */ |
40 | void mp3_play_init(void); | 40 | void mp3_play_init(void); |
41 | void mp3_play_data(const unsigned char* start, int size, | 41 | void mp3_play_data(const unsigned char* start, int size, |
42 | void (*get_more)(unsigned char** start, int* size) /* callback fn */ | 42 | void (*get_more)(unsigned char** start, size_t* size) /* callback fn */ |
43 | ); | 43 | ); |
44 | void mp3_play_pause(bool play); | 44 | void mp3_play_pause(bool play); |
45 | bool mp3_pause_done(void); | 45 | bool mp3_pause_done(void); |
diff --git a/firmware/mp3_playback.c b/firmware/mp3_playback.c index 68fa96d619..c5c747ac2c 100644 --- a/firmware/mp3_playback.c +++ b/firmware/mp3_playback.c | |||
@@ -61,7 +61,7 @@ static long playstart_tick; | |||
61 | static long cumulative_ticks; | 61 | static long cumulative_ticks; |
62 | 62 | ||
63 | /* the registered callback function to ask for more mp3 data */ | 63 | /* the registered callback function to ask for more mp3 data */ |
64 | static void (*callback_for_more)(unsigned char**, int*); | 64 | static void (*callback_for_more)(unsigned char**, size_t*); |
65 | #endif /* #ifndef SIMULATOR */ | 65 | #endif /* #ifndef SIMULATOR */ |
66 | 66 | ||
67 | /* list of tracks in memory */ | 67 | /* list of tracks in memory */ |
@@ -167,7 +167,7 @@ void DEI3(void) __attribute__((interrupt_handler)); | |||
167 | void DEI3(void) | 167 | void DEI3(void) |
168 | { | 168 | { |
169 | unsigned char* start; | 169 | unsigned char* start; |
170 | int size = 0; | 170 | size_t size = 0; |
171 | 171 | ||
172 | if (callback_for_more != NULL) | 172 | if (callback_for_more != NULL) |
173 | { | 173 | { |
@@ -502,7 +502,7 @@ void mp3_play_init(void) | |||
502 | } | 502 | } |
503 | 503 | ||
504 | void mp3_play_data(const unsigned char* start, int size, | 504 | void mp3_play_data(const unsigned char* start, int size, |
505 | void (*get_more)(unsigned char** start, int* size) /* callback fn */ | 505 | void (*get_more)(unsigned char** start, size_t* size) /* callback fn */ |
506 | ) | 506 | ) |
507 | { | 507 | { |
508 | /* init DMA */ | 508 | /* init DMA */ |
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index a66a4d0f01..0299d4d557 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c | |||
@@ -810,7 +810,7 @@ static void reset_mp3_buffer(void) | |||
810 | } | 810 | } |
811 | 811 | ||
812 | /* DMA transfer end interrupt callback */ | 812 | /* DMA transfer end interrupt callback */ |
813 | static void transfer_end(unsigned char** ppbuf, int* psize) | 813 | static void transfer_end(unsigned char** ppbuf, size_t* psize) |
814 | { | 814 | { |
815 | if(playing && !paused) | 815 | if(playing && !paused) |
816 | { | 816 | { |
diff --git a/tools/configure b/tools/configure index 1a84a487ee..d73409d44b 100755 --- a/tools/configure +++ b/tools/configure | |||
@@ -1470,6 +1470,11 @@ if test "$CC" = "sh-elf-gcc"; then | |||
1470 | fi | 1470 | fi |
1471 | fi | 1471 | fi |
1472 | 1472 | ||
1473 | if test "$CC" = "m68k-elf-gcc"; then | ||
1474 | # convert -O to -Os to get smaller binaries! | ||
1475 | GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'` | ||
1476 | fi | ||
1477 | |||
1473 | if test "$1" = "--ccache"; then | 1478 | if test "$1" = "--ccache"; then |
1474 | echo "Enable ccache for building" | 1479 | echo "Enable ccache for building" |
1475 | ccache="ccache" | 1480 | ccache="ccache" |