8#ifndef ZEPHYR_INCLUDE_DRIVERS_BLUETOOTH_H_
9#define ZEPHYR_INCLUDE_DRIVERS_BLUETOOTH_H_
67#define BT_DT_HCI_QUIRK_OR(node_id, prop, idx) DT_STRING_TOKEN_BY_IDX(node_id, prop, idx)
68#define BT_DT_HCI_QUIRKS_GET(node_id) COND_CODE_1(DT_NODE_HAS_PROP(node_id, bt_hci_quirks), \
69 (DT_FOREACH_PROP_ELEM_SEP(node_id, \
74#define BT_DT_HCI_QUIRKS_INST_GET(inst) BT_DT_HCI_QUIRKS_GET(DT_DRV_INST(inst))
76#define BT_DT_HCI_NAME_GET(node_id) DT_PROP_OR(node_id, bt_hci_name, "HCI")
77#define BT_DT_HCI_NAME_INST_GET(inst) BT_DT_HCI_NAME_GET(DT_DRV_INST(inst))
79#define BT_DT_HCI_BUS_GET(node_id) DT_STRING_TOKEN_OR(node_id, bt_hci_bus, BT_HCI_BUS_VIRTUAL)
80#define BT_DT_HCI_BUS_INST_GET(inst) BT_DT_HCI_BUS_GET(DT_DRV_INST(inst))
88#if defined(CONFIG_BT_HCI_SETUP)
89 int (*setup)(
const struct device *dev,
130 if (api->
close == NULL) {
134 return api->
close(dev);
154 return api->
send(dev, buf);
157#if defined(CONFIG_BT_HCI_SETUP) || defined(__DOXYGEN__)
174 if (api->setup == NULL) {
178 return api->setup(dev, params);
Bluetooth device address definitions and utilities.
Bluetooth data buffer API.
struct net_buf * bt_hci_evt_create(uint8_t evt, uint8_t len)
Allocate an HCI event buffer.
struct net_buf * bt_hci_cmd_complete_create(uint16_t op, uint8_t plen)
Allocate an HCI Command Complete event buffer.
struct net_buf * bt_hci_cmd_status_create(uint16_t op, uint8_t status)
Allocate an HCI Command Status event buffer.
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.
static ssize_t recv(int sock, void *buf, size_t max_len, int flags)
POSIX wrapper for zsock_recv.
Definition: socket.h:922
static int bt_hci_setup(const struct device *dev, struct bt_hci_setup_params *params)
HCI vendor-specific setup.
Definition: bluetooth.h:170
static int bt_hci_send(const struct device *dev, struct net_buf *buf)
Send HCI buffer to controller.
Definition: bluetooth.h:150
int(* bt_hci_recv_t)(const struct device *dev, struct net_buf *buf)
Definition: bluetooth.h:82
bt_hci_bus
Possible values for the 'bus' member of the bt_hci_driver struct.
Definition: bluetooth.h:54
static int bt_hci_open(const struct device *dev, bt_hci_recv_t recv)
Open the HCI transport.
Definition: bluetooth.h:109
static int bt_hci_close(const struct device *dev)
Close the HCI transport.
Definition: bluetooth.h:126
@ BT_HCI_QUIRK_NO_AUTO_DLE
Definition: bluetooth.h:50
@ BT_HCI_QUIRK_NO_RESET
Definition: bluetooth.h:44
@ BT_HCI_BUS_VIRTUAL
Definition: bluetooth.h:55
@ BT_HCI_BUS_USB
Definition: bluetooth.h:56
@ BT_HCI_BUS_IPM
Definition: bluetooth.h:64
@ BT_HCI_BUS_PCCARD
Definition: bluetooth.h:57
@ BT_HCI_BUS_SPI
Definition: bluetooth.h:62
@ BT_HCI_BUS_UART
Definition: bluetooth.h:58
@ BT_HCI_BUS_PCI
Definition: bluetooth.h:60
@ BT_HCI_BUS_RS232
Definition: bluetooth.h:59
@ BT_HCI_BUS_SDIO
Definition: bluetooth.h:61
@ BT_HCI_BUS_I2C
Definition: bluetooth.h:63
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition: util_macro.h:44
#define ENOSYS
Function not implemented.
Definition: errno.h:82
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Bluetooth Device Address.
Definition: addr.h:40
Definition: bluetooth.h:84
int(* open)(const struct device *dev, bt_hci_recv_t recv)
Definition: bluetooth.h:85
int(* close)(const struct device *dev)
Definition: bluetooth.h:86
int(* send)(const struct device *dev, struct net_buf *buf)
Definition: bluetooth.h:87
Definition: bluetooth.h:34
bt_addr_t public_addr
The public identity address to give to the controller.
Definition: bluetooth.h:39
Runtime device structure (in ROM) per driver instance.
Definition: device.h:403
const void * api
Address of the API structure exposed by the device instance.
Definition: device.h:409
Network buffer representation.
Definition: buf.h:1004
uint16_t len
Length of the data behind the data pointer.
Definition: buf.h:1033