drivers: ieee802154_nrf5: Implement configure API

Implement newly introduced `configure` API for nRF 802154 radio driver.

Increase maximum number of slots for Frame Pending bit information in
the radio driver.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2019-04-16 14:52:59 +02:00 committed by Anas Nashif
commit e0ff342a89
2 changed files with 44 additions and 2 deletions

View file

@ -388,6 +388,47 @@ static void nrf5_iface_init(struct net_if *iface)
ieee802154_init(iface);
}
int nrf5_configure(struct device *dev, enum ieee802154_config_type type,
const struct ieee802154_config *config)
{
ARG_UNUSED(dev);
switch (type) {
case IEEE802154_CONFIG_AUTO_ACK_FPB:
nrf_802154_auto_pending_bit_set(config->auto_ack_fpb.enabled);
break;
case IEEE802154_CONFIG_ACK_FPB:
if (config->ack_fpb.enabled) {
if (!nrf_802154_pending_bit_for_addr_set(
config->ack_fpb.addr,
config->ack_fpb.extended)) {
return -ENOMEM;
}
break;
}
if (config->ack_fpb.addr != NULL) {
if (!nrf_802154_pending_bit_for_addr_clear(
config->ack_fpb.addr,
config->ack_fpb.extended)) {
return -ENOENT;
}
} else {
nrf_802154_pending_bit_for_addr_reset(
config->ack_fpb.extended);
}
break;
default:
return -EINVAL;
}
return 0;
}
/* nRF5 radio driver callbacks */
void nrf_802154_received_raw(uint8_t *data, int8_t power, uint8_t lqi)
@ -468,6 +509,7 @@ static struct ieee802154_radio_api nrf5_radio_api = {
.start = nrf5_start,
.stop = nrf5_stop,
.tx = nrf5_tx,
.configure = nrf5_configure,
};
#if defined(CONFIG_NET_L2_IEEE802154)

View file

@ -52,11 +52,11 @@ zephyr_compile_definitions(
# Number of slots containing short addresses of nodes for which
# pending data is stored.
NRF_802154_PENDING_SHORT_ADDRESSES=1
NRF_802154_PENDING_SHORT_ADDRESSES=16
# Number of slots containing extended addresses of nodes for which
# pending data is stored.
NRF_802154_PENDING_EXTENDED_ADDRESSES=1
NRF_802154_PENDING_EXTENDED_ADDRESSES=16
# Number of buffers in receive queue.
NRF_802154_RX_BUFFERS=8