1 /* 2 * Copyright 2011-2012 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 class ArchUARTPL011 : public DebugUART { 20 public: 21 ArchUARTPL011(addr_t base, int64 clock); 22 ~ArchUARTPL011(); 23 24 void InitEarly(); 25 void InitPort(uint32 baud); 26 27 void Enable(); 28 void Disable(); 29 30 int PutChar(char c); 31 int GetChar(bool wait); 32 33 void FlushTx(); 34 void FlushRx(); 35 36 private: 37 void Out32(int reg, uint32 value); 38 uint32 In32(int reg); 39 virtual void Barrier(); 40 }; 41 42 43 ArchUARTPL011 *arch_get_uart_pl011(addr_t base, int64 clock); 44 45 46 #endif 47