text
stringlengths
0
234
end if;
Function Definition: procedure Host is
Function Body: COM : aliased Serial_Port;
COM3 : constant Port_Name := Name (3);
Outgoing : String (1 .. 1024); -- arbitrary
Last : Natural;
begin
COM.Open (COM3);
COM.Set (Rate => B115200, Block => False);
loop
Put ("> ");
Get_Line (Outgoing, Last);
exit when Last = Outgoing'First - 1;
Put_Line ("Sending: '" & Outgoing (1 .. Last) & "'");
String'Output (COM'Access, Outgoing (1 .. Last));
declare
Incoming : constant String := String'Input (COM'Access);
begin
Put_Line ("From board: " & Incoming);
Function Definition: -- procedure Host is
Function Body: -- COM : aliased Serial_Port;
-- COM3 : constant Port_Name := Name (3);
--
-- Outgoing : String (1 .. 1024); -- arbitrary
-- Last : Natural;
-- begin
-- COM.Open (COM3);
-- COM.Set (Rate => B115200, Block => False);
--
-- loop
-- Put ("> ");
-- Get_Line (Outgoing, Last);
-- exit when Last = Outgoing'First - 1;
--
-- Put_Line ("Sending: '" & Outgoing (1 .. Last) & "'");
-- String'Output (COM'Access, Outgoing (1 .. Last));
--
-- declare
-- Incoming : constant String := String'Input (COM'Access);
-- begin
-- Put_Line ("From board: " & Incoming);
-- end;
-- end loop;
--
-- COM.Close;
-- end Host;
-- You can change the COM port number, or even get it from the command line
-- as an argument, but it must match what the host OS sees from the USB-COM
-- cable.
-- When running it, enter a string at the prompt (">") or just hit carriage
-- return if you are ready to quit. If you enter a string, it will be sent to
-- the target board, along with the bounds. The program (in this file) running
-- on the target, echos it back so the host app will show that response from
-- the board.
-- TARGET BOARD SIDE:
-- This file declares the main procedure for the program running on the target
-- board. It simply echos the incoming strings, forever.
with Last_Chance_Handler; pragma Unreferenced (Last_Chance_Handler);
with Peripherals_Streaming; use Peripherals_Streaming;
with Serial_IO.Streaming; use Serial_IO.Streaming;
procedure Demo_Serial_Port_Streaming is
begin
Initialize (COM);
Configure (COM, Baud_Rate => 115_200);
loop
declare
Incoming : constant String := String'Input (COM'Access);
begin
String'Output (COM'Access, "'" & Incoming & "'");
Function Definition: procedure Main is
Function Body: use type Partitions.Status_Code;
procedure List_Dir (Path : String);
-- List files in directory
procedure List_Partitions (Path_To_Disk_Image : String);
-- List partition in a disk file
--------------
-- List_Dir --
--------------
procedure List_Dir (Path : String) is
Status : Status_Code;