text
stringlengths 0
234
|
|---|
Info.Card_Type := High_Capacity_SD_Card;
|
end if;
|
if (Rsp and SD_OCR_Power_Up) = 0 then
|
Status := Error;
|
else
|
Status := OK;
|
exit;
|
end if;
|
end loop;
|
if Status = Command_Timeout_Error
|
and then Info.Card_Type = Multimedia_Card
|
then
|
for I in 1 .. 5 loop
|
This.Delay_Milliseconds (200);
|
-- CMD1: SEND_OP_COND query voltage
|
Send_Cmd (This, Cmd_Desc (Send_Op_Cond), 16#00ff_8000#, Status);
|
if Status /= OK then
|
return;
|
end if;
|
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
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.