MMC/SD驱动(1)

本文介绍了SD卡的命令设置过程及初始化流程,包括SD卡命令的结构与发送方式,并详细解析了设置块大小和复位操作的具体实现。此外,还提供了在Linux环境下处理器识别SDIO、SD和MMC设备的流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值