CONFIG_BT=y
CONFIG_LOG=y
CONFIG_BT_AUDIO=y
CONFIG_BT_SMP=y
CONFIG_BT_PAC_SNK=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
# Set preferred values based on BT_BAP_CONN_PARAM_RELAXED
CONFIG_BT_PERIPHERAL_PREF_MIN_INT=50
CONFIG_BT_PERIPHERAL_PREF_MAX_INT=70
CONFIG_BT_PERIPHERAL_PREF_LATENCY=0
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400
CONFIG_BT_OBSERVER=y
CONFIG_BT_GATT_DYNAMIC_DB=y
CONFIG_BT_EXT_ADV=y
CONFIG_BT_PER_ADV_SYNC=y
CONFIG_BT_ISO_SYNC_RECEIVER=y
CONFIG_BT_BAP_BROADCAST_SINK=y
CONFIG_BT_BAP_SCAN_DELEGATOR=y
CONFIG_BT_ISO_MAX_CHAN=2
# Allocate 4 RX buffers per channel
CONFIG_BT_ISO_RX_BUF_COUNT=8
CONFIG_BT_BAP_BROADCAST_SNK_SUBGROUP_COUNT=2
CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT=2
CONFIG_BT_BAP_BASS_MAX_SUBGROUPS=2
CONFIG_BT_BUF_ACL_RX_SIZE=255
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_AUDIO_CODEC_CFG_MAX_METADATA_SIZE=64
CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_SIZE=64
CONFIG_BT_AUDIO_CODEC_CAP_MAX_METADATA_SIZE=64
CONFIG_BT_AUDIO_CODEC_CAP_MAX_DATA_SIZE=64

CONFIG_BT_DEVICE_NAME="Broadcast Audio Sink"

# TEST - CoPilot
# Broadcast source role
CONFIG_BT_BAP_BROADCAST_SOURCE=y
#CONFIG_BT_AUDIO_BROADCAST_SOURCE=y

# Number of BISes transmit (match sink stream count)
CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT=2

# ISO TX buffers for relaying
CONFIG_BT_ISO_TX_BUF_COUNT=16
#CONFIG_BT_ISO_TX_FRAG_COUNT=16

# Helpful logging
#CONFIG_BT_DEBUG_LOG=y
#CONFIG_BT_AUDIO_DEBUG_LOG=y


#
# TEST
CONFIG_DEBUG=y
CONFIG_ASSERT=y
CONFIG_ASSERT_VERBOSE=y
CONFIG_REBOOT=y
CONFIG_BT_BUF_CMD_TX_COUNT=5
CONFIG_BT_PRIVACY=n

CONFIG_MAIN_STACK_SIZE=4096

CONFIG_BT_ISO_BROADCASTER=y


# ISO
CONFIG_BT_EXT_ADV_MAX_ADV_SET=2
CONFIG_BT_ISO_MAX_BIG=2
CONFIG_BT_ISO_MAX_CHAN=4
# TBD: is 4 stream(1 channel) or 2 stream(/2 channel) + 1 extra Tx buf sufficient?
#CONFIG_BT_ISO_TX_BUF_COUNT=8
CONFIG_BT_ISO_TX_BUF_COUNT=5
# Allocate up to 4 ISO Rx buffers per channel
# (see samples/bluetooth/bap_broadcast_sink)
# N.B. for Rx, data copied from BLE Rx buf to new net_buf so
# Rx ISO buffer count should be reducible, however, frames lost on BISes
# may be followed by burst of frames on BISes, where number depends on
# latencies and PTO, so keep buf count as is. This only affects host.
CONFIG_BT_ISO_RX_BUF_COUNT=8

# v4.1.0 - new requirement
CONFIG_BT_ISO_BROADCASTER=y
CONFIG_BT_ISO_TX_MTU=310
CONFIG_BT_ISO_RX_MTU=310

# PaWR
CONFIG_BT_PER_ADV_RSP=y
# TEST - nRF7002DK? nRF5340DK?
#####CONFIG_BT_PER_ADV_SYNC_RSP=y
CONFIG_BT_PER_ADV_SYNC_BUF_SIZE=255
# TBD: enable to test 2nd Per Adv train
#CONFIG_AUR_PAWR=n
#


# newlibc (required by SES, not required by VSC)
CONFIG_NEWLIB_LIBC=y
CONFIG_STATIC_INIT_GNU=y
# TBD: enable to reduce RAM
# TEST - gnuarmemb does not have libc_nano.a for all cases??
CONFIG_NEWLIB_LIBC_NANO=y
# ...or picolibc
#CONFIG_CBPRINTF_NANO=y

