Zephyr API
4.5.99
A Scalable Open Source RTOS
Toggle main menu visibility
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
16
#include <
zephyr/bluetooth/hci_types.h
>
17
#include <
zephyr/net_buf.h
>
18
19
#ifdef __cplusplus
20
extern
"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
115
void
bt_hci_pkt_reset_cmd
(
struct
net_buf_simple
*buf);
116
134
int
bt_hci_pkt_push_cmd_hdr
(
struct
net_buf_simple
*buf,
uint16_t
opcode);
135
142
struct
bt_hci_pkt_cmd_rsp
{
148
uint16_t
opcode
;
153
uint8_t
ncmd
;
164
uint8_t
status
;
172
const
uint8_t
*
rp
;
174
size_t
rp_len
;
175
};
176
196
int
bt_hci_pkt_pull_cmd_complete
(
struct
net_buf_simple
*buf,
struct
bt_hci_pkt_cmd_rsp
*rsp);
197
210
int
bt_hci_pkt_pull_cmd_status
(
struct
net_buf_simple
*buf,
struct
bt_hci_pkt_cmd_rsp
*rsp);
211
232
int
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_ */
bt_hci_pkt_pull_cmd_complete
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.
bt_hci_pkt_parse_cmd_rsp
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.
bt_hci_pkt_pull_cmd_status
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.
bt_hci_pkt_reset_cmd
void bt_hci_pkt_reset_cmd(struct net_buf_simple *buf)
Reset a buffer for a new HCI command packet.
bt_hci_pkt_push_cmd_hdr
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.
hci_types.h
net_buf.h
Buffer management.
stdint.h
uint8_t
__UINT8_TYPE__ uint8_t
Definition
stdint.h:88
uint16_t
__UINT16_TYPE__ uint16_t
Definition
stdint.h:89
bt_hci_pkt_cmd_rsp
Decoded HCI command response.
Definition
hci_pkt.h:142
bt_hci_pkt_cmd_rsp::status
uint8_t status
Status code (BT_HCI_ERR_*).
Definition
hci_pkt.h:164
bt_hci_pkt_cmd_rsp::rp
const uint8_t * rp
Return parameters of the command.
Definition
hci_pkt.h:172
bt_hci_pkt_cmd_rsp::opcode
uint16_t opcode
Opcode of the command the event responds to.
Definition
hci_pkt.h:148
bt_hci_pkt_cmd_rsp::ncmd
uint8_t ncmd
Num_HCI_Command_Packets.
Definition
hci_pkt.h:153
bt_hci_pkt_cmd_rsp::rp_len
size_t rp_len
Length of rp in bytes.
Definition
hci_pkt.h:174
net_buf_simple
Simple network buffer representation.
Definition
net_buf.h:97
zephyr
bluetooth
hci_pkt.h
Generated on
for Zephyr API by
1.17.0