]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.c
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Library / BaseSerialPortLibNull / BaseSerialPortLibNull.c
1 /** @file
2 Null Serial Port library instance with empty functions.
3
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include <Base.h>
10 #include <Library/SerialPortLib.h>
11
12 /**
13 Initialize the serial device hardware.
14
15 If no initialization is required, then return RETURN_SUCCESS.
16 If the serial device was successfully initialized, then return RETURN_SUCCESS.
17 If the serial device could not be initialized, then return RETURN_DEVICE_ERROR.
18
19 @retval RETURN_SUCCESS The serial device was initialized.
20 @retval RETURN_DEVICE_ERROR The serial device could not be initialized.
21
22 **/
23 RETURN_STATUS
24 EFIAPI
25 SerialPortInitialize (
26 VOID
27 )
28 {
29 return RETURN_SUCCESS;
30 }
31
32 /**
33 Write data from buffer to serial device.
34
35 Writes NumberOfBytes data bytes from Buffer to the serial device.
36 The number of bytes actually written to the serial device is returned.
37 If the return value is less than NumberOfBytes, then the write operation failed.
38 If Buffer is NULL, then ASSERT().
39 If NumberOfBytes is zero, then return 0.
40
41 @param Buffer The pointer to the data buffer to be written.
42 @param NumberOfBytes The number of bytes to written to the serial device.
43
44 @retval 0 NumberOfBytes is 0.
45 @retval >0 The number of bytes written to the serial device.
46 If this value is less than NumberOfBytes, then the write operation failed.
47
48 **/
49 UINTN
50 EFIAPI
51 SerialPortWrite (
52 IN UINT8 *Buffer,
53 IN UINTN NumberOfBytes
54 )
55 {
56 return 0;
57 }
58
59 /**
60 Read data from serial device and save the datas in buffer.
61
62 Reads NumberOfBytes data bytes from a serial device into the buffer
63 specified by Buffer. The number of bytes actually read is returned.
64 If the return value is less than NumberOfBytes, then the rest operation failed.
65 If Buffer is NULL, then ASSERT().
66 If NumberOfBytes is zero, then return 0.
67
68 @param Buffer The pointer to the data buffer to store the data read from the serial device.
69 @param NumberOfBytes The number of bytes which will be read.
70
71 @retval 0 Read data failed; No data is to be read.
72 @retval >0 The actual number of bytes read from serial device.
73
74 **/
75 UINTN
76 EFIAPI
77 SerialPortRead (
78 OUT UINT8 *Buffer,
79 IN UINTN NumberOfBytes
80 )
81 {
82 return 0;
83 }
84
85 /**
86 Polls a serial device to see if there is any data waiting to be read.
87
88 Polls a serial device to see if there is any data waiting to be read.
89 If there is data waiting to be read from the serial device, then TRUE is returned.
90 If there is no data waiting to be read from the serial device, then FALSE is returned.
91
92 @retval TRUE Data is waiting to be read from the serial device.
93 @retval FALSE There is no data waiting to be read from the serial device.
94
95 **/
96 BOOLEAN
97 EFIAPI
98 SerialPortPoll (
99 VOID
100 )
101 {
102 return FALSE;
103 }
104
105 /**
106 Sets the control bits on a serial device.
107
108 @param Control Sets the bits of Control that are settable.
109
110 @retval RETURN_SUCCESS The new control bits were set on the serial device.
111 @retval RETURN_UNSUPPORTED The serial device does not support this operation.
112 @retval RETURN_DEVICE_ERROR The serial device is not functioning correctly.
113
114 **/
115 RETURN_STATUS
116 EFIAPI
117 SerialPortSetControl (
118 IN UINT32 Control
119 )
120 {
121 return RETURN_UNSUPPORTED;
122 }
123
124 /**
125 Retrieve the status of the control bits on a serial device.
126
127 @param Control A pointer to return the current control signals from the serial device.
128
129 @retval RETURN_SUCCESS The control bits were read from the serial device.
130 @retval RETURN_UNSUPPORTED The serial device does not support this operation.
131 @retval RETURN_DEVICE_ERROR The serial device is not functioning correctly.
132
133 **/
134 RETURN_STATUS
135 EFIAPI
136 SerialPortGetControl (
137 OUT UINT32 *Control
138 )
139 {
140 return RETURN_UNSUPPORTED;
141 }
142
143 /**
144 Sets the baud rate, receive FIFO depth, transmit/receice time out, parity,
145 data bits, and stop bits on a serial device.
146
147 @param BaudRate The requested baud rate. A BaudRate value of 0 will use the
148 device's default interface speed.
149 On output, the value actually set.
150 @param ReveiveFifoDepth The requested depth of the FIFO on the receive side of the
151 serial interface. A ReceiveFifoDepth value of 0 will use
152 the device's default FIFO depth.
153 On output, the value actually set.
154 @param Timeout The requested time out for a single character in microseconds.
155 This timeout applies to both the transmit and receive side of the
156 interface. A Timeout value of 0 will use the device's default time
157 out value.
158 On output, the value actually set.
159 @param Parity The type of parity to use on this serial device. A Parity value of
160 DefaultParity will use the device's default parity value.
161 On output, the value actually set.
162 @param DataBits The number of data bits to use on the serial device. A DataBits
163 vaule of 0 will use the device's default data bit setting.
164 On output, the value actually set.
165 @param StopBits The number of stop bits to use on this serial device. A StopBits
166 value of DefaultStopBits will use the device's default number of
167 stop bits.
168 On output, the value actually set.
169
170 @retval RETURN_SUCCESS The new attributes were set on the serial device.
171 @retval RETURN_UNSUPPORTED The serial device does not support this operation.
172 @retval RETURN_INVALID_PARAMETER One or more of the attributes has an unsupported value.
173 @retval RETURN_DEVICE_ERROR The serial device is not functioning correctly.
174
175 **/
176 RETURN_STATUS
177 EFIAPI
178 SerialPortSetAttributes (
179 IN OUT UINT64 *BaudRate,
180 IN OUT UINT32 *ReceiveFifoDepth,
181 IN OUT UINT32 *Timeout,
182 IN OUT EFI_PARITY_TYPE *Parity,
183 IN OUT UINT8 *DataBits,
184 IN OUT EFI_STOP_BITS_TYPE *StopBits
185 )
186 {
187 return RETURN_UNSUPPORTED;
188 }