]> git.proxmox.com Git - mirror_edk2.git/blob - EmbeddedPkg/Library/TemplateSerialPortExtLib/TemplateSerialPortExtLib.c
EmbeddedPkg: Introduced a separate SerialPortExtLib library
[mirror_edk2.git] / EmbeddedPkg / Library / TemplateSerialPortExtLib / TemplateSerialPortExtLib.c
1 /** @file
2 Extended Serial I/O Port library functions
3
4 Copyright (c) 2012, ARM Ltd. All rights reserved.
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/SerialPortLib.h>
19 #include <Library/SerialPortExtLib.h>
20
21 /**
22 Set the serial device control bits.
23
24 @return Always return RETURN_UNSUPPORTED.
25
26 **/
27 RETURN_STATUS
28 EFIAPI
29 SerialPortSetControl (
30 IN UINT32 Control
31 )
32 {
33 return RETURN_UNSUPPORTED;
34 }
35
36 /**
37 Get the serial device control bits.
38
39 @param Control Control signals read from the serial device.
40
41 @retval EFI_SUCCESS The control bits were read from the serial device.
42 @retval EFI_DEVICE_ERROR The serial device is not functioning correctly.
43
44 **/
45 RETURN_STATUS
46 EFIAPI
47 SerialPortGetControl (
48 OUT UINT32 *Control
49 )
50 {
51 if (SerialPortPoll ()) {
52 // If a character is pending don't set EFI_SERIAL_INPUT_BUFFER_EMPTY
53 *Control = EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
54 } else {
55 *Control = EFI_SERIAL_INPUT_BUFFER_EMPTY | EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
56 }
57 return EFI_SUCCESS;
58 }
59
60 /**
61 Set the serial device attributes.
62
63 @return Always return RETURN_UNSUPPORTED.
64
65 **/
66 RETURN_STATUS
67 EFIAPI
68 SerialPortSetAttributes (
69 IN UINT64 BaudRate,
70 IN UINT32 ReceiveFifoDepth,
71 IN UINT32 Timeout,
72 IN EFI_PARITY_TYPE Parity,
73 IN UINT8 DataBits,
74 IN EFI_STOP_BITS_TYPE StopBits
75 )
76 {
77 return RETURN_UNSUPPORTED;
78 }
79