diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2005-06-27 21:23:03 +0000 |
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2005-06-27 21:23:03 +0000 |
| commit | a24017f4da1be50a43bd14db607205582abc7544 (patch) | |
| tree | 16e3d6a2fc27e21a44238b3b647c50546e0bb5ce | |
| parent | 46136596433da25f3d802d72d0d1273a229c9d9f (diff) | |
| download | rockbox-a24017f4da1be50a43bd14db607205582abc7544.zip rockbox-a24017f4da1be50a43bd14db607205582abc7544.tar.gz rockbox-a24017f4da1be50a43bd14db607205582abc7544.tar.bz2 rockbox-a24017f4da1be50a43bd14db607205582abc7544.tar.xz | |
Moved the codec and plugin buffer sizes to the config-*.h files instead of
having it repeated in numerous files where they all had to be updated to the
same value if ever changed. This allows specific models to actually have its
own buffer sizes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6901 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | apps/codecs.c | 10 | ||||
| -rw-r--r-- | apps/codecs.h | 4 | ||||
| -rw-r--r-- | apps/plugin.h | 7 | ||||
| -rw-r--r-- | apps/plugins/Makefile | 2 | ||||
| -rw-r--r-- | apps/plugins/plugin.lds | 14 | ||||
| -rwxr-xr-x | apps/plugins/rockboy/archos.lds | 2 | ||||
| -rw-r--r-- | firmware/app.lds | 12 | ||||
| -rw-r--r-- | firmware/export/config-fmrecorder.h | 3 | ||||
| -rw-r--r-- | firmware/export/config-gmini120.h | 7 | ||||
| -rw-r--r-- | firmware/export/config-gminisp.h | 7 | ||||
| -rw-r--r-- | firmware/export/config-h100.h | 6 | ||||
| -rw-r--r-- | firmware/export/config-h300.h | 6 | ||||
| -rw-r--r-- | firmware/export/config-ondiofm.h | 3 | ||||
| -rw-r--r-- | firmware/export/config-ondiosp.h | 3 | ||||
| -rw-r--r-- | firmware/export/config-player.h | 3 | ||||
| -rw-r--r-- | firmware/export/config-recorder.h | 3 | ||||
| -rw-r--r-- | firmware/export/config-recorderv2.h | 3 | ||||
| -rw-r--r-- | firmware/export/config.h | 4 |
18 files changed, 60 insertions, 39 deletions
diff --git a/apps/codecs.c b/apps/codecs.c index da4b1f8..16338c2 100644 --- a/apps/codecs.c +++ b/apps/codecs.c @@ -16,6 +16,8 @@ * KIND, either express or implied. * ****************************************************************************/ +#include "config.h" + #include <stdbool.h> #include <string.h> #include <stdio.h> @@ -52,7 +54,7 @@ #ifdef SIMULATOR #if CONFIG_HWCODEC == MASNONE -static unsigned char codecbuf[CODEC_BUFFER_SIZE]; +static unsigned char codecbuf[CODEC_SIZE]; #endif void *sim_codec_load(char *plugin, int *fd); void sim_codec_close(int fd); @@ -251,9 +253,9 @@ int codec_load_ram(char* codecptr, size_t size, void* ptr2, size_t bufwrap) if ((char *)&codecbuf[0] != codecptr) { /* zero out codec buffer to ensure a properly zeroed bss area */ - memset(codecbuf, 0, CODEC_BUFFER_SIZE); + memset(codecbuf, 0, CODEC_SIZE); - size = MIN(size, CODEC_BUFFER_SIZE); + size = MIN(size, CODEC_SIZE); copy_n = MIN(size, bufwrap); memcpy(codecbuf, codecptr, copy_n); size -= copy_n; @@ -283,7 +285,7 @@ int codec_load_file(const char *plugin) return fd; } - rc = read(fd, &codecbuf[0], CODEC_BUFFER_SIZE); + rc = read(fd, &codecbuf[0], CODEC_SIZE); close(fd); if (rc <= 0) { logf("Codec read error"); diff --git a/apps/codecs.h b/apps/codecs.h index c50af30..1a03139 100644 --- a/apps/codecs.h +++ b/apps/codecs.h @@ -72,10 +72,6 @@ #endif -/* This size must match the one set in ../plugins/plugin.lds and - ../../firmware/app.lds */ -#define CODEC_BUFFER_SIZE 0x40000 - #ifdef SIMULATOR #define PREFIX(_x_) sim_ ## _x_ #else diff --git a/apps/plugin.h b/apps/plugin.h index 6d2b6e5..d2253b4 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -80,13 +80,6 @@ #endif -/* These three sizes must match the ones set in plugins/plugin.lds */ -#if MEM >= 32 -#define PLUGIN_BUFFER_SIZE 0xC0000 -#else -#define PLUGIN_BUFFER_SIZE 0x8000 -#endif - #ifdef SIMULATOR #define PREFIX(_x_) sim_ ## _x_ #else diff --git a/apps/plugins/Makefile b/apps/plugins/Makefile index fbae027..a59e33f 100644 --- a/apps/plugins/Makefile +++ b/apps/plugins/Makefile @@ -51,7 +51,7 @@ endif all: $(BUILDDIR)/libplugin.a $(ROCKS) $(SUBDIRS) $(DEPFILE) ifndef SIMVER -$(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(LINKCODEC) $(BUILDDIR)/libplugin.a +$(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(BUILDDIR)/libplugin.a $(SILENT)(file=`basename $@`; \ echo "LD $$file"; \ $(CC) $(GCCOPTS) -O -nostdlib -o $@ $< -L$(BUILDDIR) $(CODECLIBS) -lplugin -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/$*.map) diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds index f1b4d30..3e624d6 100644 --- a/apps/plugins/plugin.lds +++ b/apps/plugins/plugin.lds @@ -22,19 +22,9 @@ OUTPUT_FORMAT(elf32-sh) #define DRAMORIG 0x09000000 + STUBOFFSET #endif -#ifdef CODEC -#define CODEC_SIZE 0x40000 -#else -#define CODEC_SIZE 0 -#endif +#define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE -#if MEMORYSIZE >= 32 -#define PLUGIN_LENGTH 0xC0000 -#else -#define PLUGIN_LENGTH 0x8000 -#endif - -#if CODEC_SIZE > 0 +#ifdef CODEC #define THIS_LENGTH CODEC_SIZE #else #define THIS_LENGTH PLUGIN_LENGTH diff --git a/apps/plugins/rockboy/archos.lds b/apps/plugins/rockboy/archos.lds index 23d03c6..9412c43 100755 --- a/apps/plugins/rockboy/archos.lds +++ b/apps/plugins/rockboy/archos.lds @@ -6,7 +6,7 @@ OUTPUT_FORMAT(elf32-sh) #define DRAMORIG 0x09000000 -#define PLUGIN_LENGTH 0x8000 +#define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE #define OVERLAY_LENGTH 0x68000 #define OVERLAY_ORIGIN (DRAMORIG + (MEMORYSIZE * 0x100000) - PLUGIN_LENGTH - OVERLAY_LENGTH) diff --git a/firmware/app.lds b/firmware/app.lds index 91f0395..ee666d8 100644 --- a/firmware/app.lds +++ b/firmware/app.lds @@ -101,17 +101,9 @@ _pluginbuf = 0; #else -#if MEMORYSIZE >= 32 -#define PLUGINSIZE 0xC0000 -#else -#define PLUGINSIZE 0x8000 -#endif +#define PLUGINSIZE PLUGIN_BUFFER_SIZE +#define CODECSIZE CODEC_SIZE -#if CONFIG_HWCODEC == MASNONE -#define CODECSIZE 0x40000 -#else -#define CODECSIZE 0 -#endif #ifdef DEBUG #define STUBOFFSET 0x10000 diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h index a3f2597..d566ffd 100644 --- a/firmware/export/config-fmrecorder.h +++ b/firmware/export/config-fmrecorder.h @@ -17,6 +17,9 @@ /* Define this if you have a software controlled poweroff */ #define HAVE_SW_POWEROFF +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0x8000 + #ifndef SIMULATOR /* Define this if you have a MAS3587F */ diff --git a/firmware/export/config-gmini120.h b/firmware/export/config-gmini120.h index 93b8727..fa7e98e 100644 --- a/firmware/export/config-gmini120.h +++ b/firmware/export/config-gmini120.h @@ -19,6 +19,13 @@ /* Define this if you have a software controlled poweroff */ #define HAVE_SW_POWEROFF +/* The number of bytes reserved for loadable codecs. Although in this case + the codec won't be loadable... */ +#define CODEC_SIZE 0x40000 + +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0xC0000 + #ifndef SIMULATOR /* Define this if you have a TCC730 (CalmRISC16) */ diff --git a/firmware/export/config-gminisp.h b/firmware/export/config-gminisp.h index 6a1105f..2bf97d5 100644 --- a/firmware/export/config-gminisp.h +++ b/firmware/export/config-gminisp.h @@ -13,6 +13,13 @@ /* Define this if you have a software controlled poweroff */ #define HAVE_SW_POWEROFF +/* The number of bytes reserved for loadable codecs. Although in this case + the codec won't be loadable... */ +#define CODEC_SIZE 0x40000 + +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0xC0000 + #ifndef SIMULATOR /* Define this if you have a TCC730 (CalmRISC16) */ diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index 552eea1..5c161ae 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h @@ -27,6 +27,12 @@ /* Define this if you have a software controlled poweroff */ #define HAVE_SW_POWEROFF +/* The number of bytes reserved for loadable codecs */ +#define CODEC_SIZE 0x40000 + +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0xC0000 + #ifndef SIMULATOR /* Define this if you have a Motorola SCF5249 */ diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index 015f31a..f6e1e69 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h @@ -25,6 +25,12 @@ /* Define this if you have a software controlled poweroff */ #define HAVE_SW_POWEROFF +/* The number of bytes reserved for loadable codecs */ +#define CODEC_SIZE 0x40000 + +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0xC0000 + #ifndef SIMULATOR /* Define this if you have a Motorola SCF5249 */ diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h index 9436b86..48f1d86 100644 --- a/firmware/export/config-ondiofm.h +++ b/firmware/export/config-ondiofm.h @@ -14,6 +14,9 @@ /* Define this if you have a software controlled poweroff */ #define HAVE_SW_POWEROFF +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0x8000 + #ifndef SIMULATOR /* Define this if you have a SH7034 */ diff --git a/firmware/export/config-ondiosp.h b/firmware/export/config-ondiosp.h index fd79d19..3030c28 100644 --- a/firmware/export/config-ondiosp.h +++ b/firmware/export/config-ondiosp.h @@ -11,6 +11,9 @@ /* Define this if you have a software controlled poweroff */ #define HAVE_SW_POWEROFF +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0x8000 + #ifndef SIMULATOR /* Define this if you have a SH7034 */ diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h index eee9e97..464561d 100644 --- a/firmware/export/config-player.h +++ b/firmware/export/config-player.h @@ -8,6 +8,9 @@ /* define this if you have the Player's keyboard */ #define CONFIG_KEYPAD PLAYER_PAD +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0x8000 + #ifndef SIMULATOR /* Define this if you have a SH7034 */ diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h index 61c76d4..4cc378f 100644 --- a/firmware/export/config-recorder.h +++ b/firmware/export/config-recorder.h @@ -14,6 +14,9 @@ /* define this if you have a real-time clock */ #define HAVE_RTC 1 +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0x8000 + #ifndef SIMULATOR /* Define this if you have a MAS3587F */ diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h index c75f0e6..a9c8afc 100644 --- a/firmware/export/config-recorderv2.h +++ b/firmware/export/config-recorderv2.h @@ -17,6 +17,9 @@ /* Define this if you have a software controlled poweroff */ #define HAVE_SW_POWEROFF +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0x8000 + #ifndef SIMULATOR /* Define this if you have a SH7034 */ diff --git a/firmware/export/config.h b/firmware/export/config.h index e0d901b..61c9899 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -108,4 +108,8 @@ /* no known platform */ #endif +#ifndef CODEC_SIZE +#define CODEC_SIZE 0 +#endif + #endif |