Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
buf.h File Reference

Bluetooth data buffer API. More...

#include <stdint.h>
#include <zephyr/net_buf.h>
#include <zephyr/bluetooth/hci.h>
#include <zephyr/sys/util.h>

Go to the source code of this file.

Data Structures

struct  bt_buf_data
 This is a base type for bt_buf user data. More...
 

Macros

#define BT_BUF_RESERVE   1
 
#define BT_BUF_SIZE(size)
 Helper to include reserved HCI data in buffer calculations.
 
#define BT_BUF_ACL_SIZE(size)
 Helper to calculate needed buffer size for HCI ACL packets.
 
#define BT_BUF_EVT_SIZE(size)
 Helper to calculate needed buffer size for HCI Event packets.
 
#define BT_BUF_CMD_SIZE(size)
 Helper to calculate needed buffer size for HCI Command packets.
 
#define BT_BUF_ISO_SIZE(size)
 Helper to calculate needed buffer size for HCI ISO packets.
 
#define BT_BUF_ACL_RX_SIZE   BT_BUF_ACL_SIZE(CONFIG_BT_BUF_ACL_RX_SIZE)
 Data size needed for HCI ACL RX buffers.
 
#define BT_BUF_EVT_RX_SIZE   BT_BUF_EVT_SIZE(CONFIG_BT_BUF_EVT_RX_SIZE)
 Data size needed for HCI Event RX buffers.
 
#define BT_BUF_ISO_RX_SIZE   0
 
#define BT_BUF_ISO_RX_COUNT   0
 
#define BT_BUF_ACL_RX_COUNT_MAX   65535
 
#define BT_BUF_ACL_RX_COUNT   0
 
#define BT_BUF_RX_SIZE
 Data size needed for HCI ACL, HCI ISO or Event RX buffers.
 
#define BT_BUF_RX_COUNT
 Buffer count needed for HCI ACL, HCI ISO or Event RX buffers.
 
#define BT_BUF_CMD_TX_SIZE   BT_BUF_CMD_SIZE(CONFIG_BT_BUF_CMD_TX_SIZE)
 Data size needed for HCI Command buffers.
 

Typedefs

typedef void(* bt_buf_rx_freed_cb_t) (enum bt_buf_type type_mask)
 A callback to notify about freed buffer in the incoming data pool.
 

Enumerations

enum  bt_buf_type {
  BT_BUF_CMD = BIT(0) , BT_BUF_EVT = BIT(1) , BT_BUF_ACL_OUT = BIT(2) , BT_BUF_ACL_IN = BIT(3) ,
  BT_BUF_ISO_OUT = BIT(4) , BT_BUF_ISO_IN = BIT(5) , BT_BUF_H4 = BIT(6)
}
 Possible types of buffers passed around the Bluetooth stack in a form of bitmask. More...
 

Functions

struct net_bufbt_buf_get_rx (enum bt_buf_type type, k_timeout_t timeout)
 Allocate a buffer for incoming data.
 
void bt_buf_rx_freed_cb_set (bt_buf_rx_freed_cb_t cb)
 Set the callback to notify about freed buffer in the incoming data pool.
 
struct net_bufbt_buf_get_tx (enum bt_buf_type type, k_timeout_t timeout, const void *data, size_t size)
 Allocate a buffer for outgoing data.
 
struct net_bufbt_buf_get_evt (uint8_t evt, bool discardable, k_timeout_t timeout)
 Allocate a buffer for an HCI Event.
 
static void bt_buf_set_type (struct net_buf *buf, enum bt_buf_type type)
 Set the buffer type.
 
static enum bt_buf_type bt_buf_get_type (struct net_buf *buf)
 Get the buffer type.
 

Detailed Description

Bluetooth data buffer API.