Commit Graph

211 Commits

Author SHA1 Message Date
Erwan Gouriou ec37ced258 drivers: bluetooth: stm32wb: Cleanup unused definition
This definition is not used anymore, clean it.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-09 12:31:16 +02:00
Erwan Gouriou 946304e799 drivers: bluetooth: stm32wb: Put HCI messages under CONFIG_BT_HCI_HOST
HCI message sending in this hci driver as these actions require hci_host
to be available and could be performed by the remote host if required.
Explicit this dependency using CONFIG_BT_HCI_HOST.
This is is required to be able to compile BT_HCI_RAW mode.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-09 12:31:16 +02:00
Erwan Gouriou 41422f99fe drivers: bluetooth: hci: stm32wb: Take advantage of host drivern reset
Don't perform HCI reset in the driver but get the host to perform it.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-09 12:31:16 +02:00
Kamil Gawor e6da6e9133 drivers: bluetooth: hci: Add BT_HAS_HCI_VS selection for RPMSG.
Add explicit selection of the BT_HAS_HCI_VS for
the BT_RPMSG HCI driver. When the HCI over RPMSG
is used this dependency will not be solved automatically.
It is required to handle correctly Bluetooth identity
initialization.

Signed-off-by: Kamil Gawor <Kamil.Gawor@nordicsemi.no>
2022-08-02 09:13:12 +02:00
Kumar Gala fbc0289733 drivers: bluetooth: hci: spi: Replace DT_INST_LABEL
As we phase out label properties from devicetree the devicetree
node may not have a label so utilize DEVICE_DT_NAME instead
which will use a label if it exists and the node name if not.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-28 20:50:38 +02:00
Freddie Yang eca27824f3 drivers: fix race condition in SPI-based HCI driver
Give the semaphore after transceiving the message.

Signed-off-by: Freddie Yang <freddie.yang325@outlook.com>
2022-07-19 10:31:36 +02:00
Tomislav Milkovic 0fe2c1fe90 everywhere: Fix legacy include paths
Any project with Kconfig option CONFIG_LEGACY_INCLUDE_PATH set to n
couldn't be built because some files were missing zephyr/ prefix in
includes
Re-run the migrate_includes.py script to fix all legacy include paths

Signed-off-by: Tomislav Milkovic <milkovic@byte-lab.com>
2022-07-18 16:16:47 +00:00
Yuriy Vynnychek cca221e928 drivers: bluetooth: hci: introduce new Telink B91 HCI driver
Telink B91 Bluetooth HCI driver basic support.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-06-05 14:45:10 +02:00
Fabio Baltieri e24314f10f include: add more missing zephyr/ prefixes
Adds few missing zephyr/ prefixes to leftover #include statements that
either got added recently or were using double quote format.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-05-27 15:20:27 -07:00
Gerard Marull-Paretas fb60aab245 drivers: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:21 +02:00
Kamil Piszczek d87552a128 drivers: bluetooth: hci: rpmsg: use chosen to abstract ipc instance
Added chosen syntax in Device Tree to abstract the IPC device that is
used with the IPC service module in the Bluetooth HCI RPMsg driver.
Ported affected boards to declare this alias.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2022-05-06 14:15:27 +02:00
Benedikt Schmidt 86469b1d0b drivers: clock_control: Make LSE driving configurable
Make the LSE driving capability configurable for the STM32 series.
Fixes #44737.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2022-04-29 16:11:34 +02:00
Lingao Meng 37e561f42e Bluetooth: Host: Add choice select whether BT RX
Change CONFIG_BT_RECV_IS_RX_THREAD into a
choice:CONFIG_BT_RECV_CONTEXT with the following options
(names can be discussed further of course):

    CONFIG_BT_RECV_BLOCKING
    CONFIG_BT_RECV_WORKQ_BT
    CONFIG_BT_RECV_WORKQ_SYS

This way users would be able to choose what to run most of
the BLE stack on, they wouldn't be forced to a single model.

We would default to CONFIG_BT_RECV_BLOCKING so that we wouldn't
need to change the system workqueue stack size by default, instead
asking users to do so if they select the CONFIG_BT_RECV_WORKQ_SYS option

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2022-04-11 10:58:09 +02:00
Emil Obalski d877e1dded ipc_service: Automatically include source files for backends
The purpose of this change is to allow to enable more than one
backend at once by removing choice from ipc-service backend Kconfig
and depending backend Kconfig option on existing of correct compatible.

