EmbeddedPkg: Introduced 'SerialPortExtLib.h'
EmbeddedPkg/SerialDxe was not allowing to set/get the control of the Serial connection because the needed functions were not exposed in SerialPortLib.h. This commit introduces an additional library to extend the SerialPort features. Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13773 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -19,11 +19,12 @@
|
||||
#include <Library/IoLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/SerialPortLib.h>
|
||||
#include <Library/SerialPortExtLib.h>
|
||||
|
||||
#include <Drivers/PL011Uart.h>
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
|
||||
Programmed hardware of Serial port.
|
||||
|
||||
@@ -101,3 +102,83 @@ SerialPortPoll (
|
||||
{
|
||||
return PL011UartPoll ((UINTN)PcdGet64 (PcdSerialRegisterBase));
|
||||
}
|
||||
|
||||
/**
|
||||
Set new attributes to PL011.
|
||||
|
||||
@param BaudRate The baud rate of the serial device. If the baud rate is not supported,
|
||||
the speed will be reduced down to the nearest supported one and the
|
||||
variable's value will be updated accordingly.
|
||||
@param ReceiveFifoDepth The number of characters the device will buffer on input. If the specified
|
||||
value is not supported, the variable's value will be reduced down to the
|
||||
nearest supported one.
|
||||
@param Timeout If applicable, the number of microseconds the device will wait
|
||||
before timing out a Read or a Write operation.
|
||||
@param Parity If applicable, this is the EFI_PARITY_TYPE that is computer or checked
|
||||
as each character is transmitted or received. If the device does not
|
||||
support parity, the value is the default parity value.
|
||||
@param DataBits The number of data bits in each character
|
||||
@param StopBits If applicable, the EFI_STOP_BITS_TYPE number of stop bits per character.
|
||||
If the device does not support stop bits, the value is the default stop
|
||||
bit value.
|
||||
|
||||
@retval EFI_SUCCESS All attributes were set correctly on the serial device.
|
||||
@retval EFI_INVALID_PARAMETERS One or more of the attributes has an unsupported value.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
SerialPortSetAttributes (
|
||||
IN UINT64 BaudRate,
|
||||
IN UINT32 ReceiveFifoDepth,
|
||||
IN UINT32 Timeout,
|
||||
IN EFI_PARITY_TYPE Parity,
|
||||
IN UINT8 DataBits,
|
||||
IN EFI_STOP_BITS_TYPE StopBits
|
||||
)
|
||||
{
|
||||
return PL011UartInitializePort (
|
||||
(UINTN)PcdGet64 (PcdSerialRegisterBase),
|
||||
BaudRate,
|
||||
ReceiveFifoDepth,
|
||||
Parity,
|
||||
DataBits,
|
||||
StopBits);
|
||||
}
|
||||
|
||||
/**
|
||||
Set the serial device control bits.
|
||||
|
||||
@param Control Control bits which are to be set on the serial device.
|
||||
|
||||
@retval EFI_SUCCESS The new control bits were set on the serial device.
|
||||
@retval EFI_UNSUPPORTED The serial device does not support this operation.
|
||||
@retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
SerialPortSetControl (
|
||||
IN UINT32 Control
|
||||
)
|
||||
{
|
||||
return PL011UartSetControl((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
|
||||
}
|
||||
|
||||
/**
|
||||
Get the serial device control bits.
|
||||
|
||||
@param Control Control signals read from the serial device.
|
||||
|
||||
@retval EFI_SUCCESS The control bits were read from the serial device.
|
||||
@retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
SerialPortGetControl (
|
||||
OUT UINT32 *Control
|
||||
)
|
||||
{
|
||||
return PL011UartGetControl((UINTN)PcdGet64 (PcdSerialRegisterBase), Control);
|
||||
}
|
||||
|
@@ -30,6 +30,7 @@
|
||||
PcdLib
|
||||
|
||||
[Packages]
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
ArmPlatformPkg/ArmPlatformPkg.dec
|
||||
|
Reference in New Issue
Block a user