Skip to content
Permalink
Browse files

net: openthread: Implement frame pending API

Implement OpenThreads frame pending bit management on top of the Zephyrs
radio driver API. This allows for proper Sleepy End Devices handling
from the parent side.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
  • Loading branch information...
rlubos authored and nashif committed Apr 16, 2019
1 parent e0ff342 commit 57629724c2b28acd857747cd232c5a975fe55591
Showing with 77 additions and 5 deletions.
  1. +77 −5 subsys/net/lib/openthread/platform/radio.c
@@ -35,6 +35,8 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);

#include "platform-zephyr.h"

#define SHORT_ADDRESS_SIZE 2

#define FCS_SIZE 2

static otRadioState sState = OT_RADIO_STATE_DISABLED;
@@ -303,14 +305,33 @@ otError otPlatRadioEnergyScan(otInstance *aInstance, u8_t aScanChannel,
void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
{
ARG_UNUSED(aInstance);
ARG_UNUSED(aEnable);

struct ieee802154_config config = {
.auto_ack_fpb.enabled = aEnable
};

(void)radio_api->configure(radio_dev, IEEE802154_CONFIG_AUTO_ACK_FPB,
&config);
}

otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance,
const u16_t aShortAddress)
{
ARG_UNUSED(aInstance);
ARG_UNUSED(aShortAddress);

u8_t short_address[SHORT_ADDRESS_SIZE];
struct ieee802154_config config = {
.ack_fpb.enabled = true,
.ack_fpb.addr = short_address,
.ack_fpb.extended = false
};

sys_put_le16(aShortAddress, short_address);

if (radio_api->configure(radio_dev, IEEE802154_CONFIG_ACK_FPB,
&config) != 0) {
return OT_ERROR_NO_BUFS;
}

return OT_ERROR_NONE;
}
@@ -319,7 +340,17 @@ otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance,
const otExtAddress *aExtAddress)
{
ARG_UNUSED(aInstance);
ARG_UNUSED(aExtAddress);

struct ieee802154_config config = {
.ack_fpb.enabled = true,
.ack_fpb.addr = (u8_t *)aExtAddress->m8,
.ack_fpb.extended = true
};

if (radio_api->configure(radio_dev, IEEE802154_CONFIG_ACK_FPB,
&config) != 0) {
return OT_ERROR_NO_BUFS;
}

return OT_ERROR_NONE;
}
@@ -328,7 +359,20 @@ otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance,
const u16_t aShortAddress)
{
ARG_UNUSED(aInstance);
ARG_UNUSED(aShortAddress);

u8_t short_address[SHORT_ADDRESS_SIZE];
struct ieee802154_config config = {
.ack_fpb.enabled = false,
.ack_fpb.addr = short_address,
.ack_fpb.extended = false
};

sys_put_le16(aShortAddress, short_address);

if (radio_api->configure(radio_dev, IEEE802154_CONFIG_ACK_FPB,
&config) != 0) {
return OT_ERROR_NO_BUFS;
}

return OT_ERROR_NONE;
}
@@ -337,19 +381,47 @@ otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance,
const otExtAddress *aExtAddress)
{
ARG_UNUSED(aInstance);
ARG_UNUSED(aExtAddress);

struct ieee802154_config config = {
.ack_fpb.enabled = false,
.ack_fpb.addr = (u8_t *)aExtAddress->m8,
.ack_fpb.extended = true
};

if (radio_api->configure(radio_dev, IEEE802154_CONFIG_ACK_FPB,
&config) != 0) {
return OT_ERROR_NO_BUFS;
}

return OT_ERROR_NONE;
}

void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance)
{
ARG_UNUSED(aInstance);

struct ieee802154_config config = {
.ack_fpb.enabled = false,
.ack_fpb.addr = NULL,
.ack_fpb.extended = false
};

(void)radio_api->configure(radio_dev, IEEE802154_CONFIG_ACK_FPB,
&config);
}

void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance)
{
ARG_UNUSED(aInstance);

struct ieee802154_config config = {
.ack_fpb.enabled = false,
.ack_fpb.addr = NULL,
.ack_fpb.extended = true
};

(void)radio_api->configure(radio_dev, IEEE802154_CONFIG_ACK_FPB,
&config);
}

int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)

0 comments on commit 5762972

Please sign in to comment.
You can’t perform that action at this time.