1 /****************************************************************************** 2 * 3 * Copyright (C) 2003-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 compile-time configurable constants for the device 22 * manager. 23 * 24 ******************************************************************************/ 25 26 #include <stddef.h> 27 #include "common/bt_target.h" 28 #include "bta/bta_sys.h" 29 #include "bta/bta_api.h" 30 #include "bta_dm_int.h" 31 #include "bta/bta_jv_api.h" 32 #include "bta/bta_gap_bt_co.h" 33 34 #ifndef BTA_DM_LINK_POLICY_SETTINGS 35 #define BTA_DM_LINK_POLICY_SETTINGS (HCI_ENABLE_MASTER_SLAVE_SWITCH | HCI_ENABLE_HOLD_MODE | HCI_ENABLE_SNIFF_MODE | HCI_ENABLE_PARK_MODE) 36 #endif 37 38 /* page timeout in 625uS */ 39 #ifndef BTA_DM_PAGE_TIMEOUT 40 #define BTA_DM_PAGE_TIMEOUT 8192 41 #endif 42 43 /* link supervision timeout in 625uS (5 secs) */ 44 #ifndef BTA_DM_LINK_TIMEOUT 45 #define BTA_DM_LINK_TIMEOUT 8000 46 #endif 47 48 /* TRUE to avoid scatternet when av is streaming (be the master) */ 49 #ifndef BTA_DM_AVOID_SCATTER_A2DP 50 #define BTA_DM_AVOID_SCATTER_A2DP TRUE 51 #endif 52 53 /* For Insight, PM cfg lookup tables are runtime configurable (to allow tweaking of params for power consumption measurements) */ 54 #ifndef BTE_SIM_APP 55 #define tBTA_DM_PM_TYPE_QUALIFIER const 56 #else 57 #define tBTA_DM_PM_TYPE_QUALIFIER 58 #endif 59 60 61 const tBTA_DM_CFG bta_dm_cfg = { 62 /* mobile phone COD */ 63 BTA_DM_COD, 64 /* link policy settings */ 65 BTA_DM_LINK_POLICY_SETTINGS, 66 /* page timeout in 625uS */ 67 BTA_DM_PAGE_TIMEOUT, 68 /* link supervision timeout in 625uS*/ 69 BTA_DM_LINK_TIMEOUT, 70 /* TRUE to avoid scatternet when av is streaming (be the master) */ 71 BTA_DM_AVOID_SCATTER_A2DP 72 }; 73 74 #ifndef BTA_DM_SCATTERNET 75 /* By default, allow partial scatternet */ 76 #define BTA_DM_SCATTERNET BTA_DM_PARTIAL_SCATTERNET 77 #endif 78 79 #ifndef BTA_HH_ROLE 80 /* By default, do not specify HH role (backward compatibility) */ 81 #define BTA_HH_ROLE BTA_ANY_ROLE 82 #endif 83 84 #ifndef BTA_AV_ROLE 85 /* By default, AV role (backward BTA_MASTER_ROLE_PREF) */ 86 #define BTA_AV_ROLE BTA_MASTER_ROLE_PREF 87 #endif 88 89 #ifndef BTA_PANU_ROLE 90 /* By default, AV role (backward BTA_MASTER_ROLE_PREF) */ 91 #define BTA_PANU_ROLE BTA_SLAVE_ROLE_ONLY 92 #endif 93 #define BTA_DM_NUM_RM_ENTRY 6 94 95 /* appids for PAN used by insight sample application 96 these have to be same as defined in btui_int.h */ 97 #define BTUI_PAN_ID_PANU 0 98 #define BTUI_PAN_ID_NAP 1 99 #define BTUI_PAN_ID_GN 2 100 101 /* First element is always for SYS: 102 app_id = # of entries table, cfg is 103 device scatternet support */ 104 const tBTA_DM_RM bta_dm_rm_cfg[] = { 105 {BTA_ID_SYS, BTA_DM_NUM_RM_ENTRY, BTA_DM_SCATTERNET}, 106 {BTA_ID_PAN, BTUI_PAN_ID_NAP, BTA_ANY_ROLE}, 107 {BTA_ID_PAN, BTUI_PAN_ID_GN, BTA_ANY_ROLE}, 108 {BTA_ID_PAN, BTA_APP_ID_PAN_MULTI, BTA_MASTER_ROLE_ONLY}, 109 {BTA_ID_PAN, BTUI_PAN_ID_PANU, BTA_PANU_ROLE}, 110 {BTA_ID_HH, BTA_ALL_APP_ID, BTA_HH_ROLE}, 111 {BTA_ID_AV, BTA_ALL_APP_ID, BTA_AV_ROLE} 112 }; 113 114 115 tBTA_DM_CFG *const p_bta_dm_cfg = (tBTA_DM_CFG *) &bta_dm_cfg; 116 117 tBTA_DM_RM *const p_bta_dm_rm_cfg = (tBTA_DM_RM *) &bta_dm_rm_cfg; 118 119 #if BLE_INCLUDED == TRUE 120 # define BTA_DM_NUM_PM_ENTRY 10 /* number of entries in bta_dm_pm_cfg except the first */ 121 # define BTA_DM_NUM_PM_SPEC 10 /* number of entries in bta_dm_pm_spec */ 122 #else 123 # define BTA_DM_NUM_PM_ENTRY 8 /* number of entries in bta_dm_pm_cfg except the first */ 124 # define BTA_DM_NUM_PM_SPEC 8 /* number of entries in bta_dm_pm_spec */ 125 #endif 126 127 #if (BTA_DM_PM_INCLUDED == TRUE) 128 129 tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_CFG bta_dm_pm_cfg[BTA_DM_NUM_PM_ENTRY + 1] = { 130 {BTA_ID_SYS, BTA_DM_NUM_PM_ENTRY, 0}, /* reserved: specifies length of this table. */ 131 {BTA_ID_AG, BTA_ALL_APP_ID, 0}, /* ag uses first spec table for app id 0 */ 132 {BTA_ID_AV, BTA_ALL_APP_ID, 1}, /* av spec table */ 133 {BTA_ID_JV, BTA_APP_ID_1, 2}, /* app BTA_JV_PM_ID_1, reuse ftc spec table */ 134 {BTA_ID_JV, BTA_ALL_APP_ID, 3}, /* reuse fts spec table */ 135 {BTA_ID_HS, BTA_ALL_APP_ID, 4}, /* HS spec table */ 136 {BTA_ID_AVK, BTA_ALL_APP_ID, 5}, /* avk spec table */ 137 {BTA_ID_HD, BTA_ALL_APP_ID, 6}, /* hd spec table */ 138 {BTA_ID_HH, BTA_ALL_APP_ID, 7} /* hh spec table */ 139 #if BLE_INCLUDED == TRUE 140 , {BTA_ID_GATTC, BTA_ALL_APP_ID, 8} /* gattc spec table */ 141 , {BTA_ID_GATTS, BTA_ALL_APP_ID, 9} /* gatts spec table */ 142 #endif 143 }; 144 145 #define BTA_DM_PM_SPEC_TO_OFFSET (197) /* timeout offset to avoid conflict with other bluedroid host */ 146 tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = { 147 /* AG : 0 */ 148 { 149 (BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */ 150 #if (BTM_SSR_INCLUDED == TRUE) 151 (BTA_DM_PM_SSR2), /* the SSR entry */ 152 #endif 153 { 154 {{BTA_DM_PM_SNIFF_A2DP_IDX, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff */ 155 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 156 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 157 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 158 {{BTA_DM_PM_SNIFF_SCO_OPEN_IDX, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open, active */ 159 {{BTA_DM_PM_SNIFF_A2DP_IDX, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close sniff */ 160 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 161 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 162 {{BTA_DM_PM_RETRY, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 163 } 164 }, 165 166 /* AV : 1 */ 167 { 168 (BTA_DM_PM_SNIFF), /* allow sniff */ 169 #if (BTM_SSR_INCLUDED == TRUE) 170 (BTA_DM_PM_SSR2), /* the SSR entry */ 171 #endif 172 { 173 {{BTA_DM_PM_SNIFF_A2DP_IDX, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff */ 174 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 175 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 176 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 177 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */ 178 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */ 179 {{BTA_DM_PM_SNIFF_A2DP_IDX, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 180 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 181 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 182 } 183 }, 184 185 /* FTC, OPC, JV : 2 */ 186 { 187 (BTA_DM_PM_SNIFF), /* allow sniff */ 188 #if (BTM_SSR_INCLUDED == TRUE) 189 (BTA_DM_PM_SSR2), /* the SSR entry */ 190 #endif 191 { 192 {{BTA_DM_PM_SNIFF_JV_IDX, BTA_FTC_OPS_IDLE_TO_SNIFF_DELAY_MS + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open active */ 193 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 194 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 195 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 196 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */ 197 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */ 198 {{BTA_DM_PM_SNIFF_JV_IDX, BTA_FTC_OPS_IDLE_TO_SNIFF_DELAY_MS + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 199 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 200 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 201 } 202 }, 203 204 /* FTS, PBS, OPS, MSE, BTA_JV_PM_ID_1 : 3 */ 205 { 206 (BTA_DM_PM_SNIFF), /* allow sniff */ 207 #if (BTM_SSR_INCLUDED == TRUE) 208 (BTA_DM_PM_SSR2), /* the SSR entry */ 209 #endif 210 { 211 {{BTA_DM_PM_SNIFF_JV_IDX, BTA_FTS_OPS_IDLE_TO_SNIFF_DELAY_MS + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open active */ 212 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 213 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 214 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 215 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */ 216 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */ 217 {{BTA_DM_PM_SNIFF_JV_IDX, BTA_FTS_OPS_IDLE_TO_SNIFF_DELAY_MS + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 218 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 219 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 220 } 221 }, 222 223 /* HS : 4 */ 224 { 225 (BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */ 226 #if (BTM_SSR_INCLUDED == TRUE) 227 (BTA_DM_PM_SSR2), /* the SSR entry */ 228 #endif 229 { 230 {{BTA_DM_PM_SNIFF, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff */ 231 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 232 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 233 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 234 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open, active */ 235 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close sniff */ 236 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 237 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 238 {{BTA_DM_PM_RETRY, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 239 } 240 }, 241 242 /* AVK : 5 */ 243 { 244 (BTA_DM_PM_SNIFF), /* allow sniff */ 245 #if (BTM_SSR_INCLUDED == TRUE) 246 (BTA_DM_PM_SSR2), /* the SSR entry */ 247 #endif 248 { 249 {{BTA_DM_PM_SNIFF, 3000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff */ 250 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 251 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 252 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 253 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */ 254 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */ 255 {{BTA_DM_PM_SNIFF4, 3000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 256 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 257 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 258 } 259 }, 260 261 /* HD : 6 */ 262 { 263 (BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */ 264 #if (BTM_SSR_INCLUDED == TRUE) 265 (BTA_DM_PM_SSR3), /* the SSR entry */ 266 #endif 267 { 268 {{BTA_DM_PM_SNIFF_HD_ACTIVE_IDX, 5000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff */ 269 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 270 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 271 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 272 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */ 273 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */ 274 {{BTA_DM_PM_SNIFF_HD_IDLE_IDX, 5000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 275 {{BTA_DM_PM_SNIFF_HD_ACTIVE_IDX, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 276 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 277 } 278 }, 279 280 /* HH : 7 */ 281 { 282 (BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */ 283 #if (BTM_SSR_INCLUDED == TRUE) 284 (BTA_DM_PM_SSR1), /* the SSR entry */ 285 #endif 286 { 287 {{BTA_DM_PM_SNIFF_HH_OPEN_IDX, BTA_DM_PM_HH_OPEN_DELAY + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff */ 288 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 289 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 290 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 291 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */ 292 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close, used for HH suspend */ 293 {{BTA_DM_PM_SNIFF_HH_IDLE_IDX, BTA_DM_PM_HH_IDLE_DELAY + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 294 {{BTA_DM_PM_SNIFF_HH_ACTIVE_IDX, BTA_DM_PM_HH_ACTIVE_DELAY + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 295 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 296 } 297 } 298 299 #if BLE_INCLUDED == TRUE 300 /* GATTC : 8 */ 301 , { 302 (BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */ 303 #if (BTM_SSR_INCLUDED == TRUE) 304 (BTA_DM_PM_SSR2), /* the SSR entry */ 305 #endif 306 { 307 {{BTA_DM_PM_SNIFF_A2DP_IDX, 10000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open active */ 308 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 309 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 310 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 311 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */ 312 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */ 313 {{BTA_DM_PM_SNIFF_A2DP_IDX, 10000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 314 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 315 #if defined(AMP_INCLUDED) && (AMP_INCLUDED == TRUE) 316 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* amp */ 317 #endif 318 {{BTA_DM_PM_RETRY, 5000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 319 } 320 } 321 /* GATTS : 9 */ 322 , { 323 (BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */ 324 #if (BTM_SSR_INCLUDED == TRUE) 325 (BTA_DM_PM_SSR2), /* the SSR entry */ 326 #endif 327 { 328 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn open active */ 329 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 330 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 331 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 332 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */ 333 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */ 334 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 335 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 336 #if defined(AMP_INCLUDED) && (AMP_INCLUDED == TRUE) 337 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* amp */ 338 #endif 339 {{BTA_DM_PM_RETRY, 5000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 340 } 341 } 342 343 #endif 344 345 #ifdef BTE_SIM_APP /* For Insight builds only */ 346 /* Entries at the end of the pm_spec table are user-defined (runtime configurable), 347 for power consumption experiments. 348 Insight finds the first user-defined entry by looking for the first BTA_DM_PM_NO_PREF. 349 The number of user_defined specs is defined by BTA_SWRAP_UD_PM_SPEC_COUNT */ 350 , 351 {BTA_DM_PM_NO_PREF}, /* pm_spec USER_DEFINED_0 */ 352 {BTA_DM_PM_NO_PREF} /* pm_spec USER_DEFINED_1 */ 353 #endif /* BTE_SIM_APP */ 354 }; 355 356 /* Please refer to the SNIFF table definitions in bta/bta_api.h. 357 * 358 * Adding to or Modifying the Table 359 * Additional sniff parameter entries can be added for BTA_DM_PM_SNIFF5 - BTA_DM_PM_SNIFF7. 360 * Overrides of additional table entries can be specified in bdroid_buildcfg.h. If additional 361 * sniff parameter entries are added or an override of an existing entry is specified in 362 * bdroid_buildcfg.h then the BTA_DM_PM_*_IDX defines in bta/bta_api.h will need to be match the new 363 * ordering. 364 * 365 * Table Ordering 366 * Sniff Table entries must be ordered from highest latency (biggest interval) to lowest latency. 367 * If there is a conflict among the connected services the setting with the lowest latency will 368 * be selected. 369 */ 370 tBTA_DM_PM_TYPE_QUALIFIER tBTM_PM_PWR_MD bta_dm_pm_md[] = { 371 /* 372 * More sniff parameter entries can be added for 373 * BTA_DM_PM_SNIFF3 - BTA_DM_PM_SNIFF7, if needed. When entries are added or 374 * removed, BTA_DM_PM_PARK_IDX needs to be updated to reflect the actual index 375 * BTA_DM_PM_PARK_IDX is defined in bta/bta_api.h and can be override by the 376 * bdroid_buildcfg.h settings. 377 * The SNIFF table entries must be in the order from highest latency (biggest 378 * interval) to lowest latency. If there's a conflict among the connected 379 * services, the setting with lowest latency wins. 380 */ 381 /* sniff modes: max interval, min interval, attempt, timeout */ 382 {BTA_DM_PM_SNIFF_MAX, BTA_DM_PM_SNIFF_MIN, BTA_DM_PM_SNIFF_ATTEMPT, BTA_DM_PM_SNIFF_TIMEOUT, BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF - A2DP */ 383 {BTA_DM_PM_SNIFF1_MAX, BTA_DM_PM_SNIFF1_MIN, BTA_DM_PM_SNIFF1_ATTEMPT, BTA_DM_PM_SNIFF1_TIMEOUT, BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF1 */ 384 {BTA_DM_PM_SNIFF2_MAX, BTA_DM_PM_SNIFF2_MIN, BTA_DM_PM_SNIFF2_ATTEMPT, BTA_DM_PM_SNIFF2_TIMEOUT, BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF2- HD idle */ 385 {BTA_DM_PM_SNIFF3_MAX, BTA_DM_PM_SNIFF3_MIN, BTA_DM_PM_SNIFF3_ATTEMPT, BTA_DM_PM_SNIFF3_TIMEOUT, BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF3- SCO open */ 386 {BTA_DM_PM_SNIFF4_MAX, BTA_DM_PM_SNIFF4_MIN, BTA_DM_PM_SNIFF4_ATTEMPT, BTA_DM_PM_SNIFF4_TIMEOUT, BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF4- HD active */ 387 {BTA_DM_PM_SNIFF5_MAX, BTA_DM_PM_SNIFF5_MIN, BTA_DM_PM_SNIFF5_ATTEMPT, BTA_DM_PM_SNIFF5_TIMEOUT, BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF5- HD active */ 388 {BTA_DM_PM_PARK_MAX, BTA_DM_PM_PARK_MIN, BTA_DM_PM_PARK_ATTEMPT, BTA_DM_PM_PARK_TIMEOUT, BTM_PM_MD_PARK} 389 390 #ifdef BTE_SIM_APP /* For Insight builds only */ 391 /* Entries at the end of the bta_dm_pm_md table are user-defined (runtime configurable), 392 for power consumption experiments. 393 Insight finds the first user-defined entry by looking for the first 'max=0'. 394 The number of user_defined specs is defined by BTA_SWRAP_UD_PM_DM_COUNT */ 395 , 396 {0}, /* CONN_OPEN/SCO_CLOSE power mode settings for pm_spec USER_DEFINED_0 */ 397 {0}, /* SCO_OPEN power mode settings for pm_spec USER_DEFINED_0 */ 398 399 {0}, /* CONN_OPEN/SCO_CLOSE power mode settings for pm_spec USER_DEFINED_1 */ 400 {0} /* SCO_OPEN power mode settings for pm_spec USER_DEFINED_1 */ 401 #endif /* BTE_SIM_APP */ 402 }; 403 404 /* 0=max_lat -> no SSR */ 405 /* the smaller of the SSR max latency wins. 406 * the entries in this table must be from highest latency (biggest interval) to lowest latency */ 407 #if (BTM_SSR_INCLUDED == TRUE) 408 tBTA_DM_SSR_SPEC bta_dm_ssr_spec[] = { 409 /*max_lat, min_rmt_to, min_loc_to*/ 410 {0, 0, 0}, /* BTA_DM_PM_SSR0 - do not use SSR */ 411 {0, 0, 2}, /* BTA_DM_PM_SSR1 - HH, can NOT share entry with any other profile, 412 seting default max latency and min remote timeout as 0, 413 and always read individual device preference from HH module */ 414 {1200, 2, 2}, /* BTA_DM_PM_SSR2 - others (as long as sniff is allowed)*/ 415 {360, 160, 1600} /* BTA_DM_PM_SSR3 - HD */ 416 }; 417 418 tBTA_DM_SSR_SPEC *const p_bta_dm_ssr_spec = (tBTA_DM_SSR_SPEC *) &bta_dm_ssr_spec; 419 #endif 420 421 tBTA_DM_PM_CFG *const p_bta_dm_pm_cfg = (tBTA_DM_PM_CFG *) &bta_dm_pm_cfg; 422 tBTA_DM_PM_SPEC *const p_bta_dm_pm_spec = (tBTA_DM_PM_SPEC *) &bta_dm_pm_spec; 423 tBTM_PM_PWR_MD *const p_bta_dm_pm_md = (tBTM_PM_PWR_MD *) &bta_dm_pm_md; 424 425 #endif /* #if (BTA_DM_PM_INCLUDED == TRUE) */ 426 427 /* The performance impact of EIR packet size 428 ** 429 ** When BTM_EIR_DEFAULT_FEC_REQUIRED is TRUE, 430 ** 1 to 17 bytes, DM1 is used and most robust. 431 ** 18 to 121 bytes, DM3 is used but impacts inquiry scan time with large number 432 ** of devices.(almost double with 150 users) 433 ** 122 to 224 bytes, DM5 is used but cause quite big performance loss even with 434 ** small number of users. so it is not recommended. 435 ** 225 to 240 bytes, DH5 is used without FEC but it not recommended. 436 ** (same reason of DM5) 437 ** 438 ** When BTM_EIR_DEFAULT_FEC_REQUIRED is FALSE, 439 ** 1 to 27 bytes, DH1 is used but only robust at short range. 440 ** 28 to 183 bytes, DH3 is used but only robust at short range and impacts inquiry 441 ** scan time with large number of devices. 442 ** 184 to 240 bytes, DH5 is used but it not recommended. 443 */ 444 445 #if (BTA_EIR_CANNED_UUID_LIST == TRUE) 446 /* for example */ 447 const UINT8 bta_dm_eir_uuid16_list[] = { 0x08, 0x11, /* Headset */ 448 0x1E, 0x11, /* Handsfree */ 449 0x0E, 0x11, /* AV Remote Control */ 450 0x0B, 0x11, /* Audio Sink */ 451 }; 452 #endif // BTA_EIR_CANNED_UUID_LIST 453 454 /* Extended Inquiry Response */ 455 tBTA_DM_EIR_CONF bta_dm_eir_cfg = { 456 BTM_EIR_DEFAULT_FEC_REQUIRED, /* FEC required */ 457 50, /* minimum length of local name when it is shortened */ 458 /* if length of local name is longer than this and EIR has not enough */ 459 /* room for all UUID list then local name is shortened to this length */ 460 TRUE, /* Included UUIDs */ 461 #if (BTA_EIR_CANNED_UUID_LIST == TRUE) 462 8, 463 (UINT8 *)bta_dm_eir_uuid16_list, 464 #else // BTA_EIR_CANNED_UUID_LIST 465 { /* mask of UUID list in EIR */ 466 0xFFFFFFFF, /* LSB is the first UUID of the first 32 UUIDs in BTM_EIR_UUID_LKUP_TBL */ 467 0xFFFFFFFF /* LSB is the first UUID of the next 32 UUIDs in BTM_EIR_UUID_LKUP_TBL */ 468 /* BTM_EIR_UUID_LKUP_TBL can be overrided */ 469 }, 470 #endif // BTA_EIR_CANNED_UUID_LIST 471 FALSE, /* Not included TX power*/ 472 3, /* Inquiry TX power */ 473 0, /* flags for EIR */ 474 0, /* length of manufacturer specific in bytes */ 475 NULL, /* manufacturer specific */ 476 0, /* length of URL in bytes */ 477 NULL, /* URL */ 478 #if (BTC_GAP_BT_INCLUDED == TRUE) 479 (tBTA_DM_CONFIG_EIR_CBACK *)btc_gap_bt_config_eir_cmpl_callback /* callback */ 480 #else 481 NULL 482 #endif /* #if (BTC_GAP_BT_INCLUDED == TRUE) */ 483 }; 484 tBTA_DM_EIR_CONF *p_bta_dm_eir_cfg = (tBTA_DM_EIR_CONF *) &bta_dm_eir_cfg; 485