From 92f608fc582ee17967b651d3f281670a87c22b7e Mon Sep 17 00:00:00 2001 From: ShenWeilong Date: Fri, 4 Sep 2026 15:50:46 +0800 Subject: [PATCH] fix(ble): fixed porting_btdm compilation issue for esp32-s31/h4 --- .../bt/include/esp32h4/include/esp_bt.h | 9 +++++---- .../bt/include/esp32s31/include/esp_bt.h | 8 ++++---- .../controller/ble/include/os/os_mempool.h | 19 ++++++++++--------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/components/bt/include/esp32h4/include/esp_bt.h b/components/bt/include/esp32h4/include/esp_bt.h index fa9f3991096..c80b8027372 100644 --- a/components/bt/include/esp32h4/include/esp_bt.h +++ b/components/bt/include/esp32h4/include/esp_bt.h @@ -20,10 +20,6 @@ #include "../../common/btdm_bredr.h" #endif // SOC_BT_CLASSIC_SUPPORTED - #if SOC_BLE_SUPPORTED - #include "../../common/btdm_le.h" - #endif /* SOC_BLE_SUPPORTED */ - #ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART #include "driver/uart.h" #endif @@ -112,6 +108,11 @@ uint8_t val[6]; /*!< Array containing the 6-byte Bluetooth address value */ } esp_ble_addr_t; + + #if SOC_BLE_SUPPORTED + #include "../../common/btdm_le.h" + #endif /* SOC_BLE_SUPPORTED */ + #define BTDM_CONFIG_VERSION 0x20260127 #define BTDM_CONFIG_MAGIC_VALUE 0x5a5aa5a5 diff --git a/components/bt/include/esp32s31/include/esp_bt.h b/components/bt/include/esp32s31/include/esp_bt.h index 5a8fed71411..cee53bdc3df 100644 --- a/components/bt/include/esp32s31/include/esp_bt.h +++ b/components/bt/include/esp32s31/include/esp_bt.h @@ -20,10 +20,6 @@ #include "../../common/btdm_bredr.h" #endif // SOC_BT_CLASSIC_SUPPORTED -#if SOC_BLE_SUPPORTED -#include "../../common/btdm_le.h" -#endif /* SOC_BLE_SUPPORTED */ - #ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART #include "driver/uart.h" #endif @@ -112,6 +108,10 @@ typedef struct { uint8_t val[6]; /*!< Array containing the 6-byte Bluetooth address value */ } esp_ble_addr_t; +#if SOC_BLE_SUPPORTED +#include "../../common/btdm_le.h" +#endif /* SOC_BLE_SUPPORTED */ + #define BTDM_CONFIG_VERSION 0x20260127 #define BTDM_CONFIG_MAGIC_VALUE 0x5a5aa5a5 diff --git a/components/bt/porting_btdm/controller/ble/include/os/os_mempool.h b/components/bt/porting_btdm/controller/ble/include/os/os_mempool.h index 87de825b82b..28e755f43f8 100644 --- a/components/bt/porting_btdm/controller/ble/include/os/os_mempool.h +++ b/components/bt/porting_btdm/controller/ble/include/os/os_mempool.h @@ -380,16 +380,16 @@ static inline os_error_t os_mempool_init(struct os_mempool *mp, uint16_t blocks, uint32_t block_size, void *membuf, const char *name) { - return btdm_mempool_init((struct btdm_mempool *)mp, blocks, block_size, - membuf, name); + return (os_error_t)btdm_mempool_init((struct btdm_mempool *)mp, blocks, + block_size, membuf, name); } static inline os_error_t os_mempool_ext_init(struct os_mempool_ext *mpe, uint16_t blocks, uint32_t block_size, void *membuf, const char *name) { - return btdm_mempool_ext_init((struct btdm_mempool_ext *)mpe, blocks, - block_size, membuf, name); + return (os_error_t)btdm_mempool_ext_init((struct btdm_mempool_ext *)mpe, + blocks, block_size, membuf, name); } static inline void @@ -403,19 +403,19 @@ os_ext_mempool_register_cb(struct os_mempool_ext *mpe, void *put_cb, static inline os_error_t os_mempool_unregister(struct os_mempool *mp) { - return btdm_mempool_unregister((struct btdm_mempool *)mp); + return (os_error_t)btdm_mempool_unregister((struct btdm_mempool *)mp); } static inline os_error_t os_mempool_clear(struct os_mempool *mp) { - return btdm_mempool_clear((struct btdm_mempool *)mp); + return (os_error_t)btdm_mempool_clear((struct btdm_mempool *)mp); } static inline os_error_t os_mempool_ext_clear(struct os_mempool_ext *mpe) { - return btdm_mempool_ext_clear((struct btdm_mempool_ext *)mpe); + return (os_error_t)btdm_mempool_ext_clear((struct btdm_mempool_ext *)mpe); } static inline bool @@ -439,13 +439,14 @@ os_memblock_get(struct os_mempool *mp) static inline os_error_t os_memblock_put_from_cb(struct os_mempool *mp, void *block_addr) { - return btdm_memblock_put_from_cb((struct btdm_mempool *)mp, block_addr); + return (os_error_t)btdm_memblock_put_from_cb((struct btdm_mempool *)mp, + block_addr); } static inline os_error_t os_memblock_put(struct os_mempool *mp, void *block_addr) { - return btdm_memblock_put((struct btdm_mempool *)mp, block_addr); + return (os_error_t)btdm_memblock_put((struct btdm_mempool *)mp, block_addr); } static inline void