|
|
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: 13312 (0x3400)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Low_Level_Io_2, seg_05c1e2, seg_05c2a1
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
with System;
with Duart_68681;
use Duart_68681;
with Pic_68155;
with Unchecked_Conversion;
with Ada_Krn_Defs;
package body Low_Level_Io_2 is
Interrupt_Vector : constant := 100;
First_Call : Boolean := True;
function To_Reg is new Unchecked_Conversion
(System.Address, Duart_68681.Acc_Channel);
Duart : Duart_68681.Objet;
for Duart use at System.Address'Ref (16#03001000#);
Pic : Pic_68155.Objet;
for Pic use at System.Address'Ref (16#03010020#);
procedure Init_Port (Port : in Object) is
begin
Port.Regs.Sr := Duart_68681.Vitesse_9600;
Port.Regs.Cr := Duart_68681.Reset_Pointeur_Mr;
Port.Regs.Mr := Duart_68681.Sans_Parite_8_Bits;
Port.Regs.Mr := Duart_68681.Un_Stop_Bit;
Port.Regs.Cr := Duart_68681.Valider_Rx_Tx;
Duart.Int := Duart_68681.Get_Int
(Name => Port.Name, Rx => True, Tx => False);
end Init_Port;
procedure Initialize is
begin
Duart.Acr := Duart_68681.Duart_Simple;
Pic.R3 := Pic_68155.Activer_Lrq1;
Pic.R0 := Pic_68155.Adresser_Cr1;
Pic.R1 := Pic_68155.Activer_Sur_Front;
end Initialize;
task Duart_Task is
entry Go (P : in Object);
entry Rx_A (C : out Duart_68681.Byte);
entry Tx_A (C : in Duart_68681.Byte);
entry Rx_B (C : out Duart_68681.Byte);
entry Tx_B (C : in Duart_68681.Byte);
entry It;
for It use at System.Address'Ref (Interrupt_Vector);
pragma Passive (Abort_Unsafe, Ada_Krn_Defs.Default_Intr_Attr);
end Duart_Task;
function It_Rx (Port : in Object; Reg : in Duart_68681.Byte)
return Boolean is
Rg : Duart_68681.Loc_Byte;
for Rg use at Reg'Address;
begin
if Port = null then
return False;
else
return Rg (Port.Bit_It_Rx);
end if;
end It_Rx;
function It_Tx (Port : in Object; Reg : in Duart_68681.Byte)
return Boolean is
Rg : Duart_68681.Loc_Byte;
for Rg use at Reg'Address;
begin
if Port = null then
return False;
else
return Rg (Port.Bit_It_Tx);
end if;
end It_Tx;
task body Duart_Task is
Init_Done : array (Duart_68681.Port_Name) of Boolean :=
(others => False);
Ports : array (Duart_68681.Port_Name) of Object;
Reg_Isr : Duart_68681.Byte;
begin
loop
select
accept Go (P : in Object) do
Ports (P.Name) := P;
Init_Done (P.Name) := True;
end Go;
or
when Init_Done (Port_A) and then Ports (Port_A).Tx_Ready =>
accept Tx_A (C : in Duart_68681.Byte) do
Ports (Port_A).Regs.Tx_Rx := C;
Duart.Int :=
Duart_68681.Get_Int
(Name => Port_A, Rx => False, Tx => True);
Ports (Port_A).Tx_Ready := False;
end Tx_A;
or
when Init_Done (Port_A) and then Ports (Port_A).Rx_Ready =>
accept Rx_A (C : out Duart_68681.Byte) do
C := Ports (Port_A).Car;
Ports (Port_A).Rx_Ready := False;
end Rx_A;
or
when Init_Done (Port_B) and then Ports (Port_B).Tx_Ready =>
accept Tx_B (C : in Duart_68681.Byte) do
Ports (Port_B).Regs.Tx_Rx := C;
Duart.Int :=
Duart_68681.Get_Int
(Name => Port_B, Tx => True, Rx => False);
Ports (Port_B).Tx_Ready := False;
end Tx_B;
or
when Init_Done (Port_B) and then Ports (Port_B).Rx_Ready =>
accept Rx_B (C : out Duart_68681.Byte) do
C := Ports (Port_B).Car;
Ports (Port_B).Rx_Ready := False;
end Rx_B;
or
accept It do
Reg_Isr := Duart.Int;
if It_Rx (Port => Ports (Port_A), Reg => Reg_Isr) then
Ports (Port_A).Car := Ports (Port_A).Regs.Tx_Rx;
Ports (Port_A).Rx_Ready := True;
end if;
if It_Tx (Port => Ports (Port_A), Reg => Reg_Isr) then
Duart.Int :=
Duart_68681.Get_Int
(Name => Port_A, Rx => True, Tx => False);
Ports (Port_A).Tx_Ready := True;
end if;
if It_Rx (Port => Ports (Port_B), Reg => Reg_Isr) then
Ports (Port_B).Car := Ports (Port_B).Regs.Tx_Rx;
Ports (Port_B).Rx_Ready := True;
end if;
if It_Tx (Port => Ports (Port_B), Reg => Reg_Isr) then
Duart.Int :=
Duart_68681.Get_Int
(Name => Port_B, Rx => True, Tx => False);
Ports (Port_B).Tx_Ready := True;
end if;
end It;
end select;
end loop;
end Duart_Task;
function Open (Name : in Duart_68681.Port_Name;
S : in Duart_68681.Stop_Bit := Duart_68681.Stop_Bit_1;
P : in Duart_68681.Parity := Duart_68681.Parity_None;
C : in Duart_68681.Car_Length :=
Duart_68681.Car_Length_8_Bit;
B : in Duart_68681.Baud_Rate := Duart_68681.Baud_Rate_9600)
return Object is
Port : Object := new Port_Infos;
begin
if First_Call then
Initialize;
First_Call := False;
end if;
Port.Name := Name;
if Name = Port_A then
Port.Regs := To_Reg (Duart.Port_A'Address);
Port.Bit_It_Tx := 8;
Port.Bit_It_Rx := 7;
else
Port.Regs := To_Reg (Duart.Port_B'Address);
Port.Bit_It_Tx := 4;
Port.Bit_It_Rx := 3;
end if;
Init_Port (Port => Port);
Duart_Task.Go (P => Port);
return Port;
end Open;
function Byte_Available (Port : in Object) return Boolean is
begin
return Port.Rx_Ready;
end Byte_Available;
function Receive (Port : in Object) return Duart_68681.Byte is
C : Duart_68681.Byte;
begin
if Port.Name = Port_A then
Duart_Task.Rx_A (C);
else
Duart_Task.Rx_B (C);
end if;
return C;
end Receive;
procedure Send (Port : in Object; Car : in Duart_68681.Byte) is
begin
if Port.Name = Port_A then
Duart_Task.Tx_A (Car);
else
Duart_Task.Tx_B (Car);
end if;
end Send;
procedure Close (Port : in Object) is
begin
null;
end Close;
begin
Duart.Ivr := Interrupt_Vector;
end Low_Level_Io_2;
nblk1=c
nid=9
hdr6=10
[0x00] rec0=1f rec1=00 rec2=01 rec3=01e
[0x01] rec0=1a rec1=00 rec2=07 rec3=020
[0x02] rec0=1f rec1=00 rec2=05 rec3=096
[0x03] rec0=14 rec1=00 rec2=0c rec3=042
[0x04] rec0=14 rec1=00 rec2=02 rec3=008
[0x05] rec0=15 rec1=00 rec2=0b rec3=008
[0x06] rec0=1e rec1=00 rec2=06 rec3=014
[0x07] rec0=1a rec1=00 rec2=08 rec3=000
[0x08] rec0=1d rec1=00 rec2=03 rec3=000
[0x09] rec0=22 rec1=00 rec2=05 rec3=000
[0x0a] rec0=05 rec1=00 rec2=04 rec3=000
[0x0b] rec0=e2 rec1=80 rec2=00 rec3=000
tail 0x2176b8bfc895a7e1ef86a 0x42a00088462060003
Free Block Chain:
0x9: 0000 00 03 03 fc 00 1b 20 20 20 20 20 20 20 20 20 20 ┆ ┆
0x3: 0000 00 04 00 03 00 00 00 01 00 00 00 00 00 00 00 00 ┆ ┆
0x4: 0000 00 0a 01 4d 80 09 64 20 73 65 6c 65 63 74 3b 09 ┆ M d select; ┆
0xa: 0000 00 00 00 42 80 1c 6f 72 74 73 20 28 50 6f 72 74 ┆ B orts (Port┆