Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

HCI drivers. More...

Data Structures

struct  bt_hci_setup_params
 
struct  bt_hci_driver
 Abstraction which represents the HCI transport to the controller. More...
 

Enumerations

enum  { BT_QUIRK_NO_RESET = BIT(0) , BT_QUIRK_NO_AUTO_DLE = BIT(1) }
 
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
}
 Possible values for the 'bus' member of the bt_hci_driver struct. More...
 

Functions

int bt_recv (struct net_buf *buf)
 Receive data from the controller/HCI driver.
 
int bt_hci_driver_register (const struct bt_hci_driver *drv)
 Register a new HCI driver to the Bluetooth stack.
 
int bt_hci_transport_setup (const struct device *dev)
 Setup the HCI transport, which usually means to reset the Bluetooth IC.
 
int bt_hci_transport_teardown (const struct device *dev)
 Teardown the HCI transport.
 
struct net_bufbt_hci_evt_create (uint8_t evt, uint8_t len)
 Allocate an HCI event buffer.
 
struct net_bufbt_hci_cmd_complete_create (uint16_t op, uint8_t plen)
 Allocate an HCI Command Complete event buffer.
 
struct net_bufbt_hci_cmd_status_create (uint16_t op, uint8_t status)
 Allocate an HCI Command Status event buffer.
 

Detailed Description

HCI drivers.

Deprecated
This is the old HCI driver API. Drivers should use Bluetooth HCI APIs instead.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

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

Enumerator
BT_QUIRK_NO_RESET 
BT_QUIRK_NO_AUTO_DLE 

◆ bt_hci_driver_bus

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

Possible values for the 'bus' member of the bt_hci_driver struct.

Enumerator
BT_HCI_DRIVER_BUS_VIRTUAL 
BT_HCI_DRIVER_BUS_USB 
BT_HCI_DRIVER_BUS_PCCARD 
BT_HCI_DRIVER_BUS_UART 
BT_HCI_DRIVER_BUS_RS232 
BT_HCI_DRIVER_BUS_PCI 
BT_HCI_DRIVER_BUS_SDIO 
BT_HCI_DRIVER_BUS_SPI 
BT_HCI_DRIVER_BUS_I2C 
BT_HCI_DRIVER_BUS_IPM 

Function Documentation

◆ bt_hci_cmd_complete_create()

struct net_buf * bt_hci_cmd_complete_create ( uint16_t op,
uint8_t plen )

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

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.

Parameters
opCommand OpCode.
plenLength of command parameters.
Returns
Newly allocated buffer.

◆ bt_hci_cmd_status_create()

struct net_buf * bt_hci_cmd_status_create ( uint16_t op,
uint8_t status )

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

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.

Parameters
opCommand OpCode.
statusStatus code.
Returns
Newly allocated buffer.

◆ bt_hci_driver_register()

int bt_hci_driver_register ( const struct bt_hci_driver * drv)

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

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.

Parameters
drvA bt_hci_driver struct representing the driver.
Returns
0 on success or negative error number on failure.
Deprecated
Use the new HCI driver interface instead: Bluetooth HCI APIs

◆ bt_hci_evt_create()

struct net_buf * bt_hci_evt_create ( uint8_t evt,
uint8_t len )

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

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.

Parameters
evtEvent OpCode.
lenLength of event parameters.
Returns
Newly allocated buffer.

◆ bt_hci_transport_setup()

int bt_hci_transport_setup ( const struct device * dev)

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

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.
Parameters
devThe device structure for the bus connecting to the IC
Returns
0 on success, negative error value on failure

◆ bt_hci_transport_teardown()

int bt_hci_transport_teardown ( const struct device * dev)

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

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.
Parameters
devThe device structure for the bus connecting to the IC
Returns
0 on success, negative error value on failure

◆ bt_recv()

int bt_recv ( struct net_buf * buf)

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

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.

Parameters
bufNetwork buffer containing data from the controller.
Returns
0 on success or negative error number on failure.
Deprecated
Use the new HCI driver interface instead: Bluetooth HCI APIs