Lines Matching full:big

384 			struct bt_iso_big *big;  in bt_iso_connected()  local
386 big = lookup_big_by_handle(iso->iso.big_handle); in bt_iso_connected()
388 err = bt_iso_big_terminate(big); in bt_iso_connected()
390 LOG_ERR("Could not terminate BIG: %d", err); in bt_iso_connected()
2444 /* We can use the index in the `bigs` array as BIG handles, for both in get_free_big()
2469 LOG_DBG("No BIG with flag bit %d set", bit); in big_lookup_flag()
2474 static void cleanup_big(struct bt_iso_big *big) in cleanup_big() argument
2478 SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&big->bis_channels, bis, tmp, node) { in cleanup_big()
2484 sys_slist_remove(&big->bis_channels, NULL, &bis->node); in cleanup_big()
2487 memset(big, 0, sizeof(*big)); in cleanup_big()
2490 static void big_disconnect(struct bt_iso_big *big, uint8_t reason) in big_disconnect() argument
2494 SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) { in big_disconnect()
2501 static int big_init_bis(struct bt_iso_big *big, in big_init_bis() argument
2518 iso_conn->big_handle = big->handle; in big_init_bis()
2525 sys_slist_append(&big->bis_channels, &bis->node); in big_init_bis()
2532 static int hci_le_create_big(struct bt_le_ext_adv *padv, struct bt_iso_big *big, in hci_le_create_big() argument
2548 bis = SYS_SLIST_PEEK_HEAD_CONTAINER(&big->bis_channels, bis, node); in hci_le_create_big()
2555 req->big_handle = big->handle; in hci_le_create_big()
2557 req->num_bis = big->num_bis; in hci_le_create_big()
2572 bt_hci_cmd_state_set_init(buf, &state, big->flags, BT_BIG_PENDING, true); in hci_le_create_big()
2579 SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) { in hci_le_create_big()
2588 struct bt_iso_big *big, in hci_le_create_big_test() argument
2604 bis = SYS_SLIST_PEEK_HEAD_CONTAINER(&big->bis_channels, bis, node); in hci_le_create_big_test()
2611 req->big_handle = big->handle; in hci_le_create_big_test()
2613 req->num_bis = big->num_bis; in hci_le_create_big_test()
2632 LOG_DBG("BIG handle %u, adv handle %u, num_bis %u, SDU interval %u, " in hci_le_create_big_test()
2640 bt_hci_cmd_state_set_init(buf, &state, big->flags, BT_BIG_PENDING, true); in hci_le_create_big_test()
2646 SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) { in hci_le_create_big_test()
2795 struct bt_iso_big *big; in bt_iso_big_create() local
2808 LOG_DBG("Invalid BIG parameters"); in bt_iso_big_create()
2813 big = get_free_big(); in bt_iso_big_create()
2815 if (!big) { in bt_iso_big_create()
2819 err = big_init_bis(big, param->bis_channels, param->num_bis, true); in bt_iso_big_create()
2821 LOG_DBG("Could not init BIG %d", err); in bt_iso_big_create()
2822 cleanup_big(big); in bt_iso_big_create()
2825 big->num_bis = param->num_bis; in bt_iso_big_create()
2828 err = hci_le_create_big(padv, big, param); in bt_iso_big_create()
2831 err = hci_le_create_big_test(padv, big, param); in bt_iso_big_create()
2836 LOG_DBG("Could not create BIG %d", err); in bt_iso_big_create()
2837 cleanup_big(big); in bt_iso_big_create()
2841 *out_big = big; in bt_iso_big_create()
2871 struct bt_iso_big *big; in hci_le_big_complete() local
2875 LOG_WRN("Invalid BIG handle"); in hci_le_big_complete()
2877 big = big_lookup_flag(BT_BIG_PENDING); in hci_le_big_complete()
2878 if (big) { in hci_le_big_complete()
2879 big_disconnect(big, evt->status ? evt->status : BT_HCI_ERR_UNSPECIFIED); in hci_le_big_complete()
2880 cleanup_big(big); in hci_le_big_complete()
2886 big = lookup_big_by_handle(evt->big_handle); in hci_le_big_complete()
2887 atomic_clear_bit(big->flags, BT_BIG_PENDING); in hci_le_big_complete()
2889 LOG_DBG("BIG[%u] %p completed, status 0x%02x", big->handle, big, evt->status); in hci_le_big_complete()
2891 if (evt->status || evt->num_bis != big->num_bis) { in hci_le_big_complete()
2892 if (evt->status == BT_HCI_ERR_SUCCESS && evt->num_bis != big->num_bis) { in hci_le_big_complete()
2894 big->num_bis); in hci_le_big_complete()
2896 big_disconnect(big, evt->status ? evt->status : BT_HCI_ERR_UNSPECIFIED); in hci_le_big_complete()
2897 cleanup_big(big); in hci_le_big_complete()
2902 SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) { in hci_le_big_complete()
2915 struct bt_iso_big *big; in hci_le_big_terminate() local
2918 LOG_WRN("Invalid BIG handle"); in hci_le_big_terminate()
2922 big = lookup_big_by_handle(evt->big_handle); in hci_le_big_terminate()
2924 LOG_DBG("BIG[%u] %p terminated", big->handle, big); in hci_le_big_terminate()
2926 big_disconnect(big, evt->reason); in hci_le_big_terminate()
2927 cleanup_big(big); in hci_le_big_terminate()
2931 static int hci_le_terminate_big(struct bt_iso_big *big) in hci_le_terminate_big() argument
2942 req->big_handle = big->handle; in hci_le_terminate_big()
2948 static int hci_le_big_sync_term(struct bt_iso_big *big) in hci_le_big_sync_term() argument
2962 req->big_handle = big->handle; in hci_le_big_sync_term()
2969 if (evt->status || (evt->big_handle != big->handle)) { in hci_le_big_sync_term()
2978 int bt_iso_big_terminate(struct bt_iso_big *big) in bt_iso_big_terminate() argument
2983 if (!atomic_test_bit(big->flags, BT_BIG_INITIALIZED) || !big->num_bis) { in bt_iso_big_terminate()
2984 LOG_DBG("BIG not initialized"); in bt_iso_big_terminate()
2988 bis = SYS_SLIST_PEEK_HEAD_CONTAINER(&big->bis_channels, bis, node); in bt_iso_big_terminate()
2993 err = hci_le_terminate_big(big); in bt_iso_big_terminate()
2996 * the BIG in hci_le_big_terminate in bt_iso_big_terminate()
2999 SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) { in bt_iso_big_terminate()
3005 err = hci_le_big_sync_term(big); in bt_iso_big_terminate()
3008 big_disconnect(big, BT_HCI_ERR_LOCALHOST_TERM_CONN); in bt_iso_big_terminate()
3009 cleanup_big(big); in bt_iso_big_terminate()
3016 LOG_DBG("Could not terminate BIG %d", err); in bt_iso_big_terminate()
3046 struct bt_iso_big *big; in hci_le_big_sync_established() local
3050 LOG_WRN("Invalid BIG handle"); in hci_le_big_sync_established()
3051 big = big_lookup_flag(BT_BIG_SYNCING); in hci_le_big_sync_established()
3052 if (big) { in hci_le_big_sync_established()
3053 big_disconnect(big, evt->status ? evt->status : BT_HCI_ERR_UNSPECIFIED); in hci_le_big_sync_established()
3054 cleanup_big(big); in hci_le_big_sync_established()
3060 big = lookup_big_by_handle(evt->big_handle); in hci_le_big_sync_established()
3061 atomic_clear_bit(big->flags, BT_BIG_SYNCING); in hci_le_big_sync_established()
3063 LOG_DBG("BIG[%u] %p sync established, status 0x%02x", big->handle, big, evt->status); in hci_le_big_sync_established()
3065 if (evt->status || evt->num_bis != big->num_bis) { in hci_le_big_sync_established()
3066 if (evt->status == BT_HCI_ERR_SUCCESS && evt->num_bis != big->num_bis) { in hci_le_big_sync_established()
3068 big->num_bis); in hci_le_big_sync_established()
3070 big_disconnect(big, evt->status ? evt->status : BT_HCI_ERR_UNSPECIFIED); in hci_le_big_sync_established()
3071 cleanup_big(big); in hci_le_big_sync_established()
3076 SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) { in hci_le_big_sync_established()
3089 struct bt_iso_big *big; in hci_le_big_sync_lost() local
3092 LOG_WRN("Invalid BIG handle"); in hci_le_big_sync_lost()
3096 big = lookup_big_by_handle(evt->big_handle); in hci_le_big_sync_lost()
3098 LOG_DBG("BIG[%u] %p sync lost", big->handle, big); in hci_le_big_sync_lost()
3100 big_disconnect(big, evt->reason); in hci_le_big_sync_lost()
3101 cleanup_big(big); in hci_le_big_sync_lost()
3104 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
3113 buf = bt_hci_cmd_create(BT_HCI_OP_LE_BIG_CREATE_SYNC, sizeof(*req) + big->num_bis); in hci_le_big_create_sync()
3118 req = net_buf_add(buf, sizeof(*req) + big->num_bis); in hci_le_big_create_sync()
3119 req->big_handle = big->handle; in hci_le_big_create_sync()
3129 req->num_bis = big->num_bis; in hci_le_big_create_sync()
3133 if (bit_idx == big->num_bis) { in hci_le_big_create_sync()
3134 LOG_DBG("BIG cannot contain %u BISes", bit_idx + 1); in hci_le_big_create_sync()
3141 if (bit_idx != big->num_bis) { in hci_le_big_create_sync()
3143 big->num_bis); in hci_le_big_create_sync()
3147 bt_hci_cmd_state_set_init(buf, &state, big->flags, BT_BIG_SYNCING, true); in hci_le_big_create_sync()
3158 struct bt_iso_big *big; in bt_iso_big_sync() local
3215 big = get_free_big(); in bt_iso_big_sync()
3217 if (!big) { in bt_iso_big_sync()
3221 err = big_init_bis(big, param->bis_channels, param->num_bis, false); in bt_iso_big_sync()
3223 LOG_DBG("Could not init BIG %d", err); in bt_iso_big_sync()
3224 cleanup_big(big); in bt_iso_big_sync()
3227 big->num_bis = param->num_bis; in bt_iso_big_sync()
3229 err = hci_le_big_create_sync(sync, big, param); in bt_iso_big_sync()
3231 LOG_DBG("Could not create BIG sync %d", err); in bt_iso_big_sync()
3232 cleanup_big(big); in bt_iso_big_sync()
3237 SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) { in bt_iso_big_sync()
3241 *out_big = big; in bt_iso_big_sync()