| 1 |
|
| 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__ |
| 27 |
static inline void __usbdebug_init(void) { usbdebug_init(); } |
| 28 |
static inline void __usb_tx_byte(u8 data) |
| 29 |
{ |
| 30 |
usb_tx_byte(USB_PIPE_FOR_CONSOLE, data); |
| 31 |
} |
| 32 |
static inline void __usb_tx_flush(void) { usb_tx_flush(USB_PIPE_FOR_CONSOLE); } |
| 33 |
#else |
| 34 |
static inline void __usbdebug_init(void) {} |
| 35 |
static inline void __usb_tx_byte(u8 data) {} |
| 36 |
static inline void __usb_tx_flush(void) {} |
| 37 |
#endif |
| 38 |
|
| 39 |
#endif |