This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
The following commit(s) were added to refs/heads/master by this push:
new 6a520ec88 nimble/ll: guard central-only functions
6a520ec88 is described below
commit 6a520ec884f4e74c5bdc797c244c38c5a12a5d31
Author: Victor Luque <[email protected]>
AuthorDate: Mon Nov 17 12:10:54 2025 +0100
nimble/ll: guard central-only functions
Aligns guard usage more consistently.
Solves error when symbol resolution is done before garbage collection.
---
nimble/controller/include/controller/ble_ll_conn.h | 2 --
nimble/controller/src/ble_ll_conn.c | 4 +++-
nimble/controller/src/ble_ll_conn_hci.c | 11 ++++++++++-
nimble/controller/src/ble_ll_conn_priv.h | 12 ++++++++----
4 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/nimble/controller/include/controller/ble_ll_conn.h
b/nimble/controller/include/controller/ble_ll_conn.h
index 90f013fbe..733bcf4e7 100644
--- a/nimble/controller/include/controller/ble_ll_conn.h
+++ b/nimble/controller/include/controller/ble_ll_conn.h
@@ -468,8 +468,6 @@ int ble_ll_conn_move_anchor(struct ble_ll_conn_sm *connsm,
uint16_t offset);
struct ble_ll_scan_addr_data;
struct ble_ll_scan_pdu_data;
-uint8_t ble_ll_conn_tx_connect_ind_pducb(uint8_t *dptr, void *pducb_arg,
- uint8_t *hdr_byte);
void ble_ll_conn_prepare_connect_ind(struct ble_ll_conn_sm *connsm,
struct ble_ll_scan_pdu_data *pdu_data,
struct ble_ll_scan_addr_data *addrd,
diff --git a/nimble/controller/src/ble_ll_conn.c
b/nimble/controller/src/ble_ll_conn.c
index a702f3532..206d290b9 100644
--- a/nimble/controller/src/ble_ll_conn.c
+++ b/nimble/controller/src/ble_ll_conn.c
@@ -3175,7 +3175,8 @@ ble_ll_conn_prepare_connect_ind(struct ble_ll_conn_sm
*connsm,
pdu_data->hdr_byte = hdr;
}
-uint8_t
+#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
+static uint8_t
ble_ll_conn_tx_connect_ind_pducb(uint8_t *dptr, void *pducb_arg, uint8_t
*hdr_byte)
{
struct ble_ll_conn_sm *connsm;
@@ -3209,6 +3210,7 @@ ble_ll_conn_tx_connect_ind_pducb(uint8_t *dptr, void
*pducb_arg, uint8_t *hdr_by
return 34;
}
+#endif
/**
* Called when a schedule item overlaps the currently running connection
diff --git a/nimble/controller/src/ble_ll_conn_hci.c
b/nimble/controller/src/ble_ll_conn_hci.c
index 0a601c4a0..9a1de3629 100644
--- a/nimble/controller/src/ble_ll_conn_hci.c
+++ b/nimble/controller/src/ble_ll_conn_hci.c
@@ -42,7 +42,6 @@
* event to the host. This is the os time at which we can send an event.
*/
static ble_npl_time_t g_ble_ll_last_num_comp_pkt_evt;
-extern uint8_t *g_ble_ll_conn_comp_ev;
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
static const uint8_t ble_ll_conn_create_valid_phy_mask = (
@@ -63,6 +62,9 @@ static const uint8_t ble_ll_conn_create_required_phy_mask = (
0);
#endif
+#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
+extern uint8_t *g_ble_ll_conn_comp_ev;
+
/**
* Allocate an event to send a connection complete event when initiating
*
@@ -87,6 +89,7 @@ ble_ll_init_alloc_conn_comp_ev(void)
return rc;
}
+#endif
/**
* Called to check that the connection parameters are within range
@@ -468,6 +471,7 @@ ble_ll_conn_hci_create_check_scan(struct
ble_ll_conn_create_scan *p)
return 0;
}
+#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
static int
ble_ll_conn_hci_create_check_params(struct ble_ll_conn_create_params
*cc_params)
{
@@ -640,6 +644,7 @@ ble_ll_conn_hci_create(const uint8_t *cmdbuf, uint8_t len)
return rc;
}
+#endif
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
static void
@@ -663,6 +668,7 @@ ble_ll_conn_hci_ext_create_set_fb_params(uint8_t
init_phy_mask,
#endif
}
+#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
static int
ble_ll_conn_hci_ext_create_parse_params(const struct conn_params *params,
uint8_t phy,
@@ -868,6 +874,7 @@ ble_ll_conn_hci_ext_create(const uint8_t *cmdbuf, uint8_t
len)
return rc;
}
#endif
+#endif
static int
ble_ll_conn_process_conn_params(const struct ble_hci_le_rem_conn_param_rr_cp
*cmd,
@@ -1265,6 +1272,7 @@ done:
return rc;
}
+#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
/* this is called from same context after cmd complete is send so it is
* safe to use g_ble_ll_conn_comp_ev
*/
@@ -1318,6 +1326,7 @@ ble_ll_conn_create_cancel(void)
return rc;
}
+#endif
/**
* Called to process a HCI disconnect command
diff --git a/nimble/controller/src/ble_ll_conn_priv.h
b/nimble/controller/src/ble_ll_conn_priv.h
index 460a836ff..a0f6ca2ef 100644
--- a/nimble/controller/src/ble_ll_conn_priv.h
+++ b/nimble/controller/src/ble_ll_conn_priv.h
@@ -197,14 +197,21 @@ void ble_ll_disconn_comp_event_send(struct ble_ll_conn_sm
*connsm,
void ble_ll_auth_pyld_tmo_event_send(struct ble_ll_conn_sm *connsm);
int ble_ll_conn_hci_disconnect_cmd(const struct ble_hci_lc_disconnect_cp *cmd);
int ble_ll_conn_hci_rd_rem_ver_cmd(const uint8_t *cmdbuf, uint8_t len);
+
+#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
int ble_ll_conn_hci_create(const uint8_t *cmdbuf, uint8_t len);
+int ble_ll_conn_create_cancel(void);
+#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
+int ble_ll_conn_hci_ext_create(const uint8_t *cmdbuf, uint8_t len);
+#endif
+#endif
+
int ble_ll_conn_hci_update(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_conn_hci_set_chan_class(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_conn_hci_param_rr(const uint8_t *cmdbuf, uint8_t len,
uint8_t *rspbuf, uint8_t *rsplen);
int ble_ll_conn_hci_param_nrr(const uint8_t *cmdbuf, uint8_t len,
uint8_t *rspbuf, uint8_t *rsplen);
-int ble_ll_conn_create_cancel(void);
void ble_ll_conn_num_comp_pkts_event_send(struct ble_ll_conn_sm *connsm);
void ble_ll_conn_comp_event_send(struct ble_ll_conn_sm *connsm, uint8_t status,
uint8_t *evbuf, struct ble_ll_adv_sm *advsm);
@@ -267,9 +274,6 @@ int ble_ll_conn_hci_le_rd_phy(const uint8_t *cmdbuf,
uint8_t len,
uint8_t *rsp, uint8_t *rsplen);
int ble_ll_conn_hci_le_set_phy(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_conn_phy_update_if_needed(struct ble_ll_conn_sm *connsm);
-#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
-int ble_ll_conn_hci_ext_create(const uint8_t *cmdbuf, uint8_t len);
-#endif
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PERIODIC_ADV_SYNC_TRANSFER)
int ble_ll_set_sync_transfer_params(const uint8_t *cmdbuf, uint8_t len,