Remove address from GPLv2 headers
[coreboot.git] / src / console / early_print.c
blob978cae92069bcb0171fc01cb48e34dcbcd5aebc3
1 /*
2 * This file is part of the coreboot project.
4 * 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.
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.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc.
18 #include <console/streams.h>
20 void console_tx_nibble(unsigned nibble)
22 unsigned char digit;
23 digit = nibble + '0';
24 if (digit > '9') {
25 digit += 39;
27 console_tx_byte(digit);
30 void console_tx_hex8(unsigned char value)
32 console_tx_nibble((value >> 4U) & 0x0fU);
33 console_tx_nibble(value & 0x0fU);
36 void console_tx_hex16(unsigned short value)
38 console_tx_nibble((value >> 12U) & 0x0fU);
39 console_tx_nibble((value >> 8U) & 0x0fU);
40 console_tx_nibble((value >> 4U) & 0x0fU);
41 console_tx_nibble(value & 0x0fU);
44 void console_tx_hex32(unsigned int value)
46 console_tx_nibble((value >> 28U) & 0x0fU);
47 console_tx_nibble((value >> 24U) & 0x0fU);
48 console_tx_nibble((value >> 20U) & 0x0fU);
49 console_tx_nibble((value >> 16U) & 0x0fU);
50 console_tx_nibble((value >> 12U) & 0x0fU);
51 console_tx_nibble((value >> 8U) & 0x0fU);
52 console_tx_nibble((value >> 4U) & 0x0fU);
53 console_tx_nibble(value & 0x0fU);
56 void console_tx_string(const char *str)
58 unsigned char ch;
59 while((ch = *str++) != '\0') {
60 if (ch == '\n')
61 console_tx_byte('\r');
62 console_tx_byte(ch);