diff --git a/drivers/at86rf2xx/at86rf2xx_getset.c b/drivers/at86rf2xx/at86rf2xx_getset.c index c26fa6e261da7d67c188d546cb27a673ed76b4ed..2af840e6ce3fc77a4f049e7f3aeab063617d69d9 100644 --- a/drivers/at86rf2xx/at86rf2xx_getset.c +++ b/drivers/at86rf2xx/at86rf2xx_getset.c @@ -380,6 +380,13 @@ void at86rf2xx_set_option(at86rf2xx_t *dev, uint16_t option, bool state) : (tmp & ~AT86RF2XX_IRQ_STATUS_MASK__RX_START); at86rf2xx_reg_write(dev, AT86RF2XX_REG__IRQ_MASK, tmp); break; + case AT86RF2XX_OPT_ACK_PENDING: + DEBUG("[at86rf2xx] opt: enabling pending ACKs\n"); + tmp = at86rf2xx_reg_read(dev, AT86RF2XX_REG__CSMA_SEED_1); + tmp = (state) ? (tmp | AT86RF2XX_CSMA_SEED_1__AACK_SET_PD) + : (tmp & ~AT86RF2XX_CSMA_SEED_1__AACK_SET_PD); + at86rf2xx_reg_write(dev, AT86RF2XX_REG__CSMA_SEED_1, tmp); + break; default: /* do nothing */ break; diff --git a/drivers/at86rf2xx/at86rf2xx_netdev.c b/drivers/at86rf2xx/at86rf2xx_netdev.c index 99422c3b17a51e4139ede3fd7d6bba3a56e11a85..54fbd9d9bba2102317e0fdb26dca17c312e2edd3 100644 --- a/drivers/at86rf2xx/at86rf2xx_netdev.c +++ b/drivers/at86rf2xx/at86rf2xx_netdev.c @@ -486,6 +486,12 @@ static int _set(netdev_t *netdev, netopt_t opt, const void *val, size_t len) res = sizeof(netopt_enable_t); break; + case NETOPT_ACK_PENDING: + at86rf2xx_set_option(dev, AT86RF2XX_OPT_ACK_PENDING, + ((const bool *)val)[0]); + res = sizeof(netopt_enable_t); + break; + case NETOPT_RETRANS: assert(len <= sizeof(uint8_t)); at86rf2xx_set_max_retries(dev, *((const uint8_t *)val)); diff --git a/drivers/include/at86rf2xx.h b/drivers/include/at86rf2xx.h index c6873c4b5cfba41558c3a02b4658b63f85f9259d..b1c2bc6ef420e06b4e7dac6d56b2a1739e29c62f 100644 --- a/drivers/include/at86rf2xx.h +++ b/drivers/include/at86rf2xx.h @@ -135,6 +135,7 @@ extern "C" { #define AT86RF2XX_OPT_SRC_ADDR_LONG (NETDEV_IEEE802154_SRC_MODE_LONG) /**< legacy define */ #define AT86RF2XX_OPT_RAWDUMP (NETDEV_IEEE802154_RAW) /**< legacy define */ #define AT86RF2XX_OPT_AUTOACK (NETDEV_IEEE802154_ACK_REQ) /**< legacy define */ +#define AT86RF2XX_OPT_ACK_PENDING (NETDEV_IEEE802154_FRAME_PEND) /**< legacy define */ #define AT86RF2XX_OPT_CSMA (0x0100) /**< CSMA active */ #define AT86RF2XX_OPT_PROMISCUOUS (0x0200) /**< promiscuous mode diff --git a/drivers/include/net/netdev/ieee802154.h b/drivers/include/net/netdev/ieee802154.h index 5a7726bb0d37b14f0395383df63a11a0165ff66f..c98abbd8657dc8babb94aba03f300e60ffe3ccad 100644 --- a/drivers/include/net/netdev/ieee802154.h +++ b/drivers/include/net/netdev/ieee802154.h @@ -53,6 +53,11 @@ extern "C" { * @brief request ACK from receiver */ #define NETDEV_IEEE802154_ACK_REQ (IEEE802154_FCF_ACK_REQ) + +/** + * @brief set frame pending bit + */ +#define NETDEV_IEEE802154_FRAME_PEND (IEEE802154_FCF_FRAME_PEND) /** * @} */ diff --git a/sys/include/net/netopt.h b/sys/include/net/netopt.h index 2f084a0c8cc8b83cc240af3c7f5a2d7768664d54..65d283e13ed736e58af019892f78d36f5a0e2787 100644 --- a/sys/include/net/netopt.h +++ b/sys/include/net/netopt.h @@ -147,6 +147,12 @@ typedef enum { * the current state */ NETOPT_AUTOACK, /**< en/disable link layer auto ACKs or read * the current state */ + NETOPT_ACK_PENDING, /**< en/disable the frame pending bit of ACKs. + * This bit is copied into the frame pending + * subfield of the ACK if it is the response + * to a data request MAC command frame, which + * lets the data request sender know if the ACK + * sender has pending data or not. */ NETOPT_ACK_REQ, /**< en/disable acknowledgement requests or * read the current state */ NETOPT_RETRANS, /**< get/set the maximum number of diff --git a/sys/net/crosslayer/netopt/netopt.c b/sys/net/crosslayer/netopt/netopt.c index 6df4bd1d14a2a5a79935c749f4b2c721011bdf57..227559f3cc1f78f530ba398627a29dc21025b827 100644 --- a/sys/net/crosslayer/netopt/netopt.c +++ b/sys/net/crosslayer/netopt/netopt.c @@ -45,6 +45,7 @@ static const char *_netopt_strmap[] = { [NETOPT_PRELOADING] = "NETOPT_PRELOADING", [NETOPT_PROMISCUOUSMODE] = "NETOPT_PROMISCUOUSMODE", [NETOPT_AUTOACK] = "NETOPT_AUTOACK", + [NETOPT_ACK_PENDING] = "NETOPT_ACK_PENDING", [NETOPT_ACK_REQ] = "NETOPT_ACK_REQ", [NETOPT_RETRANS] = "NETOPT_RETRANS", [NETOPT_PROTO] = "NETOPT_PROTO",