File : s-textio-p2020.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) 1992-2013, Free Software Foundation, Inc. --
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 with System;
33
34 with Interfaces;
35
36 with System.BB.Board_Parameters;
37
38 package body System.Text_IO is
39 use Interfaces;
40
41 Uthr : Character;
42 for Uthr'Address use
43 System.BB.Board_Parameters.CCSRBAR + 16#4500#;
44 pragma Import (Ada, Uthr);
45 pragma Volatile (Uthr);
46
47 Ulsr : Unsigned_8;
48 for Ulsr'Address use
49 System.BB.Board_Parameters.CCSRBAR + 16#4505#;
50 pragma Import (Ada, Ulsr);
51 pragma Volatile (Ulsr);
52
53 Dr : constant Unsigned_8 := 2#0000_0001#;
54 Thre : constant Unsigned_8 := 2#0010_0000#;
55 -- Ulsr bits
56
57 ---------
58 -- Get --
59 ---------
60
61 function Get return Character is
62 begin
63 return Uthr;
64 end Get;
65
66 ----------------
67 -- Initialize --
68 ----------------
69
70 procedure Initialize is
71 begin
72 Initialized := True;
73 end Initialize;
74
75 -----------------
76 -- Is_Rx_Ready --
77 -----------------
78
79 function Is_Rx_Ready return Boolean is
80 begin
81 return (Ulsr and Dr) /= 0;
82 end Is_Rx_Ready;
83
84 -----------------
85 -- Is_Tx_Ready --
86 -----------------
87
88 function Is_Tx_Ready return Boolean is
89 begin
90 return (Ulsr and Thre) /= 0;
91 end Is_Tx_Ready;
92
93 ---------
94 -- Put --
95 ---------
96
97 procedure Put (C : Character) is
98 begin
99 -- Send the character
100
101 Uthr := C;
102 end Put;
103
104 ----------------------------
105 -- Use_Cr_Lf_For_New_Line --
106 ----------------------------
107
108 function Use_Cr_Lf_For_New_Line return Boolean is
109 begin
110 return True;
111 end Use_Cr_Lf_For_New_Line;
112
113 end System.Text_IO;