Skip to content

Commit 43ee21b

Browse files
radua-nxpJA-NXP
authored andcommitted
drivers: ieee802154: mcxw: setting RX state in accordance with rx_on_when_idle
setting RX state in accordance with rx_on_when_idle Signed-off-by: Jamel <jamel.arbi@nxp.com>
1 parent afcfbf6 commit 43ee21b

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

drivers/ieee802154/ieee802154_mcxw.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ static uint32_t rf_adjust_tstamp_from_app(uint32_t time);
9898

9999
static void rf_rx_on_idle(uint32_t newValue);
100100
static void rf_set_rx_time_poll(uint32_t time_poll);
101+
static void set_rx_state(void);
101102

102103
static uint8_t ot_phy_ctx = (uint8_t)(-1);
103104
static struct mcxw_context mcxw_ctx;
@@ -1240,7 +1241,7 @@ phyStatus_t pd_mac_sap_handler(void *msg, instanceId_t instance)
12401241

12411242
mcxw_ctx.tx_frame.length = 0;
12421243
mcxw_ctx.tx_status = 0;
1243-
mcxw_ctx.state = RADIO_STATE_RECEIVE;
1244+
set_rx_state();
12441245

12451246
mcxw_ctx.rx_ack_frame.channel = mcxw_ctx.channel;
12461247
mcxw_ctx.rx_ack_frame.length = data_msg->msgData.dataCnf.ackLength;
@@ -1324,7 +1325,7 @@ phyStatus_t plme_mac_sap_handler(void *msg, instanceId_t instance)
13241325
} else {
13251326
mcxw_ctx.tx_status = 0;
13261327
}
1327-
mcxw_ctx.state = RADIO_STATE_RECEIVE;
1328+
set_rx_state();
13281329

13291330
k_sem_give(&mcxw_ctx.cca_wait);
13301331
break;
@@ -1351,7 +1352,7 @@ phyStatus_t plme_mac_sap_handler(void *msg, instanceId_t instance)
13511352
}
13521353
#endif
13531354

1354-
mcxw_ctx.state = RADIO_STATE_RECEIVE;
1355+
set_rx_state();
13551356
/* No ack */
13561357
mcxw_ctx.tx_status = ENOMSG;
13571358

@@ -1374,7 +1375,7 @@ phyStatus_t plme_mac_sap_handler(void *msg, instanceId_t instance)
13741375
}
13751376
#endif
13761377

1377-
mcxw_ctx.state = RADIO_STATE_RECEIVE;
1378+
set_rx_state();
13781379
mcxw_ctx.tx_status = EIO;
13791380

13801381
k_sem_give(&mcxw_ctx.tx_wait);
@@ -1479,6 +1480,7 @@ static int mcxw_configure(const struct device *dev, enum ieee802154_config_type
14791480
} else {
14801481
rf_rx_on_idle(RX_ON_IDLE_STOP);
14811482
}
1483+
set_rx_state();
14821484
break;
14831485

14841486
case IEEE802154_CONFIG_EVENT_HANDLER:
@@ -1629,6 +1631,16 @@ static void rf_set_rx_time_poll(uint32_t time_poll)
16291631
MAC_PLME_SapHandler(&msg, ot_phy_ctx);
16301632
}
16311633

1634+
static void set_rx_state(void)
1635+
{
1636+
if (rx_on_when_idle) {
1637+
mcxw_ctx.state = RADIO_STATE_RECEIVE;
1638+
}
1639+
else {
1640+
mcxw_ctx.state = RADIO_STATE_DISABLED;
1641+
}
1642+
}
1643+
16321644
static const struct ieee802154_radio_api mcxw71_radio_api = {
16331645
.iface_api.init = mcxw_iface_init,
16341646

0 commit comments

Comments
 (0)