[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。

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