Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Bluetooth HCI APIs

Bluetooth HCI APIs . More...

Data Structures

struct  bt_hci_setup_params
 
struct  bt_hci_driver_api
 

Macros

#define BT_DT_HCI_QUIRK_OR(node_id, prop, idx)
 
#define BT_DT_HCI_QUIRKS_GET(node_id)
 
#define BT_DT_HCI_QUIRKS_INST_GET(inst)
 
#define BT_DT_HCI_NAME_GET(node_id)
 
#define BT_DT_HCI_NAME_INST_GET(inst)
 
#define BT_DT_HCI_BUS_GET(node_id)
 
#define BT_DT_HCI_BUS_INST_GET(inst)
 

Typedefs

typedef int(* bt_hci_recv_t) (const struct device *dev, struct net_buf *buf)
 

Enumerations

enum  { BT_HCI_QUIRK_NO_RESET = BIT(0) , BT_HCI_QUIRK_NO_AUTO_DLE = BIT(1) }
 
enum  bt_hci_bus {
  BT_HCI_BUS_VIRTUAL = 0 , BT_HCI_BUS_USB = 1 , BT_HCI_BUS_PCCARD = 2 , BT_HCI_BUS_UART = 3 ,
  BT_HCI_BUS_RS232 = 4 , BT_HCI_BUS_PCI = 5 , BT_HCI_BUS_SDIO = 6 , BT_HCI_BUS_SPI = 7 ,
  BT_HCI_BUS_I2C = 8 , BT_HCI_BUS_SMD = 9 , BT_HCI_BUS_VIRTIO = 10 , BT_HCI_BUS_IPC = 11 ,
  BT_HCI_BUS_IPM = BT_HCI_BUS_IPC
}
 Possible values for the 'bus' member of the bt_hci_driver struct. More...
 

Functions

static int bt_hci_open (const struct device *dev, bt_hci_recv_t recv)
 Open the HCI transport.
 
static int bt_hci_close (const struct device *dev)
 Close the HCI transport.
 
static int bt_hci_send (const struct device *dev, struct net_buf *buf)
 Send HCI buffer to controller.
 
static int bt_hci_setup (const struct device *dev, struct bt_hci_setup_params *params)
 HCI vendor-specific setup.
 

Detailed Description

Bluetooth HCI APIs .

Since
3.7
Version
0.2.0

Macro Definition Documentation

◆ BT_DT_HCI_BUS_GET

#define BT_DT_HCI_BUS_GET ( node_id)

#include <zephyr/drivers/bluetooth.h>

Value:
UTIL_CAT(BT_HCI_BUS_, DT_STRING_UPPER_TOKEN_OR(node_id, bt_hci_bus, VIRTUAL))
bt_hci_bus
Possible values for the 'bus' member of the bt_hci_driver struct.
Definition bluetooth.h:62
#define DT_STRING_UPPER_TOKEN_OR(node_id, prop, default_value)
Like DT_STRING_UPPER_TOKEN(), but with a fallback to default_value.
Definition devicetree.h:1189
#define UTIL_CAT(a,...)
Definition util_internal.h:104

◆ BT_DT_HCI_BUS_INST_GET

#define BT_DT_HCI_BUS_INST_GET ( inst)

#include <zephyr/drivers/bluetooth.h>

Value:
#define BT_DT_HCI_BUS_GET(node_id)
Definition bluetooth.h:92
#define DT_DRV_INST(inst)
Node identifier for an instance of a DT_DRV_COMPAT compatible.
Definition devicetree.h:3809

◆ BT_DT_HCI_NAME_GET

#define BT_DT_HCI_NAME_GET ( node_id)

#include <zephyr/drivers/bluetooth.h>

Value:
DT_PROP_OR(node_id, bt_hci_name, "HCI")
#define DT_PROP_OR(node_id, prop, default_value)
Like DT_PROP(), but with a fallback to default_value.
Definition devicetree.h:914

◆ BT_DT_HCI_NAME_INST_GET

#define BT_DT_HCI_NAME_INST_GET ( inst)

#include <zephyr/drivers/bluetooth.h>

Value:
#define BT_DT_HCI_NAME_GET(node_id)
Definition bluetooth.h:89

◆ BT_DT_HCI_QUIRK_OR

#define BT_DT_HCI_QUIRK_OR ( node_id,
prop,
idx )

#include <zephyr/drivers/bluetooth.h>

