1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 3 #ifndef _CONSOLE_USB_H_ 4 #define _CONSOLE_USB_H_ 5 6 #include <types.h> 7 8 void usbdebug_init(void); 9 int usbdebug_hw_init(bool force); 10 11 void usb_tx_byte(int idx, unsigned char data); 12 void usb_tx_flush(int idx); 13 unsigned char usb_rx_byte(int idx); 14 int usb_can_rx_byte(int idx); 15 16 #define __CONSOLE_USB_ENABLE__ (CONFIG(CONSOLE_USB) && \ 17 ((ENV_BOOTBLOCK && CONFIG(USBDEBUG_IN_PRE_RAM)) || \ 18 (ENV_SEPARATE_ROMSTAGE && CONFIG(USBDEBUG_IN_PRE_RAM)) || \ 19 (ENV_POSTCAR && CONFIG(USBDEBUG_IN_PRE_RAM)) || \ 20 (ENV_SEPARATE_VERSTAGE && CONFIG(USBDEBUG_IN_PRE_RAM)) || \ 21 ENV_RAMSTAGE)) 22 23 #define USB_PIPE_FOR_CONSOLE 0 24 #define USB_PIPE_FOR_GDB 0 25 26 #if __CONSOLE_USB_ENABLE__ __usbdebug_init(void)27static inline void __usbdebug_init(void) { usbdebug_init(); } __usb_tx_byte(u8 data)28static inline void __usb_tx_byte(u8 data) 29 { 30 usb_tx_byte(USB_PIPE_FOR_CONSOLE, data); 31 } __usb_tx_flush(void)32static inline void __usb_tx_flush(void) { usb_tx_flush(USB_PIPE_FOR_CONSOLE); } 33 #else __usbdebug_init(void)34static inline void __usbdebug_init(void) {} __usb_tx_byte(u8 data)35static inline void __usb_tx_byte(u8 data) {} __usb_tx_flush(void)36static inline void __usb_tx_flush(void) {} 37 #endif 38 39 #endif /* _CONSOLE_USB_H_ */ 40