Bluetooth: Shell: Restructure shell files

Moves around the shell files so that they are placed nearer
to the features they expose access to.

A few changes as possible has been made.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2024-09-11 12:37:17 +02:00 committed by Anas Nashif
commit bf897cf941
54 changed files with 96 additions and 122 deletions

View file

@ -345,9 +345,6 @@ Bluetooth controller:
- subsys/bluetooth/common/
- subsys/bluetooth/controller/
- subsys/bluetooth/crypto/
- subsys/bluetooth/shell/ll.c
- subsys/bluetooth/shell/ll.h
- subsys/bluetooth/shell/ticker.c
- tests/bluetooth/controller/
- tests/bsim/bluetooth/ll/
labels:
@ -376,7 +373,6 @@ Bluetooth Host:
- subsys/bluetooth/host/
- subsys/bluetooth/lib/
- subsys/bluetooth/services/
- subsys/bluetooth/shell/
- subsys/bluetooth/CMakeLists.txt
- subsys/bluetooth/Kconfig*
- tests/bluetooth/
@ -404,14 +400,10 @@ Bluetooth Host:
- samples/bluetooth/tmap*/
- samples/bluetooth/iso_*/
- samples/bluetooth/mesh*/
- subsys/bluetooth/shell/bredr.c
- subsys/bluetooth/shell/iso.c
- subsys/bluetooth/shell/ll.c
- subsys/bluetooth/shell/ll.h
- subsys/bluetooth/shell/ticker.c
- subsys/bluetooth/Kconfig.iso
- subsys/bluetooth/host/iso.c
- subsys/bluetooth/host/iso_internal.h
- subsys/bluetooth/host/shell/iso.c
- tests/bluetooth/audio/
- tests/bluetooth/controller/
- tests/bluetooth/mesh*/
@ -503,7 +495,6 @@ Bluetooth Classic:
files:
- subsys/bluetooth/common/
- subsys/bluetooth/host/classic/
- subsys/bluetooth/shell/bredr.c
- include/zephyr/bluetooth/classic/
labels:
- "area: Bluetooth Classic"
@ -521,10 +512,10 @@ Bluetooth ISO:
- include/zephyr/bluetooth/iso.h
- doc/connectivity/bluetooth/api/shell/iso.rst
- samples/bluetooth/iso_*/
- subsys/bluetooth/shell/iso.c
- subsys/bluetooth/Kconfig.iso
- subsys/bluetooth/host/iso.c
- subsys/bluetooth/host/iso_internal.h
- subsys/bluetooth/host/shell/iso.c
labels:
- "area: Bluetooth ISO"
- "area: Bluetooth"

View file

