[SDIO]Read Wait 读等待机制

sdio 协议的read wait机制相当于是一个流控功能。在执行多块读后,sd卡会在每一个SDCLK持续发送数据。如果host内部的DMA或CPU已经来不及搬运这些数据了,导致controller 的buffer overflow,数据将会出现丢失。

解决办法1: host controller 在buffer 满时关闭SDCLK,sd卡没有clk驱动,会暂停数据发送。但是SDCLK关闭时无法发送其他CMD。

解决办法2:通过一个信号告诉SD卡,我已经来不及处理这些数据了,请暂停,这个就是read wait机制。

《SD Card Specification》中关于Read Wait 的描述:

6.5 Read Wait (Optional)
Host devices built to the SD Physical specification version 1.01 must control the SDCLK to stop the read data
block output from a card executing a multiple read command whenever the host cannot accept more data.
During the time that the host has stopped the SDCLK, a CMD52 cannot be issued. This limitation causes a
problem in that a host device built to the SD Physical specification version 1.01 cannot perform the I/O
command during a multiple read cycle.
In order to eliminate this limitation, the SDIO specification adds the read wait control to enable the host to issue
CMD52 during a multiple read cycle. Read Wait uses the DAT[2] line to allow the host to signal the card to
temporarily halt the sending of read data by a card. This feature is optional for an SDIO or combo card.
However, if an SDIO or combo supports Read Wait, all functions and any memory must support read wait.
Note that Read Wait is defined only for the SD 1 and 4-bit modes. It does not apply to SPI transfers.
To determine if a card supports the Read Wait protocol, the host must test SRW capability bit in the Card
Capability byte of the CCCR. If a card does not support the Read Wait protocol, the only means a host has to
stall (not abort) data in a read multiple command is to control the SDCLK.

翻译:

根据SD物理规范1.01版,主机设备必须控制SDCLK,以便在主机无法接受更多数据时,使执行多块读命令的卡暂停发送数据块的输出。

在主机停止SDCLK期间,无法发出CMD52。这一限制导致了一个问题,在一个多块读周期中,按照SD物理规范版本1.01构建的主机设备无法执行I/O命令。

为了消除这种限制,SDIO规范添加了读等待特性,以使主机能够在一个多块读周期中发出CMD52。Read Wait使用DAT[2]行来允许主机向卡发出信号,让卡暂时停止发送读数据。这个功能对于SDIO或combo卡是可选的。

但是,如果SDIO或combo支持读等待,那么所有函数和内存都必须支持读等待。

注意,Read Wait只在sd1和4位模式下定义。它不适用于SPI传输。

要确定卡是否支持读等待协议,主机必须在CCCR的卡功能字节中测试SRW功能位。如果卡不支持读等待协议,那么在Read multiple命令中,主机必须停止(而不是终止)数据的唯一方法就是控制SDCLK。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章