Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
HCI drivers. More...
Data Structures | |
struct | bt_hci_driver |
Abstraction which represents the HCI transport to the controller. More... | |
Macros | |
#define | IS_BT_QUIRK_NO_AUTO_DLE(bt_dev) ((bt_dev)->drv->quirks & BT_QUIRK_NO_AUTO_DLE) |
#define | BT_HCI_EVT_FLAG_RECV_PRIO BIT(0) |
#define | BT_HCI_EVT_FLAG_RECV BIT(1) |
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 } |
Functions | |
static uint8_t | bt_hci_evt_get_flags (uint8_t evt) |
Get HCI event flags. More... | |
int | bt_recv (struct net_buf *buf) |
Receive data from the controller/HCI driver. More... | |
int | bt_recv_prio (struct net_buf *buf) |
Receive high priority data from the controller/HCI driver. More... | |
uint8_t | bt_read_static_addr (struct bt_hci_vs_static_addr addrs[], uint8_t size) |
Read static addresses from the controller. More... | |
int | bt_hci_driver_register (const struct bt_hci_driver *drv) |
Register a new HCI driver to the Bluetooth stack. More... | |
int | bt_hci_transport_setup (const struct device *dev) |
Setup the HCI transport, which usually means to reset the Bluetooth IC. More... | |
struct net_buf * | bt_hci_evt_create (uint8_t evt, uint8_t len) |
struct net_buf * | bt_hci_cmd_complete_create (uint16_t op, uint8_t plen) |
struct net_buf * | bt_hci_cmd_status_create (uint16_t op, uint8_t status) |
HCI drivers.
#define BT_HCI_EVT_FLAG_RECV BIT(1) |
#include <include/drivers/bluetooth/hci_driver.h>
#define BT_HCI_EVT_FLAG_RECV_PRIO BIT(0) |
#include <include/drivers/bluetooth/hci_driver.h>
#define IS_BT_QUIRK_NO_AUTO_DLE | ( | bt_dev | ) | ((bt_dev)->drv->quirks & BT_QUIRK_NO_AUTO_DLE) |
#include <include/drivers/bluetooth/hci_driver.h>
anonymous enum |
#include <include/drivers/bluetooth/hci_driver.h>
Enumerator | |
---|---|
BT_QUIRK_NO_RESET | |
BT_QUIRK_NO_AUTO_DLE |
enum bt_hci_driver_bus |
#include <include/drivers/bluetooth/hci_driver.h>
Possible values for the 'bus' member of the bt_hci_driver struct
#include <include/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.
op | Command OpCode. |
plen | Length of command parameters. |
#include <include/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.
op | Command OpCode. |
status | Status code. |
int bt_hci_driver_register | ( | const struct bt_hci_driver * | drv | ) |
#include <include/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.
drv | A bt_hci_driver struct representing the driver. |
#include <include/drivers/bluetooth/hci_driver.h>
Allocate an HCI event buffer.
This function allocates a new buffer for an HCI event. It is given the avent code and the total length of the parameters. Upon successful return the buffer is ready to have the parameters encoded into it.
evt | Event OpCode. |
len | Length of event parameters. |
#include <include/drivers/bluetooth/hci_driver.h>
Get HCI event flags.
Helper for the HCI driver to get HCI event flags that describes rules that. must be followed.
When CONFIG_BT_RECV_IS_RX_THREAD is enabled the flags BT_HCI_EVT_FLAG_RECV and BT_HCI_EVT_FLAG_RECV_PRIO indicates if the event should be given to bt_recv or bt_recv_prio.
evt | HCI event code. |
int bt_hci_transport_setup | ( | const struct device * | dev | ) |
#include <include/drivers/bluetooth/hci_driver.h>
Setup the HCI transport, which usually means to reset the Bluetooth IC.
dev | The device structure for the bus connecting to the IC |
uint8_t bt_read_static_addr | ( | struct bt_hci_vs_static_addr | addrs[], |
uint8_t | size | ||
) |
#include <include/drivers/bluetooth/hci_driver.h>
Read static addresses from the controller.
addrs | Random static address and Identity Root (IR) array. |
size | Size of array. |
int bt_recv | ( | struct net_buf * | buf | ) |
#include <include/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.
When CONFIG_BT_RECV_IS_RX_THREAD is defined then this API should not be used for so-called high priority HCI events, which should instead be delivered to the host stack through bt_recv_prio().
buf | Network buffer containing data from the controller. |
int bt_recv_prio | ( | struct net_buf * | buf | ) |
#include <include/drivers/bluetooth/hci_driver.h>
Receive high priority data from the controller/HCI driver.
This is the same as bt_recv(), except that it should be used for so-called high priority HCI events. There's a separate bt_hci_evt_get_flags() helper that can be used to identify which events have the BT_HCI_EVT_FLAG_RECV_PRIO flag set.
As with bt_recv(), the buffer needs to have its type set with the help of bt_buf_set_type() before calling this API. The only exception is so called high priority HCI events which should be delivered to the host stack through bt_recv_prio() instead.
buf | Network buffer containing data from the controller. |