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 8f0ecadecc991ab7a441e7fe2f13916ff643f1d8 Author: Szymon Janc <[email protected]> AuthorDate: Mon Sep 26 14:55:09 2022 +0200 nimble/ll: Unify PHY tx power API names Consistently use tx_power for transmit power related PHY API. --- nimble/controller/include/controller/ble_phy.h | 6 +++--- nimble/controller/src/ble_ll.c | 8 ++++---- nimble/controller/src/ble_ll_adv.c | 14 +++++++------- nimble/controller/src/ble_ll_dtm.c | 2 +- nimble/controller/src/ble_ll_hci.c | 4 ++-- nimble/controller/src/ble_ll_hci_vs.c | 4 ++-- nimble/drivers/dialog_cmac/src/ble_phy.c | 4 ++-- nimble/drivers/native/src/ble_phy.c | 7 ++++--- nimble/drivers/nrf51/src/ble_phy.c | 7 ++++--- nimble/drivers/nrf5x/src/ble_phy.c | 6 +++--- 10 files changed, 32 insertions(+), 30 deletions(-) diff --git a/nimble/controller/include/controller/ble_phy.h b/nimble/controller/include/controller/ble_phy.h index 495a068c..35ef87ed 100644 --- a/nimble/controller/include/controller/ble_phy.h +++ b/nimble/controller/include/controller/ble_phy.h @@ -111,13 +111,13 @@ int ble_phy_tx(ble_phy_tx_pducb_t pducb, void *pducb_arg, uint8_t end_trans); void ble_phy_rxpdu_copy(uint8_t *dptr, struct os_mbuf *rxpdu); /* Set the transmit power */ -int ble_phy_txpwr_set(int dbm); +int ble_phy_tx_power_set(int dbm); /* Get highest allowed power from range */ -int ble_phy_txpower_round(int dbm); +int ble_phy_tx_power_round(int dbm); /* Get the transmit power */ -int ble_phy_txpwr_get(void); +int ble_phy_tx_power_get(void); /* Disable the PHY */ void ble_phy_disable(void); diff --git a/nimble/controller/src/ble_ll.c b/nimble/controller/src/ble_ll.c index 2ce70765..bcd03740 100644 --- a/nimble/controller/src/ble_ll.c +++ b/nimble/controller/src/ble_ll.c @@ -1350,8 +1350,8 @@ ble_ll_task(void *arg) ble_phy_init(); /* Set output power to default */ - g_ble_ll_tx_power = ble_phy_txpower_round(MYNEWT_VAL(BLE_LL_TX_PWR_DBM)); - ble_phy_txpwr_set(g_ble_ll_tx_power); + g_ble_ll_tx_power = ble_phy_tx_power_round(MYNEWT_VAL(BLE_LL_TX_PWR_DBM)); + ble_phy_tx_power_set(g_ble_ll_tx_power); /* Tell the host that we are ready to receive packets */ ble_ll_hci_send_noop(); @@ -1597,8 +1597,8 @@ ble_ll_reset(void) g_ble_ll_rx_power_compensation = 0; /* Set output power to default */ - g_ble_ll_tx_power = ble_phy_txpower_round(MYNEWT_VAL(BLE_LL_TX_PWR_DBM)); - ble_phy_txpwr_set(g_ble_ll_tx_power); + g_ble_ll_tx_power = ble_phy_tx_power_round(MYNEWT_VAL(BLE_LL_TX_PWR_DBM)); + ble_phy_tx_power_set(g_ble_ll_tx_power); /* FLush all packets from Link layer queues */ ble_ll_flush_pkt_queue(&g_ble_ll_data.ll_tx_pkt_q); diff --git a/nimble/controller/src/ble_ll_adv.c b/nimble/controller/src/ble_ll_adv.c index c26e8521..949335c1 100644 --- a/nimble/controller/src/ble_ll_adv.c +++ b/nimble/controller/src/ble_ll_adv.c @@ -1030,7 +1030,7 @@ ble_ll_adv_tx_done(void *arg) struct ble_ll_adv_sm *advsm; /* reset power to max after advertising */ - ble_phy_txpwr_set(g_ble_ll_tx_power); + ble_phy_tx_power_set(g_ble_ll_tx_power); advsm = (struct ble_ll_adv_sm *)arg; @@ -1111,7 +1111,7 @@ ble_ll_adv_tx_start_cb(struct ble_ll_sched_item *sch) } /* Set the power */ - ble_phy_txpwr_set(advsm->adv_txpwr); + ble_phy_tx_power_set(advsm->adv_txpwr); /* Set channel */ rc = ble_phy_setchan(advsm->adv_chan, BLE_ACCESS_ADDR_ADV, BLE_LL_CRCINIT_ADV); @@ -1255,7 +1255,7 @@ ble_ll_adv_secondary_tx_start_cb(struct ble_ll_sched_item *sch) ble_ll_adv_active_chanset_set_sec(advsm); /* Set the power */ - ble_phy_txpwr_set(advsm->adv_txpwr); + ble_phy_tx_power_set(advsm->adv_txpwr); /* Set channel */ aux = AUX_CURRENT(advsm); @@ -1740,7 +1740,7 @@ ble_ll_adv_halt(void) ble_ll_trace_u32(BLE_LL_TRACE_ID_ADV_HALT, advsm->adv_instance); - ble_phy_txpwr_set(g_ble_ll_tx_power); + ble_phy_tx_power_set(g_ble_ll_tx_power); #if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PERIODIC_ADV) if (advsm->flags & BLE_LL_ADV_SM_FLAG_PERIODIC_SYNC_SENDING) { @@ -2176,7 +2176,7 @@ static void ble_ll_adv_sync_tx_done(struct ble_ll_adv_sm *advsm) { /* reset power to default after advertising */ - ble_phy_txpwr_set(g_ble_ll_tx_power); + ble_phy_tx_power_set(g_ble_ll_tx_power); /* for sync we trace a no pri nor sec set */ ble_ll_trace_u32x2(BLE_LL_TRACE_ID_ADV_TXDONE, advsm->adv_instance, 0); @@ -2232,7 +2232,7 @@ ble_ll_adv_sync_tx_start_cb(struct ble_ll_sched_item *sch) ble_ll_adv_flags_set(advsm, BLE_LL_ADV_SM_FLAG_PERIODIC_SYNC_SENDING); /* Set the power */ - ble_phy_txpwr_set(advsm->adv_txpwr); + ble_phy_tx_power_set(advsm->adv_txpwr); /* Set channel */ sync = SYNC_CURRENT(advsm); @@ -3528,7 +3528,7 @@ ble_ll_adv_ext_set_param(const uint8_t *cmdbuf, uint8_t len, /* no preference */ advsm->adv_txpwr = g_ble_ll_tx_power; } else { - advsm->adv_txpwr = ble_phy_txpower_round(cmd->tx_power); + advsm->adv_txpwr = ble_phy_tx_power_round(cmd->tx_power); } /* we can always store as those are validated and used only when needed */ diff --git a/nimble/controller/src/ble_ll_dtm.c b/nimble/controller/src/ble_ll_dtm.c index db32835c..1b41bc2d 100644 --- a/nimble/controller/src/ble_ll_dtm.c +++ b/nimble/controller/src/ble_ll_dtm.c @@ -243,7 +243,7 @@ ble_ll_dtm_tx_sched_cb(struct ble_ll_sched_item *sch) ble_phy_mode_set(ctx->phy_mode, ctx->phy_mode); #endif ble_phy_set_txend_cb(ble_ll_dtm_tx_done, ctx); - ble_phy_txpwr_set(0); + ble_phy_tx_power_set(0); sch->start_time += g_ble_ll_sched_offset_ticks; diff --git a/nimble/controller/src/ble_ll_hci.c b/nimble/controller/src/ble_ll_hci.c index 39085d4c..6089ed94 100644 --- a/nimble/controller/src/ble_ll_hci.c +++ b/nimble/controller/src/ble_ll_hci.c @@ -786,8 +786,8 @@ ble_ll_read_tx_power(uint8_t *rspbuf, uint8_t *rsplen) { struct ble_hci_le_rd_transmit_power_rp *rsp = (void *) rspbuf; - rsp->min_tx_power = ble_phy_txpower_round(-127); - rsp->max_tx_power = ble_phy_txpower_round(126); + rsp->min_tx_power = ble_phy_tx_power_round(-127); + rsp->max_tx_power = ble_phy_tx_power_round(126); *rsplen = sizeof(*rsp); return BLE_ERR_SUCCESS; diff --git a/nimble/controller/src/ble_ll_hci_vs.c b/nimble/controller/src/ble_ll_hci_vs.c index c6c1e256..8cbf3dca 100644 --- a/nimble/controller/src/ble_ll_hci_vs.c +++ b/nimble/controller/src/ble_ll_hci_vs.c @@ -126,10 +126,10 @@ ble_ll_hci_vs_set_tx_power(uint16_t ocf, const uint8_t *cmdbuf, uint8_t cmdlen, /* restore reset default */ g_ble_ll_tx_power = MYNEWT_VAL(BLE_LL_TX_PWR_DBM); } else { - g_ble_ll_tx_power = ble_phy_txpower_round(cmd->tx_power); + g_ble_ll_tx_power = ble_phy_tx_power_round(cmd->tx_power); } - ble_phy_txpwr_set(g_ble_ll_tx_power); + ble_phy_tx_power_set(g_ble_ll_tx_power); rsp->tx_power = g_ble_ll_tx_power; *rsplen = sizeof(*rsp); diff --git a/nimble/drivers/dialog_cmac/src/ble_phy.c b/nimble/drivers/dialog_cmac/src/ble_phy.c index 33c41d2c..b7e4818c 100644 --- a/nimble/drivers/dialog_cmac/src/ble_phy.c +++ b/nimble/drivers/dialog_cmac/src/ble_phy.c @@ -1652,7 +1652,7 @@ ble_phy_encrypt_disable(void) #endif int -ble_phy_txpwr_set(int dbm) +ble_phy_tx_power_set(int dbm) { #if MYNEWT_VAL(CMAC_DEBUG_DATA_ENABLE) if (g_cmac_shared_data.debug.tx_power_override != INT8_MAX) { @@ -1668,7 +1668,7 @@ ble_phy_txpwr_set(int dbm) } int -ble_phy_txpower_round(int dbm) +ble_phy_tx_power_round(int dbm) { return 0; } diff --git a/nimble/drivers/native/src/ble_phy.c b/nimble/drivers/native/src/ble_phy.c index f9ab0fcb..410b9ce6 100644 --- a/nimble/drivers/native/src/ble_phy.c +++ b/nimble/drivers/native/src/ble_phy.c @@ -464,7 +464,7 @@ ble_phy_tx(ble_phy_tx_pducb_t pducb, void *pducb_arg, uint8_t end_trans) * @return int 0: success; anything else is an error */ int -ble_phy_txpwr_set(int dbm) +ble_phy_tx_power_set(int dbm) { /* Check valid range */ assert(dbm <= BLE_PHY_MAX_PWR_DBM); @@ -492,7 +492,8 @@ ble_phy_txpwr_set(int dbm) * * @return int Rounded power in dBm */ -int ble_phy_txpower_round(int dbm) +int +ble_phy_tx_power_round(int dbm) { /* "Rail" power level if outside supported range */ if (dbm > BLE_XCVR_TX_PWR_MAX_DBM) { @@ -514,7 +515,7 @@ int ble_phy_txpower_round(int dbm) * @return int The current PHY transmit power, in dBm */ int -ble_phy_txpwr_get(void) +ble_phy_tx_power_get(void) { return g_ble_phy_data.phy_txpwr_dbm; } diff --git a/nimble/drivers/nrf51/src/ble_phy.c b/nimble/drivers/nrf51/src/ble_phy.c index 94302ad3..cfcfb7ec 100644 --- a/nimble/drivers/nrf51/src/ble_phy.c +++ b/nimble/drivers/nrf51/src/ble_phy.c @@ -1258,7 +1258,7 @@ ble_phy_tx(ble_phy_tx_pducb_t pducb, void *pducb_arg, uint8_t end_trans) * @return int 0: success; anything else is an error */ int -ble_phy_txpwr_set(int dbm) +ble_phy_tx_power_set(int dbm) { /* Check valid range */ assert(dbm <= BLE_PHY_MAX_PWR_DBM); @@ -1287,7 +1287,8 @@ ble_phy_txpwr_set(int dbm) * * @return int Rounded power in dBm */ -int ble_phy_txpower_round(int dbm) +int +ble_phy_tx_power_round(int dbm) { /* "Rail" power level if outside supported range */ if (dbm > NRF_TX_PWR_MAX_DBM) { @@ -1309,7 +1310,7 @@ int ble_phy_txpower_round(int dbm) * @return int The current PHY transmit power, in dBm */ int -ble_phy_txpwr_get(void) +ble_phy_tx_power_get(void) { return g_ble_phy_data.phy_txpwr_dbm; } diff --git a/nimble/drivers/nrf5x/src/ble_phy.c b/nimble/drivers/nrf5x/src/ble_phy.c index 90d3a346..24f2ed68 100644 --- a/nimble/drivers/nrf5x/src/ble_phy.c +++ b/nimble/drivers/nrf5x/src/ble_phy.c @@ -1926,7 +1926,7 @@ ble_phy_tx(ble_phy_tx_pducb_t pducb, void *pducb_arg, uint8_t end_trans) * @return int 0: success; anything else is an error */ int -ble_phy_txpwr_set(int dbm) +ble_phy_tx_power_set(int dbm) { /* Get actual TX power supported by radio */ dbm = phy_txpower_round(dbm); @@ -1947,7 +1947,7 @@ ble_phy_txpwr_set(int dbm) * @return int Rounded power in dBm */ int -ble_phy_txpower_round(int dbm) +ble_phy_tx_power_round(int dbm) { return phy_txpower_round(dbm); } @@ -1995,7 +1995,7 @@ ble_phy_set_access_addr(uint32_t access_addr) * @return int The current PHY transmit power, in dBm */ int -ble_phy_txpwr_get(void) +ble_phy_tx_power_get(void) { return g_ble_phy_data.phy_txpwr_dbm; }
