]>
git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/Include/Drivers/PL011Uart.h
3 * Copyright (c) 2011, ARM Limited. All rights reserved.
5 * This program and the accompanying materials
6 * are licensed and made available under the terms and conditions of the BSD License
7 * which accompanies this distribution. The full text of the license may be found at
8 * http://opensource.org/licenses/bsd-license.php
10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef __PL011_UART_H__
16 #define __PL011_UART_H__
23 #define UARTILPR 0x020
24 #define UARTIBRD 0x024
25 #define UARTFBRD 0x028
26 #define UARTLCR_H 0x02C
28 #define UARTIFLS 0x034
29 #define UARTIMSC 0x038
33 #define UARTDMACR 0x048
35 #define UART_115200_IDIV 13 // Integer Part
36 #define UART_115200_FDIV 1 // Fractional Part
37 #define UART_38400_IDIV 39
38 #define UART_38400_FDIV 5
39 #define UART_19200_IDIV 12
40 #define UART_19200_FDIV 37
43 #define UART_DATA_ERROR_MASK 0x0F00
46 #define UART_STATUS_ERROR_MASK 0x0F
49 #define UART_TX_EMPTY_FLAG_MASK 0x80
50 #define UART_RX_FULL_FLAG_MASK 0x40
51 #define UART_TX_FULL_FLAG_MASK 0x20
52 #define UART_RX_EMPTY_FLAG_MASK 0x10
53 #define UART_BUSY_FLAG_MASK 0x08
56 #define PL011_UARTCR_CTSEN (1 << 15) // CTS hardware flow control enable
57 #define PL011_UARTCR_RTSEN (1 << 14) // RTS hardware flow control enable
58 #define PL011_UARTCR_RTS (1 << 11) // Request to send
59 #define PL011_UARTCR_DTR (1 << 10) // Data transmit ready.
60 #define PL011_UARTCR_RXE (1 << 9) // Receive enable
61 #define PL011_UARTCR_TXE (1 << 8) // Transmit enable
62 #define PL011_UARTCR_UARTEN (1 << 0) // UART Enable
64 // Line Control Register Bits
65 #define PL011_UARTLCR_H_SPS (1 << 7) // Stick parity select
66 #define PL011_UARTLCR_H_WLEN_8 (3 << 5)
67 #define PL011_UARTLCR_H_WLEN_7 (2 << 5)
68 #define PL011_UARTLCR_H_WLEN_6 (1 << 5)
69 #define PL011_UARTLCR_H_WLEN_5 (0 << 5)
70 #define PL011_UARTLCR_H_FEN (1 << 4) // FIFOs Enable
71 #define PL011_UARTLCR_H_STP2 (1 << 3) // Two stop bits select
72 #define PL011_UARTLCR_H_EPS (1 << 2) // Even parity select
73 #define PL011_UARTLCR_H_PEN (1 << 1) // Parity Enable
74 #define PL011_UARTLCR_H_BRK (1 << 0) // Send break
78 Programmed hardware of Serial port.
80 @return Always return EFI_UNSUPPORTED.
92 Write data to serial device.
94 @param Buffer Point of data buffer which need to be writed.
95 @param NumberOfBytes Number of output bytes which are cached in Buffer.
97 @retval 0 Write data failed.
98 @retval !0 Actual number of bytes writed to serial device.
106 IN UINTN NumberOfBytes
110 Read data from serial device and save the datas in buffer.
112 @param Buffer Point of data buffer which need to be writed.
113 @param NumberOfBytes Number of output bytes which are cached in Buffer.
115 @retval 0 Read data failed.
116 @retval !0 Aactual number of bytes read from serial device.
124 IN UINTN NumberOfBytes
128 Check to see if any data is avaiable to be read from the debug device.
130 @retval EFI_SUCCESS At least one byte of data is avaiable to be read
131 @retval EFI_NOT_READY No data is avaiable to be read
132 @retval EFI_DEVICE_ERROR The serial device is not functioning properly