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