blob: 03fe2a19645d5467452a895c83a595a95db38d70 [file] [log] [blame]
The Android Open Source Project5738f832012-12-12 16:00:35 -08001/******************************************************************************
2 *
Jakub Pawlowski5b790fe2017-09-18 09:00:20 -07003 * Copyright 1999-2012 Broadcom Corporation
The Android Open Source Project5738f832012-12-12 16:00:35 -08004 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 ******************************************************************************/
18
19/******************************************************************************
20 *
21 * this file contains the main Bluetooth Upper Layer definitions. The Broadcom
22 * implementations of L2CAP RFCOMM, SDP and the BTIf run as one GKI task. The
23 * btu_task switches between them.
24 *
25 ******************************************************************************/
26
27#ifndef BTU_H
28#define BTU_H
29
Pavlin Radoslavov258c2532015-09-27 20:59:05 -070030#include "bt_common.h"
Myles Watson911d1ae2016-11-28 16:44:40 -080031#include "bt_target.h"
Jack He6d110522018-07-25 21:43:01 -070032#include "common/message_loop_thread.h"
Pavlin Radoslavov78bcff72015-12-04 17:36:34 -080033#include "osi/include/alarm.h"
The Android Open Source Project5738f832012-12-12 16:00:35 -080034
Jakub Pawlowski67f5f372018-07-23 10:00:25 -070035#include <base/callback.h>
36#include <base/location.h>
37#include <base/threading/thread.h>
38
The Android Open Source Project5738f832012-12-12 16:00:35 -080039/* Global BTU data */
Pavlin Radoslavov78bcff72015-12-04 17:36:34 -080040extern uint8_t btu_trace_level;
The Android Open Source Project5738f832012-12-12 16:00:35 -080041
Pavlin Radoslavovb2a292b2016-10-14 19:34:48 -070042/* Functions provided by btu_hcif.cc
Myles Watsonee96a3c2016-11-23 14:49:54 -080043 ***********************************
The Android Open Source Project5738f832012-12-12 16:00:35 -080044*/
Ajay Panicker2b7e9052017-03-01 10:00:30 -080045void btu_hcif_process_event(uint8_t controller_id, BT_HDR* p_buf);
46void btu_hcif_send_cmd(uint8_t controller_id, BT_HDR* p_msg);
Jakub Pawlowski67f5f372018-07-23 10:00:25 -070047void btu_hcif_send_cmd_with_cb(const base::Location& posted_from,
Ajay Panicker2b7e9052017-03-01 10:00:30 -080048 uint16_t opcode, uint8_t* params,
49 uint8_t params_len,
Jakub Pawlowskic74471d2018-10-30 18:29:36 +010050 base::OnceCallback<void(uint8_t*, uint16_t)> cb);
The Android Open Source Project5738f832012-12-12 16:00:35 -080051
Pavlin Radoslavovb2a292b2016-10-14 19:34:48 -070052/* Functions provided by btu_init.cc
Myles Watsonee96a3c2016-11-23 14:49:54 -080053 ***********************************
The Android Open Source Project5738f832012-12-12 16:00:35 -080054*/
Ajay Panicker2b7e9052017-03-01 10:00:30 -080055void btu_init_core(void);
56void btu_free_core(void);
57
58/* Functions provided by btu_task.cc
59 ***********************************
60*/
Cheney Ni32c6ba52018-12-12 20:20:28 +080061bluetooth::common::MessageLoopThread* get_main_thread();
Jack He96d16e32018-08-27 13:55:14 -070062base::MessageLoop* get_main_message_loop();
Jakub Pawlowski67f5f372018-07-23 10:00:25 -070063bt_status_t do_in_main_thread(const base::Location& from_here,
Jack He96d16e32018-08-27 13:55:14 -070064 base::OnceClosure task);
Cheney Nif2cf5eb2020-02-19 17:41:59 +080065bt_status_t do_in_main_thread_delayed(const base::Location& from_here,
66 base::OnceClosure task,
67 const base::TimeDelta& delay);
Sharvil Nanavatif79d2862014-09-06 16:16:19 -070068
69void BTU_StartUp(void);
70void BTU_ShutDown(void);
71
The Android Open Source Project5738f832012-12-12 16:00:35 -080072#endif