DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: ┃ B T ┃
Length: 67348 (0x10714) Types: TextFile Names: »B«
└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13 └─ ⟦124ff5788⟧ »DATA« └─⟦this⟧ └─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11 └─ ⟦129cab021⟧ »DATA« └─⟦this⟧ └─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16 └─ ⟦6f12a12be⟧ »DATA« └─⟦this⟧ └─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04 └─ ⟦d65440be7⟧ »DATA« └─⟦this⟧
with Text_Io, Octet, Mot, Periph, Erreur, Ppi_Out, Ihm, Bus, Verif_Input; use Periph; package body Ppi_Pack is Bit_Set : constant Octet.Num_Bit := 0; Cport_Low : constant Octet.Num_Bit := 0; Bport : constant Octet.Num_Bit := 1; Bgr_Mode : constant Octet.Num_Bit := 2; Cport_Upper : constant Octet.Num_Bit := 3; Aport : constant Octet.Num_Bit := 4; Agr_Mode1 : constant Octet.Num_Bit := 5; Agr_Mode2 : constant Octet.Num_Bit := 6; Set_Flag : constant Octet.Num_Bit := 7; Intrb : constant Octet.Num_Bit := 0; Ibfb : constant Octet.Num_Bit := 1; Obfb : constant Octet.Num_Bit := 1; Inteb : constant Octet.Num_Bit := 2; Intra : constant Octet.Num_Bit := 3; Inte2a : constant Octet.Num_Bit := 4; Ibfa : constant Octet.Num_Bit := 5; Inte1a : constant Octet.Num_Bit := 6; Obfa : constant Octet.Num_Bit := 7; Full_Transmit : constant Natural := 8; Pc0 : constant Octet.Num_Bit := 0; Pc1 : constant Octet.Num_Bit := 1; Pc2 : constant Octet.Num_Bit := 2; Pc3 : constant Octet.Num_Bit := 3; Pc4 : constant Octet.Num_Bit := 4; Pc5 : constant Octet.Num_Bit := 5; Pc6 : constant Octet.Num_Bit := 6; Pc7 : constant Octet.Num_Bit := 7; Not_Available : constant Natural := 40; Unknown_Id : constant Natural := 41; Cant_Force_Bit : constant Natural := 42; Conf_Periph_Error : constant Natural := 43; Conf_Write_Error : constant Natural := 44; Conf_Read_Error : constant Natural := 45; Unknown_Event : constant Natural := 46; Window_Already_Open : constant Natural := 47; Bad_Value : constant Natural := 48; Identifier_Field : constant String := "BB.Number"; Vector_Field : constant String := "BB.F1.Vector"; Address_Field : constant String := "BB.F1.Base"; Mem_Mapped_Field : constant String := "BB.F1.Memory"; It_Connect_Field : constant String := "BB.F1.It"; Status_Field : constant String := "BB.F2.Status"; Control_Field : constant String := "BB.F2.Control"; Mode_A_Field : constant String := "BB.Port.ModeA"; Mode_B_Field : constant String := "BB.Port.ModeB"; In_A_Field : constant String := "BB.Port.SensA"; In_B_Field : constant String := "BB.Port.SensB"; In_Clow_Field : constant String := "BB.Port.LowC"; In_Cupper_Field : constant String := "BB.Port.HighC"; Port_A_Field : constant String := "BB.Port.A"; Port_B_Field : constant String := "BB.Port.B"; Port_C_Field : constant String := "BB.Port.C"; Close_Window : constant String := "Cancel"; Window_Name : constant String := "PPI"; type Access_Mode is (Put, Get); type Ppi_Mode is (Mode0, Mode1, Mode2); task type Ppi_Task is entry Init (Periph_Id : Periph.T_Periph_Number; It_Vector : Octet.T_Octet; Basic_Address : Mot.T_Mot; Memory_Mapped : Boolean; It_Connected : Boolean; Identifier : T_Ppi_Number; Number_Of_Register : out Natural); entry Access_Register (Access_Mode) (Register_Number : Natural; Value : in out Octet.T_Octet); entry Reset; entry Receive (Register_Number : Natural; Value : Octet.T_Octet; Bit_Number : Natural); entry Kill; entry Open_Window (Wid : Ihm.Window_Id); entry Do_Event (What_Kind : Ihm.Event.Kind; Field_Name : String; Value : String); end Ppi_Task; type P_Ppi_Task is access Ppi_Task; type Object is record Task_Access : P_Ppi_Task; Window : Boolean := False; end record; type Object_Table is array (T_Ppi_Number) of Object; type Object_Manager is record Table : Object_Table; Last : T_Ppi_Number := T_Ppi_Number'First; end record; type Ppi_Config is record Identifier : T_Ppi_Number; Periph_Id : Periph.T_Periph_Number; Vector : Octet.T_Octet; Address : Mot.T_Mot; Mem_Mapped : Boolean; It_Connect : Boolean; Mode_A : Ppi_Mode; Mode_B : Ppi_Mode; In_A : Boolean; In_B : Boolean; In_Clow : Boolean; In_Cupper : Boolean; Setbit : Octet.T_Octet; Status : Octet.T_Octet; Control : Octet.T_Octet; Port_A : Octet.T_Octet; Port_B : Octet.T_Octet; Port_C : Octet.T_Octet; Disp_Cwr : Boolean; end record; Ppi_Manager : Object_Manager; ------------------------------ exports ------------------------------------- procedure Init (Periph_Id : Periph.T_Periph_Number; It_Vector : Octet.T_Octet; Basic_Address : Mot.T_Mot; Memory_Mapped : Boolean; It_Connected : Boolean; Number_Of_Register : out Natural; Identifier : out T_Ppi_Number) is begin if Ppi_Manager.Last >= T_Ppi_Number'Last then Erreur.Detectee (Not_Available); Identifier := T_Ppi_Number'First; Number_Of_Register := 0; else Ppi_Manager.Last := Ppi_Manager.Last + 1; Ppi_Manager.Table (Ppi_Manager.Last).Task_Access := new Ppi_Task; Ppi_Manager.Table (Ppi_Manager.Last).Task_Access.Init (Periph_Id, It_Vector, Basic_Address, Memory_Mapped, It_Connected, Ppi_Manager.Last, Number_Of_Register); Identifier := Ppi_Manager.Last; end if; end Init; procedure Put_Register (Identifier : T_Ppi_Number; Register_Number : Natural; Value : Octet.T_Octet) is Register_Value : Octet.T_Octet; begin if Identifier > Ppi_Manager.Last or Identifier = T_Ppi_Number'First then Erreur.Detectee (Unknown_Id); else Register_Value := Value; Ppi_Manager.Table (Identifier).Task_Access.Access_Register (Put) (Register_Number, Register_Value); end if; end Put_Register; function Get_Register (Identifier : T_Ppi_Number; Register_Number : Natural) return Octet.T_Octet is Register_Value : Octet.T_Octet := 0; begin if Identifier > Ppi_Manager.Last or Identifier = T_Ppi_Number'First then Erreur.Detectee (Unknown_Id); else Ppi_Manager.Table (Identifier).Task_Access.Access_Register (Get) (Register_Number, Register_Value); end if; return Register_Value; end Get_Register; procedure Reset (Identifier : T_Ppi_Number) is begin if Identifier > Ppi_Manager.Last or Identifier = T_Ppi_Number'First then Erreur.Detectee (Unknown_Id); else Ppi_Manager.Table (Identifier).Task_Access.Reset; end if; end Reset; procedure Receive (Register_Number : Natural; Value : Octet.T_Octet; Bit_Number : Natural; Identifier : Natural) is Id : T_Ppi_Number; begin Id := T_Ppi_Number (Identifier); if Id > Ppi_Manager.Last or Id = T_Ppi_Number'First then Erreur.Detectee (Unknown_Id); else Ppi_Manager.Table (Id).Task_Access.Receive (Register_Number, Value, Bit_Number); end if; end Receive; procedure Kill is begin for I in 1 .. Ppi_Manager.Last loop Ppi_Manager.Table (I).Window := False; Ppi_Manager.Table (I).Task_Access.Kill; end loop; Ppi_Manager.Last := T_Ppi_Number'First; end Kill; function Open_Window (Identifier : Natural) return Boolean is Id : T_Ppi_Number; begin Id := T_Ppi_Number (Identifier); if Id > Ppi_Manager.Last or Id = T_Ppi_Number'First then Erreur.Detectee (Unknown_Id); return False; elsif Ppi_Manager.Table (Id).Window then Erreur.Detectee (Window_Already_Open); return False; else return True; end if; end Open_Window; procedure Open_Window (Identifier : Natural; Window_Id : Ihm.Window_Id) is Id : T_Ppi_Number; begin Id := T_Ppi_Number (Identifier); Ppi_Manager.Table (Id).Window := True; Ppi_Manager.Table (Id).Task_Access.Open_Window (Window_Id); end Open_Window; procedure Dispatch_Event (Identifier : Natural; What_Kind : Ihm.Event.Kind; Field_Name : String; Value : String) is Id : T_Ppi_Number; begin Id := T_Ppi_Number (Identifier); if Id > Ppi_Manager.Last or Id = T_Ppi_Number'First then Erreur.Detectee (Unknown_Id); else if Ihm.Event."=" (What_Kind, Ihm.Event.Pushbutton) and Field_Name = Close_Window then Ppi_Manager.Table (Id).Window := False; end if; Ppi_Manager.Table (Id).Task_Access.Do_Event (What_Kind, Field_Name, Value); end if; end Dispatch_Event; ------------------------------ internals ------------------------------------ procedure Write_Window (Configuration : Ppi_Config; Window_Id : Ihm.Window_Id; Window_Enable : Boolean; Identifier_Show, Vector_Show, Address_Show, Mem_Mapped_Show, It_Connect_Show, Status_Show, Control_Show, Mode_A_Show, Mode_B_Show, In_A_Show, In_B_Show, In_Clow_Show, In_Cupper_Show, Port_A_Show, Port_B_Show, Port_C_Show : Boolean := False) is begin if Window_Enable then if Identifier_Show then Ihm.Window.Put_Field (Window_Id, Identifier_Field, T_Ppi_Number'Image (Configuration.Identifier)); end if; if Vector_Show then Ihm.Window.Put_Field (Window_Id, Vector_Field, Octet.Convert_Octet_String (Configuration.Vector)); end if; if Address_Show then Ihm.Window.Put_Field (Window_Id, Address_Field, Mot.Convert_Mot_String (Configuration.Address)); end if; if Mem_Mapped_Show then if Configuration.Mem_Mapped then Ihm.Window.Put_Field (Window_Id, Mem_Mapped_Field, " On"); else Ihm.Window.Put_Field (Window_Id, Mem_Mapped_Field, "Off"); end if; end if; if It_Connect_Show then if Configuration.It_Connect then Ihm.Window.Put_Field (Window_Id, It_Connect_Field, " On"); else Ihm.Window.Put_Field (Window_Id, It_Connect_Field, "Off"); end if; end if; if Status_Show then Ihm.Window.Put_Field (Window_Id, Status_Field, Octet.Convert_Binaire_String (Configuration.Status)); end if; if Control_Show then if Configuration.Disp_Cwr then Ihm.Window.Put_Field (Window_Id, Control_Field, Octet.Convert_Binaire_String (Configuration.Control)); else Ihm.Window.Put_Field (Window_Id, Control_Field, Octet.Convert_Binaire_String (Configuration.Setbit)); end if; end if; if Mode_A_Show then case Configuration.Mode_A is when Mode0 => Ihm.Window.Put_Field (Window_Id, Mode_A_Field, "0"); when Mode1 => Ihm.Window.Put_Field (Window_Id, Mode_A_Field, "1"); when Mode2 => Ihm.Window.Put_Field (Window_Id, Mode_A_Field, "2"); end case; end if; if Mode_B_Show then case Configuration.Mode_B is when Mode0 => Ihm.Window.Put_Field (Window_Id, Mode_B_Field, "0"); when Mode1 => Ihm.Window.Put_Field (Window_Id, Mode_B_Field, "1"); when Mode2 => null; end case; end if; if In_A_Show then if Configuration.In_A then Ihm.Window.Put_Field (Window_Id, In_A_Field, " In"); else Ihm.Window.Put_Field (Window_Id, In_A_Field, "Out"); end if; end if; if In_B_Show then if Configuration.In_B then Ihm.Window.Put_Field (Window_Id, In_B_Field, " In"); else Ihm.Window.Put_Field (Window_Id, In_B_Field, "Out"); end if; end if; if In_Clow_Show then if Configuration.In_Clow then Ihm.Window.Put_Field (Window_Id, In_Clow_Field, " In"); else Ihm.Window.Put_Field (Window_Id, In_Clow_Field, "Out"); end if; end if; if In_Cupper_Show then if Configuration.In_Cupper then Ihm.Window.Put_Field (Window_Id, In_Cupper_Field, " In"); else Ihm.Window.Put_Field (Window_Id, In_Cupper_Field, "Out"); end if; end if; if Port_A_Show then Ihm.Window.Put_Field (Window_Id, Port_A_Field, Octet.Convert_Octet_String (Configuration.Port_A)); end if; if Port_B_Show then Ihm.Window.Put_Field (Window_Id, Port_B_Field, Octet.Convert_Octet_String (Configuration.Port_B)); end if; if Port_C_Show then Ihm.Window.Put_Field (Window_Id, Port_C_Field, Octet.Convert_Binaire_String (Configuration.Port_C)); end if; end if; end Write_Window; procedure Display (Configuration : Ppi_Config) is use Text_Io; Carac1, Carac2 : Character; begin Put_Line ("==================================================="); Put_Line ("PPI " & T_Ppi_Number'Image (Configuration.Identifier)); Put (" V:"); Octet.Afficher_Octet_Binaire (Configuration.Vector); Put (" ADR: "); Mot.Afficher_Mot_Hexa (Configuration.Address); Put (" MAP:" & Boolean'Image (Configuration.Mem_Mapped)); Put (" ITC:" & Boolean'Image (Configuration.It_Connect)); New_Line; Put ("A:"); Octet.Afficher_Octet_Binaire (Configuration.Port_A); Put (" B:"); Octet.Afficher_Octet_Binaire (Configuration.Port_B); New_Line; Put ("C:"); Octet.Afficher_Octet_Binaire (Configuration.Port_C); Put_Line (" ModeA: " & Ppi_Mode'Image (Configuration.Mode_A) & " ModeB: " & Ppi_Mode'Image (Configuration.Mode_B)); Put (" CWR:"); Octet.Afficher_Octet_Binaire (Configuration.Control); Put (" SWR:"); Octet.Afficher_Octet_Binaire (Configuration.Status); New_Line; Put (" SET:"); Octet.Afficher_Octet_Binaire (Configuration.Setbit); New_Line; Put (" A_in:" & Boolean'Image (Configuration.In_A)); Put (" Ch_in:" & Boolean'Image (Configuration.In_Cupper)); Put (" Cl_in:" & Boolean'Image (Configuration.In_Clow)); Put (" B_in:" & Boolean'Image (Configuration.In_B)); New_Line; Put_Line ("++++++++++++++++++++++++++++++++++++++++++++++++++"); end Display; procedure Reset_Ppi (Configuration : in out Ppi_Config; Window_Id : Ihm.Window_Id; Window_Enable : Boolean) is begin Configuration.Mode_A := Mode0; Configuration.Mode_B := Mode0; Configuration.Port_A := 0; Configuration.Port_B := 0; Configuration.Port_C := 0; Configuration.Control := 0; Configuration.Setbit := 0; Configuration.Status := 0; Configuration.In_A := True; Configuration.In_B := True; Configuration.In_Clow := True; Configuration.In_Cupper := True; Configuration.Disp_Cwr := True; Write_Window (Configuration, Window_Id, Window_Enable, Identifier_Show => True, Vector_Show => True, Address_Show => True, Mem_Mapped_Show => True, It_Connect_Show => True, Status_Show => True, Control_Show => True, Mode_A_Show => True, Mode_B_Show => True, In_A_Show => True, In_B_Show => True, In_Clow_Show => True, In_Cupper_Show => True, Port_A_Show => True, Port_B_Show => True, Port_C_Show => True); end Reset_Ppi; procedure Initialize_Ppi (Configuration : in out Ppi_Config; Window_Id : Ihm.Window_Id; Window_Enable : Boolean) is use Octet; begin Configuration.Port_A := 0; Configuration.Port_B := 0; Configuration.Port_C := 0; Configuration.Status := 0; if Test_Bit (Configuration.Control, Bgr_Mode) then Configuration.Mode_B := Mode1; else Configuration.Mode_B := Mode0; end if; if Test_Bit (Configuration.Control, Agr_Mode2) then Configuration.Mode_A := Mode2; Set_Bit (Configuration.Status, Obfa); -- we suppose peripheral well connected Configuration.Port_C := "or" (Configuration.Port_C, 208); elsif Test_Bit (Configuration.Control, Agr_Mode1) then Configuration.Mode_A := Mode1; else Configuration.Mode_A := Mode0; end if; if Test_Bit (Configuration.Control, Aport) then Configuration.In_A := True; if Configuration.Mode_A = Mode1 then -- we suppose peripheral well connected Configuration.Port_C := "or" (Configuration.Port_C, 16); end if; else Configuration.In_A := False; if Configuration.Mode_A = Mode1 then Set_Bit (Configuration.Status, Obfa); -- we suppose peripheral well connected Configuration.Port_C := "or" (Configuration.Port_C, 192); end if; end if; if Test_Bit (Configuration.Control, Bport) then Configuration.In_B := True; if Configuration.Mode_B = Mode1 then -- we suppose peripheral well connected Configuration.Port_C := "or" (Configuration.Port_C, 4); end if; else Configuration.In_B := False; if Configuration.Mode_B = Mode1 then Set_Bit (Configuration.Status, Obfb); -- we suppose peripheral well connected Configuration.Port_C := "or" (Configuration.Port_C, 6); end if; end if; if Test_Bit (Configuration.Control, Cport_Low) then Configuration.In_Clow := True; else Configuration.In_Clow := False; end if; if Test_Bit (Configuration.Control, Cport_Upper) then Configuration.In_Cupper := True; else Configuration.In_Cupper := False; end if; Write_Window (Configuration, Window_Id, Window_Enable, Status_Show => True, Control_Show => True, Mode_A_Show => True, Mode_B_Show => True, In_A_Show => True, In_B_Show => True, In_Clow_Show => True, In_Cupper_Show => True, Port_A_Show => True, Port_B_Show => True, Port_C_Show => True); end Initialize_Ppi; procedure Do_Setbit (Configuration : in out Ppi_Config; Window_Id : Ihm.Window_Id; Window_Enable : Boolean) is use Octet; Mask : T_Octet := 14; Bit_Number : T_Octet; begin Bit_Number := "and" (Configuration.Setbit, Mask); Bit_Number := Bit_Number / 2; case Bit_Number is when 0 | 1 => if Configuration.Mode_B = Mode1 then if Test_Bit (Configuration.Setbit, Bit_Set) then Set_Bit (Configuration.Port_C, Bit_Number); Set_Bit (Configuration.Status, Bit_Number); else Res_Bit (Configuration.Port_C, Bit_Number); Res_Bit (Configuration.Status, Bit_Number); end if; Ppi_Out.Transmit_Bit (Configuration.Port_C, Bit_Number, 'C', Natural (Ppi_Mode'Pos (Configuration.Mode_B)), Natural (Configuration.Identifier), True); else Erreur.Detectee (Cant_Force_Bit); end if; when 2 => if Configuration.Mode_B = Mode1 then if Test_Bit (Configuration.Setbit, Bit_Set) then Set_Bit (Configuration.Status, Bit_Number); if Configuration.It_Connect and not Configuration.In_B and Test_Bit (Configuration.Status, Obfb) then Bus.It_From_Periph (Configuration.Periph_Id, Configuration.Vector); end if; else Res_Bit (Configuration.Status, Bit_Number); end if; else Erreur.Detectee (Cant_Force_Bit); end if; when 3 => if Configuration.Mode_A /= Mode0 then if Test_Bit (Configuration.Setbit, Bit_Set) then Set_Bit (Configuration.Port_C, Bit_Number); Set_Bit (Configuration.Status, Bit_Number); else Res_Bit (Configuration.Port_C, Bit_Number); Res_Bit (Configuration.Status, Bit_Number); end if; Ppi_Out.Transmit_Bit (Configuration.Port_C, Bit_Number, 'C', Natural (Ppi_Mode'Pos (Configuration.Mode_A)), Natural (Configuration.Identifier), True); else Erreur.Detectee (Cant_Force_Bit); end if; when 4 => if (Configuration.Mode_A = Mode1 and Configuration.In_A) or Configuration.Mode_A = Mode2 then if Test_Bit (Configuration.Setbit, Bit_Set) then Set_Bit (Configuration.Status, Bit_Number); else Res_Bit (Configuration.Status, Bit_Number); end if; elsif (Configuration.Mode_A = Mode1 and not Configuration.In_A and not Configuration.In_Cupper) then if Test_Bit (Configuration.Setbit, Bit_Set) then Set_Bit (Configuration.Port_C, Bit_Number); Set_Bit (Configuration.Status, Bit_Number); else Res_Bit (Configuration.Port_C, Bit_Number); Res_Bit (Configuration.Status, Bit_Number); end if; Ppi_Out.Transmit_Bit (Configuration.Port_C, Bit_Number, 'C', Natural (Ppi_Mode'Pos (Configuration.Mode_A)), Natural (Configuration.Identifier), True); else Erreur.Detectee (Cant_Force_Bit); end if; when 5 => if (Configuration.Mode_A = Mode1 and not Configuration.In_A and not Configuration.In_Cupper) or Configuration.Mode_A = Mode2 or (Configuration.Mode_A = Mode1 and Configuration.In_A) then if Test_Bit (Configuration.Setbit, Bit_Set) then Set_Bit (Configuration.Port_C, Bit_Number); Set_Bit (Configuration.Status, Bit_Number); else Res_Bit (Configuration.Port_C, Bit_Number); Res_Bit (Configuration.Status, Bit_Number); end if; Ppi_Out.Transmit_Bit (Configuration.Port_C, Bit_Number, 'C', Natural (Ppi_Mode'Pos (Configuration.Mode_A)), Natural (Configuration.Identifier), True); else Erreur.Detectee (Cant_Force_Bit); end if; when 6 => if (Configuration.Mode_A = Mode1 and not Configuration.In_A) or Configuration.Mode_A = Mode2 then if Test_Bit (Configuration.Setbit, Bit_Set) then Set_Bit (Configuration.Status, Bit_Number); if Configuration.It_Connect and Test_Bit (Configuration.Status, Obfa) then Bus.It_From_Periph (Configuration.Periph_Id, Configuration.Vector); end if; else Res_Bit (Configuration.Status, Bit_Number); end if; elsif (Configuration.Mode_A = Mode1 and Configuration.In_A and not Configuration.In_Cupper) then if Test_Bit (Configuration.Setbit, Bit_Set) then Set_Bit (Configuration.Port_C, Bit_Number); Set_Bit (Configuration.Status, Bit_Number); else Res_Bit (Configuration.Port_C, Bit_Number); Res_Bit (Configuration.Status, Bit_Number); end if; Ppi_Out.Transmit_Bit (Configuration.Port_C, Bit_Number, 'C', Natural (Ppi_Mode'Pos (Configuration.Mode_A)), Natural (Configuration.Identifier), True); else Erreur.Detectee (Cant_Force_Bit); end if; when 7 => if (Configuration.Mode_A = Mode1 and Configuration.In_A and not Configuration.In_Cupper) or Configuration.Mode_A = Mode2 or (Configuration.Mode_A = Mode1 and not Configuration.In_A) then if Test_Bit (Configuration.Setbit, Bit_Set) then Set_Bit (Configuration.Port_C, Bit_Number); Set_Bit (Configuration.Status, Bit_Number); else Res_Bit (Configuration.Port_C, Bit_Number); Res_Bit (Configuration.Status, Bit_Number); end if; Ppi_Out.Transmit_Bit (Configuration.Port_C, Bit_Number, 'C', Natural (Ppi_Mode'Pos (Configuration.Mode_A)), Natural (Configuration.Identifier), True); else Erreur.Detectee (Cant_Force_Bit); end if; when others => null; end case; Write_Window (Configuration, Window_Id, Window_Enable, Status_Show => True, Control_Show => True, Port_C_Show => True); end Do_Setbit; procedure Write_C (Configuration : in out Ppi_Config; Value : Octet.T_Octet; Error : out Boolean) is use Octet; Error_Found : Boolean := False; begin if Configuration.Mode_B = Mode0 and Configuration.Mode_A = Mode0 then if Configuration.In_Clow and Configuration.In_Cupper then Error_Found := True; else if not Configuration.In_Clow then Configuration.Port_C := "or" ("and" (Configuration.Port_C, 240), "and" (Value, 15)); end if; if not Configuration.In_Cupper then Configuration.Port_C := "or" ("and" (Configuration.Port_C, 15), "and" (Value, 240)); end if; end if; elsif Configuration.Mode_B = Mode0 and Configuration.Mode_A = Mode1 then if not Configuration.In_Clow then Configuration.Port_C := "or" ("and" (Configuration.Port_C, 248), "and" (Value, 7)); end if; elsif Configuration.Mode_B = Mode0 and Configuration.Mode_A = Mode2 then if not Configuration.In_Clow then Configuration.Port_C := "or" ("and" (Configuration.Port_C, 248), "and" (Value, 7)); end if; elsif Configuration.Mode_B = Mode1 and Configuration.Mode_A = Mode0 then if not Configuration.In_Cupper then Configuration.Port_C := "or" ("and" (Configuration.Port_C, 7), "and" (Value, 248)); end if; else Error_Found := True; end if; Error := Error_Found; end Write_C; procedure Read_C (Configuration : in out Ppi_Config; Value : in out Octet.T_Octet; Error : in out Boolean) is use Octet; Error_Found : Boolean := False; begin Value := 0; if Configuration.Mode_B = Mode0 and Configuration.Mode_A = Mode0 then if not Configuration.In_Clow and not Configuration.In_Cupper then Error_Found := True; else if Configuration.In_Clow then Value := "or" (Value, "and" (Configuration.Port_C, 15)); end if; if Configuration.In_Cupper then Value := "or" (Value, "and" (Configuration.Port_C, 240)); end if; end if; elsif Configuration.Mode_B = Mode0 and Configuration.Mode_A = Mode1 then if Configuration.In_Clow then Value := "or" (Value, "and" (Configuration.Port_C, 7)); end if; if Configuration.In_A then Value := "or" (Value, "and" (Configuration.Status, 56)); if Configuration.In_Cupper then Value := "or" (Value, "and" (Configuration.Port_C, 192)); end if; else Value := "or" (Value, "and" (Configuration.Status, 200)); if Configuration.In_Cupper then Value := "or" (Value, "and" (Configuration.Port_C, 48)); end if; end if; elsif Configuration.Mode_B = Mode0 and Configuration.Mode_A = Mode2 then Value := "and" (Configuration.Status, 248); if Configuration.In_Clow then Value := "or" (Value, "and" (Configuration.Port_C, 7)); end if; elsif Configuration.Mode_B = Mode1 and Configuration.Mode_A = Mode0 then Value := "and" (Configuration.Status, 7); if Configuration.In_Cupper then Value := "or" (Value, "and" (Configuration.Port_C, 248)); end if; elsif Configuration.Mode_B = Mode1 and Configuration.Mode_A = Mode1 then if Configuration.In_A then Value := "or" (Value, "and" (Configuration.Status, 63)); if Configuration.In_Cupper then Value := "or" (Value, "and" (Configuration.Port_C, 192)); end if; else Value := "or" (Value, "and" (Configuration.Status, 207)); if Configuration.In_Cupper then Value := "or" (Value, "and" (Configuration.Port_C, 48)); end if; end if; else Value := Configuration.Status; end if; Error := Error_Found; end Read_C; procedure Port_A_Output (Configuration : in out Ppi_Config; Window_Id : Ihm.Window_Id; Window_Enable : Boolean) is use Octet; begin case Configuration.Mode_A is when Mode0 => Ppi_Out.Transmit_Bit (Configuration.Port_A, Full_Transmit, 'A', Natural (Ppi_Mode'Pos (Configuration.Mode_A)), Natural (Configuration.Identifier), True); when Mode1 => if Octet.Test_Bit (Configuration.Status, Obfa) then Res_Bit (Configuration.Status, Intra); Res_Bit (Configuration.Port_C, Pc3); Res_Bit (Configuration.Status, Obfa); Res_Bit (Configuration.Port_C, Pc7); Ppi_Out.Transmit_Bit (Configuration.Port_C, Pc7, 'C', Natural (Ppi_Mode'Pos (Configuration.Mode_A)), Natural (Configuration.Identifier), True); Ppi_Out.Transmit_Bit (Configuration.Port_A, Full_Transmit, 'A', Natural (Ppi_Mode'Pos (Configuration.Mode_A)), Natural (Configuration.Identifier), True); else Erreur.Detectee (Conf_Write_Error); end if; when Mode2 => if Test_Bit (Configuration.Status, Obfa) then if not Test_Bit (Configuration.Port_C, Pc4) then Erreur.Detectee (Conf_Write_Error); else Res_Bit (Configuration.Status, Intra); Res_Bit (Configuration.Port_C, Pc3); Res_Bit (Configuration.Status, Obfa); Res_Bit (Configuration.Port_C, Pc7); Ppi_Out.Transmit_Bit (Configuration.Port_C, Pc7, 'C', Natural (Ppi_Mode'Pos (Configuration.Mode_A)), Natural (Configuration.Identifier), True); end if; else Erreur.Detectee (Conf_Write_Error); end if; end case; Write_Window (Configuration, Window_Id, Window_Enable, Status_Show => True, Port_A_Show => True, Port_C_Show => True); end Port_A_Output; procedure Port_A_Input (Configuration : in out Ppi_Config; Window_Id : Ihm.Window_Id; Window_Enable : Boolean) is use Octet; begin if not Test_Bit (Configuration.Port_C, Pc4) then Res_Bit (Configuration.Status, Ibfa); Res_Bit (Configuration.Port_C, Pc5); Ppi_Out.Transmit_Bit (Configuration.Port_C, Pc5, 'C', Natural (Ppi_Mode'Pos (Configuration.Mode_A)), Natural (Configuration.Identifier), False); Res_Bit (Configuration.Status, Intra); Res_Bit (Configuration.Port_C, Pc3); end if; Write_Window (Configuration, Window_Id, Window_Enable, Status_Show => True, Port_A_Show => True, Port_C_Show => True); end Port_A_Input; procedure Port_B_Output (Configuration : in out Ppi_Config; Window_Id : Ihm.Window_Id; Window_Enable : Boolean) is use Octet; begin case Configuration.Mode_B is when Mode0 => Ppi_Out.Transmit_Bit (Configuration.Port_B, Full_Transmit, 'B', Natural (Ppi_Mode'Pos (Configuration.Mode_B)), Natural (Configuration.Identifier), True); when Mode1 => if Octet.Test_Bit (Configuration.Status, Obfb) then Res_Bit (Configuration.Status, Intrb); Res_Bit (Configuration.Port_C, Pc0); Res_Bit (Configuration.Status, Obfb); Res_Bit (Configuration.Port_C, Pc1); Ppi_Out.Transmit_Bit (Configuration.Port_C, Pc1, 'C', Natural (Ppi_Mode'Pos (Configuration.Mode_B)), Natural (Configuration.Identifier), True); Ppi_Out.Transmit_Bit (Configuration.Port_B, Full_Transmit, 'B', Natural (Ppi_Mode'Pos (Configuration.Mode_B)), Natural (Configuration.Identifier), True); else Erreur.Detectee (Conf_Write_Error); end if; when Mode2 => null; end case; Write_Window (Configuration, Window_Id, Window_Enable, Status_Show => True, Port_B_Show => True, Port_C_Show => True); end Port_B_Output; procedure Port_B_Input (Configuration : in out Ppi_Config; Window_Id : Ihm.Window_Id; Window_Enable : Boolean) is use Octet; begin if not Test_Bit (Configuration.Port_C, Pc2) then Res_Bit (Configuration.Status, Ibfb); Res_Bit (Configuration.Port_C, Pc1); Ppi_Out.Transmit_Bit (Configuration.Port_C, Pc1, 'C', Natural (Ppi_Mode'Pos (Configuration.Mode_B)), Natural (Configuration.Identifier), False); Res_Bit (Configuration.Status, Intrb); Res_Bit (Configuration.Port_C, Pc0); end if; Write_Window (Configuration, Window_Id, Window_Enable, Status_Show => True, Port_B_Show => True, Port_C_Show => True); end Port_B_Input; procedure Receive_From_Periph (Register_Number : Natural; Configuration : in out Ppi_Config; Bit_Number : Natural; Value : Octet.T_Octet) is use Octet; begin case Register_Number is when 3 => case Bit_Number is when 0 | 1 => if Configuration.Mode_B = Mode0 and Configuration.In_Clow then if Test_Bit (Value, Bit_Number) then Set_Bit (Configuration.Port_C, Bit_Number); else Res_Bit (Configuration.Port_C, Bit_Number); end if; end if; when 2 => if (Configuration.Mode_B = Mode0 and Configuration.In_Clow) or (Configuration.Mode_B = Mode1 and Configuration.In_B) then if Test_Bit (Value, Bit_Number) then Set_Bit (Configuration.Port_C, Bit_Number); else Res_Bit (Configuration.Port_C, Bit_Number); end if; elsif Configuration.Mode_B = Mode1 and not Configuration.In_B then if Test_Bit (Value, Bit_Number) then Set_Bit (Configuration.Port_C, Bit_Number); Set_Bit (Configuration.Status, Obfb); Set_Bit (Configuration.Port_C, Pc1); Ppi_Out.Transmit_Bit (Configuration.Port_C, Pc1, 'C', Natural (Ppi_Mode'Pos (Configuration.Mode_B)), Natural (Configuration.Identifier), True); if Test_Bit (Configuration.Status, Inteb) then Set_Bit (Configuration.Status, Intrb); Set_Bit (Configuration.Port_C, Pc0); if Configuration.It_Connect then Bus.It_From_Periph (Configuration.Periph_Id, Configuration.Vector); end if; end if; else Res_Bit (Configuration.Port_C, Pc2); end if; end if; when 3 => if Configuration.Mode_A = Mode0 and Configuration.In_Cupper then if Test_Bit (Value, Bit_Number) then Set_Bit (Configuration.Port_C, Bit_Number); else Res_Bit (Configuration.Port_C, Bit_Number); end if; end if; when 4 => if Configuration.Mode_A = Mode2 or (Configuration.Mode_A = Mode1 and Configuration.In_A) or (Configuration.Mode_A = Mode1 and not Configuration.In_A and Configuration.In_Cupper) or (Configuration.Mode_A = Mode0 and Configuration.In_Cupper) then if Test_Bit (Value, Bit_Number) then Set_Bit (Configuration.Port_C, Bit_Number); else Res_Bit (Configuration.Port_C, Bit_Number); end if; end if; when 5 => if (Configuration.Mode_A = Mode0 and Configuration.In_Cupper) or (Configuration.Mode_A = Mode1 and not Configuration.In_A and Configuration.In_Cupper) then if Test_Bit (Value, Bit_Number) then Set_Bit (Configuration.Port_C, Bit_Number); else Res_Bit (Configuration.Port_C, Bit_Number); end if; end if; when 6 => if (Configuration.Mode_A = Mode0 and Configuration.In_Cupper) or (Configuration.Mode_A = Mode1 and Configuration.In_A and Configuration.In_Cupper) then if Test_Bit (Value, Bit_Number) then Set_Bit (Configuration.Port_C, Bit_Number); else Res_Bit (Configuration.Port_C, Bit_Number); end if; elsif Configuration.Mode_A = Mode1 and not Configuration.In_A then if Test_Bit (Value, Pc6) then Set_Bit (Configuration.Port_C, Bit_Number); Set_Bit (Configuration.Status, Obfa); Set_Bit (Configuration.Port_C, Pc7); Ppi_Out.Transmit_Bit (Configuration.Port_C, Pc7, 'C', Natural (Ppi_Mode'Pos (Configuration.Mode_A)), Natural (Configuration.Identifier), True); if Test_Bit (Configuration.Status, Inte1a) then Set_Bit (Configuration.Status, Intra); Set_Bit (Configuration.Port_C, Pc3); if Configuration.It_Connect then Bus.It_From_Periph (Configuration.Periph_Id, Configuration.Vector); end if; end if; else Res_Bit (Configuration.Port_C, Bit_Number); end if; elsif Configuration.Mode_A = Mode2 then if not Test_Bit (Value, Bit_Number) then Res_Bit (Configuration.Port_C, Bit_Number); Ppi_Out.Transmit_Bit (Configuration.Port_A, Full_Transmit, 'A', Natural (Ppi_Mode'Pos (Configuration.Mode_A)), Natural (Configuration.Identifier), True); else Set_Bit (Configuration.Port_C, Bit_Number); Set_Bit (Configuration.Status, Obfa); Set_Bit (Configuration.Port_C, Pc7); Ppi_Out.Transmit_Bit (Configuration.Port_C, Pc7, 'C', Natural (Ppi_Mode'Pos (Configuration.Mode_A)), Natural (Configuration.Identifier), True); if Test_Bit (Configuration.Status, Inte1a) then Set_Bit (Configuration.Status, Intra); Set_Bit (Configuration.Port_C, Pc3); if Configuration.It_Connect then Bus.It_From_Periph (Configuration.Periph_Id, Configuration.Vector); end if; end if; end if; else Erreur.Detectee (Conf_Periph_Error); end if; when 7 => if (Configuration.Mode_A = Mode0 and Configuration.In_Cupper) or (Configuration.Mode_A = Mode1 and Configuration.In_A and Configuration.In_Cupper) then if Test_Bit (Value, Bit_Number) then Set_Bit (Configuration.Port_C, Bit_Number); else Res_Bit (Configuration.Port_C, Bit_Number); end if; end if; when others => null; end case; when 2 => if not Configuration.In_B then Erreur.Detectee (Conf_Periph_Error); elsif Configuration.Mode_B = Mode0 then Configuration.Port_B := Value; elsif not Test_Bit (Configuration.Port_C, Pc2) then Configuration.Port_B := Value; Set_Bit (Configuration.Status, Ibfb); Set_Bit (Configuration.Port_C, Pc1); Ppi_Out.Transmit_Bit (Configuration.Port_C, Pc1, 'C', Natural (Ppi_Mode'Pos (Configuration.Mode_B)), Natural (Configuration.Identifier), False); if Test_Bit (Configuration.Status, Inteb) then Set_Bit (Configuration.Status, Intrb); Set_Bit (Configuration.Port_C, Pc0); if Configuration.It_Connect then Bus.It_From_Periph (Configuration.Periph_Id, Configuration.Vector); end if; end if; end if; when 1 => if (Configuration.Mode_A /= Mode2 and not Configuration.In_A) then Erreur.Detectee (Conf_Write_Error); elsif Configuration.Mode_A = Mode0 then Configuration.Port_A := Value; elsif not Test_Bit (Configuration.Port_C, Pc4) then Configuration.Port_A := Value; Set_Bit (Configuration.Status, Ibfa); Set_Bit (Configuration.Port_C, Pc5); Ppi_Out.Transmit_Bit (Configuration.Port_C, Pc5, 'C', Natural (Ppi_Mode'Pos (Configuration.Mode_A)), Natural (Configuration.Identifier), False); if Test_Bit (Configuration.Status, Inte2a) then Set_Bit (Configuration.Status, Intra); Set_Bit (Configuration.Port_C, Pc3); if Configuration.It_Connect then Bus.It_From_Periph (Configuration.Periph_Id, Configuration.Vector); end if; end if; end if; when others => null; end case; end Receive_From_Periph; procedure Do_Event_Window (Configuration : in out Ppi_Config; Window_Id : Ihm.Window_Id; Window_Enable : in out Boolean; What_Kind : Ihm.Event.Kind; Field_Name : String; Str_Value : String) is Value : Octet.T_Octet; begin case What_Kind is when Ihm.Event.Pushbutton => if Field_Name = Close_Window then Window_Enable := False; end if; when Ihm.Event.Fieldenter => if Field_Name = Control_Field then if Verif_Input.Is_Binary_Byte_Value (Str_Value) then Value := Octet.Convert_String_Binaire (Str_Value); if Octet.Test_Bit (Value, Set_Flag) and Configuration.Control /= Value then Configuration.Control := Value; Configuration.Disp_Cwr := True; Initialize_Ppi (Configuration, Window_Id, Window_Enable); elsif not Octet.Test_Bit (Value, Set_Flag) and Configuration.Setbit /= Value then Configuration.Setbit := Value; Configuration.Disp_Cwr := False; Do_Setbit (Configuration, Window_Id, Window_Enable); end if; else Erreur.Detectee (Bad_Value); Write_Window (Configuration, Window_Id, Window_Enable, Control_Show => True); end if; end if; if Field_Name = Port_A_Field then if Verif_Input.Is_Hexadecimal_Byte_Value (Str_Value) then Value := Octet.Convert_String_Octet (Str_Value); Receive_From_Periph (1, Configuration, Full_Transmit, Value); Write_Window (Configuration, Window_Id, Window_Enable, Status_Show => True, Port_A_Show => True, Port_B_Show => True, Port_C_Show => True); else Erreur.Detectee (Bad_Value); Write_Window (Configuration, Window_Id, Window_Enable, Port_A_Show => True); end if; end if; if Field_Name = Port_B_Field then if Verif_Input.Is_Hexadecimal_Byte_Value (Str_Value) then Value := Octet.Convert_String_Octet (Str_Value); Receive_From_Periph (2, Configuration, Full_Transmit, Value); Write_Window (Configuration, Window_Id, Window_Enable, Status_Show => True, Port_A_Show => True, Port_B_Show => True, Port_C_Show => True); else Erreur.Detectee (Bad_Value); Write_Window (Configuration, Window_Id, Window_Enable, Port_B_Show => True); end if; end if; if Field_Name = Port_C_Field then if Verif_Input.Is_Binary_Byte_Value (Str_Value) then declare Diff_Bit_C : Octet.T_Octet; begin Value := Octet.Convert_String_Binaire (Str_Value); Diff_Bit_C := Octet."xor" (Configuration.Port_C, Value); for I in 0 .. 7 loop if Octet.Test_Bit (Diff_Bit_C, I) then Receive_From_Periph (3, Configuration, I, Value); end if; end loop; Write_Window (Configuration, Window_Id, Window_Enable, Status_Show => True, Port_A_Show => True, Port_B_Show => True, Port_C_Show => True); end; else Erreur.Detectee (Bad_Value); Write_Window (Configuration, Window_Id, Window_Enable, Port_C_Show => True); end if; end if; when others => Erreur.Detectee (Unknown_Event); end case; end Do_Event_Window; task body Ppi_Task is Configuration : Ppi_Config; Register : Natural; Error : Boolean := False; Bit_Num : Natural; The_Value : Octet.T_Octet; Diff_Bit_C : Octet.T_Octet; Window_Enable : Boolean := False; Window_Id : Ihm.Window_Id; begin select accept Init (Periph_Id : Periph.T_Periph_Number; It_Vector : Octet.T_Octet; Basic_Address : Mot.T_Mot; Memory_Mapped : Boolean; It_Connected : Boolean; Identifier : T_Ppi_Number; Number_Of_Register : out Natural) do Number_Of_Register := 4; Configuration.Vector := It_Vector; Configuration.Address := Basic_Address; Configuration.Mem_Mapped := Memory_Mapped; Configuration.It_Connect := It_Connected; Configuration.Identifier := Identifier; Configuration.Periph_Id := Periph_Id; end Init; Reset_Ppi (Configuration, Window_Id, Window_Enable); or terminate; end select; loop select accept Reset do Reset_Ppi (Configuration, Window_Id, Window_Enable); end Reset; or accept Access_Register (Put) (Register_Number : Natural; Value : in out Octet.T_Octet) do Register := Register_Number; case Register is when 1 => if not Configuration.In_A or Configuration.Mode_A = Mode2 then Configuration.Port_A := Value; else Error := True; end if; when 2 => if not Configuration.In_B then Configuration.Port_B := Value; else Error := True; end if; when 3 => Write_C (Configuration, Value, Error); when 4 => if (Octet.Test_Bit (Value, Set_Flag)) then Configuration.Control := Value; Configuration.Disp_Cwr := True; else Configuration.Setbit := Value; Configuration.Disp_Cwr := False; end if; when others => null; end case; end Access_Register; case Register is when 1 => if Error then Erreur.Detectee (Conf_Write_Error); else Port_A_Output (Configuration, Window_Id, Window_Enable); end if; when 2 => if Error then Erreur.Detectee (Conf_Write_Error); else Port_B_Output (Configuration, Window_Id, Window_Enable); end if; when 3 => if Error then Erreur.Detectee (Conf_Write_Error); else Write_Window (Configuration, Window_Id, Window_Enable, Port_C_Show => True); Ppi_Out.Transmit_Bit (Configuration.Port_C, Full_Transmit, 'C', 0, Natural (Configuration.Identifier), True); end if; when 4 => if Configuration.Disp_Cwr then Initialize_Ppi (Configuration, Window_Id, Window_Enable); else Do_Setbit (Configuration, Window_Id, Window_Enable); end if; when others => null; end case; or accept Access_Register (Get) (Register_Number : Natural; Value : in out Octet.T_Octet) do Register := Register_Number; case Register is when 1 => if Configuration.In_A or Configuration.Mode_A = Mode2 then Value := Configuration.Port_A; else Error := True; end if; when 2 => if Configuration.In_B then Value := Configuration.Port_B; else Error := True; end if; when 3 => Read_C (Configuration, Value, Error); when 4 => Error := True; when others => null; end case; end Access_Register; case Register is when 1 => if Error then Erreur.Detectee (Conf_Read_Error); else Port_A_Input (Configuration, Window_Id, Window_Enable); end if; when 2 => if Error then Erreur.Detectee (Conf_Read_Error); else Port_B_Input (Configuration, Window_Id, Window_Enable); end if; when 3 => if Error then Erreur.Detectee (Conf_Read_Error); end if; when 4 => if Error then Erreur.Detectee (Conf_Read_Error); end if; when others => null; end case; or accept Receive (Register_Number : Natural; Value : Octet.T_Octet; Bit_Number : Natural) do Register := Register_Number; Bit_Num := Bit_Number; The_Value := Value; end Receive; if Register = 3 and Bit_Num > 7 then Diff_Bit_C := Octet."xor" (Configuration.Port_C, The_Value); for I in 0 .. 7 loop if Octet.Test_Bit (Diff_Bit_C, I) then Receive_From_Periph (Register, Configuration, I, The_Value); end if; end loop; Write_Window (Configuration, Window_Id, Window_Enable, Status_Show => True, Port_C_Show => True); else Receive_From_Periph (Register, Configuration, Bit_Num, The_Value); Write_Window (Configuration, Window_Id, Window_Enable, Status_Show => True, Port_A_Show => True, Port_B_Show => True, Port_C_Show => True); end if; or accept Kill; exit; or accept Open_Window (Wid : Ihm.Window_Id) do Window_Id := Wid; Window_Enable := True; end Open_Window; Write_Window (Configuration, Window_Id, Window_Enable, Identifier_Show => True, Vector_Show => True, Address_Show => True, Mem_Mapped_Show => True, It_Connect_Show => True, Status_Show => True, Control_Show => True, Mode_A_Show => True, Mode_B_Show => True, In_A_Show => True, In_B_Show => True, In_Clow_Show => True, In_Cupper_Show => True, Port_A_Show => True, Port_B_Show => True, Port_C_Show => True); or accept Do_Event (What_Kind : Ihm.Event.Kind; Field_Name : String; Value : String) do if Window_Enable then Do_Event_Window (Configuration, Window_Id, Window_Enable, What_Kind, Field_Name, Value); end if; end Do_Event; or terminate; end select; Error := False; end loop; end Ppi_Task; end Ppi_Pack;