Linux下mmc_test测试工具使用
很多朋友也都有疑问,如何在
Linux
下,测试emmc/sd
模块呢? 当然,mmc core
提供了mmc_test.c
来作为mmc driver
的测试文件。
如何使用mmc_test.c
测试文件测试mmc
驱动呢?
1、将mmc_test.c
编译到内核
默认情况下,mmc_test.c
是独立的文件,并没有编译到内核中,需要我们到menuconfig
中手动打开。
打开的配置有:CONFIG_MMC_TEST
、CONFIG_MMC_DEBUG
、CONFIG_DEBUG_FS
三个配置。
注意:CONFIG_MMC_TEST
,该选项可以选择M
和*
,分别对应为:编译成模块
或者直接编译到内核
这里我们选择*
2、mmc_test
绑定
默认情况下,我们一般都已经加载了mmc driver
,那么要想使用mmc_test
工具测试,需要将mmc
设备绑定到该mmc_test
驱动上。
2.1、查看驱动编号
通过下面命令,查询对应的mmc
编号,如下:mmc0:0001
,忽略掉
ls /sys/bus/mmc/drivers/mmcblk/mmc0:0001/
2.2、解绑mmc原驱动
代码语言:javascript复制echo mmc0:0001 > /sys/bus/mmc/drivers/mmcblk/unbind
2.3、绑定mmc_test
驱动
代码语言:javascript复制echo mmc0:0001 > /sys/bus/mmc/drivers/mmc_test/bind
2.4、debugfs
挂载
代码语言:javascript复制mount -t debugfs none /sys/kernel/debug
2.5、查看测试列表
代码语言:javascript复制cd /sys/kernel/debug/mmc0/mmc0:0001/
cat testlist
代码语言:javascript复制0: Run all tests
1: Basic write (no data verification)
2: Basic read (no data verification)
3: Basic write (with data verification)
4: Basic read (with data verification)
5: Multi-block write
6: Multi-block read
7: Power of two block writes
8: Power of two block reads
9: Weird sized block writes
10: Weird sized block reads
11: Badly aligned write
12: Badly aligned read
13: Badly aligned multi-block write
14: Badly aligned multi-block read
15: Correct xfer_size at write (start failure)
16: Correct xfer_size at read (start failure)
17: Correct xfer_size at write (midway failure)
18: Correct xfer_size at read (midway failure)
19: Highmem write
20: Highmem read
21: Multi-block highmem write
22: Multi-block highmem read
23: Best-case read performance
24: Best-case write performance
25: Best-case read performance into scattered pages
26: Best-case write performance from scattered pages
27: Single read performance by transfer size
28: Single write performance by transfer size
29: Single trim performance by transfer size
30: Consecutive read performance by transfer size
31: Consecutive write performance by transfer size
32: Consecutive trim performance by transfer size
33: Random read performance by transfer size
34: Random write performance by transfer size
35: Large sequential read into scattered pages
36: Large sequential write from scattered pages
37: Write performance with blocking req 4k to 4MB
38: Write performance with non-blocking req 4k to 4MB
39: Read performance with blocking req 4k to 4MB
40: Read performance with non-blocking req 4k to 4MB
41: Write performance blocking req 1 to 512 sg elems
42: Write performance non-blocking req 1 to 512 sg elems
43: Read performance blocking req 1 to 512 sg elems
44: Read performance non-blocking req 1 to 512 sg elems
45: Reset test
46: Commands during read - no Set Block Count (CMD23)
47: Commands during write - no Set Block Count (CMD23)
48: Commands during read - use Set Block Count (CMD23)
49: Commands during write - use Set Block Count (CMD23)
50: Commands during non-blocking read - use Set Block Count (CMD23)
51: Commands during non-blocking write - use Set Block Count (CMD23)
2.6、测试指定命令
代码语言:javascript复制echo number > test
number
:是上面的测试序号。
如:echo 1 > test
mmc0: Starting tests of card mmc0:0001...
mmc0: Test case 1. Basic write (no data verification)...
mmc0: Result: OK
嵌入式艺术