Kyösti Mälkki | e2227a2 | 2014-02-05 13:02:55 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2007 AMD |
| 5 | * Written by Yinghai Lu <yinghai.lu@amd.com> for AMD. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | #ifndef _CONSOLE_USB_H_ |
| 22 | #define _CONSOLE_USB_H_ |
| 23 | |
Kyösti Mälkki | f339086 | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 24 | #include <rules.h> |
| 25 | #include <stdint.h> |
| 26 | |
Kyösti Mälkki | e2227a2 | 2014-02-05 13:02:55 +0200 | [diff] [blame] | 27 | int usbdebug_init(void); |
| 28 | |
Kyösti Mälkki | ea6736a | 2014-02-10 00:00:44 +0200 | [diff] [blame] | 29 | void usb_tx_byte(int idx, unsigned char data); |
| 30 | void usb_tx_flush(int idx); |
| 31 | unsigned char usb_rx_byte(int idx); |
| 32 | int usb_can_rx_byte(int idx); |
Kyösti Mälkki | e2227a2 | 2014-02-05 13:02:55 +0200 | [diff] [blame] | 33 | |
Kyösti Mälkki | f339086 | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 34 | #define __CONSOLE_USB_ENABLE__ CONFIG_CONSOLE_USB && \ |
| 35 | ((ENV_ROMSTAGE && CONFIG_USBDEBUG_IN_ROMSTAGE) || ENV_RAMSTAGE) |
| 36 | |
| 37 | #if __CONSOLE_USB_ENABLE__ |
| 38 | static inline void __usbdebug_init(void) { usbdebug_init(); } |
| 39 | static inline void __usb_tx_byte(u8 data) { usb_tx_byte(0, data); } |
| 40 | static inline void __usb_tx_flush(void) { usb_tx_flush(0); } |
| 41 | #else |
| 42 | static inline void __usbdebug_init(void) {} |
| 43 | static inline void __usb_tx_byte(u8 data) {} |
| 44 | static inline void __usb_tx_flush(void) {} |
| 45 | #endif |
| 46 | |
Kyösti Mälkki | e2227a2 | 2014-02-05 13:02:55 +0200 | [diff] [blame] | 47 | #endif /* _CONSOLE_USB_H_ */ |