with Cursor, DC_Bits, DC_Char, DC_Comm, DC_Errr, DC_Intr, DC_Keyb, DC_Scrn, System; procedure CommTest is --------------------------------------------------------------------------- --------------------------------------------------------------------------- Com_Index : array ( DC_Comm.Com1..DC_Comm.Com2 ) of integer := ( 1, 1 ); Com_Index_Max: constant integer := 80; Com_Input : array ( DC_Comm.Com1..DC_Comm.Com2 ) of string ( 1..Com_Index_Max ); task Testing is pragma priority (3); entry Entry_Com1; entry Entry_Com2; for Entry_Com1 use at DC_Intr.Int_Com1; for Entry_Com2 use at DC_Intr.Int_Com2; end Testing; task Enable_Ints_When_Ready is pragma priority (2); entry Enable ( Port: in DC_Comm.Port_Type ); end Enable_Ints_When_Ready; task Display is pragma priority (1); end; procedure Read_Port ( Port: in DC_Comm.Port_Type ) is --------------------------------------------------------------------------- -- Reads character and puts it in Com_Input(Port) then enables interrupts. --------------------------------------------------------------------------- begin if Com_Index ( Port ) = Com_Index_Max then Com_Index ( Port ) := 1; else Com_Index ( Port ) := Com_Index ( Port ) + 1; end if; Com_Input ( Port ) ( Com_Index ( Port ) ) := DC_Char.Filter ( character'val ( DC_Bits.Clear_Bits ( DC_Comm.Get_RDR ( Port ), DC_Bits.Bit7 ) ) ); Enable_Ints_When_Ready.Enable ( Port ); end Read_Port; task body Testing is --------------------------------------------------------------------------- begin loop select accept Entry_Com1 do Read_Port ( DC_Comm.Com1 ); end Entry_Com1; or accept Entry_Com2 do Read_Port ( DC_Comm.Com2 ); end Entry_Com2; end select; end loop; end Testing; task body Enable_Ints_When_Ready is --------------------------------------------------------------------------- PIC_Level: DC_Intr.PIC_Level_Type; begin loop accept Enable ( Port: in DC_Comm.Port_Type ) do case Port is when DC_Comm.Com1 => PIC_Level := DC_Intr.PIC_Com1; when DC_Comm.Com2 => PIC_Level := DC_Intr.PIC_Com2; when DC_Comm.Com3 => PIC_Level := DC_Intr.PIC_Com3; when DC_Comm.Com4 => PIC_Level := DC_Intr.PIC_Com4; end case; end Enable; DC_Intr.PIC_8259_EOI ( PIC_Level ); end loop; end Enable_Ints_When_Ready; task body Display is --------------------------------------------------------------------------- begin loop -- DC_Comm.Setup ( Port => DC_Comm.Com1, BPS => 9600 ); DC_Comm.Setup ( Port => DC_Comm.Com2, BPS => 1200 ); -- DC_Comm.Interrupt_Handling ( DC_Comm.Com1, true ); DC_Comm.Interrupt_Handling ( DC_Comm.Com2, true ); DC_Scrn.ClrScr; for index in 1..99 loop Cursor.Move ( 0, 0 ); -- DC_Comm.Registers_Display ( DC_Comm.Registers_Fetch ( DC_Comm.Com1)); DC_Comm.Registers_Display ( DC_Comm.Registers_Fetch ( DC_Comm.Com2)); ---- DC_Intr.PIC_8259_Show; -- DC_Scrn.Put ( Com_Input ( DC_Comm.Com1 ) -- ( Com_Index ( DC_Comm.Com1 ) ) & " " ); -- DC_Scrn.Put_Line ( "Com_Index ( Com1 ): " -- & integer'image ( Com_Index ( DC_Comm.Com1 ) ) ); DC_Scrn.Put ( Com_Input ( DC_Comm.Com2 ) ( Com_Index ( DC_Comm.Com2 ) ) & " " ); DC_Scrn.Put_Line ( "Com_Index ( Com2 ): " & integer'image ( Com_Index ( DC_Comm.Com2 ) ) ); end loop; -- DC_Intr.PIC_8259_EOI ( DC_Intr.PIC_Com1 ); DC_Intr.PIC_8259_EOI ( DC_Intr.PIC_Com2 ); -- DC_Comm.Interrupt_Handling ( DC_Comm.Com1, false ); DC_Comm.Interrupt_Handling ( DC_Comm.Com2, false ); DC_Keyb.Pause; end loop; exception when others => DC_Errr.Notify ( "Display" ); DC_Scrn.Put ( "Aborting..." ); DC_Comm.Interrupt_Handling ( DC_Comm.Com1, false ); DC_Comm.Interrupt_Handling ( DC_Comm.Com2, false ); abort Testing; abort Enable_Ints_When_Ready; DC_Scrn.Put_Line ( "done." ); end Display; --------------------------------------------------------------------------- --------------------------------------------------------------------------- begin null; end CommTest;