]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortExtLib.c
EmbeddedPkg/SerialPortExtLib.h: Changed SerialPortSetAttributes() prototype to return...
[mirror_edk2.git] / ArmPlatformPkg / Library / PL011SerialPortLib / PL011SerialPortExtLib.c
CommitLineData
d38c35f9 1/** @file\r
2 Serial I/O Port library functions with no library constructor/destructor\r
3\r
15e277d5 4 Copyright (c) 2012-2013, ARM Ltd. All rights reserved.<BR>\r
d38c35f9 5 \r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#include <Base.h>\r
17\r
18#include <Library/IoLib.h>\r
19#include <Library/PcdLib.h>\r
20#include <Library/SerialPortExtLib.h>\r
21\r
22#include <Drivers/PL011Uart.h>\r
23\r
24/**\r
25 Set new attributes to PL011.\r
26\r
27 @param BaudRate The baud rate of the serial device. If the baud rate is not supported,\r
28 the speed will be reduced down to the nearest supported one and the\r
29 variable's value will be updated accordingly.\r
30 @param ReceiveFifoDepth The number of characters the device will buffer on input. If the specified\r
31 value is not supported, the variable's value will be reduced down to the\r
32 nearest supported one.\r
33 @param Timeout If applicable, the number of microseconds the device will wait\r
34 before timing out a Read or a Write operation.\r
35 @param Parity If applicable, this is the EFI_PARITY_TYPE that is computed or checked\r
36 as each character is transmitted or received. If the device does not\r
37 support parity, the value is the default parity value.\r
38 @param DataBits The number of data bits in each character\r
39 @param StopBits If applicable, the EFI_STOP_BITS_TYPE number of stop bits per character.\r
40 If the device does not support stop bits, the value is the default stop\r
41 bit value.\r
42\r
43 @retval EFI_SUCCESS All attributes were set correctly on the serial device.\r
44 @retval EFI_INVALID_PARAMETERS One or more of the attributes has an unsupported value.\r
45\r
46**/\r
47RETURN_STATUS\r
48EFIAPI\r
49SerialPortSetAttributes (\r
15e277d5 50 IN OUT UINT64 *BaudRate,\r
51 IN OUT UINT32 *ReceiveFifoDepth,\r
52 IN OUT UINT32 *Timeout,\r
53 IN OUT EFI_PARITY_TYPE *Parity,\r
54 IN OUT UINT8 *DataBits,\r
55 IN OUT EFI_STOP_BITS_TYPE *StopBits\r
d38c35f9 56 )\r
57{\r
58 return PL011UartInitializePort (\r
59 (UINTN)PcdGet64 (PcdSerialRegisterBase),\r
60 BaudRate,\r
61 ReceiveFifoDepth,\r
62 Parity,\r
63 DataBits,\r
64 StopBits);\r
65}\r
66\r
67/**\r
68 Set the serial device control bits.\r
69\r
70 @param Control Control bits which are to be set on the serial device.\r
71\r
72 @retval EFI_SUCCESS The new control bits were set on the serial device.\r
73 @retval EFI_UNSUPPORTED The serial device does not support this operation.\r
74 @retval EFI_DEVICE_ERROR The serial device is not functioning correctly.\r
75\r
76**/\r
77RETURN_STATUS\r
78EFIAPI\r
79SerialPortSetControl (\r
80 IN UINT32 Control\r
81 )\r
82{\r
83 return PL011UartSetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);\r
84}\r
85\r
86/**\r
87 Get the serial device control bits.\r
88\r
89 @param Control Control signals read from the serial device.\r
90\r
91 @retval EFI_SUCCESS The control bits were read from the serial device.\r
92 @retval EFI_DEVICE_ERROR The serial device is not functioning correctly.\r
93\r
94**/\r
95RETURN_STATUS\r
96EFIAPI\r
97SerialPortGetControl (\r
98 OUT UINT32 *Control\r
99 )\r
100{\r
101 return PL011UartGetControl ((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);\r
102}\r
103\r