From 5451c8b70fe9da99336b795355c9f3791c65f67d Mon Sep 17 00:00:00 2001 From: Artur Hadasz Date: Mon, 28 Feb 2022 13:38:24 +0100 Subject: [PATCH] modules: hal_nordic: 802.15.4 make possible to disable CSMA-CA Currently if an attempt to disable CSMA-CA in by setting an appropriate flag in another (for example application) CmakeLists.txt it caused lots of warnings. This fix allows higher level CMakeLists.txt to disable CSMA-CA without warnings. Signed-off-by: Artur Hadasz --- drivers/ieee802154/ieee802154_nrf5.c | 4 ++++ modules/hal_nordic/nrf_802154/CMakeLists.txt | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 512747540a0..6ee25c48253 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -449,6 +449,7 @@ static bool nrf5_tx_immediate(struct net_pkt *pkt, uint8_t *payload, bool cca) return nrf_802154_transmit_raw(payload, &metadata); } +#if NRF_802154_CSMA_CA_ENABLED static bool nrf5_tx_csma_ca(struct net_pkt *pkt, uint8_t *payload) { nrf_802154_transmit_csma_ca_metadata_t metadata = { @@ -460,6 +461,7 @@ static bool nrf5_tx_csma_ca(struct net_pkt *pkt, uint8_t *payload) return nrf_802154_transmit_csma_ca_raw(payload, &metadata); } +#endif #if IS_ENABLED(CONFIG_NET_PKT_TXTIME) static bool nrf5_tx_at(struct net_pkt *pkt, uint8_t *payload, bool cca) @@ -509,9 +511,11 @@ static int nrf5_tx(const struct device *dev, ret = nrf5_tx_immediate(pkt, nrf5_radio->tx_psdu, mode == IEEE802154_TX_MODE_CCA); break; +#if NRF_802154_CSMA_CA_ENABLED case IEEE802154_TX_MODE_CSMA_CA: ret = nrf5_tx_csma_ca(pkt, nrf5_radio->tx_psdu); break; +#endif #if IS_ENABLED(CONFIG_NET_PKT_TXTIME) case IEEE802154_TX_MODE_TXTIME: case IEEE802154_TX_MODE_TXTIME_CCA: diff --git a/modules/hal_nordic/nrf_802154/CMakeLists.txt b/modules/hal_nordic/nrf_802154/CMakeLists.txt index b533e23d152..d87e5c3bcef 100644 --- a/modules/hal_nordic/nrf_802154/CMakeLists.txt +++ b/modules/hal_nordic/nrf_802154/CMakeLists.txt @@ -67,8 +67,6 @@ target_compile_definitions(zephyr-802154-interface # Number of buffers in receive queue. NRF_802154_RX_BUFFERS=${CONFIG_NRF_802154_RX_BUFFERS} - # Enable CSMA/CA - NRF_802154_CSMA_CA_ENABLED=1 NRF_802154_TX_STARTED_NOTIFY_ENABLED=1 # ACK timeout