Value:
UTIL_CAT(BT_HCI_QUIRK_, DT_STRING_UPPER_TOKEN_BY_IDX(node_id, prop, idx))
#define DT_STRING_UPPER_TOKEN_BY_IDX(node_id, prop, idx)
Like DT_STRING_TOKEN_BY_IDX(), but uppercased.
Definition devicetree.h:1351

◆ BT_DT_HCI_QUIRKS_GET

#define BT_DT_HCI_QUIRKS_GET ( node_id)

#include <zephyr/drivers/bluetooth.h>

Value:
COND_CODE_1(DT_NODE_HAS_PROP(node_id, bt_hci_quirks), \
bt_hci_quirks, \
(|))), \
(0))
#define BT_DT_HCI_QUIRK_OR(node_id, prop, idx)
Definition bluetooth.h:79
#define DT_NODE_HAS_PROP(node_id, prop)
Does a devicetree node have a property?
Definition devicetree.h:3684
#define DT_FOREACH_PROP_ELEM_SEP(node_id, prop, fn, sep)
Invokes fn for each element in the value of property prop with separator.
Definition devicetree.h:3267
#define COND_CODE_1(_flag, _if_1_code, _else_code)
Insert code depending on whether _flag expands to 1 or not.
Definition util_macro.h:195

◆ BT_DT_HCI_QUIRKS_INST_GET

#define BT_DT_HCI_QUIRKS_INST_GET ( inst)

#include <zephyr/drivers/bluetooth.h>

Value:
#define BT_DT_HCI_QUIRKS_GET(node_id)
Definition bluetooth.h:81

Typedef Documentation

◆ bt_hci_recv_t

typedef int(* bt_hci_recv_t) (const struct device *dev, struct net_buf *buf)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

#include <zephyr/drivers/bluetooth.h>

Enumerator
BT_HCI_QUIRK_NO_RESET 
BT_HCI_QUIRK_NO_AUTO_DLE 

◆ bt_hci_bus

enum bt_hci_bus

#include <zephyr/drivers/bluetooth.h>

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

Enumerator
BT_HCI_BUS_VIRTUAL 
BT_HCI_BUS_USB 
BT_HCI_BUS_PCCARD 
BT_HCI_BUS_UART 
BT_HCI_BUS_RS232 
BT_HCI_BUS_PCI 
BT_HCI_BUS_SDIO 
BT_HCI_BUS_SPI 
BT_HCI_BUS_I2C 
BT_HCI_BUS_SMD 
BT_HCI_BUS_VIRTIO 
BT_HCI_BUS_IPC 
BT_HCI_BUS_IPM 

Function Documentation

◆ bt_hci_close()

static int bt_hci_close ( const struct device * dev)
inlinestatic

#include <zephyr/drivers/bluetooth.h>

Close the HCI transport.

Closes the HCI transport. This function must not return until the transport is closed.

Parameters
devHCI device
Returns
0 on success or negative POSIX error number on failure.

◆ bt_hci_open()

static int bt_hci_open ( const struct device * dev,
bt_hci_recv_t recv )
inlinestatic

#include <zephyr/drivers/bluetooth.h>

Open the HCI transport.

Opens the HCI transport for operation. This function must not return until the transport is ready for operation, meaning it is safe to start calling the send() handler.

Parameters
devHCI device
recvThis is callback through which the HCI driver provides the host with data from the controller. The buffer passed to the callback will have its type set with bt_buf_set_type(). The callback is expected to be called from thread context.
Returns
0 on success or negative POSIX error number on failure.

◆ bt_hci_send()

static int bt_hci_send ( const struct device * dev,
struct net_buf * buf )
inlinestatic

#include <zephyr/drivers/bluetooth.h>

Send HCI buffer to controller.

Send an HCI packet to the controller. The packet type of the buffer must be set using bt_buf_set_type().

Note
This function must only be called from a cooperative thread.
Parameters
devHCI device
bufBuffer containing data to be sent to the controller.
Returns
0 on success or negative POSIX error number on failure.

◆ bt_hci_setup()

static int bt_hci_setup ( const struct device * dev,
struct bt_hci_setup_params * params )
inlinestatic

#include <zephyr/drivers/bluetooth.h>

HCI vendor-specific setup.

Executes vendor-specific commands sequence to initialize BT Controller before BT Host executes Reset sequence. This is normally called directly after bt_hci_open().

Note
CONFIG_BT_HCI_SETUP 
must be selected for this field to be available.
Returns
0 on success or negative POSIX error number on failure.