The latest development version of this page may be more current than this released 2.1.0 version.

HCI Drivers

API Reference

group bt_hci_driver

HCI drivers.

Enums

enum [anonymous]

Values:

BT_QUIRK_NO_RESET = BIT(0)
enum bt_hci_driver_bus

Possible values for the ‘bus’ member of the bt_hci_driver struct

Values:

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

Functions

static bool bt_hci_evt_is_prio(u8_t evt)

Check if an HCI event is high priority or not.

Helper for the HCI driver to know which events are ok to be passed through the RX thread and which must be given to bt_recv_prio() from another context (e.g. ISR). If this function returns true it’s safe to pass the event through the RX thread, however if it returns false then this risks a deadlock.

Return

true if the event can be processed in the RX thread, false if it cannot.

Parameters
  • evt: HCI event code.

int bt_recv(struct net_buf *buf)

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. This API should not be used for so-called high priority HCI events, which should instead be delivered to the host stack through bt_recv_prio().

Return

0 on success or negative error number on failure.

Parameters
  • buf: Network buffer containing data from the controller.

int bt_recv_prio(struct net_buf *buf)

Receive high priority data from the controller/HCI driver.

This is the same as bt_recv(), except that it should be used for so-called high priority HCI events. There’s a separate bt_hci_evt_is_prio() helper that can be used to identify which events are high priority.

As with bt_recv(), the buffer needs to have its type set with the help of bt_buf_set_type() before calling this API. The only exception is so called high priority HCI events which should be delivered to the host stack through bt_recv_prio() instead.

Return

0 on success or negative error number on failure.

Parameters
  • buf: Network buffer containing data from the controller.

int bt_hci_driver_register(const struct bt_hci_driver *drv)

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.

Return

0 on success or negative error number on failure.

Parameters

int bt_hci_transport_setup(struct device *dev)

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.

Return

0 on success, negative error value on failure

Parameters
  • dev: The device structure for the bus connecting to the IC

struct bt_hci_driver
#include <hci_driver.h>

Abstraction which represents the HCI transport to the controller.

This struct is used to represent the HCI transport to the Bluetooth controller.