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 934193cb85d62b288de3bd28972f283740b08fe3 Author: Szymon Janc <[email protected]> AuthorDate: Wed Sep 28 14:40:08 2022 +0200 nimble/ll: Use global symbol for accessing TX power compensation Global symbol is in dBm units (as opose to HCI, which is in 0.1 dBm) and doesn't require division by 10 on each access. This also improves performance on CPUs with no HW division support. --- nimble/controller/include/controller/ble_ll_hci.h | 3 --- nimble/controller/src/ble_ll_adv.c | 6 +++--- nimble/controller/src/ble_ll_hci.c | 6 ------ 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/nimble/controller/include/controller/ble_ll_hci.h b/nimble/controller/include/controller/ble_ll_hci.h index b73f8527..cb0ec033 100644 --- a/nimble/controller/include/controller/ble_ll_hci.h +++ b/nimble/controller/include/controller/ble_ll_hci.h @@ -80,9 +80,6 @@ int ble_ll_hci_chk_phy_masks(uint8_t all_phys, uint8_t tx_phys, uint8_t rx_phys, /* Returns true if Extended Advertising HCI commands are in use */ bool ble_ll_hci_adv_mode_ext(void); -/* Get TX power compensation rounded to integer dB */ -int8_t ble_ll_get_tx_pwr_compensation(void); - /* Check if max octets/time are within allowed range */ int ble_ll_hci_check_dle(uint16_t max_octets, uint16_t max_time); diff --git a/nimble/controller/src/ble_ll_adv.c b/nimble/controller/src/ble_ll_adv.c index 949335c1..8733e5d8 100644 --- a/nimble/controller/src/ble_ll_adv.c +++ b/nimble/controller/src/ble_ll_adv.c @@ -802,7 +802,7 @@ ble_ll_adv_aux_pdu_make(uint8_t *dptr, void *pducb_arg, uint8_t *hdr_byte) #endif if (aux->ext_hdr_flags & (1 << BLE_LL_EXT_ADV_TX_POWER_BIT)) { - dptr[0] = advsm->adv_txpwr + ble_ll_get_tx_pwr_compensation(); + dptr[0] = advsm->adv_txpwr + g_ble_ll_tx_power_compensation; dptr += BLE_LL_EXT_ADV_TX_POWER_SIZE; } @@ -879,7 +879,7 @@ ble_ll_adv_aux_scannable_pdu_make(uint8_t *dptr, void *pducb_arg, uint8_t *hdr_b if (advsm->props & BLE_HCI_LE_SET_EXT_ADV_PROP_INC_TX_PWR) { *ext_hdr_len += BLE_LL_EXT_ADV_TX_POWER_SIZE; *ext_hdr |= (1 << BLE_LL_EXT_ADV_TX_POWER_BIT); - dptr[0] = advsm->adv_txpwr + ble_ll_get_tx_pwr_compensation(); + dptr[0] = advsm->adv_txpwr + g_ble_ll_tx_power_compensation; dptr += BLE_LL_EXT_ADV_TX_POWER_SIZE; } @@ -2157,7 +2157,7 @@ ble_ll_adv_sync_pdu_make(uint8_t *dptr, void *pducb_arg, uint8_t *hdr_byte) } if (sync->ext_hdr_flags & (1 << BLE_LL_EXT_ADV_TX_POWER_BIT)) { - dptr[0] = advsm->adv_txpwr + ble_ll_get_tx_pwr_compensation(); + dptr[0] = advsm->adv_txpwr + g_ble_ll_tx_power_compensation; dptr += BLE_LL_EXT_ADV_TX_POWER_SIZE; } diff --git a/nimble/controller/src/ble_ll_hci.c b/nimble/controller/src/ble_ll_hci.c index 6089ed94..fa3bf66b 100644 --- a/nimble/controller/src/ble_ll_hci.c +++ b/nimble/controller/src/ble_ll_hci.c @@ -832,12 +832,6 @@ ble_ll_write_rf_path_compensation(const uint8_t *cmdbuf, uint8_t len) return BLE_ERR_SUCCESS; } -int8_t -ble_ll_get_tx_pwr_compensation(void) -{ - return tx_path_pwr_compensation / 10; -} - /** * Process a LE command sent from the host to the controller. The HCI command * has a 3 byte command header followed by data. The header is:
