aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testhal/STM32F4xx/SDC/main.c55
1 files 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);
}