]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.c
MdePkg/BasePrintLib: Fix incomplete print output
[mirror_edk2.git] / MdePkg / Library / BaseSerialPortLibNull / BaseSerialPortLibNull.c
1 /** @file
2 Null Serial Port library instance with empty functions.
3
4 Copyright (c) 2006 - 2015, 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 write 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
113 /**
114 Sets the control bits on a serial device.
115
116 @param Control Sets the bits of Control that are settable.
117
118 @retval RETURN_SUCCESS The new control bits were set on the serial device.
119 @retval RETURN_UNSUPPORTED The serial device does not support this operation.
120 @retval RETURN_DEVICE_ERROR The serial device is not functioning correctly.
121
122 **/
123 RETURN_STATUS
124 EFIAPI
125 SerialPortSetControl (
126 IN UINT32 Control
127 )
128 {
129 return RETURN_UNSUPPORTED;
130 }
131
132 /**
133 Retrieve the status of the control bits on a serial device.
134
135 @param Control A pointer to return the current control signals from the serial device.
136
137 @retval RETURN_SUCCESS The control bits were read from the serial device.
138 @retval RETURN_UNSUPPORTED The serial device does not support this operation.
139 @retval RETURN_DEVICE_ERROR The serial device is not functioning correctly.
140
141 **/
142 RETURN_STATUS
143 EFIAPI
144 SerialPortGetControl (
145 OUT UINT32 *Control
146 )
147 {
148 return RETURN_UNSUPPORTED;
149 }
150
151 /**
152 Sets the baud rate, receive FIFO depth, transmit/receice time out, parity,
153 data bits, and stop bits on a serial device.
154
155 @param BaudRate The requested baud rate. A BaudRate value of 0 will use the
156 device's default interface speed.
157 On output, the value actually set.
158 @param ReveiveFifoDepth The requested depth of the FIFO on the receive side of the
159 serial interface. A ReceiveFifoDepth value of 0 will use
160 the device's default FIFO depth.
161 On output, the value actually set.
162 @param Timeout The requested time out for a single character in microseconds.
163 This timeout applies to both the transmit and receive side of the
164 interface. A Timeout value of 0 will use the device's default time
165 out value.
166 On output, the value actually set.
167 @param Parity The type of parity to use on this serial device. A Parity value of
168 DefaultParity will use the device's default parity value.
169 On output, the value actually set.
170 @param DataBits The number of data bits to use on the serial device. A DataBits
171 vaule of 0 will use the device's default data bit setting.
172 On output, the value actually set.
173 @param StopBits The number of stop bits to use on this serial device. A StopBits
174 value of DefaultStopBits will use the device's default number of
175 stop bits.
176 On output, the value actually set.
177
178 @retval RETURN_SUCCESS The new attributes were set on the serial device.
179 @retval RETURN_UNSUPPORTED The serial device does not support this operation.
180 @retval RETURN_INVALID_PARAMETER One or more of the attributes has an unsupported value.
181 @retval RETURN_DEVICE_ERROR The serial device is not functioning correctly.
182
183 **/
184 RETURN_STATUS
185 EFIAPI
186 SerialPortSetAttributes (
187 IN OUT UINT64 *BaudRate,
188 IN OUT UINT32 *ReceiveFifoDepth,
189 IN OUT UINT32 *Timeout,
190 IN OUT EFI_PARITY_TYPE *Parity,
191 IN OUT UINT8 *DataBits,
192 IN OUT EFI_STOP_BITS_TYPE *StopBits
193 )
194 {
195 return RETURN_UNSUPPORTED;
196 }
197