drivers: ieee802154: nrf: make selective tx power the default
Remove `IEEE802154_SELECTIVE_TXPOWER` option. Cache the tx power value in nRF5 driver and make use of it on each operation. Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no> Signed-off-by: Jędrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
This commit is contained in:
parent
1bbaaeffb0
commit
5767998d4f
|
@ -182,6 +182,8 @@ Drivers and Sensors
|
|||
|
||||
* IEEE 802.15.4
|
||||
|
||||
* Removed :kconfig:option:`CONFIG_IEEE802154_SELECTIVE_TXPOWER` Kconfig option.
|
||||
|
||||
* Interrupt Controller
|
||||
|
||||
* Input
|
||||
|
|
|
@ -98,11 +98,6 @@ config IEEE802154_CSL_DEBUG
|
|||
help
|
||||
Enable support for CSL debugging by avoiding sleep state in favor of receive state.
|
||||
|
||||
config IEEE802154_SELECTIVE_TXPOWER
|
||||
bool "Support selective TX power setting"
|
||||
help
|
||||
Enable support for selectively setting TX power for every transmission request.
|
||||
|
||||
module = IEEE802154_DRIVER
|
||||
module-str = IEEE 802.15.4 driver
|
||||
module-help = Sets log level for IEEE 802.15.4 Device Drivers.
|
||||
|
|
|
@ -375,7 +375,7 @@ static int nrf5_set_txpower(const struct device *dev, int16_t dbm)
|
|||
|
||||
LOG_DBG("%d", dbm);
|
||||
|
||||
nrf_802154_tx_power_set(dbm);
|
||||
nrf5_data.txpwr = dbm;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -454,10 +454,8 @@ static bool nrf5_tx_immediate(struct net_pkt *pkt, uint8_t *payload, bool cca)
|
|||
},
|
||||
.cca = cca,
|
||||
.tx_power = {
|
||||
.use_metadata_value = IS_ENABLED(CONFIG_IEEE802154_SELECTIVE_TXPOWER),
|
||||
#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER)
|
||||
.power = net_pkt_ieee802154_txpwr(pkt),
|
||||
#endif
|
||||
.use_metadata_value = true,
|
||||
.power = nrf5_data.txpwr,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -473,10 +471,8 @@ static bool nrf5_tx_csma_ca(struct net_pkt *pkt, uint8_t *payload)
|
|||
.dynamic_data_is_set = net_pkt_ieee802154_mac_hdr_rdy(pkt),
|
||||
},
|
||||
.tx_power = {
|
||||
.use_metadata_value = IS_ENABLED(CONFIG_IEEE802154_SELECTIVE_TXPOWER),
|
||||
#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER)
|
||||
.power = net_pkt_ieee802154_txpwr(pkt),
|
||||
#endif
|
||||
.use_metadata_value = true,
|
||||
.power = nrf5_data.txpwr,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -519,10 +515,8 @@ static bool nrf5_tx_at(struct nrf5_802154_data *nrf5_radio, struct net_pkt *pkt,
|
|||
.cca = cca,
|
||||
.channel = nrf_802154_channel_get(),
|
||||
.tx_power = {
|
||||
.use_metadata_value = IS_ENABLED(CONFIG_IEEE802154_SELECTIVE_TXPOWER),
|
||||
#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER)
|
||||
.power = net_pkt_ieee802154_txpwr(pkt),
|
||||
#endif
|
||||
.use_metadata_value = true,
|
||||
.power = nrf5_data.txpwr,
|
||||
},
|
||||
#if defined(CONFIG_IEEE802154_NRF5_MULTIPLE_CCA)
|
||||
.extra_cca_attempts = max_extra_cca_attempts,
|
||||
|
@ -660,6 +654,8 @@ static int nrf5_start(const struct device *dev)
|
|||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
nrf_802154_tx_power_set(nrf5_data.txpwr);
|
||||
|
||||
if (!nrf_802154_receive()) {
|
||||
LOG_ERR("Failed to enter receive state");
|
||||
return -EIO;
|
||||
|
@ -702,6 +698,8 @@ static int nrf5_continuous_carrier(const struct device *dev)
|
|||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
nrf_802154_tx_power_set(nrf5_data.txpwr);
|
||||
|
||||
if (!nrf_802154_continuous_carrier()) {
|
||||
LOG_ERR("Failed to enter continuous carrier state");
|
||||
return -EIO;
|
||||
|
|
|
@ -97,6 +97,9 @@ struct nrf5_802154_data {
|
|||
uint8_t max_extra_cca_attempts;
|
||||
#endif
|
||||
|
||||
/* The TX power in dBm. */
|
||||
int8_t txpwr;
|
||||
|
||||
#if defined(CONFIG_NRF_802154_SER_HOST) && defined(CONFIG_IEEE802154_CSL_ENDPOINT)
|
||||
/* The last configured value of CSL period in units of 10 symbols. */
|
||||
uint32_t csl_period;
|
||||
|
|
|
@ -59,12 +59,6 @@ struct net_pkt_cb_ieee802154 {
|
|||
*/
|
||||
uint8_t rssi;
|
||||
};
|
||||
#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER)
|
||||
/* TX packets */
|
||||
struct {
|
||||
int8_t txpwr; /* TX power in dBm. */
|
||||
};
|
||||
#endif /* CONFIG_IEEE802154_SELECTIVE_TXPOWER */
|
||||
};
|
||||
|
||||
/* Flags */
|
||||
|
@ -185,18 +179,6 @@ static inline void net_pkt_set_ieee802154_rssi_dbm(struct net_pkt *pkt, int16_t
|
|||
CODE_UNREACHABLE;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER)
|
||||
static inline int8_t net_pkt_ieee802154_txpwr(struct net_pkt *pkt)
|
||||
{
|
||||
return net_pkt_cb_ieee802154(pkt)->txpwr;
|
||||
}
|
||||
|
||||
static inline void net_pkt_set_ieee802154_txpwr(struct net_pkt *pkt, int8_t txpwr)
|
||||
{
|
||||
net_pkt_cb_ieee802154(pkt)->txpwr = txpwr;
|
||||
}
|
||||
#endif /* CONFIG_IEEE802154_SELECTIVE_TXPOWER */
|
||||
|
||||
static inline bool net_pkt_ieee802154_ack_fpb(struct net_pkt *pkt)
|
||||
{
|
||||
return net_pkt_cb_ieee802154(pkt)->ack_fpb;
|
||||
|
|
|
@ -384,13 +384,8 @@ void transmit_message(struct k_work *tx_job)
|
|||
|
||||
channel = sTransmitFrame.mChannel;
|
||||
|
||||
radio_api->set_channel(radio_dev, sTransmitFrame.mChannel);
|
||||
|
||||
#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER)
|
||||
net_pkt_set_ieee802154_txpwr(tx_pkt, get_transmit_power_for_channel(channel));
|
||||
#else
|
||||
radio_api->set_channel(radio_dev, channel);
|
||||
radio_api->set_txpower(radio_dev, get_transmit_power_for_channel(channel));
|
||||
#endif /* CONFIG_IEEE802154_SELECTIVE_TXPOWER */
|
||||
|
||||
net_pkt_set_ieee802154_frame_secured(tx_pkt,
|
||||
sTransmitFrame.mInfo.mTxInfo.mIsSecurityProcessed);
|
||||
|
|
Loading…
Reference in a new issue