1/*
2 * Copyright (c) 2016, ETH Zurich.
3 * All rights reserved.
4 *
5 * This file is distributed under the terms in the attached LICENSE file.
6 * If you do not find this file, copies can be found by writing to:
7 * ETH Zurich D-INFK, Universitaetstr 6, CH-8092 Zurich. Attn: Systems Group.
8 */
9
10#ifndef __ZYNQ_UART_H__
11#define __ZYNQ_UART_H__
12
13#include <barrelfish_kpi/types.h>
14#include <stdbool.h>
15
16#define ZYNQ_UART_MAX_PORTS 2
17
18/*
19 * \brief Configure a port.
20 *
21 * This happens at system startup, and before the MMU is turned on.
22 * The hardware is not initialized by this call.
23 * After this, the UART is (hopefully) usable, but after the MMU is
24 * enabled the OS should then call zynq_uart_init below.
25 */
26extern void zynq_uart_early_init(unsigned port, lpaddr_t addr);
27
28/*
29 * \brief Initialize a UART, and a number to refer to it in the
30 * future.
31 *
32 * \param port : Physical address of the UART.
33 * \param hwinit : Also init the hardware itself if True
34 */
35extern void zynq_uart_init(unsigned port, lvaddr_t base, bool hwinit);
36
37/*
38 * \brief Put a character to the port
39 */
40extern void zynq_uart_putchar(unsigned port, char c);
41
42/*
43 * \brief Read a character from a port
44 */
45extern char zynq_uart_getchar(unsigned port);
46
47#endif // __ZYNQ_UART_H__
48