Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
hci_pkt.h
Go to the documentation of this file.
1
4
5/*
6 * Copyright (c) 2026 Silicon Laboratories Inc.
7 *
8 * SPDX-License-Identifier: Apache-2.0
9 */
10
11#ifndef ZEPHYR_INCLUDE_BLUETOOTH_HCI_PKT_H_
12#define ZEPHYR_INCLUDE_BLUETOOTH_HCI_PKT_H_
13
14#include <stdint.h>
15
17#include <zephyr/net_buf.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
53
61#define BT_HCI_PKT_CMD_HDR_SIZE (sizeof(uint8_t) + BT_HCI_CMD_HDR_SIZE)
62
64#define BT_HCI_PKT_CMD_SIZE(param_len) (BT_HCI_PKT_CMD_HDR_SIZE + (param_len))
65
67#define Z_BT_HCI_PKT_CMD_DEFINE(_name, _max_param_len, _storage) \
68 _storage uint8_t net_buf_data_##_name[BT_HCI_PKT_CMD_SIZE(_max_param_len)]; \
69 _storage struct net_buf_simple _name = { \
70 .data = net_buf_data_##_name + BT_HCI_PKT_CMD_HDR_SIZE, \
71 .len = 0, \
72 .size = BT_HCI_PKT_CMD_SIZE(_max_param_len), \
73 .__buf = net_buf_data_##_name, \
74 }
76
91#define BT_HCI_PKT_CMD_DEFINE(_name, _max_param_len) \
92 Z_BT_HCI_PKT_CMD_DEFINE(_name, _max_param_len,)
93
101#define BT_HCI_PKT_CMD_DEFINE_STATIC(_name, _max_param_len) \
102 Z_BT_HCI_PKT_CMD_DEFINE(_name, _max_param_len, static)
103
116
135
176
197
211
232int bt_hci_pkt_parse_cmd_rsp(const uint8_t *pkt, size_t len, struct bt_hci_pkt_cmd_rsp *rsp);
233
237
238#ifdef __cplusplus
239}
240#endif
241
242#endif /* ZEPHYR_INCLUDE_BLUETOOTH_HCI_PKT_H_ */
int bt_hci_pkt_pull_cmd_complete(struct net_buf_simple *buf, struct bt_hci_pkt_cmd_rsp *rsp)
Pull an HCI_Command_Complete event.
int bt_hci_pkt_parse_cmd_rsp(const uint8_t *pkt, size_t len, struct bt_hci_pkt_cmd_rsp *rsp)
Parse an HCI command response from a complete HCI packet.
int bt_hci_pkt_pull_cmd_status(struct net_buf_simple *buf, struct bt_hci_pkt_cmd_rsp *rsp)
Pull an HCI_Command_Status event.
void bt_hci_pkt_reset_cmd(struct net_buf_simple *buf)
Reset a buffer for a new HCI command packet.
int bt_hci_pkt_push_cmd_hdr(struct net_buf_simple *buf, uint16_t opcode)
Push the packet indicator and command header of an HCI command packet.
Buffer management.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Decoded HCI command response.
Definition hci_pkt.h:142
uint8_t status
Status code (BT_HCI_ERR_*).
Definition hci_pkt.h:164
const uint8_t * rp
Return parameters of the command.
Definition hci_pkt.h:172
uint16_t opcode
Opcode of the command the event responds to.
Definition hci_pkt.h:148
uint8_t ncmd
Num_HCI_Command_Packets.
Definition hci_pkt.h:153
size_t rp_len
Length of rp in bytes.
Definition hci_pkt.h:174
Simple network buffer representation.
Definition net_buf.h:89