]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/BluetoothIo.h
MdePkg/ProcessorBind: add defines for page allocation granularity
[mirror_edk2.git] / MdePkg / Include / Protocol / BluetoothIo.h
CommitLineData
362c355c
QS
1/** @file\r
2 EFI Bluetooth IO Service Binding Protocol as defined in UEFI 2.5.\r
3 EFI Bluetooth IO Protocol as defined in UEFI 2.5.\r
4 The EFI Bluetooth IO Service Binding Protocol is used to locate EFI Bluetooth IO Protocol drivers to \r
5 create and destroy child of the driver to communicate with other Bluetooth device by using Bluetooth IO protocol.\r
6\r
7 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
8 This program and the accompanying materials are licensed and made available under \r
9 the terms and conditions of the BSD License that accompanies this distribution. \r
10 The full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php. \r
12 \r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16 @par Revision Reference: \r
17 This Protocol is introduced in UEFI Specification 2.5\r
18\r
19**/\r
20\r
21#ifndef __EFI_BLUETOOTH_IO_PROTOCOL_H__\r
22#define __EFI_BLUETOOTH_IO_PROTOCOL_H__\r
23\r
24#include <IndustryStandard/Bluetooth.h>\r
25\r
26#define EFI_BLUETOOTH_IO_SERVICE_BINDING_PROTOCOL_GUID \\r
27 { \\r
28 0x388278d3, 0x7b85, 0x42f0, { 0xab, 0xa9, 0xfb, 0x4b, 0xfd, 0x69, 0xf5, 0xab } \\r
29 }\r
30 \r
31#define EFI_BLUETOOTH_IO_PROTOCOL_GUID \\r
32 { \\r
33 0x467313de, 0x4e30, 0x43f1, { 0x94, 0x3e, 0x32, 0x3f, 0x89, 0x84, 0x5d, 0xb5 } \\r
34 }\r
35 \r
36typedef struct _EFI_BLUETOOTH_IO_PROTOCOL EFI_BLUETOOTH_IO_PROTOCOL;\r
37\r
38///\r
39/// EFI_BLUETOOTH_DEVICE_INFO\r
40///\r
41typedef struct {\r
42 ///\r
43 /// The version of the structure\r
44 ///\r
45 UINT32 Version;\r
46 ///\r
47 /// 48bit Bluetooth device address.\r
48 ///\r
49 BLUETOOTH_ADDRESS BD_ADDR;\r
50 ///\r
51 /// Bluetooth PageScanRepetitionMode. See Bluetooth specification for detail.\r
52 ///\r
53 UINT8 PageScanRepetitionMode;\r
54 ///\r
55 /// Bluetooth ClassOfDevice. See Bluetooth specification for detail.\r
56 ///\r
57 BLUETOOTH_CLASS_OF_DEVICE ClassOfDevice;\r
58 ///\r
59 /// Bluetooth CloseOffset. See Bluetooth specification for detail.\r
60 ///\r
61 UINT16 ClockOffset;\r
62 ///\r
63 /// Bluetooth RSSI. See Bluetooth specification for detail.\r
64 ///\r
65 UINT8 RSSI;\r
66 ///\r
67 /// Bluetooth ExtendedInquiryResponse. See Bluetooth specification for detail.\r
68 ///\r
69 UINT8 ExtendedInquiryResponse[240];\r
70} EFI_BLUETOOTH_DEVICE_INFO;\r
71\r
72/**\r
73 Get Bluetooth device information.\r
74\r
75 @param This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
76 @param DeviceInfoSize A pointer to the size, in bytes, of the DeviceInfo buffer.\r
77 @param DeviceInfo A pointer to a callee allocated buffer that returns Bluetooth device information.\r
78\r
79 @retval EFI_SUCCESS The Bluetooth device information is returned successfully.\r
80 @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the Bluetooth device information.\r
81\r
82**/\r
83typedef \r
84EFI_STATUS\r
85(EFIAPI *EFI_BLUETOOTH_IO_GET_DEVICE_INFO)(\r
86 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
87 OUT UINTN *DeviceInfoSize,\r
88 OUT VOID **DeviceInfo\r
89 );\r
90 \r
91/**\r
92 Get Bluetooth SDP information.\r
93\r
94 @param This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
95 @param SdpInfoSize A pointer to the size, in bytes, of the SdpInfo buffer.\r
96 @param SdpInfo A pointer to a callee allocated buffer that returns Bluetooth SDP information.\r
97\r
98 @retval EFI_SUCCESS The Bluetooth device information is returned successfully.\r
99 @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the Bluetooth SDP information.\r
100\r
101**/\r
102typedef \r
103EFI_STATUS\r
104(EFIAPI *EFI_BLUETOOTH_IO_GET_SDP_INFO)(\r
105 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
106 OUT UINTN *SdpInfoSize,\r
107 OUT VOID **SdpInfo\r
108 );\r
109 \r
110/**\r
111 Send L2CAP message (including L2CAP header).\r
112\r
113 @param This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
114 @param BufferSize On input, indicates the size, in bytes, of the data buffer specified by Buffer. \r
115 On output, indicates the amount of data actually transferred.\r
116 @param Buffer A pointer to the buffer of data that will be transmitted to Bluetooth L2CAP layer.\r
117 @param Timeout Indicating the transfer should be completed within this time frame. The units are in \r
118 milliseconds. If Timeout is 0, then the caller must wait for the function to be completed \r
119 until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
120\r
121 @retval EFI_SUCCESS The L2CAP message is sent successfully.\r
122 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
123 - BufferSize is NULL.\r
124 - *BufferSize is 0.\r
125 - Buffer is NULL.\r
126 @retval EFI_TIMEOUT Sending L2CAP message fail due to timeout.\r
127 @retval EFI_DEVICE_ERROR Sending L2CAP message fail due to host controller or device error.\r
128\r
129**/\r
130typedef \r
131EFI_STATUS\r
132(EFIAPI *EFI_BLUETOOTH_IO_L2CAP_RAW_SEND)(\r
133 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
134 IN OUT UINTN *BufferSize,\r
135 IN VOID *Buffer,\r
136 IN UINTN Timeout\r
137 );\r
138 \r
139/**\r
140 Receive L2CAP message (including L2CAP header).\r
141\r
142 @param This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
143 @param BufferSize On input, indicates the size, in bytes, of the data buffer specified by Buffer. \r
144 On output, indicates the amount of data actually transferred.\r
145 @param Buffer A pointer to the buffer of data that will be received from Bluetooth L2CAP layer.\r
146 @param Timeout Indicating the transfer should be completed within this time frame. The units are in \r
147 milliseconds. If Timeout is 0, then the caller must wait for the function to be completed \r
148 until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
149\r
150 @retval EFI_SUCCESS The L2CAP message is received successfully.\r
151 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
152 - BufferSize is NULL.\r
153 - *BufferSize is 0.\r
154 - Buffer is NULL.\r
155 @retval EFI_TIMEOUT Receiving L2CAP message fail due to timeout.\r
156 @retval EFI_DEVICE_ERROR Receiving L2CAP message fail due to host controller or device error.\r
157\r
158**/\r
159typedef \r
160EFI_STATUS\r
161(EFIAPI *EFI_BLUETOOTH_IO_L2CAP_RAW_RECEIVE)(\r
162 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
163 IN OUT UINTN *BufferSize,\r
164 OUT VOID *Buffer,\r
165 IN UINTN Timeout\r
166 );\r
167 \r
168/**\r
169 Callback function, it is called when asynchronous transfer is completed.\r
170\r
171 @param ChannelID Bluetooth L2CAP message channel ID.\r
172 @param Data Data received via asynchronous transfer.\r
173 @param DataLength The length of Data in bytes, received via asynchronous transfer.\r
174 @param Context Context passed from asynchronous transfer request.\r
175\r
176 @retval EFI_SUCCESS The callback function complete successfully.\r
177\r
178**/\r
179typedef\r
180EFI_STATUS\r
181(EFIAPI *EFI_BLUETOOTH_IO_ASYNC_FUNC_CALLBACK) (\r
182 IN UINT16 ChannelID,\r
183 IN VOID *Data,\r
184 IN UINTN DataLength,\r
185 IN VOID *Context\r
186 );\r
187 \r
188/**\r
189 Receive L2CAP message (including L2CAP header) in non-blocking way.\r
190\r
191 @param This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
192 @param IsNewTransfer If TRUE, a new transfer will be submitted. If FALSE, the request is deleted.\r
193 @param PollingInterval Indicates the periodic rate, in milliseconds, that the transfer is to be executed.\r
194 @param DataLength Specifies the length, in bytes, of the data to be received.\r
195 @param Callback The callback function. This function is called if the asynchronous transfer is \r
196 completed.\r
197 @param Context Data passed into Callback function. This is optional parameter and may be NULL. \r
198 \r
199 @retval EFI_SUCCESS The L2CAP asynchronous receive request is submitted successfully.\r
200 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
201 - DataLength is 0.\r
202 - If IsNewTransfer is TRUE, and an asynchronous receive request already exists.\r
203\r
204**/\r
205typedef \r
206EFI_STATUS\r
207(EFIAPI *EFI_BLUETOOTH_IO_L2CAP_RAW_ASYNC_RECEIVE)(\r
208 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
209 IN BOOLEAN IsNewTransfer,\r
210 IN UINTN PollingInterval,\r
211 IN UINTN DataLength,\r
212 IN EFI_BLUETOOTH_IO_ASYNC_FUNC_CALLBACK Callback,\r
213 IN VOID *Context\r
214 );\r
215\r
216/**\r
217 Send L2CAP message (excluding L2CAP header) to a specific channel.\r
218\r
219 @param This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
220 @param Handle A handle created by EFI_BLUETOOTH_IO_PROTOCOL.L2CapConnect indicates which channel to send.\r
221 @param BufferSize On input, indicates the size, in bytes, of the data buffer specified by Buffer. \r
222 On output, indicates the amount of data actually transferred.\r
223 @param Buffer A pointer to the buffer of data that will be transmitted to Bluetooth L2CAP layer.\r
224 @param Timeout Indicating the transfer should be completed within this time frame. The units are in \r
225 milliseconds. If Timeout is 0, then the caller must wait for the function to be completed \r
226 until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
227\r
228 @retval EFI_SUCCESS The L2CAP message is sent successfully.\r
229 @retval EFI_NOT_FOUND Handle is invalid or not found.\r
230 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
231 - BufferSize is NULL.\r
232 - *BufferSize is 0.\r
233 - Buffer is NULL.\r
234 @retval EFI_TIMEOUT Sending L2CAP message fail due to timeout.\r
235 @retval EFI_DEVICE_ERROR Sending L2CAP message fail due to host controller or device error.\r
236\r
237**/\r
238typedef \r
239EFI_STATUS\r
240(EFIAPI *EFI_BLUETOOTH_IO_L2CAP_SEND)(\r
241 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
242 IN EFI_HANDLE Handle,\r
243 IN OUT UINTN *BufferSize,\r
244 IN VOID *Buffer,\r
245 IN UINTN Timeout\r
246 );\r
247 \r
248/**\r
249 Receive L2CAP message (excluding L2CAP header) from a specific channel.\r
250\r
251 @param This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
252 @param Handle A handle created by EFI_BLUETOOTH_IO_PROTOCOL.L2CapConnect indicates which channel to receive.\r
253 @param BufferSize Indicates the size, in bytes, of the data buffer specified by Buffer.\r
254 @param Buffer A pointer to the buffer of data that will be received from Bluetooth L2CAP layer.\r
255 @param Timeout Indicating the transfer should be completed within this time frame. The units are in \r
256 milliseconds. If Timeout is 0, then the caller must wait for the function to be completed \r
257 until EFI_SUCCESS or EFI_DEVICE_ERROR is returned.\r
258\r
259 @retval EFI_SUCCESS The L2CAP message is received successfully.\r
260 @retval EFI_NOT_FOUND Handle is invalid or not found.\r
261 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
262 - BufferSize is NULL.\r
263 - *BufferSize is 0.\r
264 - Buffer is NULL.\r
265 @retval EFI_TIMEOUT Receiving L2CAP message fail due to timeout.\r
266 @retval EFI_DEVICE_ERROR Receiving L2CAP message fail due to host controller or device error.\r
267\r
268**/\r
269typedef \r
270EFI_STATUS\r
271(EFIAPI *EFI_BLUETOOTH_IO_L2CAP_RECEIVE)(\r
272 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
273 IN EFI_HANDLE Handle,\r
274 OUT UINTN *BufferSize,\r
275 OUT VOID **Buffer,\r
276 IN UINTN Timeout\r
277 );\r
278 \r
279/**\r
280 Callback function, it is called when asynchronous transfer is completed.\r
281\r
282 @param Data Data received via asynchronous transfer.\r
283 @param DataLength The length of Data in bytes, received via asynchronous transfer.\r
284 @param Context Context passed from asynchronous transfer request.\r
285\r
286 @retval EFI_SUCCESS The callback function complete successfully.\r
287\r
288**/\r
289typedef\r
290EFI_STATUS\r
291(EFIAPI *EFI_BLUETOOTH_IO_CHANNEL_SERVICE_CALLBACK) (\r
292 IN VOID *Data,\r
293 IN UINTN DataLength,\r
294 IN VOID *Context\r
295 );\r
296 \r
297/**\r
298 Receive L2CAP message (excluding L2CAP header) in non-blocking way from a specific channel.\r
299\r
300 @param This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
301 @param Handel A handle created by EFI_BLUETOOTH_IO_PROTOCOL.L2CapConnect indicates which channel to receive.\r
302 @param Callback The callback function. This function is called if the asynchronous transfer is \r
303 completed.\r
304 @param Context Data passed into Callback function. This is optional parameter and may be NULL. \r
305 \r
306 @retval EFI_SUCCESS The L2CAP asynchronous receive request is submitted successfully.\r
307 @retval EFI_NOT_FOUND Handle is invalid or not found.\r
308 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
309 - DataLength is 0.\r
310 - If an asynchronous receive request already exists on same Handle.\r
311\r
312**/\r
313typedef \r
314EFI_STATUS\r
315(EFIAPI *EFI_BLUETOOTH_IO_L2CAP_ASYNC_RECEIVE)(\r
316 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
317 IN EFI_HANDLE Handle,\r
318 IN EFI_BLUETOOTH_IO_CHANNEL_SERVICE_CALLBACK Callback,\r
319 IN VOID *Context\r
320 );\r
321 \r
322/**\r
323 Do L2CAP connection.\r
324\r
325 @param This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
326 @param Handel A handle to indicate this L2CAP connection.\r
327 @param Psm Bluetooth PSM. See Bluetooth specification for detail.\r
328 @param Mtu Bluetooth MTU. See Bluetooth specification for detail.\r
329 @param Callback The callback function. This function is called whenever there is message received \r
330 in this channel.\r
331 @param Context Data passed into Callback function. This is optional parameter and may be NULL.\r
332 \r
333 @retval EFI_SUCCESS The Bluetooth L2CAP layer connection is created successfully.\r
334 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
335 - Handle is NULL.\r
336 @retval EFI_DEVICE_ERROR A hardware error occurred trying to do Bluetooth L2CAP connection.\r
337\r
338**/\r
339typedef \r
340EFI_STATUS\r
341(EFIAPI *EFI_BLUETOOTH_IO_L2CAP_CONNECT)(\r
342 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
343 OUT EFI_HANDLE *Handle,\r
344 IN UINT16 Psm,\r
345 IN UINT16 Mtu,\r
346 IN EFI_BLUETOOTH_IO_CHANNEL_SERVICE_CALLBACK Callback,\r
347 IN VOID *Context\r
348 );\r
349 \r
350/**\r
351 Do L2CAP disconnection.\r
352\r
353 @param This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
354 @param Handel A handle to indicate this L2CAP connection.\r
355 \r
356 @retval EFI_SUCCESS The Bluetooth L2CAP layer is disconnected successfully.\r
357 @retval EFI_NOT_FOUND Handle is invalid or not found.\r
358 @retval EFI_DEVICE_ERROR A hardware error occurred trying to do Bluetooth L2CAP disconnection.\r
359\r
360**/\r
361typedef \r
362EFI_STATUS\r
363(EFIAPI *EFI_BLUETOOTH_IO_L2CAP_DISCONNECT)(\r
364 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
365 IN EFI_HANDLE Handle\r
366 );\r
367 \r
368/**\r
369 Register L2CAP callback function for special channel.\r
370\r
371 @param This Pointer to the EFI_BLUETOOTH_IO_PROTOCOL instance.\r
372 @param Handel A handle to indicate this L2CAP connection.\r
373 @param Psm Bluetooth PSM. See Bluetooth specification for detail.\r
374 @param Mtu Bluetooth MTU. See Bluetooth specification for detail.\r
375 @param Callback The callback function. This function is called whenever there is message received \r
376 in this channel. NULL means unregister.\r
377 @param Context Data passed into Callback function. This is optional parameter and may be NULL.\r
378 \r
379 @retval EFI_SUCCESS The Bluetooth L2CAP callback function is registered successfully.\r
380 @retval EFI_ALREADY_STARTED The callback function already exists when register.\r
381 @retval EFI_NOT_FOUND The callback function does not exist when unregister.\r
382\r
383**/\r
384typedef \r
385EFI_STATUS\r
386(EFIAPI *EFI_BLUETOOTH_IO_L2CAP_REGISTER_SERVICE)(\r
387 IN EFI_BLUETOOTH_IO_PROTOCOL *This,\r
388 OUT EFI_HANDLE *Handle,\r
389 IN UINT16 Psm,\r
390 IN UINT16 Mtu,\r
391 IN EFI_BLUETOOTH_IO_CHANNEL_SERVICE_CALLBACK Callback,\r
392 IN VOID *Context\r
393 );\r
394 \r
395///\r
396/// This protocol provides service for Bluetooth L2CAP (Logical Link Control and Adaptation Protocol) \r
397/// and SDP (Service Discovery Protocol).\r
398///\r
399struct _EFI_BLUETOOTH_IO_PROTOCOL {\r
400 EFI_BLUETOOTH_IO_GET_DEVICE_INFO GetDeviceInfo;\r
401 EFI_BLUETOOTH_IO_GET_SDP_INFO GetSdpInfo;\r
402 EFI_BLUETOOTH_IO_L2CAP_RAW_SEND L2CapRawSend;\r
403 EFI_BLUETOOTH_IO_L2CAP_RAW_RECEIVE L2CapRawReceive;\r
404 EFI_BLUETOOTH_IO_L2CAP_RAW_ASYNC_RECEIVE L2CapRawAsyncReceive;\r
405 EFI_BLUETOOTH_IO_L2CAP_SEND L2CapSend;\r
406 EFI_BLUETOOTH_IO_L2CAP_RECEIVE L2CapReceive;\r
407 EFI_BLUETOOTH_IO_L2CAP_ASYNC_RECEIVE L2CapAsyncReceive;\r
408 EFI_BLUETOOTH_IO_L2CAP_CONNECT L2CapConnect;\r
409 EFI_BLUETOOTH_IO_L2CAP_DISCONNECT L2CapDisconnect;\r
410 EFI_BLUETOOTH_IO_L2CAP_REGISTER_SERVICE L2CapRegisterService;\r
411};\r
412\r
413extern EFI_GUID gEfiBluetoothIoServiceBindingProtocolGuid;\r
414extern EFI_GUID gEfiBluetoothIoProtocolGuid;\r
415\r
416#endif\r