Lines Matching full:big

370 			struct bt_iso_big *big;  in bt_iso_connected()  local
372 big = lookup_big_by_handle(iso->iso.big_handle); in bt_iso_connected()
374 err = bt_iso_big_terminate(big); in bt_iso_connected()
376 LOG_ERR("Could not terminate BIG: %d", err); in bt_iso_connected()
2678 /* We can use the index in the `bigs` array as BIG handles, for both in get_free_big()
2703 LOG_DBG("No BIG with flag bit %d set", bit); in big_lookup_flag()
2708 static void cleanup_big(struct bt_iso_big *big) in cleanup_big() argument
2712 SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&big->bis_channels, bis, tmp, node) { in cleanup_big()
2718 sys_slist_remove(&big->bis_channels, NULL, &bis->node); in cleanup_big()
2721 memset(big, 0, sizeof(*big)); in cleanup_big()
2724 static void big_disconnect(struct bt_iso_big *big, uint8_t reason) in big_disconnect() argument
2728 SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) { in big_disconnect()
2739 listener->stopped(big, reason); in big_disconnect()
2745 static int big_init_bis(struct bt_iso_big *big, struct bt_iso_chan **bis_channels, uint8_t num_bis, in big_init_bis() argument
2760 iso_conn->big_handle = big->handle; in big_init_bis()
2767 sys_slist_append(&big->bis_channels, &bis->node); in big_init_bis()
2793 static int hci_le_create_big(struct bt_le_ext_adv *padv, struct bt_iso_big *big, in hci_le_create_big() argument
2809 bis = SYS_SLIST_PEEK_HEAD_CONTAINER(&big->bis_channels, bis, node); in hci_le_create_big()
2816 req->big_handle = big->handle; in hci_le_create_big()
2818 req->num_bis = big->num_bis; in hci_le_create_big()
2833 LOG_DBG("BIG handle 0x%02x, adv_handle 0x%02x, num_bis %u, sdu_interval %u, max_sdu %u, " in hci_le_create_big()
2835 big->handle, padv->handle, big->num_bis, param->interval, qos->sdu, param->latency, in hci_le_create_big()
2838 bt_hci_cmd_state_set_init(buf, &state, big->flags, BT_BIG_PENDING, true); in hci_le_create_big()
2845 SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) { in hci_le_create_big()
2853 static int hci_le_create_big_test(const struct bt_le_ext_adv *padv, struct bt_iso_big *big, in hci_le_create_big_test() argument
2869 bis = SYS_SLIST_PEEK_HEAD_CONTAINER(&big->bis_channels, bis, node); in hci_le_create_big_test()
2876 req->big_handle = big->handle; in hci_le_create_big_test()
2878 req->num_bis = big->num_bis; in hci_le_create_big_test()
2897 LOG_DBG("BIG handle %u, adv handle %u, num_bis %u, SDU interval %u, " in hci_le_create_big_test()
2904 bt_hci_cmd_state_set_init(buf, &state, big->flags, BT_BIG_PENDING, true); in hci_le_create_big_test()
2910 SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) { in hci_le_create_big_test()
3050 struct bt_iso_big *big; in bt_iso_big_create() local
3078 LOG_DBG("Invalid BIG parameters"); in bt_iso_big_create()
3083 big = get_free_big(); in bt_iso_big_create()
3085 if (!big) { in bt_iso_big_create()
3089 err = big_init_bis(big, param->bis_channels, param->num_bis, true); in bt_iso_big_create()
3091 LOG_DBG("Could not init BIG %d", err); in bt_iso_big_create()
3092 cleanup_big(big); in bt_iso_big_create()
3095 big->num_bis = param->num_bis; in bt_iso_big_create()
3098 err = hci_le_create_big(padv, big, param); in bt_iso_big_create()
3101 err = hci_le_create_big_test(padv, big, param); in bt_iso_big_create()
3106 LOG_DBG("Could not create BIG %d", err); in bt_iso_big_create()
3107 cleanup_big(big); in bt_iso_big_create()
3111 *out_big = big; in bt_iso_big_create()
3141 struct bt_iso_big *big; in hci_le_big_complete() local
3145 LOG_WRN("Invalid BIG handle"); in hci_le_big_complete()
3147 big = big_lookup_flag(BT_BIG_PENDING); in hci_le_big_complete()
3148 if (big) { in hci_le_big_complete()
3149 big_disconnect(big, evt->status ? evt->status : BT_HCI_ERR_UNSPECIFIED); in hci_le_big_complete()
3150 cleanup_big(big); in hci_le_big_complete()
3156 big = lookup_big_by_handle(evt->big_handle); in hci_le_big_complete()
3157 atomic_clear_bit(big->flags, BT_BIG_PENDING); in hci_le_big_complete()
3159 LOG_DBG("BIG[%u] %p completed, status 0x%02x %s", big->handle, big, evt->status, in hci_le_big_complete()
3162 if (evt->status || evt->num_bis != big->num_bis) { in hci_le_big_complete()
3163 if (evt->status == BT_HCI_ERR_SUCCESS && evt->num_bis != big->num_bis) { in hci_le_big_complete()
3165 big->num_bis); in hci_le_big_complete()
3167 big_disconnect(big, evt->status ? evt->status : BT_HCI_ERR_UNSPECIFIED); in hci_le_big_complete()
3168 cleanup_big(big); in hci_le_big_complete()
3173 SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) { in hci_le_big_complete()
3187 listener->started(big); in hci_le_big_complete()
3196 struct bt_iso_big *big; in hci_le_big_terminate() local
3199 LOG_WRN("Invalid BIG handle"); in hci_le_big_terminate()
3203 big = lookup_big_by_handle(evt->big_handle); in hci_le_big_terminate()
3205 LOG_DBG("BIG[%u] %p terminated", big->handle, big); in hci_le_big_terminate()
3207 big_disconnect(big, evt->reason); in hci_le_big_terminate()
3208 cleanup_big(big); in hci_le_big_terminate()
3212 static int hci_le_terminate_big(struct bt_iso_big *big) in hci_le_terminate_big() argument
3223 req->big_handle = big->handle; in hci_le_terminate_big()
3229 static int hci_le_big_sync_term(struct bt_iso_big *big) in hci_le_big_sync_term() argument
3243 req->big_handle = big->handle; in hci_le_big_sync_term()
3250 if (evt->status || (evt->big_handle != big->handle)) { in hci_le_big_sync_term()
3259 int bt_iso_big_terminate(struct bt_iso_big *big) in bt_iso_big_terminate() argument
3264 CHECKIF(big == NULL) { in bt_iso_big_terminate()
3265 LOG_DBG("big is NULL"); in bt_iso_big_terminate()
3269 if (!atomic_test_bit(big->flags, BT_BIG_INITIALIZED) || !big->num_bis) { in bt_iso_big_terminate()
3270 LOG_DBG("BIG not initialized"); in bt_iso_big_terminate()
3274 bis = SYS_SLIST_PEEK_HEAD_CONTAINER(&big->bis_channels, bis, node); in bt_iso_big_terminate()
3279 err = hci_le_terminate_big(big); in bt_iso_big_terminate()
3282 * the BIG in hci_le_big_terminate in bt_iso_big_terminate()
3285 SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) { in bt_iso_big_terminate()
3291 err = hci_le_big_sync_term(big); in bt_iso_big_terminate()
3294 big_disconnect(big, BT_HCI_ERR_LOCALHOST_TERM_CONN); in bt_iso_big_terminate()
3295 cleanup_big(big); in bt_iso_big_terminate()
3302 LOG_DBG("Could not terminate BIG %d", err); in bt_iso_big_terminate()
3332 struct bt_iso_big *big; in hci_le_big_sync_established() local
3336 LOG_WRN("Invalid BIG handle"); in hci_le_big_sync_established()
3337 big = big_lookup_flag(BT_BIG_SYNCING); in hci_le_big_sync_established()
3338 if (big) { in hci_le_big_sync_established()
3339 big_disconnect(big, evt->status ? evt->status : BT_HCI_ERR_UNSPECIFIED); in hci_le_big_sync_established()
3340 cleanup_big(big); in hci_le_big_sync_established()
3346 big = lookup_big_by_handle(evt->big_handle); in hci_le_big_sync_established()
3347 atomic_clear_bit(big->flags, BT_BIG_SYNCING); in hci_le_big_sync_established()
3349 LOG_DBG("BIG[%u] %p sync established, status 0x%02x %s", big->handle, big, evt->status, in hci_le_big_sync_established()
3352 if (evt->status || evt->num_bis != big->num_bis) { in hci_le_big_sync_established()
3353 if (evt->status == BT_HCI_ERR_SUCCESS && evt->num_bis != big->num_bis) { in hci_le_big_sync_established()
3355 big->num_bis); in hci_le_big_sync_established()
3357 big_disconnect(big, evt->status ? evt->status : BT_HCI_ERR_UNSPECIFIED); in hci_le_big_sync_established()
3358 cleanup_big(big); in hci_le_big_sync_established()
3363 SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) { in hci_le_big_sync_established()
3377 listener->started(big); in hci_le_big_sync_established()
3386 struct bt_iso_big *big; in hci_le_big_sync_lost() local
3389 LOG_WRN("Invalid BIG handle"); in hci_le_big_sync_lost()
3393 big = lookup_big_by_handle(evt->big_handle); in hci_le_big_sync_lost()
3395 LOG_DBG("BIG[%u] %p sync lost", big->handle, big); in hci_le_big_sync_lost()
3397 big_disconnect(big, evt->reason); in hci_le_big_sync_lost()
3398 cleanup_big(big); in hci_le_big_sync_lost()
3401 static int hci_le_big_create_sync(const struct bt_le_per_adv_sync *sync, struct bt_iso_big *big, in hci_le_big_create_sync() argument
3410 buf = bt_hci_cmd_create(BT_HCI_OP_LE_BIG_CREATE_SYNC, sizeof(*req) + big->num_bis); in hci_le_big_create_sync()
3415 req = net_buf_add(buf, sizeof(*req) + big->num_bis); in hci_le_big_create_sync()
3416 req->big_handle = big->handle; in hci_le_big_create_sync()
3426 req->num_bis = big->num_bis; in hci_le_big_create_sync()
3430 if (bit_idx == big->num_bis) { in hci_le_big_create_sync()
3431 LOG_DBG("BIG cannot contain %u BISes", bit_idx + 1); in hci_le_big_create_sync()
3438 if (bit_idx != big->num_bis) { in hci_le_big_create_sync()
3440 big->num_bis); in hci_le_big_create_sync()
3444 bt_hci_cmd_state_set_init(buf, &state, big->flags, BT_BIG_SYNCING, true); in hci_le_big_create_sync()
3455 struct bt_iso_big *big; in bt_iso_big_sync() local
3527 big = get_free_big(); in bt_iso_big_sync()
3529 if (!big) { in bt_iso_big_sync()
3533 err = big_init_bis(big, param->bis_channels, param->num_bis, false); in bt_iso_big_sync()
3535 LOG_DBG("Could not init BIG %d", err); in bt_iso_big_sync()
3536 cleanup_big(big); in bt_iso_big_sync()
3539 big->num_bis = param->num_bis; in bt_iso_big_sync()
3541 err = hci_le_big_create_sync(sync, big, param); in bt_iso_big_sync()
3543 LOG_DBG("Could not create BIG sync %d", err); in bt_iso_big_sync()
3544 cleanup_big(big); in bt_iso_big_sync()
3548 SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) { in bt_iso_big_sync()
3552 *out_big = big; in bt_iso_big_sync()
3587 struct bt_iso_big *big = &bigs[i]; in bt_iso_reset() local
3589 big_disconnect(big, BT_HCI_ERR_UNSPECIFIED); in bt_iso_reset()
3590 cleanup_big(big); in bt_iso_reset()