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
This commit is contained in:
Daniel Stenberg 2005-06-27 21:23:03 +00:00
parent 4613659643
commit a24017f4da
18 changed files with 60 additions and 39 deletions

View file

@ -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");

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -22,19 +22,9 @@ OUTPUT_FORMAT(elf32-sh)
#define DRAMORIG 0x09000000 + STUBOFFSET
#endif
#define PLUGIN_LENGTH PLUGIN_BUFFER_SIZE
#ifdef CODEC
#define CODEC_SIZE 0x40000
#else
#define CODEC_SIZE 0
#endif
#if MEMORYSIZE >= 32
#define PLUGIN_LENGTH 0xC0000
#else
#define PLUGIN_LENGTH 0x8000
#endif
#if CODEC_SIZE > 0
#define THIS_LENGTH CODEC_SIZE
#else
#define THIS_LENGTH PLUGIN_LENGTH

View file

@ -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)

View file

@ -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

View file

@ -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 */

View file

@ -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) */

View file

@ -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) */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -108,4 +108,8 @@
/* no known platform */
#endif
#ifndef CODEC_SIZE
#define CODEC_SIZE 0
#endif
#endif