text
stringlengths
0
234
---------
-- ISB --
---------
procedure ISB is
begin
Asm ("isb", Volatile => True);
end ISB;
-----------------------
-- Cache_Maintenance --
-----------------------
procedure Cache_Maintenance
(Start : System.Address;
Len : Natural)
is
begin
if not D_Cache_Enabled then
return;
end if;
declare
function To_U32 is new Ada.Unchecked_Conversion
(System.Address, UInt32);
Op_Size : Integer_32 := Integer_32 (Len);
Op_Addr : UInt32 := To_U32 (Start);
Reg : UInt32 with Volatile, Address => Reg_Address;
begin
DSB;
while Op_Size > 0 loop
Reg := Op_Addr;
Op_Addr := Op_Addr + Data_Cache_Line_Size;
Op_Size := Op_Size - Integer_32 (Data_Cache_Line_Size);
end loop;
DSB;
ISB;
Function Definition: function To_Char is new Ada.Unchecked_Conversion (Source => UInt8,
Function Body: Target => Character);
function To_UInt8 is new Ada.Unchecked_Conversion (Source => Character,
Target => UInt8);
procedure Write (This : in out TP_Device; Cmd : String);
procedure Read (This : in out TP_Device; Str : out String);
-----------
-- Write --
-----------
procedure Write (This : in out TP_Device; Cmd : String) is
Status : UART_Status;
Data : UART_Data_8b (Cmd'Range);
begin
for Index in Cmd'Range loop
Data (Index) := To_UInt8 (Cmd (Index));
end loop;
This.Port.Transmit (Data, Status);
if Status /= Ok then
-- No error handling...
raise Program_Error;
end if;
-- This.Time.Delay_Microseconds ((11 * 1000000 / 19_2000) + Cmd'Length);
end Write;
----------
-- Read --
----------
procedure Read (This : in out TP_Device; Str : out String) is
Status : UART_Status;
Data : UART_Data_8b (Str'Range);
begin
This.Port.Receive (Data, Status);
if Status /= Ok then
-- No error handling...
raise Program_Error;
end if;
for Index in Str'Range loop
Str (Index) := To_Char (Data (Index));
end loop;
end Read;
----------------------
-- Set_Line_Spacing --
----------------------
procedure Set_Line_Spacing (This : in out TP_Device; Spacing : UInt8) is
begin
Write (This, ASCII.ESC & '3' & To_Char (Spacing));
end Set_Line_Spacing;