text
stringlengths 0
234
|
|---|
-----------------------
|
function Response_R7_Error
|
(Controller : in out SDMMC_Controller) return SD_Error
|
is
|
Start : constant Time := Clock;
|
Timeout : Boolean := False;
|
begin
|
while not Controller.Periph.STA.CCRCFAIL
|
and then not Controller.Periph.STA.CMDREND
|
and then not Controller.Periph.STA.CTIMEOUT
|
loop
|
if Clock - Start > Milliseconds (1000) then
|
Timeout := True;
|
exit;
|
end if;
|
end loop;
|
if Timeout or else 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;
|
elsif Controller.Periph.STA.CMDREND then
|
Controller.Periph.ICR.CMDRENDC := True;
|
return OK;
|
else
|
return Error;
|
end if;
|
end Response_R7_Error;
|
-------------------
|
-- Stop_Transfer --
|
-------------------
|
function Stop_Transfer
|
(This : in out SDMMC_Controller) return SD_Error
|
is
|
Ret : SD_Error;
|
begin
|
Send_Cmd (This, Cmd_Desc (Stop_Transmission), 0, Ret);
|
return Ret;
|
end Stop_Transfer;
|
-----------------------
|
-- Set_Clk_Src_Speed --
|
-----------------------
|
procedure Set_Clk_Src_Speed
|
(This : in out SDMMC_Controller;
|
CLK : UInt32)
|
is
|
begin
|
This.CLK_In := CLK;
|
end Set_Clk_Src_Speed;
|
----------------
|
-- Initialize --
|
----------------
|
function Initialize
|
(This : in out SDMMC_Controller) return SD_Error
|
is
|
Ret : SD_Error;
|
begin
|
SDMMC_Init.Card_Identification_Process (This, This.Info, Ret);
|
This.Card_Type := This.Info.Card_Type;
|
This.RCA := This.Info.RCA;
|
return Ret;
|
end Initialize;
|
----------
|
-- Read --
|
----------
|
overriding
|
function Read
|
(This : in out SDMMC_Controller;
|
Block_Number : UInt64;
|
Data : out HAL.Block_Drivers.Block) return Boolean
|
is
|
Ret : Boolean;
|
SD_Err : SD_Error;
|
DMA_Err : DMA_Error_Code;
|
begin
|
Ensure_Card_Informations (This);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.