blob: 4331b875495fd65fad04584e82781bb8e3304ff7 [file] [log] [blame]
Nico Huberc83239e2016-10-05 17:46:49 +02001--
2-- This file is part of the coreboot project.
3--
4-- Copyright (C) 2015 secunet Security Networks AG
5--
6-- This program is free software; you can redistribute it and/or modify
7-- it under the terms of the GNU General Public License as published by
8-- the Free Software Foundation; version 2 of the License.
9--
10-- This program is distributed in the hope that it will be useful,
11-- but WITHOUT ANY WARRANTY; without even the implied warranty of
12-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-- GNU General Public License for more details.
14--
15
16with Interfaces.C;
17
18use type Interfaces.C.int;
19
20package body HW.Debug_Sink is
21
Nico Huber4a00ccc2018-06-04 15:10:54 +020022 function console_log_level
23 (msg_level : Interfaces.C.int)
24 return Interfaces.C.int;
25 pragma Import (C, console_log_level, "console_log_level");
26
27 Msg_Level_BIOS_DEBUG : constant := 7;
Nico Huberc83239e2016-10-05 17:46:49 +020028
29 procedure console_tx_byte (chr : Interfaces.C.char);
30 pragma Import (C, console_tx_byte, "console_tx_byte");
31
32 procedure Put (Item : String) is
33 begin
Nico Huber4a00ccc2018-06-04 15:10:54 +020034 if console_log_level (Msg_Level_BIOS_DEBUG) /= 0 then
Nico Huberc83239e2016-10-05 17:46:49 +020035 for Idx in Item'Range loop
36 console_tx_byte (Interfaces.C.To_C (Item (Idx)));
37 end loop;
38 end if;
39 end Put;
40
41 procedure Put_Char (Item : Character) is
42 begin
Nico Huber4a00ccc2018-06-04 15:10:54 +020043 if console_log_level (Msg_Level_BIOS_DEBUG) /= 0 then
Nico Huberc83239e2016-10-05 17:46:49 +020044 console_tx_byte (Interfaces.C.To_C (Item));
45 end if;
46 end Put_Char;
47
48 procedure New_Line is
49 begin
50 Put_Char (Character'Val (16#0a#));
51 end New_Line;
52
Nico Huberc83239e2016-10-05 17:46:49 +020053end HW.Debug_Sink;