diff --git a/doc/connectivity/bluetooth/api/hci_drivers.rst b/doc/connectivity/bluetooth/api/hci_drivers.rst index 9b01981d67a0d7..fd70691f2a89bd 100644 --- a/doc/connectivity/bluetooth/api/hci_drivers.rst +++ b/doc/connectivity/bluetooth/api/hci_drivers.rst @@ -8,4 +8,4 @@ HCI Drivers API Reference ************* -.. doxygengroup:: bt_hci_driver +.. doxygengroup:: bt_hci_api diff --git a/include/zephyr/drivers/bluetooth/hci_driver.h b/include/zephyr/drivers/bluetooth/hci_driver.h deleted file mode 100644 index c2eae9d90cb93d..00000000000000 --- a/include/zephyr/drivers/bluetooth/hci_driver.h +++ /dev/null @@ -1,242 +0,0 @@ -/** @file - * @brief Bluetooth HCI driver API. - */ - -/* - * Copyright (c) 2015-2016 Intel Corporation - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef ZEPHYR_INCLUDE_DRIVERS_BLUETOOTH_HCI_DRIVER_H_ -#define ZEPHYR_INCLUDE_DRIVERS_BLUETOOTH_HCI_DRIVER_H_ - -/** - * @brief HCI drivers - * - * @deprecated This is the old HCI driver API. Drivers should use @ref bt_hci_api instead. - * - * @defgroup bt_hci_driver HCI drivers - * @ingroup bluetooth - * @{ - */ - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - /* The host should never send HCI_Reset */ - BT_QUIRK_NO_RESET = BIT(0), - /* The controller does not auto-initiate a DLE procedure when the - * initial connection data length parameters are not equal to the - * default data length parameters. Therefore the host should initiate - * the DLE procedure after connection establishment. */ - BT_QUIRK_NO_AUTO_DLE = BIT(1), -}; - -/** - * @brief Receive data from the controller/HCI driver. - * - * This is the main function through which the HCI driver provides the - * host with data from the controller. The buffer needs to have its type - * set with the help of bt_buf_set_type() before calling this API. - * - * @param buf Network buffer containing data from the controller. - * - * @return 0 on success or negative error number on failure. - * - * @deprecated Use the new HCI driver interface instead: @ref bt_hci_api - */ -__deprecated int bt_recv(struct net_buf *buf); - -/** Possible values for the 'bus' member of the bt_hci_driver struct */ -enum bt_hci_driver_bus { - BT_HCI_DRIVER_BUS_VIRTUAL = 0, - BT_HCI_DRIVER_BUS_USB = 1, - BT_HCI_DRIVER_BUS_PCCARD = 2, - BT_HCI_DRIVER_BUS_UART = 3, - BT_HCI_DRIVER_BUS_RS232 = 4, - BT_HCI_DRIVER_BUS_PCI = 5, - BT_HCI_DRIVER_BUS_SDIO = 6, - BT_HCI_DRIVER_BUS_SPI = 7, - BT_HCI_DRIVER_BUS_I2C = 8, - BT_HCI_DRIVER_BUS_IPM = 9, -}; - -#if defined(CONFIG_BT_HCI_SETUP) || defined(__DOXYGEN__) -struct bt_hci_setup_params { - /** The public identity address to give to the controller. This field is used when the - * driver selects @kconfig{CONFIG_BT_HCI_SET_PUBLIC_ADDR} to indicate that it supports - * setting the controller's public address. - */ - bt_addr_t public_addr; -}; -#endif - -/** - * @brief Abstraction which represents the HCI transport to the controller. - * - * This struct is used to represent the HCI transport to the Bluetooth - * controller. - */ -struct bt_hci_driver { - /** Name of the driver */ - const char *name; - - /** Bus of the transport (BT_HCI_DRIVER_BUS_*) */ - enum bt_hci_driver_bus bus; - - /** Specific controller quirks. These are set by the HCI driver - * and acted upon by the host. They can either be statically - * set at buildtime, or set at runtime before the HCI driver's - * open() callback returns. - */ - uint32_t quirks; - - /** - * @brief Open the HCI transport. - * - * Opens the HCI transport for operation. This function must not - * return until the transport is ready for operation, meaning it - * is safe to start calling the send() handler. - * - * @return 0 on success or negative error number on failure. - */ - int (*open)(void); - - /** - * @brief Close the HCI transport. - * - * Closes the HCI transport. This function must not return until the - * transport is closed. - * - * @return 0 on success or negative error number on failure. - */ - int (*close)(void); - - /** - * @brief Send HCI buffer to controller. - * - * Send an HCI command or ACL data to the controller. The exact - * type of the data can be checked with the help of bt_buf_get_type(). - * - * @note This function must only be called from a cooperative thread. - * - * @param buf Buffer containing data to be sent to the controller. - * - * @return 0 on success or negative error number on failure. - */ - int (*send)(struct net_buf *buf); - -#if defined(CONFIG_BT_HCI_SETUP) || defined(__DOXYGEN__) - /** - * @brief HCI vendor-specific setup - * - * Executes vendor-specific commands sequence to initialize - * BT Controller before BT Host executes Reset sequence. - * - * @note @kconfig{CONFIG_BT_HCI_SETUP} must be selected for this - * field to be available. - * - * @return 0 on success or negative error number on failure. - */ - int (*setup)(const struct bt_hci_setup_params *params); -#endif /* defined(CONFIG_BT_HCI_SETUP) || defined(__DOXYGEN__)*/ -}; - -/** - * @brief Register a new HCI driver to the Bluetooth stack. - * - * This needs to be called before any application code runs. The bt_enable() - * API will fail if there is no driver registered. - * - * @param drv A bt_hci_driver struct representing the driver. - * - * @return 0 on success or negative error number on failure. - * - * @deprecated Use the new HCI driver interface instead: @ref bt_hci_api - */ -__deprecated int bt_hci_driver_register(const struct bt_hci_driver *drv); - -/** - * @brief Setup the HCI transport, which usually means to reset the - * Bluetooth IC. - * - * @note A weak version of this function is included in the H4 driver, so - * defining it is optional per board. - * - * @param dev The device structure for the bus connecting to the IC - * - * @return 0 on success, negative error value on failure - */ -int bt_hci_transport_setup(const struct device *dev); - -/** - * @brief Teardown the HCI transport. - * - * @note A weak version of this function is included in the IPC driver, so - * defining it is optional. NRF5340 includes support to put network core - * in reset state. - * - * @param dev The device structure for the bus connecting to the IC - * - * @return 0 on success, negative error value on failure - */ -int bt_hci_transport_teardown(const struct device *dev); - -/** Allocate an HCI event buffer. - * - * This function allocates a new buffer for an HCI event. It is given the - * event code and the total length of the parameters. Upon successful return - * the buffer is ready to have the parameters encoded into it. - * - * @param evt Event OpCode. - * @param len Length of event parameters. - * - * @return Newly allocated buffer. - */ -struct net_buf *bt_hci_evt_create(uint8_t evt, uint8_t len); - -/** Allocate an HCI Command Complete event buffer. - * - * This function allocates a new buffer for HCI Command Complete event. - * It is given the OpCode (encoded e.g. using the BT_OP macro) and the total - * length of the parameters. Upon successful return the buffer is ready to have - * the parameters encoded into it. - * - * @param op Command OpCode. - * @param plen Length of command parameters. - * - * @return Newly allocated buffer. - */ -struct net_buf *bt_hci_cmd_complete_create(uint16_t op, uint8_t plen); - -/** Allocate an HCI Command Status event buffer. - * - * This function allocates a new buffer for HCI Command Status event. - * It is given the OpCode (encoded e.g. using the BT_OP macro) and the status - * code. Upon successful return the buffer is ready to have the parameters - * encoded into it. - * - * @param op Command OpCode. - * @param status Status code. - * - * @return Newly allocated buffer. - */ -struct net_buf *bt_hci_cmd_status_create(uint16_t op, uint8_t status); - -#ifdef __cplusplus -} -#endif - -/** - * @} - */ - -#endif /* ZEPHYR_INCLUDE_DRIVERS_BLUETOOTH_HCI_DRIVER_H_ */ diff --git a/subsys/bluetooth/controller/hci/hci.c b/subsys/bluetooth/controller/hci/hci.c index 8fffa01a3feafb..059b94d933d767 100644 --- a/subsys/bluetooth/controller/hci/hci.c +++ b/subsys/bluetooth/controller/hci/hci.c @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c index f77710b3e08d05..ec5cdeb3f67e78 100644 --- a/subsys/bluetooth/host/conn.c +++ b/subsys/bluetooth/host/conn.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include "common/assert.h" diff --git a/subsys/bluetooth/host/hci_common.c b/subsys/bluetooth/host/hci_common.c index a050b4915e979a..1f382075d05f07 100644 --- a/subsys/bluetooth/host/hci_common.c +++ b/subsys/bluetooth/host/hci_common.c @@ -6,7 +6,7 @@ #include #include -#include +#include #include "common/assert.h" struct net_buf *bt_hci_evt_create(uint8_t evt, uint8_t len) diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 88eac980f0103d..a2f72d3a70773f 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -30,11 +30,7 @@ #include #include #include -#if DT_HAS_CHOSEN(zephyr_bt_hci) #include -#else -#include -#endif #include "common/bt_str.h" #include "common/assert.h" @@ -70,9 +66,20 @@ #include LOG_MODULE_REGISTER(bt_hci_core); -#define BT_HCI_DEV DT_CHOSEN(zephyr_bt_hci) -#define BT_HCI_BUS BT_DT_HCI_BUS_GET(BT_HCI_DEV) -#define BT_HCI_NAME BT_DT_HCI_NAME_GET(BT_HCI_DEV) +#if DT_HAS_CHOSEN(zephyr_bt_hci) +#define BT_HCI_NODE DT_CHOSEN(zephyr_bt_hci) +#define BT_HCI_DEV DEVICE_DT_GET(BT_HCI_NODE) +#define BT_HCI_BUS BT_DT_HCI_BUS_GET(BT_HCI_NODE) +#define BT_HCI_NAME BT_DT_HCI_NAME_GET(BT_HCI_NODE) +#define BT_HCI_QUIRKS BT_DT_HCI_QUIRKS_GET(BT_HCI_NODE) +#else +/* The zephyr,bt-hci chosen property is mandatory, except for unit tests */ +BUILD_ASSERT(IS_ENABLED(CONFIG_ZTEST), "Missing DT chosen property for HCI"); +#define BT_HCI_DEV NULL +#define BT_HCI_BUS 0 +#define BT_HCI_NAME "" +#define BT_HCI_QUIRKS 0 +#endif void bt_tx_irq_raise(void); @@ -96,9 +103,7 @@ struct bt_dev bt_dev = { #if defined(CONFIG_BT_DEVICE_APPEARANCE_DYNAMIC) .appearance = CONFIG_BT_DEVICE_APPEARANCE, #endif -#if DT_HAS_CHOSEN(zephyr_bt_hci) - .hci = DEVICE_DT_GET(BT_HCI_DEV), -#endif + .hci = BT_HCI_DEV, }; static bt_ready_cb_t ready_cb; @@ -126,28 +131,16 @@ static struct cmd_data cmd_data[CONFIG_BT_BUF_CMD_TX_COUNT]; #define cmd(buf) (&cmd_data[net_buf_id(buf)]) #define acl(buf) ((struct acl_data *)net_buf_user_data(buf)) -#if DT_HAS_CHOSEN(zephyr_bt_hci) static bool drv_quirk_no_reset(void) { - return ((BT_DT_HCI_QUIRKS_GET(DT_CHOSEN(zephyr_bt_hci)) & BT_HCI_QUIRK_NO_RESET) != 0); + return ((BT_HCI_QUIRKS & BT_HCI_QUIRK_NO_RESET) != 0); } bool bt_drv_quirk_no_auto_dle(void) { - return ((BT_DT_HCI_QUIRKS_GET(DT_CHOSEN(zephyr_bt_hci)) & BT_HCI_QUIRK_NO_AUTO_DLE) != 0); -} -#else -static bool drv_quirk_no_reset(void) -{ - return ((bt_dev.drv->quirks & BT_QUIRK_NO_RESET) != 0); + return ((BT_HCI_QUIRKS & BT_HCI_QUIRK_NO_AUTO_DLE) != 0); } -bool bt_drv_quirk_no_auto_dle(void) -{ - return ((bt_dev.drv->quirks & BT_QUIRK_NO_AUTO_DLE) != 0); -} -#endif - void bt_hci_cmd_state_set_init(struct net_buf *buf, struct bt_hci_cmd_state_set *state, atomic_t *target, int bit, bool val) @@ -4008,19 +4001,10 @@ static int hci_init(void) } #endif /* defined(CONFIG_BT_HCI_SET_PUBLIC_ADDR) */ -#if DT_HAS_CHOSEN(zephyr_bt_hci) err = bt_hci_setup(bt_dev.hci, &setup_params); if (err && err != -ENOSYS) { return err; } -#else - if (bt_dev.drv->setup) { - err = bt_dev.drv->setup(&setup_params); - if (err) { - return err; - } - } -#endif #endif /* defined(CONFIG_BT_HCI_SETUP) */ err = common_init(); @@ -4075,11 +4059,7 @@ int bt_send(struct net_buf *buf) return bt_hci_ecc_send(buf); } -#if DT_HAS_CHOSEN(zephyr_bt_hci) return bt_hci_send(bt_dev.hci, buf); -#else - return bt_dev.drv->send(buf); -#endif } static const struct event_handler prio_events[] = { @@ -4181,14 +4161,9 @@ static int bt_recv_unsafe(struct net_buf *buf) } } -#if DT_HAS_CHOSEN(zephyr_bt_hci) int bt_hci_recv(const struct device *dev, struct net_buf *buf) { ARG_UNUSED(dev); -#else -int bt_recv(struct net_buf *buf) -{ -#endif int err; k_sched_lock(); @@ -4198,29 +4173,6 @@ int bt_recv(struct net_buf *buf) return err; } -/* Old-style HCI driver registration */ -#if !DT_HAS_CHOSEN(zephyr_bt_hci) -int bt_hci_driver_register(const struct bt_hci_driver *drv) -{ - if (bt_dev.drv) { - return -EALREADY; - } - - if (!drv->open || !drv->send) { - return -EINVAL; - } - - bt_dev.drv = drv; - - LOG_DBG("Registered %s", drv->name ? drv->name : ""); - - bt_monitor_new_index(BT_MONITOR_TYPE_PRIMARY, drv->bus, - BT_ADDR_ANY, drv->name ? drv->name : "bt0"); - - return 0; -} -#endif /* !DT_HAS_CHOSEN(zephyr_bt_hci) */ - void bt_finalize_init(void) { atomic_set_bit(bt_dev.flags, BT_DEV_READY); @@ -4349,19 +4301,17 @@ int bt_enable(bt_ready_cb_t cb) { int err; -#if DT_HAS_CHOSEN(zephyr_bt_hci) + if (IS_ENABLED(CONFIG_ZTEST) && bt_dev.hci == NULL) { + LOG_ERR("No DT chosen property for HCI"); + return -ENODEV; + } + if (!device_is_ready(bt_dev.hci)) { LOG_ERR("HCI driver is not ready"); return -ENODEV; } bt_monitor_new_index(BT_MONITOR_TYPE_PRIMARY, BT_HCI_BUS, BT_ADDR_ANY, BT_HCI_NAME); -#else /* !DT_HAS_CHONSEN(zephyr_bt_hci) */ - if (!bt_dev.drv) { - LOG_ERR("No HCI driver registered"); - return -ENODEV; - } -#endif atomic_clear_bit(bt_dev.flags, BT_DEV_DISABLE); @@ -4403,11 +4353,7 @@ int bt_enable(bt_ready_cb_t cb) k_thread_name_set(&bt_workq.thread, "BT RX WQ"); #endif -#if DT_HAS_CHOSEN(zephyr_bt_hci) err = bt_hci_open(bt_dev.hci, bt_hci_recv); -#else - err = bt_dev.drv->open(); -#endif if (err) { LOG_ERR("HCI driver open failed (%d)", err); return err; @@ -4427,17 +4373,6 @@ int bt_disable(void) { int err; -#if !DT_HAS_CHOSEN(zephyr_bt_hci) - if (!bt_dev.drv) { - LOG_ERR("No HCI driver registered"); - return -ENODEV; - } - - if (!bt_dev.drv->close) { - return -ENOTSUP; - } -#endif - if (atomic_test_and_set_bit(bt_dev.flags, BT_DEV_DISABLE)) { return -EALREADY; } @@ -4465,16 +4400,13 @@ int bt_disable(void) disconnected_handles_reset(); #endif /* CONFIG_BT_CONN */ -#if DT_HAS_CHOSEN(zephyr_bt_hci) err = bt_hci_close(bt_dev.hci); if (err == -ENOSYS) { atomic_clear_bit(bt_dev.flags, BT_DEV_DISABLE); atomic_set_bit(bt_dev.flags, BT_DEV_READY); return -ENOTSUP; } -#else - err = bt_dev.drv->close(); -#endif + if (err) { LOG_ERR("HCI driver close failed (%d)", err); diff --git a/subsys/bluetooth/host/hci_core.h b/subsys/bluetooth/host/hci_core.h index fb7a69539fd7bb..ac2bf9d2970212 100644 --- a/subsys/bluetooth/host/hci_core.h +++ b/subsys/bluetooth/host/hci_core.h @@ -403,12 +403,7 @@ struct bt_dev { /* Queue for outgoing HCI commands */ struct k_fifo cmd_tx_queue; -#if DT_HAS_CHOSEN(zephyr_bt_hci) const struct device *hci; -#else - /* Registered HCI driver */ - const struct bt_hci_driver *drv; -#endif #if defined(CONFIG_BT_PRIVACY) /* Local Identity Resolving Key */ @@ -443,9 +438,7 @@ extern sys_slist_t bt_auth_info_cbs; enum bt_security_err bt_security_err_get(uint8_t hci_err); #endif /* CONFIG_BT_SMP || CONFIG_BT_CLASSIC */ -#if DT_HAS_CHOSEN(zephyr_bt_hci) int bt_hci_recv(const struct device *dev, struct net_buf *buf); -#endif /* Data type to store state related with command to be updated * when command completes successfully. diff --git a/subsys/bluetooth/host/hci_ecc.c b/subsys/bluetooth/host/hci_ecc.c index 39fc7ef47a2f5c..017ed6b354ad56 100644 --- a/subsys/bluetooth/host/hci_ecc.c +++ b/subsys/bluetooth/host/hci_ecc.c @@ -27,11 +27,7 @@ #include #include #include -#if DT_HAS_CHOSEN(zephyr_bt_hci) #include -#else -#include -#endif #include "common/bt_str.h" @@ -102,11 +98,7 @@ static void send_cmd_status(uint16_t opcode, uint8_t status) evt->opcode = sys_cpu_to_le16(opcode); evt->status = status; -#if DT_HAS_CHOSEN(zephyr_bt_hci) bt_hci_recv(bt_dev.hci, buf); -#else - bt_recv(buf); -#endif } #if defined(CONFIG_BT_USE_PSA_API) @@ -217,11 +209,7 @@ static void emulate_le_p256_public_key_cmd(void) atomic_clear_bit(flags, PENDING_PUB_KEY); -#if DT_HAS_CHOSEN(zephyr_bt_hci) bt_hci_recv(bt_dev.hci, buf); -#else - bt_recv(buf); -#endif } static void emulate_le_generate_dhkey(void) @@ -303,11 +291,7 @@ static void emulate_le_generate_dhkey(void) atomic_clear_bit(flags, PENDING_DHKEY); -#if DT_HAS_CHOSEN(zephyr_bt_hci) bt_hci_recv(bt_dev.hci, buf); -#else - bt_recv(buf); -#endif } static void ecc_process(struct k_work *work) @@ -432,11 +416,7 @@ int bt_hci_ecc_send(struct net_buf *buf) } } -#if DT_HAS_CHOSEN(zephyr_bt_hci) return bt_hci_send(bt_dev.hci, buf); -#else - return bt_dev.drv->send(buf); -#endif } void bt_hci_ecc_supported_commands(uint8_t *supported_commands) diff --git a/subsys/bluetooth/host/hci_raw.c b/subsys/bluetooth/host/hci_raw.c index 984c8607ee6539..0f0b93e99e686a 100644 --- a/subsys/bluetooth/host/hci_raw.c +++ b/subsys/bluetooth/host/hci_raw.c @@ -11,11 +11,7 @@ #include #include -#if DT_HAS_CHOSEN(zephyr_bt_hci) #include -#else -#include -#endif #include #include #include @@ -53,40 +49,25 @@ NET_BUF_POOL_FIXED_DEFINE(hci_iso_pool, CONFIG_BT_ISO_TX_BUF_COUNT, sizeof(struct bt_buf_data), NULL); #endif /* CONFIG_BT_ISO */ -#define BT_HCI_DEV DT_CHOSEN(zephyr_bt_hci) -#define BT_HCI_BUS BT_DT_HCI_BUS_GET(BT_HCI_DEV) -#define BT_HCI_NAME BT_DT_HCI_NAME_GET(BT_HCI_DEV) - -struct bt_dev_raw bt_dev = { #if DT_HAS_CHOSEN(zephyr_bt_hci) - .hci = DEVICE_DT_GET(BT_HCI_DEV), +#define BT_HCI_NODE DT_CHOSEN(zephyr_bt_hci) +#define BT_HCI_DEV DEVICE_DT_GET(BT_HCI_NODE) +#define BT_HCI_BUS BT_DT_HCI_BUS_GET(BT_HCI_NODE) +#define BT_HCI_NAME BT_DT_HCI_NAME_GET(BT_HCI_NODE) +#else +/* The zephyr,bt-hci chosen property is mandatory, except for unit tests */ +BUILD_ASSERT(IS_ENABLED(CONFIG_ZTEST), "Missing DT chosen property for HCI"); +#define BT_HCI_DEV NULL +#define BT_HCI_BUS 0 +#define BT_HCI_NAME "" #endif + +struct bt_dev_raw bt_dev = { + .hci = BT_HCI_DEV, }; struct bt_hci_raw_cmd_ext *cmd_ext; static size_t cmd_ext_size; -#if !DT_HAS_CHOSEN(zephyr_bt_hci) -int bt_hci_driver_register(const struct bt_hci_driver *drv) -{ - if (bt_dev.drv) { - return -EALREADY; - } - - if (!drv->open || !drv->send) { - return -EINVAL; - } - - bt_dev.drv = drv; - - LOG_DBG("Registered %s", drv->name ? drv->name : ""); - - bt_monitor_new_index(BT_MONITOR_TYPE_PRIMARY, drv->bus, - BT_ADDR_ANY, drv->name ? drv->name : "bt0"); - - return 0; -} -#endif - struct net_buf *bt_buf_get_rx(enum bt_buf_type type, k_timeout_t timeout) { struct net_buf *buf; @@ -191,14 +172,10 @@ struct net_buf *bt_buf_get_evt(uint8_t evt, bool discardable, k_timeout_t timeou return bt_buf_get_rx(BT_BUF_EVT, timeout); } -#if DT_HAS_CHOSEN(zephyr_bt_hci) int bt_hci_recv(const struct device *dev, struct net_buf *buf) { ARG_UNUSED(dev); -#else -int bt_recv(struct net_buf *buf) -{ -#endif + LOG_DBG("buf %p len %u", buf, buf->len); bt_monitor_send(bt_monitor_opcode(buf), buf->data, buf->len); @@ -243,11 +220,7 @@ static void bt_cmd_complete_ext(uint16_t op, uint8_t status) cc = net_buf_add(buf, sizeof(*cc)); cc->status = status; -#if DT_HAS_CHOSEN(zephyr_bt_hci) bt_hci_recv(bt_dev.hci, buf); -#else - bt_recv(buf); -#endif } static uint8_t bt_send_ext(struct net_buf *buf) @@ -327,11 +300,7 @@ int bt_send(struct net_buf *buf) return bt_hci_ecc_send(buf); } -#if DT_HAS_CHOSEN(zephyr_bt_hci) return bt_hci_send(bt_dev.hci, buf); -#else - return bt_dev.drv->send(buf); -#endif } int bt_hci_raw_set_mode(uint8_t mode) @@ -375,7 +344,6 @@ int bt_enable_raw(struct k_fifo *rx_queue) raw_rx = rx_queue; -#if DT_HAS_CHOSEN(zephyr_bt_hci) if (!device_is_ready(bt_dev.hci)) { LOG_ERR("HCI driver is not ready"); return -ENODEV; @@ -384,16 +352,6 @@ int bt_enable_raw(struct k_fifo *rx_queue) bt_monitor_new_index(BT_MONITOR_TYPE_PRIMARY, BT_HCI_BUS, BT_ADDR_ANY, BT_HCI_NAME); err = bt_hci_open(bt_dev.hci, bt_hci_recv); -#else - const struct bt_hci_driver *drv = bt_dev.drv; - - if (!drv) { - LOG_ERR("No HCI driver registered"); - return -ENODEV; - } - - err = drv->open(); -#endif if (err) { LOG_ERR("HCI driver open failed (%d)", err); return err; diff --git a/subsys/bluetooth/host/hci_raw_internal.h b/subsys/bluetooth/host/hci_raw_internal.h index 6f1d711eedfcc9..d652cc0ceabcac 100644 --- a/subsys/bluetooth/host/hci_raw_internal.h +++ b/subsys/bluetooth/host/hci_raw_internal.h @@ -14,17 +14,10 @@ extern "C" { #endif struct bt_dev_raw { -#if DT_HAS_CHOSEN(zephyr_bt_hci) const struct device *hci; -#else - /* Registered HCI driver */ - const struct bt_hci_driver *drv; -#endif }; -#if DT_HAS_CHOSEN(zephyr_bt_hci) int bt_hci_recv(const struct device *dev, struct net_buf *buf); -#endif extern struct bt_dev_raw bt_dev; diff --git a/subsys/usb/device/class/bluetooth.c b/subsys/usb/device/class/bluetooth.c index 942a1076156823..8acd749d8195db 100644 --- a/subsys/usb/device/class/bluetooth.c +++ b/subsys/usb/device/class/bluetooth.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include diff --git a/subsys/usb/device_next/class/bt_hci.c b/subsys/usb/device_next/class/bt_hci.c index 52eddc4e25b617..baca59db2b8c60 100644 --- a/subsys/usb/device_next/class/bt_hci.c +++ b/subsys/usb/device_next/class/bt_hci.c @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include