Overwriting IPC_SERVICE_BACKEND option in some places is removes
as no longer needed.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2022-03-29 12:30:50 -07:00
Alexandre Bourdiol 2c4d55042c drivers: bluetooth: hci: BlueNRG-MS: Hold on CS
In case of BlueNRG-MS, it is necessary to prevent SPI driver to release CS,
and instead, let current driver manage CS release.
So, add SPI_HOLD_ON_CS to operation field

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2022-03-24 10:44:15 +01:00
Alexandre Bourdiol 8538b835f3 drivers: bluetooth: hci: use logic (and not pin value) kick/release CS
Use logic (and not pin value) for kick_cs() and release_cs()
because potential pin value invertion (Active LOW)
is handled in gpio_pin_set()

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2022-03-24 10:44:15 +01:00
Jonathan Rico f4ea0651ac Bluetooth: hci: rpmsg: do not drop hci buffers
This fixes an issue where we would drop the hci event if allocation from
the hci event buffer pool didn't immediately succeed.

The behavior is now to block on allocation, and warn the user every 10
seconds.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2022-03-23 12:54:26 +01:00
Nazar Kazakov 9713f0d47c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-14 20:22:24 -04:00
Erwan Gouriou 3a041ca5c8 drivers/bluetooth: stm32wb: Allow sequential C2 start
Set up a c2_reset procedure in order to allow sequential
open/close/open calls and keep c2_reset done at init (required
for flash access).
Move reinit out of the reset procedure, so flash could be
accessed after bt_disable().

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-10 13:28:41 -05:00
Erwan Gouriou 045c986314 drivers/bluetooth/hci: stm32wb: Implement close api
Add treatment for close api.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-10 13:28:41 -05:00
Erwan Gouriou 49b15c8306 drivers/bluetooth/hci: stm32wb: Move RX thread creation to open
In order to enable RX thread abortion on close, move creation
to from init to open.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-10 13:28:41 -05:00
Gerard Marull-Paretas 95fb0ded6b kconfig: remove Enable from boolean prompts
According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:

sed -i "s/bool \"[Ee]nables\? \(\w\)/bool \"\U\1/g" **/Kconfig*

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Erwan Gouriou ceb8579854 include/drivers/clock_control: stm32: Add XXX_ENABLED and XXX_FREQ
Add STM32_FOO_ENABLED and STM32_FOO_FREQ to STM32 fixed clocks:
HSI, HSE, MSI(S), CSI, LSI, LSE..

Replace STM32_LSE_CLOCK by STM32_LSE_FREQ and when possible
replace by new STM32_LSE_ENABLED when making sense.

Fix STM32_PLL3_FOO_ENABLE to STM32_PLL3_FOO_ENABLED

Additionally, add STM32_PLL_FOO_ENABLED definitions.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-07 11:36:28 +01:00
Kamil Piszczek cf6a58d3f6 bluetooth: hci: rpmsg: use ipc service library
The Bluetooth HCI driver based on the RPMsg transport now uses the IPC
service module. The compatible Bluetooth sample - HCI RPMsg - has also
been migrated to the new IPC solution.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2022-03-02 17:03:01 +01:00
Gerard Marull-Paretas b61df8281c drivers: bluetooth: hci: spi: use gpio_dt_spec
Simplify driver implementation by using gpio_dt_spec.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Gerard Marull-Paretas cc85c6c518 drivers: bluetooth: hci: spi: use spi_dt_spec
Use spi_dt_spec to simplify driver implementation.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:16:10 -05:00
Nazar Palamar 29eec8b3f7 Bluetooth: H4: added support for HCI vendor-specific Setup feature.
Updated H4 driver to initialize setup function. Finally bt_h4_vnd_setup
function must be implemented in vendor-specific HCI extension module if
CONFIG_BT_HCI_SETUP is enabled.

BT_HCI_SETUP feature is useful when the BT Controller requires execution
of the vendor-specific commands sequence to initialize the BT Controller
before the BT Host executes a Reset sequence.
To enable this feature the CONFIG_BT_HCI_SETUP should be enable.

Fixes #41140

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2022-01-21 15:04:15 +02:00
Nazar Palamar c77a546f14 Bluetooth: hci: added HCI vendor-specific Setup function feature
- Added config BT_HCI_SETUP to enable HCI vendor-specific Setup feature,
- Added pointer to 'setup' function in bt_hci_driver structure.

