gnrc: make all gnrc modules sub-modules of gnrc
This commit is contained in:
parent
6b22e15a54
commit
58ff31bfe9
183
Makefile.dep
183
Makefile.dep
|
@ -2,16 +2,8 @@ ifneq (,$(filter gnrc_%,$(filter-out gnrc_netapi gnrc_netreg gnrc_netif% gnrc_pk
|
|||
USEMODULE += gnrc
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_netif_default,$(USEMODULE)))
|
||||
USEMODULE += ng_netif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_netif,$(USEMODULE)))
|
||||
USEMODULE += gnrc
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_nomac,$(USEMODULE)))
|
||||
USEMODULE += gnrc
|
||||
ifneq (,$(filter gnrc_netif_default,$(USEMODULE)))
|
||||
USEMODULE += gnrc_netif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter at86rf2%,$(USEMODULE)))
|
||||
|
@ -27,100 +19,97 @@ ifneq (,$(filter xbee,$(USEMODULE)))
|
|||
USEMODULE += ieee802154
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_zep,$(USEMODULE)))
|
||||
ifneq (,$(filter gnrc_zep,$(USEMODULE)))
|
||||
USEMODULE += hashes
|
||||
USEMODULE += ieee802154
|
||||
USEMODULE += ng_udp
|
||||
USEMODULE += gnrc_udp
|
||||
USEMODULE += random
|
||||
USEMODULE += vtimer
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_rpl,$(USEMODULE)))
|
||||
ifneq (,$(filter gnrc_rpl,$(USEMODULE)))
|
||||
USEMODULE += fib
|
||||
USEMODULE += gnrc
|
||||
USEMODULE += ng_ipv6_router_default
|
||||
USEMODULE += gnrc_ipv6_router_default
|
||||
USEMODULE += trickle
|
||||
USEMODULE += vtimer
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ieee802154,$(USEMODULE)))
|
||||
ifneq (,$(filter ng_ipv6, $(USEMODULE)))
|
||||
USEMODULE += ng_sixlowpan
|
||||
ifneq (,$(filter gnrc_ipv6, $(USEMODULE)))
|
||||
USEMODULE += gnrc_sixlowpan
|
||||
endif
|
||||
ifneq (,$(filter ng_ipv6_router, $(USEMODULE)))
|
||||
USEMODULE += ng_sixlowpan # TODO: replace with ng_sixlowpan_router
|
||||
ifneq (,$(filter gnrc_ipv6_router, $(USEMODULE)))
|
||||
USEMODULE += gnrc_sixlowpan # TODO: replace with gnrc_sixlowpan_router
|
||||
endif
|
||||
ifneq (,$(filter ng_ipv6_default, $(USEMODULE)))
|
||||
USEMODULE += ng_sixlowpan_default
|
||||
ifneq (,$(filter gnrc_ipv6_default, $(USEMODULE)))
|
||||
USEMODULE += gnrc_sixlowpan_default
|
||||
endif
|
||||
ifneq (,$(filter ng_ipv6_router_default, $(USEMODULE)))
|
||||
USEMODULE += ng_sixlowpan_default # TODO: replace with ng_sixlowpan_router_default
|
||||
ifneq (,$(filter gnrc_ipv6_router_default, $(USEMODULE)))
|
||||
USEMODULE += gnrc_sixlowpan_default # TODO: replace with gnrc_sixlowpan_router_default
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_sixlowpan_default,$(USEMODULE)))
|
||||
USEMODULE += ng_ipv6_default
|
||||
USEMODULE += ng_sixlowpan
|
||||
USEMODULE += ng_sixlowpan_frag
|
||||
USEMODULE += ng_sixlowpan_iphc
|
||||
ifneq (,$(filter gnrc_sixlowpan_default,$(USEMODULE)))
|
||||
USEMODULE += gnrc_ipv6_default
|
||||
USEMODULE += gnrc_sixlowpan
|
||||
USEMODULE += gnrc_sixlowpan_frag
|
||||
USEMODULE += gnrc_sixlowpan_iphc
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_sixlowpan_frag,$(USEMODULE)))
|
||||
USEMODULE += ng_sixlowpan
|
||||
ifneq (,$(filter gnrc_sixlowpan_frag,$(USEMODULE)))
|
||||
USEMODULE += gnrc_sixlowpan
|
||||
USEMODULE += vtimer
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_sixlowpan_iphc,$(USEMODULE)))
|
||||
USEMODULE += ng_sixlowpan
|
||||
USEMODULE += ng_sixlowpan_ctx
|
||||
ifneq (,$(filter gnrc_sixlowpan_iphc,$(USEMODULE)))
|
||||
USEMODULE += gnrc_sixlowpan
|
||||
USEMODULE += gnrc_sixlowpan_ctx
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_sixlowpan,$(USEMODULE)))
|
||||
USEMODULE += ng_ipv6
|
||||
USEMODULE += ng_sixlowpan_netif
|
||||
USEMODULE += gnrc
|
||||
ifneq (,$(filter gnrc_sixlowpan,$(USEMODULE)))
|
||||
USEMODULE += gnrc_ipv6
|
||||
USEMODULE += gnrc_sixlowpan_netif
|
||||
USEMODULE += sixlowpan
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_sixlowpan_ctx,$(USEMODULE)))
|
||||
ifneq (,$(filter gnrc_sixlowpan_ctx,$(USEMODULE)))
|
||||
USEMODULE += ipv6_addr
|
||||
USEMODULE += vtimer
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_ipv6_default,$(USEMODULE)))
|
||||
USEMODULE += ng_ipv6
|
||||
USEMODULE += ng_icmpv6
|
||||
USEMODULE += ng_ndp
|
||||
USEMODULE += ng_ndp_internal
|
||||
USEMODULE += ng_ndp_node
|
||||
ifneq (,$(filter gnrc_ipv6_default,$(USEMODULE)))
|
||||
USEMODULE += gnrc_ipv6
|
||||
USEMODULE += gnrc_icmpv6
|
||||
USEMODULE += gnrc_ndp
|
||||
USEMODULE += gnrc_ndp_internal
|
||||
USEMODULE += gnrc_ndp_node
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_ipv6_router_default,$(USEMODULE)))
|
||||
USEMODULE += ng_ipv6_router
|
||||
USEMODULE += ng_icmpv6
|
||||
USEMODULE += ng_ndp
|
||||
USEMODULE += ng_ndp_internal
|
||||
USEMODULE += ng_ndp_node
|
||||
ifneq (,$(filter gnrc_ipv6_router_default,$(USEMODULE)))
|
||||
USEMODULE += gnrc_ipv6_router
|
||||
USEMODULE += gnrc_icmpv6
|
||||
USEMODULE += gnrc_ndp
|
||||
USEMODULE += gnrc_ndp_internal
|
||||
USEMODULE += gnrc_ndp_node
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_ndp,$(USEMODULE)))
|
||||
USEMODULE += ng_icmpv6
|
||||
ifneq (,$(filter gnrc_ndp,$(USEMODULE)))
|
||||
USEMODULE += gnrc_icmpv6
|
||||
USEMODULE += random
|
||||
USEMODULE += timex
|
||||
USEMODULE += vtimer
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_icmpv6_echo,$(USEMODULE)))
|
||||
USEMODULE += ng_icmpv6
|
||||
USEMODULE += gnrc
|
||||
ifneq (,$(filter gnrc_icmpv6_echo,$(USEMODULE)))
|
||||
USEMODULE += gnrc_icmpv6
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_icmpv6,$(USEMODULE)))
|
||||
ifneq (,$(filter gnrc_icmpv6,$(USEMODULE)))
|
||||
USEMODULE += inet_csum
|
||||
USEMODULE += ng_ipv6
|
||||
USEMODULE += gnrc_ipv6
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_rpl_srh,$(USEMODULE)))
|
||||
ifneq (,$(filter gnrc_rpl_srh,$(USEMODULE)))
|
||||
USEMODULE += ipv6_ext_rh
|
||||
endif
|
||||
|
||||
|
@ -128,27 +117,26 @@ ifneq (,$(filter ipv6_ext_rh,$(USEMODULE)))
|
|||
USEMODULE += ipv6_ext
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_ipv6_ext,$(USEMODULE)))
|
||||
ifneq (,$(filter gnrc_ipv6_ext,$(USEMODULE)))
|
||||
USEMODULE += ipv6_ext
|
||||
USEMODULE += ng_ipv6
|
||||
USEMODULE += gnrc_ipv6
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_ipv6_router,$(USEMODULE)))
|
||||
USEMODULE += ng_ipv6
|
||||
ifneq (,$(filter gnrc_ipv6_router,$(USEMODULE)))
|
||||
USEMODULE += gnrc_ipv6
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_ipv6,$(USEMODULE)))
|
||||
ifneq (,$(filter gnrc_ipv6,$(USEMODULE)))
|
||||
USEMODULE += inet_csum
|
||||
USEMODULE += ipv6_addr
|
||||
USEMODULE += ng_ipv6_hdr
|
||||
USEMODULE += ng_ipv6_nc
|
||||
USEMODULE += ng_ipv6_netif
|
||||
USEMODULE += gnrc
|
||||
USEMODULE += gnrc_ipv6_hdr
|
||||
USEMODULE += gnrc_ipv6_nc
|
||||
USEMODULE += gnrc_ipv6_netif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_ipv6_hdr,$(USEMODULE)))
|
||||
ifneq (,$(filter gnrc_ipv6_hdr,$(USEMODULE)))
|
||||
USEMODULE += ipv6_hdr
|
||||
USEMODULE += ng_pktbuf
|
||||
USEMODULE += gnrc_pktbuf
|
||||
endif
|
||||
|
||||
ifneq (,$(filter sixlowpan,$(USEMODULE)))
|
||||
|
@ -159,55 +147,42 @@ ifneq (,$(filter ipv6_hdr,$(USEMODULE)))
|
|||
USEMODULE += inet_csum
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_ipv6_nc,$(USEMODULE)))
|
||||
ifneq (,$(filter gnrc_ipv6_nc,$(USEMODULE)))
|
||||
USEMODULE += ipv6_addr
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_ipv6_netif,$(USEMODULE)))
|
||||
ifneq (,$(filter gnrc_ipv6_netif,$(USEMODULE)))
|
||||
USEMODULE += ipv6_addr
|
||||
USEMODULE += ng_netif
|
||||
USEMODULE += gnrc_netif
|
||||
USEMODULE += bitfield
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_udp,$(USEMODULE)))
|
||||
USEMODULE += gnrc
|
||||
ifneq (,$(filter gnrc_udp,$(USEMODULE)))
|
||||
USEMODULE += inet_csum
|
||||
USEMODULE += udp
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_nettest,$(USEMODULE)))
|
||||
USEMODULE += ng_netapi
|
||||
USEMODULE += ng_netreg
|
||||
USEMODULE += ng_netif
|
||||
USEMODULE += ng_pktbuf
|
||||
ifneq (,$(filter gnrc_nettest,$(USEMODULE)))
|
||||
USEMODULE += gnrc_netapi
|
||||
USEMODULE += gnrc_netreg
|
||||
USEMODULE += gnrc_netif
|
||||
USEMODULE += gnrc_pktbuf
|
||||
USEMODULE += vtimer
|
||||
endif
|
||||
|
||||
ifneq (,$(filter gnrc,$(USEMODULE)))
|
||||
USEMODULE += ng_netapi
|
||||
USEMODULE += ng_netreg
|
||||
USEMODULE += ng_netif
|
||||
USEMODULE += ng_netif_hdr
|
||||
USEMODULE += ng_pktbuf
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_pktdump,$(USEMODULE)))
|
||||
USEMODULE += ng_pktbuf
|
||||
ifneq (,$(filter gnrc_pktdump,$(USEMODULE)))
|
||||
USEMODULE += gnrc_pktbuf
|
||||
USEMODULE += od
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_pktbuf, $(USEMODULE)))
|
||||
ifeq (,$(filter ng_pktbuf_%, $(USEMODULE)))
|
||||
USEMODULE += ng_pktbuf_static
|
||||
ifneq (,$(filter gnrc_pktbuf, $(USEMODULE)))
|
||||
ifeq (,$(filter gnrc_pktbuf_%, $(USEMODULE)))
|
||||
USEMODULE += gnrc_pktbuf_static
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_pktbuf_%, $(USEMODULE)))
|
||||
USEMODULE += ng_pktbuf # make MODULE_NG_PKTBUF macro available for all implementations
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_slip,$(USEMODULE)))
|
||||
USEMODULE += gnrc
|
||||
ifneq (,$(filter gnrc_pktbuf_%, $(USEMODULE)))
|
||||
USEMODULE += gnrc_pktbuf # make MODULE_GNRC_PKTBUF macro available for all implementations
|
||||
endif
|
||||
|
||||
ifneq (,$(filter uart0,$(USEMODULE)))
|
||||
|
@ -268,8 +243,16 @@ ifneq (,$(filter newlib,$(USEMODULE)))
|
|||
USEMODULE += uart_stdio
|
||||
endif
|
||||
|
||||
ifneq (,$(filter ng_netdev_eth,$(USEMODULE)))
|
||||
USEMODULE += ng_pktbuf
|
||||
ifneq (,$(filter gnrc_netdev_eth,$(USEMODULE)))
|
||||
USEMODULE += gnrc_pktbuf
|
||||
endif
|
||||
|
||||
ifneq (,$(filter gnrc,$(USEMODULE)))
|
||||
USEMODULE += gnrc_netapi
|
||||
USEMODULE += gnrc_netreg
|
||||
USEMODULE += gnrc_netif
|
||||
USEMODULE += gnrc_netif_hdr
|
||||
USEMODULE += gnrc_pktbuf
|
||||
endif
|
||||
|
||||
ifneq (,$(filter hih6130,$(USEMODULE)))
|
||||
|
|
|
@ -134,10 +134,10 @@ include $(RIOTBOARD)/$(BOARD)/Makefile.include
|
|||
include $(RIOTCPU)/$(CPU)/Makefile.include
|
||||
|
||||
# get number of interfaces straight before resolving dependencies
|
||||
NG_NETIF_NUMOF ?= 1
|
||||
GNRC_NETIF_NUMOF ?= 1
|
||||
|
||||
ifneq ($(NG_NETIF_NUMOF),1)
|
||||
CFLAGS += -DNG_NETIF_NUMOF=$(NG_NETIF_NUMOF)
|
||||
ifneq ($(GNRC_NETIF_NUMOF),1)
|
||||
CFLAGS += -DGNRC_NETIF_NUMOF=$(GNRC_NETIF_NUMOF)
|
||||
endif
|
||||
|
||||
include $(RIOTBASE)/Makefile.dep
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
PSEUDOMODULES += ng_netif_default
|
||||
PSEUDOMODULES += gnrc_netif_default
|
||||
PSEUDOMODULES += gnrc_ipv6_default
|
||||
PSEUDOMODULES += gnrc_ipv6_router
|
||||
PSEUDOMODULES += gnrc_ipv6_router_default
|
||||
PSEUDOMODULES += gnrc_sixlowpan_default
|
||||
PSEUDOMODULES += gnrc_pktbuf
|
||||
PSEUDOMODULES += ieee802154
|
||||
PSEUDOMODULES += ng_ipv6_default
|
||||
PSEUDOMODULES += ng_ipv6_router
|
||||
PSEUDOMODULES += ng_ipv6_router_default
|
||||
PSEUDOMODULES += pktqueue
|
||||
PSEUDOMODULES += ng_pktbuf
|
||||
PSEUDOMODULES += newlib
|
||||
PSEUDOMODULES += ng_sixlowpan_default
|
||||
PSEUDOMODULES += log
|
||||
PSEUDOMODULES += log_printfnoformat
|
||||
PSEUDOMODULES += newlib
|
||||
PSEUDOMODULES += pktqueue
|
||||
|
||||
# include variants of the AT86RF2xx drivers as pseudo modules
|
||||
PSEUDOMODULES += at86rf23%
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
ifneq (,$(filter ng_netif_default,$(USEMODULE)))
|
||||
ifneq (,$(filter gnrc_netif_default,$(USEMODULE)))
|
||||
USEMODULE += at86rf231
|
||||
USEMODULE += ng_nomac
|
||||
USEMODULE += gnrc_nomac
|
||||
endif
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
ifneq (,$(filter ng_netif_default,$(USEMODULE)))
|
||||
ifneq (,$(filter gnrc_netif_default,$(USEMODULE)))
|
||||
USEMODULE += at86rf212b
|
||||
USEMODULE += ng_nomac
|
||||
USEMODULE += gnrc_nomac
|
||||
endif
|
||||
|
||||
# The RTT clock drives the core clock in the default configuration
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
ifneq (,$(filter ng_netif_default,$(USEMODULE)))
|
||||
ifneq (,$(filter gnrc_netif_default,$(USEMODULE)))
|
||||
USEMODULE += dev_eth_tap
|
||||
USEMODULE += ng_netdev_eth
|
||||
USEMODULE += ng_nomac
|
||||
USEMODULE += gnrc_netdev_eth
|
||||
USEMODULE += gnrc_nomac
|
||||
endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
ifneq (,$(filter ng_netif_default,$(USEMODULE)))
|
||||
ifneq (,$(filter gnrc_netif_default,$(USEMODULE)))
|
||||
USEMODULE += kw2xrf
|
||||
USEMODULE += ng_nomac
|
||||
USEMODULE += gnrc_nomac
|
||||
endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
ifneq (,$(filter ng_netif_default,$(USEMODULE)))
|
||||
ifneq (,$(filter gnrc_netif_default,$(USEMODULE)))
|
||||
USEMODULE += at86rf233
|
||||
USEMODULE += ng_nomac
|
||||
USEMODULE += gnrc_nomac
|
||||
endif
|
||||
|
|
|
@ -31,8 +31,8 @@ extern "C" {
|
|||
#define UART0_BUFSIZE (32)
|
||||
#endif
|
||||
|
||||
#ifndef NG_PKTBUF_SIZE
|
||||
#define NG_PKTBUF_SIZE (2560) /* TODO: Make this value
|
||||
#ifndef GNRC_PKTBUF_SIZE
|
||||
#define GNRC_PKTBUF_SIZE (2560) /* TODO: Make this value
|
||||
* overall MTU dependent */
|
||||
#endif
|
||||
/** @} */
|
||||
|
|
|
@ -109,14 +109,14 @@ static int _recv(dev_eth_t *dev_eth, char *buf, int len) {
|
|||
dev_eth_tap_t *dev = (dev_eth_tap_t*)dev_eth;
|
||||
|
||||
int nread = real_read(dev->tap_fd, buf, len);
|
||||
DEBUG("ng_tapnet: read %d bytes\n", nread);
|
||||
DEBUG("gnrc_tapnet: read %d bytes\n", nread);
|
||||
|
||||
if (nread > 0) {
|
||||
ethernet_hdr_t *hdr = (ethernet_hdr_t *)buf;
|
||||
if (!(dev->promiscous) && !_is_addr_multicast(hdr->dst) &&
|
||||
!_is_addr_broadcast(hdr->dst) &&
|
||||
(memcmp(hdr->dst, dev->addr, ETHERNET_ADDR_LEN) != 0)) {
|
||||
DEBUG("ng_eth_dev: received for %02x:%02x:%02x:%02x:%02x:%02x\n"
|
||||
DEBUG("gnrc_eth_dev: received for %02x:%02x:%02x:%02x:%02x:%02x\n"
|
||||
"That's not me => Dropped\n",
|
||||
hdr->dst[0], hdr->dst[1], hdr->dst[2],
|
||||
hdr->dst[3], hdr->dst[4], hdr->dst[5]);
|
||||
|
@ -255,7 +255,7 @@ static int _init(dev_eth_t *ethdev)
|
|||
/* change mac addr so it differs from what the host is using */
|
||||
dev->addr[5]++;
|
||||
#endif
|
||||
DEBUG("ng_tapnet_init(): dev->addr = %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
DEBUG("gnrc_tapnet_init(): dev->addr = %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
dev->addr[0], dev->addr[1], dev->addr[2],
|
||||
dev->addr[3], dev->addr[4], dev->addr[5]);
|
||||
/* configure signal handler for fds */
|
||||
|
@ -267,14 +267,14 @@ static int _init(dev_eth_t *ethdev)
|
|||
#else
|
||||
/* configure fds to send signals on io */
|
||||
if (fcntl(dev->tap_fd, F_SETOWN, _native_pid) == -1) {
|
||||
err(EXIT_FAILURE, "ng_tapnet_init(): fcntl(F_SETOWN)");
|
||||
err(EXIT_FAILURE, "gnrc_tapnet_init(): fcntl(F_SETOWN)");
|
||||
}
|
||||
/* set file access mode to non-blocking */
|
||||
if (fcntl(dev->tap_fd, F_SETFL, O_NONBLOCK | O_ASYNC) == -1) {
|
||||
err(EXIT_FAILURE, "ng_tabnet_init(): fcntl(F_SETFL)");
|
||||
err(EXIT_FAILURE, "gnrc_tabnet_init(): fcntl(F_SETFL)");
|
||||
}
|
||||
#endif /* not OSX */
|
||||
DEBUG("ng_tapnet: initialized.\n");
|
||||
DEBUG("gnrc_tapnet: initialized.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ static void _cleanup(dev_eth_t *ethdev)
|
|||
}
|
||||
|
||||
#ifdef __MACH__
|
||||
static void _sigio_child(ng_tapnet_t *dev)
|
||||
static void _sigio_child(gnrc_tapnet_t *dev)
|
||||
{
|
||||
pid_t parent = _native_pid;
|
||||
if ((_sigio_child_pid = real_fork()) == -1) {
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#ifndef NRFMIN_H_
|
||||
#define NRFMIN_H_
|
||||
|
||||
#include "net/ng_netdev.h"
|
||||
#include "net/gnrc/netdev.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -79,7 +79,7 @@ extern "C" {
|
|||
/**
|
||||
* @brief Reference to the netdev driver interface
|
||||
*/
|
||||
extern const ng_netdev_driver_t nrfmin_driver;
|
||||
extern const gnrc_netdev_driver_t nrfmin_driver;
|
||||
|
||||
/**
|
||||
* @brief Initialize the NRF51822 radio
|
||||
|
@ -91,7 +91,7 @@ extern const ng_netdev_driver_t nrfmin_driver;
|
|||
* @return 0 on success
|
||||
* @return -ENODEV if @p dev is invalid
|
||||
*/
|
||||
int nrfmin_init(ng_netdev_t *dev);
|
||||
int nrfmin_init(gnrc_netdev_t *dev);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ typedef struct __attribute__((packed)) {
|
|||
/**
|
||||
* @brief Pointer to the MAC layer event callback
|
||||
*/
|
||||
static ng_netdev_t *_netdev = NULL;
|
||||
static gnrc_netdev_t *_netdev = NULL;
|
||||
|
||||
/**
|
||||
* @brief Current state of the device
|
||||
|
@ -142,39 +142,39 @@ static volatile int _rx_next = 0;
|
|||
/*
|
||||
* Create an internal mapping between NETTYPE and NRFTYPE
|
||||
*/
|
||||
static inline ng_nettype_t _nrftype_to_nettype(uint8_t nrftype)
|
||||
static inline gnrc_nettype_t _nrftype_to_nettype(uint8_t nrftype)
|
||||
{
|
||||
switch (nrftype) {
|
||||
#ifdef MODULE_NG_SIXLOWPAN
|
||||
#ifdef MODULE_GNRC_SIXLOWPAN
|
||||
case NRFTYPE_SIXLOWPAN:
|
||||
return NG_NETTYPE_SIXLOWPAN;
|
||||
return GNRC_NETTYPE_SIXLOWPAN;
|
||||
#endif
|
||||
#ifdef MODULE_NG_IPV6
|
||||
#ifdef MODULE_GNRC_IPV6
|
||||
case NRFTYPE_IPV6:
|
||||
return NG_NETTYPE_IPV6;
|
||||
return GNRC_NETTYPE_IPV6;
|
||||
#endif
|
||||
#ifdef MODULE_NG_ICMPV6
|
||||
#ifdef MODULE_GNRC_ICMPV6
|
||||
case NRFTYPE_ICMPV6:
|
||||
return NG_NETTYPE_ICMPV6;
|
||||
return GNRC_NETTYPE_ICMPV6;
|
||||
#endif
|
||||
default:
|
||||
return NG_NETTYPE_UNDEF;
|
||||
return GNRC_NETTYPE_UNDEF;
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint8_t _nettype_to_nrftype(ng_nettype_t nettype)
|
||||
static inline uint8_t _nettype_to_nrftype(gnrc_nettype_t nettype)
|
||||
{
|
||||
switch (nettype) {
|
||||
#ifdef MODULE_NG_SIXLOWPAN
|
||||
case NG_NETTYPE_SIXLOWPAN:
|
||||
#ifdef MODULE_GNRC_SIXLOWPAN
|
||||
case GNRC_NETTYPE_SIXLOWPAN:
|
||||
return NRFTYPE_SIXLOWPAN;
|
||||
#endif
|
||||
#ifdef MODULE_NG_IPV6
|
||||
case NG_NETTYPE_IPV6:
|
||||
#ifdef MODULE_GNRC_IPV6
|
||||
case GNRC_NETTYPE_IPV6:
|
||||
return NRFTYPE_IPV6;
|
||||
#endif
|
||||
#ifdef MODULE_NG_ICMPV6
|
||||
case NG_NETTYPE_ICMPV6:
|
||||
#ifdef MODULE_GNRC_ICMPV6
|
||||
case GNRC_NETTYPE_ICMPV6:
|
||||
return NRFTYPE_ICMPV6;
|
||||
#endif
|
||||
default:
|
||||
|
@ -437,7 +437,7 @@ void isr_radio(void)
|
|||
if (NRF_RADIO->CRCSTATUS != 1) {
|
||||
return;
|
||||
}
|
||||
msg.type = NG_NETDEV_MSG_TYPE_EVENT;
|
||||
msg.type = GNRC_NETDEV_MSG_TYPE_EVENT;
|
||||
msg.content.value = ISR_EVENT_RX_DONE;
|
||||
msg_send_int(&msg, _netdev->mac_pid);
|
||||
/* switch buffer */
|
||||
|
@ -466,10 +466,10 @@ void isr_radio(void)
|
|||
static void _receive_data(void)
|
||||
{
|
||||
packet_t *data;
|
||||
ng_pktsnip_t *pkt_head;
|
||||
ng_pktsnip_t *pkt;
|
||||
ng_netif_hdr_t *hdr;
|
||||
ng_nettype_t nettype;
|
||||
gnrc_pktsnip_t *pkt_head;
|
||||
gnrc_pktsnip_t *pkt;
|
||||
gnrc_netif_hdr_t *hdr;
|
||||
gnrc_nettype_t nettype;
|
||||
|
||||
/* only read data if we have somewhere to send it to */
|
||||
if (_netdev->event_cb == NULL) {
|
||||
|
@ -480,24 +480,24 @@ static void _receive_data(void)
|
|||
data = &(_rx_buf[_rx_next ^ 1]);
|
||||
|
||||
/* allocate and fill netif header */
|
||||
pkt_head = ng_pktbuf_add(NULL, NULL, sizeof(ng_netif_hdr_t) + 4,
|
||||
NG_NETTYPE_UNDEF);
|
||||
pkt_head = gnrc_pktbuf_add(NULL, NULL, sizeof(gnrc_netif_hdr_t) + 4,
|
||||
GNRC_NETTYPE_UNDEF);
|
||||
if (pkt_head == NULL) {
|
||||
DEBUG("nrfmin: Error allocating netif header on RX\n");
|
||||
return;
|
||||
}
|
||||
hdr = (ng_netif_hdr_t *)pkt_head->data;
|
||||
ng_netif_hdr_init(hdr, 2, 2);
|
||||
hdr = (gnrc_netif_hdr_t *)pkt_head->data;
|
||||
gnrc_netif_hdr_init(hdr, 2, 2);
|
||||
hdr->if_pid = _netdev->mac_pid;
|
||||
ng_netif_hdr_set_src_addr(hdr, data->src_addr, 2);
|
||||
ng_netif_hdr_set_dst_addr(hdr, data->dst_addr, 2);
|
||||
gnrc_netif_hdr_set_src_addr(hdr, data->src_addr, 2);
|
||||
gnrc_netif_hdr_set_dst_addr(hdr, data->dst_addr, 2);
|
||||
|
||||
/* allocate and fill payload */
|
||||
nettype = _nrftype_to_nettype(data->proto);
|
||||
pkt = ng_pktbuf_add(pkt_head, data->payload, data->length - 6, nettype);
|
||||
pkt = gnrc_pktbuf_add(pkt_head, data->payload, data->length - 6, nettype);
|
||||
if (pkt == NULL) {
|
||||
DEBUG("nrfmin: Error allocating packet payload on RX\n");
|
||||
ng_pktbuf_release(pkt_head);
|
||||
gnrc_pktbuf_release(pkt_head);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -508,7 +508,7 @@ static void _receive_data(void)
|
|||
/*
|
||||
* Public interface functions
|
||||
*/
|
||||
int nrfmin_init(ng_netdev_t *dev)
|
||||
int nrfmin_init(gnrc_netdev_t *dev)
|
||||
{
|
||||
uint8_t cpuid[CPUID_ID_LEN];
|
||||
uint8_t tmp;
|
||||
|
@ -576,14 +576,14 @@ int nrfmin_init(ng_netdev_t *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int _send(ng_netdev_t *dev, ng_pktsnip_t *pkt)
|
||||
int _send(gnrc_netdev_t *dev, gnrc_pktsnip_t *pkt)
|
||||
{
|
||||
(void)dev;
|
||||
size_t size;
|
||||
size_t pos = 0;
|
||||
uint8_t *dst_addr;
|
||||
ng_netif_hdr_t *hdr;
|
||||
ng_pktsnip_t *payload;
|
||||
gnrc_netif_hdr_t *hdr;
|
||||
gnrc_pktsnip_t *payload;
|
||||
|
||||
/* check packet */
|
||||
if (pkt == NULL || pkt->next == NULL) {
|
||||
|
@ -592,20 +592,20 @@ int _send(ng_netdev_t *dev, ng_pktsnip_t *pkt)
|
|||
}
|
||||
|
||||
/* check if payload is withing length bounds */
|
||||
size = ng_pkt_len(pkt->next);
|
||||
size = gnrc_pkt_len(pkt->next);
|
||||
if (size > CONF_PAYLOAD_LEN) {
|
||||
ng_pktbuf_release(pkt);
|
||||
gnrc_pktbuf_release(pkt);
|
||||
DEBUG("nrfmin: Error sending packet: payload to large\n");
|
||||
return -EOVERFLOW;
|
||||
}
|
||||
/* get netif header and check address length */
|
||||
hdr = (ng_netif_hdr_t *)pkt->data;
|
||||
hdr = (gnrc_netif_hdr_t *)pkt->data;
|
||||
if (hdr->dst_l2addr_len != 2) {
|
||||
DEBUG("nrfmin: Error sending packet: dest address has invalid size\n");
|
||||
ng_pktbuf_release(pkt);
|
||||
gnrc_pktbuf_release(pkt);
|
||||
return -ENOMSG;
|
||||
}
|
||||
dst_addr = ng_netif_hdr_get_dst_addr(hdr);
|
||||
dst_addr = gnrc_netif_hdr_get_dst_addr(hdr);
|
||||
|
||||
DEBUG("nrfmin: Sending packet to %02x:%02x - size %u\n",
|
||||
dst_addr[0], dst_addr[1], size);
|
||||
|
@ -640,11 +640,11 @@ int _send(ng_netdev_t *dev, ng_pktsnip_t *pkt)
|
|||
NRF_RADIO->TASKS_TXEN = 1;
|
||||
|
||||
/* release packet */
|
||||
ng_pktbuf_release(pkt);
|
||||
gnrc_pktbuf_release(pkt);
|
||||
return (int)size;
|
||||
}
|
||||
|
||||
int _add_event_cb(ng_netdev_t *dev, ng_netdev_event_cb_t cb)
|
||||
int _add_event_cb(gnrc_netdev_t *dev, gnrc_netdev_event_cb_t cb)
|
||||
{
|
||||
if (dev->event_cb != NULL) {
|
||||
return -ENOBUFS;
|
||||
|
@ -653,7 +653,7 @@ int _add_event_cb(ng_netdev_t *dev, ng_netdev_event_cb_t cb)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int _rem_event_cb(ng_netdev_t *dev, ng_netdev_event_cb_t cb)
|
||||
int _rem_event_cb(gnrc_netdev_t *dev, gnrc_netdev_event_cb_t cb)
|
||||
{
|
||||
if (dev->event_cb == cb) {
|
||||
dev->event_cb = NULL;
|
||||
|
@ -662,7 +662,7 @@ int _rem_event_cb(ng_netdev_t *dev, ng_netdev_event_cb_t cb)
|
|||
return -ENOENT;
|
||||
}
|
||||
|
||||
int _get(ng_netdev_t *dev, netopt_t opt, void *value, size_t max_len)
|
||||
int _get(gnrc_netdev_t *dev, netopt_t opt, void *value, size_t max_len)
|
||||
{
|
||||
(void)dev;
|
||||
|
||||
|
@ -682,7 +682,7 @@ int _get(ng_netdev_t *dev, netopt_t opt, void *value, size_t max_len)
|
|||
}
|
||||
}
|
||||
|
||||
int _set(ng_netdev_t *dev, netopt_t opt, void *value, size_t value_len)
|
||||
int _set(gnrc_netdev_t *dev, netopt_t opt, void *value, size_t value_len)
|
||||
{
|
||||
(void)dev;
|
||||
|
||||
|
@ -702,7 +702,7 @@ int _set(ng_netdev_t *dev, netopt_t opt, void *value, size_t value_len)
|
|||
}
|
||||
}
|
||||
|
||||
void _isr_event(ng_netdev_t *dev, uint32_t event_type)
|
||||
void _isr_event(gnrc_netdev_t *dev, uint32_t event_type)
|
||||
{
|
||||
switch (event_type) {
|
||||
case ISR_EVENT_RX_DONE:
|
||||
|
@ -717,7 +717,7 @@ void _isr_event(ng_netdev_t *dev, uint32_t event_type)
|
|||
/*
|
||||
* Mapping of netdev interface
|
||||
*/
|
||||
const ng_netdev_driver_t nrfmin_driver = {
|
||||
const gnrc_netdev_driver_t nrfmin_driver = {
|
||||
.send_data = _send,
|
||||
.add_event_callback = _add_event_cb,
|
||||
.rem_event_callback = _rem_event_cb,
|
||||
|
|
|
@ -8,7 +8,7 @@ nodes. It is primarily designed for sniffing wireless data traffic, but can also
|
|||
well be used for wired network traffic, as long as the used network devices
|
||||
support promiscuous mode and output of raw data.
|
||||
|
||||
The sniffer is based on a RIOT node running the [sniffer application](https://github.com/RIOT-OS/applications/tree/master/ng_sniffer) application located in [RIOTs application repository](https://github.com/RIOT-OS/applications).
|
||||
The sniffer is based on a RIOT node running the [sniffer application](https://github.com/RIOT-OS/applications/tree/master/sniffer) application located in [RIOTs application repository](https://github.com/RIOT-OS/applications).
|
||||
This node outputs received network traffic via a serial port in the Wireshark
|
||||
pcap format. This output is then parsed by the `sniffer.py` script included
|
||||
in this folder run on a host computer.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Creating a SLIP network interface
|
||||
=================================
|
||||
|
||||
The module `ng_slip` (Serial line IP) enables the RIOT network stack to
|
||||
The module `gnrc_slip` (Serial line IP) enables the RIOT network stack to
|
||||
communicate IP packets over the serial interface. This collection of tools
|
||||
originally from Contiki [1] enables Linux to interpret this data. Though there
|
||||
is a tool for such operations on Linux (`slattach`) it is only able to handle
|
||||
|
|
|
@ -45,7 +45,7 @@ static void _irq_handler(void *arg)
|
|||
at86rf2xx_t *dev = (at86rf2xx_t *) arg;
|
||||
|
||||
/* tell driver thread about the interrupt */
|
||||
msg.type = NG_NETDEV_MSG_TYPE_EVENT;
|
||||
msg.type = GNRC_NETDEV_MSG_TYPE_EVENT;
|
||||
msg_send(&msg, dev->mac_pid);
|
||||
}
|
||||
|
||||
|
@ -143,10 +143,10 @@ void at86rf2xx_reset(at86rf2xx_t *dev)
|
|||
at86rf2xx_set_option(dev, AT86RF2XX_OPT_TELL_RX_START, false);
|
||||
at86rf2xx_set_option(dev, AT86RF2XX_OPT_TELL_RX_END, true);
|
||||
/* set default protocol */
|
||||
#ifdef MODULE_NG_SIXLOWPAN
|
||||
dev->proto = NG_NETTYPE_SIXLOWPAN;
|
||||
#ifdef MODULE_GNRC_SIXLOWPAN
|
||||
dev->proto = GNRC_NETTYPE_SIXLOWPAN;
|
||||
#else
|
||||
dev->proto = NG_NETTYPE_UNDEF;
|
||||
dev->proto = GNRC_NETTYPE_UNDEF;
|
||||
#endif
|
||||
/* enable safe mode (protect RX FIFO until reading data starts) */
|
||||
at86rf2xx_reg_write(dev, AT86RF2XX_REG__TRX_CTRL_2,
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
/* TODO: generalize and move to (gnrc_)ieee802154 */
|
||||
static size_t _make_data_frame_hdr(at86rf2xx_t *dev, uint8_t *buf,
|
||||
ng_netif_hdr_t *hdr)
|
||||
gnrc_netif_hdr_t *hdr)
|
||||
{
|
||||
int pos = 0;
|
||||
|
||||
|
@ -43,8 +43,8 @@ static size_t _make_data_frame_hdr(at86rf2xx_t *dev, uint8_t *buf,
|
|||
buf[1] = IEEE802154_FCF_VERS_V1;
|
||||
|
||||
/* if AUTOACK is enabled, then we also expect ACKs for this packet */
|
||||
if (!(hdr->flags & NG_NETIF_HDR_FLAGS_BROADCAST) &&
|
||||
!(hdr->flags & NG_NETIF_HDR_FLAGS_MULTICAST) &&
|
||||
if (!(hdr->flags & GNRC_NETIF_HDR_FLAGS_BROADCAST) &&
|
||||
!(hdr->flags & GNRC_NETIF_HDR_FLAGS_MULTICAST) &&
|
||||
(dev->options & AT86RF2XX_OPT_AUTOACK)) {
|
||||
buf[0] |= IEEE802154_FCF_ACK_REQ;
|
||||
}
|
||||
|
@ -56,20 +56,20 @@ static size_t _make_data_frame_hdr(at86rf2xx_t *dev, uint8_t *buf,
|
|||
|
||||
/* fill in destination address */
|
||||
if (hdr->flags &
|
||||
(NG_NETIF_HDR_FLAGS_BROADCAST | NG_NETIF_HDR_FLAGS_MULTICAST)) {
|
||||
(GNRC_NETIF_HDR_FLAGS_BROADCAST | GNRC_NETIF_HDR_FLAGS_MULTICAST)) {
|
||||
buf[1] |= IEEE802154_FCF_DST_ADDR_SHORT;
|
||||
buf[pos++] = 0xff;
|
||||
buf[pos++] = 0xff;
|
||||
}
|
||||
else if (hdr->dst_l2addr_len == 2) {
|
||||
uint8_t *dst_addr = ng_netif_hdr_get_dst_addr(hdr);
|
||||
uint8_t *dst_addr = gnrc_netif_hdr_get_dst_addr(hdr);
|
||||
buf[1] |= IEEE802154_FCF_DST_ADDR_SHORT;
|
||||
buf[pos++] = dst_addr[1];
|
||||
buf[pos++] = dst_addr[0];
|
||||
}
|
||||
else if (hdr->dst_l2addr_len == 8) {
|
||||
buf[1] |= IEEE802154_FCF_DST_ADDR_LONG;
|
||||
uint8_t *dst_addr = ng_netif_hdr_get_dst_addr(hdr);
|
||||
uint8_t *dst_addr = gnrc_netif_hdr_get_dst_addr(hdr);
|
||||
for (int i = 7; i >= 0; i--) {
|
||||
buf[pos++] = dst_addr[i];
|
||||
}
|
||||
|
@ -142,13 +142,13 @@ static size_t _get_frame_hdr_len(uint8_t *mhr)
|
|||
}
|
||||
|
||||
/* TODO: generalize and move to (gnrc_)ieee802154 */
|
||||
static ng_pktsnip_t *_make_netif_hdr(uint8_t *mhr)
|
||||
static gnrc_pktsnip_t *_make_netif_hdr(uint8_t *mhr)
|
||||
{
|
||||
uint8_t tmp;
|
||||
uint8_t *addr;
|
||||
uint8_t src_len, dst_len;
|
||||
ng_pktsnip_t *snip;
|
||||
ng_netif_hdr_t *hdr;
|
||||
gnrc_pktsnip_t *snip;
|
||||
gnrc_netif_hdr_t *hdr;
|
||||
|
||||
/* figure out address sizes */
|
||||
tmp = mhr[1] & IEEE802154_FCF_SRC_ADDR_MASK;
|
||||
|
@ -178,17 +178,17 @@ static ng_pktsnip_t *_make_netif_hdr(uint8_t *mhr)
|
|||
return NULL;
|
||||
}
|
||||
/* allocate space for header */
|
||||
snip = ng_pktbuf_add(NULL, NULL, sizeof(ng_netif_hdr_t) + src_len + dst_len,
|
||||
NG_NETTYPE_NETIF);
|
||||
snip = gnrc_pktbuf_add(NULL, NULL, sizeof(gnrc_netif_hdr_t) + src_len + dst_len,
|
||||
GNRC_NETTYPE_NETIF);
|
||||
if (snip == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
/* fill header */
|
||||
hdr = (ng_netif_hdr_t *)snip->data;
|
||||
ng_netif_hdr_init(hdr, src_len, dst_len);
|
||||
hdr = (gnrc_netif_hdr_t *)snip->data;
|
||||
gnrc_netif_hdr_init(hdr, src_len, dst_len);
|
||||
if (dst_len > 0) {
|
||||
tmp = 5 + dst_len;
|
||||
addr = ng_netif_hdr_get_dst_addr(hdr);
|
||||
addr = gnrc_netif_hdr_get_dst_addr(hdr);
|
||||
for (int i = 0; i < dst_len; i++) {
|
||||
addr[i] = mhr[5 + (dst_len - i) - 1];
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ static ng_pktsnip_t *_make_netif_hdr(uint8_t *mhr)
|
|||
tmp += 2;
|
||||
}
|
||||
if (src_len > 0) {
|
||||
addr = ng_netif_hdr_get_src_addr(hdr);
|
||||
addr = gnrc_netif_hdr_get_src_addr(hdr);
|
||||
for (int i = 0; i < src_len; i++) {
|
||||
addr[i] = mhr[tmp + (src_len - i) - 1];
|
||||
}
|
||||
|
@ -209,10 +209,10 @@ static ng_pktsnip_t *_make_netif_hdr(uint8_t *mhr)
|
|||
}
|
||||
|
||||
|
||||
static int _send(ng_netdev_t *netdev, ng_pktsnip_t *pkt)
|
||||
static int _send(gnrc_netdev_t *netdev, gnrc_pktsnip_t *pkt)
|
||||
{
|
||||
at86rf2xx_t *dev = (at86rf2xx_t *)netdev;
|
||||
ng_pktsnip_t *snip;
|
||||
gnrc_pktsnip_t *snip;
|
||||
uint8_t mhr[IEEE802154_MAX_HDR_LEN];
|
||||
size_t len;
|
||||
|
||||
|
@ -220,23 +220,23 @@ static int _send(ng_netdev_t *netdev, ng_pktsnip_t *pkt)
|
|||
return -ENOMSG;
|
||||
}
|
||||
if (dev == NULL) {
|
||||
ng_pktbuf_release(pkt);
|
||||
gnrc_pktbuf_release(pkt);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* create 802.15.4 header */
|
||||
len = _make_data_frame_hdr(dev, mhr, (ng_netif_hdr_t *)pkt->data);
|
||||
len = _make_data_frame_hdr(dev, mhr, (gnrc_netif_hdr_t *)pkt->data);
|
||||
if (len == 0) {
|
||||
DEBUG("[at86rf2xx] error: unable to create 802.15.4 header\n");
|
||||
ng_pktbuf_release(pkt);
|
||||
gnrc_pktbuf_release(pkt);
|
||||
return -ENOMSG;
|
||||
}
|
||||
/* check if packet (header + payload + FCS) fits into FIFO */
|
||||
snip = pkt->next;
|
||||
if ((ng_pkt_len(snip) + len + 2) > AT86RF2XX_MAX_PKT_LENGTH) {
|
||||
if ((gnrc_pkt_len(snip) + len + 2) > AT86RF2XX_MAX_PKT_LENGTH) {
|
||||
printf("[at86rf2xx] error: packet too large (%u byte) to be send\n",
|
||||
ng_pkt_len(snip) + len + 2);
|
||||
ng_pktbuf_release(pkt);
|
||||
gnrc_pkt_len(snip) + len + 2);
|
||||
gnrc_pktbuf_release(pkt);
|
||||
return -EOVERFLOW;
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ static int _send(ng_netdev_t *netdev, ng_pktsnip_t *pkt)
|
|||
at86rf2xx_tx_exec(dev);
|
||||
}
|
||||
/* release packet */
|
||||
ng_pktbuf_release(pkt);
|
||||
gnrc_pktbuf_release(pkt);
|
||||
/* return the number of bytes that were actually send out */
|
||||
return (int)len;
|
||||
}
|
||||
|
@ -262,8 +262,8 @@ static void _receive_data(at86rf2xx_t *dev)
|
|||
{
|
||||
uint8_t mhr[IEEE802154_MAX_HDR_LEN];
|
||||
size_t pkt_len, hdr_len;
|
||||
ng_pktsnip_t *hdr, *payload = NULL;
|
||||
ng_netif_hdr_t *netif;
|
||||
gnrc_pktsnip_t *hdr, *payload = NULL;
|
||||
gnrc_netif_hdr_t *netif;
|
||||
|
||||
/* get the size of the received packet (unlocks frame buffer protection) */
|
||||
pkt_len = at86rf2xx_rx_len(dev);
|
||||
|
@ -275,7 +275,7 @@ static void _receive_data(at86rf2xx_t *dev)
|
|||
|
||||
/* in raw mode, just read the binary dump into the packet buffer */
|
||||
if (dev->options & AT86RF2XX_OPT_RAWDUMP) {
|
||||
payload = ng_pktbuf_add(NULL, NULL, pkt_len, NG_NETTYPE_UNDEF);
|
||||
payload = gnrc_pktbuf_add(NULL, NULL, pkt_len, GNRC_NETTYPE_UNDEF);
|
||||
if (payload == NULL ) {
|
||||
DEBUG("[at86rf2xx] error: unable to allocate RAW data\n");
|
||||
return;
|
||||
|
@ -300,16 +300,16 @@ static void _receive_data(at86rf2xx_t *dev)
|
|||
return;
|
||||
}
|
||||
/* fill missing fields in netif header */
|
||||
netif = (ng_netif_hdr_t *)hdr->data;
|
||||
netif = (gnrc_netif_hdr_t *)hdr->data;
|
||||
netif->if_pid = dev->mac_pid;
|
||||
at86rf2xx_rx_read(dev, &(netif->lqi), 1, pkt_len);
|
||||
netif->rssi = at86rf2xx_reg_read(dev, AT86RF2XX_REG__PHY_ED_LEVEL);
|
||||
|
||||
/* allocate payload */
|
||||
payload = ng_pktbuf_add(hdr, NULL, (pkt_len - hdr_len), dev->proto);
|
||||
payload = gnrc_pktbuf_add(hdr, NULL, (pkt_len - hdr_len), dev->proto);
|
||||
if (payload == NULL) {
|
||||
DEBUG("[at86rf2xx] error: unable to allocate incoming payload\n");
|
||||
ng_pktbuf_release(hdr);
|
||||
gnrc_pktbuf_release(hdr);
|
||||
return;
|
||||
}
|
||||
/* copy payload */
|
||||
|
@ -357,7 +357,7 @@ netopt_state_t _get_state(at86rf2xx_t *dev)
|
|||
}
|
||||
}
|
||||
|
||||
static int _get(ng_netdev_t *device, netopt_t opt, void *val, size_t max_len)
|
||||
static int _get(gnrc_netdev_t *device, netopt_t opt, void *val, size_t max_len)
|
||||
{
|
||||
if (device == NULL) {
|
||||
return -ENODEV;
|
||||
|
@ -421,11 +421,11 @@ static int _get(ng_netdev_t *device, netopt_t opt, void *val, size_t max_len)
|
|||
return sizeof(eui64_t);
|
||||
|
||||
case NETOPT_PROTO:
|
||||
if (max_len < sizeof(ng_nettype_t)) {
|
||||
if (max_len < sizeof(gnrc_nettype_t)) {
|
||||
return -EOVERFLOW;
|
||||
}
|
||||
*((ng_nettype_t *)val) = dev->proto;
|
||||
return sizeof(ng_nettype_t);
|
||||
*((gnrc_nettype_t *)val) = dev->proto;
|
||||
return sizeof(gnrc_nettype_t);
|
||||
|
||||
case NETOPT_CHANNEL:
|
||||
if (max_len < sizeof(uint16_t)) {
|
||||
|
@ -535,7 +535,7 @@ static int _get(ng_netdev_t *device, netopt_t opt, void *val, size_t max_len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int _set(ng_netdev_t *device, netopt_t opt, void *val, size_t len)
|
||||
static int _set(gnrc_netdev_t *device, netopt_t opt, void *val, size_t len)
|
||||
{
|
||||
at86rf2xx_t *dev = (at86rf2xx_t *) device;
|
||||
|
||||
|
@ -661,7 +661,7 @@ static int _set(ng_netdev_t *device, netopt_t opt, void *val, size_t len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int _add_event_cb(ng_netdev_t *dev, ng_netdev_event_cb_t cb)
|
||||
static int _add_event_cb(gnrc_netdev_t *dev, gnrc_netdev_event_cb_t cb)
|
||||
{
|
||||
if (dev == NULL) {
|
||||
return -ENODEV;
|
||||
|
@ -674,7 +674,7 @@ static int _add_event_cb(ng_netdev_t *dev, ng_netdev_event_cb_t cb)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int _rem_event_cb(ng_netdev_t *dev, ng_netdev_event_cb_t cb)
|
||||
static int _rem_event_cb(gnrc_netdev_t *dev, gnrc_netdev_event_cb_t cb)
|
||||
{
|
||||
if (dev == NULL) {
|
||||
return -ENODEV;
|
||||
|
@ -687,7 +687,7 @@ static int _rem_event_cb(ng_netdev_t *dev, ng_netdev_event_cb_t cb)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void _isr_event(ng_netdev_t *device, uint32_t event_type)
|
||||
static void _isr_event(gnrc_netdev_t *device, uint32_t event_type)
|
||||
{
|
||||
at86rf2xx_t *dev = (at86rf2xx_t *) device;
|
||||
uint8_t irq_mask;
|
||||
|
@ -720,7 +720,7 @@ static void _isr_event(ng_netdev_t *device, uint32_t event_type)
|
|||
}
|
||||
}
|
||||
|
||||
const ng_netdev_driver_t at86rf2xx_driver = {
|
||||
const gnrc_netdev_driver_t at86rf2xx_driver = {
|
||||
.send_data = _send,
|
||||
.add_event_callback = _add_event_cb,
|
||||
.rem_event_callback = _rem_event_cb,
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#ifndef AT86RF2XX_NETDEV_H_
|
||||
#define AT86RF2XX_NETDEV_H_
|
||||
|
||||
#include "net/ng_netdev.h"
|
||||
#include "net/gnrc/netdev.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -28,7 +28,7 @@ extern "C" {
|
|||
/**
|
||||
* @brief Reference to the netdev device driver struct
|
||||
*/
|
||||
extern const ng_netdev_driver_t at86rf2xx_driver;
|
||||
extern const gnrc_netdev_driver_t at86rf2xx_driver;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "board.h"
|
||||
#include "periph/spi.h"
|
||||
#include "periph/gpio.h"
|
||||
#include "net/ng_netdev.h"
|
||||
#include "net/gnrc/netdev.h"
|
||||
#include "at86rf2xx.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -133,8 +133,8 @@ typedef enum {
|
|||
*/
|
||||
typedef struct {
|
||||
/* netdev fields */
|
||||
const ng_netdev_driver_t *driver; /**< pointer to the devices interface */
|
||||
ng_netdev_event_cb_t event_cb; /**< netdev event callback */
|
||||
const gnrc_netdev_driver_t *driver; /**< pointer to the devices interface */
|
||||
gnrc_netdev_event_cb_t event_cb; /**< netdev event callback */
|
||||
kernel_pid_t mac_pid; /**< the driver's thread's PID */
|
||||
/* device specific fields */
|
||||
spi_t spi; /**< used SPI device */
|
||||
|
@ -142,7 +142,7 @@ typedef struct {
|
|||
gpio_t sleep_pin; /**< sleep pin */
|
||||
gpio_t reset_pin; /**< reset pin */
|
||||
gpio_t int_pin; /**< external interrupt pin */
|
||||
ng_nettype_t proto; /**< protocol the radio expects */
|
||||
gnrc_nettype_t proto; /**< protocol the radio expects */
|
||||
uint8_t state; /**< current state of the radio */
|
||||
uint8_t seq_nr; /**< sequence number to use next */
|
||||
uint8_t frame_len; /**< length of the current TX frame */
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "board.h"
|
||||
#include "periph/spi.h"
|
||||
#include "periph/gpio.h"
|
||||
#include "net/ng_netdev.h"
|
||||
#include "net/gnrc/netdev.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -41,10 +41,10 @@ extern "C" {
|
|||
/**
|
||||
* @brief Default protocol for data that is coming in
|
||||
*/
|
||||
#ifdef MODULE_NG_SIXLOWPAN
|
||||
#define KW2XRF_DEFAULT_PROTOCOL NG_NETTYPE_SIXLOWPAN
|
||||
#ifdef MODULE_GNRC_SIXLOWPAN
|
||||
#define KW2XRF_DEFAULT_PROTOCOL GNRC_NETTYPE_SIXLOWPAN
|
||||
#else
|
||||
#define KW2XRF_DEFAULT_PROTOCOL NG_NETTYPE_UNDEF
|
||||
#define KW2XRF_DEFAULT_PROTOCOL GNRC_NETTYPE_UNDEF
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -104,8 +104,8 @@ extern "C" {
|
|||
*/
|
||||
typedef struct {
|
||||
/* netdev fields */
|
||||
ng_netdev_driver_t const *driver; /**< Pointer to the devices interface */
|
||||
ng_netdev_event_cb_t event_cb; /**< Netdev event callback */
|
||||
gnrc_netdev_driver_t const *driver; /**< Pointer to the devices interface */
|
||||
gnrc_netdev_event_cb_t event_cb; /**< Netdev event callback */
|
||||
kernel_pid_t mac_pid; /**< The driver's thread's PID */
|
||||
/* driver specific fields */
|
||||
uint8_t buf[KW2XRF_MAX_PKT_LENGTH]; /**< Buffer for incoming or outgoing packets */
|
||||
|
@ -117,7 +117,7 @@ typedef struct {
|
|||
uint8_t addr_long[8]; /**< The long address the radio device is using */
|
||||
uint16_t option; /**< Bit field to save enable/disable options */
|
||||
int8_t tx_power; /**< The current tx-power setting of the device */
|
||||
ng_nettype_t proto; /**< Protocol the interface speaks */
|
||||
gnrc_nettype_t proto; /**< Protocol the interface speaks */
|
||||
} kw2xrf_t;
|
||||
|
||||
/**
|
||||
|
@ -147,7 +147,7 @@ typedef struct kw2xrf_params {
|
|||
/**
|
||||
* @brief Reference to the KW2XRF driver interface
|
||||
*/
|
||||
extern const ng_netdev_driver_t kw2xrf_driver;
|
||||
extern const gnrc_netdev_driver_t kw2xrf_driver;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -54,10 +54,10 @@ extern "C" {
|
|||
/**
|
||||
* @brief Default protocol for data that is coming in
|
||||
*/
|
||||
#ifdef MODULE_NG_SIXLOWPAN
|
||||
#define XBEE_DEFAULT_PROTOCOL (NG_NETTYPE_SIXLOWPAN)
|
||||
#ifdef MODULE_GNRC_SIXLOWPAN
|
||||
#define XBEE_DEFAULT_PROTOCOL (GNRC_NETTYPE_SIXLOWPAN)
|
||||
#else
|
||||
#define XBEE_DEFAULT_PROTOCOL (NG_NETTYPE_UNDEF)
|
||||
#define XBEE_DEFAULT_PROTOCOL (GNRC_NETTYPE_UNDEF)
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -108,14 +108,14 @@ typedef enum {
|
|||
*/
|
||||
typedef struct {
|
||||
/* netdev fields */
|
||||
ng_netdev_driver_t const *driver; /**< pointer to the devices interface */
|
||||
ng_netdev_event_cb_t event_cb; /**< netdev event callback */
|
||||
gnrc_netdev_driver_t const *driver; /**< pointer to the devices interface */
|
||||
gnrc_netdev_event_cb_t event_cb; /**< netdev event callback */
|
||||
kernel_pid_t mac_pid; /**< the driver's thread's PID */
|
||||
/* device driver specific fields */
|
||||
uart_t uart; /**< UART interfaced used */
|
||||
gpio_t reset_pin; /**< GPIO pin connected to RESET */
|
||||
gpio_t sleep_pin; /**< GPIO pin connected to SLEEP */
|
||||
ng_nettype_t proto; /**< protocol the interface speaks */
|
||||
gnrc_nettype_t proto; /**< protocol the interface speaks */
|
||||
uint8_t options; /**< options field */
|
||||
uint8_t addr_flags; /**< address flags as defined above */
|
||||
uint8_t addr_short[2]; /**< onw 802.15.4 short address */
|
||||
|
@ -145,7 +145,7 @@ typedef struct {
|
|||
/**
|
||||
* @brief Reference to the XBee driver interface
|
||||
*/
|
||||
extern const ng_netdev_driver_t xbee_driver;
|
||||
extern const gnrc_netdev_driver_t xbee_driver;
|
||||
|
||||
/**
|
||||
* @brief Initialize the given Xbee device
|
||||
|
|
|
@ -278,7 +278,7 @@ void kw2xrf_irq_handler(void *args)
|
|||
kw2xrf_t *dev = (kw2xrf_t *)args;
|
||||
|
||||
/* notify driver thread about the interrupt */
|
||||
msg.type = NG_NETDEV_MSG_TYPE_EVENT;
|
||||
msg.type = GNRC_NETDEV_MSG_TYPE_EVENT;
|
||||
msg_send_int(&msg, dev->mac_pid);
|
||||
}
|
||||
|
||||
|
@ -315,22 +315,22 @@ int kw2xrf_set_pan(kw2xrf_t *dev, uint16_t pan)
|
|||
|
||||
int kw2xrf_get_proto(kw2xrf_t *dev, uint8_t *val, size_t max)
|
||||
{
|
||||
if (max < sizeof(ng_nettype_t)) {
|
||||
if (max < sizeof(gnrc_nettype_t)) {
|
||||
return -EOVERFLOW;
|
||||
}
|
||||
|
||||
memcpy(val, &(dev->proto), sizeof(ng_nettype_t));
|
||||
return sizeof(ng_nettype_t);
|
||||
memcpy(val, &(dev->proto), sizeof(gnrc_nettype_t));
|
||||
return sizeof(gnrc_nettype_t);
|
||||
}
|
||||
|
||||
int kw2xrf_set_proto(kw2xrf_t *dev, uint8_t *val, size_t len)
|
||||
{
|
||||
if (len != sizeof(ng_nettype_t)) {
|
||||
if (len != sizeof(gnrc_nettype_t)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
memcpy(&(dev->proto), val, sizeof(ng_nettype_t));
|
||||
return sizeof(ng_nettype_t);
|
||||
memcpy(&(dev->proto), val, sizeof(gnrc_nettype_t));
|
||||
return sizeof(gnrc_nettype_t);
|
||||
}
|
||||
|
||||
int kw2xrf_on(kw2xrf_t *dev)
|
||||
|
@ -468,7 +468,7 @@ int kw2xrf_init(kw2xrf_t *dev, spi_t spi, spi_speed_t spi_speed,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int kw2xrf_add_cb(ng_netdev_t *dev, ng_netdev_event_cb_t cb)
|
||||
int kw2xrf_add_cb(gnrc_netdev_t *dev, gnrc_netdev_event_cb_t cb)
|
||||
{
|
||||
if (dev == NULL) {
|
||||
return -ENODEV;
|
||||
|
@ -482,7 +482,7 @@ int kw2xrf_add_cb(ng_netdev_t *dev, ng_netdev_event_cb_t cb)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int kw2xrf_rem_cb(ng_netdev_t *dev, ng_netdev_event_cb_t cb)
|
||||
int kw2xrf_rem_cb(gnrc_netdev_t *dev, gnrc_netdev_event_cb_t cb)
|
||||
{
|
||||
if (dev == NULL) {
|
||||
return -ENODEV;
|
||||
|
@ -508,7 +508,7 @@ uint64_t kw2xrf_get_addr_long(kw2xrf_t *dev)
|
|||
return addr;
|
||||
}
|
||||
|
||||
int kw2xrf_get(ng_netdev_t *netdev, netopt_t opt, void *value, size_t max_len)
|
||||
int kw2xrf_get(gnrc_netdev_t *netdev, netopt_t opt, void *value, size_t max_len)
|
||||
{
|
||||
kw2xrf_t *dev = (kw2xrf_t *)netdev;
|
||||
|
||||
|
@ -696,7 +696,7 @@ void kw2xrf_set_option(kw2xrf_t *dev, uint16_t option, bool state)
|
|||
}
|
||||
}
|
||||
|
||||
int kw2xrf_set(ng_netdev_t *netdev, netopt_t opt, void *value, size_t value_len)
|
||||
int kw2xrf_set(gnrc_netdev_t *netdev, netopt_t opt, void *value, size_t value_len)
|
||||
{
|
||||
kw2xrf_t *dev = (kw2xrf_t *)netdev;
|
||||
|
||||
|
@ -849,13 +849,13 @@ static size_t _get_frame_hdr_len(uint8_t *mhr)
|
|||
}
|
||||
|
||||