blob: 997fe185cea3f501f71bd7e9b09bbd675e7bca7b [file] [log] [blame]
Stefan Reinauer509f7722012-12-07 17:31:37 -08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2012 The ChromiumOS Authors. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Stefan Reinauer509f7722012-12-07 17:31:37 -080018 */
19
20#ifndef UART_H
21#define UART_H
22
Kyösti Mälkki3ee16682014-02-17 19:37:52 +020023/* Return the clock frequency UART uses as reference clock for
24 * baudrate generator. */
25unsigned int uart_platform_refclk(void);
26
27/* Return the baudrate determined from option_table, or when that is
28 * not used, CONFIG_TTYS0_BAUD.
29 */
30unsigned int default_baudrate(void);
31
32/* Returns the divisor value for a given baudrate.
33 * The formula to satisfy is:
34 * refclk / divisor = baudrate * oversample
35 */
36unsigned int uart_baudrate_divisor(unsigned int baudrate,
37 unsigned int refclk, unsigned int oversample);
38
39
Stefan Reinauer509f7722012-12-07 17:31:37 -080040unsigned char uart_rx_byte(void);
41void uart_tx_byte(unsigned char data);
42void uart_tx_flush(void);
Hung-Te Linb868d402013-02-06 22:01:18 +080043void uart_init(void);
Stefan Reinauer509f7722012-12-07 17:31:37 -080044
David Hendricksfdcef1a2013-02-15 19:29:12 -080045uint32_t uartmem_getbaseaddr(void);
David Hendricksfdcef1a2013-02-15 19:29:12 -080046
Stefan Reinauer509f7722012-12-07 17:31:37 -080047#endif /* UART_H */