Skip to content

Commit

Permalink
applications: nrf5340_audio: Upmerge fixes
Browse files Browse the repository at this point in the history
- Changed to using overlay files for each application
- Updated use of upstream API
- OCT-3172

Signed-off-by: Alexander Svensen <[email protected]>
  • Loading branch information
alexsven authored and anangl committed Jan 22, 2025
1 parent c52e0aa commit e64a8a2
Show file tree
Hide file tree
Showing 18 changed files with 234 additions and 334 deletions.
1 change: 1 addition & 0 deletions Kconfig.nrf
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ config NRF_SECURITY_ENABLER
imply NRF_SECURITY if BT_CRYPTO || BT_HOST_CRYPTO || BT_MESH_USES_MBEDTLS_PSA || BT_FAST_PAIR_CRYPTO_PSA
imply ENTROPY_GENERATOR if BOARD_NATIVE_SIM
imply PSA_WANT_GENERATE_RANDOM if BT_HOST_CRYPTO_PRNG
depends on !SOC_NRF5340_CPUNET

rsource "samples/Kconfig"
rsource "subsys/Kconfig"
Expand Down
18 changes: 0 additions & 18 deletions applications/nrf5340_audio/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,6 @@ config TRANSPORT_CIS
endchoice

#----------------------------------------------------------------------------#
if (TRANSPORT_BIS && AUDIO_DEV = 1)
rsource "broadcast_sink/Kconfig.defaults"
endif # TRANSPORT_BIS && AUDIO_DEV = 1

if (TRANSPORT_BIS && AUDIO_DEV = 2)
rsource "broadcast_source/Kconfig.defaults"
endif # TRANSPORT_BIS && AUDIO_DEV = 2

if (TRANSPORT_CIS && AUDIO_DEV = 1)
rsource "unicast_server/Kconfig.defaults"
endif # TRANSPORT_CIS && AUDIO_DEV = 1

if (TRANSPORT_CIS && AUDIO_DEV = 2)
rsource "unicast_client/Kconfig.defaults"
endif # TRANSPORT_CIS && AUDIO_DEV = 2



rsource "Kconfig.defaults"
rsource "src/audio/Kconfig"
rsource "src/bluetooth/Kconfig"
Expand Down
109 changes: 0 additions & 109 deletions applications/nrf5340_audio/broadcast_sink/Kconfig.defaults

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

CONFIG_TRANSPORT_BIS=y

## ACL related configs ##
CONFIG_BT_OBSERVER=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_SMP=y
CONFIG_BT_AUDIO=y
CONFIG_BT_GATT_DYNAMIC_DB=y
CONFIG_BT_GATT_CACHING=n

CONFIG_SETTINGS=y
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y

CONFIG_BT_BUF_ACL_TX_COUNT=18

CONFIG_BT_CAP_ACCEPTOR=y
CONFIG_BT_CSIP_SET_MEMBER=y
CONFIG_BT_CAP_ACCEPTOR_SET_MEMBER=y
CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS=y
CONFIG_BT_VCP_VOL_REND=y

CONFIG_BT_PERIPHERAL_PREF_MIN_INT=64
CONFIG_BT_PERIPHERAL_PREF_MAX_INT=69
CONFIG_BT_PERIPHERAL_PREF_LATENCY=0
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=200

# Generic Audio Sink - 0x0840
CONFIG_BT_DEVICE_APPEARANCE=2112
CONFIG_BT_PER_ADV_SYNC_MAX=2

## ISO related configs ##
CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT=2
CONFIG_BT_BAP_BROADCAST_SNK_COUNT=2
CONFIG_BT_ISO_MAX_CHAN=2
CONFIG_BT_ISO_MAX_BIG=2

CONFIG_BT_PER_ADV_SYNC_TRANSFER_RECEIVER=y

