summaryrefslogtreecommitdiff
path: root/src/include/console
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/console')
-rw-r--r--src/include/console/streams.h6
-rw-r--r--src/include/console/uart.h8
-rw-r--r--src/include/console/usb.h16
3 files changed, 28 insertions, 2 deletions
diff --git a/src/include/console/streams.h b/src/include/console/streams.h
index 9d4d3fcc6b..fb168da905 100644
--- a/src/include/console/streams.h
+++ b/src/include/console/streams.h
@@ -22,6 +22,12 @@ void console_hw_init(void);
void console_tx_byte(unsigned char byte);
void console_tx_flush(void);
+/* For remote GDB debugging. */
+void gdb_hw_init(void);
+void gdb_tx_byte(unsigned char byte);
+void gdb_tx_flush(void);
+unsigned char gdb_rx_byte(void);
+
/* Helpers for ROMCC console. */
void console_tx_nibble(unsigned nibble);
void console_tx_hex8(unsigned char value);
diff --git a/src/include/console/uart.h b/src/include/console/uart.h
index b08cd9b4f1..d4020c3aa0 100644
--- a/src/include/console/uart.h
+++ b/src/include/console/uart.h
@@ -69,6 +69,14 @@ static inline void __uart_tx_byte(u8 data) {}
static inline void __uart_tx_flush(void) {}
#endif
+#if CONFIG_GDB_STUB && (ENV_ROMSTAGE || ENV_RAMSTAGE)
+#define CONFIG_UART_FOR_GDB CONFIG_UART_FOR_CONSOLE
+static inline void __gdb_hw_init(void) { uart_init(CONFIG_UART_FOR_GDB); }
+static inline void __gdb_tx_byte(u8 data) { uart_tx_byte(CONFIG_UART_FOR_GDB, data); }
+static inline void __gdb_tx_flush(void) { uart_tx_flush(CONFIG_UART_FOR_GDB); }
+static inline u8 __gdb_rx_byte(void) { return uart_rx_byte(CONFIG_UART_FOR_GDB); }
+#endif
+
#endif /* __ROMCC__ */
#endif /* CONSOLE_UART_H */
diff --git a/src/include/console/usb.h b/src/include/console/usb.h
index 57ea4eb3df..b5aab66649 100644
--- a/src/include/console/usb.h
+++ b/src/include/console/usb.h
@@ -34,14 +34,26 @@ int usb_can_rx_byte(int idx);
#define __CONSOLE_USB_ENABLE__ CONFIG_CONSOLE_USB && \
((ENV_ROMSTAGE && CONFIG_USBDEBUG_IN_ROMSTAGE) || ENV_RAMSTAGE)
+#define USB_PIPE_FOR_CONSOLE 0
+#define USB_PIPE_FOR_GDB 0
+
#if __CONSOLE_USB_ENABLE__
static inline void __usbdebug_init(void) { usbdebug_init(); }
-static inline void __usb_tx_byte(u8 data) { usb_tx_byte(0, data); }
-static inline void __usb_tx_flush(void) { usb_tx_flush(0); }
+static inline void __usb_tx_byte(u8 data) { usb_tx_byte(USB_PIPE_FOR_CONSOLE, data); }
+static inline void __usb_tx_flush(void) { usb_tx_flush(USB_PIPE_FOR_CONSOLE); }
#else
static inline void __usbdebug_init(void) {}
static inline void __usb_tx_byte(u8 data) {}
static inline void __usb_tx_flush(void) {}
#endif
+/* */
+#if 0 && CONFIG_GDB_STUB && \
+ ((ENV_ROMSTAGE && CONFIG_USBDEBUG_IN_ROMSTAGE) || ENV_RAMSTAGE)
+static inline void __gdb_hw_init(void) { usbdebug_init(); }
+static inline void __gdb_tx_byte(u8 data) { usb_tx_byte(USB_PIPE_FOR_GDB, data); }
+static inline void __gdb_tx_flush(void) { usb_tx_flush(USB_PIPE_FOR_GDB); }
+static inline u8 __gdb_rx_byte(void) { return usb_rx_byte(USB_PIPE_FOR_GDB); }
+#endif
+
#endif /* _CONSOLE_USB_H_ */