Skip to content

Commit d12e072

Browse files
author
Zhou Xiao
committed
fix(ble): added missed printf for ll log interface
1 parent 9d687da commit d12e072

File tree

4 files changed

+52
-24
lines changed

4 files changed

+52
-24
lines changed

components/bt/controller/esp32c2/bt.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ struct ext_funcs_t {
119119

120120
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
121121
typedef void (*interface_func_t) (uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag);
122+
123+
enum {
124+
BLE_LOG_INTERFACE_FLAG_CONTINUE = 0,
125+
BLE_LOG_INTERFACE_FLAG_END,
126+
};
122127
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
123128

124129
/* External functions or variables
@@ -411,20 +416,22 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
411416
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
412417
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag)
413418
{
414-
bool end = flag ? true : false;
419+
bool end = (flag & BIT(BLE_LOG_INTERFACE_FLAG_END));
415420
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
416421
esp_bt_controller_log_storage(len, addr, end);
417422
#else // !CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
418423
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
419424
portENTER_CRITICAL_SAFE(&spinlock);
420425
esp_panic_handler_feed_wdts();
421-
for (int i = 0; i < len; i++) {
422-
esp_rom_printf("%02x ", addr[i]);
423-
}
424426

425-
if (end) {
426-
esp_rom_printf("\n");
427+
if (len && addr) {
428+
for (int i = 0; i < len; i++) { esp_rom_printf("%02x ", addr[i]); }
427429
}
430+
if (len_append && addr_append) {
431+
for (int i = 0; i < len_append; i++) { esp_rom_printf("%02x ", addr_append[i]); }
432+
}
433+
if (end) { esp_rom_printf("\n"); }
434+
428435
portEXIT_CRITICAL_SAFE(&spinlock);
429436
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
430437
}

components/bt/controller/esp32c5/bt.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ struct ext_funcs_t {
103103

104104
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
105105
typedef void (*interface_func_t) (uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag);
106+
107+
enum {
108+
BLE_LOG_INTERFACE_FLAG_CONTINUE = 0,
109+
BLE_LOG_INTERFACE_FLAG_END,
110+
};
106111
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
107112
/* External functions or variables
108113
************************************************************************
@@ -1410,20 +1415,22 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po
14101415
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
14111416
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag)
14121417
{
1413-
bool end = flag ? true : false;
1418+
bool end = (flag & BIT(BLE_LOG_INTERFACE_FLAG_END));
14141419
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
14151420
esp_bt_controller_log_storage(len, addr, end);
14161421
#else // !CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
14171422
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
14181423
portENTER_CRITICAL_SAFE(&spinlock);
14191424
esp_panic_handler_feed_wdts();
1420-
for (int i = 0; i < len; i++) {
1421-
esp_rom_printf("%02x ", addr[i]);
1422-
}
14231425

1424-
if (end) {
1425-
esp_rom_printf("\n");
1426+
if (len && addr) {
1427+
for (int i = 0; i < len; i++) { esp_rom_printf("%02x ", addr[i]); }
14261428
}
1429+
if (len_append && addr_append) {
1430+
for (int i = 0; i < len_append; i++) { esp_rom_printf("%02x ", addr_append[i]); }
1431+
}
1432+
if (end) { esp_rom_printf("\n"); }
1433+
14271434
portEXIT_CRITICAL_SAFE(&spinlock);
14281435
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
14291436
}

components/bt/controller/esp32c6/bt.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ struct ext_funcs_t {
110110

111111
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
112112
typedef void (*interface_func_t) (uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag);
113+
114+
enum {
115+
BLE_LOG_INTERFACE_FLAG_CONTINUE = 0,
116+
BLE_LOG_INTERFACE_FLAG_END,
117+
};
113118
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
114119

115120
/* External functions or variables
@@ -1481,20 +1486,22 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po
14811486
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
14821487
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag)
14831488
{
1484-
bool end = flag ? true : false;
1489+
bool end = (flag & BIT(BLE_LOG_INTERFACE_FLAG_END));
14851490
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
14861491
esp_bt_controller_log_storage(len, addr, end);
14871492
#else // !CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
14881493
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
14891494
portENTER_CRITICAL_SAFE(&spinlock);
14901495
esp_panic_handler_feed_wdts();
1491-
for (int i = 0; i < len; i++) {
1492-
esp_rom_printf("%02x ", addr[i]);
1493-
}
14941496

1495-
if (end) {
1496-
esp_rom_printf("\n");
1497+
if (len && addr) {
1498+
for (int i = 0; i < len; i++) { esp_rom_printf("%02x ", addr[i]); }
14971499
}
1500+
if (len_append && addr_append) {
1501+
for (int i = 0; i < len_append; i++) { esp_rom_printf("%02x ", addr_append[i]); }
1502+
}
1503+
if (end) { esp_rom_printf("\n"); }
1504+
14981505
portEXIT_CRITICAL_SAFE(&spinlock);
14991506
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
15001507
}

components/bt/controller/esp32h2/bt.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ struct ext_funcs_t {
102102

103103
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
104104
typedef void (*interface_func_t) (uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag);
105+
106+
enum {
107+
BLE_LOG_INTERFACE_FLAG_CONTINUE = 0,
108+
BLE_LOG_INTERFACE_FLAG_END,
109+
};
105110
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
106111
/* External functions or variables
107112
************************************************************************
@@ -1404,20 +1409,22 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po
14041409
#if !CONFIG_BT_LE_CONTROLLER_LOG_SPI_OUT_ENABLED
14051410
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, uint32_t len_append, const uint8_t *addr_append, uint32_t flag)
14061411
{
1407-
bool end = flag ? true : false;
1412+
bool end = (flag & BIT(BLE_LOG_INTERFACE_FLAG_END));
14081413
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
14091414
esp_bt_controller_log_storage(len, addr, end);
14101415
#else // !CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
14111416
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
14121417
portENTER_CRITICAL_SAFE(&spinlock);
14131418
esp_panic_handler_feed_wdts();
1414-
for (int i = 0; i < len; i++) {
1415-
esp_rom_printf("%02x ", addr[i]);
1416-
}
14171419

1418-
if (end) {
1419-
esp_rom_printf("\n");
1420+
if (len && addr) {
1421+
for (int i = 0; i < len; i++) { esp_rom_printf("%02x ", addr[i]); }
14201422
}
1423+
if (len_append && addr_append) {
1424+
for (int i = 0; i < len_append; i++) { esp_rom_printf("%02x ", addr_append[i]); }
1425+
}
1426+
if (end) { esp_rom_printf("\n"); }
1427+
14211428
portEXIT_CRITICAL_SAFE(&spinlock);
14221429
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
14231430
}

0 commit comments

Comments
 (0)