1 /******************************************************************************
3 * Copyright (C) 2000-2012 Broadcom Corporation
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:
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 ******************************************************************************/
19 /******************************************************************************
21 * This module contains the routines that initialize the stack components.
22 * It must be called before the BTU task is started.
24 ******************************************************************************/
26 #include "bt_target.h"
30 #define BTA_INCLUDED FALSE
33 /* Include initialization functions definitions */
34 #if (defined(RFCOMM_INCLUDED) && RFCOMM_INCLUDED == TRUE)
38 #if (defined(TCS_INCLUDED) && TCS_INCLUDED == TRUE)
42 #if (defined(OBX_INCLUDED) && OBX_INCLUDED == TRUE)
46 #if (defined(BNEP_INCLUDED) && BNEP_INCLUDED == TRUE)
50 #if (defined(GAP_INCLUDED) && GAP_INCLUDED == TRUE)
54 #if ((defined(CTP_INCLUDED) && CTP_INCLUDED == TRUE))
58 #if ((defined(ICP_INCLUDED) && ICP_INCLUDED == TRUE))
62 #if (defined(SPP_INCLUDED) && SPP_INCLUDED == TRUE)
66 #if (defined(DUN_INCLUDED) && DUN_INCLUDED == TRUE)
70 #if (defined(GOEP_INCLUDED) && GOEP_INCLUDED == TRUE)
71 #include "goep_util.h"
72 #endif /* GOEP included */
74 #if (defined(FTP_INCLUDED) && FTP_INCLUDED == TRUE)
78 #if (defined(OPP_INCLUDED) && OPP_INCLUDED == TRUE)
82 #if (defined(BIP_INCLUDED) && BIP_INCLUDED == TRUE)
86 #if (defined(BTU_BTA_INCLUDED) && BTU_BTA_INCLUDED == TRUE)
87 #if (defined(BTA_BI_INCLUDED) && BTA_BI_INCLUDED == TRUE)
88 #include "bta_bi_api.h"
92 #if (defined(HFP_INCLUDED) && HFP_INCLUDED == TRUE)
96 #if ((defined(HSP2_INCLUDED) && HSP2_INCLUDED == TRUE)) || \
97 ((defined(HFP_INCLUDED) && HFP_INCLUDED == TRUE))
101 #if (defined(HCRP_INCLUDED) && HCRP_INCLUDED == TRUE)
102 #if (defined(HCRP_CLIENT_INCLUDED) && HCRP_CLIENT_INCLUDED == TRUE)
103 #include "hcrp_api.h"
105 #if (defined(HCRP_SERVER_INCLUDED) && HCRP_SERVER_INCLUDED == TRUE)
106 #include "hcrpm_api.h"
110 #if (defined(BPP_INCLUDED) && BPP_INCLUDED == TRUE)
114 #if (defined(PAN_INCLUDED) && PAN_INCLUDED == TRUE)
118 #if (defined(AVRC_INCLUDED) && AVRC_INCLUDED == TRUE)
119 #include "avrc_api.h"
122 #if (defined(A2D_INCLUDED) && A2D_INCLUDED == TRUE)
127 #if (defined(HID_DEV_INCLUDED) && HID_DEV_INCLUDED == TRUE)
128 #include "hidd_api.h"
131 #if (defined(HID_HOST_INCLUDED) && HID_HOST_INCLUDED == TRUE)
132 #include "hidh_api.h"
135 #if (defined(SAP_SERVER_INCLUDED) && SAP_SERVER_INCLUDED == TRUE)
137 #endif /* SAP_SERVER_INCLUDED */
139 #if (defined(MCA_INCLUDED) && MCA_INCLUDED == TRUE)
143 #if (defined(BLE_INCLUDED) && BLE_INCLUDED == TRUE)
144 #include "gatt_api.h"
145 #if (defined(SMP_INCLUDED) && SMP_INCLUDED == TRUE)
151 /***** BTA Modules ******/
152 #if BTA_INCLUDED == TRUE && BTA_DYNAMIC_MEMORY == TRUE
156 #if BTA_AC_INCLUDED == TRUE
157 #include "bta_acs_int.h"
158 #include "bta_acc_int.h"
161 #if BTA_AG_INCLUDED == TRUE
162 #include "bta_ag_int.h"
165 #if BTA_HS_INCLUDED == TRUE
166 #include "bta_hs_int.h"
169 #include "bta_dm_int.h"
171 #if BTA_DG_INCLUDED == TRUE
172 #include "bta_dg_api.h"
173 #include "bta_dg_int.h"
176 #if BTA_FT_INCLUDED == TRUE
177 #include "bta_ftc_int.h"
178 #include "bta_fts_int.h"
181 #if BTA_PBC_INCLUDED == TRUE
182 #include "bta_pbc_int.h"
185 #if BTA_PBS_INCLUDED == TRUE
186 #include "bta_pbs_int.h"
189 #if BTA_OP_INCLUDED == TRUE
190 #include "bta_opc_int.h"
191 #include "bta_ops_int.h"
194 #if BTA_SS_INCLUDED==TRUE
195 #include "bta_ss_int.h"
198 #if BTA_CT_INCLUDED==TRUE
199 #include "bta_ct_int.h"
202 #if BTA_CG_INCLUDED==TRUE
203 #include "bta_cg_int.h"
206 #if BTA_BI_INCLUDED==TRUE
207 #include "bta_bic_int.h"
208 #include "bta_bis_int.h"
211 #if BTA_PR_INCLUDED==TRUE
212 #include "bta_pr_int.h"
215 #if BTA_AR_INCLUDED==TRUE
216 #include "bta_ar_int.h"
218 #if BTA_AV_INCLUDED==TRUE
219 #include "bta_av_int.h"
222 #if BTA_SC_INCLUDED==TRUE
223 #include "bta_sc_int.h"
226 #if BTA_HD_INCLUDED==TRUE
227 #include "bta_hd_int.h"
230 #if BTA_HH_INCLUDED==TRUE
231 #include "bta_hh_int.h"
234 #if BTA_FM_INCLUDED==TRUE
235 #include "bta_fm_int.h"
238 #if BTA_FMTX_INCLUDED==TRUE
239 #include "bta_fmtx_int.h"
242 #if BTA_JV_INCLUDED==TRUE
243 #include "bta_jv_int.h"
244 tBTA_JV_CB *bta_jv_cb_ptr = NULL;
247 #if BTA_MCE_INCLUDED == TRUE
248 #include "bta_mce_int.h"
251 #if BTA_MSE_INCLUDED == TRUE
252 #include "bta_mse_int.h"
255 #if BTA_HL_INCLUDED == TRUE
256 #include "bta_hl_int.h"
259 #if BTA_GATT_INCLUDED == TRUE
260 #include "bta_gattc_int.h"
261 #include "bta_gatts_int.h"
264 #if BTA_PAN_INCLUDED==TRUE
265 #include "bta_pan_int.h"
268 #include "bta_sys_int.h"
270 /* control block for patch ram downloading */
271 #include "bta_prm_int.h"
273 #endif /* BTA_INCLUDED */
276 /*****************************************************************************
277 ** F U N C T I O N S *
278 ******************************************************************************/
280 /*****************************************************************************
282 ** Function BTE_InitStack
284 ** Description Initialize control block memory for each component.
286 ** Note: The core stack components must be called
287 ** before creating the BTU Task. The rest of the
288 ** components can be initialized at a later time if desired
289 ** as long as the component's init function is called
290 ** before accessing any of its functions.
294 ******************************************************************************/
295 BT_API void BTE_InitStack(void)
297 /* Initialize the optional stack components */
299 /****************************
300 ** RFCOMM and its profiles **
301 *****************************/
302 #if (defined(RFCOMM_INCLUDED) && RFCOMM_INCLUDED == TRUE)
305 #if (defined(SPP_INCLUDED) && SPP_INCLUDED == TRUE)
309 #if (defined(DUN_INCLUDED) && DUN_INCLUDED == TRUE)
313 #if (defined(HSP2_INCLUDED) && HSP2_INCLUDED == TRUE)
317 #if (defined(HFP_INCLUDED) && HFP_INCLUDED == TRUE)
321 /**************************
322 ** OBEX and its profiles **
323 ***************************/
324 #if (defined(OBX_INCLUDED) && OBX_INCLUDED == TRUE)
326 #if (defined(BIP_INCLUDED) && BIP_INCLUDED == TRUE)
328 #if (defined(BTU_BTA_INCLUDED) && BTU_BTA_INCLUDED == TRUE)
329 #if (defined(BTA_BI_INCLUDED) && BTA_BI_INCLUDED == TRUE)
335 #if (defined(GOEP_INCLUDED) && GOEP_INCLUDED == TRUE)
340 #if (defined(FTP_INCLUDED) && FTP_INCLUDED == TRUE)
343 #if (defined(OPP_INCLUDED) && OPP_INCLUDED == TRUE)
347 #if (defined(BPP_INCLUDED) && BPP_INCLUDED == TRUE)
353 #endif /* RFCOMM Included */
355 /*************************
356 ** TCS and its profiles **
357 **************************/
358 #if (defined(TCS_INCLUDED) && TCS_INCLUDED == TRUE)
361 #if (defined(CTP_INCLUDED) && CTP_INCLUDED == TRUE)
363 #endif /* CTP_INCLUDED */
365 #if (defined(ICP_INCLUDED) && ICP_INCLUDED == TRUE)
367 #endif /* ICP_INCLUDED */
369 #endif /* TCS_INCLUDED */
372 /**************************
373 ** BNEP and its profiles **
374 ***************************/
375 #if (defined(BNEP_INCLUDED) && BNEP_INCLUDED == TRUE)
378 #if (defined(PAN_INCLUDED) && PAN_INCLUDED == TRUE)
381 #endif /* BNEP Included */
384 /**************************
385 ** AVDT and its profiles **
386 ***************************/
387 #if (defined(A2D_INCLUDED) && A2D_INCLUDED == TRUE)
392 #if (defined(AVRC_INCLUDED) && AVRC_INCLUDED == TRUE)
400 #if (defined(GAP_INCLUDED) && GAP_INCLUDED == TRUE)
402 #endif /* GAP Included */
404 #if (defined(HCRP_INCLUDED) && HCRP_INCLUDED == TRUE)
405 #if (defined(HCRP_CLIENT_INCLUDED) && HCRP_CLIENT_INCLUDED == TRUE)
408 #if (defined(HCRP_SERVER_INCLUDED) && HCRP_SERVER_INCLUDED == TRUE)
411 #endif /* HCRP Included */
413 #if (defined(SAP_SERVER_INCLUDED) && SAP_SERVER_INCLUDED == TRUE)
415 #endif /* SAP_SERVER_INCLUDED */
417 #if (defined(HID_DEV_INCLUDED) && HID_DEV_INCLUDED == TRUE)
420 #if (defined(HID_HOST_INCLUDED) && HID_HOST_INCLUDED == TRUE)
424 #if (defined(MCA_INCLUDED) && MCA_INCLUDED == TRUE)
426 #endif /* SAP_SERVER_INCLUDED */
432 #if (BTA_INCLUDED == TRUE && BTA_DYNAMIC_MEMORY == TRUE)
433 memset((void*)bta_sys_cb_ptr, 0, sizeof(tBTA_SYS_CB));
434 memset((void*)bta_dm_cb_ptr, 0, sizeof(tBTA_DM_CB));
435 memset((void*)bta_dm_search_cb_ptr, 0, sizeof(tBTA_DM_SEARCH_CB));
436 memset((void*)bta_dm_di_cb_ptr, 0, sizeof(tBTA_DM_DI_CB));
437 memset((void*)bta_prm_cb_ptr, 0, sizeof(tBTA_PRM_CB));
439 #if BTA_AC_INCLUDED == TRUE
440 memset((void*)bta_acc_cb_ptr, 0, sizeof(tBTA_ACC_CB));
441 memset((void*)bta_acs_cb_ptr, 0, sizeof(tBTA_ACS_CB));
443 #if BTA_AG_INCLUDED == TRUE
444 memset((void*)bta_ag_cb_ptr, 0, sizeof(tBTA_AG_CB));
446 #if BTA_HS_INCLUDED == TRUE
447 memset((void*)bta_hs_cb_ptr, 0, sizeof(tBTA_HS_CB));
449 #if BTA_DG_INCLUDED == TRUE
450 memset((void*)bta_dg_cb_ptr, 0, sizeof(tBTA_DG_CB));
452 #if BTA_FT_INCLUDED==TRUE
453 memset((void*)bta_ftc_cb_ptr, 0, sizeof(tBTA_FTC_CB));
454 memset((void*)bta_fts_cb_ptr, 0, sizeof(tBTA_FTS_CB));
456 #if BTA_PBC_INCLUDED==TRUE
457 memset((void*)bta_pbc_cb_ptr, 0, sizeof(tBTA_PBC_CB));
459 #if BTA_PBS_INCLUDED==TRUE
460 memset((void*)bta_pbs_cb_ptr, 0, sizeof(tBTA_PBS_CB));
462 #if BTA_OP_INCLUDED==TRUE
463 memset((void*)bta_opc_cb_ptr, 0, sizeof(tBTA_OPC_CB));
464 memset((void*)bta_ops_cb_ptr, 0, sizeof(tBTA_OPS_CB));
466 #if BTA_SS_INCLUDED==TRUE
467 memset((void*)bta_ss_cb_ptr, 0, sizeof(tBTA_SS_CB));
469 #if BTA_CT_INCLUDED==TRUE
470 memset((void*)bta_ct_cb_ptr, 0, sizeof(tBTA_CT_CB));
472 #if BTA_CG_INCLUDED==TRUE
473 memset((void*)bta_cg_cb_ptr, 0, sizeof(tBTA_CG_CB));
475 #if BTA_BI_INCLUDED==TRUE
476 memset((void *)bta_bic_cb_ptr, 0, sizeof(tBTA_BIC_CB));
477 memset((void *)bta_bis_cb_ptr, 0, sizeof(tBTA_BIS_CB));
479 #if BTA_AR_INCLUDED==TRUE
480 memset((void *)bta_ar_cb_ptr, 0, sizeof(tBTA_AR_CB));
482 #if BTA_AV_INCLUDED==TRUE
483 memset((void *)bta_av_cb_ptr, 0, sizeof(tBTA_AV_CB));
485 #if BTA_PR_INCLUDED==TRUE
486 memset((void *)bta_pr_cb_ptr, 0, sizeof(tBTA_PR_CB));
488 #if BTA_SC_INCLUDED==TRUE
489 memset((void *)bta_sc_cb_ptr, 0, sizeof(tBTA_SC_CB));
491 #if BTA_HD_INCLUDED==TRUE
492 memset((void *)bta_hd_cb_ptr, 0, sizeof(tBTA_HD_CB));
494 #if BTA_HH_INCLUDED==TRUE
495 memset((void *)bta_hh_cb_ptr, 0, sizeof(tBTA_HH_CB));
497 #if BTA_FM_INCLUDED==TRUE
498 memset((void *)bta_fm_cb_ptr, 0, sizeof(tBTA_FM_CB));
500 #if BTA_FMTX_INCLUDED==TRUE
501 memset((void *)bta_fmtx_cb_ptr, 0, sizeof(tBTA_FMTX_CB));
504 #if BTA_JV_INCLUDED==TRUE
505 memset((void *)bta_jv_cb_ptr, 0, sizeof(tBTA_JV_CB));
508 #if BTA_HL_INCLUDED==TRUE
509 memset((void *)bta_hl_cb_ptr, 0, sizeof(tBTA_HL_CB));
511 #if BTA_GATT_INCLUDED==TRUE
512 memset((void *)bta_gattc_cb_ptr, 0, sizeof(tBTA_GATTC_CB));
513 memset((void *)bta_gatts_cb_ptr, 0, sizeof(tBTA_GATTS_CB));
515 #if BTA_PAN_INCLUDED==TRUE
516 memset((void *)bta_pan_cb_ptr, 0, sizeof(tBTA_PAN_CB));
519 #endif /* BTA_INCLUDED == TRUE */