|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 6144 (0x1800)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Transport, seg_04cdce
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
with Transport_Defs;
use Transport_Defs;
with System;
with Daemon_Talk;
with Transport_Byte_Order;
-- This package body is for talk_io (breakpointed Ada I/O). It's shared
-- between the host (daemons) and target (in the talk_io library).
--
package body Transport is
use Transport_Byte_Order;
Packet_Length : constant := 24;
type Byte_Array is array (Natural range <>) of Character;
subtype Packet_Data is Byte_Array (1 .. Packet_Length);
type Packet is
record
Channel : Transport_Integer;
Length : Transport_Integer;
More : Transport_Integer;
Sum : Transport_Integer;
Data : Packet_Data;
end record;
Pkt_Size : constant Integer := Packet'Size / 8;
Scanned : Boolean;
Pkt : Packet;
procedure Send_Packet is
begin
Pkt.Sum := 0;
Daemon_Talk.Do_Io (Pkt'Address, Pkt_Size, 1);
end Send_Packet;
function Receive_Packet return Boolean is
begin
Daemon_Talk.Do_Io (Pkt'Address, Pkt_Size, 2);
return True;
end Receive_Packet;
--------------------------------------
-- Breaks the message up into fixed --
-- size packets and sends them out. --
--------------------------------------
procedure Send (Chan : in Transport_Defs.Channel_T;
Count : in Natural;
Buf_Addr : in System.Address) is
L : Integer;
More : Boolean;
Current : Integer := 0;
Data : Byte_Array (1 .. Count);
for Data use at Buf_Addr;
begin
Pkt.Channel := To_Transport_Integer (Integer (Chan));
loop
L := Count - Current;
if L > Packet_Length then
L := Packet_Length;
end if;
Pkt.Data (1 .. L) := Data (Current + 1 .. Current + L);
Pkt.Length := To_Transport_Integer (L);
Current := Current + L;
More := Current < Count;
Pkt.More := To_Transport_Integer (Boolean'Pos (More));
Send_Packet;
exit when not More;
end loop;
end Send;
----------------------------------------------------------------
-- Reads the channel number and saves it. This call must be --
-- followed by a receive call before any send calls are made. --
----------------------------------------------------------------
function Scan (Timeout : Boolean := False) return Channel_T is
begin
if not Scanned then
loop
exit when Receive_Packet;
if Timeout then
raise Transport_Timeout;
end if;
end loop;
Scanned := True;
end if;
return Channel_T (To_Local_Integer (Pkt.Channel));
end Scan;
------------------------------------
-- Receive no more than count bytes --
------------------------------------
procedure Receive (Chan : in Transport_Defs.Channel_T;
Count : in out Natural;
Buf_Addr : in System.Address;
Rcvd_Msg : out Boolean) is
L : Integer;
More : Boolean;
Current : Integer := 0;
Data : Byte_Array (1 .. Count);
for Data use at Buf_Addr;
begin
if Count < 0 then
raise Transport_Error;
end if;
if Scan /= Chan then
Scanned := False;
raise Transport_Error;
end if;
Scanned := False;
loop
L := To_Local_Integer (Pkt.Length);
if L > Count then
raise Transport_Error;
end if;
Data (Current + 1 .. Current + L) := Pkt.Data (1 .. L);
Current := Current + L;
More := Boolean'Val (To_Local_Integer (Pkt.More));
exit when not More;
if not Receive_Packet then
raise Transport_Error;
end if;
end loop;
Count := Current; -- bytes
Rcvd_Msg := True;
end Receive;
procedure Put_Signal (Sig : Transport_Defs.Tdm_Sig_T) is
begin
null;
end Put_Signal;
procedure Reset is
begin
Scanned := False;
end Reset;
procedure Initialize (Verbose : Boolean := False;
Preempt : Boolean := False) is
begin
Reset;
end Initialize;
procedure Shutdown is
begin
null;
end Shutdown;
begin
Reset;
end Transport;
nblk1=5
nid=0
hdr6=a
[0x00] rec0=28 rec1=00 rec2=01 rec3=000
[0x01] rec0=1c rec1=00 rec2=02 rec3=004
[0x02] rec0=1b rec1=00 rec2=03 rec3=018
[0x03] rec0=1b rec1=00 rec2=04 rec3=06c
[0x04] rec0=23 rec1=00 rec2=05 rec3=000
tail 0x217541d6c874f7b6e131b 0x42a00088462060003