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:
parent
ca516fd8e6
commit
4c166f98c7
|
@ -180,8 +180,8 @@ typedef struct {
|
||||||
* @param[in] ip pointer to a @p BaseBlockDevice or derived class
|
* @param[in] ip pointer to a @p BaseBlockDevice or derived class
|
||||||
*
|
*
|
||||||
* @return The operation status.
|
* @return The operation status.
|
||||||
* @retval CH_SUCCESS operation succeeded.
|
* @retval HAL_SUCCESS operation succeeded.
|
||||||
* @retval CH_FAILED operation failed.
|
* @retval HAL_FAILED operation failed.
|
||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
|
@ -194,8 +194,8 @@ typedef struct {
|
||||||
* @param[in] ip pointer to a @p BaseBlockDevice or derived class
|
* @param[in] ip pointer to a @p BaseBlockDevice or derived class
|
||||||
*
|
*
|
||||||
* @return The operation status.
|
* @return The operation status.
|
||||||
* @retval CH_SUCCESS operation succeeded.
|
* @retval HAL_SUCCESS operation succeeded.
|
||||||
* @retval CH_FAILED operation failed.
|
* @retval HAL_FAILED operation failed.
|
||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
|
@ -210,8 +210,8 @@ typedef struct {
|
||||||
* @param[in] n number of blocks to read
|
* @param[in] n number of blocks to read
|
||||||
*
|
*
|
||||||
* @return The operation status.
|
* @return The operation status.
|
||||||
* @retval CH_SUCCESS operation succeeded.
|
* @retval HAL_SUCCESS operation succeeded.
|
||||||
* @retval CH_FAILED operation failed.
|
* @retval HAL_FAILED operation failed.
|
||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
|
@ -227,8 +227,8 @@ typedef struct {
|
||||||
* @param[in] n number of blocks to write
|
* @param[in] n number of blocks to write
|
||||||
*
|
*
|
||||||
* @return The operation status.
|
* @return The operation status.
|
||||||
* @retval CH_SUCCESS operation succeeded.
|
* @retval HAL_SUCCESS operation succeeded.
|
||||||
* @retval CH_FAILED operation failed.
|
* @retval HAL_FAILED operation failed.
|
||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
|
@ -241,8 +241,8 @@ typedef struct {
|
||||||
* @param[in] ip pointer to a @p BaseBlockDevice or derived class
|
* @param[in] ip pointer to a @p BaseBlockDevice or derived class
|
||||||
*
|
*
|
||||||
* @return The operation status.
|
* @return The operation status.
|
||||||
* @retval CH_SUCCESS operation succeeded.
|
* @retval HAL_SUCCESS operation succeeded.
|
||||||
* @retval CH_FAILED operation failed.
|
* @retval HAL_FAILED operation failed.
|
||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
|
@ -255,8 +255,8 @@ typedef struct {
|
||||||
* @param[out] bdip pointer to a @p BlockDeviceInfo structure
|
* @param[out] bdip pointer to a @p BlockDeviceInfo structure
|
||||||
*
|
*
|
||||||
* @return The operation status.
|
* @return The operation status.
|
||||||
* @retval CH_SUCCESS operation succeeded.
|
* @retval HAL_SUCCESS operation succeeded.
|
||||||
* @retval CH_FAILED operation failed.
|
* @retval HAL_FAILED operation failed.
|
||||||
*
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -59,6 +59,9 @@ static uint8_t buf[MMCSD_BLOCK_SIZE * SDC_BURST_SIZE + 1];
|
||||||
|
|
||||||
void cmd_sdc(BaseSequentialStream *chp, int argc, char *argv[]) {
|
void cmd_sdc(BaseSequentialStream *chp, int argc, char *argv[]) {
|
||||||
static const char *mode[] = {"SDV11", "SDV20", "MMC", NULL};
|
static const char *mode[] = {"SDV11", "SDV20", "MMC", NULL};
|
||||||
|
systime_t start, end;
|
||||||
|
uint32_t n, startblk;
|
||||||
|
|
||||||
if (argc != 1) {
|
if (argc != 1) {
|
||||||
chprintf(chp, "Usage: sdiotest read|write|all\r\n");
|
chprintf(chp, "Usage: sdiotest read|write|all\r\n");
|
||||||
return;
|
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, "Mode : %s\r\n", mode[SDCD1.cardmode]);
|
||||||
chprintf(chp, "Capacity : %DMB\r\n", SDCD1.capacity / 2048);
|
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) ||
|
if ((strcmp(argv[0], "read") == 0) ||
|
||||||
(strcmp(argv[0], "all") == 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) ||
|
if ((strcmp(argv[0], "write") == 0) ||
|
||||||
(strcmp(argv[0], "all") == 0)) {
|
(strcmp(argv[0], "all") == 0)) {
|
||||||
|
|
Loading…
Reference in New Issue