blob: 57ea4eb3dfc9b00de3ecde29f72da2b3eb55b91d [file] [log] [blame]
Kyösti Mälkkie2227a22014-02-05 13:02:55 +02001/*
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älkkif3390862014-02-26 15:19:04 +020024#include <rules.h>
25#include <stdint.h>
26
Kyösti Mälkkie2227a22014-02-05 13:02:55 +020027int usbdebug_init(void);
28
Kyösti Mälkkiea6736a2014-02-10 00:00:44 +020029void usb_tx_byte(int idx, unsigned char data);
30void usb_tx_flush(int idx);
31unsigned char usb_rx_byte(int idx);
32int usb_can_rx_byte(int idx);
Kyösti Mälkkie2227a22014-02-05 13:02:55 +020033
Kyösti Mälkkif3390862014-02-26 15:19:04 +020034#define __CONSOLE_USB_ENABLE__ CONFIG_CONSOLE_USB && \
35 ((ENV_ROMSTAGE && CONFIG_USBDEBUG_IN_ROMSTAGE) || ENV_RAMSTAGE)
36
37#if __CONSOLE_USB_ENABLE__
38static inline void __usbdebug_init(void) { usbdebug_init(); }
39static inline void __usb_tx_byte(u8 data) { usb_tx_byte(0, data); }
40static inline void __usb_tx_flush(void) { usb_tx_flush(0); }
41#else
42static inline void __usbdebug_init(void) {}
43static inline void __usb_tx_byte(u8 data) {}
44static inline void __usb_tx_flush(void) {}
45#endif
46
Kyösti Mälkkie2227a22014-02-05 13:02:55 +020047#endif /* _CONSOLE_USB_H_ */