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