Clean up multiple definitions of RAM size. Remove -DMEM (make) and MEM (code), use the already defined MEMORYSIZE instead.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29189 a1c6a512-1295-4272-9138-f99709370657
diff --git a/apps/buffering.c b/apps/buffering.c
index 46b6455..8d41324 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -119,7 +119,7 @@
/* Configuration */
static size_t conf_watermark = 0; /* Level to trigger filebuf fill */
-#if MEM > 8
+#if MEMORYSIZE > 8
static size_t high_watermark = 0; /* High watermark for rebuffer */
#endif
@@ -1509,7 +1509,7 @@
#if 0
/* TODO: This needs to be fixed to use the idle callback, disable it
* for simplicity until its done right */
-#if MEM > 8
+#if MEMORYSIZE > 8
/* If the disk is spinning, take advantage by filling the buffer */
else if (storage_disk_is_active() && queue_empty(&buffering_queue))
{
@@ -1589,7 +1589,7 @@
base_handle_id = -1;
/* Set the high watermark as 75% full...or 25% empty :) */
-#if MEM > 8
+#if MEMORYSIZE > 8
high_watermark = 3*buflen / 4;
#endif
diff --git a/apps/codecs.h b/apps/codecs.h
index 1c0b9da..c3ef7c1 100644
--- a/apps/codecs.h
+++ b/apps/codecs.h
@@ -27,10 +27,6 @@
#define NO_REDEFINES_PLEASE
#endif
-#ifndef MEM
-#define MEM 2
-#endif
-
#include <stdbool.h>
#include <stdlib.h>
#include "strlcpy.h"
diff --git a/apps/main.c b/apps/main.c
index a7d6dc3..6378833 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -430,7 +430,7 @@
system_init();
#if defined(IPOD_VIDEO)
audiobufend=(unsigned char *)audiobufend_lds;
- if(MEM==64 && probed_ramsize!=64)
+ if(MEMORYSIZE==64 && probed_ramsize!=64)
{
audiobufend -= (32<<20);
}
diff --git a/apps/mpeg.c b/apps/mpeg.c
index 583e4e2..bdca920 100644
--- a/apps/mpeg.c
+++ b/apps/mpeg.c
@@ -1623,7 +1623,7 @@
#if (CONFIG_STORAGE & STORAGE_MMC)
/* MMC is slow, so don't read too large chunks */
amount_to_read = MIN(0x40000, amount_to_read);
-#elif MEM == 8
+#elif MEMORYSIZE == 8
amount_to_read = MIN(0x100000, amount_to_read);
#endif
@@ -1933,7 +1933,7 @@
#if (CONFIG_STORAGE & STORAGE_MMC)
/* MMC is slow, so don't save too large chunks at once */
amount_to_save = MIN(0x40000, amount_to_save);
-#elif MEM == 8
+#elif MEMORYSIZE == 8
amount_to_save = MIN(0x100000, amount_to_save);
#endif
rc = write(mpeg_file, audiobuf + audiobuf_read,
diff --git a/apps/plugin.h b/apps/plugin.h
index 4b11ac3..77dedc5 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -27,10 +27,6 @@
#define NO_REDEFINES_PLEASE
#endif
-#ifndef MEM
-#define MEM 2
-#endif
-
#include <stdbool.h>
#include <inttypes.h>
#include <sys/types.h>
diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c
index 01a706b..4dc88fd 100644
--- a/apps/plugins/rockboy/rockboy.c
+++ b/apps/plugins/rockboy/rockboy.c
@@ -430,7 +430,7 @@
= rb->plugin_get_audio_buffer(&audio_buffer_free);
plugbuf=false;
}
-#if MEM <= 8 && (CONFIG_PLATFORM & PLATFORM_NATIVE)
+#if MEMORYSIZE <= 8 && (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* loaded as an overlay plugin, protect from overwriting ourselves */
if ((unsigned)(plugin_start_addr - (unsigned char *)audio_bufferbase)
< audio_buffer_free)
diff --git a/apps/plugins/wavplay.c b/apps/plugins/wavplay.c
index 887c5cd..073af31 100644
--- a/apps/plugins/wavplay.c
+++ b/apps/plugins/wavplay.c
@@ -3600,7 +3600,7 @@
wanted = MIN(free_space, aud_size - aud_write);
#if (CONFIG_STORAGE & STORAGE_MMC)
wanted = MIN(wanted, 256*1024);
-#elif MEM == 8
+#elif MEMORYSIZE == 8
wanted = MIN(wanted, 1024*1024);
#endif
if (available() < low_water)
diff --git a/apps/recorder/pcm_record.c b/apps/recorder/pcm_record.c
index 0221963..6ecb75f 100644
--- a/apps/recorder/pcm_record.c
+++ b/apps/recorder/pcm_record.c
@@ -131,7 +131,7 @@
****************************************************************************/
/** buffer parameters where incoming PCM data is placed **/
-#if MEM <= 2
+#if MEMORYSIZE <= 2
#define PCM_NUM_CHUNKS 16 /* Power of 2 */
#else
#define PCM_NUM_CHUNKS 256 /* Power of 2 */
@@ -180,13 +180,13 @@
#ifdef HAVE_PRIORITY_SCHEDULING
#define PRIO_SECONDS 10 /* max flush time before priority boost */
#endif
-#if MEM <= 2
+#if MEMORYSIZE <= 2
/* fractions must be integer fractions of 4 because they are evaluated with
* X*4*XXX_SECONDS, that way we avoid float calculation */
#define LOW_SECONDS 1/4 /* low watermark time till empty */
#define PANIC_SECONDS 1/2 /* flood watermark time until full */
#define FLUSH_SECONDS 1 /* flush watermark time until full */
-#elif MEM <= 16
+#elif MEMORYSIZE <= 16
#define LOW_SECONDS 1 /* low watermark time till empty */
#define PANIC_SECONDS 5 /* flood watermark time until full */
#define FLUSH_SECONDS 7 /* flush watermark time until full */
@@ -194,7 +194,7 @@
#define LOW_SECONDS 1 /* low watermark time till empty */
#define PANIC_SECONDS 8
#define FLUSH_SECONDS 10
-#endif /* MEM */
+#endif /* MEMORYSIZE */
/** encoder events **/
static void (*enc_events_callback)(enum enc_events event, void *data);
diff --git a/apps/settings_list.c b/apps/settings_list.c
index c6f5e67..94910c0 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -760,7 +760,7 @@
SYSTEM_SETTING(NVRAM(4), topruntime, 0),
INT_SETTING(F_BANFROMQS, max_files_in_playlist,
LANG_MAX_FILES_IN_PLAYLIST,
-#if MEM > 1
+#if MEMORYSIZE > 1
10000,
#else
400,
@@ -768,7 +768,7 @@
"max files in playlist", UNIT_INT, 1000, 32000, 1000,
NULL, NULL, NULL),
INT_SETTING(F_BANFROMQS, max_files_in_dir, LANG_MAX_FILES_IN_DIR,
-#if MEM > 1
+#if MEMORYSIZE > 1
1000,
#else
200,
diff --git a/apps/talk.c b/apps/talk.c
index 7dbfb2e..ad34437 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -112,7 +112,7 @@
/* The MMC storage on the Ondios is slow enough that we want to buffer the
* talk clips only when they are needed */
# define TALK_PROGRESSIVE_LOAD
-#elif CONFIG_CODEC == SWCODEC && MEM <= 2
+#elif CONFIG_CODEC == SWCODEC && MEMORYSIZE <= 2
/* The entire voice file wouldn't fit in memory together with codecs, so we
* load clips each time they are accessed */
# define TALK_PARTIAL_LOAD
diff --git a/firmware/buffer.c b/firmware/buffer.c
index 4ede24d..a1a9b05 100644
--- a/firmware/buffer.c
+++ b/firmware/buffer.c
@@ -24,7 +24,7 @@
#include "logf.h"
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
-unsigned char audiobuffer[(MEM*1024-256)*1024];
+unsigned char audiobuffer[(MEMORYSIZE*1024-256)*1024];
unsigned char *audiobufend = audiobuffer + sizeof(audiobuffer);
#else
/* defined in linker script */
diff --git a/firmware/common/dir_uncached.c b/firmware/common/dir_uncached.c
index 00123c1..14c8522 100644
--- a/firmware/common/dir_uncached.c
+++ b/firmware/common/dir_uncached.c
@@ -28,7 +28,7 @@
#include "debug.h"
#include "filefuncs.h"
-#if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8)
+#if (MEMORYSIZE > 8)
#define MAX_OPEN_DIRS 12
#else
#define MAX_OPEN_DIRS 8
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c
index e8a5e7c..1e0e022 100644
--- a/firmware/common/dircache.c
+++ b/firmware/common/dircache.c
@@ -51,7 +51,7 @@
#define DIRCACHE_BUILD 1
#define DIRCACHE_STOP 2
-#if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8)
+#if (MEMORYSIZE > 8)
#define MAX_OPEN_DIRS 12
#else
#define MAX_OPEN_DIRS 8
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 2cdd674..a16a6cc 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -79,7 +79,7 @@
static unsigned int ata_thread_id = 0;
#endif
-#if defined(MAX_PHYS_SECTOR_SIZE) && MEM == 64
+#if defined(MAX_PHYS_SECTOR_SIZE) && MEMORYSIZE == 64
/* Hack - what's the deal with 5g? */
struct ata_lock
{
diff --git a/firmware/export/config/archosrecorder.h b/firmware/export/config/archosrecorder.h
index f64dd3c..be7c872 100644
--- a/firmware/export/config/archosrecorder.h
+++ b/firmware/export/config/archosrecorder.h
@@ -80,7 +80,7 @@
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
-#if MEM < 8
+#if MEMORYSIZE < 8
#define CURRENT_NORMAL 145 /* usual current in mA */
#else
#define CURRENT_NORMAL 145 *100 / 122 /* assuming 192 kbps, the running time is 22% longer with 8MB */
diff --git a/firmware/export/imx31l.h b/firmware/export/imx31l.h
index 7cb452d..ca4ab0c 100644
--- a/firmware/export/imx31l.h
+++ b/firmware/export/imx31l.h
@@ -28,7 +28,7 @@
#define REG32_PTR_T volatile unsigned long *
/* Place in the section with the framebuffer */
-#define TTB_BASE_ADDR (CSD0_BASE_ADDR + (MEM*0x100000) - TTB_SIZE)
+#define TTB_BASE_ADDR (CSD0_BASE_ADDR + (MEMORYSIZE*0x100000) - TTB_SIZE)
#define TTB_SIZE (0x4000)
#define IRAM_SIZE (0x4000)
#define TTB_BASE ((unsigned long *)TTB_BASE_ADDR)
diff --git a/firmware/font.c b/firmware/font.c
index cd74459..8538ef9 100644
--- a/firmware/font.c
+++ b/firmware/font.c
@@ -44,7 +44,7 @@
/* max static loadable font buffer size */
#ifndef MAX_FONT_SIZE
#if LCD_HEIGHT > 64
-#if MEM > 2
+#if MEMORYSIZE > 2
#define MAX_FONT_SIZE 60000
#else
#define MAX_FONT_SIZE 10000
diff --git a/firmware/target/arm/as3525/system-target.h b/firmware/target/arm/as3525/system-target.h
index 6db16af..7c9dccc 100644
--- a/firmware/target/arm/as3525/system-target.h
+++ b/firmware/target/arm/as3525/system-target.h
@@ -42,7 +42,7 @@
#define AS3525_UNCACHED_ADDR(a) ((typeof(a)) ((uintptr_t)(a) + 0x10000000))
#define AS3525_PHYSICAL_ADDR(a) \
- ((typeof(a)) ((((uintptr_t)(a)) & (MEM*0x100000)) \
+ ((typeof(a)) ((((uintptr_t)(a)) & (MEMORYSIZE*0x100000)) \
? (((uintptr_t)(a)) - IRAM_ORIG) \
: ((uintptr_t)(a))))
diff --git a/firmware/target/arm/crt0-pp.S b/firmware/target/arm/crt0-pp.S
index 585455f..12c8850 100644
--- a/firmware/target/arm/crt0-pp.S
+++ b/firmware/target/arm/crt0-pp.S
@@ -48,7 +48,7 @@
.equ CACHE_CTRL, 0xcf004024
.equ MMAP_LOG, 0xf000f000 /* MMAP0 */
.equ MMAP_PHYS, 0xf000f004
-#if MEM > 32
+#if MEMORYSIZE > 32
.equ MMAP_MASK, 0x00003c00
#else
.equ MMAP_MASK, 0x00003e00
@@ -69,7 +69,7 @@
.equ CACHE_CTRL, 0x6000c000
.equ MMAP_LOG, 0xf000f000 /* MMAP0 */
.equ MMAP_PHYS, 0xf000f004
-#if MEM > 32
+#if MEMORYSIZE > 32
.equ MMAP_MASK, 0x00003c00
#else
.equ MMAP_MASK, 0x00003e00
diff --git a/firmware/target/arm/crt0-pp502x-bl-usb.S b/firmware/target/arm/crt0-pp502x-bl-usb.S
index c360596..c8b7fb4 100644
--- a/firmware/target/arm/crt0-pp502x-bl-usb.S
+++ b/firmware/target/arm/crt0-pp502x-bl-usb.S
@@ -47,7 +47,7 @@
.equ CACHE_ENAB, 0x1
.equ CACHE_OP_COMMIT_DISCARD, 0x1
.equ CACHE_OP_COMMIT , 0x0
-#if MEM > 32
+#if MEMORYSIZE > 32
.equ MMAP_MASK, 0x00003c00
#else
.equ MMAP_MASK, 0x00003e00
diff --git a/firmware/target/arm/tcc77x/crt0.S b/firmware/target/arm/tcc77x/crt0.S
index 7c90021..251fd0c 100644
--- a/firmware/target/arm/tcc77x/crt0.S
+++ b/firmware/target/arm/tcc77x/crt0.S
@@ -109,7 +109,7 @@
mov r0, #0x20000000 /* Otherwise, load address is the start of DRAM */
#endif
mov r1, #0x20000000 /* Destination: 1MB from end of DRAM */
- add r1, r1, #((MEM - 1) * 0x100000)
+ add r1, r1, #((MEMORYSIZE - 1) * 0x100000)
ldr r2, =_dataend
1:
diff --git a/firmware/target/arm/thread-pp.c b/firmware/target/arm/thread-pp.c
index 0c07777..3eb7238 100644
--- a/firmware/target/arm/thread-pp.c
+++ b/firmware/target/arm/thread-pp.c
@@ -21,7 +21,7 @@
*
****************************************************************************/
-#if defined(MAX_PHYS_SECTOR_SIZE) && MEM == 64
+#if defined(MAX_PHYS_SECTOR_SIZE) && MEMORYSIZE == 64
/* Support a special workaround object for large-sector disks */
#define IF_NO_SKIP_YIELD(...) __VA_ARGS__
#endif
diff --git a/firmware/target/coldfire/crt0.S b/firmware/target/coldfire/crt0.S
index 7734970..e671771 100644
--- a/firmware/target/coldfire/crt0.S
+++ b/firmware/target/coldfire/crt0.S
@@ -138,7 +138,7 @@
/* Set up the DRAM controller. The refresh is based on the 11.2896MHz
clock (5.6448MHz bus frequency). We haven't yet started the PLL */
-#if MEM < 32
+#if MEMORYSIZE < 32
move.w #0x8004,%d0 /* DCR - Synchronous, 80 cycle refresh */
#else
move.w #0x8001,%d0 /* DCR - Synchronous, 32 cycle refresh */
@@ -153,7 +153,7 @@
In our case this means that we set the base address 16M ahead and
use a 64M mask.
*/
-#if MEM < 32
+#if MEMORYSIZE < 32
move.l #0x31002324,%d0 /* DACR0 - Base 0x31000000, Banks on 21 and up,
CAS latency 2, Page mode, No refresh yet */
move.l %d0,(0x108,%a0)
diff --git a/firmware/target/coldfire/iriver/system-iriver.c b/firmware/target/coldfire/iriver/system-iriver.c
index 1916eec..1ceb89b 100644
--- a/firmware/target/coldfire/iriver/system-iriver.c
+++ b/firmware/target/coldfire/iriver/system-iriver.c
@@ -49,7 +49,7 @@
* 124185600 11 0x018ae025 59 29 0x1180 0x1580 0x2180 3 1 1
*/
-#if MEM < 32
+#if MEMORYSIZE < 32
#define MAX_REFRESH_TIMER 59
#define NORMAL_REFRESH_TIMER 21
#define DEFAULT_REFRESH_TIMER 4
diff --git a/firmware/target/mips/mmu-mips.c b/firmware/target/mips/mmu-mips.c
index 5ea1015..31b0740 100644
--- a/firmware/target/mips/mmu-mips.c
+++ b/firmware/target/mips/mmu-mips.c
@@ -121,7 +121,7 @@
local_flush_tlb_all();
/*
map_address(0x80000000, 0x80000000, 0x4000, K_CacheAttrC);
- map_address(0x80004000, 0x80004000, MEM * 0x100000, K_CacheAttrC);
+ map_address(0x80004000, 0x80004000, MEMORYSIZE * 0x100000, K_CacheAttrC);
*/
}
diff --git a/tools/root.make b/tools/root.make
index 907d392..73ccf3a 100644
--- a/tools/root.make
+++ b/tools/root.make
@@ -9,7 +9,7 @@
include $(TOOLSDIR)/functions.make
-DEFINES = -DROCKBOX -DMEMORYSIZE=$(MEMORYSIZE) -DMEM=$(MEMORYSIZE) $(TARGET) \
+DEFINES = -DROCKBOX -DMEMORYSIZE=$(MEMORYSIZE) $(TARGET) \
-DTARGET_ID=$(TARGET_ID) -DTARGET_NAME=\"$(MODELNAME)\" $(BUILDDATE) \
$(EXTRA_DEFINES) # <-- -DSIMULATOR or not
INCLUDES = -I$(BUILDDIR) -I$(BUILDDIR)/lang $(TARGET_INC)