1/*
2 * Copyright 2011-2021 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Alexander von Gluck, kallisti5@unixzen.com
7 */
8#ifndef __DEV_UART_PL011_H
9#define __DEV_UART_PL011_H
10
11
12#include <sys/types.h>
13
14#include <SupportDefs.h>
15
16#include <arch/generic/debug_uart.h>
17
18
19#define UART_KIND_PL011 "pl011"
20
21
22class ArchUARTPL011 : public DebugUART {
23public:
24							ArchUARTPL011(addr_t base, int64 clock);
25							~ArchUARTPL011();
26
27			void			InitEarly();
28			void			InitPort(uint32 baud);
29
30			void			Enable();
31			void			Disable();
32
33			int				PutChar(char c);
34			int				GetChar(bool wait);
35
36			void			FlushTx();
37			void			FlushRx();
38
39private:
40			void			Out32(int reg, uint32 value);
41			uint32			In32(int reg);
42	virtual	void			Barrier();
43};
44
45
46ArchUARTPL011 *arch_get_uart_pl011(addr_t base, int64 clock);
47
48
49#endif
50