text
stringlengths
0
234
elsif Controller.Periph.STA.CCRCFAIL then
Controller.Periph.ICR.CCRCFAILC := True;
return CRC_Check_Fail;
end if;
Clear_Static_Flags (Controller);
return OK;
end Response_R2_Error;
-----------------------
-- Response_R3_Error --
-----------------------
function Response_R3_Error
(Controller : in out SDMMC_Controller) return SD_Error
is
begin
while not Controller.Periph.STA.CCRCFAIL
and then not Controller.Periph.STA.CMDREND
and then not Controller.Periph.STA.CTIMEOUT
loop
null;
end loop;
if Controller.Periph.STA.CTIMEOUT then
-- Card is not v2.0 compliant or card does not support the set
-- voltage range
Controller.Periph.ICR.CTIMEOUTC := True;
return Timeout_Error;
end if;
Clear_Static_Flags (Controller);
return OK;
end Response_R3_Error;
-----------------------
-- Response_R6_Error --
-----------------------
function Response_R6_Error
(Controller : in out SDMMC_Controller;
Command_Index : SD_Command;
RCA : out UInt32) return SD_Error
is
Response : UInt32;
begin
while not Controller.Periph.STA.CCRCFAIL
and then not Controller.Periph.STA.CMDREND
and then not Controller.Periph.STA.CTIMEOUT
loop
null;
end loop;
if Controller.Periph.STA.CTIMEOUT then
-- Card is not v2.0 compliant or card does not support the set
-- voltage range
Controller.Periph.ICR.CTIMEOUTC := True;
return Timeout_Error;
elsif Controller.Periph.STA.CCRCFAIL then
Controller.Periph.ICR.CCRCFAILC := True;
return CRC_Check_Fail;
end if;
if SD_Command (Controller.Periph.RESPCMD.RESPCMD) /=
Command_Index
then
return Illegal_Cmd;
end if;
Clear_Static_Flags (Controller);
Response := Controller.Periph.RESP1;
if (Response and SD_R6_Illegal_Cmd) = SD_R6_Illegal_Cmd then
return Illegal_Cmd;
elsif (Response and SD_R6_General_Unknown_Error) =
SD_R6_General_Unknown_Error
then
return General_Unknown_Error;
elsif (Response and SD_R6_Com_CRC_Failed) = SD_R6_Com_CRC_Failed then
return CRC_Check_Fail;
end if;
RCA := Response and 16#FFFF_0000#;
return OK;
end Response_R6_Error;
-----------------------
-- Response_R7_Error --