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

This commit is contained in:
gdisirio 2013-09-23 19:03:43 +00:00
parent ca516fd8e6
commit 4c166f98c7
2 changed files with 32 additions and 12 deletions

View File

@ -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
*/

View File

@ -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)) {