## PACS related configs ##
CONFIG_BT_PAC_SNK_NOTIFIABLE=y
CONFIG_BT_PAC_SNK=y
CONFIG_BT_PAC_SRC_NOTIFIABLE=y
CONFIG_BT_PAC_SRC=y

## Audio related configs ##
CONFIG_AUDIO_MUTE=n
CONFIG_AUDIO_TEST_TONE=n

CONFIG_BT_ISO_SYNC_RECEIVER=y
CONFIG_BT_BAP_SCAN_DELEGATOR=y
CONFIG_BT_BAP_BROADCAST_SINK=y

## LC3 related configs ##
CONFIG_LC3_DEC_CHAN_MAX=1



Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# Copyright (c) 2025 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

CONFIG_TRANSPORT_BIS=y

CONFIG_BT_CAP_INITIATOR=y
CONFIG_BT_AUDIO=y

CONFIG_BT_DEVICE_APPEARANCE=2181

CONFIG_BT_ISO_BROADCASTER=y

CONFIG_BT_BAP_BROADCAST_SOURCE=y

CONFIG_BT_ISO_TX_BUF_COUNT=2

CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT=2

CONFIG_BT_ISO_MAX_CHAN=2

CONFIG_BT_ISO_MAX_BIG=2

CONFIG_LC3_ENC_CHAN_MAX=2
CONFIG_ENTROPY_GENERATOR=y
1 change: 1 addition & 0 deletions applications/nrf5340_audio/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CONFIG_STACK_USAGE=y
CONFIG_THREAD_RUNTIME_STATS=y
CONFIG_STACK_SENTINEL=y
CONFIG_INIT_STACKS=y
CONFIG_BT=y

# Uart driver
CONFIG_SERIAL=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ void bt_mgmt_broadcast_code_ptr_get(uint8_t **broadcast_code_ptr)
void bt_mgmt_scan_delegator_init(void)
{
if (!scan_dlg_cb_registered) {
bt_bap_scan_delegator_register_cb(&scan_delegator_cbs);
bt_bap_scan_delegator_register(&scan_delegator_cbs);
scan_dlg_cb_registered = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ static struct bt_bap_lc3_preset lc3_preset = BT_BAP_LC3_BROADCAST_PRESET_NRF5340

static bool initialized;
static bool delete_broadcast_src[CONFIG_BT_ISO_MAX_BIG];
static uint32_t stored_broadcast_id;

static int metadata_u8_add(uint8_t buffer[], uint8_t *index, uint8_t type, uint8_t value)
{
Expand Down Expand Up @@ -263,14 +264,15 @@ int broadcast_source_ext_adv_populate(uint8_t big_index, bool fixed_id, uint32_t

if (!fixed_id) {
/* Use a random broadcast ID */
ret = bt_cap_initiator_broadcast_get_id(broadcast_sources[big_index],
&broadcast_id);
ret = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE);
if (ret) {
LOG_ERR("Unable to get broadcast ID: %d", ret);
LOG_WRN("Unable to generate broadcast ID: %d\n", ret);
return ret;
}
}

stored_broadcast_id = broadcast_id;

sys_put_le16(BT_UUID_BROADCAST_AUDIO_VAL, ext_adv_data->brdcst_id_buf);

sys_put_le24(broadcast_id, &ext_adv_data->brdcst_id_buf[BROADCAST_SOURCE_ADV_ID_START]);
Expand Down Expand Up @@ -596,8 +598,6 @@ static uint8_t audio_map_location_get(struct bt_bap_stream *bap_stream)

int broadcast_source_id_get(uint8_t big_index, uint32_t *broadcast_id)
{
int ret;

if (big_index >= CONFIG_BT_ISO_MAX_BIG) {
LOG_ERR("Failed to get broadcast ID for BIG %d out of %d", big_index,
CONFIG_BT_ISO_MAX_BIG);
Expand All @@ -614,11 +614,7 @@ int broadcast_source_id_get(uint8_t big_index, uint32_t *broadcast_id)
return -EINVAL;
}

ret = bt_cap_initiator_broadcast_get_id(broadcast_sources[big_index], broadcast_id);
if (ret) {
LOG_ERR("Unable to get broadcast ID: %d", ret);
return ret;
}
*broadcast_id = stored_broadcast_id;

return 0;
}
Expand Down
8 changes: 4 additions & 4 deletions applications/nrf5340_audio/src/bluetooth/bt_stream/le_audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
BT_AUDIO_CODEC_CFG_DURATION_10, _loc, \
LE_AUDIO_SDU_SIZE_OCTETS(_bitrate), 1, \
_stream_context), \
BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, LE_AUDIO_SDU_SIZE_OCTETS(_bitrate), \
CONFIG_BT_AUDIO_RETRANSMITS, \
CONFIG_BT_AUDIO_MAX_TRANSPORT_LATENCY_MS, \
CONFIG_BT_AUDIO_PRESENTATION_DELAY_US))
BT_BAP_QOS_CFG_UNFRAMED(10000u, LE_AUDIO_SDU_SIZE_OCTETS(_bitrate), \
CONFIG_BT_AUDIO_RETRANSMITS, \
CONFIG_BT_AUDIO_MAX_TRANSPORT_LATENCY_MS, \
CONFIG_BT_AUDIO_PRESENTATION_DELAY_US))

