Skip to content

Commit

Permalink
nimble/host: prepare for Broadcast sink
Browse files Browse the repository at this point in the history
This patch renames files, functions and configs from `broadcaster` to
`broadcast source` so new `broadcast sink` files and functions can be
created. Adds `BLE_ISO_BROADCAST_SINK` sysconfig
  • Loading branch information
KKopyscinski authored and MariuszSkamra committed Feb 19, 2024
1 parent 60aab30 commit b96b812
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/test_build_apps_syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ syscfg.vals:
BLE_PERIODIC_ADV_SYNC_BIGINFO_REPORTS: 1
BLE_ISO: 1
BLE_ISO_TEST: 1
BLE_ISO_BROADCASTER: 1
BLE_ISO_BROADCAST_SOURCE: 1
BLE_HCI_VS: 1
BLE_POWER_CONTROL: 1
BLE_CONN_SUBRATING: 1
Expand Down
2 changes: 1 addition & 1 deletion apps/auracast/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ syscfg.vals:

BLE_VERSION: 54
BLE_ISO: 1
BLE_ISO_BROADCASTER: 1
BLE_ISO_BROADCAST_SOURCE: 1
BLE_MAX_BIG: 1
BLE_MAX_BIS: 2

Expand Down
6 changes: 3 additions & 3 deletions apps/btshell/src/btshell.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

#include "host/ble_gatt.h"
#include "host/ble_gap.h"
#if (MYNEWT_VAL(BLE_ISO_BROADCASTER))
#include "host/ble_audio_broadcast.h"
#if (MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE))
#include "host/ble_audio_broadcast_source.h"
#endif

#ifdef __cplusplus
Expand Down Expand Up @@ -191,7 +191,7 @@ int btshell_l2cap_send(uint16_t conn, uint16_t idx, uint16_t bytes);
int btshell_l2cap_reconfig(uint16_t conn_handle, uint16_t mtu,
uint8_t num, uint8_t idxs[]);

