Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Bluetooth H:4 UART driver vendor extension interface

Bluetooth H:4 UART driver vendor extension interface. More...

Functions

int bt_h4_vnd_open (const struct device *dev, const struct device *uart, struct bt_hci_lockstep *ls)
 Configure the controller while the H:4 transport is opened.

Detailed Description

Bluetooth H:4 UART driver vendor extension interface.

Since
4.5
Version
0.1.0

Functions that a vendor extension of the H:4 UART driver implements, in addition to bt_hci_transport_setup() and bt_hci_transport_teardown(), which any board or extension may implement.

Function Documentation

◆ bt_h4_vnd_open()

int bt_h4_vnd_open ( const struct device * dev,
const struct device * uart,
struct bt_hci_lockstep * ls )

#include <zephyr/drivers/bluetooth/h4.h>

Configure the controller while the H:4 transport is opened.

Implemented by the vendor extension that selects CONFIG_BT_H4_VND_OPEN. The H:4 driver calls it last in its open(), once it transmits and receives on the UART and has restored the initial command allowance of ls, and fails the open() with what it returns.

The extension sends its commands with bt_hci_lockstep_cmd_send_sync() on ls: the driver feeds every packet it receives to the helper, so the responses reach the extension. A command carries at most CONFIG_BT_BUF_CMD_TX_SIZE parameter bytes and a longer one fails with -EMSGSIZE, so an extension with longer commands needs that option raised, for example with a Kconfig default. The extension reads the public address to configure with bt_hci_get_public_addr(), and may reconfigure the UART, for a baud rate change the controller has acknowledged. Work that is not HCI, such as uploading a firmware image over the bare UART, belongs in bt_hci_transport_setup(), which runs before the driver takes the UART.

On failure the driver undoes its own open(); the extension leaves nothing of its own running that a later open() would trip over.

Parameters
devHCI device, for bt_hci_get_public_addr()
uartUART device of the transport, for reconfiguring it
lsLockstep helper of the transport
Return values
0The controller is configured.
Returns
Negative errno value on failure, returned by bt_hci_open().