/**
* @brief Callback for receiving Bluetooth LE Audio data.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,3 @@ config NVS

config NVS_LOG_LEVEL
default 2

config BT_ASCS_MAX_ASE_SRC_COUNT
default 1
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ static void check_and_update_pd_in_group(struct stream_index idx, uint32_t new_p
}

static void stream_configured_cb(struct bt_bap_stream *stream,
const struct bt_audio_codec_qos_pref *pref)
const struct bt_bap_qos_cfg_pref *pref)
{
int ret;
uint32_t new_pres_dly_us;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ static enum bt_audio_dir caps_dirs[] = {
#endif /* (CONFIG_BT_AUDIO_TX) */
};

static const struct bt_audio_codec_qos_pref qos_pref = BT_AUDIO_CODEC_QOS_PREF(
static const struct bt_bap_qos_cfg_pref qos_pref = BT_BAP_QOS_CFG_PREF(
true, BT_GAP_LE_PHY_2M, CONFIG_BT_AUDIO_RETRANSMITS, BLE_ISO_LATENCY_MS,
CONFIG_AUDIO_MIN_PRES_DLY_US, CONFIG_AUDIO_MAX_PRES_DLY_US,
CONFIG_BT_AUDIO_PREFERRED_MIN_PRES_DLY_US, CONFIG_BT_AUDIO_PREFERRED_MAX_PRES_DLY_US);
Expand Down Expand Up @@ -168,7 +168,7 @@ BUILD_ASSERT(CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT <= 1,

static int lc3_config_cb(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_audio_dir dir,
const struct bt_audio_codec_cfg *codec, struct bt_bap_stream **stream,
struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp)
struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp)
{
int ret;
LOG_DBG("LC3 config callback");
Expand Down Expand Up @@ -224,14 +224,14 @@ static int lc3_config_cb(struct bt_conn *conn, const struct bt_bap_ep *ep, enum

static int lc3_reconfig_cb(struct bt_bap_stream *stream, enum bt_audio_dir dir,
const struct bt_audio_codec_cfg *codec,
struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp)
struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp)
{
LOG_DBG("ASE Codec Reconfig: stream %p", (void *)stream);

return 0;
}

static int lc3_qos_cb(struct bt_bap_stream *stream, const struct bt_audio_codec_qos *qos,
static int lc3_qos_cb(struct bt_bap_stream *stream, const struct bt_bap_qos_cfg *qos,
struct bt_bap_ascs_rsp *rsp)
{
enum bt_audio_dir dir;
Expand Down
Loading

0 comments on commit e64a8a2

Please sign in to comment.