You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2022/11/02 14:24:10 UTC
[mynewt-nimble] 03/05: nimble/ll: Use common helper for checking if allowed to set TX power
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
commit 50a993f1b8ebe224da905d24644435f7c7a842c1
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Fri Oct 28 09:53:12 2022 +0200
nimble/ll: Use common helper for checking if allowed to set TX power
No need for local helper.
---
nimble/controller/src/ble_ll_hci_vs.c | 54 ++---------------------------------
1 file changed, 2 insertions(+), 52 deletions(-)
diff --git a/nimble/controller/src/ble_ll_hci_vs.c b/nimble/controller/src/ble_ll_hci_vs.c
index 9f7fb185..3f373c42 100644
--- a/nimble/controller/src/ble_ll_hci_vs.c
+++ b/nimble/controller/src/ble_ll_hci_vs.c
@@ -57,56 +57,6 @@ ble_ll_hci_vs_rd_static_addr(uint16_t ocf,
return BLE_ERR_SUCCESS;
}
-/* disallow changing TX power if there is any radio activity
- * note: we could allow to change it if there is no TX activity (eg only
- * passive scan or sync) but lets just keep this simple for now
- */
-static int
-ble_ll_hci_vs_is_controller_busy(void)
-{
-#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL) || MYNEWT_VAL(BLE_LL_ROLE_PERIPHERAL)
- struct ble_ll_conn_sm *cur;
- int i = 0;
-#endif
-
-#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PERIODIC_ADV) && MYNEWT_VAL(BLE_LL_ROLE_OBSERVER)
- if (ble_ll_sync_enabled()) {
- return 1;
- }
-#endif
-
-#if MYNEWT_VAL(BLE_LL_ROLE_BROADCASTER)
- if (ble_ll_adv_enabled()) {
- return 1;
- }
-#endif
-
-#if MYNEWT_VAL(BLE_LL_ROLE_OBSERVER)
- if (ble_ll_scan_enabled()) {
- return 1;
- }
-#endif
-
-#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
- if (g_ble_ll_conn_create_sm.connsm) {
- return 1;
- }
-#endif
-
-#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL) || MYNEWT_VAL(BLE_LL_ROLE_PERIPHERAL)
- STAILQ_FOREACH(cur, &g_ble_ll_conn_free_list, free_stqe) {
- i++;
- }
-
- /* check if all connection objects are free */
- if (i < MYNEWT_VAL(BLE_MAX_CONNECTIONS)) {
- return 1;
- }
-#endif
-
- return 0;
-}
-
static int
ble_ll_hci_vs_set_tx_power(uint16_t ocf, const uint8_t *cmdbuf, uint8_t cmdlen,
uint8_t *rspbuf, uint8_t *rsplen)
@@ -118,7 +68,7 @@ ble_ll_hci_vs_set_tx_power(uint16_t ocf, const uint8_t *cmdbuf, uint8_t cmdlen,
return BLE_ERR_INV_HCI_CMD_PARMS;
}
- if (ble_ll_hci_vs_is_controller_busy()) {
+ if (ble_ll_is_busy()) {
return BLE_ERR_CMD_DISALLOWED;
}
@@ -367,7 +317,7 @@ ble_ll_hci_vs_set_antenna(uint16_t ocf, const uint8_t *cmdbuf, uint8_t cmdlen,
return BLE_ERR_INV_HCI_CMD_PARMS;
}
- if (ble_ll_hci_vs_is_controller_busy()) {
+ if (ble_ll_is_busy()) {
return BLE_ERR_CMD_DISALLOWED;
}