Skip to content

Commit 888b949

Browse files
committed
drivers: ieee802154: configure IE header injection for nRF5
Pass enh ack data injection arguments to the nRF5 radio driver. Signed-off-by: Lukasz Maciejonczyk <[email protected]>
1 parent 4113a43 commit 888b949

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

drivers/ieee802154/ieee802154_nrf5.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
4141

4242
#include "ieee802154_nrf5.h"
4343
#include "nrf_802154.h"
44+
#include "nrf_802154_const.h"
4445

4546
#if defined(CONFIG_NRF_802154_SER_HOST)
4647
#include "nrf_802154_serialization_error.h"
@@ -686,6 +687,27 @@ static int nrf5_configure(const struct device *dev,
686687
case IEEE802154_CONFIG_EVENT_HANDLER:
687688
nrf5_data.event_handler = config->event_handler;
688689

690+
case IEEE802154_CONFIG_ENH_ACK_HEADER_IE: {
691+
uint8_t short_addr_le[SHORT_ADDRESS_SIZE];
692+
uint8_t ext_addr_le[EXTENDED_ADDRESS_SIZE];
693+
694+
/* We expect that addresses are in big endian format, but radio driver requires
695+
* to have them in little endian. Convert addresses to little endian.
696+
*/
697+
sys_put_le16(config->ack_ie.short_addr, short_addr_le);
698+
sys_memcpy_swap(ext_addr_le, config->ack_ie.ext_addr, EXTENDED_ADDRESS_SIZE);
699+
700+
if (config->ack_ie.data_len > 0) {
701+
nrf_802154_ack_data_set(short_addr_le, false, config->ack_ie.data,
702+
config->ack_ie.data_len, NRF_802154_ACK_DATA_IE);
703+
nrf_802154_ack_data_set(ext_addr_le, true, config->ack_ie.data,
704+
config->ack_ie.data_len, NRF_802154_ACK_DATA_IE);
705+
} else {
706+
nrf_802154_ack_data_clear(short_addr_le, false, NRF_802154_ACK_DATA_IE);
707+
nrf_802154_ack_data_clear(ext_addr_le, true, NRF_802154_ACK_DATA_IE);
708+
}
709+
} break;
710+
689711
default:
690712
return -EINVAL;
691713
}

0 commit comments

Comments
 (0)