The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
Jakub Pawlowski | 5b790fe | 2017-09-18 09:00:20 -0700 | [diff] [blame] | 3 | * Copyright 1999-2012 Broadcom Corporation |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 4 | * |
| 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 Radoslavov | 258c253 | 2015-09-27 20:59:05 -0700 | [diff] [blame] | 30 | #include "bt_common.h" |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 31 | #include "bt_target.h" |
Jack He | 6d11052 | 2018-07-25 21:43:01 -0700 | [diff] [blame] | 32 | #include "common/message_loop_thread.h" |
Pavlin Radoslavov | 78bcff7 | 2015-12-04 17:36:34 -0800 | [diff] [blame] | 33 | #include "osi/include/alarm.h" |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 34 | |
Jakub Pawlowski | 67f5f37 | 2018-07-23 10:00:25 -0700 | [diff] [blame] | 35 | #include <base/callback.h> |
| 36 | #include <base/location.h> |
| 37 | #include <base/threading/thread.h> |
| 38 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 39 | /* Global BTU data */ |
Pavlin Radoslavov | 78bcff7 | 2015-12-04 17:36:34 -0800 | [diff] [blame] | 40 | extern uint8_t btu_trace_level; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 41 | |
Pavlin Radoslavov | b2a292b | 2016-10-14 19:34:48 -0700 | [diff] [blame] | 42 | /* Functions provided by btu_hcif.cc |
Myles Watson | ee96a3c | 2016-11-23 14:49:54 -0800 | [diff] [blame] | 43 | *********************************** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 44 | */ |
Ajay Panicker | 2b7e905 | 2017-03-01 10:00:30 -0800 | [diff] [blame] | 45 | void btu_hcif_process_event(uint8_t controller_id, BT_HDR* p_buf); |
| 46 | void btu_hcif_send_cmd(uint8_t controller_id, BT_HDR* p_msg); |
Jakub Pawlowski | 67f5f37 | 2018-07-23 10:00:25 -0700 | [diff] [blame] | 47 | void btu_hcif_send_cmd_with_cb(const base::Location& posted_from, |
Ajay Panicker | 2b7e905 | 2017-03-01 10:00:30 -0800 | [diff] [blame] | 48 | uint16_t opcode, uint8_t* params, |
| 49 | uint8_t params_len, |
Jakub Pawlowski | c74471d | 2018-10-30 18:29:36 +0100 | [diff] [blame] | 50 | base::OnceCallback<void(uint8_t*, uint16_t)> cb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 51 | |
Pavlin Radoslavov | b2a292b | 2016-10-14 19:34:48 -0700 | [diff] [blame] | 52 | /* Functions provided by btu_init.cc |
Myles Watson | ee96a3c | 2016-11-23 14:49:54 -0800 | [diff] [blame] | 53 | *********************************** |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 54 | */ |
Ajay Panicker | 2b7e905 | 2017-03-01 10:00:30 -0800 | [diff] [blame] | 55 | void btu_init_core(void); |
| 56 | void btu_free_core(void); |
| 57 | |
| 58 | /* Functions provided by btu_task.cc |
| 59 | *********************************** |
| 60 | */ |
Cheney Ni | 32c6ba5 | 2018-12-12 20:20:28 +0800 | [diff] [blame] | 61 | bluetooth::common::MessageLoopThread* get_main_thread(); |
Jack He | 96d16e3 | 2018-08-27 13:55:14 -0700 | [diff] [blame] | 62 | base::MessageLoop* get_main_message_loop(); |
Jakub Pawlowski | 67f5f37 | 2018-07-23 10:00:25 -0700 | [diff] [blame] | 63 | bt_status_t do_in_main_thread(const base::Location& from_here, |
Jack He | 96d16e3 | 2018-08-27 13:55:14 -0700 | [diff] [blame] | 64 | base::OnceClosure task); |
Cheney Ni | f2cf5eb | 2020-02-19 17:41:59 +0800 | [diff] [blame] | 65 | bt_status_t do_in_main_thread_delayed(const base::Location& from_here, |
| 66 | base::OnceClosure task, |
| 67 | const base::TimeDelta& delay); |
Sharvil Nanavati | f79d286 | 2014-09-06 16:16:19 -0700 | [diff] [blame] | 68 | |
| 69 | void BTU_StartUp(void); |
| 70 | void BTU_ShutDown(void); |
| 71 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 72 | #endif |