text
stringlengths 0
234
|
|---|
Ensure_Card_Informations (This);
|
-- Flush the data cache
|
Cortex_M.Cache.Clean_DCache
|
(Start => Data (Data'First)'Address,
|
Len => Data'Length);
|
This.SD_Int.Set_Transfer_State (This);
|
Ret := Write_Blocks_DMA
|
(This,
|
Block_Number * 512,
|
Data);
|
-- this always leaves the last 12 byte standing. Why?
|
-- also...NDTR is not what it should be.
|
if Ret /= OK then
|
This.TX_DMA_Int.Clear_Transfer_State;
|
This.SD_Int.Clear_Transfer_State;
|
This.TX_DMA_Int.Abort_Transfer (DMA_Err);
|
return False;
|
end if;
|
This.TX_DMA_Int.Wait_For_Completion (DMA_Err); -- this unblocks
|
This.SD_Int.Wait_Transfer (Ret); -- TX underrun!
|
-- this seems slow. Do we have to wait?
|
loop
|
-- FIXME: some people claim, that this goes wrong with multiblock, see
|
-- http://blog.frankvh.com/2011/09/04/stm32f2xx-sdio-sd-card-interface/
|
exit when not Get_Flag (This, TX_Active);
|
end loop;
|
if Last_Operation (This) =
|
Write_Multiple_Blocks_Operation
|
then
|
Ret := Stop_Transfer (This);
|
end if;
|
Clear_All_Status (This.TX_DMA_Int.Controller.all, This.TX_DMA_Int.Stream);
|
Disable (This.TX_DMA_Int.Controller.all, This.TX_DMA_Int.Stream);
|
declare
|
Data_Incomplete : constant Boolean :=
|
This.TX_DMA_Int.Buffer_Error and then
|
Items_Transferred (This.TX_DMA_Int.Controller.all, This.TX_DMA_Int.Stream)
|
/= Data'Length / 4;
|
begin
|
return Ret = OK
|
and then DMA_Err = DMA_No_Error
|
and then not Data_Incomplete;
|
Function Definition: function To_Word is new Ada.Unchecked_Conversion (System.Address, UInt32);
|
Function Body: function Offset (Buffer : DMA2D_Buffer;
|
X, Y : Integer) return UInt32 with Inline_Always;
|
DMA2D_Init_Transfer_Int : DMA2D_Sync_Procedure := null;
|
DMA2D_Wait_Transfer_Int : DMA2D_Sync_Procedure := null;
|
------------------
|
-- DMA2D_DeInit --
|
------------------
|
procedure DMA2D_DeInit is
|
begin
|
RCC_Periph.AHB1ENR.DMA2DEN := False;
|
DMA2D_Init_Transfer_Int := null;
|
DMA2D_Wait_Transfer_Int := null;
|
end DMA2D_DeInit;
|
----------------
|
-- DMA2D_Init --
|
----------------
|
procedure DMA2D_Init
|
(Init : DMA2D_Sync_Procedure;
|
Wait : DMA2D_Sync_Procedure)
|
is
|
begin
|
if DMA2D_Init_Transfer_Int = Init then
|
return;
|
end if;
|
DMA2D_DeInit;
|
DMA2D_Init_Transfer_Int := Init;
|
DMA2D_Wait_Transfer_Int := Wait;
|
RCC_Periph.AHB1ENR.DMA2DEN := True;
|
RCC_Periph.AHB1RSTR.DMA2DRST := True;
|
RCC_Periph.AHB1RSTR.DMA2DRST := False;
|
end DMA2D_Init;
|
------------
|
-- Offset --
|
------------
|
function Offset (Buffer : DMA2D_Buffer;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.