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