作者:下家山
CMD5命令響應—與—S3C2410寄存器的對應關係
協議規定CMD5命令響應爲R4,其響應格式爲:
R4 響應格式
S |
D |
Reserved |
C |
Number Of I/O functions |
Memory present |
Stuff Bits |
I/O OCR |
Reserved |
E |
1 1 6 1 3 1 3 24 7 1
S(tart bit): Start bit. Always 0
D(irection): Direction. Always 0 indicates transfer from card to host
Reserved: Bits Reserved for future use. These bits shall be set to 1.
C(omplete): Set to 1 if card is ready to operate after initialization.
I/ OCR : See Table 1
Memory Present: Set to 1 if the card also contains SD memory . Set to 0 if the card is I/O only.Number of I/O Functions:Indicates the total number of I/O functions supported by this card. The range is 0-7. Note that the common area present on all I/O cards at Function 0 is not included in this count. The I/O functions shall be implemented sequentially beginning at function 1.
Stuff Bits : Not used ,shall be set to 0.
個人觀點: R4的長度爲48bit,因爲很多位是固定的,因此,S3C2410把它做到了一個響應
寄存器中,即rSDIRSP0(響應寄存器0)。
發送CMD5命令後,通過Polling或interrupt方式讀取rSDIRSP0中的值。我發
送CMD5(0x00000345)後得到的響應寄存器0的值爲90FF8000。下面對90FF8000進行解碼分析。
1 001 0 000 1111 1111 1000 0000 0000 0000
C |
Number Of I/O functions |
Memory Present |
Stuff Bits |
I/O OCR |
1 3 1 3 24
C(omplete) == 1 表示初始化完成;
Number Of I/O functions == 001 表示此SDIO card所支持的功能號爲0~1;
Memory Present == 0 表示 此卡僅爲I/O卡;
Stuff Bits == 000 (本應該爲000)
I/O OCR == FF8000對應到Table1 ,即此卡支持的電壓範圍爲【2.7v~3.6v】
6.2 CMD52及響應剖析
rSDICARG[7:0]=====================CMD52[15:8](Write Data or Stuff Bits)
rSDICARG[8]=====================CMD52[16] (Stuff)
rSDICARG[25:9]=====================CMD52[33:17] (Register Address)
rSDICARG[26]=====================CMD52[34] (Stuff)
rSDICARG[27]=====================CMD52[35] (RAW flag)
rSDICARG[30:28]=====================CMD52[38:36] (FunctionNumber)
rSDICARG[31]=====================CMD52[39] (R/W flag)
rSDICCON[7:0]======================CMD5[47:40](S/D/command index)
6.2.1 在S3c2410中,如何解讀發送CMD52後的結果
在s3c2410中,解讀任何一個命令發送後的狀態是通過讀取rSDICSTA(命令狀態寄存器), rSDIRSP0-3(命令響應寄存器),然後分析的。以我讀取conexant wifi SDIO card 出廠ID號爲例,發送CMD52後,得到的這兩個寄存器的值爲:
rSDICSTA == 0x00000A34
rSDIRSP0 == 0x00001013
解碼0x00000A34
0………..0 0 1 0 1 0 0011 0100
undefine |
Response CRC Fail |
Command Sent |
Command Time Out |
Response Receive End |
CMD line progress |
RspIndex |
18 1 1 1 1 1 8
Command Sent == 1 表示命令已發送;
ResponseReceiveEnd == 1 表示命令響應結束;
RspIndex == 0x34 表示命令號爲52(0x34)
這表明命令狀態OK。
解碼0x00001013
0……0 0 0 01 0 0 0 0 0001 0011
undefine |
COM_CRC_ERROR |
illegal_COMMAND |
IO_CURRENT_STATE |
ERROR |
RFU |
FUNCTION_NUMBER |
OUT_OF_RANGE |
Read or Write Data |
16 1 1 2 1 1 1 1 8
IO_CURRENT_STATE == 01 表示 Execution CMD52 in CMD State;
Read or Write Data == 0x13 表示讀出來的出廠ID號爲0x13;
個人觀點:CMD52 Response (R5)中的stuff域,E域因其值固定而在S3c2410中沒有表現出來,而CRC7在rSDICSTA中有專門的crc位指示。而,S域,D域,CommandIndex域也在rSDICSTA中的【7:0】顯示出來了,所以在rSDIRSP0中沒有必要再顯示這些值。