BT_HCI_SETUP feature is useful when the BT Controller requires execution
of the vendor-specific commands sequence to initialize the BT Controller
before the BT Host executes a Reset sequence. To enable this feature the
CONFIG_BT_HCI_SETUP should be enable.

Fixes #41140

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2022-01-21 15:04:15 +02:00
Herman Berget 6ede31428d Bluetooth: Host: Reassemble extended advertising reports
The host reassembles fragmented advertising reports from the controller.

Non-complete advertising reports from different advertisers may not be
interleaved. If non-complete advertising reports from an advertiser
is received while advertising reports from another advertiser is
reassembled, an error message is logged and the advertising report is
discarded. Future scan results may be incomplete.

Advertising reports from legacy PDUs or complete extended advertising
reports may be interleaved as these do not require reassembly.

If the controller sends more advertising data than fits in the
reassembly buffer, the data is truncated. Further advertising reports
from the advertiser are discarded until the final complete advertising
report is received and discarded.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-01-07 15:35:39 +02:00
Emil Gydesen 0921979adc Bluetooth: Drivers: Fix bad return for bt_esp_evt_recv
Instead of returning NULL, the function had a `continue`.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-01-04 10:09:51 -05:00
Emil Gydesen b988c803f6 Bluetooth: drivers: Add length checks before net_buf_add_mem
Add length checks before calls to net_buf_add_mem
for dynamically sized data.

This should give a better error response than hitting
the __ASSERT in net_buf_simple_add.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-12-24 20:50:03 -05:00
Carles Cufi 02cee09308 drivers: bluetooth: spi: Check lengths in incoming headers
So far the lengths provided in event and ACL packets were not being
checked at all, which could have caused an overflow if the contents were
not to fit inside the net_buf.
Check the length and discard the packet when it doesn't fit.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-20 15:24:02 +01:00
Tomasz Bursztyka f6be2835bd drivers: Apply SPI API change to relevant places
Mostly drivers, but also one sample and one test.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-11-19 11:50:38 +01:00
Emil Gydesen 12decc70d0 Bluetooth: ISO: Add bitmask for retrieving iso header lenght
Add a macro to retrieve the iso data load length (the
length stored in the iso header) with a bit mask that
ensures that we only take the first 14 bits.

This is to remove any RFU bits that may have been set.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-11-12 14:52:33 +01:00
Johan Hedberg 224468f35b Bluetooth: drivers: h4: Fix uart_fifo_fill return value handling
The return value of uart_fifo_fill could potentially be negative, so
make sure the code doesn't do anything bad in that case.

Fixes #39823

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-11-10 14:17:50 +01:00
Johan Hedberg cc2d5f8a45 Bluetooth: drivers: h4: Fix uart_fifo_read return value handling
Make sure negative error returns from uart_fifo_read() are correctly
handled.

In the same go, the logic of reading packet headers (ACL/event/ISO) is
refactored into its own helper function. This also fixes having an
appropriate name for the variable that tracks how many header bytes have
already been read (it was called "to_read" and now it's called
"bytes_read").

Fixes #39805

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-11-10 14:17:50 +01:00
Torsten Rasmussen 9a2be89557 kconfig: bluetooth: experimental settings now uses select EXPERIMENTAL
With the introduction of `EXPERIMENTAL` and `WARN_EXPERIMENTAL` in
Zephyr all subsys/bluetooth and drivers/bluetooth/hci settings having
`[EXPERIMENTAL]` in their prompt has has been updated to include
`select EXPERIMENTAL` so that developers can enable warnings when
experimental features are enabled.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-10-22 13:59:21 +02:00
Johann Fischer 9ad610d1a7 bluetooth: remove Kconfig options CONFIG_BT_*_ON_DEV_NAME
Follow up on commit bfd45e5b8c
("drivers: remove Kconfig option CONFIG_UART_CONSOLE_ON_DEV_NAME")
Remove Kconfig options
CONFIG_BT_UART_ON_DEV_NAME and CONFIG_BT_MONITOR_ON_DEV_NAME
since all UART drivers are converted to devicetree and we can just use
DEVICE_DT_GET(DT_CHOSEN(zephyr_bt_uart)) and
DEVICE_DT_GET(DT_CHOSEN(zephyr_bt_mon_uart)).

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-25 18:05:17 -04:00
Alexandre Bourdiol 29d1e90a8d drivers: bluetooth: hci: ipm_stm32wb: macro renamed CFG_BLE_OPTIONS
Adapt to stm32hal stm32wb cube update v1.12.0

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-08-24 22:14:20 -04:00
Daniel Leung 378ad046c8 drivers: bluetooth: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Note that the include to subsys/bluetooth has been
moved from under drivers/bluetooth to subsys/bluetooth,
as it is actually the subsystem's job to make sure
the include directories are correct.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
Martin Jäger ecef16aa86 bluetooth: hci: esp32: Fix DBG logging
The log level was always set to debug. Defining BT_DBG_ENABLED same
as for other bluetooth files allows to switch off debug log messages.

