Zephyr Project API 4.0.0
A Scalable Open Source RTOS
|
Data buffers. More...
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) (BT_BUF_RESERVE + (size)) |
Helper to include reserved HCI data in buffer calculations. | |
#define | BT_BUF_ACL_SIZE(size) BT_BUF_SIZE(BT_HCI_ACL_HDR_SIZE + (size)) |
Helper to calculate needed buffer size for HCI ACL packets. | |
#define | BT_BUF_EVT_SIZE(size) BT_BUF_SIZE(BT_HCI_EVT_HDR_SIZE + (size)) |
Helper to calculate needed buffer size for HCI Event packets. | |
#define | BT_BUF_CMD_SIZE(size) BT_BUF_SIZE(BT_HCI_CMD_HDR_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_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. | |
Enumerations | |
enum | bt_buf_type { BT_BUF_CMD , BT_BUF_EVT , BT_BUF_ACL_OUT , BT_BUF_ACL_IN , BT_BUF_ISO_OUT , BT_BUF_ISO_IN , BT_BUF_H4 } |
Possible types of buffers passed around the Bluetooth stack. More... | |
Functions | |
struct net_buf * | bt_buf_get_rx (enum bt_buf_type type, k_timeout_t timeout) |
Allocate a buffer for incoming data. | |
struct net_buf * | bt_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_buf * | bt_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. | |
Data buffers.
#define BT_BUF_ACL_RX_SIZE BT_BUF_ACL_SIZE(CONFIG_BT_BUF_ACL_RX_SIZE) |
#include <include/zephyr/bluetooth/buf.h>
Data size needed for HCI ACL RX buffers.
#define BT_BUF_ACL_SIZE | ( | size | ) | BT_BUF_SIZE(BT_HCI_ACL_HDR_SIZE + (size)) |
#include <include/zephyr/bluetooth/buf.h>
Helper to calculate needed buffer size for HCI ACL packets.
#define BT_BUF_CMD_SIZE | ( | size | ) | BT_BUF_SIZE(BT_HCI_CMD_HDR_SIZE + (size)) |
#include <include/zephyr/bluetooth/buf.h>
Helper to calculate needed buffer size for HCI Command packets.
#define BT_BUF_CMD_TX_SIZE BT_BUF_CMD_SIZE(CONFIG_BT_BUF_CMD_TX_SIZE) |
#include <include/zephyr/bluetooth/buf.h>
Data size needed for HCI Command buffers.
#define BT_BUF_EVT_RX_SIZE BT_BUF_EVT_SIZE(CONFIG_BT_BUF_EVT_RX_SIZE) |
#include <include/zephyr/bluetooth/buf.h>
Data size needed for HCI Event RX buffers.
#define BT_BUF_EVT_SIZE | ( | size | ) | BT_BUF_SIZE(BT_HCI_EVT_HDR_SIZE + (size)) |
#include <include/zephyr/bluetooth/buf.h>
Helper to calculate needed buffer size for HCI Event packets.
#define BT_BUF_ISO_RX_COUNT 0 |
#include <include/zephyr/bluetooth/buf.h>
#define BT_BUF_ISO_RX_SIZE 0 |
#include <include/zephyr/bluetooth/buf.h>
#define BT_BUF_ISO_SIZE | ( | size | ) |
#include <include/zephyr/bluetooth/buf.h>
Helper to calculate needed buffer size for HCI ISO packets.
#define BT_BUF_RESERVE 1 |
#include <include/zephyr/bluetooth/buf.h>
#define BT_BUF_RX_COUNT |
#include <include/zephyr/bluetooth/buf.h>
Buffer count needed for HCI ACL, HCI ISO or Event RX buffers.
#define BT_BUF_RX_SIZE |
#include <include/zephyr/bluetooth/buf.h>
Data size needed for HCI ACL, HCI ISO or Event RX buffers.
#define BT_BUF_SIZE | ( | size | ) | (BT_BUF_RESERVE + (size)) |
#include <include/zephyr/bluetooth/buf.h>
Helper to include reserved HCI data in buffer calculations.
enum bt_buf_type |
#include <include/zephyr/bluetooth/buf.h>
Possible types of buffers passed around the Bluetooth stack.
struct net_buf * bt_buf_get_evt | ( | uint8_t | evt, |
bool | discardable, | ||
k_timeout_t | timeout | ||
) |
#include <include/zephyr/bluetooth/buf.h>
Allocate a buffer for an HCI Event.
This will set the buffer type so bt_buf_set_type() does not need to be explicitly called.
evt | HCI event code |
discardable | Whether the driver considers the event discardable. |
timeout | Non-negative waiting period to obtain a buffer or one of the special values K_NO_WAIT and K_FOREVER. |
struct net_buf * bt_buf_get_rx | ( | enum bt_buf_type | type, |
k_timeout_t | timeout | ||
) |
#include <include/zephyr/bluetooth/buf.h>
Allocate a buffer for incoming data.
This will set the buffer type so bt_buf_set_type() does not need to be explicitly called.
type | Type of buffer. Only BT_BUF_EVT, BT_BUF_ACL_IN and BT_BUF_ISO_IN are allowed. |
timeout | Non-negative waiting period to obtain a buffer or one of the special values K_NO_WAIT and K_FOREVER. |
struct net_buf * bt_buf_get_tx | ( | enum bt_buf_type | type, |
k_timeout_t | timeout, | ||
const void * | data, | ||
size_t | size | ||
) |
#include <include/zephyr/bluetooth/buf.h>
Allocate a buffer for outgoing data.
This will set the buffer type so bt_buf_set_type() does not need to be explicitly called.
type | Type of buffer. Only BT_BUF_CMD, BT_BUF_ACL_OUT or BT_BUF_H4, when operating on H:4 mode, are allowed. |
timeout | Non-negative waiting period to obtain a buffer or one of the special values K_NO_WAIT and K_FOREVER. |
data | Initial data to append to buffer. |
size | Initial data size. |
|
inlinestatic |
#include <include/zephyr/bluetooth/buf.h>
Get the buffer type.
buf | Bluetooth buffer |
|
inlinestatic |
#include <include/zephyr/bluetooth/buf.h>
Set the buffer type.
buf | Bluetooth buffer |
type | The BT_* type to set the buffer to |