1/*
2 * Copyright (c) 2007, 2008, 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, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
8 */
9
10#ifndef __PL011_H__
11#define __PL011_H__
12
13#include <barrelfish_kpi/types.h>
14#include <stdbool.h>
15
16/*
17 * We can handle up to 6 UARTS; should be enough for anyone...
18 */
19#define PL011_MAX_PORTS 6
20
21/*
22 * \briefConfigure a port.
23 *
24 * This happens at system startup, and before the MMU is turned on.
25 * The hardware is not initialized by this call.
26 * After this, the UART is (hopefully) usable, but after the MMU is
27 * enabled the OS should then call pl011_init below.
28 */
29extern void pl011_configure(unsigned port, lpaddr_t addr);
30
31/*
32 * \brief Initialize a UART, and a number to refer to it in the
33 * future.
34 *
35 * \param port : Physical address of the UART.
36 * \param hwinit : Also init the hardware itself if True
37 */
38extern void pl011_init(unsigned port, lvaddr_t base, bool hwinit);
39
40/*
41 * \brief Put a character to the port
42 */
43extern void pl011_putchar(unsigned port, char c);
44
45/*
46 * \brief Read a character from a port
47 */
48extern char pl011_getchar(unsigned port);
49
50#endif // __PL011_H__
51