1.SD卡命令
static int mmc_test_set_blksize(struct mmc_test_card *test, unsigned size)
{
struct mmc_command cmd;
int ret;
cmd.opcode = MMC_SET_BLOCKLEN; //命令
cmd.arg = size; //参数
cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; //命令类型
ret = mmc_wait_for_cmd(test->card->host, &cmd, 0);
if (ret)
return ret;
return 0;
}
命令类型(BC,BCR,AC,ADTC):
SPI Mode & SD Mode:
The SD Card wakes up in the SD Bus mode. It will enter SPI mode if the CS signal is asserted (negative) during the reception of the reset command (CMD0).
The default command structure/protocol for SPI mode is that CRC checking is disabled. Since the card powers up in SD Bus mode, CMD0 must be followed by a valid CRC byte (even though the command is sent using the SPI structure). Once in SPI mode, CRCs are disabled by default.
2.SD参考程序
3.处理器关于如何识别SDIO、SD、MMC的流程图(LINUX)
nanjing