热度 3
2023-7-6 22:08
971 次阅读|
0 个评论
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原驱动 echo /sys/bus/mmc/drivers/mmcblk/unbind 2.3、绑定mmc_test驱动 echo /sys/bus/mmc/drivers/mmc_test/ bind 2.4、debugfs挂载 mount-tdebugfsnone/sys/kernel/debug 2.5、查看测试列表 cd /sys/kernel/debug/mmc0/mmc0\:0001/ cattestlist 0:Runalltests 1:Basicwrite(nodataverification) 2:Basic read (nodataverification) 3:Basicwrite(withdataverification) 4:Basic read (withdataverification) 5:Multi-blockwrite 6:Multi-block read 7:Poweroftwoblockwrites 8:Poweroftwoblockreads 9:Weirdsizedblockwrites 10:Weirdsizedblockreads 11:Badlyalignedwrite 12:Badlyaligned read 13:Badlyalignedmulti-blockwrite 14:Badlyalignedmulti-block read 15:Correctxfer_sizeatwrite(startfailure) 16:Correctxfer_sizeat read (startfailure) 17:Correctxfer_sizeatwrite(midwayfailure) 18:Correctxfer_sizeat read (midwayfailure) 19:Highmemwrite 20:Highmem read 21:Multi-blockhighmemwrite 22:Multi-blockhighmem read 23:Best-case read performance 24:Best-casewriteperformance 25:Best-case read performanceintoscatteredpages 26:Best-casewriteperformancefromscatteredpages 27:Single read performancebytransfersize 28:Singlewriteperformancebytransfersize 29:Singletrimperformancebytransfersize 30:Consecutive read performancebytransfersize 31:Consecutivewriteperformancebytransfersize 32:Consecutivetrimperformancebytransfersize 33:Random read performancebytransfersize 34:Randomwriteperformancebytransfersize 35:Largesequential read intoscatteredpages 36:Largesequentialwritefromscatteredpages 37:Writeperformancewithblockingreq4kto4MB 38:Writeperformancewithnon-blockingreq4kto4MB 39:Readperformancewithblockingreq4kto4MB 40:Readperformancewithnon-blockingreq4kto4MB 41:Writeperformanceblockingreq1to512sgelems 42:Writeperformancenon-blockingreq1to512sgelems 43:Readperformanceblockingreq1to512sgelems 44:Readperformancenon-blockingreq1to512sgelems 45:Reset test 46:Commandsduring read -noSetBlockCount(CMD23) 47:Commandsduringwrite-noSetBlockCount(CMD23) 48:Commandsduring read -useSetBlockCount(CMD23) 49:Commandsduringwrite-useSetBlockCount(CMD23) 50:Commandsduringnon-blocking read -useSetBlockCount(CMD23) 51:Commandsduringnon-blockingwrite-useSetBlockCount(CMD23) 2.6、测试指定命令 echo test number:是上面的测试序号。 test mmc0:Startingtestsofcardmmc0:0001... mmc0:Test case 1.Basicwrite(nodataverification)... mmc0:Result:OK 这个工具可以尽可能的帮助我们测试SD/EMMC卡,使用起来吧! 学习资料奉上: 传送门