Linux下,如何验证SD/EMMC卡?

2023-07-10 12:22:26来源:面包芯语


(资料图)

1、将mmc_test.c编译到内核

默认情况下,mmc_test.c是独立的文件,并没有编译到内核中,需要我们到menuconfig中手动打开。

打开的配置有:CONFIG_MMC_TESTCONFIG_MMC_DEBUGCONFIG_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原驱动

echommc0:0001>/sys/bus/mmc/drivers/mmcblk/unbind

2.3、绑定mmc_test驱动

echommc0:0001>/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:Runalltests1:Basicwrite(nodataverification)2:Basicread(nodataverification)3:Basicwrite(withdataverification)4:Basicread(withdataverification)5:Multi-blockwrite6:Multi-blockread7:Poweroftwoblockwrites8:Poweroftwoblockreads9:Weirdsizedblockwrites10:Weirdsizedblockreads11:Badlyalignedwrite12:Badlyalignedread13:Badlyalignedmulti-blockwrite14:Badlyalignedmulti-blockread15:Correctxfer_sizeatwrite(startfailure)16:Correctxfer_sizeatread(startfailure)17:Correctxfer_sizeatwrite(midwayfailure)18:Correctxfer_sizeatread(midwayfailure)19:Highmemwrite20:Highmemread21:Multi-blockhighmemwrite22:Multi-blockhighmemread23:Best-casereadperformance24:Best-casewriteperformance25:Best-casereadperformanceintoscatteredpages26:Best-casewriteperformancefromscatteredpages27:Singlereadperformancebytransfersize28:Singlewriteperformancebytransfersize29:Singletrimperformancebytransfersize30:Consecutivereadperformancebytransfersize31:Consecutivewriteperformancebytransfersize32:Consecutivetrimperformancebytransfersize33:Randomreadperformancebytransfersize34:Randomwriteperformancebytransfersize35:Largesequentialreadintoscatteredpages36:Largesequentialwritefromscatteredpages37:Writeperformancewithblockingreq4kto4MB38:Writeperformancewithnon-blockingreq4kto4MB39:Readperformancewithblockingreq4kto4MB40:Readperformancewithnon-blockingreq4kto4MB41:Writeperformanceblockingreq1to512sgelems42:Writeperformancenon-blockingreq1to512sgelems43:Readperformanceblockingreq1to512sgelems44:Readperformancenon-blockingreq1to512sgelems45:Resettest46:Commandsduringread-noSetBlockCount(CMD23)47:Commandsduringwrite-noSetBlockCount(CMD23)48:Commandsduringread-useSetBlockCount(CMD23)49:Commandsduringwrite-useSetBlockCount(CMD23)50:Commandsduringnon-blockingread-useSetBlockCount(CMD23)51:Commandsduringnon-blockingwrite-useSetBlockCount(CMD23)

2.6、测试指定命令

echonumber>test

number:是上面的测试序号。

如:echo 1 > test

mmc0:Startingtestsofcardmmc0:0001...mmc0:Testcase1.Basicwrite(nodataverification)...mmc0:Result:OK

来源:嵌入式艺术

版权归原作者所有,如有侵权,请联系删除。

标签:

  • 今日焦点
  • 行业动态