text stringlengths 0 234 |
|---|
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; |
Color : UInt32; |
Synchronous : Boolean := False) |
is |
function Conv is new Ada.Unchecked_Conversion (UInt32, OCOLR_Register); |
begin |
DMA2D_Wait_Transfer_Int.all; |
DMA2D_Periph.CR.MODE := DMA2D_MODE'Enum_Rep (R2M); |
DMA2D_Periph.OPFCCR.CM := As_UInt3 (Buffer.Color_Mode); |
DMA2D_Periph.OCOLR := Conv (Color); |
DMA2D_Periph.OMAR := To_Word (Buffer.Addr); |
DMA2D_Periph.OOR := (LO => 0, others => <>); |
DMA2D_Periph.NLR := (NL => UInt16 (Buffer.Height), |
PL => UInt14 (Buffer.Width), |
others => <>); |
DMA2D_Init_Transfer_Int.all; |
if Synchronous then |
DMA2D_Wait_Transfer_Int.all; |
end if; |
end DMA2D_Fill; |
--------------------- |
-- DMA2D_Fill_Rect -- |
--------------------- |
procedure DMA2D_Fill_Rect |
(Buffer : DMA2D_Buffer; |
Color : UInt32; |
X : Integer; |
Y : Integer; |
Width : Integer; |
Height : Integer; |
Synchronous : Boolean := False) |
is |
function Conv is new Ada.Unchecked_Conversion (UInt32, OCOLR_Register); |
Off : constant UInt32 := Offset (Buffer, X, Y); |
begin |
DMA2D_Wait_Transfer_Int.all; |
DMA2D_Periph.CR.MODE := DMA2D_MODE'Enum_Rep (R2M); |
DMA2D_Periph.OPFCCR := |
(CM => DMA2D_Color_Mode'Enum_Rep (Buffer.Color_Mode), |
others => <>); |
DMA2D_Periph.OCOLR := Conv (Color); |
DMA2D_Periph.OMAR := To_Word (Buffer.Addr) + Off; |
DMA2D_Periph.OOR.LO := UInt14 (Buffer.Width - Width); |
DMA2D_Periph.NLR := |
(NL => UInt16 (Height), PL => UInt14 (Width), others => <>); |
DMA2D_Init_Transfer_Int.all; |
if Synchronous then |
DMA2D_Wait_Transfer_Int.all; |
end if; |
end DMA2D_Fill_Rect; |
--------------------- |
-- DMA2D_Draw_Rect -- |
--------------------- |
procedure DMA2D_Draw_Rect |
(Buffer : DMA2D_Buffer; |
Color : UInt32; |
X : Integer; |
Y : Integer; |
Width : Integer; |
Height : Integer) |
is |
begin |
DMA2D_Draw_Horizontal_Line (Buffer, Color, X, Y, Width); |
DMA2D_Draw_Horizontal_Line (Buffer, Color, X, Y + Height - 1, Width); |
DMA2D_Draw_Vertical_Line (Buffer, Color, X, Y, Height); |
DMA2D_Draw_Vertical_Line (Buffer, Color, X + Width - 1, Y, Height, True); |
end DMA2D_Draw_Rect; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.