Lines Matching +full:location +full:- +full:rx
8 * Copyright (c) 2022-2023 Nordic Semiconductor ASA
10 * SPDX-License-Identifier: Apache-2.0
92 BT_BAP_LC3_UNICAST_PRESET_16_2_1(LOCATION, CONTEXT)};
94 "16_2_1", BT_BAP_LC3_UNICAST_PRESET_16_2_1(LOCATION, CONTEXT)};
96 "16_2_1", BT_BAP_LC3_BROADCAST_PRESET_16_2_1(LOCATION, CONTEXT)};
100 {"8_1_1", BT_BAP_LC3_UNICAST_PRESET_8_1_1(LOCATION, CONTEXT)},
101 {"8_2_1", BT_BAP_LC3_UNICAST_PRESET_8_2_1(LOCATION, CONTEXT)},
102 {"16_1_1", BT_BAP_LC3_UNICAST_PRESET_16_1_1(LOCATION, CONTEXT)},
103 {"16_2_1", BT_BAP_LC3_UNICAST_PRESET_16_2_1(LOCATION, CONTEXT)},
104 {"24_1_1", BT_BAP_LC3_UNICAST_PRESET_24_1_1(LOCATION, CONTEXT)},
105 {"24_2_1", BT_BAP_LC3_UNICAST_PRESET_24_2_1(LOCATION, CONTEXT)},
106 {"32_1_1", BT_BAP_LC3_UNICAST_PRESET_32_1_1(LOCATION, CONTEXT)},
107 {"32_2_1", BT_BAP_LC3_UNICAST_PRESET_32_2_1(LOCATION, CONTEXT)},
108 {"441_1_1", BT_BAP_LC3_UNICAST_PRESET_441_1_1(LOCATION, CONTEXT)},
109 {"441_2_1", BT_BAP_LC3_UNICAST_PRESET_441_2_1(LOCATION, CONTEXT)},
110 {"48_1_1", BT_BAP_LC3_UNICAST_PRESET_48_1_1(LOCATION, CONTEXT)},
111 {"48_2_1", BT_BAP_LC3_UNICAST_PRESET_48_2_1(LOCATION, CONTEXT)},
112 {"48_3_1", BT_BAP_LC3_UNICAST_PRESET_48_3_1(LOCATION, CONTEXT)},
113 {"48_4_1", BT_BAP_LC3_UNICAST_PRESET_48_4_1(LOCATION, CONTEXT)},
114 {"48_5_1", BT_BAP_LC3_UNICAST_PRESET_48_5_1(LOCATION, CONTEXT)},
115 {"48_6_1", BT_BAP_LC3_UNICAST_PRESET_48_6_1(LOCATION, CONTEXT)},
116 /* High-reliability presets */
117 {"8_1_2", BT_BAP_LC3_UNICAST_PRESET_8_1_2(LOCATION, CONTEXT)},
118 {"8_2_2", BT_BAP_LC3_UNICAST_PRESET_8_2_2(LOCATION, CONTEXT)},
119 {"16_1_2", BT_BAP_LC3_UNICAST_PRESET_16_1_2(LOCATION, CONTEXT)},
120 {"16_2_2", BT_BAP_LC3_UNICAST_PRESET_16_2_2(LOCATION, CONTEXT)},
121 {"24_1_2", BT_BAP_LC3_UNICAST_PRESET_24_1_2(LOCATION, CONTEXT)},
122 {"24_2_2", BT_BAP_LC3_UNICAST_PRESET_24_2_2(LOCATION, CONTEXT)},
123 {"32_1_2", BT_BAP_LC3_UNICAST_PRESET_32_1_2(LOCATION, CONTEXT)},
124 {"32_2_2", BT_BAP_LC3_UNICAST_PRESET_32_2_2(LOCATION, CONTEXT)},
125 {"441_1_2", BT_BAP_LC3_UNICAST_PRESET_441_1_2(LOCATION, CONTEXT)},
126 {"441_2_2", BT_BAP_LC3_UNICAST_PRESET_441_2_2(LOCATION, CONTEXT)},
127 {"48_1_2", BT_BAP_LC3_UNICAST_PRESET_48_1_2(LOCATION, CONTEXT)},
128 {"48_2_2", BT_BAP_LC3_UNICAST_PRESET_48_2_2(LOCATION, CONTEXT)},
129 {"48_3_2", BT_BAP_LC3_UNICAST_PRESET_48_3_2(LOCATION, CONTEXT)},
130 {"48_4_2", BT_BAP_LC3_UNICAST_PRESET_48_4_2(LOCATION, CONTEXT)},
131 {"48_5_2", BT_BAP_LC3_UNICAST_PRESET_48_5_2(LOCATION, CONTEXT)},
132 {"48_6_2", BT_BAP_LC3_UNICAST_PRESET_48_6_2(LOCATION, CONTEXT)},
136 {"8_1_1", BT_BAP_LC3_BROADCAST_PRESET_8_1_1(LOCATION, CONTEXT)},
137 {"8_2_1", BT_BAP_LC3_BROADCAST_PRESET_8_2_1(LOCATION, CONTEXT)},
138 {"16_1_1", BT_BAP_LC3_BROADCAST_PRESET_16_1_1(LOCATION, CONTEXT)},
139 {"16_2_1", BT_BAP_LC3_BROADCAST_PRESET_16_2_1(LOCATION, CONTEXT)},
140 {"24_1_1", BT_BAP_LC3_BROADCAST_PRESET_24_1_1(LOCATION, CONTEXT)},
141 {"24_2_1", BT_BAP_LC3_BROADCAST_PRESET_24_2_1(LOCATION, CONTEXT)},
142 {"32_1_1", BT_BAP_LC3_BROADCAST_PRESET_32_1_1(LOCATION, CONTEXT)},
143 {"32_2_1", BT_BAP_LC3_BROADCAST_PRESET_32_2_1(LOCATION, CONTEXT)},
144 {"441_1_1", BT_BAP_LC3_BROADCAST_PRESET_441_1_1(LOCATION, CONTEXT)},
145 {"441_2_1", BT_BAP_LC3_BROADCAST_PRESET_441_2_1(LOCATION, CONTEXT)},
146 {"48_1_1", BT_BAP_LC3_BROADCAST_PRESET_48_1_1(LOCATION, CONTEXT)},
147 {"48_2_1", BT_BAP_LC3_BROADCAST_PRESET_48_2_1(LOCATION, CONTEXT)},
148 {"48_3_1", BT_BAP_LC3_BROADCAST_PRESET_48_3_1(LOCATION, CONTEXT)},
149 {"48_4_1", BT_BAP_LC3_BROADCAST_PRESET_48_4_1(LOCATION, CONTEXT)},
150 {"48_5_1", BT_BAP_LC3_BROADCAST_PRESET_48_5_1(LOCATION, CONTEXT)},
151 {"48_6_1", BT_BAP_LC3_BROADCAST_PRESET_48_6_1(LOCATION, CONTEXT)},
152 /* High-reliability presets */
153 {"8_1_2", BT_BAP_LC3_BROADCAST_PRESET_8_1_2(LOCATION, CONTEXT)},
154 {"8_2_2", BT_BAP_LC3_BROADCAST_PRESET_8_2_2(LOCATION, CONTEXT)},
155 {"16_1_2", BT_BAP_LC3_BROADCAST_PRESET_16_1_2(LOCATION, CONTEXT)},
156 {"16_2_2", BT_BAP_LC3_BROADCAST_PRESET_16_2_2(LOCATION, CONTEXT)},
157 {"24_1_2", BT_BAP_LC3_BROADCAST_PRESET_24_1_2(LOCATION, CONTEXT)},
158 {"24_2_2", BT_BAP_LC3_BROADCAST_PRESET_24_2_2(LOCATION, CONTEXT)},
159 {"32_1_2", BT_BAP_LC3_BROADCAST_PRESET_32_1_2(LOCATION, CONTEXT)},
160 {"32_2_2", BT_BAP_LC3_BROADCAST_PRESET_32_2_2(LOCATION, CONTEXT)},
161 {"441_1_2", BT_BAP_LC3_BROADCAST_PRESET_441_1_2(LOCATION, CONTEXT)},
162 {"441_2_2", BT_BAP_LC3_BROADCAST_PRESET_441_2_2(LOCATION, CONTEXT)},
163 {"48_1_2", BT_BAP_LC3_BROADCAST_PRESET_48_1_2(LOCATION, CONTEXT)},
164 {"48_2_2", BT_BAP_LC3_BROADCAST_PRESET_48_2_2(LOCATION, CONTEXT)},
165 {"48_3_2", BT_BAP_LC3_BROADCAST_PRESET_48_3_2(LOCATION, CONTEXT)},
166 {"48_4_2", BT_BAP_LC3_BROADCAST_PRESET_48_4_2(LOCATION, CONTEXT)},
167 {"48_5_2", BT_BAP_LC3_BROADCAST_PRESET_48_5_2(LOCATION, CONTEXT)},
168 {"48_6_2", BT_BAP_LC3_BROADCAST_PRESET_48_6_2(LOCATION, CONTEXT)},
185 return &sh_stream->stream.bap_stream; in bap_stream_from_shell_stream()
220 const bool has_left = (sh_stream->lc3_chan_allocation & BT_AUDIO_LOCATION_FRONT_LEFT) != 0; in get_lc3_chan_alloc_from_index()
222 (sh_stream->lc3_chan_allocation & BT_AUDIO_LOCATION_FRONT_RIGHT) != 0; in get_lc3_chan_alloc_from_index()
223 const bool is_mono = sh_stream->lc3_chan_allocation == BT_AUDIO_LOCATION_MONO_AUDIO; in get_lc3_chan_alloc_from_index()
238 return -EINVAL; in get_lc3_chan_alloc_from_index()
256 const uint32_t interval_us = bap_stream->qos->interval; in get_next_seq_num()
262 if (!sh_stream->is_tx) { in get_next_seq_num()
266 /* Note: This does not handle wrapping of ticks when they go above 2^(62-1) */ in get_next_seq_num()
268 delta_ticks = uptime_ticks - sh_stream->tx.connected_at_ticks; in get_next_seq_num()
279 /* For the first call-back we push multiple audio frames to the buffer to use the
289 #define AUDIO_VOLUME (INT16_MAX - 3000) /* codec does clipping above INT16_MAX - 3000 */
298 return -EINVAL; in init_lc3_encoder()
301 if (!sh_stream->is_tx) { in init_lc3_encoder()
303 return -EINVAL; in init_lc3_encoder()
306 if (sh_stream->tx.lc3_encoder != NULL) { in init_lc3_encoder()
308 return -EALREADY; in init_lc3_encoder()
311 if (sh_stream->lc3_freq_hz == 0 || sh_stream->lc3_frame_duration_us == 0) { in init_lc3_encoder()
313 sh_stream->lc3_freq_hz, sh_stream->lc3_frame_duration_us); in init_lc3_encoder()
315 return -EINVAL; in init_lc3_encoder()
325 return -EINVAL; in init_lc3_encoder()
332 bap_stream_from_shell_stream(sh_stream), sh_stream->lc3_frame_duration_us, in init_lc3_encoder()
333 sh_stream->lc3_freq_hz); in init_lc3_encoder()
335 sh_stream->tx.lc3_encoder = in init_lc3_encoder()
336 lc3_setup_encoder(sh_stream->lc3_frame_duration_us, sh_stream->lc3_freq_hz, in init_lc3_encoder()
338 &sh_stream->tx.lc3_encoder_mem); in init_lc3_encoder()
339 if (sh_stream->tx.lc3_encoder == NULL) { in init_lc3_encoder()
340 shell_error(ctx_shell, "Failed to setup LC3 encoder - wrong parameters?\n"); in init_lc3_encoder()
341 return -EINVAL; in init_lc3_encoder()
348 * Use the math lib to generate a sine-wave using 16 bit samples into a buffer.
353 * @param sample_rate_hz sample-rate in Hz.
371 const size_t total_frames = sh_stream->lc3_chan_cnt * sh_stream->lc3_frame_blocks_per_sdu; in encode_frame()
372 const uint16_t octets_per_frame = sh_stream->lc3_octets_per_frame; in encode_frame()
389 fill_lc3_tx_buf_sin(lc3_tx_buf, sh_stream->lc3_frame_duration_us, in encode_frame()
390 AUDIO_TONE_FREQUENCY_HZ, sh_stream->lc3_freq_hz); in encode_frame()
393 if ((sh_stream->tx.encoded_cnt % bap_stats_interval) == 0) { in encode_frame()
395 sh_stream->tx.encoded_cnt, octets_per_frame, frame_cnt + 1, in encode_frame()
399 lc3_ret = lc3_encode(sh_stream->tx.lc3_encoder, LC3_PCM_FORMAT_S16, lc3_tx_buf, 1, in encode_frame()
401 if (lc3_ret == -1) { in encode_frame()
402 shell_error(ctx_shell, "LC3 encoder failed - wrong parameters?: %d", lc3_ret); in encode_frame()
407 out_buf->len += octets_per_frame; in encode_frame()
415 const uint8_t chan_cnt = sh_stream->lc3_chan_cnt; in encode_frame_block()
433 /* No op - Will just send empty SDU */ in do_lc3_encode()
437 for (uint8_t i = 0U; i < sh_stream->lc3_frame_blocks_per_sdu; i++) { in do_lc3_encode()
440 sh_stream->tx.encoded_cnt++; in do_lc3_encode()
448 const uint16_t tx_sdu_len = sh_stream->lc3_frame_blocks_per_sdu * sh_stream->lc3_chan_cnt * in lc3_audio_send_data()
449 sh_stream->lc3_octets_per_frame; in lc3_audio_send_data()
453 if (!sh_stream->is_tx || !sh_stream->tx.active) { in lc3_audio_send_data()
458 if (sh_stream->tx.lc3_encoder == NULL) { in lc3_audio_send_data()
463 if (bap_stream == NULL || bap_stream->qos == NULL) { in lc3_audio_send_data()
472 tx_sdu_len, sh_stream->lc3_frame_blocks_per_sdu, in lc3_audio_send_data()
473 sh_stream->lc3_chan_cnt, sh_stream->lc3_octets_per_frame, in lc3_audio_send_data()
478 if (atomic_get(&sh_stream->tx.lc3_enqueue_cnt) == 0U) { in lc3_audio_send_data()
488 err = bt_bap_stream_send(bap_stream, buf, sh_stream->tx.seq_num); in lc3_audio_send_data()
496 if ((sh_stream->tx.lc3_sdu_cnt % bap_stats_interval) == 0U) { in lc3_audio_send_data()
498 sh_stream->tx.lc3_sdu_cnt, bap_stream, tx_sdu_len, in lc3_audio_send_data()
499 sh_stream->tx.seq_num); in lc3_audio_send_data()
502 sh_stream->tx.lc3_sdu_cnt++; in lc3_audio_send_data()
503 sh_stream->tx.seq_num++; in lc3_audio_send_data()
504 atomic_dec(&sh_stream->tx.lc3_enqueue_cnt); in lc3_audio_send_data()
511 if (!sh_stream->is_tx) { in lc3_sent_cb()
515 atomic_inc(&sh_stream->tx.lc3_enqueue_cnt); in lc3_sent_cb()
520 if (sh_stream->is_tx) { in encode_and_send_cb()
605 return -ENOEXEC; in cmd_select_unicast()
611 return -ENOEXEC; in cmd_select_unicast()
630 if (!stream->conn) { in stream_alloc()
652 return -ENOMEM; in lc3_config()
712 if (!BT_AUDIO_METADATA_TYPE_IS_KNOWN(data->type)) { in meta_data_func_cb()
713 printk("Invalid metadata type %u or length %u\n", data->type, data->data_len); in meta_data_func_cb()
714 *rsp = BT_BAP_ASCS_RSP(BT_BAP_ASCS_RSP_CODE_METADATA_REJECTED, data->type); in meta_data_func_cb()
805 return -ENOEXEC; in set_metadata()
809 sys_put_le16(context, codec_cfg->meta); in set_metadata()
832 snk_qos[i] = &snk_uni_streams[i]->qos; in bap_ac_create_unicast_group()
836 src_qos[i] = &src_uni_streams[i]->qos; in bap_ac_create_unicast_group()
855 for (size_t i = 0U; i < param->conn_cnt; i++) { in bap_ac_create_unicast_group()
856 for (size_t j = 0; j < MAX(param->snk_cnt[i], param->src_cnt[i]); j++) { in bap_ac_create_unicast_group()
857 if (param->snk_cnt[i] > j) { in bap_ac_create_unicast_group()
864 if (param->src_cnt[i] > j) { in bap_ac_create_unicast_group()
884 if (stream->conn) { in stream_dir()
885 uint8_t conn_index = bt_conn_index(stream->conn); in stream_dir()
891 if (snk_ep != NULL && stream->ep == snk_ep) { in stream_dir()
901 if (src_ep != NULL && stream->ep == src_ep) { in stream_dir()
1073 .location = unicast_client_location_cb,
1096 return -ENOEXEC; in cmd_discover()
1101 return -ENOEXEC; in cmd_discover()
1126 return -ENOEXEC; in cmd_discover()
1132 return -ENOEXEC; in cmd_discover()
1149 enum bt_audio_location location = BT_AUDIO_LOCATION_MONO_AUDIO; in cmd_config() local
1161 return -ENOEXEC; in cmd_config()
1175 return -ENOEXEC; in cmd_config()
1181 return -ENOEXEC; in cmd_config()
1203 return -ENOEXEC; in cmd_config()
1208 return -ENOEXEC; in cmd_config()
1229 return -ENOEXEC; in cmd_config()
1235 return -ENOEXEC; in cmd_config()
1238 location = (enum bt_audio_location)loc_bits; in cmd_config()
1246 return -ENOEXEC; in cmd_config()
1263 /* If location has been modified, we update the location in the codec configuration */ in cmd_config()
1264 struct bt_audio_codec_cfg *codec_cfg = &uni_stream->codec_cfg; in cmd_config()
1266 for (size_t i = 0U; i < codec_cfg->data_len;) { in cmd_config()
1267 const uint8_t len = codec_cfg->data[i++]; in cmd_config()
1272 if (len == 0 || len > codec_cfg->data_len - i) { in cmd_config()
1277 type = codec_cfg->data[i++]; in cmd_config()
1278 value = &codec_cfg->data[i]; in cmd_config()
1281 const uint32_t loc_32 = location; in cmd_config()
1285 shell_print(sh, "Setting location to 0x%08X", location); in cmd_config()
1289 data_len = len - sizeof(type); in cmd_config()
1297 if (bap_stream->ep == ep) { in cmd_config()
1298 err = bt_bap_stream_reconfig(bap_stream, &uni_stream->codec_cfg); in cmd_config()
1301 return -ENOEXEC; in cmd_config()
1305 &uni_stream->codec_cfg); in cmd_config()
1312 shell_print(sh, "ASE config: preset %s", named_preset->name); in cmd_config()
1325 return -ENOEXEC; in cmd_stream_qos()
1328 qos = default_stream->qos; in cmd_stream_qos()
1332 return -ENOEXEC; in cmd_stream_qos()
1337 return -ENOEXEC; in cmd_stream_qos()
1341 return -ENOEXEC; in cmd_stream_qos()
1344 qos->interval = interval; in cmd_stream_qos()
1351 return -ENOEXEC; in cmd_stream_qos()
1355 return -ENOEXEC; in cmd_stream_qos()
1358 qos->framing = framing; in cmd_stream_qos()
1366 return -ENOEXEC; in cmd_stream_qos()
1370 return -ENOEXEC; in cmd_stream_qos()
1373 qos->latency = latency; in cmd_stream_qos()
1381 return -ENOEXEC; in cmd_stream_qos()
1385 return -ENOEXEC; in cmd_stream_qos()
1388 qos->pd = pd; in cmd_stream_qos()
1396 return -ENOEXEC; in cmd_stream_qos()
1400 return -ENOEXEC; in cmd_stream_qos()
1403 qos->sdu = sdu; in cmd_stream_qos()
1411 return -ENOEXEC; in cmd_stream_qos()
1416 return -ENOEXEC; in cmd_stream_qos()
1419 qos->phy = phy; in cmd_stream_qos()
1427 return -ENOEXEC; in cmd_stream_qos()
1431 return -ENOEXEC; in cmd_stream_qos()
1434 qos->rtn = rtn; in cmd_stream_qos()
1453 if (stream->ep != NULL) { in set_group_param()
1458 stream_param->stream = stream; in set_group_param()
1460 stream_param->qos = &uni_stream->qos; in set_group_param()
1463 stream_param->qos = &uni_stream->qos; in set_group_param()
1474 return -ENOEXEC; in set_group_param()
1477 group_param->packing = BT_ISO_PACKING_SEQUENTIAL; in set_group_param()
1478 group_param->params = pair_param; in set_group_param()
1479 group_param->params_count = MAX(source_cnt, sink_cnt); in set_group_param()
1500 return -ENOEXEC; in create_unicast_group()
1522 return -ENOEXEC; in reconfig_unicast_group()
1534 return -ENOEXEC; in cmd_qos()
1539 return -ENOEXEC; in cmd_qos()
1557 return -ENOEXEC; in cmd_qos()
1570 return -ENOEXEC; in cmd_enable()
1573 codec_cfg = default_stream->codec_cfg; in cmd_enable()
1583 err = bt_bap_stream_enable(default_stream, codec_cfg->meta, codec_cfg->meta_len); in cmd_enable()
1586 return -ENOEXEC; in cmd_enable()
1598 return -ENOEXEC; in cmd_stop()
1604 return -ENOEXEC; in cmd_stop()
1616 return -ENOEXEC; in cmd_connect()
1622 return -ENOEXEC; in cmd_connect()
1636 return -ENOEXEC; in cmd_metadata()
1639 codec_cfg = default_stream->codec_cfg; in cmd_metadata()
1649 err = bt_bap_stream_metadata(default_stream, codec_cfg->meta, codec_cfg->meta_len); in cmd_metadata()
1652 return -ENOEXEC; in cmd_metadata()
1664 return -ENOEXEC; in cmd_start()
1670 return -ENOEXEC; in cmd_start()
1682 return -ENOEXEC; in cmd_disable()
1688 return -ENOEXEC; in cmd_disable()
1747 if (stream != NULL && stream->conn != NULL) { in cmd_list()
1750 stream_dir(stream), stream->group); in cmd_list()
1766 return -ENOEXEC; in cmd_release()
1772 return -ENOEXEC; in cmd_release()
1792 return -1; in parse_config_data_args()
1801 return -1; in parse_config_data_args()
1807 return -1; in parse_config_data_args()
1815 return -1; in parse_config_data_args()
1821 return -1; in parse_config_data_args()
1830 return -1; in parse_config_data_args()
1836 return -1; in parse_config_data_args()
1844 return -1; in parse_config_data_args()
1850 return -1; in parse_config_data_args()
1859 return -1; in parse_config_data_args()
1865 return -1; in parse_config_data_args()
1874 return -1; in parse_config_data_args()
1880 return -1; in parse_config_data_args()
1889 return -1; in parse_config_data_args()
1895 return -1; in parse_config_data_args()
1903 return -1; in parse_config_data_args()
1909 return -1; in parse_config_data_args()
1918 return -1; in parse_config_data_args()
1924 return -1; in parse_config_data_args()
1932 return -1; in parse_config_data_args()
1936 argn--; in parse_config_data_args()
1956 return -1; in parse_config_meta_args()
1965 return -1; in parse_config_meta_args()
1971 return -1; in parse_config_meta_args()
1980 return -1; in parse_config_meta_args()
1986 return -1; in parse_config_meta_args()
1995 return -1; in parse_config_meta_args()
2001 return -1; in parse_config_meta_args()
2010 return -1; in parse_config_meta_args()
2016 return -1; in parse_config_meta_args()
2026 return -1; in parse_config_meta_args()
2032 return -1; in parse_config_meta_args()
2040 return -1; in parse_config_meta_args()
2047 return -1; in parse_config_meta_args()
2056 return -1; in parse_config_meta_args()
2065 return -1; in parse_config_meta_args()
2074 return -1; in parse_config_meta_args()
2080 return -1; in parse_config_meta_args()
2090 return -1; in parse_config_meta_args()
2096 return -1; in parse_config_meta_args()
2105 return -1; in parse_config_meta_args()
2111 return -1; in parse_config_meta_args()
2122 return -1; in parse_config_meta_args()
2128 return -1; in parse_config_meta_args()
2138 return -1; in parse_config_meta_args()
2144 return -1; in parse_config_meta_args()
2154 return -1; in parse_config_meta_args()
2162 return -1; in parse_config_meta_args()
2171 return -1; in parse_config_meta_args()
2180 return -1; in parse_config_meta_args()
2189 return -1; in parse_config_meta_args()
2198 return -1; in parse_config_meta_args()
2207 return -1; in parse_config_meta_args()
2215 return -1; in parse_config_meta_args()
2219 argn--; in parse_config_meta_args()
2246 return -ENOEXEC; in cmd_preset()
2255 return -ENOEXEC; in cmd_preset()
2273 return -ENOEXEC; in cmd_preset()
2302 return -ENOEXEC; in cmd_preset()
2324 return -ENOEXEC; in cmd_preset()
2332 return -ENOEXEC; in cmd_preset()
2338 shell_print(sh, "%s", named_preset->name); in cmd_preset()
2340 print_codec_cfg(ctx_shell, 0, &named_preset->preset.codec_cfg); in cmd_preset()
2341 print_qos(ctx_shell, &named_preset->preset.qos); in cmd_preset()
2393 switch (data->type) { in scan_check_and_sync_broadcast()
2395 if (data->data_len < BT_UUID_SIZE_16 + BT_AUDIO_BROADCAST_ID_SIZE) { in scan_check_and_sync_broadcast()
2399 if (!bt_uuid_create(&adv_uuid.uuid, data->data, BT_UUID_SIZE_16)) { in scan_check_and_sync_broadcast()
2407 sr_info->broadcast_id = sys_get_le24(data->data + BT_UUID_SIZE_16); in scan_check_and_sync_broadcast()
2410 if (!IN_RANGE(data->data_len, BT_AUDIO_BROADCAST_NAME_LEN_MIN, in scan_check_and_sync_broadcast()
2415 memcpy(sr_info->broadcast_name, data->data, data->data_len); in scan_check_and_sync_broadcast()
2416 sr_info->broadcast_name[data->data_len] = '\0'; in scan_check_and_sync_broadcast()
2448 bt_addr_le_to_str(info->addr, addr_str, sizeof(addr_str)); in broadcast_scan_recv()
2462 (auto_scan.broadcast_sink->pa_sync == NULL)) { in broadcast_scan_recv()
2468 sr_info.broadcast_id, addr_str, info->sid); in broadcast_scan_recv()
2475 bt_addr_le_copy(&create_params.addr, info->addr); in broadcast_scan_recv()
2477 create_params.sid = info->sid; in broadcast_scan_recv()
2479 create_params.timeout = interval_to_sync_timeout(info->interval); in broadcast_scan_recv()
2486 auto_scan.broadcast_sink->pa_sync = *auto_scan.out_sync; in broadcast_scan_recv()
2513 biginfo->encryption ? "with" : "without"); in syncable()
2526 if (auto_scan.broadcast_sink->bap_sink == NULL) { in bap_pa_sync_synced_cb()
2532 &auto_scan.broadcast_sink->bap_sink); in bap_pa_sync_synced_cb()
2613 return -EINVAL; in init_lc3_decoder()
2616 if (!sh_stream->is_rx) { in init_lc3_decoder()
2618 return -EINVAL; in init_lc3_decoder()
2621 if (sh_stream->rx.lc3_decoder != NULL) { in init_lc3_decoder()
2623 return -EALREADY; in init_lc3_decoder()
2626 if (sh_stream->lc3_freq_hz == 0 || sh_stream->lc3_frame_duration_us == 0) { in init_lc3_decoder()
2628 sh_stream->lc3_freq_hz, sh_stream->lc3_frame_duration_us); in init_lc3_decoder()
2630 return -EINVAL; in init_lc3_decoder()
2635 sh_stream->lc3_frame_duration_us, sh_stream->lc3_freq_hz); in init_lc3_decoder()
2637 sh_stream->rx.lc3_decoder = in init_lc3_decoder()
2638 lc3_setup_decoder(sh_stream->lc3_frame_duration_us, sh_stream->lc3_freq_hz, in init_lc3_decoder()
2640 &sh_stream->rx.lc3_decoder_mem); in init_lc3_decoder()
2641 if (sh_stream->rx.lc3_decoder == NULL) { in init_lc3_decoder()
2642 shell_error(ctx_shell, "Failed to setup LC3 decoder - wrong parameters?\n"); in init_lc3_decoder()
2643 return -EINVAL; in init_lc3_decoder()
2651 const struct shell_stream *sh_stream = data->sh_stream; in decode_frame()
2652 const size_t total_frames = sh_stream->lc3_chan_cnt * sh_stream->lc3_frame_blocks_per_sdu; in decode_frame()
2653 const uint16_t octets_per_frame = sh_stream->lc3_octets_per_frame; in decode_frame()
2654 struct net_buf *buf = data->buf; in decode_frame()
2658 if (data->do_plc) { in decode_frame()
2661 if ((sh_stream->rx.decoded_cnt % bap_stats_interval) == 0) { in decode_frame()
2662 shell_print(ctx_shell, "[%zu]: Performing PLC", sh_stream->rx.decoded_cnt); in decode_frame()
2665 data->do_plc = false; /* clear flag */ in decode_frame()
2667 iso_data = net_buf_pull_mem(data->buf, octets_per_frame); in decode_frame()
2669 if ((sh_stream->rx.decoded_cnt % bap_stats_interval) == 0) { in decode_frame()
2671 sh_stream->rx.decoded_cnt, octets_per_frame, frame_cnt + 1, in decode_frame()
2676 err = lc3_decode(sh_stream->rx.lc3_decoder, iso_data, octets_per_frame, LC3_PCM_FORMAT_S16, in decode_frame()
2679 shell_error(ctx_shell, "Failed to decode LC3 data (%u/%u - %u/%u)", frame_cnt + 1, in decode_frame()
2680 total_frames, octets_per_frame * frame_cnt, buf->len); in decode_frame()
2689 const struct shell_stream *sh_stream = data->sh_stream; in decode_frame_block()
2690 const uint8_t chan_cnt = sh_stream->lc3_chan_cnt; in decode_frame_block()
2719 sizeof(lc3_rx_buf), data->ts); in decode_frame_block()
2720 if (err == -EINVAL) { in decode_frame_block()
2741 struct shell_stream *sh_stream = data->sh_stream; in do_lc3_decode()
2743 if (sh_stream->is_rx && sh_stream->rx.lc3_decoder != NULL) { in do_lc3_decode()
2744 const uint8_t frame_blocks_per_sdu = sh_stream->lc3_frame_blocks_per_sdu; in do_lc3_decode()
2758 sh_stream->rx.decoded_cnt++; in do_lc3_decode()
2761 net_buf_unref(data->buf); in do_lc3_decode()
2768 struct shell_stream *sh_stream = data->sh_stream; in lc3_decoder_thread_func()
2770 if (sh_stream->is_rx && sh_stream->rx.lc3_decoder == NULL) { in lc3_decoder_thread_func()
2790 if (!sh_stream->is_rx) { in audio_recv()
2794 sh_stream->rx.rx_cnt++; in audio_recv()
2796 if (info->ts == sh_stream->rx.last_info.ts) { in audio_recv()
2797 sh_stream->rx.dup_ts++; in audio_recv()
2800 if (info->seq_num == sh_stream->rx.last_info.seq_num) { in audio_recv()
2801 sh_stream->rx.dup_psn++; in audio_recv()
2804 if ((info->flags & BT_ISO_FLAGS_VALID) != 0) { in audio_recv()
2805 if (buf->len == 0U) { in audio_recv()
2806 sh_stream->rx.empty_sdu_pkts++; in audio_recv()
2808 sh_stream->rx.valid_sdu_pkts++; in audio_recv()
2812 if (info->flags & BT_ISO_FLAGS_ERROR) { in audio_recv()
2813 sh_stream->rx.err_pkts++; in audio_recv()
2816 if (info->flags & BT_ISO_FLAGS_LOST) { in audio_recv()
2817 sh_stream->rx.lost_pkts++; in audio_recv()
2820 if ((sh_stream->rx.rx_cnt % bap_stats_interval) == 0) { in audio_recv()
2825 sh_stream->rx.rx_cnt, stream, buf->len, info->ts, info->seq_num, in audio_recv()
2826 info->flags, sh_stream->rx.valid_sdu_pkts, sh_stream->rx.dup_ts, in audio_recv()
2827 sh_stream->rx.dup_psn, sh_stream->rx.err_pkts, sh_stream->rx.lost_pkts, in audio_recv()
2828 sh_stream->rx.empty_sdu_pkts); in audio_recv()
2831 (void)memcpy(&sh_stream->rx.last_info, info, sizeof(sh_stream->rx.last_info)); in audio_recv()
2834 if (sh_stream->rx.lc3_decoder != NULL) { in audio_recv()
2835 const uint8_t frame_blocks_per_sdu = sh_stream->lc3_frame_blocks_per_sdu; in audio_recv()
2836 const uint16_t octets_per_frame = sh_stream->lc3_octets_per_frame; in audio_recv()
2837 const uint8_t chan_cnt = sh_stream->lc3_chan_cnt; in audio_recv()
2850 if ((info->flags & BT_ISO_FLAGS_VALID) == 0) { in audio_recv()
2851 data->do_plc = true; in audio_recv()
2852 } else if (buf->len != (octets_per_frame * chan_cnt * frame_blocks_per_sdu)) { in audio_recv()
2853 if (buf->len != 0U) { in audio_recv()
2858 frame_blocks_per_sdu, chan_cnt, octets_per_frame, buf->len); in audio_recv()
2861 data->do_plc = true; in audio_recv()
2864 data->buf = net_buf_ref(buf); in audio_recv()
2865 data->sh_stream = sh_stream; in audio_recv()
2866 if (info->flags & BT_ISO_FLAGS_TS) { in audio_recv()
2867 data->ts = info->ts; in audio_recv()
2869 data->ts = 0U; in audio_recv()
2888 err = bt_conn_get_info(stream->conn, &conn_info); in stream_enabled_cb()
2898 err = bt_bap_ep_get_info(stream->ep, &ep_info); in stream_enabled_cb()
2925 ret = bt_bap_ep_get_info(bap_stream->ep, &info); in stream_started_cb()
2931 sh_stream->is_rx = info.can_recv; in stream_started_cb()
2932 sh_stream->is_tx = info.can_send; in stream_started_cb()
2935 const struct bt_audio_codec_cfg *codec_cfg = bap_stream->codec_cfg; in stream_started_cb()
2937 if (codec_cfg->id == BT_HCI_CODING_FORMAT_LC3) { in stream_started_cb()
2938 if (sh_stream->is_tx) { in stream_started_cb()
2939 atomic_set(&sh_stream->tx.lc3_enqueue_cnt, PRIME_COUNT); in stream_started_cb()
2940 sh_stream->tx.lc3_sdu_cnt = 0U; in stream_started_cb()
2950 sh_stream->lc3_freq_hz = (uint32_t)ret; in stream_started_cb()
2954 sh_stream->lc3_freq_hz = 0U; in stream_started_cb()
2958 sh_stream->lc3_freq_hz = 0U; in stream_started_cb()
2962 sh_stream->lc3_freq_hz = 0U; in stream_started_cb()
2969 sh_stream->lc3_frame_duration_us = (uint32_t)ret; in stream_started_cb()
2972 sh_stream->lc3_frame_duration_us = 0U; in stream_started_cb()
2976 sh_stream->lc3_frame_duration_us = 0U; in stream_started_cb()
2980 codec_cfg, &sh_stream->lc3_chan_allocation, false); in stream_started_cb()
2982 sh_stream->lc3_chan_cnt = in stream_started_cb()
2983 bt_audio_get_chan_count(sh_stream->lc3_chan_allocation); in stream_started_cb()
2986 sh_stream->lc3_chan_allocation = BT_AUDIO_LOCATION_MONO_AUDIO; in stream_started_cb()
2987 sh_stream->lc3_chan_cnt = 1U; in stream_started_cb()
2992 sh_stream->lc3_frame_blocks_per_sdu = (uint8_t)ret; in stream_started_cb()
2995 sh_stream->lc3_frame_blocks_per_sdu = 0U; in stream_started_cb()
3000 sh_stream->lc3_octets_per_frame = (uint16_t)ret; in stream_started_cb()
3003 sh_stream->lc3_octets_per_frame = 0U; in stream_started_cb()
3007 if (sh_stream->is_tx && sh_stream->tx.lc3_encoder == NULL) { in stream_started_cb()
3018 sh_stream->tx.active = true; in stream_started_cb()
3024 if (sh_stream->is_rx) { in stream_started_cb()
3025 if (sh_stream->rx.lc3_decoder == NULL) { in stream_started_cb()
3036 sh_stream->rx.decoded_cnt = 0U; in stream_started_cb()
3039 if ((sh_stream->lc3_chan_allocation & in stream_started_cb()
3052 if ((sh_stream->lc3_chan_allocation & in stream_started_cb()
3071 if (sh_stream->is_tx) { in stream_started_cb()
3072 sh_stream->tx.connected_at_ticks = k_uptime_ticks(); in stream_started_cb()
3077 if (sh_stream->is_rx) { in stream_started_cb()
3078 sh_stream->rx.empty_sdu_pkts = 0U; in stream_started_cb()
3079 sh_stream->rx.valid_sdu_pkts = 0U; in stream_started_cb()
3080 sh_stream->rx.lost_pkts = 0U; in stream_started_cb()
3081 sh_stream->rx.err_pkts = 0U; in stream_started_cb()
3082 sh_stream->rx.dup_psn = 0U; in stream_started_cb()
3083 sh_stream->rx.rx_cnt = 0U; in stream_started_cb()
3084 sh_stream->rx.dup_ts = 0U; in stream_started_cb()
3094 if (sh_stream->is_rx) { in update_usb_streams_cb()
3096 (sh_stream->lc3_chan_allocation & BT_AUDIO_LOCATION_FRONT_LEFT) != 0) { in update_usb_streams_cb()
3102 (sh_stream->lc3_chan_allocation & BT_AUDIO_LOCATION_FRONT_RIGHT) != 0) { in update_usb_streams_cb()
3111 if (sh_stream->is_rx) { in update_usb_streams()
3132 default_broadcast_sink.stream_cnt--; in clear_stream_data()
3146 if (sh_stream->is_rx) { in clear_stream_data()
3147 rx_streaming_cnt--; in clear_stream_data()
3148 memset(&sh_stream->rx, 0, sizeof(sh_stream->rx)); in clear_stream_data()
3153 if (sh_stream->is_tx) { in clear_stream_data()
3154 memset(&sh_stream->tx, 0, sizeof(sh_stream->tx)); in clear_stream_data()
3158 sh_stream->is_rx = sh_stream->is_tx = false; in clear_stream_data()
3197 if (bap_stream->ep != NULL) { in stream_released_cb()
3201 err = bt_bap_ep_get_info(bap_stream->ep, &ep_info); in stream_released_cb()
3257 return -ENOEXEC; in cmd_select_broadcast_source()
3263 return -ENOEXEC; in cmd_select_broadcast_source()
3283 return -ENOEXEC; in cmd_create_broadcast()
3306 return -ENOEXEC; in cmd_create_broadcast()
3327 return -ENOEXEC; in cmd_create_broadcast()
3358 named_preset->name); in cmd_create_broadcast()
3375 return -ENOEXEC; in cmd_start_broadcast()
3380 return -ENOEXEC; in cmd_start_broadcast()
3398 return -ENOEXEC; in cmd_stop_broadcast()
3417 return -ENOEXEC; in cmd_delete_broadcast()
3442 return -ENOEXEC; in cmd_create_broadcast_sink()
3448 return -ENOEXEC; in cmd_create_broadcast_sink()
3457 .timeout = 1000, /* 10ms units -> 10 second timeout */ in cmd_create_broadcast_sink()
3466 return -ENOEXEC; in cmd_create_broadcast_sink()
3482 return -ENOEXEC; in cmd_create_broadcast_sink()
3496 .timeout = 1000, /* 10ms units -> 10 second timeout */ in cmd_create_sink_by_name()
3507 return -ENOEXEC; in cmd_create_sink_by_name()
3516 return -ENOEXEC; in cmd_create_sink_by_name()
3558 return -ENOEXEC; in cmd_sync_broadcast()
3574 return -ENOEXEC; in cmd_sync_broadcast()
3586 return -ENOEXEC; in cmd_sync_broadcast()
3592 return -ENOEXEC; in cmd_sync_broadcast()
3602 return -ENOEXEC; in cmd_sync_broadcast()
3629 return -ENOEXEC; in cmd_stop_broadcast_sink()
3648 return -ENOEXEC; in cmd_term_broadcast_sink()
3677 return -ENOEXEC; in cmd_set_loc()
3684 return -ENOEXEC; in cmd_set_loc()
3688 shell_error(sh, "Invalid location: %lu", loc_val); in cmd_set_loc()
3690 return -ENOEXEC; in cmd_set_loc()
3698 return -ENOEXEC; in cmd_set_loc()
3717 return -ENOEXEC; in cmd_context()
3730 return -ENOEXEC; in cmd_context()
3739 return -ENOEXEC; in cmd_context()
3755 return -ENOEXEC; in cmd_context()
3769 return -ENOEXEC; in cmd_init()
3793 return -ENOEXEC; in cmd_init()
3803 return -ENOEXEC; in cmd_init()
3824 err = bt_pacs_set_location(BT_AUDIO_DIR_SINK, LOCATION); in cmd_init()
3825 __ASSERT(err == 0, "Failed to set sink location: %d", err); in cmd_init()
3839 err = bt_pacs_set_location(BT_AUDIO_DIR_SOURCE, LOCATION); in cmd_init()
3840 __ASSERT(err == 0, "Failed to set source location: %d", err); in cmd_init()
3931 static uint8_t data[DATA_MTU - BT_ISO_CHAN_SEND_RESERVE]; in cmd_send()
3938 return -ENOEXEC; in cmd_send()
3941 if (default_stream->qos == NULL) { in cmd_send()
3944 return -ENOEXEC; in cmd_send()
3949 if (len > default_stream->qos->sdu) { in cmd_send()
3951 len, default_stream->qos->sdu); in cmd_send()
3953 return -ENOEXEC; in cmd_send()
3956 len = MIN(default_stream->qos->sdu, sizeof(data)); in cmd_send()
3967 shell_print(sh, "Unable to send: %d", -ret); in cmd_send()
3970 return -ENOEXEC; in cmd_send()
3982 if (sh_stream->is_tx) { in start_sine_stream_cb()
3994 sh_stream->tx.active = true; in start_sine_stream_cb()
3995 sh_stream->tx.seq_num = get_next_seq_num(bap_stream_from_shell_stream(sh_stream)); in start_sine_stream_cb()
4028 if (sh_stream->is_tx) { in stop_sine_stream_cb()
4034 sh_stream->tx.active = false; in stop_sine_stream_cb()
4077 return -ENOEXEC; in cmd_bap_stats()
4083 return -ENOEXEC; in cmd_bap_stats()
4108 return -ENOEXEC; in cmd_print_ase_info()
4117 /* 31 is a unit separator - without t the tab is seemingly ignored*/
4122 "[chan_alloc <location>]" HELP_SEP "[frame_len <frame length>]" HELP_SEP \
4127 "[program_info <program info>]" HELP_SEP "[lang <ISO 639-3 lang>]" HELP_SEP \
4199 "<direction: sink, source> <location bitmask>", cmd_set_loc, 3, 0),
4215 return -ENOEXEC; in cmd_bap()
4260 data_array_size - ad_len); in connectable_ad_data_add()
4264 ad_len += cap_acceptor_ad_data_add(&data_array[ad_len], data_array_size - ad_len, in connectable_ad_data_add()
4269 ad_len += gmap_ad_data_add(&data_array[ad_len], data_array_size - ad_len); in connectable_ad_data_add()
4288 uuid16_size = ARRAY_SIZE(ad_ext_uuid16) - BT_UUID_SIZE_16; in connectable_ad_data_add()
4293 /* We can maximum advertise 127 16-bit UUIDs = 254 octets */ in connectable_ad_data_add()
4337 return -1; in nonconnectable_ad_data_add()
4405 return -1; in audio_pa_data_add()