git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6319 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2013-09-26 13:02:22 +00:00
parent 318c354f14
commit e118266767
1 changed files with 50 additions and 5 deletions

View File

@ -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);
}