blob: 78359cd50b8071519f3834a71da86b77d1a10ee1 [file] [log] [blame]
Nico Huberc83239e2016-10-05 17:46:49 +02001--
2-- This file is part of the coreboot project.
3--
Nico Huberc83239e2016-10-05 17:46:49 +02004-- This program is free software; you can redistribute it and/or modify
5-- it under the terms of the GNU General Public License as published by
6-- the Free Software Foundation; version 2 of the License.
7--
8-- This program is distributed in the hope that it will be useful,
9-- but WITHOUT ANY WARRANTY; without even the implied warranty of
10-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11-- GNU General Public License for more details.
12--
13
14with Interfaces.C;
15
16use type Interfaces.C.int;
17
18package body HW.Debug_Sink is
19
Nico Huber4a00ccc2018-06-04 15:10:54 +020020 function console_log_level
21 (msg_level : Interfaces.C.int)
22 return Interfaces.C.int;
23 pragma Import (C, console_log_level, "console_log_level");
24
25 Msg_Level_BIOS_DEBUG : constant := 7;
Nico Huberc83239e2016-10-05 17:46:49 +020026
27 procedure console_tx_byte (chr : Interfaces.C.char);
28 pragma Import (C, console_tx_byte, "console_tx_byte");
29
30 procedure Put (Item : String) is
31 begin
Nico Huber4a00ccc2018-06-04 15:10:54 +020032 if console_log_level (Msg_Level_BIOS_DEBUG) /= 0 then
Nico Huberc83239e2016-10-05 17:46:49 +020033 for Idx in Item'Range loop
34 console_tx_byte (Interfaces.C.To_C (Item (Idx)));
35 end loop;
36 end if;
37 end Put;
38
39 procedure Put_Char (Item : Character) is
40 begin
Nico Huber4a00ccc2018-06-04 15:10:54 +020041 if console_log_level (Msg_Level_BIOS_DEBUG) /= 0 then
Nico Huberc83239e2016-10-05 17:46:49 +020042 console_tx_byte (Interfaces.C.To_C (Item));
43 end if;
44 end Put_Char;
45
46 procedure New_Line is
47 begin
48 Put_Char (Character'Val (16#0a#));
49 end New_Line;
50
Nico Huberc83239e2016-10-05 17:46:49 +020051end HW.Debug_Sink;