• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright (C) 1999-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 the main Bluetooth Manager (BTM) internal
22  *  definitions.
23  *
24  ******************************************************************************/
25 
26 #ifndef BTM_BLE_INT_H
27 #define BTM_BLE_INT_H
28 
29 #include "bt_target.h"
30 #include "gki.h"
31 #include "hcidefs.h"
32 #include "btm_ble_api.h"
33 #include "btm_int.h"
34 
35 #if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
36 #include "smp_api.h"
37 #endif
38 
39 
40 /* scanning enable status */
41 #define BTM_BLE_SCAN_ENABLE      0x01
42 #define BTM_BLE_SCAN_DISABLE     0x00
43 
44 /* advertising enable status */
45 #define BTM_BLE_ADV_ENABLE     0x01
46 #define BTM_BLE_ADV_DISABLE    0x00
47 
48 /* use the high 4 bits unused by inquiry mode */
49 #define BTM_BLE_SELECT_SCAN     0x20
50 #define BTM_BLE_NAME_REQUEST    0x40
51 #define BTM_BLE_OBSERVE         0x80
52 
53 #define BTM_BLE_MAX_WL_ENTRY        1
54 #define BTM_BLE_AD_DATA_LEN         31
55 
56 #define BTM_BLE_ENC_MASK    0x03
57 
58 #define BTM_BLE_DUPLICATE_ENABLE        1
59 #define BTM_BLE_DUPLICATE_DISABLE       0
60 
61 #define BTM_BLE_GAP_DISC_SCAN_INT      18         /* Interval(scan_int) = 11.25 ms= 0x0010 * 0.625 ms */
62 #define BTM_BLE_GAP_DISC_SCAN_WIN      18         /* scan_window = 11.25 ms= 0x0010 * 0.625 ms */
63 #define BTM_BLE_GAP_ADV_INT            512        /* Tgap(gen_disc) = 1.28 s= 512 * 0.625 ms */
64 #define BTM_BLE_GAP_LIM_TOUT           180        /* Tgap(lim_timeout) = 180s max */
65 #define BTM_BLE_LOW_LATENCY_SCAN_INT   8000       /* Interval(scan_int) = 5s= 8000 * 0.625 ms */
66 #define BTM_BLE_LOW_LATENCY_SCAN_WIN   8000       /* scan_window = 5s= 8000 * 0.625 ms */
67 
68 
69 #define BTM_BLE_GAP_ADV_FAST_INT_1         48         /* TGAP(adv_fast_interval1) = 30(used) ~ 60 ms  = 48 *0.625 */
70 #define BTM_BLE_GAP_ADV_FAST_INT_2         160         /* TGAP(adv_fast_interval2) = 100(used) ~ 150 ms = 160 * 0.625 ms */
71 #define BTM_BLE_GAP_ADV_SLOW_INT           2048         /* Tgap(adv_slow_interval) = 1.28 s= 512 * 0.625 ms */
72 #define BTM_BLE_GAP_ADV_DIR_MAX_INT        800         /* Tgap(dir_conn_adv_int_max) = 500 ms = 800 * 0.625 ms */
73 #define BTM_BLE_GAP_ADV_DIR_MIN_INT        400         /* Tgap(dir_conn_adv_int_min) = 250 ms = 400 * 0.625 ms */
74 
75 #define BTM_BLE_GAP_FAST_ADV_TOUT          30
76 
77 #define BTM_BLE_SEC_REQ_ACT_NONE           0
78 #define BTM_BLE_SEC_REQ_ACT_ENCRYPT        1 /* encrypt the link using current key or key refresh */
79 #define BTM_BLE_SEC_REQ_ACT_PAIR           2
80 #define BTM_BLE_SEC_REQ_ACT_DISCARD        3 /* discard the sec request while encryption is started but not completed */
81 typedef UINT8   tBTM_BLE_SEC_REQ_ACT;
82 
83 #define BLE_STATIC_PRIVATE_MSB_MASK          0x3f
84 #define BLE_RESOLVE_ADDR_MSB                 0x40   /*  most significant bit, bit7, bit6 is 01 to be resolvable random */
85 #define BLE_RESOLVE_ADDR_MASK                0xc0   /* bit 6, and bit7 */
86 #define BTM_BLE_IS_RESOLVE_BDA(x)           ((x[0] & BLE_RESOLVE_ADDR_MASK) == BLE_RESOLVE_ADDR_MSB)
87 
88 /* LE scan activity bit mask, continue with LE inquiry bits */
89 #define BTM_LE_SELECT_CONN_ACTIVE      0x40     /* selection connection is in progress */
90 #define BTM_LE_OBSERVE_ACTIVE          0x80     /* observe is in progress */
91 
92 /* BLE scan activity mask checking */
93 #define BTM_BLE_IS_SCAN_ACTIVE(x)   ((x) & BTM_BLE_SCAN_ACTIVE_MASK)
94 #define BTM_BLE_IS_INQ_ACTIVE(x)   ((x) & BTM_BLE_INQUIRY_MASK)
95 #define BTM_BLE_IS_OBS_ACTIVE(x)   ((x) & BTM_LE_OBSERVE_ACTIVE)
96 #define BTM_BLE_IS_SEL_CONN_ACTIVE(x)   ((x) & BTM_LE_SELECT_CONN_ACTIVE)
97 
98 /* BLE ADDR type ID bit */
99 #define BLE_ADDR_TYPE_ID_BIT 0x02
100 
101 #define BTM_VSC_CHIP_CAPABILITY_L_VERSION 55
102 #define BTM_VSC_CHIP_CAPABILITY_M_VERSION 95
103 
104 typedef struct
105 {
106     UINT16              data_mask;
107     UINT8               *p_flags;
108     UINT8               ad_data[BTM_BLE_AD_DATA_LEN];
109     UINT8               *p_pad;
110 }tBTM_BLE_LOCAL_ADV_DATA;
111 
112 typedef struct
113 {
114     UINT32          inq_count;          /* Used for determining if a response has already been      */
115                                         /* received for the current inquiry operation. (We do not   */
116                                         /* want to flood the caller with multiple responses from    */
117                                         /* the same device.                                         */
118     BOOLEAN         scan_rsp;
119     tBLE_BD_ADDR    le_bda;
120 } tINQ_LE_BDADDR;
121 
122 #define BTM_BLE_ADV_DATA_LEN_MAX        31
123 #define BTM_BLE_CACHE_ADV_DATA_MAX      62
124 
125 #define BTM_BLE_ISVALID_PARAM(x, min, max)  (((x) >= (min) && (x) <= (max)) || ((x) == BTM_BLE_CONN_PARAM_UNDEF))
126 
127 #define BTM_BLE_PRIVATE_ADDR_INT    900  /* 15 minutes minimum for random address refreshing */
128 
129 typedef struct
130 {
131     UINT16 discoverable_mode;
132     UINT16 connectable_mode;
133     UINT32 scan_window;
134     UINT32 scan_interval;
135     UINT8 scan_type; /* current scan type: active or passive */
136     UINT8 scan_duplicate_filter; /* duplicate filter enabled for scan */
137     UINT16 adv_interval_min;
138     UINT16 adv_interval_max;
139     tBTM_BLE_AFP afp; /* advertising filter policy */
140     tBTM_BLE_SFP sfp; /* scanning filter policy */
141 
142     tBLE_ADDR_TYPE adv_addr_type;
143     UINT8 evt_type;
144     UINT8 adv_mode;
145     tBLE_BD_ADDR direct_bda;
146     tBTM_BLE_EVT directed_conn;
147     BOOLEAN fast_adv_on;
148     TIMER_LIST_ENT fast_adv_timer;
149 
150     UINT8 adv_len;
151     UINT8 adv_data_cache[BTM_BLE_CACHE_ADV_DATA_MAX];
152 
153     /* inquiry BD addr database */
154     UINT8 num_bd_entries;
155     UINT8 max_bd_entries;
156     tBTM_BLE_LOCAL_ADV_DATA adv_data;
157     tBTM_BLE_ADV_CHNL_MAP adv_chnl_map;
158 
159     TIMER_LIST_ENT inq_timer_ent;
160     BOOLEAN scan_rsp;
161     UINT8 state; /* Current state that the inquiry process is in */
162     INT8 tx_power;
163 } tBTM_BLE_INQ_CB;
164 
165 
166 /* random address resolving complete callback */
167 typedef void (tBTM_BLE_RESOLVE_CBACK) (void * match_rec, void *p);
168 
169 typedef void (tBTM_BLE_ADDR_CBACK) (BD_ADDR_PTR static_random, void *p);
170 
171 /* random address management control block */
172 typedef struct
173 {
174     tBLE_ADDR_TYPE              own_addr_type;         /* local device LE address type */
175     BD_ADDR                     private_addr;
176     BD_ADDR                     random_bda;
177     BOOLEAN                     busy;
178     UINT16                       index;
179     tBTM_BLE_RESOLVE_CBACK      *p_resolve_cback;
180     tBTM_BLE_ADDR_CBACK         *p_generate_cback;
181     void                        *p;
182     TIMER_LIST_ENT              raddr_timer_ent;
183 } tBTM_LE_RANDOM_CB;
184 
185 #define BTM_BLE_MAX_BG_CONN_DEV_NUM    10
186 
187 typedef struct
188 {
189     UINT16              min_conn_int;
190     UINT16              max_conn_int;
191     UINT16              slave_latency;
192     UINT16              supervision_tout;
193 
194 }tBTM_LE_CONN_PRAMS;
195 
196 
197 typedef struct
198 {
199     BD_ADDR     bd_addr;
200     UINT8       attr;
201     BOOLEAN     is_connected;
202     BOOLEAN     in_use;
203 }tBTM_LE_BG_CONN_DEV;
204 
205   /* white list using state as a bit mask */
206 #define BTM_BLE_WL_IDLE         0
207 #define BTM_BLE_WL_INIT         1
208 #define BTM_BLE_WL_SCAN         2
209 #define BTM_BLE_WL_ADV          4
210 typedef UINT8 tBTM_BLE_WL_STATE;
211 
212 /* resolving list using state as a bit mask */
213 #define BTM_BLE_RL_IDLE         0
214 #define BTM_BLE_RL_INIT         1
215 #define BTM_BLE_RL_SCAN         2
216 #define BTM_BLE_RL_ADV          4
217 typedef UINT8 tBTM_BLE_RL_STATE;
218 
219 /* BLE connection state */
220 #define BLE_CONN_IDLE    0
221 #define BLE_DIR_CONN     1
222 #define BLE_BG_CONN      2
223 #define BLE_CONN_CANCEL  3
224 typedef UINT8 tBTM_BLE_CONN_ST;
225 
226 typedef struct
227 {
228     void    *p_param;
229 }tBTM_BLE_CONN_REQ;
230 
231 /* LE state request */
232 #define BTM_BLE_STATE_INVALID               0
233 #define BTM_BLE_STATE_CONN_ADV              1
234 #define BTM_BLE_STATE_INIT                  2
235 #define BTM_BLE_STATE_MASTER                3
236 #define BTM_BLE_STATE_SLAVE                 4
237 #define BTM_BLE_STATE_LO_DUTY_DIR_ADV       5
238 #define BTM_BLE_STATE_HI_DUTY_DIR_ADV       6
239 #define BTM_BLE_STATE_NON_CONN_ADV          7
240 #define BTM_BLE_STATE_PASSIVE_SCAN          8
241 #define BTM_BLE_STATE_ACTIVE_SCAN           9
242 #define BTM_BLE_STATE_SCAN_ADV              10
243 #define BTM_BLE_STATE_MAX                   11
244 typedef UINT8 tBTM_BLE_STATE;
245 
246 #define BTM_BLE_STATE_CONN_ADV_BIT          0x0001
247 #define BTM_BLE_STATE_INIT_BIT              0x0002
248 #define BTM_BLE_STATE_MASTER_BIT            0x0004
249 #define BTM_BLE_STATE_SLAVE_BIT             0x0008
250 #define BTM_BLE_STATE_LO_DUTY_DIR_ADV_BIT   0x0010
251 #define BTM_BLE_STATE_HI_DUTY_DIR_ADV_BIT   0x0020
252 #define BTM_BLE_STATE_NON_CONN_ADV_BIT      0x0040
253 #define BTM_BLE_STATE_PASSIVE_SCAN_BIT      0x0080
254 #define BTM_BLE_STATE_ACTIVE_SCAN_BIT       0x0100
255 #define BTM_BLE_STATE_SCAN_ADV_BIT          0x0200
256 typedef UINT16 tBTM_BLE_STATE_MASK;
257 
258 #define BTM_BLE_STATE_ALL_MASK              0x03ff
259 #define BTM_BLE_STATE_ALL_ADV_MASK          (BTM_BLE_STATE_CONN_ADV_BIT|BTM_BLE_STATE_LO_DUTY_DIR_ADV_BIT|BTM_BLE_STATE_HI_DUTY_DIR_ADV_BIT|BTM_BLE_STATE_SCAN_ADV_BIT)
260 #define BTM_BLE_STATE_ALL_SCAN_MASK         (BTM_BLE_STATE_PASSIVE_SCAN_BIT|BTM_BLE_STATE_ACTIVE_SCAN_BIT)
261 #define BTM_BLE_STATE_ALL_CONN_MASK         (BTM_BLE_STATE_MASTER_BIT|BTM_BLE_STATE_SLAVE_BIT)
262 
263 #ifndef BTM_LE_RESOLVING_LIST_MAX
264 #define BTM_LE_RESOLVING_LIST_MAX     0x20
265 #endif
266 
267 typedef struct
268 {
269     BD_ADDR         *resolve_q_random_pseudo;
270     UINT8           *resolve_q_action;
271     UINT8           q_next;
272     UINT8           q_pending;
273 } tBTM_BLE_RESOLVE_Q;
274 
275 typedef struct
276 {
277     BOOLEAN     in_use;
278     BOOLEAN     to_add;
279     BD_ADDR     bd_addr;
280     UINT8       attr;
281 }tBTM_BLE_WL_OP;
282 
283 /* BLE privacy mode */
284 #define BTM_PRIVACY_NONE    0              /* BLE no privacy */
285 #define BTM_PRIVACY_1_1     1              /* BLE privacy 1.1, do not support privacy 1.0 */
286 #define BTM_PRIVACY_1_2     2              /* BLE privacy 1.2 */
287 #define BTM_PRIVACY_MIXED   3              /* BLE privacy mixed mode, broadcom propietary mode */
288 typedef UINT8 tBTM_PRIVACY_MODE;
289 
290 /* data length change event callback */
291 typedef void (tBTM_DATA_LENGTH_CHANGE_CBACK) (UINT16 max_tx_length, UINT16 max_rx_length);
292 
293 /* Define BLE Device Management control structure
294 */
295 typedef struct
296 {
297     UINT8 scan_activity;         /* LE scan activity mask */
298 
299     /*****************************************************
300     **      BLE Inquiry
301     *****************************************************/
302     tBTM_BLE_INQ_CB inq_var;
303 
304     /* observer callback and timer */
305     tBTM_INQ_RESULTS_CB *p_obs_results_cb;
306     tBTM_CMPL_CB *p_obs_cmpl_cb;
307     TIMER_LIST_ENT obs_timer_ent;
308 
309     /* background connection procedure cb value */
310     tBTM_BLE_CONN_TYPE bg_conn_type;
311     UINT32 scan_int;
312     UINT32 scan_win;
313     tBTM_BLE_SEL_CBACK *p_select_cback;
314 
315     /* white list information */
316     UINT8 white_list_avail_size;
317     tBTM_BLE_WL_STATE wl_state;
318 
319     BUFFER_Q conn_pending_q;
320     tBTM_BLE_CONN_ST conn_state;
321 
322     /* random address management control block */
323     tBTM_LE_RANDOM_CB addr_mgnt_cb;
324 
325     BOOLEAN enabled;
326 
327 #if BLE_PRIVACY_SPT == TRUE
328     BOOLEAN mixed_mode; /* privacy 1.2 mixed mode is on or not */
329     tBTM_PRIVACY_MODE privacy_mode; /* privacy mode */
330     UINT8 resolving_list_avail_size; /* resolving list available size */
331     tBTM_BLE_RESOLVE_Q resolving_list_pend_q; /* Resolving list queue */
332     tBTM_BLE_RL_STATE suspended_rl_state; /* Suspended resolving list state */
333     UINT8 *irk_list_mask; /* IRK list availability mask, up to max entry bits */
334     tBTM_BLE_RL_STATE rl_state; /* Resolving list state */
335 #endif
336 
337     tBTM_BLE_WL_OP wl_op_q[BTM_BLE_MAX_BG_CONN_DEV_NUM];
338 
339     /* current BLE link state */
340     tBTM_BLE_STATE_MASK cur_states; /* bit mask of tBTM_BLE_STATE */
341     UINT8 link_count[2]; /* total link count master and slave*/
342 } tBTM_BLE_CB;
343 
344 #ifdef __cplusplus
345 extern "C" {
346 #endif
347 
348 extern void btm_ble_timeout(TIMER_LIST_ENT *p_tle);
349 extern void btm_ble_process_adv_pkt (UINT8 *p);
350 extern void btm_ble_proc_scan_rsp_rpt (UINT8 *p);
351 extern tBTM_STATUS btm_ble_read_remote_name(BD_ADDR remote_bda, tBTM_INQ_INFO *p_cur, tBTM_CMPL_CB *p_cb);
352 extern BOOLEAN btm_ble_cancel_remote_name(BD_ADDR remote_bda);
353 
354 extern tBTM_STATUS btm_ble_set_discoverability(UINT16 combined_mode);
355 extern tBTM_STATUS btm_ble_set_connectability(UINT16 combined_mode);
356 extern tBTM_STATUS btm_ble_start_inquiry (UINT8 mode, UINT8   duration);
357 extern void btm_ble_stop_scan(void);
358 extern void btm_clear_all_pending_le_entry(void);
359 
360 extern void btm_ble_stop_scan();
361 extern BOOLEAN btm_ble_send_extended_scan_params(UINT8 scan_type, UINT32 scan_int,
362                                                  UINT32 scan_win, UINT8 addr_type_own,
363                                                  UINT8 scan_filter_policy);
364 extern void btm_ble_stop_inquiry(void);
365 extern void btm_ble_init (void);
366 extern void btm_ble_connected (UINT8 *bda, UINT16 handle, UINT8 enc_mode, UINT8 role, tBLE_ADDR_TYPE addr_type, BOOLEAN addr_matched);
367 extern void btm_ble_read_remote_features_complete(UINT8 *p);
368 extern void btm_ble_write_adv_enable_complete(UINT8 * p);
369 extern void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced);
370 extern void btm_read_ble_local_supported_states_complete(UINT8 *p, UINT16 evt_len);
371 extern tBTM_BLE_CONN_ST btm_ble_get_conn_st(void);
372 extern void btm_ble_set_conn_st(tBTM_BLE_CONN_ST new_st);
373 extern UINT8 *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, UINT8 **p_dst,
374                                      tBTM_BLE_ADV_DATA *p_data);
375 extern tBTM_STATUS btm_ble_start_adv(void);
376 extern tBTM_STATUS btm_ble_stop_adv(void);
377 extern tBTM_STATUS btm_ble_start_scan(void);
378 extern void btm_ble_create_ll_conn_complete (UINT8 status);
379 
380 /* LE security function from btm_sec.c */
381 #if SMP_INCLUDED == TRUE
382 extern void btm_ble_link_sec_check(BD_ADDR bd_addr, tBTM_LE_AUTH_REQ auth_req, tBTM_BLE_SEC_REQ_ACT *p_sec_req_act);
383 extern void btm_ble_ltk_request_reply(BD_ADDR bda,  BOOLEAN use_stk, BT_OCTET16 stk);
384 extern UINT8 btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data);
385 extern tBTM_STATUS btm_ble_set_encryption (BD_ADDR bd_addr, void *p_ref_data, UINT8 link_role);
386 extern void btm_ble_ltk_request(UINT16 handle, UINT8 rand[8], UINT16 ediv);
387 extern tBTM_STATUS btm_ble_start_encrypt(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk);
388 extern void btm_ble_link_encrypted(BD_ADDR bd_addr, UINT8 encr_enable);
389 #endif
390 
391 /* LE device management functions */
392 extern void btm_ble_reset_id( void );
393 
394 /* security related functions */
395 extern void btm_ble_increment_sign_ctr(BD_ADDR bd_addr, BOOLEAN is_local );
396 extern BOOLEAN btm_get_local_div (BD_ADDR bd_addr, UINT16 *p_div);
397 extern BOOLEAN btm_ble_get_enc_key_type(BD_ADDR bd_addr, UINT8 *p_key_types);
398 
399 extern void btm_ble_test_command_complete(UINT8 *p);
400 extern void btm_ble_rand_enc_complete (UINT8 *p, UINT16 op_code, tBTM_RAND_ENC_CB *p_enc_cplt_cback);
401 
402 extern void btm_sec_save_le_key(BD_ADDR bd_addr, tBTM_LE_KEY_TYPE key_type, tBTM_LE_KEY_VALUE *p_keys, BOOLEAN pass_to_application);
403 extern void btm_ble_update_sec_key_size(BD_ADDR bd_addr, UINT8 enc_key_size);
404 extern UINT8 btm_ble_read_sec_key_size(BD_ADDR bd_addr);
405 
406 /* white list function */
407 extern BOOLEAN btm_update_dev_to_white_list(BOOLEAN to_add, BD_ADDR bd_addr);
408 extern void btm_update_scanner_filter_policy(tBTM_BLE_SFP scan_policy);
409 extern void btm_update_adv_filter_policy(tBTM_BLE_AFP adv_policy);
410 extern void btm_ble_clear_white_list (void);
411 extern void btm_read_white_list_size_complete(UINT8 *p, UINT16 evt_len);
412 extern void btm_ble_add_2_white_list_complete(UINT8 status);
413 extern void btm_ble_remove_from_white_list_complete(UINT8 *p, UINT16 evt_len);
414 extern void btm_ble_clear_white_list_complete(UINT8 *p, UINT16 evt_len);
415 extern void btm_ble_white_list_init(UINT8 white_list_size);
416 
417 /* background connection function */
418 extern BOOLEAN btm_ble_suspend_bg_conn(void);
419 extern BOOLEAN btm_ble_resume_bg_conn(void);
420 extern void btm_ble_initiate_select_conn(BD_ADDR bda);
421 extern BOOLEAN btm_ble_start_auto_conn(BOOLEAN start);
422 extern BOOLEAN btm_ble_start_select_conn(BOOLEAN start,tBTM_BLE_SEL_CBACK   *p_select_cback);
423 extern BOOLEAN btm_ble_renew_bg_conn_params(BOOLEAN add, BD_ADDR bd_addr);
424 extern void btm_write_dir_conn_wl(BD_ADDR target_addr);
425 extern void btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bda, UINT8 status);
426 extern BOOLEAN btm_execute_wl_dev_operation(void);
427 extern void btm_ble_update_link_topology_mask(UINT8 role, BOOLEAN increase);
428 
429 /* direct connection utility */
430 extern BOOLEAN btm_send_pending_direct_conn(void);
431 extern void btm_ble_enqueue_direct_conn_req(void *p_param);
432 
433 /* BLE address management */
434 extern void btm_gen_resolvable_private_addr (void *p_cmd_cplt_cback);
435 extern void btm_gen_non_resolvable_private_addr (tBTM_BLE_ADDR_CBACK *p_cback, void *p);
436 extern void btm_ble_resolve_random_addr(BD_ADDR random_bda, tBTM_BLE_RESOLVE_CBACK * p_cback, void *p);
437 extern void btm_gen_resolve_paddr_low(tBTM_RAND_ENC *p);
438 
439 /*  privacy function */
440 #if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
441 /* BLE address mapping with CS feature */
442 extern BOOLEAN btm_identity_addr_to_random_pseudo(BD_ADDR bd_addr, UINT8 *p_addr_type, BOOLEAN refresh);
443 extern BOOLEAN btm_random_pseudo_to_identity_addr(BD_ADDR random_pseudo, UINT8 *p_static_addr_type);
444 extern void btm_ble_refresh_peer_resolvable_private_addr(BD_ADDR pseudo_bda, BD_ADDR rra, UINT8 rra_type);
445 extern void btm_ble_refresh_local_resolvable_private_addr(BD_ADDR pseudo_addr, BD_ADDR local_rpa);
446 extern void btm_ble_read_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len) ;
447 extern void btm_ble_remove_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len);
448 extern void btm_ble_add_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len);
449 extern void btm_ble_clear_resolving_list_complete(UINT8 *p, UINT16 evt_len);
450 extern void btm_read_ble_resolving_list_size_complete (UINT8 *p, UINT16 evt_len);
451 extern void btm_ble_enable_resolving_list(UINT8);
452 extern BOOLEAN btm_ble_disable_resolving_list(UINT8 rl_mask, BOOLEAN to_resume);
453 extern void btm_ble_enable_resolving_list_for_platform (UINT8 rl_mask);
454 extern void btm_ble_resolving_list_init(UINT8 max_irk_list_sz);
455 extern void btm_ble_resolving_list_cleanup(void);
456 #endif
457 
458 extern void btm_ble_multi_adv_configure_rpa (tBTM_BLE_MULTI_ADV_INST *p_inst);
459 extern void btm_ble_multi_adv_init(void);
460 extern void* btm_ble_multi_adv_get_ref(UINT8 inst_id);
461 extern void btm_ble_multi_adv_cleanup(void);
462 extern void btm_ble_multi_adv_reenable(UINT8 inst_id);
463 extern void btm_ble_multi_adv_enb_privacy(BOOLEAN enable);
464 extern char btm_ble_map_adv_tx_power(int tx_power_index);
465 extern void btm_ble_batchscan_init(void);
466 extern void btm_ble_batchscan_cleanup(void);
467 extern void btm_ble_adv_filter_init(void);
468 extern void btm_ble_adv_filter_cleanup(void);
469 extern BOOLEAN btm_ble_topology_check(tBTM_BLE_STATE_MASK request);
470 extern BOOLEAN btm_ble_clear_topology_mask(tBTM_BLE_STATE_MASK request_state);
471 extern BOOLEAN btm_ble_set_topology_mask(tBTM_BLE_STATE_MASK request_state);
472 
473 #if BTM_BLE_CONFORMANCE_TESTING == TRUE
474 extern void btm_ble_set_no_disc_if_pair_fail (BOOLEAN disble_disc);
475 extern void btm_ble_set_test_mac_value (BOOLEAN enable, UINT8 *p_test_mac_val);
476 extern void btm_ble_set_test_local_sign_cntr_value(BOOLEAN enable, UINT32 test_local_sign_cntr);
477 extern void btm_set_random_address(BD_ADDR random_bda);
478 extern void btm_ble_set_keep_rfu_in_auth_req(BOOLEAN keep_rfu);
479 #endif
480 
481 
482 #ifdef __cplusplus
483 }
484 #endif
485 
486 #endif
487