]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.c
Fix issue when BaseDebugLibSerialPort is combined with BaseSerialPortLibNull. It...
[mirror_edk2.git] / MdePkg / Library / BaseSerialPortLibNull / BaseSerialPortLibNull.c
1 /** @file
2 Null Serial Port library instance with empty functions.
3
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15
16 #include <Base.h>
17 #include <Library/SerialPortLib.h>
18
19 /**
20 Initialize the serial device hardware.
21
22 If no initialization is required, then return RETURN_SUCCESS.
23 If the serial device was successfully initialized, then return RETURN_SUCCESS.
24 If the serial device could not be initialized, then return RETURN_DEVICE_ERROR.
25
26 @retval RETURN_SUCCESS The serial device was initialized.
27 @retval RETURN_DEVICE_ERROR The serial device could not be initialized.
28
29 **/
30 RETURN_STATUS
31 EFIAPI
32 SerialPortInitialize (
33 VOID
34 )
35 {
36 return RETURN_SUCCESS;
37 }
38
39 /**
40 Write data from buffer to serial device.
41
42 Writes NumberOfBytes data bytes from Buffer to the serial device.
43 The number of bytes actually written to the serial device is returned.
44 If the return value is less than NumberOfBytes, then the write operation failed.
45 If Buffer is NULL, then ASSERT().
46 If NumberOfBytes is zero, then return 0.
47
48 @param Buffer The pointer to the data buffer to be written.
49 @param NumberOfBytes The number of bytes to written to the serial device.
50
51 @retval 0 NumberOfBytes is 0.
52 @retval >0 The number of bytes written to the serial device.
53 If this value is less than NumberOfBytes, then the read operation failed.
54
55 **/
56 UINTN
57 EFIAPI
58 SerialPortWrite (
59 IN UINT8 *Buffer,
60 IN UINTN NumberOfBytes
61 )
62 {
63 return 0;
64 }
65
66
67 /**
68 Read data from serial device and save the datas in buffer.
69
70 Reads NumberOfBytes data bytes from a serial device into the buffer
71 specified by Buffer. The number of bytes actually read is returned.
72 If the return value is less than NumberOfBytes, then the rest operation failed.
73 If Buffer is NULL, then ASSERT().
74 If NumberOfBytes is zero, then return 0.
75
76 @param Buffer The pointer to the data buffer to store the data read from the serial device.
77 @param NumberOfBytes The number of bytes which will be read.
78
79 @retval 0 Read data failed; No data is to be read.
80 @retval >0 The actual number of bytes read from serial device.
81
82 **/
83 UINTN
84 EFIAPI
85 SerialPortRead (
86 OUT UINT8 *Buffer,
87 IN UINTN NumberOfBytes
88 )
89 {
90 return 0;
91 }
92
93 /**
94 Polls a serial device to see if there is any data waiting to be read.
95
96 Polls a serial device to see if there is any data waiting to be read.
97 If there is data waiting to be read from the serial device, then TRUE is returned.
98 If there is no data waiting to be read from the serial device, then FALSE is returned.
99
100 @retval TRUE Data is waiting to be read from the serial device.
101 @retval FALSE There is no data waiting to be read from the serial device.
102
103 **/
104 BOOLEAN
105 EFIAPI
106 SerialPortPoll (
107 VOID
108 )
109 {
110 return FALSE;
111 }
112