bluetooth: Rename rpmsg HCI driver and sample to ipc
The existing driver and sample: - drivers/bluetooth/hci/rpmsg - samples/bluetooth/hci_rpmsg are no longer correctly named, since they now use the IPC subsystem to send and receive data. The IPC subsystem can use RPMsg as a transport, but that is one of several selectable backends. I initially wanted to deprecated both the BT_RPMSG Kconfig option as well as the zephyr,bt-hci-rpmsg-ipc chosen node in Devicetree. However, this proved to be undoable in the case of the Kconfig option. This is because it's a choice option, and those have special behavior. In particular, the only practical way to deprecate would've been to keep the old Kconfig option outside the choice (much like it's done in this commit) but then also add a 'depends on !BT_RPMSG' on each of the remaining choice symbols *except* on the new BT_HCI_IPC one. This, however, only works correctly for .conf files. If a board instead sets the default BT_HCI_BUS_TYPE in the Kconfig.defconfig file then the Kconfig tree parsing would fail, because it'd try to set it to a value (BT_RPMSG) that is no longer part of the choice. Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
parent
928e22c302
commit
9cf07bbdb5
69 changed files with 209 additions and 175 deletions
|
@ -20,7 +20,7 @@ documentation and are prefixed with :literal:`hci_` in their folder names.
|
|||
``-DBOARD=nrf5340dk_nrf5340_cpuapp`` or
|
||||
``-DBOARD=nrf5340dk_nrf5340_cpuapp_ns``) you must also build
|
||||
and program the corresponding sample for the nRF5340 network core
|
||||
:ref:`bluetooth-hci-rpmsg-sample` which implements the Bluetooth
|
||||
:ref:`bluetooth-hci-ipc-sample` which implements the Bluetooth
|
||||
Low Energy controller.
|
||||
|
||||
.. note::
|
||||
|
|
|
@ -37,21 +37,21 @@ changing ``nrf52833dk_nrf52833`` as needed for your board:
|
|||
:compact:
|
||||
|
||||
To run the application on nRF5340DK, a Bluetooth controller application must
|
||||
also run on the network core. The :ref:`bluetooth-hci-rpmsg-sample` sample
|
||||
also run on the network core. The :ref:`bluetooth-hci-ipc-sample` sample
|
||||
application may be used. To build this sample with direction finding support
|
||||
enabled:
|
||||
|
||||
* Copy
|
||||
:zephyr_file:`samples/bluetooth/direction_finding_central/boards/nrf52833dk_nrf52833.overlay`
|
||||
to a new file,
|
||||
:file:`samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.overlay`.
|
||||
:file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.overlay`.
|
||||
* Make sure the same GPIO pins are assigned to Direction Finding Extension in file
|
||||
:zephyr_file:`samples/bluetooth/direction_finding_central/boards/nrf5340dk_nrf5340_cpuapp.overlay`.
|
||||
as those in the created file :file:`samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.overlay`.
|
||||
as those in the created file :file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.overlay`.
|
||||
* Copy
|
||||
:zephyr_file:`samples/bluetooth/direction_finding_central/boards/nrf52833dk_nrf52833.conf`
|
||||
to a new file,
|
||||
:file:`samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.conf`.
|
||||
:file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.conf`.
|
||||
|
||||
Antenna matrix configuration
|
||||
****************************
|
||||
|
@ -69,8 +69,8 @@ this overlay. See :ref:`set-devicetree-overlays` for information on setting up
|
|||
and using overlays.
|
||||
|
||||
Note that antenna matrix configuration for the nRF5340 SoC is part of the
|
||||
network core application. When :ref:`bluetooth-hci-rpmsg-sample` is used as the
|
||||
network core application. When :ref:`bluetooth-hci-ipc-sample` is used as the
|
||||
network core application, the antenna matrix configuration should be stored in
|
||||
the file
|
||||
:file:`samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.overlay`
|
||||
:file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.overlay`
|
||||
instead.
|
||||
|
|
|
@ -37,21 +37,21 @@ changing ``nrf52833dk_nrf52833`` as needed for your board:
|
|||
:compact:
|
||||
|
||||
To run the application on nRF5340DK, a Bluetooth controller application must
|
||||
also run on the network core. The :ref:`bluetooth-hci-rpmsg-sample` sample
|
||||
also run on the network core. The :ref:`bluetooth-hci-ipc-sample` sample
|
||||
application may be used. To build this sample with direction finding support
|
||||
enabled:
|
||||
|
||||
* Copy
|
||||
:zephyr_file:`samples/bluetooth/direction_finding_connectionless_rx/boards/nrf52833dk_nrf52833.overlay`
|
||||
to a new file,
|
||||
:file:`samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.overlay`.
|
||||
:file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.overlay`.
|
||||
* Make sure the same GPIO pins are assigned to Direction Finding Extension in file
|
||||
:zephyr_file:`samples/bluetooth/direction_finding_connectionless_rx/boards/nrf5340dk_nrf5340_cpuapp.overlay`.
|
||||
as those in the created file :file:`samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.overlay`.
|
||||
as those in the created file :file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.overlay`.
|
||||
* Copy
|
||||
:zephyr_file:`samples/bluetooth/direction_finding_connectionless_rx/boards/nrf52833dk_nrf52833.conf`
|
||||
to a new file,
|
||||
:file:`samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.conf`. Add
|
||||
:file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.conf`. Add
|
||||
the line ``CONFIG_BT_EXT_ADV=y`` to enable extended size of
|
||||
:kconfig:option:`CONFIG_BT_BUF_CMD_TX_SIZE` to support the LE Set Extended Advertising
|
||||
Data command.
|
||||
|
@ -72,8 +72,8 @@ this overlay. See :ref:`set-devicetree-overlays` for information on setting up
|
|||
and using overlays.
|
||||
|
||||
Note that antenna matrix configuration for the nRF5340 SoC is part of the
|
||||
network core application. When :ref:`bluetooth-hci-rpmsg-sample` is used as the
|
||||
network core application. When :ref:`bluetooth-hci-ipc-sample` is used as the
|
||||
network core application, the antenna matrix configuration should be stored in
|
||||
the file
|
||||
:file:`samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.overlay`
|
||||
:file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.overlay`
|
||||
instead.
|
||||
|
|
|
@ -37,21 +37,21 @@ To use Angle of Arrival mode only, build this application as follows, changing
|
|||
:compact:
|
||||
|
||||
To run the application on nRF5340DK, a Bluetooth controller application must
|
||||
also run on the network core. The :zephyr_file:`samples/bluetooth/hci_rpmsg`
|
||||
also run on the network core. The :zephyr_file:`samples/bluetooth/hci_ipc`
|
||||
sample application may be used. To build this sample with direction finding
|
||||
support enabled:
|
||||
|
||||
* Copy
|
||||
:zephyr_file:`samples/bluetooth/direction_finding_connectionless_tx/boards/nrf52833dk_nrf52833.overlay`
|
||||
to a new file,
|
||||
:file:`samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.overlay`.
|
||||
:file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.overlay`.
|
||||
* Make sure the same GPIO pins are assigned to Direction Finding Extension in file
|
||||
:zephyr_file:`samples/bluetooth/direction_finding_connectionless_tx/boards/nrf5340dk_nrf5340_cpuapp.overlay`.
|
||||
as those in the created file :file:`samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.overlay`.
|
||||
as those in the created file :file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.overlay`.
|
||||
* Copy
|
||||
:zephyr_file:`samples/bluetooth/direction_finding_connectionless_tx/boards/nrf52833dk_nrf52833.conf`
|
||||
to a new file,
|
||||
:file:`samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.conf`. Add
|
||||
:file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.conf`. Add
|
||||
the line ``CONFIG_BT_EXT_ADV=y`` to enable extended size of
|
||||
:kconfig:option:`CONFIG_BT_BUF_CMD_TX_SIZE` to support the LE Set Extended
|
||||
Advertising Data command.
|
||||
|
@ -73,10 +73,10 @@ this overlay. See :ref:`set-devicetree-overlays` for information on setting up
|
|||
and using overlays.
|
||||
|
||||
Note that antenna matrix configuration for the nRF5340 SoC is part of the
|
||||
network core application. When :ref:`bluetooth-hci-rpmsg-sample` is used as
|
||||
network core application. When :ref:`bluetooth-hci-ipc-sample` is used as
|
||||
network core application, the antenna matrix configuration should be stored in
|
||||
the file
|
||||
:file:`samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.overlay`
|
||||
:file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.overlay`
|
||||
instead.
|
||||
|
||||
In addition to the devicetree configuration, to successfully use the Direction
|
||||
|
|
|
@ -36,21 +36,21 @@ changing ``nrf52833dk_nrf52833`` as needed for your board:
|
|||
:compact:
|
||||
|
||||
To run the application on nRF5340DK, a Bluetooth controller application must
|
||||
also run on the network core. The :ref:`bluetooth-hci-rpmsg-sample` sample
|
||||
also run on the network core. The :ref:`bluetooth-hci-ipc-sample` sample
|
||||
application may be used. To build this sample with direction finding support
|
||||
enabled:
|
||||
|
||||
* Copy
|
||||
:zephyr_file:`samples/bluetooth/direction_finding_peripheral/boards/nrf52833dk_nrf52833.overlay`
|
||||
to a new file,
|
||||
:file:`samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.overlay`.
|
||||
:file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.overlay`.
|
||||
* Make sure the same GPIO pins are assigned to Direction Finding Extension in file
|
||||
:zephyr_file:`samples/bluetooth/direction_finding_peripheral/boards/nrf5340dk_nrf5340_cpuapp.overlay`.
|
||||
as those in the created file :file:`samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.overlay`.
|
||||
as those in the created file :file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.overlay`.
|
||||
* Copy
|
||||
:zephyr_file:`samples/bluetooth/direction_finding_peripheral/boards/nrf52833dk_nrf52833.conf`
|
||||
to a new file,
|
||||
:file:`samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.conf`.
|
||||
:file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.conf`.
|
||||
|
||||
Antenna matrix configuration
|
||||
****************************
|
||||
|
@ -68,8 +68,8 @@ this overlay. See :ref:`set-devicetree-overlays` for information on setting up
|
|||
and using overlays.
|
||||
|
||||
Note that antenna matrix configuration for the nRF5340 SoC is part of the
|
||||
network core application. When :ref:`bluetooth-hci-rpmsg-sample` is used as the
|
||||
network core application. When :ref:`bluetooth-hci-ipc-sample` is used as the
|
||||
network core application, the antenna matrix configuration should be stored in
|
||||
the file
|
||||
:file:`samples/bluetooth/hci_rpmsg/boards/nrf5340dk_nrf5340_cpunet.overlay`
|
||||
:file:`samples/bluetooth/hci_ipc/boards/nrf5340dk_nrf5340_cpunet.overlay`
|
||||
instead.
|
||||
|
|
14
samples/bluetooth/hci_ipc/CMakeLists.txt
Normal file
14
samples/bluetooth/hci_ipc/CMakeLists.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
cmake_minimum_required(VERSION 3.20.0)
|
||||
|
||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||
project(hci_ipc)
|
||||
|
||||
target_sources(app PRIVATE src/main.c)
|
||||
|
||||
# Remove after 3.7.0 is released
|
||||
dt_chosen(chosen_hci_rpmsg PROPERTY "zephyr,bt-hci-rpmsg-ipc")
|
||||
if(DEFINED chosen_hci_rpmsg)
|
||||
message(FATAL_ERROR "zephyr,bt-hci-rpmsg-ipc has been renamed to zephyr,bt-hci-ipc")
|
||||
endif()
|
|
@ -1,37 +1,36 @@
|
|||
.. _bluetooth-hci-rpmsg-sample:
|
||||
.. _bluetooth-hci-ipc-sample:
|
||||
|
||||
Bluetooth: HCI RPMsg
|
||||
####################
|
||||
Bluetooth: HCI IPC
|
||||
##################
|
||||
|
||||
Overview
|
||||
********
|
||||
|
||||
This sample exposes :ref:`bluetooth_controller` support
|
||||
to another device or CPU using RPMsg transport which is
|
||||
a part of `OpenAMP <https://github.com/OpenAMP/open-amp/>`__.
|
||||
to another device or CPU using IPC subsystem.
|
||||
|
||||
Requirements
|
||||
************
|
||||
|
||||
* A board with :ref:`ipm_api` driver and Bluetooth LE support
|
||||
* A board with IPC subsystem and Bluetooth LE support
|
||||
|
||||
Building and Running
|
||||
********************
|
||||
|
||||
This sample can be found under :zephyr_file:`samples/bluetooth/hci_rpmsg`
|
||||
This sample can be found under :zephyr_file:`samples/bluetooth/hci_ipc`
|
||||
in the Zephyr tree.
|
||||
|
||||
To use this application, you need a board with a Bluetooth controller
|
||||
and IPM drivers.
|
||||
and IPC support.
|
||||
You can then build this application and flash it onto your board in
|
||||
the usual way. See :ref:`boards` for board-specific building and
|
||||
programming information.
|
||||
|
||||
To test this sample, you need a separate device/CPU that acts as Bluetooth
|
||||
HCI RPMsg peer.
|
||||
This sample is compatible with the HCI RPMsg driver provided by
|
||||
HCI IPC peer.
|
||||
This sample is compatible with the HCI IPC driver provided by
|
||||
Zephyr's Bluetooth :ref:`bt_hci_drivers` core. See the
|
||||
:kconfig:option:`CONFIG_BT_RPMSG` configuration option for more information.
|
||||
:kconfig:option:`CONFIG_BT_HCI_IPC` configuration option for more information.
|
||||
|
||||
You might need to adjust the Kconfig configuration of this sample to make it
|
||||
compatible with the peer application. For example, :kconfig:option:`CONFIG_BT_MAX_CONN`
|
|
@ -1,8 +1,8 @@
|
|||
sample:
|
||||
description: Allows Zephyr to provide Bluetooth connectivity via RPMsg.
|
||||
name: Bluetooth HCI RPMsg
|
||||
description: Allows Zephyr to provide Bluetooth connectivity via IPC
|
||||
name: Bluetooth HCI IPC
|
||||
tests:
|
||||
sample.bluetooth.hci_rpmsg:
|
||||
sample.bluetooth.hci_ipc:
|
||||
harness: bluetooth
|
||||
tags: bluetooth
|
||||
platform_allow:
|
||||
|
@ -12,7 +12,7 @@ tests:
|
|||
integration_platforms:
|
||||
- nrf5340dk_nrf5340_cpunet
|
||||
- nrf5340_audio_dk_nrf5340_cpunet
|
||||
sample.bluetooth.hci_rpmsg.iso_broadcast.bt_ll_sw_split:
|
||||
sample.bluetooth.hci_ipc.iso_broadcast.bt_ll_sw_split:
|
||||
harness: bluetooth
|
||||
tags: bluetooth
|
||||
extra_args: CONF_FILE="nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf"
|
||||
|
@ -23,7 +23,7 @@ tests:
|
|||
integration_platforms:
|
||||
- nrf5340dk_nrf5340_cpunet
|
||||
- nrf5340_audio_dk_nrf5340_cpunet
|
||||
sample.bluetooth.hci_rpmsg.iso_receive.bt_ll_sw_split:
|
||||
sample.bluetooth.hci_ipc.iso_receive.bt_ll_sw_split:
|
||||
harness: bluetooth
|
||||
tags: bluetooth
|
||||
extra_args: CONF_FILE="nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf"
|
||||
|
@ -33,7 +33,7 @@ tests:
|
|||
- nrf5340bsim_nrf5340_cpunet
|
||||
integration_platforms:
|
||||
- nrf5340dk_nrf5340_cpunet
|
||||
sample.bluetooth.hci_rpmsg.bis.bt_ll_sw_split:
|
||||
sample.bluetooth.hci_ipc.bis.bt_ll_sw_split:
|
||||
harness: bluetooth
|
||||
tags: bluetooth
|
||||
extra_args: CONF_FILE="nrf5340_cpunet_bis-bt_ll_sw_split.conf"
|
||||
|
@ -43,7 +43,7 @@ tests:
|
|||
- nrf5340bsim_nrf5340_cpunet
|
||||
integration_platforms:
|
||||
- nrf5340dk_nrf5340_cpunet
|
||||
sample.bluetooth.hci_rpmsg.iso_central.bt_ll_sw_split:
|
||||
sample.bluetooth.hci_ipc.iso_central.bt_ll_sw_split:
|
||||
harness: bluetooth
|
||||
tags: bluetooth
|
||||
extra_args: CONF_FILE="nrf5340_cpunet_iso_central-bt_ll_sw_split.conf"
|
||||
|
@ -53,7 +53,7 @@ tests:
|
|||
- nrf5340bsim_nrf5340_cpunet
|
||||
integration_platforms:
|
||||
- nrf5340dk_nrf5340_cpunet
|
||||
sample.bluetooth.hci_rpmsg.iso_peripheral.bt_ll_sw_split:
|
||||
sample.bluetooth.hci_ipc.iso_peripheral.bt_ll_sw_split:
|
||||
harness: bluetooth
|
||||
tags: bluetooth
|
||||
extra_args: CONF_FILE="nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf"
|
||||
|
@ -63,7 +63,7 @@ tests:
|
|||
- nrf5340bsim_nrf5340_cpunet
|
||||
integration_platforms:
|
||||
- nrf5340dk_nrf5340_cpunet
|
||||
sample.bluetooth.hci_rpmsg.cis.bt_ll_sw_split:
|
||||
sample.bluetooth.hci_ipc.cis.bt_ll_sw_split:
|
||||
harness: bluetooth
|
||||
tags: bluetooth
|
||||
extra_args: CONF_FILE="nrf5340_cpunet_cis-bt_ll_sw_split.conf"
|
||||
|
@ -73,7 +73,7 @@ tests:
|
|||
- nrf5340bsim_nrf5340_cpunet
|
||||
integration_platforms:
|
||||
- nrf5340dk_nrf5340_cpunet
|
||||
sample.bluetooth.hci_rpmsg.iso.bt_ll_sw_split:
|
||||
sample.bluetooth.hci_ipc.iso.bt_ll_sw_split:
|
||||
harness: bluetooth
|
||||
tags: bluetooth
|
||||
extra_args: CONF_FILE="nrf5340_cpunet_iso-bt_ll_sw_split.conf"
|
||||
|
@ -82,7 +82,7 @@ tests:
|
|||
- nrf5340bsim_nrf5340_cpunet
|
||||
integration_platforms:
|
||||
- nrf5340dk_nrf5340_cpunet
|
||||
sample.bluetooth.hci_rpmsg.df.bt_ll_sw_split:
|
||||
sample.bluetooth.hci_ipc.df.bt_ll_sw_split:
|
||||
harness: bluetooth
|
||||
tags: bluetooth
|
||||
extra_args:
|
||||
|
@ -91,7 +91,7 @@ tests:
|
|||
platform_allow: nrf5340dk_nrf5340_cpunet
|
||||
integration_platforms:
|
||||
- nrf5340dk_nrf5340_cpunet
|
||||
sample.bluetooth.hci_rpmsg.df.no_phy_coded.bt_ll_sw_split:
|
||||
sample.bluetooth.hci_ipc.df.no_phy_coded.bt_ll_sw_split:
|
||||
harness: bluetooth
|
||||
tags: bluetooth
|
||||
extra_args:
|
||||
|
@ -101,7 +101,7 @@ tests:
|
|||
platform_allow: nrf5340dk_nrf5340_cpunet
|
||||
integration_platforms:
|
||||
- nrf5340dk_nrf5340_cpunet
|
||||
sample.bluetooth.hci_rpmsg.mesh.bt_ll_sw_split:
|
||||
sample.bluetooth.hci_ipc.mesh.bt_ll_sw_split:
|
||||
harness: bluetooth
|
||||
tags: bluetooth
|
||||
extra_args: CONF_FILE="nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf"
|
|
@ -27,7 +27,7 @@
|
|||
#include <zephyr/logging/log_ctrl.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
|
||||
LOG_MODULE_REGISTER(hci_rpmsg, CONFIG_BT_LOG_LEVEL);
|
||||
LOG_MODULE_REGISTER(hci_ipc, CONFIG_BT_LOG_LEVEL);
|
||||
|
||||
static struct ipc_ept hci_ept;
|
||||
|
||||
|
@ -42,16 +42,16 @@ static K_SEM_DEFINE(ipc_bound_sem, 0, 1);
|
|||
static bool ipc_ept_ready;
|
||||
#endif /* CONFIG_BT_CTLR_ASSERT_HANDLER || CONFIG_BT_HCI_VS_FATAL_ERROR */
|
||||
|
||||
#define HCI_RPMSG_CMD 0x01
|
||||
#define HCI_RPMSG_ACL 0x02
|
||||
#define HCI_RPMSG_SCO 0x03
|
||||
#define HCI_RPMSG_EVT 0x04
|
||||
#define HCI_RPMSG_ISO 0x05
|
||||
#define HCI_IPC_CMD 0x01
|
||||
#define HCI_IPC_ACL 0x02
|
||||
#define HCI_IPC_SCO 0x03
|
||||
#define HCI_IPC_EVT 0x04
|
||||
#define HCI_IPC_ISO 0x05
|
||||
|
||||
#define HCI_FATAL_ERR_MSG true
|
||||
#define HCI_REGULAR_MSG false
|
||||
|
||||
static struct net_buf *hci_rpmsg_cmd_recv(uint8_t *data, size_t remaining)
|
||||
static struct net_buf *hci_ipc_cmd_recv(uint8_t *data, size_t remaining)
|
||||
{
|
||||
struct bt_hci_cmd_hdr *hdr = (void *)data;
|
||||
struct net_buf *buf;
|
||||
|
@ -88,7 +88,7 @@ static struct net_buf *hci_rpmsg_cmd_recv(uint8_t *data, size_t remaining)
|
|||
return buf;
|
||||
}
|
||||
|
||||
static struct net_buf *hci_rpmsg_acl_recv(uint8_t *data, size_t remaining)
|
||||
static struct net_buf *hci_ipc_acl_recv(uint8_t *data, size_t remaining)
|
||||
{
|
||||
struct bt_hci_acl_hdr *hdr = (void *)data;
|
||||
struct net_buf *buf;
|
||||
|
@ -125,7 +125,7 @@ static struct net_buf *hci_rpmsg_acl_recv(uint8_t *data, size_t remaining)
|
|||
return buf;
|
||||
}
|
||||
|
||||
static struct net_buf *hci_rpmsg_iso_recv(uint8_t *data, size_t remaining)
|
||||
static struct net_buf *hci_ipc_iso_recv(uint8_t *data, size_t remaining)
|
||||
{
|
||||
struct bt_hci_iso_hdr *hdr = (void *)data;
|
||||
struct net_buf *buf;
|
||||
|
@ -162,28 +162,28 @@ static struct net_buf *hci_rpmsg_iso_recv(uint8_t *data, size_t remaining)
|
|||
return buf;
|
||||
}
|
||||
|
||||
static void hci_rpmsg_rx(uint8_t *data, size_t len)
|
||||
static void hci_ipc_rx(uint8_t *data, size_t len)
|
||||
{
|
||||
uint8_t pkt_indicator;
|
||||
struct net_buf *buf = NULL;
|
||||
size_t remaining = len;
|
||||
|
||||
LOG_HEXDUMP_DBG(data, len, "RPMSG data:");
|
||||
LOG_HEXDUMP_DBG(data, len, "IPC data:");
|
||||
|
||||
pkt_indicator = *data++;
|
||||
remaining -= sizeof(pkt_indicator);
|
||||
|
||||
switch (pkt_indicator) {
|
||||
case HCI_RPMSG_CMD:
|
||||
buf = hci_rpmsg_cmd_recv(data, remaining);
|
||||
case HCI_IPC_CMD:
|
||||
buf = hci_ipc_cmd_recv(data, remaining);
|
||||
break;
|
||||
|
||||
case HCI_RPMSG_ACL:
|
||||
buf = hci_rpmsg_acl_recv(data, remaining);
|
||||
case HCI_IPC_ACL:
|
||||
buf = hci_ipc_acl_recv(data, remaining);
|
||||
break;
|
||||
|
||||
case HCI_RPMSG_ISO:
|
||||
buf = hci_rpmsg_iso_recv(data, remaining);
|
||||
case HCI_IPC_ISO:
|
||||
buf = hci_ipc_iso_recv(data, remaining);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -220,7 +220,7 @@ static void tx_thread(void *p1, void *p2, void *p3)
|
|||
}
|
||||
}
|
||||
|
||||
static void hci_rpmsg_send(struct net_buf *buf, bool is_fatal_err)
|
||||
static void hci_ipc_send(struct net_buf *buf, bool is_fatal_err)
|
||||
{
|
||||
uint8_t pkt_indicator;
|
||||
uint8_t retries = 0;
|
||||
|
@ -232,13 +232,13 @@ static void hci_rpmsg_send(struct net_buf *buf, bool is_fatal_err)
|
|||
|
||||
switch (bt_buf_get_type(buf)) {
|
||||
case BT_BUF_ACL_IN:
|
||||
pkt_indicator = HCI_RPMSG_ACL;
|
||||
pkt_indicator = HCI_IPC_ACL;
|
||||
break;
|
||||
case BT_BUF_EVT:
|
||||
pkt_indicator = HCI_RPMSG_EVT;
|
||||
pkt_indicator = HCI_IPC_EVT;
|
||||
break;
|
||||
case BT_BUF_ISO_IN:
|
||||
pkt_indicator = HCI_RPMSG_ISO;
|
||||
pkt_indicator = HCI_IPC_ISO;
|
||||
break;
|
||||
default:
|
||||
LOG_ERR("Unknown type %u", bt_buf_get_type(buf));
|
||||
|
@ -295,8 +295,8 @@ void bt_ctlr_assert_handle(char *file, uint32_t line)
|
|||
|
||||
buf = hci_vs_err_assert(file, line);
|
||||
if (buf == NULL) {
|
||||
/* Send the event over rpmsg */
|
||||
hci_rpmsg_send(buf, HCI_FATAL_ERR_MSG);
|
||||
/* Send the event over ipc */
|
||||
hci_ipc_send(buf, HCI_FATAL_ERR_MSG);
|
||||
} else {
|
||||
LOG_ERR("Can't create Fatal Error HCI event: %s at %d", __FILE__, __LINE__);
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *esf)
|
|||
|
||||
buf = hci_vs_err_stack_frame(reason, esf);
|
||||
if (buf != NULL) {
|
||||
hci_rpmsg_send(buf, HCI_FATAL_ERR_MSG);
|
||||
hci_ipc_send(buf, HCI_FATAL_ERR_MSG);
|
||||
} else {
|
||||
LOG_ERR("Can't create Fatal Error HCI event.\n");
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ static void hci_ept_bound(void *priv)
|
|||
static void hci_ept_recv(const void *data, size_t len, void *priv)
|
||||
{
|
||||
LOG_INF("Received message of %u bytes.", len);
|
||||
hci_rpmsg_rx((uint8_t *) data, len);
|
||||
hci_ipc_rx((uint8_t *) data, len);
|
||||
}
|
||||
|
||||
static struct ipc_ept_cfg hci_ept_cfg = {
|
||||
|
@ -378,7 +378,7 @@ int main(void)
|
|||
{
|
||||
int err;
|
||||
const struct device *hci_ipc_instance =
|
||||
DEVICE_DT_GET(DT_CHOSEN(zephyr_bt_hci_rpmsg_ipc));
|
||||
DEVICE_DT_GET(DT_CHOSEN(zephyr_bt_hci_ipc));
|
||||
|
||||
/* incoming events and data from the controller */
|
||||
static K_FIFO_DEFINE(rx_queue);
|
||||
|
@ -394,7 +394,7 @@ int main(void)
|
|||
k_thread_create(&tx_thread_data, tx_thread_stack,
|
||||
K_THREAD_STACK_SIZEOF(tx_thread_stack), tx_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);
|
||||
k_thread_name_set(&tx_thread_data, "HCI rpmsg TX");
|
||||
k_thread_name_set(&tx_thread_data, "HCI ipc TX");
|
||||
|
||||
/* Initialize IPC service instance and register endpoint. */
|
||||
err = ipc_service_open_instance(hci_ipc_instance);
|
||||
|
@ -413,7 +413,7 @@ int main(void)
|
|||
struct net_buf *buf;
|
||||
|
||||
buf = net_buf_get(&rx_queue, K_FOREVER);
|
||||
hci_rpmsg_send(buf, HCI_REGULAR_MSG);
|
||||
hci_ipc_send(buf, HCI_REGULAR_MSG);
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
cmake_minimum_required(VERSION 3.20.0)
|
||||
|
||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||
project(hci_rpmsg)
|
||||
|
||||
target_sources(app PRIVATE src/main.c)
|
|
@ -45,9 +45,9 @@ Refer to your :ref:`board's documentation <boards>` for alternative
|
|||
flash instructions if your board doesn't support the ``flash`` target.
|
||||
|
||||
To run the application on an :ref:`nrf5340dk_nrf5340`, a Bluetooth controller application
|
||||
must also run on the network core. The :ref:`bluetooth-hci-rpmsg-sample` sample
|
||||
must also run on the network core. The :ref:`bluetooth-hci-ipc-sample` sample
|
||||
application may be used. Build this sample with configuration
|
||||
:zephyr_file:`samples/bluetooth/hci_rpmg/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf`
|
||||
:zephyr_file:`samples/bluetooth/hci_ipc/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf`
|
||||
to enable mesh support.
|
||||
|
||||
Interacting with the sample
|
||||
|
|
|
@ -56,7 +56,7 @@ Refer to your :ref:`board's documentation <boards>` for alternative
|
|||
flash instructions if your board doesn't support the ``flash`` target.
|
||||
|
||||
To run the application on an :ref:`nrf5340dk_nrf5340`, a Bluetooth controller application
|
||||
must also run on the network core. The :ref:`bluetooth-hci-rpmsg-sample` sample
|
||||
must also run on the network core. The :ref:`bluetooth-hci-ipc-sample` sample
|
||||
application may be used. Build this sample with configuration
|
||||
:zephyr_file:`samples/bluetooth/hci_rpmg/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf`
|
||||
:zephyr_file:`samples/bluetooth/hci_ipc/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf`
|
||||
to enable mesh support.
|
||||
|
|
|
@ -54,7 +54,7 @@ Refer to your :ref:`board's documentation <boards>` for alternative
|
|||
flash instructions if your board doesn't support the ``flash`` target.
|
||||
|
||||
To run the application on an :ref:`nrf5340dk_nrf5340`, a Bluetooth controller application
|
||||
must also run on the network core. The :ref:`bluetooth-hci-rpmsg-sample` sample
|
||||
must also run on the network core. The :ref:`bluetooth-hci-ipc-sample` sample
|
||||
application may be used. Build this sample with configuration
|
||||
:zephyr_file:`samples/bluetooth/hci_rpmg/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf`
|
||||
:zephyr_file:`samples/bluetooth/hci_ipc/nrf5340_cpunet_bt_mesh-bt_ll_sw_split.conf`
|
||||
to enable mesh support.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue