Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ieee802154_submac: add initial support for common MAC sub layer #14950

Merged
merged 6 commits into from
Oct 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ ifneq (,$(filter netdev_ieee802154,$(USEMODULE)))
USEMODULE += random
endif

ifneq (,$(filter netdev_ieee802154_submac,$(USEMODULE)))
USEMODULE += ieee802154_radio_hal
USEMODULE += ieee802154_submac
endif

ifneq (,$(filter gnrc_dhcpv6_%, $(USEMODULE)))
USEMODULE += gnrc_dhcpv6
endif
Expand Down Expand Up @@ -191,6 +196,9 @@ ifneq (,$(filter gnrc_netif,$(USEMODULE)))
USEMODULE += netif
USEMODULE += l2util
USEMODULE += fmt
ifneq (,$(filter netdev_ieee802154_submac,$(USEMODULE)))
USEMODULE += gnrc_netif_pktq
endif
ifneq (,$(filter netdev_ieee802154,$(USEMODULE)))
USEMODULE += gnrc_netif_ieee802154
endif
Expand Down Expand Up @@ -437,6 +445,11 @@ ifneq (,$(filter gnrc_pktdump,$(USEMODULE)))
USEMODULE += od
endif

ifneq (,$(filter ieee802154_submac,$(USEMODULE)))
USEMODULE += luid
USEMODULE += xtimer
endif

ifneq (,$(filter od,$(USEMODULE)))
USEMODULE += fmt
endif
Expand Down
70 changes: 70 additions & 0 deletions drivers/include/net/netdev/ieee802154_submac.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright (C) 2020 HAW Hamburg
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License v2.1. See the file LICENSE in the top level directory for more
* details.
*/

/**
* @defgroup drivers_netdev_ieee802154_submac IEEE802.15.4 SubMAC netdev layer
* @ingroup drivers_netdev_api
* @experimental This API is experimental and in an early state - expect
* changes!

* @brief This module defines implements the netdev API on top of the
* IEEE 802.15.4 radio HAL
*
* @{
*
* @author José I. Alamos <jose.alamos@haw-hamburg.de>
*/
#ifndef NET_NETDEV_IEEE802154_SUBMAC_H
#define NET_NETDEV_IEEE802154_SUBMAC_H

#ifdef __cplusplus
extern "C" {
#endif

#include "net/netdev.h"
#include "net/netdev/ieee802154.h"
#include "net/ieee802154/submac.h"
#include "net/ieee802154/radio.h"
#include "xtimer.h"

#include "od.h"
#include "event/thread.h"
#include "event/callback.h"
#include "xtimer.h"

#define NETDEV_SUBMAC_FLAGS_ACK_TIMEOUT (1 << 0) /**< Flag for ACK Timeout event */
#define NETDEV_SUBMAC_FLAGS_TX_DONE (1 << 1) /**< Flag for TX Done event */
#define NETDEV_SUBMAC_FLAGS_RX_DONE (1 << 2) /**< Flag for RX Done event */

/**
* @brief IEEE 802.15.4 SubMAC netdev descriptor
*/
typedef struct {
netdev_ieee802154_t dev; /**< IEEE 802.15.4 netdev descriptor */
ieee802154_submac_t submac; /**< IEEE 802.15.4 SubMAC descriptor */
xtimer_t ack_timer; /**< xtimer descriptor for the ACK timeout timer */
int isr_flags; /**< netdev submac @ref NETDEV_EVENT_ISR flags */
} netdev_ieee802154_submac_t;

/**
* @brief Init the IEEE 802.15.4 SubMAC netdev adoption.
*
* @param[in] netdev_submac pointer to the netdev submac descriptor.
* @param[in] dev pointer to the device associated to @p netdev_submac.
*
* @return 0 on success.
* @return negative errno on failure.
*/
int netdev_ieee802154_submac_init(netdev_ieee802154_submac_t *netdev_submac,
ieee802154_dev_t *dev);
#ifdef __cplusplus
}
#endif

#endif /* NET_NETDEV_IEEE802154_SUBMAC_H */
/** @} */
1 change: 1 addition & 0 deletions drivers/netdev_ieee802154_submac/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include $(RIOTBASE)/Makefile.base
Loading