2 Serial I/O Port library functions with no library constructor/destructor
4 Copyright (c) 2012-2013, ARM Ltd. All rights reserved.<BR>
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
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.
18 #include <Library/IoLib.h>
19 #include <Library/PcdLib.h>
20 #include <Library/SerialPortExtLib.h>
22 #include <Drivers/PL011Uart.h>
25 Set new attributes to PL011.
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
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.
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
58 return PL011UartInitializePort (
59 (UINTN
)PcdGet64 (PcdSerialRegisterBase
),
68 Set the serial device control bits.
70 @param Control Control bits which are to be set on the serial device.
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.
79 SerialPortSetControl (
83 return PL011UartSetControl ((UINTN
)PcdGet64 (PcdSerialRegisterBase
), Control
);
87 Get the serial device control bits.
89 @param Control Control signals read from the serial device.
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.
97 SerialPortGetControl (
101 return PL011UartGetControl ((UINTN
)PcdGet64 (PcdSerialRegisterBase
), Control
);