Skip to content

Commit b890545

Browse files
e-rkrlubos
authored andcommitted
[nrf fromlist] drivers: ieee802154: nrf5: Add temporary API migration code
The transmit functions will return an error code, instead of a boolean value. To prepare for this, the API calls are temporarily implemented in two variants, for old and new API declarations. The presence of new API will be detected by the use of NRF_802154_TX_FUNCTIONS_RETURN_ERROR_CODE macro, which will be unconditionally defined by a newer nrf-802154 driver. Upstream PR #: 96219 Signed-off-by: Rafał Kuźnia <[email protected]>
1 parent d792280 commit b890545

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

drivers/ieee802154/ieee802154_nrf5.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,13 @@ static bool nrf5_tx_immediate(struct net_pkt *pkt, uint8_t *payload, bool cca)
499499
},
500500
};
501501

502+
#ifdef NRF_802154_TX_FUNCTIONS_RETURN_ERROR_CODE
503+
nrf_802154_tx_error_t result = nrf_802154_transmit_raw(payload, &metadata);
504+
505+
return result == NRF_802154_TX_ERROR_NONE;
506+
#else
502507
return nrf_802154_transmit_raw(payload, &metadata);
508+
#endif
503509
}
504510

505511
#if NRF_802154_CSMA_CA_ENABLED
@@ -516,7 +522,13 @@ static bool nrf5_tx_csma_ca(struct net_pkt *pkt, uint8_t *payload)
516522
},
517523
};
518524

525+
#ifdef NRF_802154_TX_FUNCTIONS_RETURN_ERROR_CODE
526+
nrf_802154_tx_error_t result = nrf_802154_transmit_csma_ca_raw(payload, &metadata);
527+
528+
return result == NRF_802154_TX_ERROR_NONE;
529+
#else
519530
return nrf_802154_transmit_csma_ca_raw(payload, &metadata);
531+
#endif
520532
}
521533
#endif
522534

@@ -573,7 +585,13 @@ static bool nrf5_tx_at(struct nrf5_802154_data *nrf5_radio, struct net_pkt *pkt,
573585
uint64_t tx_at = nrf_802154_timestamp_phr_to_shr_convert(
574586
net_pkt_timestamp_ns(pkt) / NSEC_PER_USEC);
575587

588+
#ifdef NRF_802154_TX_FUNCTIONS_RETURN_ERROR_CODE
589+
nrf_802154_tx_error_t result = nrf_802154_transmit_raw_at(payload, tx_at, &metadata);
590+
591+
return result == NRF_802154_TX_ERROR_NONE;
592+
#else
576593
return nrf_802154_transmit_raw_at(payload, tx_at, &metadata);
594+
#endif
577595
}
578596
#endif /* CONFIG_NET_PKT_TXTIME */
579597

0 commit comments

Comments
 (0)