File : s-textio-prep.adb
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- S Y S T E M . T E X T _ I O --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 2010-2012, AdaCore --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- --
19 -- --
20 -- --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
31
32 -- Minimal output procedure
33
34 with System.IOPorts; use System.IOPorts;
35
36 with Interfaces; use Interfaces;
37
38 package body System.Text_IO is
39
40 Uthr : constant Port_Id := 16#3f8# + 0;
41 Ulsr : constant Port_Id := 16#3f8# + 5;
42
43 Dr : constant Unsigned_8 := 2#0000_0001#;
44 Thre : constant Unsigned_8 := 2#0010_0000#;
45
46 ---------
47 -- Get --
48 ---------
49
50 function Get return Character is
51 begin
52 return Character'Val (Inb (Uthr));
53 end Get;
54
55 ----------------
56 -- Initialize --
57 ----------------
58
59 procedure Initialize is
60 begin
61 Initialized := True;
62 end Initialize;
63
64 -----------------
65 -- Is_Rx_Ready --
66 -----------------
67
68 function Is_Rx_Ready return Boolean is
69 begin
70 return (Inb (Ulsr) and Dr) /= 0;
71 end Is_Rx_Ready;
72
73 -----------------
74 -- Is_Tx_Ready --
75 -----------------
76
77 function Is_Tx_Ready return Boolean is
78 begin
79 return (Inb (Ulsr) and Thre) /= 0;
80 end Is_Tx_Ready;
81
82 ---------
83 -- Put --
84 ---------
85
86 procedure Put (C : Character) is
87 begin
88 Outb (Uthr, Character'Pos (C));
89 end Put;
90
91 ----------------------------
92 -- Use_Cr_Lf_For_New_Line --
93 ----------------------------
94
95 function Use_Cr_Lf_For_New_Line return Boolean is
96 begin
97 return False;
98 end Use_Cr_Lf_For_New_Line;
99
100 end System.Text_IO;