summaryrefslogtreecommitdiffstats
path: root/apps/plugins/test_mem.c
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2017-10-12 23:39:07 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2017-10-22 15:36:13 +0200
commit7a8c9daf7ef5a8b38d4c4f6625ff2d9d8eb1aa0a (patch)
tree21f423a61469be635193d1a98de30ded8c150613 /apps/plugins/test_mem.c
parente441c2696d43d80d8d43e217cbe451e971b67c52 (diff)
downloadrockbox-7a8c9daf7ef5a8b38d4c4f6625ff2d9d8eb1aa0a.tar.gz
rockbox-7a8c9daf7ef5a8b38d4c4f6625ff2d9d8eb1aa0a.zip
test_mem: increase dram buffer if possible, cap number of iterations
Change-Id: Ie034433184d0dfcd50e3b783b2b6d0b6a44d001f
Diffstat (limited to 'apps/plugins/test_mem.c')
-rw-r--r--apps/plugins/test_mem.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/plugins/test_mem.c b/apps/plugins/test_mem.c
index 7ff5735647..0b623fd5c8 100644
--- a/apps/plugins/test_mem.c
+++ b/apps/plugins/test_mem.c
@@ -25,16 +25,22 @@
#if PLUGIN_BUFFER_SIZE <= 0x8000
#define BUF_SIZE (1<<12) /* 16 KB = (1<<12)*sizeof(int) */
-#else
+#elif PLUGIN_BUFFER_SIZE <= 0x10000
#define BUF_SIZE (1<<13) /* 32 KB = (1<<13)*sizeof(int) */
+#elif PLUGIN_BUFFER_SIZE <= 0x20000
+#define BUF_SIZE (1<<14) /* 64 KB = (1<<14)*sizeof(int) */
+#else
+#define BUF_SIZE (1<<15) /* 128 KB = (1<<15)*sizeof(int) */
#endif
#define LOOP_REPEAT_DRAM 256
+#define MAX_REPEAT_DRAM 512
static int loop_repeat_dram = LOOP_REPEAT_DRAM;
static volatile int buf_dram[BUF_SIZE] MEM_ALIGN_ATTR;
#if defined(PLUGIN_USE_IRAM)
#define LOOP_REPEAT_IRAM 256
+#define MAX_REPEAT_IRAM 512
static int loop_repeat_iram = LOOP_REPEAT_DRAM;
static volatile int buf_iram[BUF_SIZE] IBSS_ATTR MEM_ALIGN_ATTR;
#endif
@@ -221,7 +227,7 @@ enum plugin_status plugin_start(const void* parameter)
ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, WRITE);
ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, MEMSET);
ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, MEMCPY);
- if (ret != 0) loop_repeat_dram *= 2;
+ if (ret != 0 && loop_repeat_dram < MAX_REPEAT_DRAM) loop_repeat_dram *= 2;
#if defined(PLUGIN_USE_IRAM)
TEST_MEM_PRINTF("IRAM cnt: %d size: %d MB", loop_repeat_iram,
(loop_repeat_iram*BUF_SIZE*sizeof(buf_iram[0]))>>20);
@@ -230,7 +236,7 @@ enum plugin_status plugin_start(const void* parameter)
ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, WRITE);
ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, MEMSET);
ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, MEMCPY);
- if (ret != 0) loop_repeat_iram *= 2;
+ if (ret != 0 && loop_repeat_iram < MAX_REPEAT_IRAM) loop_repeat_iram *= 2;
#endif
rb->screens[0]->update();