text
stringlengths
0
234
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;
X, Y : Integer) return UInt32
is
Off : constant UInt32 := UInt32 (X + Buffer.Width * Y);
begin
case Buffer.Color_Mode is
when ARGB8888 =>
return 4 * Off;
when RGB888 =>
return 3 * Off;
when ARGB1555 | ARGB4444 | RGB565 | AL88 =>
return 2 * Off;
when L8 | AL44 | A8 =>
return Off;
when L4 | A4 =>
return Off / 2;
end case;
end Offset;
----------------
-- DMA2D_Fill --
----------------
procedure DMA2D_Fill
(Buffer : DMA2D_Buffer;