1 /****************************************************************************** 2 * 3 * Copyright 1999-2012 Broadcom Corporation 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 30 #include "bt_common.h" 31 #include "bt_target.h" 32 #include "common/message_loop_thread.h" 33 #include "osi/include/alarm.h" 34 35 #include <base/callback.h> 36 #include <base/location.h> 37 #include <base/threading/thread.h> 38 39 /* Global BTU data */ 40 extern uint8_t btu_trace_level; 41 42 /* Functions provided by btu_hcif.cc 43 *********************************** 44 */ 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); 47 void btu_hcif_send_cmd_with_cb(const base::Location& posted_from, 48 uint16_t opcode, uint8_t* params, 49 uint8_t params_len, 50 base::OnceCallback<void(uint8_t*, uint16_t)> cb); 51 52 /* Functions provided by btu_init.cc 53 *********************************** 54 */ 55 void btu_init_core(void); 56 void btu_free_core(void); 57 58 /* Functions provided by btu_task.cc 59 *********************************** 60 */ 61 bluetooth::common::MessageLoopThread* get_main_thread(); 62 base::MessageLoop* get_main_message_loop(); 63 bt_status_t do_in_main_thread(const base::Location& from_here, 64 base::OnceClosure task); 65 bt_status_t do_in_main_thread_delayed(const base::Location& from_here, 66 base::OnceClosure task, 67 const base::TimeDelta& delay); 68 69 void BTU_StartUp(void); 70 void BTU_ShutDown(void); 71 72 #endif 73