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