]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmEbPkg/Include/ArmEb/ArmEbUart.h
A better template, with some build scripts, for ArmEbPkg. New libraries are just...
[mirror_edk2.git] / ArmEbPkg / Include / ArmEb / ArmEbUart.h
diff --git a/ArmEbPkg/Include/ArmEb/ArmEbUart.h b/ArmEbPkg/Include/ArmEb/ArmEbUart.h
new file mode 100755 (executable)
index 0000000..642b83a
--- /dev/null
@@ -0,0 +1,75 @@
+/*++\r
+\r
+Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+Portions copyright (c) 2009, Hewlett-Packard Company. All rights reserved.<BR>\r
+Portions copyright (c) 2010, Apple Inc. All rights reserved.<BR>\r
+This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.  \r
+\r
+--*/\r
+\r
+#ifndef __ARM_EB_UART_H__\r
+#define __ARM_EB_UART_H__\r
+\r
+\r
+#define SERIAL_PORT_MAX_TIMEOUT            100000000    // 100 seconds\r
+\r
+\r
+// EB constants\r
+#define EB_UART1_BASE   0x10009000\r
+\r
+// PL011 Registers\r
+#define UARTDR          0x000\r
+#define UARTRSR         0x004\r
+#define UARTECR         0x004\r
+#define UARTFR          0x018\r
+#define UARTILPR        0x020\r
+#define UARTIBRD        0x024\r
+#define UARTFBRD        0x028\r
+#define UARTLCR_H       0x02C\r
+#define UARTCR          0x030\r
+#define UARTIFLS        0x034\r
+#define UARTIMSC        0x038\r
+#define UARTRIS         0x03C\r
+#define UARTMIS         0x040\r
+#define UARTICR         0x044\r
+#define UARTDMACR       0x048\r
+\r
+// If the required baud rate is 115200 and UARTCLK = 24MHz then:\r
+// Baud Rate Divisor = (24×10^6)/(16×115200) = 13.020833\r
+// This means BRDI = 13 and BRDF = 0.020833\r
+// Therefore, fractional part, m = integer(0.020833×64) = integer(1.33331) = 1\r
+// Generated baud rate divider = 13+1/64 = 13.015625\r
+// Generated baud rate = (24×10^6)/(16×13.015625) = 115246.098\r
+// Error = (115246.098-115200)/115200 × 100 = 0.04%\r
+#define UART_115200_IDIV    13\r
+#define UART_115200_FDIV    1\r
+\r
+// add more baud rates here as needed\r
+\r
+// data status bits\r
+#define UART_DATA_ERROR_MASK      0x0F00\r
+\r
+// status reg bits\r
+#define UART_STATUS_ERROR_MASK    0x0F\r
+\r
+// flag reg bits\r
+#define UART_TX_EMPTY_FLAG_MASK   0x80\r
+#define UART_RX_FULL_FLAG_MASK    0x40\r
+#define UART_TX_FULL_FLAG_MASK    0x20\r
+#define UART_RX_EMPTY_FLAG_MASK   0x10\r
+#define UART_BUSY_FLAG_MASK       0x08\r
+\r
+// control reg bits\r
+#define UART_CTSEN_CONTROL_MASK   0x8000\r
+#define UART_RTSEN_CONTROL_MASK   0x4000\r
+#define UART_RTS_CONTROL_MASK     0x0800\r
+#define UART_DTR_CONTROL_MASK     0x0400\r
+\r
+\r
+#endif \r