BaseTools/Capsule: Do not support -o with --dump-info
[mirror_edk2.git] / ArmPlatformPkg / Include / Library / PL011UartLib.h
CommitLineData
12156134
AB
1/** @file\r
2*\r
3* Copyright (c) 2011-2016, ARM Limited. All rights reserved.\r
4*\r
5* This program and the accompanying materials\r
6* are licensed and made available under the terms and conditions of the BSD License\r
7* which accompanies this distribution. The full text of the license may be found at\r
8* http://opensource.org/licenses/bsd-license.php\r
9*\r
10* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12*\r
13**/\r
14\r
15#ifndef __PL011_UART_LIB_H__\r
16#define __PL011_UART_LIB_H__\r
17\r
18#include <Uefi/UefiBaseType.h>\r
19\r
20#include <Protocol/SerialIo.h>\r
21\r
22/**\r
23\r
24 Initialise the serial port to the specified settings.\r
25 All unspecified settings will be set to the default values.\r
26\r
27 @param[in] UartBase The base address of the serial device.\r
28 @param[in] UartClkInHz The clock in Hz for the serial device.\r
29 Ignored if the PCD PL011UartInteger is not 0\r
30 @param[in out] BaudRate The baud rate of the serial device. If the\r
31 baud rate is not supported, the speed will be\r
32 reduced to the nearest supported one and the\r
33 variable's value will be updated accordingly.\r
34 @param[in out] ReceiveFifoDepth The number of characters the device will\r
35 buffer on input. Value of 0 will use the\r
36 device's default FIFO depth.\r
37 @param[in out] Parity If applicable, this is the EFI_PARITY_TYPE\r
38 that is computed or checked as each character\r
39 is transmitted or received. If the device\r
40 does not support parity, the value is the\r
41 default parity value.\r
42 @param[in out] DataBits The number of data bits in each character.\r
43 @param[in out] StopBits If applicable, the EFI_STOP_BITS_TYPE number\r
44 of stop bits per character.\r
45 If the device does not support stop bits, the\r
46 value is the default stop bit value.\r
47\r
48 @retval RETURN_SUCCESS All attributes were set correctly on the\r
49 serial device.\r
50 @retval RETURN_INVALID_PARAMETER One or more of the attributes has an\r
51 unsupported value.\r
52\r
53**/\r
54RETURN_STATUS\r
55EFIAPI\r
56PL011UartInitializePort (\r
57 IN UINTN UartBase,\r
58 IN UINT32 UartClkInHz,\r
59 IN OUT UINT64 *BaudRate,\r
60 IN OUT UINT32 *ReceiveFifoDepth,\r
61 IN OUT EFI_PARITY_TYPE *Parity,\r
62 IN OUT UINT8 *DataBits,\r
63 IN OUT EFI_STOP_BITS_TYPE *StopBits\r
64 );\r
65\r
66/**\r
67\r
68 Assert or deassert the control signals on a serial port.\r
69 The following control signals are set according their bit settings :\r
70 . Request to Send\r
71 . Data Terminal Ready\r
72\r
73 @param[in] UartBase UART registers base address\r
74 @param[in] Control The following bits are taken into account :\r
75 . EFI_SERIAL_REQUEST_TO_SEND : assert/deassert the\r
76 "Request To Send" control signal if this bit is\r
77 equal to one/zero.\r
78 . EFI_SERIAL_DATA_TERMINAL_READY : assert/deassert\r
79 the "Data Terminal Ready" control signal if this\r
80 bit is equal to one/zero.\r
81 . EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE : enable/disable\r
82 the hardware loopback if this bit is equal to\r
83 one/zero.\r
84 . EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE : not supported.\r
85 . EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE : enable/\r
86 disable the hardware flow control based on CTS (Clear\r
87 To Send) and RTS (Ready To Send) control signals.\r
88\r
89 @retval RETURN_SUCCESS The new control bits were set on the device.\r
90 @retval RETURN_UNSUPPORTED The device does not support this operation.\r
91\r
92**/\r
93RETURN_STATUS\r
94EFIAPI\r
95PL011UartSetControl (\r
96 IN UINTN UartBase,\r
97 IN UINT32 Control\r
98 );\r
99\r
100/**\r
101\r
102 Retrieve the status of the control bits on a serial device.\r
103\r
104 @param[in] UartBase UART registers base address\r
105 @param[out] Control Status of the control bits on a serial device :\r
106\r
107 . EFI_SERIAL_DATA_CLEAR_TO_SEND,\r
108 EFI_SERIAL_DATA_SET_READY,\r
109 EFI_SERIAL_RING_INDICATE,\r
110 EFI_SERIAL_CARRIER_DETECT,\r
111 EFI_SERIAL_REQUEST_TO_SEND,\r
112 EFI_SERIAL_DATA_TERMINAL_READY\r
113 are all related to the DTE (Data Terminal Equipment)\r
114 and DCE (Data Communication Equipment) modes of\r
115 operation of the serial device.\r
116 . EFI_SERIAL_INPUT_BUFFER_EMPTY : equal to one if the\r
117 receive buffer is empty, 0 otherwise.\r
118 . EFI_SERIAL_OUTPUT_BUFFER_EMPTY : equal to one if the\r
119 transmit buffer is empty, 0 otherwise.\r
120 . EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE : equal to one if\r
121 the hardware loopback is enabled (the ouput feeds the\r
122 receive buffer), 0 otherwise.\r
123 . EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE : equal to one if\r
124 a loopback is accomplished by software, 0 otherwise.\r
125 . EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE : equal to\r
126 one if the hardware flow control based on CTS (Clear\r
127 To Send) and RTS (Ready To Send) control signals is\r
128 enabled, 0 otherwise.\r
129\r
130 @retval RETURN_SUCCESS The control bits were read from the serial device.\r
131\r
132**/\r
133RETURN_STATUS\r
134EFIAPI\r
135PL011UartGetControl (\r
136 IN UINTN UartBase,\r
137 OUT UINT32 *Control\r
138 );\r
139\r
140/**\r
141 Write data to serial device.\r
142\r
143 @param Buffer Point of data buffer which need to be written.\r
144 @param NumberOfBytes Number of output bytes which are cached in Buffer.\r
145\r
146 @retval 0 Write data failed.\r
147 @retval !0 Actual number of bytes written to serial device.\r
148\r
149**/\r
150UINTN\r
151EFIAPI\r
152PL011UartWrite (\r
153 IN UINTN UartBase,\r
154 IN UINT8 *Buffer,\r
155 IN UINTN NumberOfBytes\r
156 );\r
157\r
158/**\r
159 Read data from serial device and save the data in buffer.\r
160\r
161 @param Buffer Point of data buffer which need to be written.\r
162 @param NumberOfBytes Number of output bytes which are cached in Buffer.\r
163\r
164 @retval 0 Read data failed.\r
165 @retval !0 Actual number of bytes read from serial device.\r
166\r
167**/\r
168UINTN\r
169EFIAPI\r
170PL011UartRead (\r
171 IN UINTN UartBase,\r
172 OUT UINT8 *Buffer,\r
173 IN UINTN NumberOfBytes\r
174 );\r
175\r
176/**\r
177 Check to see if any data is available to be read from the debug device.\r
178\r
179 @retval TRUE At least one byte of data is available to be read\r
180 @retval FALSE No data is available to be read\r
181\r
182**/\r
183BOOLEAN\r
184EFIAPI\r
185PL011UartPoll (\r
186 IN UINTN UartBase\r
187 );\r
188\r
189#endif\r