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