summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-06-27 21:23:03 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-06-27 21:23:03 +0000
commita24017f4da1be50a43bd14db607205582abc7544 (patch)
tree16e3d6a2fc27e21a44238b3b647c50546e0bb5ce /apps
parent46136596433da25f3d802d72d0d1273a229c9d9f (diff)
downloadrockbox-a24017f4da1be50a43bd14db607205582abc7544.tar.gz
rockbox-a24017f4da1be50a43bd14db607205582abc7544.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs.c10
-rw-r--r--apps/codecs.h4
-rw-r--r--apps/plugin.h7
-rw-r--r--apps/plugins/Makefile2
-rw-r--r--apps/plugins/plugin.lds14
-rwxr-xr-xapps/plugins/rockboy/archos.lds2
6 files changed, 10 insertions, 29 deletions
diff --git a/apps/codecs.c b/apps/codecs.c
index da4b1f8bff..16338c263c 100644
--- a/apps/codecs.c
+++ b/apps/codecs.c
@@ -16,6 +16,8 @@
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19#include "config.h"
20
19#include <stdbool.h> 21#include <stdbool.h>
20#include <string.h> 22#include <string.h>
21#include <stdio.h> 23#include <stdio.h>
@@ -52,7 +54,7 @@
52 54
53#ifdef SIMULATOR 55#ifdef SIMULATOR
54#if CONFIG_HWCODEC == MASNONE 56#if CONFIG_HWCODEC == MASNONE
55static unsigned char codecbuf[CODEC_BUFFER_SIZE]; 57static unsigned char codecbuf[CODEC_SIZE];
56#endif 58#endif
57void *sim_codec_load(char *plugin, int *fd); 59void *sim_codec_load(char *plugin, int *fd);
58void sim_codec_close(int fd); 60void sim_codec_close(int fd);
@@ -251,9 +253,9 @@ int codec_load_ram(char* codecptr, size_t size, void* ptr2, size_t bufwrap)
251 253
252 if ((char *)&codecbuf[0] != codecptr) { 254 if ((char *)&codecbuf[0] != codecptr) {
253 /* zero out codec buffer to ensure a properly zeroed bss area */ 255 /* zero out codec buffer to ensure a properly zeroed bss area */
254 memset(codecbuf, 0, CODEC_BUFFER_SIZE); 256 memset(codecbuf, 0, CODEC_SIZE);
255 257
256 size = MIN(size, CODEC_BUFFER_SIZE); 258 size = MIN(size, CODEC_SIZE);
257 copy_n = MIN(size, bufwrap); 259 copy_n = MIN(size, bufwrap);
258 memcpy(codecbuf, codecptr, copy_n); 260 memcpy(codecbuf, codecptr, copy_n);
259 size -= copy_n; 261 size -= copy_n;
@@ -283,7 +285,7 @@ int codec_load_file(const char *plugin)
283 return fd; 285 return fd;
284 } 286 }
285 287
286 rc = read(fd, &codecbuf[0], CODEC_BUFFER_SIZE); 288 rc = read(fd, &codecbuf[0], CODEC_SIZE);
287 close(fd); 289 close(fd);
288 if (rc <= 0) { 290 if (rc <= 0) {
289 logf("Codec read error"); 291 logf("Codec read error");
diff --git a/apps/codecs.h b/apps/codecs.h
index c50af3030e..1a03139be8 100644
--- a/apps/codecs.h
+++ b/apps/codecs.h
@@ -72,10 +72,6 @@
72 72
73#endif 73#endif
74 74
75/* This size must match the one set in ../plugins/plugin.lds and
76 ../../firmware/app.lds */
77#define CODEC_BUFFER_SIZE 0x40000
78
79#ifdef SIMULATOR 75#ifdef SIMULATOR
80#define PREFIX(_x_) sim_ ## _x_ 76#define PREFIX(_x_) sim_ ## _x_
81#else 77#else
diff --git a/apps/plugin.h b/apps/plugin.h
index 6d2b6e5bf0..d2253b42c6 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -80,13 +80,6 @@
80 80
81#endif 81#endif
82 82
83/* These three sizes must match the ones set in plugins/plugin.lds */
84#if MEM >= 32
85#define PLUGIN_BUFFER_SIZE 0xC0000
86#else
87#define PLUGIN_BUFFER_SIZE 0x8000
88#endif
89
90#ifdef SIMULATOR 83#ifdef SIMULATOR
91#define PREFIX(_x_) sim_ ## _x_ 84#define PREFIX(_x_) sim_ ## _x_
92#else 85#else
diff --git a/apps/plugins/Makefile b/apps/plugins/Makefile
index fbae027ca3..a59e33f5c6 100644
--- a/apps/plugins/Makefile
+++ b/apps/plugins/Makefile
@@ -51,7 +51,7 @@ endif
51all: $(BUILDDIR)/libplugin.a $(ROCKS) $(SUBDIRS) $(DEPFILE) 51all: $(BUILDDIR)/libplugin.a $(ROCKS) $(SUBDIRS) $(DEPFILE)
52 52
53ifndef SIMVER 53ifndef SIMVER
54$(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(LINKCODEC) $(BUILDDIR)/libplugin.a 54$(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(BUILDDIR)/libplugin.a
55 $(SILENT)(file=`basename $@`; \ 55 $(SILENT)(file=`basename $@`; \
56 echo "LD $$file"; \ 56 echo "LD $$file"; \
57 $(CC) $(GCCOPTS) -O -nostdlib -o $@ $< -L$(BUILDDIR) $(CODECLIBS) -lplugin -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/$*.map) 57 $(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 f1b4d300d7..3e624d6a0b 100644
--- a/apps/plugins/plugin.lds
+++ b/apps/plugins/plugin.lds
@@ -22,19 +22,9 @@ OUTPUT_FORMAT(elf32-sh)
22#define DRAMORIG 0x09000000 + STUBOFFSET 22#define DRAMORIG 0x09000000 + STUBOFFSET
23#endif 23#endif
24 24
25#ifdef CODEC 25#define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE
26#define CODEC_SIZE 0x40000
27#else
28#define CODEC_SIZE 0
29#endif
30 26
31#if MEMORYSIZE >= 32 27#ifdef CODEC
32#define PLUGIN_LENGTH 0xC0000
33#else
34#define PLUGIN_LENGTH 0x8000
35#endif
36
37#if CODEC_SIZE > 0
38#define THIS_LENGTH CODEC_SIZE 28#define THIS_LENGTH CODEC_SIZE
39#else 29#else
40#define THIS_LENGTH PLUGIN_LENGTH 30#define THIS_LENGTH PLUGIN_LENGTH
diff --git a/apps/plugins/rockboy/archos.lds b/apps/plugins/rockboy/archos.lds
index 23d03c6297..9412c4365a 100755
--- a/apps/plugins/rockboy/archos.lds
+++ b/apps/plugins/rockboy/archos.lds
@@ -6,7 +6,7 @@
6OUTPUT_FORMAT(elf32-sh) 6OUTPUT_FORMAT(elf32-sh)
7 7
8#define DRAMORIG 0x09000000 8#define DRAMORIG 0x09000000
9#define PLUGIN_LENGTH 0x8000 9#define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE
10 10
11#define OVERLAY_LENGTH 0x68000 11#define OVERLAY_LENGTH 0x68000
12#define OVERLAY_ORIGIN (DRAMORIG + (MEMORYSIZE * 0x100000) - PLUGIN_LENGTH - OVERLAY_LENGTH) 12#define OVERLAY_ORIGIN (DRAMORIG + (MEMORYSIZE * 0x100000) - PLUGIN_LENGTH - OVERLAY_LENGTH)