mmc_test.c研究mmc模块使用方法
1. make menuconfig --> Kernel hacking --> 选中Debug Filesystem (CONFIG_DEBUG_FS)选项。
CONFIG_MMC_DEBUG=y
CONFIG_MMC_TEST=y
vi drivers/mmc/card/mmc_test.c
fs_initcall(mmc_test_init);
//module_init(mmc_test_init);
2.mount -t debugfs none /sys/kernel/debug
3./sys/kernel/debug/mmc0/mmc0:aaaa# ls
state status test testlist
4.cat testlist
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: eMMC hardware reset
5.echo 2 > test
[ 1599.710000] mmc0: Starting tests of card mmc0:aaaa...
[ 1599.720000] mmc0: Test case 2. Basic read (no data verification)...
[ 1599.730000] mmc0: Result: OK
[ 1599.740000] mmc0: Tests completed.