OSDN Git Service

Remove definitions for DUN
[android-x86/system-bt.git] / main / bte_init.c
1 /******************************************************************************
2  *
3  *  Copyright (C) 2000-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 module contains the routines that initialize the stack components.
22  *  It must be called before the BTU task is started.
23  *
24  ******************************************************************************/
25
26 #include "bt_target.h"
27 #include <string.h>
28
29 #ifndef BTA_INCLUDED
30 #define BTA_INCLUDED FALSE
31 #endif
32
33 /* Include initialization functions definitions */
34 #if (defined(RFCOMM_INCLUDED) && RFCOMM_INCLUDED == TRUE)
35 #include "port_api.h"
36 #endif
37
38 #if (defined(OBX_INCLUDED) && OBX_INCLUDED == TRUE)
39 #include "obx_api.h"
40 #endif
41
42 #if (defined(BNEP_INCLUDED) && BNEP_INCLUDED == TRUE)
43 #include "bnep_api.h"
44 #endif
45
46 #if (defined(GAP_INCLUDED) && GAP_INCLUDED == TRUE)
47 #include "gap_api.h"
48 #endif
49
50 #if (defined(SPP_INCLUDED) && SPP_INCLUDED == TRUE)
51 #include "spp_api.h"
52 #endif
53
54 #if (defined(OPP_INCLUDED) && OPP_INCLUDED == TRUE)
55 #include "opp_api.h"
56 #endif /* OPP */
57
58 #if (defined(BIP_INCLUDED) && BIP_INCLUDED == TRUE)
59 #include "bip_api.h"
60 #endif
61
62 #if (defined(BTA_BI_INCLUDED) && BTA_BI_INCLUDED == TRUE)
63 #include "bta_bi_api.h"
64 #endif
65
66 #if (defined(HFP_INCLUDED) && HFP_INCLUDED == TRUE)
67 #include "hfp_api.h"
68 #endif
69
70 #if ((defined(HSP2_INCLUDED) && HSP2_INCLUDED == TRUE)) || \
71     ((defined(HFP_INCLUDED) && HFP_INCLUDED == TRUE))
72 #include "hsp2_api.h"
73 #endif
74
75 #if (defined(HCRP_INCLUDED) && HCRP_INCLUDED == TRUE)
76 #if (defined(HCRP_CLIENT_INCLUDED) && HCRP_CLIENT_INCLUDED == TRUE)
77 #include "hcrp_api.h"
78 #endif
79 #if (defined(HCRP_SERVER_INCLUDED) && HCRP_SERVER_INCLUDED == TRUE)
80 #include "hcrpm_api.h"
81 #endif
82 #endif
83
84 #if (defined(BPP_INCLUDED) && BPP_INCLUDED == TRUE)
85 #include "bpp_api.h"
86 #endif
87
88 #if (defined(PAN_INCLUDED) && PAN_INCLUDED == TRUE)
89 #include "pan_api.h"
90 #endif
91
92 #if (defined(AVRC_INCLUDED) && AVRC_INCLUDED == TRUE)
93 #include "avrc_api.h"
94 #endif
95
96 #if (defined(A2D_INCLUDED) && A2D_INCLUDED == TRUE)
97 #include "a2d_api.h"
98 #endif
99
100
101 #if (defined(HID_DEV_INCLUDED) && HID_DEV_INCLUDED == TRUE)
102 #include "hidd_api.h"
103 #endif
104
105 #if (defined(HID_HOST_INCLUDED) && HID_HOST_INCLUDED == TRUE)
106 #include "hidh_api.h"
107 #endif
108
109 #if (defined(SAP_SERVER_INCLUDED) && SAP_SERVER_INCLUDED == TRUE)
110 #include "sap_api.h"
111 #endif  /* SAP_SERVER_INCLUDED */
112
113 #if (defined(MCA_INCLUDED) && MCA_INCLUDED == TRUE)
114 #include "mca_api.h"
115 #endif
116
117 #if (defined(BLE_INCLUDED) && BLE_INCLUDED == TRUE)
118 #include "gatt_api.h"
119 #if (defined(SMP_INCLUDED) && SMP_INCLUDED == TRUE)
120 #include "smp_api.h"
121 #endif
122 #endif
123
124 // btla-specific ++
125 /***** BTA Modules ******/
126 #if BTA_INCLUDED == TRUE && BTA_DYNAMIC_MEMORY == TRUE
127 #include "bta_api.h"
128 #include "bta_sys.h"
129
130 #if BTA_AC_INCLUDED == TRUE
131 #include "bta_acs_int.h"
132 #include "bta_acc_int.h"
133 #endif
134
135 #if BTA_AG_INCLUDED == TRUE
136 #include "bta_ag_int.h"
137 #endif
138
139 #if BTA_HS_INCLUDED == TRUE
140 #include "bta_hs_int.h"
141 #endif
142
143 #include "bta_dm_int.h"
144
145 #if BTA_DG_INCLUDED == TRUE
146 #include "bta_dg_api.h"
147 #include "bta_dg_int.h"
148 #endif
149
150 #if BTA_FT_INCLUDED == TRUE
151 #include "bta_ftc_int.h"
152 #include "bta_fts_int.h"
153 #endif
154
155 #if BTA_PBC_INCLUDED == TRUE
156 #include "bta_pbc_int.h"
157 #endif
158
159 #if BTA_PBS_INCLUDED == TRUE
160 #include "bta_pbs_int.h"
161 #endif
162
163 #if BTA_OP_INCLUDED == TRUE
164 #include "bta_opc_int.h"
165 #include "bta_ops_int.h"
166 #endif
167
168 #if BTA_SS_INCLUDED==TRUE
169 #include "bta_ss_int.h"
170 #endif
171
172 #if BTA_CT_INCLUDED==TRUE
173 #include "bta_ct_int.h"
174 #endif
175
176 #if BTA_CG_INCLUDED==TRUE
177 #include "bta_cg_int.h"
178 #endif
179
180 #if BTA_BI_INCLUDED==TRUE
181 #include "bta_bic_int.h"
182 #include "bta_bis_int.h"
183 #endif
184
185 #if BTA_PR_INCLUDED==TRUE
186 #include "bta_pr_int.h"
187 #endif
188
189 #if BTA_AR_INCLUDED==TRUE
190 #include "bta_ar_int.h"
191 #endif
192 #if BTA_AV_INCLUDED==TRUE
193 #include "bta_av_int.h"
194 #endif
195
196 #if BTA_SC_INCLUDED==TRUE
197 #include "bta_sc_int.h"
198 #endif
199
200 #if BTA_HD_INCLUDED==TRUE
201 #include "bta_hd_int.h"
202 #endif
203
204 #if BTA_HH_INCLUDED==TRUE
205 #include "bta_hh_int.h"
206 #endif
207
208 #if BTA_FM_INCLUDED==TRUE
209 #include "bta_fm_int.h"
210 #endif
211
212 #if BTA_FMTX_INCLUDED==TRUE
213 #include "bta_fmtx_int.h"
214 #endif
215
216 #if BTA_JV_INCLUDED==TRUE
217 #include "bta_jv_int.h"
218 tBTA_JV_CB *bta_jv_cb_ptr = NULL;
219 #endif
220
221 #if BTA_MCE_INCLUDED == TRUE
222 #include "bta_mce_int.h"
223 #endif
224
225 #if BTA_MSE_INCLUDED == TRUE
226 #include "bta_mse_int.h"
227 #endif
228
229 #if BTA_HL_INCLUDED == TRUE
230 #include "bta_hl_int.h"
231 #endif
232
233 #if BTA_GATT_INCLUDED == TRUE
234 #include "bta_gattc_int.h"
235 #include "bta_gatts_int.h"
236 #endif
237
238 #if BTA_PAN_INCLUDED==TRUE
239 #include "bta_pan_int.h"
240 #endif
241
242 #include "bta_sys_int.h"
243
244 /* control block for patch ram downloading */
245 #include "bta_prm_int.h"
246
247 #endif /* BTA_INCLUDED */
248 // btla-specific --
249
250 /*****************************************************************************
251 **                          F U N C T I O N S                                *
252 ******************************************************************************/
253
254 /*****************************************************************************
255 **
256 ** Function         BTE_InitStack
257 **
258 ** Description      Initialize control block memory for each component.
259 **
260 **                  Note: The core stack components must be called
261 **                      before creating the BTU Task.  The rest of the
262 **                      components can be initialized at a later time if desired
263 **                      as long as the component's init function is called
264 **                      before accessing any of its functions.
265 **
266 ** Returns          void
267 **
268 ******************************************************************************/
269 void BTE_InitStack(void)
270 {
271 /* Initialize the optional stack components */
272
273 /****************************
274 ** RFCOMM and its profiles **
275 *****************************/
276 #if (defined(RFCOMM_INCLUDED) && RFCOMM_INCLUDED == TRUE)
277     RFCOMM_Init();
278
279 #if (defined(SPP_INCLUDED) && SPP_INCLUDED == TRUE)
280     SPP_Init();
281 #endif  /* SPP */
282
283 #if (defined(HSP2_INCLUDED) && HSP2_INCLUDED == TRUE)
284     HSP2_Init();
285 #endif  /* HSP2 */
286
287 #if (defined(HFP_INCLUDED) && HFP_INCLUDED == TRUE)
288     HFP_Init();
289 #endif  /* HFP */
290
291 /**************************
292 ** OBEX and its profiles **
293 ***************************/
294 #if (defined(OBX_INCLUDED) && OBX_INCLUDED == TRUE)
295     OBX_Init();
296 #if (defined(BIP_INCLUDED) && BIP_INCLUDED == TRUE)
297     BIP_Init();
298 #if (defined(BTA_BI_INCLUDED) && BTA_BI_INCLUDED == TRUE)
299     BTA_BicInit();
300 #endif  /* BTA BI */
301 #endif  /* BIP */
302
303 #if (defined(OPP_INCLUDED) && OPP_INCLUDED == TRUE)
304     OPP_Init();
305 #endif
306
307 #if (defined(BPP_INCLUDED) && BPP_INCLUDED == TRUE)
308     BPP_Init();
309 #endif  /* BPP */
310 #endif  /* OBX */
311
312
313 #endif  /* RFCOMM Included */
314
315 /**************************
316 ** BNEP and its profiles **
317 ***************************/
318 #if (defined(BNEP_INCLUDED) && BNEP_INCLUDED == TRUE)
319     BNEP_Init();
320
321 #if (defined(PAN_INCLUDED) && PAN_INCLUDED == TRUE)
322     PAN_Init();
323 #endif  /* PAN */
324 #endif  /* BNEP Included */
325
326
327 /**************************
328 ** AVDT and its profiles **
329 ***************************/
330 #if (defined(A2D_INCLUDED) && A2D_INCLUDED == TRUE)
331     A2D_Init();
332 #endif  /* AADP */
333
334
335 #if (defined(AVRC_INCLUDED) && AVRC_INCLUDED == TRUE)
336     AVRC_Init();
337 #endif
338
339
340 /***********
341 ** Others **
342 ************/
343 #if (defined(GAP_INCLUDED) && GAP_INCLUDED == TRUE)
344     GAP_Init();
345 #endif  /* GAP Included */
346
347 #if (defined(HCRP_INCLUDED) && HCRP_INCLUDED == TRUE)
348 #if (defined(HCRP_CLIENT_INCLUDED) && HCRP_CLIENT_INCLUDED == TRUE)
349     HCRP_Init();
350 #endif
351 #if (defined(HCRP_SERVER_INCLUDED) && HCRP_SERVER_INCLUDED == TRUE)
352     HCRPM_Init();
353 #endif
354 #endif  /* HCRP Included */
355
356 #if (defined(SAP_SERVER_INCLUDED) && SAP_SERVER_INCLUDED == TRUE)
357     SAP_Init();
358 #endif  /* SAP_SERVER_INCLUDED */
359
360 #if (defined(HID_DEV_INCLUDED) && HID_DEV_INCLUDED == TRUE)
361     HID_DevInit();
362 #endif
363 #if (defined(HID_HOST_INCLUDED) && HID_HOST_INCLUDED == TRUE)
364     HID_HostInit();
365 #endif
366
367 #if (defined(MCA_INCLUDED) && MCA_INCLUDED == TRUE)
368     MCA_Init();
369 #endif  /* SAP_SERVER_INCLUDED */
370
371 /****************
372 ** BTA Modules **
373 *****************/
374 // btla-specific ++
375 #if (BTA_INCLUDED == TRUE && BTA_DYNAMIC_MEMORY == TRUE)
376     memset((void*)bta_sys_cb_ptr, 0, sizeof(tBTA_SYS_CB));
377     memset((void*)bta_dm_cb_ptr, 0, sizeof(tBTA_DM_CB));
378     memset((void*)bta_dm_search_cb_ptr, 0, sizeof(tBTA_DM_SEARCH_CB));
379     memset((void*)bta_dm_di_cb_ptr, 0, sizeof(tBTA_DM_DI_CB));
380     memset((void*)bta_prm_cb_ptr, 0, sizeof(tBTA_PRM_CB));
381
382 #if BTA_AC_INCLUDED == TRUE
383     memset((void*)bta_acc_cb_ptr, 0, sizeof(tBTA_ACC_CB));
384     memset((void*)bta_acs_cb_ptr, 0, sizeof(tBTA_ACS_CB));
385 #endif
386 #if BTA_AG_INCLUDED == TRUE
387     memset((void*)bta_ag_cb_ptr, 0, sizeof(tBTA_AG_CB));
388 #endif
389 #if BTA_HS_INCLUDED == TRUE
390     memset((void*)bta_hs_cb_ptr, 0, sizeof(tBTA_HS_CB));
391 #endif
392 #if BTA_DG_INCLUDED == TRUE
393     memset((void*)bta_dg_cb_ptr, 0, sizeof(tBTA_DG_CB));
394 #endif
395 #if BTA_FT_INCLUDED==TRUE
396     memset((void*)bta_ftc_cb_ptr, 0, sizeof(tBTA_FTC_CB));
397     memset((void*)bta_fts_cb_ptr, 0, sizeof(tBTA_FTS_CB));
398 #endif
399 #if BTA_PBC_INCLUDED==TRUE
400     memset((void*)bta_pbc_cb_ptr, 0, sizeof(tBTA_PBC_CB));
401 #endif
402 #if BTA_PBS_INCLUDED==TRUE
403     memset((void*)bta_pbs_cb_ptr, 0, sizeof(tBTA_PBS_CB));
404 #endif
405 #if BTA_OP_INCLUDED==TRUE
406     memset((void*)bta_opc_cb_ptr, 0, sizeof(tBTA_OPC_CB));
407     memset((void*)bta_ops_cb_ptr, 0, sizeof(tBTA_OPS_CB));
408 #endif
409 #if BTA_SS_INCLUDED==TRUE
410     memset((void*)bta_ss_cb_ptr, 0, sizeof(tBTA_SS_CB));
411 #endif
412 #if BTA_CT_INCLUDED==TRUE
413     memset((void*)bta_ct_cb_ptr, 0, sizeof(tBTA_CT_CB));
414 #endif
415 #if BTA_CG_INCLUDED==TRUE
416     memset((void*)bta_cg_cb_ptr, 0, sizeof(tBTA_CG_CB));
417 #endif
418 #if BTA_BI_INCLUDED==TRUE
419     memset((void *)bta_bic_cb_ptr, 0, sizeof(tBTA_BIC_CB));
420     memset((void *)bta_bis_cb_ptr, 0, sizeof(tBTA_BIS_CB));
421 #endif
422 #if BTA_AR_INCLUDED==TRUE
423     memset((void *)bta_ar_cb_ptr, 0, sizeof(tBTA_AR_CB));
424 #endif
425 #if BTA_AV_INCLUDED==TRUE
426     memset((void *)bta_av_cb_ptr, 0, sizeof(tBTA_AV_CB));
427 #endif
428 #if BTA_PR_INCLUDED==TRUE
429     memset((void *)bta_pr_cb_ptr, 0, sizeof(tBTA_PR_CB));
430 #endif
431 #if BTA_SC_INCLUDED==TRUE
432     memset((void *)bta_sc_cb_ptr, 0, sizeof(tBTA_SC_CB));
433 #endif
434 #if BTA_HD_INCLUDED==TRUE
435     memset((void *)bta_hd_cb_ptr, 0, sizeof(tBTA_HD_CB));
436 #endif
437 #if BTA_HH_INCLUDED==TRUE
438     memset((void *)bta_hh_cb_ptr, 0, sizeof(tBTA_HH_CB));
439 #endif
440 #if BTA_FM_INCLUDED==TRUE
441     memset((void *)bta_fm_cb_ptr, 0, sizeof(tBTA_FM_CB));
442 #endif
443 #if BTA_FMTX_INCLUDED==TRUE
444     memset((void *)bta_fmtx_cb_ptr, 0, sizeof(tBTA_FMTX_CB));
445 #endif
446 #if 0
447 #if BTA_JV_INCLUDED==TRUE
448     memset((void *)bta_jv_cb_ptr, 0, sizeof(tBTA_JV_CB));
449 #endif
450 #endif
451 #if BTA_HL_INCLUDED==TRUE
452     memset((void *)bta_hl_cb_ptr, 0, sizeof(tBTA_HL_CB));
453 #endif
454 #if BTA_GATT_INCLUDED==TRUE
455     memset((void *)bta_gattc_cb_ptr, 0, sizeof(tBTA_GATTC_CB));
456     memset((void *)bta_gatts_cb_ptr, 0, sizeof(tBTA_GATTS_CB));
457 #endif
458 #if BTA_PAN_INCLUDED==TRUE
459     memset((void *)bta_pan_cb_ptr, 0, sizeof(tBTA_PAN_CB));
460 #endif
461
462 #endif /* BTA_INCLUDED == TRUE */
463 // btla-specific --
464
465 }