From e118266767c68b2841b6661e4821befbba360228 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 26 Sep 2013 13:02:22 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6319 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32F4xx/SDC/main.c | 55 ++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/testhal/STM32F4xx/SDC/main.c b/testhal/STM32F4xx/SDC/main.c index 3a049234a..264f31133 100644 --- a/testhal/STM32F4xx/SDC/main.c +++ b/testhal/STM32F4xx/SDC/main.c @@ -93,27 +93,72 @@ void cmd_sdc(BaseSequentialStream *chp, int argc, char *argv[]) { if ((strcmp(argv[0], "read") == 0) || (strcmp(argv[0], "all") == 0)) { - /* Single block read performance.*/ - chprintf(chp, "Single block read performance: "); + /* Single block read performance, aligned.*/ + chprintf(chp, "Single block aligned read performance: "); start = chVTGetSystemTime(); end = start + MS2ST(1000); n = 0; do { if (blkRead(&SDCD1, startblk, buf, 1)) { chprintf(chp, "failed\r\n"); - break; + goto exittest; } - chThdSleepMilliseconds(1); n++; } while (chVTIsSystemTimeWithin(start, end)); - chprintf(chp, "%D blocks per second\r\n", n); + chprintf(chp, "%D blocks/S, %D bytes/S\r\n", n, n * MMCSD_BLOCK_SIZE); + + /* Multiple sequential blocks read performance, aligned.*/ + chprintf(chp, "16 sequential blocks aligned read performance: "); + start = chVTGetSystemTime(); + end = start + MS2ST(1000); + n = 0; + do { + if (blkRead(&SDCD1, startblk, buf, SDC_BURST_SIZE)) { + chprintf(chp, "failed\r\n"); + goto exittest; + } + n += SDC_BURST_SIZE; + } while (chVTIsSystemTimeWithin(start, end)); + chprintf(chp, "%D blocks/S, %D bytes/S\r\n", n, n * MMCSD_BLOCK_SIZE); + +#if STM32_SDC_SDIO_UNALIGNED_SUPPORT + /* Single block read performance, unaligned.*/ + chprintf(chp, "Single block unaligned read performance: "); + start = chVTGetSystemTime(); + end = start + MS2ST(1000); + n = 0; + do { + if (blkRead(&SDCD1, startblk, buf + 1, 1)) { + chprintf(chp, "failed\r\n"); + goto exittest; + } + n++; + } while (chVTIsSystemTimeWithin(start, end)); + chprintf(chp, "%D blocks/S, %D bytes/S\r\n", n, n * MMCSD_BLOCK_SIZE); + + /* Multiple sequential blocks read performance, unaligned.*/ + chprintf(chp, "16 sequential blocks unaligned read performance: "); + start = chVTGetSystemTime(); + end = start + MS2ST(1000); + n = 0; + do { + if (blkRead(&SDCD1, startblk, buf + 1, SDC_BURST_SIZE)) { + chprintf(chp, "failed\r\n"); + goto exittest; + } + n += SDC_BURST_SIZE; + } while (chVTIsSystemTimeWithin(start, end)); + chprintf(chp, "%D blocks/S, %D bytes/S\r\n", n, n * MMCSD_BLOCK_SIZE); +#endif /* STM32_SDC_SDIO_UNALIGNED_SUPPORT */ } + if ((strcmp(argv[0], "write") == 0) || (strcmp(argv[0], "all") == 0)) { } /* Card disconnect and command end.*/ +exittest: sdcDisconnect(&SDCD1); }