1 -- SPDX-License-Identifier: GPL-2.0-only
7 use type Interfaces
.C
.int
;
9 package body HW
.Debug_Sink
is
11 function console_log_level
12 (msg_level
: Interfaces
.C
.int
)
13 return Interfaces
.C
.int
;
14 pragma Import
(C
, console_log_level
, "console_log_level");
16 Msg_Level_BIOS_DEBUG
: constant := 7;
18 CONSOLE_LOG_FAST
: constant := 1;
19 CONSOLE_LOG_ALL
: constant := 2;
21 procedure cbmemc_tx_byte
(chr
: Interfaces
.C
.char
);
22 pragma Import
(C
, cbmemc_tx_byte
, "cbmemc_tx_byte");
24 procedure console_tx_byte
(chr
: Interfaces
.C
.char
);
25 pragma Import
(C
, console_tx_byte
, "console_tx_byte");
27 procedure Put
(Item
: String)
29 console_log
: constant Interfaces
.C
.int
:=
30 console_log_level
(Msg_Level_BIOS_DEBUG
);
32 if console_log
= CONSOLE_LOG_FAST
then
33 if Config
.CONSOLE_CBMEM
then
34 for Idx
in Item
'Range loop
35 cbmemc_tx_byte
(Interfaces
.C
.To_C
(Item
(Idx
)));
38 elsif console_log
= CONSOLE_LOG_ALL
then
39 for Idx
in Item
'Range loop
40 console_tx_byte
(Interfaces
.C
.To_C
(Item
(Idx
)));
45 procedure Put_Char
(Item
: Character)
47 console_log
: constant Interfaces
.C
.int
:=
48 console_log_level
(Msg_Level_BIOS_DEBUG
);
50 if console_log
= CONSOLE_LOG_FAST
then
51 if Config
.CONSOLE_CBMEM
then
52 cbmemc_tx_byte
(Interfaces
.C
.To_C
(Item
));
54 elsif console_log
= CONSOLE_LOG_ALL
then
55 console_tx_byte
(Interfaces
.C
.To_C
(Item
));
61 Put_Char
(Character'Val (16#
0a#
));