• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright (C) 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 <base/callback.h>
31 #include <base/location.h>
32 #include "bt_common.h"
33 #include "bt_target.h"
34 #include "osi/include/alarm.h"
35 
36 // HACK(zachoverflow): temporary dark magic
37 #define BTU_POST_TO_TASK_NO_GOOD_HORRIBLE_HACK \
38   0x1700  // didn't look used in bt_types...here goes nothing
39 typedef struct { void (*callback)(BT_HDR*); } post_to_task_hack_t;
40 
41 typedef struct {
42   void (*callback)(BT_HDR*);
43   BT_HDR* response;
44   void* context;
45 } command_complete_hack_t;
46 
47 typedef struct {
48   void (*callback)(BT_HDR*);
49   uint8_t status;
50   BT_HDR* command;
51   void* context;
52 } command_status_hack_t;
53 
54 /* Global BTU data */
55 extern uint8_t btu_trace_level;
56 
57 extern const BD_ADDR BT_BD_ANY;
58 
59 /* Functions provided by btu_hcif.cc
60  ***********************************
61 */
62 extern void btu_hcif_process_event(uint8_t controller_id, BT_HDR* p_buf);
63 extern void btu_hcif_send_cmd(uint8_t controller_id, BT_HDR* p_msg);
64 extern void btu_hcif_send_cmd_with_cb(
65     const tracked_objects::Location& posted_from, uint16_t opcode,
66     uint8_t* params, uint8_t params_len,
67     base::Callback<void(uint8_t*, uint16_t)> cb);
68 
69 /* Functions provided by btu_init.cc
70  ***********************************
71 */
72 extern void btu_init_core(void);
73 extern void btu_free_core(void);
74 
75 void BTU_StartUp(void);
76 void BTU_ShutDown(void);
77 
78 #endif
79