Lines Matching full:sync
98 static inline void sync_release(struct ll_adv_sync_set *sync);
99 static inline uint16_t sync_handle_get(const struct ll_adv_sync_set *sync);
100 static uint32_t sync_time_get(const struct ll_adv_sync_set *sync,
102 static inline uint8_t sync_remove(struct ll_adv_sync_set *sync,
137 struct ll_adv_sync_set *sync; in ll_adv_sync_param_set() local
153 lll_sync = adv->lll.sync; in ll_adv_sync_param_set()
159 sync = sync_acquire(); in ll_adv_sync_param_set()
160 if (!sync) { in ll_adv_sync_param_set()
165 lll_sync = &sync->lll; in ll_adv_sync_param_set()
166 lll->sync = lll_sync; in ll_adv_sync_param_set()
175 /* NOTE: ull_hdr_init(&sync->ull); is done on start */ in ll_adv_sync_param_set()
176 lll_hdr_init(lll_sync, sync); in ll_adv_sync_param_set()
197 sync->is_enabled = 0U; in ll_adv_sync_param_set()
198 sync->is_started = 0U; in ll_adv_sync_param_set()
203 sync = HDR_LLL2ULL(lll_sync); in ll_adv_sync_param_set()
207 if (sync->is_started) { in ll_adv_sync_param_set()
211 sync->interval = interval; in ll_adv_sync_param_set()
234 sync->is_data_cmplt = 1U; in ll_adv_sync_param_set()
240 void ull_adv_sync_iso_created(struct ll_adv_sync_set *sync) in ull_adv_sync_iso_created() argument
242 if (sync->lll.iso && sync->is_started) { in ull_adv_sync_iso_created()
243 uint8_t iso_handle = sync->lll.iso->handle; in ull_adv_sync_iso_created()
244 uint8_t handle = sync_handle_get(sync); in ull_adv_sync_iso_created()
248 ticker_update_op_cb, sync, 0, TICKER_ID_ADV_ISO_BASE + iso_handle); in ull_adv_sync_iso_created()
259 struct ll_adv_sync_set *sync; in ll_adv_sync_ad_data_set() local
279 lll_sync = adv->lll.sync; in ll_adv_sync_ad_data_set()
284 sync = HDR_LLL2ULL(lll_sync); in ll_adv_sync_ad_data_set()
287 if (sync->is_enabled && (op <= BT_HCI_LE_EXT_ADV_OP_LAST_FRAG)) { in ll_adv_sync_ad_data_set()
292 if (sync->is_data_cmplt && in ll_adv_sync_ad_data_set()
299 if (!sync->is_data_cmplt && in ll_adv_sync_ad_data_set()
347 ((!sync->is_enabled) || in ll_adv_sync_ad_data_set()
364 if (sync->is_started) { in ll_adv_sync_ad_data_set()
365 err = ull_adv_sync_time_update(sync, pdu); in ll_adv_sync_ad_data_set()
375 sync->is_data_cmplt = (op >= BT_HCI_LE_EXT_ADV_OP_LAST_FRAG); in ll_adv_sync_ad_data_set()
384 struct ll_adv_sync_set *sync; in ll_adv_sync_enable() local
397 lll_sync = adv->lll.sync; in ll_adv_sync_enable()
410 sync = HDR_LLL2ULL(lll_sync); in ll_adv_sync_enable()
414 if (!sync->is_enabled) { in ll_adv_sync_enable()
418 if (!sync->is_started) { in ll_adv_sync_enable()
419 sync->is_enabled = 0U; in ll_adv_sync_enable()
424 err = sync_remove(sync, adv, 0U); in ll_adv_sync_enable()
437 if (!sync->is_data_cmplt) { in ll_adv_sync_enable()
445 if (sync->is_enabled) { in ll_adv_sync_enable()
488 if (adv->is_enabled && !sync->is_started) { in ll_adv_sync_enable()
515 ull_adv_sync_info_fill(sync, sync_info); in ll_adv_sync_enable()
518 ticks_slot_overhead = ull_adv_sync_evt_init(adv, sync, ter_pdu); in ll_adv_sync_enable()
540 err = ull_sched_adv_aux_sync_free_anchor_get(sync->ull.ticks_slot, in ll_adv_sync_enable()
553 * sync info field. in ll_adv_sync_enable()
580 ret = ull_adv_sync_start(adv, sync, ticks_anchor_sync, in ll_adv_sync_enable()
583 sync_remove(sync, adv, 1U); in ll_adv_sync_enable()
588 sync->is_started = 1U; in ll_adv_sync_enable()
605 sync_remove(sync, adv, 1U); in ll_adv_sync_enable()
626 sync->is_enabled = sync_got_enabled; in ll_adv_sync_enable()
648 struct ll_adv_sync_set *sync; in ll_adv_sync_set_info_transfer() local
663 if (!adv->lll.sync) { in ll_adv_sync_set_info_transfer()
667 sync = HDR_LLL2ULL(adv->lll.sync); in ll_adv_sync_set_info_transfer()
668 if (!sync->is_enabled) { in ll_adv_sync_set_info_transfer()
673 return ull_cp_periodic_sync(conn, NULL, sync, service_data); in ll_adv_sync_set_info_transfer()
692 struct ll_adv_sync_set *sync; in ull_adv_sync_reset() local
703 lll_sync = adv->lll.sync; in ull_adv_sync_reset()
708 sync = HDR_LLL2ULL(lll_sync); in ull_adv_sync_reset()
710 if (!sync->is_started) { in ull_adv_sync_reset()
711 sync->is_enabled = 0U; in ull_adv_sync_reset()
716 err = sync_remove(sync, adv, 0U); in ull_adv_sync_reset()
746 uint16_t ull_adv_sync_handle_get(const struct ll_adv_sync_set *sync) in ull_adv_sync_handle_get() argument
748 return sync_handle_get(sync); in ull_adv_sync_handle_get()
756 void ull_adv_sync_release(struct ll_adv_sync_set *sync) in ull_adv_sync_release() argument
758 lll_adv_sync_data_release(&sync->lll); in ull_adv_sync_release()
759 sync_release(sync); in ull_adv_sync_release()
762 uint32_t ull_adv_sync_time_get(const struct ll_adv_sync_set *sync, in ull_adv_sync_time_get() argument
765 const struct lll_adv_sync *lll_sync = &sync->lll; in ull_adv_sync_time_get()
792 struct ll_adv_sync_set *sync, in ull_adv_sync_evt_init() argument
799 ull_hdr_init(&sync->ull); in ull_adv_sync_evt_init()
802 pdu = lll_adv_sync_data_peek(&sync->lll, NULL); in ull_adv_sync_evt_init()
805 time_us = sync_time_get(sync, pdu); in ull_adv_sync_evt_init()
808 sync->ull.ticks_active_to_start = 0U; in ull_adv_sync_evt_init()
809 sync->ull.ticks_prepare_to_start = in ull_adv_sync_evt_init()
811 sync->ull.ticks_preempt_to_start = in ull_adv_sync_evt_init()
813 sync->ull.ticks_slot = HAL_TICKER_US_TO_TICKS_CEIL(time_us); in ull_adv_sync_evt_init()
815 ticks_slot_offset = MAX(sync->ull.ticks_active_to_start, in ull_adv_sync_evt_init()
816 sync->ull.ticks_prepare_to_start); in ull_adv_sync_evt_init()
827 struct ll_adv_sync_set *sync, in ull_adv_sync_start() argument
836 interval_us = (uint32_t)sync->interval * PERIODIC_INT_UNIT_US; in ull_adv_sync_start()
838 sync_handle = sync_handle_get(sync); in ull_adv_sync_start()
842 if (sync->lll.iso) { in ull_adv_sync_start()
844 TICKER_ID_ADV_ISO_BASE + sync->lll.iso->handle; in ull_adv_sync_start()
863 (sync->ull.ticks_slot + ticks_slot_overhead), in ull_adv_sync_start()
864 ticker_cb, sync, in ull_adv_sync_start()
877 uint8_t ull_adv_sync_time_update(struct ll_adv_sync_set *sync, in ull_adv_sync_time_update() argument
883 time_us = sync_time_get(sync, pdu); in ull_adv_sync_time_update()
892 if (sync->ull.ticks_slot > time_ticks) { in ull_adv_sync_time_update()
893 ticks_minus = sync->ull.ticks_slot - time_ticks; in ull_adv_sync_time_update()
895 } else if (sync->ull.ticks_slot < time_ticks) { in ull_adv_sync_time_update()
897 ticks_plus = time_ticks - sync->ull.ticks_slot; in ull_adv_sync_time_update()
905 (TICKER_ID_ADV_SYNC_BASE + sync_handle_get(sync)), in ull_adv_sync_time_update()
914 sync->ull.ticks_slot = time_ticks; in ull_adv_sync_time_update()
943 /* Allocate next Sync PDU */ in ull_adv_sync_chm_complete()
959 void ull_adv_sync_info_fill(struct ll_adv_sync_set *sync, in ull_adv_sync_info_fill() argument
964 /* NOTE: sync offset and offset unit filled by secondary prepare. in ull_adv_sync_info_fill()
972 si->interval = sys_cpu_to_le16(sync->interval); in ull_adv_sync_info_fill()
973 lll_sync = &sync->lll; in ull_adv_sync_info_fill()
1085 lll_sync = adv->lll.sync;
2406 /* Initialize adv sync pool. */
2454 static inline void sync_release(struct ll_adv_sync_set *sync) argument
2456 mem_release(sync, &adv_sync_free);
2459 static inline uint16_t sync_handle_get(const struct ll_adv_sync_set *sync) argument
2461 return mem_index_get(sync, ll_adv_sync_pool,
2465 static uint32_t sync_time_get(const struct ll_adv_sync_set *sync, argument
2479 return ull_adv_sync_time_get(sync, len);
2482 static uint8_t sync_stop(struct ll_adv_sync_set *sync) argument
2487 sync_handle = sync_handle_get(sync);
2490 sync, &sync->lll);
2499 static inline uint8_t sync_remove(struct ll_adv_sync_set *sync, argument
2517 if (sync->is_started) {
2518 /* TODO: we removed sync info, but if sync_stop() fails, what do
2521 err = sync_stop(sync);
2526 sync->is_started = 0U;
2537 sync->is_enabled = 0U;
2563 lll_sync = adv->lll.sync;
2573 /* Allocate next Sync PDU */
2614 struct ll_adv_sync_set *sync = HDR_LLL2ULL(lll_sync); local
2616 if (!sync->is_started) {
2617 /* Sync not started yet, apply new channel map now */
2632 lll_sync = lll_aux->adv->sync;
2686 struct ll_adv_sync_set *sync; local
2700 lll_sync = adv->lll.sync;
2701 sync = HDR_LLL2ULL(lll_sync);
2702 ticker_id = TICKER_ID_ADV_SYNC_BASE + sync_handle_get(sync);
2747 remainder = sync->aux_remainder;
2858 struct ll_adv_sync_set *sync = context->context; local
2860 struct ll_adv_sync_set *sync = param; local
2868 lll = &sync->lll;
2871 ref = ull_ref_inc(&sync->ull);
2903 ull_adv_iso_offset_get(sync);