Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
hci_driver.h
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2015-2016 Intel Corporation
7 *
8 * SPDX-License-Identifier: Apache-2.0
9 */
10#ifndef ZEPHYR_INCLUDE_DRIVERS_BLUETOOTH_HCI_DRIVER_H_
11#define ZEPHYR_INCLUDE_DRIVERS_BLUETOOTH_HCI_DRIVER_H_
12
20#include <stdbool.h>
21#include <net/buf.h>
22#include <bluetooth/buf.h>
23#include <bluetooth/hci_vs.h>
24#include <device.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30enum {
31 /* The host should never send HCI_Reset */
33 /* The controller does not auto-initiate a DLE procedure when the
34 * initial connection data length parameters are not equal to the
35 * default data length parameters. Therefore the host should initiate
36 * the DLE procedure after connection establishment. */
38};
39
40#define IS_BT_QUIRK_NO_AUTO_DLE(bt_dev) ((bt_dev)->drv->quirks & BT_QUIRK_NO_AUTO_DLE)
41
42/* @brief The HCI event shall be given to bt_recv_prio */
43#define BT_HCI_EVT_FLAG_RECV_PRIO BIT(0)
44/* @brief The HCI event shall be given to bt_recv. */
45#define BT_HCI_EVT_FLAG_RECV BIT(1)
46
61{
62 switch (evt) {
65 /* fallthrough */
66#if defined(CONFIG_BT_CONN) || defined(CONFIG_BT_ISO)
68#if defined(CONFIG_BT_CONN)
70 __fallthrough;
71#endif /* defined(CONFIG_BT_CONN) */
72#endif /* CONFIG_BT_CONN || CONFIG_BT_ISO */
76 default:
78 }
79}
80
96int bt_recv(struct net_buf *buf);
97
115int bt_recv_prio(struct net_buf *buf);
116
125
138};
139
148 const char *name;
149
152
159
173 int (*open)(void);
174
187 int (*send)(struct net_buf *buf);
188};
189
201
213int bt_hci_transport_setup(const struct device *dev);
214
227
241
255
256#ifdef __cplusplus
257}
258#endif
259
264#endif /* ZEPHYR_INCLUDE_DRIVERS_BLUETOOTH_HCI_DRIVER_H_ */
Bluetooth data buffer API.
void
Definition: eswifi_shell.c:15
int bt_recv_prio(struct net_buf *buf)
Receive high priority data from the controller/HCI driver.
static uint8_t bt_hci_evt_get_flags(uint8_t evt)
Get HCI event flags.
Definition: hci_driver.h:60
struct net_buf * bt_hci_evt_create(uint8_t evt, uint8_t len)
uint8_t bt_read_static_addr(struct bt_hci_vs_static_addr addrs[], uint8_t size)
Read static addresses from the controller.
#define BT_HCI_EVT_FLAG_RECV
Definition: hci_driver.h:45
int bt_hci_driver_register(const struct bt_hci_driver *drv)
Register a new HCI driver to the Bluetooth stack.
struct net_buf * bt_hci_cmd_complete_create(uint16_t op, uint8_t plen)
bt_hci_driver_bus
Definition: hci_driver.h:127
#define BT_HCI_EVT_FLAG_RECV_PRIO
Definition: hci_driver.h:43
struct net_buf * bt_hci_cmd_status_create(uint16_t op, uint8_t status)
int bt_recv(struct net_buf *buf)
Receive data from the controller/HCI driver.
int bt_hci_transport_setup(const struct device *dev)
Setup the HCI transport, which usually means to reset the Bluetooth IC.
@ BT_HCI_DRIVER_BUS_PCCARD
Definition: hci_driver.h:130
@ BT_HCI_DRIVER_BUS_I2C
Definition: hci_driver.h:136
@ BT_HCI_DRIVER_BUS_UART
Definition: hci_driver.h:131
@ BT_HCI_DRIVER_BUS_SPI
Definition: hci_driver.h:135
@ BT_HCI_DRIVER_BUS_RS232
Definition: hci_driver.h:132
@ BT_HCI_DRIVER_BUS_IPM
Definition: hci_driver.h:137
@ BT_HCI_DRIVER_BUS_VIRTUAL
Definition: hci_driver.h:128
@ BT_HCI_DRIVER_BUS_PCI
Definition: hci_driver.h:133
@ BT_HCI_DRIVER_BUS_SDIO
Definition: hci_driver.h:134
@ BT_HCI_DRIVER_BUS_USB
Definition: hci_driver.h:129
@ BT_QUIRK_NO_RESET
Definition: hci_driver.h:32
@ BT_QUIRK_NO_AUTO_DLE
Definition: hci_driver.h:37
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition: util_macro.h:44
#define BT_HCI_EVT_CMD_COMPLETE
Definition: hci.h:2074
#define BT_HCI_EVT_CMD_STATUS
Definition: hci.h:2084
#define BT_HCI_EVT_DISCONN_COMPLETE
Definition: hci.h:2031
#define BT_HCI_EVT_NUM_COMPLETED_PACKETS
Definition: hci.h:2103
#define BT_HCI_EVT_DATA_BUF_OVERFLOW
Definition: hci.h:2141
Buffer management.
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
__UINT16_TYPE__ uint16_t
Definition: stdint.h:59
Abstraction which represents the HCI transport to the controller.
Definition: hci_driver.h:146
uint32_t quirks
Definition: hci_driver.h:158
const char * name
Definition: hci_driver.h:148
int(* open)(void)
Open the HCI transport.
Definition: hci_driver.h:173
int(* send)(struct net_buf *buf)
Send HCI buffer to controller.
Definition: hci_driver.h:187
enum bt_hci_driver_bus bus
Definition: hci_driver.h:151
Definition: hci_vs.h:110
Runtime device structure (in ROM) per driver instance.
Definition: device.h:367
Network buffer representation.
Definition: buf.h:919
uint16_t len
Definition: buf.h:947