| 1 |
|
| 2 |
|
| 3 |
#include <console/cbmem_console.h> |
| 4 |
#include <console/flash.h> |
| 5 |
#include <console/i2c_smbus.h> |
| 6 |
#include <console/ne2k.h> |
| 7 |
#include <console/qemu_debugcon.h> |
| 8 |
#include <console/simnow.h> |
| 9 |
#include <console/spi.h> |
| 10 |
#include <console/spkmodem.h> |
| 11 |
#include <console/streams.h> |
| 12 |
#include <console/system76_ec.h> |
| 13 |
#include <console/uart.h> |
| 14 |
#include <console/usb.h> |
| 15 |
#include <types.h> |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
void console_hw_init(void) |
| 20 |
{ |
| 21 |
__cbmemc_init(); |
| 22 |
__spkmodem_init(); |
| 23 |
__qemu_debugcon_init(); |
| 24 |
|
| 25 |
__uart_init(); |
| 26 |
__ne2k_init(); |
| 27 |
__usbdebug_init(); |
| 28 |
__spiconsole_init(); |
| 29 |
__flashconsole_init(); |
| 30 |
__system76_ec_init(); |
| 31 |
__i2c_smbus_console_init(); |
| 32 |
__simnow_console_init(); |
| 33 |
} |
| 34 |
|
| 35 |
void console_interactive_tx_byte(unsigned char byte, void *data_unused) |
| 36 |
{ |
| 37 |
if (byte == '\n') { |
| 38 |
|
| 39 |
__uart_tx_byte('\r'); |
| 40 |
__usb_tx_byte('\r'); |
| 41 |
__i2c_smbus_console_tx_byte('\r'); |
| 42 |
} |
| 43 |
|
| 44 |
__spkmodem_tx_byte(byte); |
| 45 |
__qemu_debugcon_tx_byte(byte); |
| 46 |
__uart_tx_byte(byte); |
| 47 |
__ne2k_tx_byte(byte); |
| 48 |
__usb_tx_byte(byte); |
| 49 |
__spiconsole_tx_byte(byte); |
| 50 |
__system76_ec_tx_byte(byte); |
| 51 |
__i2c_smbus_console_tx_byte(byte); |
| 52 |
__simnow_console_tx_byte(byte); |
| 53 |
} |
| 54 |
|
| 55 |
void console_stored_tx_byte(unsigned char byte, void *data_unused) |
| 56 |
{ |
| 57 |
__flashconsole_tx_byte(byte); |
| 58 |
__cbmemc_tx_byte(byte); |
| 59 |
} |
| 60 |
|
| 61 |
void console_tx_byte(unsigned char byte) |
| 62 |
{ |
| 63 |
console_interactive_tx_byte(byte, NULL); |
| 64 |
console_stored_tx_byte(byte, NULL); |
| 65 |
} |
| 66 |
|
| 67 |
void console_tx_flush(void) |
| 68 |
{ |
| 69 |
__uart_tx_flush(); |
| 70 |
__ne2k_tx_flush(); |
| 71 |
__usb_tx_flush(); |
| 72 |
__flashconsole_tx_flush(); |
| 73 |
__system76_ec_tx_flush(); |
| 74 |
} |
| 75 |
|
| 76 |
void console_write_line(uint8_t *buffer, size_t number_of_bytes) |
| 77 |
{ |
| 78 |
|
| 79 |
if (number_of_bytes == 0) { |
| 80 |
console_tx_flush(); |
| 81 |
return; |
| 82 |
} |
| 83 |
|
| 84 |
|
| 85 |
while (number_of_bytes--) |
| 86 |
console_tx_byte(*buffer++); |
| 87 |
} |
| 88 |
|
| 89 |
#if CONFIG(GDB_STUB) && (ENV_ROMSTAGE_OR_BEFORE || ENV_RAMSTAGE) |
| 90 |
void gdb_hw_init(void) |
| 91 |
{ |
| 92 |
__gdb_hw_init(); |
| 93 |
} |
| 94 |
|
| 95 |
void gdb_tx_byte(unsigned char byte) |
| 96 |
{ |
| 97 |
__gdb_tx_byte(byte); |
| 98 |
} |
| 99 |
|
| 100 |
void gdb_tx_flush(void) |
| 101 |
{ |
| 102 |
__gdb_tx_flush(); |
| 103 |
} |
| 104 |
|
| 105 |
unsigned char gdb_rx_byte(void) |
| 106 |
{ |
| 107 |
return __gdb_rx_byte(); |
| 108 |
} |
| 109 |
#endif |