blob: c67144d03941a1ebf55ea814f0dc238470d4bc8a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2007 AMD
* Written by Yinghai Lu <yinghai.lu@amd.com> for AMD.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _CONSOLE_USB_H_
#define _CONSOLE_USB_H_
#include <rules.h>
#include <stdint.h>
int usbdebug_init(void);
void usb_tx_byte(int idx, unsigned char data);
void usb_tx_flush(int idx);
unsigned char usb_rx_byte(int idx);
int usb_can_rx_byte(int idx);
#define __CONSOLE_USB_ENABLE__ (IS_ENABLED(CONFIG_CONSOLE_USB) && \
((ENV_ROMSTAGE && IS_ENABLED(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(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 && IS_ENABLED(CONFIG_GDB_STUB) && \
((ENV_ROMSTAGE && IS_ENABLED(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_ */
|