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