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 #include "port_api.h"
35
36 #if (defined(BNEP_INCLUDED) && BNEP_INCLUDED == TRUE)
37 #include "bnep_api.h"
38 #endif
39
40 #include "gap_api.h"
41
42 #if (defined(PAN_INCLUDED) && PAN_INCLUDED == TRUE)
43 #include "pan_api.h"
44 #endif
45
46 #include "avrc_api.h"
47
48 #if (defined(A2D_INCLUDED) && A2D_INCLUDED == TRUE)
49 #include "a2d_api.h"
50 #endif
51
52 #if (defined(HID_HOST_INCLUDED) && HID_HOST_INCLUDED == TRUE)
53 #include "hidh_api.h"
54 #endif
55
56 #if (defined(MCA_INCLUDED) && MCA_INCLUDED == TRUE)
57 #include "mca_api.h"
58 #endif
59
60 #if (defined(BLE_INCLUDED) && BLE_INCLUDED == TRUE)
61 #include "gatt_api.h"
62 #if (defined(SMP_INCLUDED) && SMP_INCLUDED == TRUE)
63 #include "smp_api.h"
64 #endif
65 #endif
66
67 /***** BTA Modules ******/
68 #if BTA_INCLUDED == TRUE && BTA_DYNAMIC_MEMORY == TRUE
69 #include "bta_api.h"
70 #include "bta_sys.h"
71
72 #include "bta_ag_int.h"
73
74 #if BTA_HS_INCLUDED == TRUE
75 #include "bta_hs_int.h"
76 #endif
77
78 #include "bta_dm_int.h"
79
80 #if BTA_AR_INCLUDED==TRUE
81 #include "bta_ar_int.h"
82 #endif
83 #if BTA_AV_INCLUDED==TRUE
84 #include "bta_av_int.h"
85 #endif
86
87 #if BTA_HH_INCLUDED==TRUE
88 #include "bta_hh_int.h"
89 #endif
90
91 #if BTA_JV_INCLUDED==TRUE
92 #include "bta_jv_int.h"
93 tBTA_JV_CB *bta_jv_cb_ptr = NULL;
94 #endif
95
96 #if BTA_HL_INCLUDED == TRUE
97 #include "bta_hl_int.h"
98 #endif
99
100 #if BTA_GATT_INCLUDED == TRUE
101 #include "bta_gattc_int.h"
102 #include "bta_gatts_int.h"
103 #endif
104
105 #if BTA_PAN_INCLUDED==TRUE
106 #include "bta_pan_int.h"
107 #endif
108
109 #include "bta_sys_int.h"
110
111 /* control block for patch ram downloading */
112 #include "bta_prm_int.h"
113
114 #endif /* BTA_INCLUDED */
115
116 /*****************************************************************************
117 ** F U N C T I O N S *
118 ******************************************************************************/
119
120 /*****************************************************************************
121 **
122 ** Function BTE_InitStack
123 **
124 ** Description Initialize control block memory for each component.
125 **
126 ** Note: The core stack components must be called
127 ** before creating the BTU Task. The rest of the
128 ** components can be initialized at a later time if desired
129 ** as long as the component's init function is called
130 ** before accessing any of its functions.
131 **
132 ** Returns void
133 **
134 ******************************************************************************/
BTE_InitStack(void)135 void BTE_InitStack(void)
136 {
137 /* Initialize the optional stack components */
138 RFCOMM_Init();
139
140 /**************************
141 ** BNEP and its profiles **
142 ***************************/
143 #if (defined(BNEP_INCLUDED) && BNEP_INCLUDED == TRUE)
144 BNEP_Init();
145
146 #if (defined(PAN_INCLUDED) && PAN_INCLUDED == TRUE)
147 PAN_Init();
148 #endif /* PAN */
149 #endif /* BNEP Included */
150
151
152 /**************************
153 ** AVDT and its profiles **
154 ***************************/
155 #if (defined(A2D_INCLUDED) && A2D_INCLUDED == TRUE)
156 A2D_Init();
157 #endif /* AADP */
158
159
160 AVRC_Init();
161
162
163 /***********
164 ** Others **
165 ************/
166 GAP_Init();
167
168 #if (defined(HID_HOST_INCLUDED) && HID_HOST_INCLUDED == TRUE)
169 HID_HostInit();
170 #endif
171
172 #if (defined(MCA_INCLUDED) && MCA_INCLUDED == TRUE)
173 MCA_Init();
174 #endif
175
176 /****************
177 ** BTA Modules **
178 *****************/
179 #if (BTA_INCLUDED == TRUE && BTA_DYNAMIC_MEMORY == TRUE)
180 memset((void*)bta_sys_cb_ptr, 0, sizeof(tBTA_SYS_CB));
181 memset((void*)bta_dm_cb_ptr, 0, sizeof(tBTA_DM_CB));
182 memset((void*)bta_dm_search_cb_ptr, 0, sizeof(tBTA_DM_SEARCH_CB));
183 memset((void*)bta_dm_di_cb_ptr, 0, sizeof(tBTA_DM_DI_CB));
184 memset((void*)bta_prm_cb_ptr, 0, sizeof(tBTA_PRM_CB));
185 memset((void*)bta_ag_cb_ptr, 0, sizeof(tBTA_AG_CB));
186 #if BTA_HS_INCLUDED == TRUE
187 memset((void*)bta_hs_cb_ptr, 0, sizeof(tBTA_HS_CB));
188 #endif
189 #if BTA_AR_INCLUDED==TRUE
190 memset((void *)bta_ar_cb_ptr, 0, sizeof(tBTA_AR_CB));
191 #endif
192 #if BTA_AV_INCLUDED==TRUE
193 memset((void *)bta_av_cb_ptr, 0, sizeof(tBTA_AV_CB));
194 #endif
195 #if BTA_HH_INCLUDED==TRUE
196 memset((void *)bta_hh_cb_ptr, 0, sizeof(tBTA_HH_CB));
197 #endif
198 #if BTA_HL_INCLUDED==TRUE
199 memset((void *)bta_hl_cb_ptr, 0, sizeof(tBTA_HL_CB));
200 #endif
201 #if BTA_GATT_INCLUDED==TRUE
202 memset((void *)bta_gattc_cb_ptr, 0, sizeof(tBTA_GATTC_CB));
203 memset((void *)bta_gatts_cb_ptr, 0, sizeof(tBTA_GATTS_CB));
204 #endif
205 #if BTA_PAN_INCLUDED==TRUE
206 memset((void *)bta_pan_cb_ptr, 0, sizeof(tBTA_PAN_CB));
207 #endif
208
209 #endif /* BTA_INCLUDED == TRUE */
210
211 }
212