text stringlengths 0 234 |
|---|
Read_Rsp48 (This, Rsp); |
if (Rsp and SD_OCR_Power_Up) = 0 then |
Status := Error; |
else |
if (Rsp and 16#00ff_8000#) /= 16#00ff_8000# then |
Status := Error; |
return; |
end if; |
Status := OK; |
exit; |
end if; |
end loop; |
end if; |
if Status /= OK then |
return; |
end if; |
-- TODO: Switch voltage |
-- CMD2: ALL_SEND_CID (136 bits) |
Send_Cmd (This, All_Send_CID, 0, Status); |
if Status /= OK then |
return; |
end if; |
Read_Rsp136 (This, W0, W1, W2, W3); |
Convert_Card_Identification_Data_Register (W0, W1, W2, W3, Info.SD_CID); |
-- CMD3: SEND_RELATIVE_ADDR |
case Info.Card_Type is |
when Multimedia_Card => |
Rca := 16#01_0000#; |
when others => |
Rca := 0; |
end case; |
Send_Cmd (This, Send_Relative_Addr, Rca, Status); |
if Status /= OK then |
return; |
end if; |
case Info.Card_Type is |
when Multimedia_Card => |
null; |
when others => |
Read_Rsp48 (This, Rsp); |
Rca := Rsp and 16#ffff_0000#; |
if (Rsp and 16#e100#) /= 16#0100# then |
return; |
end if; |
end case; |
Info.RCA := UInt16 (Shift_Right (Rca, 16)); |
-- Switch to 25Mhz |
case Info.Card_Type is |
when Multimedia_Card => |
Set_Clock (This, Get_Transfer_Rate (Info.SD_CSD)); |
when STD_Capacity_SD_Card_V1_1 |
| STD_Capacity_SD_Card_v2_0 |
| High_Capacity_SD_Card => |
Set_Clock (This, 25_000_000); |
when others => |
-- Not yet handled |
raise Program_Error; |
end case; |
-- CMD10: SEND_CID (136 bits) |
Send_Cmd (This, Send_CID, Rca, Status); |
if Status /= OK then |
return; |
end if; |
-- CMD9: SEND_CSD |
Send_Cmd (This, Send_CSD, Rca, Status); |
if Status /= OK then |
return; |
end if; |
Read_Rsp136 (This, W0, W1, W2, W3); |
Convert_Card_Specific_Data_Register |
(W0, W1, W2, W3, Info.Card_Type, Info.SD_CSD); |
Info.Card_Capacity := |
Compute_Card_Capacity (Info.SD_CSD, Info.Card_Type); |
Info.Card_Block_Size := |
Compute_Card_Block_Size (Info.SD_CSD, Info.Card_Type); |
-- CMD7: SELECT |
Send_Cmd (This, Select_Card, Rca, Status); |
if Status /= OK then |
return; |
end if; |
-- CMD13: STATUS |
Send_Cmd (This, Send_Status, Rca, Status); |
if Status /= OK then |
return; |
end if; |
-- Bus size |
case Info.Card_Type is |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.