1 /****************************************************************************** 2 * 3 * Copyright 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 28 #include "bt_target.h" 29 #include "bta_api.h" 30 #include "bta_dm_int.h" 31 #include "bta_hh_api.h" 32 #include "bta_jv_api.h" 33 #include "bta_sys.h" 34 35 #ifndef BTA_DM_LINK_POLICY_SETTINGS 36 #define BTA_DM_LINK_POLICY_SETTINGS \ 37 (HCI_ENABLE_MASTER_SLAVE_SWITCH | HCI_ENABLE_HOLD_MODE | \ 38 HCI_ENABLE_SNIFF_MODE | HCI_ENABLE_PARK_MODE) 39 #endif 40 41 /* page timeout in 625uS */ 42 #ifndef BTA_DM_PAGE_TIMEOUT 43 #define BTA_DM_PAGE_TIMEOUT 8192 44 #endif 45 46 /* link supervision timeout in 625uS (5 secs) */ 47 #ifndef BTA_DM_LINK_TIMEOUT 48 #define BTA_DM_LINK_TIMEOUT 8000 49 #endif 50 51 /* TRUE to avoid scatternet when av is streaming (be the master) */ 52 #ifndef BTA_DM_AVOID_SCATTER_A2DP 53 #define BTA_DM_AVOID_SCATTER_A2DP TRUE 54 #endif 55 56 /* For Insight, PM cfg lookup tables are runtime configurable (to allow tweaking 57 * of params for power consumption measurements) */ 58 #ifndef BTE_SIM_APP 59 #define tBTA_DM_PM_TYPE_QUALIFIER const 60 #else 61 #define tBTA_DM_PM_TYPE_QUALIFIER 62 #endif 63 64 const tBTA_DM_CFG bta_dm_cfg = { 65 /* mobile phone COD */ 66 BTA_DM_COD, 67 /* link policy settings */ 68 BTA_DM_LINK_POLICY_SETTINGS, 69 /* page timeout in 625uS */ 70 BTA_DM_PAGE_TIMEOUT, 71 /* link supervision timeout in 625uS*/ 72 BTA_DM_LINK_TIMEOUT, 73 /* true to avoid scatternet when av is streaming (be the master) */ 74 BTA_DM_AVOID_SCATTER_A2DP}; 75 76 #ifndef BTA_DM_SCATTERNET 77 /* By default, allow partial scatternet */ 78 #define BTA_DM_SCATTERNET BTA_DM_PARTIAL_SCATTERNET 79 #endif 80 81 #ifndef BTA_HH_ROLE 82 /* By default, do not specify HH role (backward compatibility) */ 83 #define BTA_HH_ROLE BTA_ANY_ROLE 84 #endif 85 86 #ifndef BTA_AV_ROLE 87 /* By default, AV role (backward BTA_MASTER_ROLE_PREF) */ 88 #define BTA_AV_ROLE BTA_MASTER_ROLE_PREF 89 #endif 90 91 #ifndef BTA_PANU_ROLE 92 /* By default, AV role (backward BTA_MASTER_ROLE_PREF) */ 93 #define BTA_PANU_ROLE BTA_SLAVE_ROLE_ONLY 94 #endif 95 #define BTA_DM_NUM_RM_ENTRY 6 96 97 /* appids for PAN used by insight sample application 98 these have to be same as defined in btui_int.h */ 99 #define BTUI_PAN_ID_PANU 0 100 #define BTUI_PAN_ID_NAP 1 101 #define BTUI_PAN_ID_GN 2 102 103 /* First element is always for SYS: 104 app_id = # of entries table, cfg is 105 device scatternet support */ 106 const tBTA_DM_RM bta_dm_rm_cfg[] = { 107 {BTA_ID_SYS, BTA_DM_NUM_RM_ENTRY, BTA_DM_SCATTERNET}, 108 {BTA_ID_PAN, BTUI_PAN_ID_NAP, BTA_ANY_ROLE}, 109 {BTA_ID_PAN, BTUI_PAN_ID_GN, BTA_ANY_ROLE}, 110 {BTA_ID_PAN, BTA_APP_ID_PAN_MULTI, BTA_MASTER_ROLE_ONLY}, 111 {BTA_ID_PAN, BTUI_PAN_ID_PANU, BTA_PANU_ROLE}, 112 {BTA_ID_HH, BTA_ALL_APP_ID, BTA_HH_ROLE}, 113 {BTA_ID_AV, BTA_ALL_APP_ID, BTA_AV_ROLE}}; 114 115 const tBTA_DM_CFG* p_bta_dm_cfg = &bta_dm_cfg; 116 117 const tBTA_DM_RM* p_bta_dm_rm_cfg = &bta_dm_rm_cfg[0]; 118 119 #define BTA_DM_NUM_PM_ENTRY \ 120 25 /* number of entries in bta_dm_pm_cfg except the first */ 121 #define BTA_DM_NUM_PM_SPEC 16 /* number of entries in bta_dm_pm_spec */ 122 123 tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_CFG 124 bta_dm_pm_cfg[BTA_DM_NUM_PM_ENTRY + 1] = { 125 {BTA_ID_SYS, BTA_DM_NUM_PM_ENTRY, 126 0}, /* reserved: specifies length of this table. */ 127 {BTA_ID_AG, BTA_ALL_APP_ID, 128 0}, /* ag uses first spec table for app id 0 */ 129 {BTA_ID_CT, 1, 1}, /* ct (BTA_ID_CT,APP ID=1) spec table */ 130 {BTA_ID_CG, BTA_ALL_APP_ID, 1}, /* cg resue ct spec table */ 131 {BTA_ID_DG, BTA_ALL_APP_ID, 2}, /* dg spec table */ 132 {BTA_ID_AV, BTA_ALL_APP_ID, 4}, /* av spec table */ 133 {BTA_ID_AVK, BTA_ALL_APP_ID, 13}, /* avk spec table */ 134 {BTA_ID_FTC, BTA_ALL_APP_ID, 7}, /* ftc spec table */ 135 {BTA_ID_FTS, BTA_ALL_APP_ID, 8}, /* fts spec table */ 136 {BTA_ID_HD, BTA_ALL_APP_ID, 3}, /* hd spec table */ 137 {BTA_ID_HH, BTA_HH_APP_ID_JOY, 5}, /* app BTA_HH_APP_ID_JOY, 138 similar to hh spec table */ 139 {BTA_ID_HH, BTA_HH_APP_ID_GPAD, 5}, /* app BTA_HH_APP_ID_GPAD, 140 similar to hh spec table */ 141 {BTA_ID_HH, BTA_ALL_APP_ID, 6}, /* hh spec table */ 142 {BTA_ID_PBC, BTA_ALL_APP_ID, 2}, /* reuse dg spec table */ 143 {BTA_ID_PBS, BTA_ALL_APP_ID, 8}, /* reuse fts spec table */ 144 {BTA_ID_OPC, BTA_ALL_APP_ID, 7}, /* reuse ftc spec table */ 145 {BTA_ID_OPS, BTA_ALL_APP_ID, 8}, /* reuse fts spec table */ 146 {BTA_ID_MSE, BTA_ALL_APP_ID, 8}, /* reuse fts spec table */ 147 {BTA_ID_JV, BTA_JV_PM_ID_1, 148 7}, /* app BTA_JV_PM_ID_1, reuse ftc spec table */ 149 {BTA_ID_JV, BTA_ALL_APP_ID, 8}, /* reuse fts spec table */ 150 {BTA_ID_HL, BTA_ALL_APP_ID, 9}, /* reuse fts spec table */ 151 {BTA_ID_PAN, BTUI_PAN_ID_PANU, 10}, /* PANU spec table */ 152 {BTA_ID_PAN, BTUI_PAN_ID_NAP, 11}, /* NAP spec table */ 153 {BTA_ID_HS, BTA_ALL_APP_ID, 12}, /* HS spec table */ 154 {BTA_ID_GATTC, BTA_ALL_APP_ID, 14}, /* gattc spec table */ 155 {BTA_ID_GATTS, BTA_ALL_APP_ID, 15} /* gatts spec table */ 156 }; 157 158 tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = { 159 /* AG : 0 */ 160 {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */ 161 #if (BTM_SSR_INCLUDED == TRUE) 162 (BTA_DM_PM_SSR2), /* the SSR entry */ 163 #endif 164 { 165 {{BTA_DM_PM_SNIFF_A2DP_IDX, 7000}, 166 {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff */ 167 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 168 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 169 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 170 {{BTA_DM_PM_SNIFF_SCO_OPEN_IDX, 7000}, 171 {BTA_DM_PM_NO_ACTION, 0}}, /* sco open, active */ 172 {{BTA_DM_PM_SNIFF_A2DP_IDX, 7000}, 173 {BTA_DM_PM_NO_ACTION, 0}}, /* sco close sniff */ 174 {{BTA_DM_PM_SNIFF_A2DP_IDX, 7000}, 175 {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 176 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 177 {{BTA_DM_PM_RETRY, 7000}, 178 {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 179 }}, 180 181 /* CT, CG : 1 */ 182 {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */ 183 #if (BTM_SSR_INCLUDED == TRUE) 184 (BTA_DM_PM_SSR2), /* the SSR entry */ 185 #endif 186 { 187 {{BTA_DM_PM_PARK, 5000}, 188 {BTA_DM_PM_NO_ACTION, 0}}, /* conn open park */ 189 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 190 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 191 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 192 {{BTA_DM_PM_SNIFF_A2DP_IDX, 5000}, 193 {BTA_DM_PM_NO_ACTION, 0}}, /* sco open sniff */ 194 {{BTA_DM_PM_PARK, 5000}, 195 {BTA_DM_PM_NO_ACTION, 0}}, /* sco close park */ 196 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 197 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 198 {{BTA_DM_PM_RETRY, 5000}, 199 {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 200 }}, 201 202 /* DG, PBC : 2 */ 203 {(BTA_DM_PM_ACTIVE), /* no power saving mode allowed */ 204 #if (BTM_SSR_INCLUDED == TRUE) 205 (BTA_DM_PM_SSR2), /* the SSR entry */ 206 #endif 207 { 208 {{BTA_DM_PM_SNIFF, 5000}, 209 {BTA_DM_PM_NO_ACTION, 0}}, /* conn open active */ 210 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 211 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 212 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 213 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */ 214 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */ 215 {{BTA_DM_PM_SNIFF, 1000}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 216 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 217 {{BTA_DM_PM_NO_ACTION, 0}, 218 {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 219 }}, 220 221 /* HD : 3 */ 222 {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */ 223 #if (BTM_SSR_INCLUDED == TRUE) 224 (BTA_DM_PM_SSR3), /* the SSR entry */ 225 #endif 226 { 227 {{BTA_DM_PM_SNIFF_HD_ACTIVE_IDX, 5000}, 228 {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff */ 229 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 230 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 231 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 232 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */ 233 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */ 234 {{BTA_DM_PM_SNIFF_HD_IDLE_IDX, 5000}, 235 {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 236 {{BTA_DM_PM_SNIFF_HD_ACTIVE_IDX, 0}, 237 {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 238 {{BTA_DM_PM_NO_ACTION, 0}, 239 {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 240 }}, 241 242 /* AV : 4 */ 243 {(BTA_DM_PM_SNIFF), /* allow sniff */ 244 #if (BTM_SSR_INCLUDED == TRUE) 245 (BTA_DM_PM_SSR2), /* the SSR entry */ 246 #endif 247 { 248 {{BTA_DM_PM_SNIFF_A2DP_IDX, 7000}, 249 {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_SNIFF_A2DP_IDX, 7000}, 256 {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 257 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 258 {{BTA_DM_PM_NO_ACTION, 0}, 259 {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 260 }}, 261 262 /* HH for joysticks and gamepad : 5 */ 263 {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */ 264 #if (BTM_SSR_INCLUDED == TRUE) 265 (BTA_DM_PM_SSR1), /* the SSR entry */ 266 #endif 267 { 268 {{BTA_DM_PM_SNIFF6, BTA_DM_PM_HH_OPEN_DELAY}, 269 {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff */ 270 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 271 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 272 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 273 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */ 274 {{BTA_DM_PM_NO_ACTION, 0}, 275 {BTA_DM_PM_NO_ACTION, 0}}, /* sco close, used for HH suspend */ 276 {{BTA_DM_PM_SNIFF6, BTA_DM_PM_HH_IDLE_DELAY}, 277 {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 278 {{BTA_DM_PM_SNIFF6, BTA_DM_PM_HH_ACTIVE_DELAY}, 279 {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 280 {{BTA_DM_PM_NO_ACTION, 0}, 281 {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 282 }}, 283 284 /* HH : 6 */ 285 {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */ 286 #if (BTM_SSR_INCLUDED == TRUE) 287 (BTA_DM_PM_SSR1), /* the SSR entry */ 288 #endif 289 { 290 {{BTA_DM_PM_SNIFF_HH_OPEN_IDX, BTA_DM_PM_HH_OPEN_DELAY}, 291 {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff */ 292 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 293 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 294 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 295 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */ 296 {{BTA_DM_PM_NO_ACTION, 0}, 297 {BTA_DM_PM_NO_ACTION, 0}}, /* sco close, used for HH suspend */ 298 {{BTA_DM_PM_SNIFF_HH_IDLE_IDX, BTA_DM_PM_HH_IDLE_DELAY}, 299 {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 300 {{BTA_DM_PM_SNIFF_HH_ACTIVE_IDX, BTA_DM_PM_HH_ACTIVE_DELAY}, 301 {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 302 {{BTA_DM_PM_NO_ACTION, 0}, 303 {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 304 }}, 305 306 /* FTC, OPC, JV : 7 */ 307 {(BTA_DM_PM_SNIFF), /* allow sniff */ 308 #if (BTM_SSR_INCLUDED == TRUE) 309 (BTA_DM_PM_SSR2), /* the SSR entry */ 310 #endif 311 { 312 {{BTA_DM_PM_ACTIVE, 0}, 313 {BTA_DM_PM_NO_ACTION, 0}}, /* conn open active */ 314 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 315 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 316 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 317 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */ 318 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */ 319 {{BTA_DM_PM_SNIFF_A2DP_IDX, BTA_FTC_IDLE_TO_SNIFF_DELAY_MS}, 320 {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 321 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 322 {{BTA_DM_PM_NO_ACTION, 0}, 323 {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 324 }}, 325 326 /* FTS, PBS, OPS, MSE, BTA_JV_PM_ID_1 : 8 */ 327 {(BTA_DM_PM_SNIFF), /* allow sniff */ 328 #if (BTM_SSR_INCLUDED == TRUE) 329 (BTA_DM_PM_SSR2), /* the SSR entry */ 330 #endif 331 { 332 {{BTA_DM_PM_ACTIVE, 0}, 333 {BTA_DM_PM_NO_ACTION, 0}}, /* conn open active */ 334 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 335 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 336 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 337 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */ 338 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */ 339 {{BTA_DM_PM_SNIFF_A2DP_IDX, BTA_FTS_OPS_IDLE_TO_SNIFF_DELAY_MS}, 340 {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 341 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 342 {{BTA_DM_PM_NO_ACTION, 0}, 343 {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 344 }}, 345 346 /* HL : 9 */ 347 {(BTA_DM_PM_SNIFF), /* allow sniff */ 348 #if (BTM_SSR_INCLUDED == TRUE) 349 (BTA_DM_PM_SSR2), /* the SSR entry */ 350 #endif 351 { 352 {{BTA_DM_PM_SNIFF_A2DP_IDX, 5000}, 353 {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff */ 354 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 355 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 356 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 357 {{BTA_DM_PM_NO_ACTION, 0}, 358 {BTA_DM_PM_NO_ACTION, 0}}, /* sco open, active */ 359 {{BTA_DM_PM_NO_ACTION, 0}, 360 {BTA_DM_PM_NO_ACTION, 0}}, /* sco close sniff */ 361 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 362 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 363 {{BTA_DM_PM_NO_ACTION, 0}, 364 {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 365 }}, 366 367 /* PANU : 10 */ 368 {(BTA_DM_PM_SNIFF), /* allow sniff */ 369 #if (BTM_SSR_INCLUDED == TRUE) 370 (BTA_DM_PM_SSR2), /* the SSR entry */ 371 #endif 372 { 373 {{BTA_DM_PM_ACTIVE, 0}, 374 {BTA_DM_PM_NO_ACTION, 0}}, /* conn open active */ 375 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 376 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 377 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 378 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */ 379 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */ 380 {{BTA_DM_PM_SNIFF_A2DP_IDX, 5000}, 381 {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 382 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 383 {{BTA_DM_PM_NO_ACTION, 0}, 384 {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 385 }}, 386 387 /* NAP : 11 */ 388 {(BTA_DM_PM_SNIFF), /* allow sniff */ 389 #if (BTM_SSR_INCLUDED == TRUE) 390 (BTA_DM_PM_SSR2), /* the SSR entry */ 391 #endif 392 { 393 {{BTA_DM_PM_ACTIVE, 0}, 394 {BTA_DM_PM_NO_ACTION, 0}}, /* conn open active */ 395 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 396 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 397 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 398 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */ 399 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */ 400 {{BTA_DM_PM_SNIFF_A2DP_IDX, 5000}, 401 {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 402 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 403 404 {{BTA_DM_PM_NO_ACTION, 0}, 405 {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 406 }}, 407 408 /* HS : 12 */ 409 {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */ 410 #if (BTM_SSR_INCLUDED == TRUE) 411 (BTA_DM_PM_SSR2), /* the SSR entry */ 412 #endif 413 { 414 {{BTA_DM_PM_SNIFF, 7000}, 415 {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff */ 416 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 417 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 418 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 419 {{BTA_DM_PM_SNIFF3, 7000}, 420 {BTA_DM_PM_NO_ACTION, 0}}, /* sco open, active */ 421 {{BTA_DM_PM_SNIFF, 7000}, 422 {BTA_DM_PM_NO_ACTION, 0}}, /* sco close sniff */ 423 {{BTA_DM_PM_SNIFF, 7000}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 424 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 425 {{BTA_DM_PM_RETRY, 7000}, 426 {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 427 }}, 428 429 /* AVK : 13 */ 430 {(BTA_DM_PM_SNIFF), /* allow sniff */ 431 #if (BTM_SSR_INCLUDED == TRUE) 432 (BTA_DM_PM_SSR2), /* the SSR entry */ 433 #endif 434 { 435 {{BTA_DM_PM_SNIFF, 3000}, 436 {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff */ 437 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 438 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 439 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 440 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */ 441 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */ 442 {{BTA_DM_PM_SNIFF4, 3000}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 443 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 444 {{BTA_DM_PM_NO_ACTION, 0}, 445 {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 446 }} 447 448 /* GATTC : 14 */ 449 , 450 {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */ 451 #if (BTM_SSR_INCLUDED == TRUE) 452 (BTA_DM_PM_SSR2), /* the SSR entry */ 453 #endif 454 { 455 {{BTA_DM_PM_SNIFF_A2DP_IDX, 10000}, 456 {BTA_DM_PM_NO_ACTION, 0}}, /* conn open active */ 457 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 458 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 459 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 460 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */ 461 {{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */ 462 {{BTA_DM_PM_SNIFF_A2DP_IDX, 10000}, 463 {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 464 {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 465 {{BTA_DM_PM_RETRY, 5000}, 466 {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 467 }} 468 /* GATTS : 15 */ 469 , 470 {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */ 471 #if (BTM_SSR_INCLUDED == TRUE) 472 (BTA_DM_PM_SSR2), /* the SSR entry */ 473 #endif 474 { 475 {{BTA_DM_PM_NO_PREF, 0}, 476 {BTA_DM_PM_NO_ACTION, 0}}, /* conn open active */ 477 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */ 478 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */ 479 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */ 480 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open */ 481 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close */ 482 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */ 483 {{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */ 484 {{BTA_DM_PM_RETRY, 5000}, 485 {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */ 486 }} 487 488 #ifdef BTE_SIM_APP /* For Insight builds only */ 489 /* Entries at the end of the pm_spec table are user-defined (runtime 490 configurable), 491 for power consumption experiments. 492 Insight finds the first user-defined entry by looking for the first 493 BTA_DM_PM_NO_PREF. 494 The number of user_defined specs is defined by 495 BTA_SWRAP_UD_PM_SPEC_COUNT */ 496 , 497 {BTA_DM_PM_NO_PREF}, /* pm_spec USER_DEFINED_0 */ 498 {BTA_DM_PM_NO_PREF} /* pm_spec USER_DEFINED_1 */ 499 #endif /* BTE_SIM_APP */ 500 }; 501 502 /* Please refer to the SNIFF table definitions in bta_api.h. 503 * 504 * Adding to or Modifying the Table 505 * Additional sniff parameter entries can be added for BTA_DM_PM_SNIFF6 - 506 * BTA_DM_PM_SNIFF7. 507 * Overrides of additional table entries can be specified in bdroid_buildcfg.h. 508 * If additional 509 * sniff parameter entries are added or an override of an existing entry is 510 * specified in 511 * bdroid_buildcfg.h then the BTA_DM_PM_*_IDX defines in bta_api.h will need to 512 * be match the new 513 * ordering. 514 * 515 * Table Ordering 516 * Sniff Table entries must be ordered from highest latency (biggest interval) 517 * to lowest latency. 518 * If there is a conflict among the connected services the setting with the 519 * lowest latency will 520 * be selected. 521 */ 522 tBTA_DM_PM_TYPE_QUALIFIER tBTM_PM_PWR_MD bta_dm_pm_md[] = { 523 /* 524 * More sniff parameter entries can be added for 525 * BTA_DM_PM_SNIFF3 - BTA_DM_PM_SNIFF7, if needed. When entries are added or 526 * removed, BTA_DM_PM_PARK_IDX needs to be updated to reflect the actual 527 * index 528 * BTA_DM_PM_PARK_IDX is defined in bta_api.h and can be override by the 529 * bdroid_buildcfg.h settings. 530 * The SNIFF table entries must be in the order from highest latency 531 * (biggest 532 * interval) to lowest latency. If there's a conflict among the connected 533 * services, the setting with lowest latency wins. 534 */ 535 /* sniff modes: max interval, min interval, attempt, timeout */ 536 {BTA_DM_PM_SNIFF_MAX, BTA_DM_PM_SNIFF_MIN, BTA_DM_PM_SNIFF_ATTEMPT, 537 BTA_DM_PM_SNIFF_TIMEOUT, BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF - A2DP */ 538 {BTA_DM_PM_SNIFF1_MAX, BTA_DM_PM_SNIFF1_MIN, BTA_DM_PM_SNIFF1_ATTEMPT, 539 BTA_DM_PM_SNIFF1_TIMEOUT, BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF1 */ 540 {BTA_DM_PM_SNIFF2_MAX, BTA_DM_PM_SNIFF2_MIN, BTA_DM_PM_SNIFF2_ATTEMPT, 541 BTA_DM_PM_SNIFF2_TIMEOUT, 542 BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF2- HD idle */ 543 {BTA_DM_PM_SNIFF3_MAX, BTA_DM_PM_SNIFF3_MIN, BTA_DM_PM_SNIFF3_ATTEMPT, 544 BTA_DM_PM_SNIFF3_TIMEOUT, 545 BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF3- SCO open */ 546 {BTA_DM_PM_SNIFF4_MAX, BTA_DM_PM_SNIFF4_MIN, BTA_DM_PM_SNIFF4_ATTEMPT, 547 BTA_DM_PM_SNIFF4_TIMEOUT, 548 BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF4- HD active */ 549 {BTA_DM_PM_SNIFF5_MAX, BTA_DM_PM_SNIFF5_MIN, BTA_DM_PM_SNIFF5_ATTEMPT, 550 BTA_DM_PM_SNIFF5_TIMEOUT, 551 BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF5- HD active */ 552 {BTA_DM_PM_SNIFF6_MAX, BTA_DM_PM_SNIFF6_MIN, BTA_DM_PM_SNIFF6_ATTEMPT, 553 BTA_DM_PM_SNIFF6_TIMEOUT, 554 BTM_PM_MD_SNIFF}, /* for BTA_DM_PM_SNIFF6- HD active */ 555 {BTA_DM_PM_PARK_MAX, BTA_DM_PM_PARK_MIN, BTA_DM_PM_PARK_ATTEMPT, 556 BTA_DM_PM_PARK_TIMEOUT, BTM_PM_MD_PARK} 557 558 #ifdef BTE_SIM_APP /* For Insight builds only */ 559 /* Entries at the end of the bta_dm_pm_md table are user-defined (runtime 560 configurable), 561 for power consumption experiments. 562 Insight finds the first user-defined entry by looking for the first 563 'max=0'. 564 The number of user_defined specs is defined by BTA_SWRAP_UD_PM_DM_COUNT 565 */ 566 , 567 {0}, /* CONN_OPEN/SCO_CLOSE power mode settings for pm_spec USER_DEFINED_0 568 */ 569 {0}, /* SCO_OPEN power mode settings for pm_spec USER_DEFINED_0 */ 570 571 {0}, /* CONN_OPEN/SCO_CLOSE power mode settings for pm_spec USER_DEFINED_1 572 */ 573 {0} /* SCO_OPEN power mode settings for pm_spec USER_DEFINED_1 */ 574 #endif /* BTE_SIM_APP */ 575 }; 576 577 /* 0=max_lat -> no SSR */ 578 /* the smaller of the SSR max latency wins. 579 * the entries in this table must be from highest latency (biggest interval) to 580 * lowest latency */ 581 #if (BTM_SSR_INCLUDED == TRUE) 582 tBTA_DM_SSR_SPEC bta_dm_ssr_spec[] = { 583 /*max_lat, min_rmt_to, min_loc_to*/ 584 {0, 0, 0}, /* BTA_DM_PM_SSR0 - do not use SSR */ 585 /* BTA_DM_PM_SSR1 - HH, can NOT share entry with any other profile, seting 586 default max latency and min remote timeout as 0, and always read 587 individual device preference from HH module */ 588 {0, 0, 2}, 589 {1200, 2, 2}, /* BTA_DM_PM_SSR2 - others (as long as sniff is allowed)*/ 590 {360, 160, 1600}, /* BTA_DM_PM_SSR3 - HD */ 591 {1200, 65534, 65534} /* BTA_DM_PM_SSR4 - A2DP streaming */ 592 }; 593 594 tBTA_DM_SSR_SPEC* p_bta_dm_ssr_spec = &bta_dm_ssr_spec[0]; 595 #endif 596 597 const tBTA_DM_PM_CFG* p_bta_dm_pm_cfg = &bta_dm_pm_cfg[0]; 598 const tBTA_DM_PM_SPEC* p_bta_dm_pm_spec = &bta_dm_pm_spec[0]; 599 const tBTM_PM_PWR_MD* p_bta_dm_pm_md = &bta_dm_pm_md[0]; 600 601 /* The performance impact of EIR packet size 602 * 603 * When BTM_EIR_DEFAULT_FEC_REQUIRED is true, 604 * 1 to 17 bytes, DM1 is used and most robust. 605 * 18 to 121 bytes, DM3 is used but impacts inquiry scan time with large number 606 * of devices.(almost double with 150 users) 607 * 122 to 224 bytes, DM5 is used but cause quite big performance loss even with 608 * small number of users. so it is not recommended. 609 * 225 to 240 bytes, DH5 is used without FEC but it not recommended. 610 * (same reason of DM5) 611 * 612 * When BTM_EIR_DEFAULT_FEC_REQUIRED is false, 613 * 1 to 27 bytes, DH1 is used but only robust at short range. 614 * 28 to 183 bytes, DH3 is used but only robust at short range and impacts 615 * inquiry 616 * scan time with large number of devices. 617 * 184 to 240 bytes, DH5 is used but it not recommended. 618 */ 619 620 #if (BTA_EIR_CANNED_UUID_LIST == TRUE) 621 /* for example */ 622 const uint8_t bta_dm_eir_uuid16_list[] = { 623 0x08, 0x11, /* Headset */ 624 0x1E, 0x11, /* Handsfree */ 625 0x0E, 0x11, /* AV Remote Control */ 626 0x0B, 0x11, /* Audio Sink */ 627 }; 628 #endif // BTA_EIR_CANNED_UUID_LIST 629 630 /* Extended Inquiry Response */ 631 const tBTA_DM_EIR_CONF bta_dm_eir_cfg = { 632 50, /* minimum length of local name when it is shortened */ 633 /* if length of local name is longer than this and EIR has not enough */ 634 /* room for all UUID list then local name is shortened to this length */ 635 #if (BTA_EIR_CANNED_UUID_LIST == TRUE) 636 8, (uint8_t*)bta_dm_eir_uuid16_list, 637 #else // BTA_EIR_CANNED_UUID_LIST 638 { 639 /* mask of UUID list in EIR */ 640 0xFFFFFFFF, /* LSB is the first UUID of the first 32 UUIDs in 641 BTM_EIR_UUID_LKUP_TBL */ 642 0xFFFFFFFF /* LSB is the first UUID of the next 32 UUIDs in 643 BTM_EIR_UUID_LKUP_TBL */ 644 /* BTM_EIR_UUID_LKUP_TBL can be overrided */ 645 }, 646 #endif // BTA_EIR_CANNED_UUID_LIST 647 NULL, /* Inquiry TX power */ 648 0, /* length of flags in bytes */ 649 NULL, /* flags for EIR */ 650 0, /* length of manufacturer specific in bytes */ 651 NULL, /* manufacturer specific */ 652 0, /* length of additional data in bytes */ 653 NULL /* additional data */ 654 }; 655 const tBTA_DM_EIR_CONF* p_bta_dm_eir_cfg = &bta_dm_eir_cfg; 656