NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
bta_sys.h
1/******************************************************************************
2 *
3 * NOTICE OF CHANGES
4 * 2024/03/26:
5 * - Add #defines for RVL target
6 * - Add prototype for bta_sys_compress_register
7 *
8 * Compile with REVOLUTION defined to include these changes.
9 *
10 ******************************************************************************/
11
12
13
14/******************************************************************************
15 *
16 * Copyright (C) 2003-2012 Broadcom Corporation
17 *
18 * Licensed under the Apache License, Version 2.0 (the "License");
19 * you may not use this file except in compliance with the License.
20 * You may obtain a copy of the License at:
21 *
22 * http://www.apache.org/licenses/LICENSE-2.0
23 *
24 * Unless required by applicable law or agreed to in writing, software
25 * distributed under the License is distributed on an "AS IS" BASIS,
26 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27 * See the License for the specific language governing permissions and
28 * limitations under the License.
29 *
30 ******************************************************************************/
31
32/******************************************************************************
33 *
34 * This is the public interface file for the BTA system manager.
35 *
36 ******************************************************************************/
37#ifndef BTA_SYS_H
38#define BTA_SYS_H
39
40#include "bt_target.h"
41#include "gki.h"
42
43/*****************************************************************************
44** Constants and data types
45*****************************************************************************/
46
47/* event handler function type */
48typedef BOOLEAN (tBTA_SYS_EVT_HDLR)(BT_HDR *p_msg);
49
50/* disable function type */
51typedef void (tBTA_SYS_DISABLE)(void);
52
53
54/* HW modules */
55enum
56{
57 BTA_SYS_HW_BLUETOOTH,
58 BTA_SYS_HW_FMRX,
59 BTA_SYS_HW_FMTX,
60 BTA_SYS_HW_GPS,
61 BTA_SYS_HW_SENSOR,
62 BTA_SYS_HW_NFC,
63 BTA_SYS_HW_RT,
64
65 BTA_SYS_MAX_HW_MODULES
66};
67
68typedef UINT16 tBTA_SYS_HW_MODULE;
69
70#ifndef BTA_DM_NUM_JV_ID
71#define BTA_DM_NUM_JV_ID 2
72#endif
73
74/* SW sub-systems */
75#define BTA_ID_SYS 0 /* system manager */
76/* BLUETOOTH PART - from 0 to BTA_ID_BLUETOOTH_MAX */
77#define BTA_ID_DM 1 /* device manager */
78#define BTA_ID_DM_SEARCH 2 /* device manager search */
79#define BTA_ID_DM_SEC 3 /* device manager security */
80#define BTA_ID_DG 4 /* data gateway */
81#define BTA_ID_AG 5 /* audio gateway */
82#define BTA_ID_OPC 6 /* object push client */
83#define BTA_ID_OPS 7 /* object push server */
84#define BTA_ID_FTS 8 /* file transfer server */
85#define BTA_ID_CT 9 /* cordless telephony terminal */
86#define BTA_ID_FTC 10 /* file transfer client */
87#define BTA_ID_SS 11 /* synchronization server */
88#define BTA_ID_PR 12 /* Printer client */
89#define BTA_ID_BIC 13 /* Basic Imaging Client */
90#define BTA_ID_PAN 14 /* Personal Area Networking */
91#define BTA_ID_BIS 15 /* Basic Imaging Server */
92#define BTA_ID_ACC 16 /* Advanced Camera Client */
93#define BTA_ID_SC 17 /* SIM Card Access server */
94#define BTA_ID_AV 18 /* Advanced audio/video */
95#define BTA_ID_AVK 19 /* Audio/video sink */
96#define BTA_ID_HD 20 /* HID Device */
97#define BTA_ID_CG 21 /* Cordless Gateway */
98#define BTA_ID_BP 22 /* Basic Printing Client */
99#define BTA_ID_HH 23 /* Human Interface Device Host */
100#define BTA_ID_PBS 24 /* Phone Book Access Server */
101#define BTA_ID_PBC 25 /* Phone Book Access Client */
102
103#ifndef REVOLUTION
104
105#define BTA_ID_JV 26 /* Java */
106#define BTA_ID_HS 27 /* Headset */
107#define BTA_ID_MSE 28 /* Message Server Equipment */
108#define BTA_ID_MCE 29 /* Message Client Equipment */
109#define BTA_ID_HL 30 /* Health Device Profile*/
110#define BTA_ID_GATTC 31 /* GATT Client */
111#define BTA_ID_GATTS 32 /* GATT Client */
112#define BTA_ID_BLUETOOTH_MAX 33 /* last BT profile */
113
114
115/* FM */
116#define BTA_ID_FM 34 /* FM */
117#define BTA_ID_FMTX 35 /* FM TX */
118
119/* SENSOR */
120#define BTA_ID_SSR 36 /* Sensor */
121
122/* GPS */
123#define BTA_ID_GPS 37 /* GPS */
124
125/* GENERIC */
126#define BTA_ID_PRM 38
127#define BTA_ID_SYSTEM 39 /* platform-specific */
128#define BTA_ID_SWRAP 40 /* Insight script wrapper */
129#define BTA_ID_MIP 41 /* Multicase Individual Polling */
130#define BTA_ID_RT 42 /* Audio Routing module: This module is always on. */
131
132
133/* JV */
134#define BTA_ID_JV1 43 /* JV1 */
135#define BTA_ID_JV2 44 /* JV2 */
136
137#define BTA_ID_MAX (43 + BTA_DM_NUM_JV_ID)
138
139#else
140
141#define BTA_ID_BLUETOOTH_MAX 26 /* last BT profile */
142#define BTA_ID_MAX 26
143
144#endif
145
146typedef UINT8 tBTA_SYS_ID;
147
148
149#define BTA_SYS_CONN_OPEN 0x00
150#define BTA_SYS_CONN_CLOSE 0x01
151#define BTA_SYS_APP_OPEN 0x02
152#define BTA_SYS_APP_CLOSE 0x03
153#define BTA_SYS_SCO_OPEN 0x04
154#define BTA_SYS_SCO_CLOSE 0x05
155#define BTA_SYS_CONN_IDLE 0x06
156#define BTA_SYS_CONN_BUSY 0x07
157
158/* for link policy */
159#define BTA_SYS_PLCY_SET 0x10 /* set the link policy to the given addr */
160#define BTA_SYS_PLCY_CLR 0x11 /* clear the link policy to the given addr */
161#define BTA_SYS_PLCY_DEF_SET 0x12 /* set the default link policy */
162#define BTA_SYS_PLCY_DEF_CLR 0x13 /* clear the default link policy */
163#define BTA_SYS_ROLE_CHANGE 0x14 /* role change */
164
165typedef UINT8 tBTA_SYS_CONN_STATUS;
166
167/* Bitmask of sys features */
168#define BTA_SYS_FEAT_PCM2 0x0001
169#define BTA_SYS_FEAT_PCM2_MASTER 0x0002
170
171/* tBTA_PREF_ROLES */
172typedef UINT8 tBTA_SYS_PREF_ROLES;
173
174/* conn callback for role / low power manager*/
175typedef void (tBTA_SYS_CONN_CBACK)(tBTA_SYS_CONN_STATUS status,UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
176
177/* conn callback for role / low power manager*/
178typedef void (tBTA_SYS_SSR_CFG_CBACK)(UINT8 id, UINT8 app_id, UINT16 latency, UINT16 tout);
179
180#if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&(BTA_EIR_CANNED_UUID_LIST != TRUE)
181/* eir callback for adding/removeing UUID */
182typedef void (tBTA_SYS_EIR_CBACK)(UINT16 uuid16, BOOLEAN adding);
183#endif
184
185/* registration structure */
186typedef struct
187{
188 tBTA_SYS_EVT_HDLR *evt_hdlr;
189 tBTA_SYS_DISABLE *disable;
191
192/* system manager configuration structure */
193typedef struct
194{
195 UINT16 mbox_evt; /* GKI mailbox event */
196 UINT8 mbox; /* GKI mailbox id */
197 UINT8 timer; /* GKI timer id */
198 UINT8 trace_level; /* initial trace level */
200
201/* data type to send events to BTA SYS HW manager */
202typedef struct
203{
204 BT_HDR hdr;
205 tBTA_SYS_HW_MODULE hw_module;
207
208
209
210/*****************************************************************************
211** Global data
212*****************************************************************************/
213
214/* trace level */
215extern UINT8 appl_trace_level;
216
217/*****************************************************************************
218** Macros
219*****************************************************************************/
220
221/* Calculate start of event enumeration; id is top 8 bits of event */
222#define BTA_SYS_EVT_START(id) ((id) << 8)
223
224/*****************************************************************************
225** events for BTA SYS HW manager
226*****************************************************************************/
227
228/* events sent to SYS HW manager - must be kept synchronized with tables in bta_sys_main.c */
229enum
230{
231 /* device manager local device API events */
232 BTA_SYS_API_ENABLE_EVT = BTA_SYS_EVT_START(BTA_ID_SYS),
233 BTA_SYS_EVT_ENABLED_EVT,
234 BTA_SYS_EVT_STACK_ENABLED_EVT,
235 BTA_SYS_API_DISABLE_EVT,
236 BTA_SYS_EVT_DISABLED_EVT,
237 BTA_SYS_ERROR_EVT,
238
239 BTA_SYS_MAX_EVT
240};
241
242
243
244/* SYS HW status events - returned by SYS HW manager to other modules. */
245enum
246{
247 BTA_SYS_HW_OFF_EVT,
248 BTA_SYS_HW_ON_EVT,
249 BTA_SYS_HW_STARTING_EVT,
250 BTA_SYS_HW_STOPPING_EVT,
251 BTA_SYS_HW_ERROR_EVT
252
253};
254typedef UINT8 tBTA_SYS_HW_EVT;
255
256/* HW enable callback type */
257typedef void (tBTA_SYS_HW_CBACK)(tBTA_SYS_HW_EVT status);
258
259/*****************************************************************************
260** Function declarations
261*****************************************************************************/
262
263#ifdef __cplusplus
264extern "C" {
265#endif
266
267BTA_API extern void bta_sys_init(void);
268BTA_API extern void bta_sys_event(BT_HDR *p_msg);
269BTA_API extern void bta_sys_timer_update(void);
270BTA_API extern void bta_sys_disable_timers(void);
271BTA_API extern void bta_sys_set_trace_level(UINT8 level);
272extern void bta_sys_register(UINT8 id, const tBTA_SYS_REG *p_reg);
273extern void bta_sys_deregister(UINT8 id);
274extern BOOLEAN bta_sys_is_register(UINT8 id);
275extern UINT16 bta_sys_get_sys_features(void);
276extern void bta_sys_sendmsg(void *p_msg);
277extern void bta_sys_start_timer(TIMER_LIST_ENT *p_tle, UINT16 type, INT32 timeout);
278extern void bta_sys_stop_timer(TIMER_LIST_ENT *p_tle);
279extern void bta_sys_disable(tBTA_SYS_HW_MODULE module);
280
281extern void bta_sys_hw_register( tBTA_SYS_HW_MODULE module, tBTA_SYS_HW_CBACK *cback);
282extern void bta_sys_hw_unregister( tBTA_SYS_HW_MODULE module );
283
284
285extern void bta_sys_rm_register(tBTA_SYS_CONN_CBACK * p_cback);
286extern void bta_sys_compress_register(tBTA_SYS_CONN_CBACK * p_cback);
287extern void bta_sys_pm_register(tBTA_SYS_CONN_CBACK * p_cback);
288
289extern void bta_sys_policy_register(tBTA_SYS_CONN_CBACK * p_cback);
290extern void bta_sys_sco_register(tBTA_SYS_CONN_CBACK * p_cback);
291
292
293extern void bta_sys_conn_open(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
294extern void bta_sys_conn_close(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
295extern void bta_sys_app_open(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
296extern void bta_sys_app_close(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
297extern void bta_sys_sco_open(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
298extern void bta_sys_sco_close(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
299extern void bta_sys_sco_use(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
300extern void bta_sys_sco_unuse(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
301extern void bta_sys_idle(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
302extern void bta_sys_busy(UINT8 id, UINT8 app_id, BD_ADDR peer_addr);
303
304#if (BTM_SSR_INCLUDED == TRUE)
305extern void bta_sys_ssr_cfg_register(tBTA_SYS_SSR_CFG_CBACK * p_cback);
306extern void bta_sys_chg_ssr_config (UINT8 id, UINT8 app_id, UINT16 max_latency, UINT16 min_tout);
307#endif
308
309extern void bta_sys_role_chg_register(tBTA_SYS_CONN_CBACK * p_cback);
310extern void bta_sys_notify_role_chg(BD_ADDR_PTR p_bda, UINT8 new_role, UINT8 hci_status);
311extern void bta_sys_collision_register(UINT8 bta_id, tBTA_SYS_CONN_CBACK *p_cback);
312extern void bta_sys_notify_collision (BD_ADDR_PTR p_bda);
313
314#if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&(BTA_EIR_CANNED_UUID_LIST != TRUE)
315extern void bta_sys_eir_register(tBTA_SYS_EIR_CBACK * p_cback);
316extern void bta_sys_add_uuid(UINT16 uuid16);
317extern void bta_sys_remove_uuid(UINT16 uuid16);
318#else
319#define bta_sys_eir_register(ut)
320#define bta_sys_add_uuid(ut)
321#define bta_sys_remove_uuid(ut)
322#endif
323
324extern void bta_sys_set_policy (UINT8 id, UINT8 policy, BD_ADDR peer_addr);
325extern void bta_sys_clear_policy (UINT8 id, UINT8 policy, BD_ADDR peer_addr);
326extern void bta_sys_set_default_policy (UINT8 id, UINT8 policy);
327extern void bta_sys_clear_default_policy (UINT8 id, UINT8 policy);
328
329#ifdef __cplusplus
330}
331#endif
332
333#endif /* BTA_SYS_H */