Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
|
Bluetooth HCI driver API. More...
#include <stdbool.h>
#include <stdint.h>
#include <zephyr/net/buf.h>
#include <zephyr/bluetooth/buf.h>
#include <zephyr/bluetooth/addr.h>
#include <zephyr/bluetooth/hci_vs.h>
#include <zephyr/device.h>
Go to the source code of this file.
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. | |
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_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. | |
Bluetooth HCI driver API.
Copyright (c) 2024 Johan Hedberg
SPDX-License-Identifier: Apache-2.0
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.
op | HCI command OpCode. |
plen | Length of command parameters. |
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.
op | HCI command OpCode. |
status | Status code. |
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.
evt | HCI event OpCode. |
len | Length of event parameters. |
int bt_hci_transport_setup | ( | const struct device * | dev | ) |
Setup the HCI transport, which usually means to reset the Bluetooth IC.
dev | The device structure for the bus connecting to the IC |
int bt_hci_transport_teardown | ( | const struct device * | dev | ) |
Teardown the HCI transport.
dev | The device structure for the bus connecting to the IC |