Signed-off-by: Martin Jäger <martin@libre.solar>
2021-08-16 11:44:10 +02:00
Felipe Neves 2474c9b3f3 soc: riscv: esp32c3: added initial support for ble
subsystem by linking esp32 vhci adapter to the
espressif ble controller adapter

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-08-07 19:59:27 -04:00
Francois Ramu 2790d2ac4c drivers: bluetooth: hci driver for stm32wb includes clock control
The definition of the STM32_LSE_CLOCK is given by the
drivers/clock_control/stm32_clock_control.h
to the hci/ipm_stm32wb driver

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-06-18 07:59:48 -05:00
Casper Bonde afe469eac7 Bluetooth: ISO: Speed up BT ISO data processing
For the native posix build the sleep calls used in tasks will stall
the zephyr instance which sets an upper limit on the data processing
interval to once every 20-30 millisecond.
This change reduces the duration of the sleep calls and increases the
TICKS_PER_SECOND to allow for shorter sleeps. This is needed to
support the data rates needed for LE Audio streaming. The rate is
tuned to support up to bidirectional 5ms ISO-intervals.
This change also increases the ISO buffer count from 1 to 5 to
allow for some buffering in the controller, which is needed for
gapless playback and/or use of burst number larger than 1.

Signed-off-by: Casper Bonde <casper_bonde@bose.com>
2021-05-27 13:16:40 +02:00
Alexandre Bourdiol c3d35d89a3 drivers: bluetooth: hci: increase spi_rx_stack
Thread analyze:
 BT SPI RX : STACK: unused 216 usage 296 / 512 (57 %)

Fixes #34601

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2021-05-13 22:07:45 -04:00
Joakim Andersson 597080204e drivers: Bluetooth: Update H5 driver to new delayable work API.
Update the Bluetooth H5 driver to use the new delayable work API.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-05-05 19:44:09 -04:00
Sylvio Alves a3c35c93ff driver: esp32: add bluetooth support
Add support to BLE and BR/EDR feature.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-04-30 16:51:30 -04:00
Erwan Gouriou 2691541ad2 drivers/clock_controller: stm32: Prepare for dts based configuration
To allow transition to device tree based clock configuration on
stm32 targets, rework clock_control driver to use intermediate
STM32_ macros initially defined as the equivalent Kconfig macros
for now.
Propagate the change in all code using these macros.

The reason to introduce these new macros instead of configuring
Kconfig flags using dt kconfigfunctions is that we'll need
to be able to inform users that Kconfig flags are deprecated
once the whole family conversion is done, to encourage
out of tree users to adopt this new configuration scheme.

Note: For now STM32H7 series and code is excluded.
This is the same for some series specific code such as
PLL mul/div for L0/L1 and XTRE prescaler on F1 series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-27 11:53:37 +02:00
Pete Skeggs ecfda097d1 bluetooth: hci: h4: Add thread name
Add a name to the h4 rx thread.

It's useful to put a name on each thread for debugging, e.g., with the
shell's kernel threads command.

Signed-off-by: Pete Skeggs <peter.skeggs@nordicsemi.no>
2021-03-04 13:17:02 +01:00
Hubert Miś 5548917e69 bluetooth: hci: rpmsg: Use RPMsg Service
This patch modifies Bluetooth HCI RPMsg drivers and samples to use
RPMsg Service instead of configuring OpenAMP directly in the driver
or the sample.

Co-authored-by: Piotr Szkotak <piotr.szkotak@nordicsemi.no>
Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
2021-01-19 22:07:09 +01:00