Merge branch 'fix/ble_hci_log_direction_v5.3' into 'release/v5.3'

feat(ble_log): encode HCI direction in ble_log pipeline (v5.3)

See merge request espressif/esp-idf!46300
This commit is contained in:
Jiang Jiang Jian
2026-03-25 20:51:47 +08:00
4 changed files with 19 additions and 5 deletions
+15 -1
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -38,6 +38,20 @@ typedef enum {
BLE_LOG_SRC_MAX,
} ble_log_src_t;
/* HCI Log Direction */
#define BLE_LOG_HCI_DOWNSTREAM 0
#define BLE_LOG_HCI_UPSTREAM 1
/* HCI Log Write Macro
* Encodes direction in MSB of data[0] (HCI type byte) before writing.
* Safe because ble_log_write_hex -> ble_log_lbm_write_trans does synchronous memcpy.
* Parser reads MSB to determine direction; old firmware with MSB=0 defaults to "sent". */
#define ble_log_write_hci(direction, data, len) do { \
(data)[0] |= ((direction) << 7); \
ble_log_write_hex(BLE_LOG_SRC_HCI, (data), (len)); \
(data)[0] &= 0x7F; \
} while (0)
/* INTERFACE */
bool ble_log_init(void);
void ble_log_deinit(void);