diff options
-rw-r--r-- | os/hal/include/hal_ioblock.h | 24 | ||||
-rw-r--r-- | testhal/STM32F4xx/SDC/main.c | 20 |
2 files changed, 32 insertions, 12 deletions
diff --git a/os/hal/include/hal_ioblock.h b/os/hal/include/hal_ioblock.h index e0ef360f3..f759a5dff 100644 --- a/os/hal/include/hal_ioblock.h +++ b/os/hal/include/hal_ioblock.h @@ -180,8 +180,8 @@ typedef struct { * @param[in] ip pointer to a @p BaseBlockDevice or derived class
*
* @return The operation status.
- * @retval CH_SUCCESS operation succeeded.
- * @retval CH_FAILED operation failed.
+ * @retval HAL_SUCCESS operation succeeded.
+ * @retval HAL_FAILED operation failed.
*
* @api
*/
@@ -194,8 +194,8 @@ typedef struct { * @param[in] ip pointer to a @p BaseBlockDevice or derived class
*
* @return The operation status.
- * @retval CH_SUCCESS operation succeeded.
- * @retval CH_FAILED operation failed.
+ * @retval HAL_SUCCESS operation succeeded.
+ * @retval HAL_FAILED operation failed.
*
* @api
*/
@@ -210,8 +210,8 @@ typedef struct { * @param[in] n number of blocks to read
*
* @return The operation status.
- * @retval CH_SUCCESS operation succeeded.
- * @retval CH_FAILED operation failed.
+ * @retval HAL_SUCCESS operation succeeded.
+ * @retval HAL_FAILED operation failed.
*
* @api
*/
@@ -227,8 +227,8 @@ typedef struct { * @param[in] n number of blocks to write
*
* @return The operation status.
- * @retval CH_SUCCESS operation succeeded.
- * @retval CH_FAILED operation failed.
+ * @retval HAL_SUCCESS operation succeeded.
+ * @retval HAL_FAILED operation failed.
*
* @api
*/
@@ -241,8 +241,8 @@ typedef struct { * @param[in] ip pointer to a @p BaseBlockDevice or derived class
*
* @return The operation status.
- * @retval CH_SUCCESS operation succeeded.
- * @retval CH_FAILED operation failed.
+ * @retval HAL_SUCCESS operation succeeded.
+ * @retval HAL_FAILED operation failed.
*
* @api
*/
@@ -255,8 +255,8 @@ typedef struct { * @param[out] bdip pointer to a @p BlockDeviceInfo structure
*
* @return The operation status.
- * @retval CH_SUCCESS operation succeeded.
- * @retval CH_FAILED operation failed.
+ * @retval HAL_SUCCESS operation succeeded.
+ * @retval HAL_FAILED operation failed.
*
* @api
*/
diff --git a/testhal/STM32F4xx/SDC/main.c b/testhal/STM32F4xx/SDC/main.c index 3b804198b..f547f65e8 100644 --- a/testhal/STM32F4xx/SDC/main.c +++ b/testhal/STM32F4xx/SDC/main.c @@ -59,6 +59,9 @@ static uint8_t buf[MMCSD_BLOCK_SIZE * SDC_BURST_SIZE + 1]; void cmd_sdc(BaseSequentialStream *chp, int argc, char *argv[]) {
static const char *mode[] = {"SDV11", "SDV20", "MMC", NULL};
+ systime_t start, end;
+ uint32_t n, startblk;
+
if (argc != 1) {
chprintf(chp, "Usage: sdiotest read|write|all\r\n");
return;
@@ -84,9 +87,26 @@ void cmd_sdc(BaseSequentialStream *chp, int argc, char *argv[]) { chprintf(chp, "Mode : %s\r\n", mode[SDCD1.cardmode]);
chprintf(chp, "Capacity : %DMB\r\n", SDCD1.capacity / 2048);
+ /* The test is performed in the middle of the flash area.*/
+ startblk = (SDCD1.capacity / MMCSD_BLOCK_SIZE) / 2;
+
if ((strcmp(argv[0], "read") == 0) ||
(strcmp(argv[0], "all") == 0)) {
+ /* Single block read performance.*/
+ chprintf(chp, "Single block read performance: ");
+ start = chVTGetSystemTime();
+ end = start + MS2ST(1000);
+ n = 0;
+ do {
+ if (blkRead(&SDCD1, startblk, buf, MMCSD_BLOCK_SIZE)) {
+ chprintf(chp, "failed\r\n");
+ break;
+ }
+ chThdSleepMilliseconds(1);
+ n++;
+ } while (chVTIsSystemTimeWithin(start, end));
+ chprintf(chp, "%D blocks per second\r\n", n);
}
if ((strcmp(argv[0], "write") == 0) ||
(strcmp(argv[0], "all") == 0)) {
|