@ -6,7 +6,6 @@ target_include_directories(subsys__bluetooth INTERFACE ${CMAKE_CURRENT_SOURCE_DI
add_subdirectory(common)
add_subdirectory_ifdef(CONFIG_BT_HCI host)
add_subdirectory_ifdef(CONFIG_BT_SHELL shell)
add_subdirectory_ifdef(CONFIG_BT_CONN services)
add_subdirectory_ifdef(CONFIG_BT_MESH mesh)
add_subdirectory_ifdef(CONFIG_BT_AUDIO audio)

View file

@ -202,11 +202,18 @@ rsource "Kconfig.iso"
rsource "common/Kconfig"
rsource "host/Kconfig"
rsource "controller/Kconfig"
rsource "shell/Kconfig"
rsource "crypto/Kconfig"
rsource "lib/Kconfig"
rsource "Kconfig.logging"
config BT_SHELL
bool "Bluetooth shell"
select SHELL
select BT_TICKER_NEXT_SLOT_GET if BT_LL_SW_SPLIT
help
Activate shell module that provides Bluetooth commands to the
console.
config BT_USE_PSA_API
bool "Use PSA APIs instead of TinyCrypt for crypto operations"
depends on BT_CRYPTO || BT_HOST_CRYPTO || BT_ECC

View file

@ -32,7 +32,7 @@
#include <zephyr/sys/util_macro.h>
#include <zephyr/sys_clock.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
#define SHELL_PRINT_INDENT_LEVEL_SIZE 2
#define MAX_CODEC_FRAMES_PER_SDU 4U

View file

@ -47,7 +47,7 @@
#include <zephyr/sys/util_macro.h>
#include <zephyr/sys_clock.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
#include "audio.h"
/* Determines if we can initiate streaming */

View file

@ -32,7 +32,7 @@
#include <zephyr/sys/util_macro.h>
#include <zephyr/types.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
#include "../../host/hci_core.h"
#include "audio.h"

View file

@ -31,7 +31,7 @@
#include <zephyr/types.h>
#include <audio/bap_internal.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
#define PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO 20 /* Set the timeout relative to interval */
#define PA_SYNC_SKIP 5

View file

@ -27,7 +27,7 @@
#include <zephyr/bluetooth/gatt.h>
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/audio/cap.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
static size_t ad_cap_announcement_data_add(struct bt_data data[], size_t data_size)
{

View file

@ -21,7 +21,7 @@
#include <zephyr/sys/util.h>
#include <zephyr/types.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
#include "audio.h"
static void cap_discover_cb(struct bt_conn *conn, int err,

View file

@ -33,7 +33,7 @@
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/audio/cap.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
#include "audio.h"
#if defined(CONFIG_BT_BAP_UNICAST_CLIENT)

View file

@ -31,7 +31,7 @@
#include <zephyr/types.h>
#include <zephyr/shell/shell.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
static uint8_t members_found;
static struct k_work_delayable discover_members_timer;

View file

@ -29,7 +29,7 @@
#include <zephyr/types.h>
#include <zephyr/shell/shell.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
extern const struct shell *ctx_shell;
struct bt_csip_set_member_svc_inst *svc_inst;

View file

@ -29,7 +29,7 @@
#include <zephyr/sys/util.h>
#include <zephyr/sys/util_macro.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
#include "audio.h"
#define UNICAST_SINK_SUPPORTED (CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT > 0)

View file

@ -20,7 +20,7 @@
#include <zephyr/shell/shell.h>
#include <zephyr/shell/shell_string_conv.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
static int preset_select(uint8_t index, bool sync)
{

View file

@ -20,7 +20,7 @@
#include <zephyr/kernel.h>
#include <zephyr/shell/shell_string_conv.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
static struct bt_has *inst;

View file

@ -28,7 +28,7 @@
#include <zephyr/shell/shell_string_conv.h>
#include <zephyr/sys/util.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
#include "../media_proxy_internal.h"

View file

@ -28,7 +28,7 @@
#include "../media_proxy_internal.h" /* For MPL_NO_TRACK_ID - TODO: Fix */
#include "shell/bt.h"
#include "host/shell/bt.h"
LOG_MODULE_REGISTER(bt_media_controller_shell, CONFIG_BT_MCS_LOG_LEVEL);

View file

@ -21,7 +21,7 @@
#include <zephyr/shell/shell_string_conv.h>
#include <zephyr/types.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
static struct bt_micp_mic_ctlr *micp_mic_ctlr;
#if defined(CONFIG_BT_MICP_MIC_CTLR_AICS)

View file

@ -23,7 +23,7 @@
#include <zephyr/sys/util.h>
#include <zephyr/types.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
static void micp_mic_dev_mute_cb(uint8_t mute)
{

View file

@ -21,7 +21,7 @@
#include <zephyr/shell/shell.h>
#include <zephyr/shell/shell_string_conv.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
#include "../mpl_internal.h"

View file

@ -23,7 +23,7 @@
#include <zephyr/sys/__assert.h>
#include <zephyr/sys/util.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
#define PBS_DEMO 'P', 'B', 'P'

View file

@ -23,7 +23,7 @@
#include <zephyr/shell/shell_string_conv.h>
#include <zephyr/sys/util_macro.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
static struct bt_conn *tbs_authorized_conn;
static bool cbs_registered;

View file

@ -26,7 +26,7 @@
#include <zephyr/sys/util.h>
#include <zephyr/types.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
static int cmd_tbs_client_discover(const struct shell *sh, size_t argc,
char *argv[])

View file

@ -19,7 +19,7 @@
#include <zephyr/shell/shell.h>
#include <zephyr/sys/util.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
static int cmd_tmap_init(const struct shell *sh, size_t argc, char **argv)
{

View file

@ -22,7 +22,7 @@
#include <zephyr/sys/util.h>
#include <zephyr/types.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
static struct bt_vcp_vol_ctlr *vcp_vol_ctlr;
static struct bt_vcp_included vcp_included;

View file

@ -24,7 +24,7 @@
#include <zephyr/sys/util.h>
#include <zephyr/sys/util_macro.h>
#include "shell/bt.h"
#include "host/shell/bt.h"
static struct bt_vcp_included vcp_included;

View file

@ -9,6 +9,11 @@ endif()
zephyr_library()
zephyr_library_link_libraries(subsys__bluetooth)
if(CONFIG_BT_SHELL AND CONFIG_BT_LL_SW_SPLIT)
add_subdirectory(ticker/shell)
add_subdirectory(ll_sw/shell)
endif()
zephyr_library_sources(
util/mem.c
util/memq.c

View file

@ -0,0 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
zephyr_library_sources_ifdef(CONFIG_BT_LL_SW_SPLIT ll.c)
zephyr_include_directories(${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/nordic)

View file

@ -19,10 +19,10 @@
#include <zephyr/shell/shell.h>
#include "../controller/util/memq.h"
#include "../controller/include/ll.h"
#include "controller/util/memq.h"
#include "controller/include/ll.h"
#include "bt.h"
#include "host/shell/bt.h"
int cmd_ll_addr_read(const struct shell *sh, size_t argc, char *argv[])
{
@ -123,7 +123,7 @@ int cmd_test_end(const struct shell *sh, size_t argc, char *argv[])
#endif /* CONFIG_BT_CTLR_DTM */
#if defined(CONFIG_BT_CTLR_ADV_EXT)
#include "../controller/ll_sw/lll.h"
#include "controller/ll_sw/lll.h"
#if defined(CONFIG_BT_BROADCASTER)
#define OWN_ADDR_TYPE 1

View file

@ -0,0 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
zephyr_library_sources(ticker.c)
zephyr_include_directories(${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/nordic)

View file

@ -16,10 +16,10 @@
#include <zephyr/shell/shell.h>
#include "../controller/util/memq.h"
#include "../controller/util/mayfly.h"
#include "../controller/hal/ticker.h"
#include "../controller/ticker/ticker.h"
#include "controller/util/memq.h"
#include "controller/util/mayfly.h"
#include "controller/hal/ticker.h"
#include "controller/ticker/ticker.h"
#if defined(CONFIG_BT_MAX_CONN)
#define TICKERS_MAX (CONFIG_BT_MAX_CONN + 2)
@ -27,7 +27,7 @@
#define TICKERS_MAX 2
#endif
#include "bt.h"
#include "host/shell/bt.h"
static void ticker_op_done(uint32_t err, void *context)
{

View file

@ -4,6 +4,7 @@ zephyr_library()
zephyr_library_link_libraries(subsys__bluetooth)
add_subdirectory_ifdef(CONFIG_BT_CLASSIC classic)
add_subdirectory_ifdef(CONFIG_BT_SHELL shell)
zephyr_library_sources_ifdef(CONFIG_BT_HCI_RAW hci_raw.c hci_common.c)
zephyr_library_sources_ifdef(CONFIG_BT_MONITOR monitor.c)

View file

@ -1,5 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
add_subdirectory_ifdef(CONFIG_BT_SHELL shell)
zephyr_library()
zephyr_library_link_libraries(subsys__bluetooth)

View file

@ -0,0 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
zephyr_library_sources(bredr.c)
zephyr_library_sources_ifdef(CONFIG_BT_RFCOMM rfcomm.c)
zephyr_library_sources_ifdef(CONFIG_BT_A2DP a2dp.c)

View file

@ -24,7 +24,7 @@
#include <zephyr/shell/shell.h>
#include "bt.h"
#include "host/shell/bt.h"
struct bt_a2dp *default_a2dp;
static uint8_t a2dp_sink_sdp_registered;

View file

@ -29,7 +29,7 @@
#include <zephyr/shell/shell.h>
#include "bt.h"
#include "host/shell/bt.h"
#if defined(CONFIG_BT_CONN)
/* Connection context for BR/EDR legacy pairing in sec mode 3 */

View file

@ -29,7 +29,7 @@
#include <zephyr/shell/shell.h>
#include "bt.h"
#include "host/shell/bt.h"
#define DATA_MTU 48

View file

@ -0,0 +1,8 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
zephyr_library_sources(bt.c)
zephyr_library_sources_ifdef(CONFIG_BT_CONN gatt.c)
zephyr_library_sources_ifdef(CONFIG_BT_L2CAP_DYNAMIC_CHANNEL l2cap.c)
zephyr_library_sources_ifdef(CONFIG_BT_ISO iso.c)
zephyr_library_sources_ifdef(CONFIG_BT_CHANNEL_SOUNDING cs.c)

View file

@ -36,10 +36,10 @@
#include <zephyr/shell/shell.h>
#include "bt.h"
#include "ll.h"
#include "hci.h"
#include "../audio/shell/audio.h"
#include "audio/shell/audio.h"
#include "controller/ll_sw/shell/ll.h"
#include "host/shell/bt.h"
#include "mesh/shell/hci.h"
static bool no_settings_load;

View file

@ -26,7 +26,7 @@
#include <zephyr/shell/shell.h>
#include "bt.h"
#include "host/shell/bt.h"
#if defined(CONFIG_BT_GATT_CLIENT) || defined(CONFIG_BT_GATT_DYNAMIC_DB)
extern uint8_t selected_id;

View file

@ -22,7 +22,7 @@
#include <zephyr/bluetooth/conn.h>
#include <zephyr/bluetooth/iso.h>
#include "bt.h"
#include "host/shell/bt.h"
#if defined(CONFIG_BT_ISO_TX)
#define DEFAULT_IO_QOS \

View file

@ -29,7 +29,7 @@
#include <zephyr/shell/shell.h>
#include "bt.h"
#include "host/shell/bt.h"
#define CREDITS 10
#define DATA_MTU (23 * CREDITS)

View file

@ -36,3 +36,5 @@ zephyr_library_sources_ifdef(CONFIG_BT_MESH_OD_PRIV_PROXY_CLI od_priv_proxy.c)
zephyr_library_sources_ifdef(CONFIG_BT_MESH_SOL_PDU_RPL_CLI sol_pdu_rpl.c)
zephyr_library_sources_ifdef(CONFIG_BT_MESH_SHELL_BRG_CFG_CLI brg_cfg.c)
zephyr_library_sources_ifdef(CONFIG_BT_HCI_MESH_EXT hci.c)

View file

@ -1,5 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
add_subdirectory_ifdef(CONFIG_BT_SHELL shell)
zephyr_sources_ifdef(
CONFIG_BT_IAS
ias.c)

View file

@ -0,0 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
zephyr_library_sources_ifdef(CONFIG_BT_IAS ias.c)
zephyr_library_sources_ifdef(CONFIG_BT_IAS_CLIENT ias_client.c)

View file

@ -7,7 +7,6 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include "bt.h"
#include <stdlib.h>
#include <zephyr/types.h>
#include <zephyr/bluetooth/conn.h>
@ -18,6 +17,8 @@
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/services/ias.h>
#include "host/shell/bt.h"
extern const struct shell *ctx_shell;
static void alert_stop(void)

View file

@ -15,7 +15,7 @@
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/services/ias.h>
#include "bt.h"
#include "host/shell/bt.h"
extern const struct shell *ctx_shell;

View file

@ -1,53 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
zephyr_library_sources(
bt.c
hci.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_CONN
gatt.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_CLASSIC
bredr.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL
l2cap.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_RFCOMM
rfcomm.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_A2DP
a2dp.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_ISO
iso.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_CHANNEL_SOUNDING
cs.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_IAS
ias.c
)
zephyr_library_sources_ifdef(
CONFIG_BT_IAS_CLIENT
ias_client.c
)
if(CONFIG_BT_CTLR AND CONFIG_BT_LL_SW_SPLIT)
zephyr_library_sources(
ll.c
ticker.c
)
zephyr_include_directories(
${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/nordic
)
endif()

View file

@ -1,12 +0,0 @@
# Shell configuration options
# Copyright (c) 2017 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
config BT_SHELL
bool "Bluetooth shell"
select SHELL
select BT_TICKER_NEXT_SLOT_GET if BT_LL_SW_SPLIT
help
Activate shell module that provides Bluetooth commands to the
console.