]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/BluetoothHc.h
MdePkg/BluetoothHc: Add detailed function header comments
[mirror_edk2.git] / MdePkg / Include / Protocol / BluetoothHc.h
CommitLineData
362c355c
QS
1/** @file\r
2 EFI Bluetooth Host Controller Protocol as defined in UEFI 2.5.\r
3 This protocol abstracts the Bluetooth host controller layer message transmit and receive.\r
4\r
5a39f404
RN
5 Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
6 This program and the accompanying materials are licensed and made available under\r
7 the terms and conditions of the BSD License that accompanies this distribution.\r
362c355c 8 The full text of the license may be found at\r
5a39f404
RN
9 http://opensource.org/licenses/bsd-license.php.\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
362c355c
QS
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
5a39f404 14 @par Revision Reference:\r
362c355c
QS
15 This Protocol is introduced in UEFI Specification 2.5\r
16\r
17**/\r
18\r
19#ifndef __EFI_BLUETOOTH_HC_PROTOCOL_H__\r
20#define __EFI_BLUETOOTH_HC_PROTOCOL_H__\r
21\r
22#define EFI_BLUETOOTH_HC_PROTOCOL_GUID \\r
23 { \\r
24 0xb3930571, 0xbeba, 0x4fc5, { 0x92, 0x3, 0x94, 0x27, 0x24, 0x2e, 0x6a, 0x43 } \\r
25 }\r
26 \r
27typedef struct _EFI_BLUETOOTH_HC_PROTOCOL EFI_BLUETOOTH_HC_PROTOCOL;\r
28\r
29/**\r
30 Send HCI command packet.\r
31\r
5a39f404
RN
32 The SendCommand() function sends HCI command packet. Buffer holds the whole HCI\r
33 command packet, including OpCode, OCF, OGF, parameter length, and parameters. When\r
34 this function is returned, it just means the HCI command packet is sent, it does not mean\r
35 the command is success or complete. Caller might need to wait a command status event\r
36 to know the command status, or wait a command complete event to know if the\r
37 command is completed.\r
38\r
39 @param[in] This Pointer to the EFI_BLUETOOTH_HC_PROTOCOL instance.\r
40 @param[in,out] BufferSize On input, indicates the size, in bytes, of the data buffer\r
41 specified by Buffer. On output, indicates the amount of\r
42 data actually transferred.\r
43 @param[in] Buffer A pointer to the buffer of data that will be transmitted to\r
44 Bluetooth host controller.\r
45 @param[in] Timeout Indicating the transfer should be completed within this\r
46 time frame. The units are in milliseconds. If Timeout is 0,\r
47 then the caller must wait for the function to be completed\r
48 until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
49\r
50 @retval EFI_SUCCESS The HCI command packet is sent successfully.\r
51 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
52 BufferSize is NULL.\r
53 *BufferSize is 0.\r
54 Buffer is NULL.\r
55 @retval EFI_TIMEOUT Sending HCI command packet fail due to timeout.\r
56 @retval EFI_DEVICE_ERROR Sending HCI command packet fail due to host controller or device\r
57 error.\r
362c355c
QS
58\r
59**/\r
5a39f404 60typedef\r
362c355c
QS
61EFI_STATUS\r
62(EFIAPI *EFI_BLUETOOTH_HC_SEND_COMMAND)(\r
5a39f404
RN
63 IN EFI_BLUETOOTH_HC_PROTOCOL *This,\r
64 IN OUT UINTN *BufferSize,\r
65 IN VOID *Buffer,\r
66 IN UINTN Timeout\r
362c355c 67 );\r
362c355c
QS
68\r
69/**\r
70 Receive HCI event packet.\r
71\r
5a39f404
RN
72 The ReceiveEvent() function receives HCI event packet. Buffer holds the whole HCI event\r
73 packet, including EventCode, parameter length, and parameters.\r
74\r
75 @param[in] This Pointer to the EFI_BLUETOOTH_HC_PROTOCOL instance.\r
76 @param[in,out] BufferSize On input, indicates the size, in bytes, of the data buffer\r
77 specified by Buffer. On output, indicates the amount of\r
78 data actually transferred.\r
79 @param[out] Buffer A pointer to the buffer of data that will be received from\r
80 Bluetooth host controller.\r
81 @param[in] Timeout Indicating the transfer should be completed within this\r
82 time frame. The units are in milliseconds. If Timeout is 0,\r
83 then the caller must wait for the function to be completed\r
84 until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
85\r
86 @retval EFI_SUCCESS The HCI event packet is received successfully.\r
87 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
88 BufferSize is NULL.\r
89 *BufferSize is 0.\r
90 Buffer is NULL.\r
91 @retval EFI_TIMEOUT Receiving HCI event packet fail due to timeout.\r
92 @retval EFI_DEVICE_ERROR Receiving HCI event packet fail due to host controller or device\r
93 error.\r
362c355c
QS
94\r
95**/\r
96typedef\r
97EFI_STATUS\r
98(EFIAPI *EFI_BLUETOOTH_HC_RECEIVE_EVENT)(\r
5a39f404
RN
99 IN EFI_BLUETOOTH_HC_PROTOCOL *This,\r
100 IN OUT UINTN *BufferSize,\r
101 OUT VOID *Buffer,\r
102 IN UINTN Timeout\r
362c355c 103 );\r
5a39f404 104\r
362c355c 105/**\r
5a39f404 106 The async callback of AsyncReceiveEvent().\r
362c355c 107\r
5a39f404
RN
108 @param[in] Data Data received via asynchronous transfer.\r
109 @param[in] DataLength The length of Data in bytes, received via asynchronous\r
110 transfer.\r
111 @param[in] Context Context passed from asynchronous transfer request.\r
362c355c 112\r
5a39f404
RN
113 @retval EFI_SUCCESS The callback does execute successfully.\r
114 @retval Others The callback doesn't execute successfully.\r
362c355c
QS
115\r
116**/\r
117typedef\r
118EFI_STATUS\r
119(EFIAPI *EFI_BLUETOOTH_HC_ASYNC_FUNC_CALLBACK) (\r
5a39f404
RN
120 IN VOID *Data,\r
121 IN UINTN DataLength,\r
122 IN VOID *Context\r
362c355c 123 );\r
5a39f404 124\r
362c355c
QS
125/**\r
126 Receive HCI event packet in non-blocking way.\r
127\r
5a39f404
RN
128 The AsyncReceiveEvent() function receives HCI event packet in non-blocking way. Data\r
129 in Callback function holds the whole HCI event packet, including EventCode, parameter\r
130 length, and parameters.\r
131\r
132 @param[in] This Pointer to the EFI_BLUETOOTH_HC_PROTOCOL instance.\r
133 @param[in] IsNewTransfer If TRUE, a new transfer will be submitted. If FALSE, the\r
134 request is deleted.\r
135 @param[in] PollingInterval Indicates the periodic rate, in milliseconds, that the\r
136 transfer is to be executed.\r
137 @param[in] DataLength Specifies the length, in bytes, of the data to be received.\r
138 @param[in] Callback The callback function. This function is called if the\r
139 asynchronous transfer is completed.\r
140 @param[in] Context Data passed into Callback function. This is optional\r
141 parameter and may be NULL.\r
142\r
143 @retval EFI_SUCCESS The HCI asynchronous receive request is submitted successfully.\r
144 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
145 DataLength is 0.\r
146 If IsNewTransfer is TRUE, and an asynchronous receive\r
147 request already exists.\r
362c355c
QS
148**/\r
149typedef\r
150EFI_STATUS\r
5a39f404
RN
151(EFIAPI *EFI_BLUETOOTH_HC_ASYNC_RECEIVE_EVENT) (\r
152 IN EFI_BLUETOOTH_HC_PROTOCOL *This,\r
153 IN BOOLEAN IsNewTransfer,\r
154 IN UINTN PollingInterval,\r
155 IN UINTN DataLength,\r
156 IN EFI_BLUETOOTH_HC_ASYNC_FUNC_CALLBACK Callback,\r
157 IN VOID *Context\r
362c355c 158 );\r
5a39f404 159\r
362c355c
QS
160/**\r
161 Send HCI ACL data packet.\r
162\r
5a39f404
RN
163 The SendACLData() function sends HCI ACL data packet. Buffer holds the whole HCI ACL\r
164 data packet, including Handle, PB flag, BC flag, data length, and data.\r
165\r
166 The SendACLData() function and ReceiveACLData() function just send and receive data\r
167 payload from application layer. In order to protect the payload data, the Bluetooth bus is\r
168 required to call HCI_Set_Connection_Encryption command to enable hardware based\r
169 encryption after authentication completed, according to pairing mode and host\r
170 capability.\r
171\r
172 @param[in] This Pointer to the EFI_BLUETOOTH_HC_PROTOCOL instance.\r
173 @param[in, out] BufferSize On input, indicates the size, in bytes, of the data buffer\r
174 specified by Buffer. On output, indicates the amount of\r
175 data actually transferred.\r
176 @param[in] Buffer A pointer to the buffer of data that will be transmitted to\r
177 Bluetooth host controller.\r
178 @param[in] Timeout Indicating the transfer should be completed within this\r
179 time frame. The units are in milliseconds. If Timeout is 0,\r
180 then the caller must wait for the function to be completed\r
181 until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
182\r
183 @retval EFI_SUCCESS The HCI ACL data packet is sent successfully.\r
184 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
185 BufferSize is NULL.\r
186 *BufferSize is 0.\r
187 Buffer is NULL.\r
188 @retval EFI_TIMEOUT Sending HCI ACL data packet fail due to timeout.\r
189 @retval EFI_DEVICE_ERROR Sending HCI ACL data packet fail due to host controller or device\r
190 error.\r
362c355c
QS
191\r
192**/\r
193typedef\r
194EFI_STATUS\r
195(EFIAPI *EFI_BLUETOOTH_HC_SEND_ACL_DATA)(\r
5a39f404
RN
196 IN EFI_BLUETOOTH_HC_PROTOCOL *This,\r
197 IN OUT UINTN *BufferSize,\r
198 IN VOID *Buffer,\r
199 IN UINTN Timeout\r
362c355c 200 );\r
5a39f404 201\r
362c355c
QS
202/**\r
203 Receive HCI ACL data packet.\r
204\r
5a39f404
RN
205 The ReceiveACLData() function receives HCI ACL data packet. Buffer holds the whole HCI\r
206 ACL data packet, including Handle, PB flag, BC flag, data length, and data.\r
207\r
208 @param[in] This Pointer to the EFI_BLUETOOTH_HC_PROTOCOL instance.\r
209 @param[in, out] BufferSize On input, indicates the size, in bytes, of the data buffer\r
210 specified by Buffer. On output, indicates the amount of\r
211 data actually transferred.\r
212 @param[out] Buffer A pointer to the buffer of data that will be received from\r
213 Bluetooth host controller.\r
214 @param[in] Timeout Indicating the transfer should be completed within this\r
215 time frame. The units are in milliseconds. If Timeout is 0,\r
216 then the caller must wait for the function to be completed\r
217 until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
218\r
219 @retval EFI_SUCCESS The HCI ACL data packet is received successfully.\r
220 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
221 BufferSize is NULL.\r
222 *BufferSize is 0.\r
223 Buffer is NULL.\r
224 @retval EFI_TIMEOUT Receiving HCI ACL data packet fail due to timeout.\r
225 @retval EFI_DEVICE_ERROR Receiving HCI ACL data packet fail due to host controller or device\r
226 error.\r
362c355c
QS
227\r
228**/\r
229typedef\r
230EFI_STATUS\r
231(EFIAPI *EFI_BLUETOOTH_HC_RECEIVE_ACL_DATA)(\r
5a39f404
RN
232 IN EFI_BLUETOOTH_HC_PROTOCOL *This,\r
233 IN OUT UINTN *BufferSize,\r
234 OUT VOID *Buffer,\r
235 IN UINTN Timeout\r
362c355c 236 );\r
362c355c
QS
237\r
238/**\r
239 Receive HCI ACL data packet in non-blocking way.\r
240\r
5a39f404
RN
241 The AsyncReceiveACLData() function receives HCI ACL data packet in non-blocking way.\r
242 Data in Callback holds the whole HCI ACL data packet, including Handle, PB flag, BC flag,\r
243 data length, and data.\r
244\r
245 @param[in] This Pointer to the EFI_BLUETOOTH_HC_PROTOCOL instance.\r
246 @param[in] IsNewTransfer If TRUE, a new transfer will be submitted. If FALSE, the\r
247 request is deleted.\r
248 @param[in] PollingInterval Indicates the periodic rate, in milliseconds, that the\r
249 transfer is to be executed.\r
250 @param[in] DataLength Specifies the length, in bytes, of the data to be received.\r
251 @param[in] Callback The callback function. This function is called if the\r
252 asynchronous transfer is completed.\r
253 @param[in] Context Data passed into Callback function. This is optional\r
254 parameter and may be NULL.\r
255\r
256 @retval EFI_SUCCESS The HCI asynchronous receive request is submitted successfully.\r
257 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
258 DataLength is 0.\r
259 If IsNewTransfer is TRUE, and an asynchronous receive\r
260 request already exists.\r
362c355c
QS
261**/\r
262typedef\r
263EFI_STATUS\r
264(EFIAPI *EFI_BLUETOOTH_HC_ASYNC_RECEIVE_ACL_DATA) (\r
5a39f404
RN
265 IN EFI_BLUETOOTH_HC_PROTOCOL *This,\r
266 IN BOOLEAN IsNewTransfer,\r
267 IN UINTN PollingInterval,\r
268 IN UINTN DataLength,\r
269 IN EFI_BLUETOOTH_HC_ASYNC_FUNC_CALLBACK Callback,\r
270 IN VOID *Context\r
362c355c 271 );\r
5a39f404 272\r
362c355c
QS
273/**\r
274 Send HCI SCO data packet.\r
275\r
5a39f404
RN
276 The SendSCOData() function sends HCI SCO data packet. Buffer holds the whole HCI SCO\r
277 data packet, including ConnectionHandle, PacketStatus flag, data length, and data.\r
278\r
279 @param[in] This Pointer to the EFI_BLUETOOTH_HC_PROTOCOL instance.\r
280 @param[in,out] BufferSize On input, indicates the size, in bytes, of the data buffer\r
281 specified by Buffer. On output, indicates the amount of\r
282 data actually transferred.\r
283 @param[in] Buffer A pointer to the buffer of data that will be transmitted to\r
284 Bluetooth host controller.\r
285 @param[in] Timeout Indicating the transfer should be completed within this\r
286 time frame. The units are in milliseconds. If Timeout is 0,\r
287 then the caller must wait for the function to be completed\r
288 until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
289\r
290 @retval EFI_SUCCESS The HCI SCO data packet is sent successfully.\r
291 @retval EFI_UNSUPPORTED The implementation does not support HCI SCO transfer.\r
292 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
293 BufferSize is NULL.\r
294 *BufferSize is 0.\r
295 Buffer is NULL.\r
296 @retval EFI_TIMEOUT Sending HCI SCO data packet fail due to timeout.\r
297 @retval EFI_DEVICE_ERROR Sending HCI SCO data packet fail due to host controller or device\r
298 error.\r
362c355c
QS
299**/\r
300typedef\r
301EFI_STATUS\r
302(EFIAPI *EFI_BLUETOOTH_HC_SEND_SCO_DATA)(\r
5a39f404
RN
303 IN EFI_BLUETOOTH_HC_PROTOCOL *This,\r
304 IN OUT UINTN *BufferSize,\r
305 IN VOID *Buffer,\r
306 IN UINTN Timeout\r
362c355c 307 );\r
5a39f404 308\r
362c355c
QS
309/**\r
310 Receive HCI SCO data packet.\r
311\r
5a39f404
RN
312 The ReceiveSCOData() function receives HCI SCO data packet. Buffer holds the whole HCI\r
313 SCO data packet, including ConnectionHandle, PacketStatus flag, data length, and data.\r
314\r
315 @param[in] This Pointer to the EFI_BLUETOOTH_HC_PROTOCOL instance.\r
316 @param[in,out] BufferSize On input, indicates the size, in bytes, of the data buffer\r
317 specified by Buffer. On output, indicates the amount of\r
318 data actually transferred.\r
319 @param[out] Buffer A pointer to the buffer of data that will be received from\r
320 Bluetooth host controller.\r
321 @param[in] Timeout Indicating the transfer should be completed within this\r
322 time frame. The units are in milliseconds. If Timeout is 0,\r
323 then the caller must wait for the function to be completed\r
324 until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
325\r
326 @retval EFI_SUCCESS The HCI SCO data packet is received successfully.\r
327 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
328 BufferSize is NULL.\r
329 *BufferSize is 0.\r
330 Buffer is NULL.\r
331 @retval EFI_TIMEOUT Receiving HCI SCO data packet fail due to timeout.\r
332 @retval EFI_DEVICE_ERROR Receiving HCI SCO data packet fail due to host controller or device\r
333 error.\r
362c355c
QS
334**/\r
335typedef\r
336EFI_STATUS\r
337(EFIAPI *EFI_BLUETOOTH_HC_RECEIVE_SCO_DATA)(\r
5a39f404
RN
338 IN EFI_BLUETOOTH_HC_PROTOCOL *This,\r
339 IN OUT UINTN *BufferSize,\r
340 OUT VOID *Buffer,\r
341 IN UINTN Timeout\r
362c355c
QS
342 );\r
343\r
344/**\r
345 Receive HCI SCO data packet in non-blocking way.\r
346\r
5a39f404
RN
347 The AsyncReceiveSCOData() function receives HCI SCO data packet in non-blocking way.\r
348 Data in Callback holds the whole HCI SCO data packet, including ConnectionHandle,\r
349 PacketStatus flag, data length, and data.\r
350\r
351 @param[in] This Pointer to the EFI_BLUETOOTH_HC_PROTOCOL instance.\r
352 @param[in] IsNewTransfer If TRUE, a new transfer will be submitted. If FALSE, the\r
353 request is deleted.\r
354 @param[in] PollingInterval Indicates the periodic rate, in milliseconds, that the\r
355 transfer is to be executed.\r
356 @param[in] DataLength Specifies the length, in bytes, of the data to be received.\r
357 @param[in] Callback The callback function. This function is called if the\r
358 asynchronous transfer is completed.\r
359 @param[in] Context Data passed into Callback function. This is optional\r
360 parameter and may be NULL.\r
361\r
362 @retval EFI_SUCCESS The HCI asynchronous receive request is submitted successfully.\r
363 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
364 DataLength is 0.\r
365 If IsNewTransfer is TRUE, and an asynchronous receive\r
366 request already exists.\r
362c355c
QS
367**/\r
368typedef\r
369EFI_STATUS\r
370(EFIAPI *EFI_BLUETOOTH_HC_ASYNC_RECEIVE_SCO_DATA) (\r
5a39f404
RN
371 IN EFI_BLUETOOTH_HC_PROTOCOL *This,\r
372 IN BOOLEAN IsNewTransfer,\r
373 IN UINTN PollingInterval,\r
374 IN UINTN DataLength,\r
375 IN EFI_BLUETOOTH_HC_ASYNC_FUNC_CALLBACK Callback,\r
376 IN VOID *Context\r
362c355c 377 );\r
5a39f404
RN
378\r
379//\r
380// The EFI_BLUETOOTH_HC_PROTOCOL is used to transmit or receive HCI layer data packets.\r
381//\r
362c355c 382struct _EFI_BLUETOOTH_HC_PROTOCOL {\r
5a39f404
RN
383 //\r
384 // Send HCI command packet.\r
385 //\r
362c355c 386 EFI_BLUETOOTH_HC_SEND_COMMAND SendCommand;\r
5a39f404
RN
387 //\r
388 // Receive HCI event packets.\r
389 //\r
362c355c 390 EFI_BLUETOOTH_HC_RECEIVE_EVENT ReceiveEvent;\r
5a39f404
RN
391 //\r
392 // Non-blocking receive HCI event packets.\r
393 //\r
362c355c 394 EFI_BLUETOOTH_HC_ASYNC_RECEIVE_EVENT AsyncReceiveEvent;\r
5a39f404
RN
395 //\r
396 // Send HCI ACL (asynchronous connection-oriented) data packets.\r
397 //\r
362c355c 398 EFI_BLUETOOTH_HC_SEND_ACL_DATA SendACLData;\r
5a39f404
RN
399 //\r
400 // Receive HCI ACL data packets.\r
401 //\r
362c355c 402 EFI_BLUETOOTH_HC_RECEIVE_ACL_DATA ReceiveACLData;\r
5a39f404
RN
403 //\r
404 // Non-blocking receive HCI ACL data packets.\r
405 //\r
362c355c 406 EFI_BLUETOOTH_HC_ASYNC_RECEIVE_ACL_DATA AsyncReceiveACLData;\r
5a39f404
RN
407 //\r
408 // Send HCI synchronous (SCO and eSCO) data packets.\r
409 //\r
362c355c 410 EFI_BLUETOOTH_HC_SEND_SCO_DATA SendSCOData;\r
5a39f404
RN
411 //\r
412 // Receive HCI synchronous data packets.\r
413 //\r
362c355c 414 EFI_BLUETOOTH_HC_RECEIVE_SCO_DATA ReceiveSCOData;\r
5a39f404
RN
415 //\r
416 // Non-blocking receive HCI synchronous data packets.\r
417 //\r
362c355c
QS
418 EFI_BLUETOOTH_HC_ASYNC_RECEIVE_SCO_DATA AsyncReceiveSCOData;\r
419};\r
5a39f404 420\r
362c355c
QS
421extern EFI_GUID gEfiBluetoothHcProtocolGuid;\r
422\r
423#endif\r
5a39f404 424\r