# N.B. need to increase tx_thread_stack (hci_core.c) to avoid crash
CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y
CONFIG_BT_HCI_TX_STACK_SIZE=1024
# TBD: need for pdm_mic_gen_tone? What happens if < INT_MIN?
CONFIG_FPU=y
CONFIG_FP16=y
CONFIG_FP_HARDABI=y

# Dynamic zi2c, any zi2s, aur_bap_stream, aur_data_fifo, aur_lc3
# e.g. NET_BUF_POOL_...
# N.B. use k_malloc (heap) as malloc() seems to have small limits
# TBD: merge client and driver/device buffers to reduce this
# TEST: 20250930 use static allocation and reduce heap
#CONFIG_HEAP_MEM_POOL_SIZE=49152
CONFIG_HEAP_MEM_POOL_SIZE=24576
# Minimal malloc (psa, mbedtls)
CONFIG_COMMON_LIBC_MALLOC=y
#CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=16384
CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=1024
# Support dynamic stack allocation (for thread stacks of variable size)
CONFIG_DYNAMIC_THREAD=y
CONFIG_DYNAMIC_THREAD_ALLOC=y

# Console
# Console behaviour is different on non-FOTA (debug) and FOTA (non-debug)
# systems.
# non-FOTA system (debug):
# - disable CONFIG_UART_CONSOLE
# - enable CONFIG_RTT_CONSOLE
# - enable CONFIG_USE_SEGGER_RTT
# FOTA system (non-debug):
# ****USE psrc_ctlr_mcuboot project for Production***
# ****USE psrc_ctlr_mcuboot project for Production***
# ****USE psrc_ctlr_mcuboot project for Production***
# - enable UART console
# - disable CONFIG_RTT_CONSOLE
# - disable CONFIG_USE_SEGGER_RTT
# and
# - add zephyr,console = &cdc_acm_uart0 to boards/*.overlay
# USB/UART shell (instead of RTT) will get print* output, including
# any output previously routed to RTT
# Note: on FOTA, CONFIG_LOG=n, so print* calls routed to LOG go to /dev/null
#
### non-FOTA system (debug)
CONFIG_UART_CONSOLE=n
### FOTA system (non-debug)
#####CONFIG_UART_CONSOLE=y
#
CONFIG_RTT_CONSOLE=y
CONFIG_USE_SEGGER_RTT=y
# v4.1.0 - new requirement (if CONFIG_SHELL=y)
CONFIG_LOG_BACKEND_RTT=y
##CONFIG_SHELL_BACKEND_RTT=y
##CONFIG_SHELL_LOG_BACKEND=y

# Logging
CONFIG_LOG_PRINTK=y
CONFIG_LOG_MODE_DEFERRED=y
CONFIG_LOG_SPEED=y
CONFIG_LOG_MODE_OVERFLOW=y
CONFIG_LOG_BUFFER_SIZE=10000
# N.B. sends RTT output to USB/UARG
####CONFIG_LOG_BACKEND_RTT_BUFFER=1
#CONFIG_LOG_BACKEND_RTT_BUFFER_SIZE=2048
CONFIG_SEGGER_RTT_BUFFER_SIZE_UP=2048
#CONFIG_BT_GATT_LOG_LEVEL_DBG=y
#CONFIG_BT_BAP_DEBUG_STREAM_SEQ_NUM=y
#CONFIG_BT_BAP_DEBUG_STREAM_DATA=y
#CONFIG_BT_BAP_STREAM_LOG_LEVEL_DBG=y
#CONFIG_BT_BAP_BASE_LOG_LEVEL_DBG=y
#CONFIG_BT_BAP_BROADCAST_SOURCE_LOG_LEVEL_DBG=y
#CONFIG_BT_BAP_BROADCAST_ASSISTANT_LOG_LEVEL_DBG=y
#CONFIG_BT_BAP_SCAN_DELEGATOR_LOG_LEVEL_DBG=y
####CONFIG_BT_DEBUG_ISO_DATA=y
###CONFIG_BT_ISO_LOG_LEVEL_DBG=y
#CONFIG_USB_CDC_ACM_LOG_LEVEL_DBG=y
#CONFIG_AUDIO_DATAPATH_LOG_LEVEL_DBG=y
#CONFIG_MEM_SLAB_TRACE_MAX_UTILIZATION=y
#CONFIG_BT_HCI_CORE_LOG_LEVEL_DBG=y
#CONFIG_BT_HCI_DRIVER_LOG_LEVEL_DBG=y
