Zephyr Project API 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
52
60#define BT_HCI_PKT_CMD_HDR_SIZE (sizeof(uint8_t) + BT_HCI_CMD_HDR_SIZE)
61
63#define BT_HCI_PKT_CMD_SIZE(param_len) (BT_HCI_PKT_CMD_HDR_SIZE + (param_len))
64
66#define Z_BT_HCI_PKT_CMD_DEFINE(_name, _max_param_len, _storage) \
67 _storage uint8_t net_buf_data_##_name[BT_HCI_PKT_CMD_SIZE(_max_param_len)]; \
68 _storage struct net_buf_simple _name = { \
69 .data = net_buf_data_##_name + BT_HCI_PKT_CMD_HDR_SIZE, \
70 .len = 0, \
71 .size = BT_HCI_PKT_CMD_SIZE(_max_param_len), \
72 .__buf = net_buf_data_##_name, \
73 }
75
90#define BT_HCI_PKT_CMD_DEFINE(_name, _max_param_len) \
91 Z_BT_HCI_PKT_CMD_DEFINE(_name, _max_param_len,)
92
100#define BT_HCI_PKT_CMD_DEFINE_STATIC(_name, _max_param_len) \
101 Z_BT_HCI_PKT_CMD_DEFINE(_name, _max_param_len, static)
102
115
134
175
196
210
231int bt_hci_pkt_parse_cmd_rsp(const uint8_t *pkt, size_t len, struct bt_hci_pkt_cmd_rsp *rsp);
232
236
237#ifdef __cplusplus
238}
239#endif
240
241#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:141
uint8_t status
Status code (BT_HCI_ERR_*).
Definition hci_pkt.h:163
const uint8_t * rp
Return parameters of the command.
Definition hci_pkt.h:171
uint16_t opcode
Opcode of the command the event responds to.
Definition hci_pkt.h:147
uint8_t ncmd
Num_HCI_Command_Packets.
Definition hci_pkt.h:152
size_t rp_len
Length of rp in bytes.
Definition hci_pkt.h:173
Simple network buffer representation.
Definition net_buf.h:89