summaryrefslogtreecommitdiff
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
parente441c2696d43d80d8d43e217cbe451e971b67c52 (diff)
downloadrockbox-7a8c9daf7ef5a8b38d4c4f6625ff2d9d8eb1aa0a.tar.gz
rockbox-7a8c9daf7ef5a8b38d4c4f6625ff2d9d8eb1aa0a.zip
test_mem: increase dram buffer if possible, cap number of iterations
Change-Id: Ie034433184d0dfcd50e3b783b2b6d0b6a44d001f
-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 @@
25 25
26#if PLUGIN_BUFFER_SIZE <= 0x8000 26#if PLUGIN_BUFFER_SIZE <= 0x8000
27#define BUF_SIZE (1<<12) /* 16 KB = (1<<12)*sizeof(int) */ 27#define BUF_SIZE (1<<12) /* 16 KB = (1<<12)*sizeof(int) */
28#else 28#elif PLUGIN_BUFFER_SIZE <= 0x10000
29#define BUF_SIZE (1<<13) /* 32 KB = (1<<13)*sizeof(int) */ 29#define BUF_SIZE (1<<13) /* 32 KB = (1<<13)*sizeof(int) */
30#elif PLUGIN_BUFFER_SIZE <= 0x20000
31#define BUF_SIZE (1<<14) /* 64 KB = (1<<14)*sizeof(int) */
32#else
33#define BUF_SIZE (1<<15) /* 128 KB = (1<<15)*sizeof(int) */
30#endif 34#endif
31 35
32#define LOOP_REPEAT_DRAM 256 36#define LOOP_REPEAT_DRAM 256
37#define MAX_REPEAT_DRAM 512
33static int loop_repeat_dram = LOOP_REPEAT_DRAM; 38static int loop_repeat_dram = LOOP_REPEAT_DRAM;
34static volatile int buf_dram[BUF_SIZE] MEM_ALIGN_ATTR; 39static volatile int buf_dram[BUF_SIZE] MEM_ALIGN_ATTR;
35 40
36#if defined(PLUGIN_USE_IRAM) 41#if defined(PLUGIN_USE_IRAM)
37#define LOOP_REPEAT_IRAM 256 42#define LOOP_REPEAT_IRAM 256
43#define MAX_REPEAT_IRAM 512
38static int loop_repeat_iram = LOOP_REPEAT_DRAM; 44static int loop_repeat_iram = LOOP_REPEAT_DRAM;
39static volatile int buf_iram[BUF_SIZE] IBSS_ATTR MEM_ALIGN_ATTR; 45static volatile int buf_iram[BUF_SIZE] IBSS_ATTR MEM_ALIGN_ATTR;
40#endif 46#endif
@@ -221,7 +227,7 @@ enum plugin_status plugin_start(const void* parameter)
221 ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, WRITE); 227 ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, WRITE);
222 ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, MEMSET); 228 ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, MEMSET);
223 ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, MEMCPY); 229 ret |= test(buf_dram, BUF_SIZE, loop_repeat_dram, MEMCPY);
224 if (ret != 0) loop_repeat_dram *= 2; 230 if (ret != 0 && loop_repeat_dram < MAX_REPEAT_DRAM) loop_repeat_dram *= 2;
225#if defined(PLUGIN_USE_IRAM) 231#if defined(PLUGIN_USE_IRAM)
226 TEST_MEM_PRINTF("IRAM cnt: %d size: %d MB", loop_repeat_iram, 232 TEST_MEM_PRINTF("IRAM cnt: %d size: %d MB", loop_repeat_iram,
227 (loop_repeat_iram*BUF_SIZE*sizeof(buf_iram[0]))>>20); 233 (loop_repeat_iram*BUF_SIZE*sizeof(buf_iram[0]))>>20);
@@ -230,7 +236,7 @@ enum plugin_status plugin_start(const void* parameter)
230 ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, WRITE); 236 ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, WRITE);
231 ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, MEMSET); 237 ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, MEMSET);
232 ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, MEMCPY); 238 ret |= test(buf_iram, BUF_SIZE, loop_repeat_iram, MEMCPY);
233 if (ret != 0) loop_repeat_iram *= 2; 239 if (ret != 0 && loop_repeat_iram < MAX_REPEAT_IRAM) loop_repeat_iram *= 2;
234#endif 240#endif
235 241
236 rb->screens[0]->update(); 242 rb->screens[0]->update();