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.
This commit is contained in:
Szymon Janc
2022-10-03 15:22:29 +02:00
parent 70117943f4
commit 934193cb85
3 changed files with 3 additions and 12 deletions
@@ -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);
+3 -3
View File
@@ -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;
}
-6
View File
@@ -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: