Lines Matching +full:timing +full:- +full:ext

2  * Copyright (c) 2016-2019 Nordic Semiconductor ASA
5 * SPDX-License-Identifier: Apache-2.0
62 #define IS_PHY_ENABLED(scan_ctx, scan_phy) ((scan_ctx)->lll.phy & (scan_phy))
113 lll = &scan->lll; in ll_scan_params_set()
120 lll->phy = 0U; in ll_scan_params_set()
128 lll->phy = phy; in ll_scan_params_set()
131 lll = &scan->lll; in ll_scan_params_set()
134 scan->own_addr_type = own_addr_type; in ll_scan_params_set()
136 scan->ticks_window = ull_scan_params_set(lll, type, interval, window, in ll_scan_params_set()
197 own_addr_type = scan_coded->own_addr_type;
198 is_coded_phy = (scan_coded->lll.phy &
203 (!is_coded_phy && (scan->own_addr_type & 0x1))) {
236 lll = &scan_coded->lll;
240 lll = &scan->lll;
241 own_addr_type = scan->own_addr_type;
245 ull_filter_scan_update(lll->filter_policy);
247 lll->rl_idx = FILTER_IDX_NONE;
248 lll->rpa_gen = 0;
250 if ((lll->type & 0x1) && (own_addr_type == BT_HCI_OWN_ADDR_RPA_OR_PUBLIC ||
254 lll->rpa_gen = 1;
259 lll->scan_aux_score = 0;
365 * 0000b - legacy 1M passive
366 * 0001b - legacy 1M active
367 * 0010b - Ext. 1M passive
368 * 0011b - Ext. 1M active
369 * 0100b - invalid
370 * 0101b - invalid
371 * 0110b - invalid
372 * 0111b - invalid
373 * 1000b - Ext. Coded passive
374 * 1001b - Ext. Coded active
376 lll->type = type;
377 lll->filter_policy = filter_policy;
378 lll->interval = interval;
379 lll->ticks_window = HAL_TICKER_US_TO_TICKS((uint64_t)window *
382 return lll->ticks_window;
398 scan->is_stop = 0U;
402 lll = &scan->lll;
403 lll->init_addr_type = scan->own_addr_type;
404 (void)ll_addr_read(lll->init_addr_type, lll->init_addr);
405 lll->chan = 0U;
406 lll->is_stop = 0U;
408 ull_hdr_init(&scan->ull);
411 ticks_interval = HAL_TICKER_US_TO_TICKS((uint64_t)lll->interval *
415 scan->ull.ticks_active_to_start = 0U;
416 scan->ull.ticks_prepare_to_start =
418 scan->ull.ticks_preempt_to_start =
422 ticks_slot_overhead = MAX(scan->ull.ticks_active_to_start,
423 scan->ull.ticks_prepare_to_start);
430 lll->ticks_window = scan->ticks_window;
431 if ((lll->ticks_window +
433 (ticks_interval - ticks_slot_overhead)) {
434 scan->ull.ticks_slot =
435 (lll->ticks_window +
440 scan->ull.ticks_slot + ticks_slot_overhead;
445 scan->ull.ticks_slot = 0U;
447 scan->ull.ticks_slot = ticks_interval -
451 lll->ticks_window = 0U;
466 (lll->ticks_window != 0U)) {
472 lll_coded = &scan_coded->lll;
474 (uint64_t)lll_coded->interval *
476 ticks_window_sum_min = lll->ticks_window +
477 lll_coded->ticks_window;
489 scan->ull.ticks_slot = 0U;
491 scan->ull.ticks_slot =
492 lll->ticks_window -
493 ticks_slot_overhead -
494 HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_START_US) -
523 (lll->ticks_window != 0U)) {
529 lll_1m = &scan_1m->lll;
531 (uint64_t)lll_1m->interval *
533 ticks_window_sum_min = lll->ticks_window +
534 lll_1m->ticks_window;
546 scan->ull.ticks_slot = 0U;
548 scan->ull.ticks_slot =
549 lll->ticks_window -
550 ticks_slot_overhead -
551 HAL_TICKER_US_TO_TICKS(EVENT_OVERHEAD_START_US) -
559 ticks_offset = lll_1m->ticks_window;
566 lll->ticks_window = 0U;
567 lll_1m->ticks_window = 0U;
589 if (!lll->conn) {
595 (scan->ull.ticks_slot +
600 * after any central role is available (indicated by a non-zero
620 HAL_TICKER_REMAINDER((uint64_t)lll->interval *
623 (scan->ull.ticks_slot + ticks_slot_overhead),
636 scan->is_enabled = 1U;
656 scan->is_stop = 1U;
661 scan, &scan->lll);
662 LL_ASSERT_INFO2(err == 0 || err == -EALREADY, handle, err);
670 err = ull_scan_aux_stop(&scan->lll);
671 if (err && (err != -EALREADY)) {
683 aux_scan_lll = aux->parent;
693 if (err && (err != -EALREADY)) {
703 parent = aux->parent;
723 scan = CONTAINER_OF(done->param, struct ll_scan_set, ull);
724 lll = &scan->lll;
726 if (likely(scan->duration_lazy || !lll->duration_reload ||
727 lll->duration_expire)) {
732 lll->duration_reload = 0U;
748 scan_other->lll.duration_reload = 0U;
751 rx = (void *)scan->node_rx_scan_term;
752 rx->hdr.type = NODE_RX_TYPE_EXT_SCAN_TERMINATE;
753 rx->hdr.handle = handle;
770 scan->is_enabled = 0U;
809 return ((uint8_t *)scan - (uint8_t *)ll_scan) / sizeof(*scan);
814 return ull_scan_handle_get((void *)lll->hdr.parent);
822 (BT_CTLR_SCAN_SET - 1))))) {
836 return &scan->lll;
847 if (!scan || !scan->is_enabled) {
859 if (!scan || scan->is_enabled) {
875 return scan->periodic.sync ? ULL_SCAN_IS_SYNC : 0U;
881 return (((uint32_t)scan->is_enabled << scan->lll.type) |
883 (scan->lll.conn ? ULL_SCAN_IS_INITIATOR : 0U) |
886 (scan->periodic.sync ? ULL_SCAN_IS_SYNC : 0U) |
900 return scan->lll.filter_policy;
928 lll = &scan->lll;
931 ref = ull_ref_inc(&scan->ull);
934 /* Append timing parameters */
948 if (lll->duration_expire) {
952 if (lll->duration_expire > elapsed) {
953 lll->duration_expire -= elapsed;
955 if (scan->duration_lazy) {
959 duration_lazy = lll->duration_expire +
960 scan->duration_lazy - elapsed;
975 lll->duration_expire = 0U;
977 } else if (lll->duration_reload && lazy) {
983 lll->duration_expire = lll->duration_reload;
1002 *node_rx_scan_term = (*scan)->node_rx_scan_term;
1003 return duration && period && (*scan)->lll.duration_reload &&
1004 (*scan)->duration_lazy;
1013 lll = &scan->lll;
1015 lll->duration_reload =
1017 scan->lll.interval);
1024 scan->duration_lazy =
1026 scan->lll.interval);
1027 scan->duration_lazy -= lll->duration_reload;
1028 scan->node_rx_scan_term = NULL;
1033 scan->duration_lazy = 0U;
1036 scan->node_rx_scan_term = *node_rx_scan_term;
1041 /* The alloc here used for ext scan termination event */
1054 node_rx->hdr.link = (void *)link_scan_term;
1055 scan->node_rx_scan_term = node_rx;
1059 lll->duration_reload = 0U;
1060 scan->duration_lazy = 0U;
1061 scan->node_rx_scan_term = NULL;
1074 scan->lll.duration_expire = 0U;
1090 scan->lll.duration_expire = scan->lll.duration_reload;
1123 hdr = &scan->ull;
1129 mfy.param = &scan->lll;
1134 LL_ASSERT(!hdr->disabled_cb);
1135 hdr->disabled_param = mfy.param;
1136 hdr->disabled_cb = ext_disabled_cb;
1144 ext_disabled_cb(&scan->lll);
1159 rx = scan->node_rx_scan_term;
1167 ll_rx_put_sched(rx->hdr.link, rx);
1182 if (scan->lll.conn) {
1192 scan->is_enabled = 0U;
1195 if (scan->node_rx_scan_term) {
1196 struct node_rx_pdu *node_rx_scan_term = scan->node_rx_scan_term;
1198 scan->node_rx_scan_term = NULL;
1200 ll_rx_link_release(node_rx_scan_term->hdr.link);