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