Zephyr API Documentation  3.6.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)   DT_STRING_TOKEN_BY_IDX(node_id, prop, idx)
 
#define BT_DT_HCI_QUIRKS_GET(node_id)
 
#define BT_DT_HCI_QUIRKS_INST_GET(inst)   BT_DT_HCI_QUIRKS_GET(DT_DRV_INST(inst))
 
#define BT_DT_HCI_NAME_GET(node_id)   DT_PROP_OR(node_id, bt_hci_name, "HCI")
 
#define BT_DT_HCI_NAME_INST_GET(inst)   BT_DT_HCI_NAME_GET(DT_DRV_INST(inst))
 
#define BT_DT_HCI_BUS_GET(node_id)   DT_STRING_TOKEN_OR(node_id, bt_hci_bus, BT_HCI_BUS_VIRTUAL)
 
#define BT_DT_HCI_BUS_INST_GET(inst)   BT_DT_HCI_BUS_GET(DT_DRV_INST(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_IPM = 9
}
 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)    DT_STRING_TOKEN_OR(node_id, bt_hci_bus, BT_HCI_BUS_VIRTUAL)

◆ BT_DT_HCI_BUS_INST_GET

#define BT_DT_HCI_BUS_INST_GET (   inst)    BT_DT_HCI_BUS_GET(DT_DRV_INST(inst))

◆ BT_DT_HCI_NAME_GET

#define BT_DT_HCI_NAME_GET (   node_id)    DT_PROP_OR(node_id, bt_hci_name, "HCI")

◆ BT_DT_HCI_NAME_INST_GET

#define BT_DT_HCI_NAME_INST_GET (   inst)    BT_DT_HCI_NAME_GET(DT_DRV_INST(inst))

◆ BT_DT_HCI_QUIRK_OR

#define BT_DT_HCI_QUIRK_OR (   node_id,
  prop,
  idx 
)    DT_STRING_TOKEN_BY_IDX(node_id, prop, idx)

◆ 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:67
#define DT_NODE_HAS_PROP(node_id, prop)
Does a devicetree node have a property?
Definition: devicetree.h:3307
#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:3011
#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:179

◆ BT_DT_HCI_QUIRKS_INST_GET

#define BT_DT_HCI_QUIRKS_INST_GET (   inst)    BT_DT_HCI_QUIRKS_GET(DT_DRV_INST(inst))

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_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.