#if (MYNEWT_VAL(BLE_ISO_BROADCASTER))
#if (MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE))
int btshell_broadcast_base_add(uint8_t adv_instance, uint32_t presentation_delay);
int btshell_broadcast_big_sub_add(uint8_t adv_instance,
uint8_t codec_fmt,
Expand Down
2 changes: 1 addition & 1 deletion apps/btshell/src/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -4206,7 +4206,7 @@ static const struct shell_cmd_help sync_stats_help = {
#endif
#endif

#if MYNEWT_VAL(BLE_ISO_BROADCASTER)
#if MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE)
#if MYNEWT_VAL(SHELL_CMD_HELP)
static const struct shell_param leaudio_base_add_params[] = {
{"adv_instance", "Advertising instance, usage: =<UINT8>"},
Expand Down
4 changes: 2 additions & 2 deletions apps/btshell/src/cmd_leaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
* under the License.
*/

#include "host/ble_audio_broadcast.h"
#include "host/ble_audio_broadcast_source.h"
#include "cmd_leaudio.h"
#include "btshell.h"
#include "console/console.h"
#include "errno.h"

#if (MYNEWT_VAL(BLE_ISO_BROADCASTER))
#if (MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE))
int
cmd_leaudio_base_add(int argc, char **argv)
{
Expand Down
8 changes: 4 additions & 4 deletions apps/btshell/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include "host/ble_store.h"
#include "host/ble_sm.h"
#include "host/ble_audio_common.h"
#include "host/ble_audio_broadcast.h"
#include "host/ble_audio_broadcast_source.h"
#include "host/util/util.h"

/* Mandatory services. */
Expand Down Expand Up @@ -130,7 +130,7 @@ int btshell_full_disc_prev_chr_val;
struct ble_sm_sc_oob_data oob_data_local;
struct ble_sm_sc_oob_data oob_data_remote;

#if MYNEWT_VAL(BLE_ISO_BROADCASTER)
#if MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE)
static struct {struct ble_audio_base *base; uint8_t adv_instance;}
btshell_base_list[MYNEWT_VAL(BLE_MAX_BIG)];

Expand Down Expand Up @@ -2749,7 +2749,7 @@ btshell_get_default_own_addr_type(void)
return default_own_addr_type;
}

#if (MYNEWT_VAL(BLE_ISO_BROADCASTER))
#if (MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE))
static int
btshell_base_find_free(void)
{
Expand Down Expand Up @@ -3068,7 +3068,7 @@ mynewt_main(int argc, char **argv)
"btshell_coc_conn_pool");
assert(rc == 0);
#endif
#if (MYNEWT_VAL(BLE_ISO_BROADCASTER))
#if (MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE))
rc = os_mempool_init(&btshell_base_pool, MYNEWT_VAL(BLE_MAX_BIG),
sizeof(struct ble_audio_base),
btshell_base_mem,
Expand Down
2 changes: 1 addition & 1 deletion apps/leaudio_broadcaster/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "host/ble_hs.h"
#include "host/util/util.h"

#include "host/ble_audio_broadcast.h"
#include "host/ble_audio_broadcast_source.h"
#include "host/ble_audio_common.h"
#include "host/ble_iso.h"

Expand Down
2 changes: 1 addition & 1 deletion apps/leaudio_broadcaster/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ syscfg.vals:

BLE_VERSION: 54
BLE_ISO: 1
BLE_ISO_BROADCASTER: 1
BLE_ISO_BROADCAST_SOURCE: 1
BLE_MAX_BIG: 1
BLE_MAX_BIS: 2

Expand Down
2 changes: 1 addition & 1 deletion nimble/controller/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ syscfg.defs:
Enable support for Isochronous Broadcasting state.
restrictions:
- BLE_LL_ISO if 1
value: MYNEWT_VAL(BLE_ISO_BROADCASTER)
value: MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE)
state: experimental
BLE_LL_ISO_HCI_FEEDBACK_INTERVAL_MS:
description: >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* under the License.
*/

#ifndef H_BLE_AUDIO_BROADCAST_
#define H_BLE_AUDIO_BROADCAST_
#ifndef H_BLE_AUDIO_BROADCAST_SOURCE_
#define H_BLE_AUDIO_BROADCAST_SOURCE_

/**
* @file ble_audio_broadcast.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <stdint.h>
#include "host/ble_gap.h"
#include "host/ble_audio_common.h"
#include "host/ble_audio_broadcast.h"
#include "host/ble_audio_broadcast_source.h"

struct ble_svc_auracast_create_params {
/** Broadcast Audio Source Endpoint */
Expand Down
5 changes: 3 additions & 2 deletions nimble/host/services/auracast/src/ble_svc_auracast.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "host/ble_gap.h"
#include "host/ble_hs.h"
#include "host/ble_audio_broadcast.h"
#include "host/ble_audio_broadcast_source.h"
#include "services/auracast/ble_svc_auracast.h"

int
Expand Down Expand Up @@ -61,7 +61,8 @@ ble_svc_auracast_create(const struct ble_svc_auracast_create_params *params,

auracast_svc_data[data_offset] = BLE_HS_ADV_TYPE_SVC_DATA_UUID16;
data_offset++;
put_le16(&auracast_svc_data[data_offset], 0x1856);
put_le16(&auracast_svc_data[data_offset],
BLE_BROADCAST_PUBLIC_BROADCAST_ANNOUNCEMENT_SVC_UUID);
data_offset += 2;
auracast_svc_data[data_offset] = features;
data_offset++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
*/

#include "host/ble_uuid.h"
#include "host/ble_audio_broadcast.h"
#include "host/ble_audio_broadcast_source.h"

#include "os/util.h"

#if MYNEWT_VAL(BLE_ISO_BROADCASTER)
#if MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE)
struct ble_audio_broadcast {
SLIST_ENTRY(ble_audio_broadcast) next;
uint8_t adv_instance;
Expand Down
4 changes: 2 additions & 2 deletions nimble/host/src/ble_hs.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "syscfg/syscfg.h"
#include "stats/stats.h"
#include "host/ble_hs.h"
#include "host/ble_audio_broadcast.h"
#include "host/ble_audio_broadcast_source.h"
#include "ble_hs_priv.h"
#include "nimble/nimble_npl.h"
#ifndef MYNEWT
Expand Down Expand Up @@ -756,7 +756,7 @@ ble_hs_init(void)
#if MYNEWT_VAL(BLE_ISO)
rc = ble_iso_init();
SYSINIT_PANIC_ASSERT(rc == 0);
#if MYNEWT_VAL(BLE_ISO_BROADCASTER)
#if MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE)
rc = ble_audio_broadcast_init();
SYSINIT_PANIC_ASSERT(rc == 0);
#endif
Expand Down
6 changes: 3 additions & 3 deletions nimble/host/src/ble_hs_hci_evt.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static ble_hs_hci_evt_le_fn ble_hs_hci_evt_le_periodic_adv_rpt;
static ble_hs_hci_evt_le_fn ble_hs_hci_evt_le_periodic_adv_sync_lost;
static ble_hs_hci_evt_le_fn ble_hs_hci_evt_le_scan_req_rcvd;
static ble_hs_hci_evt_le_fn ble_hs_hci_evt_le_periodic_adv_sync_transfer;
#if MYNEWT_VAL(BLE_ISO_BROADCASTER)
#if MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE)
static ble_hs_hci_evt_le_fn ble_hs_hci_evt_le_create_big_complete;
static ble_hs_hci_evt_le_fn ble_hs_hci_evt_le_terminate_big_complete;
#endif
Expand Down Expand Up @@ -137,7 +137,7 @@ static ble_hs_hci_evt_le_fn * const ble_hs_hci_evt_le_dispatch[] = {
[BLE_HCI_LE_SUBEV_ADV_SET_TERMINATED] = ble_hs_hci_evt_le_adv_set_terminated,
[BLE_HCI_LE_SUBEV_SCAN_REQ_RCVD] = ble_hs_hci_evt_le_scan_req_rcvd,
[BLE_HCI_LE_SUBEV_PERIODIC_ADV_SYNC_TRANSFER] = ble_hs_hci_evt_le_periodic_adv_sync_transfer,
#if MYNEWT_VAL(BLE_ISO_BROADCASTER)
#if MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE)
[BLE_HCI_LE_SUBEV_CREATE_BIG_COMPLETE] =
ble_hs_hci_evt_le_create_big_complete,
[BLE_HCI_LE_SUBEV_TERMINATE_BIG_COMPLETE] =
Expand Down Expand Up @@ -747,7 +747,7 @@ ble_hs_hci_evt_le_periodic_adv_sync_transfer(uint8_t subevent, const void *data,
return 0;
}

#if MYNEWT_VAL(BLE_ISO_BROADCASTER)
#if MYNEWT_VAL(BLE_ISO_BROADCAST_SOURCE)
static int
ble_hs_hci_evt_le_create_big_complete(uint8_t subevent, const void *data,
unsigned int len)
Expand Down
4 changes: 2 additions & 2 deletions nimble/host/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -498,14 +498,14 @@ syscfg.defs:
Number of available BIGs
value: 'MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES'
restrictions:
- 'BLE_ISO_BROADCASTER if 0'
- 'BLE_ISO_BROADCAST_SOURCE if 0'

BLE_MAX_BIS:
description: >
Number of supported BISes
value: 4
restrictions:
- 'BLE_ISO_BROADCASTER if 0'
- 'BLE_ISO_BROADCAST_SOURCE if 0'

### Log settings.

Expand Down
10 changes: 8 additions & 2 deletions nimble/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,15 @@ syscfg.defs:
value: 0
restrictions:
- '(BLE_VERSION >= 52) if 1'
BLE_ISO_BROADCASTER:
BLE_ISO_BROADCAST_SOURCE:
description: >
This enables LE Audio Broadcaster feature
This enables LE Audio Broadcast Source feature
value: 0
restrictions:
- '(BLE_VERSION >= 52) if 1'
BLE_ISO_BROADCAST_SINK:
description: >
This enables LE Audio Broadcast Sink feature
value: 0
restrictions:
- '(BLE_VERSION >= 52) if 1'
Expand Down
2 changes: 1 addition & 1 deletion porting/npl/riot/include/syscfg/syscfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@
#define MYNEWT_VAL_BLE_LL_ISO (0)
#endif

/* Value copied from BLE_ISO_BROADCASTER */
/* Value copied from BLE_ISO_BROADCAST_SOURCE */
#ifndef MYNEWT_VAL_BLE_LL_ISO_BROADCASTER
#define MYNEWT_VAL_BLE_LL_ISO_BROADCASTER (0)
#endif
Expand Down
2 changes: 1 addition & 1 deletion targets/nordic_pca10095_net-blehci_broadcaster/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ syscfg.vals:

BLE_VERSION: 54
BLE_ISO: 1
BLE_ISO_BROADCASTER: 1
BLE_ISO_BROADCAST_SOURCE: 1
BLE_MAX_BIG: 1
BLE_MAX_BIS: 2

0 comments on commit b96b812

Please sign in to comment.