From 27dc6d95f6e4576059f86c9bb53afb07131edbe6 Mon Sep 17 00:00:00 2001 From: Roshan Bangar Date: Tue, 9 May 2023 12:06:48 +0530 Subject: [PATCH] NimBLE : Sync porting files --- components/bt/host/nimble/nimble | 2 +- .../nimble/include/nimble/hci_common.h | 28 +++++++++++-------- components/bt/porting/nimble/include/os/os.h | 9 ------ .../bt/porting/nimble/include/os/os_error.h | 2 +- .../bt/porting/nimble/include/os/os_mbuf.h | 5 ++-- .../bt/porting/nimble/include/os/os_mempool.h | 1 - .../bt/porting/nimble/src/os_msys_init.c | 4 +-- 7 files changed, 22 insertions(+), 29 deletions(-) diff --git a/components/bt/host/nimble/nimble b/components/bt/host/nimble/nimble index ca668cf0aa11..c03504a4a4f5 160000 --- a/components/bt/host/nimble/nimble +++ b/components/bt/host/nimble/nimble @@ -1 +1 @@ -Subproject commit ca668cf0aa11704f3fde4b641cb2a30758792975 +Subproject commit c03504a4a4f504fff3895ff77baf83c2cba59f74 diff --git a/components/bt/porting/nimble/include/nimble/hci_common.h b/components/bt/porting/nimble/include/nimble/hci_common.h index abbb97886b46..7d350b9ef8ec 100644 --- a/components/bt/porting/nimble/include/nimble/hci_common.h +++ b/components/bt/porting/nimble/include/nimble/hci_common.h @@ -34,8 +34,8 @@ extern "C" { #endif -#define BLE_HCI_MAX_DATA_LEN (MYNEWT_VAL(BLE_TRANSPORT_EVT_SIZE) - \ - sizeof(struct ble_hci_ev)) +#define BLE_HCI_MAX_DATA_LEN (MYNEWT_VAL(BLE_TRANSPORT_EVT_SIZE) - \ + sizeof(struct ble_hci_ev)) /* Generic command header */ struct ble_hci_cmd { @@ -490,20 +490,20 @@ struct ble_hci_le_rd_resolv_list_size_rp { } __attribute__((packed)); #define BLE_HCI_OCF_LE_RD_PEER_RESOLV_ADDR (0x002B) -struct ble_hci_le_rd_peer_recolv_addr_cp { +struct ble_hci_le_rd_peer_resolv_addr_cp { uint8_t peer_addr_type; uint8_t peer_id_addr[6]; } __attribute__((packed)); -struct ble_hci_le_rd_peer_recolv_addr_rp { +struct ble_hci_le_rd_peer_resolv_addr_rp { uint8_t rpa[6]; } __attribute__((packed)); #define BLE_HCI_OCF_LE_RD_LOCAL_RESOLV_ADDR (0x002C) -struct ble_hci_le_rd_local_recolv_addr_cp { +struct ble_hci_le_rd_local_resolv_addr_cp { uint8_t peer_addr_type; uint8_t peer_id_addr[6]; } __attribute__((packed)); -struct ble_hci_le_rd_local_recolv_addr_rp { +struct ble_hci_le_rd_local_resolv_addr_rp { uint8_t rpa[6]; } __attribute__((packed)); @@ -1129,8 +1129,9 @@ struct ble_hci_le_subrate_req_cp { uint16_t supervision_tmo; } __attribute__((packed)); -/* --- Vendor specific commands (OGF 0x00FF) */ -#define BLE_HCI_OCF_VS_RD_STATIC_ADDR (0x0001) +/* --- Vendor specific commands (OGF 0x003F) */ +/* Read Random Static Address */ +#define BLE_HCI_OCF_VS_RD_STATIC_ADDR (MYNEWT_VAL(BLE_HCI_VS_OCF_OFFSET) + (0x0001)) struct ble_hci_vs_rd_static_addr_rp { uint8_t addr[6]; } __attribute__((packed)); @@ -1520,8 +1521,8 @@ struct ble_hci_ev_auth_pyld_tmo { #define BLE_HCI_EVCODE_SAM_STATUS_CHG (0x58) -#define BLE_HCI_EVCODE_VENDOR_DEBUG (0xFF) -struct ble_hci_ev_vendor_debug { +#define BLE_HCI_EVCODE_VS_DEBUG (0xFF) +struct ble_hci_ev_vs_debug { uint8_t id; uint8_t data[0]; } __attribute__((packed)); @@ -1959,7 +1960,9 @@ struct ble_hci_ev_le_subev_subrate_change { #elif MYNEWT_VAL(BLE_VERSION) == 52 #define BLE_HCI_VER_BCS BLE_HCI_VER_BCS_5_2 #define BLE_LMP_VER_BCS BLE_LMP_VER_BCS_5_2 - +#elif MYNEWT_VAL(BLE_VERSION) == 53 +#define BLE_HCI_VER_BCS BLE_HCI_VER_BCS_5_3 +#define BLE_LMP_VER_BCS BLE_LMP_VER_BCS_5_3 #endif #define BLE_HCI_DATA_HDR_SZ 4 @@ -1967,7 +1970,8 @@ struct ble_hci_ev_le_subev_subrate_change { #define BLE_HCI_DATA_PB(handle_pb_bc) (((handle_pb_bc) & 0x3000) >> 12) #define BLE_HCI_DATA_BC(handle_pb_bc) (((handle_pb_bc) & 0xc000) >> 14) -struct hci_data_hdr { +struct hci_data_hdr +{ uint16_t hdh_handle_pb_bc; uint16_t hdh_len; }; diff --git a/components/bt/porting/nimble/include/os/os.h b/components/bt/porting/nimble/include/os/os.h index 16a89484d40b..56fdf52dd7cf 100644 --- a/components/bt/porting/nimble/include/os/os.h +++ b/components/bt/porting/nimble/include/os/os.h @@ -38,15 +38,6 @@ extern "C" { #define static_assert _Static_assert #endif -#ifndef min -#define min(a, b) ((a)<(b)?(a):(b)) -#endif - -#ifndef max -#define max(a, b) ((a)>(b)?(a):(b)) -#endif - -#include "soc/soc_caps.h" #include "nimble/nimble_npl.h" #define OS_ALIGN(__n, __a) ( \ diff --git a/components/bt/porting/nimble/include/os/os_error.h b/components/bt/porting/nimble/include/os/os_error.h index a2ec0c2c485a..2e736e390772 100644 --- a/components/bt/porting/nimble/include/os/os_error.h +++ b/components/bt/porting/nimble/include/os/os_error.h @@ -27,7 +27,7 @@ #ifndef H_OS_ERROR_ #define H_OS_ERROR_ -#include +#include "os/os.h" #ifdef __cplusplus extern "C" { diff --git a/components/bt/porting/nimble/include/os/os_mbuf.h b/components/bt/porting/nimble/include/os/os_mbuf.h index e207efac7b95..bd2df864b4c8 100644 --- a/components/bt/porting/nimble/include/os/os_mbuf.h +++ b/components/bt/porting/nimble/include/os/os_mbuf.h @@ -36,7 +36,6 @@ #ifndef _OS_MBUF_H #define _OS_MBUF_H -#include #include "os/os.h" #ifdef __cplusplus @@ -141,11 +140,11 @@ struct os_mqueue { /** Get a packet header pointer given an mbuf pointer */ #define OS_MBUF_PKTHDR(__om) ((struct os_mbuf_pkthdr *) \ - ((uint8_t *)&(__om)->om_data + sizeof(struct os_mbuf))) + (void *)((uint8_t *)&(__om)->om_data + sizeof(struct os_mbuf))) /** Given a mbuf packet header pointer, return a pointer to the mbuf */ #define OS_MBUF_PKTHDR_TO_MBUF(__hdr) \ - (struct os_mbuf *)((uint8_t *)(__hdr) - sizeof(struct os_mbuf)) + (struct os_mbuf *)(void *)((uint8_t *)(__hdr) - sizeof(struct os_mbuf)) /** * Gets the length of an entire mbuf chain. The specified mbuf must have a diff --git a/components/bt/porting/nimble/include/os/os_mempool.h b/components/bt/porting/nimble/include/os/os_mempool.h index 934cefb8f67f..4daead13a689 100644 --- a/components/bt/porting/nimble/include/os/os_mempool.h +++ b/components/bt/porting/nimble/include/os/os_mempool.h @@ -148,7 +148,6 @@ struct os_mempool_info { struct os_mempool *os_mempool_info_get_next(struct os_mempool *, struct os_mempool_info *); - #if (OS_ALIGNMENT == 4) typedef uint32_t os_membuf_t; #elif (OS_ALIGNMENT == 8) diff --git a/components/bt/porting/nimble/src/os_msys_init.c b/components/bt/porting/nimble/src/os_msys_init.c index b23e18de3bda..523566cbf404 100644 --- a/components/bt/porting/nimble/src/os_msys_init.c +++ b/components/bt/porting/nimble/src/os_msys_init.c @@ -66,7 +66,7 @@ static struct os_mempool os_msys_init_2_mempool; #define OS_MSYS_SANITY_ENABLED \ (OS_MSYS_1_SANITY_MIN_COUNT > 0 || \ - OS_MSYS_1_SANITY_MIN_COUNT > 0) + OS_MSYS_2_SANITY_MIN_COUNT > 0) #if OS_MSYS_SANITY_ENABLED static struct os_sanity_check os_msys_sc; @@ -91,7 +91,7 @@ IRAM_ATTR os_msys_sanity_min_count(int idx) return OS_MSYS_1_SANITY_MIN_COUNT; case 1: - return OS_MSYS_1_SANITY_MIN_COUNT; + return OS_MSYS_2_SANITY_MIN_COUNT; default: BLE_LL_ASSERT(0);