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:
@@ -2,6 +2,7 @@
|
||||
Serial I/O Port library functions with no library constructor/destructor
|
||||
|
||||
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
Copyright (c) 2012, ARM Ltd. All rights reserved.
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -17,8 +18,9 @@
|
||||
|
||||
|
||||
#include <Library/SerialPortLib.h>
|
||||
#include <Library/SerialPortExtLib.h>
|
||||
|
||||
/*
|
||||
/**
|
||||
|
||||
Programmed hardware of Serial port.
|
||||
|
||||
@@ -34,6 +36,65 @@ SerialPortInitialize (
|
||||
return RETURN_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Set the serial device control bits.
|
||||
|
||||
@return Always return EFI_UNSUPPORTED.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
SerialPortSetControl (
|
||||
IN UINT32 Control
|
||||
)
|
||||
{
|
||||
return RETURN_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
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
|
||||
)
|
||||
{
|
||||
if (SerialPortPoll ()) {
|
||||
// If a character is pending don't set EFI_SERIAL_INPUT_BUFFER_EMPTY
|
||||
*Control = EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
|
||||
} else {
|
||||
*Control = EFI_SERIAL_INPUT_BUFFER_EMPTY | EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Set the serial device attributes.
|
||||
|
||||
@return Always return EFI_UNSUPPORTED.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
SerialPortSetAttributes (
|
||||
IN OUT UINT64 *BaudRate,
|
||||
IN OUT UINT32 *ReceiveFifoDepth,
|
||||
IN OUT UINT32 *Timeout,
|
||||
IN OUT EFI_PARITY_TYPE *Parity,
|
||||
IN OUT UINT8 *DataBits,
|
||||
IN OUT EFI_STOP_BITS_TYPE *StopBits
|
||||
)
|
||||
{
|
||||
return RETURN_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Write data to serial device.
|
||||
|
||||
@@ -49,7 +110,7 @@ EFIAPI
|
||||
SerialPortWrite (
|
||||
IN UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes
|
||||
)
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -70,7 +131,7 @@ EFIAPI
|
||||
SerialPortRead (
|
||||
OUT UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes
|
||||
)
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user