File : s-textio-tms570.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 -- Minimal version of Text_IO body for use on LEON3, writes to the ARM Debug
33 -- Control Channel (DCC)
34
35 with System.Machine_Code; use System.Machine_Code;
36 package body System.Text_IO is
37
38 type Word is mod 2**32;
39
40 function Read_DCSR return Word;
41 -- Read status register for debugger communication
42
43 ---------
44 -- Get --
45 ---------
46
47 function Get return Character is
48 C : Character;
49 begin
50 Asm ("mrc p14, 0, %0, c0, c5",
51 Outputs => (Character'Asm_Output ("=r", C)),
52 Volatile => True);
53
54 return C;
55 end Get;
56
57 ----------------
58 -- Initialize --
59 ----------------
60
61 procedure Initialize is
62 begin
63 Initialized := True;
64 end Initialize;
65
66 -----------------
67 -- Is_Tx_Ready --
68 -----------------
69
70 function Is_Tx_Ready return Boolean is
71 ((Read_DCSR and 2**29) = 0);
72
73 -----------------
74 -- Is_Rx_Ready --
75 -----------------
76
77 function Is_Rx_Ready return Boolean is
78 ((Read_DCSR and 2**30) /= 0);
79
80 ---------
81 -- Put --
82 ---------
83
84 procedure Put (C : Character) is
85 begin
86 Asm ("mcr p14, 0, %0, c0, c5",
87 Inputs => (Word'Asm_Input ("r", Word (Character'Pos (C)))),
88 Volatile => True);
89 end Put;
90
91 ---------------
92 -- Read_DCSR --
93 ---------------
94
95 function Read_DCSR return Word is
96 R : Word;
97 begin
98 Asm ("mrc p14, 0, %0, c0, c1",
99 Outputs => (Word'Asm_Output ("=r", R)),
100 Volatile => True);
101 return R;
102 end Read_DCSR;
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 end System.Text_IO;